forked from sin365/AxibugEmuOnline
hash | PSVita dir
This commit is contained in:
parent
68f121df60
commit
2b051b7a27
@ -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");
|
||||
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)
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user