mirror of
https://github.com/JuniorDark/RustyHearts-Launcher.git
synced 2026-05-07 05:21:44 -04:00
Extended the localization system to easily include additional languages in the future
This commit is contained in:
parent
d5ec712d0f
commit
ae34584021
50 changed files with 45079 additions and 24129 deletions
|
|
@ -1,41 +1,39 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
using RHLauncher.DynamicLib;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public static class ZLibDll
|
||||
namespace RHLauncher.DynamicLib
|
||||
{
|
||||
|
||||
//[DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
//public static extern int Decompress(byte[] compressed_buffer, int compressed_size, byte[] decompressed_buffer, ref int decompressed_size);
|
||||
|
||||
public delegate int DecompressDelegate(byte[] compressed_buffer, int compressed_size, byte[] decompressed_buffer, ref int decompressed_size);
|
||||
public static DecompressDelegate? Decompress = null;
|
||||
|
||||
//[DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
//public static extern int Compress(byte[] decompressed_buffer, int decompressed_size, byte[] compressed_buffer, ref int compressed_size);
|
||||
public delegate int CompressDelegate(byte[] decompressed_buffer, int decompressed_size, byte[] compressed_buffer, ref int compressed_size);
|
||||
public static CompressDelegate? Compress = null;
|
||||
|
||||
static ZLibDll()
|
||||
public static class ZLibDll
|
||||
{
|
||||
byte[] libBuffer = ResourceDll.ZlibDll;
|
||||
string dllPath = Path.Combine(Path.GetTempPath(), "ZlibDll.dll");
|
||||
try
|
||||
|
||||
//[DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
//public static extern int Decompress(byte[] compressed_buffer, int compressed_size, byte[] decompressed_buffer, ref int decompressed_size);
|
||||
|
||||
public delegate int DecompressDelegate(byte[] compressed_buffer, int compressed_size, byte[] decompressed_buffer, ref int decompressed_size);
|
||||
public static DecompressDelegate? Decompress = null;
|
||||
|
||||
//[DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
//public static extern int Compress(byte[] decompressed_buffer, int decompressed_size, byte[] compressed_buffer, ref int compressed_size);
|
||||
public delegate int CompressDelegate(byte[] decompressed_buffer, int decompressed_size, byte[] compressed_buffer, ref int compressed_size);
|
||||
public static CompressDelegate? Compress = null;
|
||||
|
||||
static ZLibDll()
|
||||
{
|
||||
File.WriteAllBytes(dllPath, libBuffer);
|
||||
byte[] libBuffer = ResourceDll.ZlibDll;
|
||||
string dllPath = Path.Combine(Path.GetTempPath(), "ZlibDll.dll");
|
||||
try
|
||||
{
|
||||
File.WriteAllBytes(dllPath, libBuffer);
|
||||
}
|
||||
catch { }
|
||||
|
||||
int hModule = NativeMethod.LoadLibrary(dllPath);
|
||||
if (hModule == 0) return;
|
||||
|
||||
IntPtr intPtr = NativeMethod.GetProcAddress(hModule, "Decompress");
|
||||
Decompress = (DecompressDelegate)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(DecompressDelegate));
|
||||
|
||||
intPtr = NativeMethod.GetProcAddress(hModule, "Compress");
|
||||
Compress = (CompressDelegate)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(CompressDelegate));
|
||||
}
|
||||
catch { }
|
||||
|
||||
int hModule = NativeMethod.LoadLibrary(dllPath);
|
||||
if (hModule == 0) return;
|
||||
|
||||
IntPtr intPtr = NativeMethod.GetProcAddress(hModule, "Decompress");
|
||||
Decompress = (DecompressDelegate)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(DecompressDelegate));
|
||||
|
||||
intPtr = NativeMethod.GetProcAddress(hModule, "Compress");
|
||||
Compress = (CompressDelegate)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(CompressDelegate));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue