コード例 #1
0
        public static Verall Read(string path)
        {
            if (File.Exists(Path.Combine(path, "allver.ver.txt")) == false)
            {
                return(null);
            }
            string txt = File.ReadAllText(Path.Combine(path, "allver.ver.txt"), Encoding.UTF8);

            string[] lines = txt.Split(new[] { "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
            var      var   = new Verall();

            foreach (string l in lines)
            {
                if (l.IndexOf("Ver:") == 0)
                {
                    var.ver = int.Parse(l.Substring(4));
                }
                else
                {
                    string[] sp = l.Split('|');
                    var.groups[sp[0]] = new VerInfo(sp[0]);
                    var.groups[sp[0]].Read(var.ver, sp[1], int.Parse(sp[2]), path);
                }
            }
            return(var);
        }
コード例 #2
0
 void InitVerAndPath()
 {
     _ver = Verall.Read("./");
     if (_ver == null)
     {
         _ver = new Verall();
         string[] groups = Directory.GetDirectories("./");
         foreach (var g in groups)
         {
             string path = g.Substring(2).ToLower();
             if (path.IndexOf("path") == 0)
             {
                 continue;
             }
             _ver.groups[path] = new VerInfo(path);
         }
         _ver.ver = 0;
     }
 }
コード例 #3
0
 void InitVerAndPath()
 {
     _ver = Verall.Read("./");
     if (_ver == null)
     {
         _ver = new Verall();
         string[] groups = Directory.GetDirectories("./");
         foreach (var g in groups)
         {
             string path = g.Substring(2).ToLower();
             if (path.IndexOf("path") == 0)
             {
                 continue;
             }
             _ver.groups[path] = new VerInfo(path);
         }
         _ver.ver = 0;
     }
 }
コード例 #4
0
        void GenVer()
        {
            if (_vernew == null)
            {
                ListBoxConsole.Items.Add("先检查一下版本再生成");
                return;
            }
            if (_vernew.ver == _ver.ver)
            {
                ListBoxConsole.Items.Add("版本无变化");
                //return;
            }
            _vernew.SaveToPath("./");

            ListBoxConsole.Items.Add("生成OK Ver:" + _vernew.ver);
            _ver = _vernew;
            ListBoxGroup.Items.Clear();
            foreach (var v in _ver.groups)
            {
                ListBoxGroup.Items.Add(v.Key);
            }
        }
コード例 #5
0
 public static Verall Read(string path)
 {
     if (File.Exists(Path.Combine(path, "allver.ver.txt")) == false)
     {
         return null;
     }
     string txt = File.ReadAllText(Path.Combine(path, "allver.ver.txt"), Encoding.UTF8);
     string[] lines = txt.Split(new[] {"\n", "\r"}, StringSplitOptions.RemoveEmptyEntries);
     var var = new Verall();
     foreach (string l in lines)
     {
         if (l.IndexOf("Ver:") == 0)
         {
             var.ver = int.Parse(l.Substring(4));
         }
         else
         {
             string[] sp = l.Split('|');
             var.groups[sp[0]] = new VerInfo(sp[0]);
             var.groups[sp[0]].Read(var.ver, sp[1], int.Parse(sp[2]), path);
         }
     }
     return var;
 }
コード例 #6
0
        void CheckVer()
        {
            _vernew = new Verall();
            string[] groups = Directory.GetDirectories("./");
            foreach (var g in groups)
            {
                string path = g.Substring(2).ToLower();
                if (path.IndexOf("path") == 0)
                {
                    continue;
                }
                if (_ver.groups.ContainsKey(path) == false)
                {
                    ListBoxConsole.Items.Add("目录未包含:" + path + " 如果需要增加,修改allver增加一行");
                }
            }
            int delcount    = 0;
            int updatecount = 0;
            int addcount    = 0;

            foreach (var g in _ver.groups)
            {
                _vernew.groups[g.Key] = new VerInfo(g.Key);
                _vernew.groups[g.Key].GenHash();
                foreach (var f in g.Value.filehash)
                {
                    if (_vernew.groups[g.Key].filehash.ContainsKey(f.Key) == false)
                    {
                        ListBoxConsole.Items.Add("文件被删除:" + g.Key + ":" + f.Key);
                        delcount++;
                    }
                    else
                    {
                        string hash    = _vernew.groups[g.Key].filehash[f.Key];
                        string oldhash = g.Value.filehash[f.Key];
                        if (hash != oldhash)
                        {
                            ListBoxConsole.Items.Add("文件更新:" + g.Key + ":" + f.Key);
                            updatecount++;
                        }
                    }
                }
                foreach (var f in _vernew.groups[g.Key].filehash)
                {
                    if (g.Value.filehash.ContainsKey(f.Key) == false)
                    {
                        ListBoxConsole.Items.Add("文件增加:" + g.Key + ":" + f.Key);
                        addcount++;
                    }
                }
            }

            if (addcount == 0 && delcount == 0 && updatecount == 0)
            {
                _vernew.ver = _ver.ver;
                ListBoxConsole.Items.Add("无变化 ver=" + _vernew.ver);
            }
            else
            {
                _vernew.ver = _ver.ver + 1;
                ListBoxConsole.Items.Add("检查变化结果 add:" + addcount + " remove:" + delcount + " update:" + updatecount);
                ListBoxConsole.Items.Add("版本号变为:" + _vernew.ver);
            }
            //ver = vernew;
        }
コード例 #7
0
        void CheckVer()
        {
            _vernew = new Verall();
            string[] groups = Directory.GetDirectories("./");
            foreach (var g in groups)
            {
                string path = g.Substring(2).ToLower();
                if (path.IndexOf("path") == 0)
                {
                    continue;
                }
                if (_ver.groups.ContainsKey(path) == false)
                {
                    ListBoxConsole.Items.Add("目录未包含:" + path + " 如果需要增加,修改allver增加一行");
                }

            }
            int delcount = 0;
            int updatecount = 0;
            int addcount = 0;
            foreach (var g in _ver.groups)
            {
                _vernew.groups[g.Key] = new VerInfo(g.Key);
                _vernew.groups[g.Key].GenHash();
                foreach (var f in g.Value.filehash)
                {
                    if (_vernew.groups[g.Key].filehash.ContainsKey(f.Key) == false)
                    {
                        ListBoxConsole.Items.Add("文件被删除:" + g.Key + ":" + f.Key);
                        delcount++;
                    }
                    else
                    {
                        string hash = _vernew.groups[g.Key].filehash[f.Key];
                        string oldhash = g.Value.filehash[f.Key];
                        if (hash != oldhash)
                        {
                            ListBoxConsole.Items.Add("文件更新:" + g.Key + ":" + f.Key);
                            updatecount++;
                        }
                    }
                }
                foreach (var f in _vernew.groups[g.Key].filehash)
                {
                    if (g.Value.filehash.ContainsKey(f.Key) == false)
                    {
                        ListBoxConsole.Items.Add("文件增加:" + g.Key + ":" + f.Key);
                        addcount++;
                    }
                }

            }

            if (addcount == 0 && delcount == 0 && updatecount == 0)
            {
                _vernew.ver = _ver.ver;
                ListBoxConsole.Items.Add("无变化 ver=" + _vernew.ver);
            }
            else
            {
                _vernew.ver = _ver.ver + 1;
                ListBoxConsole.Items.Add("检查变化结果 add:" + addcount + " remove:" + delcount + " update:" + updatecount);
                ListBoxConsole.Items.Add("版本号变为:" + _vernew.ver);
            }
            //ver = vernew;
        }
コード例 #8
0
        void GenVer()
        {
            if (_vernew == null)
            {
                ListBoxConsole.Items.Add("先检查一下版本再生成");
                return;
            }
            if (_vernew.ver == _ver.ver)
            {
                ListBoxConsole.Items.Add("版本无变化");
                //return;
            }
            _vernew.SaveToPath("./");

            ListBoxConsole.Items.Add("生成OK Ver:" + _vernew.ver);
            _ver = _vernew;
            ListBoxGroup.Items.Clear();
            foreach (var v in _ver.groups)
            {
                ListBoxGroup.Items.Add(v.Key);
            }
        }