Browse Source

Log the used .NET version on startup.

pull/11/head
Quit 5 years ago
parent
commit
7e9528051e
1 changed files with 31 additions and 1 deletions
  1. +31
    -1
      IllusionInjector/PluginManager.cs

+ 31
- 1
IllusionInjector/PluginManager.cs View File

@@ -51,7 +51,7 @@ namespace IllusionInjector


// DEBUG
Console.WriteLine("Running on Unity {0}", UnityEngine.Application.unityVersion);
Console.WriteLine("Running on Unity {0} using {1}", UnityEngine.Application.unityVersion, GetFrameworkVersion());
Console.WriteLine("-----------------------------");
Console.WriteLine("Loading plugins from {0} and found {1}", pluginDirectory, _Plugins.Count);
Console.WriteLine("-----------------------------");
@@ -116,6 +116,36 @@ namespace IllusionInjector
&& type.GetConstructor(Type.EmptyTypes) != null;
}

private static string GetFrameworkVersion()
{
var version = Environment.Version.ToString();

try
{
switch (version)
{
case "2.0.50727.1433":
return ".NET 3.5 Equivalent";
case "4.0.30319.17020":
// For reasons unknown, switching to netstandard seems to set this back to .NET 4.0
var netstandard = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == "netstandard");
if (netstandard != null)
return $".NET Standard {netstandard.GetName().Version.ToString(2)}";

goto default;
case "4.0.30319.42000":
return ".NET 4.x";
default:
return $".NET Framework {version}";
}
}
catch
{
// In case something goes wrong, return the best we can guess
return version;
}
}

public class AppInfo
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false)]


Loading…
Cancel
Save