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;
}