Mercurial > repos > IBBoard.ArmyBuilder.API
view ABFile.cs @ 2:d5ba733cd289
Re #77 - Identify fields in .ab files
* Rename "UnknownNumber" to "UniqueID" based on data in "update XML" files
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 20 Apr 2009 19:28:01 +0000 |
parents | 1c19230d568d |
children | 1a54f6afafe7 |
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 class ABFile { private FileInfo file; private string header = ""; private string gameName = ""; private string folderName = ""; private string releaseMajor = ""; private string releaseMinor = ""; private string requiredMajorVersion = ""; private string requiredMinorVersion = ""; private string uniqueID = ""; private string exporter = ""; private string comment = ""; 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 GameName { get { return gameName; } set { gameName = value; } } public string FolderName { get { return folderName; } set { folderName = value; } } public string Release { get { return ReleaseMajor + "." + ReleaseMinor; } } public string ReleaseMajor { get { return releaseMajor; } set { releaseMajor = value; } } public string ReleaseMinor { get { return releaseMinor; } set { releaseMinor = value; } } public string RequiredVersion { get { return RequiredMajorVersion + "." + RequiredMinorVersion; } } public string RequiredMajorVersion { get { return requiredMajorVersion; } set { requiredMajorVersion = value; } } public string RequiredMinorVersion { get { return requiredMinorVersion; } set { requiredMinorVersion = value; } } public string UniqueID { get { return uniqueID; } set { uniqueID = value; } } public string Exporter { get { return exporter; } set { exporter = value; } } public string Comment { get { return comment; } set { comment = value; } } } }