Mercurial > repos > IBBoard.ArmyBuilder.API
view ABFile.cs @ 4:d2f7826147eb
Re #75 - Extract Army Builder files
* Fix code compilation issues (still can't extract)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 19 May 2009 10:22:30 +0000 |
parents | 1a54f6afafe7 |
children | ec77b60e5369 |
line wrap: on
line source
// This file (ABFile.cs) is a part of the IBBoard.ArmyBuilder.API project and is copyright 2009 IBBoard // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. // using System; using System.IO; using System.Collections.Generic; using IBBoard.IO; using IBBoard.ArmyBuilder.API.Loaders; namespace IBBoard.ArmyBuilder.API { /// <summary> /// A .ab file (Army Builder's main data definition file). .ab files contain details of the application requirements for a game system, /// details of the game system, and all of the data files for that game system (including race data). /// </summary> public abstract class ABFile { private FileInfo file; private string header = ""; private string comment = ""; private int fileTablePosition = 0; private List<FileTableEntry> files; public ABFile(String filePath) : this(new FileInfo(filePath)) { } public ABFile(FileInfo file) { this.file = file; files = new List<FileTableEntry>(); } public FileInfo File { get { return file; } } public FileStream GetFileStream() { return file.OpenRead(); } public void AddFileTableEntry(FileTableEntry tableEntry) { if (tableEntry!=null && !files.Contains(tableEntry)) { files.Add(tableEntry); tableEntry.ParentFile = this; } } public void RemoveFileTableEntry(FileTableEntry tableEntry) { if (tableEntry !=null && files.Contains(tableEntry)) { files.Remove(tableEntry); tableEntry.ParentFile = null; } } public FileTableEntry[] Files { get { return files.ToArray(); } } public string Header { //This may actually be three values - a standard header ("LWDExport"), a count of the number of header parts (? seemingly always 0A) // and an app name ("Army Builder" or "Card Value") get { return header; } set { header = value; } } public string Comment { get { return comment; } set { comment = value; } } public int FileTablePosition { get { return fileTablePosition; } set { fileTablePosition = value; } } } }