From 7e2546fe218297deabff3858b06697278ff34b49 Mon Sep 17 00:00:00 2001 From: Michael Malloy Date: Sat, 6 Feb 2021 16:41:59 -0600 Subject: [PATCH] Updated files to use recommended patterns based on VS recommendations. Everything should work the same. --- Sharpii/HBC.cs | 4 ++-- Sharpii/IOS.cs | 8 +++++--- Sharpii/NUSD.cs | 8 +------- Sharpii/Program.cs | 6 +++--- Sharpii/TPL.cs | 2 +- Sharpii/WAD.cs | 8 ++++---- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Sharpii/HBC.cs b/Sharpii/HBC.cs index ddb4132..28cb4d5 100644 --- a/Sharpii/HBC.cs +++ b/Sharpii/HBC.cs @@ -108,8 +108,8 @@ namespace Sharpii { for (int n = i + 2; n < args.Length; n++) { - arguments = arguments + "\x0000"; - arguments = arguments + args[n]; + arguments += "\x0000"; + arguments += args[n]; } } break; diff --git a/Sharpii/IOS.cs b/Sharpii/IOS.cs index 6ebdb68..7466d3a 100644 --- a/Sharpii/IOS.cs +++ b/Sharpii/IOS.cs @@ -229,8 +229,10 @@ namespace Sharpii //Main part (most of it was borrowed from PatchIOS) try { - WAD ios = new WAD(); - ios.KeepOriginalFooter = true; + WAD ios = new WAD + { + KeepOriginalFooter = true + }; if (BeQuiet.quiet > 2) Console.Write("Loading File..."); @@ -312,7 +314,7 @@ namespace Sharpii if (output != "") { if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAD") - output = output + ".wad"; + output += ".wad"; } ios.Save(input); diff --git a/Sharpii/NUSD.cs b/Sharpii/NUSD.cs index 52ba29f..25c3286 100644 --- a/Sharpii/NUSD.cs +++ b/Sharpii/NUSD.cs @@ -379,7 +379,7 @@ namespace Sharpii if (output == "") { NoOut = true; - output = ios == "" ? id + "v" + version : ios.Substring(0, ios.Length - 4); + output = ios == "" ? id + "v" + version : ios[0..^4]; if (BeQuiet.quiet > 2) Console.WriteLine("No output specified, using {0}", output); } @@ -558,21 +558,18 @@ namespace Sharpii if (File.Exists(realout.Substring(0, index + 1) + ios)) File.Delete(realout.Substring(0, index + 1) + ios); File.Move(Path.Combine(temp, id.ToUpper() + "v" + version + ".wad"), realout.Substring(0, index + 1) + ios); - OperationDone = true; } else if (ios == "" && NoOut == true && LowercaseWad == false) { if (File.Exists(realout + ".wad")) File.Delete(realout + ".wad"); File.Move(Path.Combine(temp, id.ToUpper() + "v" + version + ".wad"), realout + ".wad"); - OperationDone = true; } else if (LowercaseWad == false && OperationDone == false) { if (File.Exists(realout)) File.Delete(realout); File.Move(Path.Combine(temp, id.ToUpper() + "v" + version + ".wad"), realout); - OperationDone = true; } else if (ios != "" && NoOut == true && LowercaseWad == true) { @@ -580,21 +577,18 @@ namespace Sharpii if (File.Exists(realout.Substring(0, index + 1) + ios)) File.Delete(realout.Substring(0, index + 1) + ios); File.Move(Path.Combine(temp, id.ToLower() + "v" + version + ".wad"), realout.Substring(0, index + 1) + ios); - OperationDone = true; } else if (ios == "" && NoOut == true && LowercaseWad == true) { if (File.Exists(realout + ".wad")) File.Delete(realout + ".wad"); File.Move(Path.Combine(temp, id.ToLower() + "v" + version + ".wad"), realout + ".wad"); - OperationDone = true; } else if (LowercaseWad == true && OperationDone == false) { if (File.Exists(realout)) File.Delete(realout); File.Move(Path.Combine(temp, id.ToLower() + "v" + version + ".wad"), realout); - OperationDone = true; } DeleteADir.DeleteDirectory(temp); } diff --git a/Sharpii/Program.cs b/Sharpii/Program.cs index 52bd7cb..bf71e2a 100644 --- a/Sharpii/Program.cs +++ b/Sharpii/Program.cs @@ -28,7 +28,7 @@ namespace Sharpii { if (args.Length < 1) { - help(); + Help(); Environment.Exit(0); } @@ -53,7 +53,7 @@ namespace Sharpii if (Function == "-H" || Function == "-HELP" || Function == "H" || Function == "HELP") { - help(); + Help(); gotSomewhere = true; } @@ -141,7 +141,7 @@ namespace Sharpii Environment.Exit(0); } - private static void help() + private static void Help() { Console.WriteLine(""); Console.WriteLine("Sharpii {0} - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version); diff --git a/Sharpii/TPL.cs b/Sharpii/TPL.cs index b28a14c..333a3be 100644 --- a/Sharpii/TPL.cs +++ b/Sharpii/TPL.cs @@ -238,7 +238,7 @@ namespace Sharpii Console.Write("Saving tpl file..."); if (output.Substring(output.Length - 4, 4).ToUpper() != ".TPL") - output = output + ".tpl"; + output += ".tpl"; tplfile.Save(output); diff --git a/Sharpii/WAD.cs b/Sharpii/WAD.cs index ea5772b..fcaa703 100644 --- a/Sharpii/WAD.cs +++ b/Sharpii/WAD.cs @@ -192,7 +192,7 @@ namespace Sharpii Console.WriteLine(" Korean: {0}\n", wad.ChannelTitles[7]); } Console.WriteLine("Title ID: {0}", wad.UpperTitleID); - Console.WriteLine("Full Title ID: {0}", wad.TitleID.ToString("X16").Substring(0, 8) + "-" + wad.TitleID.ToString("X16").Substring(8)); + Console.WriteLine("Full Title ID: {0}", wad.TitleID.ToString("X16").Substring(0, 8) + "-" + wad.TitleID.ToString("X16")[8..]); Console.WriteLine("IOS: {0}", ((int)wad.StartupIOS).ToString()); Console.WriteLine("Region: {0}", wad.Region); Console.WriteLine("Version: {0}", wad.TitleVersion); @@ -204,7 +204,7 @@ namespace Sharpii Console.Write("Saving file..."); if (output.Substring(output.Length - 4, 4).ToUpper() != ".TXT") - output = output + ".txt"; + output += ".txt"; TextWriter txt = new StreamWriter(output); txt.WriteLine("WAD Info:"); @@ -224,7 +224,7 @@ namespace Sharpii txt.WriteLine(" Korean: {0}", wad.ChannelTitles[7]); } txt.WriteLine("Title ID: {0}", wad.UpperTitleID); - txt.WriteLine("Full Title ID: {0}", wad.TitleID.ToString("X16").Substring(0, 8) + "-" + wad.TitleID.ToString("X16").Substring(8)); + txt.WriteLine("Full Title ID: {0}", wad.TitleID.ToString("X16").Substring(0, 8) + "-" + wad.TitleID.ToString("X16")[8..]); txt.WriteLine("IOS: {0}", ((int)wad.StartupIOS).ToString()); txt.WriteLine("Region: {0}", wad.Region); txt.WriteLine("Version: {0}", wad.TitleVersion); @@ -723,7 +723,7 @@ namespace Sharpii Console.Write("Saving file..."); if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAD") - output = output + ".wad"; + output += ".wad"; wad.Save(output);