Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -2,48 +2,50 @@ using System;
|
|||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class Snapshot : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "ss", Construct );
|
||||
public class Snapshot : PersistableObject
|
||||
{
|
||||
public Snapshot()
|
||||
{
|
||||
Children = new ObjectCollection();
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new Snapshot();
|
||||
}
|
||||
public DateTime TimeStamp{ get; set; }
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public ObjectCollection Children{ get; set; }
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetDateTime("t", TimeStamp);
|
||||
}
|
||||
|
||||
public ObjectCollection Children { get; set; }
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
TimeStamp = ip.GetDateTime("t");
|
||||
}
|
||||
|
||||
public Snapshot()
|
||||
{
|
||||
Children = new ObjectCollection();
|
||||
}
|
||||
public override void SerializeChildren(PersistanceWriter op)
|
||||
{
|
||||
for (int i = 0; i < Children.Count; ++i)
|
||||
Children[i].Serialize(op);
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", TimeStamp );
|
||||
}
|
||||
public override void DeserializeChildren(PersistanceReader ip)
|
||||
{
|
||||
while (ip.HasChild)
|
||||
Children.Add(ip.GetChild());
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
TimeStamp = ip.GetDateTime( "t" );
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < Children.Count; ++i )
|
||||
Children[i].Serialize( op );
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("ss", Construct);
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
Children.Add( ip.GetChild() );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new Snapshot();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -8,182 +8,175 @@
|
|||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.Snapshot.
|
||||
/// </summary>
|
||||
public class SnapshotCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.Snapshot.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.Snapshot at a specific position in the SnapshotCollection.
|
||||
/// </summary>
|
||||
public class SnapshotCollection : CollectionBase
|
||||
public Snapshot this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public SnapshotCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.Snapshot at a specific position in the SnapshotCollection.
|
||||
/// </summary>
|
||||
public Snapshot this[int index]
|
||||
{
|
||||
get => ((Snapshot)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.Snapshot entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Snapshot value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.Snapshot instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.Snapshot instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Snapshot value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.Snapshot instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.Snapshot instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Snapshot value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.Snapshot instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.Snapshot instance to remove.</param>
|
||||
public void Remove(Snapshot value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.Snapshot instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.Snapshot's enumerator.</returns>
|
||||
public new SnapshotCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new SnapshotCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.Snapshot instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.Snapshot instance to insert.</param>
|
||||
public void Insert(int index, Snapshot value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.Snapshot.
|
||||
/// </summary>
|
||||
public class SnapshotCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Snapshot _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private SnapshotCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal SnapshotCollectionEnumerator(SnapshotCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.Snapshot object in the enumerated SnapshotCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Snapshot Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was successfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = _collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
get => (Snapshot)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.Snapshot entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Snapshot value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.Snapshot instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.Snapshot instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Snapshot value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.Snapshot instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.Snapshot instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(Snapshot value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.Snapshot instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.Snapshot instance to remove.</param>
|
||||
public void Remove(Snapshot value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.Snapshot instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.Snapshot's enumerator.</returns>
|
||||
public new SnapshotCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new SnapshotCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.Snapshot instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.Snapshot instance to insert.</param>
|
||||
public void Insert(int index, Snapshot value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.Snapshot.
|
||||
/// </summary>
|
||||
public class SnapshotCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private SnapshotCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Snapshot _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal SnapshotCollectionEnumerator(SnapshotCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.Snapshot object in the enumerated SnapshotCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Snapshot Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_index == -1
|
||||
|| _index >= _collection.Count)
|
||||
throw new IndexOutOfRangeException("Enumerator not started.");
|
||||
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_index == -1
|
||||
|| _index >= _collection.Count)
|
||||
throw new IndexOutOfRangeException("Enumerator not started.");
|
||||
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// true, if the enumerator was successfully advanced to the next queue; false, if the enumerator has reached the end
|
||||
/// of the enumeration.
|
||||
/// </returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (_index
|
||||
< _collection.Count - 1)
|
||||
{
|
||||
_index = _index + 1;
|
||||
_currentElement = _collection[_index];
|
||||
return true;
|
||||
}
|
||||
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,60 +2,62 @@ using System.IO;
|
|||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class SnapshotHistory : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "sh", Construct );
|
||||
public class SnapshotHistory : PersistableObject
|
||||
{
|
||||
public SnapshotHistory()
|
||||
{
|
||||
Snapshots = new SnapshotCollection();
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new SnapshotHistory();
|
||||
}
|
||||
public SnapshotCollection Snapshots{ get; set; }
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public void Save()
|
||||
{
|
||||
string path = Path.Combine(Core.BaseDirectory, "reportHistory.xml");
|
||||
PersistanceWriter pw = new XmlPersistanceWriter(path, "Stats");
|
||||
|
||||
public SnapshotCollection Snapshots { get; set; }
|
||||
pw.WriteDocument(this);
|
||||
|
||||
public SnapshotHistory()
|
||||
{
|
||||
Snapshots = new SnapshotCollection();
|
||||
}
|
||||
pw.Close();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "reportHistory.xml" );
|
||||
PersistanceWriter pw = new XmlPersistanceWriter( path, "Stats" );
|
||||
public void Load()
|
||||
{
|
||||
string path = Path.Combine(Core.BaseDirectory, "reportHistory.xml");
|
||||
|
||||
pw.WriteDocument( this );
|
||||
if (!File.Exists(path))
|
||||
return;
|
||||
|
||||
pw.Close();
|
||||
}
|
||||
PersistanceReader pr = new XmlPersistanceReader(path, "Stats");
|
||||
|
||||
public void Load()
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "reportHistory.xml" );
|
||||
pr.ReadDocument(this);
|
||||
|
||||
if ( !File.Exists( path ) )
|
||||
return;
|
||||
pr.Close();
|
||||
}
|
||||
|
||||
PersistanceReader pr = new XmlPersistanceReader( path, "Stats" );
|
||||
public override void SerializeChildren(PersistanceWriter op)
|
||||
{
|
||||
for (int i = 0; i < Snapshots.Count; ++i)
|
||||
Snapshots[i].Serialize(op);
|
||||
}
|
||||
|
||||
pr.ReadDocument( this );
|
||||
public override void DeserializeChildren(PersistanceReader ip)
|
||||
{
|
||||
while (ip.HasChild)
|
||||
Snapshots.Add(ip.GetChild() as Snapshot);
|
||||
}
|
||||
|
||||
pr.Close();
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < Snapshots.Count; ++i )
|
||||
Snapshots[i].Serialize( op );
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("sh", Construct);
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
Snapshots.Add( ip.GetChild() as Snapshot );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new SnapshotHistory();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue