61 lines
1.4 KiB
C#
61 lines
1.4 KiB
C#
using skyscraper5.Skyscraper;
|
|
using skyscraper5.Skyscraper.IO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace skyscraper5.src.InteractionChannel.Model
|
|
{
|
|
public class Spt : Validatable
|
|
{
|
|
public Spt(MemoryStream ms)
|
|
{
|
|
byte satelliteLoopCount = ms.ReadUInt8(); satelliteLoopCount++;
|
|
Satellites = new Satellite[satelliteLoopCount];
|
|
for (int i = 0; i < satelliteLoopCount; i++)
|
|
{
|
|
Satellites[i] = new Satellite();
|
|
Satellites[i].Id = ms.ReadUInt8();
|
|
Satellites[i].X = ms.ReadUInt32BE();
|
|
Satellites[i].Y = ms.ReadUInt32BE();
|
|
Satellites[i].Z = ms.ReadUInt32BE();
|
|
}
|
|
uint crc32 = ms.ReadUInt32BE();
|
|
Valid = true;
|
|
}
|
|
|
|
public Satellite[] Satellites { get; }
|
|
public class Satellite
|
|
{
|
|
public byte Id { get; internal set; }
|
|
public uint X { get; internal set; }
|
|
public uint Y { get; internal set; }
|
|
public uint Z { get; internal set; }
|
|
|
|
protected bool Equals(Satellite other)
|
|
{
|
|
return Id == other.Id;
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
if (ReferenceEquals(null, obj))
|
|
return false;
|
|
if (ReferenceEquals(this, obj))
|
|
return true;
|
|
if (obj.GetType() != this.GetType())
|
|
return false;
|
|
return Equals((Satellite)obj);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return Id.GetHashCode();
|
|
}
|
|
}
|
|
}
|
|
}
|