Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit 37f816f

Browse files
RazmothRazmoth
Razmoth
authored and
Razmoth
committed
Added net6 back.
1 parent 94d7339 commit 37f816f

19 files changed

+219
-225
lines changed

AssetStudio.PInvoke/AssetStudio.PInvoke.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66
<Version>0.80.30</Version>
77
<AssemblyVersion>0.80.30</AssemblyVersion>

AssetStudio.PInvoke/DllLoader.cs

+11-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace AssetStudio.PInvoke
88
{
9-
public static partial class DllLoader
9+
public static class DllLoader
1010
{
1111

1212
public static void PreloadDll(string dllName)
@@ -46,9 +46,9 @@ internal static void LoadDll(string dllDir, string dllName)
4646
var directedDllPath = Path.Combine(dllDir, dllFileName);
4747

4848
// Specify SEARCH_DLL_LOAD_DIR to load dependent libraries located in the same platform-specific directory.
49-
var hLibrary = LoadLibraryEx(directedDllPath, nint.Zero, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
49+
var hLibrary = LoadLibraryEx(directedDllPath, IntPtr.Zero, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
5050

51-
if (hLibrary == nint.Zero)
51+
if (hLibrary == IntPtr.Zero)
5252
{
5353
var errorCode = Marshal.GetLastWin32Error();
5454
var exception = new Win32Exception(errorCode);
@@ -59,15 +59,15 @@ internal static void LoadDll(string dllDir, string dllName)
5959

6060
// HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
6161
// HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
62-
[LibraryImport("kernel32.dll", EntryPoint = "LoadLibraryExA", SetLastError = true, StringMarshalling = StringMarshalling.Utf8)]
63-
private static partial IntPtr LoadLibraryEx(string lpLibFileName, IntPtr hFile, uint dwFlags);
62+
[DllImport("kernel32.dll", SetLastError = true)]
63+
private static extern IntPtr LoadLibraryEx(string lpLibFileName, IntPtr hFile, uint dwFlags);
6464

6565
private const uint LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x1000;
6666
private const uint LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x100;
6767

6868
}
6969

70-
private static partial class Posix
70+
private static class Posix
7171
{
7272

7373
internal static void LoadDll(string dllDir, string dllName)
@@ -93,7 +93,7 @@ internal static void LoadDll(string dllDir, string dllName)
9393
const int ldFlags = RTLD_NOW | RTLD_GLOBAL;
9494
var hLibrary = DlOpen(directedDllPath, ldFlags);
9595

96-
if (hLibrary == nint.Zero)
96+
if (hLibrary == IntPtr.Zero)
9797
{
9898
var pErrStr = DlError();
9999
// `PtrToStringAnsi` always uses the specific constructor of `String` (see dotnet/core#2325),
@@ -107,12 +107,12 @@ internal static void LoadDll(string dllDir, string dllName)
107107

108108
// OSX and most Linux OS use LP64 so `int` is still 32-bit even on 64-bit platforms.
109109
// void *dlopen(const char *filename, int flag);
110-
[LibraryImport("libdl", EntryPoint = "dlopen", StringMarshalling = StringMarshalling.Utf8)]
111-
private static partial nint DlOpen(string fileName, int flags);
110+
[DllImport("libdl", EntryPoint = "dlopen")]
111+
private static extern IntPtr DlOpen([MarshalAs(UnmanagedType.LPStr)] string fileName, int flags);
112112

113113
// char *dlerror(void);
114-
[LibraryImport("libdl", EntryPoint = "dlerror")]
115-
private static partial nint DlError();
114+
[DllImport("libdl", EntryPoint = "dlerror")]
115+
private static extern IntPtr DlError();
116116

117117
private const int RTLD_LAZY = 0x1;
118118
private const int RTLD_NOW = 0x2;

AssetStudio/AssetStudio.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
55
<Version>0.80.30</Version>
66
<AssemblyVersion>0.80.30</AssemblyVersion>
77
<FileVersion>0.80.30</FileVersion>

AssetStudio/Classes/AnimationClip.cs

-2
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,6 @@ public void Read(ObjectReader reader)
488488
m_ConstCurveCount = reader.ReadUInt32();
489489
}
490490
}
491-
492-
public bool IsSet => m_CurveCount > 0;
493491
}
494492

495493
public class StreamedClip

AssetStudio/Classes/MiHoYoBinData.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ public enum MiHoYoBinDataType
1212
Bytes,
1313
JSON
1414
}
15-
public sealed partial class MiHoYoBinData : Object
15+
public sealed class MiHoYoBinData : Object
1616
{
17+
private static Regex ASCII = new Regex("[^\u0020-\u007E]", RegexOptions.Compiled);
18+
1719
public static bool Exportable;
1820
public static bool Encrypted;
1921
public static byte Key;
@@ -29,7 +31,7 @@ public MiHoYoBinData(ObjectReader reader) : base(reader)
2931
public string AsString => Type switch
3032
{
3133
MiHoYoBinDataType.JSON => JToken.Parse(DataStr).ToString(Formatting.Indented),
32-
MiHoYoBinDataType.Bytes => Chars().Replace(DataStr, string.Empty),
34+
MiHoYoBinDataType.Bytes => ASCII.Replace(DataStr, string.Empty),
3335
_ => "",
3436
};
3537
public new object Dump() => Type switch
@@ -74,8 +76,5 @@ private byte[] Data
7476
else return RawData;
7577
}
7678
}
77-
78-
[GeneratedRegex("[^\\u0020-\\u007E]")]
79-
private static partial Regex Chars();
8079
}
8180
}

AssetStudioCLI/AssetStudioCLI.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net7.0-windows</TargetFramework>
4+
<TargetFrameworks>net7.0-windows;net6.0-windows</TargetFrameworks>
55
<ApplicationIcon>Resources\as.ico</ApplicationIcon>
66
<Version>0.80.30</Version>
77
<AssemblyVersion>0.80.30</AssemblyVersion>

AssetStudioFBXWrapper/AssetStudioFBXWrapper.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66
<Version>0.80.30</Version>
77
<AssemblyVersion>0.80.30</AssemblyVersion>

AssetStudioFBXWrapper/Fbx.PInvoke.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ namespace AssetStudio
66
partial class Fbx
77
{
88

9-
[LibraryImport(FbxDll.DllName)]
10-
private static partial void AsUtilQuaternionToEuler(float qx, float qy, float qz, float qw, out float vx, out float vy, out float vz);
9+
[DllImport(FbxDll.DllName)]
10+
private static extern void AsUtilQuaternionToEuler(float qx, float qy, float qz, float qw, out float vx, out float vy, out float vz);
1111

12-
[LibraryImport(FbxDll.DllName)]
13-
private static partial void AsUtilEulerToQuaternion(float vx, float vy, float vz, out float qx, out float qy, out float qz, out float qw);
12+
[DllImport(FbxDll.DllName)]
13+
private static extern void AsUtilEulerToQuaternion(float vx, float vy, float vz, out float qx, out float qy, out float qz, out float qw);
1414

1515
}
1616
}

0 commit comments

Comments
 (0)