Mercurial > repos > IBBoard.WarFoundry.API
view api/Objects/WarFoundryStagedLoadingObject.cs @ 10:607c3232d689
Re #11 - Documentation
* Document Stats and SystemStats at class level to explain the difference
* Document WarFoundryXmlFactory at class level
Re #13 - XPath for XML loading
* Load categories using XPath - needs fixing so we can do a proper "categories/cat" query
Re #10 - Refactoring for readability
* Fix method signature for getting number from attribute added in r19
* Refactor more code in to GetExtraData method
* Separate out loading of categories for GameSystem
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 04 Jan 2009 20:43:36 +0000 |
parents | 613bc5eaac59 |
children | 306558904c2a |
line wrap: on
line source
// WarFoundryStagedLoadingObject.cs is a part of the IBBoard.WarFoundry.API library (referred to from here as "this program") // // Copyright (C) 2009 IBBoard // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // using System; using System.IO; using IBBoard.WarFoundry.API.Factories; namespace IBBoard.WarFoundry.API.Objects { public class WarFoundryStagedLoadingObject : WarFoundryObject, IWarFoundryStagedLoadObject { private bool isFullyLoaded; private IWarFoundryFactory creatingFactory; private FileInfo sourceFile; protected WarFoundryStagedLoadingObject(IWarFoundryFactory creatingFactory) : this (null, creatingFactory) { } protected WarFoundryStagedLoadingObject(string objName, IWarFoundryFactory creatingFactory) : this(null, objName, creatingFactory) { } protected WarFoundryStagedLoadingObject(string objId, string objName, IWarFoundryFactory creatingFactory) : base(objId, objName) { this.creatingFactory = creatingFactory; isFullyLoaded = false; } public FileInfo SourceFile { get { return sourceFile; } set { sourceFile = value; } } public void EnsureFullyLoaded () { if (!IsFullyLoaded) { if (Factory == null) { throw new InvalidOperationException("No factory set for partially loaded object with ID "+ID); } Factory.CompleteLoading(this); } } public IWarFoundryFactory Factory { get { return creatingFactory; } } public bool IsFullyLoaded { get { return isFullyLoaded; } } public void SetAsFullyLoaded() { isFullyLoaded = true; } } }