Esempio n. 1
0
        private void RefreshStatus()
        {
            string        sname, tname;
            ListViewGroup lvg;
            ListViewItem  lvItem;
            BaseConf      pf = ch.pf;

            listView1.Items.Clear();

            foreach (KeyValuePair <String, Dictionary <string, Boolean> > element in ch.lpath)
            {
                sname = System.IO.Path.GetDirectoryName(element.Key);
                tname = sname.Replace(pf.WorkSpace, "");

                lvg = new System.Windows.Forms.ListViewGroup(tname + "  [" + ch.lver[element.Key] + "]",
                                                             System.Windows.Forms.HorizontalAlignment.Left);
                lvg.Tag = element.Key;
                listView1.Groups.Add(lvg);

                foreach (KeyValuePair <string, Boolean> le in element.Value)
                {
                    if (le.Value == false)
                    {
                        continue;
                    }

                    lvItem = new ListViewItem(le.Key.Replace(sname, ""));
                    lvItem.SubItems.Add(Enum.GetName(typeof(SharpSvn.SvnStatus), (ch.lstatus[element.Key])[le.Key]));
                    lvItem.Tag     = le.Key;
                    lvItem.Checked = true;
                    lvItem.Group   = lvg;
                    listView1.Items.Add(lvItem);
                }
            }
        }
Esempio n. 2
0
        private void LoadConf()
        {
            log.WriteFileLog("加载配置文件");
            XmlDocument xmldoc = new XmlDocument();

            try
            {
                xmldoc.Load(conf);
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("配置文件不存在,程序退出!");
                Application.Exit();
            }

            XmlElement root = xmldoc.DocumentElement;

            XmlNode     xn  = root.SelectSingleNode("Products");
            XmlNodeList xnl = xn.ChildNodes;

            foreach (XmlNode x in xnl)
            {
                if (x.Attributes["enable"].Value == "false")
                {
                    continue;
                }

                // 跳过注释,否则格式不对,会报错
                if (x.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }

                BaseConf c = null;
                if (x.Attributes["type"].Value == "cres")
                {
                    c = new CresConf(x);
                }
                else if (x.Attributes["type"].Value == "febs")
                {
                    c = new FebsConf(x);
                }

                if (c != null)
                {
                    Configs.Add(c);
                }
            }

            log.WriteFileLog("配置初始化完成");
        }
Esempio n. 3
0
        public void GetStatus()
        {
            pf = MAConf.instance.Configs[ap.ProductId];

            System.Collections.ObjectModel.Collection<SharpSvn.SvnStatusEventArgs> ss;
            SharpSvn.SvnStatusArgs sarg = new SharpSvn.SvnStatusArgs();
            sclient = new SharpSvn.SvnClient();
            ld = new List<string>();
            lver = new Dictionary<string, string>();
            lpath = new Dictionary<string, Dictionary<string, bool>>();
            lstatus = new Dictionary<string, Dictionary<string, SharpSvn.SvnStatus>>();
            Dictionary<string, bool> tpath; // 临时变量
            Dictionary<string, SharpSvn.SvnStatus> tstatus; // 临时变量
            string ext;

            foreach (CommitCom c in ap.ComComms)
            {
                // 对于无变动和要删除的,不需要再生成SAW库信息;对于小包,不需要生成 SAW库信息
                if (c.cstatus == ComStatus.NoChange || c.cstatus == ComStatus.Delete || c.ctype == ComType.Ssql)
                    continue;

                if (!ld.Contains(c.sawfile.LocalPath))
                {
                    ld.Add(c.sawfile.LocalPath);
                    lver.Add(c.sawfile.LocalPath, c.cver);
                }
            }

            foreach (string s in pf.CommitPublic)
            {
                if (!ld.Contains(s))
                {
                    ld.Add(System.IO.Path.Combine(pf.WorkSpace, s));
                    lver.Add(System.IO.Path.Combine(pf.WorkSpace, s), pf.logmessage);
                }
            }

            foreach (string k in ld)
            {
                try
                {
                    sarg.Depth = SharpSvn.SvnDepth.Infinity;
                    sclient.GetStatus(k, sarg, out ss);

                    if (ss.Count > 0)
                    {
                        tpath = new Dictionary<string, bool>();
                        tstatus = new Dictionary<string, SharpSvn.SvnStatus>();
                        foreach (SharpSvn.SvnStatusEventArgs s in ss)
                        {
                            if (s.LocalContentStatus == SharpSvn.SvnStatus.NotVersioned)
                            {
                                ext = System.IO.Path.GetExtension(s.Path).ToLower();
                                if (ext == ".dcu" || ext == ".~pas" || ext == ".~dfm")
                                    log.WriteLog("[NotVersioned] " + s.Path, LogLevel.FileLog);
                                else
                                    log.WriteLog("[NotVersioned] " + s.Path);

                                continue;
                            }
                            if (s.LocalContentStatus == SharpSvn.SvnStatus.Normal)
                                continue;

                            tpath.Add(s.Path, true);
                            tstatus.Add(s.Path, s.LocalContentStatus);
                        }

                        // 都是 Not Versioned 不需处理
                        if (tpath.Count > 0)
                        {
                            lpath.Add(k, tpath);
                            lstatus.Add(k, tstatus);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MAConf.instance.WriteLog("获取状态失败" + ex.Message, LogLevel.Error);
                }
            }
        }