Exemplo n.º 1
0
        public override bool DoWork(AmendPack ap)
        {
            bool Result = true;
            // 这个地方由于没有历史性刷出的办法,对于DLL,可能需要两遍代码刷出,第一遍,先刷出最新版,第二遍,根据递交的版本历史,
            // 把在这个版本之后修改的刷回去
            // 需要注意的是ReadMe中的路径是不全的,这个很恶心
            SvnPort svn = new SvnPort("0", "1");
            foreach (SAWFile s in ap.SAWFiles)
            {
                if (s.fstatus == FileStatus.New)
                {
                    continue;
                }

                svn.Path = s.LocalPath;
                svn.Uri = s.UriPath;
                svn.AmendNo = ap.AmendNo;
                svn.AmendList = ap.AmendList;
                svn.Version = s.Version;
                // 检出失败,退出循环
                Result = svn.GetAmendCode();
                if (!Result)
                {
                    string message = " 获取版本库信息错误,确认继续?" + "\r\n" + s.LocalPath;
                    string caption = "测试";

                    DialogResult dRes = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (dRes == System.Windows.Forms.DialogResult.No)
                    {
                        break;
                    }
                    else
                    {
                        Result = true;  // 防止最后一个确认的svn点了Yes,但是仍然返回失败
                    }
                }
                s.fstatus = FileStatus.New;
                s.LastModTime = svn.uriinfo.LastChangeTime;
            }

            return Result;
        }
