powerfun-new-net/Model/HostModel.cs
2022-05-10 19:23:32 +08:00

156 lines
3.5 KiB
C#

using OnlineUserPool.Services;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
namespace OnlineUserPool.Model
{
public class HostModel : BindableBase
{
public IPEndPoint IPEndPoint { get; set; }
private DateTime _LastActiveTime;
public DateTime LastActiveTime {
get {
return _LastActiveTime;
}
set {
SetProperty(ref _LastActiveTime, value);
}
}
private int _RouteId = 0;
/// <summary>
/// 地图编号
/// </summary>
public int RouteId {
get {
return _RouteId;
}
set {
SetProperty(ref _RouteId, value);
}
}
private int _MemberId;
/// <summary>
/// 用户Id
/// </summary>
public int MemberId {
get {
return _MemberId;
}
set {
SetProperty(ref _MemberId, value);
}
}
/// <summary>
/// 客户端过期
/// </summary>
public bool Expire
{
get
{
return DateTime.Now.Subtract(LastActiveTime).TotalSeconds > 60;
}
}
public bool Equals(IPEndPoint obj)
{
//return base.Equals(obj);
return obj.Address.ToString() == IPEndPoint.Address.ToString() && obj.Port == IPEndPoint.Port;
}
/// <summary>
/// 需要展示的路书Id
/// </summary>
public List<int> ShowRouteId { get; set; }
private int _Competitionid = 0;
public int Competitionid {
get {
return _Competitionid;
} set {
SetProperty(ref _Competitionid, value);
}
}
///// <summary>
///// 是否展示在线的人
///// </summary>
//public bool ShowVirtual { get; set; }
public string Encoding { get; set; }
public string Client { get; set; }
private int _V = 0;
/// <summary>
/// 客户端支持的消息格式的版本号
/// </summary>
public int V {
get
{
return _V;
}
set
{
SetProperty(ref _V, value);
}
}
[Newtonsoft.Json.JsonIgnore]
public IService Service { get; set; }
public String ServiceName
{
get
{
return Service.ToString();
}
}
private bool _IsWatch;
public bool IsWatch
{
get { return _IsWatch; }
set
{
SetProperty(ref _IsWatch, value);
}
}
private string _Request;
public string Request
{
get { return _Request; }
set
{
SetProperty(ref _Request, value);
}
}
private string _Model;
public string Model
{
get { return _Model; }
set
{
SetProperty(ref _Model, value);
}
}
private int _RoomId;
public int RoomId
{
get { return _RoomId; }
set
{
SetProperty(ref _RoomId, value);
}
}
}
}