|
- using System;
- using System.IO;
- using System.Runtime.CompilerServices;
- using NetworkFramework.Shared;
-
- namespace CLre_server.API.Synergy.Tweaks
- {
- public struct SerializedCLreTerrainModifyRejection: ISerializedNetData
- {
- public RejectionFlag Flags;
-
- public uint Cell;
-
- public byte[] Serialize()
- {
- using (MemoryStream stream = new MemoryStream())
- {
- using (BinaryWriter writer = new BinaryWriter(stream))
- {
- writer.Write((byte)Flags);
- writer.Write(Cell);
- return stream.ToArray();
- }
- }
- }
-
- public void Deserialize(byte[] data)
- {
- using (MemoryStream stream = new MemoryStream(data))
- {
- using (BinaryReader reader = new BinaryReader(stream))
- {
- Flags = (RejectionFlag)reader.ReadByte();
- Cell = reader.ReadUInt32();
- }
- }
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public bool Ok()
- {
- return (Flags & RejectionFlag.Rejection) == RejectionFlag.None;
- }
- }
-
- [Flags]
- public enum RejectionFlag : byte
- {
- None = 0,
- Rejection = 1,
- Proximity = 1 << 1,
- Permission = 1 << 2,
- AccountNotFound = 1 << 3,
- InitError = 1 << 4,
- }
- }
|