master #39

Merged
sin365 merged 7 commits from Alienjack/AxibugEmuOnline:master into master 2024-09-24 18:02:02 +08:00
2 changed files with 36 additions and 1 deletions
Showing only changes of commit abc68f68c3 - Show all commits

View File

@ -1,6 +1,7 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Network;
using System.Collections;
using System.IO;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
@ -31,8 +32,11 @@ namespace AxibugEmuOnline.Client.ClientCore
private static CoroutineRunner coRunner;
#endregion
#if UNITY_PSP2
public static string PersistentDataPath => "ux0:data/AxibugEmu";
#else
public static string PersistentDataPath => Application.persistentDataPath;
#endif
[RuntimeInitializeOnLoadMethod]
static void Init()
@ -56,6 +60,12 @@ namespace AxibugEmuOnline.Client.ClientCore
tickLoop = go.AddComponent<TickLoop>();
coRunner = go.AddComponent<CoroutineRunner>();
if (UnityEngine.Application.platform == RuntimePlatform.PSP2)
{
//PSV 等平台需要手动创建目录
PersistentDataPathDir();
}
var importNode = GameObject.Find("IMPORTENT");
if (importNode != null) GameObject.DontDestroyOnLoad(importNode);
@ -63,6 +73,14 @@ namespace AxibugEmuOnline.Client.ClientCore
RePullNetInfo();
}
private static void PersistentDataPathDir()
{
if (!Directory.Exists(PersistentDataPath))
{
Directory.CreateDirectory(PersistentDataPath);
}
}
private static IEnumerator AppTickFlow()
{
while (true)

View File

@ -1,6 +1,8 @@
using System;
using System.IO;
using System.IO.Compression;
using System.Security.Cryptography;
using System.Text;
namespace AxibugEmuOnline.Client.Common
{
@ -42,5 +44,20 @@ namespace AxibugEmuOnline.Client.Common
return resultMemoryStream.ToArray();
}
}
public static string FileMD5Hash(string filePath)
{
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(filePath))
{
var hash = md5.ComputeHash(stream);
var sb = new StringBuilder(hash.Length * 2);
foreach (var b in hash)
sb.AppendFormat("{0:x2}", b);
return sb.ToString();
}
}
}
}
}