Пример #1
0
        public SensorAction(ChessStreamReader chessReader, BinaryReader reader)
        {
            byte typeIndex = reader.ReadByte();
            Type sensorType = chessReader.SensorsFound[typeIndex];

            this.Data = SensorData.Deserialize(sensorType, reader);
        }
Пример #2
0
        public StreamTranslator(string sourceFile)
        {
            this.reader = new ChessStreamReader(sourceFile);
            this.start = reader.ReadAction() as Chess.IO.StartAction;
            if (this.start == null)
                throw new InvalidOperationException("Unexpected first action.");

            this.sensors = this.start.Sensors;
        }
Пример #3
0
        private void Start(Stream stream)
        {
            this.Speed = 1;
            this.chessReader = new ChessStreamReader(stream);

            var start = this.chessReader.ReadAction();
            if (!(start is StartAction))
                throw new InvalidOperationException("Expected: StartPositionAction");

            this.StartingFEN = ((StartAction)start).FEN;
            this.GameDuration = this.chessReader.GameDuration;
            this.IsLive = this.GameDuration == 0;
        }