FSO.SimAntics.NetPlay.Model.VMNetCommand.Deserialize C# (CSharp) Method

Deserialize() public method

public Deserialize ( BinaryReader reader ) : void
reader System.IO.BinaryReader
return void
        public void Deserialize(BinaryReader reader)
        {
            Type = (VMCommandType)reader.ReadByte();
            Type cmdType = CmdMap[Type];
            Command = (VMNetCommandBodyAbstract)Activator.CreateInstance(cmdType);
            Command.Deserialize(reader);
        }

Usage Example

コード例 #1
0
ファイル: VMServerDriver.cs プロジェクト: Daribon/FreeSO
 public override void OnPacket(NetworkClient client, ProcessedPacket packet)
 {
     var cmd = new VMNetCommand();
     try {
         using (var reader = new BinaryReader(packet)) {
             cmd.Deserialize(reader);
         }
     } catch (Exception)
     {
         ClientsToDC.Add(client);
         return;
     }
     if (cmd.Type == VMCommandType.SimJoin)
     {
         if (((VMNetSimJoinCmd)cmd.Command).Version != VMNetSimJoinCmd.CurVer)
         {
             ClientsToDC.Add(client);
             return;
         }
         lock (UIDs)
         {
             UIDs.Add(client, ((VMNetSimJoinCmd)cmd.Command).SimID);
         }
     }
     SendCommand(cmd.Command);
 }
All Usage Examples Of FSO.SimAntics.NetPlay.Model.VMNetCommand::Deserialize