Пример #1
0
        public static XciItem GetXciInfo(string filePath, XciLocation location)
        {
            XciItem xci = new XciItem(filePath);

            Log($"GetXciInfo {filePath}");

            if (!File.Exists(filePath))
            {
                return(null);
            }

            XCI_Explorer.MainForm mainForm = new XCI_Explorer.MainForm(false);
            mainForm.IgnoreFileCorruptErrors = Helpers.Settings.config.ignoreFileCorruptErrors;

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

            //xci.packageId = header.PackageID;

            xci.uniqueId = GetXciIdentifier(filePath);

            mainForm.SGM_ProcessFile(filePath);

            xci.gameName         = mainForm.TB_Name.Text.Trim().TrimEnd('\0');
            xci.gameDeveloper    = mainForm.TB_Dev.Text.Trim().TrimEnd('\0');
            xci.gameCardCapacity = mainForm.TB_Capacity.Text.Trim().TrimEnd('\0');

            if ((Bitmap)mainForm.PB_GameIcon.BackgroundImage == null)
            {
                xci.gameIcon = GetDefaultIcon();
            }
            else
            {
                xci.gameIcon = (Bitmap)mainForm.PB_GameIcon.BackgroundImage;
            }
            xci.contentType = mainForm.ContentType;

            if (xci.contentType == null || xci.contentType.Length == 0)
            {
                xci.contentType = "NSP Game";
            }

            xci.gameRevision      = mainForm.TB_GameRev.Text.Trim().TrimEnd('\0');
            xci.masterKeyRevision = mainForm.TB_MKeyRev.Text.Trim().TrimEnd('\0');
            xci.sdkVersion        = mainForm.TB_SDKVer.Text.Trim().TrimEnd('\0');
            xci.titleId           = mainForm.TB_TID.Text.Trim().TrimEnd('\0');
            if (xci.titleId.Length != 16)
            {
                xci.titleId = 0 + xci.titleId;
            }
            xci.gameSize     = mainForm.ExactSize;
            xci.gameUsedSize = mainForm.UsedSize;
            xci.productCode  = mainForm.TB_ProdCode.Text.Trim().TrimEnd('\0');
            xci.gameCert     = ReadXciCert(xci.xciFilePath);
            xci.xciFileSize  = new System.IO.FileInfo(xci.xciFilePath).Length;

            if (xci.gameName.Length == 0 && xci.gameUsedSize == 0)
            {
                xci.gameName = Path.GetFileName(xci.xciFilePath) + " (Corrupt?)";
            }

            if (location == XciLocation.PC)
            {
                xci.xciLocation = XciLocation.PC;
                xci.isGameOnPc  = true;
            }
            else
            {
                xci.xciLocation = XciLocation.SD;
                xci.isGameOnSd  = true;
            }

            // compare the expected size with the actual size
            xci.isXciTrimmed = (xci.gameSize == xci.gameUsedSize);

            // compare the first byte of the cert to the rest of the cert if they're all the same,
            // it's not unique. ex 255 for all
            xci.isUniqueCert = !xci.gameCert.All(s => s.Equals(xci.gameCert[0]));

            mainForm.Close();
            mainForm = null;

            return(xci);
        }
Пример #2
0
 public static void ShowXciExplorer(string filePath)
 {
     XCI_Explorer.MainForm mainForm = new XCI_Explorer.MainForm(true);
     mainForm.IgnoreFileCorruptErrors = Helpers.Settings.config.ignoreFileCorruptErrors;
     mainForm.SGM_ProcessFile(filePath);
 }
Пример #3
0
 public static void ShowXciExplorer(string filePath)
 {
     XCI_Explorer.MainForm mainForm = new XCI_Explorer.MainForm(true);
     mainForm.ReadXci(filePath);
 }