//
        //Internal Config
        //
        private void ConfigureButton_Click(object sender, EventArgs e)
        {
            progressIntNetwork.Value = 5;

            //call the extract data class,and get the list
            ExtractData extractInternalData = new ExtractData();

            extractInternalData.Extract_Internal_Data();
            List <string> internalExtractedData = extractInternalData.GetInternalList();
            string        path = ExtractData.internalBecFilePath;

            if (path == null)
            {
                return;
            }

            //get the fourth octet of the firewall IP from config file
            string firewallIP_FO = ConfigurationManager.AppSettings.Get("FirewallIP");

            //produce the subnet IP & the firewall IP from the internal IP
            internalIPAddr = internalExtractedData[0];
            string[] internalIPArray = internalIPAddr.Split('.');
            BNAUSubnetIP             = internalIPArray[0] + "." + internalIPArray[1] + "." + internalIPArray[2];
            firewallIPAddr           = BNAUSubnetIP + firewallIP_FO;
            ConfigBNAUSubnetBox.Text = BNAUSubnetIP;

            progressIntNetwork.Value = 15;

            //call the putty internal class
            Putty internalConfig = new InternalPutty(internalIPAddr, firewallIPAddr);

            internalConfig.Configure();

            progressIntNetwork.Value = 80;

            //get the ping success result
            if (Putty.consoleOutput.Contains("bytes from " + internalIPAddr))
            {
                pingBNAUResult = true;
            }
            else
            {
                pingBNAUResult = false;
            }

            //determine whether cable is connected from ifconfig status
            if (Putty.consoleOutput.Contains("status: active"))
            {
                BNAUPlugged = true;
            }
            else
            {
                BNAUPlugged = false;
            }
            progressIntNetwork.Value = 85;
            //write log file
            WriteLog writeLog = new InternalLog();

            writeLog.WriteLogFile();
            progressIntNetwork.Value = 90;

            //go to next page if it succeeded
            if (Putty.configSuccess == true)
            {
                progressIntNetwork.Value = 100;
                //Hide current tab and show next
                BNAUWizard.TabPages.Clear();
                BNAUWizard.TabPages.Add(OSPF);
            }
            else
            {
                progressIntNetwork.Value = 0;
                return;
            }
        }
