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

View File

@@ -23,7 +23,6 @@ namespace mpvnet
public Size WindowSize;
public string ConfigEditorSearch = "Video:";
public string Mute = "no";
public string UpdateCheckVersion = "";
}
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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.2.0")]
[assembly: AssemblyFileVersion("6.0.2.0")]
[assembly: AssemblyVersion("6.0.3.0")]
[assembly: AssemblyFileVersion("6.0.3.0")]