Skip to content

Commit

Permalink
1.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
alittelboy committed May 27, 2021
1 parent a8e1dbf commit 156d3c5
Show file tree
Hide file tree
Showing 29 changed files with 3,736 additions and 304 deletions.
Binary file modified .vs/QuickInput/v15/.suo
Binary file not shown.
Binary file modified .vs/QuickInput/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/QuickInput/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/QuickInput/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
Binary file added PS/QC.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PS/QC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PS/QC.psd
Binary file not shown.
380 changes: 284 additions & 96 deletions QuickInput/Form1.Designer.cs

Large diffs are not rendered by default.

526 changes: 397 additions & 129 deletions QuickInput/Form1.cs

Large diffs are not rendered by default.

2,840 changes: 2,770 additions & 70 deletions QuickInput/Form1.resx

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions QuickInput/IniManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace QuickInput
{
class IniManager
{
/// <summary>
/// 为INI文件中指定的节点取得字符串
/// </summary>
/// <param name="lpAppName">欲在其中查找关键字的节点名称</param>
/// <param name="lpKeyName">欲获取的项名</param>
/// <param name="lpDefault">指定的项没有找到时返回的默认值</param>
/// <param name="lpReturnedString">指定一个字串缓冲区,长度至少为nSize</param>
/// <param name="nSize">指定装载到lpReturnedString缓冲区的最大字符数量</param>
/// <param name="lpFileName">INI文件完整路径</param>
/// <returns>复制到lpReturnedString缓冲区的字节数量,其中不包括那些NULL中止字符</returns>
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);

/// <summary>
/// 修改INI文件中内容
/// </summary>
/// <param name="lpApplicationName">欲在其中写入的节点名称</param>
/// <param name="lpKeyName">欲设置的项名</param>
/// <param name="lpString">要写入的新字符串</param>
/// <param name="lpFileName">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
[DllImport("kernel32")]
private static extern int WritePrivateProfileString(string lpApplicationName, string lpKeyName, string lpString, string lpFileName);



/// <summary>
/// 读取INI文件值
/// </summary>
/// <param name="section">节点名</param>
/// <param name="key">键</param>
/// <param name="def">未取到值时返回的默认值</param>
/// <param name="filePath">INI文件完整路径</param>
/// <returns>读取的值</returns>
public static string Read(string section, string key, string def, string filePath, bool check = false)
{
if (check)
{
CheckPath(filePath);
}

StringBuilder sb = new StringBuilder(1024);
GetPrivateProfileString(section, key, def, sb, 1024, filePath);
return sb.ToString();
}

/// <summary>
/// 写INI文件值
/// </summary>
/// <param name="section">欲在其中写入的节点名称</param>
/// <param name="key">欲设置的项名</param>
/// <param name="value">要写入的新字符串</param>
/// <param name="filePath">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
public static int Write(string section, string key, string value, string filePath)
{
CheckPath(filePath);
return WritePrivateProfileString(section, key, value, filePath);
}

private static void CheckPath(string filePath)
{
if (!System.IO.File.Exists(filePath))
{
System.IO.File.Create(filePath).Dispose();//创建INI文件,并释放
}
WriteHelp(filePath);
}

public static void WriteHelp(string filePath)
{
if (Read("words", "65", "", filePath).Equals(""))
{
WritePrivateProfileString("words", "65", "空格 加 a以输入这行数据,需要关闭中文输入法。65-81对应a-z", filePath);
}
if (Read("words", "66", "", filePath).Equals(""))
{
WritePrivateProfileString("words", "66", "空格 加 b以输入这行数据,需要关闭中文输入法。{ENTER}表示换行,{+}、{^}、{%}等符号有特殊含义,可以看底部链接说明。", filePath);
}
WritePrivateProfileString("ReadMe", "KeyCode", "You can get value-key relation in this link. https://www.bejson.com/othertools/keycodes/", filePath);
WritePrivateProfileString("ReadMe", "SendKeys", "You can set special words by this way. https://www.cnblogs.com/shaozhuyong/p/5951779.html", filePath);
}
/// <summary>
/// 删除节
/// </summary>
/// <param name="section">节点名</param>
/// <param name="filePath">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
public static int DeleteSection(string section, string filePath)
{
return Write(section, null, null, filePath);
}

/// <summary>
/// 删除键的值
/// </summary>
/// <param name="section">节点名</param>
/// <param name="key">键名</param>
/// <param name="filePath">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
public static int DeleteKey(string section, string key, string filePath)
{
return Write(section, key, null, filePath);
}
}
}
104 changes: 104 additions & 0 deletions QuickInput/PlaceHolderTextBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RevitDevelopment.CustomControls
{
/// <summary>
/// 带有PlaceHolder的Textbox
/// </summary>
/// <creator>marc</creator>
public class PlaceHolderTextBox : TextBox
{
private bool _isPlaceHolder = true;
private string _placeHolderText;
/// <summary>
/// 提示文本
/// </summary>
public string PlaceHolderText
{
get { return _placeHolderText; }
set
{
_placeHolderText = value;
SetPlaceholder();
}
}

/// <summary>
/// 文本
/// </summary>
public new string Text
{
get
{
return _isPlaceHolder ? string.Empty : base.Text;
}
set
{
base.Text = value;
}
}

/// <summary>
/// 构造函数
/// </summary>
public PlaceHolderTextBox()
{
GotFocus += RemovePlaceHolder;
LostFocus += SetPlaceholder;
}

/// <summary>
/// 当焦点失去的时候,将清空提示文本
/// </summary>
private void SetPlaceholder()
{
if (string.IsNullOrEmpty(base.Text))
{
base.Text = PlaceHolderText;
this.ForeColor = Color.Gray;
this.Font = new Font(this.Font, FontStyle.Italic);
_isPlaceHolder = true;
}
}

/// <summary>
/// 当焦点获得的时候,将显示提示文本
/// </summary>
private void RemovePlaceHolder()
{
if (_isPlaceHolder)
{
base.Text = "";
this.ForeColor = SystemColors.WindowText;
this.Font = new Font(this.Font, FontStyle.Regular);
_isPlaceHolder = false;
}
}

/// <summary>
/// 失去焦点
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SetPlaceholder(object sender, EventArgs e)
{
SetPlaceholder();
}

/// <summary>
/// 获得焦点
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RemovePlaceHolder(object sender, EventArgs e)
{
RemovePlaceHolder();
}
}
}
22 changes: 19 additions & 3 deletions QuickInput/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

