diff --git a/BNS.cs b/BNS.cs
index 629cac6..5e91daa 100644
--- a/BNS.cs
+++ b/BNS.cs
@@ -731,6 +731,7 @@ namespace libWiiSharp
}
internal class BNS_Header
{
+ //Private Variables
private readonly byte[] magic = new byte[4]
{
66,
@@ -747,6 +748,7 @@ namespace libWiiSharp
private uint dataOffset = 192;
private uint dataLength = 315392;
+ //Public Variables
public uint DataOffset
{
get => dataOffset;
diff --git a/Brlan.cs b/Brlan.cs
index b0f2c2a..051731c 100644
--- a/Brlan.cs
+++ b/Brlan.cs
@@ -24,16 +24,33 @@ namespace libWiiSharp
{
public class Brlan
{
+ #region Public Functions
+ ///
+ /// Gets all TPLs that are required by the brlan (Frame Animation).
+ ///
+ ///
+ ///
public static string[] GetBrlanTpls(string pathTobrlan)
{
- return Brlan.PrivGetBrlanTpls(File.ReadAllBytes(pathTobrlan));
+ return PrivGetBrlanTpls(File.ReadAllBytes(pathTobrlan));
}
+ ///
+ /// Gets all TPLs that are required by the brlan (Frame Animation).
+ ///
+ ///
+ ///
public static string[] GetBrlanTpls(byte[] brlanFile)
{
- return Brlan.PrivGetBrlanTpls(brlanFile);
+ return PrivGetBrlanTpls(brlanFile);
}
+ ///
+ /// Gets all TPLs that are required by the brlan (Frame Animation).
+ ///
+ ///
+ ///
+ ///
public static string[] GetBrlanTpls(WAD wad, bool banner)
{
if (!wad.HasBanner)
@@ -57,7 +74,7 @@ namespace libWiiSharp
{
if (u8.StringTable[index2].ToLower() == str + "_start.brlan" || u8.StringTable[index2].ToLower() == str + "_loop.brlan" || u8.StringTable[index2].ToLower() == str + ".brlan")
{
- a = Shared.MergeStringArrays(a, Brlan.GetBrlanTpls(u8.Data[index2]));
+ a = Shared.MergeStringArrays(a, GetBrlanTpls(u8.Data[index2]));
}
}
return a;
@@ -65,11 +82,13 @@ namespace libWiiSharp
}
return new string[0];
}
+ #endregion
+ #region Private Functions
private static string[] PrivGetBrlanTpls(byte[] brlanFile)
{
List stringList = new List();
- int numOfTpls = Brlan.GetNumOfTpls(brlanFile);
+ int numOfTpls = GetNumOfTpls(brlanFile);
int index1 = 36 + numOfTpls * 4;
for (int index2 = 0; index2 < numOfTpls; ++index2)
{
@@ -96,5 +115,6 @@ namespace libWiiSharp
{
return Shared.Swap(BitConverter.ToUInt16(brlanFile, 28));
}
+ #endregion
}
}
diff --git a/Brlyt.cs b/Brlyt.cs
index ca0d27f..64734c2 100644
--- a/Brlyt.cs
+++ b/Brlyt.cs
@@ -24,16 +24,33 @@ namespace libWiiSharp
{
public class Brlyt
{
+ #region Public Functions
+ ///
+ /// Gets all TPLs that are required by the brlyt.
+ ///
+ ///
+ ///
public static string[] GetBrlytTpls(string pathToBrlyt)
{
return PrivGetBrlytTpls(File.ReadAllBytes(pathToBrlyt));
}
+ ///
+ /// Gets all TPLs that are required by the brlyt.
+ ///
+ ///
+ ///
public static string[] GetBrlytTpls(byte[] brlytFile)
{
return PrivGetBrlytTpls(brlytFile);
}
+ ///
+ /// Gets all TPLs that are required by the brlyt.
+ ///
+ ///
+ ///
+ ///
public static string[] GetBrlytTpls(WAD wad, bool banner)
{
if (!wad.HasBanner)
@@ -57,7 +74,7 @@ namespace libWiiSharp
{
if (u8.StringTable[index2].ToLower() == str + ".brlyt")
{
- a = Shared.MergeStringArrays(a, Brlyt.GetBrlytTpls(u8.Data[index2]));
+ a = Shared.MergeStringArrays(a, GetBrlytTpls(u8.Data[index2]));
}
}
return a;
@@ -65,11 +82,13 @@ namespace libWiiSharp
}
return new string[0];
}
+ #endregion
+ #region Private Functions
private static string[] PrivGetBrlytTpls(byte[] brlytFile)
{
List stringList = new List();
- int numOfTpls = Brlyt.GetNumOfTpls(brlytFile);
+ int numOfTpls = GetNumOfTpls(brlytFile);
int index1 = 48 + numOfTpls * 8;
for (int index2 = 0; index2 < numOfTpls; ++index2)
{
@@ -96,5 +115,6 @@ namespace libWiiSharp
{
return Shared.Swap(BitConverter.ToUInt16(brlytFile, 44));
}
+ #endregion
}
}
diff --git a/CertificateChain.cs b/CertificateChain.cs
index a5baeab..5ee82ca 100644
--- a/CertificateChain.cs
+++ b/CertificateChain.cs
@@ -34,10 +34,12 @@ namespace libWiiSharp
private byte[] certXs = new byte[768];
private bool isDisposed;
+ ///
+ /// If false, the Certificate Chain is not complete (i.e. at least one certificate is missing).
+ ///
public bool CertsComplete => certsComplete[0] && certsComplete[1] && certsComplete[2];
- public event EventHandler Debug;
-
+ #region IDisposable Members
~CertificateChain() => Dispose(false);
public void Dispose()
@@ -59,12 +61,24 @@ namespace libWiiSharp
}
isDisposed = true;
}
+ #endregion
+ #region Public Functions
+ ///
+ /// Loads a cert file.
+ ///
+ ///
+ ///
public static CertificateChain Load(string pathToCert)
{
- return CertificateChain.Load(File.ReadAllBytes(pathToCert));
+ return Load(File.ReadAllBytes(pathToCert));
}
+ ///
+ /// Loads a cert file.
+ ///
+ ///
+ ///
public static CertificateChain Load(byte[] certFile)
{
CertificateChain certificateChain = new CertificateChain();
@@ -82,6 +96,11 @@ namespace libWiiSharp
return certificateChain;
}
+ ///
+ /// Loads a cert file.
+ ///
+ ///
+ ///
public static CertificateChain Load(Stream cert)
{
CertificateChain certificateChain = new CertificateChain();
@@ -89,11 +108,25 @@ namespace libWiiSharp
return certificateChain;
}
+ ///
+ /// Grabs certificates from Ticket and Tmd.
+ /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
+ ///
+ ///
+ ///
+ ///
public static CertificateChain FromTikTmd(string pathToTik, string pathToTmd)
{
- return CertificateChain.FromTikTmd(File.ReadAllBytes(pathToTik), File.ReadAllBytes(pathToTmd));
+ return FromTikTmd(File.ReadAllBytes(pathToTik), File.ReadAllBytes(pathToTmd));
}
+ ///
+ /// Grabs certificates from Ticket and Tmd.
+ /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
+ ///
+ ///
+ ///
+ ///
public static CertificateChain FromTikTmd(byte[] tikFile, byte[] tmdFile)
{
CertificateChain certificateChain = new CertificateChain();
@@ -121,6 +154,13 @@ namespace libWiiSharp
return certificateChain.CertsComplete ? certificateChain : throw new Exception("Couldn't locate all certs!");
}
+ ///
+ /// Grabs certificates from Ticket and Tmd.
+ /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
+ ///
+ ///
+ ///
+ ///
public static CertificateChain FromTikTmd(Stream tik, Stream tmd)
{
CertificateChain certificateChain = new CertificateChain();
@@ -129,11 +169,19 @@ namespace libWiiSharp
return certificateChain;
}
+ ///
+ /// Loads a cert file.
+ ///
+ ///
public void LoadFile(string pathToCert)
{
LoadFile(File.ReadAllBytes(pathToCert));
}
+ ///
+ /// Loads a cert file.
+ ///
+ ///
public void LoadFile(byte[] certFile)
{
MemoryStream memoryStream = new MemoryStream(certFile);
@@ -149,16 +197,33 @@ namespace libWiiSharp
memoryStream.Dispose();
}
+ ///
+ /// Loads a cert file.
+ ///
+ ///
public void LoadFile(Stream cert)
{
ParseCert(cert);
}
+ ///
+ /// Grabs certificates from Ticket and Tmd.
+ /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
+ ///
+ ///
+ ///
+ ///
public void LoadFromTikTmd(string pathToTik, string pathToTmd)
{
LoadFromTikTmd(File.ReadAllBytes(pathToTik), File.ReadAllBytes(pathToTmd));
}
+ ///
+ /// Grabs certificates from Ticket and Tmd.
+ /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
+ ///
+ ///
+ ///
public void LoadFromTikTmd(byte[] tikFile, byte[] tmdFile)
{
MemoryStream memoryStream1 = new MemoryStream(tikFile);
@@ -188,12 +253,22 @@ namespace libWiiSharp
}
}
+ ///
+ /// Grabs certificates from Ticket and Tmd.
+ /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
+ ///
+ ///
+ ///
public void LoadFromTikTmd(Stream tik, Stream tmd)
{
GrabFromTik(tik);
GrabFromTmd(tmd);
}
+ ///
+ /// Saves the Certificate Chain.
+ ///
+ ///
public void Save(string savePath)
{
if (File.Exists(savePath))
@@ -205,6 +280,10 @@ namespace libWiiSharp
WriteToStream(fileStream);
}
+ ///
+ /// Returns the Certificate Chain as a memory stream.
+ ///
+ ///
public MemoryStream ToMemoryStream()
{
MemoryStream memoryStream = new MemoryStream();
@@ -220,6 +299,10 @@ namespace libWiiSharp
}
}
+ ///
+ /// Returns the Certificate Chain as a byte array.
+ ///
+ ///
public byte[] ToByteArray()
{
MemoryStream memoryStream = new MemoryStream();
@@ -236,7 +319,9 @@ namespace libWiiSharp
memoryStream.Dispose();
return array;
}
+ #endregion
+ #region Private Functions
private void WriteToStream(Stream writeStream)
{
FireDebug("Writing Certificate Chain...");
@@ -476,6 +561,13 @@ namespace libWiiSharp
return part[388] == 67 && part[389] == 80 && Shared.CompareByteArrays(sha.ComputeHash(part), Shared.HexStringToByteArray("6824D6DA4C25184F0D6DAF6EDB9C0FC57522A41C"));
}
+ #endregion
+
+ #region Events
+ ///
+ /// Fires debugging messages. You may write them into a log file or log textbox.
+ ///
+ public event EventHandler Debug;
private void FireDebug(string debugMessage, params object[] args)
{
@@ -487,5 +579,6 @@ namespace libWiiSharp
debug(new object(), new MessageEventArgs(string.Format(debugMessage, args)));
}
+ #endregion
}
}
diff --git a/CommonKey.cs b/CommonKey.cs
index 49eb3ff..8d0851d 100644
--- a/CommonKey.cs
+++ b/CommonKey.cs
@@ -25,12 +25,12 @@ namespace libWiiSharp
public static byte[] GetStandardKey()
{
- return Shared.HexStringToByteArray(CommonKey.standardKey);
+ return Shared.HexStringToByteArray(standardKey);
}
public static byte[] GetKoreanKey()
{
- return Shared.HexStringToByteArray(CommonKey.koreanKey);
+ return Shared.HexStringToByteArray(koreanKey);
}
}
}
diff --git a/ContentType.cs b/ContentType.cs
deleted file mode 100644
index ff0fd4f..0000000
--- a/ContentType.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Decompiled with JetBrains decompiler
-// Type: libWiiSharp.ContentType
-// Assembly: libWiiSharp, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
-// MVID: FBF36F3D-B5D6-481F-B5F5-1BD3C19E13B2
-// Assembly location: C:\Users\theso\Downloads\NCPatcher\pack\libWiiSharp.dll
-
-namespace libWiiSharp
-{
- public enum ContentType : ushort
- {
- Normal = 1,
- DLC = 16385, // 0x4001
- Shared = 32769, // 0x8001
- }
-}
diff --git a/HbcTransmitter.cs b/HbcTransmitter.cs
index c1a1e5a..efc14f8 100644
--- a/HbcTransmitter.cs
+++ b/HbcTransmitter.cs
@@ -417,8 +417,8 @@ namespace libWiiSharp
{
byte[] array = new byte[inFile.Length + 64];
int destLength = -1;
- ZlibWrapper.ZLibError zlibError = ZlibWrapper.Compress2(array, ref destLength, inFile, inFile.Length, 6);
- if (zlibError != ZlibWrapper.ZLibError.Z_OK || destLength <= -1 || destLength >= inFile.Length)
+ ZlibWrapper.ZLibError zlibError = Compress2(array, ref destLength, inFile, inFile.Length, 6);
+ if (zlibError != ZLibError.Z_OK || destLength <= -1 || destLength >= inFile.Length)
{
throw new Exception("An error occured while compressing! Code: " + zlibError.ToString());
}
diff --git a/Headers.cs b/Headers.cs
index b5f20fb..02803a0 100644
--- a/Headers.cs
+++ b/Headers.cs
@@ -55,7 +55,7 @@ namespace libWiiSharp
///
public static Headers.HeaderType DetectHeader(string pathToFile)
{
- return Headers.DetectHeader(File.ReadAllBytes(pathToFile));
+ return DetectHeader(File.ReadAllBytes(pathToFile));
}
///
@@ -65,17 +65,17 @@ namespace libWiiSharp
///
public static Headers.HeaderType DetectHeader(byte[] file)
{
- if (file.Length > 68 && (int)Shared.Swap(BitConverter.ToUInt32(file, 64)) == (int)Headers.imetMagic)
+ if (file.Length > 68 && (int)Shared.Swap(BitConverter.ToUInt32(file, 64)) == (int)imetMagic)
{
- return Headers.HeaderType.ShortIMET;
+ return HeaderType.ShortIMET;
}
- if (file.Length > 132 && (int)Shared.Swap(BitConverter.ToUInt32(file, 128)) == (int)Headers.imetMagic)
+ if (file.Length > 132 && (int)Shared.Swap(BitConverter.ToUInt32(file, 128)) == (int)imetMagic)
{
- return Headers.HeaderType.IMET;
+ return HeaderType.IMET;
}
- return file.Length > 4 && (int)Shared.Swap(BitConverter.ToUInt32(file, 0)) == (int)Headers.imd5Magic ? Headers.HeaderType.IMD5 : Headers.HeaderType.None;
+ return file.Length > 4 && (int)Shared.Swap(BitConverter.ToUInt32(file, 0)) == (int)imd5Magic ? HeaderType.IMD5 : HeaderType.None;
}
///
@@ -90,30 +90,30 @@ namespace libWiiSharp
{
file.Seek(64L, SeekOrigin.Begin);
file.Read(buffer, 0, buffer.Length);
- if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)Headers.imetMagic)
+ if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)imetMagic)
{
- return Headers.HeaderType.ShortIMET;
+ return HeaderType.ShortIMET;
}
}
if (file.Length > 132L)
{
file.Seek(128L, SeekOrigin.Begin);
file.Read(buffer, 0, buffer.Length);
- if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)Headers.imetMagic)
+ if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)imetMagic)
{
- return Headers.HeaderType.IMET;
+ return HeaderType.IMET;
}
}
if (file.Length > 4L)
{
file.Seek(0L, SeekOrigin.Begin);
file.Read(buffer, 0, buffer.Length);
- if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)Headers.imd5Magic)
+ if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)imd5Magic)
{
- return Headers.HeaderType.IMD5;
+ return HeaderType.IMD5;
}
}
- return Headers.HeaderType.None;
+ return HeaderType.None;
}
#endregion
@@ -279,7 +279,7 @@ namespace libWiiSharp
///
public static Headers.IMET Load(string pathToFile)
{
- return Headers.IMET.Load(File.ReadAllBytes(pathToFile));
+ return Load(File.ReadAllBytes(pathToFile));
}
///
@@ -289,13 +289,13 @@ namespace libWiiSharp
///
public static Headers.IMET Load(byte[] fileOrHeader)
{
- Headers.HeaderType headerType = Headers.DetectHeader(fileOrHeader);
+ Headers.HeaderType headerType = DetectHeader(fileOrHeader);
switch (headerType)
{
- case Headers.HeaderType.ShortIMET:
- case Headers.HeaderType.IMET:
+ case HeaderType.ShortIMET:
+ case HeaderType.IMET:
Headers.IMET imet = new Headers.IMET();
- if (headerType == Headers.HeaderType.ShortIMET)
+ if (headerType == HeaderType.ShortIMET)
{
imet.isShortImet = true;
}
@@ -324,13 +324,13 @@ namespace libWiiSharp
///
public static Headers.IMET Load(Stream fileOrHeader)
{
- Headers.HeaderType headerType = Headers.DetectHeader(fileOrHeader);
+ Headers.HeaderType headerType = DetectHeader(fileOrHeader);
switch (headerType)
{
- case Headers.HeaderType.ShortIMET:
- case Headers.HeaderType.IMET:
+ case HeaderType.ShortIMET:
+ case HeaderType.IMET:
Headers.IMET imet = new Headers.IMET();
- if (headerType == Headers.HeaderType.ShortIMET)
+ if (headerType == HeaderType.ShortIMET)
{
imet.isShortImet = true;
}
@@ -384,7 +384,7 @@ namespace libWiiSharp
///
public static void RemoveHeader(string pathToFile)
{
- byte[] bytes = Headers.IMET.RemoveHeader(File.ReadAllBytes(pathToFile));
+ byte[] bytes = RemoveHeader(File.ReadAllBytes(pathToFile));
File.Delete(pathToFile);
File.WriteAllBytes(pathToFile, bytes);
}
@@ -396,11 +396,11 @@ namespace libWiiSharp
///
public static byte[] RemoveHeader(byte[] file)
{
- Headers.HeaderType headerType = Headers.DetectHeader(file);
+ Headers.HeaderType headerType = DetectHeader(file);
switch (headerType)
{
- case Headers.HeaderType.ShortIMET:
- case Headers.HeaderType.IMET:
+ case HeaderType.ShortIMET:
+ case HeaderType.IMET:
byte[] numArray = new byte[(int)(file.Length - headerType)];
Array.Copy(file, (int)headerType, numArray, 0, numArray.Length);
return numArray;
@@ -683,7 +683,7 @@ namespace libWiiSharp
///
public static Headers.IMD5 Load(string pathToFile)
{
- return Headers.IMD5.Load(File.ReadAllBytes(pathToFile));
+ return Load(File.ReadAllBytes(pathToFile));
}
///
@@ -693,7 +693,7 @@ namespace libWiiSharp
///
public static Headers.IMD5 Load(byte[] fileOrHeader)
{
- if (Headers.DetectHeader(fileOrHeader) != Headers.HeaderType.IMD5)
+ if (DetectHeader(fileOrHeader) != HeaderType.IMD5)
{
throw new Exception("No IMD5 Header found!");
}
@@ -720,7 +720,7 @@ namespace libWiiSharp
///
public static Headers.IMD5 Load(Stream fileOrHeader)
{
- if (Headers.DetectHeader(fileOrHeader) != Headers.HeaderType.IMD5)
+ if (DetectHeader(fileOrHeader) != HeaderType.IMD5)
{
throw new Exception("No IMD5 Header found!");
}
@@ -751,7 +751,7 @@ namespace libWiiSharp
///
public static void AddHeader(string pathToFile)
{
- byte[] buffer = Headers.IMD5.AddHeader(File.ReadAllBytes(pathToFile));
+ byte[] buffer = AddHeader(File.ReadAllBytes(pathToFile));
File.Delete(pathToFile);
using FileStream fileStream = new FileStream(pathToFile, FileMode.Create);
fileStream.Write(buffer, 0, buffer.Length);
@@ -764,7 +764,7 @@ namespace libWiiSharp
///
public static byte[] AddHeader(byte[] file)
{
- Headers.IMD5 imD5 = Headers.IMD5.Create(file);
+ Headers.IMD5 imD5 = Create(file);
MemoryStream memoryStream1 = new MemoryStream();
MemoryStream memoryStream2 = memoryStream1;
imD5.WriteToStream(memoryStream2);
@@ -780,7 +780,7 @@ namespace libWiiSharp
///
public static void RemoveHeader(string pathToFile)
{
- byte[] buffer = Headers.IMD5.RemoveHeader(File.ReadAllBytes(pathToFile));
+ byte[] buffer = RemoveHeader(File.ReadAllBytes(pathToFile));
File.Delete(pathToFile);
using FileStream fileStream = new FileStream(pathToFile, FileMode.Create);
fileStream.Write(buffer, 0, buffer.Length);
diff --git a/HexView.cs b/HexView.cs
index 92b2ad7..e2bf251 100644
--- a/HexView.cs
+++ b/HexView.cs
@@ -45,7 +45,7 @@ namespace libWiiSharp
richTextBox.Clear();
richTextBox.Font = new Font("Courier New", 9f);
richTextBox.ReadOnly = true;
- richTextBox.Text = HexView.DumpAsString(data);
+ richTextBox.Text = DumpAsString(data);
}
///
@@ -59,7 +59,7 @@ namespace libWiiSharp
textBox.Multiline = true;
textBox.Font = new Font("Courier New", 9f);
textBox.ReadOnly = true;
- textBox.Text = HexView.DumpAsString(data).Replace("\n", "\r\n");
+ textBox.Text = DumpAsString(data).Replace("\n", "\r\n");
}
///
@@ -71,7 +71,7 @@ namespace libWiiSharp
///
public static string DumpAsString(byte[] data)
{
- return string.Join("\n", HexView.DumpAsStringArray(data));
+ return string.Join("\n", DumpAsStringArray(data));
}
///
@@ -89,7 +89,7 @@ namespace libWiiSharp
if (dataGridView.Columns[e.ColumnIndex].HeaderText.ToLower() == "dump")
{
string str = (string)dataGridView.Rows[e.RowIndex].Cells[17].Value;
- if (!(str != HexView.savedValue))
+ if (!(str != savedValue))
{
return;
}
@@ -101,9 +101,9 @@ namespace libWiiSharp
for (int index = 0; index < 16; ++index)
{
- if (HexView.ToAscii(byte.Parse((string)dataGridView.Rows[e.RowIndex].Cells[index + 1].Value, NumberStyles.HexNumber)) != str[index])
+ if (ToAscii(byte.Parse((string)dataGridView.Rows[e.RowIndex].Cells[index + 1].Value, NumberStyles.HexNumber)) != str[index])
{
- dataGridView.Rows[e.RowIndex].Cells[index + 1].Value = HexView.FromAscii(str[index]).ToString("x2");
+ dataGridView.Rows[e.RowIndex].Cells[index + 1].Value = FromAscii(str[index]).ToString("x2");
}
}
}
@@ -115,7 +115,7 @@ namespace libWiiSharp
}
int startIndex = int.Parse(dataGridView.Columns[e.ColumnIndex].HeaderText, NumberStyles.HexNumber);
- string str = ((string)dataGridView.Rows[e.RowIndex].Cells[17].Value).Remove(startIndex, 1).Insert(startIndex, HexView.ToAscii(byte.Parse((string)dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value, NumberStyles.HexNumber)).ToString());
+ string str = ((string)dataGridView.Rows[e.RowIndex].Cells[17].Value).Remove(startIndex, 1).Insert(startIndex, ToAscii(byte.Parse((string)dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value, NumberStyles.HexNumber)).ToString());
dataGridView.Rows[e.RowIndex].Cells[17].Value = str;
if (((string)dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).Length <= 2)
{
@@ -140,7 +140,7 @@ namespace libWiiSharp
///
public static void DataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
- HexView.savedValue = (string)((DataGridView)sender).Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
+ savedValue = (string)((DataGridView)sender).Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
}
#endregion
@@ -165,7 +165,7 @@ namespace libWiiSharp
{
str1 = str1 + data[num + index].ToString("x2") + " ";
string str3 = str2;
- ascii = HexView.ToAscii(data[num + index]);
+ ascii = ToAscii(data[num + index]);
string str4 = ascii.ToString();
str2 = str3 + str4;
}
@@ -182,7 +182,7 @@ namespace libWiiSharp
{
str1 = str1 + data[num + index].ToString("x2") + " ";
string str3 = str2;
- ascii = HexView.ToAscii(data[num + index]);
+ ascii = ToAscii(data[num + index]);
string str4 = ascii.ToString();
str2 = str3 + str4;
}
diff --git a/Lz77.cs b/Lz77.cs
index 9b359c7..b3b69a4 100644
--- a/Lz77.cs
+++ b/Lz77.cs
@@ -34,17 +34,17 @@ namespace libWiiSharp
//private int matchPosition;
//private int matchLength;
- public static uint Lz77Magic => Lz77.lz77Magic;
+ public static uint Lz77Magic => lz77Magic;
public static bool IsLz77Compressed(string file)
{
- return Lz77.IsLz77Compressed(File.ReadAllBytes(file));
+ return IsLz77Compressed(File.ReadAllBytes(file));
}
public static bool IsLz77Compressed(byte[] file)
{
Headers.HeaderType headerType = Headers.DetectHeader(file);
- return (int)Shared.Swap(BitConverter.ToUInt32(file, (int)headerType)) == (int)Lz77.lz77Magic;
+ return (int)Shared.Swap(BitConverter.ToUInt32(file, (int)headerType)) == (int)lz77Magic;
}
public static bool IsLz77Compressed(Stream file)
@@ -53,7 +53,7 @@ namespace libWiiSharp
byte[] buffer = new byte[4];
file.Seek((long)headerType, SeekOrigin.Begin);
file.Read(buffer, 0, buffer.Length);
- return (int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)Lz77.lz77Magic;
+ return (int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) == (int)lz77Magic;
}
public void Compress(string inFile, string outFile)
@@ -120,7 +120,7 @@ namespace libWiiSharp
private Stream PrivDecompress(Stream inFile)
{
- if (!Lz77.IsLz77Compressed(inFile))
+ if (!IsLz77Compressed(inFile))
{
return inFile;
}
@@ -131,7 +131,7 @@ namespace libWiiSharp
byte[] buffer = new byte[8];
inFile.Seek((long)headerType, SeekOrigin.Begin);
inFile.Read(buffer, 0, 8);
- if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) != (int)Lz77.lz77Magic)
+ if ((int)Shared.Swap(BitConverter.ToUInt32(buffer, 0)) != (int)lz77Magic)
{
inFile.Dispose();
throw new Exception("Invaild Magic!");
diff --git a/NusClient.cs b/NusClient.cs
index 6be7e8e..e708f88 100644
--- a/NusClient.cs
+++ b/NusClient.cs
@@ -117,13 +117,13 @@ namespace libWiiSharp
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
}
- if (System.IO.File.Exists(savePath))
+ if (File.Exists(savePath))
{
- System.IO.File.Delete(savePath);
+ File.Delete(savePath);
}
byte[] bytes = PrivDownloadSingleContent(titleId, titleVersion, contentId);
- System.IO.File.WriteAllBytes(savePath, bytes);
+ File.WriteAllBytes(savePath, bytes);
}
private byte[] PrivDownloadSingleContent(string titleId, string titleVersion, string contentId)
@@ -329,7 +329,7 @@ namespace libWiiSharp
string str3 = outputDir;
contentId = tmd.Contents[index1].ContentID;
string str4 = contentId.ToString("x8");
- if (System.IO.File.Exists(str3 + str4))
+ if (File.Exists(str3 + str4))
{
FireDebug(" Using Local File, Skipping...");
continue;
@@ -369,7 +369,7 @@ namespace libWiiSharp
string str3 = outputDir;
contentId = tmd.Contents[contentIndex].ContentID;
string str4 = contentId.ToString("x8");
- byte[] array = DecryptContent(System.IO.File.ReadAllBytes(str3 + str4), contentIndex, tik, tmd);
+ byte[] array = DecryptContent(File.ReadAllBytes(str3 + str4), contentIndex, tik, tmd);
Array.Resize(ref array, (int)tmd.Contents[contentIndex].Size);
if (!Shared.CompareByteArrays(shA1.ComputeHash(array), tmd.Contents[contentIndex].Hash))
{
@@ -379,7 +379,7 @@ namespace libWiiSharp
string str5 = outputDir;
contentId = tmd.Contents[contentIndex].ContentID;
string str6 = contentId.ToString("x8");
- System.IO.File.WriteAllBytes(str5 + str6 + ".app", array);
+ File.WriteAllBytes(str5 + str6 + ".app", array);
}
shA1.Clear();
}
@@ -395,7 +395,7 @@ namespace libWiiSharp
string str3 = outputDir;
contentId = tmd.Contents[index1].ContentID;
string str4 = contentId.ToString("x8");
- byte[] numArray2 = System.IO.File.ReadAllBytes(str3 + str4 + ".app");
+ byte[] numArray2 = File.ReadAllBytes(str3 + str4 + ".app");
numArray1[index2] = numArray2;
}
FireDebug(" Creating WAD...");
@@ -406,9 +406,9 @@ namespace libWiiSharp
FireDebug(" Deleting Encrypted Contents...");
for (int index = 0; index < strArray1.Length; ++index)
{
- if (System.IO.File.Exists(outputDir + strArray1[index]))
+ if (File.Exists(outputDir + strArray1[index]))
{
- System.IO.File.Delete(outputDir + strArray1[index]);
+ File.Delete(outputDir + strArray1[index]);
}
}
}
@@ -417,17 +417,17 @@ namespace libWiiSharp
FireDebug(" Deleting Decrypted Contents...");
for (int index = 0; index < strArray1.Length; ++index)
{
- if (System.IO.File.Exists(outputDir + strArray1[index] + ".app"))
+ if (File.Exists(outputDir + strArray1[index] + ".app"))
{
- System.IO.File.Delete(outputDir + strArray1[index] + ".app");
+ File.Delete(outputDir + strArray1[index] + ".app");
}
}
}
if (!flag2 && !flag1)
{
FireDebug(" Deleting TMD and Ticket...");
- System.IO.File.Delete(outputDir + str2);
- System.IO.File.Delete(outputDir + "cetk");
+ File.Delete(outputDir + str2);
+ File.Delete(outputDir + "cetk");
}
FireDebug("Downloading Title {0} v{1} Finished...", titleId, string.IsNullOrEmpty(titleVersion) ? "[Latest]" : titleVersion);
FireProgress(100);
diff --git a/Shared.cs b/Shared.cs
index 491b6a3..ba87464 100644
--- a/Shared.cs
+++ b/Shared.cs
@@ -115,7 +115,7 @@ namespace libWiiSharp
public static long AddPadding(long value)
{
- return Shared.AddPadding(value, 64);
+ return AddPadding(value, 64);
}
public static long AddPadding(long value, int padding)
@@ -130,7 +130,7 @@ namespace libWiiSharp
public static int AddPadding(int value)
{
- return Shared.AddPadding(value, 64);
+ return AddPadding(value, 64);
}
public static int AddPadding(int value, int padding)
diff --git a/TMD.cs b/TMD.cs
index ff18ca0..40ba491 100644
--- a/TMD.cs
+++ b/TMD.cs
@@ -153,7 +153,7 @@ namespace libWiiSharp
public static TMD Load(string pathToTmd)
{
- return TMD.Load(File.ReadAllBytes(pathToTmd));
+ return Load(File.ReadAllBytes(pathToTmd));
}
public static TMD Load(byte[] tmdFile)
diff --git a/TPL.cs b/TPL.cs
index 13124c6..acf2182 100644
--- a/TPL.cs
+++ b/TPL.cs
@@ -140,7 +140,7 @@ namespace libWiiSharp
TPL_TextureFormat tplFormat,
TPL_PaletteFormat paletteFormat = TPL_PaletteFormat.RGB5A3)
{
- return TPL.FromImages(new string[1] { pathToImage }, new TPL_TextureFormat[1]
+ return FromImages(new string[1] { pathToImage }, new TPL_TextureFormat[1]
{
tplFormat
}, new TPL_PaletteFormat[1] { paletteFormat });
@@ -151,7 +151,7 @@ namespace libWiiSharp
TPL_TextureFormat tplFormat,
TPL_PaletteFormat paletteFormat = TPL_PaletteFormat.RGB5A3)
{
- return TPL.FromImages(new Image[1] { img }, new TPL_TextureFormat[1]
+ return FromImages(new Image[1] { img }, new TPL_TextureFormat[1]
{
tplFormat
}, new TPL_PaletteFormat[1] { paletteFormat });
diff --git a/Ticket.cs b/Ticket.cs
index b317ca9..646be3e 100644
--- a/Ticket.cs
+++ b/Ticket.cs
@@ -148,7 +148,7 @@ namespace libWiiSharp
public static Ticket Load(string pathToTicket)
{
- return Ticket.Load(File.ReadAllBytes(pathToTicket));
+ return Load(File.ReadAllBytes(pathToTicket));
}
public static Ticket Load(byte[] ticket)
diff --git a/U8.cs b/U8.cs
index 67ecde9..3f206c3 100644
--- a/U8.cs
+++ b/U8.cs
@@ -111,7 +111,7 @@ namespace libWiiSharp
public static bool IsU8(string pathToFile)
{
- return U8.IsU8(File.ReadAllBytes(pathToFile));
+ return IsU8(File.ReadAllBytes(pathToFile));
}
public static bool IsU8(byte[] file)
@@ -124,7 +124,7 @@ namespace libWiiSharp
file1[index] = file[index];
}
- return U8.IsU8(new Lz77().Decompress(file1));
+ return IsU8(new Lz77().Decompress(file1));
}
Headers.HeaderType headerType = Headers.DetectHeader(file);
return Shared.Swap(BitConverter.ToUInt32(file, (int)headerType)) == 1437218861U;
@@ -132,7 +132,7 @@ namespace libWiiSharp
public static U8 Load(string pathToU8)
{
- return U8.Load(File.ReadAllBytes(pathToU8));
+ return Load(File.ReadAllBytes(pathToU8));
}
public static U8 Load(byte[] u8File)
diff --git a/WAD.cs b/WAD.cs
index 6d88839..0f9a935 100644
--- a/WAD.cs
+++ b/WAD.cs
@@ -212,7 +212,7 @@ namespace libWiiSharp
public static WAD Load(string pathToWad)
{
- return WAD.Load(File.ReadAllBytes(pathToWad));
+ return Load(File.ReadAllBytes(pathToWad));
}
public static WAD Load(byte[] wadFile)
@@ -272,7 +272,7 @@ namespace libWiiSharp
string path = contentDir + Path.DirectorySeparatorChar.ToString() + (flag ? tmd.Contents[index].ContentID.ToString("x8") : tmd.Contents[index].Index.ToString("x8")) + ".app";
contents[index] = File.ReadAllBytes(path);
}
- return WAD.Create(cert, tik, tmd, contents);
+ return Create(cert, tik, tmd, contents);
}
public static WAD Create(
@@ -309,7 +309,7 @@ namespace libWiiSharp
string path = contentDir + Path.DirectorySeparatorChar.ToString() + (flag ? tmd.Contents[index].ContentID.ToString("x8") : tmd.Contents[index].Index.ToString("x8")) + ".app";
contents[index] = File.ReadAllBytes(path);
}
- return WAD.Create(cert, tik, tmd, contents);
+ return Create(cert, tik, tmd, contents);
}
public static WAD Create(byte[] cert, byte[] tik, byte[] tmd, byte[][] contents)
@@ -320,7 +320,7 @@ namespace libWiiSharp
Ticket tik1 = ticket;
TMD tmd2 = tmd1;
byte[][] contents1 = contents;
- return WAD.Create(cert1, tik1, tmd2, contents1);
+ return Create(cert1, tik1, tmd2, contents1);
}
public static WAD Create(CertificateChain cert, Ticket tik, TMD tmd, byte[][] contents)