Exemplo n.º 1
0
        public static Settings Load()
        {
            try
            {
                String settingsPath = GetSettingsPath();
                if (!File.Exists(settingsPath))
                {
                    return(new Settings());
                }

                UInt32   version = DetectSettingsVersion(settingsPath);
                Settings result  = null;
                switch (version)
                {
                case 1:
                    result = V1.Load(settingsPath);
                    break;

                case 2:
                    result = V2.Load(settingsPath);
                    break;

                case 0:
                default:
                    result = new Settings();
                    break;
                }

                Debug.Assert(result.Version == LAST_VERSION_FORMAT);
                return(result);
            }
            catch (System.Exception a_Exception)
            {
                System.Diagnostics.Debug.WriteLine(a_Exception.Message);
            }

            return(new Settings());
        }