Fix file opening bugs, IE compatibility issues, and implement auto-incrementing version
This commit is contained in:
17
README.md
17
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.
|
* **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.
|
* **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.<yil>.<ay>.<artan build numarası>` (Ö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
|
## 🛠️ Kurulum ve Derleme
|
||||||
|
|
||||||
1. **Depoyu İndirin**: Projeyi bilgisayarınıza klonlayın veya zip olarak indirin.
|
1. **Depoyu İndirin**: Projeyi bilgisayarınıza klonlayın veya zip olarak indirin.
|
||||||
|
|||||||
@@ -9,27 +9,47 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
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
|
namespace hMarkdown
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
|
private string startupFile = "";
|
||||||
|
|
||||||
public Form1(string fn)
|
public Form1(string fn)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
webBrowser.ScriptErrorsSuppressed = true;
|
||||||
this.DragEnter += Form1_DragEnter;
|
this.DragEnter += Form1_DragEnter;
|
||||||
this.Resize += Form1_Resize;
|
this.Resize += Form1_Resize;
|
||||||
this.Load += (s, e) => AdjustDosyaTextBoxWidth();
|
this.Load += Form1_Load;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(fn)) {
|
||||||
|
startupFile = fn.Trim('"', ' ');
|
||||||
|
}
|
||||||
|
|
||||||
InitializeCustomControls();
|
InitializeCustomControls();
|
||||||
SetMode(false);
|
SetMode(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (fn.Length>0) {
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
tbDosya.Text = fn;
|
{
|
||||||
|
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();
|
DosyaAc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +119,15 @@ namespace hMarkdown
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>";
|
</html>";
|
||||||
|
if (webBrowser.Document != null)
|
||||||
|
{
|
||||||
|
webBrowser.Document.OpenNew(true);
|
||||||
|
webBrowser.Document.Write(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
webBrowser.DocumentText = result;
|
webBrowser.DocumentText = result;
|
||||||
|
}
|
||||||
|
|
||||||
//webBrowser.Document.Body.Style.font = "font-family: Tahoma, Threbucet, Verdana; font-size: large;";
|
//webBrowser.Document.Body.Style.font = "font-family: Tahoma, Threbucet, Verdana; font-size: large;";
|
||||||
//webBrowser.Document.ExecCommand("SelectAll", false, "null");
|
//webBrowser.Document.ExecCommand("SelectAll", false, "null");
|
||||||
@@ -109,6 +137,7 @@ namespace hMarkdown
|
|||||||
|
|
||||||
private void tbGozat_Click(object sender, EventArgs e)
|
private void tbGozat_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
openFileDialog.FileName = "";
|
||||||
openFileDialog.Filter = "(*.md)|*.md|Tüm Dosyalar (*.*)|*.*";
|
openFileDialog.Filter = "(*.md)|*.md|Tüm Dosyalar (*.*)|*.*";
|
||||||
openFileDialog.FilterIndex = 2;
|
openFileDialog.FilterIndex = 2;
|
||||||
openFileDialog.RestoreDirectory = true;
|
openFileDialog.RestoreDirectory = true;
|
||||||
@@ -185,12 +214,10 @@ namespace hMarkdown
|
|||||||
|
|
||||||
private void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
|
private void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
|
||||||
{
|
{
|
||||||
string file = e.Url.LocalPath.ToString();
|
if (e.Url != null && e.Url.IsFile)
|
||||||
|
|
||||||
if (file!="blank")
|
|
||||||
{
|
{
|
||||||
|
string file = e.Url.LocalPath;
|
||||||
tbDosya.Text = file.Replace("file:///", ""); ;
|
tbDosya.Text = file;
|
||||||
DosyaAc();
|
DosyaAc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace hMarkdown
|
namespace hMarkdown
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@@ -14,9 +16,35 @@ namespace hMarkdown
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
SetBrowserEmulationMode();
|
||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new Form1(args.Length > 0 ? args[0] : ""));
|
|
||||||
|
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 { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -29,5 +29,4 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("1.0.1.0")]
|
[assembly: AssemblyVersion("1.2026.7.*")]
|
||||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>false</Deterministic>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
|
|||||||
Reference in New Issue
Block a user