fix issue with clipboard url detection
This commit is contained in:
@@ -35,8 +35,8 @@ namespace RatingExtension // the assembly name must end with 'Extension'
|
|||||||
string basename = Path.GetFileNameWithoutExtension(filepath);
|
string basename = Path.GetFileNameWithoutExtension(filepath);
|
||||||
|
|
||||||
for (int x = 0; x < 6; x++)
|
for (int x = 0; x < 6; x++)
|
||||||
if (basename.Contains(" (" + x.ToString() + "stars)"))
|
if (basename.Contains(" (" + x + "stars)"))
|
||||||
basename = basename.Replace(" (" + x.ToString() + "stars)", "");
|
basename = basename.Replace(" (" + x + "stars)", "");
|
||||||
|
|
||||||
basename += $" ({rating}stars)";
|
basename += $" ({rating}stars)";
|
||||||
string newPath = Path.Combine(Path.GetDirectoryName(filepath), basename + Path.GetExtension(filepath));
|
string newPath = Path.Combine(Path.GetDirectoryName(filepath), basename + Path.GetExtension(filepath));
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ namespace mpvnet
|
|||||||
$"{width} x {height}\n";
|
$"{width} x {height}\n";
|
||||||
|
|
||||||
if (fileSize > 0)
|
if (fileSize > 0)
|
||||||
text += Convert.ToInt32(fileSize / 1024.0 / 1024.0).ToString() + " MB\n";
|
text += Convert.ToInt32(fileSize / 1024.0 / 1024.0) + " MB\n";
|
||||||
|
|
||||||
text += $"{videoFormat}\n{audioCodec}";
|
text += $"{videoFormat}\n{audioCodec}";
|
||||||
|
|
||||||
|
|||||||
@@ -50,23 +50,23 @@ public class Msg
|
|||||||
td.Show();
|
td.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.GetType().Name + "\n\n" + ex.Message + "\n\n" + ex.ToString(),
|
MessageBox.Show(e.GetType().Name + "\n\n" + e.Message + "\n\n" + e,
|
||||||
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowException(Exception e)
|
public static void ShowException(Exception exception)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (TaskDialog<string> td = new TaskDialog<string>())
|
using (TaskDialog<string> td = new TaskDialog<string>())
|
||||||
{
|
{
|
||||||
td.MainInstruction = e.GetType().Name;
|
td.MainInstruction = exception.GetType().Name;
|
||||||
td.Content = e.Message;
|
td.Content = exception.Message;
|
||||||
td.MainIcon = MsgIcon.Error;
|
td.MainIcon = MsgIcon.Error;
|
||||||
td.ExpandedInformation = e.ToString();
|
td.ExpandedInformation = exception.ToString();
|
||||||
td.Footer = "[Copy Message](copymsg)";
|
td.Footer = "[Copy Message](copymsg)";
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Msg.SupportURL))
|
if (!string.IsNullOrEmpty(Msg.SupportURL))
|
||||||
@@ -75,9 +75,9 @@ public class Msg
|
|||||||
td.Show();
|
td.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.GetType().Name + "\n\n" + ex.Message + "\n\n" + ex.ToString(),
|
MessageBox.Show(e.GetType().Name + "\n\n" + e.Message + "\n\n" + e,
|
||||||
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,9 +144,9 @@ public class Msg
|
|||||||
return td.Show();
|
return td.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return (MsgResult)MessageBox.Show(ex.GetType().Name + "\n\n" + ex.Message + "\n\n" + ex.ToString(),
|
return (MsgResult)MessageBox.Show(e.GetType().Name + "\n\n" + e.Message + "\n\n" + e,
|
||||||
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,6 +235,7 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
|
|||||||
|
|
||||||
if (Path.GetFileName(lpszFileName.ToString().Replace(".vshost", "")) ==
|
if (Path.GetFileName(lpszFileName.ToString().Replace(".vshost", "")) ==
|
||||||
Path.GetFileName(Assembly.GetEntryAssembly().Location))
|
Path.GetFileName(Assembly.GetEntryAssembly().Location))
|
||||||
|
|
||||||
return foregroundWindow;
|
return foregroundWindow;
|
||||||
|
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
|
|||||||
@@ -200,8 +200,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
private void FilterListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void FilterListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.AddedItems.Count > 0)
|
if (e.AddedItems.Count > 0) SearchControl.Text = e.AddedItems[0] + ":";
|
||||||
SearchControl.Text = e.AddedItems[0].ToString() + ":"; // TODO: remove ToString()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
private void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace mpvnet
|
|||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 13; i++)
|
||||||
if ("D" + i.ToString() == text)
|
if ("D" + i == text)
|
||||||
text = text.Substring(1);
|
text = text.Substring(1);
|
||||||
|
|
||||||
switch (e.KeyCode)
|
switch (e.KeyCode)
|
||||||
@@ -59,7 +59,7 @@ namespace mpvnet
|
|||||||
case WF.Keys.NumPad7:
|
case WF.Keys.NumPad7:
|
||||||
case WF.Keys.NumPad8:
|
case WF.Keys.NumPad8:
|
||||||
case WF.Keys.NumPad9:
|
case WF.Keys.NumPad9:
|
||||||
text = "KP" + e.KeyCode.ToString()[6].ToString(); break;
|
text = "KP" + e.KeyCode.ToString()[6]; break;
|
||||||
case WF.Keys.Space:
|
case WF.Keys.Space:
|
||||||
text = "Space"; break;
|
text = "Space"; break;
|
||||||
case WF.Keys.Enter:
|
case WF.Keys.Enter:
|
||||||
|
|||||||
@@ -571,7 +571,6 @@ namespace mpvnet
|
|||||||
ContextMenuStrip = ContextMenu;
|
ContextMenuStrip = ContextMenu;
|
||||||
WPF.WPF.Init();
|
WPF.WPF.Init();
|
||||||
System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
|
System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
|
||||||
CheckClipboardForURL();
|
|
||||||
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
|
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
|
||||||
WasShown = true;
|
WasShown = true;
|
||||||
mp.LoadScripts();
|
mp.LoadScripts();
|
||||||
@@ -660,10 +659,11 @@ namespace mpvnet
|
|||||||
!clipboard.Contains(" ") && clipboard.Contains(url.ToLower().Trim()) &&
|
!clipboard.Contains(" ") && clipboard.Contains(url.ToLower().Trim()) &&
|
||||||
RegHelp.GetString(App.RegPath, "LastURL") != clipboard && Visible)
|
RegHelp.GetString(App.RegPath, "LastURL") != clipboard && Visible)
|
||||||
{
|
{
|
||||||
RegHelp.SetObject(App.RegPath, "LastURL", clipboard);
|
|
||||||
|
|
||||||
if (Msg.ShowQuestion("Play URL?", clipboard) == MsgResult.OK)
|
if (Msg.ShowQuestion("Play URL?", clipboard) == MsgResult.OK)
|
||||||
mp.Load(new[] { clipboard }, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
mp.Load(new[] { clipboard }, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||||
|
|
||||||
|
RegHelp.SetObject(App.RegPath, "LastURL", clipboard);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -631,7 +631,6 @@ namespace mpvnet
|
|||||||
i.Contains(":\\") || i.StartsWith("\\\\") || File.Exists(i)))
|
i.Contains(":\\") || i.StartsWith("\\\\") || File.Exists(i)))
|
||||||
{
|
{
|
||||||
files.Add(i);
|
files.Add(i);
|
||||||
if (i.Contains("://")) RegHelp.SetObject(App.RegPath, "LastURL", i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user