Esempio n. 1
0
        /// <summary>
        /// Read from a stream and get system control info, if possible
        /// </summary>
        /// <param name="reader">BinaryReader representing the input stream</param>
        /// <returns>System control info object, null on error</returns>
        public static SystemControlInfo Read(BinaryReader reader)
        {
            SystemControlInfo sci = new SystemControlInfo();

            try
            {
                sci.ApplicationTitle    = reader.ReadChars(8);
                sci.Reserved1           = reader.ReadBytes(5);
                sci.Flag                = reader.ReadByte();
                sci.RemasterVersion     = reader.ReadBytes(2);
                sci.TextCodesetInfo     = CodeSetInfo.Read(reader);
                sci.StackSize           = reader.ReadUInt32();
                sci.ReadOnlyCodeSetInfo = CodeSetInfo.Read(reader);
                sci.Reserved2           = reader.ReadBytes(4);
                sci.DataCodeSetInfo     = CodeSetInfo.Read(reader);
                sci.BSSSize             = reader.ReadUInt32();

                sci.DependencyModuleList = new byte[48][];
                for (int i = 0; i < 48; i++)
                {
                    sci.DependencyModuleList[i] = reader.ReadBytes(8);
                }

                sci.SystemInfo = SystemInfo.Read(reader);
                return(sci);
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Read from a stream and get a CXI extended header, if possible
        /// </summary>
        /// <param name="reader">BinaryReader representing the input stream</param>
        /// <returns>CXI extended header object, null on error</returns>
        public static CXIExtendedHeader Read(BinaryReader reader)
        {
            CXIExtendedHeader header = new CXIExtendedHeader();

            try
            {
                header.SCI = SystemControlInfo.Read(reader);
                header.ACI = AccessControlInfo.Read(reader);
                header.AccessDescSignature = reader.ReadBytes(0x100);
                header.NCCHHDRPublicKey    = reader.ReadBytes(0x100);
                header.ACIForLimitations   = AccessControlInfo.Read(reader);
                return(header);
            }
            catch
            {
                return(null);
            }
        }