minor rewrite
This commit is contained in:
@@ -272,5 +272,16 @@ namespace mpvnet
|
|||||||
if (File.Exists(dir + "mpvnet.exe") && !File.Exists(dir + "mpvnet.com"))
|
if (File.Exists(dir + "mpvnet.exe") && !File.Exists(dir + "mpvnet.com"))
|
||||||
File.Copy(Folder.Startup + "mpvnet.com", dir + "mpvnet.com");
|
File.Copy(Folder.Startup + "mpvnet.com", dir + "mpvnet.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static (string Title, string Path) GetTitleAndPath(string input)
|
||||||
|
{
|
||||||
|
if (input.Contains("|"))
|
||||||
|
{
|
||||||
|
var a = input.Split('|');
|
||||||
|
return (a[1], a[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (input, input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -566,19 +566,12 @@ namespace mpvnet
|
|||||||
|
|
||||||
foreach (string path in App.Settings.RecentFiles)
|
foreach (string path in App.Settings.RecentFiles)
|
||||||
{
|
{
|
||||||
string file = path;
|
var file = App.GetTitleAndPath(path);
|
||||||
string title = path;
|
|
||||||
|
|
||||||
if (title.Contains("|"))
|
|
||||||
{
|
|
||||||
title = title.Substring(title.IndexOf("|") + 1);
|
|
||||||
file = file.Substring(0, file.IndexOf("|"));
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandPaletteItem item = new CommandPaletteItem()
|
CommandPaletteItem item = new CommandPaletteItem()
|
||||||
{
|
{
|
||||||
Text = title.ShortPath(60),
|
Text = file.Title.ShortPath(60),
|
||||||
Action = () => Core.LoadFiles(new[] { file }, true, Control.ModifierKeys.HasFlag(Keys.Control))
|
Action = () => Core.LoadFiles(new[] { file.Path }, true, Control.ModifierKeys.HasFlag(Keys.Control))
|
||||||
};
|
};
|
||||||
|
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
|
|||||||
@@ -322,20 +322,12 @@ namespace mpvnet
|
|||||||
|
|
||||||
foreach (string path in App.Settings.RecentFiles)
|
foreach (string path in App.Settings.RecentFiles)
|
||||||
{
|
{
|
||||||
string file = path;
|
var file = App.GetTitleAndPath(path);
|
||||||
string title = path;
|
var mi = MenuHelp.Add(recentMenuItem.Items, file.Title.ShortPath(100));
|
||||||
|
|
||||||
if (title.Contains("|"))
|
|
||||||
{
|
|
||||||
title = title.Substring(title.IndexOf("|") + 1);
|
|
||||||
file = file.Substring(0, file.IndexOf("|"));
|
|
||||||
}
|
|
||||||
|
|
||||||
var mi = MenuHelp.Add(recentMenuItem.Items, title.ShortPath(100));
|
|
||||||
|
|
||||||
if (mi != null)
|
if (mi != null)
|
||||||
mi.Click += (sender, args) =>
|
mi.Click += (sender, args) =>
|
||||||
Core.LoadFiles(new[] { file }, true, ModifierKeys.HasFlag(Keys.Control));
|
Core.LoadFiles(new[] { file.Path }, true, ModifierKeys.HasFlag(Keys.Control));
|
||||||
}
|
}
|
||||||
|
|
||||||
recentMenuItem.Items.Add(new WpfControls.Separator());
|
recentMenuItem.Items.Add(new WpfControls.Separator());
|
||||||
|
|||||||
Reference in New Issue
Block a user