|
// =====================================================================
//
// Savior - Simplify Saving and Restoring Application Settings
//
// by Jim Hollenhorst, jim@ultrapico.com
// Copyright Ultrapico, March 2003
// http://www.ultrapico.com
//
// =====================================================================
using System;
using System.Drawing;
namespace SaveAndRestore
{
/// Settings is the class in which all application settings are stored. This must
/// be customized for each application and multiple such classes may be defined
/// to facilitate more complex scenarios. The suggested name for the class is
/// "Settings", but any name may be used since an instantiation of this class is
/// passed to another class ("Savior") to do the work.
///
/// In order to support binary serialization to a file, the class should be marked
/// with the [Serializable] attribute, as shown here
///
/// All default values should be specified in this class. These will be used if the
/// corresponding information is not found in the registry.
/// <summary>
/// Any data that is desired to be saved should be stored in this class
/// as a public field. It is suggested that most variables be given default
/// values within this class. The class should be defined with the "Serializable"
/// attribute to facilitate file serialization. Properties should not be defined.
/// </summary>
[Serializable]
public class Settings
{
public string Text="Try changing this string!";
public bool Check=true;
public bool Radio=false;
public decimal TheNumber=55;
public Color BackColor=Color.Aqua;
public Point Location = new Point(100,100);
public Size TheSize=new Size(530,435);
public Thing thing = Thing.Frog;
public string[] SomeStrings=
{
"You can't change",
"these but you can",
"check to see if they",
"are being saved and",
"restored properly!"
};
public byte[] SomeBytes={1,2,3,5,7,11,13,17,19,23,29};
public bool[] Truth={false,true,true,false,true};
public string[] Headers={"Type","Name","Age","Master"};
public int[] Orders={0,1,2,3};
public int[] Widths={70,50,50,70};
}
}
|
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.