public static void Commit() { var json = JsonUtility.ToJson(AssetProcessorDB.DBInstance, true); string r; if (ResourceEditGetPoster.HttpPost("AssetProcessorDB", json, out r)) { Debug.Log("Commit ok."); } }
public static bool Commit(string dbKey, ResourceParamsDB db) { bool ret = false; ResourceKeys keys = new ResourceKeys { Keys = db.ResourceKeys }; var keysJson = JsonUtility.ToJson(keys, true); string r; if (ResourceEditGetPoster.HttpPost(dbKey, keysJson, out r)) { try { ret = true; int ct = 0; int totalCt = keys.Keys.Count; foreach (var key in keys.Keys) { ResourceParams ps; if (db.TryGetResourceParams(key, out ps)) { var paramsJson = JsonUtility.ToJson(ps, true); if (!ResourceEditGetPoster.HttpPost(key, paramsJson, out r)) { ret = false; } } ++ct; if (EditorUtility.DisplayCancelableProgressBar("Commit", string.Format("{0}/{1}", ct, totalCt), ct * 1.0f / totalCt)) { break; } } if (ret) { Debug.Log("Commit ok."); } } finally { EditorUtility.ClearProgressBar(); } } return(ret); }