private void ValidateConfig() { EditorConfig config = EditorConfig.Get(); if (!File.Exists(config.ClientExecutablePath)) { throw new FileNotFoundException($"Client executable not found: {config.ClientExecutablePath}"); } }
private void previewToolStripMenuItem_Click(object sender, System.EventArgs e) { EditorConfig config = EditorConfig.Get(); Process process = new Process { StartInfo = new ProcessStartInfo { FileName = Path.GetFullPath(config.ClientExecutablePath), Arguments = $"--map \"{Path.GetFullPath(currentMapPath)}\"" } }; process.Start(); process.WaitForExit(); }
public static EditorConfig Get() { const string EDITOR_CONFIG_PATH = "editor.json"; if (!File.Exists(EDITOR_CONFIG_PATH)) { throw new FileNotFoundException($"Editor config file not found: {EDITOR_CONFIG_PATH}"); } if (instance == null) { instance = JsonConvert.DeserializeObject <EditorConfig>( File.ReadAllText(EDITOR_CONFIG_PATH) ); } return(instance); }