#268 Fix exception using named pipes

This commit is contained in:
Frank Skare
2021-06-23 06:02:02 +02:00
parent 55f16d2c53
commit 1c23c10c81
9 changed files with 27 additions and 16 deletions

View File

@@ -364,7 +364,7 @@ namespace mpvnet
{
string path = Core.GetPropertyString("path");
if (File.Exists(path))
if (File.Exists(path) && !path.Contains(@"\\.\pipe\"))
{
using (MediaInfo mediaInfo = new MediaInfo(path))
{

View File

@@ -103,6 +103,7 @@ namespace mpvnet
public bool Fullscreen { get; set; }
public bool IsLogoVisible { set; get; } = true;
public bool IsQuitNeeded { set; get; } = true;
public bool KeepaspectWindow { get; set; }
public bool TaskbarProgress { get; set; } = true;
public bool WasInitialSizeSet;
public bool WindowMaximized { get; set; }
@@ -174,6 +175,7 @@ namespace mpvnet
case "fs":
case "fullscreen": Fullscreen = value == "yes"; break;
case "border": Border = value == "yes"; break;
case "keepaspect-window": KeepaspectWindow = value == "yes"; break;
case "window-maximized": WindowMaximized = value == "yes"; break;
case "window-minimized": WindowMinimized = value == "yes"; break;
case "taskbar-progress": TaskbarProgress = value == "yes"; break;
@@ -1336,7 +1338,7 @@ namespace mpvnet
}
}
}
else if (File.Exists(path))
else if (File.Exists(path) && !path.Contains(@"\\.\pipe\"))
{
using (MediaInfo mi = new MediaInfo(path))
{

View File

@@ -242,7 +242,6 @@ namespace mpvnet
public static IEnumerable<CommandPaletteItem> GetItems()
{
var aaa = CommandItem.Items.ToArray();
return CommandItem.Items
.Where(i => i.Command != "")
.Select(i => new CommandPaletteItem() {

View File

@@ -14,10 +14,12 @@ namespace mpvnet
public static Theme Current { get; set; }
public Brush Background { get; set; }
public Brush Foreground { get; set; }
public Brush Foreground2 { get; set; }
public Brush Background { get; set; }
public Brush Heading { get; set; }
public Brush MenuBackground { get; set; }
public Brush MenuHighlight { get; set; }
public System.Drawing.Color GetWinFormsColor(string key)
{
@@ -67,10 +69,12 @@ namespace mpvnet
if (Current == null)
Current = DefaultThemes[0];
Current.Background = Current.GetBrush("background");
Current.Foreground = Current.GetBrush("foreground");
Current.Foreground2 = Current.GetBrush("foreground2");
Current.Background = Current.GetBrush("background");
Current.Heading = Current.GetBrush("heading");
Current.MenuBackground = Current.GetBrush("menu-background");
Current.MenuHighlight = Current.GetBrush("menu-highlight");
}
static List<Theme> Load(string content)

View File

@@ -34,7 +34,7 @@ namespace mpvnet
if (!match.Success)
{
App.ShowError("Update check is currently not available.");
App.InvokeOnMainThread(() => App.ShowError("Update check is currently not available."));
return;
}
@@ -44,7 +44,7 @@ namespace mpvnet
if (onlineVersion <= currentVersion)
{
if (showUpToDateMessage)
Msg.ShowInfo($"{Application.ProductName} is up to date.");
App.InvokeOnMainThread(() => Msg.ShowInfo($"{Application.ProductName} is up to date."));
return;
}
@@ -60,7 +60,7 @@ namespace mpvnet
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
proc.StartInfo.FileName = "powershell.exe";
proc.StartInfo.Arguments = $"-NoExit -ExecutionPolicy Bypass -File \"{Folder.Startup + "Setup\\update.ps1"}\" \"{url}\" \"{Folder.Startup.TrimEnd(Path.DirectorySeparatorChar)}\"";
proc.StartInfo.Arguments = $"-NoExit -NoProfile -ExecutionPolicy Bypass -File \"{Folder.Startup + "Setup\\update.ps1"}\" \"{url}\" \"{Folder.Startup.TrimEnd(Path.DirectorySeparatorChar)}\"";
if (Folder.Startup.Contains("Program Files"))
proc.StartInfo.Verb = "runas";