diff --git a/Changelog.md b/Changelog.md index 644ccae..c59f795 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,30 +2,33 @@ ### 5.4.4.2 - new: flag cli switches support now `--no-flag` in addition to `--flag=no` + https://mpv.io/manual/master/#usage - new: cli switches can also start with single `-` instead of double `--` -- new: the PowerShell script host was completely rewritten, events can - can be assigned to using `Register-ObjectEvent`, the scripting - wiki page was updated + https://mpv.io/manual/master/#legacy-option-syntax +- new: the PowerShell script host was completely rewritten, events can be assigned + to using `Register-ObjectEvent`, the scripting wiki page was updated + https://github.com/stax76/mpv.net/wiki/Scripting#powershell - new: Context Menu > View > Show Profiles -- new: default mpv.conf is now generated with `osd-duration=2000` and - `script-opts=...,console-scale=` to - workaround mpv using broken High DPI defaults + https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L147 +- new: various default were improved + https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt ### 5.4.4.1 -- new: external console replaced with internal console +- new: external OSD console replaced with internal OSD console + https://mpv.io/manual/master/#console - new: blue color in dark theme is now less intense + https://github.com/stax76/mpv.net/blob/master/Manual.md#color-theme - new: menu item 'View > Show Progress' (p key) to show progress bar + https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L146 - new: `script-message mpv.net playlist-first`, unlike mpv does not restart if the first file is already active -- new: if mpv.net is started from the terminal and an error happens - then the error is printed to the terminal instead of shown - with a message box + https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L44 +- new: if mpv.net is started from the terminal and an error happens then the error + is printed to the terminal instead of shown with a message box - fix: update routine did only work when mpv.net was located in 'Program Files' -- fix: errors were ignored and only seen in the terminal, - now a message box is shown -- fix: when start-size=video was used then enlarging or shrinking the window - size was broken +- fix: fatal errors were ignored and only seen in the terminal, now a message box is shown +- fix: when start-size=video was used then enlarging or shrinking the window size was broken ### 5.4.4.0 @@ -37,7 +40,7 @@ - new: update check, it must be enabled first in the conf editor under General - new: update feature, requires PowerShell 5 and curl, an up to date Windows 10 system has both included. - Main menu (input.conf) must be reset or updated manually ([defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt)) + Main menu (input.conf) must be reset or updated manually ([defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt)) - update: libmpv shinchiro 2019-11-10 @@ -76,7 +79,7 @@ context menu item in explorer with multi selection support use my [Open with++](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist) shell extension, as far as I know multi selection can not be done using the Registry but only via shell extension -- window-size mpv property support added ([default bindings](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt#L137)) +- window-size mpv property support added ([default bindings](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L137)) - the config editor keeps profiles and comments in mpv.conf intact! - the options in the config editor are better organized @@ -273,7 +276,7 @@ pressed, the files are opened as selected, the order is random though because Explorer starts multiple mpv.net processes concurrently - libmpv was updated to shinchiro 2019-06-30 -- the [mpv.conf defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt) were changed to show a larger OSC +- the [mpv.conf defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt) were changed to show a larger OSC - in case a file is opened that has a aspect ratio smaller then 1.2 then the window size will use a aspect ratio of 1.8 - new JavaScript script osc-visibility.js included in the distribution @@ -312,7 +315,7 @@ - the default key binding of the Everything media search was changed to F3 - support for the mpv property 'border' was added to the config editor to show/hide the window decoration (titlebar, border). A toggle menu item and - key binding (b) was added as well ([Default Binding](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt#L135)) + key binding (b) was added as well ([Default Binding](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L135)) ### 4.3.1 @@ -327,7 +330,7 @@ - the help and layout in the config editor was improved - clipboard monitoring for URLs can be disabled in the settings - the context menu has a new feature: Open > Add files to playlist, - it appends files to the playlist [(Default binding)](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt#L33) + it appends files to the playlist [(Default binding)](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L33) - a setting was added to force using a single mpv.net process instance ### 4.1 @@ -369,7 +372,7 @@ - there was a bug that caused underscores beeing removed from input like MBTN_LEFT_DBL - the search clear button in the input editor had a render issue in dark mode - new search feature added to search and play media files, requires - [Everything](https://www.voidtools.com) to be installed. [Default Binding](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt#L29) + [Everything](https://www.voidtools.com) to be installed. [Default Binding](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L29) ### 3.5 @@ -382,6 +385,6 @@ ### 3.4 -- new feature added to manage file associations from within the app. It can be found in the menu at: Tools > Manage... [Default Binding](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt#L149) +- new feature added to manage file associations from within the app. It can be found in the menu at: Tools > Manage... [Default Binding](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L149) - new zip download option added - new x86 download option added \ No newline at end of file diff --git a/README.md b/README.md index 5bea5ba..e2c2e5a 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,9 @@ Table of contents - Very high degree of mpv compatibility, almost all mpv features are available - Great usability due to everything in the application being searchable - Open source built with modern tools -- Customizable context menu defined in the same file as the key bindings ([Screenshot](#context-menu-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt)) -- Searchable config dialog ([Screenshot](#config-editor-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt)) -- Searchable input (key/mouse) binding editor ([Screenshot](#input-editor-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt)) +- Customizable context menu defined in the same file as the key bindings ([Screenshot](#context-menu-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt)) +- Searchable config dialog ([Screenshot](#config-editor-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt)) +- Searchable input (key/mouse) binding editor ([Screenshot](#input-editor-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt)) - Configuration files that are easy to read and edit ([Manual](https://mpv.io/manual/master/#configuration-files)) - Searchable command palette to quickly find commands and keys ([Screenshot](#command-palette-screenshot)) - Modern graphical user interface with customizable color themes ([Screenshot](#config-editor-screenshot)) @@ -173,7 +173,7 @@ C:\Users\%username%\AppData\Roaming\mpv\input.conf if it's missing mpv.net generates it with the following defaults: - + input.conf defines mpv's key and mouse bindings and mpv.net uses comments to define the context menu. @@ -191,14 +191,14 @@ all config will be loaded from this folder only. mpv specific settings are stored in the file mpv.conf, if no mpv.conf file exists mpv.net generates it with the following defaults: - + mpv.net specific settings are stored in the file mpvnet.conf The input (key/mouse) bindings and the context menu definitions are stored in the input.conf file, if it's missing mpv.net generates it with the following defaults: - + mpv.net supports almost all mpv settings and features, [limitations are listed in the wiki](https://github.com/stax76/mpv.net/wiki/Limitations). @@ -254,7 +254,7 @@ You can support the development of mpv.net with a PayPal donation: #### mpv.net - wiki: -- default key bindings: +- default key bindings: - download: - bugs and requests: diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index deafe61..af9ae53 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -8,7 +8,7 @@ using System.Windows.Forms; using UI; using static libmpv; -using static Common; +using static NewLine; using System.Threading.Tasks; diff --git a/mpv.net/Misc/Command.cs b/mpv.net/Misc/Command.cs index 5b6ea4f..1a38aa1 100644 --- a/mpv.net/Misc/Command.cs +++ b/mpv.net/Misc/Command.cs @@ -10,8 +10,7 @@ using System.Windows.Interop; using VB = Microsoft.VisualBasic; using ScriptHost; -using static Common; -using System.Collections.Generic; +using static NewLine; namespace mpvnet { @@ -43,6 +42,8 @@ namespace mpvnet case "playlist-first": PlaylistFirst(); break; case "playlist-last": PlaylistLast(); break; case "show-profiles": ShowProfiles(); break; + case "show-properties": ShowProperties(); break; + case "show-commands": ShowCommands(); break; case "add-files-to-playlist": OpenFiles("append"); break; // deprecated 2019 default: Msg.ShowError($"No command '{id}' found."); break; } @@ -299,10 +300,10 @@ namespace mpvnet } } - private static void ShowProfiles() + static void ShowProfiles() { - string psCode = @" - foreach ($item in ($mpvjson | ConvertFrom-Json)) + string code = @" + foreach ($item in ($json | ConvertFrom-Json | foreach { $_ } | sort name)) { $item.name '' @@ -316,14 +317,44 @@ namespace mpvnet }"; string json = mp.get_property_string("profile-list"); - PowerShell ps = new PowerShell(); - ps.Print = false; - ps.Scripts.Add(psCode); - string file = Path.GetTempPath() + @"\mpv profiles.txt"; - File.WriteAllText(file, BR + string.Join("\r\n", (ps.Invoke("mpvjson", json) - as IEnumerable).Select(x => x.ToString())).ToString()); + string file = Path.GetTempPath() + @"\mpv profile-list.txt"; + File.WriteAllText(file, BR + PowerShell.InvokeAndReturnString(code, "json", json)); + Process.Start(file); + } + + static void ShowCommands() + { + string code = @" + foreach ($item in ($json | ConvertFrom-Json | foreach { $_ } | sort name)) + { + '' + $item.name + + foreach ($arg in $item.args) + { + $value = $arg.name + ' <' + $arg.type.ToLower() + '>' + + if ($arg.optional -eq $true) + { + $value = '[' + $value + ']' + } + + ' ' + $value + } + }"; + + string json = mp.get_property_string("command-list"); + string file = Path.GetTempPath() + @"\mpv command-list.txt"; + File.WriteAllText(file, PowerShell.InvokeAndReturnString(code, "json", json) + BR); + Process.Start(file); + } + + static void ShowProperties() + { + string file = Path.GetTempPath() + @"\mpv property-list.txt"; + var props = mp.get_property_string("property-list").Split(',').OrderBy(prop => prop); + File.WriteAllText(file, BR + string.Join(BR, props) + BR); Process.Start(file); - ps.Runspace.Dispose(); } } } diff --git a/mpv.net/Misc/Common.cs b/mpv.net/Misc/NewLine.cs similarity index 84% rename from mpv.net/Misc/Common.cs rename to mpv.net/Misc/NewLine.cs index dfc0c80..3d56f17 100644 --- a/mpv.net/Misc/Common.cs +++ b/mpv.net/Misc/NewLine.cs @@ -1,7 +1,7 @@  using System; -public static class Common +public static class NewLine { public static string BR = Environment.NewLine; public static string BR2 = Environment.NewLine + Environment.NewLine; diff --git a/mpv.net/Properties/Resources.Designer.cs b/mpv.net/Properties/Resources.Designer.cs index 8cf664f..ef1b679 100644 --- a/mpv.net/Properties/Resources.Designer.cs +++ b/mpv.net/Properties/Resources.Designer.cs @@ -61,7 +61,8 @@ namespace mpvnet.Properties { } /// - /// Looks up a localized string similar to [[settings]] + /// Looks up a localized string similar to + ///[[settings]] ///name = "hwdec" ///file = "mpv" ///default = "no" @@ -69,18 +70,18 @@ namespace mpvnet.Properties { ///url = "https://mpv.io/manual/master/#options-hwdec" ///help = "Specify the hardware video decoding API that should be used if possible. Whether hardware decoding is actually done depends on the video codec. If hardware decoding is not possible, mpv will fall back on software decoding.\n\nFor more information visit:" ///options = [{ name = "no", help = "always use software decoding" }, - /// { name = "auto", hel [rest of string was truncated]";. + /// { name = "auto", h [rest of string was truncated]";. /// - internal static string confToml { + internal static string editor_toml { get { - return ResourceManager.GetString("confToml", resourceCulture); + return ResourceManager.GetString("editor_toml", resourceCulture); } } /// /// Looks up a localized string similar to /// # This file defines the key and mouse bindings and the context menu - /// # of mpv.net. A input and config editor can be found in mpv.net's + /// # of mpv.net. A input and config editor can be found in mpv.nets /// # context menu under 'Settings'. The defaults of this file can be found at: /// /// # https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt @@ -90,34 +91,34 @@ namespace mpvnet.Properties { /// # https://github.com/mpv-player/mpv/blob/master/etc/input.conf /// /// # mpv.net's defaults of mpv.conf contain: 'input-default-bindings = no' - /// # which disables mpv's [rest of string was truncated]";. + /// # which disables mpv's i [rest of string was truncated]";. /// - internal static string inputConf { + internal static string input_conf { get { - return ResourceManager.GetString("inputConf", resourceCulture); + return ResourceManager.GetString("input_conf", resourceCulture); } } /// - /// Looks up a localized string similar to input-default-bindings = no + /// Looks up a localized string similar to + ///input-default-bindings = no ///input-ar-delay = 500 ///input-ar-rate = 20 ///keep-open = yes ///keep-open-pause = no + ///osd-duration = 2000 ///osd-playing-msg = '${filename}' - ///script-opts = osc-scalewindowed=1.5 + ///script-opts = osc-scalewindowed=1.5,osc-hidetimeout=2000,console-scale=1 ///screenshot-directory = '~~desktop/' - ///cscale = spline36 - ///dscale = spline36 - ///scale = spline36 ///hwdec = yes /// ///[protocol.https] - ///osd-playing-msg = '${media-title}'. + ///osd-playing-msg = '${media-title}' + ///. /// - internal static string mpvConf { + internal static string mpv_conf { get { - return ResourceManager.GetString("mpvConf", resourceCulture); + return ResourceManager.GetString("mpv_conf", resourceCulture); } } @@ -135,23 +136,24 @@ namespace mpvnet.Properties { /// Looks up a localized string similar to ///[dark] /// - ///heading = #1E90FF - ///foreground = #FFFFFF - ///foreground2 = #C0C0C0 - ///background = #323232 + ///heading = #3C8CC8 + ///foreground = #DDDDDD + ///foreground2 = #AAAAAA + ///background = #323232 /// - ///menu-foreground = #FFFFFF + ///menu-foreground = #DDDDDD ///menu-background = #323232 ///menu-highlight = #505050 ///menu-border = #FFFFFF ///menu-checked = #5A5A5A /// + /// ///[light] /// - ///heading = #0068B2 - ///foreground = #000000 + ///heading = #0068B2 + ///foreground = #000000 ///foreground2 = #4C4C4C - ///background = #F7F7F7 + ///background = #F7F7F7 /// ///menu-foreground = #000000 ///menu-background = #DFDFDF diff --git a/mpv.net/Properties/Resources.resx b/mpv.net/Properties/Resources.resx index 6bfa498..6c7effc 100644 --- a/mpv.net/Properties/Resources.resx +++ b/mpv.net/Properties/Resources.resx @@ -118,18 +118,18 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\ConfToml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + ..\Resources\editor.toml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - ..\Resources\inputConf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\mpvConf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + ..\Resources\input.conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 ..\Resources\mpvnet.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\mpv.conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + ..\Resources\theme.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 diff --git a/mpv.net/Resources/ConfToml.txt b/mpv.net/Resources/editor.toml.txt similarity index 100% rename from mpv.net/Resources/ConfToml.txt rename to mpv.net/Resources/editor.toml.txt diff --git a/mpv.net/Resources/inputConf.txt b/mpv.net/Resources/input.conf.txt similarity index 80% rename from mpv.net/Resources/inputConf.txt rename to mpv.net/Resources/input.conf.txt index 730ce60..45f5ba3 100644 --- a/mpv.net/Resources/inputConf.txt +++ b/mpv.net/Resources/input.conf.txt @@ -3,7 +3,7 @@ # of mpv.net. A input and config editor can be found in mpv.nets # context menu under 'Settings'. The defaults of this file can be found at: - # https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt + # https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt # The defaults of mpv can be found at: @@ -132,32 +132,34 @@ _ ignore #menu: Extensions > Rating > - _ script-message rate-file about #menu: Extensions > Rating > About - Ctrl+t set ontop yes #menu: View > On Top > Enable - Ctrl+T set ontop no #menu: View > On Top > Disable - Alt++ no-osd set window-scale 1.2 #menu: View > Window Size > Enlarge - Alt+- no-osd set window-scale 0.8 #menu: View > Window Size > Shrink - b cycle border #menu: View > Toggle Border - i script-message mpv.net show-info #menu: View > File/Stream Info - t script-binding stats/display-stats #menu: View > Show Statistics - T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics - Del script-binding osc/visibility #menu: View > Toggle OSC Visibility - F8 script-binding show-playlist #menu: View > Show Playlist - F9 show-text ${track-list} 5000 #menu: View > Show Audio/Video/Subtitle List - p show-progress #menu: View > Show Progress - Ctrl+p script-message mpv.net show-profiles #menu: View > Show Profiles - ` script-binding console/enable #menu: View > Show REPL + Ctrl+t set ontop yes #menu: View > On Top > Enable + Ctrl+T set ontop no #menu: View > On Top > Disable + Alt++ no-osd set window-scale 1.2 #menu: View > Window Size > Enlarge + Alt+- no-osd set window-scale 0.8 #menu: View > Window Size > Shrink + b cycle border #menu: View > Toggle Border + i script-message mpv.net show-info #menu: View > File/Stream Info + t script-binding stats/display-stats #menu: View > Show Statistics + T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics + Del script-binding osc/visibility #menu: View > Toggle OSC Visibility + F8 script-binding show-playlist #menu: View > Show Playlist + F9 show-text ${track-list} 5000 #menu: View > Show Audio/Video/Subtitle List + p show-progress #menu: View > Show Progress + Ctrl+p script-message mpv.net show-profiles #menu: View > Show Profiles + Shift+p script-message mpv.net show-properties #menu: View > Show Properties + Shift+c script-message mpv.net show-commands #menu: View > Show Commands + ` script-binding console/enable #menu: View > Show Console - c script-message mpv.net show-conf-editor #menu: Settings > Show Config Editor - Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor - Ctrl+f script-message mpv.net open-conf-folder #menu: Settings > Open Config Folder + c script-message mpv.net show-conf-editor #menu: Settings > Show Config Editor + Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor + Ctrl+f script-message mpv.net open-conf-folder #menu: Settings > Open Config Folder - F1 script-message mpv.net show-command-palette #menu: Tools > Show All Commands - h script-message mpv.net show-history #menu: Tools > Show History - l ab-loop #menu: Tools > Set/clear A-B loop points - L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping - _ cycle shuffle #menu: Tools > Toggle Shuffle - Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding - _ script-message mpv.net show-setup-dialog #menu: Tools > Setup... + F1 script-message mpv.net show-command-palette #menu: Tools > Show All Commands + h script-message mpv.net show-history #menu: Tools > Show History + l ab-loop #menu: Tools > Set/clear A-B loop points + L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping + _ cycle shuffle #menu: Tools > Toggle Shuffle + Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding + _ script-message mpv.net show-setup-dialog #menu: Tools > Setup... _ script-message mpv.net shell-execute https://mpv.io #menu: Help > Website mpv _ script-message mpv.net shell-execute https://github.com/stax76/mpv.net #menu: Help > Website mpv.net diff --git a/mpv.net/Resources/mpvConf.txt b/mpv.net/Resources/mpv.conf.txt similarity index 100% rename from mpv.net/Resources/mpvConf.txt rename to mpv.net/Resources/mpv.conf.txt diff --git a/mpv.net/Scripting/PythonScript.cs b/mpv.net/Scripting/IronPython.cs similarity index 99% rename from mpv.net/Scripting/PythonScript.cs rename to mpv.net/Scripting/IronPython.cs index 5742c31..6abb6d0 100644 --- a/mpv.net/Scripting/PythonScript.cs +++ b/mpv.net/Scripting/IronPython.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.IO; using System.Reflection; diff --git a/mpv.net/Scripting/PowerShell.cs b/mpv.net/Scripting/PowerShell.cs index 500bc68..49fdb59 100644 --- a/mpv.net/Scripting/PowerShell.cs +++ b/mpv.net/Scripting/PowerShell.cs @@ -1,6 +1,7 @@  using System; using System.Collections.Generic; +using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Threading; @@ -65,6 +66,16 @@ namespace ScriptHost } } + public static string InvokeAndReturnString(string code, string varName, object varValue) + { + PowerShell ps = new PowerShell() { Print = false }; + ps.Scripts.Add(code); + string ret = string.Join(Environment.NewLine, (ps.Invoke(varName, varValue) + as IEnumerable).Select(item => item.ToString())).ToString(); + ps.Runspace.Dispose(); + return ret; + } + public void Output_DataReady(object sender, EventArgs e) { var output = sender as PipelineReader; diff --git a/mpv.net/WPF/ConfWindow.xaml.cs b/mpv.net/WPF/ConfWindow.xaml.cs index dbc3be3..ded73b4 100644 --- a/mpv.net/WPF/ConfWindow.xaml.cs +++ b/mpv.net/WPF/ConfWindow.xaml.cs @@ -5,6 +5,7 @@ using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Windows; using System.Windows.Controls; @@ -16,7 +17,7 @@ namespace mpvnet { public partial class ConfWindow : Window { - List SettingsDefinitions = Settings.LoadSettings(Properties.Resources.confToml); + List SettingsDefinitions = Settings.LoadSettings(Properties.Resources.editor_toml); List ConfItems = new List(); public ObservableCollection FilterStrings { get; } = new ObservableCollection(); string InitialContent; diff --git a/mpv.net/WPF/InputWindow.xaml.cs b/mpv.net/WPF/InputWindow.xaml.cs index 5461bc8..7b90de8 100644 --- a/mpv.net/WPF/InputWindow.xaml.cs +++ b/mpv.net/WPF/InputWindow.xaml.cs @@ -94,7 +94,7 @@ namespace mpvnet { string text = null; - foreach (string line in Properties.Resources.inputConf.Split(new[] { "\r\n" }, StringSplitOptions.None)) + foreach (string line in Properties.Resources.input_conf.Split(new[] { "\r\n" }, StringSplitOptions.None)) { string test = line.Trim(); if (test == "" || test.StartsWith("#")) text += test + "\r\n"; diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 92da133..3a12d1a 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -385,7 +385,7 @@ namespace mpvnet if (!content.Contains("#menu:")) { - var defaultItems = CommandItem.GetItems(Properties.Resources.inputConf); + var defaultItems = CommandItem.GetItems(Properties.Resources.input_conf); foreach (CommandItem item in items) foreach (CommandItem defaultItem in defaultItems) diff --git a/mpv.net/mpv.net.csproj b/mpv.net/mpv.net.csproj index 4893e4b..5d117a7 100644 --- a/mpv.net/mpv.net.csproj +++ b/mpv.net/mpv.net.csproj @@ -118,7 +118,7 @@ - + License.txt @@ -179,7 +179,7 @@ True Resources.resx - + Form @@ -247,8 +247,8 @@ True - - + + @@ -256,7 +256,7 @@ - + diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 5a8d227..9c7e9a9 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -19,7 +19,7 @@ using WinForms = System.Windows.Forms; using static libmpv; using static WinAPI; -using static Common; +using static NewLine; namespace mpvnet { @@ -215,11 +215,11 @@ namespace mpvnet RegistryHelp.SetValue(App.RegPath, "ConfigFolder", _ConfigFolder); if (!File.Exists(_ConfigFolder + "input.conf")) - File.WriteAllText(_ConfigFolder + "input.conf", Properties.Resources.inputConf); + File.WriteAllText(_ConfigFolder + "input.conf", Properties.Resources.input_conf); if (!File.Exists(_ConfigFolder + "mpv.conf")) { - string conf = Properties.Resources.mpvConf; + string conf = Properties.Resources.mpv_conf; Graphics gx = Graphics.FromHwnd(IntPtr.Zero); float scale = GetDeviceCaps(gx.GetHdc(), 88 /*LOGPIXELSX*/) / 96.0f;