Skip to content

Commit

Permalink
更新3.1版本
Browse files Browse the repository at this point in the history
  • Loading branch information
BluePointLilac committed Feb 24, 2021
1 parent 108dba4 commit 9fde37f
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 31 deletions.
27 changes: 21 additions & 6 deletions ContextMenuManager/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static string Language
public static bool AutoBackup
{
get => ConfigWriter.GetValue("General", "AutoBackup") != "0";
set => ConfigWriter.SetValue("General", "AutoBackup", (value ? 1 : 0).ToString());
set => ConfigWriter.SetValue("General", "AutoBackup", value ? 1 : 0);
}

public static DateTime LastCheckUpdateTime
Expand All @@ -99,14 +99,14 @@ public static DateTime LastCheckUpdateTime
}
set
{
ConfigWriter.SetValue("General", "LastCheckUpdateTime", value.ToBinary().ToString());
ConfigWriter.SetValue("General", "LastCheckUpdateTime", value.ToBinary());
}
}

public static bool ProtectOpenItem
{
get => ConfigWriter.GetValue("General", "ProtectOpenItem") != "0";
set => ConfigWriter.SetValue("General", "ProtectOpenItem", (value ? 1 : 0).ToString());
set => ConfigWriter.SetValue("General", "ProtectOpenItem", value ? 1 : 0);
}

public static string EngineUrl
Expand All @@ -126,19 +126,34 @@ public static string EngineUrl
public static bool ShowFilePath
{
get => ConfigWriter.GetValue("General", "ShowFilePath") == "1";
set => ConfigWriter.SetValue("General", "ShowFilePath", (value ? 1 : 0).ToString());
set => ConfigWriter.SetValue("General", "ShowFilePath", value ? 1 : 0);
}

public static bool WinXSortable
{
get => ConfigWriter.GetValue("General", "WinXSortable") == "1";
set => ConfigWriter.SetValue("General", "WinXSortable", (value ? 1 : 0).ToString());
set => ConfigWriter.SetValue("General", "WinXSortable", value ? 1 : 0);
}

public static bool OpenMoreRegedit
{
get => ConfigWriter.GetValue("General", "OpenMoreRegedit") == "1";
set => ConfigWriter.SetValue("General", "OpenMoreRegedit", (value ? 1 : 0).ToString());
set => ConfigWriter.SetValue("General", "OpenMoreRegedit", value ? 1 : 0);
}

public static Version Version
{
get
{
Version version = new Version();
try { version = new Version(ConfigWriter.GetValue("General", "Version")); }
catch { }
return version;
}
set
{
ConfigWriter.SetValue("General", "Version", value);
}
}
}
}
30 changes: 18 additions & 12 deletions ContextMenuManager/BluePointLilac.Methods/ExternalProgram.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -36,19 +37,24 @@ public static void JumpRegEdit(string regPath, string valueName = null, bool mor
Thread.Sleep(50);
SendMessage(hTree, WM_KEYDOWN, VK_RIGHT, null);
}
else SendMessage(hTree, WM_CHAR, Convert.ToInt16(chr), null);
else
{
SendMessage(hTree, WM_CHAR, Convert.ToInt16(chr), null);
}
}

if(!string.IsNullOrEmpty(valueName))
if(string.IsNullOrEmpty(valueName)) return;
using(RegistryKey key = RegistryEx.GetRegistryKey(regPath))
{
Thread.Sleep(50);
SetForegroundWindow(hList);
SetFocus(hList);
SendMessage(hList, WM_KEYDOWN, VK_HOME, null);
foreach(char chr in Encoding.Default.GetBytes(valueName))
{
SendMessage(hList, WM_CHAR, Convert.ToInt16(chr), null);
}
if(key?.GetValue(valueName) == null) return;
}
Thread.Sleep(50);
SetForegroundWindow(hList);
SetFocus(hList);
SendMessage(hList, WM_KEYDOWN, VK_HOME, null);
foreach(char chr in Encoding.Default.GetBytes(valueName))
{
SendMessage(hList, WM_CHAR, Convert.ToInt16(chr), null);
}
}

Expand Down Expand Up @@ -118,7 +124,7 @@ public static void OpenNotepadWithText(string text)
{
using(Process process = Process.Start("notepad.exe"))
{
Thread.Sleep(200);
process.WaitForInputIdle();
IntPtr handle = FindWindowEx(process.MainWindowHandle, IntPtr.Zero, "Edit", null);
SendMessage(handle, WM_SETTEXT, 0, text);
}
Expand Down
7 changes: 5 additions & 2 deletions ContextMenuManager/BluePointLilac.Methods/GuidEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ public static bool TryParse(string str, out Guid guid)
}
}

private static readonly Regex GuidRegex = new Regex(@"[A-F0-9]{8}(\-[A-F0-9]{4}){3}\-[A-F0-9]{12}", RegexOptions.IgnoreCase);

public static bool IsGuid(string str)
{
if(string.IsNullOrEmpty(str)) return false;
Regex guidRegEx = new Regex(@"[a-fA-F0-9]{8}(\-[a-fA-F0-9]{4}){3}\-[a-fA-F0-9]{12}");
return guidRegEx.IsMatch(str);
if(str.Length == 38 && str.StartsWith("{") && str.EndsWith("}") && GuidRegex.IsMatch(str)) return true;
if(str.Length == 36 && GuidRegex.IsMatch(str)) return true;
return false;
}
}
}
5 changes: 5 additions & 0 deletions ContextMenuManager/BluePointLilac.Methods/IniWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ private void SetValue(string section, string key, ref string value, bool isGetVa
}
}

