PS ConvertFrom-Json replaced with JSONParser
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
5.4.9.8 Beta (2021-??-??)
|
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)
|
5.4.9.7 Beta (2021-08-28)
|
||||||
|
|
||||||
- Fix exception closing command palette on Windows 7.
|
- Fix exception closing command palette on Windows 7.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Windows;
|
|||||||
|
|
||||||
using static mpvnet.Global;
|
using static mpvnet.Global;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -290,27 +291,27 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void ShowCommands()
|
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");
|
string json = Core.GetPropertyString("command-list");
|
||||||
ShowTextWithEditor("command-list", PowerShell.InvokeAndReturnString(code, "json", json));
|
var o = json.FromJson<List<Dictionary<string, object>>>().OrderBy(i => i["name"]);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (Dictionary<string, object> i in o)
|
||||||
|
{
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(i["name"].ToString());
|
||||||
|
|
||||||
|
foreach (Dictionary<string, object> i2 in i["args"] as List<object>)
|
||||||
|
{
|
||||||
|
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)
|
public static void ShowTextWithEditor(string name, string text)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -99,34 +100,33 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
public static string GetProfiles()
|
public static string GetProfiles()
|
||||||
{
|
{
|
||||||
string code = @"
|
string json = Core.GetPropertyString("profile-list");
|
||||||
foreach ($item in ($json | ConvertFrom-Json | foreach { $_ } | sort name))
|
var o = json.FromJson<List<Dictionary<string, object>>>().OrderBy(i => i["name"]);
|
||||||
{
|
StringBuilder sb = new StringBuilder();
|
||||||
$item.name
|
|
||||||
''
|
|
||||||
|
|
||||||
foreach ($option in $item.options)
|
foreach (Dictionary<string, object> i in o)
|
||||||
{
|
{
|
||||||
' ' + $option.key + ' = ' + $option.value
|
sb.Append(i["name"].ToString() + BR2);
|
||||||
|
|
||||||
|
foreach (Dictionary<string, object> i2 in i["options"] as List<object>)
|
||||||
|
sb.AppendLine(" " + i2["key"] + " = " + i2["value"]);
|
||||||
|
|
||||||
|
sb.Append(BR);
|
||||||
}
|
}
|
||||||
|
|
||||||
''
|
return sb.ToString();
|
||||||
}";
|
|
||||||
|
|
||||||
string json = Core.GetPropertyString("profile-list");
|
|
||||||
return PowerShell.InvokeAndReturnString(code, "json", json).Trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetDecoders()
|
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");
|
string json = Core.GetPropertyString("decoder-list");
|
||||||
return PowerShell.InvokeAndReturnString(code, "json", json).Trim();
|
var o = json.FromJson<List<Dictionary<string, object>>>().OrderBy(i => i["codec"]);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (Dictionary<string, object> i in o)
|
||||||
|
sb.AppendLine(i["codec"] + " - " + i["description"]);
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetProtocols()
|
public static string GetProtocols()
|
||||||
|
|||||||
@@ -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-toggle #menu: View > Toggle Statistics
|
||||||
t script-binding stats/display-stats #menu: View > Show Statistics
|
t script-binding stats/display-stats #menu: View > Show Statistics
|
||||||
_ script-message mpv.net show-audio-devices #menu: View > Show Audio Devices
|
_ 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-binding console/enable #menu: View > Show Console
|
||||||
_ script-message mpv.net show-decoders #menu: View > Show Decoders
|
_ script-message mpv.net show-decoders #menu: View > Show Decoders
|
||||||
_ script-message mpv.net show-demuxers #menu: View > Show Demuxers
|
_ script-message mpv.net show-demuxers #menu: View > Show Demuxers
|
||||||
|
|||||||
Reference in New Issue
Block a user