Exemplo n.º 2
0
        public void LoadConf(XmlNode root)
        {
            XmlNode xn = null;

            try
            {
                // 读取显示属性

                log.WriteFileLog("读取产品信息");

                type       = root.Attributes["type"].InnerText;
                product_id = root.Attributes["product_id"].InnerText;
                enable     = bool.Parse(root.Attributes["enable"].InnerText);
                name       = root.Attributes["name"].InnerText;
                funclist   = root.Attributes["funclist"].InnerText;

                // 读取节点配置明细
                log.WriteFileLog("读取配置库信息");
                xn         = root.SelectSingleNode("Repository");
                Repository = xn.Attributes["repo"].InnerText;
                WorkSpace  = xn.Attributes["workspace"].InnerText;
                // OutDir 如果以 \ 结尾,会导致编译前台Drp时,批处理里会出现 "C:\src\", \"会被认为是转义,就报错了,
                // 这里如果,结尾是\,去掉
                if (WorkSpace[WorkSpace.Length - 1] == '\\')
                {
                    WorkSpace = WorkSpace.Substring(0, WorkSpace.Length - 1);
                }
                SvnRepo           = new SvnPort(name, Repository);
                SvnRepo.Workspace = WorkSpace;

                // 读取修改单配置明细
                log.WriteFileLog("读取开发工具信息");
                xn      = root.SelectSingleNode("Develop");
                DevTool = xn.Attributes["devtool"].InnerText;
                Rar     = xn.Attributes["rar"].InnerText;
                OutDir  = xn.Attributes["outdir"].InnerText;
                // OutDir 如果以 \ 结尾,会导致编译前台Drp时,批处理里会出现 "C:\src\", \"会被认为是转义,就报错了,
                // 这里如果,结尾是\,去掉
                if (OutDir[OutDir.Length - 1] == '\\')
                {
                    OutDir = OutDir.Substring(0, OutDir.Length - 1);
                }

                // 读取Ssh连接配置
                log.WriteFileLog("读取Ssh连接配置");
                xn   = root.SelectSingleNode("SSHConn");
                Conn = new ReSSH(xn.Attributes["name"].InnerText,
                                 xn.Attributes["host"].InnerText,
                                 int.Parse(xn.Attributes["port"].InnerText),
                                 xn.Attributes["user"].InnerText,
                                 xn.Attributes["pass"].InnerText,
                                 bool.Parse(xn.Attributes["restartas"].InnerText));
                Conn.localdir = OutDir;

                // 读取小球FTP路径递交配置
                log.WriteFileLog("读取小球FTP路径递交配置");
                xn           = root.SelectSingleNode("CommitFtp");
                fc           = new FtpConf();
                fc.host      = xn.Attributes["host"].InnerText;
                fc.port      = int.Parse(xn.Attributes["port"].InnerText);
                fc.user      = xn.Attributes["user"].InnerText;
                fc.pass      = xn.Attributes["pass"].InnerText;
                fc.ServerDir = xn.Attributes["remotedir"].Value;
                fc.LocalDir  = xn.Attributes["localdir"].Value;
                if (fc.LocalDir[fc.LocalDir.Length - 1] == '\\')
                {
                    fc.LocalDir = fc.LocalDir.Substring(0, fc.LocalDir.Length - 1);
                }

                // 初始化 ftp配置
                ftp = new FTPConnection();
                ftp.ServerAddress   = fc.host;
                ftp.ServerPort      = fc.port;
                ftp.UserName        = fc.user;
                ftp.Password        = fc.pass;
                ftp.TransferType    = FTPTransferType.BINARY;         // 指定 BINARY 传输,否则对于压缩包会失败
                ftp.CommandEncoding = Encoding.GetEncoding("gb2312"); // 重要,否则乱码且连接不

                log.WriteFileLog("读取对比参数");
                xn         = root.SelectSingleNode("Diff");
                DiffEnable = bool.Parse(xn.Attributes["enable"].Value);
                DiffBin    = xn.Attributes["bin"].Value;
                DiffArgs   = xn.Attributes["args"].Value;

                log.WriteFileLog("读取Delphi编译版本配置");
                xn      = root.SelectSingleNode("SpecialCom");
                SpeComs = new ArrayList();
                XmlNodeList xnl = xn.ChildNodes;
                foreach (XmlNode x in xnl)
                {
                    if (x.NodeType == XmlNodeType.Comment)
                    {
                        continue;
                    }
                    ComInfo com = new ComInfo(x.Attributes["lang"].Value,
                                              int.Parse(x.Attributes["ver"].Value),
                                              x.Attributes["coms"].Value);
                    SpeComs.Add(com);
                }

                // 读取数据库连接属性
                xn  = root.SelectSingleNode("DB");
                xnl = xn.ChildNodes;
                foreach (XmlNode x in xnl)
                {
                    DBUser u = new DBUser(x.Attributes["name"].InnerText,
                                          x.Attributes["pass"].InnerText,
                                          x.Attributes["dbtns"].InnerText,
                                          x.Attributes["note"].InnerText);
                    Users.Add(u);
                }


                // 读取公用递交配置
                try
                {
                    xn         = root.SelectSingleNode("CommitPublic");
                    logmessage = xn.Attributes["logmessage"].Value;
                    xnl        = xn.ChildNodes;
                    foreach (XmlNode x in xnl)
                    {
                        CommitPublic.Add(x.Attributes["dir"].InnerText);
                    }
                }
                catch
                {
                    log.WriteLog("无法读取公共递交资源CommitPublic!,请检查MAConf.xml配置");
                }
            }
            catch (Exception e)
            {
                log.WriteLog("加载配置失败,活动节点:" + xn.Name + e.Message, LogLevel.Error);
                throw new MissingFieldException("LoadConf");
            }
        }
Exemplo n.º 3
0
        public void LoadConf(XmlNode root)
        {
            XmlNode xn = null;
            try
            {
                // 读取显示属性

                log.WriteFileLog("读取产品信息");

                type = root.Attributes["type"].InnerText;
                product_id = root.Attributes["product_id"].InnerText;
                enable = bool.Parse(root.Attributes["enable"].InnerText);
                name = root.Attributes["name"].InnerText;
                funclist = root.Attributes["funclist"].InnerText;

                // 读取节点配置明细
                log.WriteFileLog("读取配置库信息");
                xn = root.SelectSingleNode("Repository");
                Repository = xn.Attributes["repo"].InnerText;
                WorkSpace = xn.Attributes["workspace"].InnerText;
                // OutDir 如果以 \ 结尾,会导致编译前台Drp时,批处理里会出现 "C:\src\", \"会被认为是转义,就报错了,
                // 这里如果,结尾是\,去掉
                if (WorkSpace[WorkSpace.Length - 1] == '\\')
                {
                    WorkSpace = WorkSpace.Substring(0, WorkSpace.Length - 1);
                }
                SvnRepo = new SvnPort(name, Repository);
                SvnRepo.Workspace = WorkSpace;

                // 读取修改单配置明细
                log.WriteFileLog("读取开发工具信息");
                xn = root.SelectSingleNode("Develop");
                DevTool = xn.Attributes["devtool"].InnerText;
                Rar = xn.Attributes["rar"].InnerText;
                OutDir = xn.Attributes["outdir"].InnerText;
                // OutDir 如果以 \ 结尾,会导致编译前台Drp时,批处理里会出现 "C:\src\", \"会被认为是转义,就报错了,
                // 这里如果,结尾是\,去掉
                if (OutDir[OutDir.Length - 1] == '\\')
                {
                    OutDir = OutDir.Substring(0, OutDir.Length - 1);
                }

                // 读取Ssh连接配置
                log.WriteFileLog("读取Ssh连接配置");
                xn = root.SelectSingleNode("SSHConn");
                Conn = new ReSSH(xn.Attributes["name"].InnerText,
                        xn.Attributes["host"].InnerText,
                        int.Parse(xn.Attributes["port"].InnerText),
                        xn.Attributes["user"].InnerText,
                        xn.Attributes["pass"].InnerText,
                        bool.Parse(xn.Attributes["restartas"].InnerText));
                Conn.localdir = OutDir;

                // 读取小球FTP路径递交配置
                log.WriteFileLog("读取小球FTP路径递交配置");
                xn = root.SelectSingleNode("CommitFtp");
                fc = new FtpConf();
                fc.host = xn.Attributes["host"].InnerText;
                fc.port = int.Parse(xn.Attributes["port"].InnerText);
                fc.user = xn.Attributes["user"].InnerText;
                fc.pass = xn.Attributes["pass"].InnerText;
                fc.ServerDir = xn.Attributes["remotedir"].Value;
                fc.LocalDir = xn.Attributes["localdir"].Value;
                if (fc.LocalDir[fc.LocalDir.Length - 1] == '\\')
                {
                    fc.LocalDir = fc.LocalDir.Substring(0, fc.LocalDir.Length - 1);
                }

                // 初始化 ftp配置
                ftp = new FTPConnection();
                ftp.ServerAddress = fc.host;
                ftp.ServerPort = fc.port;
                ftp.UserName = fc.user;
                ftp.Password = fc.pass;
                ftp.TransferType = FTPTransferType.BINARY;  // 指定 BINARY 传输,否则对于压缩包会失败
                ftp.CommandEncoding = Encoding.GetEncoding("gb2312"); // 重要,否则乱码且连接不

                log.WriteFileLog("读取对比参数");
                xn = root.SelectSingleNode("Diff");
                DiffEnable = bool.Parse(xn.Attributes["enable"].Value);
                DiffBin = xn.Attributes["bin"].Value;
                DiffArgs = xn.Attributes["args"].Value;

                log.WriteFileLog("读取Delphi编译版本配置");
                xn = root.SelectSingleNode("SpecialCom");
                SpeComs = new ArrayList();
                XmlNodeList xnl = xn.ChildNodes;
                foreach (XmlNode x in xnl)
                {
                    if (x.NodeType == XmlNodeType.Comment)
                        continue;
                    ComInfo com = new ComInfo(x.Attributes["lang"].Value,
                        int.Parse(x.Attributes["ver"].Value),
                        x.Attributes["coms"].Value);
                    SpeComs.Add(com);
                }

                // 读取数据库连接属性
                xn = root.SelectSingleNode("DB");
                xnl = xn.ChildNodes;
                foreach (XmlNode x in xnl)
                {
                    DBUser u = new DBUser(x.Attributes["name"].InnerText,
                        x.Attributes["pass"].InnerText,
                        x.Attributes["dbtns"].InnerText,
                        x.Attributes["note"].InnerText);
                    Users.Add(u);
                }

                // 读取公用递交配置
                try
                {
                    xn = root.SelectSingleNode("CommitPublic");
                    logmessage = xn.Attributes["logmessage"].Value;
                    xnl = xn.ChildNodes;
                    foreach (XmlNode x in xnl)
                    {
                        CommitPublic.Add(x.Attributes["dir"].InnerText);
                    }
                }
                catch
                {
                    log.WriteLog("无法读取公共递交资源CommitPublic!,请检查MAConf.xml配置");
                }
            }
            catch (Exception e)
            {
                log.WriteLog("加载配置失败,活动节点:" + xn.Name + e.Message, LogLevel.Error);
                throw new MissingFieldException("LoadConf");
            }
        }