public void SetValue(string section, string key, object value)
{
SetValue(section, key, value.ToString());
}

public void SetValue(string section, string key, string value)
{
SetValue(section, key, ref value, false);
Expand Down
2 changes: 1 addition & 1 deletion ContextMenuManager/Controls/AboutApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public AppSettingBox()
MyToolTip.SetToolTip(cmbConfigDir, AppString.Tip.ConfigPath);
MyToolTip.SetToolTip(btnConfigDir, AppString.Other.OpenConfigDir);
MyToolTip.SetToolTip(btnBackupDir, AppString.Other.OpenBackupDir);
MyToolTip.SetToolTip(lblUpdate, AppString.Tip.CheckUpdate + Environment.NewLine
MyToolTip.SetToolTip(mliUpdate, AppString.Tip.CheckUpdate + Environment.NewLine
+ AppString.Tip.LastCheckUpdateTime + AppConfig.LastCheckUpdateTime.ToLongDateString());
cmbConfigDir.Items.AddRange(new[] { AppString.Other.AppDataDir, AppString.Other.AppDir });
cmbEngine.Items.AddRange(new[] { "Baidu", "Bing", "Google", "DogeDoge", "Sogou", "360", AppString.Other.CustomEngine });
Expand Down
2 changes: 1 addition & 1 deletion ContextMenuManager/Controls/RuleItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public int ItemValue
}
set
{
IniWriter.SetValue(Rule.Section, Rule.KeyName, value.ToString());
IniWriter.SetValue(Rule.Section, Rule.KeyName, value);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ContextMenuManager/Controls/ShellExItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public string RegPath
}
}

public string ValueName => DefaultValue;
public string ValueName => null;
public Guid Guid { get; set; }
public string SearchText => Text;
public string ItemFilePath => GuidInfo.GetFilePath(Guid);
Expand Down
2 changes: 1 addition & 1 deletion ContextMenuManager/Controls/ShellExecuteDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public ShellExecuteCheckBox()
{
this.Text = "ShellExecute";
this.AutoSize = true;
this.Font = new Font(SystemFonts.DialogFont.FontFamily, 8F);
this.Font = new Font(SystemFonts.DialogFont.FontFamily, 8F / 1F.DpiZoom());
}

public string Verb { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions ContextMenuManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("35190ec1-2515-488d-a2e9-825d6ff67aa2")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ Icon=..\FreeArc.exe
[AD392E40-428C-459F-961E-9B147782D099]
Text=UltraISO
Icon=.\UltraISO.exe
[be86f80b-eb1a-45b4-b4b6-4b12d302b6bc]
Text=AntZip

;----------------杀软------------------
[09A47860-11B0-4DA5-AFA5-26D86198A780]
Expand Down Expand Up @@ -316,6 +318,7 @@ Text=使用瑞星杀毒
[0bb81440-5f42-4480-a5f7-770a6f439fc8]
Text=IObit Malware Fighter
Icon=*,3

;----------------传输------------------
[53D2405C-48AB-4C8A-8F59-CE0610F13BBC]
Text=通过QQ发送到
Expand Down
17 changes: 15 additions & 2 deletions ContextMenuManager/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ sealed class Updater

public static void PeriodicUpdate()
{
Version appVersion = new Version(Application.ProductVersion);
//如果上次检测更新时间为一个月以前就进行更新操作
if(AppConfig.LastCheckUpdateTime.AddMonths(1).CompareTo(DateTime.Today) < 0)
bool flag1 = AppConfig.LastCheckUpdateTime.AddMonths(1).CompareTo(DateTime.Today) < 0;
//如果配置文件中的版本号低于程序版本号也进行更新操作
bool flag2 = appVersion.CompareTo(AppConfig.Version) > 0;
if(flag1 || flag2)
{
CheckUpdate();
AppConfig.LastCheckUpdateTime = DateTime.Today;
AppConfig.Version = appVersion;
}
}

Expand All @@ -35,7 +40,15 @@ public static bool CheckUpdate()
private static bool UpdateApp()
{
IniReader reader = new IniReader(new StringBuilder(GetWebString(UpdateUrl)));
Version version1 = new Version(reader.GetValue("Update", "Version"));
Version version1;
try
{
version1 = new Version(reader.GetValue("Update", "Version"));
}
catch
{
version1 = new Version(Application.ProductVersion);
}
Version version2 = new Version(Application.ProductVersion);
if(version1.CompareTo(version2) > 0)
{
Expand Down
6 changes: 3 additions & 3 deletions Update.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Update]
Version=3.0.0.0
Url=https://github.com/BluePointLilac/ContextMenuManager/releases/download/3.0.0.0/ContextMenuManager.zip
Info=【更新描述】\n(1).支持通过GUID添加ShellEx菜单项目;\n(2).添加ShellExecute函数,方便创建更加强大的Shell菜单项目;\n(3).添加WinX菜单创建和排序功能;\n(4).添加IE右键菜单管理和创建功能;\n(5).添加管理和创建右键拖拽菜单项目功能;\n(6).添加了丰富的字典,添加了很多增强菜单;\n(7).整合文件类型管理功能,使管理更加方便;\n(8).添加状态栏实时显示文件路径功能;\n(9).优化程序部分UI,优化部分代码,解决一些已知Bug
Version=3.1.0.0
Url=https://github.com/BluePointLilac/ContextMenuManager/releases/download/3.1.0.0/ContextMenuManager.zip
Info=【更新描述】\n(1).修复已知bug,优化部分代码。

0 comments on commit 9fde37f

Please sign in to comment.