예제 #1
0
        private static ColorOffsets Write_Colors(Stream s, Theme b)
        {
            var offsets = new ColorOffsets();

            using (BinaryWriter bw = new BinaryWriter(s, Encoding.ASCII, true))
            {
                // Top Solid
#if SKIP_COLOR_NOT_SET
                if (b.Flags.TopDrawType == TopDrawType.SolidColor || b.Flags.TopDrawType == TopDrawType.SolidColorTexture)
                #endif
                {
                    offsets.TopBackground = (uint) s.Position;
                    var seven = b.Flags.TopDrawType == TopDrawType.SolidColorTexture;
                    b.Colors.TopBackground.Write(bw, seven);
                }
                // Cursor
#if SKIP_COLOR_NOT_SET
                if (b.Flags.CursorColor)
#endif
                {
                    offsets.Cursor = (uint) s.Position;
                    b.Colors.Cursor.Write(bw);
                }
                // 3D Folder
#if SKIP_COLOR_NOT_SET
                if (b.Flags.FolderColor)
#endif
                {
                    offsets.Folder = (uint) s.Position;
                    b.Colors.Folder.Write(bw);
                }
                // 3D File
#if SKIP_COLOR_NOT_SET
                if (b.Flags.FileColor)
#endif
                {
                    offsets.File = (uint) s.Position;
                    b.Colors.File.Write(bw);
                }
                // Arrow Button
#if SKIP_COLOR_NOT_SET
                if (b.Flags.ArrowButtonColor)
#endif
                {
                    offsets.ArrowButton = (uint) s.Position;
                    b.Colors.ArrowButton.Write(bw);
                }
                // Arrow
#if SKIP_COLOR_NOT_SET
                if (b.Flags.ArrowColor)
#endif
                {
                    offsets.Arrow = (uint) s.Position;
                    b.Colors.Arrow.Write(bw);
                }
                // Open Close Button
#if SKIP_COLOR_NOT_SET
                if (b.Flags.OpenCloseColor)
#endif
                {
                    offsets.Open = (uint) s.Position;
                    b.Colors.Open.Write(bw);
                    offsets.Close = (uint) s.Position;
                    b.Colors.Close.Write(bw);
                }
                // Game Text
#if SKIP_COLOR_NOT_SET
                if (b.Flags.GameTextDrawType)
#endif
                {
                    offsets.GameText = (uint) s.Position;
                    b.Colors.GameText.Write(bw);
                }
                // Bottom Solid
#if SKIP_COLOR_NOT_SET
                if (b.Flags.BottomBackgroundInnerColor)
#endif
                {
                    offsets.BottomSolid = (uint) s.Position;
                    b.Colors.BottomBackgroundInner.Write(bw);
                }
                // Bottom Outer
#if SKIP_COLOR_NOT_SET
                if (b.Flags.BottomBackgroundOuterColor)
#endif
                {
                    offsets.BottomOuter = (uint) s.Position;
                    b.Colors.BottomBackgroundOuter.Write(bw);
                }
                // Folder BG
#if SKIP_COLOR_NOT_SET
                if (b.Flags.FolderBackgroundColor)
#endif
                {
                    offsets.FolderBackground = (uint) s.Position;
                    b.Colors.FolderBackground.Write(bw);
                }
                // Folder Arrow
#if SKIP_COLOR_NOT_SET
                if (b.Flags.FolderArrowColor)
#endif
                {
                    offsets.FolderArrow = (uint) s.Position;
                    b.Colors.FolderArrow.Write(bw);
                }
                // Bottom Corner
#if SKIP_COLOR_NOT_SET
                if (b.Flags.BottomCornerButtonColor)
#endif
                {
                    offsets.BottomCornerButton = (uint) s.Position;
                    b.Colors.BottomCornerButton.Write(bw);
                }
                // Top Corner
#if SKIP_COLOR_NOT_SET
                if (b.Flags.TopCornerButtonColor)
#endif
                {
                    offsets.TopCornerButton = (uint) s.Position;
                    b.Colors.TopCornerButton.Write(bw);
                }
                // Demo Text
#if SKIP_COLOR_NOT_SET
                if (b.Flags.DemoTextColor)
#endif
                {
                    offsets.DemoText = (uint) s.Position;
                    b.Colors.DemoText.Write(bw);
                }
            }
            return offsets;
        }
