private void parseMessagesAndShowResults(string messages) { string success = string.Empty; string error = string.Empty; string[] finalMessages = messages.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); foreach (string mess in finalMessages) { if (mess.IndexOf("failed") == -1) { success += mess + Environment.NewLine; } else { error += mess + Environment.NewLine; } } if (error != "" & error != null) { customError showError = new customError("Error Synchronizing to Service", error); showError.intervalForTimer = 60000; showError.Show(); } if (success != "" & success != null) { success synced = new success(success); synced.Show(); } }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { errorCount = 0; saveSuccess = ""; successCount = 0; saveAllSettings(); if (successCount > 0) { success Yes = new success(saveSuccess); Yes.Show(); } }
private void removeFromStartUp() { string pathToStartUp = Environment.GetFolderPath(Environment.SpecialFolder.Startup); if (File.Exists(pathToStartUp + "\\" + dynamixStartupEntryName)) { File.Delete(pathToStartUp + "\\" + dynamixStartupEntryName); success StartUpRemoved = new success("The startup entry for the Dynamix DNS Client was successfully deleted.\n\nDynamix DNS Client will NOT start with Windows!"); StartUpRemoved.ShowDialog(); } else { MessageBox.Show("There is no startup entry to delete!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void saveButton_Click(object sender, EventArgs e) { /* if(xpertEnable.Checked == false & (login4XPertDNS.Text != "" | XPertDNSPass.Text != "" | XPertDNSConfirmPass.Text != "" | dynIDsXPertDNS.Items.Count > 0)){ * MessageBox.Show("Warning: Your updated settings will not save unless you enable this server!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); * } */ errorCount = 0; saveSuccess = ""; successCount = 0; saveAllSettings(); if (successCount > 0) { success Yes = new success(saveSuccess); Yes.Show(); } }
private void addToStartUp() { string pathToStartUp = Environment.GetFolderPath(Environment.SpecialFolder.Startup); if (!File.Exists(pathToStartUp + "\\" + dynamixStartupEntryName)) { using (ShellLink shortcut = new ShellLink()) { shortcut.Target = Application.ExecutablePath; shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath); shortcut.Description = "Dynamix DNS Client"; shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; //MessageBox.Show(pathToStartUp, "info"); shortcut.Save(pathToStartUp + "\\" + dynamixStartupEntryName); } success StartUpCreated = new success("A startup entry for the Dynamix DNS Client was successfully created.\n\nDynamix DNS Client will start with Windows!"); StartUpCreated.ShowDialog(); } else { MessageBox.Show("The startup entry already exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void runExternalApps() { if (appSettings.ExternalScriptToRun.Any()) { string errorsForScripts = "", successesForScripts = ""; foreach (string prog in appSettings.ExternalScriptToRun) { // Add the positonal parameters // Send oldIP and newIP values for to all executables string parameters = " " + oldIP + " " + IPAddress; string extension = ""; if (File.Exists(prog)) { // Check and see if the program has a valid extension. If it is, run it... if not, show error! if (prog.LastIndexOf('.') == -1) { extension = "NO_EXTENSION"; } else { extension = prog.Substring(prog.LastIndexOf('.')); } switch (extension) { case ".php": // Add the positonal parameters // Send oldIP and newIP values for to all executables string runPHPProg = "\"" + prog + "\"" + parameters; // phpPath will not be set to "" if they were prompted in the past for a PHP path since it didn't exist where it was supposed to be (perhaps no installation of Dynamix DNS). if (phpPath != "") { processRun(phpPath, runPHPProg); successesForScripts += prog + " ran successfully!\n"; } else { phpExecutablePrompt phpNew = new phpExecutablePrompt(); if (Application.OpenForms.OfType <phpExecutablePrompt>().Count() > 0) { } else { phpNew.ShowDialog(); } string returnedPath = phpNew.getPath(); phpPath = returnedPath; if (returnedPath != "") { processRun(returnedPath, runPHPProg); successesForScripts += prog + " ran successfully!\n"; } else { errorsForScripts += "Unable to find the php.exe executable on your system! Until the path is entered, you cannot run .php scripts!"; } } break; case ".exe": processRun(prog, parameters); successesForScripts += prog + " ran successfully!\n"; break; case ".bat": processRun(prog, parameters); successesForScripts += prog + " ran successfully!\n"; break; case ".jar": processRun(prog, parameters); successesForScripts += prog + " ran successfully!\n"; break; default: errorsForScripts += prog + " has an invalid extension of " + extension + "! Only .exe, .php, .bat, and .jar are allowed!\n"; break; } } else { errorsForScripts += prog + " doesn't even exist!"; } } if (errorsForScripts != "") { customError newError = new customError("The following scripts did not run because:", errorsForScripts); newError.Show(); //MessageBox.Show(errorsForScripts, "Error Running Scripts", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (successesForScripts != "") { success scriptsHaveRan = new success(successesForScripts); scriptsHaveRan.Show(); } } }