コード例 #1
0
        public static void Initialize()
        {
            AppConfigUtility conf = new AppConfigUtility();

            _logPath      = conf.AppSettings("logPath");
            _dataFileName = conf.AppSettings("dataFileName");
        }
コード例 #2
0
        void WriteToEventLog(string message, EventLogEntryType logType)
        {
            EventLog eventLog = new EventLog();

            eventLog.Source = AppConfigUtility.AppSettingValue("Sample.EventSource", "sample");
            eventLog.WriteEntry(message, logType);
        }
コード例 #3
0
        public static void Initialize()
        {
            AppConfigUtility appConfigUtility = new AppConfigUtility();

            logPath      = appConfigUtility.AppSettings("logPath");
            dataFileName = appConfigUtility.AppSettings("dataFileName");



            //объявление фабрики в зависимости от типа фабрики
            factoryType = appConfigUtility.AppSettings("factoryType");


            if (factoryType.Equals("split"))
            {
                materialFactory = new MaterialSplitFileFactory();
            }
            else if (factoryType.Equals("test"))
            {
                materialFactory = new MaterialTestFactory();
            }
            else
            {
                throw new Exception("this factory type doesn't exist!!!");
            }
        }
コード例 #4
0
        public static void Initialize()
        {
            AppConfigUtility appConfig = new AppConfigUtility();

            _logPath       = appConfig.AppSettings("logPath");
            _dataFileName  = appConfig.AppSettings("dataFileName");
            _importSetting = appConfig.AppSettings("importSetting");
        }
コード例 #5
0
ファイル: AppGlobalSettings.cs プロジェクト: QutaqKicker/KPO
 public static void Initialize()
 {
     _logPath      = AppConfigUtility.AppSettings("logPath");
     _dataFileName = AppConfigUtility.AppSettings("dataFileName");
     if (_logPath is null | _dataFileName is null)
     {
         throw new Exception("Ошибка при считывании конфигурации");
     }
 }
コード例 #6
0
        public static void Initialize()
        {
            AppConfigUtility appConfigUtility = new AppConfigUtility();

            _logPath              = appConfigUtility.AppSettings("logPath");
            _dataFileName         = appConfigUtility.AppSettings("dataFileName");
            _searchProjectFactory = appConfigUtility.AppSettings("typeFactory");
            _saveFileName         = appConfigUtility.AppSettings("saveFileName");
        }
コード例 #7
0
        static void Main(string[] args)
        {
            RollbarInfrastructureConfig rollbarInfrastructureConfig = new RollbarInfrastructureConfig();

            AppConfigUtility.LoadAppSettings(rollbarInfrastructureConfig);
            RollbarInfrastructure.Instance.Init(rollbarInfrastructureConfig);

            RollbarLocator.RollbarInstance.AsBlockingLogger(TimeSpan.FromSeconds(3))
            .Info($"{typeof(Program).Namespace} sample: Rollbar is alive based on the app.config settings!");
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("started the app");

            string baseAddress = AppConfigUtility.AppSettingValue("baseAddress", "http://localhost:8080");

            // Start OWIN host
            WebApp.Start <Startup>(baseAddress);
            Console.WriteLine("Server running at {0} - press Enter to quit. ", baseAddress);
            Console.ReadLine();
        }
コード例 #9
0
 public static void Initialize()
 {
     AppGlobalSettings.Log      = AppConfigUtility.AppSettings("logPath");
     AppGlobalSettings.DataFile = AppConfigUtility.AppSettings("dataFileName");
     if (AppConfigUtility.AppSettings("factory") == "test")
     {
         _factory = new ElementaryParticlesTestFactory();
     }
     else if (AppConfigUtility.AppSettings("factory") == "split")
     {
         _factory = new ElementaryParticleSplitFileFactory();
     }
 }
コード例 #10
0
ファイル: AppConfigUtilityTests.cs プロジェクト: nsnqhq/KPO-1
        //Метод должен возвращать пустую строку, если в качество входного парамметра принята пустая строка
        public void AppSettingsTest()
        {
            AppConfigUtility con  = new AppConfigUtility();
            string           temp = con.AppSettings("");

            if (temp == String.Empty)
            {
                Assert.IsTrue(true);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
コード例 #11
0
        public static void Initialize()
        {
            AppConfigUtility appConfig = new AppConfigUtility();

            _logPath      = appConfig.AppSettings("logPath");
            _dataFileName = appConfig.AppSettings("dataFileName");
            if (_dataFileName == "test")
            {
                _semiconductorFactory = new SemiconductorTestFactory();
            }
            else
            {
                _semiconductorFactory = new SemiconductorSplitFileFactory();
            }
        }
コード例 #12
0
        public void WhenAppSettingExistsUpdateTheValue()
        {
            string keyname       = "SettingWithAValue";
            string expectedValue = "new-value";

            Args = CreateArgsArray(
                CommandNameArgument,
                GetArgEntry(Constants.ArgumentNameConfigFilename, _PathToSampleConfigFile),
                GetArgEntry(Constants.ArgumentNameKey, keyname),
                GetArgEntry(Constants.ArgumentNameValue, expectedValue));

            SystemUnderTest.Run();

            string actual = AppConfigUtility.GetAppSetting(_PathToSampleConfigFile, keyname);

            Assert.AreEqual <string>(expectedValue, actual, "Result was wrong.");
        }
コード例 #13
0
        public static void Initialize()
        {
            AppConfigUtility conf = new AppConfigUtility();

            _logPath       = conf.AppSettings("logPath");
            _dataFileName  = conf.AppSettings("dataFileName");
            _dataFileName2 = conf.AppSettings("dataFileName2");

            if (conf.AppSettings("factory") == "Test")
            {
                _factory = new CarTestFactory();
            }
            if (conf.AppSettings("factory") == "Loader")
            {
                _factory = new CarSplitFileFactory();
            }
        }
コード例 #14
0
        internal static void Register(IApplicationLifetime lifetime)
        {
            ServiceRegisterInfo serviceInfo = AppConfigUtility.Get <ServiceRegisterInfo>("ServiceRegisterEntity");

            using (var consulClient = new ConsulClient(x => x.Address = new Uri(serviceInfo.ConsulServer)))
            {
                string address    = GetAddress(serviceInfo);
                string httpScheme = serviceInfo.IsHttps ? "https://" : "http://";

                AgentServiceRegistration registration = BuildServiceRegistration(serviceInfo, "localhost", httpScheme);

                consulClient.Agent.ServiceRegister(registration).Wait();

                lifetime.ApplicationStopping.Register(() =>
                {
                    consulClient.Agent.ServiceDeregister(registration.ID).Wait();
                });

                var result = consulClient.Agent.Services().ConfigureAwait(false).GetAwaiter().GetResult();
            }
        }
コード例 #15
0
 public void AppConfigUtilityTest()
 {
     Assert.AreEqual(AppConfigUtility.AppSettings(""), "");
 }