예제 #2
0
        private static Colors Read_Colors(Stream s, Flags flags, ColorOffsets offsets)
        {
            var colors = new Colors();

            using (var br = new BinaryReader(s, Encoding.ASCII, true))
            {
                // Top Solid
#if SKIP_COLOR_NOT_SET
                if (flags.TopDrawType == TopDrawType.SolidColor || flags.TopDrawType == TopDrawType.SolidColorTexture)
#endif
                {
                    s.Position = offsets.TopBackground;
                    var sevenBytes = flags.TopDrawType == TopDrawType.SolidColorTexture;
                    colors.TopBackground = TopBackgroundSet.Read(br, sevenBytes);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.TopBackground = new TopBackgroundSet();
                }
#endif

                // Cursor
#if SKIP_COLOR_NOT_SET
                if (flags.CursorColor)
#endif

                {
                    s.Position = offsets.Cursor;
                    colors.Cursor = CursorSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Cursor = new CursorSet();
                }
#endif

                // 3D Folder
#if SKIP_COLOR_NOT_SET
                if (flags.FolderColor)
#endif

                {
                    s.Position = offsets.Folder;
                    colors.Folder = FolderSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Folder = new FolderSet();
                }
#endif

                // 3D File
#if SKIP_COLOR_NOT_SET
                if (flags.FileColor)
#endif

                {
                    s.Position = offsets.File;
                    colors.File = FileSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.File = new FileSet();
                }
#endif

                // Arrow Button
#if SKIP_COLOR_NOT_SET
                if (flags.ArrowButtonColor)
#endif

                {
                    s.Position = offsets.ArrowButton;
                    colors.ArrowButton = ArrowButtonSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.ArrowButton = new ArrowButtonSet();
                }
#endif

                // Arrows
#if SKIP_COLOR_NOT_SET
                if (flags.ArrowColor)
#endif

                {
                    s.Position = offsets.Arrow;
                    colors.Arrow = ArrowSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Arrow = new ArrowSet();
                }
#endif

                // Open Button
#if SKIP_COLOR_NOT_SET
                if (flags.OpenCloseColor)
#endif

                {
                    s.Position = offsets.Open;
                    colors.Open = OpenCloseSet.Read(br);

                    s.Position = offsets.Close;
                    colors.Close = OpenCloseSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Open = new OpenCloseSet();
                    colors.Close = new OpenCloseSet();
                }
#endif

                // Game Text
#if SKIP_COLOR_NOT_SET
                if (flags.GameTextDrawType)
#endif

                {
                    s.Position = offsets.GameText;
                    colors.GameText = GameTextSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.GameText = new GameTextSet();
                }
#endif

                // Bottom Solid
#if SKIP_COLOR_NOT_SET
                if (flags.BottomBackgroundInnerColor)
#endif

                {
                    s.Position = offsets.BottomSolid;
                    colors.BottomBackgroundInner = BottomBackgroundInnerSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.BottomBackgroundInner = new BottomBackgroundInnerSet();
                }
#endif

                // Bottom Outer
#if SKIP_COLOR_NOT_SET
                if (flags.BottomBackgroundOuterColor)
#endif

                {
                    s.Position = offsets.BottomOuter;
                    colors.BottomBackgroundOuter = BottomBackgroundOuterSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.BottomBackgroundOuter = new BottomBackgroundOuterSet();
                }
#endif

                // Folder BG
#if SKIP_COLOR_NOT_SET
                if (flags.FolderBackgroundColor)
#endif

                {
                    s.Position = offsets.FolderBackground;
                    colors.FolderBackground = BottomBackgroundInnerSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.FolderBackground = new BottomBackgroundInnerSet();
                }
#endif

                // Folder Arr
#if SKIP_COLOR_NOT_SET
                if (flags.FolderArrowColor)
#endif

                {
                    s.Position = offsets.FolderArrow;
                    colors.FolderArrow = FolderArrowSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.FolderArrow = new FolderArrowSet();
                }
#endif

                // Bottom Corner
#if SKIP_COLOR_NOT_SET
                if (flags.BottomCornerButtonColor)
#endif

                {
                    s.Position = offsets.BottomCornerButton;
                    colors.BottomCornerButton = BottomCorner.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.BottomCornerButton = new BottomCorner();
                }
#endif

                // Top Corner
#if SKIP_COLOR_NOT_SET
                if (flags.TopCornerButtonColor)
#endif

                {
                    s.Position = offsets.TopCornerButton;
                    colors.TopCornerButton = TopCornerSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.TopCornerButton = new TopCornerSet();
                }
#endif

                // Demo Text
#if SKIP_COLOR_NOT_SET
                if (flags.DemoTextColor)
#endif

                {
                    s.Position = offsets.DemoText;
                    colors.DemoText = DemoTextSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.DemoText = new DemoTextSet();
                }
#endif
            }
            return colors;
        }
