private static TextureOffsets Write_Textures(Stream s, Theme b)
{
TextureOffsets offsets = new TextureOffsets();
// Top
if (b.Flags.TopDrawType == TopDrawType.Texture
&& b.Textures.Top.Format != RawTexture.DataFormat.Invalid)
{
offsets.Top = (uint) s.Position;
var data = b.Textures.Top.Data;
s.Write(data, 0, data.Length);
}
else if (b.Flags.TopDrawType == TopDrawType.SolidColorTexture
&& b.Textures.Top.Format != RawTexture.DataFormat.Invalid)
{
offsets.Top = (uint) s.Position;
var data = b.Textures.Top.Data;
s.Write(data, 0, data.Length);
}
// Top Ext
if (b.Flags.TopDrawType == TopDrawType.SolidColorTexture
&& b.Textures.TopExt.Format != RawTexture.DataFormat.Invalid)
{
offsets.TopExt = (uint)s.Position;
var data = b.Textures.TopExt.Data;
s.Write(data, 0, data.Length);
}
// Bottom
if (b.Flags.BottomDrawType == BottomDrawType.Texture
&& b.Textures.Bottom.Format != RawTexture.DataFormat.Invalid)
{
offsets.Bottom = (uint) s.Position;
var data = b.Textures.Bottom.Data;
s.Write(data, 0, data.Length);
}
// Folder
if (b.Flags.FolderTexture
&& b.Textures.FolderClosed.Format != RawTexture.DataFormat.Invalid
&& b.Textures.FolderOpen.Format != RawTexture.DataFormat.Invalid)
{
offsets.FolderClosed = (uint) s.Position;
var data = b.Textures.FolderClosed.Data;
s.Write(data, 0, data.Length);
offsets.FolderOpen = (uint) s.Position;
data = b.Textures.FolderOpen.Data;
s.Write(data, 0, data.Length);
}
// Files
if (b.Flags.FileTexture
&& b.Textures.FileLarge.Format != RawTexture.DataFormat.Invalid
&& b.Textures.FileSmall.Format != RawTexture.DataFormat.Invalid)
{
offsets.FileLarge = (uint) s.Position;
var data = b.Textures.FileLarge.Data;
s.Write(data, 0, data.Length);
offsets.FileSmall = (uint) s.Position;
data = b.Textures.FileSmall.Data;
s.Write(data, 0, data.Length);
}
return offsets;
}
}