Ejemplo n.º 1
0
 public static SDKConfigItem CreateItem(Hashtable jsonTable)
 {
     if (jsonTable != null)
     {
         SDKConfigItem item = new SDKConfigItem();
         item.use_sdk       = Convert.ToInt32(jsonTable["use_sdk"]);
         item.development   = Convert.ToInt32(jsonTable["development"]);
         item.need_subpack  = Convert.ToInt32(jsonTable["subpack"]);
         item.sdk_name      = jsonTable["sdk_name"].ToString();
         item.company_name  = jsonTable["company_name"].ToString();
         item.game_name     = jsonTable["game_name"].ToString();
         item.protuct_name  = jsonTable["cn_name"].ToString();
         item.app_icon      = jsonTable["app_icon"].ToString();
         item.channel       = jsonTable["channel"].ToString();
         item.config_path   = jsonTable["config_path"].ToString();
         item.sdk_path      = jsonTable["sdk_path"].ToString();
         item.keystore_name = jsonTable["keystore"].ToString();
         if (jsonTable.ContainsKey("update_along"))
         {
             item.update_along = Convert.ToInt32(jsonTable["update_along"]);
         }
         else
         {
             item.update_along = 0;
         }
         return(item);
     }
     return(null);
 }
Ejemplo n.º 2
0
    public static SDKConfig LoadSDKConfig(string json)
    {
        object jsonParsed = MiniJSON.Json.Deserialize(json);

        if (jsonParsed != null)
        {
            Hashtable jsonMap = jsonParsed as Hashtable;
            SDKConfig config  = new SDKConfig();
            config.show_name    = jsonMap["editor_name"].ToString();
            config.uploadCDN    = Convert.ToInt32(jsonMap["uploadCDN"]);
            config.upload243    = Convert.ToInt32(jsonMap["upload243"]);
            config.splash_image = jsonMap["splash_img"].ToString();
            config.split_assets = Convert.ToInt32(jsonMap["split_assets"]) == 1;
            ArrayList pathes = jsonMap["upload_pathes"] as ArrayList;
            if (config.uploadPathes == null)
            {
                config.uploadPathes = new List <uploadItem>();
            }
            foreach (var item in pathes)
            {
                Hashtable  table = item as Hashtable;
                uploadItem temp  = new uploadItem();
                temp.path   = table["path"].ToString();
                temp.script = table["upload_script"].ToString();
                config.uploadPathes.Add(temp);
            }
            ArrayList items = jsonMap["items"] as ArrayList;
            if (config.items == null)
            {
                config.items = new List <SDKConfigItem>();
            }
            foreach (var item in items)
            {
                config.items.Add(SDKConfigItem.CreateItem(item as Hashtable));
            }
            return(config);
        }
        return(null);
    }