コード例 #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);
        }
コード例 #2
0
ファイル: SMDH.cs プロジェクト: usagirei/3DS-Theme-Editor
        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;
        }
コード例 #3
0
        public ThemeViewModel(Theme model, SMDH info = null) : base(model, Guid.NewGuid().ToString())
        {
            Flags = new FlagsViewModel(model.Flags, Tag);
            Colors = new ColorsViewModel(model.Colors, Tag);
            Textures = new TexturesViewModel(model.Textures, Tag);

            Info = new ThemeInfoViewModel(info ?? new SMDH(), Tag);

            SetupRules();
        }
コード例 #4
0
        public ThemeInfoViewModel(SMDH model, string tag) : base(model, tag)
        {
            SmallIcon = new TextureViewModel(model.SmallIcon, Tag);
            LargeIcon = new TextureViewModel(model.LargeIcon, Tag);

            SmallIcon.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(TextureViewModel.Bitmap))
                    RaiseViewModelChanged(nameof(SmallIcon), null, null);
            };
            LargeIcon.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(TextureViewModel.Bitmap))
                    RaiseViewModelChanged(nameof(LargeIcon), null, null);
            };
        }
コード例 #5
0
ファイル: SMDH.cs プロジェクト: usagirei/3DS-Theme-Editor
        public static void Write(SMDH smdh, Stream s)
        {
            using (var bw = new BinaryWriter(s, Encoding.ASCII, true))
            {
                bw.Write(MAGIC);
                bw.Write(smdh.Version);
                bw.Write(smdh.Reserved_1);

                for (int i = 0; i < 16; i++)
                    AppTitle.Write(smdh.AppTitles[i], s);

                AppSettings.Write(smdh.Settings, s);
                bw.Write(smdh.Reserved_2);
                bw.Write(smdh.SmallIcon.Data);
                bw.Write(smdh.LargeIcon.Data);
            }
        }
コード例 #6
0
        public static void Write(SMDH smdh, Stream s)
        {
            using (var bw = new BinaryWriter(s, Encoding.ASCII, true))
            {
                bw.Write(MAGIC);
                bw.Write(smdh.Version);
                bw.Write(smdh.Reserved_1);

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

                AppSettings.Write(smdh.Settings, s);
                bw.Write(smdh.Reserved_2);
                bw.Write(smdh.SmallIcon.Data);
                bw.Write(smdh.LargeIcon.Data);
            }
        }