5.4.4.2
This commit is contained in:
@@ -1,4 +1,11 @@
|
|||||||
|
|
||||||
|
### 5.4.4.2
|
||||||
|
|
||||||
|
- new: flag cli switches support now --no-flag in addition to --flag=no
|
||||||
|
- new: cli switches can also start with single - instead of double --
|
||||||
|
- new: the PowerShell script host was completely rewritten, events can
|
||||||
|
can be assigned to using `Register-ObjectEvent`
|
||||||
|
|
||||||
### 5.4.4.1
|
### 5.4.4.1
|
||||||
|
|
||||||
- new: external console replaced with internal console
|
- new: external console replaced with internal console
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ Before making a support request for a particular issue, please try if it was alr
|
|||||||
|
|
||||||
[Issue tracker](https://github.com/stax76/mpv.net/issues), feel free to use for anything mpv.net related.
|
[Issue tracker](https://github.com/stax76/mpv.net/issues), feel free to use for anything mpv.net related.
|
||||||
|
|
||||||
Supporting the development of mpv.net possible via PayPal donation:
|
You can support the development of mpv.net with a PayPal donation:
|
||||||
|
|
||||||
<https://www.paypal.me/stax76>
|
<https://www.paypal.me/stax76>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.IO;
|
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
using mpvnet;
|
using mpvnet;
|
||||||
|
|
||||||
@@ -9,9 +10,9 @@ class Script
|
|||||||
mp.Shutdown += Shutdown;
|
mp.Shutdown += Shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
foreach (string file in Directory.GetFiles(@"C:\Users\frank\Desktop\aaa"))
|
foreach (string file in Directory.GetFiles(@"C:\Users\frank\Desktop\aaa"))
|
||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -113,7 +114,7 @@ namespace DynamicGUI
|
|||||||
|
|
||||||
public OptionSetting OptionSetting { get; set; }
|
public OptionSetting OptionSetting { get; set; }
|
||||||
|
|
||||||
private string _Text;
|
string _Text;
|
||||||
|
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
@@ -144,7 +145,7 @@ namespace DynamicGUI
|
|||||||
|
|
||||||
public class HyperlinkEx : Hyperlink
|
public class HyperlinkEx : Hyperlink
|
||||||
{
|
{
|
||||||
private void HyperLinkEx_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
void HyperLinkEx_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start(e.Uri.AbsoluteUri);
|
Process.Start(e.Uri.AbsoluteUri);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,42 @@
|
|||||||
using System.Windows;
|
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace DynamicGUI
|
namespace DynamicGUI
|
||||||
{
|
{
|
||||||
public partial class OptionSettingControl : UserControl, ISettingControl
|
public partial class OptionSettingControl : UserControl, ISettingControl
|
||||||
{
|
{
|
||||||
private OptionSetting OptionSetting;
|
OptionSetting OptionSetting;
|
||||||
|
|
||||||
public OptionSettingControl(OptionSetting optionSetting)
|
public OptionSettingControl(OptionSetting optionSetting)
|
||||||
{
|
{
|
||||||
OptionSetting = optionSetting;
|
OptionSetting = optionSetting;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
TitleTextBox.Text = optionSetting.Name;
|
TitleTextBox.Text = optionSetting.Name;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(optionSetting.Help))
|
if (string.IsNullOrEmpty(optionSetting.Help))
|
||||||
HelpTextBox.Visibility = Visibility.Collapsed;
|
HelpTextBox.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
HelpTextBox.Text = optionSetting.Help;
|
HelpTextBox.Text = optionSetting.Help;
|
||||||
ItemsControl.ItemsSource = optionSetting.Options;
|
ItemsControl.ItemsSource = optionSetting.Options;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(optionSetting.URL))
|
if (string.IsNullOrEmpty(optionSetting.URL))
|
||||||
LinkTextBlock.Visibility = Visibility.Collapsed;
|
LinkTextBlock.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
Link.SetURL(optionSetting.URL);
|
Link.SetURL(optionSetting.URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _SearchableText;
|
string _SearchableText;
|
||||||
|
|
||||||
public string SearchableText {
|
public string SearchableText {
|
||||||
get {
|
get {
|
||||||
if (_SearchableText is null)
|
if (_SearchableText is null)
|
||||||
{
|
{
|
||||||
_SearchableText = TitleTextBox.Text + HelpTextBox.Text;
|
_SearchableText = TitleTextBox.Text + HelpTextBox.Text;
|
||||||
|
|
||||||
foreach (var i in OptionSetting.Options)
|
foreach (var i in OptionSetting.Options)
|
||||||
_SearchableText += i.Text + i.Help + i.Name;
|
_SearchableText += i.Text + i.Help + i.Name;
|
||||||
|
|
||||||
_SearchableText = _SearchableText.ToLower();
|
_SearchableText = _SearchableText.ToLower();
|
||||||
}
|
}
|
||||||
return _SearchableText;
|
return _SearchableText;
|
||||||
@@ -39,4 +46,4 @@ namespace DynamicGUI
|
|||||||
public SettingBase SettingBase => OptionSetting;
|
public SettingBase SettingBase => OptionSetting;
|
||||||
public bool Contains(string searchString) => SearchableText.Contains(searchString.ToLower());
|
public bool Contains(string searchString) => SearchableText.Contains(searchString.ToLower());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
@@ -10,7 +10,7 @@ namespace DynamicGUI
|
|||||||
{
|
{
|
||||||
public partial class StringSettingControl : UserControl, ISettingControl
|
public partial class StringSettingControl : UserControl, ISettingControl
|
||||||
{
|
{
|
||||||
private StringSetting StringSetting;
|
StringSetting StringSetting;
|
||||||
|
|
||||||
public StringSettingControl(StringSetting stringSetting)
|
public StringSettingControl(StringSetting stringSetting)
|
||||||
{
|
{
|
||||||
@@ -19,21 +19,26 @@ namespace DynamicGUI
|
|||||||
TitleTextBox.Text = stringSetting.Name;
|
TitleTextBox.Text = stringSetting.Name;
|
||||||
HelpTextBox.Text = stringSetting.Help;
|
HelpTextBox.Text = stringSetting.Help;
|
||||||
ValueTextBox.Text = StringSetting.Value;
|
ValueTextBox.Text = StringSetting.Value;
|
||||||
|
|
||||||
if (StringSetting.Width > 0)
|
if (StringSetting.Width > 0)
|
||||||
ValueTextBox.Width = StringSetting.Width;
|
ValueTextBox.Width = StringSetting.Width;
|
||||||
|
|
||||||
if (StringSetting.Type != "folder" && StringSetting.Type != "color")
|
if (StringSetting.Type != "folder" && StringSetting.Type != "color")
|
||||||
Button.Visibility = Visibility.Hidden;
|
Button.Visibility = Visibility.Hidden;
|
||||||
|
|
||||||
Link.SetURL(StringSetting.URL);
|
Link.SetURL(StringSetting.URL);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(stringSetting.URL))
|
if (string.IsNullOrEmpty(stringSetting.URL))
|
||||||
LinkTextBlock.Visibility = Visibility.Collapsed;
|
LinkTextBlock.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _SearchableText;
|
string _SearchableText;
|
||||||
|
|
||||||
public string SearchableText {
|
public string SearchableText {
|
||||||
get {
|
get {
|
||||||
if (_SearchableText is null)
|
if (_SearchableText is null)
|
||||||
_SearchableText = (TitleTextBox.Text + HelpTextBox.Text +ValueTextBox.Text).ToLower();
|
_SearchableText = (TitleTextBox.Text + HelpTextBox.Text +ValueTextBox.Text).ToLower();
|
||||||
|
|
||||||
return _SearchableText;
|
return _SearchableText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +52,7 @@ namespace DynamicGUI
|
|||||||
set => StringSetting.Value = value;
|
set => StringSetting.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
switch (StringSetting.Type)
|
switch (StringSetting.Type)
|
||||||
{
|
{
|
||||||
@@ -56,6 +61,7 @@ namespace DynamicGUI
|
|||||||
{
|
{
|
||||||
d.Description = "Choose a folder.";
|
d.Description = "Choose a folder.";
|
||||||
d.SelectedPath = ValueTextBox.Text;
|
d.SelectedPath = ValueTextBox.Text;
|
||||||
|
|
||||||
if (d.ShowDialog() == WinForms.DialogResult.OK)
|
if (d.ShowDialog() == WinForms.DialogResult.OK)
|
||||||
ValueTextBox.Text = d.SelectedPath;
|
ValueTextBox.Text = d.SelectedPath;
|
||||||
}
|
}
|
||||||
@@ -65,7 +71,8 @@ namespace DynamicGUI
|
|||||||
{
|
{
|
||||||
dialog.FullOpen = true;
|
dialog.FullOpen = true;
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
if (!string.IsNullOrEmpty(ValueTextBox.Text))
|
if (!string.IsNullOrEmpty(ValueTextBox.Text))
|
||||||
{
|
{
|
||||||
Color col = GetColor(ValueTextBox.Text);
|
Color col = GetColor(ValueTextBox.Text);
|
||||||
@@ -80,7 +87,7 @@ namespace DynamicGUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ValueTextBox_TextChanged(object sender, TextChangedEventArgs e) => Update();
|
void ValueTextBox_TextChanged(object sender, TextChangedEventArgs e) => Update();
|
||||||
|
|
||||||
Color GetColor(string value)
|
Color GetColor(string value)
|
||||||
{
|
{
|
||||||
@@ -104,9 +111,12 @@ namespace DynamicGUI
|
|||||||
if (StringSetting.Type == "color")
|
if (StringSetting.Type == "color")
|
||||||
{
|
{
|
||||||
Color c = Colors.Transparent;
|
Color c = Colors.Transparent;
|
||||||
if (ValueTextBox.Text != "") try { c = GetColor(ValueTextBox.Text); } catch {}
|
|
||||||
|
if (ValueTextBox.Text != "")
|
||||||
|
try { c = GetColor(ValueTextBox.Text); } catch {}
|
||||||
|
|
||||||
ValueTextBox.Background = new SolidColorBrush(c);
|
ValueTextBox.Background = new SolidColorBrush(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
using System;
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using UI;
|
using UI;
|
||||||
|
|
||||||
using static libmpv;
|
using static libmpv;
|
||||||
|
using static Common;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -84,16 +89,48 @@ namespace mpvnet
|
|||||||
|
|
||||||
mp.Shutdown += Shutdown;
|
mp.Shutdown += Shutdown;
|
||||||
mp.Initialized += Initialized;
|
mp.Initialized += Initialized;
|
||||||
mp.LogMessage += LogMessage;
|
mp.LogMessage += ShowFatalError;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LogMessage(mpv_log_level level, string msg)
|
static void ShowFatalError(mpv_log_level level, string msg)
|
||||||
{
|
{
|
||||||
if (!App.IsStartedFromTerminal && level == mpv_log_level.MPV_LOG_LEVEL_FATAL)
|
if (!App.IsStartedFromTerminal && level == mpv_log_level.MPV_LOG_LEVEL_FATAL)
|
||||||
Msg.ShowError(msg);
|
Msg.ShowError(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Initialized()
|
public static void RunAction(Action action)
|
||||||
|
{
|
||||||
|
Task.Run(() => {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
action.Invoke();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
ShowException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ShowException(object obj)
|
||||||
|
{
|
||||||
|
if (obj is Exception e)
|
||||||
|
{
|
||||||
|
if (App.IsStartedFromTerminal)
|
||||||
|
ConsoleHelp.WriteError(e.ToString(), "mpv.net");
|
||||||
|
else
|
||||||
|
Msg.ShowException(e);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (App.IsStartedFromTerminal)
|
||||||
|
ConsoleHelp.WriteError(obj.ToString(), "mpv.net");
|
||||||
|
else
|
||||||
|
Msg.ShowError(obj.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Initialized()
|
||||||
{
|
{
|
||||||
if (RememberVolume)
|
if (RememberVolume)
|
||||||
{
|
{
|
||||||
@@ -102,7 +139,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Shutdown()
|
static void Shutdown()
|
||||||
{
|
{
|
||||||
if (RememberVolume)
|
if (RememberVolume)
|
||||||
{
|
{
|
||||||
@@ -149,9 +186,9 @@ namespace mpvnet
|
|||||||
case "light-theme": LightTheme = value.Trim('\'', '"'); return true;
|
case "light-theme": LightTheme = value.Trim('\'', '"'); return true;
|
||||||
default:
|
default:
|
||||||
if (writeError)
|
if (writeError)
|
||||||
ConsoleHelp.WriteError($"unknown mpvnet.conf property: {name}");
|
ConsoleHelp.WriteError($"unknown mpvnet.conf property: {name}", "mpv.net");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
mpv.net/Misc/Common.cs
Normal file
8
mpv.net/Misc/Common.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public static class Common
|
||||||
|
{
|
||||||
|
public static string BR = Environment.NewLine;
|
||||||
|
public static string BR2 = Environment.NewLine + Environment.NewLine;
|
||||||
|
}
|
||||||
@@ -2,12 +2,43 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
class ConsoleHelp
|
public static class ConsoleHelp
|
||||||
{
|
{
|
||||||
public static void WriteError(object obj)
|
public static int Padding { get; set; }
|
||||||
|
|
||||||
|
public static void WriteError(object obj, string module = null) => Write(obj, module, ConsoleColor.Red, false);
|
||||||
|
|
||||||
|
public static void Write(object obj, string module)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Write(obj, module, ConsoleColor.Black, true);
|
||||||
Console.WriteLine("[mpvnet] " + obj);
|
}
|
||||||
|
|
||||||
|
public static void Write(object obj, string module, ConsoleColor color)
|
||||||
|
{
|
||||||
|
Write(obj, module, color, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Write(object obj, string module, ConsoleColor color, bool useDefaultColor)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string value = obj.ToString();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(module))
|
||||||
|
module = "[" + module + "] ";
|
||||||
|
|
||||||
|
if (useDefaultColor)
|
||||||
|
Console.ResetColor();
|
||||||
|
else
|
||||||
|
Console.ForegroundColor = color;
|
||||||
|
|
||||||
|
value = module + value;
|
||||||
|
|
||||||
|
if (Padding > 0 && value.Length < Padding)
|
||||||
|
value = value.PadRight(Padding);
|
||||||
|
|
||||||
|
Console.WriteLine(value);
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
Trace.WriteLine(obj);
|
Trace.WriteLine(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ namespace mpvnet
|
|||||||
|
|
||||||
public CommandItem(SerializationInfo info, StreamingContext context) { }
|
public CommandItem(SerializationInfo info, StreamingContext context) { }
|
||||||
|
|
||||||
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _Input = "";
|
string _Input = "";
|
||||||
|
|
||||||
public string Input {
|
public string Input {
|
||||||
get => _Input;
|
get => _Input;
|
||||||
@@ -175,14 +175,13 @@ namespace mpvnet
|
|||||||
if (item.Command.ToLower() == "ignore")
|
if (item.Command.ToLower() == "ignore")
|
||||||
item.Command = "";
|
item.Command = "";
|
||||||
|
|
||||||
MigrateCommands(item);
|
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ObservableCollection<CommandItem> _Items;
|
static ObservableCollection<CommandItem> _Items;
|
||||||
|
|
||||||
public static ObservableCollection<CommandItem> Items {
|
public static ObservableCollection<CommandItem> Items {
|
||||||
get {
|
get {
|
||||||
@@ -192,26 +191,6 @@ namespace mpvnet
|
|||||||
return _Items;
|
return _Items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// last change 2019
|
|
||||||
public static void MigrateCommands(CommandItem item)
|
|
||||||
{
|
|
||||||
switch (item.Command)
|
|
||||||
{
|
|
||||||
case "script-message mpv.net show-prefs":
|
|
||||||
item.Command = "script-message mpv.net show-conf-editor";
|
|
||||||
break;
|
|
||||||
case "script-message mpv.net show-keys":
|
|
||||||
item.Command = "script-message mpv.net show-input-editor";
|
|
||||||
break;
|
|
||||||
case "script-message mpv.net history":
|
|
||||||
item.Command = "script-message mpv.net show-history";
|
|
||||||
break;
|
|
||||||
case "script-message mpv.net open-config-folder":
|
|
||||||
item.Command = "script-message open-conf-folder";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CursorHelp
|
public class CursorHelp
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace UI
|
|||||||
if (!theme.Dictionary.ContainsKey(key))
|
if (!theme.Dictionary.ContainsKey(key))
|
||||||
{
|
{
|
||||||
isKeyMissing = true;
|
isKeyMissing = true;
|
||||||
ConsoleHelp.WriteError($"Theme '{activeTheme}' misses '{key}'");
|
ConsoleHelp.WriteError($"Theme '{activeTheme}' misses '{key}'", "mpv.net");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ public class WinAPI
|
|||||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
|
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
|
||||||
|
|
||||||
[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
|
[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
|
||||||
private static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex);
|
static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
[DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")]
|
[DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")]
|
||||||
private static extern IntPtr GetWindowLong64(IntPtr hWnd, int nIndex);
|
static extern IntPtr GetWindowLong64(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
public static IntPtr GetWindowLong(IntPtr hWnd, int nIndex)
|
public static IntPtr GetWindowLong(IntPtr hWnd, int nIndex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
public class Msg
|
public class Msg
|
||||||
{
|
{
|
||||||
private static string ShownMessages;
|
static string ShownMessages;
|
||||||
|
|
||||||
public static string SupportURL { get; set; }
|
public static string SupportURL { get; set; }
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public class Msg
|
|||||||
td.MainInstruction = exception.GetType().Name;
|
td.MainInstruction = exception.GetType().Name;
|
||||||
td.Content = exception.Message;
|
td.Content = exception.Message;
|
||||||
td.MainIcon = MsgIcon.Error;
|
td.MainIcon = MsgIcon.Error;
|
||||||
td.ExpandedInformation = exception.ToString();
|
td.ExpandedInformation = exception.StackTrace;
|
||||||
td.Footer = "[Copy Message](copymsg)";
|
td.Footer = "[Copy Message](copymsg)";
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Msg.SupportURL))
|
if (!string.IsNullOrEmpty(Msg.SupportURL))
|
||||||
@@ -78,8 +78,7 @@ public class Msg
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(e.GetType().Name + "\n\n" + e.Message + "\n\n" + e,
|
MessageBox.Show(e.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,24 +95,24 @@ public class Msg
|
|||||||
Msg.ShownMessages += mainInstruction + content;
|
Msg.ShownMessages += mainInstruction + content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MsgResult ShowQuestion(string mainInstruction,
|
public static MsgResult ShowQuestion(
|
||||||
MsgButtons buttons = MsgButtons.OkCancel)
|
string mainInstruction, MsgButtons buttons = MsgButtons.OkCancel)
|
||||||
{
|
{
|
||||||
return Msg.Show(mainInstruction, null, MsgIcon.None, buttons, MsgResult.None);
|
return Msg.Show(mainInstruction, null, MsgIcon.None, buttons, MsgResult.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MsgResult ShowQuestion(string mainInstruction,
|
public static MsgResult ShowQuestion(
|
||||||
string content,
|
string mainInstruction, string content, MsgButtons buttons = MsgButtons.OkCancel)
|
||||||
MsgButtons buttons = MsgButtons.OkCancel)
|
|
||||||
{
|
{
|
||||||
return Msg.Show(mainInstruction, content, MsgIcon.None, buttons, MsgResult.None);
|
return Msg.Show(mainInstruction, content, MsgIcon.None, buttons, MsgResult.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MsgResult Show(string mainInstruction,
|
public static MsgResult Show(
|
||||||
string content,
|
string mainInstruction,
|
||||||
MsgIcon icon,
|
string content,
|
||||||
MsgButtons buttons,
|
MsgIcon icon,
|
||||||
MsgResult defaultButton = MsgResult.None)
|
MsgButtons buttons,
|
||||||
|
MsgResult defaultButton = MsgResult.None)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -155,14 +154,20 @@ public class Msg
|
|||||||
|
|
||||||
public class TaskDialog<T> : TaskDialogNative, IDisposable
|
public class TaskDialog<T> : TaskDialogNative, IDisposable
|
||||||
{
|
{
|
||||||
private Dictionary<int, T> IdValueDic;
|
Dictionary<int, T> IdValueDic;
|
||||||
private Dictionary<int, string> IdTextDic;
|
Dictionary<int, string> IdTextDic;
|
||||||
private List<int> CommandLinkShieldList;
|
List<int> CommandLinkShieldList;
|
||||||
private IntPtr ButtonArray;
|
IntPtr ButtonArray;
|
||||||
private IntPtr RadioButtonArray;
|
IntPtr RadioButtonArray;
|
||||||
private List<TaskDialogNative.TASKDIALOG_BUTTON> Buttons;
|
T SelectedValueValue;
|
||||||
private List<TaskDialogNative.TASKDIALOG_BUTTON> RadioButtons;
|
string SelectedTextValue;
|
||||||
private TaskDialogNative.TASKDIALOGCONFIG Config;
|
int TimeoutValue;
|
||||||
|
int ExitTickCount;
|
||||||
|
bool Disposed;
|
||||||
|
List<TaskDialogNative.TASKDIALOG_BUTTON> Buttons;
|
||||||
|
List<TaskDialogNative.TASKDIALOG_BUTTON> RadioButtons;
|
||||||
|
TaskDialogNative.TASKDIALOGCONFIG Config;
|
||||||
|
|
||||||
const int TDE_CONTENT = 0;
|
const int TDE_CONTENT = 0;
|
||||||
const int TDE_EXPANDED_INFORMATION = 1;
|
const int TDE_EXPANDED_INFORMATION = 1;
|
||||||
const int TDE_FOOTER = 2;
|
const int TDE_FOOTER = 2;
|
||||||
@@ -193,11 +198,6 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
const int TDM_UPDATE_ELEMENT_TEXT = 1138;
|
const int TDM_UPDATE_ELEMENT_TEXT = 1138;
|
||||||
const int TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = 1139;
|
const int TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = 1139;
|
||||||
const int TDM_UPDATE_ICON = 1140;
|
const int TDM_UPDATE_ICON = 1140;
|
||||||
private T SelectedValueValue;
|
|
||||||
private string SelectedTextValue;
|
|
||||||
private int TimeoutValue;
|
|
||||||
private int ExitTickCount;
|
|
||||||
private bool disposed;
|
|
||||||
|
|
||||||
public TaskDialog()
|
public TaskDialog()
|
||||||
{
|
{
|
||||||
@@ -285,13 +285,14 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
set => Config.MainIcon = new TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION((int)value);
|
set => Config.MainIcon = new TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION((int)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _SelectedID;
|
int _SelectedID;
|
||||||
|
|
||||||
public int SelectedID {
|
public int SelectedID {
|
||||||
get => _SelectedID;
|
get => _SelectedID;
|
||||||
set {
|
set {
|
||||||
foreach (var i in IdValueDic)
|
foreach (var i in IdValueDic)
|
||||||
if (i.Key == value) _SelectedID = value;
|
if (i.Key == value)
|
||||||
|
_SelectedID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +300,7 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
get {
|
get {
|
||||||
if (IdValueDic.ContainsKey(SelectedID))
|
if (IdValueDic.ContainsKey(SelectedID))
|
||||||
return IdValueDic[SelectedID];
|
return IdValueDic[SelectedID];
|
||||||
|
|
||||||
return SelectedValueValue;
|
return SelectedValueValue;
|
||||||
}
|
}
|
||||||
set => SelectedValueValue = value;
|
set => SelectedValueValue = value;
|
||||||
@@ -308,13 +310,15 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
get {
|
get {
|
||||||
if (IdTextDic.ContainsKey(SelectedID))
|
if (IdTextDic.ContainsKey(SelectedID))
|
||||||
return IdTextDic[SelectedID];
|
return IdTextDic[SelectedID];
|
||||||
|
|
||||||
return SelectedTextValue;
|
return SelectedTextValue;
|
||||||
}
|
}
|
||||||
set => SelectedTextValue = value;
|
set => SelectedTextValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckBoxChecked {
|
public bool CheckBoxChecked {
|
||||||
get => (Config.dwFlags & TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED) == TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED;
|
get => (Config.dwFlags & TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED)
|
||||||
|
== TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED;
|
||||||
set {
|
set {
|
||||||
if (value)
|
if (value)
|
||||||
Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED;
|
Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED;
|
||||||
@@ -355,6 +359,7 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
value = regex.Replace(value, "<a href=\"$2\">$1</a>");
|
value = regex.Replace(value, "<a href=\"$2\">$1</a>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,8 +376,13 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
{
|
{
|
||||||
int n = 1000 + IdValueDic.Count + 1;
|
int n = 1000 + IdValueDic.Count + 1;
|
||||||
IdValueDic[n] = value;
|
IdValueDic[n] = value;
|
||||||
if (setShield) CommandLinkShieldList.Add(n);
|
|
||||||
if (!string.IsNullOrEmpty(description)) text += "\n" + description;
|
if (setShield)
|
||||||
|
CommandLinkShieldList.Add(n);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(description))
|
||||||
|
text += "\n" + description;
|
||||||
|
|
||||||
Buttons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text));
|
Buttons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text));
|
||||||
Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_USE_COMMAND_LINKS;
|
Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_USE_COMMAND_LINKS;
|
||||||
}
|
}
|
||||||
@@ -388,10 +398,17 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
{
|
{
|
||||||
MarshalDialogControlStructs();
|
MarshalDialogControlStructs();
|
||||||
TaskDialogNative.TASKDIALOGCONFIG config = Config;
|
TaskDialogNative.TASKDIALOGCONFIG config = Config;
|
||||||
int errorCode = TaskDialogNative.TaskDialogIndirect(config, out int dummy1, out int dummy2, out bool isChecked);
|
int hr = TaskDialogNative.TaskDialogIndirect(
|
||||||
if (errorCode < 0) Marshal.ThrowExceptionForHR(errorCode);
|
config, out int dummy1, out int dummy2, out bool isChecked);
|
||||||
|
|
||||||
|
if (hr < 0)
|
||||||
|
Marshal.ThrowExceptionForHR(hr);
|
||||||
|
|
||||||
CheckBoxChecked = isChecked;
|
CheckBoxChecked = isChecked;
|
||||||
if (SelectedValue is MsgResult) SelectedValue = (T)(object)SelectedID;
|
|
||||||
|
if (SelectedValue is MsgResult)
|
||||||
|
SelectedValue = (T)(object)SelectedID;
|
||||||
|
|
||||||
return SelectedValue;
|
return SelectedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,8 +429,10 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
break;
|
break;
|
||||||
case 3: //TDN_HYPERLINK_CLICKED
|
case 3: //TDN_HYPERLINK_CLICKED
|
||||||
string stringUni = Marshal.PtrToStringUni(lParam);
|
string stringUni = Marshal.PtrToStringUni(lParam);
|
||||||
|
|
||||||
if (stringUni.StartsWith("mailto") || stringUni.StartsWith("http"))
|
if (stringUni.StartsWith("mailto") || stringUni.StartsWith("http"))
|
||||||
Process.Start(stringUni);
|
Process.Start(stringUni);
|
||||||
|
|
||||||
if (stringUni == "copymsg")
|
if (stringUni == "copymsg")
|
||||||
{
|
{
|
||||||
Thread thread = new Thread((ThreadStart)(() => {
|
Thread thread = new Thread((ThreadStart)(() => {
|
||||||
@@ -475,8 +494,10 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
|
|
||||||
protected void Dispose(bool disposing)
|
protected void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposed) return;
|
if (Disposed)
|
||||||
disposed = true;
|
return;
|
||||||
|
|
||||||
|
Disposed = true;
|
||||||
|
|
||||||
if (ButtonArray != IntPtr.Zero)
|
if (ButtonArray != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
@@ -493,36 +514,27 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public delegate int PFTASKDIALOGCALLBACK(
|
public delegate int PFTASKDIALOGCALLBACK(
|
||||||
IntPtr hwnd,
|
IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam, IntPtr lpRefData);
|
||||||
uint msg,
|
|
||||||
IntPtr wParam,
|
|
||||||
IntPtr lParam,
|
|
||||||
IntPtr lpRefData);
|
|
||||||
|
|
||||||
public class TaskDialogNative
|
public class TaskDialogNative
|
||||||
{
|
{
|
||||||
[DllImport("comctl32", CharSet = CharSet.Unicode, SetLastError = true)]
|
[DllImport("comctl32", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
public static extern int TaskDialogIndirect(
|
public static extern int TaskDialogIndirect(
|
||||||
[In] TaskDialogNative.TASKDIALOGCONFIG pTaskConfig,
|
TaskDialogNative.TASKDIALOGCONFIG pTaskConfig,
|
||||||
out int pnButton,
|
out int pnButton,
|
||||||
out int pnRadioButton,
|
out int pnRadioButton,
|
||||||
[MarshalAs(UnmanagedType.Bool)] out bool pVerificationFlagChecked);
|
out bool pVerificationFlagChecked);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern IntPtr GetForegroundWindow();
|
public static extern IntPtr GetForegroundWindow();
|
||||||
|
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
|
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
|
||||||
public static extern uint GetWindowModuleFileName(
|
public static extern uint GetWindowModuleFileName(
|
||||||
IntPtr hwnd,
|
IntPtr hwnd, StringBuilder lpszFileName, uint cchFileNameMax);
|
||||||
StringBuilder lpszFileName,
|
|
||||||
uint cchFileNameMax);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern IntPtr SendMessage(
|
public static extern IntPtr SendMessage(
|
||||||
IntPtr handle,
|
IntPtr handle, int message, IntPtr wParam, IntPtr lParam);
|
||||||
int message,
|
|
||||||
IntPtr wParam,
|
|
||||||
IntPtr lParam);
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
|
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
|
||||||
public class TASKDIALOGCONFIG
|
public class TASKDIALOGCONFIG
|
||||||
@@ -532,12 +544,9 @@ public class TaskDialogNative
|
|||||||
public IntPtr hInstance;
|
public IntPtr hInstance;
|
||||||
public TaskDialogNative.TASKDIALOG_FLAGS dwFlags;
|
public TaskDialogNative.TASKDIALOG_FLAGS dwFlags;
|
||||||
public MsgButtons dwCommonButtons;
|
public MsgButtons dwCommonButtons;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszWindowTitle;
|
public string pszWindowTitle;
|
||||||
public TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION MainIcon;
|
public TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION MainIcon;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszMainInstruction;
|
public string pszMainInstruction;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszContent;
|
public string pszContent;
|
||||||
public uint cButtons;
|
public uint cButtons;
|
||||||
public IntPtr pButtons;
|
public IntPtr pButtons;
|
||||||
@@ -545,16 +554,11 @@ public class TaskDialogNative
|
|||||||
public uint cRadioButtons;
|
public uint cRadioButtons;
|
||||||
public IntPtr pRadioButtons;
|
public IntPtr pRadioButtons;
|
||||||
public int nDefaultRadioButton;
|
public int nDefaultRadioButton;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszVerificationText;
|
public string pszVerificationText;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszExpandedInformation;
|
public string pszExpandedInformation;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszExpandedControlText;
|
public string pszExpandedControlText;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszCollapsedControlText;
|
public string pszCollapsedControlText;
|
||||||
public TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION FooterIcon;
|
public TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION FooterIcon;
|
||||||
[MarshalAs(UnmanagedType.LPWStr)]
|
|
||||||
public string pszFooter;
|
public string pszFooter;
|
||||||
public PFTASKDIALOGCALLBACK pfCallback;
|
public PFTASKDIALOGCALLBACK pfCallback;
|
||||||
public IntPtr lpCallbackData;
|
public IntPtr lpCallbackData;
|
||||||
@@ -655,4 +659,4 @@ public enum MsgIcon
|
|||||||
Info = 65533,
|
Info = 65533,
|
||||||
Error = 65534,
|
Error = 65534,
|
||||||
Warning = 65535,
|
Warning = 65535,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
public class Taskbar
|
public class Taskbar
|
||||||
{
|
{
|
||||||
private ITaskbarList3 Instance = (ITaskbarList3)new TaskBarCommunication();
|
|
||||||
|
|
||||||
public IntPtr Handle { get; set; }
|
public IntPtr Handle { get; set; }
|
||||||
|
|
||||||
public Taskbar(IntPtr handle) => Handle = handle;
|
public Taskbar(IntPtr handle) => Handle = handle;
|
||||||
|
|
||||||
|
ITaskbarList3 Instance = (ITaskbarList3)new TaskBarCommunication();
|
||||||
|
|
||||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
[Guid("EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF")]
|
[Guid("EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF")]
|
||||||
private interface ITaskbarList3
|
interface ITaskbarList3
|
||||||
{
|
{
|
||||||
// ITaskbarList
|
// ITaskbarList
|
||||||
[PreserveSig] void HrInit();
|
[PreserveSig] void HrInit();
|
||||||
@@ -30,7 +30,9 @@ public class Taskbar
|
|||||||
[ComImport]
|
[ComImport]
|
||||||
[ClassInterface(ClassInterfaceType.None)]
|
[ClassInterface(ClassInterfaceType.None)]
|
||||||
[Guid("56FDF344-FD6D-11d0-958A-006097C9A090")]
|
[Guid("56FDF344-FD6D-11d0-958A-006097C9A090")]
|
||||||
private class TaskBarCommunication { }
|
class TaskBarCommunication
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SetState(TaskbarStates taskbarState)
|
public void SetState(TaskbarStates taskbarState)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("5.4.4.1")]
|
[assembly: AssemblyVersion("5.4.4.2")]
|
||||||
[assembly: AssemblyFileVersion("5.4.4.1")]
|
[assembly: AssemblyFileVersion("5.4.4.2")]
|
||||||
|
|||||||
@@ -295,13 +295,13 @@ help = "<int> Initial window height in percent. Default: 50"
|
|||||||
name = "autofit-smaller"
|
name = "autofit-smaller"
|
||||||
file = "mpv"
|
file = "mpv"
|
||||||
filter = "Screen"
|
filter = "Screen"
|
||||||
help = "<int> Minimum window height in percent. Default: 40"
|
help = "<int> Minimum window height in percent. Default: 30"
|
||||||
|
|
||||||
[[settings]]
|
[[settings]]
|
||||||
name = "autofit-larger"
|
name = "autofit-larger"
|
||||||
file = "mpv"
|
file = "mpv"
|
||||||
filter = "Screen"
|
filter = "Screen"
|
||||||
help = "<int> Maximum window height in percent. Default: 75"
|
help = "<int> Maximum window height in percent. Default: 80"
|
||||||
|
|
||||||
[[settings]]
|
[[settings]]
|
||||||
name = "start-size"
|
name = "start-size"
|
||||||
|
|||||||
107
mpv.net/Scripting/PowerShell.cs
Normal file
107
mpv.net/Scripting/PowerShell.cs
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Management.Automation;
|
||||||
|
using System.Management.Automation.Runspaces;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace ScriptHost
|
||||||
|
{
|
||||||
|
public class PowerShell
|
||||||
|
{
|
||||||
|
public Runspace Runspace { get; set; }
|
||||||
|
public Pipeline Pipeline { get; set; }
|
||||||
|
public string Module { get; set; }
|
||||||
|
public bool Print { get; set; }
|
||||||
|
public List<string> Scripts { get; } = new List<string>();
|
||||||
|
public string[] Parameters { get; }
|
||||||
|
|
||||||
|
public static List<PowerShell> Instances { get; } = new List<PowerShell>();
|
||||||
|
|
||||||
|
string BR = Environment.NewLine;
|
||||||
|
|
||||||
|
public object Invoke()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Runspace = RunspaceFactory.CreateRunspace();
|
||||||
|
Runspace.ApartmentState = ApartmentState.STA;
|
||||||
|
Runspace.Open();
|
||||||
|
Pipeline = Runspace.CreatePipeline();
|
||||||
|
|
||||||
|
foreach (string script in Scripts)
|
||||||
|
Pipeline.Commands.AddScript(script);
|
||||||
|
|
||||||
|
if (Parameters != null)
|
||||||
|
foreach (string param in Parameters)
|
||||||
|
foreach (Command command in Pipeline.Commands)
|
||||||
|
command.Parameters.Add(null, param);
|
||||||
|
|
||||||
|
Runspace.SessionStateProxy.SetVariable("ScriptHost", this);
|
||||||
|
|
||||||
|
if (Print)
|
||||||
|
{
|
||||||
|
Pipeline.Output.DataReady += Output_DataReady;
|
||||||
|
Pipeline.Error.DataReady += Error_DataReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Pipeline.Invoke();
|
||||||
|
}
|
||||||
|
catch (RuntimeException e)
|
||||||
|
{
|
||||||
|
string message = e.Message + BR + BR + e.ErrorRecord.ScriptStackTrace.Replace(
|
||||||
|
" <ScriptBlock>, <No file>", "") + BR + BR + Module + BR;
|
||||||
|
|
||||||
|
throw new PowerShellException(message);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Output_DataReady(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var output = sender as PipelineReader<PSObject>;
|
||||||
|
|
||||||
|
while (output.Count > 0)
|
||||||
|
ConsoleHelp.Write(output.Read().ToString(), Module);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Error_DataReady(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var output = sender as PipelineReader<Object>;
|
||||||
|
|
||||||
|
while (output.Count > 0)
|
||||||
|
ConsoleHelp.WriteError(output.Read().ToString(), Module);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RedirectEventJobStreams(PSEventJob job)
|
||||||
|
{
|
||||||
|
if (Print)
|
||||||
|
{
|
||||||
|
job.Output.DataAdded += Output_DataAdded;
|
||||||
|
job.Error.DataAdded += Error_DataAdded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Output_DataAdded(object sender, DataAddedEventArgs e)
|
||||||
|
{
|
||||||
|
var output = sender as PSDataCollection<PSObject>;
|
||||||
|
ConsoleHelp.Write(output[e.Index], Module);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Error_DataAdded(object sender, DataAddedEventArgs e)
|
||||||
|
{
|
||||||
|
var error = sender as PSDataCollection<ErrorRecord>;
|
||||||
|
ConsoleHelp.WriteError(error[e.Index], Module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PowerShellException : Exception
|
||||||
|
{
|
||||||
|
public PowerShellException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Management.Automation.Runspaces;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Management.Automation;
|
|
||||||
|
|
||||||
namespace mpvnet
|
|
||||||
{
|
|
||||||
public class PowerShellScript
|
|
||||||
{
|
|
||||||
public static void Execute(string filepath, params string[] parameters)
|
|
||||||
{
|
|
||||||
using (Runspace runspace = RunspaceFactory.CreateRunspace())
|
|
||||||
{
|
|
||||||
runspace.ApartmentState = ApartmentState.STA;
|
|
||||||
runspace.Open();
|
|
||||||
|
|
||||||
using (Pipeline pipeline = runspace.CreatePipeline())
|
|
||||||
{
|
|
||||||
pipeline.Commands.AddScript(
|
|
||||||
"Using namespace mpvnet\n" +
|
|
||||||
"Using namespace System\n" +
|
|
||||||
"[System.Reflection.Assembly]::LoadWithPartialName(\"mpvnet\")\n");
|
|
||||||
|
|
||||||
pipeline.Commands.AddScript(File.ReadAllText(filepath));
|
|
||||||
|
|
||||||
if (parameters != null)
|
|
||||||
foreach (string i in parameters)
|
|
||||||
pipeline.Commands[1].Parameters.Add(null, i);
|
|
||||||
|
|
||||||
PowerShellOutput output = new PowerShellOutput();
|
|
||||||
output.ModuleName = Path.GetFileName(filepath);
|
|
||||||
|
|
||||||
pipeline.Output.DataReady += output.Output_DataReady;
|
|
||||||
pipeline.Error.DataReady += output.Error_DataReady;
|
|
||||||
|
|
||||||
runspace.SessionStateProxy.SetVariable("Output", output);
|
|
||||||
|
|
||||||
try {
|
|
||||||
pipeline.Invoke();
|
|
||||||
}
|
|
||||||
catch (RuntimeException e) {
|
|
||||||
Msg.ShowError("PowerShell Exception", e.Message + "\n\n" +
|
|
||||||
e.ErrorRecord.ScriptStackTrace.Replace(" <ScriptBlock>, <No file>", "") +
|
|
||||||
"\n\n" + Path.GetFileName(filepath));
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
Msg.ShowException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline.Output.DataReady -= output.Output_DataReady;
|
|
||||||
pipeline.Error.DataReady -= output.Error_DataReady;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Init(string filepath)
|
|
||||||
{
|
|
||||||
foreach (var eventInfo in typeof(mp).GetEvents())
|
|
||||||
{
|
|
||||||
if (eventInfo.Name.ToLower() ==
|
|
||||||
Path.GetFileNameWithoutExtension(filepath).ToLower().Replace("-", ""))
|
|
||||||
{
|
|
||||||
PowerShellEventObject eventObject = new PowerShellEventObject();
|
|
||||||
MethodInfo mi;
|
|
||||||
eventObject.Filepath = filepath;
|
|
||||||
|
|
||||||
if (eventInfo.EventHandlerType == typeof(Action))
|
|
||||||
mi = eventObject.GetType().GetMethod(nameof(PowerShellEventObject.Invoke));
|
|
||||||
else if (eventInfo.EventHandlerType == typeof(Action<EndFileEventMode>))
|
|
||||||
mi = eventObject.GetType().GetMethod(nameof(PowerShellEventObject.InvokeEndFile));
|
|
||||||
else if (eventInfo.EventHandlerType == typeof(Action<string[]>))
|
|
||||||
mi = eventObject.GetType().GetMethod(nameof(PowerShellEventObject.InvokeStrings));
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
|
|
||||||
eventObject.EventInfo = eventInfo;
|
|
||||||
Delegate handler = Delegate.CreateDelegate(eventInfo.EventHandlerType, eventObject, mi);
|
|
||||||
eventObject.Delegate = handler;
|
|
||||||
eventInfo.AddEventHandler(eventObject, handler);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Execute(filepath);
|
|
||||||
}
|
|
||||||
|
|
||||||
class PowerShellOutput
|
|
||||||
{
|
|
||||||
public string ModuleName { get; set; }
|
|
||||||
|
|
||||||
public bool WriteStandard { get; set; } = true;
|
|
||||||
public bool WriteError { get; set; } = true;
|
|
||||||
|
|
||||||
public void Output_DataReady(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!WriteStandard)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var output = sender as PipelineReader<PSObject>;
|
|
||||||
|
|
||||||
while (output.Count > 0)
|
|
||||||
Console.WriteLine("[" + ModuleName + "] " + output.Read().ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Error_DataReady(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!WriteError)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var output = sender as PipelineReader<Object>;
|
|
||||||
|
|
||||||
while (output.Count > 0)
|
|
||||||
ConsoleHelp.WriteError("[" + ModuleName + "] " + output.Read().ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PowerShellEventObject
|
|
||||||
{
|
|
||||||
public EventInfo EventInfo { get; set; }
|
|
||||||
public Delegate Delegate { get; set; }
|
|
||||||
public string Filepath { get; set; }
|
|
||||||
|
|
||||||
public void Invoke() => PowerShellScript.Execute(Filepath);
|
|
||||||
public void InvokeEndFile(EndFileEventMode arg) => PowerShellScript.Execute(Filepath, arg.ToString());
|
|
||||||
public void InvokeStrings(string[] args) => PowerShellScript.Execute(Filepath, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -29,16 +26,22 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
if (item.Command == "" || item.Path == "")
|
if (item.Command == "" || item.Path == "")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string filter = FilterTextBox.Text.ToLower();
|
string filter = FilterTextBox.Text.ToLower();
|
||||||
if (filter == "") return true;
|
|
||||||
|
if (filter == "")
|
||||||
|
return true;
|
||||||
|
|
||||||
if (item.Command.ToLower().Contains(filter) ||
|
if (item.Command.ToLower().Contains(filter) ||
|
||||||
item.Input.ToLower().Contains(filter) ||
|
item.Input.ToLower().Contains(filter) ||
|
||||||
item.Path.ToLower().Contains(filter))
|
item.Path.ToLower().Contains(filter))
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||||
source.AddHook(new HwndSourceHook(WndProc));
|
source.AddHook(new HwndSourceHook(WndProc));
|
||||||
@@ -52,14 +55,15 @@ namespace mpvnet
|
|||||||
ListView.SelectedIndex = 0;
|
ListView.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||||
{
|
{
|
||||||
if (msg == 0x200 /*WM_MOUSEMOVE*/ && Mouse.LeftButton != MouseButtonState.Pressed)
|
if (msg == 0x200 /*WM_MOUSEMOVE*/ && Mouse.LeftButton != MouseButtonState.Pressed)
|
||||||
handled = true;
|
handled = true;
|
||||||
|
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
void FilterTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
@@ -67,7 +71,10 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
int index = ListView.SelectedIndex;
|
int index = ListView.SelectedIndex;
|
||||||
index -= 1;
|
index -= 1;
|
||||||
if (index < 0) index = 0;
|
|
||||||
|
if (index < 0)
|
||||||
|
index = 0;
|
||||||
|
|
||||||
ListView.SelectedIndex = index;
|
ListView.SelectedIndex = index;
|
||||||
ListView.ScrollIntoView(ListView.SelectedItem);
|
ListView.ScrollIntoView(ListView.SelectedItem);
|
||||||
}
|
}
|
||||||
@@ -76,7 +83,10 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
int index = ListView.SelectedIndex;
|
int index = ListView.SelectedIndex;
|
||||||
index += 1;
|
index += 1;
|
||||||
if (index > ListView.Items.Count - 1) index = ListView.Items.Count - 1;
|
|
||||||
|
if (index > ListView.Items.Count - 1)
|
||||||
|
index = ListView.Items.Count - 1;
|
||||||
|
|
||||||
ListView.SelectedIndex = index;
|
ListView.SelectedIndex = index;
|
||||||
ListView.ScrollIntoView(ListView.SelectedItem);
|
ListView.ScrollIntoView(ListView.SelectedItem);
|
||||||
}
|
}
|
||||||
@@ -100,12 +110,12 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListView_MouseUp(object sender, MouseButtonEventArgs e)
|
void ListView_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Execute();
|
Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
void FilterTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
CollectionView.Refresh();
|
CollectionView.Refresh();
|
||||||
SelectFirst();
|
SelectFirst();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace mpvnet
|
|||||||
SearchControl.Text = RegistryHelp.GetString(App.RegPath, "ConfigEditorSearch");
|
SearchControl.Text = RegistryHelp.GetString(App.RegPath, "ConfigEditorSearch");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadSettings()
|
void LoadSettings()
|
||||||
{
|
{
|
||||||
foreach (SettingBase setting in SettingsDefinitions)
|
foreach (SettingBase setting in SettingsDefinitions)
|
||||||
{
|
{
|
||||||
@@ -247,7 +247,7 @@ namespace mpvnet
|
|||||||
return "\r\n" + sb.ToString().Trim() + "\r\n";
|
return "\r\n" + sb.ToString().Trim() + "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
string activeFilter = "";
|
string activeFilter = "";
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ namespace mpvnet
|
|||||||
MainScrollViewer.ScrollToTop();
|
MainScrollViewer.ScrollToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConfWindow1_Loaded(object sender, RoutedEventArgs e)
|
void ConfWindow1_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SearchControl.SearchTextBox.SelectAll();
|
SearchControl.SearchTextBox.SelectAll();
|
||||||
Keyboard.Focus(SearchControl.SearchTextBox);
|
Keyboard.Focus(SearchControl.SearchTextBox);
|
||||||
@@ -284,27 +284,27 @@ namespace mpvnet
|
|||||||
i.Update();
|
i.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
void FilterListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.AddedItems.Count > 0) SearchControl.Text = e.AddedItems[0] + ":";
|
if (e.AddedItems.Count > 0) SearchControl.Text = e.AddedItems[0] + ":";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start(Path.GetDirectoryName(mp.ConfPath));
|
Process.Start(Path.GetDirectoryName(mp.ConfPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Msg.Show("mpv.conf Preview", GetContent("mpv"));
|
Msg.Show("mpv.conf Preview", GetContent("mpv"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start("https://mpv.io/manual/master/");
|
Process.Start("https://mpv.io/manual/master/");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SupportTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
void SupportTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start("https://github.com/stax76/mpv.net#Support");
|
Process.Start("https://github.com/stax76/mpv.net#Support");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace mpvnet
|
|||||||
[DllImport("Everything.dll")]
|
[DllImport("Everything.dll")]
|
||||||
public static extern UInt32 Everything_GetNumResults();
|
public static extern UInt32 Everything_GetNumResults();
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||||
source.AddHook(new HwndSourceHook(WndProc));
|
source.AddHook(new HwndSourceHook(WndProc));
|
||||||
@@ -56,7 +56,7 @@ namespace mpvnet
|
|||||||
ListView.SelectedIndex = 0;
|
ListView.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||||
{
|
{
|
||||||
if (msg == 0x200 /*WM_MOUSEMOVE*/ && Mouse.LeftButton != MouseButtonState.Pressed)
|
if (msg == 0x200 /*WM_MOUSEMOVE*/ && Mouse.LeftButton != MouseButtonState.Pressed)
|
||||||
handled = true;
|
handled = true;
|
||||||
@@ -64,7 +64,7 @@ namespace mpvnet
|
|||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
void FilterTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListView_PreviewKeyDown(object sender, KeyEventArgs e)
|
void ListView_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Escape)
|
if (e.Key == Key.Escape)
|
||||||
Close();
|
Close();
|
||||||
@@ -108,9 +108,9 @@ namespace mpvnet
|
|||||||
Keyboard.Focus(FilterTextBox);
|
Keyboard.Focus(FilterTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListView_MouseUp(object sender, MouseButtonEventArgs e) => Execute();
|
void ListView_MouseUp(object sender, MouseButtonEventArgs e) => Execute();
|
||||||
|
|
||||||
private void FilterTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
void FilterTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
string searchtext = FilterTextBox.Text;
|
string searchtext = FilterTextBox.Text;
|
||||||
Task.Run(() => Search(searchtext));
|
Task.Run(() => Search(searchtext));
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace mpvnet
|
|||||||
DataGrid.ItemsSource = CollectionView;
|
DataGrid.ItemsSource = CollectionView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
CollectionView.Refresh();
|
CollectionView.Refresh();
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ namespace mpvnet
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonClick(object sender, RoutedEventArgs e)
|
void ButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
CommandItem item = ((Button)e.Source).DataContext as CommandItem;
|
CommandItem item = ((Button)e.Source).DataContext as CommandItem;
|
||||||
if (item is null) return;
|
if (item is null) return;
|
||||||
@@ -88,7 +88,7 @@ namespace mpvnet
|
|||||||
items[i.Input] = i;
|
items[i.Input] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e) => Keyboard.Focus(SearchControl.SearchTextBox);
|
void Window_Loaded(object sender, RoutedEventArgs e) => Keyboard.Focus(SearchControl.SearchTextBox);
|
||||||
|
|
||||||
string GetInputConfContent()
|
string GetInputConfContent()
|
||||||
{
|
{
|
||||||
@@ -120,14 +120,14 @@ namespace mpvnet
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Closed(object sender, EventArgs e)
|
void Window_Closed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (InitialInputConfContent == GetInputConfContent()) return;
|
if (InitialInputConfContent == GetInputConfContent()) return;
|
||||||
File.WriteAllText(mp.InputConfPath, GetInputConfContent());
|
File.WriteAllText(mp.InputConfPath, GetInputConfContent());
|
||||||
Msg.Show("Changes will be available on next mpv.net startup.");
|
Msg.Show("Changes will be available on next mpv.net startup.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e)
|
void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
DataGrid grid = (DataGrid)sender;
|
DataGrid grid = (DataGrid)sender;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public LearnWindow() => InitializeComponent();
|
public LearnWindow() => InitializeComponent();
|
||||||
|
|
||||||
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||||
{
|
{
|
||||||
WinForms.Message m = new WinForms.Message();
|
WinForms.Message m = new WinForms.Message();
|
||||||
m.HWnd = hwnd;
|
m.HWnd = hwnd;
|
||||||
@@ -317,26 +317,26 @@ namespace mpvnet
|
|||||||
out uint lpChar,
|
out uint lpChar,
|
||||||
uint flags);
|
uint flags);
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||||
source.AddHook(new HwndSourceHook(WndProc));
|
source.AddHook(new HwndSourceHook(WndProc));
|
||||||
SetKey(InputItem.Input);
|
SetKey(InputItem.Input);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConfirmButton_Click(object sender, RoutedEventArgs e)
|
void ConfirmButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
InputItem.Input = NewKey;
|
InputItem.Input = NewKey;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearButton_Click(object sender, RoutedEventArgs e)
|
void ClearButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
InputItem.Input = "_";
|
InputItem.Input = "_";
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
|
void Window_MouseWheel(object sender, MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Delta > 0)
|
if (e.Delta > 0)
|
||||||
SetKey("WHEEL_UP");
|
SetKey("WHEEL_UP");
|
||||||
@@ -344,7 +344,7 @@ namespace mpvnet
|
|||||||
SetKey("WHEEL_DOWN");
|
SetKey("WHEEL_DOWN");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_MouseUp(object sender, MouseButtonEventArgs e)
|
void Window_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
switch (e.ChangedButton)
|
switch (e.ChangedButton)
|
||||||
{
|
{
|
||||||
@@ -368,7 +368,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
bool BlockMBTN_LEFT;
|
bool BlockMBTN_LEFT;
|
||||||
|
|
||||||
private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ChangedButton == MouseButton.Left)
|
if (e.ChangedButton == MouseButton.Left)
|
||||||
{
|
{
|
||||||
@@ -377,7 +377,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_TextInput(object sender, TextCompositionEventArgs e)
|
void Window_TextInput(object sender, TextCompositionEventArgs e)
|
||||||
{
|
{
|
||||||
KeyChar = e.Text;
|
KeyChar = e.Text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Windows;
|
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ namespace Controls
|
|||||||
|
|
||||||
public string Text { get => SearchTextBox.Text; set => SearchTextBox.Text = value; }
|
public string Text { get => SearchTextBox.Text; set => SearchTextBox.Text = value; }
|
||||||
|
|
||||||
private string _HintText;
|
string _HintText;
|
||||||
|
|
||||||
public string HintText {
|
public string HintText {
|
||||||
get => _HintText;
|
get => _HintText;
|
||||||
@@ -23,13 +24,13 @@ namespace Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchClearButton_Click(object sender, RoutedEventArgs e)
|
void SearchClearButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SearchTextBox.Text = "";
|
SearchTextBox.Text = "";
|
||||||
Keyboard.Focus(SearchTextBox);
|
Keyboard.Focus(SearchTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ namespace mpvnet
|
|||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterVideo_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("video");
|
void RegisterVideo_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("video");
|
||||||
private void RegisterAudio_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("audio");
|
void RegisterAudio_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("audio");
|
||||||
private void RegisterImage_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("image");
|
void RegisterImage_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("image");
|
||||||
|
|
||||||
private void UnregisterFileAssociations_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("unreg");
|
void UnregisterFileAssociations_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("unreg");
|
||||||
|
|
||||||
private void AddToPathEnvVar_Click(object sender, RoutedEventArgs e)
|
void AddToPathEnvVar_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string var = WinForms.Application.StartupPath + ";";
|
string var = WinForms.Application.StartupPath + ";";
|
||||||
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
||||||
@@ -47,7 +47,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveFromPathEnvVar_Click(object sender, RoutedEventArgs e)
|
void RemoveFromPathEnvVar_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string var = WinForms.Application.StartupPath + ";";
|
string var = WinForms.Application.StartupPath + ";";
|
||||||
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
Instance = this;
|
Instance = this;
|
||||||
Hwnd = Handle;
|
Hwnd = Handle;
|
||||||
|
ConsoleHelp.Padding = 60;
|
||||||
mp.Init();
|
mp.Init();
|
||||||
|
|
||||||
mp.Shutdown += Shutdown;
|
mp.Shutdown += Shutdown;
|
||||||
@@ -64,8 +65,8 @@ namespace mpvnet
|
|||||||
if (mp.GPUAPI != "vulkan")
|
if (mp.GPUAPI != "vulkan")
|
||||||
mp.ProcessCommandLine(false);
|
mp.ProcessCommandLine(false);
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) => Msg.ShowError(e.ExceptionObject.ToString());
|
AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject);
|
||||||
Application.ThreadException += (sender, e) => Msg.ShowException(e.Exception);
|
Application.ThreadException += (sender, e) => App.ShowException(e.Exception);
|
||||||
Msg.SupportURL = "https://github.com/stax76/mpv.net#support";
|
Msg.SupportURL = "https://github.com/stax76/mpv.net#support";
|
||||||
Text = "mpv.net " + Application.ProductVersion;
|
Text = "mpv.net " + Application.ProductVersion;
|
||||||
TaskbarButtonCreatedMessage = WinAPI.RegisterWindowMessage("TaskbarButtonCreated");
|
TaskbarButtonCreatedMessage = WinAPI.RegisterWindowMessage("TaskbarButtonCreated");
|
||||||
@@ -413,7 +414,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FileLoaded()
|
void FileLoaded()
|
||||||
{
|
{
|
||||||
string path = mp.get_property_string("path");
|
string path = mp.get_property_string("path");
|
||||||
|
|
||||||
@@ -572,9 +573,8 @@ namespace mpvnet
|
|||||||
CursorHelp.Hide();
|
CursorHelp.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProgressTimer_Tick(object sender, EventArgs e) => UpdateProgressBar();
|
void ProgressTimer_Tick(object sender, EventArgs e) => UpdateProgressBar();
|
||||||
|
|
||||||
// TODO: why is this in mainform?
|
|
||||||
void UpdateProgressBar()
|
void UpdateProgressBar()
|
||||||
{
|
{
|
||||||
if (mp.TaskbarProgress && Taskbar != null)
|
if (mp.TaskbarProgress && Taskbar != null)
|
||||||
@@ -686,6 +686,9 @@ namespace mpvnet
|
|||||||
|
|
||||||
if (!mp.ShutdownAutoResetEvent.WaitOne(10000))
|
if (!mp.ShutdownAutoResetEvent.WaitOne(10000))
|
||||||
Msg.ShowError("Shutdown thread failed to complete within 10 seconds.");
|
Msg.ShowError("Shutdown thread failed to complete within 10 seconds.");
|
||||||
|
|
||||||
|
//foreach (var i in PowerShell1.Instances)
|
||||||
|
// i.RS.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseDown(MouseEventArgs e)
|
protected override void OnMouseDown(MouseEventArgs e)
|
||||||
|
|||||||
@@ -118,6 +118,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Misc\App.cs" />
|
<Compile Include="Misc\App.cs" />
|
||||||
|
<Compile Include="Misc\Common.cs" />
|
||||||
<Compile Include="Misc\Extension.cs" />
|
<Compile Include="Misc\Extension.cs" />
|
||||||
<Content Include="..\License.txt">
|
<Content Include="..\License.txt">
|
||||||
<Link>License.txt</Link>
|
<Link>License.txt</Link>
|
||||||
@@ -155,6 +156,7 @@
|
|||||||
<Compile Include="Misc\UpdateCheck.cs" />
|
<Compile Include="Misc\UpdateCheck.cs" />
|
||||||
<Compile Include="Misc\RegistryHelp.cs" />
|
<Compile Include="Misc\RegistryHelp.cs" />
|
||||||
<Compile Include="Misc\Theme.cs" />
|
<Compile Include="Misc\Theme.cs" />
|
||||||
|
<Compile Include="Scripting\PowerShell.cs" />
|
||||||
<Compile Include="WPF\SearchTextBoxUserControl.xaml.cs">
|
<Compile Include="WPF\SearchTextBoxUserControl.xaml.cs">
|
||||||
<DependentUpon>SearchTextBoxUserControl.xaml</DependentUpon>
|
<DependentUpon>SearchTextBoxUserControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -172,7 +174,6 @@
|
|||||||
<Compile Include="WinForms\Menu.cs">
|
<Compile Include="WinForms\Menu.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Scripting\PowerShellScript.cs" />
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|||||||
@@ -13,10 +13,13 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
using ScriptHost;
|
||||||
|
|
||||||
using WinForms = System.Windows.Forms;
|
using WinForms = System.Windows.Forms;
|
||||||
|
|
||||||
using static libmpv;
|
using static libmpv;
|
||||||
using static WinAPI;
|
using static WinAPI;
|
||||||
|
using static Common;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -86,9 +89,9 @@ namespace mpvnet
|
|||||||
public static int Screen { get; set; } = -1;
|
public static int Screen { get; set; } = -1;
|
||||||
public static int Edition { get; set; }
|
public static int Edition { get; set; }
|
||||||
|
|
||||||
public static float Autofit { get; set; } = 0.5f;
|
public static float Autofit { get; set; } = 0.6f;
|
||||||
public static float AutofitSmaller { get; set; } = 0.4f;
|
public static float AutofitSmaller { get; set; } = 0.3f;
|
||||||
public static float AutofitLarger { get; set; } = 0.75f;
|
public static float AutofitLarger { get; set; } = 0.8f;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
@@ -253,7 +256,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string[] KnownScripts { get; } = { "osc-visibility.js", "show-playlist.js", "seek-show-position.py" };
|
public static string[] KnownScripts { get; } = { "show-playlist.js", "seek-show-position.py" };
|
||||||
|
|
||||||
public static void LoadScripts()
|
public static void LoadScripts()
|
||||||
{
|
{
|
||||||
@@ -264,21 +267,36 @@ namespace mpvnet
|
|||||||
if (KnownScripts.Contains(Path.GetFileName(scriptPath)))
|
if (KnownScripts.Contains(Path.GetFileName(scriptPath)))
|
||||||
{
|
{
|
||||||
if (scriptPath.EndsWith(".py"))
|
if (scriptPath.EndsWith(".py"))
|
||||||
Task.Run(() => PythonScripts.Add(new PythonScript(scriptPath)));
|
App.RunAction(() => PythonScripts.Add(new PythonScript(scriptPath)));
|
||||||
else if (scriptPath.EndsWith(".ps1"))
|
else if (scriptPath.EndsWith(".ps1"))
|
||||||
Task.Run(() => PowerShellScript.Init(scriptPath));
|
App.RunAction(() => InvokePowerShellScript(scriptPath));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Msg.ShowError("Failed to load script", scriptPath + "\n\nOnly scripts that ship with mpv.net are allowed in <startup>\\scripts\n\nUser scripts have to use <config folder>\\scripts\n\nNever copy or install a new mpv.net version over a old mpv.net version.");
|
Msg.ShowError("Failed to load script", scriptPath + BR + "Only scripts that ship with mpv.net are allowed in <startup>\\scripts\n\nUser scripts have to use <config folder>\\scripts\n\nNever copy or install a new mpv.net version over a old mpv.net version.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Directory.Exists(ConfigFolder + "scripts"))
|
if (Directory.Exists(ConfigFolder + "scripts"))
|
||||||
foreach (string scriptPath in Directory.GetFiles(ConfigFolder + "scripts"))
|
foreach (string scriptPath in Directory.GetFiles(ConfigFolder + "scripts"))
|
||||||
if (scriptPath.EndsWith(".py"))
|
if (scriptPath.EndsWith(".py"))
|
||||||
Task.Run(() => PythonScripts.Add(new PythonScript(scriptPath)));
|
App.RunAction(() => PythonScripts.Add(new PythonScript(scriptPath)));
|
||||||
else if (scriptPath.EndsWith(".ps1"))
|
else if (scriptPath.EndsWith(".ps1"))
|
||||||
Task.Run(() => PowerShellScript.Init(scriptPath));
|
App.RunAction(() => InvokePowerShellScript(scriptPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokePowerShellScript(string file)
|
||||||
|
{
|
||||||
|
PowerShell ps = new PowerShell();
|
||||||
|
ps.Scripts.Add("Using namespace mpvnet" + BR +
|
||||||
|
"[Reflection.Assembly]::LoadWithPartialName('mpvnet')" + BR);
|
||||||
|
ps.Scripts.Add(File.ReadAllText(file));
|
||||||
|
ps.Module = Path.GetFileName(file);
|
||||||
|
ps.Print = true;
|
||||||
|
|
||||||
|
lock (PowerShell.Instances)
|
||||||
|
PowerShell.Instances.Add(ps);
|
||||||
|
|
||||||
|
ps.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EventLoop()
|
public static void EventLoop()
|
||||||
@@ -626,10 +644,10 @@ namespace mpvnet
|
|||||||
if (throwException)
|
if (throwException)
|
||||||
{
|
{
|
||||||
foreach (string msg in messages)
|
foreach (string msg in messages)
|
||||||
ConsoleHelp.WriteError(msg);
|
ConsoleHelp.WriteError(msg, "mpv.net");
|
||||||
|
|
||||||
ConsoleHelp.WriteError(GetError(err));
|
ConsoleHelp.WriteError(GetError(err), "mpv.net");
|
||||||
throw new Exception(string.Join("\r\r", messages) + "\r\r"+ GetError(err));
|
throw new Exception(string.Join(BR2, messages) + BR2 + GetError(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,20 +655,30 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
var args = Environment.GetCommandLineArgs().Skip(1);
|
var args = Environment.GetCommandLineArgs().Skip(1);
|
||||||
|
|
||||||
//Msg.Show(string.Join("\n", args));
|
string[] preInitProperties = { "input-terminal", "terminal", "input-file", "config",
|
||||||
|
"config-dir", "input-conf", "load-scripts", "scripts", "player-operation-mode" };
|
||||||
string[] preInitProperties = { "input-terminal", "terminal", "input-file", "config", "config-dir", "input-conf", "load-scripts", "scripts", "player-operation-mode" };
|
|
||||||
|
|
||||||
foreach (string i in args)
|
foreach (string i in args)
|
||||||
{
|
{
|
||||||
string arg = i;
|
string arg = i;
|
||||||
|
|
||||||
if (arg.StartsWith("--"))
|
if (arg.StartsWith("-"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (!arg.StartsWith("--"))
|
||||||
|
arg = "-" + arg;
|
||||||
|
|
||||||
if (!arg.Contains("="))
|
if (!arg.Contains("="))
|
||||||
arg += "=yes";
|
{
|
||||||
|
if (arg.Contains("--no-"))
|
||||||
|
{
|
||||||
|
arg = arg.Replace("--no-", "--");
|
||||||
|
arg += "=no";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
arg += "=yes";
|
||||||
|
}
|
||||||
|
|
||||||
string left = arg.Substring(2, arg.IndexOf("=") - 2);
|
string left = arg.Substring(2, arg.IndexOf("=") - 2);
|
||||||
string right = arg.Substring(left.Length + 3);
|
string right = arg.Substring(left.Length + 3);
|
||||||
@@ -667,13 +695,10 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
else if (!preInit && !preInitProperties.Contains(left))
|
else if (!preInit && !preInitProperties.Contains(left))
|
||||||
{
|
{
|
||||||
if (!PrintCommandLineArgument(arg))
|
mp.ProcessProperty(left, right);
|
||||||
{
|
|
||||||
mp.ProcessProperty(left, right);
|
|
||||||
|
|
||||||
if (!App.ProcessProperty(left, right))
|
if (!App.ProcessProperty(left, right))
|
||||||
set_property_string(left, right, true);
|
set_property_string(left, right, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -707,22 +732,6 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool PrintCommandLineArgument(string argument)
|
|
||||||
{
|
|
||||||
switch (argument)
|
|
||||||
{
|
|
||||||
case "--list-properties=yes":
|
|
||||||
{
|
|
||||||
var list = get_property_string("property-list").Split(',').ToList();
|
|
||||||
list.Sort();
|
|
||||||
Console.WriteLine(string.Join("\n", list.ToArray()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DateTime LastLoad;
|
public static DateTime LastLoad;
|
||||||
|
|
||||||
public static void Load(string[] files, bool loadFolder, bool append)
|
public static void Load(string[] files, bool loadFolder, bool append)
|
||||||
|
|||||||
Reference in New Issue
Block a user