You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Network/Model/ServiceRegisterInfo.cs

42 lines
1.1 KiB

using System;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Network
{
public class ServiceRegisterInfo :
IBinarySerializable, IEquatable<ServiceRegisterInfo>
{
public int Port { get; set; }
public ZeroServiceInfo ServiceInfo { get; set; }
public bool Equals(ServiceRegisterInfo other)
{
7 months ago
if (other == null!) return false;
if (this.Port != other.Port) return false;
return this.ServiceInfo?.Equals(other.ServiceInfo) ?? other != null ? false : true;
}
public override bool Equals(object obj)
{
7 months ago
return this.Equals((obj as ServiceRegisterInfo)!);
}
public override int GetHashCode()
{
return Port.GetHashCode() ^ this.ServiceInfo.GetHashCode();
}
public void Serialize(IBinaryWriter writer)
{
writer.WriteInt32(this.Port);
writer.Write(this.ServiceInfo);
}
public void Deserialize(IBinaryReader reader)
{
this.Port = reader.ReadInt32();
this.ServiceInfo = reader.Read<ZeroServiceInfo>();
}
}
}

Powered by TurnKey Linux.