public void Run(string path) { string vicePath = Settings.Options.VicePath; bool viceFound = false; if (vicePath != null && File.Exists(vicePath)) { viceFound = true; } else { if (MessageBox.Show("WinVICE executable not found; do you want to set a path now?", "Conduit", MessageBoxButtons.YesNo) == DialogResult.Yes) { OptionsDialog dlg = new OptionsDialog(); DialogResult result = dlg.ShowDialogWithOpenTab("tabVICE"); if (result == DialogResult.OK) { vicePath = Settings.Options.VicePath; if (vicePath != null && File.Exists(vicePath)) { viceFound = true; } } } } if (viceFound) { ProcessStartInfo startInfo = new ProcessStartInfo(vicePath); startInfo.Arguments = $"\"{Path.GetFileName(path)}\""; startInfo.WorkingDirectory = Path.GetDirectoryName(path); Process.Start(startInfo); } }
public bool Run(string path) { string browserPath = Settings.Options.BrowserPath; bool browserFound = false; if (browserPath != null && File.Exists(browserPath)) { browserFound = true; } else { if (MessageBox.Show("Browser executable not found; do you want to set a path now?", "Conduit", MessageBoxButtons.YesNo) == DialogResult.Yes) { OptionsDialog dlg = new OptionsDialog(); DialogResult result = dlg.ShowDialogWithOpenTab("tabBrowser"); if (result == DialogResult.OK) { browserPath = Settings.Options.BrowserPath; if (browserPath != null && File.Exists(browserPath)) { browserFound = true; } } } } if (browserFound) { ProcessStartInfo startInfo = new ProcessStartInfo(browserPath); var arguments = ""; if (browserPath.Contains("Chrome") && Settings.Options.BrowserAddFileAccessFlag) { arguments = "--allow-file-access-from-files "; } var encodedPath = path; path = path.Replace("\\", "/"); path = System.Web.HttpUtility.UrlPathEncode(path); arguments += $"\"file://{path}\""; startInfo.Arguments = arguments; startInfo.WorkingDirectory = Path.GetDirectoryName(path); var process = Process.Start(startInfo); return(process != null); } return(false); }
public bool Run(string path) { string dosboxPath = Settings.Options.DOSBoxPath; bool dosboxFound = false; if (dosboxPath != null && File.Exists(dosboxPath)) { dosboxFound = true; } else { if (MessageBox.Show("DOSBox executable not found; do you want to set a path now?", "Conduit", MessageBoxButtons.YesNo) == DialogResult.Yes) { OptionsDialog dlg = new OptionsDialog(); DialogResult result = dlg.ShowDialogWithOpenTab("tabDOSBox"); if (result == DialogResult.OK) { dosboxPath = Settings.Options.DOSBoxPath; if (dosboxPath != null && File.Exists(dosboxPath)) { dosboxFound = true; } } } } if (dosboxFound) { ProcessStartInfo startInfo = new ProcessStartInfo(dosboxPath); List <string> arguments = new List <string>(); arguments.Add($"\"{path}\""); arguments.Add($"-noautoexec"); arguments.Add($"-exit"); startInfo.Arguments = string.Join(" ", arguments); var process = Process.Start(startInfo); return(process != null); } return(false); }