Compare commits

..

4 Commits

Author SHA1 Message Date
86a794f83d 1. 升级到.NET Framework 4.8
2. 增加统计触发次数选项
2024-04-29 20:42:23 +08:00
筱傑
dd6ddb1784 1. 发布 版本v1.1.0.0
2. 新增 将可执行文件或快捷方式拖拽到软件上,可以快捷添加热键
3. 新增 配置管理功能,可以通过任务栏图标右键选择配置文件的导入导出或者从剪切板中导入导出配置
4. 修复 重启时可能导致配置文件丢失问题(不再在软件结束时操作配置文件。不确定有效。)
2021-06-19 13:56:16 +08:00
ddc54d9a97 1. 发布 版本v1.0.0.0
2. 取消 管理员权限请求
3. 修改 自启动实现方法,现在使用快捷方式发布到启动目录的方式实现
4. 增加 快捷方式自启动实现方法帮助类
2021-04-29 14:11:26 +08:00
筱傑
c7ac1341cc 清理代码 2021-04-29 13:17:26 +08:00
14 changed files with 468 additions and 155 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
</configuration>

178
KeyGo/AppAutoStart.cs Normal file
View File

@ -0,0 +1,178 @@
using System;
using System.Collections.Generic;
using System.IO;
using IWshRuntimeLibrary;
using System.Diagnostics;
namespace KeyGo
{
/// <summary>
/// 摘自https://blog.csdn.net/liyu3519/article/details/81257839
/// 应用开机自启动帮助类
/// </summary>
static class AppAutoStart
{
/// <summary>
/// 快捷方式名称-任意自定义
/// </summary>
private static string QuickName { get; }
/// <summary>
/// 自动获取系统自动启动目录
/// </summary>
private static string SystemStartPath { get; }
/// <summary>
/// 自动获取程序完整路径
/// </summary>
private static string AppAllPath { get; }
static AppAutoStart()
{
var thisProcess = Process.GetCurrentProcess();
QuickName = thisProcess.ProcessName;
AppAllPath = thisProcess.MainModule.FileName;
SystemStartPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
Console.WriteLine(SystemStartPath);
}
/// <summary>
/// 设置开机自动启动-只需要调用改方法就可以了参数里面的bool变量是控制开机启动的开关的默认为开启自启启动
/// </summary>
/// <param name="onOff">自启开关</param>
public static void SetMeAutoStart(bool onOff = true)
{
if (onOff)//开机启动
{
//获取启动路径应用程序快捷方式的路径集合
List<string> shortcutPaths = GetQuickFromFolder(SystemStartPath, AppAllPath);
//存在2个以快捷方式则保留一个快捷方式-避免重复多于
if (shortcutPaths.Count >= 2)
{
for (int i = 1; i < shortcutPaths.Count; i++)
{
DeleteFile(shortcutPaths[i]);
}
}
else if (shortcutPaths.Count < 1)//不存在则创建快捷方式
{
CreateShortcut(SystemStartPath, QuickName, AppAllPath);
}
}
else//开机不启动
{
//获取启动路径应用程序快捷方式的路径集合
List<string> shortcutPaths = GetQuickFromFolder(SystemStartPath, AppAllPath);
//存在快捷方式则遍历全部删除
if (shortcutPaths.Count > 0)
{
for (int i = 0; i < shortcutPaths.Count; i++)
{
DeleteFile(shortcutPaths[i]);
}
}
}
}
/// <summary>
/// 向目标路径创建指定文件的快捷方式
/// </summary>
/// <param name="directory">目标目录</param>
/// <param name="shortcutName">快捷方式名字</param>
/// <param name="targetPath">文件完全路径</param>
/// <param name="description">描述</param>
/// <param name="iconLocation">图标地址</param>
/// <returns>成功或失败</returns>
private static bool CreateShortcut(string directory, string shortcutName, string targetPath, string description = null, string iconLocation = null)
{
try
{
if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); //目录不存在则创建
//添加引用 Com 中搜索 Windows Script Host Object Model
string shortcutPath = Path.Combine(directory, $"{shortcutName}.lnk"); //合成路径
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath); //创建快捷方式对象
shortcut.TargetPath = targetPath; //指定目标路径
shortcut.WorkingDirectory = Path.GetDirectoryName(targetPath); //设置起始位置
shortcut.WindowStyle = 1; //设置运行方式,默认为常规窗口
shortcut.Description = description; //设置备注
shortcut.IconLocation = string.IsNullOrWhiteSpace(iconLocation) ? targetPath : iconLocation; //设置图标路径
shortcut.Save(); //保存快捷方式
return true;
}
catch (Exception ex)
{
string temp = ex.Message;
temp = "";
}
return false;
}
/// <summary>
/// 获取指定文件夹下指定应用程序的快捷方式路径集合
/// </summary>
/// <param name="directory">文件夹</param>
/// <param name="targetPath">目标应用程序路径</param>
/// <returns>目标应用程序的快捷方式</returns>
private static List<string> GetQuickFromFolder(string directory, string targetPath)
{
List<string> tempStrs = new List<string>();
tempStrs.Clear();
string tempStr = null;
string[] files = Directory.GetFiles(directory, "*.lnk");
if (files == null || files.Length < 1)
{
return tempStrs;
}
for (int i = 0; i < files.Length; i++)
{
//files[i] = string.Format("{0}\\{1}", directory, files[i]);
tempStr = GetAppPathFromQuick(files[i]);
if (tempStr == targetPath)
{
tempStrs.Add(files[i]);
}
}
return tempStrs;
}
/// <summary>
/// 获取快捷方式的目标文件路径-用于判断是否已经开启了自动启动
/// </summary>
/// <param name="shortcutPath"></param>
/// <returns></returns>
private static string GetAppPathFromQuick(string shortcutPath)
{
//快捷方式文件的路径 = @"d:\Test.lnk";
if (System.IO.File.Exists(shortcutPath))
{
WshShell shell = new WshShell();
IWshShortcut shortct = (IWshShortcut)shell.CreateShortcut(shortcutPath);
//快捷方式文件指向的路径.Text = 当前快捷方式文件IWshShortcut类.TargetPath;
//快捷方式文件指向的目标目录.Text = 当前快捷方式文件IWshShortcut类.WorkingDirectory;
return shortct.TargetPath;
}
else
{
return "";
}
}
/// <summary>
/// 根据路径删除文件-用于取消自启时从计算机自启目录删除程序的快捷方式
/// </summary>
/// <param name="path">路径</param>
private static void DeleteFile(string path)
{
FileAttributes attr = System.IO. File.GetAttributes(path);
if (attr == FileAttributes.Directory)
{
Directory.Delete(path, true);
}
else
{
System.IO.File.Delete(path);
}
}
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml.Serialization;
namespace KeyGo
@ -29,7 +24,6 @@ namespace KeyGo
/// </value>
public bool CloseToHide { get; set; } = true;
/// <summary>
/// Loads the XML.
/// </summary>
@ -68,4 +62,4 @@ namespace KeyGo
}
}
}
}
}

