Beispiel #1
0
        private static void Main()
        {
            Console.WriteLine("Iso2god-cli " + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion + " - " + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).LegalCopyright);
            Console.WriteLine("Ported to CLI by Elie CHARRA <elie [dot] charra [at] gmail.com>");
            Console.WriteLine("Usage : iso2god <source iso> <destination folder>");
            Console.WriteLine("");
            //Get360TitleName.getFromDB();

            String[] arguments = Environment.GetCommandLineArgs();

            if (arguments.Length == 3)
            {
                String isoPath         = arguments[1];
                String destinationPath = arguments[2];

                Console.WriteLine("+ Computing ISO metadata ...");
                IsoDetails        iso = new IsoDetails(new IsoDetailsArgs(isoPath, Path.GetTempPath(), Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "xextool.exe"));
                IsoDetailsResults isoDetailsResults = iso.IsoDetails_DoWork();
                IsoEntryID        isoEntryID        = new IsoEntryID(isoDetailsResults.TitleID, isoDetailsResults.MediaID, Convert.ToByte(isoDetailsResults.DiscNumber[0]), Convert.ToByte(isoDetailsResults.DiscCount[0]), Convert.ToByte(isoDetailsResults.Platform[0]), Convert.ToByte(isoDetailsResults.ExType[0]));
                IsoEntry          isoEntry          = new IsoEntry(IsoEntryPlatform.Xbox360, isoPath, destinationPath, new FileInfo(isoPath).Length, isoDetailsResults.Name, isoEntryID);
                Get360TitleName.getTitleID(isoEntry.ID.TitleID);

                Console.WriteLine("-----------------------------------------------------------");
                Console.WriteLine("> Title    : " + Get360TitleName.getFromDB(isoEntry.ID.TitleID));
                Console.WriteLine("> Title ID : " + isoEntry.ID.TitleID);
                Console.WriteLine("> Disc     : " + Char.ConvertFromUtf32(isoEntry.ID.DiscNumber) + " / " + Char.ConvertFromUtf32(isoEntry.ID.DiscCount));
                Console.WriteLine("> Media ID : " + isoEntry.ID.MediaID);
                Console.WriteLine("> Platform : " + isoEntry.Platform);
                Console.WriteLine("> Ex       : " + Char.ConvertFromUtf32(isoEntry.ID.ExType));
                Console.WriteLine("-----------------------------------------------------------");

                Console.WriteLine("+ Launching GOD conversion ...");
                Iso2God iso2god = new Iso2God();
                iso2god.Run(isoEntry, isoEntry.ID.TitleID.ToString());
            }
        }
Beispiel #2
0
        private void Iso2God_Partial(bool Crop, IsoEntry iso, string ID)
        {
            FileStream stream;
            GDF        gdf;

            Console.WriteLine("+ Examining ISO image...");
            try
            {
                stream = new FileStream(iso.Path, FileMode.Open, FileAccess.Read, FileShare.Read);
            }
            catch (Exception)
            {
                Console.WriteLine("- Cannot access the ISO image because it is being accessed by another application.");
                return;
            }
            try
            {
                gdf = new GDF(stream);
            }
            catch (Exception exception)
            {
                Console.WriteLine("- Error while parsing GDF: " + exception.Message);
                return;
            }
            ulong num = 0L;

            if (Crop)
            {
                num = (((ulong)iso.Size) - gdf.RootOffset) - (((ulong)iso.Size) - (gdf.LastOffset + gdf.RootOffset));
            }
            else
            {
                num = ((ulong)iso.Size) - gdf.RootOffset;
            }
            uint        blocksReq    = (uint)Math.Ceiling(num / ((double)blockSize));
            uint        partsReq     = (uint)Math.Ceiling(blocksReq / ((double)blockPerPart));
            ContentType type         = (iso.Platform == IsoEntryPlatform.Xbox360) ? ContentType.GamesOnDemand : ContentType.XboxOriginal;
            string      gameTitle    = Get360TitleName.getFromDB(ID).ToString();
            var         invalidChars = new string[] { ":" };

            foreach (var i in invalidChars)
            {
                gameTitle = gameTitle.Replace(i, " ");
            }
            Console.WriteLine(gameTitle);
            object[] objArray = { iso.Destination, gameTitle, Path.DirectorySeparatorChar, "0000", ((uint)type).ToString("X02"), Path.DirectorySeparatorChar };
            string   path     = string.Concat(objArray) + ((uniqueName != null) ? uniqueName : iso.ID.TitleID) + ".data";

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            Directory.CreateDirectory(path);
            Console.WriteLine("+ Beginning ISO conversion...");
            Start = DateTime.Now;
            stream.Seek((long)gdf.RootOffset, SeekOrigin.Begin);
            writeParts(stream, path, partsReq, blocksReq);
            Console.WriteLine("+ Calculating Master Hash Table chain...");
            byte[] lastMhtHash  = new byte[20];
            uint   lastPartSize = 0;

            calcMhtHashChain(path, partsReq, out lastPartSize, out lastMhtHash);
            ulong num6      = 0xa290L;
            ulong num7      = blockSize * num6;
            ulong sizeParts = lastPartSize + ((partsReq - 1) * num7);

            Console.WriteLine("+ Creating LIVE header...");
            createConHeader(path.Substring(0, path.Length - 5), iso, blocksReq, 0, partsReq, sizeParts, lastMhtHash);
            stream.Close();
            stream.Dispose();
            gdf.Dispose();
            Finish = DateTime.Now;
            TimeSpan span = Finish - Start;

            Console.WriteLine("+ Done!");
            Console.WriteLine("+ Finished in " + span.Minutes + "m" + span.Seconds + "s. GOD package written to: " + path);
            GC.Collect();
        }