diff --git a/docs/Changelog.md b/docs/Changelog.md index 3014f70..a1d3076 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,6 +1,10 @@ 5.4.9.8 Beta (2021-??-??) +- All PowerShell dependencies except the scipt host were removed + in order to achieve first class Windows 7 compatibility! + + 5.4.9.7 Beta (2021-08-28) - Fix exception closing command palette on Windows 7. diff --git a/src/Misc/Commands.cs b/src/Misc/Commands.cs index 536b043..4e19f67 100644 --- a/src/Misc/Commands.cs +++ b/src/Misc/Commands.cs @@ -9,6 +9,7 @@ using System.Windows; using static mpvnet.Global; using System.Collections.Generic; +using System.Text; namespace mpvnet { @@ -290,27 +291,27 @@ namespace mpvnet public 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 = Core.GetPropertyString("command-list"); - ShowTextWithEditor("command-list", PowerShell.InvokeAndReturnString(code, "json", json)); + var o = json.FromJson>>().OrderBy(i => i["name"]); + StringBuilder sb = new StringBuilder(); + + foreach (Dictionary i in o) + { + sb.AppendLine(); + sb.AppendLine(i["name"].ToString()); + + foreach (Dictionary i2 in i["args"] as List) + { + string value = i2["name"].ToString() + " <" + i2["type"].ToString().ToLower() + ">"; + + if ((bool)i2["optional"] == true) + value = "[" + value + "]"; + + sb.AppendLine(" " + value); + } + } + + ShowTextWithEditor("command-list", sb.ToString()); } public static void ShowTextWithEditor(string name, string text) diff --git a/src/Misc/Help.cs b/src/Misc/Help.cs index 2053c96..80b7fca 100644 --- a/src/Misc/Help.cs +++ b/src/Misc/Help.cs @@ -1,5 +1,6 @@  using System; +using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; @@ -99,34 +100,33 @@ namespace mpvnet { public static string GetProfiles() { - string code = @" - foreach ($item in ($json | ConvertFrom-Json | foreach { $_ } | sort name)) - { - $item.name - '' - - foreach ($option in $item.options) - { - ' ' + $option.key + ' = ' + $option.value - } - - '' - }"; - string json = Core.GetPropertyString("profile-list"); - return PowerShell.InvokeAndReturnString(code, "json", json).Trim(); + var o = json.FromJson>>().OrderBy(i => i["name"]); + StringBuilder sb = new StringBuilder(); + + foreach (Dictionary i in o) + { + sb.Append(i["name"].ToString() + BR2); + + foreach (Dictionary i2 in i["options"] as List) + sb.AppendLine(" " + i2["key"] + " = " + i2["value"]); + + sb.Append(BR); + } + + return sb.ToString(); } public static string GetDecoders() - { - string code = @" - foreach ($item in ($json | ConvertFrom-Json | foreach { $_ } | sort codec)) - { - $item.codec + ' - ' + $item.description - }"; - + { string json = Core.GetPropertyString("decoder-list"); - return PowerShell.InvokeAndReturnString(code, "json", json).Trim(); + var o = json.FromJson>>().OrderBy(i => i["codec"]); + StringBuilder sb = new StringBuilder(); + + foreach (Dictionary i in o) + sb.AppendLine(i["codec"] + " - " + i["description"]); + + return sb.ToString(); } public static string GetProtocols() diff --git a/src/Resources/input.conf.txt b/src/Resources/input.conf.txt index b464bf8..40e953c 100644 --- a/src/Resources/input.conf.txt +++ b/src/Resources/input.conf.txt @@ -145,7 +145,7 @@ Ctrl+r cycle-values video-rotate 90 180 270 0 #menu: View > Rotate Video T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics t script-binding stats/display-stats #menu: View > Show Statistics _ script-message mpv.net show-audio-devices #menu: View > Show Audio Devices -Shift+c script-message mpv.net show-commands #menu: View > Show Commands +C script-message mpv.net show-commands #menu: View > Show Commands ` script-binding console/enable #menu: View > Show Console _ script-message mpv.net show-decoders #menu: View > Show Decoders _ script-message mpv.net show-demuxers #menu: View > Show Demuxers