示例#1
0
        /// <summary>
        ///     判断程序是否需要更新
        /// </summary>
        /// <returns></returns>
        public static void CheckUpdate(bool Tips)
        {
            var builder = new LSBuilder();
            var obj     = builder.Get($"{Config["ApiHost"]}{Config["UpdateUrl"]}");

            if (obj == null)
            {
                return;
            }
            var info = obj["tag"].GetValue(typeof(VersionInfo)) as VersionInfo;

            if (info != null && !info.Name.Equals(Version))
            {
                //若当前版本低于最新版本时,触发更新
                if (MessageBox.Show(Language.Default["NeedUpdateTips"], Language.Default["Tips"],
                                    MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;    //提示更新
                }
                StartUpdate(); //启动更新
            }
            else if (Tips)
            {
                MessageBox.Show(Language.Default["NeedNotUpdateTips"]); //提示不需要更新
            }
            Config.Save();
        }
示例#2
0
        private List <string> GetAvatar(string profession, string part)
        {
            LSBuilder     builder = new LSBuilder();
            var           obj     = builder.Get($"{API_HOST}/avatar/list/{profession}/{part}");
            List <Avatar> list    = new List <Avatar>();

            obj.GetValue(ref list);
            return(list.ConvertAll(avatar => avatar.Code));
        }
示例#3
0
        private List <string> GetProfession()
        {
            LSBuilder         builder = new LSBuilder();
            var               obj     = builder.Get($"{API_HOST}/profession/list");
            List <Profession> list    = new List <Profession>();

            obj.GetValue(ref list);
            return(list.ConvertAll(profesion => profesion.Name));
        }
示例#4
0
        private List <Profession> GetProfession()
        {
            var builder = new LSBuilder();
            var obj     = builder.Get($"{API_HOST}/profession/list");
            var list    = new List <Profession>();

            obj.GetValue(ref list);
            return(list);
        }
示例#5
0
        private List <Profession> GetProfession()
        {
            var builder = new LSBuilder();
            var obj     = builder.Get("http://localhost:8080/api/dressing/profession/list");
            var list    = new List <Profession>();

            obj.GetValue(ref list);
            return(list);
        }
示例#6
0
        private static List <string> GetAvatar(string profession, string part)
        {
            var url     = $"{API_HOST}/avatar/list/{profession}/{part}.json";
            var builder = new LSBuilder();
            var obj     = builder.Get(url);
            var list    = new List <Avatar>();

            obj.GetValue(ref list);
            Console.WriteLine("GET ... " + url);
            return(list.ConvertAll(avatar => avatar.Code));
        }
示例#7
0
 public void Refresh()
 {
     NetList.Clear();
     try {
         var builder = new LSBuilder();
         var obj     = builder.Get(MARKET_URL);
         if (obj["status"].Value.Equals("success"))
         {
             NetList = obj["tag"].GetValue(typeof(List <Metadata>)) as List <Metadata>;
         }
     } catch (Exception e) {
     }
 }
示例#8
0
 public void Refresh()
 {
     NetList.Clear();
     try {
         var builder = new LSBuilder();
         var obj     = builder.Get(Config["MarketUrl"].Value);
         if (obj["status"].Value.Equals("success"))
         {
             NetList = obj["tag"].GetValue(typeof(List <Metadata>)) as List <Metadata>;
         }
     } catch (Exception e) {
         throw new PluginExecption("PluginListDownloadError");
     }
 }
示例#9
0
 public void Test02()
 {
     Program.RegistyHandler();
     foreach (var profession in profession_array)
     {
         var dir = $"E:/avatar/icon_new_image/{profession}";
         if (Directory.Exists(dir))
         {
             Directory.Delete(dir, true);
         }
         Directory.CreateDirectory(dir);
         foreach (var part in part_array)
         {
             var list     = Tools.Load($@"D:\地下城与勇士\ImagePacks2\sprite_character_{profession + (profession.Contains("_") ? "" : "_")}equipment_avatar_{part}.NPK");
             var builder  = new LSBuilder();
             var obj      = builder.Get($"http://localhost/api/avatar/icon?profession={profession}&part={part}");
             var cur_list = new List <string>();
             foreach (var child in obj)
             {
                 var code = child["code"].Value.ToString();
                 cur_list.Add(code);
             }
             var rs = new List <Album>();
             foreach (var img in list.ToArray())
             {
                 var name  = img.Name;
                 var regex = new Regex("\\d+");
                 var match = regex.Match(name);
                 if (match.Success)
                 {
                     var code = match.Value;
                     if (!cur_list.Contains(code))
                     {
                         rs.Add(img);
                     }
                 }
             }
             Tools.WriteNPK($"E:/avatar/icon_new_image/{profession}/{part}.NPK", rs);
         }
     }
 }
示例#10
0
 /// <summary>
 /// 判断程序是否需要更新
 /// </summary>
 /// <returns></returns>
 public static void CheckUpdate(bool Tips)
 {
     try {
         var builder = new LSBuilder();
         var obj     = builder.Get(Config["UpdateUrl"].Value).GetValue(typeof(VersionInfo)) as VersionInfo;
         if (!obj.Name.Equals(Version))  //若当前版本低于最新版本时,触发更新
         {
             if (MessageBox.Show(Language.Default["NeedUpdateTips"], "", MessageBoxButtons.OKCancel) != DialogResult.OK)
             {
                 return;    //提示更新
             }
             StartUpdate(); //启动更新
         }
         else if (Tips)
         {
             MessageBox.Show(Language.Default["NeedNotUpdateTips"]);//提示不需要更新
         }
     } catch (Exception e) {
         Console.Write(e.StackTrace);
     }
     Config.Save();
 }
示例#11
0
        private void ComparePlugin()
        {
            var builder = new LSBuilder();
            var obj     = builder.Get(DOWNLOAD_PLUGIN_API_URL, new Dictionary <string, object>()
            {
                ["guid"] = Guid.ToString()
            });
            var files = obj.GetValue(typeof(List <FileInfo>)) as List <FileInfo>;

            Stack = new Stack <FileInfo>();
            foreach (var info in files)
            {
                info.Name = $"plugin/{Guid}/{info.Name}";
                if (!Check(info))
                {
                    Stack.Push(info);
                }
            }
            if (Stack.Count > 0)
            {
                Download(Stack.Pop());
            }
        }
示例#12
0
        private void Compare()
        {
            var builder = new LSBuilder();
            var obj     = builder.Get(UPDATE_URL);
            var version = obj.GetValue(typeof(VersionInfo)) as VersionInfo;
            var files   = version.Files;

            Stack = new Stack <FileInfo>();
            foreach (var info in files)
            {
                if (!Check(info))
                {
                    Stack.Push(info);
                }
            }
            if (Stack.Count > 0)
            {
                Download(Stack.Pop());
            }
            else
            {
                Start();
            }
        }