diff --git a/README.md b/README.md index 3ba0d7a..f6b4169 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,20 @@

- Vizpower Plugin Installer -


-## 下载地址: -Github: [https://github.com/SpaceTimee/Vizpower-Plugin-Installer/releases](https://github.com/SpaceTimee/Vizpower-Plugin-Installer/releases) +## 自我介绍 +**Vizpower Plugin Installer**: 一只基于 **WPF** 的无限宝第三方插件安装器 +* 适用平台: Windows -## 联系邮箱: -**Zeus6_6@163.com** +## 下载地址 +Github: [https://github.com/SpaceTimee/Vizpower-Plugin-Installer/releases](https://github.com/SpaceTimee/Vizpower-Plugin-Installer/releases) -## 反馈群号: +## 反馈群号 ❤: 904645614
💛: 909457621
💙: 705468445 -## 开发者: +## 联系邮箱 +**Zeus6_6@163.com** +## 开发者 **快乐小牛, WXRIW, Space Time** diff --git a/Vizpower Plugin Installer/App.xaml b/Vizpower Plugin Installer/App.xaml index 85de4fa..fad9af7 100644 --- a/Vizpower Plugin Installer/App.xaml +++ b/Vizpower Plugin Installer/App.xaml @@ -1,8 +1,7 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> diff --git a/Vizpower Plugin Installer/App.xaml.cs b/Vizpower Plugin Installer/App.xaml.cs index 88c014d..10b6f42 100644 --- a/Vizpower Plugin Installer/App.xaml.cs +++ b/Vizpower Plugin Installer/App.xaml.cs @@ -4,5 +4,9 @@ namespace Vizpower_Plugin_Installer_WPF { public partial class App : Application { + protected override void OnStartup(StartupEventArgs e) + { + new MainWindow(e.Args).Show(); + } } } \ No newline at end of file diff --git a/Vizpower Plugin Installer/MainWindow.xaml.cs b/Vizpower Plugin Installer/MainWindow.xaml.cs index 3accf13..425121f 100644 --- a/Vizpower Plugin Installer/MainWindow.xaml.cs +++ b/Vizpower Plugin Installer/MainWindow.xaml.cs @@ -17,9 +17,6 @@ namespace Vizpower_Plugin_Installer_WPF { - /// - /// Interaction logic for MainWindow.xaml - /// public partial class MainWindow : Window { //说明: @@ -37,7 +34,7 @@ public partial class MainWindow : Window private const string InstallTipUrl = @"https://gitee.com/klxn/wxbplugin/raw/master/install.png"; //安装提示Url private const string InstallVideoUrl = @"https://www.bilibili.com/video/BV1Ca4y1E7mx"; //使用教程Url - //注意:打包无需修改下方内容 + //注意:打包请勿修改下方内容 private static readonly Version CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version; //当前版本 private static readonly int CurrentVersionCode = int.Parse(CurrentVersion.Major.ToString() + CurrentVersion.Minor.ToString() + CurrentVersion.Build.ToString()); //当前版本号 @@ -46,7 +43,7 @@ public partial class MainWindow : Window private static string WxbPluginGUIExePath = ""; private static string WxbPluginGUIDllPath = ""; - public MainWindow() + public MainWindow(string[] args) { InitializeComponent(); @@ -55,26 +52,13 @@ public MainWindow() Task.Run(CheckUpdateOnline); //修改全局标题 - Title = "无限宝第三方插件 Ver " + CurrentVersion.Major + "." + CurrentVersion.Minor + "." + CurrentVersion.Build + " " + SpecialVersion + " 安装器"; + Title = "无限宝第三方插件 " + CurrentVersion.Major + "." + CurrentVersion.Minor + "." + CurrentVersion.Build + " " + SpecialVersion + (string.IsNullOrEmpty(SpecialVersion) ? "安装器" : " 安装器"); - //恢复安装路径 - if (File.Exists(Properties.Settings.Default.FilePath)) - { - LocationTextBox.Text = Properties.Settings.Default.FilePath; - FileName = Properties.Settings.Default.FileName; - } - - //处理恢复记录 - if (LocationTextBox.Text != "" && FileName != "") - { - CaptureDesktopPath = LocationTextBox.Text.Replace(FileName, "CaptureDesktop.dll"); - WxbPluginGUIExePath = LocationTextBox.Text.Replace(FileName, "WxbPluginGUI.exe"); - WxbPluginGUIDllPath = LocationTextBox.Text.Replace(FileName, "wxbPluginGUI.dll"); - - if (File.Exists(CaptureDesktopPath) && - File.Exists(WxbPluginGUIExePath)) - InstallButton.Content = "更新"; - } + //填充安装路径 + if (args.Length >= 1 && File.Exists(args[0]) && Path.GetFileName(args[0]).StartsWith("LoginTool") && Path.GetFileName(args[0]).EndsWith(".exe")) + DealWithPath(args[0]); + else if (File.Exists(Properties.Settings.Default.FilePath)) + DealWithPath(Properties.Settings.Default.FilePath); } private void CheckUpdateOnline() { @@ -150,7 +134,7 @@ private void CheckUpdateOnline() private string GetWebCode(string strURL) { Uri arg_15_0 = new Uri(strURL); - byte[] i = new byte[1]; + byte[] i; Queue dataQue = new Queue(); HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(arg_15_0); DateTime sTime = Conversions.ToDate("1990-09-21 00:00:00"); @@ -243,33 +227,35 @@ private object GetByDiv2(string code, string divBegin, string divEnd) } } - //安装拆卸核心功能 + //安装路径 private void NavigateButton_Click(object sender, EventArgs e) { - OpenFileDialog openFileDialog = new OpenFileDialog(); - openFileDialog.Filter = "无限宝登陆工具|LoginTool*.exe"; + OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "无限宝登陆工具|LoginTool*.exe" }; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) - { - LocationTextBox.Text = openFileDialog.FileName; //路径 - FileName = System.IO.Path.GetFileName(LocationTextBox.Text); //文件名(包括后缀名) + DealWithPath(openFileDialog.FileName); + } + private void DealWithPath(string filePath) + { + LocationTextBox.Text = filePath; //路径 + FileName = Path.GetFileName(filePath); //文件名(包括后缀名) - CaptureDesktopPath = LocationTextBox.Text.Replace(FileName, "CaptureDesktop.dll"); - WxbPluginGUIExePath = LocationTextBox.Text.Replace(FileName, "WxbPluginGUI.exe"); - WxbPluginGUIDllPath = LocationTextBox.Text.Replace(FileName, "wxbPluginGUI.dll"); + CaptureDesktopPath = LocationTextBox.Text.Replace(FileName, "CaptureDesktop.dll"); + WxbPluginGUIExePath = LocationTextBox.Text.Replace(FileName, "WxbPluginGUI.exe"); + WxbPluginGUIDllPath = LocationTextBox.Text.Replace(FileName, "wxbPluginGUI.dll"); - Properties.Settings.Default.FileName = FileName; - Properties.Settings.Default.FilePath = LocationTextBox.Text; - Properties.Settings.Default.Save(); + Properties.Settings.Default.FilePath = LocationTextBox.Text; + Properties.Settings.Default.Save(); - if (File.Exists(CaptureDesktopPath) && - File.Exists(WxbPluginGUIExePath)) - InstallButton.Content = "更新"; - } + if (File.Exists(CaptureDesktopPath) && + File.Exists(WxbPluginGUIExePath)) + InstallButton.Content = "更新"; } + + //安装拆卸 private void InstallButton_Click(object sender, EventArgs e) { - if (LocationTextBox.Text == "" || FileName == "") + if (string.IsNullOrEmpty(LocationTextBox.Text) || string.IsNullOrEmpty(FileName)) { MessageBox.Show("请点击浏览找到 LoginTool.exe 文件", Title, MessageBoxButtons.OK, MessageBoxIcon.Information); return; @@ -310,7 +296,7 @@ private void InstallButton_Click(object sender, EventArgs e) } private void UninstallButton_Click(object sender, RoutedEventArgs e) { - if (LocationTextBox.Text == "" || FileName == "") + if (string.IsNullOrEmpty(LocationTextBox.Text) || string.IsNullOrEmpty(FileName)) { MessageBox.Show("请点击浏览找到 LoginTool.exe 文件", Title, MessageBoxButtons.OK, MessageBoxIcon.Information); return; @@ -350,13 +336,13 @@ private void UninstallButton_Click(object sender, RoutedEventArgs e) } private bool KillWxbProcess() { - if (MessageBox.Show("需要关闭无限宝相关进程,如有残留进程,安装器会关闭它,是否继续?", Title, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) - return false; - foreach (Process process in Process.GetProcesses()) { if (process.ProcessName == "iMeeting" || process.ProcessName == "LoginTool" || process.ProcessName == "WxbPluginGUI") { + if (MessageBox.Show("发现无限宝相关进程残留,安装器会尝试自动关闭它,是否继续?", Title, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) + return false; + try { process.Kill(); diff --git a/Vizpower Plugin Installer/Properties/Settings.Designer.cs b/Vizpower Plugin Installer/Properties/Settings.Designer.cs index e1558c8..2adfe19 100644 --- a/Vizpower Plugin Installer/Properties/Settings.Designer.cs +++ b/Vizpower Plugin Installer/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Vizpower_Plugin_Installer_WPF.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -34,17 +34,5 @@ public string FilePath { this["FilePath"] = value; } } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string FileName { - get { - return ((string)(this["FileName"])); - } - set { - this["FileName"] = value; - } - } } } diff --git a/Vizpower Plugin Installer/Properties/Settings.settings b/Vizpower Plugin Installer/Properties/Settings.settings index b99945c..8622c9a 100644 --- a/Vizpower Plugin Installer/Properties/Settings.settings +++ b/Vizpower Plugin Installer/Properties/Settings.settings @@ -5,8 +5,5 @@ - - - \ No newline at end of file diff --git a/Vizpower Plugin Installer/Properties/app.config b/Vizpower Plugin Installer/Properties/app.config index c2d11f6..8210c68 100644 --- a/Vizpower Plugin Installer/Properties/app.config +++ b/Vizpower Plugin Installer/Properties/app.config @@ -1,18 +1,18 @@ - - -
- - - - - - - - - - - - + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/Vizpower Plugin Installer/Vizpower Plugin Installer.csproj b/Vizpower Plugin Installer/Vizpower Plugin Installer.csproj index da9dbab..2a2781a 100644 --- a/Vizpower Plugin Installer/Vizpower Plugin Installer.csproj +++ b/Vizpower Plugin Installer/Vizpower Plugin Installer.csproj @@ -14,6 +14,9 @@ 4 true + false + + publish\ true Disk @@ -26,11 +29,8 @@ true 0 1.0.0.%2a - false false true - - AnyCPU @@ -126,8 +126,8 @@ Resources.Designer.cs Designer - + SettingsSingleFileGenerator