Ejemplo n.º 1
0
        public void sendEmailNotification(application appClass)
        {
            XmlDocument emailConfig = new XmlDocument();
            emailConfig.Load(executablePath + "\\" + Settings.Default.ConfigXMLFile);

            XmlNode emailList = emailConfig.SelectSingleNode("settings/email");

            //Locate elements from the XML
            XmlNode hostInformation = emailList.SelectSingleNode("host");
            XmlNode portInformation = emailList.SelectSingleNode("port");
            XmlNode usernameInformation = emailList.SelectSingleNode("username");
            XmlNode passwordInformation = emailList.SelectSingleNode("password");
            XmlNode senderInformation = emailList.SelectSingleNode("sender");
            XmlNode recipientInformation = emailList.SelectSingleNode("recipient");

            string host = hostInformation.InnerText;
            int port = Convert.ToInt32(portInformation.InnerText);
            string username = usernameInformation.InnerText;
            string password = passwordInformation.InnerText;
            string sender = senderInformation.InnerText;
            string recipient = recipientInformation.InnerText;

            SmtpClient client = new SmtpClient();
            client.Host = host;
            client.Port = port;
            client.EnableSsl = false;
            client.Credentials = new NetworkCredential(username, password);

            client.Send(sender, recipient, appClass.ComboBoxValue + " Release", appClass.ReleaseNotesText);
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool validHostInformation = validateHostNameTextbox();
            bool validPortInformation = validatePortTextbox();
            bool validUsernameInformation = validateUsernameTextbox();
            bool validPasswordInformation = validatePasswordTextbox();
            bool validSenderInformation = validateSenderTextbox();
            bool validRecipientInformation = validateRecipientTextbox();

            if (validHostInformation && validPortInformation && validUsernameInformation && validPasswordInformation && validSenderInformation && validRecipientInformation)
            {
                application appClass = new application();
                appClass.EmailHost = smtpHostTextbox.Text;
                appClass.EmailPort = portTextbox.Text;
                appClass.EmailUsername = usernameTextbox.Text;
                appClass.EmailPassword = passwordTextbox.Text;
                appClass.EmailSender = senderTextbox.Text;
                appClass.EmailRecipient = recipientTextbox.Text;

                UpdateConfigXML configureEmailInfo = new UpdateConfigXML();
                configureEmailInfo.configureEmailSettings(appClass);

                Close();
            }
        }
Ejemplo n.º 3
0
        public void updateExistingApplication(application appClass)
        {
            XmlDocument interfaces = new XmlDocument();
            interfaces.Load(executablePath + "\\" + Settings.Default.XMLFile);
            XmlNode node = null;
            XmlNodeList applicationList = interfaces.SelectNodes("applications/application");

            //Sets the base path for the node to what is selected in the combobox
            string selectedApplication = appClass.ComboBoxValue;

            foreach (XmlNode application in applicationList)
            {
                if (application.Attributes["name"].Value == selectedApplication)
                {
                    node = application;
                }
            }

            //Locates the elements from the xml
            XmlAttribute applicationName = node.Attributes["name"];
            XmlNode executableFile = node.SelectSingleNode("executable");
            XmlNode dependencyFiles = node.SelectSingleNode("dependencies");
            XmlNode buildPath = node.SelectSingleNode("build_path");
            XmlNode stagingPath = node.SelectSingleNode("staging_path");

            //Remove the dependency nodes from the xml
            dependencyFiles.RemoveAll();

            //Assigns strings to the textbox values
            string updatedApplicationName = appClass.ApplicationNameText;
            string updatedExecutableFile = appClass.ExecutableNameText;
            string updatedBuildPath = appClass.BuildPathText;
            string updatedStagingPath = appClass.StagingPathText;

            //Create a new dependency node
            string[] dependencies = appClass.DependenciesText.Split(new char[] { '\n' });

            foreach (string dependency in dependencies)
            {
                XmlElement dependencyNode = interfaces.CreateElement("dependency");
                dependencyNode.InnerText = dependency.Trim().ToString();
                if (dependencyNode.InnerText.Trim() != "")
                {
                    dependencyFiles.AppendChild(dependencyNode);
                }
            }

            //Updates the xml with the updated values
            applicationName.Value = updatedApplicationName;
            executableFile.InnerText = updatedExecutableFile;
            buildPath.InnerText = updatedBuildPath;
            stagingPath.InnerText = updatedStagingPath;

            //Saves and updates the xml
            interfaces.Save(executablePath + "\\" + Settings.Default.XMLFile);
        }
