Exemple #1
0
        public List <ICommand> GetNextCommands()
        {
            try
            {
                var result = new List <ICommand>();
                foreach (ParsedCommandSpec rawCmd in _processQueue.Take().Commands)
                {
                    // Don't print full command, if it is really long for performance reasons
                    string payloadStr = rawCmd.Body.Length > 100 ? "of " + rawCmd.Body.Length + " bytes" : BitConverter.ToString(rawCmd.Body);
                    Log.DebugFormat("{0} - Received command {1} with content {2}", Endpoint, rawCmd.Name, payloadStr);

                    var cmd = CommandParser.Parse(_protocolVersion ?? ProtocolVersion.Minimum, rawCmd);
                    if (cmd is VersionCommand verCmd)
                    {
                        _protocolVersion = verCmd.ProtocolVersion;
                        // TODO - log version info
                    }
                    else if (cmd is InitializationCompleteCommand)
                    {
                        OnInitComplete?.Invoke(this);
                    }
                    result.AddIfNotNull(cmd);
                }

                return(result);
            }
            catch (ArgumentException)
            {
                //discard as was malformed
                return(new List <ICommand>());
            }
        }
Exemple #2
0
        static void OnDbInitComplete()
        {
            DataBaseProxy.Instance.OnInitialized -= OnDbInitComplete;
            CommandSequence sequence = new CommandSequence(_initStoragesCommands.ToArray());

            sequence.OnComplete += () => OnInitComplete.Invoke();
            CommandManager.Execute(sequence);
        }
Exemple #3
0
        protected void OnDbInitComplete()
        {
            _dbProxy.OnInitialized -= OnDbInitComplete;
            CommandSequence sequence = new CommandSequence(_initStoragesCommands.ToArray());

            sequence.OnComplete += () =>
            {
                OnInitComplete.Invoke();
            };
            CommandManager.Execute(sequence);
        }
 private void InitCompleted()
 {
     _initializing = false;
     OnInitComplete?.Invoke(this, new EventArgs());
 }
Exemple #5
0
 private void OnInitComplete()
 {
     onInitComplete.Invoke();
 }