public static void Initialize() { AppConfigUtility conf = new AppConfigUtility(); _logPath = conf.AppSettings("logPath"); _dataFileName = conf.AppSettings("dataFileName"); }
void WriteToEventLog(string message, EventLogEntryType logType) { EventLog eventLog = new EventLog(); eventLog.Source = AppConfigUtility.AppSettingValue("Sample.EventSource", "sample"); eventLog.WriteEntry(message, logType); }
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!!!"); } }
public static void Initialize() { AppConfigUtility appConfig = new AppConfigUtility(); _logPath = appConfig.AppSettings("logPath"); _dataFileName = appConfig.AppSettings("dataFileName"); _importSetting = appConfig.AppSettings("importSetting"); }
public static void Initialize() { _logPath = AppConfigUtility.AppSettings("logPath"); _dataFileName = AppConfigUtility.AppSettings("dataFileName"); if (_logPath is null | _dataFileName is null) { throw new Exception("Ошибка при считывании конфигурации"); } }
public static void Initialize() { AppConfigUtility appConfigUtility = new AppConfigUtility(); _logPath = appConfigUtility.AppSettings("logPath"); _dataFileName = appConfigUtility.AppSettings("dataFileName"); _searchProjectFactory = appConfigUtility.AppSettings("typeFactory"); _saveFileName = appConfigUtility.AppSettings("saveFileName"); }
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!"); }
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(); }
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(); } }
//Метод должен возвращать пустую строку, если в качество входного парамметра принята пустая строка public void AppSettingsTest() { AppConfigUtility con = new AppConfigUtility(); string temp = con.AppSettings(""); if (temp == String.Empty) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } }
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."); }
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(); } }
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(); } }
public void AppConfigUtilityTest() { Assert.AreEqual(AppConfigUtility.AppSettings(""), ""); }