View File

@ -151,6 +151,7 @@ namespace KeyGo
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
[DllImport("User32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int cmdShow);

View File

@ -5,7 +5,7 @@ using System.Windows.Forms;
namespace KeyGo
{
public class AppHotKey
public static class AppHotKey
{
/// <summary>
/// 注册热键
@ -17,14 +17,7 @@ namespace KeyGo
public static void RegKey(IntPtr hwnd, int hotKey_id, KeyModifiers keyModifiers, Keys key)
{
if (!RegisterHotKey(hwnd, hotKey_id, keyModifiers, key))
{
throw new Win32Exception();
//int code = Marshal.GetLastWin32Error();
//if (code == 1409)
// MessageBox.Show("热键被占用!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
//else
// MessageBox.Show("注册热键失败!错误代码:" + code.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
/// <summary>
@ -38,7 +31,6 @@ namespace KeyGo
UnregisterHotKey(hwnd, hotKey_id);
}
//如果函数执行成功返回值不为0。
//如果函数执行失败返回值为0。要得到扩展错误信息调用GetLastError。
[DllImport("user32.dll", SetLastError = true)]

View File

@ -12,6 +12,7 @@ namespace KeyGo
}
public HotKeyItem HotKeyItem { get; set; }
private void FormHotKey_Load(object sender, EventArgs e)
{
if (HotKeyItem != null)
@ -110,6 +111,5 @@ namespace KeyGo
TxtStartupPath.Text = frm.FileName;
}
}
}
}

View File

@ -38,12 +38,19 @@ namespace KeyGo
this.TSMICloseToHide = new System.Windows.Forms.ToolStripMenuItem();
this.TSMIPowerBoot = new System.Windows.Forms.ToolStripMenuItem();
this.TSMIExit = new System.Windows.Forms.ToolStripMenuItem();
this.TSMITriggerCountStatistics = new System.Windows.Forms.ToolStripMenuItem();
this.TSMIConfigFile = new System.Windows.Forms.ToolStripMenuItem();
this.TSMIExportConfig = new System.Windows.Forms.ToolStripMenuItem();
this.TSMIImportConfig = new System.Windows.Forms.ToolStripMenuItem();
this.TSMICopyConfig = new System.Windows.Forms.ToolStripMenuItem();
this.TSMIPasteConfig = new System.Windows.Forms.ToolStripMenuItem();
this.FLPHotKeys.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// FLPHotKeys
//
this.FLPHotKeys.AllowDrop = true;
this.FLPHotKeys.AutoScroll = true;
this.FLPHotKeys.BackColor = System.Drawing.Color.White;
this.FLPHotKeys.Controls.Add(this.BtnAdd);
@ -54,6 +61,8 @@ namespace KeyGo
this.FLPHotKeys.Padding = new System.Windows.Forms.Padding(3);
this.FLPHotKeys.Size = new System.Drawing.Size(488, 197);
this.FLPHotKeys.TabIndex = 0;
this.FLPHotKeys.DragDrop += new System.Windows.Forms.DragEventHandler(this.FLPHotKeys_DragDrop);
this.FLPHotKeys.DragEnter += new System.Windows.Forms.DragEventHandler(this.FLPHotKeys_DragEnter);
//
// BtnAdd
//
@ -75,17 +84,19 @@ namespace KeyGo
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.TSMIConfigFile,
this.TSMITriggerCountStatistics,
this.TSMICloseToHide,
this.TSMIPowerBoot,
this.TSMIExit});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(149, 70);
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 136);
//
// TSMICloseToHide
//
this.TSMICloseToHide.CheckOnClick = true;
this.TSMICloseToHide.Name = "TSMICloseToHide";
this.TSMICloseToHide.Size = new System.Drawing.Size(148, 22);
this.TSMICloseToHide.Size = new System.Drawing.Size(180, 22);
this.TSMICloseToHide.Text = "关闭为最小化";
this.TSMICloseToHide.CheckedChanged += new System.EventHandler(this.TSMICloseToHide_CheckedChanged);
//
@ -93,17 +104,62 @@ namespace KeyGo
//
this.TSMIPowerBoot.CheckOnClick = true;
this.TSMIPowerBoot.Name = "TSMIPowerBoot";
this.TSMIPowerBoot.Size = new System.Drawing.Size(148, 22);
this.TSMIPowerBoot.Size = new System.Drawing.Size(180, 22);
this.TSMIPowerBoot.Text = "开机自启动";
this.TSMIPowerBoot.CheckedChanged += new System.EventHandler(this.TSMIPowerBoot_CheckedChanged);
//
// TSMIExit
//
this.TSMIExit.Name = "TSMIExit";
this.TSMIExit.Size = new System.Drawing.Size(148, 22);
this.TSMIExit.Size = new System.Drawing.Size(180, 22);
this.TSMIExit.Text = "退出";
this.TSMIExit.Click += new System.EventHandler(this.TSMIExit_Click);
//
// TSMIConfigFile
//
this.TSMIConfigFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.TSMIExportConfig,
this.TSMIImportConfig,
this.TSMICopyConfig,
this.TSMIPasteConfig});
this.TSMIConfigFile.Name = "TSMIConfigFile";
this.TSMIConfigFile.Size = new System.Drawing.Size(180, 22);
this.TSMIConfigFile.Text = "配置文件";
//
// TSMIExportConfig
//
this.TSMIExportConfig.Name = "TSMIExportConfig";
this.TSMIExportConfig.Size = new System.Drawing.Size(180, 22);
this.TSMIExportConfig.Text = "导出文件";
this.TSMIExportConfig.Click += new System.EventHandler(this.TSMIExportConfig_Click);
//
// TSMIImportConfig
//
this.TSMIImportConfig.Name = "TSMIImportConfig";
this.TSMIImportConfig.Size = new System.Drawing.Size(180, 22);
this.TSMIImportConfig.Text = "导入文件";
this.TSMIImportConfig.Click += new System.EventHandler(this.TSMIImportConfig_Click);
//
// TSMICopyConfig
//
this.TSMICopyConfig.Name = "TSMICopyConfig";
this.TSMICopyConfig.Size = new System.Drawing.Size(180, 22);
this.TSMICopyConfig.Text = "复制到剪切板";
this.TSMICopyConfig.Click += new System.EventHandler(this.TSMICopyConfig_Click);
//
// TSMIPasteConfig
//
this.TSMIPasteConfig.Name = "TSMIPasteConfig";
this.TSMIPasteConfig.Size = new System.Drawing.Size(180, 22);
this.TSMIPasteConfig.Text = "从剪切板读入";
this.TSMIPasteConfig.Click += new System.EventHandler(this.TSMIPasteConfig_Click);
// TSMITriggerCountStatistics
//
this.TSMITriggerCountStatistics.Name = "TSMITriggerCountStatistics";
this.TSMITriggerCountStatistics.Size = new System.Drawing.Size(180, 22);
this.TSMITriggerCountStatistics.Text = "触发次数统计";
this.TSMITriggerCountStatistics.Click += new System.EventHandler(this.TSMITriggerCountStatistics_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
@ -137,6 +193,12 @@ namespace KeyGo
private System.Windows.Forms.ToolStripMenuItem TSMIExit;
private System.Windows.Forms.ToolStripMenuItem TSMIPowerBoot;
private System.Windows.Forms.ToolStripMenuItem TSMICloseToHide;
private System.Windows.Forms.ToolStripMenuItem TSMIConfigFile;
private System.Windows.Forms.ToolStripMenuItem TSMIExportConfig;
private System.Windows.Forms.ToolStripMenuItem TSMIImportConfig;
private System.Windows.Forms.ToolStripMenuItem TSMICopyConfig;
private System.Windows.Forms.ToolStripMenuItem TSMIPasteConfig;
private System.Windows.Forms.ToolStripMenuItem TSMITriggerCountStatistics;
}
}

