Browse Source

Shrunk distrobution more by not needing Cecil in the root directory

piracy-check
Anairkoen Schno 6 years ago
parent
commit
7297dbc5b1
2 changed files with 18 additions and 2 deletions
  1. +1
    -1
      IPA/IPA.csproj
  2. +17
    -1
      IPA/Program.cs

+ 1
- 1
IPA/IPA.csproj View File

@ -118,7 +118,7 @@
</ItemGroup> </ItemGroup>
<Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\%(RecursiveDir)" /> <Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\%(RecursiveDir)" />
<ItemGroup> <ItemGroup>
<BadDlls Include="$(OutputPath)Mono.Cecil.*.dll" />
<BadDlls Include="$(OutputPath)Mono.Cecil.*" /> <!-- Kill the Mono.Cecil stuff that get put in the root, don't want to dupe it -->
</ItemGroup> </ItemGroup>
<Delete Files="@(BadDlls)" /> <Delete Files="@(BadDlls)" />
</Target> </Target>


+ 17
- 1
IPA/Program.cs View File

@ -60,7 +60,23 @@ namespace IPA
catch (Exception) { } catch (Exception) { }
} }
PatchContext context;
PatchContext context = null;
Assembly AssemblyLibLoader(object source, ResolveEventArgs e)
{
var libsDir = context.LibsPathSrc;
var asmName = new AssemblyName(e.Name);
var testFilen = Path.Combine(libsDir, $"{asmName.Name}.{asmName.Version}.dll");
if (File.Exists(testFilen))
return Assembly.LoadFile(testFilen);
Console.WriteLine($"Could not load library {asmName}");
return null;
}
AppDomain.CurrentDomain.AssemblyResolve += AssemblyLibLoader;
var argExeName = Arguments.CmdLine.PositionalArgs.FirstOrDefault(s => s.EndsWith(".exe")); var argExeName = Arguments.CmdLine.PositionalArgs.FirstOrDefault(s => s.EndsWith(".exe"));
if (argExeName == null) if (argExeName == null)


Loading…
Cancel
Save