Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5c9df31e4 | ||
|
|
c0a8e895f7 | ||
|
|
064ae44ecf | ||
|
|
005ba6e5ea | ||
|
|
9f6aba6cbd |
@@ -1,3 +1,7 @@
|
||||
### 4.3.1
|
||||
|
||||
- there was a old bug setting the screen property
|
||||
|
||||
### 4.3
|
||||
|
||||
- there was new bug in file association feature
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -12,6 +13,7 @@ using System.Runtime.Serialization;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Microsoft.Win32;
|
||||
using VB = Microsoft.VisualBasic;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
@@ -28,6 +30,8 @@ namespace mpvnet
|
||||
public static string DarkMode { get; set; } = "always";
|
||||
public static string ProcessInstance { get; set; } = "single";
|
||||
|
||||
public static bool DebugMode { get; set; } = false;
|
||||
|
||||
public static bool IsDarkMode {
|
||||
get => (DarkMode == "system" && Sys.IsDarkTheme) || DarkMode == "always";
|
||||
}
|
||||
@@ -36,6 +40,28 @@ namespace mpvnet
|
||||
{
|
||||
foreach (var i in Conf)
|
||||
ProcessProperty(i.Key, i.Value);
|
||||
|
||||
if (App.DebugMode)
|
||||
{
|
||||
try
|
||||
{
|
||||
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\mpvnet-debug.log";
|
||||
if (File.Exists(filePath)) File.Delete(filePath);
|
||||
Trace.Listeners.Clear();
|
||||
Trace.Listeners.Add(new TextWriterTraceListener(filePath));
|
||||
foreach (Screen screen in Screen.AllScreens)
|
||||
Trace.WriteLine(screen);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Msg.ShowException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Exit()
|
||||
{
|
||||
if (Trace.Listeners.Count > 0) Trace.Listeners[0].Close();
|
||||
}
|
||||
|
||||
static Dictionary<string, string> _Conf;
|
||||
@@ -62,6 +88,7 @@ namespace mpvnet
|
||||
case "clipboard-monitoring": ClipboardMonitoring = value; break;
|
||||
case "process-instance": ProcessInstance = value; break;
|
||||
case "dark-mode": DarkMode = value; break;
|
||||
case "debug-mode": DebugMode = value == "yes"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace mpvnet
|
||||
return;
|
||||
}
|
||||
|
||||
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
|
||||
App.Init();
|
||||
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
|
||||
|
||||
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
|
||||
{
|
||||
@@ -49,6 +49,7 @@ namespace mpvnet
|
||||
} catch {}
|
||||
}
|
||||
|
||||
mutex.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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("4.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.3.0.0")]
|
||||
[assembly: AssemblyVersion("4.3.1.0")]
|
||||
[assembly: AssemblyFileVersion("4.3.1.0")]
|
||||
|
||||
@@ -214,7 +214,7 @@ help = "See sub-color. Color used for sub text background. You can use sub-shado
|
||||
name = "screen"
|
||||
default = ""
|
||||
filter = "Screen"
|
||||
help = "In multi-monitor configurations (i.e. a single desktop that spans across multiple displays), this option tells mpv which screen to display the video on."
|
||||
help = "<0-32> In multi-monitor configurations (i.e. a single desktop that spans across multiple displays), this option tells mpv which screen to display the video on."
|
||||
|
||||
[[settings]]
|
||||
name = "osd-playing-msg"
|
||||
|
||||
@@ -23,3 +23,11 @@ help = "Defines if more then one mpv.net process is allowed."
|
||||
options = [{ name = "multi", help = "Create a new process everytime the shell starts mpv.net" },
|
||||
{ name = "single", help = "Force a single process everytime the shell starts mpv.net" },
|
||||
{ name = "queue", help = "Force a single process and add files to playlist" }]
|
||||
|
||||
[[settings]]
|
||||
name = "debug-mode"
|
||||
default = "no"
|
||||
filter = "mpv.net"
|
||||
help = "Writes debug info to a file located on the desktop."
|
||||
options = [{ name = "yes" },
|
||||
{ name = "no" }]
|
||||
@@ -49,10 +49,8 @@ namespace mpvnet
|
||||
|
||||
var dummy = mp.Conf;
|
||||
App.ProcessCommandLineEarly();
|
||||
|
||||
if (mp.Screen == -1) mp.Screen = Array.IndexOf(Screen.AllScreens, Screen.PrimaryScreen);
|
||||
SetScreen(mp.Screen);
|
||||
|
||||
ChangeFullscreen(mp.Fullscreen);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -224,9 +222,6 @@ namespace mpvnet
|
||||
int left = middlePos.X - rect.Width / 2;
|
||||
int top = middlePos.Y - rect.Height / 2;
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
if (left < screens[0].Bounds.Left) left = screens[0].Bounds.Left;
|
||||
int maxLeft = screens[0].Bounds.Left + screens.Select((sc) => sc.Bounds.Width).Sum() - rect.Width - SystemInformation.CaptionHeight;
|
||||
if (left > maxLeft) left = maxLeft;
|
||||
Native.SetWindowPos(Handle, IntPtr.Zero /* HWND_TOP */, left, top, rect.Width, rect.Height, 4 /* SWP_NOZORDER */);
|
||||
}
|
||||
|
||||
@@ -353,8 +348,7 @@ namespace mpvnet
|
||||
Native.PostMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam);
|
||||
break;
|
||||
case 0x203: // Native.WM.LBUTTONDBLCLK
|
||||
if (!IsMouseInOSC())
|
||||
mp.command_string("cycle fullscreen");
|
||||
if (!IsMouseInOSC()) mp.command_string("cycle fullscreen");
|
||||
break;
|
||||
case 0x02E0: // WM_DPICHANGED
|
||||
if (IgnoreDpiChanged) break;
|
||||
@@ -506,6 +500,7 @@ namespace mpvnet
|
||||
{
|
||||
base.OnFormClosed(e);
|
||||
RegistryHelp.SetObject(App.RegPath, "Recent", RecentFiles.ToArray());
|
||||
App.Exit();
|
||||
mp.commandv("quit");
|
||||
mp.AutoResetEvent.WaitOne(3000);
|
||||
}
|
||||
|
||||
@@ -564,51 +564,34 @@ namespace mpvnet
|
||||
{
|
||||
if (files is null || files.Length == 0) return;
|
||||
HideLogo();
|
||||
List<string> fileList = files.ToList();
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
string ext = Path.GetExtension(file).TrimStart('.').ToLower();
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
if (App.SubtitleTypes.Contains(Path.GetExtension(files[i]).TrimStart('.').ToLower()))
|
||||
mp.commandv("sub-add", files[i]);
|
||||
else
|
||||
if (i == 0)
|
||||
mp.commandv("loadfile", files[i]);
|
||||
else
|
||||
mp.commandv("loadfile", files[i], "append");
|
||||
|
||||
if (App.SubtitleTypes.Contains(ext))
|
||||
{
|
||||
mp.commandv("sub-add", file);
|
||||
fileList.Remove(file);
|
||||
}
|
||||
Task.Run(() => LoadFolder()); // user reported race condition
|
||||
}
|
||||
|
||||
if (fileList.Count == 0) return;
|
||||
files = fileList.ToArray();
|
||||
|
||||
int count = mp.get_property_int("playlist-count");
|
||||
|
||||
foreach (string file in files)
|
||||
mp.commandv("loadfile", file, "append");
|
||||
|
||||
mp.set_property_int("playlist-pos", count);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
mp.commandv("playlist-remove", "0");
|
||||
|
||||
mp.LoadFolder(files[0]);
|
||||
}
|
||||
|
||||
static void LoadFolder(string path)
|
||||
static void LoadFolder()
|
||||
{
|
||||
if (get_property_int("playlist-count") == 1)
|
||||
{
|
||||
if (!File.Exists(path)) return;
|
||||
Thread.Sleep(50); // user reported race condition
|
||||
string path = mp.get_property_string("path");
|
||||
if (!File.Exists(path) || get_property_int("playlist-count") != 1) return;
|
||||
List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
||||
files = files.Where((file) => App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) ||
|
||||
files = files.Where((file) =>
|
||||
App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) ||
|
||||
App.AudioTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower())).ToList();
|
||||
files.Sort(new StringLogicalComparer());
|
||||
int index = files.IndexOf(path);
|
||||
files.Remove(path);
|
||||
foreach (string i in files)
|
||||
commandv("loadfile", i, "append");
|
||||
if (index > 0)
|
||||
commandv("playlist-move", "0", (index + 1).ToString());
|
||||
}
|
||||
if (index > 0) commandv("playlist-move", "0", (index + 1).ToString());
|
||||
}
|
||||
|
||||
static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
|
||||
|
||||
Reference in New Issue
Block a user