Пример #1
0
        /// <summary>
        /// Read from a stream and get access control info, if possible
        /// </summary>
        /// <param name="reader">BinaryReader representing the input stream</param>
        /// <returns>Access control info object, null on error</returns>
        public static AccessControlInfo Read(BinaryReader reader)
        {
            AccessControlInfo aci = new AccessControlInfo();

            try
            {
                aci.ARM11LocalSystemCapabilities = ARM11LocalSystemCapabilities.Read(reader);
                aci.ARM11KernelCapabilities      = ARM11KernelCapabilities.Read(reader);
                aci.ARM9AccessControl            = ARM9AccessControl.Read(reader);
                return(aci);
            }
            catch
            {
                return(null);
            }
        }
        /// <summary>
        /// Read from a stream and get ARM11 local system capabilities, if possible
        /// </summary>
        /// <param name="reader">BinaryReader representing the input stream</param>
        /// <returns>ARM11 local system capabilities object, null on error</returns>
        public static ARM11LocalSystemCapabilities Read(BinaryReader reader)
        {
            ARM11LocalSystemCapabilities lsc = new ARM11LocalSystemCapabilities();

            try
            {
                lsc.ProgramID   = reader.ReadBytes(8);
                lsc.CoreVersion = reader.ReadUInt32();
                lsc.Flag1       = (ARM11LSCFlag1)reader.ReadByte();
                lsc.Flag2       = (ARM11LSCFlag2)reader.ReadByte();
                lsc.Flag0       = (ARM11LSCFlag0)reader.ReadByte();
                lsc.Priority    = reader.ReadByte();

                lsc.ResourceLimitDescriptors = new byte[16][];
                for (int i = 0; i < 16; i++)
                {
                    lsc.ResourceLimitDescriptors[i] = reader.ReadBytes(2);
                }

                lsc.StorageInfo = StorageInfo.Read(reader);

                lsc.ServiceAccessControl = new byte[32][];
                for (int i = 0; i < 32; i++)
                {
                    lsc.ServiceAccessControl[i] = reader.ReadBytes(8);
                }

                lsc.ExtendedServiceAccessControl = new byte[2][];
                for (int i = 0; i < 2; i++)
                {
                    lsc.ExtendedServiceAccessControl[i] = reader.ReadBytes(8);
                }

                lsc.Reserved = reader.ReadBytes(0xF);
                lsc.ResourceLimitCategory = (ResourceLimitCategory)reader.ReadByte();
                return(lsc);
            }
            catch
            {
                return(null);
            }
        }