private void Form1_Shown(object sender, EventArgs e) { RegistryEditor regEdit = new RegistryEditor(); string[] args = Environment.GetCommandLineArgs(); if (args.Length > 1 && File.Exists(args[1])) { loadUBMFile(args[1]); } else { string filePath = (string)regEdit.ReadFromRegistry("defaultFile", "Software\\UnityBuildManager", false, ""); if (filePath != "") { loadUBMFile(filePath); } } string unityPath = (string)regEdit.ReadFromRegistry("Location x64", "Software\\Unity Technologies\\Installer\\Unity", false, ""); if (unityPath == "") { string unityOurRegPath = (string)regEdit.ReadFromRegistry("unityPath", "Software\\UnityBuildManager", false, ""); if (unityOurRegPath == "") { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Unity Editor Executable | *.exe"; ofd.Title = "Select Unity Editor Executable"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { unityExec = ofd.FileName; regEdit.WriteToRegistry("unityPath", "Software\\UnityBuildManager", unityExec); } } else { unityExec = unityOurRegPath; } } else { unityExec = unityPath + "\\Editor\\Unity.exe"; if (File.Exists(unityExec)) { regEdit.WriteToRegistry("unityPath", "Software\\UnityBuildManager", unityExec); } } Process process = new Process(); ProcessStartInfo info = new ProcessStartInfo("Unity.exe", "Args"); }
private void setDefaultBtn_Click(object sender, EventArgs e) { if (pendingChanges) { promptSaveChanges(); } RegistryEditor regedit = new RegistryEditor(); if (loadedFileLbl.Text != "--") { regedit.WriteToRegistry("defaultFile", "Software\\UnityBuildManager", loadedFileLbl.Text); } else { regedit.WriteToRegistry("defaultFile", "Software\\UnityBuildManager", string.Empty); } }