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: ComVisible(false)]
|
||||
[assembly: Guid("206c6c47-87b1-477f-b6e6-f7e7c1a92f8f")]
|
||||
[assembly: AssemblyFileVersion("1.4.8.1")]
|
||||
[assembly: AssemblyVersion("1.4.8.1")]
|
||||
[assembly: AssemblyFileVersion("1.4.9")]
|
||||
[assembly: AssemblyVersion("1.4.9")]
|
||||
|
|
|
@ -160,6 +160,8 @@ namespace XCI_Explorer
|
|||
LB_ActualHash.Text = "";
|
||||
B_Extract.Enabled = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (CheckNSP())
|
||||
{
|
||||
B_TrimXCI.Enabled = false;
|
||||
|
@ -183,9 +185,15 @@ namespace XCI_Explorer
|
|||
else
|
||||
{
|
||||
TB_File.Text = null;
|
||||
MessageBox.Show("Unsupported file.");
|
||||
MessageBox.Show("File is corrupt or unsupported.");
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show("Error: " + e.ToString() + "\nFile is corrupt or unsupported.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void B_LoadROM_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -230,6 +238,9 @@ namespace XCI_Explorer
|
|||
LoadPartitions();
|
||||
LoadNCAData();
|
||||
LoadGameInfos();
|
||||
|
||||
if (isTrimmed())
|
||||
B_TrimXCI.Enabled = false;
|
||||
}
|
||||
|
||||
// Giba's better implementation (more native)
|
||||
|
@ -560,7 +571,7 @@ namespace XCI_Explorer
|
|||
}
|
||||
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", "");
|
||||
if (TB_ProdCode.Text == "")
|
||||
|
@ -870,6 +881,11 @@ namespace XCI_Explorer
|
|||
return ByteArrayToString(hashValue);
|
||||
}
|
||||
|
||||
public bool isTrimmed()
|
||||
{
|
||||
return TB_ROMExactSize.Text == TB_ExactUsedSpace.Text;
|
||||
}
|
||||
|
||||
private void LoadPartitions()
|
||||
{
|
||||
string actualHash;
|
||||
|
@ -1301,7 +1317,7 @@ namespace XCI_Explorer
|
|||
{
|
||||
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.SetLength((long)UsedSize);
|
||||
|
|
Loading…
Reference in a new issue