Fix auto-load-folder not working with user scripts
This commit is contained in:
@@ -259,15 +259,19 @@ namespace mpvnet
|
||||
else
|
||||
{
|
||||
string clipboard = WinForms.Clipboard.GetText();
|
||||
List<string> files = new List<string>();
|
||||
|
||||
if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) ||
|
||||
clipboard.Contains("\n"))
|
||||
foreach (string i in clipboard.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
|
||||
if (i.Contains("://") || File.Exists(i))
|
||||
files.Add(i);
|
||||
|
||||
if (files.Count == 0)
|
||||
{
|
||||
App.ShowError("The clipboard does not contain a valid URL or file.");
|
||||
return;
|
||||
}
|
||||
|
||||
Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
Core.LoadFiles(files.ToArray(), false, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -583,6 +583,7 @@ namespace mpvnet
|
||||
break;
|
||||
case mpv_event_id.MPV_EVENT_START_FILE:
|
||||
InvokeEvent(StartFile, StartFileAsync);
|
||||
App.RunTask(() => LoadFolder());
|
||||
break;
|
||||
case mpv_event_id.MPV_EVENT_AUDIO_RECONFIG:
|
||||
InvokeEvent(AudioReconfig, AudioReconfigAsync);
|
||||
@@ -1225,7 +1226,10 @@ namespace mpvnet
|
||||
|
||||
string dir = Environment.CurrentDirectory;
|
||||
|
||||
if (path.Contains(Path.DirectorySeparatorChar))
|
||||
if (path.Contains(":/") && !path.Contains("://"))
|
||||
path = path.Replace("/", "\\");
|
||||
|
||||
if (path.Contains("\\"))
|
||||
dir = Path.GetDirectoryName(path);
|
||||
|
||||
List<string> files = Directory.GetFiles(dir).ToList();
|
||||
|
||||
Reference in New Issue
Block a user