Skip to content

Commit b9872e2

Browse files
committed
Add option to ignore corrupt file messages
to config file.
1 parent 89d3398 commit b9872e2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

SwitchGameManager/Helpers/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class Config
1919

2020
public int formHeight = 475;
2121
public int formWidth = 975;
22+
public bool ignoreFileCorruptErrors = false;
2223
public int listIconSize = 1;
2324
public List<string> localXciFolders = new List<string>();
2425
public byte[] olvState;

SwitchGameManager/Helpers/XCIHelper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ public static XciItem GetXciInfo(string filePath, XciLocation location)
273273
return null;
274274

275275
XCI_Explorer.MainForm mainForm = new XCI_Explorer.MainForm(false);
276+
mainForm.IgnoreFileCorruptErrors = Helpers.Settings.config.ignoreFileCorruptErrors;
276277

277278
//xci_header header = hac.GetXCIHeader(xci.xciFilePath);
278279

@@ -305,7 +306,9 @@ public static XciItem GetXciInfo(string filePath, XciLocation location)
305306
xci.productCode = mainForm.TB_ProdCode.Text.Trim().TrimEnd('\0');
306307
xci.gameCert = ReadXciCert(xci.xciFilePath);
307308
xci.xciFileSize = new System.IO.FileInfo(xci.xciFilePath).Length;
308-
309+
310+
if (xci.gameName.Length == 0 && xci.gameUsedSize == 0)
311+
xci.gameName = Path.GetFileName(xci.xciFilePath) + " (Corrupt?)";
309312

310313
if (location == XciLocation.PC)
311314
{
@@ -662,6 +665,7 @@ public static void ShowXciCert(XciItem xci)
662665
public static void ShowXciExplorer(string filePath)
663666
{
664667
XCI_Explorer.MainForm mainForm = new XCI_Explorer.MainForm(true);
668+
mainForm.IgnoreFileCorruptErrors = Helpers.Settings.config.ignoreFileCorruptErrors;
665669
mainForm.SGM_ProcessFile(filePath);
666670
}
667671

XCI-Explorer-master/XCI_Explorer/MainForm.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public partial class MainForm : Form
2626
public double UsedSize;
2727
public double ExactSize;
2828
public string ContentType;
29+
public bool IgnoreFileCorruptErrors = false;
2930
private Image[] Icons = new Image[16];
3031
private string[] Language = new string[16] {
3132
"American English",
@@ -211,12 +212,12 @@ private void ProcessFile()
211212
else
212213
{
213214
TB_File.Text = null;
214-
MessageBox.Show("File is corrupt or unsupported.");
215+
if (!IgnoreFileCorruptErrors) MessageBox.Show("File is corrupt or unsupported.");
215216
}
216217
}
217218
catch (Exception e)
218219
{
219-
MessageBox.Show("Error: " + e.ToString() + "\nFile is corrupt or unsupported.");
220+
if (!IgnoreFileCorruptErrors) MessageBox.Show("Error: " + e.ToString() + "\nFile is corrupt or unsupported.");
220221
}
221222

222223
}

0 commit comments

Comments
 (0)