예제 #3
0
 private static void Write_Flags
     (Stream s, Theme body, TextureOffsets tOff, ColorOffsets cOff, uint wOff)
 {
     using (BinaryWriter bw = new BinaryWriter(s, Encoding.ASCII, true))
     {
         // Version
         bw.Write(1);
         // BGM Flag
         bw.Write((byte) 0);
         bw.Write((byte) (body.Flags.BackgroundMusic ? 1 : 0));
         bw.Write((byte) 0);
         bw.Write((byte) 0);
         // Unkown
         bw.Write((uint) 0);
         // Top Screen
         bw.Write((uint) body.Flags.TopDrawType);
         bw.Write((uint) body.Flags.TopFrameType);
         bw.Write((uint) cOff.TopBackground);
         bw.Write((uint) tOff.Top);
         bw.Write((uint) tOff.TopExt);
         // Bottom Screen
         bw.Write((uint) body.Flags.BottomDrawType);
         bw.Write((uint) body.Flags.BottomFrameType);
         bw.Write((uint) tOff.Bottom);
         // Cursor
         bw.Write((uint) (body.Flags.CursorColor ? 1 : 0));
         bw.Write((uint) cOff.Cursor);
         // 3D Folder
         bw.Write((uint) (body.Flags.FolderColor ? 1 : 0));
         bw.Write((uint) cOff.Folder);
         // 2D Folder
         bw.Write((uint) (body.Flags.FolderTexture ? 1 : 0));
         bw.Write((uint) tOff.FolderClosed);
         bw.Write((uint) tOff.FolderOpen);
         // 3D File
         bw.Write((uint) (body.Flags.FileColor ? 1 : 0));
         bw.Write((uint) cOff.File);
         // 2D File
         bw.Write((uint) (body.Flags.FileTexture ? 1 : 0));
         bw.Write((uint) tOff.FileLarge);
         bw.Write((uint) tOff.FileSmall);
         // Arrow Button
         bw.Write((uint) (body.Flags.ArrowButtonColor ? 1 : 0));
         bw.Write((uint) cOff.ArrowButton);
         // Arrow
         bw.Write((uint) (body.Flags.ArrowColor ? 1 : 0));
         bw.Write((uint) cOff.Arrow);
         // Open Close
         bw.Write((uint) (body.Flags.OpenCloseColor ? 1 : 0));
         bw.Write((uint) cOff.Open);
         bw.Write((uint) cOff.Close);
         // Game Text
         bw.Write((uint) body.Flags.GameTextDrawType);
         bw.Write((uint) cOff.GameText);
         // Bottom Solid
         bw.Write((uint) (body.Flags.BottomBackgroundInnerColor ? 1 : 0));
         bw.Write((uint) cOff.BottomSolid);
         // Bottom Outer
         bw.Write((uint) (body.Flags.BottomBackgroundOuterColor ? 1 : 0));
         bw.Write((uint) cOff.BottomOuter);
         // Folder BG
         bw.Write((uint) (body.Flags.FolderBackgroundColor ? 1 : 0));
         bw.Write((uint) cOff.FolderBackground);
         // Folder Arrow
         bw.Write((uint) (body.Flags.FolderArrowColor ? 1 : 0));
         bw.Write((uint) cOff.FolderArrow);
         // Bottom Corner
         bw.Write((uint) (body.Flags.BottomCornerButtonColor ? 1 : 0));
         bw.Write((uint) cOff.BottomCornerButton);
         // Top Corner
         bw.Write((uint) (body.Flags.TopCornerButtonColor ? 1 : 0));
         bw.Write((uint) cOff.TopCornerButton);
         // Demo Text
         bw.Write((uint) (body.Flags.DemoTextColor ? 1 : 0));
         bw.Write((uint) cOff.DemoText);
         // SFX
         bw.Write((uint) (body.Flags.SoundEffect ? 1 : 0));
         bw.Write((uint) body.CWAV.Length);
         bw.Write((uint) wOff);
     }
 }
예제 #4
0
        private static ColorOffsets Read_ColorOffsets(Stream s, Flags flags)
        {
            var offsets = new ColorOffsets();

            using (var br = new BinaryReader(s, Encoding.ASCII, true))
            {
                //Top Solid
                {
                    s.Position = 0x14;
                    offsets.TopBackground = br.ReadUInt32();
                }

                // Cursor
                {
                    s.Position = 0x30;
                    offsets.Cursor = br.ReadUInt32();
                }

                // 3D Folder
                {
                    s.Position = 0x38;
                    offsets.Folder = br.ReadUInt32();
                }

                // 3D File
                {
                    s.Position = 0x4C;
                    offsets.File = br.ReadUInt32();
                }

                // Arrow Button
                {
                    s.Position = 0x60;
                    offsets.ArrowButton = br.ReadUInt32();
                }

                // Arrows
                {
                    s.Position = 0x68;
                    offsets.Arrow = br.ReadUInt32();
                }

                // Open Button
                {
                    s.Position = 0x70;
                    offsets.Open = br.ReadUInt32();
                    offsets.Close = br.ReadUInt32();
                }

                // Game Text
                {
                    s.Position = 0x7C;
                    offsets.GameText = br.ReadUInt32();
                }

                // Bottom Solid
                {
                    s.Position = 0x84;
                    offsets.BottomSolid = br.ReadUInt32();
                }

                // Bottom Outer
                {
                    s.Position = 0x8C;
                    offsets.BottomOuter = br.ReadUInt32();
                }

                // Folder BG
                {
                    s.Position = 0x94;
                    offsets.FolderBackground = br.ReadUInt32();
                }

                // Folder Arr
                {
                    s.Position = 0x9C;
                    offsets.FolderArrow = br.ReadUInt32();
                }

                // Bottom Corner
                {
                    s.Position = 0xA4;
                    offsets.BottomCornerButton = br.ReadUInt32();
                }

                // Top Corner
                {
                    s.Position = 0xAC;
                    offsets.TopCornerButton = br.ReadUInt32();
                }

                // Demo Text
                {
                    s.Position = 0xB4;
                    offsets.DemoText = br.ReadUInt32();
                }
            }
            return offsets;
        }