Skip to content

Commit 2964f38

Browse files
committed
Corrected libary > library typo
1 parent d95a8a4 commit 2964f38

File tree

2 files changed

+74
-72
lines changed

2 files changed

+74
-72
lines changed

TinyNvidiaUpdateChecker/Handlers/LibaryHandler.cs renamed to TinyNvidiaUpdateChecker/Handlers/LibraryHandler.cs

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,78 +5,79 @@
55
using System.IO;
66
using System.Runtime.InteropServices;
77
using System.Text;
8-
using static TinyNvidiaUpdateChecker.Handlers.LibaryHandler;
8+
using static TinyNvidiaUpdateChecker.Handlers.LibraryHandler;
99

1010
namespace TinyNvidiaUpdateChecker.Handlers
1111
{
1212

13-
class LibaryHandler
13+
class LibraryHandler
1414
{
1515
private static bool is64 = Environment.Is64BitOperatingSystem;
1616

17-
static List<LibaryRegistryPath> libaryRegistryList =
17+
static List<LibraryRegistryPath> libraryRegistryList
18+
=
1819
[
1920
/* WinRAR */
2021

21-
new(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinRAR archiver", "InstallLocation", Libary.WINRAR),
22-
new(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\WinRAR archiver", "InstallLocation", Libary.WINRAR),
22+
new(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinRAR archiver", "InstallLocation", Library.WINRAR),
23+
new(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\WinRAR archiver", "InstallLocation", Library.WINRAR),
2324

2425
/* 7-Zip */
2526

2627
// amd64 installer on amd64 system, or x86 on x86 system
27-
new(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip", "InstallLocation", Libary.SEVENZIP),
28+
new(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip", "InstallLocation", Library.SEVENZIP),
2829

2930
// x86 intaller on amd64 system
30-
new(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip", "InstallLocation", Libary.SEVENZIP),
31+
new(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip", "InstallLocation", Library.SEVENZIP),
3132

3233
// MSI amd64 installer on amd64 system, or x86 on x86 system
33-
new(Registry.LocalMachine, @"SOFTWARE\7-Zip", "Path", Libary.SEVENZIP),
34+
new(Registry.LocalMachine, @"SOFTWARE\7-Zip", "Path", Library.SEVENZIP),
3435

3536
// MSI x86 intaller on amd64 system
36-
new (Registry.LocalMachine, @"SOFTWARE\WOW6432Node\7-Zip", "Path", Libary.SEVENZIP),
37+
new (Registry.LocalMachine, @"SOFTWARE\WOW6432Node\7-Zip", "Path", Library.SEVENZIP),
3738
];
3839

39-
static List<LibaryPath> libaryPathList =
40+
static List<LibraryPath> LibraryPathList =
4041
[
4142
/* 7-Zip */
4243

4344
// scoop in user profile
44-
new([Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "scoop", "apps", "7zip", "current"], Libary.SEVENZIP),
45+
new([Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "scoop", "apps", "7zip", "current"], Library.SEVENZIP),
4546

4647
// scoop in Program Data
47-
new([Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "scoop", "apps", "7zip", "current"], Libary.SEVENZIP),
48+
new([Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "scoop", "apps", "7zip", "current"], Library.SEVENZIP),
4849

4950
// scoop local environment variable
50-
new([Environment.GetEnvironmentVariable("SCOOP", EnvironmentVariableTarget.User), "apps", "7zip", "current"], Libary.SEVENZIP),
51+
new([Environment.GetEnvironmentVariable("SCOOP", EnvironmentVariableTarget.User), "apps", "7zip", "current"], Library.SEVENZIP),
5152

5253
// scoop global environment variable
53-
new([Environment.GetEnvironmentVariable("SCOOP_GLOBAL", EnvironmentVariableTarget.Machine), "apps", "7zip", "current"], Libary.SEVENZIP),
54+
new([Environment.GetEnvironmentVariable("SCOOP_GLOBAL", EnvironmentVariableTarget.Machine), "apps", "7zip", "current"], Library.SEVENZIP),
5455

5556
// amd64 on amd64 system, or x86 on x86 system
56-
new([Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "7-Zip"], Libary.SEVENZIP),
57+
new([Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "7-Zip"], Library.SEVENZIP),
5758

5859
// x86 on amd64 system
59-
new([Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "7-Zip"], Libary.SEVENZIP),
60+
new([Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "7-Zip"], Library.SEVENZIP),
6061

6162
// custom path defined in config file
62-
new([ConfigurationHandler.ReadSetting("Custom 7-ZIP Libary Path", null, false)], Libary.SEVENZIP),
63+
new([ConfigurationHandler.ReadSetting("Custom 7-ZIP Library Path", null, false)], Library.SEVENZIP),
6364

6465
/* WinRAR */
65-
new([ConfigurationHandler.ReadSetting("Custom WinRAR Libary Path", null, false)], Libary.WINRAR)
66+
new([ConfigurationHandler.ReadSetting("Custom WinRAR Library Path", null, false)], Library.WINRAR)
6667
];
6768

68-
static Dictionary<string, Libary> cliList = new() {
69-
{"NanaZipC", Libary.NANAZIP} // NanaZip
69+
static Dictionary<string, Library> cliList = new() {
70+
{"NanaZipC", Library.NANAZIP} // NanaZip
7071
};
7172

72-
public enum Libary
73+
public enum Library
7374
{
7475
SEVENZIP,
7576
WINRAR,
7677
NANAZIP
7778
}
7879

79-
public static LibaryFile EvaluateLibary()
80+
public static LibraryFile EvaluateLibrary()
8081
{
8182
foreach (var entry in cliList)
8283
{
@@ -98,13 +99,14 @@ public static LibaryFile EvaluateLibary()
9899
if (process.ExitCode == 0)
99100
{
100101
string directoryPath = Path.GetDirectoryName(exePath) + @"\";
101-
return new LibaryFile(directoryPath, entry.Value, true);
102+
return new LibraryFile(directoryPath, entry.Value, true);
102103
}
103104
}
104105
catch { }
105106
}
106107

107-
foreach (var entry in libaryRegistryList)
108+
foreach (var entry in libraryRegistryList)
109+
108110
{
109111
try
110112
{
@@ -128,23 +130,23 @@ public static LibaryFile EvaluateLibary()
128130
path += @"\";
129131
}
130132

131-
string exe = LibaryPath.GetExeFromLibary(entry.libary);
133+
string exe = LibraryPath.GetExeFromLibrary(entry.library);
132134
string exePath = Path.Combine(path, exe);
133135

134136
if (Path.Exists(exePath))
135137
{
136-
return new LibaryFile(path, entry.libary, true);
138+
return new LibraryFile(path, entry.library, true);
137139
}
138140
}
139141
catch { }
140142
}
141143

142-
foreach (var entry in libaryPathList)
144+
foreach (var entry in LibraryPathList)
143145
{
144146
if (entry.validate())
145147
{
146148
string path = Path.Combine(entry.path) + @"\";
147-
return new LibaryFile(path, entry.libary, true);
149+
return new LibraryFile(path, entry.library, true);
148150
}
149151
}
150152

@@ -167,22 +169,22 @@ public static string GetMainModuleFileName(this Process process, int buffer = 10
167169
}
168170
}
169171

170-
class LibaryPath
172+
class LibraryPath
171173
{
172174
public string[] path;
173-
public LibaryHandler.Libary libary;
175+
public LibraryHandler.Library library;
174176

175-
public LibaryPath(string[] path, LibaryHandler.Libary libary)
177+
public LibraryPath(string[] path, LibraryHandler.Library library)
176178
{
177179
this.path = path;
178-
this.libary = libary;
180+
this.library = library;
179181
}
180182

181183
public bool validate()
182184
{
183185
try
184186
{
185-
string exe = GetExeFromLibary(this.libary);
187+
string exe = GetExeFromLibrary(this.library);
186188
string path = Path.Combine([.. this.path, exe]);
187189

188190
if (Path.Exists(path))
@@ -195,30 +197,30 @@ public bool validate()
195197
return false;
196198
}
197199

198-
public static string GetExeFromLibary(Libary libary)
200+
public static string GetExeFromLibrary(Library library)
199201
{
200-
return libary switch
202+
return library switch
201203
{
202-
Libary.SEVENZIP => "7z.exe",
203-
Libary.WINRAR => "winrar.exe",
204+
Library.SEVENZIP => "7z.exe",
205+
Library.WINRAR => "winrar.exe",
204206
_ => "",
205207
};
206208
}
207209
}
208210

209-
class LibaryRegistryPath
211+
class LibraryRegistryPath
210212
{
211213
public RegistryKey key;
212214
public string path;
213215
public string name;
214-
public LibaryHandler.Libary libary;
216+
public LibraryHandler.Library library;
215217

216-
public LibaryRegistryPath(RegistryKey key, string path, string name, LibaryHandler.Libary libary)
218+
public LibraryRegistryPath(RegistryKey key, string path, string name, LibraryHandler.Library library)
217219
{
218220
this.key = key;
219221
this.path = path;
220222
this.name = name;
221-
this.libary = libary;
223+
this.library = library;
222224
}
223225

224226
public RegistryHive getRegistryHive()
@@ -237,43 +239,43 @@ public RegistryHive getRegistryHive()
237239
/// <summary>
238240
/// Libaries that can extract the nvidia driver file
239241
/// </summary>
240-
class LibaryFile
242+
class LibraryFile
241243
{
242244
string installationDirectory;
243-
LibaryHandler.Libary libary;
245+
LibraryHandler.Library library;
244246
bool isInstalled;
245247

246-
public LibaryFile(string installationDirectory, LibaryHandler.Libary libary, bool isInstalled)
248+
public LibraryFile(string installationDirectory, LibraryHandler.Library library, bool isInstalled)
247249
{
248250
this.installationDirectory = installationDirectory;
249-
this.libary = libary;
251+
this.library = library;
250252
this.isInstalled = isInstalled;
251253
}
252254

253-
public LibaryFile(LibaryHandler.Libary libary, bool isInstalled)
255+
public LibraryFile(LibraryHandler.Library library, bool isInstalled)
254256
{
255-
this.libary = libary;
257+
this.library = library;
256258
this.isInstalled = isInstalled;
257259
}
258260

259261
/// <summary>
260-
/// Is the libary installed?
262+
/// Is the library installed?
261263
/// </summary>
262264
public bool IsInstalled()
263265
{
264266
return isInstalled;
265267
}
266268

267269
/// <summary>
268-
/// Libary name
270+
/// Library name
269271
/// </summary>
270-
public LibaryHandler.Libary LibaryName()
272+
public LibraryHandler.Library LibraryName()
271273
{
272-
return libary;
274+
return library;
273275
}
274276

275277
/// <summary>
276-
/// Get the absolute path to the libary, ending with a backslash
278+
/// Get the absolute path to the library, ending with a backslash
277279
/// </summary>
278280
public string GetInstallationDirectory()
279281
{
@@ -282,7 +284,7 @@ public string GetInstallationDirectory()
282284

283285
public override string ToString()
284286
{
285-
return $"installationDirectory: {installationDirectory} | libary: {libary} | isInstalled: {isInstalled}";
287+
return $"installationDirectory: {installationDirectory} | library: {library} | isInstalled: {isInstalled}";
286288
}
287289
}
288290
}

TinyNvidiaUpdateChecker/MainConsole.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ class MainConsole
7272
/// </summary>
7373
public static bool noPrompt = false;
7474

75-
/// <summary>
75+
/// <summary>
7676
/// Dry run
7777
/// </summary>
78-
public static bool dryRun = false;
78+
public static bool dryRun = false;
7979

8080
/// <summary>
8181
/// Enable extended information
@@ -286,12 +286,12 @@ private static void CheckArgs(string[] args)
286286
if (arg.ToLower() == "--quiet") {
287287
showUI = false;
288288
}
289-
290-
else if (arg.ToLower() == "--noprompt") {
289+
290+
else if (arg.ToLower() == "--noprompt") {
291291
noPrompt = true;
292292
}
293293

294-
else if (arg.ToLower() == "--dry-run") {
294+
else if (arg.ToLower() == "--dry-run") {
295295
dryRun = true;
296296
}
297297

@@ -644,7 +644,7 @@ private static JObject GetDriverDownloadInfo(int gpuId, int osId, bool isDchDriv
644644
WriteLine();
645645
WriteLine(ex.ToString());
646646
}
647-
647+
648648
callExit(1);
649649
return null;
650650
}
@@ -680,8 +680,8 @@ private static void CheckDependencies()
680680
}
681681

682682
if (ConfigurationHandler.ReadSettingBool("Minimal install")) {
683-
if (LibaryHandler.EvaluateLibary() == null) {
684-
WriteLine("Doesn't seem like neither WinRAR or 7-Zip is installed! We are disabling the minimal install feature for you.");
683+
if (LibraryHandler.EvaluateLibrary() == null) {
684+
WriteLine("No compatible extract library was detected on the system. The minimal install feature has been disabled.");
685685
ConfigurationHandler.SetSetting("Minimal install", "false");
686686
}
687687
}
@@ -900,21 +900,21 @@ private static void MakeInstaller(bool silent, string savePath, string fileName)
900900
WriteLine();
901901
Write("Extracting drivers . . . ");
902902

903-
LibaryFile libaryFile = LibaryHandler.EvaluateLibary();
903+
LibraryFile libraryFile = LibraryHandler.EvaluateLibrary();
904904
using var process = new Process();
905-
LibaryHandler.Libary libary = libaryFile.LibaryName();
905+
LibraryHandler.Library library = libraryFile.LibraryName();
906906

907907
// Extract full driver to then analyze
908-
if (libary == LibaryHandler.Libary.WINRAR) {
908+
if (library == LibraryHandler.Library.WINRAR) {
909909
process.StartInfo = new ProcessStartInfo {
910-
FileName = libaryFile.GetInstallationDirectory() + "winrar.exe",
910+
FileName = libraryFile.GetInstallationDirectory() + "winrar.exe",
911911
WorkingDirectory = savePath,
912912
Arguments = $"x {fileName} -optemp -y",
913913
UseShellExecute = false
914914
};
915915

916916
if (silent) process.StartInfo.Arguments += " -ibck";
917-
} else if (libary == LibaryHandler.Libary.SEVENZIP) {
917+
} else if (library == LibraryHandler.Library.SEVENZIP) {
918918
process.StartInfo = new ProcessStartInfo {
919919
WorkingDirectory = savePath,
920920
Arguments = $"x {fileName} -otemp -y",
@@ -923,11 +923,11 @@ private static void MakeInstaller(bool silent, string savePath, string fileName)
923923
};
924924

925925
if (silent) {
926-
process.StartInfo.FileName = libaryFile.GetInstallationDirectory() + "7z.exe";
926+
process.StartInfo.FileName = libraryFile.GetInstallationDirectory() + "7z.exe";
927927
} else {
928-
process.StartInfo.FileName = libaryFile.GetInstallationDirectory() + "7zG.exe";
928+
process.StartInfo.FileName = libraryFile.GetInstallationDirectory() + "7zG.exe";
929929
}
930-
} else if (libary == LibaryHandler.Libary.NANAZIP) {
930+
} else if (library == LibraryHandler.Library.NANAZIP) {
931931
process.StartInfo = new ProcessStartInfo {
932932
WorkingDirectory = savePath,
933933
Arguments = $"x {fileName} -otemp -y",
@@ -1033,12 +1033,12 @@ private static void callExit(int exitNum)
10331033
WriteLine();
10341034
WriteLine("Press any key to exit...");
10351035
}
1036-
1036+
10371037
if (showUI & !noPrompt) Console.ReadKey(true);
10381038
FreeConsole();
10391039
Environment.Exit(exitNum);
1040-
}
1041-
1040+
}
1041+
10421042
private static bool DoesDriverFileSizeMatch(string absoluteFilePath) {
10431043
return new FileInfo(absoluteFilePath).Length == downloadFileSize;
10441044
}

0 commit comments

Comments
 (0)