improved setup dialog
This commit is contained in:
@@ -4,8 +4,9 @@
|
|||||||
|
|
||||||
- Load AviSynth DLL from environment variable AviSynthDLL
|
- Load AviSynth DLL from environment variable AviSynthDLL
|
||||||
in order to support AviSynth portable mode.
|
in order to support AviSynth portable mode.
|
||||||
- New option global-media-keys (next, previous, play/pause, stop)
|
- New option global-media-keys (next, previous, play/pause, stop).
|
||||||
- libmpv shinshiro 2020-11-22
|
- Improved setup dialog.
|
||||||
|
- libmpv updated to shinshiro 2020-11-22.
|
||||||
|
|
||||||
|
|
||||||
5.4.8.4 Beta
|
5.4.8.4 Beta
|
||||||
|
|||||||
@@ -6,6 +6,33 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
|
public static class ProcessHelp
|
||||||
|
{
|
||||||
|
public static void Execute(string file, string arguments = null)
|
||||||
|
{
|
||||||
|
using (Process proc = new Process())
|
||||||
|
{
|
||||||
|
proc.StartInfo.FileName = file;
|
||||||
|
proc.StartInfo.Arguments = arguments;
|
||||||
|
// default is true in .NET Framework and false in .NET Core
|
||||||
|
proc.StartInfo.UseShellExecute = false;
|
||||||
|
proc.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ShellExecute(string file, string arguments = null)
|
||||||
|
{
|
||||||
|
using (Process proc = new Process())
|
||||||
|
{
|
||||||
|
proc.StartInfo.FileName = file;
|
||||||
|
proc.StartInfo.Arguments = arguments;
|
||||||
|
// default is true in .NET Framework and false in .NET Core
|
||||||
|
proc.StartInfo.UseShellExecute = true;
|
||||||
|
proc.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class ConsoleHelp
|
public static class ConsoleHelp
|
||||||
{
|
{
|
||||||
public static int Padding { get; set; }
|
public static int Padding { get; set; }
|
||||||
|
|||||||
@@ -80,25 +80,6 @@ namespace mpvnet
|
|||||||
RegistryHelp.SetValue(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities\FileAssociations", "." + ext, ExeFilenameNoExt + "." + ext);
|
RegistryHelp.SetValue(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities\FileAssociations", "." + ext, ExeFilenameNoExt + "." + ext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Unregister()
|
|
||||||
{
|
|
||||||
RegistryHelp.RemoveKey($@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename);
|
|
||||||
RegistryHelp.RemoveKey($@"HKCR\Applications\" + ExeFilename);
|
|
||||||
RegistryHelp.RemoveKey($@"HKLM\SOFTWARE\Clients\Media\mpv.net");
|
|
||||||
RegistryHelp.RemoveKey($@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename);
|
|
||||||
RegistryHelp.RemoveKey($@"HKCR\SystemFileAssociations\audio\OpenWithList\" + ExeFilename);
|
|
||||||
RegistryHelp.RemoveValue(@"HKLM\SOFTWARE\RegisteredApplications", "mpv.net");
|
|
||||||
|
|
||||||
foreach (string id in Registry.ClassesRoot.GetSubKeyNames())
|
|
||||||
{
|
|
||||||
if (id.StartsWith(ExeFilenameNoExt + "."))
|
|
||||||
Registry.ClassesRoot.DeleteSubKeyTree(id);
|
|
||||||
|
|
||||||
RegistryHelp.RemoveValue($@"HKCR\Software\Classes\{id}\OpenWithProgIDs", ExeFilenameNoExt + id);
|
|
||||||
RegistryHelp.RemoveValue($@"HKLM\Software\Classes\{id}\OpenWithProgIDs", ExeFilenameNoExt + id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MediaTrack
|
public class MediaTrack
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ namespace mpvnet
|
|||||||
if (args[1] == "audio") FileAssociation.Register(App.AudioTypes);
|
if (args[1] == "audio") FileAssociation.Register(App.AudioTypes);
|
||||||
if (args[1] == "video") FileAssociation.Register(App.VideoTypes);
|
if (args[1] == "video") FileAssociation.Register(App.VideoTypes);
|
||||||
if (args[1] == "image") FileAssociation.Register(App.ImageTypes);
|
if (args[1] == "image") FileAssociation.Register(App.ImageTypes);
|
||||||
if (args[1] == "unreg") FileAssociation.Unregister();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -55,7 +56,7 @@ namespace mpvnet
|
|||||||
proc.StartInfo.UseShellExecute = true;
|
proc.StartInfo.UseShellExecute = true;
|
||||||
proc.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
proc.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||||
proc.StartInfo.FileName = "PowerShell";
|
proc.StartInfo.FileName = "PowerShell";
|
||||||
proc.StartInfo.Arguments = $"-NoLogo -NoExit -File \"{Folder.Startup + "Update.ps1"}\" \"{url}\" \"{Application.StartupPath.TrimEnd('\\')}\"";
|
proc.StartInfo.Arguments = $"-NoLogo -NoExit -File \"{Folder.Startup + "Update.ps1"}\" \"{url}\" \"{Folder.Startup.TrimEnd(Path.DirectorySeparatorChar)}\"";
|
||||||
|
|
||||||
if (Folder.Startup.Contains("Program Files"))
|
if (Folder.Startup.Contains("Program Files"))
|
||||||
proc.StartInfo.Verb = "runas";
|
proc.StartInfo.Verb = "runas";
|
||||||
|
|||||||
@@ -19,27 +19,51 @@
|
|||||||
<Setter Property="Height" Value="25"></Setter>
|
<Setter Property="Height" Value="25"></Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="FontSize" Value="14"></Setter>
|
||||||
|
<Setter Property="Margin" Value="3,0,0,0"></Setter>
|
||||||
|
<Setter Property="TextAlignment" Value="Center"></Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<ControlTemplate x:Key = "ShieldButtonTemplate" TargetType = "Button">
|
<ControlTemplate x:Key = "ShieldButtonTemplate" TargetType = "Button">
|
||||||
<Button Margin="0">
|
<Button Margin="0" HorizontalContentAlignment="Stretch">
|
||||||
<StackPanel Orientation="Horizontal">
|
<Grid>
|
||||||
<Image Source="{x:Static mpvnet:SetupWindow.ShieldIcon}"
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Image Grid.Column="0"
|
||||||
|
Source="{x:Static mpvnet:SetupWindow.ShieldIcon}"
|
||||||
Width="18"
|
Width="18"
|
||||||
Height="18"
|
Height="18"
|
||||||
Margin="0,0,3,0"/>
|
Margin="3,0,0,0"/>
|
||||||
<ContentPresenter/>
|
<ContentPresenter Grid.Column="1" HorizontalAlignment="Center" />
|
||||||
</StackPanel>
|
</Grid>
|
||||||
</Button>
|
</Button>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Margin="10">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Button Name="RegisterVideo" Click="RegisterVideo_Click" Template="{StaticResource ShieldButtonTemplate}">Register video file extensions</Button>
|
<StackPanel Width="180" Margin="5">
|
||||||
<Button Name="RegisterAudio" Click="RegisterAudio_Click" Template="{StaticResource ShieldButtonTemplate}">Register audio file extensions</Button>
|
<TextBlock>Start Menu Shortcut</TextBlock>
|
||||||
<Button Name="RegisterImage" Click="RegisterImage_Click" Template="{StaticResource ShieldButtonTemplate}">Register image file extensions</Button>
|
<Button Name="AddStartMenuShortcut" Click="AddStartMenuShortcut_Click">Add</Button>
|
||||||
<Button Name="UnregisterFileAssociations" Click="UnregisterFileAssociations_Click" Template="{StaticResource ShieldButtonTemplate}">Unregister file extensions</Button>
|
<Button Name="RemoveStartMenuShortcut" Click="RemoveStartMenuShortcut_Click">Remove</Button>
|
||||||
<Button Name="AddToPathEnvVar" Margin="3,15,3,3" Click="AddToPathEnvVar_Click">Add to Path environment variable</Button>
|
</StackPanel>
|
||||||
<Button Name="RemoveFromPathEnvVar" Padding="10,0,10,0" Click="RemoveFromPathEnvVar_Click">Remove from Path environment variable</Button>
|
<StackPanel Width="180" Margin="20,5,5,5">
|
||||||
|
<TextBlock>File Extensions</TextBlock>
|
||||||
|
<Button Name="AddVideo" Click="AddVideo_Click" Template="{StaticResource ShieldButtonTemplate}">Add Video</Button>
|
||||||
|
<Button Name="AddAudio" Click="AddAudio_Click" Template="{StaticResource ShieldButtonTemplate}">Add Audio</Button>
|
||||||
|
<Button Name="AddImage" Click="AddImage_Click" Template="{StaticResource ShieldButtonTemplate}">Add Image</Button>
|
||||||
|
<Button Name="RemoveFileAssociations" Click="RemoveFileAssociations_Click" Template="{StaticResource ShieldButtonTemplate}">Remove All</Button>
|
||||||
|
<Button Name="EditDefaultApp" Click="EditDefaultApp_Click">Edit Default App</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Width="180" Margin="20,5,5,5">
|
||||||
|
<TextBlock>Path Environment Variable</TextBlock>
|
||||||
|
<Button Name="AddToPathEnvVar" Click="AddToPathEnvVar_Click">Add</Button>
|
||||||
|
<Button Name="RemoveFromPathEnvVar" Click="RemoveFromPathEnvVar_Click">Remove</Button>
|
||||||
|
<Button Name="ShowEnvVarEditor" Click="ShowEnvVarEditor_Click">Show Editor</Button>
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.IO;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
using WinForms = System.Windows.Forms;
|
using WinForms = System.Windows.Forms;
|
||||||
|
|
||||||
@@ -39,22 +40,38 @@ namespace mpvnet
|
|||||||
proc.StartInfo.FileName = WinForms.Application.ExecutablePath;
|
proc.StartInfo.FileName = WinForms.Application.ExecutablePath;
|
||||||
proc.StartInfo.Arguments = "--reg-file-assoc " + value;
|
proc.StartInfo.Arguments = "--reg-file-assoc " + value;
|
||||||
proc.StartInfo.Verb = "runas";
|
proc.StartInfo.Verb = "runas";
|
||||||
|
proc.StartInfo.UseShellExecute = true;
|
||||||
proc.Start();
|
proc.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
Process.Start("ms-settings:defaultapps");
|
Msg.Show(value[0].ToString().ToUpper() + value.Substring(1) +
|
||||||
|
" file associations successfully created.");
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterVideo_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("video");
|
void AddVideo_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("video");
|
||||||
void RegisterAudio_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("audio");
|
void AddAudio_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("audio");
|
||||||
void RegisterImage_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("image");
|
void AddImage_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("image");
|
||||||
|
|
||||||
void UnregisterFileAssociations_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("unreg");
|
void RemoveFileAssociations_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (Process proc = new Process())
|
||||||
|
{
|
||||||
|
proc.StartInfo.FileName = "powershell.exe";
|
||||||
|
proc.StartInfo.Arguments = "-NoLogo -NoExit -ExecutionPolicy Unrestricted -File \"" +
|
||||||
|
Folder.Startup + "Setup\\uninstall.ps1\"";
|
||||||
|
proc.StartInfo.Verb = "runas";
|
||||||
|
proc.StartInfo.UseShellExecute = true;
|
||||||
|
proc.Start();
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
|
||||||
void AddToPathEnvVar_Click(object sender, RoutedEventArgs e)
|
void AddToPathEnvVar_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string var = WinForms.Application.StartupPath + ";";
|
string var = Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";";
|
||||||
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
||||||
|
|
||||||
if (path.Contains(var))
|
if (path.Contains(var))
|
||||||
@@ -68,7 +85,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
void RemoveFromPathEnvVar_Click(object sender, RoutedEventArgs e)
|
void RemoveFromPathEnvVar_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string var = WinForms.Application.StartupPath + ";";
|
string var = Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";";
|
||||||
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
|
||||||
|
|
||||||
if (path.Contains(var))
|
if (path.Contains(var))
|
||||||
@@ -80,17 +97,29 @@ namespace mpvnet
|
|||||||
Msg.ShowWarning("Path was not containing mpv.net.");
|
Msg.ShowWarning("Path was not containing mpv.net.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void aaa()
|
void AddStartMenuShortcut_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
BitmapSource shieldSource = null;
|
ExecutePowerShellScript(Folder.Startup + "Setup\\create start menu shortcut.ps1");
|
||||||
IntPtr icon = GetIcon(SHSTOCKICONID.Shield, SHSTOCKICONFLAGS.SHGSI_LARGEICON);
|
}
|
||||||
shieldSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(
|
|
||||||
icon, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
|
void RemoveStartMenuShortcut_Click(object sender, RoutedEventArgs e)
|
||||||
DestroyIcon(icon);
|
{
|
||||||
//shieldSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(
|
ExecutePowerShellScript(Folder.Startup + "Setup\\remove start menu shortcut.ps1");
|
||||||
// System.Drawing.SystemIcons.Shield.Handle,
|
}
|
||||||
// Int32Rect.Empty,
|
|
||||||
// BitmapSizeOptions.FromEmptyOptions());
|
void ShowEnvVarEditor_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ProcessHelp.Execute("rundll32.exe", "sysdm.cpl,EditEnvironmentVariables");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecutePowerShellScript(string file)
|
||||||
|
{
|
||||||
|
ProcessHelp.Execute("powershell.exe", "-NoLogo -NoExit -ExecutionPolicy Unrestricted -File \"" + file + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EditDefaultApp_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ProcessHelp.ShellExecute("ms-settings:defaultapps");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -814,9 +814,6 @@ namespace mpvnet
|
|||||||
core.LoadScripts();
|
core.LoadScripts();
|
||||||
Task.Run(() => App.Extension = new Extension());
|
Task.Run(() => App.Extension = new Extension());
|
||||||
ShownTickCount = Environment.TickCount;
|
ShownTickCount = Environment.TickCount;
|
||||||
|
|
||||||
SetupWindow win = new SetupWindow();
|
|
||||||
win.Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivated(EventArgs e)
|
protected override void OnActivated(EventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user