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
|
|
@ -3,299 +3,305 @@ using System.Collections;
|
|||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public enum BarGraphRenderMode
|
||||
{
|
||||
Bars,
|
||||
Lines
|
||||
}
|
||||
public enum BarGraphRenderMode
|
||||
{
|
||||
Bars,
|
||||
Lines
|
||||
}
|
||||
|
||||
public class BarGraph : Chart
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "bg", Construct );
|
||||
public class BarGraph : Chart
|
||||
{
|
||||
public BarGraph(string name, string fileName, int ticks, string xTitle, string yTitle, BarGraphRenderMode rm)
|
||||
{
|
||||
m_Name = name;
|
||||
m_FileName = fileName;
|
||||
Ticks = ticks;
|
||||
this.xTitle = xTitle;
|
||||
this.yTitle = yTitle;
|
||||
RenderMode = rm;
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new BarGraph();
|
||||
}
|
||||
private BarGraph()
|
||||
{
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public int Ticks{ get; set; }
|
||||
|
||||
public int Ticks { get; set; }
|
||||
public BarGraphRenderMode RenderMode{ get; set; }
|
||||
|
||||
public BarGraphRenderMode RenderMode { get; set; }
|
||||
public string xTitle{ get; set; }
|
||||
|
||||
public string xTitle { get; set; }
|
||||
public string yTitle{ get; set; }
|
||||
|
||||
public string yTitle { get; set; }
|
||||
public int FontSize{ get; set; } = 7;
|
||||
|
||||
public int FontSize { get; set; } = 7;
|
||||
public int Interval{ get; set; } = 1;
|
||||
|
||||
public int Interval { get; set; } = 1;
|
||||
public BarRegion[] Regions{ get; set; }
|
||||
|
||||
public BarRegion[] Regions { get; set; }
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
base.SerializeAttributes(op);
|
||||
|
||||
public BarGraph( string name, string fileName, int ticks, string xTitle, string yTitle, BarGraphRenderMode rm )
|
||||
{
|
||||
m_Name = name;
|
||||
m_FileName = fileName;
|
||||
Ticks = ticks;
|
||||
this.xTitle = xTitle;
|
||||
this.yTitle = yTitle;
|
||||
RenderMode = rm;
|
||||
}
|
||||
op.SetInt32("t", Ticks);
|
||||
op.SetInt32("r", (int)RenderMode);
|
||||
|
||||
private BarGraph()
|
||||
{
|
||||
}
|
||||
op.SetString("x", xTitle);
|
||||
op.SetString("y", yTitle);
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
base.SerializeAttributes( op );
|
||||
op.SetInt32("s", FontSize);
|
||||
op.SetInt32("i", Interval);
|
||||
}
|
||||
|
||||
op.SetInt32( "t", Ticks );
|
||||
op.SetInt32( "r", (int) RenderMode );
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
base.DeserializeAttributes(ip);
|
||||
|
||||
op.SetString( "x", xTitle );
|
||||
op.SetString( "y", yTitle );
|
||||
Ticks = ip.GetInt32("t");
|
||||
RenderMode = (BarGraphRenderMode)ip.GetInt32("r");
|
||||
|
||||
op.SetInt32( "s", FontSize );
|
||||
op.SetInt32( "i", Interval );
|
||||
}
|
||||
xTitle = Utility.Intern(ip.GetString("x"));
|
||||
yTitle = Utility.Intern(ip.GetString("y"));
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
base.DeserializeAttributes( ip );
|
||||
FontSize = ip.GetInt32("s");
|
||||
Interval = ip.GetInt32("i");
|
||||
}
|
||||
|
||||
Ticks = ip.GetInt32( "t" );
|
||||
RenderMode = (BarGraphRenderMode) ip.GetInt32( "r" );
|
||||
public static int LookupReportValue(Snapshot ss, string reportName, string valueName)
|
||||
{
|
||||
for (int j = 0; j < ss.Children.Count; ++j)
|
||||
{
|
||||
if (!(ss.Children[j] is Report report) || report.Name != reportName)
|
||||
continue;
|
||||
|
||||
xTitle = Utility.Intern( ip.GetString( "x" ) );
|
||||
yTitle = Utility.Intern( ip.GetString( "y" ) );
|
||||
for (int k = 0; k < report.Items.Count; ++k)
|
||||
{
|
||||
ReportItem item = report.Items[k];
|
||||
|
||||
FontSize = ip.GetInt32( "s" );
|
||||
Interval = ip.GetInt32( "i" );
|
||||
}
|
||||
if (item.Values[0].Value == valueName)
|
||||
return Utility.ToInt32(item.Values[1].Value);
|
||||
}
|
||||
|
||||
public static int LookupReportValue( Snapshot ss, string reportName, string valueName )
|
||||
{
|
||||
for ( int j = 0; j < ss.Children.Count; ++j )
|
||||
{
|
||||
if ( !(ss.Children[j] is Report report) || report.Name != reportName )
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
for ( int k = 0; k < report.Items.Count; ++k )
|
||||
{
|
||||
ReportItem item = report.Items[k];
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( item.Values[0].Value == valueName )
|
||||
return Utility.ToInt32( item.Values[1].Value );
|
||||
}
|
||||
public static BarGraph DailyAverage(SnapshotHistory history, string reportName, string valueName)
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
|
||||
break;
|
||||
}
|
||||
int min = history.Snapshots.Count - 7 * 24; // averages over one week
|
||||
|
||||
return -1;
|
||||
}
|
||||
if (min < 0)
|
||||
min = 0;
|
||||
|
||||
public static BarGraph DailyAverage( SnapshotHistory history, string reportName, string valueName )
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
for (int i = min; i < history.Snapshots.Count; ++i)
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
|
||||
int min = history.Snapshots.Count - (7 * 24); // averages over one week
|
||||
int val = LookupReportValue(ss, reportName, valueName);
|
||||
|
||||
if ( min < 0 )
|
||||
min = 0;
|
||||
if (val == -1)
|
||||
continue;
|
||||
|
||||
for ( int i = min; i < history.Snapshots.Count; ++i )
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
int hour = ss.TimeStamp.TimeOfDay.Hours;
|
||||
|
||||
int val = LookupReportValue( ss, reportName, valueName );
|
||||
totals[hour] += val;
|
||||
counts[hour]++;
|
||||
}
|
||||
|
||||
if ( val == -1 )
|
||||
continue;
|
||||
BarGraph barGraph = new BarGraph("Hourly average " + valueName, "graphs_" + valueName.ToLower() + "_avg", 10,
|
||||
"Time", valueName, BarGraphRenderMode.Lines);
|
||||
|
||||
int hour = ss.TimeStamp.TimeOfDay.Hours;
|
||||
barGraph.FontSize = 6;
|
||||
|
||||
totals[hour] += val;
|
||||
counts[hour]++;
|
||||
}
|
||||
for (int i = 7; i <= totals.Length + 7; ++i)
|
||||
{
|
||||
int val;
|
||||
|
||||
BarGraph barGraph = new BarGraph( "Hourly average " + valueName, "graphs_" + valueName.ToLower() + "_avg", 10, "Time", valueName, BarGraphRenderMode.Lines );
|
||||
if (counts[i % totals.Length] == 0)
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i % totals.Length] + counts[i % totals.Length] / 2) / counts[i % totals.Length];
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
int realHours = i % totals.Length;
|
||||
int hours;
|
||||
|
||||
for ( int i = 7; i <= totals.Length+7; ++i )
|
||||
{
|
||||
int val;
|
||||
if (realHours == 0)
|
||||
hours = 12;
|
||||
else if (realHours > 12)
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
if ( counts[i%totals.Length] == 0 )
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i%totals.Length] + (counts[i%totals.Length] / 2)) / counts[i%totals.Length];
|
||||
barGraph.Items.Add(hours + (realHours >= 12 ? " PM" : " AM"), val);
|
||||
}
|
||||
|
||||
int realHours = i%totals.Length;
|
||||
int hours;
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
public static BarGraph Growth(SnapshotHistory history, string reportName, string valueName)
|
||||
{
|
||||
BarGraph barGraph = new BarGraph("Growth of " + valueName + " over time",
|
||||
"graphs_" + valueName.ToLower() + "_growth", 10, "Time", valueName, BarGraphRenderMode.Lines);
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
barGraph.FontSize = 6;
|
||||
barGraph.Interval = 7;
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
DateTime startPeriod = history.Snapshots[0].TimeStamp.Date + TimeSpan.FromDays(1.0);
|
||||
DateTime endPeriod = history.Snapshots[history.Snapshots.Count - 1].TimeStamp.Date;
|
||||
|
||||
public static BarGraph Growth( SnapshotHistory history, string reportName, string valueName )
|
||||
{
|
||||
BarGraph barGraph = new BarGraph( "Growth of " + valueName + " over time", "graphs_" + valueName.ToLower() + "_growth", 10, "Time", valueName, BarGraphRenderMode.Lines );
|
||||
ArrayList regions = new ArrayList();
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
barGraph.Interval = 7;
|
||||
DateTime curDate = DateTime.MinValue;
|
||||
int curPeak = -1;
|
||||
int curLow = 1000;
|
||||
int curTotl = 0;
|
||||
int curCont = 0;
|
||||
int curValu = 0;
|
||||
|
||||
DateTime startPeriod = history.Snapshots[0].TimeStamp.Date + TimeSpan.FromDays( 1.0 );
|
||||
DateTime endPeriod = history.Snapshots[history.Snapshots.Count - 1].TimeStamp.Date;
|
||||
for (int i = 0; i < history.Snapshots.Count; ++i)
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
DateTime timeStamp = ss.TimeStamp;
|
||||
|
||||
ArrayList regions = new ArrayList();
|
||||
if (timeStamp < startPeriod || timeStamp >= endPeriod)
|
||||
continue;
|
||||
|
||||
DateTime curDate = DateTime.MinValue;
|
||||
int curPeak = -1;
|
||||
int curLow = 1000;
|
||||
int curTotl = 0;
|
||||
int curCont = 0;
|
||||
int curValu = 0;
|
||||
int val = LookupReportValue(ss, reportName, valueName);
|
||||
|
||||
for ( int i = 0; i < history.Snapshots.Count; ++i )
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
DateTime timeStamp = ss.TimeStamp;
|
||||
if (val == -1)
|
||||
continue;
|
||||
|
||||
if ( timeStamp < startPeriod || timeStamp >= endPeriod )
|
||||
continue;
|
||||
DateTime thisDate = timeStamp.Date;
|
||||
|
||||
int val = LookupReportValue( ss, reportName, valueName );
|
||||
if (curDate == DateTime.MinValue)
|
||||
curDate = thisDate;
|
||||
|
||||
if ( val == -1 )
|
||||
continue;
|
||||
curCont++;
|
||||
curTotl += val;
|
||||
curValu = curTotl / curCont;
|
||||
|
||||
DateTime thisDate = timeStamp.Date;
|
||||
if (curDate != thisDate && curValu >= 0)
|
||||
{
|
||||
string mnthName = thisDate.ToString("MMMM");
|
||||
|
||||
if ( curDate == DateTime.MinValue )
|
||||
curDate = thisDate;
|
||||
if (regions.Count == 0)
|
||||
{
|
||||
regions.Add(new BarRegion(barGraph.Items.Count, barGraph.Items.Count, mnthName));
|
||||
}
|
||||
else
|
||||
{
|
||||
BarRegion region = (BarRegion)regions[regions.Count - 1];
|
||||
|
||||
curCont++;
|
||||
curTotl += val;
|
||||
curValu = curTotl / curCont;
|
||||
if (region.m_Name == mnthName)
|
||||
region.m_RangeTo = barGraph.Items.Count;
|
||||
else
|
||||
regions.Add(new BarRegion(barGraph.Items.Count, barGraph.Items.Count, mnthName));
|
||||
}
|
||||
|
||||
if ( curDate != thisDate && curValu >= 0 )
|
||||
{
|
||||
string mnthName = thisDate.ToString( "MMMM" );
|
||||
barGraph.Items.Add(thisDate.Day.ToString(), curValu);
|
||||
|
||||
if ( regions.Count == 0 )
|
||||
{
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, mnthName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
BarRegion region = (BarRegion)regions[regions.Count - 1];
|
||||
curPeak = val;
|
||||
curLow = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val > curPeak)
|
||||
curPeak = val;
|
||||
|
||||
if ( region.m_Name == mnthName )
|
||||
region.m_RangeTo = barGraph.Items.Count;
|
||||
else
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, mnthName ) );
|
||||
}
|
||||
if (val > 0 && val < curLow)
|
||||
curLow = val;
|
||||
}
|
||||
|
||||
barGraph.Items.Add( thisDate.Day.ToString(), curValu );
|
||||
curDate = thisDate;
|
||||
}
|
||||
|
||||
curPeak = val;
|
||||
curLow = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( val > curPeak )
|
||||
curPeak = val;
|
||||
barGraph.Regions = (BarRegion[])regions.ToArray(typeof(BarRegion));
|
||||
|
||||
if ( val > 0 && val < curLow )
|
||||
curLow = val;
|
||||
}
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
curDate = thisDate;
|
||||
}
|
||||
public static BarGraph OverTime(SnapshotHistory history, string reportName, string valueName, int step, int max,
|
||||
int ival)
|
||||
{
|
||||
BarGraph barGraph = new BarGraph(valueName + " over time", "graphs_" + valueName.ToLower() + "_ot", 10, "Time",
|
||||
valueName, BarGraphRenderMode.Lines);
|
||||
|
||||
barGraph.Regions = (BarRegion[])regions.ToArray( typeof( BarRegion ) );
|
||||
TimeSpan ts = TimeSpan.FromHours(max * step - 0.5);
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
DateTime mostRecent = history.Snapshots[history.Snapshots.Count - 1].TimeStamp;
|
||||
DateTime minTime = mostRecent - ts;
|
||||
|
||||
public static BarGraph OverTime( SnapshotHistory history, string reportName, string valueName, int step, int max, int ival )
|
||||
{
|
||||
BarGraph barGraph = new BarGraph( valueName + " over time", "graphs_" + valueName.ToLower() + "_ot", 10, "Time", valueName, BarGraphRenderMode.Lines );
|
||||
barGraph.FontSize = 6;
|
||||
barGraph.Interval = ival;
|
||||
|
||||
TimeSpan ts = TimeSpan.FromHours( (max*step)-0.5 );
|
||||
ArrayList regions = new ArrayList();
|
||||
|
||||
DateTime mostRecent = history.Snapshots[history.Snapshots.Count - 1].TimeStamp;
|
||||
DateTime minTime = mostRecent - ts;
|
||||
for (int i = 0; i < history.Snapshots.Count; ++i)
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
DateTime timeStamp = ss.TimeStamp;
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
barGraph.Interval = ival;
|
||||
if (timeStamp < minTime)
|
||||
continue;
|
||||
|
||||
ArrayList regions = new ArrayList();
|
||||
if (i % step != 0)
|
||||
continue;
|
||||
|
||||
for ( int i = 0; i < history.Snapshots.Count; ++i )
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
DateTime timeStamp = ss.TimeStamp;
|
||||
int val = LookupReportValue(ss, reportName, valueName);
|
||||
|
||||
if ( timeStamp < minTime )
|
||||
continue;
|
||||
if (val == -1)
|
||||
continue;
|
||||
|
||||
if ( (i % step) != 0 )
|
||||
continue;
|
||||
int realHours = timeStamp.TimeOfDay.Hours;
|
||||
int hours;
|
||||
|
||||
int val = LookupReportValue( ss, reportName, valueName );
|
||||
if (realHours == 0)
|
||||
hours = 12;
|
||||
else if (realHours > 12)
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
if ( val == -1 )
|
||||
continue;
|
||||
string dayName = timeStamp.DayOfWeek.ToString();
|
||||
|
||||
int realHours = timeStamp.TimeOfDay.Hours;
|
||||
int hours;
|
||||
if (regions.Count == 0)
|
||||
{
|
||||
regions.Add(new BarRegion(barGraph.Items.Count, barGraph.Items.Count, dayName));
|
||||
}
|
||||
else
|
||||
{
|
||||
BarRegion region = (BarRegion)regions[regions.Count - 1];
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
if (region.m_Name == dayName)
|
||||
region.m_RangeTo = barGraph.Items.Count;
|
||||
else
|
||||
regions.Add(new BarRegion(barGraph.Items.Count, barGraph.Items.Count, dayName));
|
||||
}
|
||||
|
||||
string dayName = timeStamp.DayOfWeek.ToString();
|
||||
barGraph.Items.Add(hours + (realHours >= 12 ? " PM" : " AM"), val);
|
||||
}
|
||||
|
||||
if ( regions.Count == 0 )
|
||||
{
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, dayName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
BarRegion region = (BarRegion) regions[regions.Count - 1];
|
||||
barGraph.Regions = (BarRegion[])regions.ToArray(typeof(BarRegion));
|
||||
|
||||
if ( region.m_Name == dayName )
|
||||
region.m_RangeTo = barGraph.Items.Count;
|
||||
else
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, dayName ) );
|
||||
}
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
barGraph.Regions = (BarRegion[])regions.ToArray( typeof( BarRegion ) );
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("bg", Construct);
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new BarGraph();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +1,52 @@
|
|||
namespace Server.Engines.Reports
|
||||
{
|
||||
public abstract class Chart : PersistableObject
|
||||
{
|
||||
protected string m_Name;
|
||||
protected string m_FileName;
|
||||
protected ChartItemCollection m_Items;
|
||||
public abstract class Chart : PersistableObject
|
||||
{
|
||||
protected string m_FileName;
|
||||
protected ChartItemCollection m_Items;
|
||||
protected string m_Name;
|
||||
|
||||
public string Name{ get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string FileName{ get => m_FileName;
|
||||
set => m_FileName = value;
|
||||
}
|
||||
public ChartItemCollection Items => m_Items;
|
||||
public Chart()
|
||||
{
|
||||
m_Items = new ChartItemCollection();
|
||||
}
|
||||
|
||||
public Chart()
|
||||
{
|
||||
m_Items = new ChartItemCollection();
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "n", m_Name );
|
||||
op.SetString( "f", m_FileName );
|
||||
}
|
||||
public string FileName
|
||||
{
|
||||
get => m_FileName;
|
||||
set => m_FileName = value;
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
m_FileName = Utility.Intern( ip.GetString( "f" ) );
|
||||
}
|
||||
public ChartItemCollection Items => m_Items;
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < m_Items.Count; ++i )
|
||||
m_Items[i].Serialize( op );
|
||||
}
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetString("n", m_Name);
|
||||
op.SetString("f", m_FileName);
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
m_Items.Add( ip.GetChild() as ChartItem );
|
||||
}
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
m_Name = Utility.Intern(ip.GetString("n"));
|
||||
m_FileName = Utility.Intern(ip.GetString("f"));
|
||||
}
|
||||
|
||||
public override void SerializeChildren(PersistanceWriter op)
|
||||
{
|
||||
for (int i = 0; i < m_Items.Count; ++i)
|
||||
m_Items[i].Serialize(op);
|
||||
}
|
||||
|
||||
public override void DeserializeChildren(PersistanceReader ip)
|
||||
{
|
||||
while (ip.HasChild)
|
||||
m_Items.Add(ip.GetChild() as ChartItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +1,44 @@
|
|||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ChartItem : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "ci", Construct );
|
||||
public class ChartItem : PersistableObject
|
||||
{
|
||||
private ChartItem()
|
||||
{
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ChartItem();
|
||||
}
|
||||
public ChartItem(string name, int value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public string Name{ get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public int Value{ get; set; }
|
||||
|
||||
public int Value { get; set; }
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetString("n", Name);
|
||||
op.SetInt32("v", Value);
|
||||
}
|
||||
|
||||
private ChartItem()
|
||||
{
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
Name = Utility.Intern(ip.GetString("n"));
|
||||
Value = ip.GetInt32("v");
|
||||
}
|
||||
|
||||
public ChartItem( string name, int value )
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "n", Name );
|
||||
op.SetInt32( "v", Value );
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("ci", Construct);
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
Value = ip.GetInt32( "v" );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ChartItem();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -8,187 +8,180 @@
|
|||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ChartItem.
|
||||
/// </summary>
|
||||
public class ChartItemCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ChartItem.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ChartItem at a specific position in the ChartItemCollection.
|
||||
/// </summary>
|
||||
public class ChartItemCollection : CollectionBase
|
||||
public ChartItem this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ChartItemCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ChartItem at a specific position in the ChartItemCollection.
|
||||
/// </summary>
|
||||
public ChartItem this[int index]
|
||||
{
|
||||
get => ((ChartItem)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
public int Add( string name, int value )
|
||||
{
|
||||
return Add( new ChartItem( name, value ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ChartItem entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ChartItem value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ChartItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ChartItem instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ChartItem value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ChartItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ChartItem instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(ChartItem value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ChartItem instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ChartItem instance to remove.</param>
|
||||
public void Remove(ChartItem value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ChartItem instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ChartItem's enumerator.</returns>
|
||||
public new ChartItemCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ChartItemCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ChartItem instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ChartItem instance to insert.</param>
|
||||
public void Insert(int index, ChartItem value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ChartItem.
|
||||
/// </summary>
|
||||
public class ChartItemCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ChartItem _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ChartItemCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ChartItemCollectionEnumerator(ChartItemCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ChartItem object in the enumerated ChartItemCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public ChartItem 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 => (ChartItem)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add(string name, int value)
|
||||
{
|
||||
return Add(new ChartItem(name, value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ChartItem entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ChartItem value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ChartItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ChartItem instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ChartItem value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ChartItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.ChartItem instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(ChartItem value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ChartItem instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ChartItem instance to remove.</param>
|
||||
public void Remove(ChartItem value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ChartItem instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ChartItem's enumerator.</returns>
|
||||
public new ChartItemCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ChartItemCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ChartItem instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ChartItem instance to insert.</param>
|
||||
public void Insert(int index, ChartItem value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ChartItem.
|
||||
/// </summary>
|
||||
public class ChartItemCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ChartItemCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ChartItem _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 ChartItemCollectionEnumerator(ChartItemCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ChartItem object in the enumerated ChartItemCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public ChartItem 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +1,45 @@
|
|||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class PieChart : Chart
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "pc", Construct );
|
||||
public class PieChart : Chart
|
||||
{
|
||||
public PieChart(string name, string fileName, bool showPercents)
|
||||
{
|
||||
m_Name = name;
|
||||
m_FileName = fileName;
|
||||
ShowPercents = showPercents;
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new PieChart();
|
||||
}
|
||||
private PieChart()
|
||||
{
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public bool ShowPercents{ get; set; }
|
||||
|
||||
public bool ShowPercents { get; set; }
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
base.SerializeAttributes(op);
|
||||
|
||||
public PieChart( string name, string fileName, bool showPercents )
|
||||
{
|
||||
m_Name = name;
|
||||
m_FileName = fileName;
|
||||
ShowPercents = showPercents;
|
||||
}
|
||||
op.SetBoolean("p", ShowPercents);
|
||||
}
|
||||
|
||||
private PieChart()
|
||||
{
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
base.DeserializeAttributes(ip);
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
base.SerializeAttributes( op );
|
||||
ShowPercents = ip.GetBoolean("p");
|
||||
}
|
||||
|
||||
op.SetBoolean( "p", ShowPercents );
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
base.DeserializeAttributes( ip );
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("pc", Construct);
|
||||
|
||||
ShowPercents = ip.GetBoolean( "p" );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new PieChart();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +1,57 @@
|
|||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ItemValue : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "iv", Construct );
|
||||
public class ItemValue : PersistableObject
|
||||
{
|
||||
private string m_Value;
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ItemValue();
|
||||
}
|
||||
private ItemValue()
|
||||
{
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public ItemValue(string value) : this(value, null)
|
||||
{
|
||||
}
|
||||
|
||||
private string m_Value;
|
||||
public ItemValue(string value, string format)
|
||||
{
|
||||
m_Value = value;
|
||||
Format = format;
|
||||
}
|
||||
|
||||
public string Value{ get => m_Value;
|
||||
set => m_Value = value;
|
||||
}
|
||||
public string Format { get; set; }
|
||||
public string Value
|
||||
{
|
||||
get => m_Value;
|
||||
set => m_Value = value;
|
||||
}
|
||||
|
||||
private ItemValue()
|
||||
{
|
||||
}
|
||||
public string Format{ get; set; }
|
||||
|
||||
public ItemValue( string value ) : this( value, null )
|
||||
{
|
||||
}
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetString("v", m_Value);
|
||||
op.SetString("f", Format);
|
||||
}
|
||||
|
||||
public ItemValue( string value, string format )
|
||||
{
|
||||
m_Value = value;
|
||||
Format = format;
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
m_Value = ip.GetString("v");
|
||||
Format = Utility.Intern(ip.GetString("f"));
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "v", m_Value );
|
||||
op.SetString( "f", Format );
|
||||
}
|
||||
if (Format == null)
|
||||
Utility.Intern(ref m_Value);
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_Value = ip.GetString( "v" );
|
||||
Format = Utility.Intern( ip.GetString( "f" ) );
|
||||
#region Type Identification
|
||||
|
||||
if ( Format == null )
|
||||
Utility.Intern( ref m_Value );
|
||||
}
|
||||
}
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("iv", Construct);
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ItemValue();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -8,192 +8,185 @@
|
|||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ItemValue.
|
||||
/// </summary>
|
||||
public class ItemValueCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ItemValue.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ItemValue at a specific position in the ItemValueCollection.
|
||||
/// </summary>
|
||||
public class ItemValueCollection : CollectionBase
|
||||
public ItemValue this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ItemValueCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ItemValue at a specific position in the ItemValueCollection.
|
||||
/// </summary>
|
||||
public ItemValue this[int index]
|
||||
{
|
||||
get => ((ItemValue)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
public int Add( string value )
|
||||
{
|
||||
return Add( new ItemValue( value ) );
|
||||
}
|
||||
|
||||
public int Add( string value, string format )
|
||||
{
|
||||
return Add( new ItemValue( value, format ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ItemValue entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ItemValue value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ItemValue instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ItemValue instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ItemValue value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ItemValue instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ItemValue instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(ItemValue value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ItemValue instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ItemValue instance to remove.</param>
|
||||
public void Remove(ItemValue value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ItemValue instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ItemValue's enumerator.</returns>
|
||||
public new ItemValueCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ItemValueCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ItemValue instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ItemValue instance to insert.</param>
|
||||
public void Insert(int index, ItemValue value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ItemValue.
|
||||
/// </summary>
|
||||
public class ItemValueCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ItemValue _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ItemValueCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ItemValueCollectionEnumerator(ItemValueCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ItemValue object in the enumerated ItemValueCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public ItemValue 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 => (ItemValue)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add(string value)
|
||||
{
|
||||
return Add(new ItemValue(value));
|
||||
}
|
||||
|
||||
public int Add(string value, string format)
|
||||
{
|
||||
return Add(new ItemValue(value, format));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ItemValue entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ItemValue value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ItemValue instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ItemValue instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ItemValue value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ItemValue instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.ItemValue instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(ItemValue value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ItemValue instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ItemValue instance to remove.</param>
|
||||
public void Remove(ItemValue value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ItemValue instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ItemValue's enumerator.</returns>
|
||||
public new ItemValueCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ItemValueCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ItemValue instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ItemValue instance to insert.</param>
|
||||
public void Insert(int index, ItemValue value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ItemValue.
|
||||
/// </summary>
|
||||
public class ItemValueCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ItemValueCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ItemValue _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 ItemValueCollectionEnumerator(ItemValueCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ItemValue object in the enumerated ItemValueCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public ItemValue 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +1,72 @@
|
|||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class Report : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "rp", Construct );
|
||||
public class Report : PersistableObject
|
||||
{
|
||||
private Report() : this(null, null)
|
||||
{
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new Report();
|
||||
}
|
||||
public Report(string name, string width)
|
||||
{
|
||||
Name = name;
|
||||
Width = width;
|
||||
Columns = new ReportColumnCollection();
|
||||
Items = new ReportItemCollection();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public string Name{ get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Width{ get; set; }
|
||||
|
||||
public string Width { get; set; }
|
||||
public ReportColumnCollection Columns{ get; }
|
||||
|
||||
public ReportColumnCollection Columns { get; }
|
||||
public ReportItemCollection Items{ get; }
|
||||
|
||||
public ReportItemCollection Items { get; }
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetString("n", Name);
|
||||
op.SetString("w", Width);
|
||||
}
|
||||
|
||||
private Report() : this( null, null )
|
||||
{
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
Name = Utility.Intern(ip.GetString("n"));
|
||||
Width = Utility.Intern(ip.GetString("w"));
|
||||
}
|
||||
|
||||
public Report( string name, string width )
|
||||
{
|
||||
Name = name;
|
||||
Width = width;
|
||||
Columns = new ReportColumnCollection();
|
||||
Items = new ReportItemCollection();
|
||||
}
|
||||
public override void SerializeChildren(PersistanceWriter op)
|
||||
{
|
||||
for (int i = 0; i < Columns.Count; ++i)
|
||||
Columns[i].Serialize(op);
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "n", Name );
|
||||
op.SetString( "w", Width );
|
||||
}
|
||||
for (int i = 0; i < Items.Count; ++i)
|
||||
Items[i].Serialize(op);
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
Width = Utility.Intern( ip.GetString( "w" ) );
|
||||
}
|
||||
public override void DeserializeChildren(PersistanceReader ip)
|
||||
{
|
||||
while (ip.HasChild)
|
||||
{
|
||||
PersistableObject child = ip.GetChild();
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < Columns.Count; ++i )
|
||||
Columns[i].Serialize( op );
|
||||
if (child is ReportColumn column)
|
||||
Columns.Add(column);
|
||||
else if (child is ReportItem item)
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < Items.Count; ++i )
|
||||
Items[i].Serialize( op );
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
{
|
||||
PersistableObject child = ip.GetChild();
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("rp", Construct);
|
||||
|
||||
if ( child is ReportColumn column )
|
||||
Columns.Add( column );
|
||||
else if ( child is ReportItem item )
|
||||
Items.Add( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new Report();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +1,53 @@
|
|||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ReportColumn : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "rc", Construct );
|
||||
public class ReportColumn : PersistableObject
|
||||
{
|
||||
private ReportColumn()
|
||||
{
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ReportColumn();
|
||||
}
|
||||
public ReportColumn(string width, string align) : this(width, align, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public ReportColumn(string width, string align, string name)
|
||||
{
|
||||
Width = width;
|
||||
Align = align;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public string Width { get; set; }
|
||||
public string Width{ get; set; }
|
||||
|
||||
public string Align { get; set; }
|
||||
public string Align{ get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Name{ get; set; }
|
||||
|
||||
private ReportColumn()
|
||||
{
|
||||
}
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetString("w", Width);
|
||||
op.SetString("a", Align);
|
||||
op.SetString("n", Name);
|
||||
}
|
||||
|
||||
public ReportColumn( string width, string align ) : this( width, align, null )
|
||||
{
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
Width = Utility.Intern(ip.GetString("w"));
|
||||
Align = Utility.Intern(ip.GetString("a"));
|
||||
Name = Utility.Intern(ip.GetString("n"));
|
||||
}
|
||||
|
||||
public ReportColumn( string width, string align, string name )
|
||||
{
|
||||
Width = width;
|
||||
Align = align;
|
||||
Name = name;
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "w", Width );
|
||||
op.SetString( "a", Align );
|
||||
op.SetString( "n", Name );
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("rc", Construct);
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
Width = Utility.Intern( ip.GetString( "w" ) );
|
||||
Align = Utility.Intern( ip.GetString( "a" ) );
|
||||
Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ReportColumn();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -8,192 +8,186 @@
|
|||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ReportColumn.
|
||||
/// </summary>
|
||||
public class ReportColumnCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ReportColumn.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ReportColumn at a specific position in the ReportColumnCollection.
|
||||
/// </summary>
|
||||
public class ReportColumnCollection : CollectionBase
|
||||
public ReportColumn this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ReportColumnCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ReportColumn at a specific position in the ReportColumnCollection.
|
||||
/// </summary>
|
||||
public ReportColumn this[int index]
|
||||
{
|
||||
get => ((ReportColumn)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
public int Add( string width, string align )
|
||||
{
|
||||
return Add( new ReportColumn( width, align ) );
|
||||
}
|
||||
|
||||
public int Add( string width, string align, string name )
|
||||
{
|
||||
return Add( new ReportColumn( width, align, name ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ReportColumn entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ReportColumn value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ReportColumn instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ReportColumn instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ReportColumn value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ReportColumn instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ReportColumn instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(ReportColumn value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ReportColumn instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportColumn instance to remove.</param>
|
||||
public void Remove(ReportColumn value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ReportColumn instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ReportColumn's enumerator.</returns>
|
||||
public new ReportColumnCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ReportColumnCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ReportColumn instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportColumn instance to insert.</param>
|
||||
public void Insert(int index, ReportColumn value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ReportColumn.
|
||||
/// </summary>
|
||||
public class ReportColumnCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ReportColumn _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ReportColumnCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ReportColumnCollectionEnumerator(ReportColumnCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ReportColumn object in the enumerated ReportColumnCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public ReportColumn 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 => (ReportColumn)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add(string width, string align)
|
||||
{
|
||||
return Add(new ReportColumn(width, align));
|
||||
}
|
||||
|
||||
public int Add(string width, string align, string name)
|
||||
{
|
||||
return Add(new ReportColumn(width, align, name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ReportColumn entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ReportColumn value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ReportColumn instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ReportColumn instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ReportColumn value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ReportColumn instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.ReportColumn instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(ReportColumn value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ReportColumn instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportColumn instance to remove.</param>
|
||||
public void Remove(ReportColumn value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ReportColumn instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ReportColumn's enumerator.</returns>
|
||||
public new ReportColumnCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ReportColumnCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ReportColumn instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportColumn instance to insert.</param>
|
||||
public void Insert(int index, ReportColumn value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ReportColumn.
|
||||
/// </summary>
|
||||
public class ReportColumnCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ReportColumnCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ReportColumn _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 ReportColumnCollectionEnumerator(ReportColumnCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ReportColumn object in the enumerated ReportColumnCollection currently indexed by this
|
||||
/// instance.
|
||||
/// </summary>
|
||||
public ReportColumn 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +1,37 @@
|
|||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ReportItem : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "ri", Construct );
|
||||
public class ReportItem : PersistableObject
|
||||
{
|
||||
public ReportItem()
|
||||
{
|
||||
Values = new ItemValueCollection();
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ReportItem();
|
||||
}
|
||||
public ItemValueCollection Values{ get; }
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public override void SerializeChildren(PersistanceWriter op)
|
||||
{
|
||||
for (int i = 0; i < Values.Count; ++i)
|
||||
Values[i].Serialize(op);
|
||||
}
|
||||
|
||||
public ItemValueCollection Values { get; }
|
||||
public override void DeserializeChildren(PersistanceReader ip)
|
||||
{
|
||||
while (ip.HasChild)
|
||||
Values.Add(ip.GetChild() as ItemValue);
|
||||
}
|
||||
|
||||
public ReportItem()
|
||||
{
|
||||
Values = new ItemValueCollection();
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < Values.Count; ++i )
|
||||
Values[i].Serialize( op );
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("ri", Construct);
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
Values.Add( ip.GetChild() as ItemValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ReportItem();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -8,197 +8,191 @@
|
|||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ReportItem.
|
||||
/// </summary>
|
||||
public class ReportItemCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ReportItem.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ReportItem at a specific position in the ReportItemCollection.
|
||||
/// </summary>
|
||||
public class ReportItemCollection : CollectionBase
|
||||
public ReportItem this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ReportItemCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ReportItem at a specific position in the ReportItemCollection.
|
||||
/// </summary>
|
||||
public ReportItem this[int index]
|
||||
{
|
||||
get => ((ReportItem)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
public int Add( string name, object value )
|
||||
{
|
||||
return Add( name, value, null );
|
||||
}
|
||||
|
||||
public int Add( string name, object value, string format )
|
||||
{
|
||||
ReportItem item = new ReportItem();
|
||||
|
||||
item.Values.Add( name );
|
||||
item.Values.Add( value == null ? "" : value.ToString(), format );
|
||||
|
||||
return Add( item );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ReportItem entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ReportItem value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ReportItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ReportItem instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ReportItem value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ReportItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ReportItem instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(ReportItem value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ReportItem instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportItem instance to remove.</param>
|
||||
public void Remove(ReportItem value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ReportItem instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ReportItem's enumerator.</returns>
|
||||
public new ReportItemCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ReportItemCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ReportItem instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportItem instance to insert.</param>
|
||||
public void Insert(int index, ReportItem value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ReportItem.
|
||||
/// </summary>
|
||||
public class ReportItemCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ReportItem _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ReportItemCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ReportItemCollectionEnumerator(ReportItemCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ReportItem object in the enumerated ReportItemCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public ReportItem 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 => (ReportItem)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add(string name, object value)
|
||||
{
|
||||
return Add(name, value, null);
|
||||
}
|
||||
|
||||
public int Add(string name, object value, string format)
|
||||
{
|
||||
ReportItem item = new ReportItem();
|
||||
|
||||
item.Values.Add(name);
|
||||
item.Values.Add(value == null ? "" : value.ToString(), format);
|
||||
|
||||
return Add(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ReportItem entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ReportItem value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ReportItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ReportItem instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ReportItem value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ReportItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.ReportItem instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(ReportItem value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ReportItem instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportItem instance to remove.</param>
|
||||
public void Remove(ReportItem value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ReportItem instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ReportItem's enumerator.</returns>
|
||||
public new ReportItemCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ReportItemCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ReportItem instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportItem instance to insert.</param>
|
||||
public void Insert(int index, ReportItem value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ReportItem.
|
||||
/// </summary>
|
||||
public class ReportItemCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ReportItemCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ReportItem _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 ReportItemCollectionEnumerator(ReportItemCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ReportItem object in the enumerated ReportItemCollection currently indexed by this
|
||||
/// instance.
|
||||
/// </summary>
|
||||
public ReportItem 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,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
|
||||
}
|
||||
}
|
||||
|
|
@ -3,94 +3,96 @@ using Server.Accounting;
|
|||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public abstract class BaseInfo : IComparable
|
||||
{
|
||||
public static TimeSpan SortRange { get; set; }
|
||||
public abstract class BaseInfo : IComparable
|
||||
{
|
||||
private string m_Display;
|
||||
|
||||
private string m_Display;
|
||||
public BaseInfo(string account)
|
||||
{
|
||||
Account = account;
|
||||
Pages = new PageInfoCollection();
|
||||
}
|
||||
|
||||
public string Account { get; set; }
|
||||
public static TimeSpan SortRange{ get; set; }
|
||||
|
||||
public PageInfoCollection Pages { get; set; }
|
||||
public string Account{ get; set; }
|
||||
|
||||
public string Display
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Display != null )
|
||||
return m_Display;
|
||||
public PageInfoCollection Pages{ get; set; }
|
||||
|
||||
if ( Account != null )
|
||||
{
|
||||
IAccount acct = Accounts.GetAccount( Account );
|
||||
public string Display
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Display != null)
|
||||
return m_Display;
|
||||
|
||||
if ( acct != null )
|
||||
{
|
||||
Mobile mob = null;
|
||||
if (Account != null)
|
||||
{
|
||||
IAccount acct = Accounts.GetAccount(Account);
|
||||
|
||||
for ( int i = 0; i < acct.Length; ++i )
|
||||
{
|
||||
Mobile check = acct[i];
|
||||
if (acct != null)
|
||||
{
|
||||
Mobile mob = null;
|
||||
|
||||
if ( check != null && (mob == null || check.AccessLevel > mob.AccessLevel) )
|
||||
mob = check;
|
||||
}
|
||||
for (int i = 0; i < acct.Length; ++i)
|
||||
{
|
||||
Mobile check = acct[i];
|
||||
|
||||
if ( mob?.Name != null && mob.Name.Length > 0 )
|
||||
return ( m_Display = mob.Name );
|
||||
}
|
||||
}
|
||||
if (check != null && (mob == null || check.AccessLevel > mob.AccessLevel))
|
||||
mob = check;
|
||||
}
|
||||
|
||||
return ( m_Display = Account );
|
||||
}
|
||||
}
|
||||
if (mob?.Name != null && mob.Name.Length > 0)
|
||||
return m_Display = mob.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetPageCount( PageResolution res, DateTime min, DateTime max )
|
||||
{
|
||||
return StaffHistory.GetPageCount( Pages, res, min, max );
|
||||
}
|
||||
return m_Display = Account;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseInfo( string account )
|
||||
{
|
||||
Account = account;
|
||||
Pages = new PageInfoCollection();
|
||||
}
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
BaseInfo cmp = obj as BaseInfo;
|
||||
|
||||
public void Register( PageInfo page )
|
||||
{
|
||||
Pages.Add( page );
|
||||
}
|
||||
int v = cmp.GetPageCount(cmp is StaffInfo ? PageResolution.Handled : PageResolution.None,
|
||||
DateTime.UtcNow - SortRange, DateTime.UtcNow)
|
||||
- GetPageCount(this is StaffInfo ? PageResolution.Handled : PageResolution.None,
|
||||
DateTime.UtcNow - SortRange, DateTime.UtcNow);
|
||||
|
||||
public void Unregister( PageInfo page )
|
||||
{
|
||||
Pages.Remove( page );
|
||||
}
|
||||
if (v == 0)
|
||||
v = string.Compare(Display, cmp.Display);
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
BaseInfo cmp = obj as BaseInfo;
|
||||
return v;
|
||||
}
|
||||
|
||||
int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - SortRange, DateTime.UtcNow )
|
||||
- GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - SortRange, DateTime.UtcNow );
|
||||
public int GetPageCount(PageResolution res, DateTime min, DateTime max)
|
||||
{
|
||||
return StaffHistory.GetPageCount(Pages, res, min, max);
|
||||
}
|
||||
|
||||
if ( v == 0 )
|
||||
v = string.Compare( Display, cmp.Display );
|
||||
public void Register(PageInfo page)
|
||||
{
|
||||
Pages.Add(page);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
public void Unregister(PageInfo page)
|
||||
{
|
||||
Pages.Remove(page);
|
||||
}
|
||||
}
|
||||
|
||||
public class StaffInfo : BaseInfo
|
||||
{
|
||||
public StaffInfo( string account ) : base( account )
|
||||
{
|
||||
}
|
||||
}
|
||||
public class StaffInfo : BaseInfo
|
||||
{
|
||||
public StaffInfo(string account) : base(account)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class UserInfo : BaseInfo
|
||||
{
|
||||
public UserInfo( string account ) : base( account )
|
||||
{
|
||||
}
|
||||
}
|
||||
public class UserInfo : BaseInfo
|
||||
{
|
||||
public UserInfo(string account) : base(account)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,230 +4,232 @@ using Server.Engines.Help;
|
|||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public enum PageResolution
|
||||
{
|
||||
None,
|
||||
Handled,
|
||||
Deleted,
|
||||
Logged,
|
||||
Canceled
|
||||
}
|
||||
public enum PageResolution
|
||||
{
|
||||
None,
|
||||
Handled,
|
||||
Deleted,
|
||||
Logged,
|
||||
Canceled
|
||||
}
|
||||
|
||||
public class PageInfo : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "pi", Construct );
|
||||
public class PageInfo : PersistableObject
|
||||
{
|
||||
private StaffHistory m_History;
|
||||
private StaffInfo m_Resolver;
|
||||
private UserInfo m_Sender;
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new PageInfo();
|
||||
}
|
||||
private string m_SentBy;
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public PageInfo()
|
||||
{
|
||||
Responses = new ResponseInfoCollection();
|
||||
}
|
||||
|
||||
private StaffHistory m_History;
|
||||
private StaffInfo m_Resolver;
|
||||
private UserInfo m_Sender;
|
||||
public PageInfo(PageEntry entry)
|
||||
{
|
||||
PageType = entry.Type;
|
||||
|
||||
public StaffInfo Resolver
|
||||
{
|
||||
get => m_Resolver;
|
||||
set
|
||||
{
|
||||
if ( m_Resolver == value )
|
||||
return;
|
||||
TimeSent = entry.Sent;
|
||||
m_SentBy = GetAccount(entry.Sender);
|
||||
|
||||
lock ( StaffHistory.RenderLock )
|
||||
{
|
||||
m_Resolver?.Unregister( this );
|
||||
Message = entry.Message;
|
||||
Responses = new ResponseInfoCollection();
|
||||
}
|
||||
|
||||
m_Resolver = value;
|
||||
public StaffInfo Resolver
|
||||
{
|
||||
get => m_Resolver;
|
||||
set
|
||||
{
|
||||
if (m_Resolver == value)
|
||||
return;
|
||||
|
||||
m_Resolver?.Register( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
lock (StaffHistory.RenderLock)
|
||||
{
|
||||
m_Resolver?.Unregister(this);
|
||||
|
||||
public UserInfo Sender
|
||||
{
|
||||
get => m_Sender;
|
||||
set
|
||||
{
|
||||
if ( m_Sender == value )
|
||||
return;
|
||||
m_Resolver = value;
|
||||
|
||||
lock ( StaffHistory.RenderLock )
|
||||
{
|
||||
m_Sender?.Unregister( this );
|
||||
m_Resolver?.Register(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_Sender = value;
|
||||
public UserInfo Sender
|
||||
{
|
||||
get => m_Sender;
|
||||
set
|
||||
{
|
||||
if (m_Sender == value)
|
||||
return;
|
||||
|
||||
m_Sender?.Register( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
lock (StaffHistory.RenderLock)
|
||||
{
|
||||
m_Sender?.Unregister(this);
|
||||
|
||||
private string m_SentBy;
|
||||
m_Sender = value;
|
||||
|
||||
public StaffHistory History
|
||||
{
|
||||
get => m_History;
|
||||
set
|
||||
{
|
||||
if ( m_History == value )
|
||||
return;
|
||||
m_Sender?.Register(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_History != null )
|
||||
{
|
||||
Sender = null;
|
||||
Resolver = null;
|
||||
}
|
||||
public StaffHistory History
|
||||
{
|
||||
get => m_History;
|
||||
set
|
||||
{
|
||||
if (m_History == value)
|
||||
return;
|
||||
|
||||
m_History = value;
|
||||
if (m_History != null)
|
||||
{
|
||||
Sender = null;
|
||||
Resolver = null;
|
||||
}
|
||||
|
||||
if ( m_History != null )
|
||||
{
|
||||
Sender = m_History.GetUserInfo( m_SentBy );
|
||||
UpdateResolver();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_History = value;
|
||||
|
||||
public PageType PageType { get; set; }
|
||||
if (m_History != null)
|
||||
{
|
||||
Sender = m_History.GetUserInfo(m_SentBy);
|
||||
UpdateResolver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PageResolution Resolution { get; private set; }
|
||||
public PageType PageType{ get; set; }
|
||||
|
||||
public DateTime TimeSent { get; set; }
|
||||
public PageResolution Resolution{ get; private set; }
|
||||
|
||||
public DateTime TimeResolved { get; private set; }
|
||||
public DateTime TimeSent{ get; set; }
|
||||
|
||||
public string SentBy
|
||||
{
|
||||
get => m_SentBy;
|
||||
set
|
||||
{
|
||||
m_SentBy = value;
|
||||
public DateTime TimeResolved{ get; private set; }
|
||||
|
||||
if ( m_History != null )
|
||||
Sender = m_History.GetUserInfo( m_SentBy );
|
||||
}
|
||||
}
|
||||
public string SentBy
|
||||
{
|
||||
get => m_SentBy;
|
||||
set
|
||||
{
|
||||
m_SentBy = value;
|
||||
|
||||
public string ResolvedBy { get; private set; }
|
||||
if (m_History != null)
|
||||
Sender = m_History.GetUserInfo(m_SentBy);
|
||||
}
|
||||
}
|
||||
|
||||
public string Message { get; set; }
|
||||
public string ResolvedBy{ get; private set; }
|
||||
|
||||
public ResponseInfoCollection Responses { get; set; }
|
||||
public string Message{ get; set; }
|
||||
|
||||
public void UpdateResolver()
|
||||
{
|
||||
string resolvedBy;
|
||||
DateTime timeResolved;
|
||||
PageResolution res = GetResolution( out resolvedBy, out timeResolved );
|
||||
public ResponseInfoCollection Responses{ get; set; }
|
||||
|
||||
if ( m_History != null && IsStaffResolution( res ) )
|
||||
Resolver = m_History.GetStaffInfo( resolvedBy );
|
||||
else
|
||||
Resolver = null;
|
||||
public void UpdateResolver()
|
||||
{
|
||||
string resolvedBy;
|
||||
DateTime timeResolved;
|
||||
PageResolution res = GetResolution(out resolvedBy, out timeResolved);
|
||||
|
||||
ResolvedBy = resolvedBy;
|
||||
TimeResolved = timeResolved;
|
||||
Resolution = res;
|
||||
}
|
||||
if (m_History != null && IsStaffResolution(res))
|
||||
Resolver = m_History.GetStaffInfo(resolvedBy);
|
||||
else
|
||||
Resolver = null;
|
||||
|
||||
public bool IsStaffResolution( PageResolution res )
|
||||
{
|
||||
return ( res == PageResolution.Handled );
|
||||
}
|
||||
ResolvedBy = resolvedBy;
|
||||
TimeResolved = timeResolved;
|
||||
Resolution = res;
|
||||
}
|
||||
|
||||
public static PageResolution ResFromResp( string resp )
|
||||
{
|
||||
switch ( resp )
|
||||
{
|
||||
case "[Handled]": return PageResolution.Handled;
|
||||
case "[Deleting]": return PageResolution.Deleted;
|
||||
case "[Logout]": return PageResolution.Logged;
|
||||
case "[Canceled]": return PageResolution.Canceled;
|
||||
}
|
||||
public bool IsStaffResolution(PageResolution res)
|
||||
{
|
||||
return res == PageResolution.Handled;
|
||||
}
|
||||
|
||||
return PageResolution.None;
|
||||
}
|
||||
public static PageResolution ResFromResp(string resp)
|
||||
{
|
||||
switch (resp)
|
||||
{
|
||||
case "[Handled]": return PageResolution.Handled;
|
||||
case "[Deleting]": return PageResolution.Deleted;
|
||||
case "[Logout]": return PageResolution.Logged;
|
||||
case "[Canceled]": return PageResolution.Canceled;
|
||||
}
|
||||
|
||||
public PageResolution GetResolution( out string resolvedBy, out DateTime timeResolved )
|
||||
{
|
||||
for ( int i = Responses.Count - 1; i >= 0; --i )
|
||||
{
|
||||
ResponseInfo resp = Responses[i];
|
||||
PageResolution res = ResFromResp( resp.Message );
|
||||
return PageResolution.None;
|
||||
}
|
||||
|
||||
if ( res != PageResolution.None )
|
||||
{
|
||||
resolvedBy = resp.SentBy;
|
||||
timeResolved = resp.TimeStamp;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public PageResolution GetResolution(out string resolvedBy, out DateTime timeResolved)
|
||||
{
|
||||
for (int i = Responses.Count - 1; i >= 0; --i)
|
||||
{
|
||||
ResponseInfo resp = Responses[i];
|
||||
PageResolution res = ResFromResp(resp.Message);
|
||||
|
||||
resolvedBy = m_SentBy;
|
||||
timeResolved = TimeSent;
|
||||
return PageResolution.None;
|
||||
}
|
||||
if (res != PageResolution.None)
|
||||
{
|
||||
resolvedBy = resp.SentBy;
|
||||
timeResolved = resp.TimeStamp;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetAccount( Mobile mob )
|
||||
{
|
||||
return mob?.Account is Account acct ? acct.Username : null;
|
||||
}
|
||||
resolvedBy = m_SentBy;
|
||||
timeResolved = TimeSent;
|
||||
return PageResolution.None;
|
||||
}
|
||||
|
||||
public PageInfo()
|
||||
{
|
||||
Responses = new ResponseInfoCollection();
|
||||
}
|
||||
public static string GetAccount(Mobile mob)
|
||||
{
|
||||
return mob?.Account is Account acct ? acct.Username : null;
|
||||
}
|
||||
|
||||
public PageInfo( PageEntry entry )
|
||||
{
|
||||
PageType = entry.Type;
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetInt32("p", (int)PageType);
|
||||
|
||||
TimeSent = entry.Sent;
|
||||
m_SentBy = GetAccount( entry.Sender );
|
||||
op.SetDateTime("ts", TimeSent);
|
||||
op.SetString("s", m_SentBy);
|
||||
|
||||
Message = entry.Message;
|
||||
Responses = new ResponseInfoCollection();
|
||||
}
|
||||
op.SetString("m", Message);
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetInt32( "p", (int)PageType );
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
PageType = (PageType)ip.GetInt32("p");
|
||||
|
||||
op.SetDateTime( "ts", TimeSent );
|
||||
op.SetString( "s", m_SentBy );
|
||||
TimeSent = ip.GetDateTime("ts");
|
||||
m_SentBy = ip.GetString("s");
|
||||
|
||||
op.SetString( "m", Message );
|
||||
}
|
||||
Message = ip.GetString("m");
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
PageType = (PageType) ip.GetInt32( "p" );
|
||||
public override void SerializeChildren(PersistanceWriter op)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
for (int i = 0; i < Responses.Count; ++i)
|
||||
Responses[i].Serialize(op);
|
||||
}
|
||||
}
|
||||
|
||||
TimeSent = ip.GetDateTime( "ts" );
|
||||
m_SentBy = ip.GetString( "s" );
|
||||
public override void DeserializeChildren(PersistanceReader ip)
|
||||
{
|
||||
while (ip.HasChild)
|
||||
Responses.Add(ip.GetChild() as ResponseInfo);
|
||||
}
|
||||
|
||||
Message = ip.GetString( "m" );
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
lock ( this )
|
||||
{
|
||||
for ( int i = 0; i < Responses.Count; ++i )
|
||||
Responses[i].Serialize( op );
|
||||
}
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("pi", Construct);
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
Responses.Add( ip.GetChild() as ResponseInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new PageInfo();
|
||||
}
|
||||
|
||||
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.PageInfo.
|
||||
/// </summary>
|
||||
public class PageInfoCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.PageInfo.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.PageInfo at a specific position in the PageInfoCollection.
|
||||
/// </summary>
|
||||
public class PageInfoCollection : CollectionBase
|
||||
public PageInfo this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public PageInfoCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.PageInfo at a specific position in the PageInfoCollection.
|
||||
/// </summary>
|
||||
public PageInfo this[int index]
|
||||
{
|
||||
get => ((PageInfo)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.PageInfo entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(PageInfo value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.PageInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.PageInfo instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(PageInfo value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.PageInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.PageInfo instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(PageInfo value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.PageInfo instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.PageInfo instance to remove.</param>
|
||||
public void Remove(PageInfo value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.PageInfo instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.PageInfo's enumerator.</returns>
|
||||
public new PageInfoCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new PageInfoCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.PageInfo instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.PageInfo instance to insert.</param>
|
||||
public void Insert(int index, PageInfo value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.PageInfo.
|
||||
/// </summary>
|
||||
public class PageInfoCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private PageInfo _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private PageInfoCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal PageInfoCollectionEnumerator(PageInfoCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.PageInfo object in the enumerated PageInfoCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public PageInfo 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 => (PageInfo)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.PageInfo entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(PageInfo value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.PageInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.PageInfo instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(PageInfo value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.PageInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.PageInfo instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(PageInfo value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.PageInfo instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.PageInfo instance to remove.</param>
|
||||
public void Remove(PageInfo value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.PageInfo instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.PageInfo's enumerator.</returns>
|
||||
public new PageInfoCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new PageInfoCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.PageInfo instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.PageInfo instance to insert.</param>
|
||||
public void Insert(int index, PageInfo value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.PageInfo.
|
||||
/// </summary>
|
||||
public class PageInfoCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private PageInfoCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private PageInfo _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 PageInfoCollectionEnumerator(PageInfoCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.PageInfo object in the enumerated PageInfoCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public PageInfo 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,43 +2,45 @@ using System;
|
|||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class QueueStatus : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "qs", Construct );
|
||||
public class QueueStatus : PersistableObject
|
||||
{
|
||||
public QueueStatus()
|
||||
{
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new QueueStatus();
|
||||
}
|
||||
public QueueStatus(int count)
|
||||
{
|
||||
TimeStamp = DateTime.UtcNow;
|
||||
Count = count;
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public DateTime TimeStamp{ get; set; }
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
public int Count{ get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetDateTime("t", TimeStamp);
|
||||
op.SetInt32("c", Count);
|
||||
}
|
||||
|
||||
public QueueStatus()
|
||||
{
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
TimeStamp = ip.GetDateTime("t");
|
||||
Count = ip.GetInt32("c");
|
||||
}
|
||||
|
||||
public QueueStatus( int count )
|
||||
{
|
||||
TimeStamp = DateTime.UtcNow;
|
||||
Count = count;
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", TimeStamp );
|
||||
op.SetInt32( "c", Count );
|
||||
}
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("qs", Construct);
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
TimeStamp = ip.GetDateTime( "t" );
|
||||
Count = ip.GetInt32( "c" );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new QueueStatus();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -8,182 +8,176 @@
|
|||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.QueueStatus.
|
||||
/// </summary>
|
||||
public class QueueStatusCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.QueueStatus.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.QueueStatus at a specific position in the QueueStatusCollection.
|
||||
/// </summary>
|
||||
public class QueueStatusCollection : CollectionBase
|
||||
public QueueStatus this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public QueueStatusCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.QueueStatus at a specific position in the QueueStatusCollection.
|
||||
/// </summary>
|
||||
public QueueStatus this[int index]
|
||||
{
|
||||
get => ((QueueStatus)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.QueueStatus entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(QueueStatus value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.QueueStatus instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.QueueStatus instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(QueueStatus value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.QueueStatus instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.QueueStatus instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(QueueStatus value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.QueueStatus instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.QueueStatus instance to remove.</param>
|
||||
public void Remove(QueueStatus value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.QueueStatus instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.QueueStatus's enumerator.</returns>
|
||||
public new QueueStatusCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new QueueStatusCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.QueueStatus instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.QueueStatus instance to insert.</param>
|
||||
public void Insert(int index, QueueStatus value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.QueueStatus.
|
||||
/// </summary>
|
||||
public class QueueStatusCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private QueueStatus _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private QueueStatusCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal QueueStatusCollectionEnumerator(QueueStatusCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.QueueStatus object in the enumerated QueueStatusCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public QueueStatus 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 => (QueueStatus)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.QueueStatus entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(QueueStatus value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.QueueStatus instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.QueueStatus instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(QueueStatus value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.QueueStatus instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.QueueStatus instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(QueueStatus value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.QueueStatus instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.QueueStatus instance to remove.</param>
|
||||
public void Remove(QueueStatus value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.QueueStatus instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.QueueStatus's enumerator.</returns>
|
||||
public new QueueStatusCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new QueueStatusCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.QueueStatus instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.QueueStatus instance to insert.</param>
|
||||
public void Insert(int index, QueueStatus value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.QueueStatus.
|
||||
/// </summary>
|
||||
public class QueueStatusCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private QueueStatusCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private QueueStatus _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 QueueStatusCollectionEnumerator(QueueStatusCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.QueueStatus object in the enumerated QueueStatusCollection currently indexed by this
|
||||
/// instance.
|
||||
/// </summary>
|
||||
public QueueStatus 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,50 +2,52 @@ using System;
|
|||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ResponseInfo : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "rs", Construct );
|
||||
public class ResponseInfo : PersistableObject
|
||||
{
|
||||
public ResponseInfo()
|
||||
{
|
||||
}
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ResponseInfo();
|
||||
}
|
||||
public ResponseInfo(string sentBy, string message)
|
||||
{
|
||||
TimeStamp = DateTime.UtcNow;
|
||||
SentBy = sentBy;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
public DateTime TimeStamp{ get; set; }
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
public string SentBy{ get; set; }
|
||||
|
||||
public string SentBy { get; set; }
|
||||
public string Message{ get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
public override void SerializeAttributes(PersistanceWriter op)
|
||||
{
|
||||
op.SetDateTime("t", TimeStamp);
|
||||
|
||||
public ResponseInfo()
|
||||
{
|
||||
}
|
||||
op.SetString("s", SentBy);
|
||||
op.SetString("m", Message);
|
||||
}
|
||||
|
||||
public ResponseInfo( string sentBy, string message )
|
||||
{
|
||||
TimeStamp = DateTime.UtcNow;
|
||||
SentBy = sentBy;
|
||||
Message = message;
|
||||
}
|
||||
public override void DeserializeAttributes(PersistanceReader ip)
|
||||
{
|
||||
TimeStamp = ip.GetDateTime("t");
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", TimeStamp );
|
||||
SentBy = ip.GetString("s");
|
||||
Message = ip.GetString("m");
|
||||
}
|
||||
|
||||
op.SetString( "s", SentBy );
|
||||
op.SetString( "m", Message );
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
TimeStamp = ip.GetDateTime( "t" );
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("rs", Construct);
|
||||
|
||||
SentBy = ip.GetString( "s" );
|
||||
Message = ip.GetString( "m" );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ResponseInfo();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -8,187 +8,181 @@
|
|||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ResponseInfo.
|
||||
/// </summary>
|
||||
public class ResponseInfoCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ResponseInfo.
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ResponseInfo at a specific position in the ResponseInfoCollection.
|
||||
/// </summary>
|
||||
public class ResponseInfoCollection : CollectionBase
|
||||
public ResponseInfo this[int index]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ResponseInfoCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ResponseInfo at a specific position in the ResponseInfoCollection.
|
||||
/// </summary>
|
||||
public ResponseInfo this[int index]
|
||||
{
|
||||
get => ((ResponseInfo)(List[index]));
|
||||
set => List[index] = value;
|
||||
}
|
||||
|
||||
public int Add( string sentBy, string message )
|
||||
{
|
||||
return Add( new ResponseInfo( sentBy, message ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ResponseInfo entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ResponseInfo value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ResponseInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ResponseInfo instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ResponseInfo value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ResponseInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ResponseInfo instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(ResponseInfo value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ResponseInfo instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ResponseInfo instance to remove.</param>
|
||||
public void Remove(ResponseInfo value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ResponseInfo instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ResponseInfo's enumerator.</returns>
|
||||
public new ResponseInfoCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ResponseInfoCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ResponseInfo instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ResponseInfo instance to insert.</param>
|
||||
public void Insert(int index, ResponseInfo value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ResponseInfo.
|
||||
/// </summary>
|
||||
public class ResponseInfoCollectionEnumerator : IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ResponseInfo _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ResponseInfoCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ResponseInfoCollectionEnumerator(ResponseInfoCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ResponseInfo object in the enumerated ResponseInfoCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public ResponseInfo 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 => (ResponseInfo)List[index];
|
||||
set => List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add(string sentBy, string message)
|
||||
{
|
||||
return Add(new ResponseInfo(sentBy, message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ResponseInfo entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(ResponseInfo value)
|
||||
{
|
||||
return List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ResponseInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ResponseInfo instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(ResponseInfo value)
|
||||
{
|
||||
return List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ResponseInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance to find.</param>
|
||||
/// <returns>
|
||||
/// The zero-based index of the specified Server.Engines.Reports.ResponseInfo instance. If the object is not found, the
|
||||
/// return value is -1.
|
||||
/// </returns>
|
||||
public int IndexOf(ResponseInfo value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ResponseInfo instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ResponseInfo instance to remove.</param>
|
||||
public void Remove(ResponseInfo value)
|
||||
{
|
||||
List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ResponseInfo instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ResponseInfo's enumerator.</returns>
|
||||
public new ResponseInfoCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ResponseInfoCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ResponseInfo instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ResponseInfo instance to insert.</param>
|
||||
public void Insert(int index, ResponseInfo value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ResponseInfo.
|
||||
/// </summary>
|
||||
public class ResponseInfoCollectionEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ResponseInfoCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private ResponseInfo _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 ResponseInfoCollectionEnumerator(ResponseInfoCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ResponseInfo object in the enumerated ResponseInfoCollection currently indexed by this
|
||||
/// instance.
|
||||
/// </summary>
|
||||
public ResponseInfo 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,393 +1,402 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class StaffHistory : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "stfhst", Construct );
|
||||
public class StaffHistory : PersistableObject
|
||||
{
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType("stfhst", Construct);
|
||||
public static readonly object RenderLock = new object();
|
||||
public static readonly object SaveLock = new object();
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new StaffHistory();
|
||||
}
|
||||
public StaffHistory()
|
||||
{
|
||||
Pages = new PageInfoCollection();
|
||||
QueueStats = new QueueStatusCollection();
|
||||
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
UserInfo = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||
StaffInfo = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public PageInfoCollection Pages { get; set; }
|
||||
public PageInfoCollection Pages{ get; set; }
|
||||
|
||||
public QueueStatusCollection QueueStats{ get; set; }
|
||||
|
||||
public Hashtable UserInfo{ get; set; }
|
||||
|
||||
public Hashtable StaffInfo{ get; set; }
|
||||
|
||||
public void AddPage(PageInfo info)
|
||||
{
|
||||
lock (SaveLock)
|
||||
{
|
||||
Pages.Add(info);
|
||||
}
|
||||
|
||||
info.History = this;
|
||||
}
|
||||
|
||||
public StaffInfo GetStaffInfo(string account)
|
||||
{
|
||||
lock (RenderLock)
|
||||
{
|
||||
if (string.IsNullOrEmpty(account))
|
||||
return null;
|
||||
|
||||
if (!(StaffInfo[account] is StaffInfo info))
|
||||
StaffInfo[account] = info = new StaffInfo(account);
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
public UserInfo GetUserInfo(string account)
|
||||
{
|
||||
if (string.IsNullOrEmpty(account))
|
||||
return null;
|
||||
|
||||
if (!(UserInfo[account] is UserInfo info))
|
||||
UserInfo[account] = info = new UserInfo(account);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
lock (SaveLock)
|
||||
{
|
||||
string path = Path.Combine(Core.BaseDirectory, "staffHistory.xml");
|
||||
PersistanceWriter pw = new XmlPersistanceWriter(path, "Staff");
|
||||
|
||||
pw.WriteDocument(this);
|
||||
|
||||
pw.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
string path = Path.Combine(Core.BaseDirectory, "staffHistory.xml");
|
||||
|
||||
if (!File.Exists(path))
|
||||
return;
|
||||
|
||||
PersistanceReader pr = new XmlPersistanceReader(path, "Staff");
|
||||
|
||||
pr.ReadDocument(this);
|
||||
|
||||
pr.Close();
|
||||
}
|
||||
|
||||
public override void SerializeChildren(PersistanceWriter op)
|
||||
{
|
||||
for (int i = 0; i < Pages.Count; ++i)
|
||||
Pages[i].Serialize(op);
|
||||
|
||||
for (int i = 0; i < QueueStats.Count; ++i)
|
||||
QueueStats[i].Serialize(op);
|
||||
}
|
||||
|
||||
public override void DeserializeChildren(PersistanceReader ip)
|
||||
{
|
||||
DateTime min = DateTime.UtcNow - TimeSpan.FromDays(8.0);
|
||||
|
||||
while (ip.HasChild)
|
||||
{
|
||||
PersistableObject obj = ip.GetChild();
|
||||
|
||||
if (obj is PageInfo pageInfo)
|
||||
{
|
||||
pageInfo.UpdateResolver();
|
||||
|
||||
if (pageInfo.TimeSent >= min || pageInfo.TimeResolved >= min)
|
||||
{
|
||||
Pages.Add(pageInfo);
|
||||
pageInfo.History = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
pageInfo.Sender = null;
|
||||
pageInfo.Resolver = null;
|
||||
}
|
||||
}
|
||||
else if (obj is QueueStatus queueStatus)
|
||||
{
|
||||
if (queueStatus.TimeStamp >= min)
|
||||
QueueStats.Add(queueStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StaffInfo[] GetStaff()
|
||||
{
|
||||
StaffInfo[] staff = new StaffInfo[StaffInfo.Count];
|
||||
int index = 0;
|
||||
|
||||
foreach (StaffInfo staffInfo in StaffInfo.Values)
|
||||
staff[index++] = staffInfo;
|
||||
|
||||
return staff;
|
||||
}
|
||||
|
||||
public void Render(ObjectCollection objects)
|
||||
{
|
||||
lock (RenderLock)
|
||||
{
|
||||
objects.Add(GraphQueueStatus());
|
||||
|
||||
StaffInfo[] staff = GetStaff();
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays(7.0);
|
||||
Array.Sort(staff);
|
||||
|
||||
objects.Add(GraphHourlyPages(Pages, PageResolution.None, "New pages by hour", "graph_new_pages_hr"));
|
||||
objects.Add(GraphHourlyPages(Pages, PageResolution.Handled, "Handled pages by hour",
|
||||
"graph_handled_pages_hr"));
|
||||
objects.Add(GraphHourlyPages(Pages, PageResolution.Deleted, "Deleted pages by hour",
|
||||
"graph_deleted_pages_hr"));
|
||||
objects.Add(GraphHourlyPages(Pages, PageResolution.Canceled, "Canceled pages by hour",
|
||||
"graph_canceled_pages_hr"));
|
||||
objects.Add(GraphHourlyPages(Pages, PageResolution.Logged, "Logged-out pages by hour",
|
||||
"graph_logged_pages_hr"));
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays(1.0);
|
||||
Array.Sort(staff);
|
||||
|
||||
objects.Add(ReportTotalPages(staff, TimeSpan.FromDays(1.0), "1 Day"));
|
||||
objects.AddRange(ChartTotalPages(staff, TimeSpan.FromDays(1.0), "1 Day", "graph_daily_pages"));
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays(7.0);
|
||||
Array.Sort(staff);
|
||||
|
||||
objects.Add(ReportTotalPages(staff, TimeSpan.FromDays(7.0), "1 Week"));
|
||||
objects.AddRange(ChartTotalPages(staff, TimeSpan.FromDays(7.0), "1 Week", "graph_weekly_pages"));
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays(30.0);
|
||||
Array.Sort(staff);
|
||||
|
||||
objects.Add(ReportTotalPages(staff, TimeSpan.FromDays(30.0), "1 Month"));
|
||||
objects.AddRange(ChartTotalPages(staff, TimeSpan.FromDays(30.0), "1 Month", "graph_monthly_pages"));
|
||||
|
||||
public QueueStatusCollection QueueStats { get; set; }
|
||||
for (int i = 0; i < staff.Length; ++i)
|
||||
objects.Add(GraphHourlyPages(staff[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetPageCount(StaffInfo staff, DateTime min, DateTime max)
|
||||
{
|
||||
return GetPageCount(staff.Pages, PageResolution.Handled, min, max);
|
||||
}
|
||||
|
||||
public static int GetPageCount(PageInfoCollection pages, PageResolution res, DateTime min, DateTime max)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < pages.Count; ++i)
|
||||
{
|
||||
if (res != PageResolution.None && pages[i].Resolution != res)
|
||||
continue;
|
||||
|
||||
DateTime ts = pages[i].TimeResolved;
|
||||
|
||||
if (ts >= min && ts < max)
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private BarGraph GraphQueueStatus()
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - TimeSpan.FromDays(7.0);
|
||||
|
||||
for (int i = 0; i < QueueStats.Count; ++i)
|
||||
{
|
||||
DateTime ts = QueueStats[i].TimeStamp;
|
||||
|
||||
public Hashtable UserInfo { get; set; }
|
||||
if (ts >= min && ts < max)
|
||||
{
|
||||
DateTime date = ts.Date;
|
||||
TimeSpan time = ts.TimeOfDay;
|
||||
|
||||
public Hashtable StaffInfo { get; set; }
|
||||
int hour = time.Hours;
|
||||
|
||||
public void AddPage( PageInfo info )
|
||||
{
|
||||
lock ( SaveLock )
|
||||
Pages.Add( info );
|
||||
totals[hour] += QueueStats[i].Count;
|
||||
counts[hour]++;
|
||||
}
|
||||
}
|
||||
|
||||
info.History = this;
|
||||
}
|
||||
|
||||
public StaffHistory()
|
||||
{
|
||||
Pages = new PageInfoCollection();
|
||||
QueueStats = new QueueStatusCollection();
|
||||
|
||||
UserInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
StaffInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
}
|
||||
|
||||
public StaffInfo GetStaffInfo( string account )
|
||||
{
|
||||
lock ( RenderLock )
|
||||
{
|
||||
if ( string.IsNullOrEmpty(account) )
|
||||
return null;
|
||||
|
||||
if ( !(StaffInfo[account] is StaffInfo info) )
|
||||
StaffInfo[account] = info = new StaffInfo( account );
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
public UserInfo GetUserInfo( string account )
|
||||
{
|
||||
if ( string.IsNullOrEmpty(account) )
|
||||
return null;
|
||||
|
||||
if ( !(UserInfo[account] is UserInfo info) )
|
||||
UserInfo[account] = info = new UserInfo( account );
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public static readonly object RenderLock = new object();
|
||||
public static readonly object SaveLock = new object();
|
||||
|
||||
public void Save()
|
||||
{
|
||||
lock ( SaveLock )
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "staffHistory.xml" );
|
||||
PersistanceWriter pw = new XmlPersistanceWriter( path, "Staff" );
|
||||
BarGraph barGraph = new BarGraph("Average pages in queue", "graph_pagequeue_avg", 10, "Time", "Pages",
|
||||
BarGraphRenderMode.Lines);
|
||||
|
||||
pw.WriteDocument( this );
|
||||
barGraph.FontSize = 6;
|
||||
|
||||
pw.Close();
|
||||
}
|
||||
}
|
||||
for (int i = 7; i <= totals.Length + 7; ++i)
|
||||
{
|
||||
int val;
|
||||
|
||||
public void Load()
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "staffHistory.xml" );
|
||||
if (counts[i % totals.Length] == 0)
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i % totals.Length] + counts[i % totals.Length] / 2) / counts[i % totals.Length];
|
||||
|
||||
if ( !File.Exists( path ) )
|
||||
return;
|
||||
int realHours = i % totals.Length;
|
||||
int hours;
|
||||
|
||||
PersistanceReader pr = new XmlPersistanceReader( path, "Staff" );
|
||||
|
||||
pr.ReadDocument( this );
|
||||
if (realHours == 0)
|
||||
hours = 12;
|
||||
else if (realHours > 12)
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
pr.Close();
|
||||
}
|
||||
barGraph.Items.Add(hours + (realHours >= 12 ? " PM" : " AM"), val);
|
||||
}
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < Pages.Count; ++i )
|
||||
Pages[i].Serialize( op );
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < QueueStats.Count; ++i )
|
||||
QueueStats[i].Serialize( op );
|
||||
}
|
||||
private BarGraph GraphHourlyPages(StaffInfo staff)
|
||||
{
|
||||
return GraphHourlyPages(staff.Pages, PageResolution.Handled, "Average pages handled by " + staff.Display,
|
||||
"graphs_" + staff.Account.ToLower() + "_avg");
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
DateTime min = DateTime.UtcNow - TimeSpan.FromDays( 8.0 );
|
||||
private BarGraph GraphHourlyPages(PageInfoCollection pages, PageResolution res, string title, string fname)
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
|
||||
while ( ip.HasChild )
|
||||
{
|
||||
PersistableObject obj = ip.GetChild();
|
||||
DateTime[] dates = new DateTime[24];
|
||||
|
||||
if ( obj is PageInfo pageInfo )
|
||||
{
|
||||
pageInfo.UpdateResolver();
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - TimeSpan.FromDays(7.0);
|
||||
|
||||
if ( pageInfo.TimeSent >= min || pageInfo.TimeResolved >= min )
|
||||
{
|
||||
Pages.Add( pageInfo );
|
||||
pageInfo.History = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
pageInfo.Sender = null;
|
||||
pageInfo.Resolver = null;
|
||||
}
|
||||
}
|
||||
else if ( obj is QueueStatus queueStatus )
|
||||
{
|
||||
if ( queueStatus.TimeStamp >= min )
|
||||
QueueStats.Add( queueStatus );
|
||||
}
|
||||
}
|
||||
}
|
||||
bool sentStamp = res == PageResolution.None;
|
||||
|
||||
public StaffInfo[] GetStaff()
|
||||
{
|
||||
StaffInfo[] staff = new StaffInfo[StaffInfo.Count];
|
||||
int index = 0;
|
||||
for (int i = 0; i < pages.Count; ++i)
|
||||
{
|
||||
if (res != PageResolution.None && pages[i].Resolution != res)
|
||||
continue;
|
||||
|
||||
foreach ( StaffInfo staffInfo in StaffInfo.Values )
|
||||
staff[index++] = staffInfo;
|
||||
DateTime ts = sentStamp ? pages[i].TimeSent : pages[i].TimeResolved;
|
||||
|
||||
return staff;
|
||||
}
|
||||
if (ts >= min && ts < max)
|
||||
{
|
||||
DateTime date = ts.Date;
|
||||
TimeSpan time = ts.TimeOfDay;
|
||||
|
||||
public void Render( ObjectCollection objects )
|
||||
{
|
||||
lock ( RenderLock )
|
||||
{
|
||||
objects.Add( GraphQueueStatus() );
|
||||
int hour = time.Hours;
|
||||
|
||||
StaffInfo[] staff = GetStaff();
|
||||
totals[hour]++;
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 7.0 );
|
||||
Array.Sort( staff );
|
||||
if (dates[hour] != date)
|
||||
{
|
||||
counts[hour]++;
|
||||
dates[hour] = date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.None, "New pages by hour", "graph_new_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Handled, "Handled pages by hour", "graph_handled_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Deleted, "Deleted pages by hour", "graph_deleted_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Canceled, "Canceled pages by hour", "graph_canceled_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Logged, "Logged-out pages by hour", "graph_logged_pages_hr" ) );
|
||||
BarGraph barGraph = new BarGraph(title, fname, 10, "Time", "Pages", BarGraphRenderMode.Lines);
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 1.0 );
|
||||
Array.Sort( staff );
|
||||
|
||||
objects.Add( ReportTotalPages( staff, TimeSpan.FromDays( 1.0 ), "1 Day" ) );
|
||||
objects.AddRange( (PersistableObject[])ChartTotalPages( staff, TimeSpan.FromDays( 1.0 ), "1 Day", "graph_daily_pages" ) );
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 7.0 );
|
||||
Array.Sort( staff );
|
||||
barGraph.FontSize = 6;
|
||||
|
||||
objects.Add( ReportTotalPages( staff, TimeSpan.FromDays( 7.0 ), "1 Week" ) );
|
||||
objects.AddRange( (PersistableObject[])ChartTotalPages( staff, TimeSpan.FromDays( 7.0 ), "1 Week", "graph_weekly_pages" ) );
|
||||
for (int i = 7; i <= totals.Length + 7; ++i)
|
||||
{
|
||||
int val;
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 30.0 );
|
||||
Array.Sort( staff );
|
||||
if (counts[i % totals.Length] == 0)
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i % totals.Length] + counts[i % totals.Length] / 2) / counts[i % totals.Length];
|
||||
|
||||
objects.Add( ReportTotalPages( staff, TimeSpan.FromDays( 30.0 ), "1 Month" ) );
|
||||
objects.AddRange( (PersistableObject[])ChartTotalPages( staff, TimeSpan.FromDays( 30.0 ), "1 Month", "graph_monthly_pages" ) );
|
||||
int realHours = i % totals.Length;
|
||||
int hours;
|
||||
|
||||
for ( int i = 0; i < staff.Length; ++i )
|
||||
objects.Add( GraphHourlyPages( staff[i] ) );
|
||||
}
|
||||
}
|
||||
if (realHours == 0)
|
||||
hours = 12;
|
||||
else if (realHours > 12)
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
public static int GetPageCount( StaffInfo staff, DateTime min, DateTime max )
|
||||
{
|
||||
return GetPageCount( staff.Pages, PageResolution.Handled, min, max );
|
||||
}
|
||||
barGraph.Items.Add(hours + (realHours >= 12 ? " PM" : " AM"), val);
|
||||
}
|
||||
|
||||
public static int GetPageCount( PageInfoCollection pages, PageResolution res, DateTime min, DateTime max )
|
||||
{
|
||||
int count = 0;
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < pages.Count; ++i )
|
||||
{
|
||||
if ( res != PageResolution.None && pages[i].Resolution != res )
|
||||
continue;
|
||||
private Report ReportTotalPages(StaffInfo[] staff, TimeSpan ts, string title)
|
||||
{
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - ts;
|
||||
|
||||
DateTime ts = pages[i].TimeResolved;
|
||||
|
||||
if ( ts >= min && ts < max )
|
||||
++count;
|
||||
}
|
||||
Report report = new Report(title + " Staff Report", "400");
|
||||
|
||||
return count;
|
||||
}
|
||||
report.Columns.Add("65%", "left", "Staff Name");
|
||||
report.Columns.Add("35%", "center", "Page Count");
|
||||
|
||||
private BarGraph GraphQueueStatus()
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
for (int i = 0; i < staff.Length; ++i)
|
||||
report.Items.Add(staff[i].Display, GetPageCount(staff[i], min, max));
|
||||
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - TimeSpan.FromDays( 7.0 );
|
||||
return report;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < QueueStats.Count; ++i )
|
||||
{
|
||||
DateTime ts = QueueStats[i].TimeStamp;
|
||||
private PieChart[] ChartTotalPages(StaffInfo[] staff, TimeSpan ts, string title, string fname)
|
||||
{
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - ts;
|
||||
|
||||
if ( ts >= min && ts < max )
|
||||
{
|
||||
DateTime date = ts.Date;
|
||||
TimeSpan time = ts.TimeOfDay;
|
||||
PieChart staffChart = new PieChart(title + " Staff Chart", fname + "_staff", true);
|
||||
|
||||
int hour = time.Hours;
|
||||
int other = 0;
|
||||
|
||||
totals[hour] += QueueStats[i].Count;
|
||||
counts[hour]++;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < staff.Length; ++i)
|
||||
{
|
||||
int count = GetPageCount(staff[i], min, max);
|
||||
|
||||
BarGraph barGraph = new BarGraph( "Average pages in queue", "graph_pagequeue_avg", 10, "Time", "Pages", BarGraphRenderMode.Lines );
|
||||
if (i < 12 && count > 0)
|
||||
staffChart.Items.Add(staff[i].Display, count);
|
||||
else
|
||||
other += count;
|
||||
}
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
if (other > 0)
|
||||
staffChart.Items.Add("Other", other);
|
||||
|
||||
for ( int i = 7; i <= totals.Length+7; ++i )
|
||||
{
|
||||
int val;
|
||||
PieChart resChart = new PieChart(title + " Resolutions", fname + "_resol", true);
|
||||
|
||||
if ( counts[i%totals.Length] == 0 )
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i%totals.Length] + (counts[i%totals.Length] / 2)) / counts[i%totals.Length];
|
||||
int countTotal = GetPageCount(Pages, PageResolution.None, min, max);
|
||||
int countHandled = GetPageCount(Pages, PageResolution.Handled, min, max);
|
||||
int countDeleted = GetPageCount(Pages, PageResolution.Deleted, min, max);
|
||||
int countCanceled = GetPageCount(Pages, PageResolution.Canceled, min, max);
|
||||
int countLogged = GetPageCount(Pages, PageResolution.Logged, min, max);
|
||||
int countUnres = countTotal - (countHandled + countDeleted + countCanceled + countLogged);
|
||||
|
||||
int realHours = i%totals.Length;
|
||||
int hours;
|
||||
resChart.Items.Add("Handled", countHandled);
|
||||
resChart.Items.Add("Deleted", countDeleted);
|
||||
resChart.Items.Add("Canceled", countCanceled);
|
||||
resChart.Items.Add("Logged Out", countLogged);
|
||||
resChart.Items.Add("Unresolved", countUnres);
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
return new[] { staffChart, resChart };
|
||||
}
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
#region Type Identification
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new StaffHistory();
|
||||
}
|
||||
|
||||
private BarGraph GraphHourlyPages( StaffInfo staff )
|
||||
{
|
||||
return GraphHourlyPages( staff.Pages, PageResolution.Handled, "Average pages handled by " + staff.Display, "graphs_" + staff.Account.ToLower() + "_avg" );
|
||||
}
|
||||
public override PersistableType TypeID => ThisTypeID;
|
||||
|
||||
private BarGraph GraphHourlyPages( PageInfoCollection pages, PageResolution res, string title, string fname )
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
|
||||
DateTime[] dates = new DateTime[24];
|
||||
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - TimeSpan.FromDays( 7.0 );
|
||||
|
||||
bool sentStamp = ( res == PageResolution.None );
|
||||
|
||||
for ( int i = 0; i < pages.Count; ++i )
|
||||
{
|
||||
if ( res != PageResolution.None && pages[i].Resolution != res )
|
||||
continue;
|
||||
|
||||
DateTime ts = ( sentStamp ? pages[i].TimeSent : pages[i].TimeResolved );
|
||||
|
||||
if ( ts >= min && ts < max )
|
||||
{
|
||||
DateTime date = ts.Date;
|
||||
TimeSpan time = ts.TimeOfDay;
|
||||
|
||||
int hour = time.Hours;
|
||||
|
||||
totals[hour]++;
|
||||
|
||||
if ( dates[hour] != date )
|
||||
{
|
||||
counts[hour]++;
|
||||
dates[hour] = date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BarGraph barGraph = new BarGraph( title, fname, 10, "Time", "Pages", BarGraphRenderMode.Lines );
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
|
||||
for ( int i = 7; i <= totals.Length+7; ++i )
|
||||
{
|
||||
int val;
|
||||
|
||||
if ( counts[i%totals.Length] == 0 )
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i%totals.Length] + (counts[i%totals.Length] / 2)) / counts[i%totals.Length];
|
||||
|
||||
int realHours = i%totals.Length;
|
||||
int hours;
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
private Report ReportTotalPages( StaffInfo[] staff, TimeSpan ts, string title )
|
||||
{
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - ts;
|
||||
|
||||
Report report = new Report( title + " Staff Report", "400" );
|
||||
|
||||
report.Columns.Add( "65%", "left", "Staff Name" );
|
||||
report.Columns.Add( "35%", "center", "Page Count" );
|
||||
|
||||
for ( int i = 0; i < staff.Length; ++i )
|
||||
report.Items.Add( staff[i].Display, GetPageCount( staff[i], min, max ) );
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
private PieChart[] ChartTotalPages( StaffInfo[] staff, TimeSpan ts, string title, string fname )
|
||||
{
|
||||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - ts;
|
||||
|
||||
PieChart staffChart = new PieChart( title + " Staff Chart", fname + "_staff", true );
|
||||
|
||||
int other = 0;
|
||||
|
||||
for ( int i = 0; i < staff.Length; ++i )
|
||||
{
|
||||
int count = GetPageCount( staff[i], min, max );
|
||||
|
||||
if ( i < 12 && count > 0 )
|
||||
staffChart.Items.Add( staff[i].Display, count );
|
||||
else
|
||||
other += count;
|
||||
}
|
||||
|
||||
if ( other > 0 )
|
||||
staffChart.Items.Add( "Other", other );
|
||||
|
||||
PieChart resChart = new PieChart( title + " Resolutions", fname + "_resol", true );
|
||||
|
||||
int countTotal = GetPageCount( Pages, PageResolution.None, min, max );
|
||||
int countHandled = GetPageCount( Pages, PageResolution.Handled, min, max );
|
||||
int countDeleted = GetPageCount( Pages, PageResolution.Deleted, min, max );
|
||||
int countCanceled = GetPageCount( Pages, PageResolution.Canceled, min, max );
|
||||
int countLogged = GetPageCount( Pages, PageResolution.Logged, min, max );
|
||||
int countUnres = countTotal - ( countHandled + countDeleted + countCanceled + countLogged );
|
||||
|
||||
resChart.Items.Add( "Handled", countHandled );
|
||||
resChart.Items.Add( "Deleted", countDeleted );
|
||||
resChart.Items.Add( "Canceled", countCanceled );
|
||||
resChart.Items.Add( "Logged Out", countLogged );
|
||||
resChart.Items.Add( "Unresolved", countUnres );
|
||||
|
||||
return new[]{ staffChart, resChart };
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue