Browse Source

AOT and x-plat changes (#3203)

* Make AboutPage AOT-friendlier
* Fix AOT and x-plat settings path inference
pull/3215/head
Christoph Wille 1 year ago committed by GitHub
parent
commit
e5d11203d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      ILSpy/AboutPage.cs
  2. 10
      ILSpy/ILSpySettingsFilePathProvider.cs

23
ILSpy/AboutPage.cs

@ -54,7 +54,7 @@ namespace ICSharpCode.ILSpy @@ -54,7 +54,7 @@ namespace ICSharpCode.ILSpy
};
output.WriteLine(Resources.ILSpyVersion + DecompilerVersionInfo.FullVersion);
string prodVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Uri).Assembly.Location).ProductVersion;
string prodVersion = GetDotnetProductVersion();
output.WriteLine(Resources.NETFrameworkVersion + prodVersion);
output.AddUIElement(
@ -104,6 +104,27 @@ namespace ICSharpCode.ILSpy @@ -104,6 +104,27 @@ namespace ICSharpCode.ILSpy
textView.ShowText(output);
}
private static string GetDotnetProductVersion()
{
// In case of AOT .Location is null, we need a fallback for that
string assemblyLocation = typeof(Uri).Assembly.Location;
if (!String.IsNullOrWhiteSpace(assemblyLocation))
{
return System.Diagnostics.FileVersionInfo.GetVersionInfo(assemblyLocation).ProductVersion;
}
else
{
var version = typeof(Object).Assembly.GetName().Version;
if (version != null)
{
return version.ToString();
}
}
return "UNKNOWN";
}
sealed class MyLinkElementGenerator : LinkElementGenerator
{
readonly Uri uri;

10
ILSpy/ILSpySettingsFilePathProvider.cs

@ -29,10 +29,16 @@ namespace ICSharpCode.ILSpy @@ -29,10 +29,16 @@ namespace ICSharpCode.ILSpy
{
if (App.CommandLineArguments.ConfigFile != null)
return App.CommandLineArguments.ConfigFile;
string localPath = Path.Combine(Path.GetDirectoryName(typeof(MainWindow).Assembly.Location), "ILSpy.xml");
var assemblyLocation = typeof(MainWindow).Assembly.Location;
if (!String.IsNullOrWhiteSpace(assemblyLocation))
{
string localPath = Path.Combine(Path.GetDirectoryName(assemblyLocation), "ILSpy.xml");
if (File.Exists(localPath))
return localPath;
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode\\ILSpy.xml");
}
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode", "ILSpy.xml");
}
}
}

Loading…
Cancel
Save