Beispiel #1
0
        public static KlonsSettings LoadSettings(string filename)
        {
            KlonsSettings settings = new KlonsSettings();

            if (!File.Exists(filename))
            {
                return(settings);
            }
            XmlSerializer xs = null;
            FileStream    fs = null;

            try
            {
                //xs = new XmlSerializer(typeof(KlonsSettings));
                xs       = Utils.CreateDefaultXmlSerializer(typeof(KlonsSettings));
                fs       = new FileStream(filename, FileMode.Open);
                settings = (KlonsSettings)xs.Deserialize(fs);
                return(settings);
            }
            catch (Exception)
            {
                //LogError(e.Message);
                settings = new KlonsSettings();
                return(settings);
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }
Beispiel #2
0
 public void LoadSettings()
 {
     Settings = KlonsSettings.LoadSettings(SettingsFileName);
     KlonsLIB.MyData.Settings = Settings;
 }