public GlobalAppState()
        {
            CTNSettings settings;

            try
            {
                if (File.Exists(PATH_SETTINGS))
                {
                    Log.AddDebug("Loading settings from file", PATH_SETTINGS);

                    settings     = CTNSettings.Load(PATH_SETTINGS);
                    IsFirstStart = false;

                    Log.AddDebug("Settings loaded", settings.Serialize());
                }
                else
                {
                    Log.AddInfo("No settings file found - creating new one");

                    settings = new CTNSettings(PATH_SETTINGS);
                    settings.Save();
                    IsFirstStart = true;
                }

                Settings = settings;
            }
            catch (Exception e)
            {
                Log.AddError("Could not load settings", e);
                Settings = new CTNSettings(PATH_SETTINGS);
            }
        }
Esempio n. 2
0
        public static CTNSettings Deserialize(string xml, string path)
        {
            var r = new CTNSettings(path);

            _serializer.Deserialize(r, xml, CTNXMLSerializer <CTNSettings> .DEFAULT_SERIALIZATION_SETTINGS);
            return(r);
        }
Esempio n. 3
0
        public CTNSettings Clone()
        {
            var clone = new CTNSettings(_path);

            _serializer.Clone(this, clone);
            return(clone);
        }
Esempio n. 4
0
 internal void Apply(CTNSettings source)
 {
     _serializer.Clone(source, this);
 }