This commit is contained in:
Frank Skare
2019-06-27 02:43:17 +02:00
parent c8fe3a4c43
commit e7fd268927
5 changed files with 20 additions and 15 deletions

View File

@@ -1,3 +1,7 @@
###
- opening a URL manually no longer uses a input box but uses the clipboard directly
### 4.4
- clipboard-monitoring was replaced by url-whitelist:

View File

@@ -14,11 +14,11 @@ namespace RatingAddon
public RatingAddon()
{
mp.ClientMessage += mpv_ClientMessage;
mp.Shutdown += mpv_Shutdown;
mp.ClientMessage += ClientMessage;
mp.Shutdown += Shutdown;
}
void mpv_Shutdown()
void Shutdown()
{
foreach (var i in Dic)
{
@@ -44,11 +44,9 @@ namespace RatingAddon
}
}
void mpv_ClientMessage(string[] args)
void ClientMessage(string[] args)
{
if (args == null ||
args.Length != 2 ||
args[0] != "rate-file" ||
if (args == null || args.Length != 2 || args[0] != "rate-file" ||
! int.TryParse(args[1], out int rating))
return;

View File

@@ -218,9 +218,13 @@ namespace mpvnet
public static void open_url(string[] args)
{
MainForm.Instance.Invoke(new Action(() => {
string command = VB.Interaction.InputBox("Enter URL to be opened.");
if (string.IsNullOrEmpty(command)) return;
mp.Load(new [] { command }, false, Control.ModifierKeys.HasFlag(Keys.Control));
string clipboard = Clipboard.GetText();
if (string.IsNullOrEmpty(clipboard) || !clipboard.Contains("://") || clipboard.Contains("\n") || clipboard.Contains(" "))
{
Msg.ShowError("The clipboard does not contain a valid URL, it has to contain :// and is not allowed to contain a newline or space character.");
return;
}
mp.Load(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control));
}));
}

View File

@@ -534,7 +534,7 @@ namespace mpvnet
foreach (string url in App.UrlWhitelist)
{
if (clipboard.Contains("://") && ! clipboard.Contains("\n") &&
clipboard.Contains(url.ToLower()) &&
! clipboard.Contains(" ") && clipboard.Contains(url.ToLower()) &&
RegHelp.GetString(App.RegPath, "LastURL") != clipboard && Visible)
{
RegHelp.SetObject(App.RegPath, "LastURL", clipboard);

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
@@ -213,7 +212,7 @@ namespace mpvnet
if (WindowHandle == IntPtr.Zero)
WindowHandle = FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
//Debug.WriteLine(evt.event_id.ToString());
//System.Diagnostics.Debug.WriteLine(evt.event_id.ToString());
try
{