private void updateNetLogConfiguration() { NetLogConfiguration netLogConfiguration = new NetLogConfiguration(); if (!String.IsNullOrWhiteSpace(netLogPathTextBox.Text)) { netLogConfiguration.path = netLogPathTextBox.Text.Trim(); } netLogConfiguration.ToFile(); }
public MainWindow() { InitializeComponent(); // Configured the EDDI tab EDDIConfiguration eddiConfiguration = EDDIConfiguration.FromFile(); eddiHomeSystemText.Text = eddiConfiguration.HomeSystem; eddiHomeStationText.Text = eddiConfiguration.HomeStation; eddiInsuranceDecimal.Value = eddiConfiguration.Insurance; debug = eddiConfiguration.Debug; // Configure the Companion App tab CompanionAppCredentials companionAppCredentials = CompanionAppCredentials.FromFile(); // See if the credentials work companionAppService = new CompanionAppService(debug); try { commander = companionAppService.Profile(); setUpCompanionAppComplete("Your connection to the companion app is operational, Commander " + commander.Name); } catch (Exception ex) { if (companionAppService.CurrentState == CompanionAppService.State.NEEDS_LOGIN) { // Fall back to stage 1 setUpCompanionAppStage1(); } else if (companionAppService.CurrentState == CompanionAppService.State.NEEDS_CONFIRMATION) { // Fall back to stage 2 setUpCompanionAppStage2(); } } if (commander != null) { setShipyardFromConfiguration(); } // Configure the NetLog tab NetLogConfiguration netLogConfiguration = NetLogConfiguration.FromFile(); netLogPathTextBox.Text = netLogConfiguration.path; // Configure the EDSM tab StarMapConfiguration starMapConfiguration = StarMapConfiguration.FromFile(); edsmApiKeyTextBox.Text = starMapConfiguration.apiKey; edsmCommanderNameTextBox.Text = starMapConfiguration.commanderName; // Configure the Text-to-speech tab SpeechServiceConfiguration speechServiceConfiguration = SpeechServiceConfiguration.FromFile(); List <String> speechOptions = new List <String>(); speechOptions.Add("Windows TTS default"); try { using (SpeechSynthesizer synth = new SpeechSynthesizer()) { foreach (InstalledVoice voice in synth.GetInstalledVoices()) { if (voice.Enabled) { speechOptions.Add(voice.VoiceInfo.Name); } } } ttsVoiceDropDown.ItemsSource = speechOptions; ttsVoiceDropDown.Text = speechServiceConfiguration.StandardVoice == null ? "Windows TTS default" : speechServiceConfiguration.StandardVoice; } catch (Exception e) { using (System.IO.StreamWriter errLog = new System.IO.StreamWriter(Environment.GetEnvironmentVariable("AppData") + @"\EDDI\speech.log", true)) { errLog.WriteLine("" + System.Threading.Thread.CurrentThread.ManagedThreadId + ": Caught exception " + e); } } ttsVolumeSlider.Value = speechServiceConfiguration.Volume; ttsRateSlider.Value = speechServiceConfiguration.Rate; ttsEffectsLevelSlider.Value = speechServiceConfiguration.EffectsLevel; ttsDistortCheckbox.IsChecked = speechServiceConfiguration.DistortOnDamage; ttsTestShipDropDown.ItemsSource = ShipDefinitions.ShipModels; ttsTestShipDropDown.Text = "Adder"; }
public void TestNetLogConfiguration2() { NetLogConfiguration configuration = NetLogConfiguration.FromFile(); Assert.AreEqual("C:\\Program Files (x86)\\Elite\\Products\\elite-dangerous-64\\Logs", configuration.path); }
public void TestNetLogConfiguration() { NetLogConfiguration configuration = JsonConvert.DeserializeObject <NetLogConfiguration>("{\"path\":\"test\"}"); Assert.AreEqual("test", configuration.path); }