Ejemplo n.º 2
0
        private void ConfigureButton_Click(object sender, EventArgs e)
        {
            progressDMZNetwork.Value = 5;
            //call the extract data class, saying that this is the LDG plan and get the list
            ExtractData extractDMZData = new ExtractData();

            extractDMZData.Extract_LDG_Data();
            List <string> externalExtractedData = extractDMZData.GetLDGList();

            becFilePath = ExtractData.DMZBecFilePath;
            if (becFilePath == null)
            {
                return;
            }

            //Share plan to virtual disk
            string sharedFolderPath = @"E:\Plan Files";

            //check if shared disk exists
            if (Directory.Exists(@"E:\"))
            {
                //get the directory of the plan from the becfilepath
                string[] becFilePathArray = becFilePath.Split('\\');
                Array.Resize(ref becFilePathArray, becFilePathArray.Length - 3);
                planSourcePath = String.Join("\\", becFilePathArray);

                //if folder doesn't exist create it
                if (!Directory.Exists(sharedFolderPath))
                {
                    Directory.CreateDirectory(sharedFolderPath);
                }

                //copy the files from plan to shared folder
                try
                {
                    //create the folders
                    foreach (string dirPath in Directory.GetDirectories(planSourcePath, "*", SearchOption.AllDirectories))
                    {
                        Directory.CreateDirectory(dirPath.Replace(planSourcePath, sharedFolderPath));
                    }
                    //copy all files and replace any withsame name
                    foreach (string newPath in Directory.GetFiles(planSourcePath, "*.*", SearchOption.AllDirectories))
                    {
                        File.Copy(newPath, newPath.Replace(planSourcePath, sharedFolderPath), true);
                    }
                    MessageBox.Show("Plan successfully copied to shared disk: " + Environment.NewLine + sharedFolderPath, "Plan Copied to Shared Disk", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception)
                {
                    MessageBox.Show("Error copying file to " + sharedFolderPath + ". Plan not copied to shared Disk.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Shared Disk not found, Plan not copied to shared Disk.", "Shared Disk not present", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            progressDMZNetwork.Value = 15;

            //produce the subnet IP & the firewall IP from the internal IP
            DMZchatGW = externalExtractedData[2];

            //call the configure via putty class
            Putty DMZ_Config = new DMZPutty(DMZchatGW);

            DMZ_Config.Configure();

            progressDMZNetwork.Value = 80;

            //determine whether cable is connected from ifconfig status
            if (DMZPutty.consoleOutput.Contains("status: active"))
            {
                DMZPlugged = true;
            }
            else
            {
                DMZPlugged = false;
            }

            progressDMZNetwork.Value = 85;

            //write log file
            WriteLog writeLog = new DMZLog();

            writeLog.WriteLogFile();
            progressDMZNetwork.Value = 90;

            //go to next page if it succeeded
            if (Putty.configSuccess == true)
            {
                progressDMZNetwork.Value = 100;
                DMZWizard.TabPages.Clear();
                DMZWizard.TabPages.Add(OSPF);
            }
            else
            {
                progressDMZNetwork.Value = 0;
                return;
            }
        }
Ejemplo n.º 3
0
        //
        // Choose Services Tab
        //

        //Next button on choose page
        private void nextFromChoose_Click(object sender, EventArgs e)
        {
            //if no services are selected throw error
            if (!chatCheckBox.Checked && !mailCheckBox.Checked && !OSWCheckBox.Checked && !tracksCheckBox.Checked)
            {
                MessageBox.Show("Please Select a Service to Configure", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Show the terminals for the tracks and chat listviews:
            //call the extract data class, and get the list
            ExtractData extractList = new ExtractData();

            extractList.Extract_LDG_Data();
            List <string> serviceRolesList = extractList.GetServiceList();

            //get the first dns from the bec file to compare against user selection (second in list)
            List <string> LDGList = extractList.GetLDGList();

            //if list returned empty (user canceled dialog) then return
            if (LDGList.Count == 0)
            {
                return;
            }

            //find primary DNS
            firstDNS = LDGList[2];

            //create and manage the headers
            ColumnHeader tracksHeader = new ColumnHeader();
            ColumnHeader chatHeader   = new ColumnHeader();
            ColumnHeader mailHeader   = new ColumnHeader();
            ColumnHeader OSWHeader    = new ColumnHeader();

            tracksHeader.Text = chatHeader.Text = mailHeader.Text = OSWHeader.Text = "Terminals";
            tracksHeader.Name = chatHeader.Name = mailHeader.Name = OSWHeader.Name = "Terminals";

            tracksListView.Columns.Add(tracksHeader);
            tracksHeader.Width = tracksListView.Width;

            chatListView.Columns.Add(chatHeader);
            chatHeader.Width = chatListView.Width;

            mailListView.Columns.Add(mailHeader);
            mailHeader.Width = mailListView.Width;

            OSWListView.Columns.Add(OSWHeader);
            OSWHeader.Width = OSWListView.Width;

            tracksListView.View = View.Details;
            chatListView.View   = View.Details;
            mailListView.View   = View.Details;
            OSWListView.View    = View.Details;

            //resize the colomuns
            tracksListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            chatListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            mailListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            OSWListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            tracksListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            chatListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            mailListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            OSWListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

            //Populates the listviews with the terminals for user to select
            foreach (string terminal in serviceRolesList)
            {
                chatListView.Items.Add(terminal);
                tracksListView.Items.Add(terminal);
                mailListView.Items.Add(terminal);
                OSWListView.Items.Add(terminal);
            }

            //go to relative tabs based on selection of check boxes
            if (tracksCheckBox.Checked)
            {
                //if tracks is selected go to tracks tab etc..
                servicesWizard.TabPages.Clear();
                servicesWizard.TabPages.Add(tracksTab);
            }
            else if (chatCheckBox.Checked)
            {
                servicesWizard.TabPages.Clear();
                servicesWizard.TabPages.Add(chatTab);
            }
            else if (mailCheckBox.Checked)
            {
                servicesWizard.TabPages.Clear();
                servicesWizard.TabPages.Add(mailTab);
            }
            else if (OSWCheckBox.Checked)
            {
                servicesWizard.TabPages.Clear();
                servicesWizard.TabPages.Add(OSWTab);
            }
        }