Example #1
0
        // TODO: (core) Do we still need DataSettings.ProviderInvariantName and ProviderFriendlyName?
        //public string ProviderInvariantName
        //{
        //    get
        //    {
        //        if (this.DataProvider.HasValue() && this.DataProvider.IsCaseInsensitiveEqual("sqlserver"))
        //            return "System.Data.SqlClient";

        //        // SqlCe should always be the default provider
        //        return "System.Data.SqlServerCe.4.0";
        //    }
        //}

        //public string ProviderFriendlyName
        //{
        //    get
        //    {
        //        if (this.DataProvider.HasValue() && this.DataProvider.IsCaseInsensitiveEqual("sqlserver"))
        //            return "SQL Server";

        //        // SqlCe should always be the default provider
        //        return "SQL Server Compact (SQL CE)";
        //    }
        //}

        protected virtual bool Load()
        {
            using (_rwLock.GetWriteLock())
            {
                Reset();

                (TenantName, TenantRoot) = ResolveTenant();

                if (TenantRoot.FileExists(SETTINGS_FILENAME) && !_testMode)
                {
                    string text     = TenantRoot.ReadAllText(SETTINGS_FILENAME);
                    var    settings = ParseSettings(text);
                    if (settings.Any())
                    {
                        RawDataSettings.AddRange(settings);

                        (DataProviderType, DataProviderClrType) = ConvertDataProvider(settings.Get("DataProvider"));
                        ConnectionString = settings.Get("DataConnectionString");

                        if (settings.ContainsKey("AppVersion"))
                        {
                            AppVersion = new Version(settings["AppVersion"]);
                        }

                        return(IsValid());
                    }
                }

                return(false);
            }
        }
Example #2
0
        protected void Reset()
        {
            using (_rwLock.GetWriteLock())
            {
                RawDataSettings.Clear();
                TenantName          = null;
                TenantRoot          = null;
                AppVersion          = null;
                DataProviderType    = DataProviderType.Unknown;
                DataProviderClrType = null;
                ConnectionString    = null;
                //this.DataConnectionType = null;

                _installed = null;
            }
        }
Example #3
0
        public Config()
        {
            Debug = new DebugSettings()
            {
                Debug         = false,
                ToFiles       = false,
                DebugMessages = false
            };

            Backend = new BackendSocketSettings()
            {
                Port = 9838
            };

            Http = new HttpSettings()
            {
                Enabled          = true,
                Port             = 8888,
                ShowAccountNames = false
            };

            RawData = new RawDataSettings()
            {
                Enabled    = false,
                WebhookUrl = "",
                DelayMs    = 5000
            };

            MySql = new MysqlSettings()
            {
                Enabled          = false,
                ConnectionString = "server=localhost; port=3306; database=mysqldotnet; user=mysqldotnetuser; password=Pa55w0rd!; Persist Security Info=false; Connect Timeout=300"
            };

            MadExport = new MadExportSettings()
            {
                Enabled          = false,
                ConnectionString = "server=localhost; port=3306; database=mysqldotnet; user=mysqldotnetuser; password=Pa55w0rd!; Persist Security Info=false; Connect Timeout=300"
            };

            Encounter = new EncounterSettings()
            {
                Enabled         = false,
                SaveToDatabase  = false,
                DiscordWebhooks = new List <EncounterSettings.WebhookSettings>()
                {
                    new EncounterSettings.WebhookSettings()
                    {
                        WebhookUrl       = "discord webhook url",
                        FilterByIV       = false,
                        OnlyEqual        = false,
                        MinAttackIV      = 0,
                        MinDefenseIV     = 0,
                        MinStaminaIV     = 0,
                        FilterByLocation = false,
                        Latitude         = 0.1,
                        Longitude        = 0.1,
                        DistanceInKm     = 20,
                        CustomLink       = new EncounterSettings.CustomLink()
                        {
                            Title = "Custom Link",
                            Link  = ""
                        }
                    }
                }
            };
        }