-
This commit is contained in:
@@ -212,14 +212,18 @@ namespace mpvnet
|
||||
|
||||
public static void RemoveKey(string path)
|
||||
{
|
||||
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
|
||||
try {
|
||||
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public static void RemoveValue(string path, string name)
|
||||
{
|
||||
using (RegistryKey rk = GetRootKey(path).OpenSubKey(path.Substring(5), true))
|
||||
if (!(rk is null))
|
||||
rk.DeleteValue(name, false);
|
||||
try {
|
||||
using (RegistryKey rk = GetRootKey(path).OpenSubKey(path.Substring(5), true))
|
||||
if (!(rk is null))
|
||||
rk.DeleteValue(name, false);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
static RegistryKey GetRootKey(string path)
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace mpvnet
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
|
||||
|
||||
try
|
||||
{
|
||||
string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray();
|
||||
@@ -27,6 +25,7 @@ namespace mpvnet
|
||||
return;
|
||||
}
|
||||
|
||||
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
|
||||
App.Init();
|
||||
|
||||
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
|
||||
@@ -56,15 +55,12 @@ namespace mpvnet
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm());
|
||||
mutex.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Msg.ShowException(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
mutex.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,9 @@ namespace mpvnet
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool EnableWindow(IntPtr hWnd, bool bEnable);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
|
||||
private static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex);
|
||||
|
||||
|
||||
@@ -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.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.2.0.0")]
|
||||
[assembly: AssemblyVersion("4.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.3.0.0")]
|
||||
|
||||
@@ -343,6 +343,11 @@ namespace mpvnet
|
||||
if (mp.WindowHandle != IntPtr.Zero)
|
||||
Native.SendMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam);
|
||||
break;
|
||||
case 0x0200: // WM_MOUSEMOVE
|
||||
Point pos = PointToClient(Cursor.Position);
|
||||
mp.command_string($"mouse {pos.X} {pos.Y}");
|
||||
if (CursorHelp.IsPosDifferent(LastCursorPosChanged)) CursorHelp.Show();
|
||||
break;
|
||||
case 0x319: // WM_APPCOMMAND
|
||||
if (mp.WindowHandle != IntPtr.Zero)
|
||||
Native.PostMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam);
|
||||
@@ -389,8 +394,7 @@ namespace mpvnet
|
||||
break;
|
||||
case "queue":
|
||||
foreach (string file in files)
|
||||
if (File.Exists(file))
|
||||
mp.commandv("loadfile", file, "append");
|
||||
mp.commandv("loadfile", file, "append");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -436,15 +440,6 @@ namespace mpvnet
|
||||
mp.commandv("quit");
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
mp.command_string($"mouse {e.X} {e.Y}");
|
||||
|
||||
if (CursorHelp.IsPosDifferent(LastCursorPosChanged))
|
||||
CursorHelp.Show();
|
||||
}
|
||||
|
||||
bool IsMouseInOSC() => PointToClient(Control.MousePosition).Y > ClientSize.Height * 0.9;
|
||||
|
||||
void Timer_Tick(object sender, EventArgs e)
|
||||
|
||||
@@ -193,7 +193,10 @@ namespace mpvnet
|
||||
mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event));
|
||||
|
||||
if (WindowHandle == IntPtr.Zero)
|
||||
{
|
||||
WindowHandle = FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
|
||||
//Native.EnableWindow(WindowHandle, true);
|
||||
}
|
||||
|
||||
//Debug.WriteLine(evt.event_id.ToString());
|
||||
|
||||
@@ -563,9 +566,12 @@ namespace mpvnet
|
||||
HideLogo();
|
||||
List<string> fileList = files.ToList();
|
||||
|
||||
foreach (string file in files) {
|
||||
foreach (string file in files)
|
||||
{
|
||||
string ext = Path.GetExtension(file).TrimStart('.').ToLower();
|
||||
if (App.SubtitleTypes.Contains(ext)) {
|
||||
|
||||
if (App.SubtitleTypes.Contains(ext))
|
||||
{
|
||||
mp.commandv("sub-add", file);
|
||||
fileList.Remove(file);
|
||||
}
|
||||
@@ -573,6 +579,7 @@ namespace mpvnet
|
||||
|
||||
if (fileList.Count == 0) return;
|
||||
files = fileList.ToArray();
|
||||
|
||||
int count = mp.get_property_int("playlist-count");
|
||||
|
||||
foreach (string file in files)
|
||||
|
||||
Reference in New Issue
Block a user