forked from sin365/AxibugEmuOnline
Compare commits
No commits in common. "97c278b4ec3e49e9afcb283b19b22cabea6ac4c9" and "cc57a1e0df757df8e274b4aa63d74123f2a491f9" have entirely different histories.
97c278b4ec
...
cc57a1e0df
@ -2,7 +2,6 @@
|
|||||||
using nn.fs;
|
using nn.fs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using nn.fs;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@ -14,61 +13,6 @@ public class AxiNSIO
|
|||||||
#if UNITY_SWITCH
|
#if UNITY_SWITCH
|
||||||
private FileHandle fileHandle = new nn.fs.FileHandle();
|
private FileHandle fileHandle = new nn.fs.FileHandle();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static object commitLock = new object();
|
|
||||||
|
|
||||||
static bool bDirty = false;
|
|
||||||
|
|
||||||
bool CommitSave()
|
|
||||||
{
|
|
||||||
lock (commitLock)
|
|
||||||
{
|
|
||||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
|
||||||
|
|
||||||
// 阻止用户在保存时,退出游戏 Switch 条例 0080
|
|
||||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
|
||||||
nn.Result ret = FileSystem.Commit(save_name);
|
|
||||||
|
|
||||||
if (!ret.IsSuccess())
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + ret.GetErrorInfo());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 停止阻止用户退出游戏
|
|
||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
|
||||||
|
|
||||||
bDirty = false;
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetCommitDirty()
|
|
||||||
{
|
|
||||||
lock (commitLock)
|
|
||||||
{
|
|
||||||
bDirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ApplyAutoCommit()
|
|
||||||
{
|
|
||||||
bool temp;
|
|
||||||
lock (commitLock)
|
|
||||||
{
|
|
||||||
temp = bDirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (temp)
|
|
||||||
{
|
|
||||||
CommitSave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查Path是否存在
|
/// 检查Path是否存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -109,11 +53,8 @@ public class AxiNSIO
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool CreateDir(string filePath)
|
public bool CreateDir(string filePath)
|
||||||
{
|
{
|
||||||
lock (commitLock)
|
|
||||||
{
|
|
||||||
|
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
// 使用封装函数检查和创建父目录
|
// 使用封装函数检查和创建父目录
|
||||||
if (!EnsureParentDirectory(filePath, true))
|
if (!EnsureParentDirectory(filePath, true))
|
||||||
@ -123,7 +64,6 @@ public class AxiNSIO
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -148,20 +88,16 @@ public class AxiNSIO
|
|||||||
AxiNS.instance.wait.AddWait(wait);
|
AxiNS.instance.wait.AddWait(wait);
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <param name="immediatelyCommit">是否立即Commit到物理存储</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool FileToSaveWithCreate(string filePath, byte[] data, bool immediatelyCommit = true)
|
public bool FileToSaveWithCreate(string filePath, byte[] data)
|
||||||
{
|
{
|
||||||
lock (commitLock)
|
|
||||||
{
|
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
if (!AxiNS.instance.mount.SaveIsMount)
|
if (!AxiNS.instance.mount.SaveIsMount)
|
||||||
{
|
{
|
||||||
@ -245,24 +181,24 @@ public class AxiNSIO
|
|||||||
|
|
||||||
nn.fs.File.Close(fileHandle);
|
nn.fs.File.Close(fileHandle);
|
||||||
|
|
||||||
|
//必须得提交,否则没有真实写入
|
||||||
|
result = FileSystem.Commit(save_name);
|
||||||
|
//result.abortUnlessSuccess();
|
||||||
|
if (!result.IsSuccess())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + result.GetErrorInfo());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
UnityEngine.Debug.Log($"FileSystem.Commit({save_name}) 成功: ");
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||||
// 停止阻止用户退出游戏
|
// 停止阻止用户退出游戏
|
||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(immediatelyCommit)
|
return true;
|
||||||
{
|
|
||||||
//必须得提交,否则没有真实写入
|
|
||||||
return CommitSave();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetCommitDirty();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
||||||
@ -296,7 +232,7 @@ public class AxiNSIO
|
|||||||
}
|
}
|
||||||
public bool LoadSwitchDataFile(string filename, out byte[] outputData)
|
public bool LoadSwitchDataFile(string filename, out byte[] outputData)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH || UNITY_EDITOR
|
#if !UNITY_SWITCH
|
||||||
outputData = null;
|
outputData = null;
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -356,8 +292,7 @@ public class AxiNSIO
|
|||||||
|
|
||||||
public bool GetDirectoryFiles(string path, out string[] entrys)
|
public bool GetDirectoryFiles(string path, out string[] entrys)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH || UNITY_EDITOR
|
#if !UNITY_SWITCH
|
||||||
|
|
||||||
entrys = null;
|
entrys = null;
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -367,7 +302,7 @@ public class AxiNSIO
|
|||||||
|
|
||||||
public bool GetDirectoryDirs(string path, out string[] entrys)
|
public bool GetDirectoryDirs(string path, out string[] entrys)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH || UNITY_EDITOR
|
#if !UNITY_SWITCH
|
||||||
entrys = null;
|
entrys = null;
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -376,70 +311,38 @@ public class AxiNSIO
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_SWITCH
|
#if UNITY_SWITCH
|
||||||
public bool GetDirectoryEntrys(string path, nn.fs.OpenDirectoryMode type, out string[] entrys)
|
public bool GetDirectoryEntrys(string path, nn.fs.OpenDirectoryMode type, out string[] entrys)
|
||||||
{
|
{
|
||||||
nn.fs.DirectoryHandle eHandle = new nn.fs.DirectoryHandle();
|
entrys = null;
|
||||||
nn.Result result = nn.fs.Directory.Open(ref eHandle, path, type);
|
return false;
|
||||||
if (nn.fs.FileSystem.ResultPathNotFound.Includes(result))
|
nn.fs.DirectoryHandle dirHandle = new nn.fs.DirectoryHandle();
|
||||||
{
|
nn.Result result = nn.fs.Directory.Open(ref dirHandle, path, type);
|
||||||
UnityEngine.Debug.Log($"目录 {path} 不存在");
|
if (nn.fs.FileSystem.ResultPathNotFound.Includes(result))
|
||||||
entrys = null;
|
{
|
||||||
return false;
|
UnityEngine.Debug.Log($"目录 {path} 不存在");
|
||||||
}
|
entrys = null;
|
||||||
long entryCount = 0;
|
return false;
|
||||||
nn.fs.Directory.GetEntryCount(ref entryCount, eHandle);
|
}
|
||||||
nn.fs.DirectoryEntry[] entries = new nn.fs.DirectoryEntry[entryCount];
|
long entryCount = 0;
|
||||||
long actualEntries = 0;
|
nn.fs.Directory.GetEntryCount(ref entryCount, dirHandle);
|
||||||
nn.fs.Directory.Read(ref actualEntries, entries, eHandle, entryCount);
|
nn.fs.DirectoryEntry[] dirEntries = new nn.fs.DirectoryEntry[entryCount];
|
||||||
|
long actualEntries = 0;
|
||||||
|
nn.fs.Directory.Read(ref actualEntries, dirEntries, dirHandle, entryCount);
|
||||||
|
|
||||||
entrys = new string[actualEntries];
|
entrys = new string[actualEntries];
|
||||||
for (int i = 0; i < actualEntries; i++)
|
for (int i = 0; i < actualEntries; i++)
|
||||||
{
|
{
|
||||||
entrys[i] = System.IO.Path.Combine(path, entries[i].name);
|
entrys[i] = dirEntries[i].name;
|
||||||
}
|
}
|
||||||
nn.fs.Directory.Close(eHandle);
|
nn.fs.Directory.Close(dirHandle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_SWITCH
|
|
||||||
public bool GetDirectoryEntrysFullRecursion(string path, out string[] entrys)
|
|
||||||
{
|
|
||||||
nn.fs.DirectoryHandle eHandle = new nn.fs.DirectoryHandle();
|
|
||||||
nn.Result result = nn.fs.Directory.Open(ref eHandle, path, OpenDirectoryMode.All);
|
|
||||||
if (nn.fs.FileSystem.ResultPathNotFound.Includes(result))
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.Log($"目录 {path} 不存在");
|
|
||||||
entrys = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
long entryCount = 0;
|
|
||||||
nn.fs.Directory.GetEntryCount(ref entryCount, eHandle);
|
|
||||||
nn.fs.DirectoryEntry[] entries = new nn.fs.DirectoryEntry[entryCount];
|
|
||||||
long actualEntries = 0;
|
|
||||||
nn.fs.Directory.Read(ref actualEntries, entries, eHandle, entryCount);
|
|
||||||
|
|
||||||
List<string> temp = new List<string>();
|
|
||||||
for (int i = 0; i < actualEntries; i++)
|
|
||||||
{
|
|
||||||
string singlePath = System.IO.Path.Combine(path, entries[i].name);
|
|
||||||
temp.Add(singlePath);
|
|
||||||
if (entries[i].entryType == EntryType.Directory && GetDirectoryEntrysFullRecursion(singlePath, out string[] singleEntryList))
|
|
||||||
{
|
|
||||||
temp.AddRange(singleEntryList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nn.fs.Directory.Close(eHandle);
|
|
||||||
entrys = temp.ToArray();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public IEnumerable<string> EnumerateFiles(string path, string searchPattern)
|
public IEnumerable<string> EnumerateFiles(string path, string searchPattern)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH || UNITY_EDITOR
|
#if !UNITY_SWITCH
|
||||||
yield break;
|
yield break;
|
||||||
#else
|
#else
|
||||||
// 将通配符转换为正则表达式(支持*和?)
|
// 将通配符转换为正则表达式(支持*和?)
|
||||||
var regexPattern = "^" +
|
var regexPattern = "^" +
|
||||||
@ -487,12 +390,18 @@ public class AxiNSIO
|
|||||||
UnityEngine.Debug.LogError($"nn.fs.File.Delete 失败 {filename} : result=>{result.GetErrorInfo()}");
|
UnityEngine.Debug.LogError($"nn.fs.File.Delete 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
result = nn.fs.FileSystem.Commit(save_name);
|
||||||
|
if (!result.IsSuccess())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + result.GetErrorInfo());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||||
// End preventing the user from quitting the game while saving.
|
// End preventing the user from quitting the game while saving.
|
||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
return CommitSave();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -523,12 +432,18 @@ public class AxiNSIO
|
|||||||
UnityEngine.Debug.LogError($"nn.fs.File.Delete 失败 {filename} : result=>{result.GetErrorInfo()}");
|
UnityEngine.Debug.LogError($"nn.fs.File.Delete 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
result = nn.fs.FileSystem.Commit(save_name);
|
||||||
|
if (!result.IsSuccess())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + result.GetErrorInfo());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||||
// End preventing the user from quitting the game while saving.
|
// End preventing the user from quitting the game while saving.
|
||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
return CommitSave();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
public AxiNSWait_DeletePathDir DeletePathDirAsync(string filename)
|
public AxiNSWait_DeletePathDir DeletePathDirAsync(string filename)
|
||||||
@ -564,12 +479,18 @@ public class AxiNSIO
|
|||||||
UnityEngine.Debug.LogError($"nn.fs.File.DeleteRecursively 失败 {filename} : result=>{result.GetErrorInfo()}");
|
UnityEngine.Debug.LogError($"nn.fs.File.DeleteRecursively 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
result = nn.fs.FileSystem.Commit(save_name);
|
||||||
|
if (!result.IsSuccess())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + result.GetErrorInfo());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||||
// End preventing the user from quitting the game while saving.
|
// End preventing the user from quitting the game while saving.
|
||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
return CommitSave();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,12 +520,18 @@ public class AxiNSIO
|
|||||||
UnityEngine.Debug.LogError($"nn.fs.File.DeleteRecursively 失败 {filename} : result=>{result.GetErrorInfo()}");
|
UnityEngine.Debug.LogError($"nn.fs.File.DeleteRecursively 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
result = nn.fs.FileSystem.Commit(save_name);
|
||||||
|
if (!result.IsSuccess())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + result.GetErrorInfo());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||||
// End preventing the user from quitting the game while saving.
|
// End preventing the user from quitting the game while saving.
|
||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
return CommitSave();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,13 +557,18 @@ public class AxiNSIO
|
|||||||
UnityEngine.Debug.LogError($"nn.fs.File.Rename 失败 {oldpath} to {newpath} : result=>{result.GetErrorInfo()}");
|
UnityEngine.Debug.LogError($"nn.fs.File.Rename 失败 {oldpath} to {newpath} : result=>{result.GetErrorInfo()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
result = nn.fs.FileSystem.Commit(save_name);
|
||||||
|
if (!result.IsSuccess())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + result.GetErrorInfo());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||||
// End preventing the user from quitting the game while saving.
|
// End preventing the user from quitting the game while saving.
|
||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
return CommitSave();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
bool EnsureParentDirectory(string filePath, bool bAutoCreateDir = true)
|
bool EnsureParentDirectory(string filePath, bool bAutoCreateDir = true)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if UNITY_SWITCH
|
#if UNITY_SWITCH
|
||||||
using nn.account;
|
using nn.account;
|
||||||
|
using static AxiHttp;
|
||||||
#endif
|
#endif
|
||||||
public class AxiNSMount
|
public class AxiNSMount
|
||||||
{
|
{
|
||||||
|
|||||||
@ -49,10 +49,6 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
public static SonyVitaCommonDialog sonyVitaCommonDialog;
|
public static SonyVitaCommonDialog sonyVitaCommonDialog;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNITY_SWITCH
|
|
||||||
public static SwitchCommon switchCommon;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@ -142,15 +138,10 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
// Directory.CreateDirectory("ux0:data/AxibugEmu");
|
// Directory.CreateDirectory("ux0:data/AxibugEmu");
|
||||||
|
|
||||||
#if UNITY_PSP2
|
#if UNITY_PSP2
|
||||||
//释放解码 FMV的26M内存,一般游戏用不上(PSP才用那破玩意儿)
|
|
||||||
UnityEngine.PSVita.PSVitaVideoPlayer.TransferMemToMonoHeap();
|
|
||||||
//创建PSV弹窗UI
|
//创建PSV弹窗UI
|
||||||
sonyVitaCommonDialog = new GameObject().AddComponent<SonyVitaCommonDialog>();
|
sonyVitaCommonDialog = new GameObject().AddComponent<SonyVitaCommonDialog>();
|
||||||
#endif
|
//释放解码 FMV的26M内存,一般游戏用不上(PSP才用那破玩意儿)
|
||||||
|
UnityEngine.PSVita.PSVitaVideoPlayer.TransferMemToMonoHeap();
|
||||||
#if UNITY_SWITCH
|
|
||||||
//创建创建Switch
|
|
||||||
switchCommon = new GameObject().AddComponent<SwitchCommon>();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using Sony.Vita.Dialog;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace AxiIO
|
namespace AxiIO
|
||||||
{
|
{
|
||||||
@ -44,15 +43,9 @@ namespace AxiIO
|
|||||||
return AxiIO.io.file_ReadBytesToArr(filePath, readToArr, start, len);
|
return AxiIO.io.file_ReadBytesToArr(filePath, readToArr, start, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal static void WriteAllBytes(string path, byte[] data)
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <param name="ImmediatelyCommit">是否立即Commit到物理存储(目前只有NS对本参数有效)</param>
|
|
||||||
internal static void WriteAllBytes(string path, byte[] data, bool ImmediatelyCommit = true)
|
|
||||||
{
|
{
|
||||||
AxiIO.io.file_WriteAllBytes(path, data, ImmediatelyCommit);
|
AxiIO.io.file_WriteAllBytes(path, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void WriteAllBytesFromStream(string path, System.IO.MemoryStream ms)
|
internal static void WriteAllBytesFromStream(string path, System.IO.MemoryStream ms)
|
||||||
|
|||||||
@ -26,13 +26,7 @@ namespace AxiIO
|
|||||||
return System.IO.Directory.Exists(dirpath);
|
return System.IO.Directory.Exists(dirpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void file_WriteAllBytes(string filePath, byte[] data)
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filePath"></param>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <param name="immediatelyCommit">是否立即Commit到物理存储(C#原生这里不需要)</param>
|
|
||||||
public void file_WriteAllBytes(string filePath, byte[] data, bool immediatelyCommit = true)
|
|
||||||
{
|
{
|
||||||
System.IO.File.WriteAllBytes(filePath, data);
|
System.IO.File.WriteAllBytes(filePath, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,13 +12,7 @@ namespace AxiIO
|
|||||||
byte[] file_ReadAllBytes(string filePath);
|
byte[] file_ReadAllBytes(string filePath);
|
||||||
bool file_Exists(string filePath);
|
bool file_Exists(string filePath);
|
||||||
void file_Delete(string filePath);
|
void file_Delete(string filePath);
|
||||||
/// <summary>
|
void file_WriteAllBytes(string filePath, byte[] data);
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filePath"></param>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <param name="immediatelyCommit">是否立即Commit到物理存储(目前只有NS对本参数有效)</param>
|
|
||||||
void file_WriteAllBytes(string filePath, byte[] data, bool immediatelyCommit = true);
|
|
||||||
void file_WriteAllBytes(string filePath, System.IO.MemoryStream ms);
|
void file_WriteAllBytes(string filePath, System.IO.MemoryStream ms);
|
||||||
int file_ReadBytesToArr(string filePath, byte[] readToArr, int start, int len);
|
int file_ReadBytesToArr(string filePath, byte[] readToArr, int start, int len);
|
||||||
string[] dir_GetDirectories(string path);
|
string[] dir_GetDirectories(string path);
|
||||||
|
|||||||
@ -70,13 +70,7 @@ namespace AxiIO
|
|||||||
return templen;
|
return templen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void file_WriteAllBytes(string filePath, byte[] data)
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filePath"></param>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <param name="immediatelyCommit">是否立即Commit到物理存储</param>
|
|
||||||
public void file_WriteAllBytes(string filePath, byte[] data, bool immediatelyCommit = true)
|
|
||||||
{
|
{
|
||||||
AxiNS.instance.io.FileToSaveWithCreate(filePath, data);
|
AxiNS.instance.io.FileToSaveWithCreate(filePath, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
if (!request.downloadHandler.bHadErr)
|
if (!request.downloadHandler.bHadErr)
|
||||||
{
|
{
|
||||||
AxiIO.Directory.CreateDirectory(path);
|
AxiIO.Directory.CreateDirectory(path);
|
||||||
AxiIO.File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data, false);
|
AxiIO.File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data);
|
||||||
callback.Invoke(request.downloadHandler.data);
|
callback.Invoke(request.downloadHandler.data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -15,7 +15,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
public static Action LoopAction_tick;
|
public static Action LoopAction_tick;
|
||||||
public static Action LoopAction_1s;
|
public static Action LoopAction_1s;
|
||||||
public static Action LoopAction_3s;
|
public static Action LoopAction_3s;
|
||||||
public static Action LoopAction_15s;
|
|
||||||
public Stopwatch sw = Stopwatch.StartNew();
|
public Stopwatch sw = Stopwatch.StartNew();
|
||||||
public TimeSpan LastStartPingTime;
|
public TimeSpan LastStartPingTime;
|
||||||
public int LastPingSeed;
|
public int LastPingSeed;
|
||||||
@ -43,7 +42,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
float LastLoopTime_1s;
|
float LastLoopTime_1s;
|
||||||
float LastLoopTime_3s;
|
float LastLoopTime_3s;
|
||||||
float LastLoopTime_15s;
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
NetMsg.Instance.DequeueNesMsg();
|
NetMsg.Instance.DequeueNesMsg();
|
||||||
@ -61,12 +59,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
LastLoopTime_3s = Time.time;
|
LastLoopTime_3s = Time.time;
|
||||||
LoopAction_3s?.Invoke();
|
LoopAction_3s?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Time.time - LastLoopTime_15s > 15)
|
|
||||||
{
|
|
||||||
LastLoopTime_15s = Time.time;
|
|
||||||
LoopAction_15s?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnApplicationQuit()
|
void OnApplicationQuit()
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
using AxibugEmuOnline.Client;
|
|
||||||
using UnityEngine;
|
|
||||||
public class SwitchCommon : MonoBehaviour
|
|
||||||
{
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
TickLoop.LoopAction_15s += ApplyCommit;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDisable()
|
|
||||||
{
|
|
||||||
TickLoop.LoopAction_15s -= ApplyCommit;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyCommit()
|
|
||||||
{
|
|
||||||
#if UNITY_SWITCH
|
|
||||||
AxiNS.instance.io.ApplyAutoCommit();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user