void BeginAccep(ZYSocketAsyncEventArgs e) { if (e.SocketError == SocketError.Success) { System.Threading.WaitHandle.WaitAll(reset); if (this.Connetions != null) { if (!this.Connetions(e)) { try { e.AcceptSocket?.Shutdown(SocketShutdown.Both); } catch { } e.AcceptSocket = null; Accept(e); return; } } e.SetBuffer(MaxBufferSize); BinaryInput?.Invoke(e); e.StreamInit(); StartReceive(e); } else { Accept(e); } }
public IEncodable Decode(BinaryInput stream) { Name = stream.ReadString(); ID = stream.ReadInt32(); EntityType = (EntityType)stream.ReadByte(); ShadowType = (ShadowType)stream.ReadByte(); ShadowType = ShadowType.Perspective; isSubEntity = stream.ReadBoolean(); ShadowOffset = stream.ReadInt32(); stream.ReadInt32(); CollisionMap = stream.ReadObject <CollisionMap>(); Texture = stream.ReadObject <TileableTexture>(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Animations.Add(stream.ReadObject <Animation>()); } return(this); }
internal GameDataEventArgs(Player FromPlayer, PeerConnection Connection, byte[] Packet) { this.fromPlayer = FromPlayer; this.connection = Connection; this.packet = Packet; this.data = new BinaryInput(Packet); }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Author = stream.ReadString(); this.Width = stream.ReadInt32(); this.Height = stream.ReadInt32(); this.Tiles = new MockupTile[Width][][]; for (int i = 0; i < Width; i++) { Tiles[i] = new MockupTile[Height][]; for (int j = 0; j < Height; j++) { Tiles[i][j] = new MockupTile[Map.LayerCount]; } } int w = Width; int h = Height; this.Tilesets = stream.ReadList<MockupTileset>(); for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { for (int k = 0; k < Map.LayerCount; k++) { Tiles[i][j][k] = stream.ReadObject<MockupTile>(); } } } int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Tuple<Int32, Vector2> t = new Tuple<Int32, Vector2>(stream.ReadInt32(), stream.ReadVector2()); Entities.Add(t); } return this; }
public static NamedCompound DecodeCompound(BinaryInput stream, List <Tuple <string, Type> > GenericChute) { NamedCompound result = new NamedCompound(); result.Name = stream.ReadString(); int c = stream.ReadInt32(); NamedVariableIO io = new NamedVariableIO(stream); for (int i = 0; i < c; i++) { NamedVariable varag = io.Read(); if (varag != null) { result.Tokens.Add(varag); } else { string n = stream.ReadString(); Type type = null; foreach (Tuple <string, Type> t in GenericChute.Where(t => n == t.Item1)) { type = t.Item2; } if (type != null) { } } } return(result); }
public void Paste() { if (this.Initialized) { MemoryStream stream = null; IDataObject obj = Clipboard.GetDataObject(); const string format = "aeon_entities"; if (obj.GetDataPresent(format)) { stream = obj.GetData(format) as MemoryStream; } EntitySelectionTool.Instance.SelectedEntities.Clear(); BinaryInput bin = new BinaryInput(stream); int c = bin.ReadInt32(); for (int i = 0; i < c; i++) { int temp_index = bin.ReadInt32(); int x = (int)bin.ReadSingle() >> 4; int y = (int)bin.ReadSingle() >> 4; AddEntityAction act = new AddEntityAction(EditorEngine.Instance.World.EntityContainer.All()[temp_index], new Vector2(x, y)); EditorEngine.Instance.GetActionManager().Execute(act); MapEntity result = act.worldEntity; EntitySelectionTool.Instance.SelectedEntities.Add(result); } } }
public IEncodable Decode(BinaryInput stream) { this.Uid = stream.ReadString(); this.Elapsed = stream.ReadSingle(); this.Duration = stream.ReadSingle(); return(this); }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Unchangeable = stream.ReadBoolean(); this.Deletable = stream.ReadBoolean(); this.Texture = stream.ReadTexture(); return this; }
public ISerializable Deserialize(BinaryInput input) { ID = input.ReadInt32(); Name = input.ReadString(); TileableTexture = input.ReadObject<TileableTexture>(); return this; }
public override IEncodable Decode(BinaryInput stream) { base.Decode(stream); value = stream.ReadByte(); return(this); }
public void Paste() { if (this.Initialized) { MemoryStream stream = null; IDataObject obj = Clipboard.GetDataObject(); const string format = "aeon_entities"; if (obj.GetDataPresent(format)) { stream = obj.GetData(format) as MemoryStream; } EntitySelectionTool.Instance.SelectedEntities.Clear(); BinaryInput bin = new BinaryInput(stream); int c = bin.ReadInt32(); for (int i = 0; i < c; i++) { int temp_index = bin.ReadInt32(); int x = (int)bin.ReadSingle() >> 4; int y = (int)bin.ReadSingle() >> 4; AddEntityAction act = new AddEntityAction(EditorEngine.Instance.World.EntityContainer.All()[temp_index], new Vector2(x, y)); EditorEngine.Instance.GetActionManager().Execute(act); MapEntity result = act.worldEntity; EntitySelectionTool.Instance.SelectedEntities.Add(result); } } }
/** * Sets the position. */ public bool setPosition(long offset) { try { long pos = _rs.getPosition(); if (pos <= offset) { if (_rs.setPosition(offset)) { return(true); } } // temp workaround: need to close before open for Google close(); //_in.close(); BinaryInput newIn = _in.openCopy(); init(newIn); long skipped = skip(offset); return(skipped == offset); } catch (IOException e) { e.printStackTrace(); throw new QuercusModuleException(e); } }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Unchangeable = stream.ReadBoolean(); this.Deletable = stream.ReadBoolean(); this.Texture = stream.ReadTexture(); return(this); }
public PlayerPosition(BinaryInput Input) { this.x = 319 - (int)Input.ReadInt(); this.y = 207 - (int)Input.ReadInt(); this.vx = -(int)Input.ReadInt(); this.vy = -(int)Input.ReadInt(); this.dead = Input.ReadBool(); }
public IEncodable Decode(BinaryInput stream) { this.Rows = stream.ReadInt32(); this.Columns = stream.ReadInt32(); this.Texture = stream.ReadTexture(); return(this); }
private void SocketClient_BinaryInput(byte[] data,int offset,int lengt) { RingBuffer.Write(data,offset,lengt); while (RingBuffer.Read(out byte[] pdata)) BinaryInput?.Invoke(pdata); }
public QuercusZipEntry(ZipEntry zipEntry, BinaryInput binaryInput, long position) { _entry = zipEntry; _binaryInput = binaryInput; _position = position; }
#pragma warning enable /// <summary> /// Parses a header. /// </summary> /// <param name="Input">Binary input.</param> /// <returns>Header.</returns> public static MqttHeader Parse(BinaryInput Input) { MqttHeader Result = new MqttHeader(); // Fixed part: byte b = Input.ReadByte(); Result.ControlPacketType = (MqttControlPacketType)(b >> 4); Result.Retain = (b & 1) != 0; Result.QualityOfService = (MqttQualityOfService)((b >> 1) & 3); Result.Duplicate = (b & 8) != 0; b = Input.ReadByte(); int Offset = 0; Result.RemainingLength = b & 127; while ((b & 128) != 0) { b = Input.ReadByte(); Offset += 7; Result.RemainingLength |= (b & 127) << Offset; } // Variable part: switch (Result.ControlPacketType) { case MqttControlPacketType.CONNECT: case MqttControlPacketType.CONNACK: case MqttControlPacketType.PINGREQ: case MqttControlPacketType.PINGRESP: case MqttControlPacketType.DISCONNECT: case MqttControlPacketType.PUBLISH: default: Result.PacketIdentifier = 0; break; case MqttControlPacketType.PUBACK: case MqttControlPacketType.PUBREC: case MqttControlPacketType.PUBREL: case MqttControlPacketType.PUBCOMP: case MqttControlPacketType.SUBSCRIBE: case MqttControlPacketType.SUBACK: case MqttControlPacketType.UNSUBSCRIBE: case MqttControlPacketType.UNSUBACK: Result.PacketIdentifier = Input.ReadByte(); Result.PacketIdentifier <<= 8; Result.PacketIdentifier |= Input.ReadByte(); Result.RemainingLength -= 2; break; } return(Result); }
#pragma warning enable /// <summary> /// Parses a header. /// </summary> /// <param name="Input">Binary input.</param> /// <returns>Header.</returns> public static MqttHeader Parse(BinaryInput Input) { MqttHeader Result = new MqttHeader(); // Fixed part: byte b = Input.ReadByte(); Result.ControlPacketType = (MqttControlPacketType)(b >> 4); Result.Retain = (b & 1) != 0; Result.QualityOfService = (MqttQualityOfService)((b >> 1) & 3); Result.Duplicate = (b & 8) != 0; b = Input.ReadByte(); int Offset = 0; Result.RemainingLength = b & 127; while ((b & 128) != 0) { b = Input.ReadByte(); Offset += 7; Result.RemainingLength |= (b & 127) << Offset; } // Variable part: switch (Result.ControlPacketType) { case MqttControlPacketType.CONNECT: case MqttControlPacketType.CONNACK: case MqttControlPacketType.PINGREQ: case MqttControlPacketType.PINGRESP: case MqttControlPacketType.DISCONNECT: case MqttControlPacketType.PUBLISH: default: Result.PacketIdentifier = 0; break; case MqttControlPacketType.PUBACK: case MqttControlPacketType.PUBREC: case MqttControlPacketType.PUBREL: case MqttControlPacketType.PUBCOMP: case MqttControlPacketType.SUBSCRIBE: case MqttControlPacketType.SUBACK: case MqttControlPacketType.UNSUBSCRIBE: case MqttControlPacketType.UNSUBACK: Result.PacketIdentifier = Input.ReadByte(); Result.PacketIdentifier <<= 8; Result.PacketIdentifier |= Input.ReadByte(); Result.RemainingLength -= 2; break; } return Result; }
public ISerializable Deserialize(BinaryInput input) { TilesetID = input.ReadInt32(); Row = input.ReadInt32(); Col = input.ReadInt32(); X = input.ReadInt32(); Y = input.ReadInt32(); return this; }
public ISerializable Deserialize(BinaryInput input) { Name = input.ReadString(); TimePerFrame = input.ReadSingle(); Frames = input.ReadList<KeyFrame>(); AnimationFlag = (AnimationFlags) input.ReadByte(); FlipEffect = (SpriteEffects) input.ReadByte(); Rotation = input.ReadSingle(); return this; }
public UserBody(Env env, CurlResource curl, Callable callback, BinaryInput file, long length) { _curl = curl; _callback = callback; _fileV = env.wrapJava(file); _length = length; }
public IEncodable Decode(BinaryInput stream) { int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Add(stream.ReadObject <UITemplate>()); } return(this); }
public IEncodable Decode(BinaryInput stream) { int tilesetCount = stream.ReadInt32(); for (int i = 0; i < tilesetCount; i++) { this.Add(stream.ReadObject <Tileset>()); } return(this); }
public object Deserialize( Stream serializationStream ) { IInput input = new BinaryInput( serializationStream ); object result; input.Read( out result ); input.Finish( ); return result; }
public IEncodable Decode(BinaryInput stream) { this.spriteindex = stream.ReadInt32(); this.collidable = stream.ReadBoolean(); this.reflecting = stream.ReadBoolean(); this.animated = stream.ReadBoolean(); this.frames = stream.ReadInt32(); this.timeperframe = stream.ReadSingle(); this.DefaultBehavior = stream.ReadObject<MockupTileBehavior>(); return this; }
public IEffect Read() { BinaryInput stream = this._stream as BinaryInput; int type = stream.ReadByte(); if (type == 0) { return(stream.ReadObject <LockEffect>()); } return(null); }
public IEncodable Decode(BinaryInput stream) { this.spriteindex = stream.ReadInt32(); this.collidable = stream.ReadBoolean(); this.reflecting = stream.ReadBoolean(); this.animated = stream.ReadBoolean(); this.frames = stream.ReadInt32(); this.timeperframe = stream.ReadSingle(); this.DefaultBehavior = stream.ReadObject <MockupTileBehavior>(); return(this); }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.TimePerFrame = stream.ReadSingle(); this.Flags = (AnimationFlags) stream.ReadByte(); int count = stream.ReadInt32(); for (int i = 0; i < count; i++) { this.Indices.Add(stream.ReadInt32()); } return this; }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); int tilesCount = stream.ReadInt32(); for (int i = 0; i < tilesCount; i++) { Tiles.Add(stream.ReadObject<Tile>()); } this.Texture = stream.ReadObject<TileableTexture>(); return this; }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Author = stream.ReadString(); this.TilesetFactory = stream.ReadObject<TilesetFactory>(); this.EntityTemplateFactory = stream.ReadObject<EntityTemplateFactory>(); this.TilesetContainer = stream.ReadObject<TilesetContainer>(); this.EntityContainer = stream.ReadObject<EntityContainer>(); this.UIContainer = stream.ReadObject<UIContainer>(); this.SpriteLibrary = stream.ReadObject<SpriteLibrary.SpriteLibrary>(); return this; }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); int tilesCount = stream.ReadInt32(); for (int i = 0; i < tilesCount; i++) { Tiles.Add(stream.ReadObject <Tile>()); } this.Texture = stream.ReadObject <TileableTexture>(); return(this); }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Author = stream.ReadString(); this.TilesetFactory = stream.ReadObject <TilesetFactory>(); this.EntityTemplateFactory = stream.ReadObject <EntityTemplateFactory>(); this.TilesetContainer = stream.ReadObject <TilesetContainer>(); this.EntityContainer = stream.ReadObject <EntityContainer>(); this.UIContainer = stream.ReadObject <UIContainer>(); this.SpriteLibrary = stream.ReadObject <SpriteLibrary.SpriteLibrary>(); return(this); }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.TimePerFrame = stream.ReadSingle(); this.Flags = (AnimationFlags)stream.ReadByte(); int count = stream.ReadInt32(); for (int i = 0; i < count; i++) { this.Indices.Add(stream.ReadInt32()); } return(this); }
public override IEncodable Decode(BinaryInput stream) { base.Decode(stream); this.Facing = (Facing)stream.ReadByte(); EffectIO io = new EffectIO(stream); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Effects.Add(io.Read()); } return(this); }
public IEncodable Decode(BinaryInput stream) { this.Pattern = (MovementPattern)stream.ReadByte(); this.Speed = (MovementSpeed)stream.ReadByte(); this.Count = stream.ReadInt16(); this.CurrentIndex = stream.ReadInt16(); this.Inverted = stream.ReadBoolean(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Movements.Add(stream.ReadObject <Movement>()); } return(this); }
public ISerializable Deserialize(BinaryInput input) { Texture = input.ReadTexture(); Position = input.ReadVector2(); int size = input.ReadInt32(); animations = new Dictionary<string, Animation>(size); for (var i = 0; i < size; i++) { string key = input.ReadString(); var value = input.ReadObject<Animation>(); animations.Add(key, value); } return this; }
public ISerializable Deserialize(BinaryInput input) { Rows = input.ReadInt32(); Cols = input.ReadInt32(); Tiles = new Tile[Rows, Cols]; for (var i = 0; i < Rows; i++) { for (var j = 0; j < Cols; j++) { Tiles[i, j] = input.ReadObject<Tile>(); } } return this; }
public static GameData ReadGame(GraphicsDevice graphicsDevice, BinaryInput input) { GameData result = new GameData(); input.GraphicsDevice = graphicsDevice; result.RegionData = new RegionData(); result.RegionData.Decode(input); int c = input.ReadInt32(); for (int i = 0; i < c; i++) { MapData data = new MapData(); data.Decode(input); result.MapDatas.Add(data); } return result; }
public override IEncodable Decode(BinaryInput stream) { int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibraryDirectory obj = stream.ReadObject<SpriteLibraryDirectory>(); obj.Parent = this; this.Directories.Add(obj); } c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibrarySprite obj = stream.ReadObject<SpriteLibrarySprite>(); obj.Parent = this; this.Sprites.Add(obj); } return this; }
public override IEncodable Decode(BinaryInput stream) { base.Decode(stream); TemplateID = stream.ReadInt32(); Collidable = stream.ReadBoolean(); Shadow = stream.ReadBoolean(); Rotation = stream.ReadSingle(); Scale = stream.ReadSingle(); Opacity = stream.ReadSingle(); TopMost = stream.ReadBoolean(); Color = new Color(stream.ReadVector4()); return(this); }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Author = stream.ReadString(); this.Width = stream.ReadInt32(); this.Height = stream.ReadInt32(); this.Tiles = new MockupTile[Width][][]; for (int i = 0; i < Width; i++) { Tiles[i] = new MockupTile[Height][]; for (int j = 0; j < Height; j++) { Tiles[i][j] = new MockupTile[Map.LayerCount]; } } int w = Width; int h = Height; this.Tilesets = stream.ReadList <MockupTileset>(); for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { for (int k = 0; k < Map.LayerCount; k++) { Tiles[i][j][k] = stream.ReadObject <MockupTile>(); } } } int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Tuple <Int32, Vector2> t = new Tuple <Int32, Vector2>(stream.ReadInt32(), stream.ReadVector2()); Entities.Add(t); } return(this); }
public static GameData ReadGame(GraphicsDevice graphicsDevice, BinaryInput input) { GameData result = new GameData(); input.GraphicsDevice = graphicsDevice; result.RegionData = new RegionData(); result.RegionData.Decode(input); int c = input.ReadInt32(); for (int i = 0; i < c; i++) { MapData data = new MapData(); data.Decode(input); result.MapDatas.Add(data); } return(result); }
public MapEntity Read() { MapEntity result = null; BinaryInput stream = _stream as BinaryInput; EntityType type = (EntityType)stream.ReadByte(); if (type == EntityType.Building) { result = new BuildingEntity(factory, ScrollAffected); } IEncodable encodable = result as IEncodable; if (encodable != null) { encodable.Decode(stream); } return(result); }
public static NamedCompound DecodeCompound(BinaryInput stream, List<Tuple<string, Type>> GenericChute) { NamedCompound result = new NamedCompound(); result.Name = stream.ReadString(); int c = stream.ReadInt32(); NamedVariableIO io = new NamedVariableIO(stream); for (int i = 0; i < c; i++) { NamedVariable varag= io.Read(); if (varag != null) result.Tokens.Add(varag); else { string n = stream.ReadString(); Type type = null; foreach (Tuple<string, Type> t in GenericChute.Where(t => n == t.Item1)) { type = t.Item2; } if (type != null) { } } } return result; }
public override IEncodable Decode(BinaryInput stream) { int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibraryDirectory obj = stream.ReadObject <SpriteLibraryDirectory>(); obj.Parent = this; this.Directories.Add(obj); } c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibrarySprite obj = stream.ReadObject <SpriteLibrarySprite>(); obj.Parent = this; this.Sprites.Add(obj); } return(this); }
public IAction Read() { IAction result = null; BinaryInput stream = _stream as BinaryInput; int i = stream.ReadInt32(); if (i == 1) { result = new SetTileAction(); } if (i == 2) { result = new MultiAction(); } if (i == 3) { result = new FillAction(); } if (i == 4) { result = new RectangleAction(); } if (i == 5) { result = new AddEntityAction(); } if (i == 6) { result = new RemoveEntityAction(); } IEncodable encodable = result as IEncodable; if (encodable != null) { encodable.Decode(stream); } return(result); }
public IEncodable Decode(BinaryInput stream) { Name = stream.ReadString(); ID = stream.ReadInt32(); EntityType = (EntityType) stream.ReadByte(); ShadowType = (ShadowType) stream.ReadByte(); ShadowType = ShadowType.Perspective; isSubEntity = stream.ReadBoolean(); ShadowOffset = stream.ReadInt32(); stream.ReadInt32(); CollisionMap = stream.ReadObject<CollisionMap>(); Texture = stream.ReadObject<TileableTexture>(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Animations.Add(stream.ReadObject<Animation>()); } return this; }
public IEncodable Decode(BinaryInput stream) { this.currentId = stream.ReadInt32(); return this; }
public ISerializable Deserialize(BinaryInput input) { Source = input.ReadRectangle(); return this; }
public IEncodable Decode(BinaryInput stream) { this.BehaviorId = stream.ReadByte(); return this; }
public IEncodable Decode(BinaryInput stream) { this.Uid = stream.ReadString(); this.Elapsed = stream.ReadSingle(); this.Duration = stream.ReadSingle(); return this; }
private bool ProcessInputPacket() { try { BinaryInput Packet = new BinaryInput(this.inputPacket); MqttHeader Header = MqttHeader.Parse(Packet); switch (Header.ControlPacketType) { case MqttControlPacketType.CONNECT: default: throw new Exception("Received command from server that is not handled: " + Header.ControlPacketType.ToString()); case MqttControlPacketType.CONNACK: bool SessionPresent = (Packet.ReadByte() & 1) != 0; byte ReturnCode = Packet.ReadByte(); try { switch (ReturnCode) { case 0: this.State = MqttState.Connected; this.nextPing = DateTime.Now.AddMilliseconds(this.keepAliveSeconds * 500); break; case 1: throw new IOException("Connection Refused, unacceptable protocol version."); case 2: throw new IOException("Connection Refused, identifier rejected."); case 3: throw new IOException("Connection Refused, Server unavailable."); case 4: throw new IOException("Connection Refused, bad user name or password."); case 5: throw new IOException("Connection Refused, not authorized."); default: throw new IOException("Unrecognized error code returned: " + ReturnCode.ToString()); } } catch (Exception ex) { this.ConnectionError(ex); this.stream.Close(); this.client.Close(); return false; } break; case MqttControlPacketType.PINGREQ: this.PINGRESP(); break; case MqttControlPacketType.PINGRESP: EventHandler h = this.OnPingResponse; if (h != null) { try { h(this, new EventArgs()); } catch (Exception ex) { #if LineListener LLOut(ex.Message, Color.Yellow, Color.DarkRed); #endif } } break; case MqttControlPacketType.PUBLISH: string Topic = Packet.ReadString(); if (Header.QualityOfService > MqttQualityOfService.AtMostOne) Header.PacketIdentifier = Packet.ReadUInt16(); else Header.PacketIdentifier = 0; int c = Packet.BytesLeft; byte[] Data = Packet.ReadBytes(c); MqttContent Content = new MqttContent(Header, Topic, Data); switch (Header.QualityOfService) { case MqttQualityOfService.AtMostOne: this.ContentReceived(Content); break; case MqttQualityOfService.AtLeastOne: this.PUBACK(Header.PacketIdentifier); this.ContentReceived(Content); break; case MqttQualityOfService.ExactlyOne: lock (this.contentCache) { this.contentCache[Header.PacketIdentifier] = Content; } this.PUBREC(Header.PacketIdentifier); break; } break; case MqttControlPacketType.PUBACK: this.PacketDelivered(Header.PacketIdentifier); PacketAcknowledgedEventHandler h2 = this.OnPublished; if (h2 != null) { try { h2(this, Header.PacketIdentifier); } catch (Exception ex) { #if LineListener LLOut(ex.Message, Color.Yellow, Color.DarkRed); #endif } } break; case MqttControlPacketType.PUBREC: this.PacketDelivered(Header.PacketIdentifier); this.PUBREL(Header.PacketIdentifier); break; case MqttControlPacketType.PUBREL: lock (this.contentCache) { if (this.contentCache.TryGetValue(Header.PacketIdentifier, out Content)) this.contentCache.Remove(Header.PacketIdentifier); else Content = null; } this.PUBCOMP(Header.PacketIdentifier); if (Content != null) this.ContentReceived(Content); break; case MqttControlPacketType.PUBCOMP: this.PacketDelivered(Header.PacketIdentifier); h2 = this.OnPublished; if (h2 != null) { try { h2(this, Header.PacketIdentifier); } catch (Exception ex) { #if LineListener LLOut(ex.Message, Color.Yellow, Color.DarkRed); #endif } } break; case MqttControlPacketType.SUBACK: this.PacketDelivered(Header.PacketIdentifier); h2 = this.OnSubscribed; if (h2 != null) { try { h2(this, Header.PacketIdentifier); } catch (Exception ex) { #if LineListener LLOut(ex.Message, Color.Yellow, Color.DarkRed); #endif } } break; case MqttControlPacketType.UNSUBACK: this.PacketDelivered(Header.PacketIdentifier); h2 = this.OnUnsubscribed; if (h2 != null) { try { h2(this, Header.PacketIdentifier); } catch (Exception ex) { #if LineListener LLOut(ex.Message, Color.Yellow, Color.DarkRed); #endif } } break; } } catch (Exception ex) { this.Error(ex); } return true; }
public override IEncodable Decode(BinaryInput stream) { base.Decode(stream); TemplateID = stream.ReadInt32(); Collidable = stream.ReadBoolean(); Shadow = stream.ReadBoolean(); Rotation = stream.ReadSingle(); Scale = stream.ReadSingle(); Opacity = stream.ReadSingle(); TopMost = stream.ReadBoolean(); Color = new Color(stream.ReadVector4()); return this; }
public IEncodable Decode(BinaryInput stream) { this.Facing = (Facing) stream.ReadByte(); this.Speed = (MovementSpeed) stream.ReadByte(); return this; }
public static GameData ReadGame(GraphicsDevice graphicsDevice, string loc) { using (BinaryInput input = new BinaryInput(File.OpenRead(loc))) { return ReadGame(graphicsDevice, input); } }
public ISerializable Deserialize(BinaryInput input) { ConquerDirectory = input.ReadString(); Effects = input.ReadBoolean(); return this; }
public IEncodable Decode(BinaryInput stream) { return this; }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Code = stream.ReadString(); return this; }
public virtual IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Deletable = stream.ReadBoolean(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibraryDirectory child = stream.ReadObject<SpriteLibraryDirectory>(); child.Parent = this; Directories.Add(child); } c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibrarySprite child = stream.ReadObject<SpriteLibrarySprite>(); child.Parent = this; Sprites.Add(child); } return this; }