This commit is contained in:
Frank Skare
2019-06-29 12:36:35 +02:00
parent 8e351193e1
commit 103ae81b8b
3 changed files with 18 additions and 9 deletions

View File

@@ -4,8 +4,9 @@
- the manifest was missing the company attribute which caused - the manifest was missing the company attribute which caused
mpv.net not appearing in the 'Open with' menu of the Windows File Explorer, mpv.net not appearing in the 'Open with' menu of the Windows File Explorer,
thanks to 44vince44 for pointing this out!!! thanks to 44vince44 for pointing this out!!!
- a new Python script example was added to the wiki and the scripting and - new Python and C# script examples were added to the wiki and the scripting and
add-on documentation was improved add-on documentation was improved
- invalid command line arguments were ignored, now an error message is shown
### 4.4 ### 4.4

View File

@@ -50,7 +50,7 @@ namespace RatingAddon
//handles keys defined in input.conf //handles keys defined in input.conf
void ClientMessage(string[] args) void ClientMessage(string[] args)
{ {
if (args.Length != 2 || args[0] != "rate-file" || ! int.TryParse(args[1], out int rating)) if (args[0] != "rate-file" || ! int.TryParse(args[1], out int rating))
return; return;
Dic[mp.get_property_string("path")] = rating; Dic[mp.get_property_string("path")] = rating;
mp.commandv("show-text", $"Rating: {rating}"); mp.commandv("show-text", $"Rating: {rating}");

View File

@@ -285,6 +285,7 @@ namespace mpvnet
i.Action.Invoke(args.Skip(2).ToArray()); i.Action.Invoke(args.Skip(2).ToArray());
} }
} }
if (!found) if (!found)
{ {
List<string> names = mpvnet.Command.Commands.Select((item) => item.Name).ToList(); List<string> names = mpvnet.Command.Commands.Select((item) => item.Name).ToList();
@@ -523,7 +524,7 @@ namespace mpvnet
foreach (string i in args) foreach (string i in args)
{ {
if (!i.StartsWith("--") && (File.Exists(i) || i == "-" || i.StartsWith("http"))) if (!i.StartsWith("--") && (i == "-" || i.StartsWith("http") || File.Exists(i)))
{ {
files.Add(i); files.Add(i);
if (i.StartsWith("http")) if (i.StartsWith("http"))
@@ -536,15 +537,22 @@ namespace mpvnet
foreach (string i in args) foreach (string i in args)
{ {
if (i.StartsWith("--")) if (i.StartsWith("--"))
{
try
{ {
if (i.Contains("=")) if (i.Contains("="))
{ {
string left = i.Substring(2, i.IndexOf("=") - 2); string left = i.Substring(2, i.IndexOf("=") - 2);
string right = i.Substring(left.Length + 3); string right = i.Substring(left.Length + 3);
set_property_string(left, right); set_property_string(left, right, true);
} }
else else
set_property_string(i.Substring(2), "yes"); set_property_string(i.Substring(2), "yes", true);
}
catch (Exception e)
{
Msg.ShowException(e);
}
} }
} }
} }