UltimateZoneBuilder/Source/Core/Data/DataReader.cs
MaxED 70ea0658ed GZDoom Builder 1.12:
GZDoom Builder now uses SharpCompress.dll instead of SharpZip.dll.
Added PK7 archive support.
PK3 archives now load aprox. 40% faster.
Textures browser now shows Folder/PK3/PK7 folder structure.
TextureBrowserForm is now used to display both Textures and Flats.
ACS scripts from #include and #import directives are now shown in Script name/number dropdowns.
Fixed several cases when ACS scripts lists used in Edit Thing and Edit Linedef forms wasn't updated when they should've (i.e. after compiling a script).
2012-07-23 21:28:23 +00:00

180 lines
5.2 KiB
C#

#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.GZBuilder.Data;
#endregion
namespace CodeImp.DoomBuilder.Data
{
internal abstract class DataReader
{
#region ================== Variables
protected DataLocation location;
protected bool issuspended = false;
protected bool isdisposed = false;
protected ResourceTextureSet textureset;
#endregion
#region ================== Properties
public DataLocation Location { get { return location; } }
public bool IsDisposed { get { return isdisposed; } }
public bool IsSuspended { get { return issuspended; } }
public ResourceTextureSet TextureSet { get { return textureset; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public DataReader(DataLocation dl)
{
// Keep information
location = dl;
textureset = new ResourceTextureSet(GetTitle(), dl);
}
// Disposer
public virtual void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Done
textureset = null;
isdisposed = true;
}
}
#endregion
#region ================== Management
// This returns a short name
public abstract string GetTitle();
// This suspends use of this resource
public virtual void Suspend()
{
issuspended = true;
}
// This resumes use of this resource
public virtual void Resume()
{
issuspended = false;
}
#endregion
#region ================== Palette
// When implemented, this should find and load a PLAYPAL palette
public virtual Playpal LoadPalette() { return null; }
#endregion
#region ================== Colormaps
// When implemented, this loads the colormaps
public virtual ICollection<ImageData> LoadColormaps() { return null; }
// When implemented, this returns the colormap lump
public virtual Stream GetColormapData(string pname) { return null; }
#endregion
#region ================== Textures
// When implemented, this should read the patch names
public virtual PatchNames LoadPatchNames() { return null; }
// When implemented, this returns the patch lump
public virtual Stream GetPatchData(string pname) { return null; }
//mxd. When implemented, this returns a path to... path (like /patches/walls/WALL001.png)
public virtual string GetPatchLocation(string pname) { return pname; }
// When implemented, this returns the texture lump
public virtual Stream GetTextureData(string pname) { return null; }
// When implemented, this loads the textures
public virtual ICollection<ImageData> LoadTextures(PatchNames pnames) { return null; }
#endregion
#region ================== Flats
// When implemented, this loads the flats
public virtual ICollection<ImageData> LoadFlats() { return null; }
// When implemented, this returns the flat lump
public virtual Stream GetFlatData(string pname) { return null; }
#endregion
#region ================== Sprites
// When implemented, this loads the sprites
public virtual ICollection<ImageData> LoadSprites() { return null; }
// When implemented, this returns the sprite lump
public virtual Stream GetSpriteData(string pname) { return null; }
// When implemented, this checks if the given sprite lump exists
public virtual bool GetSpriteExists(string pname) { return false; }
#endregion
#region ================== Decorate, Modeldef, Mapinfo, Gldefs, etc...
// When implemented, this returns the decorate lump
public virtual List<Stream> GetDecorateData(string pname) { return new List<Stream>(); }
//mxd. When implemented, this returns the Modeldef lump
public virtual Dictionary<string, Stream> GetModeldefData() { return new Dictionary<string, Stream>(); }
//mxd. When implemented, this returns the Mapinfo lump
public virtual Dictionary<string, Stream> GetMapinfoData() { return new Dictionary<string, Stream>(); }
//mxd. When implemented, this returns the Gldefs lump
public virtual Dictionary<string, Stream> GetGldefsData(GameType gameType) { return new Dictionary<string, Stream>(); }
public virtual Dictionary<string, Stream> GetGldefsData(string location) { return new Dictionary<string, Stream>(); }
//mxd
internal virtual MemoryStream LoadFile(string name) { return null; }
//mxd
internal virtual bool FileExists(string filename) { return false; }
#endregion
}
}