private bool LoadConfig() { // config.json 읽기 String jsonString; try { vo.JsonConfig jsonConfig = vo.JsonConfig.getInstance(); if (!File.Exists(jsonConfig.configFileName)) { MessageBox.Show("config.json 파일이 없습니다.\n환경설정 파일을 읽지 못했습니다.\n기본값으로 설정합니다.", "경고", MessageBoxButton.OK); jsonString = JsonSerializer.Serialize(jsonConfig); File.WriteAllText(jsonConfig.configFileName, jsonString); } else { jsonString = File.ReadAllText(jsonConfig.configFileName); jsonConfig = JsonSerializer.Deserialize <vo.JsonConfig>(jsonString); TxtBoxInputPath.Text = jsonConfig.CurrentInputPath; TxtBoxOutputPath.Text = jsonConfig.CurrentOutputPath; ChkIsInputPathReculsive.IsChecked = jsonConfig.IsRecursive; } } catch (Exception e) { } return(true); }
private void TxtBoxOutputPath_TextChanged(object sender, TextChangedEventArgs e) { var thisTextBox = sender as System.Windows.Controls.TextBox; vo.JsonConfig jsonConfig = vo.JsonConfig.getInstance(); jsonConfig.CurrentOutputPath = thisTextBox.Text; String jsonString = JsonSerializer.Serialize(jsonConfig); File.WriteAllText(jsonConfig.configFileName, jsonString); }
private void ChkIsInputPathReculsive_Unchecked(object sender, RoutedEventArgs e) { var thisCheckBox = sender as System.Windows.Controls.CheckBox; vo.JsonConfig jsonConfig = vo.JsonConfig.getInstance(); jsonConfig.IsRecursive = false; String jsonString = JsonSerializer.Serialize(jsonConfig); File.WriteAllText(jsonConfig.configFileName, jsonString); }
private void TxtBoxInputPath_TextChanged(object sender, TextChangedEventArgs e) { var thisTextBox = sender as System.Windows.Controls.TextBox; if (!String.IsNullOrEmpty(thisTextBox.Text)) { ChkIsInputPathReculsive.IsEnabled = true; } else { ChkIsInputPathReculsive.IsEnabled = false; } vo.JsonConfig jsonConfig = vo.JsonConfig.getInstance(); jsonConfig.CurrentInputPath = thisTextBox.Text; String jsonString = JsonSerializer.Serialize(jsonConfig); File.WriteAllText(jsonConfig.configFileName, jsonString); }