Mercurial > repos > IBBoard.ArmyBuilder.API
view ABFile.cs @ 0:1a5205612b72
Add initial work on ArmyBuilder API project\nno-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 19 Apr 2009 11:24:10 +0000 |
parents | |
children | 1c19230d568d |
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 unknownNumber = ""; 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.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 { 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 UnknownNumber { get { return unknownNumber; } set { unknownNumber = value; } } public string Exporter { get { return exporter; } set { exporter = value; } } public string Comment { get { return comment; } set { comment = value; } } } }