This commit is contained in:
Frank Skare
2019-04-24 23:59:34 +02:00
parent 3e70e8e5ea
commit 8f7aa7db2d
5 changed files with 31 additions and 18 deletions

View File

@@ -97,12 +97,15 @@ Examples:
### 3.2 (2019-0?-??) ### 3.2 (2019-0?-??)
- mpvInputEdit and mpvConfEdit were discontinued and merged into mpvnet - mpvInputEdit and mpvConfEdit were discontinued and merged into
- portable mode: in case no config folder exists mpvnet will ask where the config folder mpvnet because separate apps were to difficult to work with
should be created (portable or appdata) - portable mode: in case no config folder exists and the
startup folder has write access mpvnet will ask where
the config folder should be created (portable or appdata)
- there was an issue causing keys not working after a modal window was shown - there was an issue causing keys not working after a modal window was shown
- there was a crash when no script folder existed in the conf folder - there was a crash when no script folder existed in the conf folder
- MediaInfo and libmpv were updated - MediaInfo, youtube-dl and libmpv were updated
- a new JavaScript example script was added. [OSC always on for audio files](https://github.com/stax76/mpv.net/wiki/Scripting#osc-always-on-for-audio-files).
### 3.1 (2019-04-23) ### 3.1 (2019-04-23)

View File

@@ -536,7 +536,7 @@ namespace mpvnet
protected override void OnShown(EventArgs e) protected override void OnShown(EventArgs e)
{ {
base.OnShown(e); base.OnShown(e);
if ((MpvNetDarkMode == "system" && Misc.IsDarkTheme) || MpvNetDarkMode == "always") if ((MpvNetDarkMode == "system" && Sys.IsDarkTheme) || MpvNetDarkMode == "always")
ToolStripRendererEx.ColorTheme = Color.Black; ToolStripRendererEx.ColorTheme = Color.Black;
ContextMenu = new ContextMenuStripEx(components); ContextMenu = new ContextMenuStripEx(components);
ContextMenu.Opened += ContextMenu_Opened; ContextMenu.Opened += ContextMenu_Opened;
@@ -574,7 +574,7 @@ namespace mpvnet
{ {
RegistryHelp.SetValue("HKCU\\Software\\" + Application.ProductName, "LastYouTubeURL", clipboard); RegistryHelp.SetValue("HKCU\\Software\\" + Application.ProductName, "LastYouTubeURL", clipboard);
if (Msg.ShowQuestion("Play YouTube URL?") == MsgResult.OK) if (Msg.ShowQuestion("Play YouTube URL?", clipboard) == MsgResult.OK)
mp.LoadURL(clipboard); mp.LoadURL(clipboard);
} }
} }

View File

@@ -20,7 +20,10 @@ namespace mpvnet
public static string GetFilter(IEnumerable<string> values) => "*." + public static string GetFilter(IEnumerable<string> values) => "*." +
String.Join(";*.", values) + "|*." + String.Join(";*.", values) + "|All Files|*.*"; String.Join(";*.", values) + "|*." + String.Join(";*.", values) + "|All Files|*.*";
}
public class Sys
{
public static bool IsDarkTheme { public static bool IsDarkTheme {
get { get {
object value = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1); object value = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1);
@@ -28,6 +31,20 @@ namespace mpvnet
return (int)value == 0; return (int)value == 0;
} }
} }
public static bool IsDirectoryWritable(string dirPath)
{
try
{
using (FileStream fs = File.Create(Path.Combine(dirPath,
Path.GetRandomFileName()), 1, FileOptions.DeleteOnClose))
{ }
return true;
}
catch
{ }
return false;
}
} }
public class StringLogicalComparer : IComparer, IComparer<string> public class StringLogicalComparer : IComparer, IComparer<string>

View File

@@ -83,14 +83,6 @@ namespace mpvnet
private void Window_Closed(object sender, EventArgs e) private void Window_Closed(object sender, EventArgs e)
{ {
string backupDir = Path.GetDirectoryName(mp.InputConfPath) + "\\backup\\";
if (!Directory.Exists(backupDir))
Directory.CreateDirectory(backupDir);
if (File.Exists(mp.InputConfPath))
File.Copy(mp.InputConfPath, backupDir + "input conf " + DateTime.Now.ToString("yyyy-MM-dd HH-mm") + ".conf", true);
string text = Properties.Resources.inputConfHeader + "\r\n"; string text = Properties.Resources.inputConfHeader + "\r\n";
foreach (InputItem item in InputItem.InputItems) foreach (InputItem item in InputItem.InputItems)

View File

@@ -78,7 +78,8 @@ namespace mpvnet
string portableFolder = Application.StartupPath + "\\portable_config\\"; string portableFolder = Application.StartupPath + "\\portable_config\\";
string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\"; string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\";
if (!Directory.Exists(portableFolder) && !Directory.Exists(appdataFolder)) if (!Directory.Exists(appdataFolder) && !Directory.Exists(portableFolder) &&
Sys.IsDirectoryWritable(Application.StartupPath))
{ {
using (TaskDialog<string> td = new TaskDialog<string>()) using (TaskDialog<string> td = new TaskDialog<string>())
{ {
@@ -312,11 +313,11 @@ namespace mpvnet
break; break;
case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART: case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART:
PlaybackRestart?.Invoke(); PlaybackRestart?.Invoke();
Size s = new Size(get_property_int("dwidth"), get_property_int("dheight")); Size vidSize = new Size(get_property_int("dwidth"), get_property_int("dheight"));
if (VideoSize != s && s != Size.Empty) if (VideoSize != vidSize && vidSize != Size.Empty)
{ {
VideoSize = s; VideoSize = vidSize;
VideoSizeChanged?.Invoke(); VideoSizeChanged?.Invoke();
} }