private void btnCustomTemplates_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); if (string.IsNullOrWhiteSpace(config.CustomTemplates)) { dlg.FileName = "*.scriban"; dlg.InitialDirectory = Path.GetDirectoryName(GeneratorConfig.GetConfigurationFilePath()); } else { dlg.FileName = "*.scriban"; dlg.InitialDirectory = config.CustomTemplates; } Nullable <bool> result = dlg.ShowDialog(); if (result == true) { CustomTemplates = Path.GetDirectoryName(dlg.FileName); config.Save(); } }
private void btnTSCPathBrowse_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); if (string.IsNullOrWhiteSpace(config.TSCPath)) { dlg.FileName = "*.exe"; dlg.InitialDirectory = Path.GetDirectoryName(GeneratorConfig.GetConfigurationFilePath()); } else { dlg.FileName = Path.GetFileName(config.TSCPath); dlg.InitialDirectory = Path.GetDirectoryName(config.TSCPath); } Nullable <bool> result = dlg.ShowDialog(); if (result == true) { TSCPath = dlg.FileName; config.Save(); } }
private void WebProjectFileBrowse(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); if (string.IsNullOrWhiteSpace(WebProjectFile)) { dlg.FileName = "*.csproj"; dlg.InitialDirectory = Path.GetDirectoryName(GeneratorConfig.GetConfigurationFilePath()); } else { var webProjectFile = Path.GetFullPath(WebProjectFile); dlg.FileName = Path.GetFileName(webProjectFile); dlg.InitialDirectory = Path.GetDirectoryName(webProjectFile); } Nullable <bool> result = dlg.ShowDialog(); if (result == true) { WebProjectFile = GeneratorConfig.GetRelativePath(dlg.FileName, AppDomain.CurrentDomain.BaseDirectory); config.Save(); } }
public void Save() { Connections.Sort((x, y) => x.Key.CompareTo(y.Key)); File.WriteAllText(GeneratorConfig.GetConfigurationFilePath(), JSON.StringifyIndented(this)); }
public void Save() { Connections.Sort((x, y) => x.Key.CompareTo(y.Key)); CodeFileHelper.CheckoutAndWrite(GeneratorConfig.GetConfigurationFilePath(), JSON.StringifyIndented(this), false); }