Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison api/Objects/WarFoundryStagedLoadingObject.cs @ 34:b28be912adab
Re #32 - Migrate to schema
* Remove use of Categories (now just has a single category)
* Fix infinite loop of trying to load files by adding a "is loading" flag
* Fix invalid setting of MinSize to MaxNumber when we're testing if MinSize > MaxSize
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 15 Mar 2009 16:07:52 +0000 |
parents | 306558904c2a |
children | 9cac51553fd1 |
comparison
equal
deleted
inserted
replaced
33:4308424b4145 | 34:b28be912adab |
---|---|
9 namespace IBBoard.WarFoundry.API.Objects | 9 namespace IBBoard.WarFoundry.API.Objects |
10 { | 10 { |
11 public class WarFoundryStagedLoadingObject : WarFoundryObject, IWarFoundryStagedLoadObject | 11 public class WarFoundryStagedLoadingObject : WarFoundryObject, IWarFoundryStagedLoadObject |
12 { | 12 { |
13 private bool isFullyLoaded; | 13 private bool isFullyLoaded; |
14 private bool isLoading; | |
14 private IWarFoundryFactory creatingFactory; | 15 private IWarFoundryFactory creatingFactory; |
15 private FileInfo sourceFile; | 16 private FileInfo sourceFile; |
16 | 17 |
17 protected WarFoundryStagedLoadingObject(IWarFoundryFactory creatingFactory) : this (null, creatingFactory) | 18 protected WarFoundryStagedLoadingObject(IWarFoundryFactory creatingFactory) : this (null, creatingFactory) |
18 { | 19 { |
34 set { sourceFile = value; } | 35 set { sourceFile = value; } |
35 } | 36 } |
36 | 37 |
37 public void EnsureFullyLoaded () | 38 public void EnsureFullyLoaded () |
38 { | 39 { |
39 if (!IsFullyLoaded) | 40 if (!IsFullyLoaded && !IsLoading) |
40 { | 41 { |
41 if (Factory == null) | 42 if (Factory == null) |
42 { | 43 { |
43 throw new InvalidOperationException("No factory set for partially loaded object with ID "+ID); | 44 throw new InvalidOperationException("No factory set for partially loaded object with ID "+ID); |
44 } | 45 } |
55 public bool IsFullyLoaded | 56 public bool IsFullyLoaded |
56 { | 57 { |
57 get { return isFullyLoaded; } | 58 get { return isFullyLoaded; } |
58 } | 59 } |
59 | 60 |
61 public bool IsLoading | |
62 { | |
63 get { return isLoading; } | |
64 } | |
65 | |
60 public void SetAsFullyLoaded() | 66 public void SetAsFullyLoaded() |
61 { | 67 { |
62 isFullyLoaded = true; | 68 isFullyLoaded = true; |
63 } | 69 } |
70 | |
71 public void SetAsLoading() | |
72 { | |
73 isLoading = true; | |
74 } | |
64 } | 75 } |
65 } | 76 } |