Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
stax76 committed Jun 22, 2019
1 parent c0a8e89 commit e5c9df3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 4.3.1

- there was a old bug setting the screen property

### 4.3

- there was new bug in file association feature
Expand Down
27 changes: 27 additions & 0 deletions mpv.net/Misc/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
Expand All @@ -12,6 +13,7 @@
using System.Windows.Forms;

using Microsoft.Win32;
using VB = Microsoft.VisualBasic;

namespace mpvnet
{
Expand All @@ -28,6 +30,8 @@ public class App
public static string DarkMode { get; set; } = "always";
public static string ProcessInstance { get; set; } = "single";

public static bool DebugMode { get; set; } = false;

public static bool IsDarkMode {
get => (DarkMode == "system" && Sys.IsDarkTheme) || DarkMode == "always";
}
Expand All @@ -36,6 +40,28 @@ public static void Init()
{
foreach (var i in Conf)
ProcessProperty(i.Key, i.Value);

if (App.DebugMode)
{
try
{
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\mpvnet-debug.log";
if (File.Exists(filePath)) File.Delete(filePath);
Trace.Listeners.Clear();
Trace.Listeners.Add(new TextWriterTraceListener(filePath));
foreach (Screen screen in Screen.AllScreens)
Trace.WriteLine(screen);
}
catch (Exception e)
{
Msg.ShowException(e);
}
}
}

public static void Exit()
{
if (Trace.Listeners.Count > 0) Trace.Listeners[0].Close();
}

static Dictionary<string, string> _Conf;
Expand All @@ -62,6 +88,7 @@ public static void ProcessProperty(string name, string value)
case "clipboard-monitoring": ClipboardMonitoring = value; break;
case "process-instance": ProcessInstance = value; break;
case "dark-mode": DarkMode = value; break;
case "debug-mode": DebugMode = value == "yes"; break;
}
}

Expand Down
4 changes: 2 additions & 2 deletions mpv.net/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.3.0.0")]
[assembly: AssemblyFileVersion("4.3.0.0")]
[assembly: AssemblyVersion("4.3.1.0")]
[assembly: AssemblyFileVersion("4.3.1.0")]
2 changes: 1 addition & 1 deletion mpv.net/Resources/mpvConfToml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ help = "See sub-color. Color used for sub text background. You can use sub-shado
name = "screen"
default = ""
filter = "Screen"
help = "In multi-monitor configurations (i.e. a single desktop that spans across multiple displays), this option tells mpv which screen to display the video on."
help = "<0-32> In multi-monitor configurations (i.e. a single desktop that spans across multiple displays), this option tells mpv which screen to display the video on."

[[settings]]
name = "osd-playing-msg"
Expand Down
10 changes: 9 additions & 1 deletion mpv.net/Resources/mpvNetConfToml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ filter = "mpv.net"
help = "Defines if more then one mpv.net process is allowed."
options = [{ name = "multi", help = "Create a new process everytime the shell starts mpv.net" },
{ name = "single", help = "Force a single process everytime the shell starts mpv.net" },
{ name = "queue", help = "Force a single process and add files to playlist" }]
{ name = "queue", help = "Force a single process and add files to playlist" }]

[[settings]]
name = "debug-mode"
default = "no"
filter = "mpv.net"
help = "Writes debug info to a file located on the desktop."
options = [{ name = "yes" },
{ name = "no" }]
6 changes: 1 addition & 5 deletions mpv.net/WinForms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ public MainForm()

var dummy = mp.Conf;
App.ProcessCommandLineEarly();

if (mp.Screen == -1) mp.Screen = Array.IndexOf(Screen.AllScreens, Screen.PrimaryScreen);
SetScreen(mp.Screen);

ChangeFullscreen(mp.Fullscreen);
}
catch (Exception ex)
Expand Down Expand Up @@ -224,9 +222,6 @@ void SetFormPositionAndSizeKeepHeight()
int left = middlePos.X - rect.Width / 2;
int top = middlePos.Y - rect.Height / 2;
Screen[] screens = Screen.AllScreens;
if (left < screens[0].Bounds.Left) left = screens[0].Bounds.Left;
int maxLeft = screens[0].Bounds.Left + screens.Select((sc) => sc.Bounds.Width).Sum() - rect.Width - SystemInformation.CaptionHeight;
if (left > maxLeft) left = maxLeft;
Native.SetWindowPos(Handle, IntPtr.Zero /* HWND_TOP */, left, top, rect.Width, rect.Height, 4 /* SWP_NOZORDER */);
}

Expand Down Expand Up @@ -505,6 +500,7 @@ protected override void OnFormClosed(FormClosedEventArgs e)
{
base.OnFormClosed(e);
RegistryHelp.SetObject(App.RegPath, "Recent", RecentFiles.ToArray());
App.Exit();
mp.commandv("quit");
mp.AutoResetEvent.WaitOne(3000);
}
Expand Down

0 comments on commit e5c9df3

Please sign in to comment.