Beispiel #1
0
 public Recorder(int inputDeviceIndex, String filePath, String fileName, OnRecord onRecord)
 {
     this.onRecord         = onRecord;
     this.InputDeviceIndex = inputDeviceIndex;
     this.FileName         = fileName;
     this.FilePath         = filePath;
 }
Beispiel #2
0
 private void Game2048_OnScore(Game2048Args e)
 {
     if (e.GetLastScore().CountScore > Record.CountScore)
     {
         Record = e.GetLastScore();
         OnRecord?.Invoke(args);
     }
     if (e.MaxNumberNow >= NumberForWin && !InfinityMode)
     {
         IsWin = true;
         GameOver();
     }
 }
Beispiel #3
0
 protected override void Observe()
 {
     if (_currTimer == Interval - 1)
     {
         _values.Add(_func(ObservableContext));
         _currTimer = 0;
         OnRecord?.Invoke(this, EventArgs.Empty);
     }
     else
     {
         ++_currTimer;
     }
 }
Beispiel #4
0
        private void HandleRecord(GameType gameType, int winnerTime)
        {
            if (gameType == GameType.Custom)
            {
                return;
            }

            OnRecord?.Invoke(this, EventArgs.Empty);

            string winnerName = getRecordsmanNameProvider?.GetRecordsmanName(Settings.CurrentSettings.Type, winnerTime);

            if (!string.IsNullOrEmpty(winnerName))
            {
                Records.UpdateRecord(gameType, winnerTime, winnerName);
                Records.Save();
            }
        }
Beispiel #5
0
        private void RecordData(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Record event");

            GoIpRecordPacket packet = new GoIpRecordPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp record event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("RECORD", packet.receiveid.ToString(), "Record event authentication error!"), host, port);
                OnRecord?.Invoke(this, new GoIpRecordEventArgs("GoIp record event authentication error!", packet, host, port));
                return;
            }

            packet.password = "";  // Delete password for security reasons

            _logger.LogInformation("Received GoIp record event. ReceiveId: {0} Send num: {1} Direction: {2}", packet.receiveid, packet.send_num, packet.direction);

            Send(ACKPacketFactory.ACK("RECORD", packet.receiveid.ToString(), ""), host, port);
            OnRecord?.Invoke(this, new GoIpRecordEventArgs("OK", packet, host, port));
        }