diff --git a/CilView.Core/Common/Utils.cs b/CilView.Core/Common/Utils.cs index 710279b..0a8403b 100644 --- a/CilView.Core/Common/Utils.cs +++ b/CilView.Core/Common/Utils.cs @@ -3,6 +3,7 @@ * License: BSD 2.0 */ using System; using System.Collections.Generic; +using System.IO; using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -195,5 +196,14 @@ public static bool IsMethodWithoutBody(MethodBase m) } else return false; } + + public static string ReadEmbeddedResource(Assembly assembly, string nspace, string name) + { + using (Stream stream = assembly.GetManifestResourceStream(nspace + "." + name)) + using (StreamReader reader = new StreamReader(stream)) + { + return reader.ReadToEnd(); + } + } } } diff --git a/CilView/CilView.csproj b/CilView/CilView.csproj index 509e2a7..0e547ff 100644 --- a/CilView/CilView.csproj +++ b/CilView/CilView.csproj @@ -304,9 +304,7 @@ PreserveNewest - - Always - + Always diff --git a/CilView/MainWindow.xaml.cs b/CilView/MainWindow.xaml.cs index 4070b09..ca06e14 100644 --- a/CilView/MainWindow.xaml.cs +++ b/CilView/MainWindow.xaml.cs @@ -757,10 +757,9 @@ void OnHelpClick() { try { - string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - string path = Path.Combine(dir, "manual.html"); - - HtmlViewWindow wnd = new HtmlViewWindow(path); + Type t = typeof(MainWindow); + string content = Utils.ReadEmbeddedResource(t.Assembly, t.Namespace, "manual.html"); + HtmlViewWindow wnd = new HtmlViewWindow(content); wnd.Owner = this; wnd.Title = "CIL View Help"; wnd.Show(); diff --git a/CilView/Properties/AssemblyInfo.cs b/CilView/Properties/AssemblyInfo.cs index b94ba74..aef2de2 100644 --- a/CilView/Properties/AssemblyInfo.cs +++ b/CilView/Properties/AssemblyInfo.cs @@ -26,5 +26,5 @@ // в приложении или в каких-либо словарях ресурсов для конкретной темы) )] -[assembly: AssemblyVersion("2.5.0.1")] -[assembly: AssemblyFileVersion("2.5.0.1")] +[assembly: AssemblyVersion("2.5.0.2")] +[assembly: AssemblyFileVersion("2.5.0.2")] diff --git a/CilView/UI.Dialogs/HtmlViewWindow.xaml.cs b/CilView/UI.Dialogs/HtmlViewWindow.xaml.cs index 6e4ea70..e7c9f37 100644 --- a/CilView/UI.Dialogs/HtmlViewWindow.xaml.cs +++ b/CilView/UI.Dialogs/HtmlViewWindow.xaml.cs @@ -3,7 +3,6 @@ * License: BSD 2.0 */ using System; using System.Collections.Generic; -using System.IO; using System.Text; using System.Windows; @@ -14,10 +13,9 @@ namespace CilView.UI.Dialogs /// public partial class HtmlViewWindow : Window { - public HtmlViewWindow(string filepath) + public HtmlViewWindow(string content) { InitializeComponent(); - string content = File.ReadAllText(filepath); this.content.NavigateToString(content); } diff --git a/CilView/readme.txt b/CilView/readme.txt index 38fe0b6..a5f099e 100644 --- a/CilView/readme.txt +++ b/CilView/readme.txt @@ -121,6 +121,10 @@ Changelog - Fix literal syntax for enum and boolean types - Fix `serializable` attribute handling +2.5.0.2 + +- Fix help when running from directory with non-latin characters in path + --------------------------------------------- Copyright (c) 2022, MSDN.WhiteKnight diff --git a/scripts/package.ps1 b/scripts/package.ps1 index 3181cc3..bda7e2b 100644 --- a/scripts/package.ps1 +++ b/scripts/package.ps1 @@ -27,8 +27,7 @@ $fileList = "CilTools.BytecodeAnalysis.dll", "Newtonsoft.Json.dll", "license.txt", "ReadMe.txt", - "credits.txt", - "manual.html" + "credits.txt" foreach ($file in $fileList) {