public ProxyContext(NetworkStream client, GeneralConfig configuration, ILogger logger, CancellationToken token)
 {
     Configuration = configuration;
     Client        = client;
     Logger        = logger;
     Token         = token;
 }
Example #2
0
    static (ModApplier, EventExchange, AssetLoaderRegistry) BuildModApplier(string baseDir, string[] mods, IFileSystem disk, IJsonUtil jsonUtil, AssetMapping mapping)
    {
        var config   = GeneralConfig.Load(Path.Combine(baseDir, "data", "config.json"), baseDir, disk, jsonUtil);
        var applier  = new ModApplier();
        var exchange = new EventExchange(new LogExchange())
        {
            Name = $"EventExchange for {string.Join(", ", mods)}"
        };
        var assetLoaderRegistry = new AssetLoaderRegistry();

        exchange
        .Register(disk)
        .Register(jsonUtil)
        .Register <IGeneralConfig>(config)
        .Attach(new StdioConsoleLogger())
        .Attach(assetLoaderRegistry)
        .Attach(new ContainerRegistry())
        .Attach(new PostProcessorRegistry())
        .Attach(new AssetLocator())
        .Attach(new SpellManager())
        .Attach(new SettingsManager(new GeneralSettings()))     // Used for event comments
        .Attach(applier)
        ;

        applier.LoadMods(mapping, config, mods);
        return(applier, exchange, assetLoaderRegistry);
    }
Example #3
0
 static void Main()
 {
     GeneralConfig.SetCnnString(CnnString);
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new Main());
 }
Example #4
0
        public void InvariantCultureIsNotDisplayed()
        {
            // Arrange
            var cfg = new GeneralConfig {
                Language = "es-ES"
            };
            var cfgMock = new Mock <IConfig>();

            cfgMock.SetupGet(c => c.General).Returns(cfg);

            var languageProvider = new Mock <ILanguageProvider>();

            languageProvider.SetupGet(l => l.AvailableLanguages).Returns(new[]
            {
                CultureInfo.CreateSpecificCulture("en-US"),
                CultureInfo.CreateSpecificCulture("")
            });

            // Act
            var vm = new GeneralSettings(cfgMock.Object, languageProvider.Object);

            // Assert
            Assert.AreEqual(1, vm.AvailableLanguages.Count);
            Assert.AreEqual("en-US", vm.AvailableLanguages.First().Name);
        }
Example #5
0
        public void NeutralLanguagesAreRemovedIfSpecificVersionExists()
        {
            // Arrange
            var cfg = new GeneralConfig {
                Language = "es-ES"
            };
            var cfgMock = new Mock <IConfig>();

            cfgMock.SetupGet(c => c.General).Returns(cfg);

            var languageProvider = new Mock <ILanguageProvider>();

            languageProvider.SetupGet(l => l.AvailableLanguages).Returns(new[]
            {
                CultureInfo.CreateSpecificCulture("en-US"),
                CultureInfo.CreateSpecificCulture("de-DE"),
                CultureInfo.CreateSpecificCulture("en-US").Parent,
                CultureInfo.CreateSpecificCulture("en-GB"),
                CultureInfo.CreateSpecificCulture("de-DE").Parent
            });

            // Act
            var vm = new GeneralSettings(cfgMock.Object, languageProvider.Object);

            // Assert
            var names = vm.AvailableLanguages.Select(l => l.Name).ToArray();

            CollectionAssert.AreEquivalent(new[] { "de-DE", "en-US", "en-GB" }, names, string.Join("; ", names));
        }
Example #6
0
        public void SettingsAreCorrectlySaved()
        {
            // Arrange
            var cfg = new Mock <IConfig>();

            cfg.SetupGet(c => c.General).Returns(new GeneralConfig());
            var lng = new Mock <ILanguageProvider>();
            var vm  = new GeneralSettings(cfg.Object, lng.Object)
            {
                CheckForUpdates          = false,
                IncludePrereleaseUpdates = true,
                RealtimeStreaming        = false,
                SelectedLanguage         = CultureInfo.CreateSpecificCulture("es-ES"),
                FilterSensitiveTweets    = true
            };

            var saved   = new Mock <IConfig>();
            var general = new GeneralConfig();

            saved.SetupGet(s => s.General).Returns(general);

            // Act
            vm.SaveTo(saved.Object);

            // Assert
            Assert.AreEqual(vm.CheckForUpdates, general.CheckForUpdates);
            Assert.AreEqual(vm.IncludePrereleaseUpdates, general.IncludePrereleaseUpdates);
            Assert.AreEqual(vm.RealtimeStreaming, general.RealtimeStreaming);
            Assert.AreEqual(vm.SelectedLanguage.Name, general.Language);
            Assert.AreEqual(vm.FilterSensitiveTweets, general.FilterSensitiveTweets);
        }
 public void Init()
 {
     generatorConfig = Root.ConfigManager.PipeGeneratorConfig;
     generalConfig   = Root.ConfigManager.GeneralConfig;
     Root.Player.Input.OnDirectionPressed    += DirectionPressed;
     Root.UIManager.OnScreenDirectionPressed += DirectionPressed;
 }
Example #8
0
        private void Ayarlar_Load(object sender, EventArgs e)
        {
            GeneralConfig    config     = new GeneralConfig();
            ConfigProperties properties = config.ReadConfigFromFile();

            trckInterval.Value = properties.WordInterval / 60000;
        }
Example #9
0
 public Worker(ITerminChecker terminChecker, Settings settings)
 {
     _terminChecker  = terminChecker;
     _config         = settings.GeneralConfig;
     _emailConfig    = settings.EmailConfig;
     _telegramConfig = settings.TelegramConfig;
 }
Example #10
0
    public static void BuildStaticConfig()
    {
        var cfg = Resources.Load <GeneralConfig>("StaticConfig");

        cfg.Build();
        GeneralConfig.StaticCfg = cfg;
    }
Example #11
0
    public Assets(IFileSystem disk, IJsonUtil jsonUtil) // Everything in this class should be treated as read-only once the constructor finishes.
    {
        if (disk == null)
        {
            throw new ArgumentNullException(nameof(disk));
        }
        BaseDir = ConfigUtil.FindBasePath(disk);
        var assetIdConfigPath = Path.Combine(BaseDir, @"src/Formats/AssetIdTypes.json");
        var config            = GeneralConfig.Load(Path.Combine(BaseDir, "data/config.json"), BaseDir, disk, jsonUtil);

        AssetConfig   = AssetConfig.Load(config.ResolvePath("$(MODS)/Base/assets.json"), AssetMapping.Global, disk, jsonUtil);
        AssetIdConfig = AssetIdConfig.Load(assetIdConfigPath, disk, jsonUtil);

        AssetIdsByType   = FindAssetIdsByType(AssetIdConfig);
        ParentsByAssetId = FindAssetIdParents(AssetIdConfig, AssetIdsByType);
        AssetIdsByEnum   = FindAssetIdsForEnums(AssetConfig.IdTypes, AssetIdsByType);
        EnumsByAssetId   = FindEnumsByAssetId(AssetConfig.IdTypes, AssetIdsByType);
        // HandleIsomorphism(AssetConfig.IdTypes);

        // TODO: Build family based on IsomorphicToAttribute.
        // * AssetTypes in a family need to have a single-type AssetId
        // * AssetType families must have a single unambiguous leader
        // * The child types inherit their enum names from the leader
        // * Child types' mod specific enums need to be in 1:1 relationship with CopiedFrom attrib?
        // ....getting complicated.
    }
Example #12
0
        public static async Task SetupClient(TestContext context)
        {
            generalConfig = GeneralConfig.Instance.Value;
            var conf = new BacklogJpConfigure(generalConfig.SpaceKey);

            conf.ApiKey = generalConfig.ApiKey;
            client      = new BacklogClientFactory(conf).NewClient();
            var users = await client.GetUsersAsync();

            projectKey = generalConfig.ProjectKey;
            var project = await client.GetProjectAsync(projectKey);

            projectId = project.Id;

            gitConfig = GitConfig.Instance.Value;

            ownUser = await client.GetMyselfAsync();

            var numericUserIds = (await client.GetUsersAsync()).ToDictionary(x => x.UserId, x => x.Id);

            notifiedNumericUserIds = new[]
            { gitConfig.NotifiedUserId1, gitConfig.NotifiedUserId2, gitConfig.NotifiedUserId3 }
            .Select(x => numericUserIds[x])
            .ToArray();

            assigneeUserIds = new[]
            { gitConfig.AssigneeUserId1, gitConfig.AssigneeUserId2, gitConfig.AssigneeUserId3 }
            .Select(x => numericUserIds[x])
            .ToArray();
        }
Example #13
0
        public Form_Settings()
        {
            InitializeComponent();

            //ret = 1; // default
            IsChange      = false;
            IsChangeSaved = false;

            _benchmarkConfigsBackup = MemoryHelper.DeepClone(ConfigManager.Instance.BenchmarkConfigs);
            _generalConfigBackup    = MemoryHelper.DeepClone(ConfigManager.Instance.GeneralConfig);

            // initialize form
            InitializeFormTranslations();

            // Initialize toolTip
            InitializeToolTip();

            // Initialize tabs
            InitializeGeneralTab();

            // initialization calls
            InitializeDevicesTab();
            // link algorithm list with algorithm settings control
            algorithmSettingsControl1.Enabled         = false;
            algorithmsListView1.ComunicationInterface = algorithmSettingsControl1;
            //algorithmsListView1.RemoveRatioRates();


            // At the very end set to true
            _isInitFinished = true;
        }
 public ConfigurationPackage(
     GeneralConfig generalConfig,
     Dictionary <string, TribeConfiguration> tribeConfigs)
 {
     GeneralConfig = generalConfig;
     TribeConfig   = tribeConfigs;
 }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //처리전 인증잡업
            //ValidateVarsInServer();
            if (!IsPostBack)
            {
                //Page Title
                Title = "The Admin Control Center";
                JinsLibrary.STATEMANAGE.Session.Self["PageName"] = "Login Box";

                //쿠키아이디복구
                ReStorePid();

                //최근방문시간
                recentPLogin.Text = Server.UrlDecode(Cookie.Self["recentPLogin"]);
                //Response.Write("--> " + Server.UrlDecode(Request.Cookies["recentPLogin"].Value));
                if (recentPLogin.Text != "")
                {
                    recentPLogin.Text = "최근방문시간은 " + recentPLogin.Text + "입니다.";
                }
                else
                {
                    recentPLogin.Visible = false;
                }

                //포커스이동
                //ClientAction.FocusOn(this, "frmLogin.sLoginID");
                litSiteName.Text = GeneralConfig.GetValue("siteName");
            }
        }
Example #16
0
        public void SavedValuesAreAppliedDuringConstruction()
        {
            // Arrange
            var cfg = new GeneralConfig
            {
                CheckForUpdates          = false,
                IncludePrereleaseUpdates = true,
                Language              = "de-DE",
                RealtimeStreaming     = false,
                FilterSensitiveTweets = true
            };

            var cfgMock = new Mock <IConfig>();

            cfgMock.SetupGet(c => c.General).Returns(cfg);

            var languageProvider = new Mock <ILanguageProvider>();

            languageProvider.SetupGet(l => l.AvailableLanguages).Returns(new[] { CultureInfo.CreateSpecificCulture("de-DE") });

            // Act
            var vm = new GeneralSettings(cfgMock.Object, languageProvider.Object);

            // Assert
            Assert.AreEqual(cfg.CheckForUpdates, vm.CheckForUpdates);
            Assert.AreEqual(cfg.IncludePrereleaseUpdates, vm.IncludePrereleaseUpdates);
            Assert.AreEqual(cfg.RealtimeStreaming, vm.RealtimeStreaming);
            Assert.AreEqual(cfg.Language, vm.SelectedLanguage.Name);
            Assert.AreEqual(cfg.FilterSensitiveTweets, vm.FilterSensitiveTweets);
        }