Expand All @@ -14,9 +15,24 @@ static class Program
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
//为真 则没有重复运行
bool ifNotAlreadRun;

Mutex mutex = new Mutex(true, Application.ProductName, out ifNotAlreadRun);
if (ifNotAlreadRun)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
mutex.ReleaseMutex();
}
else
{
MessageBox.Show(null, "有一个和本程序相同的应用程序已经在运行,请不要同时运行多个本程序。\n\n这个程序即将退出。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
Application.Exit();//退出程序
}


}
}
}
Binary file added QuickInput/QC.ico
Binary file not shown.
Binary file added QuickInput/QC_big.ico
Binary file not shown.
19 changes: 18 additions & 1 deletion QuickInput/QuickInput.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>bitbug_favicon%281%29.ico</ApplicationIcon>
<ApplicationIcon>QC_big.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -55,6 +55,10 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="IniManager.cs" />
<Compile Include="PlaceHolderTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
Expand Down Expand Up @@ -84,6 +88,19 @@
</ItemGroup>
<ItemGroup>
<Content Include="bitbug_favicon%281%29.ico" />
<Content Include="QC.ico" />
<Content Include="QC_big.ico" />
</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>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file modified QuickInput/bin/Debug/QuickInput.exe
Binary file not shown.
Binary file modified QuickInput/bin/Debug/QuickInput.pdb
Binary file not shown.
Binary file modified QuickInput/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary file not shown.
Binary file modified QuickInput/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file not shown.
Binary file modified QuickInput/obj/Debug/QuickInput.Form1.resources
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
234f27e758b4748269395cef054b9d2e69872430
d7caa3e0fb5a4a4b686d8652a9c318e287eb41b6
2 changes: 2 additions & 0 deletions QuickInput/obj/Debug/QuickInput.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ D:\bc\c#\QuickInput\QuickInput\obj\Debug\QuickInput.csproj.CoreCompileInputs.cac
D:\bc\c#\QuickInput\QuickInput\obj\Debug\QuickInput.exe
D:\bc\c#\QuickInput\QuickInput\obj\Debug\QuickInput.pdb
D:\bc\c#\QuickInput\QuickInput\obj\Debug\QuickInput.Form1.resources
D:\bc\c#\QuickInput\QuickInput\obj\Debug\Interop.IWshRuntimeLibrary.dll
D:\bc\c#\QuickInput\QuickInput\obj\Debug\QuickInput.csproj.ResolveComReference.cache
Binary file modified QuickInput/obj/Debug/QuickInput.csproj.GenerateResource.cache
Binary file not shown.
Binary file not shown.
Binary file modified QuickInput/obj/Debug/QuickInput.exe
Binary file not shown.
Binary file modified QuickInput/obj/Debug/QuickInput.pdb
Binary file not shown.
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ An app to accelerate keyboard input in Windows.

思路来自于星际争霸的快捷键**编队**思想。

# 1.1版本更新
- 完善测试模式,可以修改设置文件地址
- 改善快捷键逻辑,按下触发而不是抬起,解决部分中文输入法空格时的误触发
- 新增2个按钮,帮助用户快速使用
# 1.3 版本更新
- 新增了导入设置文件,另存为设置文件
- 新增了测试模式下,可以修改检测的时间间隔
- 新增了测试模式下,可以修改热键,来替代快捷键,建议输入可以被2个退格删掉的按键

# 使用方法:
## 快捷输入
Expand All @@ -24,6 +24,8 @@ Ctrl + Shift +

原理:输出Ctrl C,然后添加到**编队**

## 测试模式
测试模式下,按键可以在窗体标题看见按键码。

# 设置方法:

Expand All @@ -33,6 +35,24 @@ Ctrl + Shift +
## 方法2:
使用快捷键修改**编队**,会自动保存到对应文件。

# 新功能
## 1.3 版本更新
- 新增了导入设置文件,另存为设置文件
- 新增了测试模式下,可以修改检测的时间间隔
- 新增了测试模式下,可以修改热键,来替代快捷键,建议输入可以被2个退格删掉的按键

## 1.2 版本更新
- 新增托盘模式,点×不会直接关闭,而是到右下角托盘
- 去掉了杂乱的按键,换成了顶部菜单
- 现在可以设置开机启动
- 现在可以启动时是否显示窗体
- 修改了图标


## 1.1 版本更新
- 完善测试模式,可以修改设置文件地址
- 改善快捷键逻辑,按下触发而不是抬起,解决部分中文输入法空格时的误触发
- 新增2个按钮,帮助用户快速使用


# 速查表
Expand Down

0 comments on commit 156d3c5

Please sign in to comment.