修复打开文件的Bug,并添加关联文件右键菜单的功能
This commit is contained in:
parent
2058642704
commit
6a8c9a1e7c
|
@ -75,7 +75,7 @@ namespace HexExplorer
|
|||
}
|
||||
|
||||
public static readonly Binding LogInfo = new Binding("Text", LoggingLib.Instance, "LogInfo");
|
||||
|
||||
public static readonly Binding UseShell = new Binding("Checked", FrmSetting.UseShell, null , true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1801,6 +1801,7 @@
|
|||
this.Text = "羽云十六进制浏览器";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
|
||||
this.Load += new System.EventHandler(this.FrmMain_Load);
|
||||
MainMenu.ResumeLayout(false);
|
||||
MainMenu.PerformLayout();
|
||||
this.hexMenuStrip.ResumeLayout(false);
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace HexExplorer
|
|||
public partial class FrmMain : FormBase
|
||||
{
|
||||
private readonly EditorPageManager pageManager;
|
||||
private string[] Args;
|
||||
|
||||
private readonly string EditFileExt = string.Empty;
|
||||
|
||||
|
@ -59,10 +60,7 @@ namespace HexExplorer
|
|||
pageManager.EditorPageClosing += PageManager_EditorPageClosing;
|
||||
SingleInstanceHelper.StartUpNextInstance += SingleInstanceHelper_StartUpNextInstance;
|
||||
|
||||
if (args != null && args.Length > 0)
|
||||
{
|
||||
CreateOrOpen(args[0].Trim());
|
||||
}
|
||||
Args = args;
|
||||
|
||||
constInfo = new ConstInfo();
|
||||
pgConst.SelectedObject = constInfo;
|
||||
|
@ -1095,6 +1093,21 @@ namespace HexExplorer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void FrmMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (Args != null && Args.Length > 0)
|
||||
{
|
||||
foreach (var item in Args)
|
||||
{
|
||||
var filename = item.Trim();
|
||||
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
CreateOrOpen(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -233,7 +233,7 @@
|
|||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADQ
|
||||
DwAAAk1TRnQBSQFMAgEBBAEAAbgBBAG4AQQBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
DwAAAk1TRnQBSQFMAgEBBAEAAcABBAHAAQQBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
AwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AugADQAFwA2IB7wNi
|
||||
Ae8DQAFwGAAD9gH/A/YB/wP2Af8D9gH/A/YB/wP2Af8D9gH/A/YB/wP2Af8cAAP2Af8D9gH/A/YB/wP2
|
||||
Af8D9gH/A/YB/wP2Af8D9gH/A/YB/wP2Af8D9gH/A/YB/wP2Af8D9gH/A/YB/wP2Af9QAAMXASADWQG/
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace HexExplorer
|
|||
System.Windows.Forms.TabPage tabPE;
|
||||
System.Windows.Forms.TabPage tabBookMark;
|
||||
System.Windows.Forms.TabPage tabPlugin;
|
||||
System.Windows.Forms.TabPage tabOther;
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnFont = new System.Windows.Forms.Button();
|
||||
this.cbEncoding = new System.Windows.Forms.ComboBox();
|
||||
|
@ -72,6 +73,7 @@ namespace HexExplorer
|
|||
this.pgPlugin = new System.Windows.Forms.PropertyGrid();
|
||||
this.clbPlugin = new System.Windows.Forms.ListBox();
|
||||
this.cbEnablePlugin = new System.Windows.Forms.CheckBox();
|
||||
this.cbShellRight = new System.Windows.Forms.CheckBox();
|
||||
this.tabSetting = new System.Windows.Forms.TabControl();
|
||||
this.cD = new System.Windows.Forms.ColorDialog();
|
||||
this.fD = new System.Windows.Forms.FontDialog();
|
||||
|
@ -84,6 +86,7 @@ namespace HexExplorer
|
|||
tabPE = new System.Windows.Forms.TabPage();
|
||||
tabBookMark = new System.Windows.Forms.TabPage();
|
||||
tabPlugin = new System.Windows.Forms.TabPage();
|
||||
tabOther = new System.Windows.Forms.TabPage();
|
||||
tabGeneral.SuspendLayout();
|
||||
groupBox2.SuspendLayout();
|
||||
groupBox1.SuspendLayout();
|
||||
|
@ -91,6 +94,7 @@ namespace HexExplorer
|
|||
tabPE.SuspendLayout();
|
||||
tabBookMark.SuspendLayout();
|
||||
tabPlugin.SuspendLayout();
|
||||
tabOther.SuspendLayout();
|
||||
this.tabSetting.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -651,12 +655,37 @@ namespace HexExplorer
|
|||
this.cbEnablePlugin.Text = "启用插件支持 ⏱";
|
||||
this.cbEnablePlugin.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tabOther
|
||||
//
|
||||
tabOther.Controls.Add(this.cbShellRight);
|
||||
tabOther.Location = new System.Drawing.Point(4, 25);
|
||||
tabOther.Name = "tabOther";
|
||||
tabOther.Padding = new System.Windows.Forms.Padding(3);
|
||||
tabOther.Size = new System.Drawing.Size(612, 339);
|
||||
tabOther.TabIndex = 4;
|
||||
tabOther.Text = "杂项";
|
||||
tabOther.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbShellRight
|
||||
//
|
||||
this.cbShellRight.AutoSize = true;
|
||||
this.cbShellRight.Enabled = false;
|
||||
this.cbShellRight.Location = new System.Drawing.Point(35, 34);
|
||||
this.cbShellRight.Name = "cbShellRight";
|
||||
this.cbShellRight.Size = new System.Drawing.Size(224, 19);
|
||||
this.cbShellRight.TabIndex = 0;
|
||||
this.cbShellRight.Text = "将所有文件类型添加右键菜单";
|
||||
this.toolTip.SetToolTip(this.cbShellRight, "需要管理员权限");
|
||||
this.cbShellRight.UseVisualStyleBackColor = true;
|
||||
this.cbShellRight.CheckedChanged += new System.EventHandler(this.CbShellRight_CheckedChanged);
|
||||
//
|
||||
// tabSetting
|
||||
//
|
||||
this.tabSetting.Controls.Add(tabGeneral);
|
||||
this.tabSetting.Controls.Add(tabPE);
|
||||
this.tabSetting.Controls.Add(tabBookMark);
|
||||
this.tabSetting.Controls.Add(tabPlugin);
|
||||
this.tabSetting.Controls.Add(tabOther);
|
||||
this.tabSetting.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabSetting.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabSetting.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
|
@ -684,6 +713,7 @@ namespace HexExplorer
|
|||
this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Name = "FrmSetting";
|
||||
this.Text = "设置";
|
||||
this.Load += new System.EventHandler(this.FrmSetting_Load);
|
||||
this.VisibleChanged += new System.EventHandler(this.FrmSetting_VisibleChanged);
|
||||
tabGeneral.ResumeLayout(false);
|
||||
groupBox2.ResumeLayout(false);
|
||||
|
@ -697,6 +727,8 @@ namespace HexExplorer
|
|||
tabBookMark.PerformLayout();
|
||||
tabPlugin.ResumeLayout(false);
|
||||
tabPlugin.PerformLayout();
|
||||
tabOther.ResumeLayout(false);
|
||||
tabOther.PerformLayout();
|
||||
this.tabSetting.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
@ -742,5 +774,6 @@ namespace HexExplorer
|
|||
private System.Windows.Forms.CheckedListBox clbBookMark;
|
||||
private System.Windows.Forms.CheckBox cbEnablePE;
|
||||
private System.Windows.Forms.CheckBox cbAdmin;
|
||||
private System.Windows.Forms.CheckBox cbShellRight;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@
|
|||
using System.ComponentModel;
|
||||
using Be.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using Microsoft.Win32;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace HexExplorer
|
||||
{
|
||||
|
@ -10,8 +12,11 @@ namespace HexExplorer
|
|||
{
|
||||
|
||||
private static FrmSetting frmSetting=null;
|
||||
public static bool UseShell = false;
|
||||
private readonly List<WSPlugin.PluginInfo> pluginInfos;
|
||||
private readonly WSPlugin plugin = WSPlugin.Instance;
|
||||
private static string app= Application.ExecutablePath;
|
||||
private string appp = $"\"{app}\" \"%1\"";
|
||||
|
||||
public static FrmSetting Instance
|
||||
{
|
||||
|
@ -69,6 +74,13 @@ namespace HexExplorer
|
|||
btnStringLine.DataBindings.Add(BindingEnum.Setting.HexStringLinePen);
|
||||
btnStringLine.DataBindings.Add(BindingEnum.Setting.HexStringLinePenFore);
|
||||
|
||||
cbShellRight.DataBindings.Add(BindingEnum.UseShell);
|
||||
|
||||
if (AdminLib.Instance.IsAdmin)
|
||||
{
|
||||
cbShellRight.Enabled = true;
|
||||
}
|
||||
|
||||
MUserProfile mUser = UserSetting.UserProfile;
|
||||
var dplugin = mUser.DisableGuid;
|
||||
if (mUser.EnablePlugin)
|
||||
|
@ -84,7 +96,7 @@ namespace HexExplorer
|
|||
|
||||
}
|
||||
|
||||
private void FrmSetting_VisibleChanged(object sender, System.EventArgs e)
|
||||
private void FrmSetting_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible)
|
||||
{
|
||||
|
@ -100,7 +112,7 @@ namespace HexExplorer
|
|||
}
|
||||
}
|
||||
|
||||
private void BtnSelectColor_Click(object sender, System.EventArgs e)
|
||||
private void BtnSelectColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cD.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
@ -113,7 +125,7 @@ namespace HexExplorer
|
|||
}
|
||||
}
|
||||
|
||||
private void BtnPenFEdit_Click(object sender, System.EventArgs e)
|
||||
private void BtnPenFEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FrmPenFEdit frmPenF = FrmPenFEdit.Instance)
|
||||
{
|
||||
|
@ -123,7 +135,7 @@ namespace HexExplorer
|
|||
}
|
||||
}
|
||||
|
||||
private void ClbPlugin_SelectedIndexChanged(object sender, System.EventArgs e)
|
||||
private void ClbPlugin_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var sel = clbPlugin.SelectedIndex;
|
||||
if (sel >= 0)
|
||||
|
@ -132,5 +144,60 @@ namespace HexExplorer
|
|||
}
|
||||
}
|
||||
|
||||
private void FrmSetting_Load(object sender, EventArgs e)
|
||||
{
|
||||
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"*\shell");
|
||||
if ((key = key.OpenSubKey("WCHexExplorer")) != null)
|
||||
{
|
||||
if (!key.GetValue("Icon", null).Equals(app))
|
||||
goto endl;
|
||||
if ((key = key.OpenSubKey("command")) != null)
|
||||
{
|
||||
if (key.GetValue("").Equals(appp))
|
||||
{
|
||||
UseShell = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goto endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
endl:
|
||||
UseShell = false;
|
||||
}
|
||||
|
||||
private void CbShellRight_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (cbShellRight.Checked)
|
||||
{
|
||||
var app = Application.ExecutablePath;
|
||||
using (var key = Registry.ClassesRoot.OpenSubKey(@"*\shell", true))
|
||||
{
|
||||
using (var key0 = key.CreateSubKey("WCHexExplorer"))
|
||||
{
|
||||
key0.SetValue("", "用羽云十六进制浏览器打开");
|
||||
key0.SetValue("Icon", app);
|
||||
using (var key1 = key0.CreateSubKey("command"))
|
||||
{
|
||||
key1.SetValue("", appp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var key = Registry.ClassesRoot.OpenSubKey(@"*\shell", true))
|
||||
{
|
||||
key.DeleteSubKeyTree("WCHexExplorer");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -156,13 +156,16 @@
|
|||
<metadata name="tabPlugin.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="tabOther.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>167, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cD.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="fD.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>93, 17</value>
|
||||
</metadata>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>167, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -12,7 +12,6 @@
|
|||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartArguments>C:\Users\wingsummer\Desktop\GuessFileType.cs</StartArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue