diff --git a/Changelog.md b/Changelog.md index 2b89d77..7a2fa57 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,10 +2,11 @@ 5.4.8.7 Beta (202?-??-??) ========================= -- history feature can be configured to ingore defined strings: +- History feature can be configured to ingore defined strings: script-opt = history-discard=value1;value2 - Web stream audio and subtitle track selection. -- On Windows 10 the default code page was changed to UTF8. +- On Windows 10 1903 and later the default code page was changed to UTF8. +- Support of --version command. 5.4.8.6 Beta (2020-12-24) diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index 2448c90..69f9992 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -12,7 +12,7 @@ namespace mpvnet { public static class App { - public static string[] VideoTypes { get; } = "264 265 asf avc avi avs dav flv h264 h265 hevc m2ts m2v m4v mkv mov mp4 mpeg mpg mpv mts ts vob vpy webm wmv y4m".Split(' '); + public static string[] VideoTypes { get; } = "264 265 asf avc avi avs dav flv h264 h265 hevc m2t m2ts m2v m4v mkv mov mp4 mpeg mpg mpv mts ts vob vpy webm wmv y4m".Split(' '); public static string[] AudioTypes { get; } = "mp3 mp2 ac3 ogg opus flac wav w64 m4a dts dtsma dtshr dtshd eac3 thd thd+ac3 mka aac mpa".Split(' '); public static string[] ImageTypes { get; } = { "jpg", "bmp", "gif", "png" }; public static string[] SubtitleTypes { get; } = { "srt", "ass", "idx", "sup", "ttxt", "ssa", "smi" }; @@ -99,6 +99,14 @@ namespace mpvnet }); } + public static string Version { + get { + return "Copyright (C) 2000-2020 mpv.net/mpv/mplayer\n" + + $"mpv.net {Application.ProductVersion} ({File.GetLastWriteTime(Application.ExecutablePath).ToShortDateString()})\n" + + $"{core.get_property_string("mpv-version")} ({File.GetLastWriteTime(Folder.Startup + "mpv-1.dll").ToShortDateString()})\nffmpeg {core.get_property_string("ffmpeg-version")}\nMIT License"; + } + } + public static void ShowException(object obj) { if (obj is Exception e) diff --git a/mpv.net/Misc/Commands.cs b/mpv.net/Misc/Commands.cs index a5dafbd..02de038 100644 --- a/mpv.net/Misc/Commands.cs +++ b/mpv.net/Misc/Commands.cs @@ -1,6 +1,5 @@  using System; -using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; diff --git a/mpv.net/Misc/PowerShell.cs b/mpv.net/Misc/PowerShell.cs index d88124d..7239604 100644 --- a/mpv.net/Misc/PowerShell.cs +++ b/mpv.net/Misc/PowerShell.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Threading; -using System.Threading.Tasks; using static mpvnet.Core; using static NewLine; diff --git a/mpv.net/WPF/AboutWindow.xaml.cs b/mpv.net/WPF/AboutWindow.xaml.cs index d711b09..13fd5ac 100644 --- a/mpv.net/WPF/AboutWindow.xaml.cs +++ b/mpv.net/WPF/AboutWindow.xaml.cs @@ -1,10 +1,7 @@  -using System.IO; using System.Windows; using System.Windows.Input; -using static mpvnet.Core; - namespace mpvnet { public partial class AboutWindow : Window @@ -12,9 +9,7 @@ namespace mpvnet public AboutWindow() { InitializeComponent(); - ContentBlock.Text= "Copyright (C) 2017-2020 Frank Skare (stax76)\n" + - $"mpv.net {System.Windows.Forms.Application.ProductVersion} ({File.GetLastWriteTime(System.Windows.Forms.Application.ExecutablePath).ToShortDateString()})\n" + - $"{core.get_property_string("mpv-version")} ({File.GetLastWriteTime(Folder.Startup + "mpv-1.dll").ToShortDateString()})\nffmpeg {core.get_property_string("ffmpeg-version")}\nMIT License"; + ContentBlock.Text = App.Version; } protected override void OnPreviewKeyDown(KeyEventArgs e) => Close(); diff --git a/mpv.net/mpv/Core.cs b/mpv.net/mpv/Core.cs index dfcc20f..46e574d 100644 --- a/mpv.net/mpv/Core.cs +++ b/mpv.net/mpv/Core.cs @@ -1,7 +1,6 @@  using System; using System.Collections.Generic; -using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; @@ -9,7 +8,6 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; using static libmpv; @@ -956,25 +954,33 @@ namespace mpvnet { try { - if (arg == "--profile=help") + if (!preInit) { - ConsoleHelp.Write(mpvHelp.GetProfiles(), null); - continue; - } - else if (arg == "--vd=help" || arg == "--ad=help") - { - ConsoleHelp.Write(mpvHelp.GetDecoders(), null); - continue; - } - else if (arg == "--audio-device=help") - { - ConsoleHelp.Write(core.get_property_osd_string("audio-device-list"), null); - continue; - } - else if (arg == "--input-keylist") - { - ConsoleHelp.Write(core.get_property_string("input-key-list").Replace(",", BR), null); - continue; + if (arg == "--profile=help") + { + Console.WriteLine(mpvHelp.GetProfiles()); + continue; + } + else if (arg == "--vd=help" || arg == "--ad=help") + { + Console.WriteLine(mpvHelp.GetDecoders()); + continue; + } + else if (arg == "--audio-device=help") + { + Console.WriteLine(core.get_property_osd_string("audio-device-list")); + continue; + } + else if (arg == "--version") + { + Console.WriteLine(App.Version); + continue; + } + else if (arg == "--input-keylist") + { + Console.WriteLine(core.get_property_string("input-key-list").Replace(",", BR)); + continue; + } } if (!arg.StartsWith("--"))