Beispiel #1
0
 public void UpdateScreenshot(string package, string url, string path)
 {
     CookieInfo info = GetItem(package);
     if (info == null)
         return;
     info.AddScreenshot(url, path);
 }
Beispiel #2
0
 public void Test()
 {
     infoList.Clear();
     for (int i = 0; i < 10; i++)
     {
         CookieInfo cookie = new CookieInfo();
         cookie.name = "testrobobobobob" + i;
         cookie.logoPath = "file://dfdsfdfdsfdsfdfdsfdsfs";
         cookie.size = 43353434;
         cookie.auther = "auther...oooooooo";
         cookie.AddScreenshot("url","path");
         cookie.AddScreenshot("url2", "path2");
         cookie.downloadPriority = 0;
         infoList.Add(cookie);
     }
     Save();
 }
Beispiel #3
0
 private void Parse(string json)
 {
     infoList.Clear();
     if(string.IsNullOrEmpty(json))
         return;
     try
     {
         Dictionary<string, object> jsonDic = FastJson.Deserialize(json) as Dictionary<string, object>;
         List<object> list = jsonDic["apps"] as List<object>;
         if (list == null)
             return;
         for (int i = 0; i < list.Count; i++)
         {
             Dictionary<string, object> dic = list[i] as Dictionary<string, object>;
             CookieInfo info = new CookieInfo();
             info.package = dic.ContainsKey("pkg") ? dic["pkg"].ToString() : "";
             info.name = dic.ContainsKey("name") ? dic["name"].ToString() : "";
             //info.logoPath = dic.ContainsKey("path") ? dic["path"].ToString() : "";
             info.logoUrl = dic.ContainsKey("url") ? dic["url"].ToString() : "";
             info.version = dic.ContainsKey("ver") ? dic["ver"].ToString() : "";
             info.build = dic.ContainsKey("build") ? uint.Parse(dic["build"].ToString()) : 0;
             info.auther = dic.ContainsKey("auther") ? dic["auther"].ToString() : "";
             info.size = dic.ContainsKey("size") ? uint.Parse(dic["size"].ToString()) : 0;
             //info.downloadPriority = dic.ContainsKey("down") ? uint.Parse(dic["down"].ToString()) : 0;
             //info.status = dic.ContainsKey("st") ? int.Parse(dic["st"].ToString()) : 0;
             List<object> images = dic.ContainsKey("images") ? dic["images"] as List<object> : null;
             if (images != null)
             {
                 for (int j = 0; j < images.Count; j++)
                 {
                     Dictionary<string, object> tmp = images[j] as Dictionary<string, object>;
                     info.AddScreenshot(tmp["url"].ToString(), tmp["path"].ToString());
                 }
             }
             if (info.downloadPriority > downloadPriority)
                 downloadPriority = info.downloadPriority;
             //ZLog.Log("read cookie:"+info.ToString());
             infoList.Add(info);
         }
     }catch(Exception e){
         Debug.LogException(e);
     }
 }