Click here to Skip to main content
15,895,192 members
Articles / Programming Languages / C#

LightBox Web Gallery Generator

Rate me:
Please Sign up or sign in to vote.
4.79/5 (36 votes)
7 Oct 2007CPOL3 min read 239.4K   2.1K   91  
A program to generate HTML Web Gallery based on the LightBox JS
using System;
using System.Windows.Forms;
using Microsoft.VisualBasic;

namespace GalleryCreator
{
	/// <summary>
	/// Summary description for RegistryWorks.
	/// </summary>
	internal class RegistryWorks
	{
		public const string strAppName = "LightBox Web Gallery Generator 1.1";

		private const string strSection = "Startup";
		public RegistryWorks()
		{
		}

		/// <summary>
		/// Saves or creates an application entry in the Windows registry
		/// </summary>
		/// <param name="strKey"></param>
		/// <param name="strSetting"></param>
		public static void SaveSetting(string strKey, string strSetting)
		{
			Interaction.SaveSetting(strAppName, strSection, strKey, strSetting);
		}
		/// <summary>
		/// Returns a key setting value from an application's entry in the Windows registry
		/// </summary>
		/// <param name="strKey"></param>
		/// <param name="strDefault"></param>
		public static string GetSetting(string strKey, string strDefault)
		{
			return Interaction.GetSetting(strAppName, strSection, strKey, strDefault);
		}
		/// <summary>
		/// Same as GetSetting, but returns int
		/// </summary>
		/// <param name="strKey"></param>
		/// <param name="intDefault"></param>
		/// <returns></returns>
		public static int GetIntSetting(string strKey, int intDefault)
		{
			string strSetting = Interaction.GetSetting(strAppName, strSection, strKey, "");
			if (strSetting.Length > 0)
			{
				try
				{
					return Int32.Parse(strSetting);
				}
				catch
				{
					return intDefault;
				}
			}
			else
				return intDefault;
		}
		/// <summary>
		/// Same as GetSetting, but returns boolean
		/// </summary>
		/// <param name="strKey"></param>
		/// <param name="blnDefault"></param>
		/// <returns></returns>
		public static bool GetBoolSetting(string strKey, bool blnDefault)
		{
			string strSetting = Interaction.GetSetting(strAppName, strSection, strKey, "");
			if (strSetting.Length > 0)
			{
				try
				{
					return Boolean.Parse(strSetting);
				}
				catch
				{
					return blnDefault;
				}
			}
			else
				return blnDefault;
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions