Fixed unhandled Exception

This commit is contained in:
Robert Altner 2019-08-01 23:41:58 +02:00
parent 54c3427a3a
commit 7f000b44bf
5 changed files with 88028 additions and 12 deletions

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -7,7 +7,8 @@
<OutputType>Library</OutputType>
<RootNamespace>BWModLoader</RootNamespace>
<AssemblyName>BWModLoader</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -40,8 +41,6 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="src\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

BIN
bin/Debug/BWModLoader.dll Normal file

Binary file not shown.

BIN
bin/Debug/UnityEngine.dll Normal file

Binary file not shown.

88008
bin/Debug/UnityEngine.xml Normal file

File diff suppressed because it is too large Load diff

View file

@ -41,17 +41,26 @@ namespace ModLoader
//Open them, Get the mod class, then add it in the game.
foreach (var file in d.GetFiles("*.dll"))
{
Assembly modDll = Assembly.LoadFrom(modsPath + "/" + file.Name);
Type[] modType = modDll.GetTypes();
foreach (Type t in modType)
try
{
Log("Found type in " + file.Name + ": " + t.Name);
if (t.IsClass && t.IsSubclassOf(typeof(MonoBehaviour)))
Assembly modDll = Assembly.LoadFrom(modsPath + "/" + file.Name);
Type[] modType = modDll.GetTypes();
foreach (Type t in modType)
{
modObjects.AddComponent(t);
Log("Loaded '" + t.Name + "' in " + file.Name);
Log("Found type in " + file.Name + ": " + t.Name);
if (t.IsClass && t.IsSubclassOf(typeof(MonoBehaviour)))
{
modObjects.AddComponent(t);
Log("Loaded '" + t.Name + "' in " + file.Name);
}
}
}
catch (Exception e)
{
Log("Exception raised while loading mod " + file.Name);
Log(e.Message);
Log("Skipped loading this mod");
}
}
Log("All Mods have been Loaded!");
modObjects.AddComponent<ModGUI.ModGUI>();