├── .gitattributes
├── .gitignore
├── Icon conversion.sln
├── Icon conversion
├── 512x512.ico
├── App.config
├── App.xaml
├── App.xaml.cs
├── Icon conversion.csproj
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Related_functions
│ ├── CMD.cs
│ ├── Icon.cs
│ └── check.cs
└── packages.config
├── LICENSE
├── README.md
└── 图片
├── Snipaste_2021-08-02_21-20-30.png
└── Snipaste_2021-09-06_13-26-23.png
/.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
--------------------------------------------------------------------------------
/Icon conversion.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Blend for Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30907.101
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Icon conversion", "Icon conversion\Icon conversion.csproj", "{DE19AD13-4659-49C1-A4EC-0D5BD858D1E3}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {DE19AD13-4659-49C1-A4EC-0D5BD858D1E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {DE19AD13-4659-49C1-A4EC-0D5BD858D1E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {DE19AD13-4659-49C1-A4EC-0D5BD858D1E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {DE19AD13-4659-49C1-A4EC-0D5BD858D1E3}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {37E90CFF-215F-498F-95F4-F6A580FD422C}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Icon conversion/512x512.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xing-Fax/Icon-conversion/22dd5fb1c9a0ac1851c5be427812cfebd28d8403/Icon conversion/512x512.ico
--------------------------------------------------------------------------------
/Icon conversion/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Icon conversion/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Icon conversion/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 Icon_conversion
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Icon conversion/Icon conversion.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {DE19AD13-4659-49C1-A4EC-0D5BD858D1E3}
8 | WinExe
9 | Icon_conversion
10 | Icon conversion
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 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | x64
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 | 512X512.ico
41 |
42 |
43 | false
44 |
45 |
46 | true
47 | bin\x64\Debug\
48 | DEBUG;TRACE
49 | full
50 | x64
51 | 7.3
52 | prompt
53 | true
54 |
55 |
56 | bin\x64\Release\
57 | TRACE
58 | true
59 | pdbonly
60 | AnyCPU
61 | 7.3
62 | prompt
63 | true
64 |
65 |
66 |
67 |
68 | ..\packages\MaterialDesignColors.2.0.1\lib\net452\MaterialDesignColors.dll
69 |
70 |
71 | ..\packages\MaterialDesignThemes.4.1.0\lib\net452\MaterialDesignThemes.Wpf.dll
72 |
73 |
74 | ..\packages\Microsoft-WindowsAPICodePack-Core.1.1.4\lib\net472\Microsoft.WindowsAPICodePack.dll
75 |
76 |
77 | ..\packages\Microsoft-WindowsAPICodePack-Shell.1.1.4\lib\net472\Microsoft.WindowsAPICodePack.Shell.dll
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | 4.0
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | MSBuild:Compile
100 | Designer
101 |
102 |
103 |
104 |
105 |
106 | MSBuild:Compile
107 | Designer
108 |
109 |
110 | App.xaml
111 | Code
112 |
113 |
114 | MainWindow.xaml
115 | Code
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 |
151 |
152 | 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/Icon conversion/MainWindow.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 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
204 |
212 |
220 |
227 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
290 |
291 |
292 |
293 |
--------------------------------------------------------------------------------
/Icon conversion/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using Microsoft.WindowsAPICodePack.Dialogs;
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.ComponentModel;
7 | using System.Diagnostics;
8 | using System.IO;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 | using System.Windows;
13 | using System.Windows.Controls;
14 | using System.Windows.Data;
15 | using System.Windows.Documents;
16 | using System.Windows.Input;
17 | using System.Windows.Media;
18 | using System.Windows.Media.Animation;
19 | using System.Windows.Media.Imaging;
20 | using System.Windows.Navigation;
21 | using System.Windows.Shapes;
22 |
23 | namespace Icon_conversion
24 | {
25 | ///
26 | /// MainWindow.xaml 的交互逻辑
27 | ///
28 | public partial class MainWindow : Window
29 | {
30 |
31 | private void 取消_Click(object sender, RoutedEventArgs e)
32 | {
33 | BeginStoryboard((Storyboard)FindResource("自定义关闭"));
34 | 自定义.IsChecked = false;
35 | 警告.Content = string.Empty;
36 | }
37 |
38 | private void 自定义_Checked(object sender, RoutedEventArgs e)
39 | {
40 | BeginStoryboard((Storyboard)FindResource("自定义打开"));
41 | 自定义.Content = "自定义";
42 | 高.Text = null;
43 | 宽.Text = null;
44 | }
45 |
46 | private void 主窗体_DragEnter(object sender, DragEventArgs e)
47 | {
48 | 拖入文件.Visibility = Visibility.Visible;
49 | }
50 |
51 | private void 主窗体_DragLeave(object sender, DragEventArgs e)
52 | {
53 | 拖入文件.Visibility = Visibility.Collapsed;
54 | }
55 |
56 | private void Rectangle_MouseMove(object sender, MouseEventArgs e)
57 | {
58 | if (e.LeftButton == MouseButtonState.Pressed) { DragMove(); }
59 | }
60 |
61 | private void 关闭_Click(object sender, RoutedEventArgs e)
62 | {
63 | Environment.Exit(0);
64 | }
65 |
66 | private void 最小化_Click(object sender, RoutedEventArgs e)
67 | {
68 | 主窗体.WindowState = WindowState.Minimized;
69 | }
70 |
71 | private void 图标_MouseUp(object sender, MouseButtonEventArgs e)
72 | {
73 | Process.Start("https://github.com/xingchuanzhen/");
74 | }
75 |
76 | private void ToggleButton_Click(object sender, RoutedEventArgs e)
77 | {
78 | 主窗体.Topmost = (bool)前端显示.IsChecked;
79 | }
80 |
81 | private void 关闭关于_Click(object sender, RoutedEventArgs e)
82 | {
83 | BeginStoryboard((Storyboard)FindResource("关于关闭"));
84 | }
85 |
86 | private void 关于_Click(object sender, RoutedEventArgs e)
87 | {
88 | BeginStoryboard((Storyboard)FindResource("关于打开"));
89 | }
90 |
91 | private void 清空对象_Click(object sender, RoutedEventArgs e)
92 | {
93 | Number_file.Clear();
94 | 文件列表.Items.Clear();
95 | 文件下拉框.Header = "已选择0个对象";
96 | Assignment("清空文件列表");
97 | }
98 |
99 | private void 清除日志_Click(object sender, RoutedEventArgs e)
100 | {
101 | 日志.Text = "[" + DateTime.Now.ToLongTimeString().ToString() + "]: 已经清空日志...";
102 | }
103 |
104 | private void 打开目录_Click(object sender, RoutedEventArgs e)
105 | {
106 | if (Directory.Exists(out_file) == false)//判断输出目录是否存在
107 | {
108 | Assignment("输出目录不存在,重新创建目录");
109 | Directory.CreateDirectory(out_file);//创建新路径
110 | }
111 | Related_functions.CMD.RunCmd("explorer " + out_file + @"\");
112 | }
113 |
114 | private void 输出目录_Click(object sender, RoutedEventArgs e)
115 | {
116 | try
117 | {
118 | var dialog = new CommonOpenFileDialog();
119 | dialog.IsFolderPicker = true;
120 | CommonFileDialogResult result = dialog.ShowDialog();
121 | if (dialog.FileName != "")
122 | {
123 | 输出路径.Text = dialog.FileName;
124 | out_file = dialog.FileName;
125 | Assignment("重新定向输出文件夹:" + dialog.FileName);
126 | }
127 | }
128 | catch { }
129 | }
130 | ///
131 | /// 获取桌面路径
132 | ///
133 | static string Desktop_file = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
134 | ///
135 | /// 设定默认输出文件夹路径
136 | ///
137 | static string out_file = Desktop_file + @"\ICON输出";
138 | ///
139 | /// 用于存储已经添加的文件路径
140 | ///
141 | static ArrayList Number_file = new ArrayList();
142 |
143 | static System.Drawing.Size siz_customize = new System.Drawing.Size();
144 |
145 | public MainWindow()
146 | {
147 | InitializeComponent();
148 |
149 | //以下代码用作校验程序签名是否完整,调试时请将其注释
150 |
151 | if (Related_functions.check.Document_verification() != true)
152 | {
153 | MessageBox.Show("签名校验失败,程序可能被篡改,轻击确定以退出程序", "警告");
154 | Environment.Exit(0);
155 | }
156 |
157 | //到此结束
158 | 日志.Text += "[" + DateTime.Now.ToLongTimeString().ToString() + "]: ICO图标转换程序启动 Copyright © xcz 2021";
159 | Assignment("获取桌面路径:" + Desktop_file);
160 | 输出路径.Text = out_file;
161 | 前端显示.IsChecked = true;
162 | 主窗体.Topmost = true;
163 | Assignment("程序准备就绪...");
164 | }
165 |
166 | private void 添加文件_Click(object sender, RoutedEventArgs e)
167 | {
168 | OpenFileDialog ofd = new OpenFileDialog();
169 | ofd.Filter = "图像文件|*.jpg;*.png;*.bmp;*.jpeg";
170 | ofd.Multiselect = true;
171 | if (ofd.ShowDialog(this) == true)
172 | {
173 | foreach (string file in ofd.FileNames)
174 | {
175 | if (Number_file.Contains(file) == false)//排除同类项
176 | {
177 | Number_file.Add(file);//将元素添加到数组末尾
178 | 文件列表.Items.Add(file);
179 | Assignment("已添加文件:" + file);
180 | }
181 | else
182 | {
183 | Assignment("添加失败!原因:已存在此文件");
184 | }
185 | }
186 | }
187 | 文件下拉框.Header = "已选择" + Number_file.Count + "个对象";
188 | }
189 |
190 | private void 开始_Click(object sender, RoutedEventArgs e)
191 | {
192 | bool[] vs = new bool[6];
193 | vs[0] = (bool)尺寸16.IsChecked;
194 | vs[1] = (bool)尺寸32.IsChecked;
195 | vs[2] = (bool)尺寸48.IsChecked;
196 | vs[3] = (bool)尺寸128.IsChecked;
197 | vs[4] = (bool)尺寸255.IsChecked;
198 | vs[5] = (bool)自定义.IsChecked;
199 |
200 | if (Number_file .Count != 0)
201 | {
202 | bool temp = false;
203 | for(int i = 0; i < vs.Length;i ++)
204 | {
205 | if (vs[i] == true) { temp = true; }
206 | }
207 | if (temp == false)
208 | {
209 | Assignment("您还没有选择要转换的尺寸!");
210 | }
211 | else
212 | {
213 | if (Directory.Exists(out_file) == false)//判断输出目录是否存在
214 | {
215 | Assignment("输出目录不存在,重新创建目录");
216 | Directory.CreateDirectory(out_file);//创建新路径
217 | }
218 | 进度条.IsIndeterminate = true;
219 | using (BackgroundWorker bw = new BackgroundWorker())
220 | {
221 | bw.DoWork += new DoWorkEventHandler(bw_DoWork);
222 | bw.RunWorkerAsync(vs);
223 | }
224 | }
225 | }
226 | else
227 | {
228 | Assignment("您还没有选择要转换的图片!");
229 | }
230 | }
231 |
232 | private void Assignment(string str)
233 | {
234 | Dispatcher.Invoke(new Action(delegate
235 | {
236 | 日志.Text += "\n[" + DateTime.Now.ToLongTimeString().ToString() + "]: " + str;
237 | 框.ScrollToVerticalOffset(框.ExtentHeight);
238 | }));
239 | }
240 |
241 | void bw_DoWork(object sender, DoWorkEventArgs e)//后台
242 | {
243 | System.Drawing.Size size = new System.Drawing.Size();
244 | for (int i = 0;i < Number_file .Count;i ++)
245 | {
246 |
247 | bool temp;
248 | if (((bool[])e.Argument)[0])
249 | {
250 | size.Height = 32;
251 | size.Width = 32;
252 | Assignment("开始执行第 " + (i + 1) + " 个文件" + "尺寸:" + size.Height + "X" + size.Width);
253 | temp = Related_functions.Icon.ConvertImageToIcon(Number_file[i].ToString(), out_file + @"\" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + "_" + size.Height + "X" + size.Width + ".ico", size);
254 | if (temp) { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行成功!( • ω • )✧"); }
255 | else { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行失败!(っ °Д °;)っ"); }
256 | }
257 |
258 | if (((bool[])e.Argument)[1])
259 | {
260 | size.Height = 64;
261 | size.Width = 64;
262 | Assignment("开始执行第 " + (i + 1) + " 个文件" + "尺寸:" + size.Height + "X" + size.Width);
263 | temp = Related_functions.Icon.ConvertImageToIcon(Number_file[i].ToString(), out_file + @"\" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + "_" + size.Height + "X" + size.Width + ".ico", size);
264 | if (temp) { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行成功!( • ω • )✧"); }
265 | else { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行失败!(っ °Д °;)っ"); }
266 | }
267 |
268 | if (((bool[])e.Argument)[2])
269 | {
270 | size.Height = 256;
271 | size.Width = 256;
272 | Assignment("开始执行第 " + (i + 1) + " 个文件" + "尺寸:" + size.Height + "X" + size.Width);
273 | temp = Related_functions.Icon.ConvertImageToIcon(Number_file[i].ToString(), out_file + @"\" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + "_" + size.Height + "X" + size.Width + ".ico", size);
274 | if (temp) { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行成功!( • ω • )✧"); }
275 | else { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行失败!(っ °Д °;)っ"); }
276 | }
277 |
278 | if (((bool[])e.Argument)[3])
279 | {
280 | size.Height = 512;
281 | size.Width = 512;
282 | Assignment("开始执行第 " + (i + 1) + " 个文件" + "尺寸:" + size.Height + "X" + size.Width);
283 | temp = Related_functions.Icon.ConvertImageToIcon(Number_file[i].ToString(), out_file + @"\" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + "_" + size.Height + "X" + size.Width + ".ico", size);
284 | if (temp) { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行成功!( • ω • )✧"); }
285 | else { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行失败!(っ °Д °;)っ"); }
286 | }
287 |
288 | if (((bool[])e.Argument)[4])
289 | {
290 | size.Height = 1024;
291 | size.Width = 1024;
292 | Assignment("开始执行第 " + (i + 1) + " 个文件" + "尺寸:" + size.Height + "X" + size.Width);
293 | temp = Related_functions.Icon.ConvertImageToIcon(Number_file[i].ToString(), out_file + @"\" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + "_" + size.Height + "X" + size.Width + ".ico", size);
294 | if (temp) { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行成功!( • ω • )✧"); }
295 | else { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行失败!(っ °Д °;)っ"); }
296 | }
297 |
298 | if (((bool[])e.Argument)[5])
299 | {
300 | Assignment("开始执行第 " + (i + 1) + " 个文件" + "尺寸:" + siz_customize.Width + "X" + siz_customize.Height);
301 | temp = Related_functions.Icon.ConvertImageToIcon(Number_file[i].ToString(), out_file + @"\" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + "_" + siz_customize.Width + "X" + siz_customize.Height + ".ico", siz_customize);
302 | if (temp) { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行成功!( • ω • )✧"); }
303 | else { Assignment("文件:" + System.IO.Path.GetFileNameWithoutExtension(Number_file[i].ToString()) + " 执行失败!(っ °Д °;)っ"); }
304 | }
305 | }
306 | Assignment("一共" + Number_file.Count.ToString() + "个文件执行完毕!(✿◕‿◕✿)");
307 | Dispatcher.Invoke(new Action(delegate{ 进度条.IsIndeterminate = false;}));
308 | }
309 |
310 | private void 确定_Click(object sender, RoutedEventArgs e)
311 | {
312 | try
313 | {
314 | if (高.Text != string.Empty && 宽.Text != string.Empty)
315 | {
316 | if (int.Parse(高.Text) > 5120 || int.Parse(宽.Text) > 5120)
317 | {
318 | 警告.Content = "高宽不能大于 5120";
319 | 警告.Visibility = Visibility.Visible;
320 | }
321 | else
322 | {
323 | siz_customize.Height = int.Parse(高.Text);
324 | siz_customize.Width = int.Parse(宽.Text);
325 | 自定义.IsChecked = true;
326 | 自定义.Content = 高.Text + " X " + 宽.Text;
327 | BeginStoryboard((Storyboard)FindResource("自定义关闭"));
328 | 警告.Content = string.Empty;
329 | }
330 | }
331 | else
332 | {
333 | 警告.Content = "高或宽不能为空!";
334 | 警告.Visibility = Visibility.Visible;
335 | }
336 | }
337 | catch
338 | {
339 | 警告.Content = "非法字符!";
340 | 警告.Visibility = Visibility.Visible;
341 | }
342 | }
343 |
344 | private void 拖入文件_Drop(object sender, DragEventArgs e)
345 | {
346 | 拖入文件.Visibility = Visibility.Collapsed;
347 | string[] filePath = (string[])e.Data.GetData(DataFormats.FileDrop);
348 | for (int i = 0; i < filePath.Length; i++)
349 | {
350 | if (Number_file.Contains(filePath[i]) == false)//排除同类项
351 | {
352 | string temp = System.IO.Path.GetExtension(filePath[i]);
353 | if (temp == ".jpg" || temp == ".png" || temp == ".bmp" || temp == ".jpeg")
354 | {
355 | Number_file.Add(filePath[i]);//将元素添加到数组末尾
356 | 文件列表.Items.Add(filePath[i]);
357 | Assignment("已添加文件:" + filePath[i]);
358 | }
359 | else
360 | {
361 | Assignment("请添加格式为 jpg、png、bmp、jpeg 格式文件!");
362 | }
363 | }
364 | else
365 | {
366 | Assignment("添加失败!原因:已存在此文件");
367 | }
368 | }
369 | 文件下拉框.Header = "已选择" + Number_file.Count + "个对象";
370 | }
371 | }
372 | }
373 |
--------------------------------------------------------------------------------
/Icon conversion/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("Icon conversion")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Icon conversion")]
15 | [assembly: AssemblyCopyright("Copyright © xcz 2021")]
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.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Icon conversion/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace Icon_conversion.Properties
13 | {
14 | ///
15 | /// 强类型资源类,用于查找本地化字符串等。
16 | ///
17 | // 此类是由 StronglyTypedResourceBuilder
18 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
19 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
20 | // (以 /str 作为命令选项),或重新生成 VS 项目。
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources
25 | {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources()
33 | {
34 | }
35 |
36 | ///
37 | /// 返回此类使用的缓存 ResourceManager 实例。
38 | ///
39 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
40 | internal static global::System.Resources.ResourceManager ResourceManager
41 | {
42 | get
43 | {
44 | if ((resourceMan == null))
45 | {
46 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Icon_conversion.Properties.Resources", typeof(Resources).Assembly);
47 | resourceMan = temp;
48 | }
49 | return resourceMan;
50 | }
51 | }
52 |
53 | ///
54 | /// 重写当前线程的 CurrentUICulture 属性,对
55 | /// 使用此强类型资源类的所有资源查找执行重写。
56 | ///
57 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
58 | internal static global::System.Globalization.CultureInfo Culture
59 | {
60 | get
61 | {
62 | return resourceCulture;
63 | }
64 | set
65 | {
66 | resourceCulture = value;
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Icon conversion/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 |
--------------------------------------------------------------------------------
/Icon conversion/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 |
12 | namespace Icon_conversion.Properties
13 | {
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
17 | {
18 |
19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
20 |
21 | public static Settings Default
22 | {
23 | get
24 | {
25 | return defaultInstance;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Icon conversion/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Icon conversion/Related_functions/CMD.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Icon_conversion.Related_functions
9 | {
10 | class CMD
11 | {
12 | ///
13 | /// 执行CMD命令
14 | ///
15 | /// 命令内容
16 | /// 返回执行后的输出结果
17 | public static string RunCmd(string command)
18 | {
19 | Process p = new Process();
20 | p.StartInfo.FileName = "cmd.exe"; //确定程序名
21 | p.StartInfo.Arguments = "/c " + command; //确定程式命令行
22 | p.StartInfo.UseShellExecute = false; //Shell的使用
23 | p.StartInfo.RedirectStandardInput = true; //重定向输入
24 | p.StartInfo.RedirectStandardOutput = true; //重定向输出
25 | p.StartInfo.RedirectStandardError = true; //重定向输出错误
26 | p.StartInfo.CreateNoWindow = true; //设置置不显示示窗口
27 | p.Start();
28 | return p.StandardOutput.ReadToEnd(); //输出出流取得命令行结果果
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Icon conversion/Related_functions/Icon.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Drawing.Imaging;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using static System.Net.Mime.MediaTypeNames;
10 |
11 | namespace Icon_conversion.Related_functions
12 | {
13 | class Icon
14 | {
15 | ///
16 | /// 图片转换为ico文件
17 | ///
18 | /// 原图片路径
19 | /// 输出ico文件路径
20 | /// 输出ico图标尺寸,保守起见最高5120*5120
21 | /// 是否转换成功
22 | public static bool ConvertImageToIcon(string origin, string destination, Size iconSize)
23 | {
24 | if (iconSize.Width > 5120 || iconSize.Height > 5120)
25 | {
26 | return false;
27 | }
28 | if (!File.Exists(origin))
29 | {
30 | return false;
31 | }
32 | try
33 | {
34 | System.Drawing.Image image = new Bitmap(new Bitmap(origin), iconSize); //先读取已有的图片为bitmap,并缩放至设定大小
35 | MemoryStream bitMapStream = new MemoryStream(); //存原图的内存流
36 | MemoryStream iconStream = new MemoryStream(); //存图标的内存流
37 | image.Save(bitMapStream, ImageFormat.Png); //将原图读取为png格式并存入原图内存流
38 | BinaryWriter iconWriter = new BinaryWriter(iconStream); //新建二进制写入器以写入目标图标内存流
39 | /**
40 | * 下面是根据原图信息,进行文件头写入
41 | */
42 | iconWriter.Write((short)0);
43 | iconWriter.Write((short)1);
44 | iconWriter.Write((short)1);
45 | iconWriter.Write((byte)image.Width);
46 | iconWriter.Write((byte)image.Height);
47 | iconWriter.Write((short)0);
48 | iconWriter.Write((short)0);
49 | iconWriter.Write((short)32);
50 | iconWriter.Write((int)bitMapStream.Length);
51 | iconWriter.Write(22);
52 | //写入图像体至目标图标内存流
53 | iconWriter.Write(bitMapStream.ToArray());
54 | //保存流,并将流指针定位至头部以Icon对象进行读取输出为文件
55 | iconWriter.Flush();
56 | iconWriter.Seek(0, SeekOrigin.Begin);
57 | Stream iconFileStream = new FileStream(destination, FileMode.Create);
58 | System.Drawing.Icon icon = new System.Drawing.Icon(iconStream);
59 | icon.Save(iconFileStream); //储存图像
60 | /**
61 | * 下面开始释放资源
62 | */
63 | iconFileStream.Close();
64 | iconWriter.Close();
65 | iconStream.Close();
66 | bitMapStream.Close();
67 | icon.Dispose();
68 | image.Dispose();
69 | return File.Exists(destination);
70 | }
71 | catch
72 | {
73 | return false;
74 | }
75 |
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/Icon conversion/Related_functions/check.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Security.Cryptography.X509Certificates;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Icon_conversion.Related_functions
10 | {
11 | class check
12 | {
13 | ///
14 | /// 检测自己身签名指纹是否匹配
15 | /// 有效防止软件被病毒或恶意软件篡改
16 | ///
17 | /// 返回true为正常状态
18 | public static bool Document_verification()
19 | {
20 | try
21 | {
22 | X509Certificate cert = X509Certificate.CreateFromSignedFile(Process.GetCurrentProcess().MainModule.FileName);
23 | string Fingerprint = cert.GetCertHashString();
24 | if (Fingerprint == "36A888B9F2A505BF92AC6B2796C2188E639AB1D1")
25 | { return true; }
26 | else
27 | { return false; }
28 | }
29 | catch { return false; }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Icon conversion/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 XCZ
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Icon-conversion
2 |
3 | #### ICO图片转换工具
4 |
5 | ## 介绍:
6 |
7 | 一个可以将图片转换为ICO格式的应用,目前支持png、jpg、bmp、jpeg格式的转换,支持批量转换,自定义分辨率
8 |
9 | 目前支持转换分辨率:最大为5120*5120
10 |
11 | ## 截图:
12 |
13 | 
14 |
15 | ## 最后:
16 |
17 | 蓝奏云链接:https://wwe.lanzoui.com/b01ohlaaj 密码:74nr
18 |
--------------------------------------------------------------------------------
/图片/Snipaste_2021-08-02_21-20-30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xing-Fax/Icon-conversion/22dd5fb1c9a0ac1851c5be427812cfebd28d8403/图片/Snipaste_2021-08-02_21-20-30.png
--------------------------------------------------------------------------------
/图片/Snipaste_2021-09-06_13-26-23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xing-Fax/Icon-conversion/22dd5fb1c9a0ac1851c5be427812cfebd28d8403/图片/Snipaste_2021-09-06_13-26-23.png
--------------------------------------------------------------------------------