Esempio n. 1
0
        public XeXHeader(MemoryStream file)
        {
            MyBinaryReader reader;

            try
            {
                reader = new MyBinaryReader(file, EndianType.BigEndian);

                reader.BaseStream.Seek(0L, SeekOrigin.Begin);
                if (Encoding.ASCII.GetString(reader.ReadBytes(4)) == "XEX2")
                {
                    reader.BaseStream.Seek(20L, SeekOrigin.Begin);

                    uint headerCount = reader.ReadUInt32();
                    byte[] infoArray = new byte[] { 0, 4, 0, 6 };

                    for (int i = 0; i < headerCount; i++)
                    {
                        byte[] headerIdArray = reader.ReadBytes(4);

                        uint headerId = BitConverter.ToUInt32(headerIdArray, 0);

                        if (headerId == BitConverter.ToUInt32(infoArray, 0))
                        {
                            uint dataAddress = reader.ReadUInt32();

                            reader.BaseStream.Seek((long)dataAddress, SeekOrigin.Begin);
                            this.mediaId = reader.ReadBytes(4);
                            this.version = reader.ReadUInt32();
                            this.baseVersion = reader.ReadUInt32();
                            this.titleId = reader.ReadBytes(4);
                            this.platform = reader.ReadByte();
                            this.executableType = reader.ReadByte();
                            this.discNumber = reader.ReadByte();
                            this.discCount = reader.ReadByte();
                            break;
                        }
                        else
                        {
                            reader.ReadUInt32();
                        }
                    }
                }
                else throw new Exception("Extracted file is not XEX file");
            }
            catch (Exception ex)
            {
                throw ex;
            }

            reader.Close();
        }
Esempio n. 2
0
        public VTSM_PGCI_UT(byte[] array)
        {
            try
            {
                MemoryStream ms = new MemoryStream(array);
                MyBinaryReader br = new MyBinaryReader(ms);

                numberOfVTSM_PGCI_LU = br.ReadInt16B();
                br.Skip(2);
                endByteOfVTSM_PGCI_LU = br.ReadInt32B();
                br.Skip(4);
                int LU_1startByte = br.ReadInt32B();
                br.BaseStream.Seek(LU_1startByte, SeekOrigin.Begin);
                menus = new VTSM_PGCI_LU_MENUS(br.ReadBytes(array.Length - LU_1startByte));
            }
            catch (Exception ex)
            {
                throw new Exception("Error searching sectors in DVD MENU", ex);
            }
        }