├── src
├── Resources
│ ├── icon.png
│ └── preview.png
├── source.extension.ico
├── Properties
│ └── AssemblyInfo.cs
├── source.extension.cs
├── GlyphExporter.cs
├── source.extension.vsixmanifest
├── GlyphExporter.vsct
├── GlyphExporter.csproj
├── source.extension.resx
└── GlyphExporterPackage.cs
├── .gitattributes
├── .github
├── ISSUE_TEMPLATE.md
└── CONTRIBUTING.md
├── LICENSE
├── appveyor.yml
├── README.md
├── GlyphExporter.sln
└── .gitignore
/src/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/madskristensen/GlyphExporter/master/src/Resources/icon.png
--------------------------------------------------------------------------------
/src/Resources/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/madskristensen/GlyphExporter/master/src/Resources/preview.png
--------------------------------------------------------------------------------
/src/source.extension.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/madskristensen/GlyphExporter/master/src/source.extension.ico
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Installed product versions
2 | - Visual Studio: [example 2015 Professional]
3 | - This extension: [example 1.1.21]
4 |
5 | ### Description
6 | Replace this text with a short description
7 |
8 | ### Steps to recreate
9 | 1. Replace this
10 | 2. text with
11 | 3. the steps
12 | 4. to recreate
13 |
14 | ### Current behavior
15 | Explain what it's doing and why it's wrong
16 |
17 | ### Expected behavior
18 | Explain what it should be doing after it's fixed.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2015 Sayed Hashimi & Mads Kristensen
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/src/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Resources;
4 | using System.Runtime.InteropServices;
5 | using MadsKristensen.GlyphExporter;
6 |
7 | [assembly: AssemblyTitle(Vsix.Name)]
8 | [assembly: AssemblyDescription(Vsix.Description)]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany(Vsix.Author)]
11 | [assembly: AssemblyProduct(Vsix.Name)]
12 | [assembly: AssemblyCopyright(Vsix.Author)]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture(Vsix.Language)]
15 | [assembly: ComVisible(false)]
16 | [assembly: CLSCompliant(false)]
17 | [assembly: NeutralResourcesLanguage(Vsix.Language)]
18 |
19 | [assembly: AssemblyVersion(Vsix.Version)]
20 | [assembly: AssemblyFileVersion(Vsix.Version)]
--------------------------------------------------------------------------------
/src/source.extension.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This file was generated by Extensibility Tools v1.10.211
4 | //
5 | // ------------------------------------------------------------------------------
6 | namespace MadsKristensen.GlyphExporter
7 | {
8 | static class Vsix
9 | {
10 | public const string Id = "c1e1a7aa-d416-4600-81ce-a0aba0a3b201";
11 | public const string Name = "Glyph Exporter";
12 | public const string Description = @"Exports all glyph icons to image files";
13 | public const string Language = "en-US";
14 | public const string Version = "1.1";
15 | public const string Author = "Mads Kristensen";
16 | public const string Tags = "";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | image: Visual Studio 2017
2 |
3 | install:
4 | - ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex
5 |
6 | before_build:
7 | - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion
8 | - ps: Vsix-TokenReplacement src\source.extension.cs 'Version = "([0-9\\.]+)"' 'Version = "{version}"'
9 |
10 | build_script:
11 | - nuget restore
12 | - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m
13 |
14 | after_build:
15 | - ps: Vsix-PushArtifacts | Vsix-PublishToGallery
16 |
17 | before_deploy:
18 | - ps: Vsix-CreateChocolatyPackage -packageId glyphexporter
19 |
20 | deploy:
21 | - provider: Environment
22 | name: Chocolatey
23 | on:
24 | branch: master
25 | appveyor_repo_commit_message_extended: /\[release\]/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Glyph Exporter for Visual Studio
2 |
3 | [](https://ci.appveyor.com/project/madskristensen/glyphexporter)
4 |
5 | Download from the
6 | [Visual Studio Gallery](https://visualstudiogallery.msdn.microsoft.com/b6cb739c-359d-4cce-a06d-9c75fe55dc51)
7 | or get the
8 | [nightly build](https://ci.appveyor.com/project/madskristensen/glyphexporter/build/artifacts)
9 |
10 | This will export the various image icons that Visual Studio uses.
11 |
12 | The icons comes from 2 sources:
13 |
14 | 1. IGlyphService
15 | 2. IVsImageService
16 |
17 | Any image icons present in those services will be exported to disk.
18 |
19 | By going to **Tools -> Export Glyphs** you will be prompted to select
20 | a folder on disk where the images should be exported into.
21 |
22 | The images can be seen here http://glyphlist.azurewebsites.net/
23 |
24 | ## License
25 | [Apache 2.0](LICENSE)
26 |
27 | ## Contribute
28 | Check out the [contribution guidelines](.github/CONTRIBUTION.md)
29 | if you want to contribute to this project.
--------------------------------------------------------------------------------
/src/GlyphExporter.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This file was generated by Extensibility Tools v1.10.211
4 | //
5 | // ------------------------------------------------------------------------------
6 | namespace MadsKristensen.GlyphExporter
7 | {
8 | using System;
9 |
10 | ///
11 | /// Helper class that exposes all GUIDs used across VS Package.
12 | ///
13 | internal sealed partial class PackageGuids
14 | {
15 | public const string guidGlyphExporterPkgString = "c1e1a7aa-d416-4600-81ce-a0aba0a3b201";
16 | public const string guidGlyphExporterCmdSetString = "3fc922ee-7ea1-456e-86df-f5a5ad462cdc";
17 | public static Guid guidGlyphExporterPkg = new Guid(guidGlyphExporterPkgString);
18 | public static Guid guidGlyphExporterCmdSet = new Guid(guidGlyphExporterCmdSetString);
19 | }
20 | ///
21 | /// Helper class that encapsulates all CommandIDs uses across VS Package.
22 | ///
23 | internal sealed partial class PackageIds
24 | {
25 | public const int MyMenuGroup = 0x1020;
26 | public const int cmdidGlyph = 0x0100;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Glyph Exporter
6 | Exports all glyph icons to image files
7 | Resources\LICENSE
8 | Resources\icon.png
9 | Resources\preview.png
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/GlyphExporter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GlyphExporter", "src\GlyphExporter.csproj", "{BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5BE2DDFB-600E-4DBF-B88F-590163C7EFA6}"
9 | ProjectSection(SolutionItems) = preProject
10 | appveyor.yml = appveyor.yml
11 | README.md = README.md
12 | EndProjectSection
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | CI|Any CPU = CI|Any CPU
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}.CI|Any CPU.ActiveCfg = CI|Any CPU
22 | {BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}.CI|Any CPU.Build.0 = CI|Any CPU
23 | {BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}.Release|Any CPU.Build.0 = Release|Any CPU
27 | EndGlobalSection
28 | GlobalSection(SolutionProperties) = preSolution
29 | HideSolutionNode = FALSE
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/GlyphExporter.vsct:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 | .vs
10 |
11 | # Build results
12 | [Dd]ebug/
13 | [Dd]ebugPublic/
14 | [Rr]elease/
15 | [Rr]eleases/
16 | x64/
17 | x86/
18 | build/
19 | bld/
20 | [Bb]in/
21 | [Oo]bj/
22 |
23 | # Roslyn cache directories
24 | *.ide/
25 |
26 | # MSTest test Results
27 | [Tt]est[Rr]esult*/
28 | [Bb]uild[Ll]og.*
29 |
30 | #NUNIT
31 | *.VisualState.xml
32 | TestResult.xml
33 |
34 | # Build Results of an ATL Project
35 | [Dd]ebugPS/
36 | [Rr]eleasePS/
37 | dlldata.c
38 |
39 | *_i.c
40 | *_p.c
41 | *_i.h
42 | *.ilk
43 | *.meta
44 | *.obj
45 | *.pch
46 | *.pdb
47 | *.pgc
48 | *.pgd
49 | *.rsp
50 | *.sbr
51 | *.tlb
52 | *.tli
53 | *.tlh
54 | *.tmp
55 | *.tmp_proj
56 | *.log
57 | *.vspscc
58 | *.vssscc
59 | .builds
60 | *.pidb
61 | *.svclog
62 | *.scc
63 |
64 | # Chutzpah Test files
65 | _Chutzpah*
66 |
67 | # Visual C++ cache files
68 | ipch/
69 | *.aps
70 | *.ncb
71 | *.opensdf
72 | *.sdf
73 | *.cachefile
74 |
75 | # Visual Studio profiler
76 | *.psess
77 | *.vsp
78 | *.vspx
79 |
80 | # TFS 2012 Local Workspace
81 | $tf/
82 |
83 | # Guidance Automation Toolkit
84 | *.gpState
85 |
86 | # ReSharper is a .NET coding add-in
87 | _ReSharper*/
88 | *.[Rr]e[Ss]harper
89 | *.DotSettings.user
90 |
91 | # JustCode is a .NET coding addin-in
92 | .JustCode
93 |
94 | # TeamCity is a build add-in
95 | _TeamCity*
96 |
97 | # DotCover is a Code Coverage Tool
98 | *.dotCover
99 |
100 | # NCrunch
101 | _NCrunch_*
102 | .*crunch*.local.xml
103 |
104 | # MightyMoose
105 | *.mm.*
106 | AutoTest.Net/
107 |
108 | # Web workbench (sass)
109 | .sass-cache/
110 |
111 | # Installshield output folder
112 | [Ee]xpress/
113 |
114 | # DocProject is a documentation generator add-in
115 | DocProject/buildhelp/
116 | DocProject/Help/*.HxT
117 | DocProject/Help/*.HxC
118 | DocProject/Help/*.hhc
119 | DocProject/Help/*.hhk
120 | DocProject/Help/*.hhp
121 | DocProject/Help/Html2
122 | DocProject/Help/html
123 |
124 | # Click-Once directory
125 | publish/
126 |
127 | # Publish Web Output
128 | *.[Pp]ublish.xml
129 | *.azurePubxml
130 | # TODO: Comment the next line if you want to checkin your web deploy settings
131 | # but database connection strings (with potential passwords) will be unencrypted
132 | *.pubxml
133 | *.publishproj
134 |
135 | # NuGet Packages
136 | *.nupkg
137 | # The packages folder can be ignored because of Package Restore
138 | **/packages/*
139 | # except build/, which is used as an MSBuild target.
140 | !**/packages/build/
141 | # If using the old MSBuild-Integrated Package Restore, uncomment this:
142 | #!**/packages/repositories.config
143 |
144 | # Windows Azure Build Output
145 | csx/
146 | *.build.csdef
147 |
148 | # Windows Store app package directory
149 | AppPackages/
150 |
151 | # Others
152 | sql/
153 | *.Cache
154 | ClientBin/
155 | [Ss]tyle[Cc]op.*
156 | ~$*
157 | *~
158 | *.dbmdl
159 | *.dbproj.schemaview
160 | *.pfx
161 | *.publishsettings
162 | node_modules/
163 |
164 | # RIA/Silverlight projects
165 | Generated_Code/
166 |
167 | # Backup & report files from converting an old project file
168 | # to a newer Visual Studio version. Backup files are not needed,
169 | # because we have git ;-)
170 | _UpgradeReport_Files/
171 | Backup*/
172 | UpgradeLog*.XML
173 | UpgradeLog*.htm
174 |
175 | # SQL Server files
176 | *.mdf
177 | *.ldf
178 |
179 | # Business Intelligence projects
180 | *.rdl.data
181 | *.bim.layout
182 | *.bim_*.settings
183 |
184 | # Microsoft Fakes
185 | FakesAssemblies/
186 |
187 | # =========================
188 | # Operating System Files
189 | # =========================
190 |
191 | # OSX
192 | # =========================
193 |
194 | .DS_Store
195 | .AppleDouble
196 | .LSOverride
197 |
198 | # Thumbnails
199 | ._*
200 |
201 | # Files that might appear on external disk
202 | .Spotlight-V100
203 | .Trashes
204 |
205 | # Directories potentially created on remote AFP share
206 | .AppleDB
207 | .AppleDesktop
208 | Network Trash Folder
209 | Temporary Items
210 | .apdisk
211 |
212 | # Windows
213 | # =========================
214 |
215 | # Windows image file caches
216 | Thumbs.db
217 | ehthumbs.db
218 |
219 | # Folder config file
220 | Desktop.ini
221 |
222 | # Recycle Bin used on file shares
223 | $RECYCLE.BIN/
224 |
225 | # Windows Installer files
226 | *.cab
227 | *.msi
228 | *.msm
229 | *.msp
230 |
231 | # Windows shortcuts
232 | *.lnk
233 |
--------------------------------------------------------------------------------
/src/GlyphExporter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(VisualStudioVersion)
5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
6 | Program
7 | $(DevEnvDir)\devenv.exe
8 | /rootsuffix Exp
9 | true
10 | Normal
11 |
12 |
13 |
14 | bin\CI\
15 | CODE_ANALYSIS;TRACE
16 | true
17 | pdbonly
18 | AnyCPU
19 | true
20 | prompt
21 | MinimumRecommendedRules.ruleset
22 | False
23 |
24 |
25 |
26 | Debug
27 | AnyCPU
28 | 2.0
29 | {BBE8E5B4-11D9-4272-8D9C-63830EBB80C3}
30 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
31 | Library
32 | Properties
33 | MadsKristensen.GlyphExporter
34 | GlyphExporter
35 | false
36 |
37 |
38 | v4.6
39 |
40 |
41 | true
42 | full
43 | false
44 | bin\Debug\
45 | DEBUG;TRACE
46 | prompt
47 | 4
48 |
49 |
50 | pdbonly
51 | true
52 | bin\Release\
53 | TRACE
54 | prompt
55 | 4
56 | true
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | True
73 | True
74 | GlyphExporter.vsct
75 |
76 |
77 |
78 |
79 | source.extension.vsixmanifest
80 |
81 |
82 |
83 |
84 | Resources\LICENSE
85 | true
86 |
87 |
88 | source.extension.vsixmanifest
89 |
90 |
91 | Designer
92 | VsixManifestGenerator
93 | source.extension.resx
94 |
95 |
96 |
97 |
98 | Menus.ctmenu
99 | VsctGenerator
100 | GlyphExporter.cs
101 |
102 |
103 |
104 |
105 | true
106 |
107 |
108 | true
109 |
110 |
111 |
112 |
113 | True
114 | True
115 | source.extension.vsixmanifest
116 | true
117 | VSPackage
118 |
119 |
120 |
121 |
122 | 14.0.68-pre
123 |
124 |
125 | 15.8.3252
126 | runtime; build; native; contentfiles; analyzers
127 | all
128 |
129 |
130 |
131 | true
132 |
133 |
134 |
135 |
142 |
--------------------------------------------------------------------------------
/src/source.extension.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Glyph Exporter
122 |
123 |
124 | Exports all glyph icons to image files
125 |
126 |
127 |
128 | source.extension.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
129 |
130 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Looking to contribute something? **Here's how you can help.**
4 |
5 | Please take a moment to review this document in order to make the contribution
6 | process easy and effective for everyone involved.
7 |
8 | Following these guidelines helps to communicate that you respect the time of
9 | the developers managing and developing this open source project. In return,
10 | they should reciprocate that respect in addressing your issue or assessing
11 | patches and features.
12 |
13 |
14 | ## Using the issue tracker
15 |
16 | The issue tracker is the preferred channel for [bug reports](#bug-reports),
17 | [features requests](#feature-requests) and
18 | [submitting pull requests](#pull-requests), but please respect the
19 | following restrictions:
20 |
21 | * Please **do not** use the issue tracker for personal support requests. Stack
22 | Overflow is a better place to get help.
23 |
24 | * Please **do not** derail or troll issues. Keep the discussion on topic and
25 | respect the opinions of others.
26 |
27 | * Please **do not** open issues or pull requests which *belongs to* third party
28 | components.
29 |
30 |
31 | ## Bug reports
32 |
33 | A bug is a _demonstrable problem_ that is caused by the code in the repository.
34 | Good bug reports are extremely helpful, so thanks!
35 |
36 | Guidelines for bug reports:
37 |
38 | 1. **Use the GitHub issue search** — check if the issue has already been
39 | reported.
40 |
41 | 2. **Check if the issue has been fixed** — try to reproduce it using the
42 | latest `master` or development branch in the repository.
43 |
44 | 3. **Isolate the problem** — ideally create an
45 | [SSCCE](http://www.sscce.org/) and a live example.
46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.)
47 | or creating a sample GitHub repository is also helpful.
48 |
49 |
50 | A good bug report shouldn't leave others needing to chase you up for more
51 | information. Please try to be as detailed as possible in your report. What is
52 | your environment? What steps will reproduce the issue? What browser(s) and OS
53 | experience the problem? Do other browsers show the bug differently? What
54 | would you expect to be the outcome? All these details will help people to fix
55 | any potential bugs.
56 |
57 | Example:
58 |
59 | > Short and descriptive example bug report title
60 | >
61 | > A summary of the issue and the Visual Studio, browser, OS environments
62 | > in which it occurs. If suitable, include the steps required to reproduce the bug.
63 | >
64 | > 1. This is the first step
65 | > 2. This is the second step
66 | > 3. Further steps, etc.
67 | >
68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium.
69 | >
70 | > Any other information you want to share that is relevant to the issue being
71 | > reported. This might include the lines of code that you have identified as
72 | > causing the bug, and potential solutions (and your opinions on their
73 | > merits).
74 |
75 |
76 | ## Feature requests
77 |
78 | Feature requests are welcome. But take a moment to find out whether your idea
79 | fits with the scope and aims of the project. It's up to *you* to make a strong
80 | case to convince the project's developers of the merits of this feature. Please
81 | provide as much detail and context as possible.
82 |
83 |
84 | ## Pull requests
85 |
86 | Good pull requests, patches, improvements and new features are a fantastic
87 | help. They should remain focused in scope and avoid containing unrelated
88 | commits.
89 |
90 | **Please ask first** before embarking on any significant pull request (e.g.
91 | implementing features, refactoring code, porting to a different language),
92 | otherwise you risk spending a lot of time working on something that the
93 | project's developers might not want to merge into the project.
94 |
95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the
96 | project (indentation, accurate comments, etc.) and any other requirements
97 | (such as test coverage).
98 |
99 | Adhering to the following process is the best way to get your work
100 | included in the project:
101 |
102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
103 | and configure the remotes:
104 |
105 | ```bash
106 | # Clone your fork of the repo into the current directory
107 | git clone https://github.com//.git
108 | # Navigate to the newly cloned directory
109 | cd
110 | # Assign the original repo to a remote called "upstream"
111 | git remote add upstream https://github.com/madskristensen/.git
112 | ```
113 |
114 | 2. If you cloned a while ago, get the latest changes from upstream:
115 |
116 | ```bash
117 | git checkout master
118 | git pull upstream master
119 | ```
120 |
121 | 3. Create a new topic branch (off the main project development branch) to
122 | contain your feature, change, or fix:
123 |
124 | ```bash
125 | git checkout -b
126 | ```
127 |
128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit
129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
130 | or your code is unlikely be merged into the main project. Use Git's
131 | [interactive rebase](https://help.github.com/articles/interactive-rebase)
132 | feature to tidy up your commits before making them public. Also, prepend name of the feature
133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`"
134 |
135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch:
136 |
137 | ```bash
138 | git pull [--rebase] upstream master
139 | ```
140 |
141 | 6. Push your topic branch up to your fork:
142 |
143 | ```bash
144 | git push origin
145 | ```
146 |
147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
148 | with a clear title and description against the `master` branch.
149 |
150 |
151 | ## Code guidelines
152 |
153 | - Always use proper indentation.
154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure
155 | `Place 'System' directives first when sorting usings` option is enabled (checked).
156 | - Before committing, organize usings for each updated C# source file. Either you can
157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension
158 | like [BatchFormat](http://visualstudiogallery.msdn.microsoft.com/a7f75c34-82b4-4357-9c66-c18e32b9393e).
159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines
160 | to fix CA issues. Code Analysis commits can be made separately.
161 |
--------------------------------------------------------------------------------
/src/GlyphExporterPackage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Design;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Reflection;
6 | using System.Runtime.InteropServices;
7 | using System.Threading;
8 | using System.Windows;
9 | using System.Windows.Forms;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using Microsoft;
13 | using Microsoft.VisualStudio.ComponentModelHost;
14 | using Microsoft.VisualStudio.Imaging;
15 | using Microsoft.VisualStudio.Imaging.Interop;
16 | using Microsoft.VisualStudio.Language.Intellisense;
17 | using Microsoft.VisualStudio.Shell;
18 | using Microsoft.VisualStudio.Shell.Interop;
19 |
20 | namespace MadsKristensen.GlyphExporter
21 | {
22 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
23 | [InstalledProductRegistration("#110", "#112", Vsix.Version, IconResourceID = 400)]
24 | [ProvideMenuResource("Menus.ctmenu", 1)]
25 | [Guid(PackageGuids.guidGlyphExporterPkgString)]
26 | public sealed class GlyphExporterPackage : AsyncPackage
27 | {
28 | private IGlyphService _glyphService;
29 | private IVsImageService2 _imageService;
30 |
31 | protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress progress)
32 | {
33 | await base.InitializeAsync(cancellationToken, progress);
34 |
35 | // When initialized asynchronously, we *may* be on a background thread at this point.
36 | // Do any initialization that requires the UI thread after switching to the UI thread.
37 | // Otherwise, remove the switch to the UI thread if you don't need it.
38 | await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
39 |
40 | var model = (IComponentModel)await GetServiceAsync(typeof(SComponentModel));
41 | Assumes.Present(model);
42 | _glyphService = model.GetService();
43 |
44 | _imageService = await GetServiceAsync(typeof(SVsImageService)) as IVsImageService2;
45 | Assumes.Present(_imageService);
46 |
47 | var mcs = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
48 | Assumes.Present(mcs);
49 |
50 | var cmdGlyphId = new CommandID(PackageGuids.guidGlyphExporterCmdSet, PackageIds.cmdidGlyph);
51 | var menuGlyph = new MenuCommand(ButtonClicked, cmdGlyphId);
52 | mcs.AddCommand(menuGlyph);
53 | }
54 |
55 | private void ButtonClicked(object sender, EventArgs e)
56 | {
57 | ThreadHelper.ThrowIfNotOnUIThread();
58 |
59 | var folder = GetFolder();
60 |
61 | if (!string.IsNullOrEmpty(folder) && Directory.Exists(folder))
62 | {
63 | SaveImagesToDisk(Path.Combine(folder, "images"));
64 | SaveGlyphsToDisk(Path.Combine(folder, "glyphs"));
65 | }
66 | }
67 |
68 | private void SaveImagesToDisk(string folder)
69 | {
70 | ThreadHelper.ThrowIfNotOnUIThread();
71 |
72 | PropertyInfo[] monikers = typeof(KnownMonikers).GetProperties(BindingFlags.Static | BindingFlags.Public);
73 |
74 | var imageAttributes = new ImageAttributes
75 | {
76 | Flags = (uint)_ImageAttributesFlags.IAF_RequiredFlags,
77 | ImageType = (uint)_UIImageType.IT_Bitmap,
78 | Format = (uint)_UIDataFormat.DF_WPF,
79 | Dpi = 96,
80 | LogicalHeight = 16,
81 | LogicalWidth = 16,
82 | StructSize = Marshal.SizeOf(typeof(ImageAttributes))
83 | };
84 |
85 | WriteableBitmap sprite = null;
86 | var count = 0;
87 | var letter = ' ';
88 |
89 | foreach (PropertyInfo monikerName in monikers)
90 | {
91 | var moniker = (ImageMoniker)monikerName.GetValue(null, null);
92 | IVsUIObject result = _imageService.GetImage(moniker, imageAttributes);
93 |
94 | if (monikerName.Name[0] != letter)
95 | {
96 | if (sprite != null)
97 | {
98 | sprite.Unlock();
99 | SaveBitmapToDisk(sprite, Path.Combine(folder, "_sprites", letter + ".png"));
100 | }
101 |
102 | var items = monikers.Count(m => m.Name[0] == monikerName.Name[0]);
103 | sprite = new WriteableBitmap(16, 16 * (items), 96, 96, PixelFormats.Pbgra32, null);
104 | sprite.Lock();
105 | letter = monikerName.Name[0];
106 | count = 0;
107 | }
108 |
109 | result.get_Data(out var data);
110 |
111 | if (data == null)
112 | {
113 | continue;
114 | }
115 |
116 | var glyph = data as BitmapSource;
117 | var fileName = Path.Combine(folder, monikerName.Name + ".png");
118 |
119 | var stride = glyph.PixelWidth * (glyph.Format.BitsPerPixel / 8);
120 | var buffer = new byte[stride * glyph.PixelHeight];
121 | glyph.CopyPixels(buffer, stride, 0);
122 |
123 | sprite.WritePixels(new Int32Rect(0, count, glyph.PixelWidth, glyph.PixelHeight), buffer, stride, 0);
124 | count += 16;
125 |
126 | SaveBitmapToDisk(glyph, fileName);
127 | }
128 |
129 | // Save the last image sprite to disk
130 | sprite.Unlock();
131 | SaveBitmapToDisk(sprite, Path.Combine(folder, "_sprites", letter + ".png"));
132 | }
133 |
134 |
135 | private void SaveGlyphsToDisk(string folder)
136 | {
137 | Array groups = Enum.GetValues(typeof(StandardGlyphGroup));
138 | Array items = Enum.GetValues(typeof(StandardGlyphItem));
139 |
140 | foreach (var groupName in groups)
141 | {
142 | var count = 0;
143 | var sprite = new WriteableBitmap(16, 16 * (items.Length), 96, 96, PixelFormats.Pbgra32, null);
144 | sprite.Lock();
145 |
146 | foreach (var itemName in items)
147 | {
148 | var group = (StandardGlyphGroup)groupName;
149 | var item = (StandardGlyphItem)itemName;
150 |
151 | if (!(_glyphService.GetGlyph(group, item) is BitmapSource glyph))
152 | {
153 | continue;
154 | }
155 |
156 | var fileName = Path.Combine(folder, group.ToString(), item.ToString() + ".png");
157 |
158 | SaveBitmapToDisk(glyph, fileName);
159 |
160 | var stride = glyph.PixelWidth * (glyph.Format.BitsPerPixel / 8);
161 | var data = new byte[stride * glyph.PixelHeight];
162 | glyph.CopyPixels(data, stride, 0);
163 |
164 | sprite.WritePixels(
165 | new Int32Rect(0, count, glyph.PixelWidth, glyph.PixelHeight),
166 | data, stride, 0);
167 |
168 | count += 16;
169 | }
170 |
171 | sprite.Unlock();
172 | SaveBitmapToDisk(sprite, Path.Combine(folder, "_sprites", groupName + ".png"));
173 | }
174 | }
175 |
176 | private static void SaveBitmapToDisk(BitmapSource glyph, string fileName)
177 | {
178 | Directory.CreateDirectory(Path.GetDirectoryName(fileName));
179 |
180 | using (var fileStream = new FileStream(fileName, FileMode.Create))
181 | {
182 | BitmapEncoder encoder = new PngBitmapEncoder();
183 | encoder.Frames.Add(BitmapFrame.Create(glyph));
184 | encoder.Save(fileStream);
185 | }
186 | }
187 |
188 | private static string GetFolder()
189 | {
190 | using (var dialog = new FolderBrowserDialog())
191 | {
192 | dialog.RootFolder = Environment.SpecialFolder.DesktopDirectory;
193 | dialog.ShowDialog();
194 |
195 | return dialog.SelectedPath;
196 | }
197 | }
198 | }
199 | }
200 |
--------------------------------------------------------------------------------