forked from sin365/AxibugEmuOnline
Compare commits
No commits in common. "5f1fbdd41f60e1cd4842a5fda98c6d220f6f6850" and "94fb19c4db976afc79459707218b15c5dfe7e6cc" have entirely different histories.
5f1fbdd41f
...
94fb19c4db
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 898ba71ded907534ba7eaada7855cadc
|
|
||||||
Binary file not shown.
@ -0,0 +1,33 @@
|
|||||||
|
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,65 +11,8 @@ 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
|
||||||
{
|
{
|
||||||
@ -184,15 +127,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AxiRespInfo AxiDownload(string url)
|
public static AxiRespInfo AxiDownload(string url)
|
||||||
{
|
{
|
||||||
AxiRespInfo respInfo = new AxiRespInfo();
|
AxiRespInfo respInfo = new AxiRespInfo();
|
||||||
respInfo.downloadMode = AxiDownLoadMode.DownLoadBytes;
|
respInfo.downloadMode = AxiDownLoadMode.DownLoadBytes;
|
||||||
SendAxiRequest(url, ref respInfo);
|
SendAxiRequest(url, ref respInfo);
|
||||||
return respInfo;
|
return respInfo;
|
||||||
@ -200,20 +142,19 @@ public static class AxiHttp
|
|||||||
|
|
||||||
public static AxiRespInfo AxiDownloadAsync(string url)
|
public static AxiRespInfo AxiDownloadAsync(string url)
|
||||||
{
|
{
|
||||||
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)
|
||||||
@ -794,9 +735,6 @@ public static class AxiHttp
|
|||||||
//}
|
//}
|
||||||
respinfo.isDone = true;
|
respinfo.isDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client != null)
|
|
||||||
client.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1085,7 +1023,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,3 +1,4 @@
|
|||||||
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static AxiHttp;
|
using static AxiHttp;
|
||||||
|
|
||||||
@ -45,8 +46,6 @@ 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}");
|
||||||
@ -71,23 +70,6 @@ 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,10 +136,14 @@ namespace AxibugEmuOnline.Client
|
|||||||
var request = downloadRequest;
|
var request = downloadRequest;
|
||||||
downloadRequest = null;
|
downloadRequest = null;
|
||||||
|
|
||||||
if (request.downloadHandler.Err == null)
|
if (request.downloadHandler.Err != null)
|
||||||
callback(request.downloadHandler.data);
|
{
|
||||||
|
callback(null);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
callback(null);
|
{
|
||||||
|
callback(request.downloadHandler.data);
|
||||||
|
}
|
||||||
|
|
||||||
//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.ClientNetwork;
|
using HaoYueNet.ClientNetworkNet.Standard2;
|
||||||
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