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
mpv.net not appearing in the 'Open with' menu of the Windows File Explorer,
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
- invalid command line arguments were ignored, now an error message is shown
### 4.4

View File

@@ -50,7 +50,7 @@ namespace RatingAddon
//handles keys defined in input.conf
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;
Dic[mp.get_property_string("path")] = rating;
mp.commandv("show-text", $"Rating: {rating}");

View File

@@ -285,6 +285,7 @@ namespace mpvnet
i.Action.Invoke(args.Skip(2).ToArray());
}
}
if (!found)
{
List<string> names = mpvnet.Command.Commands.Select((item) => item.Name).ToList();
@@ -523,7 +524,7 @@ namespace mpvnet
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);
if (i.StartsWith("http"))
@@ -537,14 +538,21 @@ namespace mpvnet
{
if (i.StartsWith("--"))
{
if (i.Contains("="))
try
{
string left = i.Substring(2, i.IndexOf("=") - 2);
string right = i.Substring(left.Length + 3);
set_property_string(left, right);
if (i.Contains("="))
{
string left = i.Substring(2, i.IndexOf("=") - 2);
string right = i.Substring(left.Length + 3);
set_property_string(left, right, true);
}
else
set_property_string(i.Substring(2), "yes", true);
}
catch (Exception e)
{
Msg.ShowException(e);
}
else
set_property_string(i.Substring(2), "yes");
}
}
}