new screenshot

This commit is contained in:
Frank Skare
2019-10-09 07:05:46 +02:00
parent 327a097bcf
commit f5e0c92824
5 changed files with 95 additions and 90 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@@ -66,7 +66,9 @@ namespace mpvnet
return; return;
} }
if (App.IsStartedFromTerminal) Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/); if (App.IsStartedFromTerminal)
Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/);
Application.Run(new MainForm()); Application.Run(new MainForm());
if (App.IsStartedFromTerminal) Native.FreeConsole(); if (App.IsStartedFromTerminal) Native.FreeConsole();
mutex.Dispose(); mutex.Dispose();

View File

@@ -10,7 +10,7 @@ public class MediaInfo : IDisposable
{ {
if (!Loaded) if (!Loaded)
{ {
if (LoadLibrary("MediaInfo.dll") == IntPtr.Zero) if (Native.LoadLibrary("MediaInfo.dll") == IntPtr.Zero)
throw new Exception("Failed to load MediaInfo.dll."); throw new Exception("Failed to load MediaInfo.dll.");
Loaded = true; Loaded = true;
@@ -56,21 +56,27 @@ public class MediaInfo : IDisposable
~MediaInfo() { Dispose(); } ~MediaInfo() { Dispose(); }
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)] [DllImport("kernel32.dll")]
static extern IntPtr LoadLibrary(string path); public static extern IntPtr LoadLibrary(string path);
[DllImport("MediaInfo.dll")] [DllImport("MediaInfo.dll")]
static extern IntPtr MediaInfo_New(); static extern IntPtr MediaInfo_New();
[DllImport("MediaInfo.dll")] [DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)]
static extern void MediaInfo_Delete(IntPtr handle); static extern int MediaInfo_Open(IntPtr handle, string path);
[DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)] [DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)]
static extern int MediaInfo_Open(IntPtr handle, string fileName); static extern IntPtr MediaInfo_Option(IntPtr handle, string optionString, string value);
[DllImport("MediaInfo.dll")]
static extern IntPtr MediaInfo_Inform(IntPtr handle, int reserved);
[DllImport("MediaInfo.dll")] [DllImport("MediaInfo.dll")]
static extern int MediaInfo_Close(IntPtr handle); static extern int MediaInfo_Close(IntPtr handle);
[DllImport("MediaInfo.dll")]
static extern void MediaInfo_Delete(IntPtr handle);
[DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)] [DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)]
static extern IntPtr MediaInfo_Get(IntPtr handle, static extern IntPtr MediaInfo_Get(IntPtr handle,
MediaInfoStreamKind streamKind, MediaInfoStreamKind streamKind,

View File

@@ -2,10 +2,8 @@
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace mpvnet public class Native
{ {
public class Native
{
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
public static extern bool AttachConsole(int dwProcessId); public static extern bool AttachConsole(int dwProcessId);
@@ -13,7 +11,7 @@ namespace mpvnet
public static extern bool FreeConsole(); public static extern bool FreeConsole();
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad); public static extern IntPtr LoadLibrary(string path);
[DllImport("user32.dll", CharSet = CharSet.Unicode)] [DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
@@ -94,5 +92,4 @@ namespace mpvnet
[MarshalAs(UnmanagedType.LPTStr)] [MarshalAs(UnmanagedType.LPTStr)]
public string lpData; public string lpData;
} }
}
} }

View File

@@ -16,7 +16,7 @@ using System.Windows.Forms;
using WinForms = System.Windows.Forms; using WinForms = System.Windows.Forms;
using static mpvnet.libmpv; using static mpvnet.libmpv;
using static mpvnet.Native; using static Native;
namespace mpvnet namespace mpvnet
{ {