예제 #1
0
 public static void ShowXciExplorer(string filePath)
 {
     XCI_Explorer.MainForm mainForm = new XCI_Explorer.MainForm(true);
     mainForm.ReadXci(filePath);
 }
예제 #2
0
        /*
         * public static XciItem GetXciInfoNew(string filePath, XciLocation location)
         * {
         *  XciItem xci = new XciItem(filePath);
         *
         *  if (!File.Exists(filePath))
         *      return null;
         *
         *  return xci;
         *
         * }
         */

        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);

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

            //xci.packageId = header.PackageID;

            xci.uniqueId = GetXciIdentifier(filePath);

            mainForm.ReadXci(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');
            xci.gameIcon          = (Bitmap)mainForm.PB_GameIcon.BackgroundImage;
            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 (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);
        }