Example #17
0
        public void ExecuteProgramConfig()
        {
            GeneralConfig    config     = new GeneralConfig();
            ConfigProperties properties = config.ReadConfigFromFile();

            tmrWord.Interval = properties.WordInterval;
            //tmrWord.Interval = 1000; //Hızlı Deneme
        }
        public override void Entry(ModHelper helper)
        {
            ModConfig = helper.ReadConfig <GeneralConfig>();
            GameEvents.OneSecondTick += new EventHandler(this.on_each_second);
            TimeEvents.OnNewDay      += new EventHandler <EventArgsNewDay>(this.on_new_day);

            Log.Info($"SDV_AdditionalDailyFriendship... loaded!");
        }
        public WalletInstall(HttpClientFactory httpClientFactory, GeneralConfig generalConfig, WalletConfig walletConfig, ILog logger)
        {
            _httpClientFactory = httpClientFactory;
            _walletConfig      = walletConfig;
            _logger            = logger;

            _walletInstallerPath = Path.Combine(generalConfig.UserConfig.UserDataPath, _walletConfig.InstallerDir);
        }
Example #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BrowseCloudControllerBase"/> class.
        /// </summary>
        /// <param name="logger">Logger</param>
        /// <param name="config">General Config</param>
        public BrowseCloudControllerBase(ILogger logger, IOptions <GeneralConfig> config)
        {
            Contract.Requires(logger != null, nameof(logger));
            Contract.Requires(config != null, nameof(config));

            this.logger = logger;
            this.config = config.Value;
        }
        private void Event_SaveGameLoaded()
        {
            base.Initialize();
            base.InitDummySim();
            WeatherDataSlowAccess = getWeatherDataReader();

            GeneralConfig.Init(api.World);
        }
Example #22
0
 public static SettingsContainerVM AdvancedContainer(GeneralConfig settingsObj)
 {
     return(new SettingsContainerVM(settingsObj,
                                    "Advanced",
                                    new AdvancedGeneralVM(settingsObj),
                                    new AdvancedSwitchingVM(settingsObj),
                                    new AdvancedMiningVM(settingsObj)));
 }
        public static void LoadAllConfigurations()
        {
            GeneralConfig = LoadGeneralConfig(DefaultGeneralConfigFile);

            TraderBuyConfig = LoadBuyersList(DefaultTraderBuyConfigFile);

            TraderSellConfig = LoadSellConfig(DefaultTraderSellConfigConfile);
        }
Example #24
0
        public bool Load()
        {
            try
            {
                try
                {
                    if (File.Exists(ConfigurationManagement.Instance.ConfigurationPath + Path.DirectorySeparatorChar + "general.cfg"))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(GeneralConfig));
                        TextReader    reader     = new StreamReader(ConfigurationManagement.Instance.ConfigurationPath + Path.DirectorySeparatorChar + "general.cfg");
                        configuration = (GeneralConfig)serializer.Deserialize(reader);
                        reader.Close();
                        reader.Dispose();
                    }
                    else
                    {
                        configuration = new GeneralConfig();
                    }
                }
                catch (Exception e)
                {
                    LogCenter.Instance.LogException(e);
                    configuration = new GeneralConfig();
                }
                finally
                {
                    if (configuration.PreferredLanguage == null)
                    {
                        configuration.PreferredLanguage = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
                    }
                    switch (configuration.PreferredLanguage)
                    {
                    case "zh":
                    case "en":
                    case "de":
                    case "pt":
                    case "ru":
                    case "es":
                    case "ja":
                    case "it":
                    case "fr":
                    case "he":
                    case "nl":
                        break;

                    default:
                        configuration.PreferredLanguage = "en";
                        break;
                    }
                }
                return(true);
            }
            catch (ApplicationException ex)
            {
                LogCenter.Instance.LogException(ex);
                return(false);
            }
        }
 public ConfigurationPackage(
     GeneralConfig generalConfig,
     List <TraderBuyingConfig> buyConfigs,
     List <TraderSellConfig> sellConfig)
 {
     GeneralConfig = generalConfig;
     BuyConfigs    = buyConfigs;
     SellConfig    = sellConfig;
 }
        public WalletBootstrap(HttpClientFactory httpClientFactory, GeneralConfig generalConfig, WalletConfig walletConfig, ILog logger)
        {
            _httpClientFactory = httpClientFactory;
            _walletConfig      = walletConfig;
            _logger            = logger;

            _bootstrapFilePath = Path.Combine(generalConfig.UserConfig.UserDataPath, _walletConfig.BootstrapDir, _walletConfig.BootstrapFilename);
            _bootstrapPath     = Path.Combine(generalConfig.UserConfig.UserDataPath, _walletConfig.BootstrapDir);
        }
