powerfun-new-net/Model/HostModel.cs

77 lines
1.8 KiB
C#
Raw Normal View History

using OnlineUserPool.Services;
using Prism.Mvvm;
2020-10-13 08:54:24 +08:00
using System;
2020-09-17 10:23:26 +08:00
using System.Collections.Generic;
using System.Net;
using System.Text;
namespace OnlineUserPool.Model
{
2020-10-13 08:54:24 +08:00
public class HostModel : BindableBase
2020-09-17 10:23:26 +08:00
{
public IPEndPoint IPEndPoint { get; set; }
2020-10-13 08:54:24 +08:00
private DateTime _LastActiveTime;
public DateTime LastActiveTime {
get {
return _LastActiveTime;
}
set {
SetProperty(ref _LastActiveTime, value);
}
}
2020-09-17 10:23:26 +08:00
/// <summary>
/// 地图编号
/// </summary>
public int RouteId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public int MemberId { get; set; }
/// <summary>
/// 客户端过期
/// </summary>
public bool Expire
{
get
{
2020-10-27 10:20:47 +08:00
return DateTime.Now.Subtract(LastActiveTime).TotalSeconds > 60;
2020-09-17 10:23:26 +08:00
}
}
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; }
///// <summary>
///// 是否展示在线的人
///// </summary>
//public bool ShowVirtual { get; set; }
2020-09-17 10:23:26 +08:00
/// <summary>
/// 客户端支持的消息格式的版本号
2020-09-17 10:23:26 +08:00
/// </summary>
public int V { get; set; }
[Newtonsoft.Json.JsonIgnore]
public IService Service { get; set; }
public String ServiceName
{
get
{
return Service.ToString();
}
}
2020-09-17 10:23:26 +08:00
}
}