Skip to content

Commit

Permalink
Added assembly resolution system to permit DLLs to live in subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
cathoderaydude committed Aug 9, 2020
1 parent 01393c9 commit dabc4d0
Show file tree
Hide file tree
Showing 41 changed files with 59 additions and 426 deletions.
4 changes: 2 additions & 2 deletions Babel/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Expand Down Expand Up @@ -78,4 +78,4 @@
</setting>
</Babel.Properties.Settings>
</userSettings>
</configuration>
</configuration>
34 changes: 27 additions & 7 deletions Babel/Babel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
using Babel.Google;
using System.Windows.Input;
using System.Configuration;
//using System.Runtime.Extensions;
using System.Reflection;
using System.IO;

namespace Babel
{
Expand Down Expand Up @@ -82,21 +83,40 @@ public frmBabel()
InitializeComponent();
}

/*private static Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
private static Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
{
Console.WriteLine("Resolving...");
return typeof(MyType).Assembly;
}*/
string AssName = args.Name.Split(',')[0];
string AssPath = Application.StartupPath + "\\DLLs\\" + AssName + ".dll";
if (File.Exists(AssPath))
{
return (Assembly.LoadFile(AssPath));
} else
{
String[] IgnoredModules =
{
"Xamarin",
"Unity",
"Mono",
".resources"
};
bool IgnoredModule = false;
foreach(string module in IgnoredModules)
{ if (args.Name.Contains(module)) IgnoredModule = true; }
if (!IgnoredModule) DebugLog.Log("Couldn't find assembly: " + args.Name);
return null;
}
//return typeof(MyType).Assembly;
}

private void Viewfinder_Load(object sender, EventArgs e)
{
DebugLog.Log("==============================================");
DebugLog.Log("Babel starting");
LoadSettings();

//AppDomain currentDomain = AppDomain.CurrentDomain;
AppDomain currentDomain = AppDomain.CurrentDomain;

//currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);


if (Properties.Settings.Default.WaiverSigned != true)
Expand Down
4 changes: 3 additions & 1 deletion Babel/Babel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Babel</RootNamespace>
<AssemblyName>Babel</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
Expand All @@ -29,6 +29,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -237,6 +238,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
Expand Down
9 changes: 0 additions & 9 deletions Babel/Help/Images/_vti_cnf/autophrase.png

This file was deleted.

9 changes: 0 additions & 9 deletions Babel/Help/Images/_vti_cnf/camera.png

This file was deleted.

9 changes: 0 additions & 9 deletions Babel/Help/Images/_vti_cnf/crosshair.png

This file was deleted.

9 changes: 0 additions & 9 deletions Babel/Help/Images/_vti_cnf/img11.gif

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img17.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img18.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img1B.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img1C.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img1E.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img1E_small.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img1F.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img1F_small.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img24.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img24_small.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img28.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img29.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img2C.gif

This file was deleted.

9 changes: 0 additions & 9 deletions Babel/Help/Images/_vti_cnf/img3.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img32.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img32_small.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img35.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img35_small.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img38.jpg

This file was deleted.

12 changes: 0 additions & 12 deletions Babel/Help/Images/_vti_cnf/img38_small.jpg

This file was deleted.

Loading

0 comments on commit dabc4d0

Please sign in to comment.