private bool InstallFile()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("DeploymentPlan.xml");

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            string       xPathFile = "/DeploymentPlan/Item[@Type='" + "File" + "']/DestinationPath";
            XmlElement   xmlNode   = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            XmlAttribute attr      = xmlNode.GetAttributeNode("Location");

            string target = attr.InnerText;

            xPathFile = "/DeploymentPlan/Item[@Type='File']/SourcePath";
            xmlNode   = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            attr      = xmlNode.GetAttributeNode("Location");

            String     source = attr.InnerText;
            FileDeploy fd     = new FileDeploy(source, target);
            string     s      = fd.Install();

            if (s == "t")
            {
                return(true);
            }
            else
            {
                ErrorBox.Text = s;
                ErrorBox.AppendText(Environment.NewLine);
                return(false);
            }
        }
        private bool InstallService()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("DeploymentPlan.xml");
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            string       xPathFile = "/DeploymentPlan/Item[@Type='" + "WindowsService" + "']/SourcePath";
            XmlElement   xmlNode   = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            XmlAttribute loc       = xmlNode.GetAttributeNode("Location");

            xPathFile = "/DeploymentPlan/Item[@Type='" + "WindowsService" + "']/Username";
            xmlNode   = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            string user = xmlNode.InnerText;

            xPathFile = "/DeploymentPlan/Item[@Type='" + "WindowsService" + "']/Password";
            xmlNode   = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            string pass = xmlNode.InnerText;


            WindowsService ws = new WindowsService(loc.InnerText, user, pass);

            string[] s = ws.Install();
            if (s[0] == "t")
            {
                return(true);
            }
            else
            {
                ErrorBox.AppendText(s[0]);
                ErrorBox.AppendText(Environment.NewLine);
                return(false);
            }
        }
        private bool InstallSQL()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("DeploymentPlan.xml");
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            string       xPathFile = "/DeploymentPlan/Item[@Type='" + "MSSQL" + "']/SourcePath";
            XmlElement   xmlEl     = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            XmlAttribute loc       = xmlEl.GetAttributeNode("Location");

            xPathFile = "/DeploymentPlan/Item[@Type='" + "MSSQL" + "']/Server";
            xmlEl     = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            string serv = xmlEl.InnerText;

            xPathFile = "/DeploymentPlan/Item[@Type='" + "MSSQL" + "']/Port";
            xmlEl     = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            int port = Convert.ToInt32(xmlEl.InnerText);

            xPathFile = "/DeploymentPlan/Item[@Type='" + "MSSQL" + "']/Username";
            xmlEl     = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            string user = xmlEl.InnerText;

            xPathFile = "/DeploymentPlan/Item[@Type='" + "MSSQL" + "']/Password";
            xmlEl     = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            string pass = xmlEl.InnerText;

            xPathFile = "/DeploymentPlan/Item[@Type='" + "MSSQL" + "']/DBName";
            xmlEl     = (XmlElement)doc.DocumentElement.SelectSingleNode(xPathFile, nsmgr);
            string db = xmlEl.InnerText;

            SQLScript sqlScr = new SQLScript(serv, port, user, pass, db, loc.InnerText);
            string    s      = sqlScr.Install();

            if (s == "t")
            {
                return(true);
            }
            else
            {
                ErrorBox.AppendText(s);
                ErrorBox.AppendText(Environment.NewLine);
                return(false);
            }
        }
Пример #4
0
 public void AppendMessage(string message)
 {
     ErrorBox.AppendText(message + '\n');
 }