public MainWindow() { InitializeComponent(); ConfigurationPath = AppDomain.CurrentDomain.BaseDirectory; textBox1.Text = AppDomain.CurrentDomain.BaseDirectory; textBox.Text = JsonConvert.SerializeObject(CSGOData.Config); SelectedCfg = "Settings.cfg"; if (!ConfigurationPath.EndsWith("\\")) { ConfigurationPath += "\\"; } if (!File.Exists(ConfigurationPath + SelectedCfg)) { statustextBlock.Text = "Not found " + ConfigurationPath + SelectedCfg; return; } var text = File.ReadAllText(ConfigurationPath + SelectedCfg); }
private void loadModule_Click(object sender, System.Windows.RoutedEventArgs e) { var selected = (string)listBoxAvailable.SelectedItem; if (selected == null) { statustextBlock.Text = "Not selected item " + ConfigurationPath + selected; return; } if (!ConfigurationPath.EndsWith("\\")) { ConfigurationPath += "\\"; } if (!File.Exists(ConfigurationPath + selected)) { statustextBlock.Text = "Not found " + ConfigurationPath + selected; return; } SelectedCfg = selected; var text = File.ReadAllText(ConfigurationPath + selected); textBox.Text = text; statustextBlock.Text = "Loaded " + ConfigurationPath + selected; }