├── Bin
└── Debug
│ ├── config
│ ├── EXCEL.xml
│ ├── POWERPNT.xml
│ ├── WINWORD.xml
│ ├── __global.xml
│ ├── et.xml
│ ├── wpp.xml
│ └── wps.xml
│ ├── intro
│ ├── 0.png
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ └── 6.png
│ └── plugins
│ └── 3rdparty
│ └── everything
│ ├── everything.exe
│ ├── everything32.dll
│ └── everything64.dll
├── Coding
├── Quick.sln
├── Quick
│ ├── Config.cs
│ ├── Extension.cs
│ ├── Global.Designer.cs
│ ├── Global.resx
│ ├── Hotkey.cs
│ ├── IQuickPlugin.cs
│ ├── IQuickWindow.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ ├── Settings.settings
│ │ └── app.manifest
│ ├── Quick.csproj
│ ├── Quick.v11.suo
│ ├── QuickCommonObject.cs
│ ├── QuickConfig.cs
│ ├── QuickContext.cs
│ ├── QuickListener.cs
│ ├── QuickMethod.cs
│ ├── QuickModel.cs
│ ├── QuickMultiVersion.cs
│ ├── QuickNotify.cs
│ ├── QuickPluginLoader.cs
│ ├── QuickReflection.cs
│ ├── QuickSafePluginRef.cs
│ ├── QuickSafeReflection.cs
│ ├── QuickUpdate.cs
│ ├── QuickVitality.cs
│ ├── UI
│ │ ├── QuickContextWindowHandler.cs
│ │ ├── QuickMainWindowHandler.cs
│ │ └── QuickPreferenceWindowHandler.cs
│ ├── Utilities.cs
│ ├── app.config
│ └── quick.ico
├── QuickPlugin
│ ├── Calc
│ │ ├── QuickCalc.cs
│ │ ├── QuickCalcCache.cs
│ │ ├── QuickCalcException.cs
│ │ ├── QuickCalcItem.cs
│ │ ├── QuickCalcLog.cs
│ │ ├── QuickCalcParse.cs
│ │ ├── QuickCalcScanner.cs
│ │ └── QuickCalcToken.cs
│ ├── Find
│ │ ├── QuickEverything.cs
│ │ ├── QuickEverything32.cs
│ │ ├── QuickEverything64.cs
│ │ ├── QuickFind.cs
│ │ └── QuickFindItem.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── QuickPlugin.cs
│ ├── QuickPlugin.csproj
│ ├── Resource.Designer.cs
│ ├── Resource.resx
│ └── Run
│ │ ├── QuickRun.cs
│ │ └── QuickRunItem.cs
├── QuickUI
│ ├── IQuickContextWindowHandler.cs
│ ├── IQuickMainWindowHandler.cs
│ ├── IQuickPreferenceWindowHandler.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── QuickContextWindow.xaml
│ ├── QuickContextWindow.xaml.cs
│ ├── QuickListBox.cs
│ ├── QuickListItem.cs
│ ├── QuickMainWindow.xaml
│ ├── QuickMainWindow.xaml.cs
│ ├── QuickPerferenceContextEdit.xaml
│ ├── QuickPerferenceContextEdit.xaml.cs
│ ├── QuickPreferenceWindow.xaml
│ ├── QuickPreferenceWindow.xaml.cs
│ ├── QuickUI.csproj
│ ├── QuickUIResource.cs
│ ├── Resources
│ │ └── icons
│ │ │ ├── config_about.png
│ │ │ ├── config_behaviors.png
│ │ │ ├── config_general.png
│ │ │ ├── locked.png
│ │ │ ├── plugin.png
│ │ │ ├── quick.png
│ │ │ ├── quick128.png
│ │ │ └── unlocked.png
│ ├── Themes
│ │ └── Generic.xaml
│ └── app.config
├── QuickUpdate
│ ├── App.config
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── QuickUpdate.csproj
│ └── SilenceUpdate.cs
└── Resources
│ └── icons
│ ├── folder16.png
│ ├── folder24.png
│ ├── folder32.png
│ ├── folder48.png
│ ├── locked16.png
│ ├── locked24.png
│ ├── plugin32.png
│ ├── plugin48.png
│ ├── quick128.png
│ ├── quick16.png
│ ├── quick24.png
│ ├── quick32.png
│ ├── quick48.png
│ ├── quick64.png
│ ├── quick72.png
│ ├── unlocked16.png
│ └── unlocked24.png
├── LICENSE
└── README.md
/Bin/Debug/config/POWERPNT.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | powerpoint.application
4 | 231
5 | 121
6 | 55
7 | Left
8 | Width
9 | Top
10 | ActiveWindow.Selection.TextRange.Text
11 |
12 |
13 |
14 | 字体颜色[zitiyanse] : 自动[zidong]
15 | ActiveWindow.Selection.TextRange.Font.Color
16 | 将所选字体的颜色设置为自动
17 |
18 | -16777216
19 | 0
20 |
21 |
22 |
23 | 字体颜色[zitiyanse] : 红色[hongse]
24 | ActiveWindow.Selection.TextRange.Font.Color
25 | 将所选字体的颜色设置为红色
26 |
27 | 255
28 | 0
29 |
30 |
31 |
32 | 字体颜色[zitiyanse] : 蓝色[lanse]
33 | ActiveWindow.Selection.TextRange.Font.Color
34 | 将所选字体的颜色设置为蓝色
35 |
36 | 16711680
37 | 0
38 |
39 |
40 |
41 | 字体颜色[zitiyanse] : 白色[baise]
42 | ActiveWindow.Selection.TextRange.Font.Color
43 | 将所选字体的颜色设置为白色
44 |
45 | 16777215
46 | 0
47 |
48 |
49 |
50 | 字体颜色[zitiyanse] : 黄色[huangse]
51 | ActiveWindow.Selection.TextRange.Font.Color
52 | 将所选字体的颜色设置为黄色
53 |
54 | 65535
55 | 0
56 |
57 |
58 |
59 | 字体颜色[zitiyanse] : 绿色[lvse]
60 | ActiveWindow.Selection.TextRange.Font.Color
61 | 将所选字体的颜色设置为绿色
62 |
63 | 32768
64 | 0
65 |
66 |
67 |
68 | 字体颜色[zitiyanse] : 黑色[heise]
69 | ActiveWindow.Selection.TextRange.Font.Color
70 | 将所选字体的颜色设置为黑色
71 |
72 | 0
73 | 0
74 |
75 |
76 |
77 | 字体颜色[zitiyanse] : 选择颜色[xuanzeyanse]
78 | @Win32Color("ActiveWindow.Selection.TextRange.Font.Color.RGB")!ActiveWindow.Selection.TextRange.Font.Color
79 | 从颜色对话框中选择字体颜色
80 |
81 |
82 | 0
83 |
84 |
85 |
86 | 字体[ziti] : 宋体[songti]
87 | ActiveWindow.Selection.TextRange.Font.Name
88 | 将所选文字的字体设置为宋体
89 |
90 | 宋体
91 | 0
92 |
93 |
94 |
95 | 字体[ziti] : 仿宋[fangsong]
96 | ActiveWindow.Selection.TextRange.Font.Name
97 | 将所选文字的字体设置为仿宋
98 |
99 | 仿宋
100 | 0
101 |
102 |
103 |
104 | 字体[ziti] : 隶书[lishu]
105 | ActiveWindow.Selection.TextRange.Font.Name
106 | 将所选文字的字体设置为隶书
107 |
108 | 隶书
109 | 0
110 |
111 |
112 |
113 | 字体[ziti] : 微软雅黑[weiruanyahei]
114 | ActiveWindow.Selection.TextRange.Font.Name
115 | 将所选文字的字体设置为微软雅黑
116 |
117 | 微软雅黑
118 | 0
119 |
120 |
121 |
122 | 字体[ziti] : 黑体[heiti]
123 | ActiveWindow.Selection.TextRange.Font.Name
124 | 将所选文字的字体设置为黑体
125 |
126 | 黑体
127 | 0
128 |
129 |
130 |
131 | 字体[ziti] : Times New Roman
132 | ActiveWindow.Selection.TextRange.Font.Name
133 | 将所选文字的字体设置为Times New Roman
134 |
135 | "Times New Roman"
136 | 0
137 |
138 |
139 |
140 | 字体[ziti] : Consolas
141 | ActiveWindow.Selection.TextRange.Font.Name
142 | 将所选文字的字体设置为Consolas
143 |
144 | Consolas
145 | 0
146 |
147 |
148 |
149 | 字体[ziti] : Arial
150 | ActiveWindow.Selection.TextRange.Font.Name
151 | 将所选文字的字体设置为Arial
152 |
153 | Arial
154 | 0
155 |
156 |
157 |
158 | 字体[ziti] : 字体名
159 | ActiveWindow.Selection.TextRange.Font.Name
160 | 将所选文字的字体设置为指定名称的字体
161 | .
162 |
163 | 0
164 |
165 |
166 |
167 | 窗口最大化[chuangkouzuidahua maximum]
168 | WindowState
169 | 使程序窗口最大化
170 |
171 | 3
172 | 0
173 |
174 |
175 |
176 | 窗口还原[chuangkouhuanyuan normal]
177 | WindowState
178 | 使程序窗口大小还原
179 |
180 | 1
181 | 0
182 |
183 |
184 |
185 |
--------------------------------------------------------------------------------
/Bin/Debug/config/__global.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 255
5 | 255
6 | 255
7 | Left
8 | Width
9 | Top
10 | GetSelection
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Bin/Debug/intro/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/intro/0.png
--------------------------------------------------------------------------------
/Bin/Debug/intro/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/intro/1.png
--------------------------------------------------------------------------------
/Bin/Debug/intro/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/intro/2.png
--------------------------------------------------------------------------------
/Bin/Debug/intro/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/intro/3.png
--------------------------------------------------------------------------------
/Bin/Debug/intro/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/intro/4.png
--------------------------------------------------------------------------------
/Bin/Debug/intro/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/intro/5.png
--------------------------------------------------------------------------------
/Bin/Debug/intro/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/intro/6.png
--------------------------------------------------------------------------------
/Bin/Debug/plugins/3rdparty/everything/everything.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/plugins/3rdparty/everything/everything.exe
--------------------------------------------------------------------------------
/Bin/Debug/plugins/3rdparty/everything/everything32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/plugins/3rdparty/everything/everything32.dll
--------------------------------------------------------------------------------
/Bin/Debug/plugins/3rdparty/everything/everything64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Bin/Debug/plugins/3rdparty/everything/everything64.dll
--------------------------------------------------------------------------------
/Coding/Quick.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quick", "Quick\Quick.csproj", "{D26B7BEA-D131-4801-A19B-E0AFC6740322}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickUpdate", "QuickUpdate\QuickUpdate.csproj", "{E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickPlugin", "QuickPlugin\QuickPlugin.csproj", "{EA358646-8755-4A40-AABC-200C03CF86CC}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickUI", "QuickUI\QuickUI.csproj", "{F36B622E-4F74-4D69-912C-FB9DE8915362}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Debug|Mixed Platforms = Debug|Mixed Platforms
18 | Debug|Win32 = Debug|Win32
19 | Release|Any CPU = Release|Any CPU
20 | Release|Mixed Platforms = Release|Mixed Platforms
21 | Release|Win32 = Release|Win32
22 | Template|Any CPU = Template|Any CPU
23 | Template|Mixed Platforms = Template|Mixed Platforms
24 | Template|Win32 = Template|Win32
25 | EndGlobalSection
26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
27 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Debug|Any CPU.Build.0 = Debug|Any CPU
29 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
30 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
31 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Debug|Win32.ActiveCfg = Debug|Any CPU
32 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
35 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Release|Mixed Platforms.Build.0 = Release|Any CPU
36 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Release|Win32.ActiveCfg = Release|Any CPU
37 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Template|Any CPU.ActiveCfg = Release|Any CPU
38 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Template|Any CPU.Build.0 = Release|Any CPU
39 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Template|Mixed Platforms.ActiveCfg = Release|Any CPU
40 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Template|Mixed Platforms.Build.0 = Release|Any CPU
41 | {D26B7BEA-D131-4801-A19B-E0AFC6740322}.Template|Win32.ActiveCfg = Release|Any CPU
42 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
45 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Debug|Win32.ActiveCfg = Debug|Any CPU
46 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Release|Any CPU.Build.0 = Release|Any CPU
48 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
49 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Release|Win32.ActiveCfg = Release|Any CPU
50 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Template|Any CPU.ActiveCfg = Release|Any CPU
51 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Template|Mixed Platforms.ActiveCfg = Release|Any CPU
52 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}.Template|Win32.ActiveCfg = Release|Any CPU
53 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
55 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
56 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
57 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Debug|Win32.ActiveCfg = Debug|Any CPU
58 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
59 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Release|Any CPU.Build.0 = Release|Any CPU
60 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
61 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
62 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Release|Win32.ActiveCfg = Release|Any CPU
63 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Template|Any CPU.ActiveCfg = Release|Any CPU
64 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Template|Any CPU.Build.0 = Release|Any CPU
65 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Template|Mixed Platforms.ActiveCfg = Release|Any CPU
66 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Template|Mixed Platforms.Build.0 = Release|Any CPU
67 | {EA358646-8755-4A40-AABC-200C03CF86CC}.Template|Win32.ActiveCfg = Release|Any CPU
68 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Debug|Any CPU.Build.0 = Debug|Any CPU
70 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
71 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
72 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Debug|Win32.ActiveCfg = Debug|Any CPU
73 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Release|Any CPU.ActiveCfg = Release|Any CPU
74 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Release|Any CPU.Build.0 = Release|Any CPU
75 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
76 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Release|Mixed Platforms.Build.0 = Release|Any CPU
77 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Release|Win32.ActiveCfg = Release|Any CPU
78 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Template|Any CPU.ActiveCfg = Release|Any CPU
79 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Template|Any CPU.Build.0 = Release|Any CPU
80 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Template|Mixed Platforms.ActiveCfg = Release|Any CPU
81 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Template|Mixed Platforms.Build.0 = Release|Any CPU
82 | {F36B622E-4F74-4D69-912C-FB9DE8915362}.Template|Win32.ActiveCfg = Release|Any CPU
83 | EndGlobalSection
84 | GlobalSection(SolutionProperties) = preSolution
85 | HideSolutionNode = FALSE
86 | EndGlobalSection
87 | EndGlobal
88 |
--------------------------------------------------------------------------------
/Coding/Quick/Config.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Windows.Forms;
4 | using System.Xml.Serialization;
5 |
6 | namespace Froser.Quick
7 | {
8 | public class QuickConfig
9 | {
10 | public Boolean FirstRun { get; set; }
11 | public Keys HotKey { get; set; }
12 | public Int32 HotKeyFlags { get; set; }
13 | public Boolean SearchToogle { get; set; }
14 |
15 | private static String ConfigDir
16 | {
17 | get
18 | {
19 | String strConfigDirector = Application.StartupPath;
20 | if (!Directory.Exists(strConfigDirector))
21 | {
22 | Directory.CreateDirectory(strConfigDirector);
23 | }
24 | return strConfigDirector;
25 | }
26 | }
27 |
28 | private static String ConfigPath
29 | {
30 | get
31 | {
32 | return Path.Combine(ConfigDir, "quick.config");
33 | }
34 | }
35 |
36 | private static QuickConfig _config;
37 | public static QuickConfig ThisConfig
38 | {
39 | get
40 | {
41 | if (_config == null)
42 | {
43 | _config = Load();
44 | }
45 | return _config;
46 | }
47 | }
48 |
49 | private QuickConfig()
50 | {
51 | FirstRun = true;
52 | HotKey = Keys.Q;
53 | HotKeyFlags = (int)Hotkey.KeyFlags.MOD_CONTROL;
54 | SearchToogle = true;
55 | }
56 |
57 | public bool TrySave()
58 | {
59 | return TrySave(this);
60 | }
61 |
62 | ///
63 | /// 读取一个配置文件,并返回一个PluginConfig对象。若XML配置文件不存在,则会用初始化本类的方式(使用默认初始化值)来创建一个配置文件。
64 | ///
65 | private static QuickConfig Load()
66 | {
67 | QuickConfig instance;
68 | if (!File.Exists(ConfigPath))
69 | {
70 | //配置文件不存在,则创建一个新的实例
71 | instance = new QuickConfig();
72 | TrySave(instance);
73 | }
74 | else
75 | {
76 | //如果文件存在,则反序列化它
77 | XmlSerializer xmlsLoad = new XmlSerializer(typeof(QuickConfig));
78 | using (FileStream fs = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read))
79 | {
80 | instance = (QuickConfig)xmlsLoad.Deserialize(fs);
81 | }
82 | }
83 | return instance;
84 | }
85 |
86 | private static bool TrySave(QuickConfig instance)
87 | {
88 | try
89 | {
90 | //注意:以下操作线程不安全
91 | //将密码暂时加密
92 | XmlSerializer xmlsSave = new XmlSerializer(typeof(QuickConfig));
93 | using (FileStream fs = new FileStream(ConfigPath, FileMode.Create, FileAccess.Write))
94 | {
95 | xmlsSave.Serialize(fs, instance);
96 | }
97 | return true;
98 | }
99 | catch
100 | {
101 | return false;
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/Coding/Quick/Extension.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using System;
3 | using System.Text.RegularExpressions;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.Windows.Media.Imaging;
7 | using System.Drawing;
8 | using System.Windows.Interop;
9 | using System.Windows;
10 | using System.Windows.Input;
11 |
12 | namespace Froser.Quick
13 | {
14 | public static class Extension
15 | {
16 | //判断某字符串是否按顺序含有子字符串,如abcd含有ac但是不含有ca
17 | public static bool HasString(this String str, String substr)
18 | {
19 | //包含在{}中的字符表示,不作为查找依据。例如,{x, y}中,忽略x, y这几个字符,当然{}本身也不包含在内
20 | Regex brace = new Regex(@"\{(.*?)\}");
21 | //先统一大小写
22 | str = str.ToLower();
23 | substr = substr.ToLower();
24 |
25 | bool result = false;
26 | String rec_str = brace.Replace(str, "");
27 | for (int i = 0; i < substr.Length; i++)
28 | {
29 | int index = rec_str.IndexOf(substr[i]);
30 | if (index < 0)
31 | {
32 | return false;
33 | }
34 | else
35 | {
36 | if (rec_str.Length == 1) return ( i == substr.Length - 1);
37 | rec_str = rec_str.Substring(index + 1);
38 | result = true;
39 | }
40 | }
41 |
42 | return result;
43 | }
44 |
45 | public static int Plus(this object lhs, object addend)
46 | {
47 | if (lhs is int)
48 | {
49 | if (addend is int)
50 | {
51 | return (int)lhs + (int)addend;
52 | }
53 | else if (addend is float || addend is double)
54 | {
55 | return (int)((int)lhs + double.Parse(addend.ToString()));
56 | }
57 | else
58 | {
59 | throw new NotSupportedException();
60 | }
61 | }
62 | else if (lhs is float || lhs is double)
63 | {
64 | if (addend is int)
65 | {
66 | return (int)(double.Parse (lhs.ToString ()) + (int)addend);
67 | }
68 | else if (addend is float || addend is double)
69 | {
70 | return (int)(double.Parse(lhs.ToString()) + double.Parse(addend.ToString()));
71 | }
72 | else
73 | {
74 | throw new NotSupportedException();
75 | }
76 | }
77 | else
78 | {
79 | throw new NotSupportedException();
80 | }
81 | }
82 |
83 | public static void ShowBalloonTip(this NotifyIcon notify, String text)
84 | {
85 | notify.ShowBalloonTip(500, System.Windows.Forms.Application.ProductName, text, ToolTipIcon.Info);
86 | }
87 |
88 | public static void Swap(this IList list, object a, object b)
89 | {
90 | int indexOfB = list.IndexOf (b);
91 | list.Insert(list.IndexOf (a), b);
92 | list.Remove(a);
93 | list.Remove(b);
94 | list.Insert(indexOfB, a);
95 | }
96 |
97 | public static string KeyToString(this Key key)
98 | {
99 | switch (key.ToString().ToLower())
100 | {
101 | case "oem3":
102 | return "`";
103 | default:
104 | return key.ToString();
105 | }
106 | }
107 |
108 | public static bool ContainsKey(this Dictionary dic, String key, bool ignoreCase, out string keyInModel)
109 | {
110 | keyInModel = "";
111 | foreach (var item in dic.Keys)
112 | {
113 | if (String.Compare(item, key, ignoreCase) == 0) {
114 | keyInModel = item;
115 | return true;
116 | }
117 | }
118 | return false;
119 | }
120 |
121 | public static BitmapSource ToBitmapSource(this Icon icon)
122 | {
123 | var bitmap = icon.ToBitmap();
124 | var hbitmap = bitmap.GetHbitmap();
125 | return Imaging.CreateBitmapSourceFromHBitmap(hbitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
126 | }
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/Coding/Quick/Global.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Global {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Global() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Froser.Quick.Global", typeof(Global).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Coding/Quick/Global.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
--------------------------------------------------------------------------------
/Coding/Quick/Hotkey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Windows.Input;
4 |
5 | namespace Froser.Quick
6 | {
7 | internal delegate void HotkeyEventHandler(int HotKeyID);
8 |
9 | internal class Hotkey : global::System.Windows.Forms.IMessageFilter
10 | {
11 | global::System.Collections.Hashtable keyIDs = new global::System.Collections.Hashtable();
12 | IntPtr hWnd;
13 |
14 | public event HotkeyEventHandler OnHotkey;
15 |
16 | public enum KeyFlags
17 | {
18 | MOD_NONE = 0x0,
19 | MOD_ALT = 0x1,
20 | MOD_CONTROL = 0x2,
21 | MOD_SHIFT = 0x4,
22 | MOD_WIN = 0x8,
23 | MOD_NOREPEAT = 0x4000
24 | }
25 | [DllImport("user32.dll")]
26 | private static extern UInt32 RegisterHotKey(IntPtr hWnd, UInt32 id, UInt32 fsModifiers, UInt32 vk);
27 |
28 | [DllImport("user32.dll")]
29 | private static extern UInt32 UnregisterHotKey(IntPtr hWnd, UInt32 id);
30 |
31 | [DllImport("kernel32.dll")]
32 | private static extern UInt32 GlobalAddAtom(String lpString);
33 |
34 | [DllImport("kernel32.dll")]
35 | private static extern UInt32 GlobalDeleteAtom(UInt32 nAtom);
36 |
37 | public Hotkey(IntPtr hWnd)
38 | {
39 | this.hWnd = hWnd;
40 | global::System.Windows.Forms.Application.AddMessageFilter(this);
41 | }
42 |
43 | public int RegisterHotkey(Key Key, KeyFlags keyflags)
44 | {
45 | try
46 | {
47 | UInt32 hotkeyid = GlobalAddAtom(global::System.Guid.NewGuid().ToString());
48 | int keycode = KeyInterop.VirtualKeyFromKey(Key);
49 | RegisterHotKey((IntPtr)hWnd, hotkeyid, (UInt32)keyflags, (UInt32)keycode);
50 | keyIDs.Add(hotkeyid, hotkeyid);
51 | return (int)hotkeyid;
52 | }
53 | catch { return 0; };
54 | }
55 |
56 | public void UnregisterHotkeys()
57 | {
58 | global::System.Windows.Forms.Application.RemoveMessageFilter(this);
59 | foreach (UInt32 key in keyIDs.Values)
60 | {
61 | UnregisterHotKey(hWnd, key);
62 | GlobalDeleteAtom(key);
63 | }
64 | }
65 |
66 | public bool PreFilterMessage(ref global::System.Windows.Forms.Message m)
67 | {
68 | if (m.Msg == 0x312)
69 | {
70 | if (OnHotkey != null)
71 | {
72 | foreach (UInt32 key in keyIDs.Values)
73 | {
74 | if ((UInt32)m.WParam == key)
75 | {
76 | OnHotkey((int)m.WParam);
77 | return true;
78 | }
79 | }
80 | }
81 | }
82 | return false;
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/Coding/Quick/IQuickPlugin.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Input;
3 | using System.Windows.Media;
4 |
5 | namespace Froser.Quick
6 | {
7 | public interface IQuickPlugin
8 | {
9 | IQuickPluginMethod[] GetMethods();
10 | }
11 |
12 | public interface IQuickPluginMethod
13 | {
14 | string GetName();
15 | string GetDescription(IQuickWindow quickWindow);
16 | string AvailableApplicationName();
17 | void Invoke(object sender, IQuickWindow quickWindow);
18 | bool AcceptArgs();
19 | bool GetIcon(IQuickWindow quickWindow, out ImageSource icon);
20 |
21 | // 事件回调
22 | // 插件在激活状态下按下一个键时
23 | void KeyDown(IQuickWindow quickWindow, KeyEventArgs e);
24 | // 插件在激活状态下搜索文本有变化时
25 | void TextChanged(IQuickWindow quickWindow, TextChangedEventArgs e);
26 | // 主窗体关闭时
27 | void Closed(IQuickWindow quickWindow);
28 | void PageDown(IQuickWindow quickWindow);
29 | void PageUp(IQuickWindow quickWindow);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Coding/Quick/IQuickWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 |
7 | namespace Froser.Quick
8 | {
9 | public interface IQuickWindow
10 | {
11 | string GetPluginsPath();
12 | void SetQueryText(string text);
13 | string GetQueryText();
14 | string GetArgument();
15 | RichTextBox GetQueryTextBox();
16 | void ReplaceMethods(IQuickPluginMethod[] methods);
17 | void ResetMethods();
18 | void Refresh(int selectIndex);
19 | int GetCurrentPage();
20 | void LockWindow();
21 | void UnlockWindow();
22 | void AsyncInvoke(Action action);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Coding/Quick/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Drawing;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Xml.Linq;
7 | using System.Security.Principal;
8 | using System.Windows.Forms;
9 |
10 | namespace Froser.Quick
11 | {
12 | static class Program
13 | {
14 | public static NotifyIcon notify = new NotifyIcon();
15 | ///
16 | /// 应用程序的主入口点。
17 | ///
18 | [STAThread]
19 | static void Main()
20 | {
21 | if (QuickUpdate.LocalUpdate())
22 | {
23 | Environment.Exit(0);
24 | return;
25 | }
26 |
27 | if (Init())
28 | {
29 | Application.Run();
30 | }
31 | }
32 |
33 | public static void Quit()
34 | {
35 | notify.Visible = false;
36 | Application.ExitThread();
37 | }
38 |
39 | static bool Init()
40 | {
41 | const string adminComment = "Quick当前是以管理员身份运行。此时,您的宿主程序也必须是以管理员身份运行,这样Quick快捷菜单才能正常出现。";
42 |
43 | var mutexStr = "__QUICK____QUICK____QUICK____QUICK____QUICK__";
44 | bool canCreateMutex;
45 | Mutex programMutex = new Mutex(false, mutexStr, out canCreateMutex);
46 | if (canCreateMutex)
47 | {
48 | notify = QuickNotify.GetNotify();
49 | notify.Visible = true;
50 |
51 | if (QuickConfig.ThisConfig.FirstRun)
52 | {
53 | QuickConfig.ThisConfig.FirstRun = false;
54 | QuickConfig.ThisConfig.TrySave();
55 |
56 | string additional = IsAdministrator() ? adminComment : string.Empty;
57 |
58 | notify.ShowBalloonTip("Quick已经运行,您可以点击右键查看其选项。" + " " + adminComment);
59 | }
60 | else if (IsAdministrator())
61 | notify.ShowBalloonTip(adminComment);
62 |
63 | Action silenceUpdate = () =>
64 | {
65 | QuickUpdate.SilenceUpdate();
66 | };
67 | silenceUpdate.BeginInvoke(null, null);
68 |
69 | QuickListener.Listener.Run();
70 | return true;
71 | }
72 | return false;
73 | }
74 |
75 | public static bool IsAdministrator()
76 | {
77 | WindowsIdentity identity = WindowsIdentity.GetCurrent();
78 | WindowsPrincipal principal = new WindowsPrincipal(identity);
79 | return principal.IsInRole(WindowsBuiltInRole.Administrator);
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Coding/Quick/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Quick")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Froser")]
12 | [assembly: AssemblyProduct("Quick")]
13 | [assembly: AssemblyCopyright("Froser")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("f3a5a152-cbb0-4ccf-9edc-3ad4ca42371c")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.1.0.0")]
37 |
--------------------------------------------------------------------------------
/Coding/Quick/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Froser.Quick.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。
65 | ///
66 | internal static System.Drawing.Bitmap quick {
67 | get {
68 | object obj = ResourceManager.GetObject("quick", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Coding/Quick/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 |
123 | iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
124 | JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACIUlEQVRYR7XXP0gWcRzH8SeNtCBJMojA
125 | ooQgBCcDt1qaitw0NzcxaAtBabIlQfAPuAgKDdLkotDmpBKiIrQ0JeigSUFB0KOo5ftzfC8e5Mvd/c7z
126 | A6/t9/18fR7vvLOUlvJqW+wt/uV0hG5EXUGxoYuYhVeexRbuw1oDoiFcxwa88ixGUA1rDYiG0Ixv8MrT
127 | /MBDWGNgNIguHMBbkEa/uiuwxoBoCBcwCa88zR88RdQVHBu8ikV4C9Ks4AasMTAaxD3oKvYWJNGt14N8
128 | n16x4efQV+ktSbKJJlhbYDRoJuAtSDOEKlhjYDSIOizDW5DkbLeeomE8wA68JUn+33qxoFQM9kIXk7ck
129 | ySdMYRqvcA3WniE6jBrMwVsQ4hCvEfVmih2+g6/wSkONI/sFqYPIe/ud9gtPkO0biA9iFF5hiGO8wyXY
130 | hpToIPR1fYBXGmIJt2DtGaLDZhB57oDYHh4j6guKDekl5AX6MWDe4DO8hZV05fch30uIFxXhMhbgLa30
131 | EfoANl1AVIab+AJvaWwbrYhmCosVtuA7vMWyDz2C9RJjkwVFhehE0qvZDPQAs6mCokIzBm+x6Fejh1d0
132 | ttBYqf6YzMNb/hsdKH65YsX1WMfp5X+h9/5a2ETBUTHuwns31KO3EXb6HKJy6Nb6icrlu3iE6My5xRY8
133 | g26zeHkZL5H/vS9rtADtiH8APSOGke8/ntBoCW5jDVr+Hg2wE3lTKp0AUQK3//kdzGoAAAAASUVORK5C
134 | YII=
135 |
136 |
137 |
--------------------------------------------------------------------------------
/Coding/Quick/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.18444
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Coding/Quick/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Coding/Quick/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
54 |
--------------------------------------------------------------------------------
/Coding/Quick/Quick.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Quick/Quick.v11.suo
--------------------------------------------------------------------------------
/Coding/Quick/QuickCommonObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Runtime.InteropServices;
7 | using System.Text;
8 | using System.Threading;
9 | using System.Windows.Forms;
10 |
11 | namespace Froser.Quick
12 | {
13 | [Serializable]
14 | internal class QuickCommonObject
15 | {
16 | [DllImport("user32.dll", EntryPoint = "keybd_event")]
17 | public static extern void keybd_event(
18 | byte bVk, //虚拟键值
19 | byte bScan,// 一般为0
20 | int dwFlags, //这里是整数类型 0 为按下,2为释放
21 | int dwExtraInfo //这里是整数类型 一般情况下设成为 0
22 | );
23 |
24 | [DllImport("user32.dll")]
25 | private static extern int GetWindowRect(IntPtr hwnd, out Rect lpRect);
26 | public struct Rect
27 | {
28 | public int Left;
29 | public int Top;
30 | public int Right;
31 | public int Bottom;
32 | }
33 | private IntPtr currentWindowPtr;
34 | private bool isGlobal;
35 |
36 | public QuickCommonObject(IntPtr windowPtr, bool isGlobal)
37 | {
38 | currentWindowPtr = windowPtr;
39 | this.isGlobal = isGlobal;
40 | }
41 |
42 |
43 | public Rect GetWindowRect()
44 | {
45 | Rect lpRect;
46 | if (isGlobal)
47 | {
48 | var rect = Screen.GetWorkingArea(new Point(0, 0));
49 | lpRect.Left = rect.Left;
50 | lpRect.Right = rect.Right;
51 | lpRect.Top = rect.Top;
52 | lpRect.Bottom = rect.Bottom;
53 | }
54 | else
55 | {
56 | GetWindowRect(currentWindowPtr, out lpRect);
57 | }
58 | return lpRect;
59 | }
60 |
61 | public String GetSelection
62 | {
63 | get
64 | {
65 | keybd_event((byte)Keys.LControlKey, 0, 0, 0);
66 | keybd_event((byte)Keys.C, 0, 0, 0);
67 | keybd_event((byte)Keys.LControlKey, 0, 2, 0);
68 | keybd_event((byte)Keys.C, 0, 2, 0);
69 | Thread.Sleep(10);
70 | return Clipboard.GetText();
71 | }
72 | }
73 |
74 | public void Call(String cmd, String arg)
75 | {
76 | Process.Start(cmd, arg);
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Windows.Forms;
5 | using System.Windows.Input;
6 | using System.Xml.Serialization;
7 | namespace Froser.Quick
8 | {
9 | public class QuickConfig
10 | {
11 | public class ContextMenuItem
12 | {
13 | public const string Replacement = "{$1}";
14 | public string Name { get; set; }
15 | public string Exec { get; set; }
16 | public string Argument { get; set; }
17 | public ContextMenuItem()
18 | {
19 | Name = "上下文名称";
20 | Exec = "打开的地址";
21 | Argument = "运行参数";
22 | }
23 | public ContextMenuItem(string name, string exec, string argument)
24 | {
25 | Name = name;
26 | Exec = exec;
27 | Argument = argument;
28 | }
29 | }
30 |
31 | private static String ConfigDir
32 | {
33 | get
34 | {
35 | String strConfigDirector = Application.StartupPath;
36 | if (!Directory.Exists(strConfigDirector))
37 | {
38 | Directory.CreateDirectory(strConfigDirector);
39 | }
40 | return strConfigDirector;
41 | }
42 | }
43 |
44 | private static String ConfigPath
45 | {
46 | get
47 | {
48 | return Path.Combine(ConfigDir, "quick.config");
49 | }
50 | }
51 |
52 | private static QuickConfig _config;
53 | public static QuickConfig ThisConfig
54 | {
55 | get
56 | {
57 | if (_config == null)
58 | {
59 | _config = Load();
60 | TrySave(_config);
61 | }
62 | return _config;
63 | }
64 | }
65 |
66 | private QuickConfig(bool isTemplate)
67 | {
68 | Init();
69 | if (isTemplate)
70 | {
71 | ModelName = new List();
72 | ModelName.Add("wps");
73 | ModelName.Add("et");
74 | ModelName.Add("wpp");
75 | ModelName.Add("winword");
76 | ModelName.Add("excel");
77 | ModelName.Add("powerpnt");
78 |
79 | ContextMenuList = new List();
80 | ContextMenuList.Add(new ContextMenuItem("用Google搜索", "https://www.google.com.hk/webhp?hl=zh-CN&sourceid=cnhp&gws_rd=ssl#newwindow=1&safe=strict&hl=zh-CN&q={$1}", ""));
81 | ContextMenuList.Add(new ContextMenuItem("用Baidu搜索", "http://www.baidu.com/baidu?wd={$1}", ""));
82 | }
83 | }
84 |
85 | private QuickConfig()
86 | {
87 | Init();
88 | }
89 |
90 | private void Init()
91 | {
92 | FirstRun = true;
93 | QuickHotKey = Key.Q;
94 | QuickHotKeyFlags = (int)Hotkey.KeyFlags.MOD_CONTROL;
95 | ContextMenuHotKey = Key.OemTilde;
96 | ContextMenuHotKeyFlags = (int)Hotkey.KeyFlags.MOD_CONTROL;
97 | ContextMenuToogle = true;
98 | LockWindow = false;
99 | }
100 |
101 | public void SetDefaultConfig()
102 | {
103 | QuickHotKey = Key.Q;
104 | QuickHotKeyFlags = (int)Hotkey.KeyFlags.MOD_CONTROL;
105 | ContextMenuHotKey = Key.OemTilde;
106 | ContextMenuHotKeyFlags = (int)Hotkey.KeyFlags.MOD_CONTROL;
107 | ContextMenuToogle = true;
108 |
109 | ContextMenuList = new List();
110 | ContextMenuList.Add(new ContextMenuItem("用Google搜索", "https://www.google.com.hk/webhp?hl=zh-CN&sourceid=cnhp&gws_rd=ssl#newwindow=1&safe=strict&hl=zh-CN&q={$1}", ""));
111 | ContextMenuList.Add(new ContextMenuItem("用Baidu搜索", "http://www.baidu.com/baidu?wd={$1}", ""));
112 | }
113 |
114 | public bool TrySave()
115 | {
116 | return TrySave(this);
117 | }
118 |
119 | public void Reload()
120 | {
121 | _config = Load();
122 | }
123 |
124 | ///
125 | /// 读取一个配置文件,并返回一个PluginConfig对象。若XML配置文件不存在,则会用初始化本类的方式(使用默认初始化值)来创建一个配置文件。
126 | ///
127 | private static QuickConfig Load()
128 | {
129 | QuickConfig instance;
130 | if (!File.Exists(ConfigPath))
131 | {
132 | //配置文件不存在,则创建一个新的实例
133 | instance = new QuickConfig(true);
134 | TrySave(instance);
135 | }
136 | else
137 | {
138 | //如果文件存在,则反序列化它
139 | XmlSerializer xmlsLoad = new XmlSerializer(typeof(QuickConfig));
140 | using (FileStream fs = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read))
141 | {
142 | instance = (QuickConfig)xmlsLoad.Deserialize(fs);
143 | }
144 | }
145 | return instance;
146 | }
147 |
148 | private static bool TrySave(QuickConfig instance)
149 | {
150 | try
151 | {
152 | XmlSerializer xmlsSave = new XmlSerializer(typeof(QuickConfig));
153 | using (FileStream fs = new FileStream(ConfigPath, FileMode.Create, FileAccess.Write))
154 | {
155 | xmlsSave.Serialize(fs, instance);
156 | }
157 | return true;
158 | }
159 | catch
160 | {
161 | return false;
162 | }
163 | }
164 |
165 | public Boolean FirstRun { get; set; }
166 | public Key QuickHotKey { get; set; }
167 | public Int32 QuickHotKeyFlags { get; set; }
168 | public Key ContextMenuHotKey { get; set; }
169 | public Int32 ContextMenuHotKeyFlags { get; set; }
170 | public Boolean ContextMenuToogle { get; set; }
171 | public List ModelName { get; set; }
172 | public List ContextMenuList { get; set; }
173 | public String CurrentVersion { get; set; }
174 | public List Plugins { get; set; }
175 | public Boolean LockWindow { get; set; }
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Media.Imaging;
7 |
8 | namespace Froser.Quick
9 | {
10 | internal struct QuickContext
11 | {
12 | public void ClearSubModel()
13 | {
14 | m_subModel = null;
15 | }
16 |
17 | public QuickModel GetSubModel()
18 | {
19 | return m_subModel;
20 | }
21 |
22 | public void ReplaceSubModel(QuickModel m)
23 | {
24 | m_subModel = m;
25 | }
26 |
27 | // 有时候进入某些条目,需要替换掉当前的model
28 | private QuickModel m_subModel;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickMethod.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Text.RegularExpressions;
6 | using System.Xml.Serialization;
7 |
8 | namespace Froser.Quick
9 | {
10 | public class QuickMethod
11 | {
12 | public String MethodName = "打开资源管理器 [dakaiziyuanguanliqi]";
13 | public String MethodScript = "Call(\"explorer.exe\",\"\")";
14 | public String MethodDescription = "打开资源管理器";
15 | public String MethodParamRegex = @""; // 可接参数的正则表达式匹配,如\d表示任意数字,.表示任意字符,+表示一个或多个,*表示0个或多个
16 | public String MethodDefArgs = ""; //动作执行的默认参数,用逗号分隔开
17 | public Int32 MethodPriority = 0;
18 | [XmlIgnore]
19 | public String Application = ""; //针对特定程序的方法,如wps、et、wpp,用于插件中
20 |
21 | public override String ToString()
22 | {
23 | return Regex.Replace(MethodName, @"\[.*?\]|\{|\}", "");
24 | }
25 |
26 | public void SetAdditionMethod(IQuickPluginMethod method)
27 | {
28 | m_method = method;
29 | }
30 |
31 | public IQuickPluginMethod GetPluginInterface()
32 | {
33 | if (m_method == null)
34 | return null;
35 | return new QuickSafePluginMethodRef(m_method);
36 | }
37 |
38 | private IQuickPluginMethod m_method;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Xml.Serialization;
5 | using System.Linq;
6 | using System.Text.RegularExpressions;
7 |
8 | namespace Froser.Quick
9 | {
10 | public class QuickModel
11 | {
12 | [XmlIgnore]
13 | public static String GlobalModelName
14 | {
15 | get
16 | {
17 | return "__global";
18 | }
19 | }
20 |
21 | public QuickModel()
22 | {
23 | MethodList = new List();
24 | }
25 |
26 | public QuickModel(QuickModel cloneProperty)
27 | {
28 | MethodList = new List();
29 | this.BorderColorB = cloneProperty.BorderColorB;
30 | this.BorderColorG = cloneProperty.BorderColorG;
31 | this.BorderColorR = cloneProperty.BorderColorR;
32 | this.Left = cloneProperty.Left;
33 | this.Search = cloneProperty.Search;
34 | this.Top = cloneProperty.Top;
35 | this.Width = cloneProperty.Width;
36 | }
37 |
38 | public static void CreateTemplate()
39 | {
40 | var template = new QuickModel();
41 |
42 | template.ProgramName = "kwps.application";
43 | template.MethodList.Add(new QuickMethod());
44 |
45 | template.BorderColorR = 77;
46 | template.BorderColorG = 130;
47 | template.BorderColorB = 228;
48 | using (var fs = File.Create(QuickUtilities.DirectoryFromDomain(@"config\template.xml")))
49 | {
50 | new XmlSerializer(template.GetType()).Serialize(fs, template);
51 | }
52 | }
53 |
54 | public static QuickModel GetModel(String filename)
55 | {
56 | XmlSerializer ser = new XmlSerializer(typeof(QuickModel));
57 | QuickModel ret = null;
58 | using (FileStream fs = new FileStream(Path.Combine(QuickUtilities.DirectoryFromDomain(@"config\"), filename), FileMode.Open, FileAccess.Read))
59 | {
60 | ret = (QuickModel)ser.Deserialize(fs);
61 | return ret;
62 | }
63 | }
64 |
65 | public void Save(String filename)
66 | {
67 | Save(this, filename);
68 | }
69 |
70 | private static void Save(QuickModel instance, String filename)
71 | {
72 | XmlSerializer xmlsSave = new XmlSerializer(typeof(QuickModel));
73 | using (FileStream fs = new FileStream(Path.Combine(QuickUtilities.DirectoryFromDomain(@"config\"), filename), FileMode.Create, FileAccess.Write))
74 | {
75 | xmlsSave.Serialize(fs, instance);
76 | }
77 | }
78 |
79 | public static String[] GetArguments(string input)
80 | {
81 | char quote = '"';
82 | char[] separator = new char [] { ' ', ',' };
83 | //state:
84 | //-1: parameter with no quote
85 | //0: start
86 | //1: in quote
87 | int state = 0;
88 | List result = new List();
89 | string value = "";
90 | for (int i = 0; i < input.Length; i++)
91 | {
92 | char c = input[i];
93 | switch (state)
94 | {
95 | case -1:
96 | if (separator.Contains(c))
97 | {
98 | state = 0;
99 | result.Add(value);
100 | value = "";
101 | }
102 | else
103 | {
104 | value += c;
105 | }
106 | break;
107 | case 0:
108 | if (c == quote)
109 | {
110 | state = 1;
111 | }
112 | else
113 | {
114 | state = -1;
115 | i--;
116 | }
117 | break;
118 | case 1:
119 | if (c == quote)
120 | {
121 | state = 0;
122 | result.Add(value);
123 | value = "";
124 | if (i < input.Length - 1 && separator.Contains(input[i + 1]))
125 | i++;
126 | }
127 | else
128 | {
129 | value += c;
130 | }
131 | break;
132 | }
133 | }
134 |
135 | if (value != "")
136 | result.Add(value);
137 | return result.ToArray();
138 | }
139 |
140 | public QuickModel GetFilteredModel(Func condition)
141 | {
142 | //condition为筛选条件,达到条件者被保留
143 | QuickModel model = new QuickModel();
144 | Action copyAction = (method) => {
145 | if (condition(method)) {
146 | model.MethodList.Add (method);
147 | }
148 | };
149 | MethodList.ForEach(copyAction);
150 | return model;
151 | }
152 |
153 | // meta,不要修改变量名
154 | public String ProgramName { get; set; }
155 | public int BorderColorR { get; set; }
156 | public int BorderColorG { get; set; }
157 | public int BorderColorB { get; set; }
158 | public String Left { get; set; }
159 | public String Width { get; set; }
160 | public String Top { get; set; }
161 | public String Search { get; set; }
162 | public List MethodList { get; set; }
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickMultiVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Froser.Quick
7 | {
8 | internal static class QuickMultiVersion
9 | {
10 | public static string s_vitalityRequest = "http://quick.kd.net/vitality.aspx?action={0}&target={1}&api={2}";
11 | public static string s_homePage = "http://quick.kd.net";
12 | public static string s_commentPage = "http://quick.kd.net/comment.html";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickNotify.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Forms;
7 | using System.Diagnostics;
8 | using Froser.Quick.UI;
9 | using System.Windows.Forms.Integration;
10 | using Froser.Quick.Properties;
11 |
12 | namespace Froser.Quick
13 | {
14 | internal abstract class QuickNotify
15 | {
16 | public static NotifyIcon GetNotify()
17 | {
18 | NotifyIcon notify = new NotifyIcon();
19 | notify.Text = "Quick";
20 | notify.Icon = Icon.FromHandle(Resources.quick.GetHicon());
21 | notify.MouseClick += (sender, e) => { if (e.Button == MouseButtons.Left) OnAbout(sender, e); };
22 | notify.ContextMenuStrip = new ContextMenuStrip();
23 | notify.ContextMenuStrip.Items.AddRange(new ToolStripItem[] {
24 | new ToolStripMenuItem(Application.ProductName + " " + Application.ProductVersion ),
25 | new ToolStripSeparator(),
26 | new ToolStripMenuItem("访问主页", null, (sender, e) => Process.Start (QuickMultiVersion.s_homePage )),
27 | new ToolStripMenuItem("功能缺失反馈", null, (sender, e) => Process.Start (QuickMultiVersion.s_commentPage )),
28 | new ToolStripSeparator(),
29 | new ToolStripMenuItem("重新载入配置", null, (sender, e) => QuickListener.Listener.Reload()),
30 | new ToolStripMenuItem("偏好设置", null, (sender, e) => ShowPreference(false)),
31 | new ToolStripMenuItem("关于", null, OnAbout),
32 | new ToolStripSeparator(),
33 | new ToolStripMenuItem("退出", null, (sender, e) => Program.Quit()),
34 | }
35 | );
36 | return notify;
37 | }
38 |
39 | private static void OnAbout(object sender, EventArgs e)
40 | {
41 | ShowPreference(true);
42 | }
43 |
44 | private static void ShowPreference(bool about)
45 | {
46 | if (s_perferenceWindowHandler == null)
47 | s_perferenceWindowHandler = new QuickPreferenceWindowHandler();
48 |
49 | if (s_perferenceWindow == null)
50 | {
51 | s_perferenceWindow = new QuickPreferenceWindow(s_perferenceWindowHandler);
52 | ElementHost.EnableModelessKeyboardInterop(s_perferenceWindow);
53 | }
54 |
55 | if (about)
56 | s_perferenceWindow.ShowAbout();
57 | else
58 | s_perferenceWindow.Show();
59 | }
60 |
61 | static QuickPreferenceWindow s_perferenceWindow;
62 | static QuickPreferenceWindowHandler s_perferenceWindowHandler;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickPluginLoader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Reflection;
6 | using System.Text;
7 |
8 | namespace Froser.Quick
9 | {
10 | internal static class QuickPluginLoader
11 | {
12 | public static void AddAdditionQuickMethodTo(Dictionary models)
13 | {
14 | // 从配置文件中读取出加载项,放入model中
15 | var plugins = QuickConfig.ThisConfig.Plugins;
16 | if (!plugins.Contains(s_defaultPlugin))
17 | plugins.Insert(0, s_defaultPlugin);
18 | List addedList = new List();
19 | foreach (var pluginPath in plugins)
20 | {
21 | if (addedList.Contains(pluginPath))
22 | continue;
23 | addedList.Add(pluginPath);
24 | string additionDir = QuickUtilities.DirectoryFromDomain(PLUGINS_PATH);
25 | string addFullPath = Path.Combine(additionDir, pluginPath);
26 | try
27 | {
28 | var methods = GetMethodsFromAssembly(addFullPath);
29 | if (methods == null)
30 | continue;
31 | foreach (var method in methods)
32 | AddToCorrectModel(models, method);
33 | }
34 | catch { }
35 | }
36 | }
37 |
38 | private static IQuickPluginMethod[] GetMethodsFromAssembly(string path)
39 | {
40 | // 加载到当前程序集
41 | Assembly asm = Assembly.LoadFrom(path);
42 | object instance = asm.CreateInstance("Froser.Quick.QuickPlugin");
43 | IQuickPlugin addition = new QuickSafePluginRef((IQuickPlugin)instance);
44 | return addition.GetMethods();
45 | }
46 |
47 | private static void AddToCorrectModel(Dictionary models, IQuickPluginMethod method)
48 | {
49 | QuickMethod coreMethod = new QuickMethod();
50 | coreMethod.MethodDefArgs = " ";
51 | coreMethod.MethodName = method.GetName();
52 | coreMethod.MethodDescription = method.GetDescription(null);
53 | bool acceptArgs = method.AcceptArgs();
54 | coreMethod.MethodParamRegex = acceptArgs ? "." : "";
55 | coreMethod.SetAdditionMethod(method);
56 |
57 | bool bAddedToSpecificModel = false;
58 | foreach (var modelName in QuickConfig.ThisConfig.ModelName)
59 | {
60 | var availStr = method.AvailableApplicationName();
61 | string[] avails = availStr != null ? availStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) : null;
62 | if (avails != null && avails.Contains(modelName, new ModelNameComparer()))
63 | {
64 | models[modelName].MethodList.Insert(0, coreMethod);
65 | bAddedToSpecificModel = true;
66 | }
67 | }
68 | if (!bAddedToSpecificModel)
69 | {
70 | // 如果没有加到特定的模块,则加到global中
71 | models[QuickModel.GlobalModelName].MethodList.Insert(0, coreMethod);
72 | }
73 | }
74 |
75 | private class ModelNameComparer : IEqualityComparer
76 | {
77 | public bool Equals(string x, string y)
78 | {
79 | return x.Trim().ToLower() == y.Trim().ToLower();
80 | }
81 |
82 | public int GetHashCode(string obj)
83 | {
84 | return obj.GetHashCode();
85 | }
86 | }
87 |
88 | public const string PLUGINS_PATH = "plugins";
89 | private const string s_defaultPlugin = "quickplugin.dll";
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickSafePluginRef.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Froser.Quick
7 | {
8 | // 会吞掉异常的引用代理
9 | internal class QuickSafePluginRef : IQuickPlugin
10 | {
11 | public QuickSafePluginRef(IQuickPlugin plugin)
12 | {
13 | m_plugin = plugin;
14 | }
15 |
16 | public IQuickPluginMethod[] GetMethods()
17 | {
18 | try
19 | {
20 | return m_plugin.GetMethods();
21 | }
22 | catch (Exception ex)
23 | {
24 | QuickVitality.UpdateVitality("error in plugin", "plugin load error", "invoking: GetMethods() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
25 | return null;
26 | }
27 | }
28 |
29 | private IQuickPlugin m_plugin;
30 | }
31 |
32 | internal class QuickSafePluginMethodRef : IQuickPluginMethod
33 | {
34 | public QuickSafePluginMethodRef(IQuickPluginMethod method)
35 | {
36 | m_method = method;
37 | }
38 |
39 | public string GetName()
40 | {
41 | try
42 | {
43 | return m_method.GetName();
44 | }
45 | catch (Exception ex)
46 | {
47 | QuickVitality.UpdateVitality("error in plugin method", "plugin GetName() error", "invoking: GetName() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
48 | return null;
49 | }
50 | }
51 |
52 | public string GetDescription(IQuickWindow quickWindow)
53 | {
54 | try
55 | {
56 | return m_method.GetDescription(quickWindow);
57 | }
58 | catch (Exception ex)
59 | {
60 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: GetName() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
61 | return null;
62 | }
63 | }
64 |
65 | public string AvailableApplicationName()
66 | {
67 | try
68 | {
69 | return m_method.AvailableApplicationName();
70 | }
71 | catch (Exception ex)
72 | {
73 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: AvailableApplicationName() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
74 | return null;
75 | }
76 | }
77 |
78 | public void Invoke(object sender, IQuickWindow quickWindow)
79 | {
80 | try
81 | {
82 | m_method.Invoke(sender, quickWindow);
83 | }
84 | catch (Exception ex)
85 | {
86 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: Invoke() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
87 | }
88 | }
89 |
90 | public bool AcceptArgs()
91 | {
92 | try
93 | {
94 | return m_method.AcceptArgs();
95 | }
96 | catch (Exception ex)
97 | {
98 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: AcceptArgs() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
99 | return false;
100 | }
101 | }
102 |
103 | public bool GetIcon(IQuickWindow quickWindow, out System.Windows.Media.ImageSource icon)
104 | {
105 | try
106 | {
107 | return m_method.GetIcon(quickWindow, out icon);
108 | }
109 | catch (Exception ex)
110 | {
111 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: GetIcon() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
112 | icon = null;
113 | return false;
114 | }
115 | }
116 |
117 | public void KeyDown(IQuickWindow quickWindow, System.Windows.Input.KeyEventArgs e)
118 | {
119 | try
120 | {
121 | m_method.KeyDown(quickWindow, e);
122 | }
123 | catch (Exception ex)
124 | {
125 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: KeyDown() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
126 | }
127 | }
128 |
129 | public void TextChanged(IQuickWindow quickWindow, System.Windows.Controls.TextChangedEventArgs e)
130 | {
131 | try
132 | {
133 | m_method.TextChanged(quickWindow, e);
134 | }
135 | catch (Exception ex)
136 | {
137 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: TextChanged() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
138 | }
139 | }
140 |
141 | public void Closed(IQuickWindow quickWindow)
142 | {
143 | try
144 | {
145 | m_method.Closed(quickWindow);
146 | }
147 | catch (Exception ex)
148 | {
149 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: Closed() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
150 | }
151 | }
152 |
153 | public void PageDown(IQuickWindow quickWindow)
154 | {
155 | try
156 | {
157 | m_method.PageDown(quickWindow);
158 | }
159 | catch (Exception ex)
160 | {
161 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: PageDown() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
162 | }
163 | }
164 |
165 | public void PageUp(IQuickWindow quickWindow)
166 | {
167 | try
168 | {
169 | m_method.PageUp(quickWindow);
170 | }
171 | catch (Exception ex)
172 | {
173 | QuickVitality.UpdateVitality("error in plugin method", m_method.GetName(), "invoking: PageUp() and caused " + ex.Message + Environment.NewLine + ex.StackTrace);
174 | }
175 | }
176 |
177 | private IQuickPluginMethod m_method;
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickSafeReflection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Froser.Quick
7 | {
8 | public static class QuickSafeReflection
9 | {
10 | public static void Set(String api, object value, object targetObj)
11 | {
12 | try
13 | {
14 | QuickReflection.Set(api, value, targetObj);
15 | }
16 | catch { }
17 | }
18 |
19 | public static object Invoke(String api, object targetObj)
20 | {
21 | try
22 | {
23 | return QuickReflection.Invoke(api, targetObj);
24 | }
25 | catch
26 | {
27 | return null;
28 | }
29 | }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickUpdate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Net;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Xml.Linq;
10 |
11 | namespace Froser.Quick
12 | {
13 | internal static class QuickUpdate
14 | {
15 | ///
16 | /// 静默更新,有更新且换完成后返回true,否则返回false
17 | ///
18 | public static bool SilenceUpdate()
19 | {
20 | try
21 | {
22 | XDocument resp = null;
23 | string latestVersion = null;
24 | if (HasUpdate(out resp, out latestVersion))
25 | {
26 | string updateUrlRoot = "http://localhost/download/update/";
27 | var filelist = resp.Element("info").Element("version").Element ("filelist").Descendants();
28 |
29 | string updateDir = Path.Combine (AppDir, "update");
30 |
31 | WebClient wc = new WebClient();
32 | foreach (var file in filelist)
33 | {
34 | string fileAddress = updateUrlRoot + file.Value;
35 | string downloadPath = Path.Combine(updateDir, fileAddress.Replace(updateUrlRoot, ""));
36 | string dir = Path.GetDirectoryName(downloadPath);
37 | if (!Directory.Exists(dir))
38 | Directory.CreateDirectory(dir);
39 |
40 | wc.DownloadFile(fileAddress, downloadPath);
41 | // 因为服务器设置,不能直接下载的文件类型加上.update
42 | // 在配置服务器的时候,应该添加.update的MIME关联
43 | if (Path.GetExtension(downloadPath) == ".update")
44 | File.Move(downloadPath, Path.Combine(Path.GetDirectoryName(downloadPath), Path.GetFileNameWithoutExtension(downloadPath)));
45 | }
46 |
47 | // 下载完所有更新文件后,写updatenotify文件
48 | string notifyFilePath = Path.Combine(AppDir, "updatenotify");
49 | using (var writer = File.CreateText(notifyFilePath))
50 | {
51 | writer.WriteLine(latestVersion);
52 | }
53 |
54 | // 准备退出程序,调用QuickUpdate
55 |
56 | return true;
57 | }
58 | }
59 | catch { }
60 | return false;
61 | }
62 |
63 | public static bool LocalUpdate()
64 | {
65 | try
66 | {
67 | if (NeedLocalUpdate())
68 | {
69 | Process proc = Process.Start(UpdateAppPath);
70 | return true;
71 | }
72 | }
73 | catch { }
74 | return false;
75 | }
76 |
77 | private static bool NeedLocalUpdate()
78 | {
79 | if (File.Exists(NotifyFilePath))
80 | {
81 | using (var reader = File.OpenText(NotifyFilePath))
82 | {
83 | return !QuickUtilities.IsLatestVersion(Application.ProductVersion, reader.ReadToEnd().Trim());
84 | }
85 | }
86 | return false;
87 | }
88 |
89 | private static bool HasUpdate(out XDocument resp, out string latestVersion)
90 | {
91 | try
92 | {
93 | resp = XDocument.Load(@"http://localhost/Download/Version.xml");
94 | String version = Application.ProductVersion;
95 | latestVersion = resp.Element("info").Element("version").Attribute("value").Value;
96 | return !QuickUtilities.IsLatestVersion(version, latestVersion);
97 | }
98 | catch
99 | {
100 | //先吞掉更新失败的问题
101 | resp = null;
102 | latestVersion = null;
103 | return false;
104 | }
105 | }
106 |
107 | private static string AppDir
108 | {
109 | get
110 | {
111 | return AppDomain.CurrentDomain.BaseDirectory;
112 | }
113 | }
114 |
115 | private static string NotifyFilePath
116 | {
117 | get
118 | {
119 | return Path.Combine(AppDir, s_notifyFile);
120 | }
121 | }
122 |
123 | private static string UpdateAppPath
124 | {
125 | get
126 | {
127 | return Path.Combine(AppDir, s_updateAppPath);
128 | }
129 | }
130 |
131 | private const string s_notifyFile = "updatenotify";
132 | private const string s_updateAppPath = "quickupdate.exe";
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/Coding/Quick/QuickVitality.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Net;
6 | using System.Windows.Forms;
7 | using System.Web;
8 |
9 | namespace Froser.Quick
10 | {
11 | internal static class QuickVitality
12 | {
13 | public static void UpdateVitality(String action, String target, String api)
14 | {
15 | #if !DEBUG
16 | Action update = () =>
17 | {
18 | action = HttpUtility.UrlEncode(action);
19 | target = HttpUtility.UrlEncode(target);
20 | api = HttpUtility.UrlEncode(api);
21 |
22 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(String.Format(QuickMultiVersion.s_vitalityRequest, action, target, api));
23 | try
24 | {
25 | request.Method = "GET";
26 | request.UserAgent = "Quick " + Application.ProductVersion;
27 | request.BeginGetResponse(null, null); //只需要异步,无需知道结果
28 | }
29 | catch { }
30 | };
31 | update.BeginInvoke(null, null);
32 | #endif
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Coding/Quick/UI/QuickContextWindowHandler.cs:
--------------------------------------------------------------------------------
1 | using Froser.Quick.UI;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Runtime.InteropServices;
8 | using System.Text;
9 | using System.Windows.Controls;
10 |
11 | namespace Froser.Quick.UI
12 | {
13 | class QuickContextWindowHandler : IQuickContextWindowHandler
14 | {
15 | [DllImport("user32.dll", EntryPoint = "GetCursorPos")]
16 | public static extern bool GetCursorPos(ref Point lpPoint);
17 |
18 | public void SetHost(QuickContextWindow host)
19 | {
20 | m_host = host;
21 | }
22 |
23 | public void Init()
24 | {
25 | var list = m_host.GetList();
26 | foreach (var i in QuickConfig.ThisConfig.ContextMenuList)
27 | {
28 | QuickListItem item = new QuickListItem(i.Name, null, null);
29 | item.Tag = i;
30 | item.CreateListBoxItemTo(list);
31 | }
32 | list.ListItemClicked += itemClicked;
33 | }
34 |
35 | private void itemClicked(object sender, EventArgs e)
36 | {
37 | ListBoxItem listItem = (ListBoxItem)sender;
38 | QuickListItem rawItem = (QuickListItem)listItem.Tag;
39 | var menuItem = (QuickConfig.ContextMenuItem)rawItem.Tag;
40 | string concreteCmd = menuItem.Exec.Replace(QuickConfig.ContextMenuItem.Replacement, m_context.ToString());
41 | Process.Start(concreteCmd, menuItem.Argument);
42 | }
43 |
44 | public void BeforeShow(string context)
45 | {
46 | m_context = context;
47 |
48 | Point mousePos = new Point();
49 | GetCursorPos(ref mousePos);
50 | m_host.Left = mousePos.X;
51 | m_host.Top = mousePos.Y;
52 | m_host.Activate();
53 | }
54 |
55 | public void AfterShow()
56 | {
57 | if (!m_adjustedHeight)
58 | {
59 | var listItems = m_host.GetList().Items;
60 | if (listItems.Count > 0)
61 | {
62 | ListBoxItem item = (ListBoxItem)m_host.GetList().Items[0];
63 | double eachHeight = item.ActualHeight;
64 | const int OFFSET = 4;
65 | m_host.Height = (eachHeight + OFFSET) * listItems.Count ;
66 | }
67 | m_adjustedHeight = true;
68 | }
69 | }
70 |
71 | public void OnDeactivate(object sender, EventArgs e)
72 | {
73 | m_host.Hide();
74 | }
75 |
76 | private QuickContextWindow m_host;
77 | private bool m_adjustedHeight = false;
78 | private string m_context;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/Coding/Quick/Utilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Diagnostics;
5 | using System.Drawing;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Reflection;
9 | using System.Text;
10 | using System.Windows.Forms;
11 |
12 | namespace Froser.Quick
13 | {
14 | public static class QuickUtilities
15 | {
16 | ///
17 | /// 表示本程序目录下的一个目录的完整路径
18 | ///
19 | /// 目录名
20 | /// 如果不存在,是否要创建一个新的目录
21 | ///
22 | public static String DirectoryFromDomain(String dirname, bool create)
23 | {
24 | String dir = AppDomain.CurrentDomain.BaseDirectory;
25 | String result = Path.Combine(dir, dirname);
26 | if (create)
27 | {
28 | if (!Directory.Exists(result))
29 | Directory.CreateDirectory(result);
30 | }
31 | return result;
32 | }
33 |
34 | public static String DirectoryFromDomain(String dirname)
35 | {
36 | return DirectoryFromDomain(dirname, false);
37 | }
38 |
39 | public static bool IsRoot(String path)
40 | {
41 | try
42 | {
43 | if (char.IsLetter(path[0]) && path[1] == ':')
44 | {
45 | if (path.Length == 3 && path[2] == '\\')
46 | {
47 | return true;
48 | }
49 | else if (path.Length == 2)
50 | {
51 | return true;
52 | }
53 | }
54 | return false;
55 | }
56 | catch
57 | {
58 | return false;
59 | }
60 | }
61 |
62 | public static bool IsLatestVersion(String current, String latest)
63 | {
64 | Version vc = new Version(current);
65 | Version vl = new Version(latest);
66 |
67 | var result = vc.CompareTo(vl);
68 | return result >= 0;
69 | }
70 |
71 | }
72 |
73 | internal class Utilities
74 | {
75 | private object comObject;
76 | public Utilities(object comObject)
77 | {
78 | this.comObject = comObject;
79 | }
80 |
81 | //获得一个Win32颜色的整型数值
82 | public int Win32Color(string api)
83 | {
84 | int def = (int) double.Parse (QuickReflection.Invoke(api, comObject).ToString ());
85 | try
86 | {
87 | ColorDialog cd = new ColorDialog();
88 | cd.Color = ColorTranslator.FromWin32(def);
89 | if (cd.ShowDialog() == DialogResult.OK)
90 | {
91 | return ColorTranslator.ToWin32(cd.Color);
92 | }
93 | return def;
94 | }
95 | catch { return def; }
96 | }
97 |
98 | // Utilities的方法返回值一定要为String[]
99 | public String[] AuthorAndContent(string api, String str)
100 | {
101 | return new String[] { QuickReflection.Invoke(api, comObject) + ":" + Environment.NewLine + str };
102 | }
103 |
104 | public object GetObject(string api)
105 | {
106 | return QuickReflection.Invoke(api, comObject);
107 | }
108 |
109 | public String EmptyString()
110 | {
111 | return "";
112 | }
113 |
114 | public void RunFile(String cmd, String arg)
115 | {
116 | try
117 | {
118 | Process.Start(cmd, arg);
119 | }
120 | catch (Win32Exception)
121 | {
122 | Process.Start(Path.Combine(QuickUtilities.DirectoryFromDomain(""), cmd), arg);
123 | }
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/Coding/Quick/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Coding/Quick/quick.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Quick/quick.ico
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Calc/QuickCalc.cs:
--------------------------------------------------------------------------------
1 | using Froser.Quick.Plugins.Calc;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 | using System.Windows.Media;
7 |
8 | namespace Froser.Quick.Plugins
9 | {
10 | internal class QuickCalc : IQuickPluginMethod
11 | {
12 | // 接口部分
13 | public virtual string GetName()
14 | {
15 | return "计算(calc)[jisuan]";
16 | }
17 |
18 | public virtual string GetDescription(IQuickWindow quickWindow)
19 | {
20 | if (!GetCache().HasCache())
21 | return "输入算式进行计算,回车粘贴到剪贴板";
22 | return GetCache().GetValue().ToString();
23 | }
24 |
25 | public virtual void Invoke(object sender, IQuickWindow quickWindow)
26 | {
27 | Process.Start("calc.exe");
28 | }
29 |
30 | public bool AcceptArgs()
31 | {
32 | return true;
33 | }
34 |
35 | public string AvailableApplicationName()
36 | {
37 | return null;
38 | }
39 |
40 | public virtual bool GetIcon(IQuickWindow quickWindow, out ImageSource icon)
41 | {
42 | icon = null;
43 | return false;
44 | }
45 |
46 | public void KeyDown(IQuickWindow quickWindow, KeyEventArgs e)
47 | {
48 | }
49 |
50 | public void TextChanged(IQuickWindow quickWindow, TextChangedEventArgs e)
51 | {
52 | var arg = quickWindow.GetArgument ();
53 | if (arg == null)
54 | {
55 | GetCache().ClearCache();
56 | quickWindow.ResetMethods();
57 | return;
58 | }
59 |
60 | CalcResult(quickWindow);
61 |
62 | QuickCalcItemType[] types = { QuickCalcItemType.ToDecimal,
63 | QuickCalcItemType.ToHex,
64 | QuickCalcItemType.ToBinary,
65 | };
66 | List calcItemList = new List();
67 | foreach (var type in types)
68 | {
69 | QuickCalcItem item = new QuickCalcItem(GetRoot(), type);
70 | calcItemList.Add(item);
71 | }
72 | if (calcItemList.Count > 0)
73 | quickWindow.ReplaceMethods(calcItemList.ToArray());
74 | }
75 |
76 | public virtual QuickCalc GetRoot()
77 | {
78 | return this;
79 | }
80 |
81 | public virtual QuickCalcCache GetCache()
82 | {
83 | return m_cache;
84 | }
85 |
86 | private void CalcResult(IQuickWindow quickWindow)
87 | {
88 | QuickCalcScanner calc = new QuickCalcScanner();
89 | if (quickWindow != null)
90 | {
91 | var arg = quickWindow.GetArgument();
92 | if (arg != null)
93 | {
94 | try
95 | {
96 | var result = calc.Eval(arg);
97 | GetCache().SetValue (result);
98 | }
99 | catch { }
100 | return;
101 | }
102 | }
103 | GetCache().ClearCache();
104 | }
105 |
106 | public void Closed(IQuickWindow quickWindow)
107 | {
108 | GetCache().ClearCache();
109 | quickWindow.Refresh(0);
110 | }
111 |
112 | public void PageDown(IQuickWindow quickWindow)
113 | {
114 | }
115 |
116 | public void PageUp(IQuickWindow quickWindow)
117 | {
118 | }
119 |
120 | private QuickCalcCache m_cache = new QuickCalcCache();
121 | }
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Calc/QuickCalcCache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Froser.Quick.Plugins.Calc
7 | {
8 | internal class QuickCalcCache
9 | {
10 | public double GetValue()
11 | {
12 | return m_value;
13 | }
14 |
15 | public void SetValue(double value)
16 | {
17 | m_value = value;
18 | m_cached = true;
19 | }
20 |
21 | public bool HasCache()
22 | {
23 | return m_cached;
24 | }
25 |
26 | public void ClearCache()
27 | {
28 | m_cached = false;
29 | }
30 |
31 | private bool m_cached = false;
32 | private double m_value;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Calc/QuickCalcException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Froser.Quick.Plugins.Calc
7 | {
8 | internal class QuickCalcException : Exception
9 | {
10 | public QuickCalcException(string message) : base(message)
11 | {
12 |
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Calc/QuickCalcItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows;
7 |
8 | namespace Froser.Quick.Plugins.Calc
9 | {
10 | enum QuickCalcItemType
11 | {
12 | ToDecimal,
13 | ToHex,
14 | ToBinary,
15 | }
16 |
17 | internal class QuickCalcItem : QuickCalc
18 | {
19 | public QuickCalcItem(QuickCalc parent, QuickCalcItemType type)
20 | {
21 | m_parent = parent;
22 | m_type = type;
23 | }
24 |
25 | public override string GetName()
26 | {
27 | StringBuilder name = new StringBuilder("结果 ");
28 | switch (m_type)
29 | {
30 | case QuickCalcItemType.ToDecimal:
31 | break;
32 | case QuickCalcItemType.ToHex:
33 | name.Append("十六进制 ");
34 | break;
35 | case QuickCalcItemType.ToBinary:
36 | name.Append("二进制 ");
37 | break;
38 | default:
39 | Debug.Assert(false, "无有效类型");
40 | break;
41 | }
42 | return name.ToString ();
43 | }
44 |
45 | public override string GetDescription(IQuickWindow quickWindow)
46 | {
47 | return Transform(GetCache().GetValue ());
48 | }
49 |
50 | public override QuickCalc GetRoot()
51 | {
52 | return m_parent;
53 | }
54 |
55 | public override void Invoke(object sender, IQuickWindow quickWindow)
56 | {
57 | Clipboard.SetText(Transform(GetCache().GetValue()));
58 | }
59 |
60 | public override QuickCalcCache GetCache()
61 | {
62 | return GetRoot().GetCache();
63 | }
64 |
65 | private string Transform(double n)
66 | {
67 | switch (m_type)
68 | {
69 | case QuickCalcItemType.ToDecimal:
70 | return n.ToString ();
71 | case QuickCalcItemType.ToHex:
72 | return "0x" + Convert.ToString ((int)n, 16).ToUpper();
73 | case QuickCalcItemType.ToBinary:
74 | return Convert.ToString((int)n, 2);
75 | default:
76 | Debug.Assert(false, "无有效类型");
77 | break;
78 | }
79 | return n.ToString ();
80 | }
81 |
82 | private QuickCalc m_parent;
83 | private QuickCalcItemType m_type;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Calc/QuickCalcLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Froser.Quick.Plugins.Calc
7 | {
8 | internal static class QuickCalcLog
9 | {
10 | public static void Log(string msg)
11 | {
12 |
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Calc/QuickCalcToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Froser.Quick.Plugins.Calc
7 | {
8 | internal enum QuickCalcToken
9 | {
10 | Reserved,
11 | Numeric,
12 | Symbol,
13 | Error,
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Find/QuickEverything32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace Froser.Quick.Plugins.Find
8 | {
9 | internal class QuickEverything32
10 | {
11 | const String dllPath = "3rdparty/everything/everything32.dll";
12 |
13 | [DllImport(dllPath, CharSet = CharSet.Unicode)]
14 | public static extern int Everything_SetSearchW(string lpSearchString);
15 | [DllImport(dllPath)]
16 | public static extern void Everything_SetMatchPath(bool bEnable);
17 | [DllImport(dllPath)]
18 | public static extern void Everything_SetMatchCase(bool bEnable);
19 | [DllImport(dllPath)]
20 | public static extern void Everything_SetMatchWholeWord(bool bEnable);
21 | [DllImport(dllPath)]
22 | public static extern void Everything_SetRegex(bool bEnable);
23 | [DllImport(dllPath)]
24 | public static extern void Everything_SetMax(int dwMax);
25 | [DllImport(dllPath)]
26 | public static extern void Everything_SetOffset(int dwOffset);
27 |
28 | [DllImport(dllPath)]
29 | public static extern bool Everything_GetMatchPath();
30 | [DllImport(dllPath)]
31 | public static extern bool Everything_GetMatchCase();
32 | [DllImport(dllPath)]
33 | public static extern bool Everything_GetMatchWholeWord();
34 | [DllImport(dllPath)]
35 | public static extern bool Everything_GetRegex();
36 | [DllImport(dllPath)]
37 | public static extern UInt32 Everything_GetMax();
38 | [DllImport(dllPath)]
39 | public static extern UInt32 Everything_GetOffset();
40 | [DllImport(dllPath)]
41 | public static extern string Everything_GetSearchW();
42 | [DllImport(dllPath)]
43 | public static extern int Everything_GetLastError();
44 |
45 | [DllImport(dllPath)]
46 | public static extern bool Everything_QueryW(bool bWait);
47 |
48 | [DllImport(dllPath)]
49 | public static extern void Everything_SortResultsByPath();
50 |
51 | [DllImport(dllPath)]
52 | public static extern int Everything_GetNumFileResults();
53 | [DllImport(dllPath)]
54 | public static extern int Everything_GetNumFolderResults();
55 | [DllImport(dllPath)]
56 | public static extern int Everything_GetNumResults();
57 | [DllImport(dllPath)]
58 | public static extern int Everything_GetTotFileResults();
59 | [DllImport(dllPath)]
60 | public static extern int Everything_GetTotFolderResults();
61 | [DllImport(dllPath)]
62 | public static extern int Everything_GetTotResults();
63 | [DllImport(dllPath)]
64 | public static extern bool Everything_IsVolumeResult(int nIndex);
65 | [DllImport(dllPath)]
66 | public static extern bool Everything_IsFolderResult(int nIndex);
67 | [DllImport(dllPath)]
68 | public static extern bool Everything_IsFileResult(int nIndex);
69 | [DllImport(dllPath, CharSet = CharSet.Unicode)]
70 | public static extern void Everything_GetResultFullPathNameW(int nIndex, StringBuilder lpString, int nMaxCount);
71 | [DllImport(dllPath)]
72 | public static extern void Everything_Reset();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Find/QuickEverything64.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace Froser.Quick.Plugins.Find
8 | {
9 | internal class QuickEverything64
10 | {
11 | const String dllPath = "3rdparty/everything/everything64.dll";
12 |
13 | [DllImport(dllPath, CharSet = CharSet.Unicode)]
14 | public static extern int Everything_SetSearchW(string lpSearchString);
15 | [DllImport(dllPath)]
16 | public static extern void Everything_SetMatchPath(bool bEnable);
17 | [DllImport(dllPath)]
18 | public static extern void Everything_SetMatchCase(bool bEnable);
19 | [DllImport(dllPath)]
20 | public static extern void Everything_SetMatchWholeWord(bool bEnable);
21 | [DllImport(dllPath)]
22 | public static extern void Everything_SetRegex(bool bEnable);
23 | [DllImport(dllPath)]
24 | public static extern void Everything_SetMax(int dwMax);
25 | [DllImport(dllPath)]
26 | public static extern void Everything_SetOffset(int dwOffset);
27 |
28 | [DllImport(dllPath)]
29 | public static extern bool Everything_GetMatchPath();
30 | [DllImport(dllPath)]
31 | public static extern bool Everything_GetMatchCase();
32 | [DllImport(dllPath)]
33 | public static extern bool Everything_GetMatchWholeWord();
34 | [DllImport(dllPath)]
35 | public static extern bool Everything_GetRegex();
36 | [DllImport(dllPath)]
37 | public static extern UInt32 Everything_GetMax();
38 | [DllImport(dllPath)]
39 | public static extern UInt32 Everything_GetOffset();
40 | [DllImport(dllPath)]
41 | public static extern string Everything_GetSearchW();
42 | [DllImport(dllPath)]
43 | public static extern int Everything_GetLastError();
44 |
45 | [DllImport(dllPath)]
46 | public static extern bool Everything_QueryW(bool bWait);
47 |
48 | [DllImport(dllPath)]
49 | public static extern void Everything_SortResultsByPath();
50 |
51 | [DllImport(dllPath)]
52 | public static extern int Everything_GetNumFileResults();
53 | [DllImport(dllPath)]
54 | public static extern int Everything_GetNumFolderResults();
55 | [DllImport(dllPath)]
56 | public static extern int Everything_GetNumResults();
57 | [DllImport(dllPath)]
58 | public static extern int Everything_GetTotFileResults();
59 | [DllImport(dllPath)]
60 | public static extern int Everything_GetTotFolderResults();
61 | [DllImport(dllPath)]
62 | public static extern int Everything_GetTotResults();
63 | [DllImport(dllPath)]
64 | public static extern bool Everything_IsVolumeResult(int nIndex);
65 | [DllImport(dllPath)]
66 | public static extern bool Everything_IsFolderResult(int nIndex);
67 | [DllImport(dllPath)]
68 | public static extern bool Everything_IsFileResult(int nIndex);
69 | [DllImport(dllPath, CharSet = CharSet.Unicode)]
70 | public static extern void Everything_GetResultFullPathNameW(int nIndex, StringBuilder lpString, int nMaxCount);
71 | [DllImport(dllPath)]
72 | public static extern void Everything_Reset();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Find/QuickFindItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Drawing;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Input;
9 | using System.Windows.Threading;
10 |
11 | namespace Froser.Quick.Plugins.Find
12 | {
13 | internal class QuickFindItem : QuickFind
14 | {
15 | public QuickFindItem(QuickFind parent, string fullpath)
16 | {
17 | m_parent = parent;
18 | m_fullpath = fullpath;
19 | }
20 |
21 | public override string GetName()
22 | {
23 | return Path.GetFileName(m_fullpath);
24 | }
25 |
26 | public override string GetDescription(IQuickWindow quickWindow)
27 | {
28 | return m_fullpath;
29 | }
30 |
31 | public override int GetPage()
32 | {
33 | return GetRoot().GetPage();
34 | }
35 |
36 | public override void SetPage(int p)
37 | {
38 | GetRoot().SetPage(p);
39 | }
40 |
41 | public override void Invoke(object sender, IQuickWindow quickWindow)
42 | {
43 | if (m_directoryOpenedToogle)
44 | {
45 | m_directoryOpenedToogle = false;
46 | return;
47 | }
48 | Execute(false);
49 | }
50 |
51 | public override QuickFind GetRoot()
52 | {
53 | return m_parent;
54 | }
55 |
56 | public override bool GetIcon(IQuickWindow quickWindow, out System.Windows.Media.ImageSource icon)
57 | {
58 | try
59 | {
60 | var tmp = Icon.ExtractAssociatedIcon(m_fullpath); //获得主线程图标
61 | icon = tmp.ToBitmapSource();
62 | return true;
63 | }
64 | catch { }
65 | icon = null;
66 | return false;
67 | }
68 |
69 |
70 | public override void KeyDown(IQuickWindow quickWindow, System.Windows.Input.KeyEventArgs e)
71 | {
72 | switch (e.Key)
73 | {
74 | case Key.Enter:
75 | // Ctrl+Enter 打开文件夹
76 | if (e.KeyboardDevice.Modifiers == ModifierKeys.Control)
77 | OpenDirectory();
78 | break;
79 | }
80 | }
81 |
82 | public override DispatcherTimer GetTimer(IQuickWindow quickWindow)
83 | {
84 | return GetRoot().GetTimer(quickWindow);
85 | }
86 |
87 | private void Execute(bool openDirectoryOnly)
88 | {
89 | var path = openDirectoryOnly ? Path.GetDirectoryName(m_fullpath) : m_fullpath;
90 | Process.Start(path);
91 | }
92 |
93 | private void OpenDirectory()
94 | {
95 | m_directoryOpenedToogle = true;
96 | Execute(true);
97 | }
98 |
99 | public override DescriptionType CurrentDescriptionType
100 | {
101 | get
102 | {
103 | return GetRoot().CurrentDescriptionType;
104 | }
105 | set
106 | {
107 | GetRoot().CurrentDescriptionType = value;
108 | }
109 | }
110 |
111 | private QuickFind m_parent;
112 | private string m_fullpath;
113 | private bool m_directoryOpenedToogle = false;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("QuickAddition")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("QuickAddition")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("178eccf2-6e6d-405f-a28a-2260a17b46e0")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/QuickPlugin.cs:
--------------------------------------------------------------------------------
1 | using Froser.Quick.Plugins;
2 |
3 | namespace Froser.Quick
4 | {
5 | internal class QuickPlugin : IQuickPlugin
6 | {
7 | public QuickPlugin()
8 | {
9 | m_additionMethod = new IQuickPluginMethod[]
10 | {
11 | new QuickCalc(),
12 | new QuickRun(),
13 | new QuickFind(),
14 | };
15 | }
16 |
17 | public IQuickPluginMethod[] GetMethods()
18 | {
19 | return m_additionMethod;
20 | }
21 |
22 | private IQuickPluginMethod[] m_additionMethod;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/QuickPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {EA358646-8755-4A40-AABC-200C03CF86CC}
8 | Library
9 | Properties
10 | Froser.Quick.Plugins
11 | QuickPlugin
12 | v4.0
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | ..\..\Bin\Debug\plugins\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | ..\..\Bin\Release\plugins\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 | true
35 | ..\..\Bin\Debug4KSO\plugins\
36 | DEBUG;TRACE
37 | full
38 | AnyCPU
39 | prompt
40 | MinimumRecommendedRules.ruleset
41 |
42 |
43 | ..\..\Bin\Release4KSO\plugins\
44 | TRACE
45 | true
46 | pdbonly
47 | AnyCPU
48 | prompt
49 | MinimumRecommendedRules.ruleset
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | True
86 | True
87 | Resource.resx
88 |
89 |
90 |
91 |
92 |
93 |
94 | ResXFileCodeGenerator
95 | Resource.Designer.cs
96 |
97 |
98 |
99 |
100 | {d26b7bea-d131-4801-a19b-e0afc6740322}
101 | Quick
102 |
103 |
104 |
105 |
106 | {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}
107 | 1
108 | 0
109 | 0
110 | tlbimp
111 | False
112 | True
113 |
114 |
115 |
116 |
123 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Resource.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.18408
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick.Plugins {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resource {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resource() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Froser.Quick.Plugins.Resource", typeof(Resource).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。
65 | ///
66 | internal static System.Drawing.Bitmap folder {
67 | get {
68 | object obj = ResourceManager.GetObject("folder", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Coding/QuickPlugin/Run/QuickRunItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Drawing;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Media.Imaging;
9 |
10 | namespace Froser.Quick.Plugins.Run
11 | {
12 | internal class QuickRunItem : QuickRun
13 | {
14 | public QuickRunItem(QuickRun parent, string progName, string fullpath)
15 | {
16 | m_progName = progName;
17 | m_fullpath = fullpath;
18 | m_parent = parent;
19 | }
20 |
21 | public override string GetName()
22 | {
23 | return "运行(run)[yunxing] " + m_progName;
24 | }
25 |
26 | public override string GetDescription(IQuickWindow quickWindow)
27 | {
28 | return m_fullpath;
29 | }
30 |
31 | protected override void Execute(bool openDirectoryOnly, IQuickWindow quickWindow)
32 | {
33 | string arg = quickWindow.GetArgument();
34 | if (arg == null)
35 | return;
36 |
37 | string[] splits = arg.Split(new char[] { ' ', '\t', '\r', '\n' }, 2);
38 | string path = m_fullpath;
39 |
40 | if (openDirectoryOnly)
41 | path = Path.GetDirectoryName(m_fullpath);
42 |
43 | string shellarg = splits.Length > 1 ? splits[1] : null;
44 | Process.Start(path, shellarg ?? "");
45 | }
46 |
47 | public override bool GetIcon(IQuickWindow quickWindow, out System.Windows.Media.ImageSource icon)
48 | {
49 | try
50 | {
51 | if (Directory.Exists(m_fullpath))
52 | {
53 | icon = GetRoot().DefaultFolderIcon;
54 | }
55 | else
56 | {
57 | string dest = m_fullpath;
58 | if (!Path.IsPathRooted(m_fullpath))
59 | dest = MatchCommonShortcutPath(m_fullpath);
60 |
61 | var tmp = Icon.ExtractAssociatedIcon(dest); //获得主线程图标
62 | icon = tmp.ToBitmapSource();
63 | }
64 | return true;
65 | }
66 | catch { }
67 | icon = null;
68 | return false;
69 | }
70 |
71 | protected override QuickRun GetRoot()
72 | {
73 | return m_parent;
74 | }
75 |
76 | protected override void Init()
77 | {
78 | // C#中是允许在构造的时候调用派生类虚函数的
79 | }
80 |
81 | public override List GetCommonShortcuts()
82 | {
83 | return m_parent.GetCommonShortcuts();
84 | }
85 |
86 | public override Dictionary GetCommonShortcutsPath()
87 | {
88 | return m_parent.GetCommonShortcutsPath();
89 | }
90 |
91 | public override bool TextDirty
92 | {
93 | get
94 | {
95 | return GetRoot().TextDirty;
96 | }
97 | set
98 | {
99 | GetRoot().TextDirty = value;
100 | }
101 | }
102 |
103 | public override Dictionary CommonShortcutsPath
104 | {
105 | get
106 | {
107 | return GetRoot().CommonShortcutsPath;
108 | }
109 | set
110 | {
111 | GetRoot().CommonShortcutsPath = value;
112 | }
113 | }
114 |
115 | public override List CommonShortcuts
116 | {
117 | get
118 | {
119 | return GetRoot().CommonShortcuts;
120 | }
121 | set
122 | {
123 | GetRoot().CommonShortcuts = value;
124 | }
125 | }
126 |
127 | public override List ResultList
128 | {
129 | get
130 | {
131 | return GetRoot().ResultList;
132 | }
133 | set
134 | {
135 | GetRoot().ResultList = value;
136 | }
137 | }
138 |
139 | public override int AutoSearchIndex
140 | {
141 | get
142 | {
143 | return GetRoot().AutoSearchIndex;
144 | }
145 | set
146 | {
147 | GetRoot().AutoSearchIndex = value;
148 | }
149 | }
150 |
151 | public override bool TabKeyPressed
152 | {
153 | get
154 | {
155 | return GetRoot().TabKeyPressed;
156 | }
157 | set
158 | {
159 | GetRoot().TabKeyPressed = value;
160 | }
161 | }
162 |
163 | private string m_progName;
164 | private string m_fullpath;
165 | private QuickRun m_parent;
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/Coding/QuickUI/IQuickContextWindowHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace Froser.Quick.UI
3 | {
4 | public interface IQuickContextWindowHandler
5 | {
6 | void SetHost(QuickContextWindow host);
7 | void Init();
8 | void AfterShow();
9 | void BeforeShow(string context);
10 | void OnDeactivate(object sender, EventArgs e);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Coding/QuickUI/IQuickMainWindowHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 |
7 | namespace Froser.Quick.UI
8 | {
9 | public interface IQuickMainWindowHandler
10 | {
11 | void Init();
12 | void SetHostWindow(QuickMainWindow host);
13 | void OnClosing(object sender, CancelEventArgs e);
14 | void OnDeactivated(object sender, EventArgs e);
15 | void OnActivated(object sender, EventArgs e);
16 | void OnKeyDown(object sender, KeyEventArgs e);
17 | void OnMouseWheel(object sender, MouseWheelEventArgs e);
18 | void OnTextChanged(object sender, TextChangedEventArgs e);
19 | void OnListItemClicked(object sender, EventArgs e);
20 | void OnLockedClick(object sender, MouseButtonEventArgs e);
21 | void OnListPageUp();
22 | void OnListPageDown();
23 | void OnShowing();
24 | void OnShowed();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Coding/QuickUI/IQuickPreferenceWindowHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 |
7 | namespace Froser.Quick.UI
8 | {
9 | public interface IQuickPreferenceWindowHandler
10 | {
11 | void SetHost(QuickPreferenceWindow host);
12 | void LoadConfig();
13 | void ShortcutTextBoxOnPreviewKeyDown(object sender, KeyEventArgs e);
14 | void OnSave();
15 | void OnTemplateSelected(int index);
16 | void OnTemplateMethodSelect(int index);
17 | void OnGeneralDefault();
18 | void OnSaveMethod();
19 | void OnRestoreMethod();
20 | void OnMoveUpMethod();
21 | void OnMoveDownMethod();
22 | void OnCreateNewMethod();
23 | void OnDeleteMethod();
24 | void OnCreateNewContext();
25 | void OnRemoveContext();
26 | void OnModifyContext();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Coding/QuickUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的常规信息通过以下
8 | // 特性集控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("QuickUI")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Froser")]
14 | [assembly: AssemblyProduct("QuickUI")]
15 | [assembly: AssemblyCopyright("Froser")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 使此程序集中的类型
20 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | // 则将该类型上的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请在
25 | // 中的 .csproj 文件中
26 | //设置 CultureYouAreCodingWith。 例如,如果您在源文件中
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly:ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(在页面或应用程序资源词典中
37 | // 未找到某个资源的情况下使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(在页面、应用程序或任何主题特定资源词典中
40 | // 未找到某个资源的情况下使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下面四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Coding/QuickUI/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.18408
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick.UI.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Froser.Quick.UI.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Coding/QuickUI/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Coding/QuickUI/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.18408
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick.UI.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Coding/QuickUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickContextWindow.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickContextWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 |
14 | namespace Froser.Quick.UI
15 | {
16 | ///
17 | /// QuickContextWindow.xaml 的交互逻辑
18 | ///
19 | public partial class QuickContextWindow : Window
20 | {
21 | public QuickContextWindow(IQuickContextWindowHandler handler)
22 | {
23 | InitializeComponent();
24 |
25 | handler.SetHost(this);
26 | m_handler = handler;
27 | this.Deactivated += handler.OnDeactivate;
28 |
29 | handler.Init();
30 | }
31 |
32 | public void Show(string context)
33 | {
34 | WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
35 | m_handler.BeforeShow(context);
36 | Show();
37 | m_handler.AfterShow();
38 | }
39 |
40 | public QuickListBox GetList()
41 | {
42 | return quickContextList;
43 | }
44 |
45 | private IQuickContextWindowHandler m_handler;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickListBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 |
7 | namespace Froser.Quick.UI
8 | {
9 | public class QuickListBox : ListBox
10 | {
11 | public event EventHandler ListItemClicked;
12 |
13 | public void ActivateListItemClickedEvent(ListBoxItem sender)
14 | {
15 | if (ListItemClicked != null)
16 | ListItemClicked(sender, new EventArgs());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickListItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace Froser.Quick.UI
16 | {
17 | public class QuickListItem
18 | {
19 | private const int IMAGE_SIZE = 32;
20 | private const int IMAGE_SIZE_SIMPLE = 24;
21 |
22 | public QuickListItem(string title, string description, ImageSource imgSrc)
23 | {
24 | m_title = title;
25 | m_description = description;
26 | m_iconImageSource = imgSrc;
27 | m_type = description == null ? ListType.Simple : ListType.Full;
28 | }
29 |
30 | public ListBoxItem CreateListBoxItemTo(QuickListBox list)
31 | {
32 | ListBoxItem item = new ListBoxItem();
33 | item.Focusable = false;
34 | item.SetResourceReference(ListBoxItem.StyleProperty, "quickListItemStyle");
35 |
36 | InitGrid();
37 | InitImage();
38 | InitTextGrid();
39 | InitTitle();
40 | InitDescription();
41 |
42 | item.Content = m_grid;
43 | list.Items.Add(item);
44 |
45 | item.MouseEnter += (sender, e) => { list.SelectedItem = item; };
46 | item.PreviewMouseDown += (sender, e) => { list.ActivateListItemClickedEvent(item); };
47 | item.Tag = this;
48 |
49 | return item;
50 | }
51 |
52 | private void InitGrid()
53 | {
54 | GridLength length ;
55 | if (m_type == ListType.Full)
56 | length = new GridLength(IMAGE_SIZE, GridUnitType.Pixel);
57 | else
58 | length = new GridLength(IMAGE_SIZE_SIMPLE, GridUnitType.Pixel);
59 | ColumnDefinition gcd1 = new ColumnDefinition();
60 | ColumnDefinition gcd2 = new ColumnDefinition();
61 | gcd1.Width = length;
62 | m_grid = new Grid();
63 | m_grid.ColumnDefinitions.Add(gcd1);
64 | m_grid.ColumnDefinitions.Add(gcd2);
65 | }
66 |
67 | private void InitImage()
68 | {
69 | m_img = new Image();
70 | if (m_iconImageSource != null)
71 | m_img.Source = m_iconImageSource;
72 | else
73 | m_img.Source = QuickUIResource.GetDefaultIcon();
74 | Grid.SetColumn(m_img, 0);
75 | m_grid.Children.Add(m_img);
76 | }
77 |
78 | private void InitTextGrid()
79 | {
80 | m_textGrid = new Grid();
81 | if (m_type == ListType.Full)
82 | {
83 | RowDefinition tgcd1 = new RowDefinition();
84 | RowDefinition tgcd2 = new RowDefinition();
85 | tgcd1.Height = new GridLength(4, GridUnitType.Star);
86 | tgcd2.Height = new GridLength(2, GridUnitType.Star);
87 | m_textGrid.RowDefinitions.Add(tgcd1);
88 | m_textGrid.RowDefinitions.Add(tgcd2);
89 | }
90 | m_grid.Children.Add(m_textGrid);
91 | Grid.SetColumn(m_textGrid, 1);
92 | }
93 |
94 | private void InitTitle()
95 | {
96 | m_lbTitle = new Label();
97 | m_lbTitle.Content = m_title.Replace("_", "__");
98 | m_lbTitle.FontFamily = DEFAULT_FONT_FAMILTY;
99 | m_lbTitle.FontWeight = FontWeights.Bold;
100 | m_lbTitle.FontSize = 16;
101 | m_textGrid.Children.Add(m_lbTitle);
102 | Grid.SetRow(m_lbTitle, 0);
103 | }
104 |
105 | private void InitDescription()
106 | {
107 | if (m_type == ListType.Full)
108 | {
109 | m_lbDescription = new Label();
110 | m_lbDescription.Content = m_description.Replace("_", "__");
111 | m_lbDescription.FontFamily = DEFAULT_FONT_FAMILTY;
112 | m_lbDescription.FontSize = 12;
113 | m_textGrid.Children.Add(m_lbDescription);
114 | Grid.SetRow(m_lbDescription, 1);
115 | }
116 | }
117 |
118 | public object Tag { get; set; }
119 |
120 | private readonly FontFamily DEFAULT_FONT_FAMILTY = new FontFamily("Consolas, Microsoft YaHei");
121 | private Grid m_grid;
122 | private Image m_img;
123 | private Grid m_textGrid;
124 | private Label m_lbTitle;
125 | private Label m_lbDescription;
126 |
127 | private ImageSource m_iconImageSource;
128 | private string m_title;
129 | private string m_description;
130 | private enum ListType {Simple, Full}
131 | private ListType m_type;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickMainWindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
39 |
40 |
41 |
42 |
43 |
44 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickMainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 | using System.Windows.Media;
7 |
8 | namespace Froser.Quick.UI
9 | {
10 | ///
11 | /// QuickMainWindow.xaml 的交互逻辑
12 | ///
13 | public partial class QuickMainWindow : Window
14 | {
15 | public QuickMainWindow(IQuickMainWindowHandler handler)
16 | {
17 | InitializeComponent();
18 |
19 | m_handler = handler;
20 | handler.SetHostWindow(this);
21 |
22 | Closing += handler.OnClosing;
23 | Deactivated += handler.OnDeactivated;
24 | Activated += handler.OnActivated;
25 | GetQueryTextBox().CaptureMouse();
26 | GetQueryTextBox().TextChanged += handler.OnTextChanged;
27 | GetQueryTextBox().MouseWheel += handler.OnMouseWheel;
28 | GetQueryTextBox().PreviewKeyDown += handler.OnKeyDown;
29 | GetList().ListItemClicked += handler.OnListItemClicked;
30 | GetList().KeyDown += handler.OnKeyDown;
31 | GetList().MouseWheel += handler.OnMouseWheel;
32 | GetLockImageButton().PreviewMouseDown += handler.OnLockedClick;
33 |
34 | handler.Init();
35 |
36 | backgroundBorder.PreviewMouseDown += dragMove;
37 | innerBorder.PreviewMouseDown += dragMove;
38 | }
39 |
40 | public new void Show()
41 | {
42 | m_handler.OnShowing();
43 | base.Show();
44 | m_handler.OnShowed();
45 | }
46 |
47 | public void SetOpacity(double o)
48 | {
49 | mainWindow.Opacity = o;
50 | }
51 |
52 | public void ResetOpacity()
53 | {
54 | mainWindow.Opacity = 1.0;
55 | }
56 |
57 | public RichTextBox GetQueryTextBox()
58 | {
59 | return searchTextBox;
60 | }
61 |
62 | public QuickListBox GetList()
63 | {
64 | return quickListBox;
65 | }
66 |
67 | public Image GetLockImageButton()
68 | {
69 | return iconLock;
70 | }
71 |
72 | public void SelectNext()
73 | {
74 | var list = GetList();
75 | int nextIndex = list.SelectedIndex + 1;
76 | if (nextIndex >= list.Items.Count)
77 | m_handler.OnListPageDown();
78 | else
79 | list.SelectedIndex = nextIndex;
80 | }
81 |
82 | public void SelectPrevious()
83 | {
84 | var list = GetList();
85 | int nextIndex = list.SelectedIndex - 1;
86 | if (nextIndex < 0)
87 | m_handler.OnListPageUp();
88 | else
89 | list.SelectedIndex = nextIndex;
90 | }
91 |
92 | public void Select(int index)
93 | {
94 | var list = GetList();
95 | list.SelectedIndex = index;
96 | }
97 |
98 | public void AutoResize()
99 | {
100 | int itemsHeight = GetList().Items.Count * UNIT_HEIGHT;
101 | if (itemsHeight < MIN_LIST_HEIGHT)
102 | itemsHeight = MIN_LIST_HEIGHT;
103 | Height = itemsHeight + WINDOW_OFFSET;
104 | }
105 |
106 | public void SetBackgroundColor(Color c)
107 | {
108 | backgroundBorder.Background = new SolidColorBrush(c);
109 | }
110 |
111 | private void dragMove(object sender, MouseButtonEventArgs e)
112 | {
113 | if (e.LeftButton == MouseButtonState.Pressed)
114 | DragMove();
115 | }
116 |
117 | private const int UNIT_HEIGHT = 55;
118 | private const int WINDOW_OFFSET = 68;
119 | private const int MIN_LIST_HEIGHT = 3 * UNIT_HEIGHT;
120 |
121 | private IQuickMainWindowHandler m_handler;
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickPerferenceContextEdit.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | 上下文编辑
19 | 名称
20 |
21 | 行为
22 |
23 | 运行参数
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickPerferenceContextEdit.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 |
14 | namespace Froser.Quick.UI
15 | {
16 | ///
17 | /// QuickPerferenceContextEdit.xaml 的交互逻辑。不使用接口,因为功能简单
18 | ///
19 | public partial class QuickPerferenceContextEdit : Window
20 | {
21 | public QuickPerferenceContextEdit()
22 | {
23 | InitializeComponent();
24 | btn_done.Click += btn_done_Click;
25 | }
26 |
27 | void btn_done_Click(object sender, RoutedEventArgs e)
28 | {
29 | if (Done != null)
30 | Done();
31 | Close();
32 | }
33 |
34 | public new void Show()
35 | {
36 | if (Init != null)
37 | Init();
38 | base.ShowDialog();
39 | }
40 |
41 | public TextBox GetName()
42 | {
43 | return tb_name;
44 | }
45 |
46 | public TextBox GetBehavior()
47 | {
48 | return tb_behavior;
49 | }
50 |
51 | public TextBox GetArgument()
52 | {
53 | return tb_argument;
54 | }
55 |
56 | public event Action Init;
57 | public event Action Done;
58 |
59 | public object m_data;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickPreferenceWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace Froser.Quick.UI
5 | {
6 | ///
7 | /// Window1.xaml 的交互逻辑
8 | ///
9 | public partial class QuickPreferenceWindow : Window
10 | {
11 | public QuickPreferenceWindow(IQuickPreferenceWindowHandler handler)
12 | {
13 | InitializeComponent();
14 | handler.SetHost(this);
15 | this.Closing += QuickPreferenceWindow_Closing;
16 |
17 | GetQuickTextBoxInGeneral().PreviewKeyDown += handler.ShortcutTextBoxOnPreviewKeyDown;
18 | GetContextTextBoxInGeneral().PreviewKeyDown += handler.ShortcutTextBoxOnPreviewKeyDown;
19 | GetSaveInTemplate().Click += QuickPreferenceWindow_SaveTemplate_Click;
20 | GetRestoreInTemplate().Click +=QuickPreferenceWindow_RestoreTemplate_Click;
21 | GetMoveUpInTemplate().Click += QuickPreferenceWindow_moveUp_Click;
22 | GetMoveDownInTemplate().Click += QuickPreferenceWindow_moveDown_Click;
23 | GetDeleteItemInTemplate().Click += QuickPreferenceWindow_delItem_Click;
24 | GetCreateItemInTemplate().Click += QuickPreferenceWindow_newItem_Click;
25 | GetSetToDefaultInGeneral().Click += QuickPreferenceWindow_default_Click;
26 | m_handler = handler;
27 | }
28 | void QuickPreferenceWindow_default_Click(object sender, RoutedEventArgs e)
29 | {
30 | m_handler.OnGeneralDefault();
31 | }
32 |
33 | void QuickPreferenceWindow_moveUp_Click(object sender, RoutedEventArgs e)
34 | {
35 | m_handler.OnMoveUpMethod();
36 | }
37 |
38 | void QuickPreferenceWindow_moveDown_Click(object sender, RoutedEventArgs e)
39 | {
40 | m_handler.OnMoveDownMethod();
41 | }
42 |
43 | void QuickPreferenceWindow_delItem_Click(object sender, RoutedEventArgs e)
44 | {
45 | m_handler.OnDeleteMethod();
46 | }
47 |
48 | void QuickPreferenceWindow_newItem_Click(object sender, RoutedEventArgs e)
49 | {
50 | m_handler.OnCreateNewMethod();
51 | }
52 |
53 | void QuickPreferenceWindow_SaveTemplate_Click(object sender, RoutedEventArgs e)
54 | {
55 | m_handler.OnSaveMethod();
56 | }
57 |
58 | void QuickPreferenceWindow_RestoreTemplate_Click(object sender, RoutedEventArgs e)
59 | {
60 | m_handler.OnRestoreMethod();
61 | }
62 |
63 | private void QuickPreferenceWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
64 | {
65 | e.Cancel = true;
66 | Hide();
67 | m_handler.OnSave();
68 | }
69 |
70 | private void template_list_SelectionChanged(object sender, SelectionChangedEventArgs e)
71 | {
72 | m_handler.OnTemplateSelected(GetTemplateListInTemplate().SelectedIndex);
73 | }
74 |
75 | private void template_methods_SelectionChanged(object sender, SelectionChangedEventArgs e)
76 | {
77 | m_handler.OnTemplateMethodSelect(GetMethodsListInTemplate().SelectedIndex);
78 | }
79 |
80 | public void ShowAbout()
81 | {
82 | about.IsSelected = true;
83 | Show();
84 | }
85 |
86 | public new void Show()
87 | {
88 | m_handler.LoadConfig();
89 | base.Show();
90 | }
91 |
92 | public TextBox GetContextTextBoxInGeneral()
93 | {
94 | return general_contextShortcutTx;
95 | }
96 |
97 | public TextBox GetQuickTextBoxInGeneral()
98 | {
99 | return general_quickShortcutTx;
100 | }
101 |
102 | public CheckBox GetContextShiftInGeneral()
103 | {
104 | return general_contextShift;
105 | }
106 |
107 | public CheckBox GetContextCtrlInGeneral()
108 | {
109 | return general_contextCtrl;
110 | }
111 |
112 | public CheckBox GetContextAltInGeneral()
113 | {
114 | return general_contextAlt;
115 | }
116 |
117 | public CheckBox GetContextWinInGeneral()
118 | {
119 | return general_contextWin;
120 | }
121 |
122 | public CheckBox GetUseContext()
123 | {
124 | return general_useContext;
125 | }
126 |
127 | public CheckBox GetQuickShiftInGeneral()
128 | {
129 | return general_quickShift;
130 | }
131 |
132 | public CheckBox GetQuickCtrlInGeneral()
133 | {
134 | return general_quickCtrl;
135 | }
136 |
137 | public CheckBox GetQuickAltInGeneral()
138 | {
139 | return general_quickAlt;
140 | }
141 |
142 | public CheckBox GetQuickWinInGeneral()
143 | {
144 | return general_quickWin;
145 | }
146 |
147 | public Button GetSetToDefaultInGeneral()
148 | {
149 | return general_setToDefault;
150 | }
151 |
152 | public ListView GetContextMenuInGeneral()
153 | {
154 | return general_contextMenu;
155 | }
156 |
157 | public ComboBox GetTemplateListInTemplate()
158 | {
159 | return template_list;
160 | }
161 |
162 | public ListBox GetMethodsListInTemplate()
163 | {
164 | return template_methods;
165 | }
166 |
167 | public TextBox GetMethodNameTextBoxInTemplate()
168 | {
169 | return tmp_methodname;
170 | }
171 |
172 | public TextBox GetMethodDescriptionTextBoxInTemplate()
173 | {
174 | return tmp_methoddesc;
175 | }
176 |
177 | public TextBox GetMethodScriptTextBoxInTemplate()
178 | {
179 | return tmp_methodscpt;
180 | }
181 |
182 | public TextBox GetMethodRegexTextBoxInTemplate()
183 | {
184 | return tmp_methodreg;
185 | }
186 |
187 | public TextBox GetMethodDefaultArgumentTextBoxInTemplate()
188 | {
189 | return tmp_methoddefarg;
190 | }
191 |
192 | public Button GetRestoreInTemplate()
193 | {
194 | return tmp_restore;
195 | }
196 |
197 | public Button GetSaveInTemplate()
198 | {
199 | return tmp_save;
200 | }
201 |
202 | public Button GetMoveUpInTemplate()
203 | {
204 | return tmp_moveUp;
205 | }
206 |
207 | public Button GetMoveDownInTemplate()
208 | {
209 | return tmp_moveDown;
210 | }
211 |
212 | public Button GetDeleteItemInTemplate()
213 | {
214 | return tmp_delItem;
215 | }
216 |
217 | public Button GetCreateItemInTemplate()
218 | {
219 | return tmp_newItem;
220 | }
221 |
222 | public TextBlock GetVersionTextBlockInAbout()
223 | {
224 | return tb_version;
225 | }
226 |
227 | private void newContextMenu_Click(object sender, RoutedEventArgs e)
228 | {
229 | m_handler.OnCreateNewContext();
230 | }
231 |
232 | private void removeContextMenu_Click(object sender, RoutedEventArgs e)
233 | {
234 | m_handler.OnRemoveContext();
235 | }
236 |
237 | private void modifyContextMenu_Click(object sender, RoutedEventArgs e)
238 | {
239 | m_handler.OnModifyContext();
240 | }
241 |
242 | private IQuickPreferenceWindowHandler m_handler;
243 | }
244 | }
245 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F36B622E-4F74-4D69-912C-FB9DE8915362}
8 | library
9 | Properties
10 | Froser.Quick.UI
11 | QuickUI
12 | v4.0
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 |
19 | true
20 | full
21 | false
22 | ..\..\Bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | pdbonly
29 | true
30 | ..\..\Bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 | true
37 | ..\..\Bin\Debug4KSO\
38 | DEBUG;TRACE
39 | full
40 | AnyCPU
41 | prompt
42 | MinimumRecommendedRules.ruleset
43 |
44 |
45 | ..\..\Bin\Release4KSO\
46 | TRACE
47 | true
48 | pdbonly
49 | AnyCPU
50 | prompt
51 | MinimumRecommendedRules.ruleset
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | 4.0
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | QuickContextWindow.xaml
77 |
78 |
79 | QuickPerferenceContextEdit.xaml
80 |
81 |
82 |
83 | QuickPreferenceWindow.xaml
84 |
85 |
86 | Designer
87 | MSBuild:Compile
88 |
89 |
90 | Designer
91 | MSBuild:Compile
92 |
93 |
94 |
95 |
96 |
97 | QuickMainWindow.xaml
98 |
99 |
100 | Designer
101 | MSBuild:Compile
102 |
103 |
104 | MSBuild:Compile
105 | Designer
106 |
107 |
108 | Designer
109 | MSBuild:Compile
110 |
111 |
112 |
113 |
114 | Code
115 |
116 |
117 | True
118 | True
119 | Resources.resx
120 |
121 |
122 | True
123 | Settings.settings
124 | True
125 |
126 |
127 | ResXFileCodeGenerator
128 | Resources.Designer.cs
129 |
130 |
131 |
132 | SettingsSingleFileGenerator
133 | Settings.Designer.cs
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
167 |
--------------------------------------------------------------------------------
/Coding/QuickUI/QuickUIResource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Media.Imaging;
6 |
7 | namespace Froser.Quick.UI
8 | {
9 | public static class QuickUIResource
10 | {
11 | public static BitmapImage GetDefaultIcon()
12 | {
13 | if (s_defaultIcon == null)
14 | {
15 | string uri = "resources/icons/quick.png";
16 | s_defaultIcon = new BitmapImage(new Uri(uri, UriKind.RelativeOrAbsolute));
17 | }
18 | return s_defaultIcon;
19 | }
20 |
21 | public static BitmapImage GetDefaultPluginIcon()
22 | {
23 | if (s_defaultPluginIcon == null)
24 | {
25 | string uri = "resources/icons/plugin.png";
26 | s_defaultPluginIcon = new BitmapImage(new Uri(uri, UriKind.RelativeOrAbsolute));
27 | }
28 | return s_defaultPluginIcon;
29 | }
30 |
31 | public static BitmapImage GetLockedIcon()
32 | {
33 | if (m_iconLocked == null)
34 | {
35 | string uri = "resources/icons/locked.png";
36 | m_iconLocked = new BitmapImage(new Uri(uri, UriKind.RelativeOrAbsolute));
37 | }
38 | return m_iconLocked;
39 | }
40 |
41 | public static BitmapImage GetUnlockedIcon()
42 | {
43 | if (m_iconUnlocked == null)
44 | {
45 | string uri = "resources/icons/unlocked.png";
46 | m_iconUnlocked = new BitmapImage(new Uri(uri, UriKind.RelativeOrAbsolute));
47 | }
48 | return m_iconUnlocked;
49 | }
50 |
51 | private static BitmapImage s_defaultIcon;
52 | private static BitmapImage s_defaultPluginIcon;
53 | private static BitmapImage m_iconLocked;
54 | private static BitmapImage m_iconUnlocked;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/config_about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/config_about.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/config_behaviors.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/config_behaviors.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/config_general.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/config_general.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/locked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/locked.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/plugin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/plugin.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/quick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/quick.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/quick128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/quick128.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Resources/icons/unlocked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/QuickUI/Resources/icons/unlocked.png
--------------------------------------------------------------------------------
/Coding/QuickUI/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
--------------------------------------------------------------------------------
/Coding/QuickUI/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Froser.Quick.QuickUpdate
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 应用程序的主入口点。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | SilenceUpdate.Update();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("QuickUpdate")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Froser")]
12 | [assembly: AssemblyProduct("Quick")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("c3de8738-6b18-4a26-927c-db482c1975e6")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.18408
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick.QuickUpdate.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Froser.Quick.QuickUpdate.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.18408
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Froser.Quick.QuickUpdate.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/QuickUpdate.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {E197A7E7-B3E0-4ECF-AC0A-459BC80D2A28}
8 | WinExe
9 | Properties
10 | Froser.Quick.QuickUpdate
11 | QuickUpdate
12 | v4.0
13 | 512
14 | false
15 |
16 | 发布\
17 | true
18 | Disk
19 | false
20 | Foreground
21 | 7
22 | Days
23 | false
24 | false
25 | true
26 | 0
27 | 1.0.0.%2a
28 | false
29 | true
30 |
31 |
32 | AnyCPU
33 | true
34 | full
35 | false
36 | ..\..\Bin\Debug\
37 | DEBUG;TRACE
38 | prompt
39 | 4
40 |
41 |
42 | AnyCPU
43 | pdbonly
44 | true
45 | ..\..\Bin\Release\
46 | TRACE
47 | prompt
48 | 4
49 |
50 |
51 | ..\..\Bin\Debug4KSO\
52 | true
53 | TRACE;DEBUG;KSO
54 | full
55 | true
56 |
57 |
58 | ..\..\Bin\Release4KSO\
59 | TRACE
60 | true
61 | pdbonly
62 | true
63 |
64 |
65 | LocalIntranet
66 |
67 |
68 | false
69 |
70 |
71 |
72 | Froser.Quick.QuickUpdate.Program
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | ResXFileCodeGenerator
92 | Resources.Designer.cs
93 | Designer
94 |
95 |
96 | True
97 | Resources.resx
98 | True
99 |
100 |
101 | SettingsSingleFileGenerator
102 | Settings.Designer.cs
103 |
104 |
105 | True
106 | Settings.settings
107 | True
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | False
116 | Microsoft .NET Framework 4.5 %28x86 和 x64%29
117 | true
118 |
119 |
120 | False
121 | .NET Framework 3.5 SP1 Client Profile
122 | false
123 |
124 |
125 | False
126 | .NET Framework 3.5 SP1
127 | false
128 |
129 |
130 |
131 |
138 |
--------------------------------------------------------------------------------
/Coding/QuickUpdate/SilenceUpdate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Froser.Quick.QuickUpdate
12 | {
13 | public static class SilenceUpdate
14 | {
15 | public static void Update()
16 | {
17 | while (IsQuickRunning())
18 | {
19 | Thread.Sleep(100);
20 | }
21 |
22 | if (HasNotifyFile())
23 | {
24 | try
25 | {
26 | // 准备更新,将文件全部都拷贝出来,然后运行Quick.exe,然后删除updatenotify和update文件夹
27 | CopyFile();
28 | Clear();
29 | Exec();
30 | Done();
31 | }
32 | catch
33 | {
34 | // Swallow exceptions
35 | }
36 | }
37 | }
38 |
39 | private static bool IsQuickRunning()
40 | {
41 | Process[] proc = Process.GetProcessesByName(s_processName);
42 | return proc.Length > 0;
43 | }
44 |
45 | private static bool HasNotifyFile()
46 | {
47 |
48 | return File.Exists(NotifyFilePath);
49 | }
50 |
51 | private static void CopyFile()
52 | {
53 | string[] files = Directory.GetFiles(UpdateDir, "*", SearchOption.AllDirectories);
54 | foreach (var file in files)
55 | {
56 | string relPath = file.Replace(UpdateDir, "");
57 | string dest = Path.Combine(AppDir, relPath);
58 | File.Copy(file, dest, true);
59 | }
60 | }
61 |
62 | private static void Clear()
63 | {
64 | File.Delete(NotifyFilePath);
65 | Directory.Delete(UpdateDir, true);
66 | }
67 |
68 | private static void Exec()
69 | {
70 | Debug.Assert(File.Exists(AppPath));
71 | Process.Start(AppPath);
72 | }
73 |
74 | private static void Done()
75 | {
76 | }
77 |
78 | private static string AppDir
79 | {
80 | get
81 | {
82 | return AppDomain.CurrentDomain.BaseDirectory;
83 | }
84 | }
85 |
86 | private static string UpdateDir
87 | {
88 | get
89 | {
90 | return Path.Combine(AppDir, s_updateDirName) + @"\";
91 | }
92 | }
93 |
94 | private static string NotifyFilePath
95 | {
96 | get
97 | {
98 | return Path.Combine(AppDir, s_notifyFile);
99 | }
100 | }
101 |
102 | private static string AppPath
103 | {
104 | get
105 | {
106 | return Path.Combine(AppDir, s_appName);
107 | }
108 | }
109 |
110 | private const string s_notifyFile = "updatenotify";
111 | private const string s_appName = "quick.exe";
112 | private const string s_updateDirName = "update";
113 | private const string s_processName = "Quick";
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Coding/Resources/icons/folder16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/folder16.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/folder24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/folder24.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/folder32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/folder32.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/folder48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/folder48.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/locked16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/locked16.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/locked24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/locked24.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/plugin32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/plugin32.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/plugin48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/plugin48.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/quick128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/quick128.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/quick16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/quick16.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/quick24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/quick24.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/quick32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/quick32.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/quick48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/quick48.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/quick64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/quick64.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/quick72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/quick72.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/unlocked16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/unlocked16.png
--------------------------------------------------------------------------------
/Coding/Resources/icons/unlocked24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Froser/Quick/f54a3e94674737a9577dc1ef77adbd6f64cbca2d/Coding/Resources/icons/unlocked24.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Quick
2 | A convenience tool makes you more effective
3 |
--------------------------------------------------------------------------------