Skip to content

Commit

Permalink
Core: DisposeAndCleanupAll. Lib: Dispose of streams. Bump to .0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Byass committed Feb 24, 2022
1 parent d703f93 commit e4e29d9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Cpp2IL.Core/Cpp2IL.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<Nullable>enable</Nullable>
<PackageId>Samboy063.Cpp2IL.Core</PackageId>
<Company>Samboy063</Company>
<FileVersion>2022.0.1</FileVersion>
<Version>2022.0.1</Version>
<InformationalVersion>2022.0.1</InformationalVersion>
<FileVersion>2022.0.2</FileVersion>
<Version>2022.0.2</Version>
<InformationalVersion>2022.0.2</InformationalVersion>
<Copyright>Copyright © Samboy063 2019-2022</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
9 changes: 6 additions & 3 deletions Cpp2IL.Core/Cpp2IlApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static void InitializeLibCpp2Il(string assemblyPath, string metadataPath,
public static void InitializeLibCpp2Il(string assemblyPath, string metadataPath, int[] unityVersion, bool allowUserToInputAddresses = false)
{
if (IsLibInitialized())
ResetInternalState();
DisposeAndCleanupAll();

ConfigureLib(allowUserToInputAddresses);

Expand Down Expand Up @@ -199,7 +199,7 @@ public static void InitializeLibCpp2Il(byte[] assemblyData, byte[] metadataData,
public static void InitializeLibCpp2Il(byte[] assemblyData, byte[] metadataData, int[] unityVersion, bool allowUserToInputAddresses = false)
{
if (IsLibInitialized())
ResetInternalState();
DisposeAndCleanupAll();

ConfigureLib(allowUserToInputAddresses);

Expand All @@ -216,7 +216,10 @@ public static void InitializeLibCpp2Il(byte[] assemblyData, byte[] metadataData,
}
}

private static void ResetInternalState()
/// <summary>
/// Clears all internal caches, lists, references, etc, disposes of the MemoryStream for the binary and metadata, and resets the state of the library.
/// </summary>
public static void DisposeAndCleanupAll()
{
SharedState.Clear();

Expand Down
4 changes: 2 additions & 2 deletions Cpp2IL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2022.0.1")]
[assembly: AssemblyFileVersion("2022.0.1")]
[assembly: AssemblyVersion("2022.0.2")]
[assembly: AssemblyFileVersion("2022.0.2")]
2 changes: 1 addition & 1 deletion LibCpp2IL/LibCpp2IL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<LangVersion>9</LangVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>Samboy063.LibCpp2IL</PackageId>
<Version>2022.0.1</Version>
<Version>2022.0.2</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
Expand Down
6 changes: 6 additions & 0 deletions LibCpp2IL/LibCpp2IlMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public static void Reset()
LibCpp2IlGlobalMapper.Reset();
LibCpp2ILUtils.Reset();
MethodsByPtr.Clear();

MetadataVersion = 0f;
Binary?.Dispose();
TheMetadata?.Dispose();
Binary = null;
TheMetadata = null;
}

public static List<Il2CppMethodDefinition>? GetManagedMethodImplementationsAtAddress(ulong addr)
Expand Down
4 changes: 2 additions & 2 deletions LibCpp2IL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
[assembly: AssemblyCopyright("Copyright © Samboy063 2019-2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2022.0.1")]
[assembly: AssemblyFileVersion("2022.0.1")]
[assembly: AssemblyVersion("2022.0.2")]
[assembly: AssemblyFileVersion("2022.0.2")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down
2 changes: 1 addition & 1 deletion WasmDisassembler/WasmDisassembler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
<PackageId>Samboy063.WasmDisassembler</PackageId>
<Version>2022.0.0</Version>
<Version>2022.0.2</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
Expand Down

0 comments on commit e4e29d9

Please sign in to comment.