private void btnCreateAll_Click(object sender, RoutedEventArgs e) { try { FixText(); for (var i = 0; i < PlayersContent.Length; i++) { cfg.IniWriteValue("Players", "P" + (i + 1), tBox_FileContent.Text); } for (var p = 0; p < PlayersContent.Length; p++) { PlayersContent[p] = cfg.IniReadValue("Players", "P" + (p + 1)); } Utilities.showMessage(this, "All players files have been saved.", "Saved"); for (var p = 0; p < PlayersContent.Length; p++) { File.WriteAllText(OutputFolder + @"\player_" + (p + 1) + ".txt", "", Encoding.UTF8); } } catch (Exception) { Utilities.showError(this, "Error while saving players files, Please check the output folder."); } finally { Last = ""; After = ""; } }
private void WriteV(Utilities.INIFile inf, String section, String key, String value) { try { inf.IniWriteValue(section, key, value); } catch (Exception) { } }
private void btnBrowseOutput_Click(object sender, RoutedEventArgs e) { var fd = new FolderBrowserDialog(); using (fd) { if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { tBoxOutput.Text = fd.SelectedPath; var inif = new Utilities.INIFile(MainWindow._AssemblyDir + @"\config.ini"); inif.IniWriteValue("HotKey", "Output", tBoxOutput.Text); } } }
private void MatchHistoryWindow_Loaded(object sender, RoutedEventArgs e) { var cfg2 = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini"); if (cfg2.IniReadValue("Match_History_Viewer", "Enabled").ToLower() == "false") { if (MessageBox.Show(this, "Match History Viewer feature is currently disabled.\nDo you want to enable it?", "Match History Viewer", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { cfg2.IniWriteValue("Match_History_Viewer", "Enabled", "true"); } else { Close(); } } LoadMatches(); MatchList.ItemsSource = _matches; }
private void setcfg() { if (IsLoaded) { if (cBoxDontShow.IsChecked == true) { cfgFile.IniWriteValue("Main", "ShowStartScreen", "true"); } else { cfgFile.IniWriteValue("Main", "ShowStartScreen", "false"); } cfgFile.IniWriteValue("Essencial", "Game", cBoxGame.SelectedIndex.ToString()); SelectedGame = cBoxGame.SelectedIndex; } }
private void DisplayerWindow_Loaded(object sender, RoutedEventArgs e) { cfg = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\lsd.ini"); cfg2 = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini"); if (cfg2.IniReadValue("Livestream_Displayer", "Enabled").ToLower() == "false") { if (MessageBox.Show(this, "Livestream Displayer feature is currently disabled.\nDo you want to enable it?", "Livestream Displayer", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { cfg2.IniWriteValue("Livestream_Displayer", "Enabled", "true"); } else { Close(); } } if (!String.IsNullOrEmpty(cfg2.IniReadValue("Livestream_Displayer", "OutputFolder"))) { OutputFolder = cfg2.IniReadValue("Livestream_Displayer", "OutputFolder"); } else { OutputFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\CELO\Livestream Displayer"; } Directory.CreateDirectory(OutputFolder); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\lsd.ini")) { for (var p = 0; p < PlayersContent.Length; p++) { PlayersContent[p] = cfg.IniReadValue("Players", "P" + (p + 1)); } } else { for (var p = 0; p < PlayersContent.Length; p++) { PlayersContent[p] = "%NICK% Ladder rank is %RANK% with a total of %HOURS% hours played"; } tBox_FileContent.Text = "%NICK% Ladder rank is %RANK% with a total of %HOURS% hours played"; FixText(); for (var i = 0; i < PlayersContent.Length; i++) { cfg.IniWriteValue("Players", "P" + (i + 1), tBox_FileContent.Text); } for (var p = 0; p < PlayersContent.Length; p++) { File.WriteAllText(OutputFolder + @"\player_" + (p + 1) + ".txt", "", Encoding.UTF8); } } for (var p = 0; p < PlayersContent.Length; p++) { PlayersContent[p] = cfg.IniReadValue("Players", "P" + (p + 1)); } tBox_FileContent.Text = PlayersContent[playerListBox.SelectedIndex]; Last = PlayersContent[playerListBox.SelectedIndex]; tBox_path.Text = OutputFolder; cfg2.IniWriteValue("Livestream_Displayer", "OutputFolder", tBox_path.Text); }