diff --git a/Changelog.md b/Changelog.md index c6a09ec..f6ff4f4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ - added new setting to start with maximized window - long file names work now even if not enabled by the OS +- fixed history being written even when history file wasn't created prior ### 5.3 diff --git a/img/MediaSearch.png b/img/MediaSearch.png index fe5dda8..013f4e4 100644 Binary files a/img/MediaSearch.png and b/img/MediaSearch.png differ diff --git a/mpv.net/Misc/Command.cs b/mpv.net/Misc/Command.cs index 23763e6..95c81d0 100644 --- a/mpv.net/Misc/Command.cs +++ b/mpv.net/Misc/Command.cs @@ -98,14 +98,15 @@ namespace mpvnet public static void ShowHistory() { - var fp = mp.ConfigFolder + "history.txt"; - - if (File.Exists(fp)) - Process.Start(fp); + if (File.Exists(mp.ConfigFolder + "history.txt")) + Process.Start(mp.ConfigFolder + "history.txt"); else + { if (Msg.ShowQuestion("Create history.txt file in config folder?", "mpv.net will write the date, time and filename of opened files to it.") == MsgResult.OK) - File.WriteAllText(fp, ""); + + File.WriteAllText(mp.ConfigFolder + "history.txt", ""); + } } public static void ShowInfo() diff --git a/mpv.net/Misc/Program.cs b/mpv.net/Misc/Program.cs index f63ffc8..863e6c8 100644 --- a/mpv.net/Misc/Program.cs +++ b/mpv.net/Misc/Program.cs @@ -40,7 +40,7 @@ namespace mpvnet files.Add(App.ProcessInstance); foreach (string arg in args) - if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") || File.Exists(arg))) + if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") || arg.Contains(":\\") || arg.StartsWith("\\\\"))) files.Add(arg); Process[] procs = Process.GetProcessesByName("mpvnet"); diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index aea2983..3f8c3e9 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -375,7 +375,7 @@ namespace mpvnet BeginInvoke(new Action(() => { if (path.Contains("://")) Text = path + " - mpv.net " + Application.ProductVersion; - else if (File.Exists(path)) + else if (path.Contains(":\\") || path.StartsWith("\\\\")) Text = path.FileName() + " - mpv.net " + Application.ProductVersion; else Text = "mpv.net " + Application.ProductVersion; diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index d368aec..128d0a1 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -622,7 +622,7 @@ namespace mpvnet foreach (string i in args) { - if (!i.StartsWith("--") && (i == "-" || i.Contains("://") || i.Contains(":\\"))) + if (!i.StartsWith("--") && (i == "-" || i.Contains("://") || i.Contains(":\\") || i.StartsWith("\\\\"))) { files.Add(i); if (i.Contains("://")) RegHelp.SetObject(App.RegPath, "LastURL", i); @@ -731,14 +731,12 @@ namespace mpvnet static void WriteHistory(string path) { - if (!File.Exists(path)) return; + if (!File.Exists(ConfigFolder + "history.txt") || !File.Exists(path)) return; int totalMinutes = Convert.ToInt32((DateTime.Now - LastHistoryStartDateTime).TotalMinutes); if (File.Exists(LastHistoryPath) && totalMinutes > 1) - { File.AppendAllText(ConfigFolder + "history.txt", DateTime.Now.ToString().Substring(0, 16) + " " + totalMinutes.ToString().PadLeft(3) + " " + Path.GetFileNameWithoutExtension(LastHistoryPath) + "\r\n"); - } LastHistoryPath = path; LastHistoryStartDateTime = DateTime.Now;