Example #27
0
        public BxLogger(GeneralConfig config)
        {
            _config = config;

            if (!Directory.Exists(_config.UserConfig.LogOutputPath))
            {
                Directory.CreateDirectory(_config.UserConfig.LogOutputPath);
            }
        }
Example #28
0
 public static void CreateBackup()
 {
     GeneralConfigBackup    = MemoryHelper.DeepClone(ConfigManager.GeneralConfig);
     BenchmarkConfigsBackup = new Dictionary <string, DeviceBenchmarkConfig>();
     foreach (var CDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices)
     {
         BenchmarkConfigsBackup[CDev.UUID] = CDev.GetAlgorithmDeviceConfig();
     }
 }
Example #29
0
        public static async Task SetupClient(TestContext context)
        {
            generalConfig = GeneralConfig.Instance.Value;
            var conf = new BacklogJpConfigure(generalConfig.SpaceKey);

            conf.ApiKey = generalConfig.ApiKey;
            client      = new BacklogClientFactory(conf).NewClient();
            var users = await client.GetUsersAsync();
        }
Example #30
0
        public RepositoryService(ILogger logger, GeneralConfig generalConfig, IEnumerable <IExchangeService> exchanges)
        {
            _logger          = logger;
            _generalConfig   = generalConfig;
            _availableTables = new List <string>();

            EnsureDbCreated();
            RegisterTableNames(exchanges.Select(x => x.ExchangeConfig).ToList());
        }
Example #31
0
 public Page(IWebDriver webDriver, GeneralConfig cfg)
 {
     if (webDriver == null)
     {
         throw new ArgumentNullException("webDriver");
     } else if (cfg == null)
     {
         throw new ArgumentNullException("cfg");
     }
     this.webDriver = webDriver;
     this.cfg = cfg;
                
     HtmlElementLoader.PopulatePageObject(this, webDriver);
     PageFactory.InitElements(webDriver, this);
 }
Example #32
0
 public void SetUp()
 {           
     DataPersister<GeneralConfig> cfgHelper = new DataPersister<GeneralConfig>();
                 
     if (cfgHelper.FileExist(GeneralConfig.DEFAULT_FILE_NAME))
     {
         Config =  cfgHelper.Load(GeneralConfig.DEFAULT_FILE_NAME);
     }
     else
     {
         Config = GeneralConfig.CreateDefault();
         cfgHelper.Save(Config, GeneralConfig.DEFAULT_FILE_NAME);
     }
     
     // think about muti-browser support
     WebDriver = new ChromeDriver();
     
     // configure default timeouts
     WebDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(Config.DefaultTimeoutSec));
 }
Example #33
0
 public FinancePage(IWebDriver webDriver, GeneralConfig cfg) : base(webDriver, cfg) { }
 public bool Load()
 {
     try
     {
         try
         {
             if (File.Exists(ConfigurationManagement.Instance.ConfigurationPath + Path.DirectorySeparatorChar + "general.cfg"))
             {
                 XmlSerializer serializer = new XmlSerializer(typeof(GeneralConfig));
                 TextReader reader = new StreamReader(ConfigurationManagement.Instance.ConfigurationPath + Path.DirectorySeparatorChar + "general.cfg");
                 configuration = (GeneralConfig)serializer.Deserialize(reader);
                 reader.Close();
                 reader.Dispose();
             }
             else
             {
                 configuration = new GeneralConfig();
             }
         }
         catch (Exception e)
         {
             LogCenter.Instance.LogException(e);
             configuration = new GeneralConfig();
         }
         finally
         {
             if (configuration.PreferredLanguage == null)
             {
                 configuration.PreferredLanguage = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
             }
             switch (configuration.PreferredLanguage)
             {
                 case "zh":
                 case "en":
                 case "de":
                 case "pt":
                 case "ru":
                 case "es":
                 case "ja":
                 case "it":
                 case "fr":
                 case "he":
                 case "nl":
                     break;
                 default:
                     configuration.PreferredLanguage = "en";
                     break;
             }
         }
         return true;
     }
     catch (ApplicationException ex)
     {
         LogCenter.Instance.LogException(ex);
         return false;
     }
 }
Example #35
0
 public MainPage(IWebDriver webDriver, GeneralConfig cfg) : base(webDriver, cfg) { }