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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
32 additions and
5 deletions
-
ILSpy/AboutPage.cs
-
ILSpy/ILSpySettingsFilePathProvider.cs
|
|
@ -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 |
|
|
|
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; |
|
|
|
|
|
@ -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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |