crash fixed when PowerShell 5.1 is not available
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
5.4.4.4 Beta (not yet released)
|
||||
============
|
||||
|
||||
- with `border=no` the osc top bar window buttons min, max, close did not work.
|
||||
- some anamorphic videos were shown with black bars
|
||||
- crash fixed when PowerShell 5.1 is not available
|
||||
|
||||
|
||||
5.4.4.3 Beta
|
||||
============
|
||||
|
||||
10
Manual.md
10
Manual.md
@@ -21,7 +21,7 @@ Table of contents
|
||||
* [Extensions](#extensions)
|
||||
* [Color Theme](#color-theme)
|
||||
* [Hidden and secret features](#hidden-and-secret-features)
|
||||
* [Limitations](#limitations)
|
||||
* [Differences](#differences)
|
||||
* [Context Menu](#context-menu)
|
||||
+ [Open > Open Files](#open--open-files)
|
||||
+ [Open > Open URL](#open--open-url)
|
||||
@@ -181,7 +181,7 @@ input.conf file, if it's missing mpv.net generates it with the following default
|
||||
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt>
|
||||
|
||||
mpv.net supports almost all mpv settings and features,
|
||||
[limitations are described in the manual](manual.md#limitations).
|
||||
[limitations are described in the manual](manual.md#differences).
|
||||
|
||||
The config folder can be opened from the context menu.
|
||||
|
||||
@@ -349,7 +349,7 @@ Whenever the control key is pressed when files or URLs are opened, the playlist
|
||||
Pressing the shift key while opening a single file will suppress loading all files in the folder.
|
||||
|
||||
|
||||
Limitations
|
||||
Differences
|
||||
-----------
|
||||
|
||||
mpv.net was designed to work exactly like mpv, there are few limitations:
|
||||
@@ -378,7 +378,9 @@ mpv.net has currently implemented the following window related features:
|
||||
|
||||
[autofit-larger](https://mpv.io/manual/master/#options-autofit-larger) (only partly implemented)
|
||||
|
||||
[window-maximized](https://mpv.io/manual/master/#options-window-maximized) (don't use input.conf, use Win+Up, Win+Down instead)
|
||||
[window-maximized](https://mpv.io/manual/master/#options-window-maximized) (only partly implemented, use Win+Up and Win+Down)
|
||||
|
||||
[window-minimized](https://mpv.io/manual/master/#options-window-minimized) (only partly implemented, use Win+Up and Win+Down)
|
||||
|
||||
|
||||
### Command Line Limitations
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace mpvnet
|
||||
InvokeOnMainThread(new Action(() => {
|
||||
using (var d = new OpenFileDialog() { Multiselect = true })
|
||||
if (d.ShowDialog() == DialogResult.OK)
|
||||
mp.Load(d.FileNames, loadFolder, append);
|
||||
mp.LoadFiles(d.FileNames, loadFolder, append);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -96,12 +96,12 @@ namespace mpvnet
|
||||
if (Directory.Exists(d.SelectedPath + "\\BDMV"))
|
||||
{
|
||||
mp.set_property_string("bluray-device", d.SelectedPath);
|
||||
mp.Load(new[] { @"bd://" }, false, false);
|
||||
mp.LoadFiles(new[] { @"bd://" }, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
mp.set_property_string("dvd-device", d.SelectedPath);
|
||||
mp.Load(new[] { @"dvd://" }, false, false);
|
||||
mp.LoadFiles(new[] { @"dvd://" }, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,7 @@ namespace mpvnet
|
||||
Msg.ShowError("The clipboard does not contain a valid URL or file, URLs have to contain :// and are not allowed to contain a newline character.");
|
||||
return;
|
||||
}
|
||||
mp.Load(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
mp.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace mpvnet
|
||||
void Execute()
|
||||
{
|
||||
if (ListView.SelectedItem != null)
|
||||
mp.Load(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control);
|
||||
mp.LoadFiles(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control);
|
||||
|
||||
Keyboard.Focus(FilterTextBox);
|
||||
}
|
||||
|
||||
@@ -24,10 +24,11 @@ namespace mpvnet
|
||||
Point LastCursorPosChanged;
|
||||
int LastCursorChangedTickCount;
|
||||
int TaskbarButtonCreatedMessage;
|
||||
int ShownTickCount;
|
||||
DateTime LastCycleFullscreen;
|
||||
Taskbar Taskbar;
|
||||
List<string> RecentFiles;
|
||||
int ShownTickCount;
|
||||
bool WasMaximized;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
@@ -54,6 +55,7 @@ namespace mpvnet
|
||||
mp.Seek += () => UpdateProgressBar();
|
||||
|
||||
mp.observe_property_bool("window-maximized", PropChangeWindowMaximized);
|
||||
mp.observe_property_bool("window-minimized", PropChangeWindowMinimized);
|
||||
mp.observe_property_bool("pause", PropChangePause);
|
||||
mp.observe_property_bool("fullscreen", PropChangeFullscreen);
|
||||
mp.observe_property_bool("ontop", PropChangeOnTop);
|
||||
@@ -141,7 +143,12 @@ namespace mpvnet
|
||||
bool IsMouseInOSC()
|
||||
{
|
||||
Point pos = PointToClient(Control.MousePosition);
|
||||
return pos.Y > ClientSize.Height * 0.9 || pos.Y < ClientSize.Height * 0.05;
|
||||
float top = 0;
|
||||
|
||||
if (FormBorderStyle == FormBorderStyle.None)
|
||||
top = ClientSize.Height * 0.1f;
|
||||
|
||||
return pos.Y > ClientSize.Height * 0.85 || pos.Y < top;
|
||||
}
|
||||
|
||||
void ContextMenu_Opening(object sender, CancelEventArgs e)
|
||||
@@ -235,7 +242,7 @@ namespace mpvnet
|
||||
recent.DropDownItems.Clear();
|
||||
|
||||
foreach (string path in RecentFiles)
|
||||
MenuItem.Add(recent.DropDownItems, path, () => mp.Load(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control)));
|
||||
MenuItem.Add(recent.DropDownItems, path, () => mp.LoadFiles(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control)));
|
||||
|
||||
recent.DropDownItems.Add(new ToolStripSeparator());
|
||||
MenuItem mi = new MenuItem("Clear List");
|
||||
@@ -554,7 +561,7 @@ namespace mpvnet
|
||||
switch (mode)
|
||||
{
|
||||
case "single":
|
||||
mp.Load(files, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
mp.LoadFiles(files, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
break;
|
||||
case "queue":
|
||||
foreach (string file in files)
|
||||
@@ -633,6 +640,20 @@ namespace mpvnet
|
||||
}));
|
||||
}
|
||||
|
||||
void PropChangeWindowMinimized(bool enabled)
|
||||
{
|
||||
if (!WasShown())
|
||||
return;
|
||||
|
||||
BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (enabled && WindowState != FormWindowState.Minimized)
|
||||
WindowState = FormWindowState.Minimized;
|
||||
else if (!enabled && WindowState == FormWindowState.Minimized)
|
||||
WindowState = FormWindowState.Normal;
|
||||
}));
|
||||
}
|
||||
|
||||
void PropChangeBorder(bool enabled) {
|
||||
mp.Border = enabled;
|
||||
|
||||
@@ -707,8 +728,6 @@ namespace mpvnet
|
||||
WasMaximized = false;
|
||||
}
|
||||
|
||||
bool WasMaximized;
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
base.OnFormClosing(e);
|
||||
@@ -724,8 +743,10 @@ namespace mpvnet
|
||||
if (!mp.ShutdownAutoResetEvent.WaitOne(10000))
|
||||
Msg.ShowError("Shutdown thread failed to complete within 10 seconds.");
|
||||
|
||||
foreach (PowerShell ps in PowerShell.Instances)
|
||||
ps.Runspace.Dispose();
|
||||
try { // PowerShell 5.1 might not be available
|
||||
foreach (PowerShell ps in PowerShell.Instances)
|
||||
ps.Runspace.Dispose();
|
||||
} catch {}
|
||||
}
|
||||
|
||||
void SaveWindowProperties()
|
||||
@@ -743,8 +764,7 @@ namespace mpvnet
|
||||
base.OnMouseDown(e);
|
||||
|
||||
if (WindowState == FormWindowState.Normal &&
|
||||
e.Button == MouseButtons.Left &&
|
||||
e.Y < ClientSize.Height * 0.9)
|
||||
e.Button == MouseButtons.Left && !IsMouseInOSC())
|
||||
{
|
||||
var HTCAPTION = new IntPtr(2);
|
||||
WinAPI.ReleaseCapture();
|
||||
@@ -768,10 +788,10 @@ namespace mpvnet
|
||||
base.OnDragDrop(e);
|
||||
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
mp.Load(e.Data.GetData(DataFormats.FileDrop) as String[], true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
mp.LoadFiles(e.Data.GetData(DataFormats.FileDrop) as String[], true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
|
||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
mp.Load(new[] { e.Data.GetData(DataFormats.Text).ToString() }, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
mp.LoadFiles(new[] { e.Data.GetData(DataFormats.Text).ToString() }, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
}
|
||||
|
||||
protected override void OnLostFocus(EventArgs e)
|
||||
|
||||
@@ -364,13 +364,14 @@ namespace mpvnet
|
||||
{
|
||||
HideLogo();
|
||||
Duration = TimeSpan.FromSeconds(get_property_number("duration"));
|
||||
Size vidSize = new Size(get_property_int("dwidth"), get_property_int("dheight"));
|
||||
Size size = new Size(get_property_int("width"), get_property_int("height"));
|
||||
|
||||
if (vidSize.Width == 0 || vidSize.Height == 0)
|
||||
vidSize = new Size(1, 1);
|
||||
if (VideoSize != vidSize)
|
||||
if (size.Width == 0 || size.Height == 0)
|
||||
size = new Size(1, 1);
|
||||
|
||||
if (VideoSize != size)
|
||||
{
|
||||
VideoSize = vidSize;
|
||||
VideoSize = size;
|
||||
VideoSizeChanged?.Invoke();
|
||||
}
|
||||
|
||||
@@ -384,7 +385,6 @@ namespace mpvnet
|
||||
WriteHistory(path);
|
||||
FileLoaded?.Invoke();
|
||||
}
|
||||
|
||||
break;
|
||||
case mpv_event_id.MPV_EVENT_TRACKS_CHANGED:
|
||||
TracksChanged?.Invoke();
|
||||
@@ -420,7 +420,16 @@ namespace mpvnet
|
||||
}
|
||||
break;
|
||||
case mpv_event_id.MPV_EVENT_VIDEO_RECONFIG:
|
||||
VideoReconfig?.Invoke();
|
||||
{
|
||||
VideoReconfig?.Invoke();
|
||||
Size size = new Size(get_property_int("dwidth"), get_property_int("dheight"));
|
||||
|
||||
if (size.Width != 0 && size.Height != 0 && VideoSize != size)
|
||||
{
|
||||
VideoSize = size;
|
||||
VideoSizeChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case mpv_event_id.MPV_EVENT_AUDIO_RECONFIG:
|
||||
AudioReconfig?.Invoke();
|
||||
@@ -740,7 +749,7 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
Load(files.ToArray(), !App.Queue, Control.ModifierKeys.HasFlag(Keys.Control) || App.Queue);
|
||||
LoadFiles(files.ToArray(), !App.Queue, Control.ModifierKeys.HasFlag(Keys.Control) || App.Queue);
|
||||
|
||||
if (files.Count == 0 || files[0].Contains("://"))
|
||||
{
|
||||
@@ -752,7 +761,7 @@ namespace mpvnet
|
||||
|
||||
public static DateTime LastLoad;
|
||||
|
||||
public static void Load(string[] files, bool loadFolder, bool append)
|
||||
public static void LoadFiles(string[] files, bool loadFolder, bool append)
|
||||
{
|
||||
if (files is null || files.Length == 0)
|
||||
return;
|
||||
@@ -765,13 +774,17 @@ namespace mpvnet
|
||||
LastLoad = DateTime.Now;
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
if (App.SubtitleTypes.Contains(files[i].ShortExt()))
|
||||
commandv("sub-add", files[i]);
|
||||
{
|
||||
string file = files[i];
|
||||
|
||||
if (App.SubtitleTypes.Contains(file.ShortExt()))
|
||||
commandv("sub-add", file);
|
||||
else
|
||||
if (i == 0 && !append)
|
||||
commandv("loadfile", files[i]);
|
||||
commandv("loadfile", file);
|
||||
else
|
||||
commandv("loadfile", files[i], "append");
|
||||
commandv("loadfile", file, "append");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(get_property_string("path")))
|
||||
set_property_int("playlist-pos", 0);
|
||||
|
||||
Reference in New Issue
Block a user