public void TestPerformExitNoOutro() { CreateTest(null); AddStep("disable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, false)); AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value); AddStep("exit via pause", () => Player.ExitViaPause()); AddAssert("player exited", () => Stack.CurrentScreen == null); }
private void load() { if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); Environment.Exit(0); } if (args?.Length > 0) { var paths = args.Where(a => !a.StartsWith('-')).ToArray(); if (paths.Length > 0) Task.Run(() => Import(paths)); } dependencies.CacheAs(this); dependencies.Cache(SentryLogger); dependencies.Cache(osuLogo = new OsuLogo { Alpha = 0 }); // bind config int to database RulesetInfo configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset); Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0; // bind config int to database SkinInfo configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin); SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID; configSkin.ValueChanged += skinId => { var skinInfo = SkinManager.Query(s => s.ID == skinId.NewValue); if (skinInfo == null) { switch (skinId.NewValue) { case -1: skinInfo = DefaultLegacySkin.Info; break; default: skinInfo = SkinInfo.Default; break; } } SkinManager.CurrentSkinInfo.Value = skinInfo; }; configSkin.TriggerChange(); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade); SelectedMods.BindValueChanged(modsChanged); Beatmap.BindValueChanged(beatmapChanged, true); }
/// <summary>Patch player after load.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void Events_AfterLoad(object sender, EventArgs e) { // load config m_playerConfig = this.Helper.ReadJsonFile <LocalConfig>(LocalConfig.s_perSaveConfigPath) ?? new LocalConfig(); // patch player textures m_farmerPatcher.m_farmer = Game1.player; m_farmerPatcher.m_config = m_playerConfig; m_farmerPatcher.ApplyConfig(); }
public static FarmaticContext Create(LocalConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } return(new FarmaticContext(config.Server, config.Database, config.Username, config.Password)); }
public override void SetUpSteps() { base.SetUpSteps(); AddStep("enable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, true)); AddStep("set dim level to 0", () => LocalConfig.SetValue <double>(OsuSetting.DimLevel, 0)); AddStep("reset fail conditions", () => currentFailConditions = (_, __) => false); AddStep("set storyboard duration to 2s", () => currentStoryboardDuration = 2000); AddStep("set ShowResults = true", () => showResults = true); }
public ConfigBuilder() { LocalConfig localConfig = LocalConfig.GetLocalConfig(); Config = new ConfigurationBuilder().AddEnvironmentVariables().Build(); Config.Providers.First().Set("SettingsUrl", $"{localConfig.SettingsServiceURL}{localConfig.SettingsServiceAccessToken}"); ReloadingManager = Config.LoadSettings <AppSettings>("SettingsUrl", false); }
public static LocalConfig GetInstance() { if (_instance == null) { _instance = new LocalConfig(); } return(_instance); }
public static IReloadingManager <AppSettings> InitConfiguration() { LocalConfig localConfig = LocalConfig.GetLocalConfig(); var config = new ConfigurationBuilder().AddEnvironmentVariables().Build(); config.Providers.First().Set("SettingsUrl", $"{localConfig.SettingsServiceURL}{localConfig.SettingsServiceAccessToken}"); return(config.LoadSettings <AppSettings>("SettingsUrl", false)); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // 装在配置 GlobalShare.CurrentConfig = LocalConfig.loadLocalConfig(); Application.Run(new LoginFrm()); }
public LoginViewModel(MainWindowViewModel mainVM, LocalConfig config, string message) : this(mainVM) { Error = message; Server = config.Server; Team = config.Team; Username = config.Username; this.config = config; }
protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); RulesetStore?.Dispose(); BeatmapManager?.Dispose(); LocalConfig?.Dispose(); contextFactory?.FlushConnections(); }
private void saveConfiguration(LocalConfig config) { var jsonSerializerSettings = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }; var json = JsonConvert.SerializeObject(config, jsonSerializerSettings); File.WriteAllText(this._configFileFullPath, json); }
protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); RulesetStore?.Dispose(); BeatmapManager?.Dispose(); LocalConfig?.Dispose(); realm?.Dispose(); }
public static async Task <APIResponse> CheckSession(LocalConfig config) { try { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, new Uri(config.Server + "/api/v1/users/me")); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", config.Token); bool rateLimited = false; HttpResponseMessage response = null; while (!rateLimited) { response = await client.SendAsync(request); if ((int)response.StatusCode == 429) { await Task.Delay(1000); } else { rateLimited = true; } } string responseContent = await response.Content.ReadAsStringAsync(); if (response.StatusCode != HttpStatusCode.OK) { APIErrorResponse error = JsonConvert.DeserializeObject <APIErrorResponse>(responseContent); return(new APIResponse() { Success = false, Error = error.Message }); } APIBaseURL = new Uri(config.Server + "/api/v1/"); Token = config.Token; MyID = config.UserID; Team = LocalStorage.GetByID <Team>("teams", config.TeamID); return(new APIResponse() { Success = true }); } catch (Exception e) { return(new APIResponse() { Success = false, Error = e.Message }); } }
// 应用本地设置 private void applyLocalConfig() { srcPathInput.Text = LocalConfig.GetInstance().Get <String>("srcPath"); dstPathInput.Text = LocalConfig.GetInstance().Get <String>("dstPath"); float defaultScale = 1.0f; scaleInput.Text = defaultScale.ToString("0.0"); imagePathInput.Text = "animation"; }
private void updateActiveState(bool isActive) { if (isActive) { this.TransformBindableTo(inactiveVolumeFade, 1, 400, Easing.OutQuint); } else { this.TransformBindableTo(inactiveVolumeFade, LocalConfig.Get <double>(OsuSetting.VolumeInactive), 4000, Easing.OutQuint); } }
private void LoadLocalSettings() { LocalConfig.Load(LocalSettings); _updater.LastPatchId = LocalSettings.LastPatchId; if (!LocalSettings.Save) { return; } Login = LocalSettings.Login.Trim(); Password = Encoder.Decode(LocalSettings.Password); Save = LocalSettings.Save; }
async void CheckConfig(LocalConfig config) { APIResponse response = await MattermostAPI.CheckSession(config); APIResponse <List <User> > users = await MattermostAPI.GetUsers(); APIResponse <List <Channel> > channels = await MattermostAPI.GetChannels(); APIResponse <Preferences> preferences = await MattermostAPI.GetPreferences(); CurrentView = new MessageViewModel(this, users.Value, channels.Value); }
public void InitConfig() { var fileName = ("File" + Path.DirectorySeparatorChar + "Config" //FIXME Move path to appSettings + Path.DirectorySeparatorChar + "ladderlogic.conf.xml").GetAbsolutePath(); /*config = new LocalConfig (); * var result = ConfigManager.Write (config, fileName); * if (!result) { * throw new Exception ("write error for config"); * }*/ Config = ConfigManager.Read <LocalConfig>(fileName); }
protected override void LoadComplete() { base.LoadComplete(); // TODO: This is temporary until we reimplement the local FPS display. // It's just to allow end-users to access the framework FPS display without knowing the shortcut key. fpsDisplayVisible = LocalConfig.GetBindable <bool>(OsuSetting.ShowFpsDisplay); fpsDisplayVisible.ValueChanged += visible => { FrameStatistics.Value = visible.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; fpsDisplayVisible.TriggerChange(); FrameStatistics.ValueChanged += e => fpsDisplayVisible.Value = e.NewValue != FrameStatisticsMode.None; }
void Login() { lock (lock_localconfig) //防止多线程冲突 { localConfig = new LocalConfig(); localConfig.username = username.Text; localConfig.password = password.Text; localConfig.autoStart = checkbox_autostart.Checked; localConfig.Save(); } }
public void TestBeatmapSkinDefault() { AddStep("enable user provider", () => testUserSkin.Enabled = true); AddStep("enable beatmap skin", () => LocalConfig.Set <bool>(OsuSetting.BeatmapSkins, true)); checkNextHitObject("beatmap"); AddStep("disable beatmap skin", () => LocalConfig.Set <bool>(OsuSetting.BeatmapSkins, false)); checkNextHitObject("user"); AddStep("disable user provider", () => testUserSkin.Enabled = false); checkNextHitObject(null); }
public static DeviceConfig Configure(DeviceConfig edgeConfig, LocalConfig localConfig) { metadataHandlers = new List <MetadataHandler> { ConfigureTemplate, ConfigureIoTHubConnectionString, ConfigureStorageConnectionString }; foreach (var handler in metadataHandlers) { edgeConfig = handler(edgeConfig, localConfig); } return(edgeConfig); }
/// <summary>Build base texture by combining face, nose, bottom, and shoe choice.</summary> /// <param name="player">The player to patch.</param> /// <param name="config">The config to patch.</param> /// <param name="which">The config number to use.</param> public void PatchBaseTexture(SFarmer player, LocalConfig config, int which = 0) { if (config.MutiplayerFix) { player.FarmerRenderer.textureName.Set("KisekaeBase_" + (player.IsMale ? "male_" : "female_") + config.ChosenFace[which] + "_" + config.ChosenNose[which] + "_" + config.ChosenBottoms[which] + "_" + config.ChosenShoes[which]); } else { Texture2D playerTextures = LoadBaseTexture(player.isMale ? "male" : "female", new int[] { config.ChosenFace[which], config.ChosenNose[which], config.ChosenBottoms[which], config.ChosenShoes[which] }); IReflectedField <Texture2D> curBaseTexture = m_env.Helper.Reflection.GetField <Texture2D>(player.FarmerRenderer, "baseTexture"); curBaseTexture.SetValue(playerTextures); } }
private bool TestItemIni() { TestItem testItem = (TestItem)LocalConfig.GetObjFromXmlFile("config\\testitem.xml", typeof(TestItem)); chkList_Diff.Items.Clear(); chkList_Single.Items.Clear(); chkList_TDR.Items.Clear(); chkList_SPair.Items.Clear(); chkList_NextPair.Items.Clear(); chkList_FextPair.Items.Clear(); foreach (string temp in testItem.Diff) { chkList_Diff.Items.Add(temp, false); } foreach (string temp in testItem.Single) { chkList_Single.Items.Add(temp, false); } foreach (string temp in testItem.Tdr) { chkList_TDR.Items.Add(temp, false); } foreach (string temp in testItem.DiffPair) { chkList_SPair.Items.Add(temp, false); } foreach (string temp in testItem.NextPair) { chkList_NextPair.Items.Add(temp, false); } foreach (string temp in testItem.FextPair) { chkList_FextPair.Items.Add(temp, false); } foreach (string temp in testItem.Speed) { cmbSpeed.Items.Add(temp); } foreach (string temp in testItem.ProductType) { cmbTypeL.Items.Add(temp); cmbTypeR.Items.Add(temp); } foreach (string temp in testItem.Power) { cmbPower.Items.Add(temp); } return(true); }
private void NextBtn_Click(object sender, RoutedEventArgs e) { int step = StepServices.GetCompletedStepCount(ViewModel.Steps); switch (step) { case 1: if (classificationPage.ViewModel.HasSelection) { propertyPage.ViewModel.GetAllProperties(classificationPage.ViewModel.SelectedClasses); propertyPage.UpdateSelection(); Workspace1.Content = propertyPage; StepControl.Content = new StepUserControl(ViewModel.MoveSteps()); } else { NoticeShow(ResourceExtensions.GetLocalized("ValidatorPage_Notice_NoClasses")); } break; case 2: if (propertyPage.ViewModel.HasSelection) { LocalConfig.SaveConfigFile(propertyPage.ViewModel.SelectedClasses); Workspace1.Content = inputFilePage; StepControl.Content = new StepUserControl(ViewModel.MoveSteps()); } else { NoticeShow(ResourceExtensions.GetLocalized("ValidatorPage_Notice_NoProps")); } break; case 3: if (inputFilePage.ViewModel.InputFiles.Count > 0) { reportPage.ViewModel.LoadReport(inputFilePage.ViewModel.InputFiles, propertyPage.ViewModel.SelectedClasses); StepControl.Content = new StepUserControl(ViewModel.MoveSteps()); Workspace1.Content = reportPage; } else { NoticeShow(ResourceExtensions.GetLocalized("ValidatorPage_Notice_NoFile")); } break; default: break; } }
public void Start(int port, int inPort, int respondePort) { var ip = new IPEndPoint(IPAddress.Parse("235.5.5.11"), inPort); searching = new SearchProtocol(_logger, ip, respondePort, NodeName); searching.IPFound += nodeFound; Task.Run(() => searching.ListenForRequests()); Task.Run(() => searching.ListenForResponses()); _logger.LogMessage("Starting"); _listener = new TcpListener(LocalConfig.GetLocalIP(), port); _listener.Start(); _listening = new Task(ListenConnections); _listening.Start(); }
private void PnChangeHandle(string pn) { ResetUi(); string msg = ""; _curretnProject = ProjectHelper.Find(pn); _hardware = (Hardware)LocalConfig.GetObjFromXmlFile("config\\hardware.xml", typeof(Hardware)); if (_curretnProject == null) { //AddStatus("未能找到对应的料号档案"); AddStatus(LanguageHelper.GetMsgText("未能找到对应的料号档案")); return; } //AddStatus("成功找到对应的料号档案"); AddStatus(LanguageHelper.GetMsgText("成功找到对应的料号档案")); if (_hardware == null) { AddStatus("未能找到对应的硬件设置档案"); return; } AddStatus("成功找到对应硬件设置档案"); if (!Util.SetHardware(_hardware, ref _switch, ref _iAnalyzer, ref msg, BlockedMsg)) { AddStatus(msg); return; } _iAnalyzer.LoadCalFile(_curretnProject.CalFilePath, ref msg); AddStatus("连接开关成功"); AddStatus("连接网分设备成功"); bool setProjectFlag = Util.SetTestParams(_curretnProject, ref _testConfigs); if (!setProjectFlag) { AddStatus("开关对数与测试对数不一致"); return; } SetInformation(); _spec = TestUtil.GetPnSpec(_curretnProject); ClearTestItems(); DisplayTestItems(); AddCharts(); SetKeyPoint(); btnTest.Enabled = true; txtSN.Focus(); }
protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); RulesetStore?.Dispose(); BeatmapManager?.Dispose(); LocalConfig?.Dispose(); realm?.Dispose(); if (Host != null) { Host.ExceptionThrown -= onExceptionThrown; } }
void Init() { var verticalView = new VerticalView(); mInstalledPackageListPage = new UIInstalledPackageListPage(LocalConfig); verticalView.AddChild(mInstalledPackageListPage); LocalConfig.GetRemote(remotePackageListConfig => { mOnlinePackageListPage = new UIOnlinePackageListPage(remotePackageListConfig); verticalView.AddChild(mOnlinePackageListPage); }); AddChild(verticalView); }
CController () { Rules = new List<FunctionRule.FunctionRule>{ new CoilRule(), new LatchRule(), new NcContactRule(), new NoContactRule(), new NotCoilRule(), new OffTimerRule(), new OnTimerRule(), new CycleTimerRule(), new PulseTimerRule(), new SetCoilRule(), new ResetCoilRule() }; Cfg = AppController.Instance.Config; }
public void InitConfig() { var fileName = ("File" + Path.DirectorySeparatorChar + "Config" //FIXME Move path to appSettings + Path.DirectorySeparatorChar + "ladderlogic.conf.xml").GetAbsolutePath (); Config = ConfigManager.Read<LocalConfig>(fileName); }