void sendstringtest() { FMessagePackage filesend = new FMessagePackage(); filesend.MT = MessageType.ASSIGNID;// //SkeletalMesh'/Game/Vehicles/VH_Buggy/Mesh/SK_Buggy_Vehicle.SK_Buggy_Vehicle' string path = "/Game/Vehicles/VH_Buggy/Mesh/SK_Buggy_Vehicle"; string id = "1"; filesend.PayLoad = "?" + path + "?" + id; string strsend = JsonConvert.SerializeObject(filesend); Send(strsend); }
void messagehandler(byte[] buffer) { try { #if UTF16 var str = System.Text.Encoding.Unicode.GetString(buffer); #else var str = System.Text.Encoding.UTF8.GetString(buffer); #endif FMessagePackage mp = JsonConvert.DeserializeObject <FMessagePackage>(str); switch (mp.MT) { case MessageType.ASSIGNOK: string androidkey = ""; string ioskey = ""; string result = "success"; string reason = ""; Thread.Sleep(6000); if (mprocess != null && !mprocess.HasExited) { mprocess.Kill(); } if (mp.PayLoad != "" && mp.PayLoad != "None") { //content copy begin string sourcepath = @"F:\uev\Content"; sourcepath = Program.signidpropath + "/Content"; //////////////////////////////////////////////////////////////////////// ///////////////////////////////resource prepare for android string despath = Program.packagpropath_android + "/Content"; Utility.SubDirectoryDelete(despath); Utility.DirectoryCopy(sourcepath, despath, true); //content copy end //delete old data begin string pakpath = Program.packagpropath_android + "/Saved"; Utility.SubDirectoryDelete(pakpath); //delete old data end ////////////////////////////////////////////////////////////////// ////////////////////////cook for Android begin string path = Program.unrealbatchfilepath; string Arguments = Program.argumentsforandroid; Process tempprocess = Utility.CommandRun(path, Arguments); tempprocess.WaitForExit(); ///////////////////////////////////////////////////////////////// /////////////////////////cook for Android end //////////////////////////////////////////////////////////////////////// ///////////////////////////////resource prepare for ios despath = Program.packagpropath_ios + "/Content"; Utility.SubDirectoryDelete(despath); Utility.DirectoryCopy(sourcepath, despath, true); //content copy end //delete old data begin pakpath = Program.packagpropath_ios + "/Saved"; Utility.SubDirectoryDelete(pakpath); ////////////////////////////////////////////////////////////////// ////////////////////////cook for ios begin Arguments = Program.argumentsforios; tempprocess = Utility.CommandRun(path, Arguments); tempprocess.WaitForExit(); ///////////////////////////////////////////////////////////////// /////////////////////////cook for ios end //Console.WriteLine("hi"); string androidpaksfilepath = Program.packagpropath_android + "/Saved/StagedBuilds/Android/InfiniteLife1_0/Content/Paks/pakchunk1-Android.pak"; string iospaksfilepath = Program.packagpropath_ios + "/Saved/StagedBuilds/IOS/cookeddata/infinitelife1_0/content/paks/pakchunk1-ios.pak"; Guid g; // Create and display the value of two GUIDs. g = Guid.NewGuid(); string guidstring = g.ToString(); string androidguid = guidstring + ".pak"; g = Guid.NewGuid(); guidstring = g.ToString(); string iosguid = guidstring + ".pak"; OssClient client = new OssClient(Config.Endpoint, Config.AccessKeyId, Config.AccessKeySecret); const string bucketName = "coresnow-circle"; androidkey = "model/" + androidguid; client.PutObject(bucketName, androidkey, androidpaksfilepath); ioskey = "model/" + iosguid; client.PutObject(bucketName, ioskey, iospaksfilepath); result = "success"; reason = ""; } else { result = "failure"; reason = "资产无效"; } Program.evtObj.Set(); //next one var payload = new Dictionary <string, string> { { "result", result }, { "reason", reason }, { "mid", Program.currentwid }, { "assetpath", mp.PayLoad },//if this value is null then this asset is invalid { "android_pak", androidkey }, { "ios_pak", ioskey } }; string strPayload = JsonConvert.SerializeObject(payload); HttpContent httpContent = new StringContent(strPayload, Encoding.UTF8, "application/json"); int retrycounter = 0; retry: window_file_log.Log("retrycounter :" + retrycounter); window_file_log.Log(strPayload); int shouldretry = 0; HttpclientHelper.httppost(Program.remotehttpserver, httpContent, (ref string strparameter, ref byte[] bytearray) => { window_file_log.Log(strparameter); if (!String.IsNullOrEmpty(strparameter)) { if (!strparameter.Contains("\"data\":true")) { shouldretry = 1; retrycounter++; } } }); if (shouldretry == 1 && retrycounter < 10) { Thread.Sleep(1000 * 60 * 10); goto retry; } //Program.evtObj.Set(); OnClientExit(); break; case MessageType.EMPTY: break; default: break; } } catch (Newtonsoft.Json.JsonSerializationException) {//buffer all zero//occur when mobile client force kill the game client OnClientExit(); } }