Windows and Linux compatible port (Mac may work but untested.)

This commit is contained in:
Shadow Eevee 2020-01-17 21:45:36 -08:00
parent 0e9e33a7c1
commit 077f97b45a
11 changed files with 215 additions and 204 deletions

View file

@ -1,8 +1,10 @@
# Sharpii - A command line libWiiSharp tool # Sharpii - A command line libWiiSharp tool
# Fork Notes # Fork Notes
- Status: Ported locally, but Linux and Mac compiling isn't possible yet. The ported files will be uploaded soon. - Status: Ported and working! Mac untested.
- Purpose: A .Net Core port of Sharpii for use on Mac and Linux, intended for use with my Unix rewrite of the RC24 Patcher [Put Link Here], but it can be used for any purpose when it's done.
- Purpose: A .Net Core port of Sharpii for use on Mac and Linux, intended for use with my Unix rewrite of the RC24 Patcher but it can be used for any purpose.
- Issues/Pull Requests: All issues with this version of Sharpii should go in this fork's issue tracker. The issue is likely with the port and even if it isn't maybe I can fix it as I don't know if the original Sharpii creator is still active here. Pull requests are appreciated if they fix an issue, but it may take a bit to review. - Issues/Pull Requests: All issues with this version of Sharpii should go in this fork's issue tracker. The issue is likely with the port and even if it isn't maybe I can fix it as I don't know if the original Sharpii creator is still active here. Pull requests are appreciated if they fix an issue, but it may take a bit to review.
# Repo info # Repo info

27
Sharpii.csproj Normal file
View file

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="Sharpii\Properties\" />
<Folder Include="WadInstaller\Properties\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Costura.Fody" Version="4.1.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="libWiiSharp">
<HintPath>Sharpii\libWiiSharp.dll</HintPath>
</Reference>
<Reference Include="WadInstaller">
<HintPath>Sharpii\WadInstaller.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View file

