diff --git a/README.md b/README.md index 736cafb..7f4e4ed 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,23 @@ hMarkdown, .NET Framework 4.8 ile geliştirilmiş, kullanıcı dostu ve modern * **Responsive Adres Çubuğu**: Pencere boyutuna göre otomatik ayarlanan dosya yolu çubuğu. * **Yardım Dokümantasyonu**: Takıldığınız yerde `F1` tuşu veya yardım butonu ile Markdown komut rehberine ulaşabilirsiniz. +## 🔄 Son Güncellemeler ve İyileştirmeler + +### 📂 Dosya Açma ve Çift Tıklama İyileştirmeleri +* **Çift Tıklama Desteği (Windows İlişkilendirmesi)**: Uygulamanın Windows Explorer üzerinden çift tıklatılarak veya parametre verilerek başlatılması tamamen optimize edildi. Dosya yollarındaki tırnak işaretleri (`"`) temizlenir ve boşluklu dosya yolları otomatik olarak birleştirilir. +* **Açılışta Önizleme Yükleme Sorunu**: İlk açılışta önizleme ekranının boş kalması engellendi. `WebBrowser` kontrolü hazır olana kadar bekletilip ardından dosya içeriğinin yüklenmesi sağlandı. +* **Dosya Açma Penceresi Temizliği**: "Gözat" (...) butonuna tıklandığında açılan dosya seçme penceresindeki varsayılan `"openFileDialog"` metni temizlendi. + +### 🌐 Tarayıcı ve Performans İyileştirmeleri +* **Modern Tarayıcı Motoru (IE11 Edge Modu)**: Varsayılan olarak eski IE7 modunda çalışan `WebBrowser` kontrolü, program başlangıcında Windows Kayıt Defteri (Registry - HKCU) üzerinden otomatik olarak **IE11 (Edge) moduna** yükseltilir. Bu sayede `highlight.js` ve CSS stilleri kusursuz çalışır. +* **Betik Hatalarının Engellenmesi**: Tarayıcının arka planda üretebileceği script hataları tamamen engellendi (`ScriptErrorsSuppressed = true`), kullanıcıya hata penceresi gösterilmez. +* **Senkron & Titremesiz Önizleme**: Tarayıcıya doğrudan senkron yazma (`Document.Write`) yöntemi kullanılarak sayfa geçişlerindeki titremeler giderildi. + +### 🏷️ Sürüm Yönetimi +* **Dinamik Sürüm Bilgisi**: Uygulama sürümü `v1...` (Örn: `1.2026.7.XXXX`) formatına dönüştürüldü. Otomatik artan build numarası aktif edilerek derleme bazlı takip kolaylaştırıldı. +* **Sürüm Gösterimi**: Aktif çalışan uygulama sürümü, pencere başlığında (Title Bar) dinamik olarak gösterilir. + + ## 🛠️ Kurulum ve Derleme 1. **Depoyu İndirin**: Projeyi bilgisayarınıza klonlayın veya zip olarak indirin. diff --git a/hMarkdown/Form1.cs b/hMarkdown/Form1.cs index 7b52e5a..1f6eca5 100644 --- a/hMarkdown/Form1.cs +++ b/hMarkdown/Form1.cs @@ -9,28 +9,48 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using static System.Net.Mime.MediaTypeNames; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrayNotify; namespace hMarkdown { public partial class Form1 : Form { + private string startupFile = ""; + public Form1(string fn) { InitializeComponent(); + webBrowser.ScriptErrorsSuppressed = true; this.DragEnter += Form1_DragEnter; this.Resize += Form1_Resize; - this.Load += (s, e) => AdjustDosyaTextBoxWidth(); + this.Load += Form1_Load; + + if (!string.IsNullOrEmpty(fn)) { + startupFile = fn.Trim('"', ' '); + } InitializeCustomControls(); SetMode(false); - - if (fn.Length>0) { - tbDosya.Text = fn; - DosyaAc(); + } + + private void Form1_Load(object sender, EventArgs e) + { + AdjustDosyaTextBoxWidth(); + + // Set window title with dynamic version + string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + this.Text = $"hOLOlu Markdown Viewer (v{version})"; + + // WebBrowser kontrolünün ActiveX nesnesini ve dokümanını başlatmak için about:blank'e yönlendirip bekliyoruz. + webBrowser.Navigate("about:blank"); + while (webBrowser.ReadyState != WebBrowserReadyState.Complete) + { + System.Windows.Forms.Application.DoEvents(); + } + + if (!string.IsNullOrEmpty(startupFile)) { + tbDosya.Text = startupFile; + DosyaAc(); } } @@ -99,7 +119,15 @@ namespace hMarkdown "; - webBrowser.DocumentText = result; + if (webBrowser.Document != null) + { + webBrowser.Document.OpenNew(true); + webBrowser.Document.Write(result); + } + else + { + webBrowser.DocumentText = result; + } //webBrowser.Document.Body.Style.font = "font-family: Tahoma, Threbucet, Verdana; font-size: large;"; //webBrowser.Document.ExecCommand("SelectAll", false, "null"); @@ -109,6 +137,7 @@ namespace hMarkdown private void tbGozat_Click(object sender, EventArgs e) { + openFileDialog.FileName = ""; openFileDialog.Filter = "(*.md)|*.md|Tüm Dosyalar (*.*)|*.*"; openFileDialog.FilterIndex = 2; openFileDialog.RestoreDirectory = true; @@ -185,12 +214,10 @@ namespace hMarkdown private void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e) { - string file = e.Url.LocalPath.ToString(); - - if (file!="blank") + if (e.Url != null && e.Url.IsFile) { - - tbDosya.Text = file.Replace("file:///", ""); ; + string file = e.Url.LocalPath; + tbDosya.Text = file; DosyaAc(); } } diff --git a/hMarkdown/Program.cs b/hMarkdown/Program.cs index 8e146a7..3cd2084 100644 --- a/hMarkdown/Program.cs +++ b/hMarkdown/Program.cs @@ -1,22 +1,50 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace hMarkdown -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1(args.Length > 0 ? args[0] : "")); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +using Microsoft.Win32; + +namespace hMarkdown +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + SetBrowserEmulationMode(); + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + string fn = ""; + if (args.Length > 0) + { + fn = string.Join(" ", args); + } + Application.Run(new Form1(fn)); + } + + private static void SetBrowserEmulationMode() + { + try + { + string appName = System.IO.Path.GetFileName(System.Windows.Forms.Application.ExecutablePath); + using (var key = Registry.CurrentUser.CreateSubKey( + @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", + RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + if (key != null) + { + key.SetValue(appName, 11001, RegistryValueKind.DWord); + } + } + } + catch { } + } + } +} diff --git a/hMarkdown/Properties/AssemblyInfo.cs b/hMarkdown/Properties/AssemblyInfo.cs index 914c962..0db56ef 100644 --- a/hMarkdown/Properties/AssemblyInfo.cs +++ b/hMarkdown/Properties/AssemblyInfo.cs @@ -1,33 +1,32 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("hMarkdown")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("hMarkdown Reader")] -[assembly: AssemblyCopyright("Copyright © 2025")] -[assembly: AssemblyTrademark("by hOLOlu")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a8e10c05-f985-4702-8ae2-b5d95e9aed83")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("hMarkdown")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("hMarkdown Reader")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("by hOLOlu")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a8e10c05-f985-4702-8ae2-b5d95e9aed83")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.2026.7.*")] diff --git a/hMarkdown/hMarkdown.csproj b/hMarkdown/hMarkdown.csproj index 60a3c3d..b0b617e 100644 --- a/hMarkdown/hMarkdown.csproj +++ b/hMarkdown/hMarkdown.csproj @@ -1,167 +1,167 @@ - - - - - - Debug - AnyCPU - {A8E10C05-F985-4702-8AE2-B5D95E9AED83} - WinExe - hMarkdown - hMarkdown - v4.8 - 512 - true - true - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 1 - 1.0.1.%2a - false - true - true - - - - - AnyCPU - true - embedded - true - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - hMarkdown.ico - - - 30C74CF3F4C04AC892558ECE90FE433BE8797724 - - - hMarkdown_TemporaryKey.pfx - - - true - - - true - - - - ..\packages\Costura.Fody.6.0.0\lib\netstandard2.0\Costura.dll - - - ..\packages\Markdig.0.41.3\lib\net462\Markdig.dll - - - - ..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll - - - - ..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll - - - - - - - - - - - - - - Form - - - Form1.cs - - - Form - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - - - - False - Microsoft .NET Framework 4.8 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + Debug + AnyCPU + {A8E10C05-F985-4702-8AE2-B5D95E9AED83} + WinExe + hMarkdown + hMarkdown + v4.8 + 512 + true + false + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 1 + 1.0.1.%2a + false + true + true + + + + + AnyCPU + true + embedded + true + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + hMarkdown.ico + + + 30C74CF3F4C04AC892558ECE90FE433BE8797724 + + + hMarkdown_TemporaryKey.pfx + + + true + + + true + + + + ..\packages\Costura.Fody.6.0.0\lib\netstandard2.0\Costura.dll + + + ..\packages\Markdig.0.41.3\lib\net462\Markdig.dll + + + + ..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll + + + + ..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll + + + + + + + + + + + + + + Form + + + Form1.cs + + + Form + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + False + Microsoft .NET Framework 4.8 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file