using System;
using System.Collections;
using System.Diagnostics;
using System.Net;
using System.Xml.Serialization;
using RevolutionaryStuff.JBT;
namespace RevolutionaryStuff.P2P.Basics
{
public interface IBootstrapService
{
IEnumerable CreateEnumerable(string networkName);
}
public interface IBootstrapEntryPoint
{
string NetworkName { get; }
DateTime FoundAt { get; }
EndPoint EndPoint { get; }
int Rating { get; }
}
public class BootstrapEntryPoint : IBootstrapEntryPoint
{
#region Constructors
public BootstrapEntryPoint(string networkName, EndPoint endPoint) : this(networkName, endPoint, 0)
{}
public BootstrapEntryPoint(string networkName, EndPoint endPoint, int rating) : this(networkName, endPoint, rating, DateTime.Now)
{}
public BootstrapEntryPoint(string networkName, EndPoint endPoint, int rating, DateTime foundAt)
{
if (null==networkName||networkName.Length==0) throw new ArgumentException("networkName");
this.NetworkName = networkName;
this.Rating = rating;
this.EndPoint = endPoint;
this.FoundAt = foundAt;
}
public BootstrapEntryPoint(IBootstrapEntryPoint bep) : this(bep.NetworkName, bep.EndPoint, bep.Rating, bep.FoundAt)
{}
#endregion
#region IBootstrapEntryPoint Members
[XmlAttribute]
public virtual string NetworkName
{
[DebuggerStepThrough]
get { return this.NetworkName_p; }
[DebuggerStepThrough]
set { this.NetworkName_p = value;}
}
private string NetworkName_p;
[XmlAttribute]
public virtual int Rating
{
[DebuggerStepThrough]
get { return this.Rating_p; }
[DebuggerStepThrough]
set { this.Rating_p = value;}
}
private int Rating_p;
[XmlAttribute]
public virtual DateTime FoundAt
{
[DebuggerStepThrough]
get { return this.FoundAt_p; }
[DebuggerStepThrough]
set { this.FoundAt_p = value;}
}
private DateTime FoundAt_p;
[XmlAttribute]
public virtual EndPoint EndPoint
{
[DebuggerStepThrough]
get { return this.EndPoint_p; }
[DebuggerStepThrough]
set { this.EndPoint_p = value;}
}
private EndPoint EndPoint_p;
#endregion
public override string ToString()
{
return SimplePersist.ToString(this);
}
}
}
|