Ejemplo n.º 1
0
        public static void Initialize()
        {
            AppConfigUtility conf = new AppConfigUtility();

            _logPath      = conf.AppSettings("logPath");
            _dataFileName = conf.AppSettings("dataFileName");
        }
Ejemplo n.º 2
0
        void WriteToEventLog(string message, EventLogEntryType logType)
        {
            EventLog eventLog = new EventLog();

            eventLog.Source = AppConfigUtility.AppSettingValue("Sample.EventSource", "sample");
            eventLog.WriteEntry(message, logType);
        }
Ejemplo n.º 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!!!");
            }
        }
Ejemplo n.º 4
0
        public static void Initialize()
        {
            AppConfigUtility appConfig = new AppConfigUtility();

            _logPath       = appConfig.AppSettings("logPath");
            _dataFileName  = appConfig.AppSettings("dataFileName");
            _importSetting = appConfig.AppSettings("importSetting");
        }
Ejemplo n.º 5
0
 public static void Initialize()
 {
     _logPath      = AppConfigUtility.AppSettings("logPath");
     _dataFileName = AppConfigUtility.AppSettings("dataFileName");
     if (_logPath is null | _dataFileName is null)
     {
         throw new Exception("Ошибка при считывании конфигурации");
     }
 }
Ejemplo n.º 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");
        }
Ejemplo n.º 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!");
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 10
0
        //Метод должен возвращать пустую строку, если в качество входного парамметра принята пустая строка
        public void AppSettingsTest()
        {
            AppConfigUtility con  = new AppConfigUtility();
            string           temp = con.AppSettings("");

            if (temp == String.Empty)
            {
                Assert.IsTrue(true);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 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();
            }
        }
        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.");
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 15
0
 public void AppConfigUtilityTest()
 {
     Assert.AreEqual(AppConfigUtility.AppSettings(""), "");
 }