Read() public static méthode

public static Read ( Stream s ) : AppTitle
s System.IO.Stream
Résultat AppTitle
Exemple #1
0
        public static SMDH Read(Stream s)
        {
            if (!s.CanSeek)
            {
                throw new ArgumentException("Stream can't Seek", nameof(s));
            }

            var smdh = new SMDH(true);

            using (var br = new BinaryReader(s, Encoding.ASCII, true))
            {
                var flag = br.ReadUInt32() == BitConverter.ToUInt32(MAGIC, 0);
                if (!flag)
                {
                    throw new InvalidDataException("Not a SMDH File");
                }

                smdh.Version    = br.ReadInt16();
                smdh.Reserved_1 = br.ReadInt16();

                smdh.AppTitles = new AppTitle[16];
                for (int i = 0; i < 16; i++)
                {
                    smdh.AppTitles[i] = AppTitle.Read(s);
                }

                smdh.Settings = AppSettings.Read(s);

                smdh.Reserved_2 = br.ReadInt64();
                smdh.SmallIcon.Read(s);
                smdh.LargeIcon.Read(s);
            }
            return(smdh);
        }