Updated files to use recommended patterns based on VS recommendations. Everything should work the same.

This commit is contained in:
Michael 2021-02-06 16:41:59 -06:00
parent 4c38cbb33c
commit 7e2546fe21
6 changed files with 16 additions and 20 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -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);