├── .gitattributes
├── .gitignore
├── ArkDesktop.sln
├── ArkDesktopCoreKit
├── ArkDesktopCoreKit.csproj
├── ConfigManager.cs
├── IArkDesktopPluginModule.cs
├── InstanceManager.cs
├── LayeredWindow.cs
├── LayeredWindowManager.Designer.cs
├── LayeredWindowManager.cs
├── LayeredWindowManager.resx
├── PackageManager.cs
├── PluginGuiContainer.Designer.cs
├── PluginGuiContainer.cs
├── PluginGuiContainer.resx
├── Properties
│ └── AssemblyInfo.cs
├── UpdateChecker.cs
└── Win32Api.cs
├── ArkDesktopHelperWPF
├── !!!!!!操作必看.txt
├── !!!!!!界面介绍.png
├── About.xaml
├── About.xaml.cs
├── App.config
├── App.xaml
├── App.xaml.cs
├── ArkDesktopHelperWPF.csproj
├── ConfigCard.xaml
├── ConfigCard.xaml.cs
├── ConfigSelect.xaml
├── ConfigSelect.xaml.cs
├── Dialog.xaml
├── Dialog.xaml.cs
├── GlobalIcon.ico
├── GlobalIcon.png
├── GlobalSetting.xaml
├── GlobalSetting.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── packages.config
└── testimg.png
├── ArkDesktopLua
├── ArkDesktopLua.cs
├── ArkDesktopLua.csproj
├── LuaApi.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── GlobalIcon.ico
├── GlobalIcon.png
├── LICENSE
├── LicenseForGlobalIcon.txt
├── Readme.md
├── TestApp
├── App.config
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── TestApp.csproj
└── testimg.png
└── docs
└── index.html
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
341 |
342 | # self build folder
343 | Build/
--------------------------------------------------------------------------------
/ArkDesktop.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29123.88
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArkDesktopLua", "ArkDesktopLua\ArkDesktopLua.csproj", "{AA4D8756-09C4-4C9A-A117-D3DB36085F0F}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lua", "Lua", "{616FB4B8-B309-4F8F-B008-4EE7643EC1A6}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArkDesktopCoreKit", "ArkDesktopCoreKit\ArkDesktopCoreKit.csproj", "{ED7282FD-04A9-400D-ABC4-540724FA8A44}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{764ECBC1-EB5C-46CE-9C35-E58729D31847}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArkDesktopHelperWPF", "ArkDesktopHelperWPF\ArkDesktopHelperWPF.csproj", "{B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Debug|x64 = Debug|x64
20 | Debug|x86 = Debug|x86
21 | Release|Any CPU = Release|Any CPU
22 | Release|x64 = Release|x64
23 | Release|x86 = Release|x86
24 | EndGlobalSection
25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
26 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Debug|x64.ActiveCfg = Debug|Any CPU
29 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Debug|x64.Build.0 = Debug|Any CPU
30 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Debug|x86.ActiveCfg = Debug|Any CPU
31 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Debug|x86.Build.0 = Debug|Any CPU
32 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Release|x64.ActiveCfg = Release|Any CPU
35 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Release|x64.Build.0 = Release|Any CPU
36 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Release|x86.ActiveCfg = Release|Any CPU
37 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}.Release|x86.Build.0 = Release|Any CPU
38 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Debug|x64.ActiveCfg = Debug|Any CPU
41 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Debug|x64.Build.0 = Debug|Any CPU
42 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Debug|x86.ActiveCfg = Debug|Any CPU
43 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Debug|x86.Build.0 = Debug|Any CPU
44 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Release|x64.ActiveCfg = Release|Any CPU
47 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Release|x64.Build.0 = Release|Any CPU
48 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Release|x86.ActiveCfg = Release|Any CPU
49 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}.Release|x86.Build.0 = Release|Any CPU
50 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Debug|Any CPU.Build.0 = Debug|Any CPU
52 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Debug|x64.ActiveCfg = Debug|Any CPU
53 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Debug|x64.Build.0 = Debug|Any CPU
54 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Debug|x86.ActiveCfg = Debug|Any CPU
55 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Debug|x86.Build.0 = Debug|Any CPU
56 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Release|Any CPU.ActiveCfg = Release|Any CPU
57 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Release|Any CPU.Build.0 = Release|Any CPU
58 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Release|x64.ActiveCfg = Release|Any CPU
59 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Release|x64.Build.0 = Release|Any CPU
60 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Release|x86.ActiveCfg = Release|Any CPU
61 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}.Release|x86.Build.0 = Release|Any CPU
62 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
64 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Debug|x64.ActiveCfg = Debug|Any CPU
65 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Debug|x64.Build.0 = Debug|Any CPU
66 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Debug|x86.ActiveCfg = Debug|Any CPU
67 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Debug|x86.Build.0 = Debug|Any CPU
68 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
69 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Release|Any CPU.Build.0 = Release|Any CPU
70 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Release|x64.ActiveCfg = Release|Any CPU
71 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Release|x64.Build.0 = Release|Any CPU
72 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Release|x86.ActiveCfg = Release|Any CPU
73 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}.Release|x86.Build.0 = Release|Any CPU
74 | EndGlobalSection
75 | GlobalSection(SolutionProperties) = preSolution
76 | HideSolutionNode = FALSE
77 | EndGlobalSection
78 | GlobalSection(NestedProjects) = preSolution
79 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F} = {616FB4B8-B309-4F8F-B008-4EE7643EC1A6}
80 | EndGlobalSection
81 | GlobalSection(ExtensibilityGlobals) = postSolution
82 | SolutionGuid = {BC85A314-D1BC-4F4E-9B27-56309804FAE0}
83 | EndGlobalSection
84 | EndGlobal
85 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/ArkDesktopCoreKit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {ED7282FD-04A9-400D-ABC4-540724FA8A44}
8 | Library
9 | Properties
10 | ArkDesktop.CoreKit
11 | ArkDesktopCoreKit
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 | true
18 | full
19 | false
20 | ..\Build\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | none
27 | true
28 | ..\Build\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | Form
52 |
53 |
54 | UserControl
55 |
56 |
57 | LayeredWindowManager.cs
58 |
59 |
60 |
61 | Form
62 |
63 |
64 | PluginGuiContainer.cs
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | LayeredWindowManager.cs
73 |
74 |
75 | PluginGuiContainer.cs
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/ConfigManager.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 | using System.Threading.Tasks;
8 | using System.Xml;
9 | using System.Xml.Linq;
10 |
11 | namespace ArkDesktop.CoreKit
12 | {
13 | public static class BinaryFileHelper
14 | {
15 | public static int ReadInt32(Stream stream)
16 | {
17 | byte[] cov = new byte[4];
18 | for (int i = 0; i < 4; ++i) cov[i] = (byte)stream.ReadByte();
19 | return BitConverter.ToInt32(cov, 0);
20 | }
21 | static bool ConvertIntToByteArray(Int32 m, ref byte[] arry)
22 | {
23 | if (arry == null) return false;
24 | if (arry.Length < 4) return false;
25 |
26 | arry[0] = (byte)(m & 0xFF);
27 | arry[1] = (byte)((m & 0xFF00) >> 8);
28 | arry[2] = (byte)((m & 0xFF0000) >> 16);
29 | arry[3] = (byte)((m >> 24) & 0xFF);
30 |
31 | return true;
32 | }
33 | public static void WriteInt32(Stream stream, int s)
34 | {
35 | byte[] cov = new byte[4];
36 | ConvertIntToByteArray(s, ref cov);
37 | stream.Write(cov, 0, 4);
38 | }
39 | public static byte[] ReadBytes(Stream stream, int count)
40 | {
41 | byte[] ret = new byte[count];
42 | stream.Read(ret, 0, count);
43 | return ret;
44 | }
45 | public static void WriteBytes(Stream stream, byte[] s)
46 | {
47 | stream.Write(s, 0, s.Length);
48 | }
49 | public static void WriteString(Stream stream, string s)
50 | {
51 | WriteBytes(stream, Encoding.UTF8.GetBytes(s));
52 | }
53 | }
54 |
55 | public class ResourceManager
56 | {
57 | private string rootPath;
58 | private FileStream packageStream;
59 | private Dictionary> packagedFile = new Dictionary>();
60 | private Dictionary activeConfigs = new Dictionary();
61 | private ConfigManager.ManageConfigSaveMethod manageConfigSave;
62 | public ResourceManager(string rootPath, ConfigManager.ManageConfigSaveMethod manageConfigSave)
63 | {
64 | this.rootPath = rootPath;
65 | this.manageConfigSave = manageConfigSave;
66 | if (Directory.Exists(rootPath) == false)
67 | {
68 | throw new ArgumentException("Cannot found specified path.", nameof(rootPath));
69 | }
70 | if (File.Exists(Path.Combine(rootPath, "resources.akdres")))
71 | {
72 | packageStream = File.OpenRead(Path.Combine(rootPath, "resources.akdres"));
73 | ReadFileList();
74 | }
75 | }
76 |
77 | private bool CheckInDir(string realPath)
78 | {
79 | return true;
80 | }
81 |
82 | public Stream OpenRead(string filename, bool packagedFirst = false)
83 | {
84 | if (filename.StartsWith("/") || filename.StartsWith("\\"))
85 | filename = filename.Substring(1);
86 | bool packaged = false;
87 | if (packagedFile.ContainsKey(filename))
88 | {
89 | packaged = true;
90 | if (packagedFirst)
91 | throw new NotImplementedException("Lazy...");
92 | }
93 | string realPath = Path.Combine(rootPath, "resources", filename);
94 | if (CheckInDir(realPath) == false)
95 | {
96 | return new MemoryStream();
97 | }
98 | if (File.Exists(realPath))
99 | {
100 | return File.OpenRead(realPath);
101 | }
102 | else if (packaged)
103 | {
104 | throw new NotImplementedException("Lazy...");
105 | }
106 | return new MemoryStream();
107 | }
108 |
109 | public Stream OpenWrite(string filename)
110 | {
111 | string realPath = Path.Combine(rootPath, filename);
112 | if (CheckInDir(realPath) == false)
113 | {
114 | return new MemoryStream();
115 | }
116 | throw new NotImplementedException();
117 | }
118 |
119 | private void ReadFileList()
120 | {
121 | throw new NotImplementedException("Lazy...");
122 | }
123 |
124 | public XElement GetConfig(string moduleName)
125 | {
126 | string realPath = Path.Combine(rootPath, "config", moduleName + ".xml");
127 | if (CheckInDir(realPath) == false || File.Exists(realPath) == false)
128 | {
129 | var v = XDocument.Parse("");
130 | v.Save(realPath);
131 | }
132 | if (activeConfigs.ContainsKey(moduleName) == false)
133 | {
134 | activeConfigs[moduleName] = XDocument.Parse(File.ReadAllText(realPath));
135 | manageConfigSave?.Invoke(realPath, activeConfigs[moduleName]);
136 | }
137 | return activeConfigs[moduleName].Root;
138 | }
139 |
140 | public void SaveConfig(string moduleName)
141 | {
142 | if (activeConfigs.ContainsKey(moduleName) == false)
143 | {
144 | return;
145 | }
146 | string realPath = Path.Combine(rootPath, "config", moduleName + ".xml");
147 | activeConfigs[moduleName].Save(realPath);
148 | }
149 | }
150 |
151 | public class PluginModuleInfo
152 | {
153 | public readonly string pluginName;
154 | public readonly string moduleName;
155 | public readonly Guid moduleGuid;
156 | public readonly Assembly assembly;
157 | public readonly string fullName;
158 | public readonly string description;
159 | public readonly int version;
160 | public PluginModuleInfo(string pluginName, IArkDesktopPluginModule module)
161 | {
162 | this.pluginName = pluginName;
163 | moduleName = module.Name;
164 | moduleGuid = module.Guid;
165 | assembly = module.GetType().Assembly;
166 | fullName = module.GetType().FullName;
167 | description = module.Description;
168 | version = module.Version;
169 | }
170 | public static List ReadFromDll(string filename)
171 | {
172 | Assembly assembly;
173 | using (var fs = File.OpenRead(filename))
174 | {
175 | byte[] vs = new byte[fs.Length];
176 | int read = 0, toRead = unchecked((int)fs.Length);
177 | while (toRead != 0)
178 | {
179 | int readed = fs.Read(vs, read, toRead);
180 | read += readed;
181 | toRead -= readed;
182 | }
183 | assembly = Assembly.Load(vs);
184 | }
185 | var found = from e in assembly.GetTypes()
186 | where typeof(IArkDesktopPluginModule).IsAssignableFrom(e)
187 | select e;
188 | var ret = new List();
189 | foreach (Type i in found)
190 | {
191 | IArkDesktopPluginModule module = (IArkDesktopPluginModule)i.Assembly.CreateInstance(i.FullName);
192 | ret.Add(new PluginModuleInfo(Path.GetFileName(filename), module));
193 | }
194 | return ret;
195 | }
196 | }
197 |
198 | public class ConfigInfo
199 | {
200 | public bool disableSave = true;
201 | ///
202 | /// Change before launch!
203 | ///
204 | public string ConfigName { get => configName; set { configName = value; Save(); } }
205 | public Guid ConfigGuid { get; }
206 | public string Description { get => description; set { description = value; Save(); } }
207 | public PluginModuleInfo LaunchModule
208 | {
209 | get => launchModule;
210 | set
211 | {
212 | launchModule = value;
213 | LaunchModuleName = value.moduleName;
214 | LaunchModuleGuid = value.moduleGuid;
215 | Save();
216 | }
217 | }
218 | public string LaunchModuleName { get; private set; }
219 | public Guid LaunchModuleGuid { get; private set; }
220 | public string rootPath;
221 | private string configName;
222 | private string description;
223 | private PluginModuleInfo launchModule;
224 | private ConfigManager.ManageConfigSaveMethod manageConfigSave;
225 |
226 | private void Save()
227 | {
228 | if (disableSave) return;
229 | XDocument document = new XDocument(
230 | new XElement("ArkDesktop",
231 | new XElement("Version", 1),
232 | new XElement("Guid", ConfigGuid.ToString()),
233 | new XElement("Description", description),
234 | new XElement("LaunchModule",
235 | new XElement("Name", LaunchModuleName),
236 | new XElement("Guid", LaunchModuleGuid))));
237 | document.Save(Path.Combine(rootPath, "config.xml"));
238 | if (Path.GetFileName(rootPath) != configName)
239 | {
240 | Directory.Move(rootPath, Path.Combine(Path.GetDirectoryName(rootPath), configName));
241 | rootPath = Path.Combine(Path.GetDirectoryName(rootPath), configName);
242 | }
243 | }
244 | public void LoadPluginModule(PluginModuleInfo module)
245 | {
246 | launchModule = module;
247 | }
248 |
249 | private ConfigInfo(XElement config, string dir, IEnumerable modules, ConfigManager.ManageConfigSaveMethod manageConfigSave)
250 | {
251 | rootPath = dir;
252 | this.manageConfigSave = manageConfigSave;
253 | ConfigName = Path.GetFileName(dir);
254 | ConfigGuid = new Guid(config.Element("Guid").Value);
255 | Description = config.Element("Description")?.Value;
256 | LaunchModuleName = config.Element("LaunchModule").Element("Name").Value;
257 | LaunchModuleGuid = new Guid(config.Element("LaunchModule").Element("Guid").Value);
258 | var found = from r in modules where r.moduleGuid == LaunchModuleGuid select r;
259 | if (found.Any()) LoadPluginModule(found.First());
260 | disableSave = false;
261 | }
262 |
263 | public static ConfigInfo ReadConfigFromDisk(string dir, IEnumerable modules, ConfigManager.ManageConfigSaveMethod manageConfigSave)
264 | {
265 | if (File.Exists(Path.Combine(dir, "config.xml")) == false)
266 | {
267 | throw new ArgumentException("Invalid config directory.", nameof(dir));
268 | }
269 | XDocument document = XDocument.Load(Path.Combine(dir, "config.xml"));
270 | if (document.Root.Name != "ArkDesktop")
271 | {
272 | throw new Exception("Invalid config file.");
273 | }
274 | string[] requirement = new string[] { "Version", "Guid", "LaunchModule" };
275 | foreach (string s in requirement)
276 | {
277 | if (document.Root.Element(s) == null)
278 | {
279 | throw new Exception("Cannot find \"" + s + "\" in config.xml.");
280 | }
281 | }
282 | if (int.Parse(document.Root.Element("Version").Value) != 1)
283 | {
284 | throw new Exception("Invalid version \"" + document.Root.Element("Version").Value + "\" in config.xml.");
285 | }
286 | XElement element = document.Root.Element("LaunchModule");
287 | if (element.Element("Name") == null || element.Element("Guid") == null)
288 | {
289 | throw new Exception("Invalid launch info in config.xml.");
290 | }
291 | return new ConfigInfo(document.Root, dir, modules, manageConfigSave);
292 | }
293 |
294 | public ResourceManager ResourceManager => new ResourceManager(rootPath, manageConfigSave);
295 | }
296 |
297 | public class ConfigManager
298 | {
299 | public string rootPath;
300 | public List Modules { get; private set; } = new List();
301 | public List Configs { get; private set; } = new List();
302 | public List> managedConfigSave = new List>();
303 | private HashSet loadedConfigs = new HashSet();
304 | private HashSet loadedModules = new HashSet();
305 |
306 | public ConfigManager(string root)
307 | {
308 | rootPath = root;
309 | }
310 | public void LoadDll(string filename)
311 | {
312 | foreach (var i in PluginModuleInfo.ReadFromDll(Path.Combine(Path.Combine(rootPath, "/plugins/"), filename)))
313 | {
314 | if (loadedModules.Contains(i.moduleGuid) == false)
315 | {
316 | loadedModules.Add(i.moduleGuid);
317 | Modules.Add(i);
318 | foreach (var j in from e in Configs where e.LaunchModule == null && e.LaunchModuleGuid == i.moduleGuid select e)
319 | j.LoadPluginModule(i);
320 | }
321 | }
322 | }
323 | public void LoadConfig(string dir)
324 | {
325 | var get = ConfigInfo.ReadConfigFromDisk(Path.Combine(rootPath, dir), Modules, ManageConfigSave);
326 | if (loadedConfigs.Contains(get.ConfigGuid) == false)
327 | {
328 | loadedConfigs.Add(get.ConfigGuid);
329 | Configs.Add(get);
330 | }
331 | }
332 |
333 | public void ScanPlugins(string dir)
334 | {
335 | var list = Directory.EnumerateFiles(dir);
336 | foreach (var i in list)
337 | {
338 | if (i.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
339 | {
340 | try
341 | {
342 | LoadDll(i);
343 | }
344 | catch (Exception)
345 | {
346 | }
347 | }
348 | }
349 | }
350 | public void ScanPlugins() => ScanPlugins(Path.Combine(rootPath, "plugins"));
351 |
352 | public void ScanConfigs(string dir)
353 | {
354 | if (Directory.Exists(dir) == false) Directory.CreateDirectory(dir);
355 | foreach (var i in Directory.EnumerateDirectories(dir, "*", SearchOption.TopDirectoryOnly))
356 | {
357 | if (i.StartsWith("__shared") == false)
358 | {
359 | try
360 | {
361 | LoadConfig(i);
362 | }
363 | catch (Exception)
364 | {
365 | }
366 | }
367 | }
368 | }
369 | public void ScanConfigs() => ScanConfigs(Path.Combine(rootPath, "configs"));
370 |
371 | public void SaveAllConfigs()
372 | {
373 | foreach (var i in managedConfigSave) i.Item2.Save(i.Item1);
374 | }
375 |
376 | public delegate void ManageConfigSaveMethod(string path, XDocument document);
377 | public void ManageConfigSave(string path, XDocument document)
378 | {
379 | managedConfigSave.Add(new Tuple(path, document));
380 | }
381 | }
382 | }
383 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/IArkDesktopPluginModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ArkDesktop.CoreKit
8 | {
9 | public interface IArkDesktopPluginModule//V3
10 | {
11 | string Name { get; }
12 | Guid Guid { get; }
13 | bool Disposed { get; }
14 | string Description { get; }
15 | int Version { get; }
16 | bool CheckFeature(string featureName);
17 | void MainThread(ResourceManager resources, InstanceHelper instanceHelper);
18 | void RequestDispose();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/InstanceManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace ArkDesktop.CoreKit
10 | {
11 | public class InstanceHelper
12 | {
13 | private readonly string extraName;
14 |
15 | public PluginGuiContainer PluginGuiContainer { get; private set; }
16 | public InstanceHelper(PluginGuiContainer container, string extraName)
17 | {
18 | PluginGuiContainer = container;
19 | this.extraName = extraName;
20 | }
21 |
22 | public void AddControl(string controlName, Control control)
23 | {
24 | if (PluginGuiContainer.tabControl.InvokeRequired)
25 | {
26 | PluginGuiContainer.tabControl.Invoke((MethodInvoker)(() => AddControl(controlName, control)));
27 | return;
28 | }
29 | controlName = string.Format("[{0}]{1}", extraName, controlName);
30 | if (PluginGuiContainer.tabControl.TabPages.ContainsKey(controlName))
31 | {
32 | throw new Exception("Control name exists.");
33 | }
34 | TabPage tabPage = new TabPage(controlName);
35 | tabPage.Controls.Add(control);
36 | PluginGuiContainer.tabControl.TabPages.Add(tabPage);
37 | }
38 |
39 | public void RemoveControl(string controlName)
40 | {
41 | if (PluginGuiContainer.tabControl.InvokeRequired)
42 | {
43 | PluginGuiContainer.tabControl.Invoke((MethodInvoker)(() => RemoveControl(controlName)));
44 | }
45 | controlName = string.Format("[{0}]{1}", extraName, controlName);
46 | if (PluginGuiContainer.tabControl.TabPages.ContainsKey(controlName))
47 | {
48 | PluginGuiContainer.tabControl.TabPages.Remove(PluginGuiContainer.tabControl.TabPages[PluginGuiContainer.tabControl.TabPages.IndexOfKey(controlName)]);
49 | }
50 | }
51 | }
52 |
53 | public class InstanceManager
54 | {
55 | public PluginGuiContainer pluginGuiContainer;
56 | public ManualResetEvent Ready;
57 | public Thread thread;
58 |
59 | public InstanceManager(PluginGuiContainer pluginGuiContainer)
60 | {
61 | this.pluginGuiContainer = pluginGuiContainer;
62 | Ready = pluginGuiContainer.Ready;
63 | thread = new Thread(new ThreadStart(() =>
64 | {
65 | Application.EnableVisualStyles();
66 | Application.Run(pluginGuiContainer);
67 | }));
68 | thread.SetApartmentState(ApartmentState.STA);
69 | thread.IsBackground = true;
70 | thread.Start();
71 | }
72 |
73 | public void LaunchModule(ConfigInfo info)
74 | {
75 | IArkDesktopPluginModule module = info.LaunchModule.assembly.CreateInstance(info.LaunchModule.fullName) as IArkDesktopPluginModule;
76 | pluginGuiContainer.RequestClose += module.RequestDispose;
77 | Ready.WaitOne();
78 | module.MainThread(info.ResourceManager, new InstanceHelper(pluginGuiContainer, info.ConfigName));
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/LayeredWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Windows.Forms;
8 | using Timer = System.Windows.Forms.Timer;
9 |
10 | namespace ArkDesktop.CoreKit
11 | {
12 | public class LayeredWindow : Form
13 | {
14 | public Timer timer = new Timer();
15 | private IntPtr screenDC, memDC;
16 | public ManualResetEvent Ready { get; private set; } = new ManualResetEvent(false);
17 |
18 | public LayeredWindow()
19 | {
20 | Load += LayeredWindow_Load;
21 | Disposed += LayeredWindow_Disposed;
22 | }
23 |
24 | private void LayeredWindow_Disposed(object sender, EventArgs e)
25 | {
26 | Win32.ReleaseDC(IntPtr.Zero, screenDC);
27 | Win32.DeleteDC(memDC);
28 | }
29 |
30 | private void LayeredWindow_Load(object sender, EventArgs e)
31 | {
32 | FormBorderStyle = FormBorderStyle.None;
33 | screenDC = Win32.GetDC(IntPtr.Zero);
34 | memDC = Win32.CreateCompatibleDC(screenDC);
35 | FormBorderStyle = FormBorderStyle.None;
36 | Ready.Set();
37 | }
38 |
39 | protected override CreateParams CreateParams
40 | {
41 | get
42 | {
43 | CreateParams cp = base.CreateParams;
44 | cp.ExStyle |= 0x00080000;
45 | return cp;
46 | }
47 | }
48 |
49 | public void SetBits(Bitmap bitmap, byte transparency = 255)//调用UpdateLayeredWindow()方法。this.BackgroundImage为你事先准备的带透明图片。
50 | {
51 | if (InvokeRequired)
52 | {
53 | Invoke((MethodInvoker)(() => SetBits(bitmap)));
54 | return;
55 | }
56 |
57 | if (IsDisposed)
58 | {
59 | return;
60 | }
61 |
62 | if (!Image.IsCanonicalPixelFormat(bitmap.PixelFormat) || !Image.IsAlphaPixelFormat(bitmap.PixelFormat))
63 | {
64 | throw new ArgumentException("Not a 32-bit argb bitmap", nameof(bitmap));
65 | }
66 |
67 | IntPtr oldBits = IntPtr.Zero;
68 | IntPtr hBitmap = IntPtr.Zero;
69 |
70 | try
71 | {
72 | Win32.Point topLoc = new Win32.Point(Left, Top);
73 | Win32.Size bitMapSize = new Win32.Size(bitmap.Width, bitmap.Height);
74 | Win32.BLENDFUNCTION blendFunc = new Win32.BLENDFUNCTION();
75 | Win32.Point srcLoc = new Win32.Point(0, 0);
76 |
77 | hBitmap = bitmap.GetHbitmap(Color.FromArgb(0));
78 | oldBits = Win32.SelectObject(memDC, hBitmap);
79 |
80 | blendFunc.BlendOp = Win32.AC_SRC_OVER;
81 | blendFunc.SourceConstantAlpha = transparency;
82 | blendFunc.AlphaFormat = Win32.AC_SRC_ALPHA;
83 | blendFunc.BlendFlags = 0;
84 |
85 | Win32.UpdateLayeredWindow(Handle, screenDC, ref topLoc, ref bitMapSize, memDC, ref srcLoc, 0, ref blendFunc, Win32.ULW_ALPHA);
86 | }
87 | finally
88 | {
89 | if (hBitmap != IntPtr.Zero)
90 | {
91 | Win32.SelectObject(memDC, oldBits);
92 | Win32.DeleteObject(hBitmap);
93 | }
94 | }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/LayeredWindowManager.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ArkDesktop.CoreKit
2 | {
3 | partial class LayeredWindowManager
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region 组件设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.button_Pos = new System.Windows.Forms.Button();
32 | this.linkLabel_Zoom = new System.Windows.Forms.LinkLabel();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.linkLabel_ZoomQuality = new System.Windows.Forms.LinkLabel();
35 | this.linkLabel1 = new System.Windows.Forms.LinkLabel();
36 | this.checkBox_HideTaskbarIcon = new System.Windows.Forms.CheckBox();
37 | this.checkBox_TopMost = new System.Windows.Forms.CheckBox();
38 | this.TransparentEventsCheckBox = new System.Windows.Forms.CheckBox();
39 | this.TransparentImageLinkLabel = new System.Windows.Forms.LinkLabel();
40 | this.SuspendLayout();
41 | //
42 | // button_Pos
43 | //
44 | this.button_Pos.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
45 | | System.Windows.Forms.AnchorStyles.Right)));
46 | this.button_Pos.Location = new System.Drawing.Point(3, 3);
47 | this.button_Pos.Name = "button_Pos";
48 | this.button_Pos.Size = new System.Drawing.Size(101, 23);
49 | this.button_Pos.TabIndex = 0;
50 | this.button_Pos.Text = "窗口位置";
51 | this.button_Pos.UseVisualStyleBackColor = true;
52 | this.button_Pos.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Button_MouseDown);
53 | this.button_Pos.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Button_Pos_MouseMove);
54 | this.button_Pos.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Button_MouseUp);
55 | //
56 | // linkLabel_Zoom
57 | //
58 | this.linkLabel_Zoom.AutoSize = true;
59 | this.linkLabel_Zoom.Location = new System.Drawing.Point(44, 29);
60 | this.linkLabel_Zoom.Name = "linkLabel_Zoom";
61 | this.linkLabel_Zoom.Size = new System.Drawing.Size(29, 12);
62 | this.linkLabel_Zoom.TabIndex = 3;
63 | this.linkLabel_Zoom.TabStop = true;
64 | this.linkLabel_Zoom.Text = "x1.0";
65 | this.linkLabel_Zoom.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel_Zoom_LinkClicked);
66 | //
67 | // label1
68 | //
69 | this.label1.AutoSize = true;
70 | this.label1.Location = new System.Drawing.Point(3, 29);
71 | this.label1.Name = "label1";
72 | this.label1.Size = new System.Drawing.Size(35, 12);
73 | this.label1.TabIndex = 4;
74 | this.label1.Text = "缩放:";
75 | //
76 | // linkLabel_ZoomQuality
77 | //
78 | this.linkLabel_ZoomQuality.AutoSize = true;
79 | this.linkLabel_ZoomQuality.Location = new System.Drawing.Point(79, 29);
80 | this.linkLabel_ZoomQuality.Name = "linkLabel_ZoomQuality";
81 | this.linkLabel_ZoomQuality.Size = new System.Drawing.Size(41, 12);
82 | this.linkLabel_ZoomQuality.TabIndex = 5;
83 | this.linkLabel_ZoomQuality.TabStop = true;
84 | this.linkLabel_ZoomQuality.Text = "高品质";
85 | this.linkLabel_ZoomQuality.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel_ZoomQuality_LinkClicked);
86 | //
87 | // linkLabel1
88 | //
89 | this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
90 | this.linkLabel1.AutoSize = true;
91 | this.linkLabel1.Location = new System.Drawing.Point(110, 8);
92 | this.linkLabel1.Name = "linkLabel1";
93 | this.linkLabel1.Size = new System.Drawing.Size(11, 12);
94 | this.linkLabel1.TabIndex = 7;
95 | this.linkLabel1.TabStop = true;
96 | this.linkLabel1.Text = "?";
97 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel1_LinkClicked);
98 | //
99 | // checkBox_HideTaskbarIcon
100 | //
101 | this.checkBox_HideTaskbarIcon.AutoSize = true;
102 | this.checkBox_HideTaskbarIcon.Location = new System.Drawing.Point(3, 66);
103 | this.checkBox_HideTaskbarIcon.Name = "checkBox_HideTaskbarIcon";
104 | this.checkBox_HideTaskbarIcon.Size = new System.Drawing.Size(96, 16);
105 | this.checkBox_HideTaskbarIcon.TabIndex = 8;
106 | this.checkBox_HideTaskbarIcon.Text = "不显示任务栏";
107 | this.checkBox_HideTaskbarIcon.UseVisualStyleBackColor = true;
108 | this.checkBox_HideTaskbarIcon.CheckedChanged += new System.EventHandler(this.CheckBox_ShowTaskbarIcon_CheckedChanged);
109 | //
110 | // checkBox_TopMost
111 | //
112 | this.checkBox_TopMost.AutoSize = true;
113 | this.checkBox_TopMost.Location = new System.Drawing.Point(3, 44);
114 | this.checkBox_TopMost.Name = "checkBox_TopMost";
115 | this.checkBox_TopMost.Size = new System.Drawing.Size(72, 16);
116 | this.checkBox_TopMost.TabIndex = 11;
117 | this.checkBox_TopMost.Text = "窗口置顶";
118 | this.checkBox_TopMost.UseVisualStyleBackColor = true;
119 | this.checkBox_TopMost.CheckedChanged += new System.EventHandler(this.checkBox_TopMost_CheckedChanged);
120 | //
121 | // TransparentEventsCheckBox
122 | //
123 | this.TransparentEventsCheckBox.AutoSize = true;
124 | this.TransparentEventsCheckBox.Location = new System.Drawing.Point(3, 88);
125 | this.TransparentEventsCheckBox.Name = "TransparentEventsCheckBox";
126 | this.TransparentEventsCheckBox.Size = new System.Drawing.Size(72, 16);
127 | this.TransparentEventsCheckBox.TabIndex = 12;
128 | this.TransparentEventsCheckBox.Text = "鼠标穿透";
129 | this.TransparentEventsCheckBox.UseVisualStyleBackColor = true;
130 | this.TransparentEventsCheckBox.CheckedChanged += new System.EventHandler(this.TransparentEventsCheckBox_CheckedChanged);
131 | //
132 | // TransparentImageLinkLabel
133 | //
134 | this.TransparentImageLinkLabel.AutoSize = true;
135 | this.TransparentImageLinkLabel.Location = new System.Drawing.Point(3, 107);
136 | this.TransparentImageLinkLabel.Name = "TransparentImageLinkLabel";
137 | this.TransparentImageLinkLabel.Size = new System.Drawing.Size(95, 12);
138 | this.TransparentImageLinkLabel.TabIndex = 14;
139 | this.TransparentImageLinkLabel.TabStop = true;
140 | this.TransparentImageLinkLabel.Text = "透明度:255/255";
141 | this.TransparentImageLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.TransparentImageLinkLabel_LinkClicked);
142 | //
143 | // LayeredWindowManager
144 | //
145 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
146 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
147 | this.Controls.Add(this.TransparentImageLinkLabel);
148 | this.Controls.Add(this.TransparentEventsCheckBox);
149 | this.Controls.Add(this.checkBox_TopMost);
150 | this.Controls.Add(this.checkBox_HideTaskbarIcon);
151 | this.Controls.Add(this.linkLabel1);
152 | this.Controls.Add(this.linkLabel_ZoomQuality);
153 | this.Controls.Add(this.label1);
154 | this.Controls.Add(this.linkLabel_Zoom);
155 | this.Controls.Add(this.button_Pos);
156 | this.Name = "LayeredWindowManager";
157 | this.Size = new System.Drawing.Size(124, 129);
158 | this.Load += new System.EventHandler(this.LayeredWindowManager_Load);
159 | this.ResumeLayout(false);
160 | this.PerformLayout();
161 |
162 | }
163 |
164 | #endregion
165 |
166 | private System.Windows.Forms.Button button_Pos;
167 | private System.Windows.Forms.LinkLabel linkLabel_Zoom;
168 | private System.Windows.Forms.Label label1;
169 | private System.Windows.Forms.LinkLabel linkLabel_ZoomQuality;
170 | private System.Windows.Forms.LinkLabel linkLabel1;
171 | private System.Windows.Forms.CheckBox checkBox_HideTaskbarIcon;
172 | private System.Windows.Forms.CheckBox checkBox_TopMost;
173 | private System.Windows.Forms.CheckBox TransparentEventsCheckBox;
174 | private System.Windows.Forms.LinkLabel TransparentImageLinkLabel;
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/LayeredWindowManager.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 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/PackageManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ArkDesktop.CoreKit
9 | {
10 | public static class PackageManager
11 | {
12 | public class PackageInfo
13 | {
14 | public byte version;
15 | }
16 | public class PackagedConfigInfo
17 | {
18 | public Guid configGuid;
19 | public string defaultConfigName;
20 | public int fileCount;
21 | public long firstFilePosition;
22 | }
23 |
24 | public static string ToNiceRelativePath(string path) => path[0] == '/' || path[0] == '\\' ? path.Substring(1) : path;
25 |
26 | public static void EnsureDirectoryExists(string path)
27 | {
28 | path = Path.GetDirectoryName(path);
29 | if (Directory.Exists(path) == false) Directory.CreateDirectory(path);
30 | }
31 |
32 | public static void ExtractFiles(string rootPath, Stream stream)
33 | {
34 | int fileCount = ReadInt32(stream);
35 | while (fileCount-- != 0)
36 | {
37 | string fileName = ReadString(stream);
38 | int fileLength = ReadInt32(stream);
39 | var path = Path.Combine(rootPath, ToNiceRelativePath(fileName));
40 | EnsureDirectoryExists(path);
41 | using (var fs = File.OpenWrite(path))
42 | {
43 | while (fileLength != 0)
44 | {
45 | var buf = new byte[8196];
46 | int readLength = fileLength > 8196 ? 8196 : fileLength;
47 | stream.Read(buf, 0, readLength);
48 | fs.Write(buf, 0, readLength);
49 | fileLength -= readLength;
50 | }
51 | }
52 | }
53 | }
54 |
55 | public static (PackageInfo, List) ReadPackageInfo(Stream stream)
56 | {
57 | byte[] magic = ReadBytes(stream, 4);
58 | if ("AKDP" != Encoding.ASCII.GetString(magic)) return (new PackageInfo { version = 255 }, null);
59 | if (stream.ReadByte() != 2) return (new PackageInfo { version = 254 }, null);
60 | int configCount = ReadInt32(stream);
61 | var retList = new List();
62 | while (configCount-- != 0)
63 | {
64 | var single = new PackagedConfigInfo();
65 | single.configGuid = new Guid(ReadBytes(stream, 16));
66 | single.defaultConfigName = ReadString(stream);
67 | single.firstFilePosition = stream.Position;
68 | single.fileCount = ReadInt32(stream);
69 | retList.Add(single);
70 | for (int i = 0; i != single.fileCount; ++i)
71 | {
72 | _ = ReadString(stream);
73 | int fileLength = ReadInt32(stream);
74 | stream.Position += fileLength;
75 | }
76 | }
77 | return (new PackageInfo { version = 2 }, retList);
78 | }
79 |
80 | public static void PackConfigs(List configsInfos, string path)
81 | {
82 | using (var fs = File.OpenWrite(path))
83 | {
84 | WriteBytes(fs, Encoding.ASCII.GetBytes("AKDP"));//固定
85 | fs.WriteByte(2);//guding
86 | WriteInt32(fs, configsInfos.Count);//数量
87 | foreach (var configInfo in configsInfos)
88 | {
89 | WriteBytes(fs, configInfo.ConfigGuid.ToByteArray());
90 | WriteString(fs, configInfo.ConfigName);
91 | var vs = EnumDirectory(configInfo.rootPath);
92 | WriteInt32(fs, vs.Count);
93 | foreach (var p in vs)
94 | {
95 | WriteString(fs, p.Substring(configInfo.rootPath.Length));
96 | WriteInt32(fs, GetFileSize(p));
97 | using (FileStream fs1 = File.OpenRead(p)) fs1.CopyTo(fs);
98 | }
99 | }
100 | }
101 | }
102 |
103 | private static int GetFileSize(string path)//获取文件长度
104 | {
105 | FileInfo fileInfo = new FileInfo(path);
106 | return Convert.ToInt32(fileInfo.Length);
107 | }
108 |
109 | private static List EnumDirectory(string dir)
110 | {
111 | var vs = new List();
112 | DirectoryInfo d = new DirectoryInfo(dir);
113 | FileSystemInfo[] fileSystemInfos = d.GetFileSystemInfos();
114 | foreach (var str in fileSystemInfos)
115 | {
116 | if (str is DirectoryInfo) vs.AddRange(EnumDirectory(str.FullName));
117 | else vs.Add(str.FullName);
118 | }
119 | return vs;
120 | }
121 | public static int ReadInt32(Stream stream)
122 | {
123 | var arry = ReadBytes(stream, 4);
124 | int ret = 0;
125 | for (int i = 0; i != 4; ++i)
126 | ret |= (arry[i]) << (8 * i);
127 | return ret;
128 | }
129 | static bool ConvertIntToByteArray(Int32 m, ref byte[] arry)
130 | {
131 | if (arry == null) return false;
132 | if (arry.Length < 4) return false;
133 |
134 | arry[0] = (byte)(m & 0xFF);
135 | arry[1] = (byte)((m & 0xFF00) >> 8);
136 | arry[2] = (byte)((m & 0xFF0000) >> 16);
137 | arry[3] = (byte)((m >> 24) & 0xFF);
138 |
139 | return true;
140 | }
141 | public static void WriteInt32(Stream stream, int s)
142 | {
143 | byte[] cov = new byte[4];
144 | ConvertIntToByteArray(s, ref cov);
145 | stream.Write(cov, 0, 4);
146 | }
147 | public static byte[] ReadBytes(Stream stream, int count)
148 | {
149 | byte[] ret = new byte[count];
150 | stream.Read(ret, 0, count);
151 | return ret;
152 | }
153 | public static void WriteBytes(Stream stream, byte[] s)
154 | {
155 | stream.Write(s, 0, s.Length);
156 | }
157 | public static string ReadString(Stream stream)
158 | {
159 | var vs = new List();
160 | while (true)
161 | {
162 | int read = stream.ReadByte();
163 | if (read > 0) vs.Add(unchecked((byte)read));
164 | else break;
165 | }
166 | return Encoding.UTF8.GetString(Convert.FromBase64String(Encoding.ASCII.GetString(vs.ToArray())));
167 | }
168 | public static void WriteString(Stream stream, string s)
169 | {
170 | WriteBytes(stream, Encoding.ASCII.GetBytes(Convert.ToBase64String(Encoding.UTF8.GetBytes(s))));
171 | stream.WriteByte(0);
172 | }
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/PluginGuiContainer.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ArkDesktop.CoreKit
2 | {
3 | partial class PluginGuiContainer
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PluginGuiContainer));
33 | this.tabControl = new System.Windows.Forms.TabControl();
34 | this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
35 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
36 | this.button1 = new System.Windows.Forms.Button();
37 | this.tableLayoutPanel1.SuspendLayout();
38 | this.SuspendLayout();
39 | //
40 | // tabControl
41 | //
42 | this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
43 | | System.Windows.Forms.AnchorStyles.Left)
44 | | System.Windows.Forms.AnchorStyles.Right)));
45 | this.tabControl.Location = new System.Drawing.Point(3, 3);
46 | this.tabControl.Name = "tabControl";
47 | this.tabControl.SelectedIndex = 0;
48 | this.tabControl.Size = new System.Drawing.Size(340, 158);
49 | this.tabControl.TabIndex = 0;
50 | //
51 | // notifyIcon
52 | //
53 | this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")));
54 | this.notifyIcon.Text = "ArkDesktop";
55 | this.notifyIcon.DoubleClick += new System.EventHandler(this.NotifyIcon_DoubleClick);
56 | //
57 | // tableLayoutPanel1
58 | //
59 | this.tableLayoutPanel1.ColumnCount = 1;
60 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
61 | this.tableLayoutPanel1.Controls.Add(this.tabControl, 0, 0);
62 | this.tableLayoutPanel1.Controls.Add(this.button1, 0, 1);
63 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
64 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
65 | this.tableLayoutPanel1.Name = "tableLayoutPanel1";
66 | this.tableLayoutPanel1.RowCount = 2;
67 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
68 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 29F));
69 | this.tableLayoutPanel1.Size = new System.Drawing.Size(346, 193);
70 | this.tableLayoutPanel1.TabIndex = 1;
71 | //
72 | // button1
73 | //
74 | this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
75 | this.button1.Location = new System.Drawing.Point(3, 167);
76 | this.button1.Name = "button1";
77 | this.button1.Size = new System.Drawing.Size(340, 23);
78 | this.button1.TabIndex = 1;
79 | this.button1.Text = "关闭程序";
80 | this.button1.UseVisualStyleBackColor = true;
81 | this.button1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Button1_MouseClick);
82 | //
83 | // PluginGuiContainer
84 | //
85 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
86 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
87 | this.ClientSize = new System.Drawing.Size(346, 193);
88 | this.Controls.Add(this.tableLayoutPanel1);
89 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
90 | this.Name = "PluginGuiContainer";
91 | this.Text = "PluginGuiContainer";
92 | this.TopMost = true;
93 | this.Load += new System.EventHandler(this.PluginGuiContainer_Load);
94 | this.Resize += new System.EventHandler(this.PluginGuiContainer_Resize);
95 | this.tableLayoutPanel1.ResumeLayout(false);
96 | this.ResumeLayout(false);
97 |
98 | }
99 |
100 | #endregion
101 | private System.Windows.Forms.NotifyIcon notifyIcon;
102 | public System.Windows.Forms.TabControl tabControl;
103 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
104 | private System.Windows.Forms.Button button1;
105 | }
106 | }
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/PluginGuiContainer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 | using ArkDesktop.CoreKit;
12 |
13 | namespace ArkDesktop.CoreKit
14 | {
15 | public partial class PluginGuiContainer : Form
16 | {
17 | private ConfigManager configManager;
18 | protected override CreateParams CreateParams
19 | {
20 | get
21 | {
22 | CreateParams createParams = base.CreateParams;
23 | createParams.ClassStyle |= 0x200;
24 | return createParams;
25 | }
26 | }
27 | public event MethodInvoker RequestClose;
28 | public ManualResetEvent Ready { get; private set; } = new ManualResetEvent(false);
29 | public PluginGuiContainer(ConfigManager configManager)
30 | {
31 | InitializeComponent();
32 | this.configManager = configManager;
33 | }
34 | public void BroadcastNotice(string notice)
35 | {
36 | notifyIcon.ShowBalloonTip(3000, "ArkDesktop", notice, ToolTipIcon.Info);
37 | }
38 |
39 | private void PluginGuiContainer_Load(object sender, EventArgs e)
40 | {
41 | Ready.Set();
42 | WindowState = FormWindowState.Minimized;
43 | }
44 |
45 | private void PluginGuiContainer_Resize(object sender, EventArgs e)
46 | {
47 | if (WindowState == FormWindowState.Minimized)
48 | {
49 | ShowInTaskbar = false;
50 | notifyIcon.Visible = true;
51 | notifyIcon.ShowBalloonTip(3000, "ArkDesktop", "最小化到托盘", ToolTipIcon.Info);
52 | }
53 | else
54 | {
55 | ShowInTaskbar = true;
56 | notifyIcon.Visible = false;
57 | }
58 | }
59 |
60 | private void NotifyIcon_DoubleClick(object sender, EventArgs e)
61 | {
62 | WindowState = FormWindowState.Normal;
63 | }
64 |
65 | private void Button1_MouseClick(object sender, MouseEventArgs e)
66 | {
67 | if (e.Button == MouseButtons.Left)
68 | {
69 | configManager.SaveAllConfigs();
70 | }
71 | RequestClose?.Invoke();
72 | Dispose();
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ArkDesktopCoreKit")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ArkDesktopCoreKit")]
13 | [assembly: AssemblyCopyright("Copyleft 2020 By huix-oldcat MPL v2 License")]
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("ed7282fd-04a9-400d-abc4-540724fa8a44")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("3.0.2.7")]
36 | [assembly: AssemblyFileVersion("3.0.2.7")]
37 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/UpdateChecker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Net;
7 | using System.IO;
8 |
9 | namespace ArkDesktop.CoreKit
10 | {
11 | public static class UpdateChecker
12 | {
13 | public static (string, string) GetUpdateInfo(List modules = null, int helperVersion = 0)
14 | {
15 | var additionalParams = new StringBuilder();
16 | void AddParam(string guid, int version)
17 | {
18 | additionalParams.Append("&modules[]=");
19 | additionalParams.Append(guid);
20 | additionalParams.Append('|');
21 | additionalParams.Append(version);
22 | }
23 | if (modules != null)
24 | foreach (PluginModuleInfo i in modules)
25 | AddParam(i.moduleGuid.ToString(), i.version);
26 | AddParam("00000000-0000-0000-0000-000000000000", helperVersion);
27 |
28 | WebClient client = new WebClient();
29 | try
30 | {
31 | var st = client.OpenRead("https://akd.huix.cc/api/GetUpdate.php?current=" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + additionalParams.ToString());
32 | string s;
33 | using (StreamReader sr = new StreamReader(st)) s = sr.ReadToEnd();
34 | if (s == "Latest") return ("Latest", null);
35 | var a = s.Split('|');
36 | if (a.Length < 2) return ("", null);
37 | if (a.Length > 2)
38 | {
39 | string a1 = "";
40 | for (int i = 1; i != a.Length; ++i) a1 += a[i] + '|';
41 | a1 = a1.Substring(0, a1.Length - 1);
42 | }
43 | return (a[0], a[1]);
44 | }
45 | catch (Exception)
46 | {
47 | return ("", null);
48 | }
49 | }
50 | public static string CoreVersion { get => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ArkDesktopCoreKit/Win32Api.cs:
--------------------------------------------------------------------------------
1 | /* This Source Code Form is subject to the terms of the Mozilla Public
2 | * License, v. 2.0. If a copy of the MPL was not distributed with this
3 | * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 | using System;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 |
8 | namespace ArkDesktop.CoreKit
9 | {
10 | public class Win32
11 | {
12 | public enum Bool
13 | {
14 | False = 0,
15 | True
16 | };
17 |
18 | [StructLayout(LayoutKind.Sequential)]
19 | public struct Point
20 | {
21 | public int x;
22 | public int y;
23 |
24 | public Point(int x, int y)
25 | { this.x = x; this.y = y; }
26 | }
27 |
28 | [StructLayout(LayoutKind.Sequential)]
29 | public struct Size
30 | {
31 | public int cx;
32 | public int cy;
33 |
34 | public Size(int cx, int cy)
35 | { this.cx = cx; this.cy = cy; }
36 | }
37 |
38 | [StructLayout(LayoutKind.Sequential, Pack = 1)]
39 | struct ARGB
40 | {
41 | public byte Blue;
42 | public byte Green;
43 | public byte Red;
44 | public byte Alpha;
45 | }
46 |
47 | [StructLayout(LayoutKind.Sequential, Pack = 1)]
48 | public struct BLENDFUNCTION
49 | {
50 | public byte BlendOp;
51 | public byte BlendFlags;
52 | public byte SourceConstantAlpha;
53 | public byte AlphaFormat;
54 | }
55 |
56 | public const int ULW_COLORKEY = 0x00000001;
57 | public const int ULW_ALPHA = 0x00000002;
58 | public const int ULW_OPAQUE = 0x00000004;
59 |
60 | public const byte AC_SRC_OVER = 0x00;
61 | public const byte AC_SRC_ALPHA = 0x01;
62 |
63 | [DllImport("user32.dll ", ExactSpelling = true, SetLastError = true)]
64 | public static extern Bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize, IntPtr hdcSrc, ref Point pprSrc, int crKey, ref BLENDFUNCTION pblend, int dwFlags);
65 |
66 | [DllImport("user32.dll ", ExactSpelling = true, SetLastError = true, EntryPoint = "GetDC")]
67 | public static extern IntPtr GetDC(IntPtr hWnd);
68 |
69 | [DllImport("user32.dll ", ExactSpelling = true)]
70 | public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
71 |
72 | [DllImport("gdi32.dll ", ExactSpelling = true, SetLastError = true)]
73 | public static extern IntPtr CreateCompatibleDC(IntPtr hDC);
74 |
75 | [DllImport("gdi32.dll ", ExactSpelling = true, SetLastError = true)]
76 | public static extern Bool DeleteDC(IntPtr hdc);
77 |
78 | [DllImport("gdi32.dll ", ExactSpelling = true)]
79 | public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
80 |
81 | [DllImport("gdi32.dll ", ExactSpelling = true, SetLastError = true)]
82 | public static extern Bool DeleteObject(IntPtr hObject);
83 |
84 | [DllImport("gdi32.dll")]
85 | public static extern bool BitBlt(
86 | IntPtr hdcDest,//目标设备的句柄
87 | int nXDest,//目标对象的左上角x坐标
88 | int nYDest,//目标对象的左上角Y坐标
89 | int nWidth,//目标对象的矩形宽度
90 | int nHeight,//目标对象的矩形长度
91 | IntPtr hdcSrc,//源设备的句柄
92 | int nXSrc,//源对象的左上角x坐标
93 | int nYSrc,//源对象的左上角y坐标
94 | int dwRop//光栅的操作值
95 | );
96 |
97 | public enum TernaryRasterOperations : uint
98 | {
99 | SRCCOPY = 0x00CC0020,
100 | SRCPAINT = 0x00EE0086,
101 | SRCAND = 0x008800C6,
102 | SRCINVERT = 0x00660046,
103 | SRCERASE = 0x00440328,
104 | NOTSRCCOPY = 0x00330008,
105 | NOTSRCERASE = 0x001100A6,
106 | MERGECOPY = 0x00C000CA,
107 | MERGEPAINT = 0x00BB0226,
108 | PATCOPY = 0x00F00021,
109 | PATPAINT = 0x00FB0A09,
110 | PATINVERT = 0x005A0049,
111 | DSTINVERT = 0x00550009,
112 | BLACKNESS = 0x00000042,
113 | WHITENESS = 0x00FF0062,
114 | CAPTUREBLT = 0x40000000 //only if WinVer >= 5.0.0 (see wingdi.h)
115 | }//https://docs.microsoft.com/zh-cn/windows/win32/api/wingdi/nf-wingdi-bitblt
116 | [DllImport("user32.dll ", EntryPoint = " SendMessage ")]
117 | public static extern int SendMessage(int hWnd, int wMsg, int wParam, int lParam);
118 |
119 | [DllImport("user32.dll ", EntryPoint = " ReleaseCapture ")]
120 | public static extern int ReleaseCapture();
121 |
122 | public const int WM_SysCommand = 0x0112;
123 | public const int SC_MOVE = 0xF012;
124 |
125 | public const int SC_MAXIMIZE = 61488;
126 | public const int SC_MINIMIZE = 61472;
127 |
128 |
129 | [DllImport("User32.dll", EntryPoint = "FindWindow")]
130 | public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
131 |
132 |
133 | [DllImport("kernel32.dll")]
134 | public static extern int GetPrivateProfileInt(string lpAppName, string lpKeyName, int nDefault, string lpFileName);
135 |
136 | [DllImport("kernel32.dll")]
137 | public static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
138 |
139 | [DllImport("kernel32.dll")]
140 | public static extern int WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName);
141 |
142 |
143 | [DllImport("user32.dll", EntryPoint = "GetWindow")]
144 | public static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
145 |
146 | [DllImport("user32.dll")]
147 | public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
148 |
149 | public const int GWL_EXSTYLE = -20;
150 | public const int WS_EX_TRANSPARENT = 32;
151 |
152 | [DllImport("user32.dll")]
153 | public static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);
154 |
155 | [DllImport("user32.dll")]
156 | public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
157 |
158 | public delegate bool EnumWindowsProc(IntPtr hWnd, int lParam);
159 | [DllImport("user32.dll")]
160 | public static extern int EnumWindows(EnumWindowsProc ewp, int lParam);
161 |
162 | [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
163 | public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
164 |
165 | [DllImport("user32.dll")]
166 | public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
167 |
168 | /*
169 | * HWND_TOP = 0; {在前面}
170 | HWND_BOTTOM = 1; {在后面}
171 | HWND_TOPMOST = HWND(-1); {在前面, 位于任何顶部窗口的前面}
172 | HWND_NOTOPMOST = HWND(-2); {在前面, 位于其他顶部窗口的后面}
173 | //uFlags 参数可选值:
174 | SWP_NOSIZE = 1; {忽略 cx、cy, 保持大小}
175 | SWP_NOMOVE = 2; {忽略 X、Y, 不改变位置}
176 | SWP_NOZORDER = 4; {忽略 hWndInsertAfter, 保持 Z 顺序}
177 | SWP_NOREDRAW = 8; {不重绘}
178 | SWP_NOACTIVATE = $10; {不激活}
179 | SWP_FRAMECHANGED = $20; {强制发送 WM_NCCALCSIZE 消息, 一般只是在改变大小时才发送此消息}
180 | SWP_SHOWWINDOW = $40; {显示窗口}
181 | SWP_HIDEWINDOW = $80; {隐藏窗口}
182 | SWP_NOCOPYBITS = $100; {丢弃客户区}
183 | SWP_NOOWNERZORDER = $200; {忽略 hWndInsertAfter, 不改变 Z 序列的所有者}
184 | SWP_NOSENDCHANGING = $400; {不发出 WM_WINDOWPOSCHANGING 消息}
185 | SWP_DRAWFRAME = SWP_FRAMECHANGED; {画边框}
186 | SWP_NOREPOSITION = SWP_NOOWNERZORDER;{}
187 | SWP_DEFERERASE = $2000; {防止产生 WM_SYNCPAINT 消息}
188 | SWP_ASYNCWINDOWPOS = $4000; {若调用进程不拥有窗口, 系统会向拥有窗口的线程发出需求}
189 | */
190 | [DllImport("user32.dll")]
191 | public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndlnsertAfter, int X, int Y, int cx, int cy, uint Flags);
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/!!!!!!操作必看.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/ArkDesktopHelperWPF/!!!!!!操作必看.txt
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/!!!!!!界面介绍.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/ArkDesktopHelperWPF/!!!!!!界面介绍.png
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/About.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 | 本图标不包含于本开源项目中,亦不适用MPLv2许可证
16 | 图标来源:https://www.pixiv.net/artworks/75931413
17 | 画师:溪涧殇 https://www.pixiv.net/users/8703481
18 | 画师微博:@溪涧殇
19 |
20 |
21 |
22 |
29 |
36 |
37 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/About.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ArkDesktopHelperWPF
17 | {
18 | ///
19 | /// About.xaml 的交互逻辑
20 | ///
21 | public partial class AboutInfo : UserControl
22 | {
23 | public AboutInfo()
24 | {
25 | InitializeComponent();
26 | HelperVersionTextBlock.Text = "Helper version:" + GetType().Assembly.GetName().Version.ToString();
27 | CoreVersionTextBlock.Text = "Core Version:" + ArkDesktop.CoreKit.UpdateChecker.CoreVersion;
28 | }
29 |
30 | private void GoWildButton_Click(object sender, RoutedEventArgs e)
31 | {
32 | if (sender.Equals(GitHubButton)) System.Diagnostics.Process.Start("https://www.github.com/huix-oldcat/ArkDesktop");
33 | else if(sender.Equals(WebsiteButton)) System.Diagnostics.Process.Start("https://akd.huix.cc/");
34 | else if(sender.Equals(QQGroupButton)) System.Diagnostics.Process.Start("https://jq.qq.com/?_wv=1027&k=5j3ooR8");
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace ArkDesktopHelperWPF
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | public const int version = 2;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/ArkDesktopHelperWPF.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B98F0DA4-B7D5-48DD-A5DD-9474A2FC79EB}
8 | WinExe
9 | ArkDesktopHelperWPF
10 | ArkDesktopHelperWPF
11 | v4.7.2
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | true
17 |
18 |
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | ..\Build\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | none
33 | true
34 | ..\Build\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 | GlobalIcon.ico
41 |
42 |
43 |
44 | ..\packages\MaterialDesignColors.1.2.1\lib\net45\MaterialDesignColors.dll
45 |
46 |
47 | ..\packages\MaterialDesignThemes.3.0.0\lib\net45\MaterialDesignThemes.Wpf.dll
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | 4.0
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | MSBuild:Compile
68 | Designer
69 |
70 |
71 | About.xaml
72 |
73 |
74 | ConfigCard.xaml
75 |
76 |
77 | ConfigSelect.xaml
78 |
79 |
80 | Designer
81 | MSBuild:Compile
82 |
83 |
84 | Designer
85 | MSBuild:Compile
86 |
87 |
88 | Designer
89 | MSBuild:Compile
90 |
91 |
92 | Designer
93 | MSBuild:Compile
94 |
95 |
96 | MSBuild:Compile
97 | Designer
98 |
99 |
100 | App.xaml
101 | Code
102 |
103 |
104 | Dialog.xaml
105 |
106 |
107 | GlobalSetting.xaml
108 |
109 |
110 | MainWindow.xaml
111 | Code
112 |
113 |
114 | Designer
115 | MSBuild:Compile
116 |
117 |
118 |
119 |
120 | Code
121 |
122 |
123 | True
124 | True
125 | Resources.resx
126 |
127 |
128 | True
129 | Settings.settings
130 | True
131 |
132 |
133 | ResXFileCodeGenerator
134 | Resources.Designer.cs
135 |
136 |
137 |
138 | SettingsSingleFileGenerator
139 | Settings.Designer.cs
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | {ed7282fd-04a9-400d-abc4-540724fa8a44}
151 | ArkDesktopCoreKit
152 | False
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | PreserveNewest
164 |
165 |
166 |
167 |
168 | PreserveNewest
169 |
170 |
171 |
172 |
173 |
174 |
175 | 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/ConfigCard.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | 标题标题标题标题
24 |
25 |
26 | 描述描述描述没什么事没什么没什么事没什么是没什么事
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/ConfigCard.xaml.cs:
--------------------------------------------------------------------------------
1 | using ArkDesktop.CoreKit;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Data;
11 | using System.Windows.Documents;
12 | using System.Windows.Input;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Navigation;
16 | using System.Windows.Shapes;
17 |
18 | namespace ArkDesktopHelperWPF
19 | {
20 | ///
21 | /// ConfigCard.xaml 的交互逻辑
22 | ///
23 | public partial class ConfigCard : UserControl
24 | {
25 | public readonly ConfigInfo info;
26 | public bool isChecked = false;
27 |
28 | public ConfigCard(ConfigInfo info)
29 | {
30 | InitializeComponent();
31 | this.info = info;
32 | name.Text = info.ConfigName;
33 | description.Text = info.Description == "" ? "暂无描述" : info.Description;
34 | if (info.LaunchModule == null) errorTag.ToolTip = "一个或多个插件未加载";
35 | else errorTag.Visibility = Visibility.Hidden;
36 | if (File.Exists(System.IO.Path.Combine(info.rootPath, "preview.png")))
37 | previewImage.Source = new BitmapImage(new Uri(System.IO.Path.Combine(info.rootPath, "preview.png"), UriKind.Absolute));
38 | }
39 |
40 | private void Image_MouseEnter(object sender, MouseEventArgs e)
41 | {
42 | runMask.Visibility = Visibility.Visible;
43 | }
44 |
45 | private void RunMask_MouseLeave(object sender, MouseEventArgs e)
46 | {
47 | if (isChecked == false) runMask.Visibility = Visibility.Hidden;
48 | }
49 |
50 | private void RunMask_MouseDown(object sender, MouseButtonEventArgs e)
51 | {
52 | rect.Fill = new SolidColorBrush(Color.FromArgb(175, 100, 100, 100));
53 | }
54 |
55 | private void RunMask_MouseUp(object sender, MouseButtonEventArgs e)
56 | {
57 | rect.Fill = new SolidColorBrush(Color.FromArgb(175, 255, 255, 255));
58 | isChecked = !isChecked;
59 | checkedIcon.Kind = isChecked ? MaterialDesignThemes.Wpf.PackIconKind.RadioboxMarked : MaterialDesignThemes.Wpf.PackIconKind.RadioboxBlank;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/ConfigSelect.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 |
26 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/ConfigSelect.xaml.cs:
--------------------------------------------------------------------------------
1 | using ArkDesktop.CoreKit;
2 | using MaterialDesignThemes.Wpf;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 |
9 | namespace ArkDesktopHelperWPF
10 | {
11 | ///
12 | /// UserControl1.xaml 的交互逻辑
13 | ///
14 | public partial class ConfigSelect : UserControl
15 | {
16 | private readonly ConfigManager manager;
17 | private readonly MainWindow.RequestStart requestStart;
18 | private readonly MainWindow.RequestBroadcast requestBrocast;
19 |
20 | public ConfigSelect(ConfigManager manager, MainWindow.RequestStart requestStart, MainWindow.RequestBroadcast requestBrocast)
21 | {
22 | InitializeComponent();
23 | this.manager = manager;
24 | this.requestStart = requestStart;
25 | this.requestBrocast = requestBrocast;
26 | LoadConfigs();
27 | }
28 | //MaterialDesign形式的 messagebox
29 | public async void MsgBox(String msg,object sender, RoutedEventArgs e)
30 | {
31 | Dialog dialog = new Dialog
32 | {
33 | Message = { Text = msg }
34 | };
35 | await DialogHost.Show(dialog, "RootDialog");
36 | }
37 | public async void MsgBox(String msg,String c, object sender, RoutedEventArgs e)
38 | {
39 | Dialog dialog = new Dialog
40 | {
41 | Message = { Text = msg }
42 | };
43 | dialog.settingConfigPath(c);
44 | await DialogHost.Show(dialog, "RootDialog");
45 | }
46 | private void Button_Click(object sender, RoutedEventArgs e)
47 | {
48 | Button button = sender as Button;
49 | switch (button.Name)
50 | {
51 | case "runButton":
52 | requestStart?.Invoke(GetSelectedConfigs());
53 | break;
54 | case "ExportButton":
55 | string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString() + ".akdpkg");
56 | requestBrocast("开始导出...");
57 | var list = GetSelectedConfigs();
58 | PackageManager.PackConfigs(list, path);
59 | App.Current.Dispatcher.Invoke((Action)(() =>
60 | {
61 | MsgBox("已导出至\n" + path + "\n是否使用文件管理器打开?", path, sender, e);
62 | }));
63 | break;
64 |
65 | }
66 | }
67 |
68 | private List GetSelectedConfigs()
69 | {
70 | List configInfos = new List();
71 | foreach (ConfigCard i in configList.Children)
72 | if (i.isChecked)
73 | configInfos.Add(i.info);
74 | return configInfos;
75 | }
76 |
77 | public MainWindow.RequestConfigList RequestDelegate => GetSelectedConfigs;
78 |
79 | public void LoadConfigs()
80 | {
81 | configList.Children.Clear();
82 | manager.ScanConfigs();
83 | foreach (var i in manager.Configs) configList.Children.Add(new ConfigCard(i));
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/Dialog.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/Dialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 |
5 | namespace ArkDesktopHelperWPF
6 | {
7 | ///
8 | /// Dialog.xaml 的交互逻辑
9 | ///
10 | public partial class Dialog :UserControl
11 | {
12 | private static string configPath = "";
13 | public void settingConfigPath(string s)
14 | {
15 | configPath = s;
16 | }
17 | public Dialog()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private static void ExplorerFile(string path)
23 | {
24 | using (Process proc = new Process())
25 | {
26 | proc.StartInfo.FileName = "explorer";
27 | proc.StartInfo.Arguments = "/select," + path;
28 | proc.Start();
29 | };
30 | }
31 |
32 | //否
33 | private void Button_Click(object sender, RoutedEventArgs e)
34 | {
35 | //TODO ,always todo
36 | }
37 |
38 | //是
39 | private void Button_Click_1(object sender, RoutedEventArgs e)
40 | {
41 | if (configPath != "")
42 | {
43 | ExplorerFile(configPath);
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/GlobalIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/ArkDesktopHelperWPF/GlobalIcon.ico
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/GlobalIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/ArkDesktopHelperWPF/GlobalIcon.png
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/GlobalSetting.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | 开机自启动(重新勾选以将主界面选中的配置更新为默认配置)
13 |
14 |
23 | 很讨厌ky的人呢......为什么看气氛就那么难呢
24 |
25 |
26 |
27 |
28 |
35 |
42 |
46 |
47 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/GlobalSetting.xaml.cs:
--------------------------------------------------------------------------------
1 | using ArkDesktop.CoreKit;
2 | using Microsoft.Win32;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Controls;
11 | using System.Windows.Data;
12 | using System.Windows.Documents;
13 | using System.Windows.Input;
14 | using System.Windows.Media;
15 | using System.Windows.Media.Imaging;
16 | using System.Windows.Navigation;
17 | using System.Windows.Shapes;
18 |
19 | namespace ArkDesktopHelperWPF
20 | {
21 | ///
22 | /// GlobalSetting.xaml 的交互逻辑
23 | ///
24 | public partial class GlobalSetting : UserControl
25 | {
26 | private readonly MainWindow.RequestConfigList requestConfigList;
27 | private readonly ConfigManager manager;
28 | private bool userClick = true;
29 |
30 | public GlobalSetting(MainWindow.RequestConfigList requestConfigList, ArkDesktop.CoreKit.ConfigManager manager)
31 | {
32 | userClick = false;
33 | InitializeComponent();
34 | this.requestConfigList = requestConfigList;
35 | this.manager = manager;
36 | if (File.Exists("AutoRun.txt"))
37 | {
38 | AutoRunListTextBox.Text = "";
39 | using (var fs = File.OpenRead("AutoRun.txt"))
40 | using (var sr = new StreamReader(fs))
41 | while (sr.EndOfStream == false)
42 | try
43 | {
44 | string s = sr.ReadLine();
45 | var g = Guid.Parse(s);
46 | AutoRunListTextBox.Text += g.ToString().Substring(24) + ' ';
47 | var f = from i in manager.Configs where i.ConfigGuid == g select i.ConfigName;
48 | if (f.Any()) AutoRunListTextBox.Text += f.First();
49 | else AutoRunListTextBox.Text += "(未找到)";
50 | AutoRunListTextBox.Text += '\n';
51 | }
52 | catch (Exception) { }
53 | }
54 | var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", false);
55 | AutoRunCheckbox.IsChecked = (key.GetValue("ArkDesktop") as string) == GetType().Assembly.Location + " -autorun";
56 | AutoUpdateCheckBox.IsChecked = File.Exists("AutoUpdate.flag");
57 | userClick = true;
58 | }
59 |
60 | private void AutoRunCheckbox_Checked(object sender, RoutedEventArgs e)
61 | {
62 | if (userClick == false) return;
63 | RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
64 | if (AutoRunCheckbox.IsChecked == true)
65 | {
66 | var list = requestConfigList?.Invoke();
67 | if (list == null || list.Any() == false)
68 | {
69 | AutoRunListTextBox.Text = "没有在主界面选择启动配置呢QAQ";
70 | AutoRunCheckbox.IsChecked = false;
71 | return;
72 | }
73 | using (FileStream fs = File.Open("AutoRun.txt", FileMode.Create))
74 | using (StreamWriter sw = new StreamWriter(fs))
75 | foreach (var i in list)
76 | sw.WriteLine(i.ConfigGuid);
77 | StringBuilder sb = new StringBuilder();
78 | using (StringWriter sw = new StringWriter(sb))
79 | foreach (var i in list)
80 | sw.WriteLine("..." + i.ConfigGuid.ToString("N").Substring(20) + " " + i.ConfigName);
81 | AutoRunListTextBox.Text = sb.ToString();
82 | key.SetValue("ArkDesktop", GetType().Assembly.Location + " -autorun");
83 | }
84 | else key.DeleteValue("ArkDesktop", false);
85 | }
86 |
87 | private void AutoUpdateCheckBox_Checked(object sender, RoutedEventArgs e)
88 | {
89 | if (AutoUpdateCheckBox.IsChecked == true) File.Create("AutoUpdate.flag");
90 | else if (File.Exists("AutoUpdate.flag")) File.Delete("AutoUpdate.flag");
91 | }
92 |
93 | private string _updateUrl;
94 |
95 | private void QueryUpdate_Click(object sender, RoutedEventArgs e)
96 | {
97 | Task.Factory.StartNew(() =>
98 | {
99 | (var a, var b) = ArkDesktop.CoreKit.UpdateChecker.GetUpdateInfo(manager.Modules, App.version);
100 | Dispatcher.Invoke(() =>
101 | {
102 | if (a == "Latest") UpdateTextBlock.Text = "已经是最新版本了哦QwQ";
103 | else if (a == "") UpdateTextBlock.Text = "更新查询失败QAQ";
104 | else
105 | {
106 | UpdateButton.IsEnabled = true;
107 | UpdateTextBlock.Text = b;
108 | _updateUrl = a;
109 | }
110 | });
111 | });
112 | }
113 |
114 | private void UpdateButton_Click(object sender, RoutedEventArgs e)
115 | {
116 | System.Diagnostics.Process.Start(_updateUrl);
117 | }
118 |
119 | private void GuidGenerateButton_Click(object sender, RoutedEventArgs e)
120 | {
121 | Guid guid = Guid.NewGuid();
122 | GuidTextBox.Text = guid.ToString();
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
37 |
43 |
49 |
52 |
54 |
57 | ArkDesktop
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Runtime.InteropServices;
7 | using System.Text;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using System.Windows.Data;
13 | using System.Windows.Documents;
14 | using System.Windows.Input;
15 | using System.Windows.Media;
16 | using System.Windows.Media.Imaging;
17 | using System.Windows.Navigation;
18 | using System.Windows.Shapes;
19 | using ArkDesktop.CoreKit;
20 |
21 | namespace ArkDesktopHelperWPF
22 | {
23 | ///
24 | /// MainWindow.xaml 的交互逻辑
25 | ///
26 | public partial class MainWindow : Window
27 | {
28 |
29 | public class DrawerItemData
30 | {
31 | public string Name { get; set; }
32 | public Control Control { get; set; }
33 | }
34 | public DrawerItemData[] DrawerItems { get; set; }
35 | ConfigManager manager;
36 | List validStartupConfig = new List();
37 |
38 | private bool ValidAutorun()
39 | {
40 | var args = Environment.GetCommandLineArgs();
41 | string realPath = AppDomain.CurrentDomain.BaseDirectory;
42 | string autorunFile = System.IO.Path.Combine(realPath, "AutoRun.txt");
43 | if (args.Length != 2 || args[1] != "-autorun" || File.Exists(autorunFile) == false) return false;
44 | using (StringReader sr = new StringReader(File.ReadAllText(autorunFile)))
45 | {
46 | while (true)
47 | {
48 | string s = sr.ReadLine();
49 | if (s == "") break;
50 | try
51 | {
52 | Guid g = Guid.Parse(s);
53 | foreach (var i in manager.Configs)
54 | if (i.ConfigGuid == g && i.LaunchModule != null)
55 | validStartupConfig.Add(i);
56 | }
57 | catch (Exception)
58 | {
59 | break;
60 | }
61 | }
62 | //?
63 | sr.Close();
64 | }
65 |
66 | return validStartupConfig.Any();
67 | }
68 |
69 | public MainWindow()
70 | {
71 | bool firstUse = Directory.Exists(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "configs")) == false;
72 | bool autoUpdate = File.Exists(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AutoUpdate.flag"));
73 | manager = new ConfigManager(AppDomain.CurrentDomain.BaseDirectory);
74 | manager.ScanPlugins();
75 | manager.ScanConfigs();
76 | if (ValidAutorun() == false)
77 | {
78 | InitDrawer();
79 | InitializeComponent();
80 | drawerItemsListBox.ItemsSource = DrawerItems;
81 | drawerItemsListBox.SelectedIndex = 0;
82 | if (firstUse) MainSnackbar.MessageQueue.Enqueue("第一次使用本软件?请阅读软件目录下的操作说明和界面介绍");
83 | if (autoUpdate)
84 | {
85 | MainSnackbar.MessageQueue.Enqueue("正在检查更新...");
86 | Task.Factory.StartNew(() =>
87 | {
88 | (string a, _) = UpdateChecker.GetUpdateInfo(manager.Modules, App.version);
89 | if (a != "" && a != "Latest")
90 | {
91 | Dispatcher.Invoke(() => MainSnackbar.MessageQueue.Enqueue("发现新版本!请前往全局设置下载"));
92 | }
93 | else if (a == "Latest")
94 | {
95 | Dispatcher.Invoke(() => MainSnackbar.MessageQueue.Enqueue("已是最新版本"));
96 | }
97 | else Dispatcher.Invoke(() => MainSnackbar.MessageQueue.Enqueue("查询过程发生错误"));
98 | });
99 | }
100 | }
101 | else
102 | {
103 | Task task = autoUpdate ? new Task(() =>
104 | {
105 | (string a, _) = UpdateChecker.GetUpdateInfo(manager.Modules, App.version);
106 | return a;
107 | }) : null;
108 | StartMultiConfig(validStartupConfig, false, task);
109 | }
110 | }
111 |
112 | private void InitDrawer()
113 | {
114 | DrawerItems = new DrawerItemData[3];
115 | DrawerItems[0] = new DrawerItemData { Name = "主界面", Control = new ConfigSelect(manager, (i) => StartMultiConfig(i), BroadcaseMessage) };
116 | DrawerItems[1] = new DrawerItemData { Name = "全局设置", Control = new GlobalSetting((DrawerItems[0].Control as ConfigSelect).RequestDelegate, manager) };
117 | DrawerItems[2] = new DrawerItemData { Name = "关于", Control = new AboutInfo() };
118 | }
119 |
120 | private void CloseWindowButton_Click(object sender, RoutedEventArgs e)
121 | {
122 | Close();
123 | Application.Current.Shutdown();
124 | Environment.Exit(0);
125 | }
126 |
127 | private void MinWindowButton_Click(object sender, RoutedEventArgs e)
128 | {
129 | WindowState = WindowState.Minimized;
130 | }
131 |
132 | private void ColorZone_MouseDown(object sender, MouseButtonEventArgs e)
133 | {
134 | DragMove();
135 | }
136 |
137 | public delegate void RequestStart(List configInfos);
138 | public delegate void RequestBroadcast(string message);
139 |
140 | private void BroadcaseMessage(string message)
141 | {
142 | MainSnackbar.MessageQueue.Enqueue(message);
143 | }
144 |
145 | private void StartMultiConfig(List configInfos, bool needClose = true, Task task = null)
146 | {
147 | List events = new List();
148 | if (needClose) Close();
149 | PluginGuiContainer pluginGuiContainer = new PluginGuiContainer(manager);
150 | InstanceManager instanceManager = new InstanceManager(pluginGuiContainer);
151 |
152 | foreach (var configInfo in configInfos)
153 | {
154 | if (configInfo.LaunchModule == null) return;
155 | ManualResetEvent e = new ManualResetEvent(false);
156 | events.Add(e);
157 | Thread thread = new Thread(new ThreadStart(() =>
158 | {
159 | instanceManager.LaunchModule(configInfo);
160 | e.Set();
161 | }));
162 | thread.IsBackground = true;
163 | thread.Start();
164 | }
165 | if (task != null)
166 | {
167 | task.Start();
168 | task.Wait();
169 | string s = task.Result;
170 | if (s != null && s != "" && s != "Latest") pluginGuiContainer.BroadcastNotice("发现新版本!请前往全局设置下载");
171 | }
172 | if (events.Count > 0) foreach (var i in events) i.WaitOne();
173 | Application.Current.Shutdown();
174 | }
175 |
176 | private void drawerItemsListBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
177 | {
178 | //until we had a StaysOpen glag to Drawer, this will help with scroll bars
179 | var dependencyObject = Mouse.Captured as DependencyObject;
180 | while (dependencyObject != null)
181 | {
182 | if (dependencyObject is System.Windows.Controls.Primitives.ScrollBar) return;
183 | dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
184 | }
185 | MenuToggleButton.IsChecked = false;
186 | }
187 |
188 | public delegate List RequestConfigList();
189 |
190 | private void Main_DragEnter(object sender, DragEventArgs e)
191 | {
192 | if (e.Data.GetDataPresent(DataFormats.FileDrop) == false) return;
193 | e.Effects = DragDropEffects.Copy;
194 | DragNotice.Visibility = Visibility.Visible;
195 | }
196 |
197 | private void Main_DragLeave(object sender, DragEventArgs e)
198 | {
199 | DragNotice.Visibility = Visibility.Hidden;
200 | }
201 |
202 | private void ImportPackage(string path)
203 | {
204 | void addText(string t) => Dispatcher.Invoke(() => DropDetails.Text += t);
205 | addText(path + "\n");
206 | using (var fs = File.OpenRead(path))
207 | {
208 | (var a, var b) = PackageManager.ReadPackageInfo(fs);
209 | if (a.version == 255)
210 | {
211 | addText(" 无效的包\n");
212 | return;
213 | }
214 | if (a.version == 254)
215 | {
216 | addText(" 版本不支持\n");
217 | return;
218 | }
219 | foreach (var i in b)
220 | {
221 | var found = from v in manager.Configs where v.ConfigGuid == i.configGuid select true;
222 | var st = "";
223 | var exportPath = "";
224 | addText(string.Format(" 读入配置{0}({1}) ", i.defaultConfigName, i.configGuid.ToString().Substring(24)));
225 | if (found.Any())
226 | {
227 | st = "重复的配置";
228 | }
229 | else if (Directory.Exists(System.IO.Path.Combine(manager.rootPath, "configs", i.defaultConfigName)))
230 | {
231 | string newName = i.defaultConfigName + "_" + Guid.NewGuid().ToString().Substring(28);
232 | exportPath = System.IO.Path.Combine(manager.rootPath, "configs", newName);
233 | st = "GUID未重复但配置名重复,已重命名配置为" + newName;
234 | }
235 | else
236 | {
237 | exportPath = System.IO.Path.Combine(manager.rootPath, "configs", i.defaultConfigName);
238 | st = "导入成功";
239 | }
240 | if (exportPath != "")
241 | {
242 | Directory.CreateDirectory(exportPath);
243 | fs.Position = i.firstFilePosition;
244 | PackageManager.ExtractFiles(exportPath, fs);
245 | }
246 | addText(string.Format("==> {0}\n", st));
247 | }
248 | }
249 | }
250 |
251 | private void Main_Drop(object sender, DragEventArgs e)
252 | {
253 | var datas = e.Data.GetData(DataFormats.FileDrop) as string[];
254 | DropDetails.Text = "";
255 | Task.Factory.StartNew(() =>
256 | {
257 | foreach (var data in datas)
258 | if (data.EndsWith(".akdpkg"))
259 | ImportPackage(data);
260 | Dispatcher.Invoke(() => (DrawerItems[0].Control as ConfigSelect).LoadConfigs());
261 | Dispatcher.Invoke(() => DropDetails.Text += "读入完成,5秒后关闭提示框");
262 | Task.Factory.StartNew(() =>
263 | {
264 | Thread.Sleep(5000);
265 | DragNotice.Dispatcher.Invoke(() => DragNotice.Visibility = Visibility.Hidden);
266 | });
267 | });
268 | }
269 | }
270 | }
271 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/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("ArkDesktop引导启动器")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("huix-oldcat")]
14 | [assembly: AssemblyProduct("ArkDesktop")]
15 | [assembly: AssemblyCopyright("Copyleft 2020 by huix-oldcat MPL v2 License")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
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.2.7")]
55 | [assembly: AssemblyFileVersion("1.0.2.7")]
56 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ArkDesktopHelperWPF.Properties
12 | {
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 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ArkDesktopHelperWPF.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/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 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ArkDesktopHelperWPF.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ArkDesktopHelperWPF/testimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/ArkDesktopHelperWPF/testimg.png
--------------------------------------------------------------------------------
/ArkDesktopLua/ArkDesktopLua.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 | using System.Xml.Linq;
9 | using ArkDesktop;
10 | using ArkDesktop.CoreKit;
11 | using Neo.IronLua;
12 | using LayeredWindow = ArkDesktop.CoreKit.LayeredWindow;
13 | using LayeredWindowManager = ArkDesktop.CoreKit.LayeredWindowManager;
14 |
15 | namespace ArkDesktopLua
16 | {
17 | public class ArkDesktopLuaModule : IArkDesktopPluginModule
18 | {
19 | public readonly string[] featureList;
20 |
21 | public string Name => "ArkDesktop.LuaModule";
22 |
23 | public Guid Guid => new Guid("b1c03350-0f81-4fee-a7ab-bacfbb13c3d4");
24 |
25 | public bool Disposed { get; set; } = false;
26 |
27 | public string Description => "ArkDesktop提供的Lua能力实现";
28 |
29 | public int Version => 3;
30 |
31 | public bool CheckFeature(string featureName) => featureList.Contains(featureName);
32 |
33 | private XElement config;
34 |
35 | public ManualResetEvent needDispose = new ManualResetEvent(false);
36 | public ManualResetEvent disposed = new ManualResetEvent(false);
37 | public LayeredWindowManager manager;
38 | internal ResourceManager resourceManager;
39 |
40 | private enum LaunchType
41 | {
42 | Positive, Passive
43 | }
44 | LaunchType launchType;
45 |
46 | private enum LoadPosition
47 | {
48 | InConfig, OutFile
49 | }
50 | LoadPosition loadPosition;
51 |
52 | private string luaScript;
53 |
54 | public ArkDesktopLuaModule()
55 | {
56 | featureList = new string[]
57 | {
58 | "LAUNCH_PositiveLaunch",
59 | "LAUNCH_PassiveLaunch",
60 | "API_LoadBitmap",
61 | "API_DisplayBitmap",
62 | "API_Sleep",
63 | "API_RequestClickEvent",
64 | "API_CreateDraft",
65 | "API_CopyBitmapToDraft",
66 | "API_DrawDraft",
67 | "API_MoveWindow(Alpha)",
68 | "API_SetFlag",
69 | "API_PlaySound",
70 | "FLAG_autoClearBackground",
71 | "FLAG_reverse",
72 | "FLAG_strictMode"
73 | };
74 | }
75 |
76 | public void MainThread(ResourceManager resources, InstanceHelper instanceHelper)
77 | {
78 | resourceManager = resources;
79 | config = resources.GetConfig(Name);
80 | if (EnsureConfigCorrect() == false)
81 | {
82 | resourceManager.SaveConfig(Name);
83 | resourceManager.SaveConfig("ArkDesktop.LayeredWindowManager");
84 | return;
85 | };
86 | manager = new LayeredWindowManager(resources);
87 | instanceHelper.AddControl("", manager);
88 | if (loadPosition == LoadPosition.InConfig)
89 | {
90 |
91 | if (config.Element("Script") == null)
92 | {
93 | MessageBox.Show("似乎没有加载到脚本,请联系配置包制作者");
94 | return;
95 | }
96 | luaScript = config.Element("Script").Value;
97 | }
98 | else
99 | {
100 | using (var sr = new System.IO.StreamReader(resourceManager.OpenRead("script.lua"))) luaScript = sr.ReadToEnd();
101 | if (luaScript == "")
102 | {
103 | MessageBox.Show("似乎没有加载到脚本,请联系配置包制作者", "QAQ");
104 | return;
105 | }
106 | }
107 | using (Lua lua = new Lua())
108 | {
109 | dynamic env = lua.CreateEnvironment();
110 | LuaApi api = new LuaApi(this, lua, env);
111 | var chunk = lua.CompileChunk(luaScript, "script.lua", new LuaCompileOptions { DebugEngine = LuaStackTraceDebugger.Default });
112 | manager.window.Click += (sender, e) => api.OnClick();
113 | var luaThread = new Thread(new ThreadStart(() =>
114 | {
115 | string GenerateExceptionString(Exception e) => $"发生了异常:{e.Message}\n{e.StackTrace}\n" +
116 | "请加QQ群(在软件主界面右边菜单的'关于'页)反馈这个bug给我们(软件开发者/包制作者)\n" +
117 | "是否重试(按'否'退出软件)";
118 |
119 | if (launchType == LaunchType.Positive)
120 | {
121 | while (true)
122 | try
123 | {
124 | env.dochunk(chunk);
125 | }
126 | catch (ThreadAbortException)
127 | {
128 | break;
129 | }
130 | catch (Exception e)
131 | {
132 | if (MessageBox.Show(GenerateExceptionString(e), "QAQ", MessageBoxButtons.YesNo) == DialogResult.No)
133 | {
134 | needDispose.Set();
135 | return;
136 | }
137 | }
138 | }
139 | else
140 | {
141 | int st = 0;
142 | LuaChunk initChunk = null, updateChunk = null;
143 | while (true)
144 | {
145 | try
146 | {
147 | if (st == 0)
148 | {
149 | env.dochunk(chunk);
150 | initChunk = lua.CompileChunk("init()", "script.lua", new LuaCompileOptions());
151 | updateChunk = lua.CompileChunk("update()", "script.lua", new LuaCompileOptions());
152 | st = 1;
153 | }
154 | if (st == 1)
155 | {
156 | env.dochunk(initChunk);
157 | st = 2;
158 | }
159 | if (st == 2)
160 | {
161 | var begin = DateTime.Now;
162 | double duration = env.update();
163 | var used = DateTime.Now - begin;
164 | var need = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(duration * 1000));
165 | if (need > used) Thread.Sleep(need - used);
166 | }
167 | }
168 | catch (ThreadAbortException)
169 | {
170 | break;
171 | }
172 | catch (Exception e)
173 | {
174 | if (MessageBox.Show(GenerateExceptionString(e), "QAQ", MessageBoxButtons.YesNo) == DialogResult.No)
175 | {
176 | needDispose.Set();
177 | return;
178 | }
179 | }
180 | }
181 | }
182 | }));
183 | luaThread.IsBackground = true;
184 | luaThread.Start();
185 | needDispose.WaitOne();
186 | luaThread.Abort();
187 | disposed.Set();
188 | }
189 | }
190 |
191 | private bool EnsureConfigCorrect()
192 | {
193 | if (config.Element("LaunchType") == null) config.Add(new XElement("LaunchType", "Positive"));
194 | if (config.Element("LoadPosition") == null) config.Add(new XElement("LoadPosition", "InConfig"));
195 | launchType = config.Element("LaunchType").Value == "Positive" ? LaunchType.Positive : LaunchType.Passive;
196 | loadPosition = config.Element("LoadPosition").Value == "OutFile" ? LoadPosition.OutFile : LoadPosition.InConfig;
197 | return true;
198 | }
199 |
200 | public void RequestDispose()
201 | {
202 | needDispose.Set();
203 | disposed.WaitOne();
204 | }
205 | }
206 | }
207 |
--------------------------------------------------------------------------------
/ArkDesktopLua/ArkDesktopLua.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {AA4D8756-09C4-4C9A-A117-D3DB36085F0F}
8 | Library
9 | Properties
10 | ArkDesktopLua
11 | ArkDesktopLua
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 |
18 |
19 | true
20 | full
21 | false
22 | ..\Build\Debug\plugins\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | none
29 | true
30 | ..\Build\Release\plugins\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 | ..\packages\NeoLua.1.3.11\lib\net47\Neo.Lua.dll
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | {ed7282fd-04a9-400d-abc4-540724fa8a44}
58 | ArkDesktopCoreKit
59 | False
60 | False
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/ArkDesktopLua/LuaApi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.IO;
8 | using Neo.IronLua;
9 | using System.Reflection;
10 | using System.Threading;
11 | using System.Media;
12 |
13 | namespace ArkDesktopLua
14 | {
15 | public class LuaApi
16 | {
17 | public List bitmaps = new List();
18 | public ArkDesktopLuaModule master;
19 | private readonly Lua lua;
20 | public dynamic env;
21 | public string clickMethod = "";
22 | public Bitmap draft;
23 | public bool autoClearBackground = true;
24 | public bool reverse = false;
25 | public bool strictMode = false;
26 | public int reversePos = 0;
27 | public LuaChunk clickMethodChunk;
28 | Dictionary soundPlayers = new Dictionary();
29 |
30 | public int LoadBitmap(string relativePath, bool necessary = true)
31 | {
32 | Stream stream = master.resourceManager.OpenRead(relativePath);
33 | if (stream.Length == 0)
34 | {
35 | if (necessary)
36 | throw new Exception("Bitmap \"" + relativePath + "\" not found.");
37 | else return -1;
38 | }
39 | bitmaps.Add(new Bitmap(stream));
40 | return bitmaps.Count - 1;
41 | }
42 |
43 | public bool DisplayBitmap(int index)
44 | {
45 | if (index < 0 || index >= bitmaps.Count)
46 | if (strictMode)
47 | throw new ArgumentOutOfRangeException(nameof(index), "Index out of range.");
48 | else
49 | return false;
50 | master.manager.SetBits(bitmaps[index]);
51 | return true;
52 | }
53 |
54 | public void Sleep(int millisecondsTimeout)
55 | {
56 | Thread.Sleep(millisecondsTimeout);
57 | }
58 |
59 | public void RequestClickEvent(string methodName)
60 | {
61 | clickMethod = methodName;
62 | if (methodName == "") clickMethodChunk = null;
63 | else clickMethodChunk = lua.CompileChunk(methodName + "()", "script.lua", new LuaCompileOptions());
64 | }
65 |
66 | public void CreateDraft(int width, int height)
67 | {
68 | if (draft != null)
69 | {
70 | draft.Dispose();
71 | }
72 | draft = new Bitmap(width, height);
73 | }
74 |
75 | public bool CopyBitmapToDraft(int index, int dx = 0, int dy = 0)
76 | {
77 | if (index < 0 || index >= bitmaps.Count)
78 | if (strictMode)
79 | throw new ArgumentOutOfRangeException(nameof(index), "Index out of range.");
80 | else
81 | return false;
82 | using (Graphics g = Graphics.FromImage(draft))
83 | {
84 | if (autoClearBackground)
85 | {
86 | g.Clear(Color.Transparent);
87 | }
88 | if (reverse)
89 | {
90 | dx = draft.Width - dx - bitmaps[index].Width;
91 | using (Image i = new Bitmap(bitmaps[index]))
92 | {
93 | i.RotateFlip(RotateFlipType.RotateNoneFlipX);
94 | g.DrawImage(i, dx, dy);
95 | }
96 | }
97 | else
98 | {
99 | g.DrawImage(bitmaps[index], dx, dy);
100 | }
101 | }
102 | return true;
103 | }
104 |
105 | public void DrawDraft()
106 | {
107 | master.manager.SetBits(draft);
108 | }
109 |
110 | public void MoveWindow(int deltaX, int deltaY)
111 | {
112 | master.manager.MoveWindow((reverse ? -1 : 1) * deltaX, deltaY);
113 | }
114 |
115 | public void SetFlag(string flagName, bool flagValue)
116 | {
117 | switch (flagName)
118 | {
119 | case "autoClearBackground":
120 | {
121 | autoClearBackground = flagValue;
122 | return;
123 | }
124 | case "reverse":
125 | {
126 | reverse = flagValue;
127 | return;
128 | }
129 | case "strictMode":
130 | {
131 | strictMode = flagValue;
132 | return;
133 | }
134 | }
135 | }
136 |
137 | // add playing sound function
138 | public void PlaySound(string relativePath, bool necessary = false)
139 | {
140 | if (soundPlayers.ContainsKey(relativePath) == false)
141 | {
142 | var stream = master.resourceManager.OpenRead(relativePath);
143 | if (stream.Length == 0)
144 | {
145 | if (necessary) throw new FileNotFoundException($"{nameof(relativePath)}: doesn't exist.");
146 | else return;
147 | }
148 | soundPlayers[relativePath] = new SoundPlayer(stream);
149 | soundPlayers[relativePath].Load();
150 | }
151 | soundPlayers[relativePath].Play();
152 | }
153 |
154 | public void OnClick()
155 | {
156 | if (clickMethodChunk == null) return;
157 | try
158 | {
159 | env.dochunk(clickMethodChunk);
160 | }
161 | catch (Exception) { };
162 | }
163 |
164 | public void RegisterLua()
165 | {
166 | env.LoadBitmap = new Func(LoadBitmap);
167 | env.DisplayBitmap = new Func(DisplayBitmap);
168 | env.Sleep = new Action(Sleep);
169 | env.RequestClickEvent = new Action(RequestClickEvent);
170 | env.CreateDraft = new Action(CreateDraft);
171 | env.CopyBitmapToDraft = new Func(CopyBitmapToDraft);
172 | env.DrawDraft = new Action(DrawDraft);
173 | env.MoveWindow = new Action(MoveWindow);
174 | env.SetFlag = new Action(SetFlag);
175 | env.PlaySound = new Action(PlaySound);
176 | }
177 |
178 | public LuaApi(ArkDesktopLuaModule master, Lua lua, dynamic env)
179 | {
180 | this.master = master ?? throw new ArgumentNullException(nameof(master));
181 | this.lua = lua;
182 | this.env = env ?? throw new ArgumentNullException(nameof(env));
183 | RegisterLua();
184 | }
185 | }
186 | }
187 |
--------------------------------------------------------------------------------
/ArkDesktopLua/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ArkDesktopLua")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ArkDesktopLua")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
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("aa4d8756-09c4-4c9a-a117-d3db36085f0f")]
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 |
--------------------------------------------------------------------------------
/ArkDesktopLua/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/GlobalIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/GlobalIcon.ico
--------------------------------------------------------------------------------
/GlobalIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/GlobalIcon.png
--------------------------------------------------------------------------------
/LicenseForGlobalIcon.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/LicenseForGlobalIcon.txt
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # ArkDesktop
2 |
3 | CI: [](https://ci.appveyor.com/project/huix-oldcat/arkdesktop)
4 |
5 | 通过一套简易的接口与平台,方便地写一个桌面控件/悬浮窗/...
6 |
7 |
8 |
9 | ## 现在它能做什么?
10 |
11 | 1. 使用`ArkDesktopLua`插件播放静帧(支持透明背景与自定义逻辑),并可以稳定置顶(可覆盖任务栏)
12 | 2. 动态载入插件
13 | 3. 多配置自启与运行
14 | 4. ...
15 |
16 | ## 许可证
17 |
18 | 项目里面的所有源代码均遵循 The Mozilla Public License 2.0 许可证
19 |
20 | ## 更新计划
21 |
22 | - [x] 集成Chormium内核(ChromiumFX) [HuiDesktop](https://github.com/huix-oldcat/HuiDesktop)
--------------------------------------------------------------------------------
/TestApp/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TestApp/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TestApp
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows 窗体设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.button1 = new System.Windows.Forms.Button();
32 | this.button2 = new System.Windows.Forms.Button();
33 | this.button3 = new System.Windows.Forms.Button();
34 | this.button4 = new System.Windows.Forms.Button();
35 | this.button5 = new System.Windows.Forms.Button();
36 | this.textBox1 = new System.Windows.Forms.TextBox();
37 | this.textBox2 = new System.Windows.Forms.TextBox();
38 | this.button6 = new System.Windows.Forms.Button();
39 | this.button7 = new System.Windows.Forms.Button();
40 | this.button8 = new System.Windows.Forms.Button();
41 | this.button9 = new System.Windows.Forms.Button();
42 | this.button10 = new System.Windows.Forms.Button();
43 | this.SuspendLayout();
44 | //
45 | // button1
46 | //
47 | this.button1.Location = new System.Drawing.Point(12, 12);
48 | this.button1.Name = "button1";
49 | this.button1.Size = new System.Drawing.Size(170, 23);
50 | this.button1.TabIndex = 0;
51 | this.button1.Text = "加载Lua插件";
52 | this.button1.UseVisualStyleBackColor = true;
53 | this.button1.Click += new System.EventHandler(this.Button1_Click);
54 | //
55 | // button2
56 | //
57 | this.button2.Location = new System.Drawing.Point(12, 41);
58 | this.button2.Name = "button2";
59 | this.button2.Size = new System.Drawing.Size(170, 23);
60 | this.button2.TabIndex = 1;
61 | this.button2.Text = "加载陈的配置";
62 | this.button2.UseVisualStyleBackColor = true;
63 | this.button2.Click += new System.EventHandler(this.Button2_Click);
64 | //
65 | // button3
66 | //
67 | this.button3.Location = new System.Drawing.Point(12, 99);
68 | this.button3.Name = "button3";
69 | this.button3.Size = new System.Drawing.Size(170, 23);
70 | this.button3.TabIndex = 3;
71 | this.button3.Text = "加载所有配置";
72 | this.button3.UseVisualStyleBackColor = true;
73 | this.button3.Click += new System.EventHandler(this.Button3_Click);
74 | //
75 | // button4
76 | //
77 | this.button4.Location = new System.Drawing.Point(12, 70);
78 | this.button4.Name = "button4";
79 | this.button4.Size = new System.Drawing.Size(170, 23);
80 | this.button4.TabIndex = 2;
81 | this.button4.Text = "加载所有插件";
82 | this.button4.UseVisualStyleBackColor = true;
83 | this.button4.Click += new System.EventHandler(this.Button4_Click);
84 | //
85 | // button5
86 | //
87 | this.button5.Location = new System.Drawing.Point(12, 182);
88 | this.button5.Name = "button5";
89 | this.button5.Size = new System.Drawing.Size(170, 23);
90 | this.button5.TabIndex = 4;
91 | this.button5.Text = "修改配置描述";
92 | this.button5.UseVisualStyleBackColor = true;
93 | this.button5.Click += new System.EventHandler(this.Button5_Click);
94 | //
95 | // textBox1
96 | //
97 | this.textBox1.Location = new System.Drawing.Point(12, 128);
98 | this.textBox1.Name = "textBox1";
99 | this.textBox1.Size = new System.Drawing.Size(170, 21);
100 | this.textBox1.TabIndex = 5;
101 | //
102 | // textBox2
103 | //
104 | this.textBox2.Location = new System.Drawing.Point(12, 155);
105 | this.textBox2.Name = "textBox2";
106 | this.textBox2.Size = new System.Drawing.Size(170, 21);
107 | this.textBox2.TabIndex = 6;
108 | //
109 | // button6
110 | //
111 | this.button6.Location = new System.Drawing.Point(12, 211);
112 | this.button6.Name = "button6";
113 | this.button6.Size = new System.Drawing.Size(170, 23);
114 | this.button6.TabIndex = 7;
115 | this.button6.Text = "新建LayeredWindowManager";
116 | this.button6.UseVisualStyleBackColor = true;
117 | this.button6.Click += new System.EventHandler(this.Button6_Click);
118 | //
119 | // button7
120 | //
121 | this.button7.Location = new System.Drawing.Point(12, 269);
122 | this.button7.Name = "button7";
123 | this.button7.Size = new System.Drawing.Size(170, 21);
124 | this.button7.TabIndex = 8;
125 | this.button7.Text = "刷新窗口";
126 | this.button7.UseVisualStyleBackColor = true;
127 | this.button7.Click += new System.EventHandler(this.Button7_Click);
128 | //
129 | // button8
130 | //
131 | this.button8.Location = new System.Drawing.Point(12, 240);
132 | this.button8.Name = "button8";
133 | this.button8.Size = new System.Drawing.Size(170, 23);
134 | this.button8.TabIndex = 9;
135 | this.button8.Text = "新建LWM(使用配置)";
136 | this.button8.UseVisualStyleBackColor = true;
137 | this.button8.Click += new System.EventHandler(this.Button8_Click);
138 | //
139 | // button9
140 | //
141 | this.button9.Location = new System.Drawing.Point(12, 296);
142 | this.button9.Name = "button9";
143 | this.button9.Size = new System.Drawing.Size(170, 23);
144 | this.button9.TabIndex = 10;
145 | this.button9.Text = "Dispose";
146 | this.button9.UseVisualStyleBackColor = true;
147 | this.button9.Click += new System.EventHandler(this.Button9_Click);
148 | //
149 | // button10
150 | //
151 | this.button10.Location = new System.Drawing.Point(12, 325);
152 | this.button10.Name = "button10";
153 | this.button10.Size = new System.Drawing.Size(170, 23);
154 | this.button10.TabIndex = 11;
155 | this.button10.Text = "获取更新信息";
156 | this.button10.UseVisualStyleBackColor = true;
157 | this.button10.Click += new System.EventHandler(this.button10_Click);
158 | //
159 | // Form1
160 | //
161 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
162 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
163 | this.ClientSize = new System.Drawing.Size(800, 450);
164 | this.Controls.Add(this.button10);
165 | this.Controls.Add(this.button9);
166 | this.Controls.Add(this.button8);
167 | this.Controls.Add(this.button7);
168 | this.Controls.Add(this.button6);
169 | this.Controls.Add(this.textBox2);
170 | this.Controls.Add(this.textBox1);
171 | this.Controls.Add(this.button5);
172 | this.Controls.Add(this.button3);
173 | this.Controls.Add(this.button4);
174 | this.Controls.Add(this.button2);
175 | this.Controls.Add(this.button1);
176 | this.Name = "Form1";
177 | this.Text = "Form1";
178 | this.Load += new System.EventHandler(this.Form1_Load);
179 | this.ResumeLayout(false);
180 | this.PerformLayout();
181 |
182 | }
183 |
184 | #endregion
185 |
186 | private System.Windows.Forms.Button button1;
187 | private System.Windows.Forms.Button button2;
188 | private System.Windows.Forms.Button button3;
189 | private System.Windows.Forms.Button button4;
190 | private System.Windows.Forms.Button button5;
191 | private System.Windows.Forms.TextBox textBox1;
192 | private System.Windows.Forms.TextBox textBox2;
193 | private System.Windows.Forms.Button button6;
194 | private System.Windows.Forms.Button button7;
195 | private System.Windows.Forms.Button button8;
196 | private System.Windows.Forms.Button button9;
197 | private System.Windows.Forms.Button button10;
198 | }
199 | }
200 |
201 |
--------------------------------------------------------------------------------
/TestApp/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 | using System.Xml.Linq;
12 | using ArkDesktop.CoreKit;
13 |
14 | namespace TestApp
15 | {
16 | public partial class Form1 : Form
17 | {
18 | public Form1()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 | ConfigManager configManager;
24 |
25 | private void Form1_Load(object sender, EventArgs e)
26 | {
27 | configManager = new ConfigManager(AppDomain.CurrentDomain.BaseDirectory);
28 | }
29 |
30 | private void Button1_Click(object sender, EventArgs e)
31 | {
32 | configManager.LoadDll(Path.Combine(configManager.rootPath, "plugins", "ArkDesktopLua.dll"));
33 | }
34 |
35 | private void Button2_Click(object sender, EventArgs e)
36 | {
37 | configManager.LoadConfig(Path.Combine(configManager.rootPath, "configs", "陈_站立_点击互动"));
38 | }
39 |
40 | private void Button4_Click(object sender, EventArgs e)
41 | {
42 | configManager.ScanPlugins(Path.Combine(configManager.rootPath, "plugins"));
43 | }
44 |
45 | private void Button3_Click(object sender, EventArgs e)
46 | {
47 | configManager.ScanConfigs(Path.Combine(configManager.rootPath, "configs"));
48 | }
49 |
50 | private void Button5_Click(object sender, EventArgs e)
51 | {
52 | var r = (from ev in configManager.Configs where ev.ConfigName == textBox1.Text select ev);
53 | if (r.Any())
54 | {
55 | r.First().Description = textBox2.Text;
56 | }
57 | }
58 | LayeredWindowManager manager;
59 | XDocument document = new XDocument();
60 |
61 | private void Button6_Click(object sender, EventArgs e)
62 | {
63 | manager = new LayeredWindowManager(document.Root);
64 | manager.Parent = this;
65 | manager.Ready.WaitOne();
66 | manager.Location = new Point(200, 0);
67 | using (Bitmap bitmap = Bitmap.FromFile("testimg.png") as Bitmap)
68 | {
69 | manager.SetBits(bitmap);
70 | }
71 | }
72 |
73 | private void Button7_Click(object sender, EventArgs e)
74 | {
75 | using (Bitmap bitmap = Bitmap.FromFile("testimg.png") as Bitmap)
76 | {
77 | manager.SetBits(bitmap);
78 | }
79 | }
80 |
81 | private void Button8_Click(object sender, EventArgs e)
82 | {
83 | configManager.ScanConfigs(Path.Combine(configManager.rootPath, "configs"));
84 | manager = new LayeredWindowManager(new ResourceManager(Path.Combine(configManager.rootPath, "configs", "陈_站立_点击互动"), null));
85 | manager.Parent = this;
86 | manager.Ready.WaitOne();
87 | manager.Location = new Point(200, 0);
88 | using (Bitmap bitmap = Bitmap.FromFile("testimg.png") as Bitmap)
89 | {
90 | manager.SetBits(bitmap);
91 | }
92 | }
93 |
94 | private void Button9_Click(object sender, EventArgs e)
95 | {
96 | manager.Dispose();
97 | }
98 |
99 | private void button10_Click(object sender, EventArgs e)
100 | {
101 | string a, b;
102 | (a, b) = UpdateChecker.GetUpdateInfo();
103 | MessageBox.Show(a);
104 | if (b != null) MessageBox.Show(b);
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/TestApp/Form1.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 |
--------------------------------------------------------------------------------
/TestApp/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 TestApp
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 应用程序的主入口点。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TestApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("TestApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestApp")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
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("764ecbc1-eb5c-46ce-9c35-e58729d31847")]
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 |
--------------------------------------------------------------------------------
/TestApp/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TestApp.Properties
12 | {
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 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestApp.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/TestApp/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 |
--------------------------------------------------------------------------------
/TestApp/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TestApp.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TestApp/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TestApp/TestApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {764ECBC1-EB5C-46CE-9C35-E58729D31847}
8 | WinExe
9 | TestApp
10 | TestApp
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | ..\Build\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | none
29 | true
30 | ..\Build\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | Form
51 |
52 |
53 | Form1.cs
54 |
55 |
56 |
57 |
58 | Form1.cs
59 |
60 |
61 | ResXFileCodeGenerator
62 | Resources.Designer.cs
63 | Designer
64 |
65 |
66 | True
67 | Resources.resx
68 |
69 |
70 | SettingsSingleFileGenerator
71 | Settings.Designer.cs
72 |
73 |
74 | True
75 | Settings.settings
76 | True
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | {ed7282fd-04a9-400d-abc4-540724fa8a44}
85 | ArkDesktopCoreKit
86 |
87 |
88 | {aa4d8756-09c4-4c9a-a117-d3db36085f0f}
89 | ArkDesktopLua
90 |
91 |
92 |
93 |
94 | xcopy /Y $(ProjectDir)testimg.png $(TargetDir)
95 |
96 |
--------------------------------------------------------------------------------
/TestApp/testimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huix-oldcat/ArkDesktop/ca0b382bbf1016a5f33354a96f2015a2c7b76630/TestApp/testimg.png
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Developing...
5 |
6 |
7 |
8 | Developing...
9 |
10 |
--------------------------------------------------------------------------------