protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(SIZE); stream.addByte(Index); stream.addUShort(Value); return stream.Data; }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(32, true); base.AddToByteStream(stream); Settings.AddToByteStream(stream); return stream.Data; }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(SIZE); base.AddToByteStream(stream); stream.addBoolean(Success); return stream.Data; }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(SIZE); stream.addLong(PlayerId); stream.addLong(FactionId); return stream.Data; }
public static BaseResponse messageFromBytes(byte[] buffer) { VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length); TYPE t = (TYPE)stream.getUShort(); stream.Seek(0, SeekOrigin.Begin); BaseResponse msg = null; switch (t) { case TYPE.NOTIFICATION: msg = new NotificationResponse(); break; case TYPE.DIALOG: msg = new DialogResponse(); break; case TYPE.SETTINGS: msg = new SettingsResponse(); break; case TYPE.FLEET: msg = new FleetResponse(); break; } if (msg != null) msg.deserialize(stream); return msg; }
public LogoutRequest(byte[] bytes) : base((ushort)MessageType.LogoutRequest) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); PlayerId = stream.getLong(); FactionId = stream.getLong(); }
public PilotingStoppedRequest(byte[] bytes) : base((ushort)MessageType.PilotingStoppedRequest) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); PlayerId = stream.getLong(); GridId = stream.getLong(); }
public override byte[] serialize() { VRage.ByteStream bs = new VRage.ByteStream(BaseSize, true); byte[] bmessage = base.serialize(); bs.Write(bmessage, 0, bmessage.Length); // Control Points bs.addUShort((ushort)Settings.ControlPoints.Count); foreach (Records.ControlPoint cp in Settings.ControlPoints) { cp.serialize(bs); } // CP Period bs.addLong(Settings.CPPeriod); // Cleanup Period bs.addLong(Settings.CleanupPeriod); // Block Types bs.addUShort((ushort)Settings.BlockTypes.Length); foreach (Records.BlockType bt in Settings.BlockTypes) { bt.serialize(bs); } // Hull Rules bs.addUShort((ushort)Settings.HullRules.Length); foreach (Records.HullRuleSet hrs in Settings.HullRules) { hrs.serialize(bs); } return bs.Data; }
public static BaseRequest messageFromBytes(byte[] buffer) { VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length); TYPE t = (TYPE)stream.getUShort(); stream.Seek(0, System.IO.SeekOrigin.Begin); BaseRequest msg = null; switch (t) { case TYPE.FLEET: msg = new FleetRequest(); break; case TYPE.SETTINGS: msg = new SettingsRequest(); break; case TYPE.VIOLATIONS: msg = new ViolationsRequest(); break; case TYPE.DISOWN: msg = new DisownRequest(); break; case TYPE.STOPGRID: msg = new StopGridRequest(); break; } if (msg != null) msg.deserialize(stream); return msg; }
public void TestLongNegative() { long input = long.MinValue; VRage.ByteStream stream = new VRage.ByteStream(1, true); stream.addLong(input); stream.Seek(0, System.IO.SeekOrigin.Begin); Assert.AreEqual(input, stream.getLong()); }
public void TestUShort() { ushort input = ushort.MaxValue; VRage.ByteStream stream = new VRage.ByteStream(1, true); stream.addUShort(input); stream.Seek(0, System.IO.SeekOrigin.Begin); Assert.AreEqual(input, stream.getUShort()); }
public static StatusResponse FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); StatusResponse response = new StatusResponse(); response.LoadFromByteStream(stream); return response; }
public static ObservingEntitiesResponse FromBytes(byte[] bytes) { long responseLength = bytes.Length; Log.Info("Creating new stream of length " + responseLength, "FromBytes"); VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); ObservingEntitiesResponse response = new ObservingEntitiesResponse(); response.LoadFromByteStream(stream); Log.Info("Base pos " + stream.Position, "FromBytes"); ushort count = stream.getUShort(); Log.Info("With count pos " + stream.Position, "FromBytes"); for (int i = 0; i < count; i++) { Log.Info("Beginning get entity at pos " + stream.Position + " / " + stream.Length, "FromBytes"); EntityType entityType = (EntityType)stream.getUShort(); switch (entityType) { case EntityType.Character: response.ObservingEntities.Add(new Character(stream)); break; case EntityType.Grid: response.ObservingEntities.Add(new RevealedGrid(stream)); break; } } Log.Info("Finished getting entity at final pos " + stream.Position, "FromBytes"); return response; }
public ConcealQueuedMessage(byte[] bytes) : base((ushort)MessageType.ConcealQueuedMessage) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); EntityId = stream.getLong(); Log.Info("Deserialized ConcealQueuedNotification for " + EntityId, "byte ctr"); }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(SIZE); stream.addLong(EntityId); Log.Info("Serialized ConcealQueuedNotification for " + EntityId, "ToBytes"); return stream.Data; }
public static ChangeSettingResponse FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); ChangeSettingResponse response = new ChangeSettingResponse(); response.LoadFromByteStream(stream); response.Success = stream.getBoolean(); return response; }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(SIZE); stream.addLong(EntityId); return stream.Data; }
public FactionChangeRequest(byte[] bytes) : base((ushort)MessageType.FactionChangeRequest) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); PlayerId = stream.getLong(); OldFactionId = stream.getLong(); NewFactionId = stream.getLong(); }
public static RevealResponse FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); RevealResponse response = new RevealResponse(); response.EntityId = stream.getLong(); return response; }
public static RevealRequest FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); RevealRequest request = new RevealRequest(); request.EntityId = stream.getLong(); return request; }
public void TestLongList() { List<long> input = new List<long>() { 1, 2, 3, 4 }; VRage.ByteStream stream = new VRage.ByteStream(1, true); stream.addLongList(input); stream.Seek(0, System.IO.SeekOrigin.Begin); List<long> output = stream.getLongList(); CollectionAssert.AreEqual(input, output); }
public void TestString() { string input = "This is a test string"; VRage.ByteStream stream = new VRage.ByteStream(1, true); stream.addString(input); stream.Seek(0, System.IO.SeekOrigin.Begin); string output = stream.getString(); Assert.AreEqual(input.Length, output.Length); Assert.AreEqual(input, output); }
public static ChangeSettingRequest FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); ChangeSettingRequest request = new ChangeSettingRequest(); request.Index = stream.getByte(); request.Value = stream.getUShort(); return request; }
public override byte[] serialize() { VRage.ByteStream bs = new VRage.ByteStream(BaseSize, true); byte[] bMessage = base.serialize(); bs.Write(bMessage, 0, bMessage.Length); bs.addLong(EntityID); return bs.Data; }
public override byte[] serialize() { VRage.ByteStream bs = new VRage.ByteStream(BaseSize, true); byte[] bmessage = base.serialize(); bs.Write(bmessage, 0, bmessage.Length); bs.addString(Body); bs.addString(Title); return bs.Data; }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(32, true); stream.addUShort((ushort)ConcealedGrids.Count); foreach (ConcealableGrid grid in ConcealedGrids) { grid.AddToByteStream(stream); } return stream.Data; }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(SIZE); stream.addLong(EntityId); stream.addBoolean(Success); Log.Info("Serialized Conceal Response " + EntityId + " ? " + Success, "ToBytes"); return stream.Data; }
public override byte[] serialize() { VRage.ByteStream bs = new VRage.ByteStream(BaseSize, true); byte[] bmessage = base.serialize(); bs.Write(bmessage, 0, bmessage.Length); bs.addUShort((ushort)Owner.OwnerType); Fleet.serialize(bs); return bs.Data; }
public static ConcealResponse FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); ConcealResponse response = new ConcealResponse(); response.EntityId = stream.getLong(); response.Success = stream.getBoolean(); Log.Info("Deserialized Conceal Response " + response.EntityId + " ? " + response.Success, "ToBytes"); return response; }
public override byte[] serialize() { VRage.ByteStream bs = new VRage.ByteStream(BaseSize, true); byte[] bmessage = base.serialize(); bs.Write(bmessage, 0, bmessage.Length); bs.addString(NotificationText); bs.addUShort(Time); bs.addUShort((ushort)Font); return bs.Data; }
public void TestLongList() { List <long> input = new List <long>() { 1, 2, 3, 4 }; VRage.ByteStream stream = new VRage.ByteStream(1, true); stream.addLongList(input); stream.Seek(0, System.IO.SeekOrigin.Begin); List <long> output = stream.getLongList(); CollectionAssert.AreEqual(input, output); }
public static ConcealResponse FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); ConcealResponse response = new ConcealResponse(); response.LoadFromByteStream(stream); response.EntityId = stream.getLong(); response.Success = stream.getBoolean(); Log.Info("Deserialized Conceal Response " + response.EntityId + " ? " + response.Success, "ToBytes"); return(response); }
// Byte Serialization public override void AddToByteStream(VRage.ByteStream stream) { base.AddToByteStream(stream); //Log.Trace("Adding observing entity to byte stream", "AddToByteStream"); stream.addLongList(EntitiesViewing.Keys.ToList()); stream.addDateTime(LastObservingTime); stream.addVector3D(LastObservingPosition); //Log.Trace("Serialized LastObservingTime of " + LastObservingTime, "AddToByteStream"); //Log.Trace("Serialized LastObservingPosition of " + LastObservingPosition, "AddToByteStream"); //Log.Trace("Serialized ViewDistance of " + ViewDistance, "AddToByteStream"); }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(32, true); base.AddToByteStream(stream); //Log.Trace("Adding grids to response", "ToBytes"); stream.addUShort((ushort)RevealedGrids.Count); foreach (RevealedGrid grid in RevealedGrids) { grid.AddToByteStream(stream); //Log.Trace("Added Grid", "ToBytes"); } return(stream.Data); }
public void serialize(VRage.ByteStream stream) { stream.addString(DisplayName); stream.addUShort((ushort)MaxPerFaction); stream.addUShort((ushort)MaxPerSoloPlayer); stream.addUShort((ushort)CaptureMultiplier); stream.addLong(MaxBlocks); stream.addBoolean(ShouldBeStation); stream.addUShort((ushort)BlockTypeLimits.Length); foreach (int limit in BlockTypeLimits) { stream.addUShort((ushort)limit); } }
/* * private double GreatestObservingDistance { * get { * return new double[3]{ * ViewDistance, DetectDistance, CommunicateDistance * }.Max(); * } * } */ #endregion #region Constructors // Byte Deserialization public ObservingEntity(VRage.ByteStream stream) : base(stream) { List <long> entitiesViewing = stream.getLongList(); foreach (long id in entitiesViewing) { EntitiesViewing.Add(id, null); } LastObservingTime = stream.getDateTime(); LastObservingPosition = stream.getVector3D(); //Log.Trace("Deserialized LastObservingTime of " + LastObservingTime, "stream ctr"); //Log.Trace("Deserialized LastObservingPosition of " + LastObservingPosition, "stream ctr"); //Log.Trace("Deserialized ViewDistance of " + ViewDistance, "stream ctr"); }
public static BlockType deserialize(VRage.ByteStream stream) { BlockType result = new BlockType(); result.DisplayName = stream.getString(); ushort subTypeStringsCount = stream.getUShort(); result.SubTypeStrings = new List <string>(); for (ushort i = 0; i < subTypeStringsCount; ++i) { result.SubTypeStrings.Add(stream.getString()); } return(result); }
void ISerializer <BonesMsg> .Serialize(VRage.ByteStream destination, ref BonesMsg data) { BlitSerializer <long> .Default.Serialize(destination, ref data.GridEntityId); BlitSerializer <Vector3I> .Default.Serialize(destination, ref data.MinBone); BlitSerializer <Vector3I> .Default.Serialize(destination, ref data.MaxBone); Debug.Assert(data.Bones.Count <= ushort.MaxValue, "Increase bone array size"); ushort count = (ushort)data.Bones.Count; BlitSerializer <ushort> .Default.Serialize(destination, ref count); destination.Write(data.Bones.GetInternalArray(), 0, data.Bones.Count); }
void ISerializer <BonesMsg> .Deserialize(VRage.ByteStream source, out BonesMsg data) { BlitSerializer <long> .Default.Deserialize(source, out data.GridEntityId); BlitSerializer <Vector3I> .Default.Deserialize(source, out data.MinBone); BlitSerializer <Vector3I> .Default.Deserialize(source, out data.MaxBone); ushort count; BlitSerializer <ushort> .Default.Deserialize(source, out count); data.Bones = new List <byte>(count); source.Read(data.Bones.GetInternalArray(), 0, count); data.Bones.SetSize(count); }
public static void addLongList(this VRage.ByteStream stream, List <long> L) { if (L == null) { stream.addUShort(0); return; } // Write length stream.addUShort((ushort)L.Count); // Write data foreach (long l in L) { stream.addLong(l); } }
// Byte Deserialization public RevealedEntity(VRage.ByteStream stream) : base(stream) { // Nearly everything is available from the ingame Entity IsObserved = stream.getBoolean(); IsRevealBlocked = stream.getBoolean(); List <long> entitiesViewedByList = stream.getLongList(); foreach (long id in entitiesViewedByList) { EntitiesViewedBy.Add(id, null); } RevealedAt = stream.getDateTime(); MovedSinceIsInAsteroidCheck = true; Log.ClassName = "GP.Concealment.World.Entities.RevealedEntity"; Log.Trace("Finished RevealedEntity deserialize constructor", "ctr"); }
public static ControlPoint deserialize(VRage.ByteStream stream) { ControlPoint result = new ControlPoint(); long x, y, z; x = stream.getLong(); y = stream.getLong(); z = stream.getLong(); result.Position = new VRageMath.Vector3D(x, y, z); result.Name = stream.getString(); result.Radius = (int)stream.getLong(); result.TokensPerPeriod = (int)stream.getLong(); return(result); }
public bool Reliable = true; // { get; protected set; } private byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(HEADER_SIZE + Body.Length, true); stream.addUShort(DomainId); //Log.Trace("Serializing MessageTypeId " + MessageTypeId, "ToBytes"); stream.addUShort(TypeId); //Log.Trace("Serializing SourceId " + SourceId, "ToBytes"); stream.addUlong(SourceId); //Log.Trace("Serializing SourceTypeID " + (ushort)SourceType, "ToBytes"); stream.addUShort((ushort)SourceType); //Log.Trace("Serializing Body.Length " + (ushort)Body.Length, "ToBytes"); stream.addUShort((ushort)Body.Length); //Log.Trace("Serializing Body", "ToBytes"); stream.Write(Body, 0, Body.Length); return(stream.Data); }
public static ConcealedGridsResponse FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); ConcealedGridsResponse response = new ConcealedGridsResponse(); response.LoadFromByteStream(stream); ConcealedGrid grid; ushort count = stream.getUShort(); for (int i = 0; i < count; i++) { grid = new ConcealedGrid(stream); response.ConcealedGrids.Add(grid); } return(response); }
public static void addString(this VRage.ByteStream stream, string s) { if (s.Length > ushort.MaxValue) { stream.addUShort(0); return; } // Write length stream.addUShort((ushort)s.Length); // Write data char[] sarray = s.ToCharArray(); for (ushort i = 0; i < s.Length; ++i) { stream.WriteByte((byte)sarray[i]); } }
public static List <long> getLongList(this VRage.ByteStream stream) { List <long> L = new List <long>(); // Read length ushort len = stream.getUShort(); if (len == 0) { return(null); } // Read data for (ushort i = 0; i < len; ++i) { L.Add(stream.getLong()); } return(L); }
public static RevealedGridsResponse FromBytes(byte[] bytes) { VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length); RevealedGridsResponse response = new RevealedGridsResponse(); response.LoadFromByteStream(stream); RevealedGrid grid; ushort count = stream.getUShort(); //Log.Trace("Retrieving " + count + " grids from response", "ToBytes"); for (int i = 0; i < count; i++) { grid = new RevealedGrid(stream); response.RevealedGrids.Add(grid); //Log.Trace("Added grid " + grid.EntityId, "ToBytes"); } return(response); }
public override void deserialize(VRage.ByteStream stream) { base.deserialize(stream); Settings = new ConquestSettings.SETTINGS(); // Control Points ushort cpCount = stream.getUShort(); Settings.ControlPoints = new List <Records.ControlPoint>(); for (ushort i = 0; i < cpCount; ++i) { Settings.ControlPoints.Add( Records.ControlPoint.deserialize(stream) ); } // CP Period Settings.CPPeriod = (int)stream.getLong(); // Cleanup Period Settings.CleanupPeriod = (int)stream.getLong(); // Block Types ushort blockTypesLength = stream.getUShort(); Settings.BlockTypes = new Records.BlockType[blockTypesLength]; for (ushort i = 0; i < blockTypesLength; ++i) { Settings.BlockTypes[i] = Records.BlockType.deserialize(stream); } // Hull Rules ushort hullRulesLength = stream.getUShort(); Settings.HullRules = new Records.HullRuleSet[hullRulesLength]; for (ushort i = 0; i < hullRulesLength; ++i) { Settings.HullRules[i] = Records.HullRuleSet.deserialize(stream); } }
public static MessageContainer FromBytes(byte[] buffer) { VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length); MessageContainer message = new MessageContainer(); message.DomainId = stream.getUShort(); message.TypeId = stream.getUShort(); //Log.Trace("Deserialized MessageTypeId " + message.MessageTypeId, "ToBytes"); message.SourceId = stream.getUlong(); //Log.Trace("Deserialized SourceId " + message.SourceId, "ToBytes"); message.SourceType = (RunLocation)stream.getUShort(); //Log.Trace("Deserialized SourceTypeId " + message.SourceType, "ToBytes"); int length = (int)stream.getUShort(); //Log.Trace("Deserialized Body.Length " + length, "ToBytes"); message.Body = stream.getByteArray(length); //Log.Trace("Deserialized Body of length " + message.Body.Length, "ToBytes"); return(message); }
public static HullRuleSet deserialize(VRage.ByteStream stream) { HullRuleSet result = new HullRuleSet(); result.DisplayName = stream.getString(); result.MaxPerFaction = stream.getUShort(); result.MaxPerSoloPlayer = stream.getUShort(); result.CaptureMultiplier = stream.getUShort(); result.MaxBlocks = (int)stream.getLong(); result.ShouldBeStation = stream.getBoolean(); ushort blockTypeLimitsCount = stream.getUShort(); result.BlockTypeLimits = new int[blockTypeLimitsCount]; for (ushort i = 0; i < blockTypeLimitsCount; ++i) { result.BlockTypeLimits[i] = stream.getUShort(); } return(result); }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(32, true); base.AddToByteStream(stream); Character character; RevealedGrid grid; Log.Info("Beginning serializing message at position " + stream.Position, "ToBytes"); stream.addUShort((ushort)ObservingEntities.Count); Log.Info("With count pos " + stream.Position, "ToBytes"); foreach (ObservingEntity e in ObservingEntities) { EntityType entityType = e.TypeOfEntity; Log.Info("Beginning add entity of type " + entityType + " at pos " + stream.Position + " / " + stream.Length, "ToBytes"); stream.addUShort((ushort)entityType); switch (entityType) { case EntityType.Character: character = e as Character; character.AddToByteStream(stream); break; case EntityType.Grid: grid = e as RevealedGrid; grid.AddToByteStream(stream); break; } Log.Info("Finished adding entity at final pos " + stream.Position, "ToBytes"); } Log.Info("Finished serializing message at position " + stream.Position, "ToBytes"); return(stream.Data); }
public static BaseRequest messageFromBytes(byte[] buffer) { VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length); TYPE t = (TYPE)stream.getUShort(); stream.Seek(0, System.IO.SeekOrigin.Begin); BaseRequest msg = null; switch (t) { case TYPE.FLEET: msg = new FleetRequest(); break; case TYPE.SETTINGS: msg = new SettingsRequest(); break; case TYPE.VIOLATIONS: msg = new ViolationsRequest(); break; case TYPE.DISOWN: msg = new DisownRequest(); break; case TYPE.STOPGRID: msg = new StopGridRequest(); break; } if (msg != null) { msg.deserialize(stream); } return(msg); }
void ISerializer <StockpileChangedMsg> .Deserialize(VRage.ByteStream source, out StockpileChangedMsg data) { BlitSerializer <long> .Default.Deserialize(source, out data.GridEntityId); BlitSerializer <ushort> .Default.Deserialize(source, out data.SubBlockId); BlitSerializer <Vector3I> .Default.Deserialize(source, out data.BlockPosition); byte size = 0; BlitSerializer <byte> .Default.Deserialize(source, out size); m_tmpList.Clear(); for (int i = 0; i < (int)size; ++i) { MyStockpileItem item = new MyStockpileItem(); BlitSerializer <int> .Default.Deserialize(source, out item.Amount); MyStringHash subtypeId; BlitSerializer <MyStringHash> .Default.Deserialize(source, out subtypeId); byte flags = 0; BlitSerializer <byte> .Default.Deserialize(source, out flags); MyRuntimeObjectBuilderId typeId; BlitSerializer <MyRuntimeObjectBuilderId> .Default.Deserialize(source, out typeId); item.Content = (MyObjectBuilder_PhysicalObject)MyObjectBuilderSerializer.CreateNewObject( (MyDefinitionId) new DefinitionIdBlit(typeId, subtypeId)); item.Content.Flags = (MyItemFlags)flags; m_tmpList.Add(item); } data.Changes = m_tmpList; }
public void serialize(VRage.ByteStream stream) { stream.addUShort((ushort)TotalCount); for (int i = 0; i < m_Counts.Length; ++i) { if (m_Counts[i] > 0) { if (m_SupportedGrids[i].Count > 0) { foreach (KeyValuePair <long, GridEnforcer> entry in m_SupportedGrids[i]) { entry.Value.serialize(stream); } } if (m_UnsupportedGrids[i].Count > 0) { foreach (KeyValuePair <long, GridEnforcer> entry in m_UnsupportedGrids[i]) { entry.Value.serialize(stream); } } } } }
public override byte[] serialize() { VRage.ByteStream bs = new VRage.ByteStream(BaseSize, true); byte[] bmessage = base.serialize(); bs.Write(bmessage, 0, bmessage.Length); // Control Points bs.addUShort((ushort)Settings.ControlPoints.Count); foreach (Records.ControlPoint cp in Settings.ControlPoints) { cp.serialize(bs); } // CP Period bs.addLong(Settings.CPPeriod); // Cleanup Period bs.addLong(Settings.CleanupPeriod); // Block Types bs.addUShort((ushort)Settings.BlockTypes.Length); foreach (Records.BlockType bt in Settings.BlockTypes) { bt.serialize(bs); } // Hull Rules bs.addUShort((ushort)Settings.HullRules.Length); foreach (Records.HullRuleSet hrs in Settings.HullRules) { hrs.serialize(bs); } return(bs.Data); }
public static bool getBoolean(this VRage.ByteStream stream) { return(Convert.ToBoolean(stream.ReadByte())); }
// Byte Serialization public override void AddToByteStream(VRage.ByteStream stream) { base.AddToByteStream(stream); stream.addLongList(SpawnOwners); stream.addLongList(BigOwners); }
protected override byte[] ToBytes() { VRage.ByteStream stream = new VRage.ByteStream(SIZE); base.AddToByteStream(stream); return(stream.Data); }
public override void deserialize(VRage.ByteStream stream) { base.deserialize(stream); OwnerType = (GridOwner.OWNER_TYPE)stream.getUShort(); FleetData = new List <GridEnforcer.GridData>(FactionFleet.deserialize(stream)); }
// Byte Deserialization public ConcealedGrid(VRage.ByteStream stream) : base(stream) { SpawnOwners = stream.getLongList(); BigOwners = stream.getLongList(); }