fixed history being written even when history file wasn't created prior
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 628 KiB |
@@ -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()
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user