Ejemplo n.º 4
0
        public void createNewApplication(application appClass)
        {
            XmlDocument interfaces = new XmlDocument();
            interfaces.Load(executablePath + "\\" + Settings.Default.XMLFile);

            //Create a new application node
            XmlElement applicationNode = interfaces.CreateElement("application");

            //Set the attribute for the application node
            XmlAttribute applicationName = interfaces.CreateAttribute("name");

            //Assign a value to the attribute and associated it with the application node
            applicationName.Value = appClass.ApplicationNameText;
            applicationNode.SetAttributeNode(applicationName);

            //Create a new executable node
            XmlElement executableNode = interfaces.CreateElement("executable");
            executableNode.InnerText = appClass.ExecutableNameText;
            applicationNode.AppendChild(executableNode);

            //Create a new dependencies node
            XmlElement dependenciesNode = interfaces.CreateElement("dependencies");
            applicationNode.AppendChild(dependenciesNode);

            //Create a new dependency node
            string[] dependencies = appClass.DependenciesText.Split(new char[] { '\n' });

            foreach (string dependency in dependencies)
            {
                XmlElement dependencyNode = interfaces.CreateElement("dependency");
                dependencyNode.InnerText = dependency.ToString();
                if (dependencyNode.InnerText != "")
                {
                    dependenciesNode.AppendChild(dependencyNode);
                }
            }

            //Create a new build path node
            XmlElement buildPathNode = interfaces.CreateElement("build_path");
            buildPathNode.InnerText = appClass.BuildPathText;
            applicationNode.AppendChild(buildPathNode);

            //Create a new staging path node
            XmlElement stagingPathNode = interfaces.CreateElement("staging_path");
            stagingPathNode.InnerText = appClass.StagingPathText;
            applicationNode.AppendChild(stagingPathNode);

            interfaces.DocumentElement.InsertAfter(applicationNode, interfaces.DocumentElement.LastChild);

            interfaces.Save(executablePath + "\\" + Settings.Default.XMLFile);
            interfaces = null;
        }
Ejemplo n.º 5
0
        public void copyFiles(application appClass)
        {
            interfaces.Load(executablePath + "\\" + Settings.Default.XMLFile);

            //Pulls the list of applications in the xml
            XmlNode node = null;
            XmlNodeList applicationList = interfaces.SelectNodes("applications/application");

            //Sets the base path for the node to what is selected in the combobox
            string selectedApplication = appClass.ComboBoxValue;
            foreach (XmlNode application in applicationList)
            {
                if (application.Attributes["name"].Value == selectedApplication)
                {
                    node = application;
                }
            }

            //Get the build and staging path
            XmlNode buildPath = node.SelectSingleNode("build_path");
            XmlNode stagingPath = node.SelectSingleNode("staging_path");

            //Sets the source and destination path to a string variable
            string source = buildPath.InnerText;
            string destination = stagingPath.InnerText;

            //Gets the executable file and moves it
            XmlNode executableFile = node.SelectSingleNode("executable");
            FileInfo file = new FileInfo(executableFile.InnerText);

            string sourceFile = Path.Combine(source, file.Name);
            string destFile = Path.Combine(destination, file.Name);

            File.Copy(sourceFile, destFile, true);

            //Gets the dependency files and moves them
            XmlNodeList dependencyNodes = node.SelectNodes("dependencies/dependency");

            foreach (XmlNode dependencyNode in dependencyNodes)
            {
                var fileName = dependencyNode.InnerText;
                string sourcePath = Path.Combine(source, fileName);
                string destPath = Path.Combine(destination, fileName);

                File.Copy(sourcePath, destPath, true);
            }
        }
Ejemplo n.º 6
0
        public void configureEmailSettings(application appClass)
        {
            XmlDocument emailConfig = new XmlDocument();
            emailConfig.Load(executablePath + "\\" + Settings.Default.ConfigXMLFile);

            XmlNode hostNode = emailConfig.SelectSingleNode("settings/email/host");

            //check if email has been configured
            if (hostNode != null)
            {
                updateEmailSettings(appClass);
            }
            //configure email settings
            else
            {
                setupEmailSettings(appClass);
            }
        }
