using Extreme.Net;
using RuriLib.ViewModels;
using System;
using System.Collections.Generic;
namespace RuriLib.Models
{
///
/// Represents the outcome of a check which can be represented in a list and can give information on the details of the check.
///
public class ValidData : ViewModelBase
{
private string data;
/// The data line that was checked.
public string Data { get { return data; } set { data = value; OnPropertyChanged(); } }
private string proxy;
/// The proxy that was used for the check.
public string Proxy { get { return proxy; } set { proxy = value; OnPropertyChanged(); } }
private ProxyType proxyType;
/// The proxy type.
public ProxyType ProxyType { get { return proxyType; } set { proxyType = value; OnPropertyChanged(); } }
private BotStatus result;
/// The result of the check.
public BotStatus Result { get { return result; } set { result = value; OnPropertyChanged(); } }
private string type;
/// The type of the result.
public string Type { get { return type; } set { type = value; OnPropertyChanged(); } }
private string capturedData;
/// The data captured during the check.
public string CapturedData { get { return capturedData; } set { capturedData = value; OnPropertyChanged(); } }
private int unixDate;
/// The unix timestamp of the check completion.
public int UnixDate { get { return unixDate; } set { unixDate = value; OnPropertyChanged(); OnPropertyChanged(); } }
/// The timestamp of the check completion as a formatted date.
public string Timestamp { get { return (new DateTime(1970, 1, 1)).AddSeconds(UnixDate).ToShortDateString(); } }
/// The timestamp of the check completion as a DateTime object.
public DateTime Time { get { return (new DateTime(1970, 1, 1)).AddSeconds(UnixDate); } }
private string source;
/// The contents of the last page's source code at the end of the check.
public string Source { get { return source; } set { source = value; OnPropertyChanged(); } }
private List log;
/// The entire log with the details of the check.
public List Log { get { return log; } set { log = value; OnPropertyChanged(); } }
///
/// Creates a ValidData object after a valid check.
///
/// The data line that was used in the check
/// The proxy that was used for the check (empty string if none)
/// The proxy type
/// The result of the check
/// The result type
/// The data captured during the check
/// The last page source code of the check
/// The detailed log of the check
public ValidData(string data, string proxy, ProxyType proxyType, BotStatus result, string type, string capturedData, string source, List log)
{
Data = data;
Proxy = proxy;
Result = result;
Type = type;
CapturedData = capturedData;
UnixDate = (int)Math.Round((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
Source = source;
Log = log;
}
}
}