mirror of
https://github.com/StudentBlake/XCI-Explorer
synced 2024-11-10 06:34:15 +00:00
Added edge-case error handling, reverted game revision display change, disable trim button if XCI is already trimmed
This commit is contained in:
parent
3f4ae7791d
commit
3b8dc168b4
2 changed files with 39 additions and 23 deletions
|
@ -15,5 +15,5 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
[assembly: Guid("206c6c47-87b1-477f-b6e6-f7e7c1a92f8f")]
|
[assembly: Guid("206c6c47-87b1-477f-b6e6-f7e7c1a92f8f")]
|
||||||
[assembly: AssemblyFileVersion("1.4.8.1")]
|
[assembly: AssemblyFileVersion("1.4.9")]
|
||||||
[assembly: AssemblyVersion("1.4.8.1")]
|
[assembly: AssemblyVersion("1.4.9")]
|
||||||
|
|
|
@ -160,31 +160,39 @@ namespace XCI_Explorer
|
||||||
LB_ActualHash.Text = "";
|
LB_ActualHash.Text = "";
|
||||||
B_Extract.Enabled = false;
|
B_Extract.Enabled = false;
|
||||||
|
|
||||||
if (CheckNSP())
|
try
|
||||||
{
|
{
|
||||||
B_TrimXCI.Enabled = false;
|
if (CheckNSP())
|
||||||
B_ExportCert.Enabled = false;
|
{
|
||||||
B_ImportCert.Enabled = false;
|
B_TrimXCI.Enabled = false;
|
||||||
B_ViewCert.Enabled = false;
|
B_ExportCert.Enabled = false;
|
||||||
B_ClearCert.Enabled = false;
|
B_ImportCert.Enabled = false;
|
||||||
|
B_ViewCert.Enabled = false;
|
||||||
|
B_ClearCert.Enabled = false;
|
||||||
|
|
||||||
LoadNSP();
|
LoadNSP();
|
||||||
}
|
}
|
||||||
else if (CheckXCI())
|
else if (CheckXCI())
|
||||||
{
|
{
|
||||||
B_TrimXCI.Enabled = true;
|
B_TrimXCI.Enabled = true;
|
||||||
B_ExportCert.Enabled = true;
|
B_ExportCert.Enabled = true;
|
||||||
B_ImportCert.Enabled = true;
|
B_ImportCert.Enabled = true;
|
||||||
B_ViewCert.Enabled = true;
|
B_ViewCert.Enabled = true;
|
||||||
B_ClearCert.Enabled = true;
|
B_ClearCert.Enabled = true;
|
||||||
|
|
||||||
LoadXCI();
|
LoadXCI();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TB_File.Text = null;
|
||||||
|
MessageBox.Show("File is corrupt or unsupported.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
TB_File.Text = null;
|
MessageBox.Show("Error: " + e.ToString() + "\nFile is corrupt or unsupported.");
|
||||||
MessageBox.Show("Unsupported file.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void B_LoadROM_Click(object sender, EventArgs e)
|
private void B_LoadROM_Click(object sender, EventArgs e)
|
||||||
|
@ -230,6 +238,9 @@ namespace XCI_Explorer
|
||||||
LoadPartitions();
|
LoadPartitions();
|
||||||
LoadNCAData();
|
LoadNCAData();
|
||||||
LoadGameInfos();
|
LoadGameInfos();
|
||||||
|
|
||||||
|
if (isTrimmed())
|
||||||
|
B_TrimXCI.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Giba's better implementation (more native)
|
// Giba's better implementation (more native)
|
||||||
|
@ -560,7 +571,7 @@ namespace XCI_Explorer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TB_GameRev.Text = NACP.NACP_Datas[0].GameVer.Replace("\0", "") + " (" + xmlVersion + ")";
|
TB_GameRev.Text = xmlVersion + " (" + NACP.NACP_Datas[0].GameVer.Replace("\0", "") + ")";
|
||||||
}
|
}
|
||||||
TB_ProdCode.Text = NACP.NACP_Datas[0].GameProd.Replace("\0", "");
|
TB_ProdCode.Text = NACP.NACP_Datas[0].GameProd.Replace("\0", "");
|
||||||
if (TB_ProdCode.Text == "")
|
if (TB_ProdCode.Text == "")
|
||||||
|
@ -870,6 +881,11 @@ namespace XCI_Explorer
|
||||||
return ByteArrayToString(hashValue);
|
return ByteArrayToString(hashValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool isTrimmed()
|
||||||
|
{
|
||||||
|
return TB_ROMExactSize.Text == TB_ExactUsedSpace.Text;
|
||||||
|
}
|
||||||
|
|
||||||
private void LoadPartitions()
|
private void LoadPartitions()
|
||||||
{
|
{
|
||||||
string actualHash;
|
string actualHash;
|
||||||
|
@ -1301,7 +1317,7 @@ namespace XCI_Explorer
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Trim XCI?", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
if (MessageBox.Show("Trim XCI?", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
if (!TB_ROMExactSize.Text.Equals(TB_ExactUsedSpace.Text))
|
if (!isTrimmed())
|
||||||
{
|
{
|
||||||
FileStream fileStream = new FileStream(TB_File.Text, FileMode.Open, FileAccess.Write);
|
FileStream fileStream = new FileStream(TB_File.Text, FileMode.Open, FileAccess.Write);
|
||||||
fileStream.SetLength((long)UsedSize);
|
fileStream.SetLength((long)UsedSize);
|
||||||
|
|
Loading…
Reference in a new issue