1
0
mirror of https://github.com/soarqin/DSP_Mods_TO.git synced 2026-02-04 14:12:18 +08:00

format code

This commit is contained in:
2026-01-28 20:27:15 +08:00
parent d698e0afc1
commit 98abc31c6f
38 changed files with 2043 additions and 2043 deletions

View File

@@ -118,7 +118,7 @@ public static class I18N
_initialized = true;
Apply();
}
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.LoadLanguage))]
private static void Localization_LoadLanguage_Postfix(int index)
{

View File

@@ -73,7 +73,7 @@ class PatchUILoadGame
_decompressButton.button.interactable = false;
_decompressButton.gameObject.SetActive(false);
}
public static void OnDestroy()
{
if (_decompressButton)

View File

@@ -39,7 +39,7 @@ static class PatchUISaveGame
//Console.WriteLine("OnCreate");
_context = new UIContext();
}
[HarmonyPatch(typeof(UISaveGameWindow), nameof(UISaveGameWindow.OnSaveClick)), HarmonyReversePatch]
private static void OSaveGameAs(this UISaveGameWindow ui, int data) { }

View File

@@ -24,9 +24,9 @@ public static class SaveUtil
fullPath = filename + GameSave.saveExt;
if (dir != null) fullPath = Path.Combine(dir, fullPath);
var i = 0;
while(File.Exists(fullPath))
while (File.Exists(fullPath))
{
fullPath = $"{filename}[{i++}]{GameSave.saveExt}";
fullPath = $"{filename}[{i++}]{GameSave.saveExt}";
if (dir != null) fullPath = Path.Combine(dir, fullPath);
}
var buffer = new byte[1024 * 1024];

View File

@@ -19,7 +19,7 @@ class BlackHoleStream : Stream
public override void Flush()
{
}
public override int Read(byte[] buffer, int offset, int count)

View File

@@ -46,7 +46,7 @@ public unsafe class BufferWriter : BinaryWriter
}
private BufferWriter(DoubleBuffer buffer , UTF8Encoding encoding, CompressionStream outStream) : base(Stream.Null, encoding)
private BufferWriter(DoubleBuffer buffer, UTF8Encoding encoding, CompressionStream outStream) : base(Stream.Null, encoding)
{
_baseStream = outStream;
_swapedBytes = 0;

View File

@@ -76,7 +76,7 @@ public class CompressionStream : Stream
}
return new CompressBuffer();
}
public BufferWriter BufferWriter { get; private set; }
public CompressionStream(WrapperDefines wrap, int compressionLevel, Stream outputStream, CompressBuffer compressBuffer, bool multiThread)
@@ -98,13 +98,13 @@ public class CompressionStream : Stream
{
_doubleBuffer = new DoubleBuffer(readBuffer ?? new byte[4 * Mb], writeBuffer ?? new byte[4 * Mb], Compress);
_outBuffer = outputBuffer ?? new byte[_wrapper.CompressBufferBound(writeBuffer?.Length ?? 4 * Mb)];
BufferWriter = new BufferWriter(_doubleBuffer,this);
BufferWriter = new BufferWriter(_doubleBuffer, this);
}
public override void Flush()
{
_doubleBuffer.SwapBuffer();
if(_useMultiThread)
if (_useMultiThread)
{
_doubleBuffer.WaitReadEnd();
}
@@ -151,7 +151,7 @@ public class CompressionStream : Stream
private void CompressAsync()
{
while(!_stopWorker)
while (!_stopWorker)
{
Compress_Internal();
}

View File

@@ -2,7 +2,7 @@ using System;
namespace CompressSave.Wrapper;
public class LZ4API: WrapperDefines
public class LZ4API : WrapperDefines
{
public static readonly bool Avaliable;
public static readonly LZ4API Instance = new();

View File

@@ -2,7 +2,7 @@
namespace CompressSave.Wrapper;
public class NoneAPI: WrapperDefines
public class NoneAPI : WrapperDefines
{
public static readonly bool Avaliable;
public static readonly NoneAPI Instance = new();

View File

@@ -5,7 +5,7 @@ namespace CompressSave.Wrapper;
internal class PeekableReader(DecompressionStream input) : BinaryReader(input)
{
public override int PeekChar()
{
{
return input.PeekByte();
}
}

View File

@@ -8,10 +8,10 @@ public static class WinApi
// LoadLibrary, GetProcAddress, FreeLibrary
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FreeLibrary(IntPtr hModule);

View File

@@ -25,7 +25,7 @@ public class WrapperDefines
long srcSize);
protected unsafe delegate long DecompressUpdateFunc(IntPtr dctx, byte* dstBuffer, ref long dstCapacity, byte* srcBuffer,
ref long srcSize);
public CompressBufferBoundFunc CompressBufferBound;
public CompressBeginFunc CompressBegin;
public CompressEndFunc CompressEnd;

View File

@@ -2,7 +2,7 @@ using System;
namespace CompressSave.Wrapper;
public class ZstdAPI: WrapperDefines
public class ZstdAPI : WrapperDefines
{
public static readonly bool Avaliable;
public static readonly ZstdAPI Instance = new();