This commit is contained in:
Frank Skare
2020-12-02 03:40:38 +01:00
parent e860cf52c4
commit 85a3506403
6 changed files with 36 additions and 12 deletions

View File

@@ -800,6 +800,29 @@ namespace mpvnet
HandleError(err, throwException, $"error setting property: {name} = " + value);
}
public string get_opt(string name, string defaultValue = "")
{
string value = get_property_string("script-opts");
if (string.IsNullOrEmpty(value))
return defaultValue;
string[] values = value.Split(',');
foreach (string item in values)
{
if (item.Contains("="))
{
string optionName = item.Substring(0, item.IndexOf("="));
if (optionName == name)
return item.Substring(item.IndexOf("=") + 1);
}
}
return defaultValue;
}
public void observe_property_int(string name, Action<int> action)
{
lock (IntPropChangeActions)