private void treeViewScriptFiles_MouseDoubleClick(object sender, MouseEventArgs e) { TreeView tree = sender as TreeView; ExecuteBackgroundTask form = new ExecuteBackgroundTask("Script Execution", "Executing Script", "ExecuteScriptFile", ProcessesManager.SCRIPT_FILES_DIRECTORY + tree.SelectedNode.Text, manager); form.ShowDialog(); }
public void LaunchConfigurationFile(string filePath) { ManageSites sites = new ManageSites(); ProcessLauncher launcher = new ProcessLauncher(); string[] tokens = null, lines = File.ReadAllLines(filePath); int l = 1; logServer.LogFile = "Log" + Path.GetFileName(filePath); File.CreateText(LOG_FILES_DIRECTORY + logServer.LogFile).Close(); parentForm.ReloadLogFiles(); foreach (string line in lines) { if (Regex.IsMatch(line, ParseUtil.SITE)) { tokens = Regex.Split(line, ParseUtil.SPACE); if (!tokens[3].Equals("none")) sites.CreateSiteWithParent(tokens[1], tokens[3]); sites.CreateSite(tokens[1]); } else if (Regex.IsMatch(line, ParseUtil.PROCESS)) { tokens = Regex.Split(line, ParseUtil.SPACE); string processType = tokens[3]; string port = ParseUtil.ExtractPortFromURL(tokens[7]); processes.Add(tokens[1], tokens[7]); parentForm.Invoke(new AddProcess(parentForm.AddToGenericProcesses), tokens[1]); if (processType.Equals("publisher")) { parentForm.Invoke(new AddProcess(parentForm.AddToPublishersProcesses), tokens[1]); launcher.AddNode(new LaunchPublisher(tokens[1], ParseUtil.ExtractIPFromURL(tokens[7]), port, tokens[5])); } else if (processType.Equals("subscriber")) { parentForm.Invoke(new AddProcess(parentForm.AddToSubscribersProcesses), tokens[1]); launcher.AddNode(new LaunchSubscriber(tokens[1], ParseUtil.ExtractIPFromURL(tokens[7]), port, tokens[5])); } else if (processType.Equals("broker")) { sites.AddBrokerUrlToSite(tokens[5], tokens[7],tokens[1]); launcher.AddNode(new LaunchBroker(tokens[1], ParseUtil.ExtractIPFromURL(tokens[7]), port, tokens[5])); } } else if (Regex.IsMatch(line, ParseUtil.ROUTING)) { tokens = Regex.Split(line, ParseUtil.SPACE); launcher.RoutingPolicy = tokens[1]; } else if (Regex.IsMatch(line, ParseUtil.ORDERING)) { tokens = Regex.Split(line, ParseUtil.SPACE); launcher.OrderingPolicy = tokens[1]; } else if (Regex.IsMatch(line, ParseUtil.LOGGING_LEVEL)) { tokens = Regex.Split(line, ParseUtil.SPACE); launcher.LogLevel = tokens[1]; } else if(line != string.Empty) //Syntax error in a script instruction. Abort. { processes.Clear(); File.Delete(LOG_FILES_DIRECTORY + logServer.LogFile); parentForm.ReloadLogFiles(); MessageBox.Show("Syntax Error at line " + l + " :" + Environment.NewLine + Environment.NewLine + line , "Script Abort", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } l++; } //Execute Asynchronous Launching... ExecuteBackgroundTask task = new ExecuteBackgroundTask("Booting System"," Initializing", "LaunchAllProcesses", sites, launcher); task.ShowDialog(); }
private void treeViewScriptFiles_MouseDoubleClick(object sender, MouseEventArgs e) { TreeView tree = sender as TreeView; ExecuteBackgroundTask form = new ExecuteBackgroundTask("Script Execution","Executing Script","ExecuteScriptFile", ProcessesManager.SCRIPT_FILES_DIRECTORY + tree.SelectedNode.Text,manager); form.ShowDialog(); }
public void LaunchConfigurationFile(string filePath) { ManageSites sites = new ManageSites(); ProcessLauncher launcher = new ProcessLauncher(); string[] tokens = null, lines = File.ReadAllLines(filePath); int l = 1; logServer.LogFile = "Log" + Path.GetFileName(filePath); File.CreateText(LOG_FILES_DIRECTORY + logServer.LogFile).Close(); parentForm.ReloadLogFiles(); foreach (string line in lines) { if (Regex.IsMatch(line, ParseUtil.SITE)) { tokens = Regex.Split(line, ParseUtil.SPACE); if (!tokens[3].Equals("none")) { sites.CreateSiteWithParent(tokens[1], tokens[3]); } sites.CreateSite(tokens[1]); } else if (Regex.IsMatch(line, ParseUtil.PROCESS)) { tokens = Regex.Split(line, ParseUtil.SPACE); string processType = tokens[3]; string port = ParseUtil.ExtractPortFromURL(tokens[7]); processes.Add(tokens[1], tokens[7]); parentForm.Invoke(new AddProcess(parentForm.AddToGenericProcesses), tokens[1]); if (processType.Equals("publisher")) { parentForm.Invoke(new AddProcess(parentForm.AddToPublishersProcesses), tokens[1]); launcher.AddNode(new LaunchPublisher(tokens[1], ParseUtil.ExtractIPFromURL(tokens[7]), port, tokens[5])); } else if (processType.Equals("subscriber")) { parentForm.Invoke(new AddProcess(parentForm.AddToSubscribersProcesses), tokens[1]); launcher.AddNode(new LaunchSubscriber(tokens[1], ParseUtil.ExtractIPFromURL(tokens[7]), port, tokens[5])); } else if (processType.Equals("broker")) { sites.AddBrokerUrlToSite(tokens[5], tokens[7], tokens[1]); launcher.AddNode(new LaunchBroker(tokens[1], ParseUtil.ExtractIPFromURL(tokens[7]), port, tokens[5])); } } else if (Regex.IsMatch(line, ParseUtil.ROUTING)) { tokens = Regex.Split(line, ParseUtil.SPACE); launcher.RoutingPolicy = tokens[1]; } else if (Regex.IsMatch(line, ParseUtil.ORDERING)) { tokens = Regex.Split(line, ParseUtil.SPACE); launcher.OrderingPolicy = tokens[1]; } else if (Regex.IsMatch(line, ParseUtil.LOGGING_LEVEL)) { tokens = Regex.Split(line, ParseUtil.SPACE); launcher.LogLevel = tokens[1]; } else if (line != string.Empty) //Syntax error in a script instruction. Abort. { processes.Clear(); File.Delete(LOG_FILES_DIRECTORY + logServer.LogFile); parentForm.ReloadLogFiles(); MessageBox.Show("Syntax Error at line " + l + " :" + Environment.NewLine + Environment.NewLine + line, "Script Abort", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } l++; } //Execute Asynchronous Launching... ExecuteBackgroundTask task = new ExecuteBackgroundTask("Booting System", " Initializing", "LaunchAllProcesses", sites, launcher); task.ShowDialog(); }