From b6072f03bfabca76ad7f26bba9d9e8ff55d31969 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Sun, 7 Apr 2019 00:29:04 +0200 Subject: [PATCH] - --- README.md | 2 +- mpv.net/Properties/Resources.Designer.cs | 37 ++++++++++++------- mpv.net/Resources/input.conf.txt | 4 +- mpv.net/mp.cs | 39 ++++++++------------ mpv.net/mpv.net.csproj | 1 + mpvInputEdit/App.config | 4 +- mpvInputEdit/Properties/Settings.Designer.cs | 4 +- mpvInputEdit/Properties/Settings.settings | 4 +- mpvnet.iss | 2 +- 9 files changed, 50 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 5688ff5..f89a12b 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ https://github.com/stax76/mpv.net/wiki/Scripting-(CSharp,-Python,-JavaScript,-Lu - the startup size was reduced and a issue was fixed that when the screen property was defined for a screen that isn't connected the startup size wasn't applied - added feature to load external audio and subtitle files in the menu under: Open > Load external audio|subtitle files (default binding at: [input.conf](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt)) - previously the conf edit GUI removed settings from the conf file if the setting was set to the default, the new behavior is not to remove anything -- the autofit mpv property was partly implemented, you can use 'autofit = 50%' in mpv.conf or '--autofit=50%' on the command line, WxH isn't implemented and only percent values are accepted. There is a new wiki page explaining limitations compared to the original mpv: +- the autofit mpv property was partly implemented, you can use 'autofit = 50%' in mpv.conf or '--autofit=50%' on the command line, WxH isn't implemented and only percent values are accepted. There is a new wiki page explaining the mpv.net limitations compared to the original mpv: [Limitations](https://github.com/stax76/mpv.net/wiki/Limitations) ### 2.3 (2019-04-04) diff --git a/mpv.net/Properties/Resources.Designer.cs b/mpv.net/Properties/Resources.Designer.cs index 8550c6d..fcb89f1 100644 --- a/mpv.net/Properties/Resources.Designer.cs +++ b/mpv.net/Properties/Resources.Designer.cs @@ -61,16 +61,20 @@ namespace mpvnet.Properties { } /// - /// Looks up a localized string similar to # mpv.net key bindings, mouse bindings and context menu configuration - /// - /// o script-message mpv.net open-files #menu: O ; Open Files... - /// _ ignore #menu: _ ; - - /// Space cycle pause #menu: Space, Enter ; Play/Pause - /// Enter cycle pause - /// s stop #menu: S ; Stop - /// _ ignore #menu: _ ; - - /// f cycle fullscreen #menu: F ; Toggle Fullscreen - /// [rest of string was truncated]";. + /// Looks up a localized string similar to + /// # This file defines the input (keys and mouse) bindings of mpv and mpv.net + /// # and it also defines the context menu of mpv.net. mpv.net has an input + /// # editor and an conf editor as alternatives to editing conf text files. + /// # The input and conf editors can be found in mpv.net's context menu at: + /// + /// # Settings > Show Config Editor + /// # Settings > Show Input Editor + /// + /// # The defaults of this file can be found at: + /// + /// # https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt + /// + /// # the [rest of string was truncated]";. /// internal static string input_conf { get { @@ -79,15 +83,20 @@ namespace mpvnet.Properties { } /// - /// Looks up a localized string similar to input-ar-delay = 500 + /// Looks up a localized string similar to + ///# mpv manual: https://mpv.io/manual/master/ + /// + ///# mpv.net mpv.conf defaults: https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt + /// + ///input-ar-delay = 500 ///input-ar-rate = 20 ///volume = 50 ///hwdec = yes - ///vo = direct3d ///keep-open = yes ///keep-open-pause = no - ///osd-playing-msg = '${filename}' - ///screenshot-directory = ~~desktop/. + ///osd-playing-msg = ${filename} + ///screenshot-directory = ~~desktop/ + ///input-default-bindings = no. /// internal static string mpv_conf { get { diff --git a/mpv.net/Resources/input.conf.txt b/mpv.net/Resources/input.conf.txt index 6b060fd..4dc70b8 100644 --- a/mpv.net/Resources/input.conf.txt +++ b/mpv.net/Resources/input.conf.txt @@ -1,7 +1,7 @@ # This file defines the input (keys and mouse) bindings of mpv and mpv.net - # and it also defines the context menu of mpv.net. mpv.net has a input - # editor and a conf editor as alternatives to editing this file via texteditor. + # and it also defines the context menu of mpv.net. mpv.net has an input + # editor and an conf editor as alternatives to editing conf text files. # The input and conf editors can be found in mpv.net's context menu at: # Settings > Show Config Editor diff --git a/mpv.net/mp.cs b/mpv.net/mp.cs index 59e885d..e0331a2 100644 --- a/mpv.net/mp.cs +++ b/mpv.net/mp.cs @@ -197,36 +197,29 @@ namespace mpvnet case mpv_event_id.MPV_EVENT_CLIENT_MESSAGE: if (ClientMessage != null) { - try + var client_messageData = (mpv_event_client_message)Marshal.PtrToStructure(evt.data, typeof(mpv_event_client_message)); + string[] args = NativeUtf8StrArray2ManagedStrArray(client_messageData.args, client_messageData.num_args); + + if (args != null && args.Length > 1 && args[0] == "mpv.net") { - var client_messageData = (mpv_event_client_message)Marshal.PtrToStructure(evt.data, typeof(mpv_event_client_message)); - string[] args = NativeUtf8StrArray2ManagedStrArray(client_messageData.args, client_messageData.num_args); + bool found = false; - if (args != null && args.Length > 1 && args[0] == "mpv.net") + foreach (var i in mpvnet.Command.Commands) { - bool found = false; - - foreach (var i in mpvnet.Command.Commands) + if (args[1] == i.Name) { - if (args[1] == i.Name) - { - found = true; - i.Action.Invoke(args.Skip(2).ToArray()); - } - } - if (!found) - { - List names = mpvnet.Command.Commands.Select((item) => item.Name).ToList(); - names.Sort(); - MainForm.Instance.ShowMsgBox($"No command '{args[1]}' found. Available commands are:\n\n{string.Join("\n", names)}\n\nHow to bind these commands can be seen in the default input bindings and menu definition located at:\n\nhttps://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt", MessageBoxIcon.Error); + found = true; + i.Action.Invoke(args.Skip(2).ToArray()); } } - ClientMessage?.Invoke(args); - } - catch (Exception ex) - { - MainForm.Instance.ShowMsgBox(ex.GetType().Name + "\n\n" + ex.ToString(), MessageBoxIcon.Error); + if (!found) + { + List names = mpvnet.Command.Commands.Select((item) => item.Name).ToList(); + names.Sort(); + MainForm.Instance.ShowMsgBox($"No command '{args[1]}' found. Available commands are:\n\n{string.Join("\n", names)}\n\nHow to bind these commands can be seen in the default input bindings and menu definition located at:\n\nhttps://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt", MessageBoxIcon.Error); + } } + ClientMessage?.Invoke(args); } break; case mpv_event_id.MPV_EVENT_VIDEO_RECONFIG: diff --git a/mpv.net/mpv.net.csproj b/mpv.net/mpv.net.csproj index a533d4d..2ec58f4 100644 --- a/mpv.net/mpv.net.csproj +++ b/mpv.net/mpv.net.csproj @@ -25,6 +25,7 @@ 4 false On + 7.3 AnyCPU diff --git a/mpvInputEdit/App.config b/mpvInputEdit/App.config index 54f3e91..651b379 100644 --- a/mpvInputEdit/App.config +++ b/mpvInputEdit/App.config @@ -12,8 +12,8 @@ # This file defines the input (keys and mouse) bindings of mpv and mpv.net - # and it also defines the context menu of mpv.net. mpv.net has a input - # editor and a conf editor as alternatives to editing this file via texteditor. + # and it also defines the context menu of mpv.net. mpv.net has an input + # editor and an conf editor as alternatives to editing conf text files. # The input and conf editors can be found in mpv.net's context menu at: # Settings > Show Config Editor diff --git a/mpvInputEdit/Properties/Settings.Designer.cs b/mpvInputEdit/Properties/Settings.Designer.cs index 3ae44e1..08ee49a 100644 --- a/mpvInputEdit/Properties/Settings.Designer.cs +++ b/mpvInputEdit/Properties/Settings.Designer.cs @@ -26,8 +26,8 @@ namespace mpvInputEdit.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute(@" # This file defines the input (keys and mouse) bindings of mpv and mpv.net - # and it also defines the context menu of mpv.net. mpv.net has a input - # editor and a conf editor as alternatives to editing this file via texteditor. + # and it also defines the context menu of mpv.net. mpv.net has an input + # editor and an conf editor as alternatives to editing conf text files. # The input and conf editors can be found in mpv.net's context menu at: # Settings > Show Config Editor diff --git a/mpvInputEdit/Properties/Settings.settings b/mpvInputEdit/Properties/Settings.settings index ce932c6..6b8530c 100644 --- a/mpvInputEdit/Properties/Settings.settings +++ b/mpvInputEdit/Properties/Settings.settings @@ -4,8 +4,8 @@ # This file defines the input (keys and mouse) bindings of mpv and mpv.net - # and it also defines the context menu of mpv.net. mpv.net has a input - # editor and a conf editor as alternatives to editing this file via texteditor. + # and it also defines the context menu of mpv.net. mpv.net has an input + # editor and an conf editor as alternatives to editing conf text files. # The input and conf editors can be found in mpv.net's context menu at: # Settings > Show Config Editor diff --git a/mpvnet.iss b/mpvnet.iss index 7e42204..ef47748 100644 --- a/mpvnet.iss +++ b/mpvnet.iss @@ -10,7 +10,7 @@ AppVersion={#MyAppVersion} AppPublisher=stax76 ArchitecturesInstallIn64BitMode=x64 Compression=lzma2 -DefaultDirName={commonpf}\{#MyAppName} +DefaultDirName={pf}\{#MyAppName} OutputBaseFilename=mpvnet-{#MyAppVersion} OutputDir=C:\Users\frank\Desktop DefaultGroupName={#MyAppName}