static void UploadContentManifest(WWWUtils.Environment env, string url, int enabled) { var stoken = WWWUtils.AdminLogin(env); var postUrl = WWWUtils.GetAdminUrl(env) + "/bundlemanager/content/from-manifest?stoken=" + stoken; var form = new WWWForm(); form.AddField("url", url); form.AddField("enabled", enabled); WWWUtils.Post(postUrl, form); }
static void UploadApkFiles(string apkPath, WWWUtils.Environment env) { try { var tmpDir = "/tmp/apk"; GeneralUtils.DeleteDirectory(tmpDir, true); // mko: cleaning up build folder Directory.CreateDirectory(tmpDir); // unzip var res = CommandLineUtils.Run("/usr/bin/unzip", string.Format("-d {0} {1}", tmpDir, apkPath)); Debug.Log(res); // generate the app.dll var files = new List <string>(Directory.GetFiles("/tmp/apk/assets/bin/Data/Managed", "*.dll", SearchOption.TopDirectoryOnly)); files.Sort(System.StringComparer.OrdinalIgnoreCase); List <byte> bytes = new List <byte>(); foreach (string filePath in files) { Debug.Log("Adding file " + filePath); bytes.AddRange(File.ReadAllBytes(filePath)); } Debug.Log("MSIL size is " + EB.Localizer.FormatNumber(bytes.Count, true)); WWWForm form = new WWWForm(); form.AddBinaryData("data", bytes.ToArray(), "data"); form.AddField("version", EB.Version.GetVersion()); form.AddField("platform", "android"); form.AddField("sha1", EB.Encoding.ToBase64String(EB.Digest.Sha1().Hash(bytes.ToArray()))); var stoken = WWWUtils.AdminLogin(env); var postUrl = WWWUtils.GetAdminUrl(env) + "/protect/upload?stoken=" + stoken; res = WWWUtils.Post(postUrl, form); Debug.Log("version: " + res); } catch (System.Exception e) { Debug.Log("Build Failed: exception: " + e.ToString()); Failed(e); } }