View File

@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using Microsoft.Win32;
namespace KeyGo
{
public partial class FormMain : Form
@ -105,7 +105,8 @@ namespace KeyGo
private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
{
_KeyGo.UnRegAllKey();
SaveHotKeyItems(_KeyGo);
// 关闭后不用保存,修改时保存即可
//SaveHotKeyItems(_KeyGo);
}
#endregion
@ -194,17 +195,7 @@ namespace KeyGo
var frm = new FormHotKey();
if (frm.ShowDialog() == DialogResult.OK)
{
try
{
var item = frm.HotKeyItem;
_KeyGo.AddHotKey(item);
FLP_AddItem(item);
SaveHotKeyItems(_KeyGo);
}
catch (Exception ex)
{
MessageBox.Show("在添加新的热键时异常:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
AddHotKeyItem(frm.HotKeyItem);
}
}
@ -228,6 +219,30 @@ namespace KeyGo
FLPHotKeys.Controls.SetChildIndex(BtnAdd, i1);
}
private void AddHotKeyItem(HotKeyItem item, bool save = true)
{
try
{
_KeyGo.AddHotKey(item);
}
catch (Exception ex)
{
if (item.Enabled)
{
// 禁用后再添加
item.Enabled = false;
_KeyGo.AddHotKey(item);
}
else
{
MessageBox.Show("在添加新的热键时异常:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
FLP_AddItem(item);
if (save) SaveHotKeyItems(_KeyGo);
}
#endregion
#region
@ -290,6 +305,11 @@ namespace KeyGo
SaveAppConfig(_AppConfig);
}
private void TSMITriggerCountStatistics_Click(object sender, EventArgs e)
{
MessageBox.Show(string.Join(Environment.NewLine, _KeyGo.Items.Select(k => $"[{k.HotKey}]\t[{k.ProcessName}]\t触发了 {k.TriggerCounter} 次")), "统计结果");
}
#endregion
#region
@ -302,29 +322,149 @@ namespace KeyGo
{
try
{
if (enable)
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.SetValue("KeyGo", Application.ExecutablePath);
R_run.Close();
R_local.Close();
}
else
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.DeleteValue("KeyGo", false);
R_run.Close();
R_local.Close();
}
AppAutoStart.SetMeAutoStart(enable);
}
catch (Exception ex)
{
MessageBox.Show("注册表编辑失败" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("设置开机自启时异常:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
#endregion
#region
private void FLPHotKeys_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Link;
else
e.Effect = DragDropEffects.None;
}
private void FLPHotKeys_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetData(DataFormats.FileDrop) is Array files && files.Length > 0)
{
var filepath = files.GetValue(0) as string;
var frm = new FormHotKey
{
HotKeyItem = new HotKeyItem
{
StartupPath = filepath,
}
};
if (frm.ShowDialog() == DialogResult.OK)
{
AddHotKeyItem(frm.HotKeyItem);
}
}
}
#endregion
#region
private string ConfigToString(List<HotKeyItem> items)
{
return string.Join(Environment.NewLine, items.Select(item => $"{item.HotKey}|{item.ProcessName}|{item.StartupPath}"));
}
private List<HotKeyItem> ParseConfig(string config)
{
if (string.IsNullOrWhiteSpace(config))
throw new ArgumentNullException(nameof(config));
return config.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.Select(s =>
{
var strs = s.Split('|');
if (strs.Length < 3)
throw new Exception("数据格式不正确,无法解析");
return new HotKeyItem
{
HotKey = strs[0],
ProcessName = strs[1],
StartupPath = strs[2],
};
}).ToList();
}
private void ImportConfig(string config)
{
if (string.IsNullOrWhiteSpace(config))
{
MessageBox.Show("导入失败,数据为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
var items = ParseConfig(config);
foreach (var item in items)
AddHotKeyItem(item, false);
SaveHotKeyItems(_KeyGo);
MessageBox.Show("导入完成", "提示");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "导入失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void TSMIExportConfig_Click(object sender, EventArgs e)
{
SaveFileDialog frm = new SaveFileDialog
{
Title = "请选择文件保存位置",
Filter = "Config file (*.config)|*.config|All file (*.*)|*.*",
FileName = "KeyGo_Hotkey.config",
RestoreDirectory = true,
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
};
if (frm.ShowDialog() == DialogResult.OK)
{
using (StreamWriter writer = new StreamWriter(frm.OpenFile()))
{
writer.Write(ConfigToString(_KeyGo.Items));
}
if (MessageBox.Show("写入完成,是否打开目录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
Process.Start("Explorer", "/select,"+ frm.FileName);
}
}
private void TSMIImportConfig_Click(object sender, EventArgs e)
{
OpenFileDialog frm = new OpenFileDialog
{
Title = "请选择配置文件",
Filter = "Config file (*.config)|*.config|All file (*.*)|*.*",
RestoreDirectory = true,
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
};
if (frm.ShowDialog() == DialogResult.OK)
{
string data;
using (StreamReader reader = new StreamReader(frm.OpenFile()))
{
data = reader.ReadToEnd();
}
ImportConfig(data);
}
}
private void TSMICopyConfig_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(ConfigToString(_KeyGo.Items), true);
}
private void TSMIPasteConfig_Click(object sender, EventArgs e)
{
ImportConfig(Clipboard.GetText());
}
#endregion
}
}

View File

@ -253,14 +253,24 @@ namespace KeyGo
/// 添加一个新热键
/// </summary>
/// <param name="item">The item.</param>
/// <exception cref="ArgumentNullException">
/// item
/// or
/// HotKey - 热键不能为空!
/// </exception>
/// <exception cref="InvalidOperationException">
/// 功能键不能为空!
/// or
/// 快捷键不能为空!
/// </exception>
public void AddHotKey(HotKeyItem item)
{
if (item is null)
throw new ArgumentNullException(nameof(item));
Items.Add(item);
if (item.Enabled)
RegKey(item);
Items.Add(item);
}
/// <summary>
@ -272,10 +282,9 @@ namespace KeyGo
if (item is null)
throw new ArgumentNullException(nameof(item));
Items.Remove(item);
if (item.HotKeyID != 0)
UnRegKey(item);
Items.Remove(item);
}
/// <summary>

View File

@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType>
<RootNamespace>KeyGo</RootNamespace>
<AssemblyName>KeyGo</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -61,9 +62,7 @@
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -78,6 +77,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppAutoStart.cs" />
<Compile Include="AppConfig.cs" />
<Compile Include="AppControl.cs" />
<Compile Include="AppHotKey.cs" />
@ -131,7 +131,6 @@
<EmbeddedResource Include="UCHotKeyItem.resx">
<DependentUpon>UCHotKeyItem.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -145,7 +144,17 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="KeyGo.ico" />
<Content Include="Resources\ImgAdd.png" />

View File

@ -21,7 +21,7 @@ using System.Runtime.InteropServices;
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("09416937-868e-4ee4-80ee-5e6fa81e2811")]
// 程序集的版本信息由下列四个值组成:
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -19,7 +19,7 @@ namespace KeyGo.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {

View File

@ -1,27 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace KeyGo.Properties
{
namespace KeyGo.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>