public static void PopulateConfigurationSettings(CustomConfigurationSettings customConfigurationSettings) { var parser = new BpHelperConfigParser(); customConfigurationSettings.AutoDetectHeroAndMap = parser.GetAutoDetectHeroAndMap(); customConfigurationSettings.AutoShowHideHelper = parser.GetAutoShowHideHelper(); customConfigurationSettings.UploadBanSample = parser.GetUploadBanSample(); customConfigurationSettings.AutoShowMMR = parser.GetAutoShowMMR(); customConfigurationSettings.AutoUploadReplayToHotslogs = parser.GetAutoUploadNewReplayToHotslogs(); customConfigurationSettings.AutoUploadReplayToHotsweek = parser.GetAutoUploadNewReplayToHotsweek(); customConfigurationSettings.UploadStrategy = parser.GeUploadStrategy(); customConfigurationSettings.MMRAutoCloseTime = parser.GetMMRAutoCloseTime(); App.UserDataSettings.PlayerTags = parser.GetPlayerTags(); App.UserDataSettings.HotsweekPlayerId = parser.GetHotsweekPlayerId(); customConfigurationSettings.LanguageForBphots = parser.GetLanguageForBphots(); App.Language = customConfigurationSettings.LanguageForBphots; LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo(customConfigurationSettings.LanguageForBphots); customConfigurationSettings.LanguageForMessage = parser.GetLanguageForMessage(); customConfigurationSettings.LanguageForGameClient = parser.GetLanguageForGameClient(); SetOcrLanguage(customConfigurationSettings.LanguageForGameClient); }
public static void WriteConfig(CustomConfigurationSettings customConfigurationSettings) { var sb = new StringBuilder(); { sb.AppendLine(WriteConfigurationValue(AutoDetectHeroAndMapKey, customConfigurationSettings.AutoDetectHeroAndMap)); sb.AppendLine(WriteConfigurationValue(AutoShowHideHelperKey, customConfigurationSettings.AutoShowHideHelper)); sb.AppendLine(WriteConfigurationValue(AutoShowMMRKey, customConfigurationSettings.AutoShowMMR)); sb.AppendLine(WriteConfigurationValue(AutoUploadNewReplayToHotslogsKey, customConfigurationSettings.AutoUploadReplayToHotslogs)); sb.AppendLine(WriteConfigurationValue(UploadBanSampleKey, customConfigurationSettings.UploadBanSample)); sb.AppendLine(WriteConfigurationValue(AutoUploadNewReplayToHotsweekKey, customConfigurationSettings.AutoUploadReplayToHotsweek)); sb.AppendLine(WriteConfigurationValue(UploadStrategyKey, (int)customConfigurationSettings.UploadStrategy)); sb.AppendLine(WriteConfigurationValue(MMRAutoCloseTimeKey, customConfigurationSettings.MMRAutoCloseTime)); sb.AppendLine(WriteConfigurationValue(LanguageForBphotsKey, customConfigurationSettings.LanguageForBphots)); sb.AppendLine(WriteConfigurationValue(LanguageForMessageKey, customConfigurationSettings.LanguageForMessage)); var languageFromGame = GetLanguageFromGame(); if (string.IsNullOrEmpty(languageFromGame)) { sb.AppendLine(WriteConfigurationValue(LanguageForGameClientKey, customConfigurationSettings.LanguageForGameClient)); } } File.WriteAllText(BpHelperConfigPath, sb.ToString()); }
protected override void Configure() { App.AppPath = AppDomain.CurrentDomain.BaseDirectory; Directory.SetCurrentDirectory(App.AppPath); var args = Environment.GetCommandLineArgs(); var configurationSettings = new CustomConfigurationSettings(); BpHelperConfigParser.PopulateConfigurationSettings(configurationSettings); App.CustomConfigurationSettings = configurationSettings; App.NextConfigurationSettings = configurationSettings; if (args.Any(arg => arg.ToLower() == "/log")) { LogUtil.NoLog = false; OcrEngine.Debug = true; } if (args.Any(arg => arg.ToLower() == "/devtool")) { App.DevTool = true; } if (args.Any(arg => arg.ToLower() == "/debugv2")) { LogUtil.NoLog = false; OcrEngine.Debug = true; App.Debug = true; } if (args.Any(arg => arg.ToLower() == "/forceupdate")) { App.ForceUpdate = true; } if (args.Any(arg => arg.ToLower() == "/errortest")) { ErrorView _errorView = new ErrorView(ViewModelBase.L("NoMatchResolution"), ViewModelBase.L("MSG_NoMatchResolution"), "https://www.bphots.com/articles/errors/test"); _errorView.ShowDialog(); } }
protected override void Configure() { App.AppPath = AppDomain.CurrentDomain.BaseDirectory; Directory.SetCurrentDirectory(App.AppPath); var args = Environment.GetCommandLineArgs(); try { var configurationSettings = new CustomConfigurationSettings(); BpHelperConfigParser.PopulateConfigurationSettings(configurationSettings); UserDataConfigParser.PopulateUserDataSettings(); App.CustomConfigurationSettings = configurationSettings; App.NextConfigurationSettings = configurationSettings; } catch (Exception) { //Ignored } if (args.Any(arg => arg.ToLower() == "/log")) { LogUtil.NoLog = false; OcrEngine.Debug = true; } if (args.Any(arg => arg.ToLower() == "/devtool")) { App.DevTool = true; } if (args.Any(arg => arg.ToLower() == "/debugv2")) { LogUtil.NoLog = false; OcrEngine.Debug = true; App.Debug = true; } if (args.Any(arg => arg.ToLower() == "/debugv2")) { LogUtil.NoLog = false; OcrEngine.Debug = true; App.Debug = true; } if (args.Any(arg => arg.ToLower() == "/forceupdate")) { App.ForceUpdate = true; } try { if (args.Any(arg => arg.ToLower().StartsWith("/upload"))) { var dateString = args.First(arg => arg.ToLower().StartsWith("/upload")).Substring(7); App.UploadMinimumAcceptableTime = DateTime.Parse(dateString).ToUniversalTime(); } else { App.UploadMinimumAcceptableTime = Const.HotsweekAcceptTime; } } catch { App.UploadMinimumAcceptableTime = DateTime.Now; } if (args.Any(arg => arg.ToLower() == "/errortest")) { ErrorView _errorView = new ErrorView(ViewModelBase.L("NoMatchResolution"), ViewModelBase.L("MSG_NoMatchResolution"), "https://www.bphots.com/articles/errors/test"); _errorView.ShowDialog(); } }