Compare commits

...

2 Commits

Author SHA1 Message Date
stax76
9a6bf5a481 v6.0.3.0 update changelog 2022-07-03 10:35:39 +02:00
stax76
40565e8b3d fix possible race condition 2022-07-02 15:10:22 +02:00
4 changed files with 33 additions and 23 deletions

View File

@@ -1,4 +1,9 @@
# 6.0.3.0 (2022-07-03)
- Fix the rare occasion of duplicated playlist entries produced by the auto-load-folder feature.
# 6.0.2.0 (2022-07-02) # 6.0.2.0 (2022-07-02)
- Fix main window shown collapsed when the player was started with full screen. - Fix main window shown collapsed when the player was started with full screen.

View File

@@ -1276,41 +1276,47 @@ namespace mpvnet
} }
} }
static object LoadFolderLockObject = new object();
public void LoadFolder() public void LoadFolder()
{ {
if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift)) if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift))
return; return;
Thread.Sleep(1000); Thread.Sleep(1000);
string path = GetPropertyString("path");
if (!File.Exists(path) || GetPropertyInt("playlist-count") != 1) lock (LoadFolderLockObject)
return; {
string path = GetPropertyString("path");
string dir = Environment.CurrentDirectory; if (!File.Exists(path) || GetPropertyInt("playlist-count") != 1)
return;
if (path.Contains(":/") && !path.Contains("://")) string dir = Environment.CurrentDirectory;
path = path.Replace("/", "\\");
if (path.Contains("\\")) if (path.Contains(":/") && !path.Contains("://"))
dir = System.IO.Path.GetDirectoryName(path); path = path.Replace("/", "\\");
List<string> files = Directory.GetFiles(dir).ToList(); if (path.Contains("\\"))
dir = System.IO.Path.GetDirectoryName(path);
files = files.Where(file => List<string> files = Directory.GetFiles(dir).ToList();
VideoTypes.Contains(file.Ext()) ||
AudioTypes.Contains(file.Ext()) ||
ImageTypes.Contains(file.Ext())).ToList();
files.Sort(new StringLogicalComparer()); files = files.Where(file =>
int index = files.IndexOf(path); VideoTypes.Contains(file.Ext()) ||
files.Remove(path); AudioTypes.Contains(file.Ext()) ||
ImageTypes.Contains(file.Ext())).ToList();
foreach (string i in files) files.Sort(new StringLogicalComparer());
CommandV("loadfile", i, "append"); int index = files.IndexOf(path);
files.Remove(path);
if (index > 0) foreach (string i in files)
CommandV("playlist-move", "0", (index + 1).ToString()); CommandV("loadfile", i, "append");
if (index > 0)
CommandV("playlist-move", "0", (index + 1).ToString());
}
} }
bool WasAviSynthLoaded; bool WasAviSynthLoaded;

View File

@@ -23,7 +23,6 @@ namespace mpvnet
public Size WindowSize; public Size WindowSize;
public string ConfigEditorSearch = "Video:"; public string ConfigEditorSearch = "Video:";
public string Mute = "no"; public string Mute = "no";
public string UpdateCheckVersion = "";
} }
class SettingsManager class SettingsManager

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.2.0")] [assembly: AssemblyVersion("6.0.3.0")]
[assembly: AssemblyFileVersion("6.0.2.0")] [assembly: AssemblyFileVersion("6.0.3.0")]