Ejemplo n.º 7
0
        public void setupEmailSettings(application appClass)
        {
            XmlDocument emailConfig = new XmlDocument();
            emailConfig.Load(executablePath + "\\" + Settings.Default.ConfigXMLFile);

            //Create a new email information node
            XmlElement emailNode = emailConfig.CreateElement("email");

            //Create a new host node
            XmlElement hostNode = emailConfig.CreateElement("host");
            hostNode.InnerText = appClass.EmailHost;
            emailNode.AppendChild(hostNode);

            //Create a new port node
            XmlElement portNode = emailConfig.CreateElement("port");
            portNode.InnerText = appClass.EmailPort;
            emailNode.AppendChild(portNode);

            //Create a new username node
            XmlElement usernameNode = emailConfig.CreateElement("username");
            usernameNode.InnerText = appClass.EmailUsername;
            emailNode.AppendChild(usernameNode);

            //Create a new password node
            XmlElement passwordNode = emailConfig.CreateElement("password");
            passwordNode.InnerText = appClass.EmailPassword;
            emailNode.AppendChild(passwordNode);

            //Create a new sender node
            XmlElement senderNode = emailConfig.CreateElement("sender");
            senderNode.InnerText = appClass.EmailSender;
            emailNode.AppendChild(senderNode);

            //Create a new recipient node
            XmlElement recipientNode = emailConfig.CreateElement("recipient");
            recipientNode.InnerText = appClass.EmailRecipient;
            emailNode.AppendChild(recipientNode);

            emailConfig.DocumentElement.InsertAfter(emailNode, emailConfig.DocumentElement.LastChild);

            emailConfig.Save(executablePath + "\\" + Settings.Default.ConfigXMLFile);
            emailConfig = null;
        }
Ejemplo n.º 8
0
        public void deleteExistingApplication(application appClass)
        {
            XmlDocument interfaces = new XmlDocument();
            interfaces.Load(executablePath + "\\" + Settings.Default.XMLFile);

            XmlNode node = null;
            XmlNodeList applicationList = interfaces.SelectNodes("applications/application");

            //Sets the base path for the node to what is selected in the combobox
            string selectedApplication = appClass.ComboBoxValue;

            foreach (XmlNode application in applicationList)
            {
                if (application.Attributes["name"].Value == selectedApplication)
                {
                    node = application;
                }
            }

            node.ParentNode.RemoveChild(node);

            interfaces.Save(executablePath + "\\" + Settings.Default.XMLFile);
        }
        public void loadApplication(application appClass)
        {
            interfaces.Load(executablePath + "\\" + Settings.Default.XMLFile);

            XmlNode node = null;
            XmlNodeList applicationList = interfaces.SelectNodes("applications/application");

            //Sets the base path for the node to what is selected in the combobox
            string selectedApplication = appClass.ComboBoxValue;

            foreach (XmlNode application in applicationList)
            {
                if (application.Attributes["name"].Value == selectedApplication)
                {
                    node = application;
                }
            }

            //Gets the values from the xml file
            XmlAttribute applicationName = node.Attributes["name"];
            XmlNode executableFile = node.SelectSingleNode("executable");
            XmlNodeList dependencyFiles = node.SelectNodes("dependencies/dependency");
            XmlNode buildPath = node.SelectSingleNode("build_path");
            XmlNode stagingPath = node.SelectSingleNode("staging_path");

            //Populates the values into the textboxes
            applicationNameTextbox.Text = applicationName.Value;
            executableFileTextbox.Text = executableFile.InnerText;
            buildPathTextBox.Text = buildPath.InnerText;
            stagingPathTextBox.Text = stagingPath.InnerText;

            foreach (XmlNode dependencyNode in dependencyFiles)
            {
                string fileName = dependencyNode.InnerText;
                dependenciesTextBox.Text = dependenciesTextBox.Text + fileName + Environment.NewLine;
            }
        }
Ejemplo n.º 10
0
        private void submit_button_Click(object sender, EventArgs e)
        {
            CreateReadMeFile createReadMeDocument = new CreateReadMeFile();
            FileCopy copyBuildFiles = new FileCopy();
            SendEmail email = new SendEmail();

            bool validApplicationSelected = validateApplicationComboBox();
            bool validReleaseNotes = validateReleaseNotesTextbox();

            if (validApplicationSelected && validReleaseNotes)
            {
                application appClass = new application();
                appClass.ComboBoxValue = applicationComboBox.Text;
                appClass.ReleaseNotesText = releaseNotesTextbox.Text;

                #region Create ReadMe
                try
                {
                    createReadMeDocument.createReadMe(appClass);
                    copyBuildFiles.copyFiles(appClass);
                }
                catch//(Exception stuff)
                {
                    //MessageBox.Show(stuff.ToString());
                    MessageBox.Show("The selected application files could not be found");
                }
                #endregion

                #region Send Email Notification
                XmlDocument emailConfig = new XmlDocument();
                emailConfig.Load(executablePath + "\\" + Settings.Default.ConfigXMLFile);

                //check if email has been configured
                XmlNode hostNode = emailConfig.SelectSingleNode("settings/email/host");
                try
                {
                    if (hostNode != null)
                    {
                        email.sendEmailNotification(appClass);
                    }
                    else
                    {
                        if (MessageBox.Show("The email information has not configured and a notification will not be sent.\n\nWould you like to configure it now?", "Configure Email Alert", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            ConfigureEmailForm configureEmail = new ConfigureEmailForm();
                            configureEmail.ShowDialog();

                            email.sendEmailNotification(appClass);
                        }
                    }
                }

                catch
                {
                    MessageBox.Show("The email information was not configured correctly");
                }
                #endregion

                releaseNotesTextbox.Clear();
                applicationComboBox.ResetText();
            }
        }
Ejemplo n.º 11
0
        private void editLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            UpdateApplicationForm editApplicationForm = new UpdateApplicationForm(this);
            applicationComboBox.Items.Clear();
            try
            {
                application appClass = new application();
                appClass.ComboBoxValue = applicationComboBox.Text;

                editApplicationForm.comboBoxValue = applicationComboBox.Text;
                editApplicationForm.loadApplication(appClass);

                editApplicationForm.FormClosed += (x, y) =>
                {
                    loadComboBox();
                };

                applicationComboBox.Text = "";

                editApplicationForm.ShowDialog();
            }
            catch(Exception)
            {
                MessageBox.Show("The selected application was not found");
                applicationComboBox.Text = "";
                loadComboBox();
            }
        }
Ejemplo n.º 12
0
        public void createReadMe(application appClass)
        {
            interfaces.Load(executablePath + "\\" + Settings.Default.XMLFile);

            //Pulls the list of applications in the xml
            XmlNode node = null;
            XmlNodeList applicationList = interfaces.SelectNodes("applications/application");

            //Sets the base path for the node to what is selected in the combobox
            string selectedApplication = appClass.ComboBoxValue;
            foreach (XmlNode application in applicationList)
            {
                if (application.Attributes["name"].Value == selectedApplication)
                {
                    node = application;
                }
            }

            XmlNode buildPath = node.SelectSingleNode("build_path");
            string readMeFile = buildPath.InnerText + "\\ReadMe.txt";
            string oldReadMeFile = buildPath.InnerText + "\\ReadMe_Old.txt";

            if (File.Exists(readMeFile))
            {
                if (File.Exists(oldReadMeFile))
                {
                    using (StreamWriter swAppend = File.AppendText(oldReadMeFile))
                    {
                        swAppend.WriteLine(File.ReadAllText(readMeFile));
                        swAppend.Close();
                    }
                }
                else
                {
                    File.Copy(@readMeFile, @oldReadMeFile);

                    using (StreamWriter sw = File.CreateText(readMeFile))
                    {
                        sw.WriteLine("========================================");
                        sw.WriteLine(appClass.ComboBoxValue + " Release Notes " + System.DateTime.Today.ToShortDateString());
                        sw.WriteLine("");
                        sw.WriteLine(appClass.ReleaseNotesText);
                        sw.WriteLine("========================================");
                        sw.Close();
                    }
                }

                using (StreamWriter swReplace = File.CreateText(readMeFile))
                {
                    swReplace.WriteLine("========================================");
                    swReplace.WriteLine(appClass.ComboBoxValue + " Release Notes " + System.DateTime.Today.ToShortDateString());
                    swReplace.WriteLine("");
                    swReplace.WriteLine(appClass.ReleaseNotesText);
                    swReplace.WriteLine("========================================");
                    swReplace.Close();
                }
            }
            else
            {
                using (StreamWriter sw = File.CreateText(readMeFile))
                {
                    sw.WriteLine("========================================");
                    sw.WriteLine(appClass.ComboBoxValue + " Release Notes " + System.DateTime.Today.ToShortDateString());
                    sw.WriteLine("");
                    sw.WriteLine(appClass.ReleaseNotesText);
                    sw.WriteLine("========================================");
                    sw.Close();
                }
            }
        }
Ejemplo n.º 13
0
        public void updateEmailSettings(application appClass)
        {
            XmlDocument emailConfig = new XmlDocument();
            emailConfig.Load(executablePath + "\\" + Settings.Default.ConfigXMLFile);

            //Set the base path
            XmlNode node = emailConfig.SelectSingleNode("settings/email");

            //Get XML Nodes
            XmlNode hostNode = node.SelectSingleNode("host");
            XmlNode portNode = node.SelectSingleNode("port");
            XmlNode usernameNode = node.SelectSingleNode("username");
            XmlNode passwordNode = node.SelectSingleNode("password");
            XmlNode senderNode = node.SelectSingleNode("sender");
            XmlNode recipientNode = node.SelectSingleNode("recipient");

            //Update the XML with the new values
            hostNode.InnerText = appClass.EmailHost;
            portNode.InnerText = appClass.EmailPort;
            usernameNode.InnerText = appClass.EmailUsername;
            passwordNode.InnerText = appClass.EmailPassword;
            senderNode.InnerText = appClass.EmailSender;
            recipientNode.InnerText = appClass.EmailRecipient;

            //Update and save the changes
            emailConfig.Save(executablePath + "\\" + Settings.Default.ConfigXMLFile);
        }