|
using System;
using System.Collections;
namespace RemoteAdminWebService
{
/// <summary>
/// Station
/// </summary>
public class Station
{
#region Fields
/// <summary>
/// Station ip address
/// </summary>
public string Address;
/// <summary>
/// Station status
/// </summary>
public string State;
/// <summary>
/// Command that has to be processed by that station.(string empty if there is no commands)
/// </summary>
public string Command;
/// <summary>
/// The command result
/// </summary>
public string Output;
/// <summary>
/// File buffer used for file transfer in both directions(upload download)
/// </summary>
public string FileBuffer;
/// <summary>
/// Last RemoteAdmin req date
/// </summary>
public string ReqDate = "";
public DateTime StartDate;
#endregion
#region Construction
public Station(string address)
{
Address = address;
Command = string.Empty;
State = string.Empty;
Output = string.Empty;
}
public Station()
{
Address = string.Empty;
Command = string.Empty;
State = string.Empty;
Output = string.Empty;
}
#endregion
}
/// <summary>
/// <para>
/// A collection that stores <see cref='Station'/> objects.
/// </para>
/// </summary>
/// <seealso cref='StationCollection'/>
[Serializable()]
public class StationCollection : CollectionBase
{
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='StationCollection'/>.
/// </para>
/// </summary>
public StationCollection()
{
}
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='StationCollection'/> based on another <see cref='StationCollection'/>.
/// </para>
/// </summary>
/// <param name='val'>
/// A <see cref='StationCollection'/> from which the contents are copied
/// </param>
public StationCollection(StationCollection val)
{
this.AddRange(val);
}
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='StationCollection'/> containing any array of <see cref='Station'/> objects.
/// </para>
/// </summary>
/// <param name='val'>
/// A array of <see cref='Station'/> objects with which to intialize the collection
/// </param>
public StationCollection(Station[] val)
{
this.AddRange(val);
}
/// <summary>
/// <para>Represents the entry at the specified index of the <see cref='Station'/>.</para>
/// </summary>
/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
/// <val>
/// <para> The entry at the specified index of the collection.</para>
/// </val>
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
public Station this[int index]
{
get
{
return ((Station)(base.List[index]));
}
set
{
base.List[index] = value;
}
}
/// <summary>
/// <para>Adds a <see cref='Station'/> with the specified val to the
/// <see cref='StationCollection'/> .</para>
/// </summary>
/// <param name='val'>The <see cref='Station'/> to add.</param>
/// <returns>
/// <para>The index at which the new element was inserted.</para>
/// </returns>
/// <seealso cref='StationCollection.AddRange'/>
public int Add(Station val)
{
return base.List.Add(val);
}
/// <summary>
/// <para>Copies the elements of an array to the end of the <see cref='StationCollection'/>.</para>
/// </summary>
/// <param name='val'>
/// An array of type <see cref='Station'/> containing the objects to add to the collection.
/// </param>
/// <returns>
/// <para>None.</para>
/// </returns>
/// <seealso cref='StationCollection.Add'/>
public void AddRange(Station[] val)
{
int i;
for (i = 0; (i < val.Length); i = (i + 1))
{
this.Add(val[i]);
}
}
/// <summary>
/// <para>
/// Adds the contents of another <see cref='StationCollection'/> to the end of the collection.
/// </para>
/// </summary>
/// <param name='val'>
/// A <see cref='StationCollection'/> containing the objects to add to the collection.
/// </param>
/// <returns>
/// <para>None.</para>
/// </returns>
/// <seealso cref='StationCollection.Add'/>
public void AddRange(StationCollection val)
{
int i;
for (i = 0; (i < val.Count); i = (i + 1))
{
this.Add(val[i]);
}
}
/// <summary>
/// <para>Gets a val indicating whether the
/// <see cref='StationCollection'/> contains the specified <see cref='Station'/>.</para>
/// </summary>
/// <param name='val'>The <see cref='Station'/> to locate.</param>
/// <returns>
/// <para><see langword='true'/> if the <see cref='Station'/> is contained in the collection;
/// otherwise, <see langword='false'/>.</para>
/// </returns>
/// <seealso cref='StationCollection.IndexOf'/>
public bool Contains(Station val)
{
return base.List.Contains(val);
}
/// <summary>
/// <para>Copies the <see cref='StationCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
/// specified index.</para>
/// </summary>
/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='StationCollection'/> .</para></param>
/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
/// <returns>
/// <para>None.</para>
/// </returns>
/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='StationCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
/// <seealso cref='System.Array'/>
public void CopyTo(Station[] array, int index)
{
base.List.CopyTo(array, index);
}
/// <summary>
/// <para>Returns the index of a <see cref='Station'/> in
/// the <see cref='StationCollection'/> .</para>
/// </summary>
/// <param name='val'>The <see cref='Station'/> to locate.</param>
/// <returns>
/// <para>The index of the <see cref='Station'/> of <paramref name='val'/> in the
/// <see cref='StationCollection'/>, if found; otherwise, -1.</para>
/// </returns>
/// <seealso cref='StationCollection.Contains'/>
public int IndexOf(Station val)
{
return base.List.IndexOf(val);
}
/// <summary>
/// <para>Inserts a <see cref='Station'/> into the <see cref='StationCollection'/> at the specified index.</para>
/// </summary>
/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
/// <param name=' val'>The <see cref='Station'/> to insert.</param>
/// <returns><para>None.</para></returns>
/// <seealso cref='StationCollection.Add'/>
public void Insert(int index, Station val)
{
base.List.Insert(index, val);
}
/// <summary>
/// <para>Returns an enumerator that can iterate through
/// the <see cref='StationCollection'/> .</para>
/// </summary>
/// <returns><para>None.</para></returns>
/// <seealso cref='System.Collections.IEnumerator'/>
public new StationEnumerator GetEnumerator()
{
return new StationEnumerator(this);
}
/// <summary>
/// <para> Removes a specific <see cref='Station'/> from the
/// <see cref='StationCollection'/> .</para>
/// </summary>
/// <param name='val'>The <see cref='Station'/> to remove from the <see cref='StationCollection'/> .</param>
/// <returns><para>None.</para></returns>
/// <exception cref='System.ArgumentException'><paramref name='val'/> is not found in the Collection. </exception>
public void Remove(Station val)
{
base.List.Remove(val);
}
/// <summary>
/// Enumerator of the <see cref='StationCollection'/>.
/// </summary>
public class StationEnumerator : IEnumerator
{
private IEnumerator baseEnumerator;
private IEnumerable temp;
/// <summary>
/// The Constructor ofStationEnumerator
/// </summary>
/// <param name='mappings'> The <see cref='StationCollection'/> containing the objects to initialize the collection.</param>
public StationEnumerator(StationCollection mappings)
{
this.temp = ((IEnumerable)(mappings));
this.baseEnumerator = this.temp.GetEnumerator();
}
/// <summary>
/// Get current <see cref='Station'/>
/// </summary>
public Station Current
{
get
{
return ((Station)(this.baseEnumerator.Current));
}
}
object IEnumerator.Current
{
get
{
return this.baseEnumerator.Current;
}
}
/// <summary>
/// Set the current <see cref='Station'/> to the next.
/// </summary>
/// <returns> If operate success return True else Flase.</returns>
public bool MoveNext()
{
return this.baseEnumerator.MoveNext();
}
bool IEnumerator.MoveNext()
{
return this.baseEnumerator.MoveNext();
}
/// <summary>
/// Reset current point of the IEnumerator.
/// </summary>
public void Reset()
{
this.baseEnumerator.Reset();
}
void IEnumerator.Reset()
{
this.baseEnumerator.Reset();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.