コード例 #1
0
ファイル: Config.cs プロジェクト: bowmark/allauth.desktop
        public static bool LoadConfig(string configFilePath = null)
        {
            if (string.IsNullOrEmpty(configFilePath))
            {
                configFilePath = GetConfigPath();
            }
            
            if (!string.IsNullOrEmpty(configFilePath))
            {
                try
                {
                    var loader = new ConfigLoader(configFilePath);
                    _configData = loader.ConfigData;
                }
                catch (Exception)
                {
                    Logger.Error("Could not find a configuration file. " +
                                 "Include one in the application directory or specify one with --config.");
                    return false;
                }
            }
            else
            {
                _configData = new IniData();
            }

            // Defaults. AddSection/AddKey take no action if they already exist.
            _configData.Sections.AddSection("Application");
            _configData["Application"].AddKey("LogLevel", "Info");
            _configData["Application"].AddKey("AutoUpdate", "true");
            _configData["Application"].AddKey(
                "UpdatesReleaseUrl", "https://downloads.allauthapp.com/allauth-desktop/win-update-pkgs");
            _configData["Application"].AddKey(
                "AccountManagementUrl", "https://account.allauthapp.com");

            _configData.Sections.AddSection("Management");
            _configData["Management"].AddKey("Https", "true");
            _configData["Management"].AddKey("Host", "management.api.allauthapp.com");
            _configData["Management"].AddKey("Port", "443");
            _configData["Management"].AddKey("ApiVersion", "1");

            //if (!Program.AppEnvDebug)
            //{
            //    // Immutable for release
            //    _configData["Management"]["Https"] = "true";
            //    _configData["Management"]["Host"] = "management.api.allauthapp.com";
            //    _configData["Management"]["Port"] = "443";
            //    _configData["Management"]["ApiVersion"] = "1";
            //}

            return true;
        }
コード例 #2
0
        public static bool LoadConfig(string configFilePath = null)
        {
            if (string.IsNullOrEmpty(configFilePath))
            {
                configFilePath = GetConfigPath();
            }

            if (!string.IsNullOrEmpty(configFilePath))
            {
                try
                {
                    var loader = new ConfigLoader(configFilePath);
                    _configData = loader.ConfigData;
                }
                catch (Exception)
                {
                    Logger.Error("Could not find a configuration file. " +
                                 "Include one in the application directory or specify one with --config.");
                    return(false);
                }
            }
            else
            {
                _configData = new IniData();
            }

            // Defaults. AddSection/AddKey take no action if they already exist.
            _configData.Sections.AddSection("Application");
            _configData["Application"].AddKey("LogLevel", "Info");
            _configData["Application"].AddKey("AutoUpdate", "true");
            _configData["Application"].AddKey(
                "UpdatesReleaseUrl", "https://downloads.allauthapp.com/allauth-desktop/win-update-pkgs");
            _configData["Application"].AddKey(
                "AccountManagementUrl", "https://account.allauthapp.com");

            _configData.Sections.AddSection("Management");
            _configData["Management"].AddKey("Https", "true");
            _configData["Management"].AddKey("Host", "management.api.allauthapp.com");
            _configData["Management"].AddKey("Port", "443");
            _configData["Management"].AddKey("ApiVersion", "1");

            //if (!Program.AppEnvDebug)
            //{
            //    // Immutable for release
            //    _configData["Management"]["Https"] = "true";
            //    _configData["Management"]["Host"] = "management.api.allauthapp.com";
            //    _configData["Management"]["Port"] = "443";
            //    _configData["Management"]["ApiVersion"] = "1";
            //}

            return(true);
        }