@ -1,42 +1,25 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual C# Express 2010 # Visual Studio Version 16
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpii", "Sharpii\Sharpii.csproj", "{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}" VisualStudioVersion = 16.0.29709.97
EndProject MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WadInstaller", "WadInstaller\WadInstaller.csproj", "{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpii", "Sharpii.csproj", "{A5ABD4DA-DBAB-4304-BEB1-A52BC9D6516D}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|Any CPU.ActiveCfg = Debug|x86 {A5ABD4DA-DBAB-4304-BEB1-A52BC9D6516D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {A5ABD4DA-DBAB-4304-BEB1-A52BC9D6516D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|Mixed Platforms.Build.0 = Debug|x86 {A5ABD4DA-DBAB-4304-BEB1-A52BC9D6516D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|x86.ActiveCfg = Debug|x86 {A5ABD4DA-DBAB-4304-BEB1-A52BC9D6516D}.Release|Any CPU.Build.0 = Release|Any CPU
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|x86.Build.0 = Debug|x86
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|Any CPU.ActiveCfg = Release|x86
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|Mixed Platforms.ActiveCfg = Release|x86
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|Mixed Platforms.Build.0 = Release|x86
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|x86.ActiveCfg = Release|x86
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|x86.Build.0 = Release|x86
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|x86.ActiveCfg = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.Build.0 = Release|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D7A37F7C-1238-497F-8B97-F238108BBB4B}
EndGlobalSection
EndGlobal EndGlobal

View file

@ -63,15 +63,15 @@ namespace Sharpii
try try
{ {
//Now convert it //Now convert it
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading file..."); Console.Write("Loading file...");
Wave WavFile = libWiiSharp.BNS.BnsToWave(input); Wave WavFile = libWiiSharp.BNS.BnsToWave(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Saving wav..."); Console.Write("Saving wav...");
if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAV") if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAV")
@ -79,10 +79,10 @@ namespace Sharpii
WavFile.Save(output); WavFile.Save(output);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -130,28 +130,28 @@ namespace Sharpii
//Run main part, and check for exceptions //Run main part, and check for exceptions
try try
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading file..."); Console.Write("Loading file...");
BNS WavFile = new BNS(input); BNS WavFile = new BNS(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (loop == true) if (loop == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Applying loop"); Console.WriteLine("Applying loop");
WavFile.SetLoop(1); WavFile.SetLoop(1);
} }
if (mono == true) if (mono == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Converting to mono"); Console.WriteLine("Converting to mono");
WavFile.StereoToMono = true; WavFile.StereoToMono = true;
} }
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Saving BNS..."); Console.Write("Saving BNS...");
WavFile.Convert(); WavFile.Convert();
@ -161,10 +161,10 @@ namespace Sharpii
WavFile.Save(output); WavFile.Save(output);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -179,7 +179,7 @@ namespace Sharpii
public static void Wav2BNS_help() public static void Wav2BNS_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - BNS - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - BNS - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");

View file

@ -19,7 +19,6 @@ using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using libWiiSharp; using libWiiSharp;
using System.Windows.Forms;
namespace Sharpii namespace Sharpii
{ {
@ -99,7 +98,7 @@ namespace Sharpii
{ {
if (ip != "" && saveip == true) if (ip != "" && saveip == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Saving IP"); Console.WriteLine("Saving IP");
Environment.SetEnvironmentVariable("SharpiiIP", ip, EnvironmentVariableTarget.Machine); Environment.SetEnvironmentVariable("SharpiiIP", ip, EnvironmentVariableTarget.Machine);
} }
@ -113,40 +112,40 @@ namespace Sharpii
Console.WriteLine("ERROR: No IP set"); Console.WriteLine("ERROR: No IP set");
return; return;
} }
if (noip == true && Quiet.quiet > 2) if (noip == true && BeQuiet.quiet > 2)
Console.WriteLine("No IP set, using {0}", ip); Console.WriteLine("No IP set, using {0}", ip);
libWiiSharp.Protocol proto = Protocol.JODI; libWiiSharp.Protocol proto = Protocol.JODI;
if (Quiet.quiet > 2 && protocol == "HAXX") if (BeQuiet.quiet > 2 && protocol == "HAXX")
Console.WriteLine("Using old protocol"); Console.WriteLine("Using old protocol");
if (protocol == "HAXX") if (protocol == "HAXX")
proto = Protocol.HAXX; proto = Protocol.HAXX;
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading File..."); Console.Write("Loading File...");
HbcTransmitter file = new HbcTransmitter(proto, ip); HbcTransmitter file = new HbcTransmitter(proto, ip);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 2 && compress == true) if (BeQuiet.quiet > 2 && compress == true)
Console.Write("Compressing File..."); Console.Write("Compressing File...");
file.Compress = compress; file.Compress = compress;
if (Quiet.quiet > 2 && compress == true) if (BeQuiet.quiet > 2 && compress == true)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Sending file..."); Console.Write("Sending file...");
file.TransmitFile(Path.GetFileName(input) + arguments, File.ReadAllBytes(input)); file.TransmitFile(Path.GetFileName(input) + arguments, File.ReadAllBytes(input));
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
catch (Exception ex) catch (Exception ex)
@ -174,7 +173,7 @@ namespace Sharpii
return false; return false;
} }
if (!File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\WadInstaller.dll")) if (!File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll"))
{ {
Console.WriteLine("ERROR: WadInstaller.dll not found"); Console.WriteLine("ERROR: WadInstaller.dll not found");
Console.WriteLine("\n\nAttemp to download? [Y/N]"); Console.WriteLine("\n\nAttemp to download? [Y/N]");
@ -186,7 +185,7 @@ namespace Sharpii
{ {
Console.Write("\nGrabbing WadInstaller.dll..."); Console.Write("\nGrabbing WadInstaller.dll...");
WebClient DLwadInstaller = new WebClient(); WebClient DLwadInstaller = new WebClient();
DLwadInstaller.DownloadFile("https://github.com/mogzol/sharpii/raw/master/Sharpii/WadInstaller.dll", Path.GetDirectoryName(Application.ExecutablePath) + "\\WadInstaller.dll"); DLwadInstaller.DownloadFile("https://github.com/mogzol/sharpii/raw/master/Sharpii/WadInstaller.dll", Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll");
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
catch (Exception ex) catch (Exception ex)
@ -267,14 +266,14 @@ namespace Sharpii
{ {
if (ip != "" && saveip == true) if (ip != "" && saveip == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Saving IP"); Console.WriteLine("Saving IP");
Environment.SetEnvironmentVariable("SharpiiIP", ip, EnvironmentVariableTarget.Machine); Environment.SetEnvironmentVariable("SharpiiIP", ip, EnvironmentVariableTarget.Machine);
} }
if (ahb == true || ios == "") if (ahb == true || ios == "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Using AHBPROT"); Console.WriteLine("Using AHBPROT");
ios = "0"; ios = "0";
} }
@ -288,32 +287,32 @@ namespace Sharpii
Console.WriteLine("ERROR: No IP set"); Console.WriteLine("ERROR: No IP set");
return; return;
} }
if (noip == true && Quiet.quiet > 2) if (noip == true && BeQuiet.quiet > 2)
Console.WriteLine("No IP set, using {0}", ip); Console.WriteLine("No IP set, using {0}", ip);
libWiiSharp.Protocol proto = Protocol.JODI; libWiiSharp.Protocol proto = Protocol.JODI;
if (Quiet.quiet > 2 && protocol == "HAXX") if (BeQuiet.quiet > 2 && protocol == "HAXX")
Console.WriteLine("Using old protocol"); Console.WriteLine("Using old protocol");
if (protocol == "HAXX") if (protocol == "HAXX")
proto = Protocol.HAXX; proto = Protocol.HAXX;
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading File..."); Console.Write("Loading File...");
HbcTransmitter file = new HbcTransmitter(proto, ip); HbcTransmitter file = new HbcTransmitter(proto, ip);
byte[] Installer = WadInstaller.InstallerHelper.CreateInstaller(input, (byte)Convert.ToInt32(ios)).ToArray(); byte[] Installer = WadInstaller.InstallerHelper.CreateInstaller(input, (byte)Convert.ToInt32(ios)).ToArray();
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Sending file..."); Console.Write("Sending file...");
file.TransmitFile("WadInstaller.dol", Installer); file.TransmitFile("WadInstaller.dol", Installer);
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
catch (Exception ex) catch (Exception ex)
@ -331,7 +330,7 @@ namespace Sharpii
private static void SendDol_help() private static void SendDol_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - SendDol - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - SendDol - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");
@ -356,7 +355,7 @@ namespace Sharpii
public static void SendWad_help() public static void SendWad_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - SendWad - A tool by person66, using libWiiSharp.dll by leathl,", Version.version); Console.WriteLine("Sharpii {0} - SendWad - A tool by person66, using libWiiSharp.dll by leathl,", ProgramVersion.version);
Console.WriteLine(" and CRAP's installer by WiiCrazy/I.R.on"); Console.WriteLine(" and CRAP's installer by WiiCrazy/I.R.on");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");

View file

@ -131,12 +131,12 @@ namespace Sharpii
WAD ios = new WAD(); WAD ios = new WAD();
ios.KeepOriginalFooter = true; ios.KeepOriginalFooter = true;
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading File..."); Console.Write("Loading File...");
ios.LoadFile(input); ios.LoadFile(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
//Check if WAD is an IOS //Check if WAD is an IOS
@ -153,28 +153,28 @@ namespace Sharpii
//apply patches //apply patches
if (fs == true) if (fs == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Applying Fakesigning patch"); Console.WriteLine("Applying Fakesigning patch");
patcher.PatchFakeSigning(); patcher.PatchFakeSigning();
} }
if (es == true) if (es == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Applying ES_Identify patch"); Console.WriteLine("Applying ES_Identify patch");
patcher.PatchEsIdentify(); patcher.PatchEsIdentify();
} }
if (np == true) if (np == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Applying NAND permissions patch"); Console.WriteLine("Applying NAND permissions patch");
patcher.PatchNandPermissions(); patcher.PatchNandPermissions();
} }
if (vp == true) if (vp == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Applying Version patch"); Console.WriteLine("Applying Version patch");
patcher.PatchVP(); patcher.PatchVP();
} }
@ -184,14 +184,14 @@ namespace Sharpii
if (slot > -1) if (slot > -1)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Changing IOS slot to: {0}", slot); Console.WriteLine("Changing IOS slot to: {0}", slot);
ios.TitleID = (ulong)((1UL << 32) | (uint)slot); ios.TitleID = (ulong)((1UL << 32) | (uint)slot);
} }
if (version > -1) if (version > -1)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Changing title version to: {0}", version); Console.WriteLine("Changing title version to: {0}", version);
ios.TitleVersion = (ushort)version; ios.TitleVersion = (ushort)version;
} }
@ -199,13 +199,13 @@ namespace Sharpii
//check if output was set //check if output was set
if (output != "") if (output != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Saving to file: {0}", output); Console.WriteLine("Saving to file: {0}", output);
ios.Save(output); ios.Save(output);
} }
else else
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Saving file..."); Console.Write("Saving file...");
if (output != "") if (output != "")
@ -216,10 +216,10 @@ namespace Sharpii
ios.Save(input); ios.Save(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -237,7 +237,7 @@ namespace Sharpii
public static void IOS_help() public static void IOS_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - IOS - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - IOS - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(" Code based off PatchIOS by leathl"); Console.WriteLine(" Code based off PatchIOS by leathl");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");

View file

@ -175,7 +175,7 @@ namespace Sharpii
if (version == "") if (version == "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("No version specified, using latest", version); Console.WriteLine("No version specified, using latest", version);
version = "LATEST"; version = "LATEST";
} }
@ -187,14 +187,14 @@ namespace Sharpii
TMD tmd = grabtmd.DownloadTMD(id, ""); TMD tmd = grabtmd.DownloadTMD(id, "");
version = tmd.TitleVersion.ToString(); version = tmd.TitleVersion.ToString();
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Found latest version: v{0}", version); Console.WriteLine("Found latest version: v{0}", version);
} }
if (entered == false) //Will only be false if no store type argument was given if (entered == false) //Will only be false if no store type argument was given
{ {
store.Add(StoreType.All); store.Add(StoreType.All);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("No store type specified, using all"); Console.WriteLine("No store type specified, using all");
} }
@ -205,7 +205,7 @@ namespace Sharpii
{ {
wad = true; wad = true;
if (Directory.Exists(temp) == true) if (Directory.Exists(temp) == true)
DeleteDir.DeleteDirectory(temp); DeleteADir.DeleteDirectory(temp);
Directory.CreateDirectory(temp); Directory.CreateDirectory(temp);
} }
@ -214,7 +214,7 @@ namespace Sharpii
{ {
NoOut = true; NoOut = true;
output = ios == "" ? id + "v" + version : ios.Substring(0, ios.Length - 4); output = ios == "" ? id + "v" + version : ios.Substring(0, ios.Length - 4);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("No output specified, using {0}", output); Console.WriteLine("No output specified, using {0}", output);
} }
@ -225,7 +225,7 @@ namespace Sharpii
if (local == true) if (local == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Using local files if present..."); Console.WriteLine("Using local files if present...");
nus.UseLocalFiles = true; nus.UseLocalFiles = true;
} }
@ -233,17 +233,17 @@ namespace Sharpii
if (content != "") if (content != "")
{ {
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Downloading content..."); Console.Write("Downloading content...");
nus.DownloadSingleContent(id, version, content, output); nus.DownloadSingleContent(id, version, content, output);
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
else else
{ {
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Downloading title..."); Console.Write("Downloading title...");
string realout = output; string realout = output;
@ -254,11 +254,11 @@ namespace Sharpii
WadIosNamingStuff(wad, temp, id, version, ios, NoOut, output, realout); WadIosNamingStuff(wad, temp, id, version, ios, NoOut, output, realout);
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -301,7 +301,7 @@ namespace Sharpii
File.Delete(realout); File.Delete(realout);
File.Move(temp + "\\" + id + "v" + version + ".wad", realout); File.Move(temp + "\\" + id + "v" + version + ".wad", realout);
} }
DeleteDir.DeleteDirectory(temp); DeleteADir.DeleteDirectory(temp);
} }
else if (ios != "") else if (ios != "")
{ {
@ -319,7 +319,7 @@ namespace Sharpii
public static void NUS_help() public static void NUS_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - NUSD - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - NUSD - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");

View file

@ -19,7 +19,6 @@ using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using libWiiSharp; using libWiiSharp;
using System.Windows.Forms;
using System.Diagnostics; using System.Diagnostics;
namespace Sharpii namespace Sharpii
@ -34,10 +33,10 @@ namespace Sharpii
Environment.Exit(0); Environment.Exit(0);
} }
if (!File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\libWiiSharp.dll")) if (!File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + Path.DirectorySeparatorChar + "libWiiSharp.dll"))
{ {
Console.WriteLine("ERROR: libWiiSharp.dll not found"); Console.WriteLine("ERROR: libWiiSharp.dll not found");
Console.WriteLine("\n\nAttemp to download? [Y/N]"); Console.WriteLine("\n\nAttempt to download? [Y/N]");
Console.Write("\n>>"); Console.Write("\n>>");
string ans = Console.ReadLine(); string ans = Console.ReadLine();
if (ans.ToUpper() == "Y") if (ans.ToUpper() == "Y")
@ -46,7 +45,7 @@ namespace Sharpii
{ {
Console.Write("\nGrabbing libWiiSharp.dll..."); Console.Write("\nGrabbing libWiiSharp.dll...");
WebClient DLlibWiiSharp = new WebClient(); WebClient DLlibWiiSharp = new WebClient();
DLlibWiiSharp.DownloadFile("https://github.com/mogzol/sharpii/raw/master/Sharpii/libWiiSharp.dll", Path.GetDirectoryName(Application.ExecutablePath) + "\\libWiiSharp.dll"); DLlibWiiSharp.DownloadFile("https://github.com/mogzol/sharpii/raw/master/Sharpii/libWiiSharp.dll", Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\libWiiSharp.dll");
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
catch (Exception ex) catch (Exception ex)
@ -61,13 +60,13 @@ namespace Sharpii
switch (args[i].ToUpper()) switch (args[i].ToUpper())
{ {
case "-QUIET": case "-QUIET":
Quiet.quiet = 1; BeQuiet.quiet = 1;
break; break;
case "-Q": case "-Q":
Quiet.quiet = 1; BeQuiet.quiet = 1;
break; break;
case "-LOTS": case "-LOTS":
Quiet.quiet = 3; BeQuiet.quiet = 3;
break; break;
} }
} }
@ -159,7 +158,7 @@ namespace Sharpii
string temp = Path.GetTempPath() + "Sharpii.tmp"; string temp = Path.GetTempPath() + "Sharpii.tmp";
if (Directory.Exists(temp) == true) if (Directory.Exists(temp) == true)
DeleteDir.DeleteDirectory(temp); DeleteADir.DeleteDirectory(temp);
Environment.Exit(0); Environment.Exit(0);
} }
@ -168,28 +167,28 @@ namespace Sharpii
{ {
try try
{ {
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Installing Sharpii..."); Console.WriteLine("Installing Sharpii...");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Adding Variables"); Console.WriteLine("Adding Variables");
Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) + Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) +
";" + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\", EnvironmentVariableTarget.Machine); ";" + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\", EnvironmentVariableTarget.Machine);
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Creating Directory"); Console.WriteLine("Creating Directory");
if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\")) if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\"))
DeleteDir.DeleteDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\"); DeleteADir.DeleteDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\");
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\"); Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Copying Files"); Console.WriteLine("Copying Files");
File.Copy(Application.ExecutablePath, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\Sharpii.exe"); File.Copy(AppDomain.CurrentDomain.BaseDirectory, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\Sharpii.exe");
if (File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\libWiiSharp.dll")) if (File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\libWiiSharp.dll"))
File.Copy(Path.GetDirectoryName(Application.ExecutablePath) + "\\libWiiSharp.dll", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\libWiiSharp.dll"); File.Copy(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\libWiiSharp.dll", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\libWiiSharp.dll");
if (File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\WadInstaller.dll")) if (File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll"))
File.Copy(Path.GetDirectoryName(Application.ExecutablePath) + "\\WadInstaller.dll", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\WadInstaller.dll"); File.Copy(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\WadInstaller.dll");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
{ {
Console.WriteLine("Sharpii was successfully installed to: {0}", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\"); Console.WriteLine("Sharpii was successfully installed to: {0}", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\");
Console.WriteLine("You can now use Sharpii in any directory!"); Console.WriteLine("You can now use Sharpii in any directory!");
@ -208,13 +207,13 @@ namespace Sharpii
{ {
try try
{ {
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Uninstalling Sharpii..."); Console.WriteLine("Uninstalling Sharpii...");
string path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine); string path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine);
Environment.SetEnvironmentVariable("PATH", path.Replace(";" + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\", ""), EnvironmentVariableTarget.Machine); Environment.SetEnvironmentVariable("PATH", path.Replace(";" + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\", ""), EnvironmentVariableTarget.Machine);
Process.Start("cmd.exe", "/C mode con:cols=50 lines=4 & color 0B & echo Finishing Uninstallation... & sleep 2 & rmdir /s /q " + '"' + Process.Start("cmd.exe", "/C mode con:cols=50 lines=4 & color 0B & echo Finishing Uninstallation... & sleep 2 & rmdir /s /q " + '"' +
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\" + '"' + " & CLS & echo Sharpii has been successfully uninstalled! & echo. & pause"); Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\" + '"' + " & CLS & echo Sharpii has been successfully uninstalled! & echo. & pause");
Application.Exit(); Environment.Exit(0);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -247,7 +246,7 @@ namespace Sharpii
private static void help() private static void help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");
@ -288,8 +287,8 @@ namespace Sharpii
} }
} }
public class DeleteDir public class DeleteADir
{ {
public static bool DeleteDirectory(string target_dir) public static bool DeleteDirectory(string target_dir)
{ {
bool result = false; bool result = false;
@ -312,14 +311,15 @@ namespace Sharpii
return result; return result;
} }
} }
public class Quiet { public class BeQuiet
{
//1 = little //1 = little
//2 = normal //2 = normal
//3 = lots //3 = lots
public static int quiet = 2; public static int quiet = 2;
} }
public class Version public class ProgramVersion
{ {
public static string version = "1.7.3"; public static string version = "1.7.3; .Net Core Port";
} }

View file

@ -67,24 +67,24 @@ namespace Sharpii
try try
{ {
//Load tpl //Load tpl
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading file..."); Console.Write("Loading file...");
TPL tplfile = libWiiSharp.TPL.Load(input); TPL tplfile = libWiiSharp.TPL.Load(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
//save image //save image
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Extracting texture..."); Console.Write("Extracting texture...");
tplfile.ExtractTexture(output); tplfile.ExtractTexture(output);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -162,20 +162,20 @@ namespace Sharpii
if (tplFormat == "RGBA8") if (tplFormat == "RGBA8")
format = TPL_TextureFormat.RGBA8; format = TPL_TextureFormat.RGBA8;
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Format set to: {0}", tplFormat); Console.WriteLine("Format set to: {0}", tplFormat);
//Make tpl //Make tpl
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Creating tpl file..."); Console.Write("Creating tpl file...");
TPL tplfile = libWiiSharp.TPL.FromImage(input, format); TPL tplfile = libWiiSharp.TPL.FromImage(input, format);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
//save //save
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Saving tpl file..."); Console.Write("Saving tpl file...");
if (output.Substring(output.Length - 4, 4).ToUpper() != ".TPL") if (output.Substring(output.Length - 4, 4).ToUpper() != ".TPL")
@ -183,10 +183,10 @@ namespace Sharpii
tplfile.Save(output); tplfile.Save(output);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -201,7 +201,7 @@ namespace Sharpii
public static void TPL_help() public static void TPL_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - TPL - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - TPL - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");

View file

@ -75,23 +75,23 @@ namespace Sharpii
//Load U8 //Load U8
U8 U8file = new U8(); U8 U8file = new U8();
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading file..."); Console.Write("Loading file...");
U8file.LoadFile(input); U8file.LoadFile(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Extracting file..."); Console.Write("Extracting file...");
U8file.Extract(output); U8file.Extract(output);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -151,24 +151,24 @@ namespace Sharpii
{ {
U8 U8folder = new U8(); U8 U8folder = new U8();
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading folder..."); Console.Write("Loading folder...");
U8folder.CreateFromDirectory(input); U8folder.CreateFromDirectory(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (imd5 == true) if (imd5 == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Adding IMD5 Header"); Console.WriteLine("Adding IMD5 Header");
U8folder.AddHeaderImd5(); U8folder.AddHeaderImd5();
} }
if (imet != "") if (imet != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Adding IMET header with title: {0}", imet); Console.WriteLine("Adding IMET header with title: {0}", imet);
U8folder.AddHeaderImet(false, imet); U8folder.AddHeaderImet(false, imet);
} }
@ -176,17 +176,17 @@ namespace Sharpii
if (lz77 == true) if (lz77 == true)
{ {
//Yeah, I know this isnt where it actually compresses it //Yeah, I know this isnt where it actually compresses it
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Compressing U8 archive"); Console.WriteLine("Compressing U8 archive");
U8folder.Lz77Compress = true; U8folder.Lz77Compress = true;
} }
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Saving file"); Console.WriteLine("Saving file");
U8folder.Save(output); U8folder.Save(output);
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -201,7 +201,7 @@ namespace Sharpii
public static void U8_help() public static void U8_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - U8 - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - U8 - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");

View file

@ -126,15 +126,15 @@ namespace Sharpii
{ {
WAD wad = new WAD(); WAD wad = new WAD();
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading file..."); Console.Write("Loading file...");
wad.LoadFile(input); wad.LoadFile(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1 && output == "") if (BeQuiet.quiet > 1 && output == "")
{ {
Console.WriteLine("WAD Info:"); Console.WriteLine("WAD Info:");
Console.WriteLine(""); Console.WriteLine("");
@ -161,7 +161,7 @@ namespace Sharpii
} }
else else
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Saving file..."); Console.Write("Saving file...");
if (output.Substring(output.Length - 4, 4).ToUpper() != ".TXT") if (output.Substring(output.Length - 4, 4).ToUpper() != ".TXT")
@ -192,10 +192,10 @@ namespace Sharpii
txt.WriteLine("Blocks: {0}", wad.NandBlocks); txt.WriteLine("Blocks: {0}", wad.NandBlocks);
txt.Close(); txt.Close();
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
} }
@ -358,25 +358,25 @@ namespace Sharpii
if (edit == true) if (edit == true)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading file..."); Console.Write("Loading file...");
wad.LoadFile(input); wad.LoadFile(input);
} }
else else
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading folder..."); Console.Write("Loading folder...");
wad.CreateNew(input); wad.CreateNew(input);
} }
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (sound != "" || banner != "" || icon != "" || app != "") if (sound != "" || banner != "" || icon != "" || app != "")
{ {
string temp = Path.GetTempPath() + "Sharpii.tmp"; string temp = Path.GetTempPath() + "Sharpii.tmp";
if (Directory.Exists(temp) == true) if (Directory.Exists(temp) == true)
DeleteDir.DeleteDirectory(temp); DeleteADir.DeleteDirectory(temp);
Directory.CreateDirectory(temp); Directory.CreateDirectory(temp);
@ -389,7 +389,7 @@ namespace Sharpii
if (sound != "") if (sound != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Grabbing sound..."); Console.Write("Grabbing sound...");
twad.LoadFile(sound); twad.LoadFile(sound);
@ -400,12 +400,12 @@ namespace Sharpii
File.Copy(temp + "\\sound\\00000000\\meta\\sound.bin", temp + "\\main\\00000000\\meta\\sound.bin", true); File.Copy(temp + "\\sound\\00000000\\meta\\sound.bin", temp + "\\main\\00000000\\meta\\sound.bin", true);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
if (banner != "") if (banner != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Grabbing banner..."); Console.Write("Grabbing banner...");
twad.LoadFile(banner); twad.LoadFile(banner);
@ -416,12 +416,12 @@ namespace Sharpii
File.Copy(temp + "\\banner\\00000000\\meta\\banner.bin", temp + "\\main\\00000000\\meta\\banner.bin", true); File.Copy(temp + "\\banner\\00000000\\meta\\banner.bin", temp + "\\main\\00000000\\meta\\banner.bin", true);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
if (icon != "") if (icon != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Grabbing icon..."); Console.Write("Grabbing icon...");
twad.LoadFile(icon); twad.LoadFile(icon);
@ -432,12 +432,12 @@ namespace Sharpii
File.Copy(temp + "\\icon\\00000000\\meta\\icon.bin", temp + "\\main\\00000000\\meta\\icon.bin", true); File.Copy(temp + "\\icon\\00000000\\meta\\icon.bin", temp + "\\main\\00000000\\meta\\icon.bin", true);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
if (app != "") if (app != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Grabbing dol..."); Console.Write("Grabbing dol...");
if (app.Substring(app.Length - 4, 4) == ".dol") if (app.Substring(app.Length - 4, 4) == ".dol")
@ -453,19 +453,19 @@ namespace Sharpii
File.Copy(temp + "\\dol\\00000001.app", temp + "\\main\\00000001.app", true); File.Copy(temp + "\\dol\\00000001.app", temp + "\\main\\00000001.app", true);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
} }
u.ReplaceFile(1, temp + "\\main\\00000000\\meta\\banner.bin"); u.ReplaceFile(1, temp + "\\main\\00000000\\meta\\banner.bin");
u.ReplaceFile(2, temp + "\\main\\00000000\\meta\\icon.bin"); u.ReplaceFile(2, temp + "\\main\\00000000\\meta\\icon.bin");
u.ReplaceFile(3, temp + "\\main\\00000000\\meta\\sound.bin"); u.ReplaceFile(3, temp + "\\main\\00000000\\meta\\sound.bin");
u.Save(temp + "\\main\\00000000.app"); u.Save(temp + "\\main\\00000000.app");
DeleteDir.DeleteDirectory(temp + "\\main\\00000000\\"); DeleteADir.DeleteDirectory(temp + "\\main\\00000000\\");
wad.CreateNew(temp + "\\main"); wad.CreateNew(temp + "\\main");
DeleteDir.DeleteDirectory(temp); DeleteADir.DeleteDirectory(temp);
} }
if (Quiet.quiet > 2 && fake == true) if (BeQuiet.quiet > 2 && fake == true)
Console.WriteLine("FakeSigning WAD"); Console.WriteLine("FakeSigning WAD");
wad.FakeSign = fake; wad.FakeSign = fake;
@ -473,7 +473,7 @@ namespace Sharpii
{ {
if (id != "") if (id != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Changing channel ID to: {0}", id); Console.WriteLine("Changing channel ID to: {0}", id);
} }
else else
@ -483,7 +483,7 @@ namespace Sharpii
if (lwrid != "") if (lwrid != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Changing channel type to: {0}", lwrid); Console.WriteLine("Changing channel type to: {0}", lwrid);
} }
else else
@ -506,18 +506,18 @@ namespace Sharpii
} }
if (ios > -1) if (ios > -1)
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Changing startup IOS to: {0}", ios); Console.WriteLine("Changing startup IOS to: {0}", ios);
wad.ChangeStartupIOS(ios); wad.ChangeStartupIOS(ios);
} }
if (title != "") if (title != "")
{ {
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.WriteLine("Changing channel title to: {0}", title); Console.WriteLine("Changing channel title to: {0}", title);
wad.ChangeChannelTitles(title); wad.ChangeChannelTitles(title);
} }
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Saving file..."); Console.Write("Saving file...");
if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAD") if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAD")
@ -525,10 +525,10 @@ namespace Sharpii
wad.Save(output); wad.Save(output);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -570,23 +570,23 @@ namespace Sharpii
{ {
WAD wad = new WAD(); WAD wad = new WAD();
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Loading file..."); Console.Write("Loading file...");
wad.LoadFile(input); wad.LoadFile(input);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Unpacking WAD..."); Console.Write("Unpacking WAD...");
wad.Unpack(output, cid); wad.Unpack(output, cid);
if (Quiet.quiet > 2) if (BeQuiet.quiet > 2)
Console.Write("Done!\n"); Console.Write("Done!\n");
if (Quiet.quiet > 1) if (BeQuiet.quiet > 1)
Console.WriteLine("Operation completed succesfully!"); Console.WriteLine("Operation completed succesfully!");
} }
catch (Exception ex) catch (Exception ex)
@ -601,7 +601,7 @@ namespace Sharpii
public static void WAD_help() public static void WAD_help()
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Sharpii {0} - WAD - A tool by person66, using libWiiSharp.dll by leathl", Version.version); Console.WriteLine("Sharpii {0} - WAD - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" Usage:"); Console.WriteLine(" Usage:");