using System;
using System.Diagnostics.Contracts;
using System.Globalization;
namespace PleaseIgnore.IntelMap {
///
/// Provides data for the intel reporting events.
///
///
[Serializable]
public class IntelEventArgs : EventArgs {
///
/// Initializes a new instance of class.
///
///
/// The that provided this log entry.
///
///
/// The date and time this log entry was generated.
///
///
/// The content of the log entry.
///
public IntelEventArgs(string channel, DateTime timestamp,
string message) {
Contract.Requires(!String.IsNullOrEmpty(channel));
Contract.Requires(timestamp.Kind == DateTimeKind.Utc);
Contract.Requires(!String.IsNullOrEmpty(message));
this.Channel = channel;
this.Timestamp = timestamp;
this.Message = message;
}
///
/// Gets the log file that generated this event.
///
///
/// The instance of that parsed and reported
/// this log entry.
///
public string Channel { get; private set; }
///
/// Gets the timestamp of the log entry.
///
///
/// A value of that encodes the log entry's time
/// stamp in the UTC time zone.
///
public DateTime Timestamp { get; private set; }
///
/// Gets the content of the log entry.
///
public string Message { get; private set; }
///
public override string ToString() {
return string.Format(
CultureInfo.CurrentCulture,
"{0}: [{1} - {2:u}] {3}",
GetType().Name,
this.Channel,
this.Timestamp,
this.Message);
}
[ContractInvariantMethod]
private void ObjectInvariant() {
Contract.Invariant(!String.IsNullOrEmpty(this.Channel));
Contract.Invariant(Timestamp.Kind == DateTimeKind.Utc);
Contract.Invariant(!String.IsNullOrEmpty(this.Message));
}
}
}