Ejemplo n.º 1
0
        public static bool SetZipNote(string zipfile, ZipNote model)
        {
            var comment = "名称:" + model.SkinName + "\r\n英雄:" + model.HeroName + "\r\n作者:" + model.Author + "\r\n版本号:" + model.GameVersion + "\r\n备注:" + model.Comment;

            return(SetZipInfo(zipfile, comment));
        }
Ejemplo n.º 2
0
        public static ZipNote GetZipNote(string zipfile)
        {
            var zip = new ZipNote {
                State = 0
            };

            try
            {
                using (ZipFile s = new ZipFile(zipfile))
                {
                    var str = s.ZipFileComment;
                    str = str.Replace("\r\n", ",");
                    var list = str.Split(',');
                    if (list.Length < 1)
                    {
                        return(null);
                    }
                    var skinname = list[0];
                    if (skinname != null)
                    {
                        if (skinname.Contains("名称:"))
                        {
                            skinname = skinname.Replace("名称:", "");
                        }
                        zip.SkinName = skinname;
                    }
                    if (list.Length < 2)
                    {
                        return(zip);
                    }
                    var hero = list[1];
                    if (hero != null)
                    {
                        if (hero.Contains("英雄:"))
                        {
                            hero = hero.Replace("英雄:", "");
                        }
                        zip.HeroName = hero;
                    }

                    if (list.Length < 3)
                    {
                        return(zip);
                    }
                    var author = list[2];
                    if (author != null)
                    {
                        if (author.Contains("作者:"))
                        {
                            author = author.Replace("作者:", "");
                        }
                        zip.Author = author;
                    }

                    if (list.Length < 4)
                    {
                        return(zip);
                    }
                    var ver = list[3];
                    if (ver != null)
                    {
                        if (ver.Contains("版本号:"))
                        {
                            ver = ver.Replace("版本号:", "");
                        }
                        zip.GameVersion = ver;
                    }

                    if (list.Length < 5)
                    {
                        return(zip);
                    }
                    var comment = list[4];
                    if (comment != null)
                    {
                        if (comment.Contains("备注:"))
                        {
                            comment = comment.Replace("备注:", "");
                        }
                        zip.Comment = comment;
                    }
                    zip.State = 1;
                }
            }
            catch (Exception ex)
            {
                Log.LogError("获取皮肤包信息", ex);
                return(zip);
            }
            return(zip);
        }