Merge branch 'master' of http://git.axibug.com/sin365/AxibugEmuOnline
This commit is contained in:
commit
5f1fbdd41f
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 898ba71ded907534ba7eaada7855cadc
|
Binary file not shown.
@ -1,33 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 324deac494a24a7499801349c7908062
|
|
||||||
PluginImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
iconMap: {}
|
|
||||||
executionOrder: {}
|
|
||||||
defineConstraints: []
|
|
||||||
isPreloaded: 0
|
|
||||||
isOverridable: 0
|
|
||||||
isExplicitlyReferenced: 0
|
|
||||||
validateReferences: 1
|
|
||||||
platformData:
|
|
||||||
- first:
|
|
||||||
Any:
|
|
||||||
second:
|
|
||||||
enabled: 1
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Editor: Editor
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
DefaultValueInitialized: true
|
|
||||||
- first:
|
|
||||||
Windows Store Apps: WindowsStoreApps
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: AnyCPU
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -11,8 +11,65 @@ using System.Security.Cryptography.X509Certificates;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
|
public static class PSVThread
|
||||||
|
{
|
||||||
|
static AutoResetEvent autoEvent = new AutoResetEvent(false);
|
||||||
|
static Queue<Action> qActs = new Queue<Action>();
|
||||||
|
static Queue<Action> qWork = new Queue<Action>();
|
||||||
|
|
||||||
|
public static void DoTask(Action act)
|
||||||
|
{
|
||||||
|
#if UNITY_PSP2
|
||||||
|
AddSingleTask(act);
|
||||||
|
#else
|
||||||
|
ThreadPool.QueueUserWorkItem(new WaitCallback((state) => act.Invoke()));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_PSP2
|
||||||
|
static Thread psvThread = new Thread(Loop);
|
||||||
|
static bool bSingleInit = false;
|
||||||
|
static void SingleInit()
|
||||||
|
{
|
||||||
|
if (bSingleInit) return;
|
||||||
|
psvThread.Start();
|
||||||
|
bSingleInit = true;
|
||||||
|
}
|
||||||
|
static void AddSingleTask(Action act)
|
||||||
|
{
|
||||||
|
SingleInit();
|
||||||
|
lock (qActs)
|
||||||
|
{
|
||||||
|
qActs.Enqueue(act);
|
||||||
|
}
|
||||||
|
autoEvent.Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Loop()
|
||||||
|
{
|
||||||
|
while (autoEvent.WaitOne())
|
||||||
|
{
|
||||||
|
lock (qActs)
|
||||||
|
{
|
||||||
|
while (qActs.Count > 0) { qWork.Enqueue(qActs.Dequeue()); }
|
||||||
|
}
|
||||||
|
while (qWork.Count > 0)
|
||||||
|
{
|
||||||
|
Action act = qWork.Dequeue();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
act.Invoke();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log(ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public static class AxiHttp
|
public static class AxiHttp
|
||||||
{
|
{
|
||||||
@ -127,8 +184,9 @@ public static class AxiHttp
|
|||||||
AxiRespInfo respInfo = new AxiRespInfo();
|
AxiRespInfo respInfo = new AxiRespInfo();
|
||||||
respInfo.downloadMode = AxiDownLoadMode.NotDownLoad;
|
respInfo.downloadMode = AxiDownLoadMode.NotDownLoad;
|
||||||
WaitAxiRequest respAsync = new WaitAxiRequest(respInfo);
|
WaitAxiRequest respAsync = new WaitAxiRequest(respInfo);
|
||||||
Task task = new Task(() => SendAxiRequest(url, ref respInfo));
|
//Task task = new Task(() => SendAxiRequest(url, ref respInfo));
|
||||||
task.Start();
|
//task.Start()
|
||||||
|
PSVThread.DoTask(() => SendAxiRequest(url, ref respInfo));
|
||||||
return respAsync;
|
return respAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,17 +202,18 @@ public static class AxiHttp
|
|||||||
{
|
{
|
||||||
AxiRespInfo respInfo = new AxiRespInfo();
|
AxiRespInfo respInfo = new AxiRespInfo();
|
||||||
respInfo.downloadMode = AxiDownLoadMode.DownLoadBytes;
|
respInfo.downloadMode = AxiDownLoadMode.DownLoadBytes;
|
||||||
Task task = new Task(() => SendAxiRequest(url, ref respInfo));
|
//Task task = new Task(() => SendAxiRequest(url, ref respInfo));
|
||||||
task.Start();
|
//task.Start();
|
||||||
|
PSVThread.DoTask(() => SendAxiRequest(url, ref respInfo));
|
||||||
return respInfo;
|
return respInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SendAxiRequest(string url, ref AxiRespInfo respinfo,int timeout = 1000 * 1000, string encoding = "UTF-8")
|
static void SendAxiRequest(string url, ref AxiRespInfo respinfo, int timeout = 1000 * 1000, string encoding = "UTF-8")
|
||||||
{
|
{
|
||||||
if (url.ToLower().StartsWith("https://"))
|
if (url.ToLower().StartsWith("https://"))
|
||||||
SendAxiRequestHttps(url, ref respinfo,timeout, encoding);// SendAxiRequestHttps(url, ref respinfo, timeout, encoding);
|
SendAxiRequestHttps(url, ref respinfo, timeout, encoding);// SendAxiRequestHttps(url, ref respinfo, timeout, encoding);
|
||||||
else
|
else
|
||||||
SendAxiRequestHttp(url, ref respinfo,timeout, encoding);
|
SendAxiRequestHttp(url, ref respinfo, timeout, encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SendAxiRequestHttp(string url, ref AxiRespInfo respinfo, int timeout, string encoding)
|
static void SendAxiRequestHttp(string url, ref AxiRespInfo respinfo, int timeout, string encoding)
|
||||||
@ -735,6 +794,9 @@ public static class AxiHttp
|
|||||||
//}
|
//}
|
||||||
respinfo.isDone = true;
|
respinfo.isDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client != null)
|
||||||
|
client.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1023,7 +1085,7 @@ public static class AxiHttp
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Log($"convertToIntBy16 str- {str} lenght->{str.Length}");
|
//Log($"convertToIntBy16 str- {str} lenght->{str.Length}");
|
||||||
if (str.Length == 0)
|
if (str.Length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return Convert.ToInt32(str, 16);
|
return Convert.ToInt32(str, 16);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System.Collections;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static AxiHttp;
|
using static AxiHttp;
|
||||||
|
|
||||||
@ -46,6 +45,8 @@ public static class AxiHttpProxy
|
|||||||
|
|
||||||
public static void ShowAxiHttpDebugInfo(AxiRespInfo resp)
|
public static void ShowAxiHttpDebugInfo(AxiRespInfo resp)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
Debug.Log($"");
|
Debug.Log($"");
|
||||||
Debug.Log($"==== request ====");
|
Debug.Log($"==== request ====");
|
||||||
Debug.Log($"url =>{resp.url}");
|
Debug.Log($"url =>{resp.url}");
|
||||||
@ -70,6 +71,23 @@ public static class AxiHttpProxy
|
|||||||
Debug.Log($"respInfo.fileName =>{resp.fileName}");
|
Debug.Log($"respInfo.fileName =>{resp.fileName}");
|
||||||
Debug.Log($"respInfo.NeedloadedLenght =>{resp.NeedloadedLenght}");
|
Debug.Log($"respInfo.NeedloadedLenght =>{resp.NeedloadedLenght}");
|
||||||
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
|
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
|
||||||
|
#else
|
||||||
|
Debug.Log($"==== request url => { resp.url}");
|
||||||
|
Debug.Log($"code =>{resp.code}");
|
||||||
|
Debug.Log($"respInfo.bTimeOut =>{resp.bTimeOut}");
|
||||||
|
Debug.Log($"==== response ====");
|
||||||
|
if (resp.downloadMode == AxiDownLoadMode.NotDownLoad)
|
||||||
|
{
|
||||||
|
Debug.Log($"body_text =>{resp.body}");
|
||||||
|
Debug.Log($"body_text.Length =>{resp.body.Length}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log($"==== download ====");
|
||||||
|
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//if (resp.downloadMode == AxiDownLoadMode.DownLoadBytes)
|
//if (resp.downloadMode == AxiDownLoadMode.DownLoadBytes)
|
||||||
//{
|
//{
|
||||||
// if (resp.bTimeOut)
|
// if (resp.bTimeOut)
|
||||||
|
@ -36,7 +36,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
AxiHttpProxy.ShowAxiHttpDebugInfo(request.downloadHandler);
|
AxiHttpProxy.ShowAxiHttpDebugInfo(request.downloadHandler);
|
||||||
|
|
||||||
if (request.downloadHandler.Err != null)
|
if (request.downloadHandler.Err == null)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data);
|
File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data);
|
||||||
|
@ -136,14 +136,10 @@ namespace AxibugEmuOnline.Client
|
|||||||
var request = downloadRequest;
|
var request = downloadRequest;
|
||||||
downloadRequest = null;
|
downloadRequest = null;
|
||||||
|
|
||||||
if (request.downloadHandler.Err != null)
|
if (request.downloadHandler.Err == null)
|
||||||
{
|
|
||||||
callback(null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
callback(request.downloadHandler.data);
|
callback(request.downloadHandler.data);
|
||||||
}
|
else
|
||||||
|
callback(null);
|
||||||
|
|
||||||
//downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}");
|
//downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}");
|
||||||
//yield return downloadRequest.SendWebRequest();
|
//yield return downloadRequest.SendWebRequest();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugProtobuf;
|
using AxibugProtobuf;
|
||||||
using HaoYueNet.ClientNetworkNet.Standard2;
|
using HaoYueNet.ClientNetwork;
|
||||||
using System;
|
using System;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
Loading…
Reference in New Issue
Block a user