├── .gitattributes
├── .gitignore
├── ModernWinver.sln
├── ModernWinver
├── AboutPage.xaml
├── AboutPage.xaml.cs
├── AdvancedPage.xaml
├── AdvancedPage.xaml.cs
├── App.config
├── App.xaml
├── App.xaml.cs
├── FodyWeavers.xml
├── FodyWeavers.xsd
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── ModernWinver.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── SystemPage.xaml
├── SystemPage.xaml.cs
├── ThemePage.xaml
├── ThemePage.xaml.cs
└── about.ico
└── README.md
/.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
--------------------------------------------------------------------------------
/ModernWinver.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30717.126
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernWinver", "ModernWinver\ModernWinver.csproj", "{7AC06503-D394-4424-8F3E-6E9EEB7F1515}"
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 | {7AC06503-D394-4424-8F3E-6E9EEB7F1515}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {7AC06503-D394-4424-8F3E-6E9EEB7F1515}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {7AC06503-D394-4424-8F3E-6E9EEB7F1515}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {7AC06503-D394-4424-8F3E-6E9EEB7F1515}.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 = {587A1415-AB30-43FF-AADC-65D450F4B8F9}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/ModernWinver/AboutPage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | The Windows 10 operating system and its user interface are protected by trademark and other pending or existing intellectual property rights in the United States and other countries/regions.This product is licensed under the
21 |
25 | Microsoft Software Licence Terms
26 | to:
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/ModernWinver/AboutPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Management;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Navigation;
16 | using System.Windows.Shapes;
17 | using System.Diagnostics;
18 | using Microsoft.VisualBasic;
19 | using Newtonsoft.Json;
20 | using Microsoft.Win32;
21 |
22 | namespace ModernWinver
23 | {
24 | ///
25 | /// Interaction logic for AboutPage.xaml
26 | ///
27 | public partial class AboutPage : Page
28 | {
29 | MainWindow mw = (MainWindow)Application.Current.MainWindow;
30 | public AboutPage()
31 | {
32 | InitializeComponent();
33 |
34 | // Actually sets all the labels
35 | valueCopyright.Content = "© " + mw.vals.CopyrightYear + " Microsoft Corporation. All rights reserved.";
36 | valueEdition.Content = mw.vals.Edition;
37 | valueVersion.Content = mw.vals.Version;
38 | valueBuild.Content = mw.vals.Build;
39 | valueUser.Content = mw.vals.User;
40 | if (mw.vals.IsLocal)
41 | {
42 | valueWorkgroup.Content = mw.vals.SystemName;
43 | labelWorkgroup.Content = "Computer";
44 | }
45 | else
46 | {
47 | valueWorkgroup.Content = mw.vals.Workgroup;
48 | labelWorkgroup.Content = "Workgroup";
49 | }
50 | mw.addLog("Initialised ABOUT");
51 | }
52 |
53 | private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
54 | {
55 | Process.Start(e.Uri.ToString());
56 | }
57 |
58 | private void buttonLaunchSettings_Click(object sender, RoutedEventArgs e)
59 | {
60 | Process.Start("ms-settings:about");
61 | mw.Close();
62 | }
63 |
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/ModernWinver/AdvancedPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ModernWinver/AdvancedPage.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.IO;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 | using ModernWpf;
17 |
18 | namespace ModernWinver
19 | {
20 | ///
21 | /// Interaction logic for AdvancedPage.xaml
22 | ///
23 | public partial class AdvancedPage : Page
24 | {
25 | MainWindow mw = (MainWindow)Application.Current.MainWindow;
26 |
27 | public AdvancedPage()
28 | {
29 | InitializeComponent();
30 | }
31 |
32 | private void applyDebugButton_Click(object sender, RoutedEventArgs e)
33 | {
34 | if (debugToggle0.IsOn) // ForceThemeOverride
35 | {
36 | debugToggle0.IsEnabled = false;
37 | ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
38 | }
39 |
40 | if (debugToggle1.IsOn) // ForceColourOverride
41 | {
42 | debugToggle1.IsEnabled = false;
43 | ThemeManager.Current.AccentColor = Colors.Red;
44 | }
45 |
46 | if (debugToggle2.IsOn) // DestroyWinverJson
47 | {
48 | debugToggle2.IsEnabled = false;
49 | File.Delete(mw.ValuesPath);
50 | }
51 |
52 | if (debugToggle3.IsOn) // HangUIThread
53 | {
54 | debugToggle3.IsEnabled = false;
55 |
56 | while (true)
57 | {
58 |
59 | }
60 | }
61 |
62 | if (debugToggle4.IsOn) // ForceUnmanagedResize
63 | {
64 | debugToggle4.IsEnabled = false;
65 | mw.Width = 450;
66 | mw.Height = 450;
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/ModernWinver/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ModernWinver/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ModernWinver/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 ModernWinver
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ModernWinver/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ModernWinver/FodyWeavers.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
13 |
14 |
15 |
16 |
17 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
18 |
19 |
20 |
21 |
22 | A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
23 |
24 |
25 |
26 |
27 | A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
28 |
29 |
30 |
31 |
32 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks.
33 |
34 |
35 |
36 |
37 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks.
38 |
39 |
40 |
41 |
42 | The order of preloaded assemblies, delimited with line breaks.
43 |
44 |
45 |
46 |
47 |
48 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.
49 |
50 |
51 |
52 |
53 | Controls if .pdbs for reference assemblies are also embedded.
54 |
55 |
56 |
57 |
58 | Controls if (.NET Core) runtime assemblies are also embedded.
59 |
60 |
61 |
62 |
63 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.
64 |
65 |
66 |
67 |
68 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.
69 |
70 |
71 |
72 |
73 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.
74 |
75 |
76 |
77 |
78 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.
79 |
80 |
81 |
82 |
83 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
84 |
85 |
86 |
87 |
88 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.
89 |
90 |
91 |
92 |
93 | A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
94 |
95 |
96 |
97 |
98 | A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.
99 |
100 |
101 |
102 |
103 | A list of unmanaged 32 bit assembly names to include, delimited with |.
104 |
105 |
106 |
107 |
108 | A list of unmanaged 64 bit assembly names to include, delimited with |.
109 |
110 |
111 |
112 |
113 | The order of preloaded assemblies, delimited with |.
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
122 |
123 |
124 |
125 |
126 | A comma-separated list of error codes that can be safely ignored in assembly verification.
127 |
128 |
129 |
130 |
131 | 'false' to turn off automatic generation of the XML Schema file.
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/ModernWinver/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | About
32 |
33 |
34 | System
35 |
36 |
37 | Theme
38 |
39 |
40 | Debug
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ModernWinver/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Management;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Navigation;
16 | using System.Windows.Shapes;
17 | using System.Diagnostics;
18 | using Microsoft.VisualBasic;
19 | using Microsoft.VisualBasic.Devices;
20 | using Newtonsoft.Json;
21 | using Microsoft.Win32;
22 | using ModernWpf.Controls;
23 |
24 | namespace ModernWinver
25 | {
26 | ///
27 | /// Interaction logic for MainWindow.xaml
28 | ///
29 | public partial class MainWindow
30 | {
31 | AboutPage LoadedAboutPage;
32 | SystemPage LoadedSystemPage;
33 | ThemePage LoadedThemePage;
34 | AdvancedPage LoadedAdvancedPage;
35 | public Values vals = new Values();
36 | DateTime current = DateTime.Now;
37 | public string ValuesPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "winver.json");
38 | string filePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "winver.log");
39 | bool UpToDate = true;
40 | string m = "";
41 | public void addLog(string message)
42 | {
43 | m = $"[{DateTime.Now}] {message}\n";
44 | File.AppendAllText(filePath, m);
45 | }
46 |
47 | public MainWindow()
48 | {
49 | File.Create(filePath).Close();
50 | addLog("Started!");
51 | if (!File.Exists(ValuesPath))
52 | {
53 | File.Create(ValuesPath).Close();
54 | UpToDate = false;
55 | addLog("Created winver.json");
56 | }
57 | else
58 | {
59 | addLog("winver.json already exists");
60 | string JsonList = File.ReadAllText(ValuesPath);
61 |
62 | if (JsonList == "")
63 | {
64 | UpToDate = false;
65 |
66 | }
67 | else
68 | {
69 | vals = JsonConvert.DeserializeObject(JsonList);
70 | double check = current.DayOfYear / 7;
71 | int checkInt = Convert.ToInt32(Math.Round(check));
72 | if (vals.WeekOfYear != checkInt || vals.WeekOfYear == -1 || vals.RAMSpeed == null)
73 | {
74 | UpToDate = false;
75 | }
76 | }
77 | }
78 |
79 | // ////////////////////////////// //
80 | // Gets new values for everything //
81 | // ////////////////////////////// //
82 | if (UpToDate == false)
83 | {
84 | buttonRefresh_Click(null, null);
85 | addLog("Initial loading complete");
86 | }
87 | else
88 | {
89 | addLog("Creating pages");
90 | LoadedAboutPage = new AboutPage();
91 | LoadedSystemPage = new SystemPage();
92 | LoadedThemePage = new ThemePage();
93 | LoadedAdvancedPage = new AdvancedPage();
94 | addLog("Page creation complete");
95 | }
96 |
97 | InitializeComponent();
98 | addLog("Initialised MAIN");
99 | }
100 |
101 | private void buttonOK_Click(object sender, RoutedEventArgs e)
102 | {
103 | addLog("Closing");
104 | Close();
105 | }
106 |
107 | private void NavView_Loaded(object sender, RoutedEventArgs e)
108 | {
109 | NavView.IsBackButtonVisible = NavigationViewBackButtonVisible.Collapsed;
110 | // Set the initial SelectedItem
111 | foreach (NavigationViewItemBase item in NavView.MenuItems)
112 | {
113 | if (item is NavigationViewItem && item.Tag.ToString() == "Page_Settings")
114 | {
115 | NavView.SelectedItem = item;
116 | break;
117 | }
118 | }
119 | NavView.SelectedItem = NavView.MenuItems[0];
120 | ContentFrame.Navigate(LoadedAboutPage);
121 | addLog("NavView loaded successfully");
122 | }
123 |
124 | private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
125 | {
126 | if (args.IsSettingsInvoked)
127 | {
128 | // Unused atm because NavigationView hates me
129 | Process.Start("ms-settings:");
130 | Close();
131 | }
132 | else
133 | {
134 | if (args.InvokedItem is TextBlock ItemContent)
135 | {
136 | switch (ItemContent.Tag)
137 | {
138 | case "AboutPage":
139 | ContentFrame.Navigate(LoadedAboutPage);
140 | break;
141 |
142 | case "SystemPage":
143 | ContentFrame.Navigate(LoadedSystemPage);
144 | break;
145 |
146 | case "ThemePage":
147 | ContentFrame.Navigate(LoadedThemePage);
148 | break;
149 |
150 | case "AdvancedPage":
151 | ContentFrame.Navigate(LoadedAdvancedPage);
152 |
153 | break;
154 | }
155 | }
156 | }
157 | }
158 |
159 | public struct Values
160 | {
161 | public int WeekOfYear;
162 | public string CopyrightYear;
163 | public string Edition;
164 | public string Version;
165 | public string Build;
166 | public string User;
167 | public bool IsLocal;
168 | public string SystemName;
169 | public string Workgroup;
170 |
171 | public string CPU;
172 | public string Arch;
173 | public double RAM;
174 | public string RAMType;
175 | public string RAMSpeed;
176 | public string Path;
177 | public double Storage;
178 | public double FreeSpace;
179 |
180 | }
181 |
182 | static int GetTotalMemoryInGibibytes()
183 | {
184 | return Convert.ToInt32(new ComputerInfo().TotalPhysicalMemory / 1073741824) + 1;
185 | }
186 |
187 | private long GetTotalFreeSpace()
188 | {
189 | long tfs = 0;
190 | foreach (DriveInfo drive in DriveInfo.GetDrives())
191 | {
192 | if (drive.IsReady)
193 | {
194 | tfs = tfs + drive.TotalFreeSpace / 1073741824;
195 | }
196 | }
197 | return tfs;
198 | }
199 |
200 | private long GetTotalSpace()
201 | {
202 | long tfs = 0;
203 | foreach (DriveInfo drive in DriveInfo.GetDrives())
204 | {
205 | if (drive.IsReady)
206 | {
207 | tfs = tfs + drive.TotalSize / 1073741824;
208 | }
209 | }
210 | return tfs;
211 | }
212 |
213 | // Magically absorbs different types of RAM
214 | public static string RamType()
215 | {
216 | int type = 0;
217 |
218 | ConnectionOptions connection = new ConnectionOptions();
219 | connection.Impersonation = ImpersonationLevel.Impersonate;
220 | ManagementScope scope = new ManagementScope("\\\\.\\root\\CIMV2", connection);
221 | scope.Connect();
222 | ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_PhysicalMemory");
223 | ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
224 | foreach (ManagementObject queryObj in searcher.Get())
225 | {
226 | type = Convert.ToInt32(queryObj["MemoryType"]);
227 | }
228 |
229 | return TypeString(type);
230 | }
231 |
232 | // Details different types of RAM
233 | private static string TypeString(int type)
234 | {
235 | string outValue;
236 | switch (type)
237 | {
238 | case 0x0: outValue = "Probably DDR4"; break;
239 | case 0x1: outValue = "Other"; break;
240 | case 0x2: outValue = "DRAM"; break;
241 | case 0x3: outValue = "Synchronous DRAM"; break;
242 | case 0x4: outValue = "Cache DRAM"; break;
243 | case 0x5: outValue = "EDO"; break;
244 | case 0x6: outValue = "EDRAM"; break;
245 | case 0x7: outValue = "VRAM"; break;
246 | case 0x8: outValue = "SRAM"; break;
247 | case 0x9: outValue = "RAM"; break;
248 | case 0xa: outValue = "ROM"; break;
249 | case 0xb: outValue = "Flash"; break;
250 | case 0xc: outValue = "EEPROM"; break;
251 | case 0xd: outValue = "FEPROM"; break;
252 | case 0xe: outValue = "EPROM"; break;
253 | case 0xf: outValue = "CDRAM"; break;
254 | case 0x10: outValue = "3DRAM"; break;
255 | case 0x11: outValue = "SDRAM"; break;
256 | case 0x12: outValue = "SGRAM"; break;
257 | case 0x13: outValue = "RDRAM"; break;
258 | case 0x14: outValue = "DDR"; break;
259 | case 0x15: outValue = "DDR2"; break;
260 | case 0x16: outValue = "DDR2 FB-DIMM"; break;
261 | case 0x17: outValue = "Undefined 23"; break;
262 | case 0x18: outValue = "DDR3"; break;
263 | case 0x19: outValue = "FBD2"; break;
264 | case 0x1a: outValue = "DDR4"; break;
265 | default: outValue = "Undefined"; break;
266 | }
267 |
268 | return outValue;
269 | }
270 |
271 | public static string SysInfo(string loc, string request)
272 | {
273 | string info = "";
274 |
275 | ConnectionOptions connection = new ConnectionOptions();
276 | connection.Impersonation = ImpersonationLevel.Impersonate;
277 | ManagementScope scope = new ManagementScope("\\\\.\\root\\CIMV2", connection);
278 | scope.Connect();
279 | ObjectQuery query = new ObjectQuery("SELECT * FROM " + loc);
280 | ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
281 | foreach (ManagementObject queryObj in searcher.Get())
282 | {
283 | if (queryObj[request] != null)
284 | {
285 | info = queryObj[request].ToString();
286 | }
287 | else
288 | {
289 | info = "[Unknown]";
290 | }
291 | }
292 | return info;
293 | }
294 |
295 | private void buttonRefresh_Click(object sender, RoutedEventArgs e)
296 | {
297 | addLog("Refreshing!");
298 | //refreshProgress.IsActive = true;
299 | RegistryKey CurrentVersionKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
300 | RegistryKey CentralProcessorKey = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0");
301 | addLog("RegKeys open");
302 |
303 | // Easy stuff
304 | vals.WeekOfYear = current.DayOfYear / 7;
305 | vals.CopyrightYear = current.Year.ToString();
306 | vals.Version = (string)CurrentVersionKey.GetValue("DisplayVersion");
307 | if (vals.Version == "")
308 | {
309 | vals.Version = (string)CurrentVersionKey.GetValue("ReleaseId");
310 | if (vals.Version == "2009")
311 | {
312 | vals.Version = "20H2";
313 | }
314 | }
315 | addLog("ES set");
316 |
317 | vals.Build = (string)CurrentVersionKey.GetValue("CurrentBuild") + "." + CurrentVersionKey.GetValue("UBR").ToString();
318 | vals.User = (string)CurrentVersionKey.GetValue("RegisteredOwner");
319 | vals.SystemName = System.Net.Dns.GetHostName();
320 | vals.Workgroup = (string)CurrentVersionKey.GetValue("RegisteredOrganization");
321 | vals.CPU = (string)CentralProcessorKey.GetValue("ProcessorNameString");
322 | vals.Arch = SysInfo("Win32_Processor", "Architecture");
323 | vals.RAM = GetTotalMemoryInGibibytes();
324 | vals.RAMType = RamType();
325 | vals.RAMSpeed = SysInfo("Win32_PhysicalMemory", "Speed");
326 | vals.Path = @"C:\Windows"; //(string)CurrentVersionKey.GetValue("PathName"); TODO: find a proper way to get this because im lazy
327 | vals.FreeSpace = GetTotalFreeSpace();
328 | vals.Storage = GetTotalSpace();
329 | addLog("CS set");
330 |
331 | switch (SysInfo("Win32_Processor", "Architecture"))
332 | {
333 | case null:
334 | vals.Arch = "Real"; break;
335 | case "0":
336 | vals.Arch = "x86"; break;
337 | case "1":
338 | vals.Arch = "MIPS"; break;
339 | case "2":
340 | vals.Arch = "Alpha"; break;
341 | case "3":
342 | vals.Arch = "PowerPC"; break;
343 | case "5":
344 | vals.Arch = "ARM"; break;
345 | case "6":
346 | vals.Arch = "ia64"; break;
347 | case "9":
348 | vals.Arch = "AMD64"; break;
349 | case "12":
350 | vals.Arch = "ARM64"; break;
351 | default:
352 | vals.Arch = "Unknown"; break;
353 | }
354 |
355 | addLog("Arch set");
356 |
357 |
358 | // Get edition of Windows 10 because apparently that's bloody impossible any other way and the registry returns me wrong values
359 | try
360 | {
361 | ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_OperatingSystem");
362 |
363 | foreach (ManagementObject queryObj in searcher.Get())
364 | {
365 | vals.Edition = ((string)queryObj["Caption"]).Replace("Microsoft ", "");
366 | if (vals.Edition.Contains("Insider Preview") && vals.Version == "")
367 | {
368 | vals.Version = "vNext";
369 | }
370 | vals.Edition = vals.Edition.Replace("Insider Preview", "");
371 |
372 | }
373 | addLog("WMI success");
374 | }
375 | catch (ManagementException ex)
376 | {
377 | addLog("WMI failure");
378 | MessageBox.Show("An error occurred while querying for WMI data: " + ex.Message);
379 | }
380 |
381 | // This just prevents you from having a blank username
382 | if (vals.User == "" || vals.User == "user name")
383 | {
384 | vals.User = "(Unknown user)";
385 | }
386 | addLog("UN set");
387 |
388 | // If in org, show org name, else show hostname
389 | if (vals.Workgroup == "" || vals.Workgroup == "org name")
390 | {
391 | vals.IsLocal = true;
392 | }
393 | else
394 | {
395 | vals.IsLocal = false;
396 | }
397 | addLog("WG set");
398 |
399 | // Writes files
400 | File.Create(ValuesPath).Close();
401 | File.WriteAllText(ValuesPath, JsonConvert.SerializeObject(vals, Formatting.Indented));
402 | addLog("winver.json written");
403 |
404 | // Reloads pages
405 | LoadedAboutPage = new AboutPage();
406 | LoadedSystemPage = new SystemPage();
407 | LoadedThemePage = new ThemePage();
408 | LoadedAdvancedPage = new AdvancedPage();
409 | if (ContentFrame != null)
410 | {
411 | ContentFrame.Navigate(LoadedAboutPage);
412 | NavView.SelectedItem = NavView.MenuItems[0];
413 | }
414 | addLog("Pages regenerated");
415 | //refreshProgress.IsActive = false;
416 | }
417 |
418 | private void WindowsLogo_Click(object sender, MouseButtonEventArgs e)
419 | {
420 |
421 | if (System.Windows.Input.Keyboard.IsKeyDown(Key.F1))
422 | {
423 | if (DebugTag.Visibility == Visibility.Hidden)
424 | {
425 | DebugTag.Visibility = Visibility.Visible;
426 | }
427 | else
428 | {
429 | DebugTag.Visibility = Visibility.Hidden;
430 | }
431 | }
432 | }
433 | }
434 | }
435 |
--------------------------------------------------------------------------------
/ModernWinver/ModernWinver.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {7AC06503-D394-4424-8F3E-6E9EEB7F1515}
8 | WinExe
9 | ModernWinver
10 | ModernWinver
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 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 | about.ico
41 |
42 |
43 |
44 |
45 | True
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | 4.0
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | MSBuild:Compile
66 | Designer
67 |
68 |
69 | AdvancedPage.xaml
70 |
71 |
72 | SystemPage.xaml
73 |
74 |
75 | ThemePage.xaml
76 |
77 |
78 | Designer
79 | MSBuild:Compile
80 |
81 |
82 | Designer
83 | MSBuild:Compile
84 |
85 |
86 | MSBuild:Compile
87 | Designer
88 |
89 |
90 | AboutPage.xaml
91 |
92 |
93 | App.xaml
94 | Code
95 |
96 |
97 | MainWindow.xaml
98 | Code
99 |
100 |
101 | Designer
102 | MSBuild:Compile
103 |
104 |
105 | Designer
106 | MSBuild:Compile
107 |
108 |
109 |
110 |
111 | Code
112 |
113 |
114 | True
115 | True
116 | Resources.resx
117 |
118 |
119 | True
120 | Settings.settings
121 | True
122 |
123 |
124 | ResXFileCodeGenerator
125 | Resources.Designer.cs
126 |
127 |
128 | SettingsSingleFileGenerator
129 | Settings.Designer.cs
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 | 1.4.0
138 |
139 |
140 | 5.0.0-alpha0281
141 | runtime; build; native; contentfiles; analyzers; buildtransitive
142 | all
143 |
144 |
145 | 4.0.2
146 |
147 |
148 | 0.8.0
149 |
150 |
151 | 0.9.3-preview.201204.0
152 |
153 |
154 | 12.0.3
155 |
156 |
157 | 0.7.78
158 |
159 |
160 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/ModernWinver/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 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("ModernWinver")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("ModernWinver")]
15 | [assembly: AssemblyCopyright("Copyright © 2020")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/ModernWinver/Properties/Resources.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 ModernWinver.Properties
13 | {
14 | ///
15 | /// A strongly-typed resource class, for looking up localized strings, etc.
16 | ///
17 | // This class was auto-generated by the StronglyTypedResourceBuilder
18 | // class via a tool like ResGen or Visual Studio.
19 | // To add or remove a member, edit your .ResX file then rerun ResGen
20 | // with the /str option, or rebuild your VS project.
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 | /// Returns the cached ResourceManager instance used by this class.
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("ModernWinver.Properties.Resources", typeof(Resources).Assembly);
47 | resourceMan = temp;
48 | }
49 | return resourceMan;
50 | }
51 | }
52 |
53 | ///
54 | /// Overrides the current thread's CurrentUICulture property for all
55 | /// resource lookups using this strongly typed resource class.
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 |
--------------------------------------------------------------------------------
/ModernWinver/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 |
--------------------------------------------------------------------------------
/ModernWinver/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 ModernWinver.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 |
--------------------------------------------------------------------------------
/ModernWinver/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ModernWinver/SystemPage.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 |
--------------------------------------------------------------------------------
/ModernWinver/SystemPage.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.Diagnostics;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 | using System.Globalization;
17 | using System.ComponentModel;
18 |
19 | namespace ModernWinver
20 | {
21 | ///
22 | /// Interaction logic for SystemPage.xaml
23 | ///
24 | public partial class SystemPage : Page
25 | {
26 | public static MainWindow mw = (MainWindow)Application.Current.MainWindow;
27 | public SystemPage()
28 | {
29 | // RAM Background Worker
30 | BackgroundWorker bwRAM = new BackgroundWorker();
31 | bwRAM.WorkerReportsProgress = true;
32 | bwRAM.DoWork += BwRam_DoWork;
33 | bwRAM.ProgressChanged += BwRam_ProgressChanged;
34 | bwRAM.RunWorkerAsync();
35 | mw.addLog("RAM worker started");
36 |
37 | // CPU Background Worker
38 | BackgroundWorker bwCPU = new BackgroundWorker();
39 | bwCPU.WorkerReportsProgress = true;
40 | bwCPU.DoWork += BwCpu_DoWork;
41 | bwCPU.ProgressChanged += BwCpu_ProgressChanged;
42 | bwCPU.RunWorkerAsync();
43 | mw.addLog("CPU worker started");
44 |
45 | InitializeComponent();
46 | valueSystemName.Content = mw.vals.SystemName;
47 | valueCPU.Content = mw.vals.CPU;
48 | valueArch.Content = mw.vals.Arch;
49 | mw.addLog("Added some CPU details or something");
50 |
51 | valueRAM.Content = Math.Round(mw.vals.RAM / GetUnits(mw.vals.RAM).Value, 2).ToString() + $" {GetUnits(mw.vals.RAM).Key} " + mw.vals.RAMType + " @ " + mw.vals.RAMSpeed.ToString() + " MT/s";
52 | valueMaxRAM.Content = $"{mw.vals.RAM} {GetUnits(mw.vals.RAM).Key}";
53 | valueZeroRAM.Content = $"0 {GetUnits(mw.vals.RAM).Key}";
54 | mw.addLog("More stuff idk what probably RAM");
55 |
56 | valuePath.Content = mw.vals.Path;
57 | mw.addLog("oh amazing a path >:c");
58 |
59 | valueFreeStorage.Content = Math.Round(mw.vals.FreeSpace/GetUnits(mw.vals.FreeSpace).Value, 2).ToString() + $" {GetUnits(mw.vals.FreeSpace).Key} free";
60 | valueStorage.Content = Math.Round((mw.vals.Storage - mw.vals.FreeSpace) / GetUnits(mw.vals.Storage - mw.vals.FreeSpace).Value, 2).ToString() + $" {GetUnits(mw.vals.Storage - mw.vals.FreeSpace).Key} used";
61 | valueTotalStorage.Content = Math.Round(mw.vals.Storage / GetUnits(mw.vals.Storage).Value, 2).ToString() + $" {GetUnits(mw.vals.Storage).Key}";
62 | mw.addLog("ugh storage too why bother");
63 |
64 | double storagePercentage = (mw.vals.FreeSpace / mw.vals.Storage) * 100;
65 | progressStorage.Value = 100 - ((storagePercentage > 100) ? 100 : storagePercentage);
66 | mw.addLog("oh shut up nobody cares about the percentage of storage they've used");
67 | }
68 |
69 |
70 |
71 | private void BwCpu_ProgressChanged(object sender, ProgressChangedEventArgs e)
72 | {
73 | progressCPU.Value = e.ProgressPercentage;
74 | }
75 |
76 | private void BwCpu_DoWork(object sender, DoWorkEventArgs e)
77 | {
78 | PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
79 | BackgroundWorker bw = sender as BackgroundWorker;
80 | while (true)
81 | {
82 | dynamic val = cpuCounter.NextValue();
83 | bw.ReportProgress((int)val);
84 | System.Threading.Thread.Sleep(1000);
85 | }
86 | }
87 |
88 | private void BwRam_ProgressChanged(object sender, ProgressChangedEventArgs e)
89 | {
90 | progressRAM.Value = e.ProgressPercentage;
91 | }
92 |
93 | private void BwRam_DoWork(object sender, DoWorkEventArgs e)
94 | {
95 | PerformanceCounter ramCounter = new PerformanceCounter("Memory", "Available MBytes");
96 | BackgroundWorker bw = sender as BackgroundWorker;
97 | int totalRAM = Convert.ToInt32(mw.vals.RAM);
98 | while (true)
99 | {
100 | dynamic val = ramCounter.NextValue();
101 | bw.ReportProgress(100 - (((int)val * 100) / (totalRAM * 1024)));
102 | System.Threading.Thread.Sleep(1000);
103 | }
104 | }
105 |
106 | public KeyValuePair GetUnits(double valueInGB)
107 | {
108 | if (valueInGB / 1024 > 1)
109 | {
110 | if ((valueInGB / 1024) / 1024 > 1)
111 | {
112 | return new KeyValuePair("PB", 1048576);
113 | }
114 | return new KeyValuePair("TB", 1024);
115 | }
116 | if (valueInGB <= 1)
117 | {
118 | return new KeyValuePair("MB", 1/1024);
119 | }
120 | mw.addLog("amazing i got some units");
121 | return new KeyValuePair("GB", 1);
122 | }
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/ModernWinver/ThemePage.xaml:
--------------------------------------------------------------------------------
1 |
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 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ModernWinver/ThemePage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media;
9 | using System.Windows.Media.Imaging;
10 | using System.Windows.Controls;
11 | using Microsoft.Win32;
12 | using System.Runtime.InteropServices;
13 | using System.Windows.Data;
14 | using System.Windows.Documents;
15 | using System.Windows.Input;
16 | using System.Management;
17 | using System.Windows.Navigation;
18 | using System.Windows.Shapes;
19 | using System.Diagnostics;
20 | using Microsoft.VisualBasic;
21 | using Microsoft.VisualBasic.Devices;
22 | using Newtonsoft.Json;
23 | using ModernWpf.Controls;
24 | using ColorHelper;
25 | using PInvoke;
26 |
27 |
28 | namespace ModernWinver
29 | {
30 | ///
31 | /// Interaction logic for ThemePage.xaml
32 | ///
33 | ///
34 |
35 | public partial class ThemePage
36 | {
37 | public static MainWindow mw = (MainWindow)Application.Current.MainWindow;
38 | public string wallpaperPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString() + @"\Microsoft\Windows\Themes\TranscodedWallpaper";
39 | public string wallpaperReal = "";
40 |
41 | public ThemePage()
42 | {
43 | try
44 | {
45 | mw.addLog("Starting init of theme page because apparently this breaks??");
46 | try
47 | {
48 | mw.addLog("Trying to initialise page...");
49 | InitializeComponent();
50 | mw.addLog("Success!!");
51 | }
52 | catch (Exception aaaaaa)
53 | {
54 | mw.addLog(aaaaaa.ToString());
55 | throw;
56 | }
57 | try
58 | {
59 | valueWallpaper.ImageSource = new BitmapImage(new Uri(wallpaperPath, UriKind.Absolute));
60 | }
61 | catch (Exception)
62 | {
63 | mw.addLog("EVERYTHING IS ON FIRE AAAAAAAAAAAAAAAAAAAAAAA");
64 | }
65 | //SystemParametersInfo(0x0073, )
66 | updateSecondaryColourRect();
67 | mw.addLog("Initialised THEME");
68 | }
69 | catch (Exception AAAAAAAAAA)
70 | {
71 | mw.addLog(AAAAAAAAAA.ToString());
72 |
73 | throw;
74 | }
75 |
76 | }
77 |
78 | private void updateSecondaryColourRect()
79 | {
80 | try
81 | {
82 | RegistryKey colourKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Colors");
83 | string[] secondaryColour = ((string)colourKey.GetValue("Hilight")).Split(' ');
84 | colourKey.Close();
85 | RGB rgb = new RGB(Convert.ToByte(secondaryColour[0]), Convert.ToByte(secondaryColour[1]), Convert.ToByte(secondaryColour[2]));
86 | textBoxSecondaryAccent.Text = $"#{ColorHelper.ColorConverter.RgbToHex(rgb)}";
87 | secondaryRectColour.Color = Color.FromArgb(255, rgb.R, rgb.G, rgb.B);
88 | mw.addLog("USCR complete");
89 | }
90 | catch (Exception aaaa)
91 | {
92 | mw.addLog(aaaa.ToString());
93 | throw;
94 | }
95 | }
96 |
97 | private void buttonUpdateSecondaryAccent_Click(object sender, RoutedEventArgs e)
98 | {
99 | if (System.Windows.Input.Keyboard.IsKeyDown(Key.LeftShift) || System.Windows.Input.Keyboard.IsKeyDown(Key.RightShift))
100 | {
101 | RegistryKey colourKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Colors", true);
102 | colourKey.SetValue("Hilight", "0 120 215");
103 | colourKey.SetValue("MenuHilight", $"0 120 215");
104 | colourKey.SetValue("HotTrackingColor", "0 102 204");
105 | colourKey.Close();
106 | updateSecondaryColourRect();
107 | //User32.SendMessage(User32.HWND_BROADCAST, User32.WindowMessage.WM_THEMECHANGED, IntPtr.Zero, IntPtr.Zero);
108 | // This *should* make colours update automagically but instead it just hangs MWV
109 | }
110 | else
111 | {
112 | try
113 | {
114 | RGB rgb = ColorHelper.ColorConverter.HexToRgb(new HEX(textBoxSecondaryAccent.Text.Replace("#", "")));
115 | RegistryKey colourKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Colors", true);
116 | colourKey.SetValue("Hilight", $"{rgb.R} {rgb.G} {rgb.B}");
117 | colourKey.SetValue("MenuHilight", $"{rgb.R} {rgb.G} {rgb.B}");
118 | colourKey.SetValue("HotTrackingColor", $"{rgb.R} {rgb.G} {rgb.B}");
119 | colourKey.Close();
120 | updateSecondaryColourRect();
121 | }
122 | catch (FormatException)
123 | {
124 | updateSecondaryColourRect();
125 | }
126 |
127 | //User32.SendMessage(User32.HWND_BROADCAST, User32.WindowMessage.WM_THEMECHANGED, IntPtr.Zero, IntPtr.Zero);
128 | // This *should* make colours update automagically but instead it just hangs MWV
129 | }
130 |
131 | }
132 |
133 | [DllImport("user32.dll")]
134 | public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWubUbu);
135 |
136 | private void buttonPersonalisation_Click(object sender, RoutedEventArgs e)
137 | {
138 | Process.Start("ms-settings:personalization");
139 | mw.Close();
140 | }
141 |
142 | private void buttonOpen_Click(object sender, RoutedEventArgs e)
143 | {
144 | if (!File.Exists($"{wallpaperPath}.jpg"))
145 | {
146 | File.Copy(wallpaperPath, $"{wallpaperPath}.jpg");
147 | }
148 | Process.Start($"{wallpaperPath}.jpg");
149 | mw.Close();
150 | }
151 |
152 | private void buttonUpdatePrimaryAccent_Click(object sender, RoutedEventArgs e)
153 | {
154 | Process.Start("ms-settings:colors");
155 | mw.Close();
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/ModernWinver/about.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/torchgm/WpfModernWinver/a6208d0cbcc87143cce4f0b1838ef27270cc8881/ModernWinver/about.ico
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ModernWinver
2 |
3 | ## This application is deprecated. A new version of Modern Winver compatible with Windows 10 and 11 is available [here](https://github.com/torchgm/NewModernWinver).
4 |
5 |
6 | A modern replacement for the About Windows screen relying on ModernWPF and FluentWPF, providing details on Windows and your PC.
7 |
8 | 
9 |
10 | ## Features
11 | - Provides information on your current installation of Windows
12 | - Gives you a quick overview of system specs and resource usage
13 | - Presents quick access to your current wallpaper and accent colour
14 | - Allows you to customise your secondary accent colour (used for file selection, text highlighting etc.)
15 |
16 | ## Installation
17 | Right now there's no official installation, and the executable will work standalone. If you want to be able to start it from the command line, I recommend you copy it to `C:\Windows\` and rename it something short like `mwv.exe` for now, or just run `copy /-Y ModernWinver.exe C:\Windows\mwv.exe` as administrator from the folder in which you downloaded ModernWinver.exe. Once you've done this, you can open ModernWinver by typing `mwv` into Start, Command Prompt or Run and pressing enter. I'll probably make a more competent installer in the future but for now this is pretty quick and effective.
18 |
--------------------------------------------------------------------------------