Exemplo n.º 1
0
        void parser__ResponseParsed(object sender, AMCPParserEventArgs e)
        {
            //A response is completely parsed
            //Info about it is in the eventArgs
            if (e.Error == AMCPError.None)
            {
                switch (e.Command)
                {
                case AMCPCommand.VERSION:
                    device_.OnVersion(e.Data[0]);
                    break;

                case AMCPCommand.CLS:
                    OnCLS(e);
                    break;

                case AMCPCommand.TLS:
                    OnTLS(e);
                    break;

                case AMCPCommand.INFO:
                    OnInfo(e);
                    break;

                case AMCPCommand.LOAD:
                    device_.OnLoad((string)((e.Data.Count > 0) ? e.Data[0] : string.Empty));
                    break;

                case AMCPCommand.LOADBG:
                    device_.OnLoadBG((string)((e.Data.Count > 0) ? e.Data[0] : string.Empty));
                    break;

                case AMCPCommand.PLAY:
                    break;

                case AMCPCommand.STOP:
                    break;

                case AMCPCommand.CG:
                    break;

                case AMCPCommand.CINF:
                    break;

                case AMCPCommand.DATA:
                    OnData(e);
                    break;
                }
            }
            else
            {
                if (e.Command == AMCPCommand.DATA)
                {
                    OnData(e);
                }
            }
        }
Exemplo n.º 2
0
        void parser__ResponseParsed(object sender, AMCPParserEventArgs e)
        {
            //A response is completely parsed
            //Info about it is in the eventArgs
            if (e.Error == AMCPError.None)
            {
                switch (e.Command)
                {
                case AMCPCommand.VERSION:
                    device_.OnVersion(e.Data[0]);
                    break;

                case AMCPCommand.CLS:
                    OnCLS(e);
                    break;

                case AMCPCommand.TLS:
                    OnTLS(e);
                    break;

                case AMCPCommand.INFO:
                    OnInfo(e);
                    break;

                case AMCPCommand.LOAD:
                    device_.OnLoad((string)((e.Data.Count > 0) ? e.Data[0] : string.Empty));
                    break;

                case AMCPCommand.LOADBG:
                    device_.OnLoadBG((string)((e.Data.Count > 0) ? e.Data[0] : string.Empty));
                    break;

                case AMCPCommand.PLAY:
                    device_.OnPlay();
                    break;

                case AMCPCommand.STOP:
                    if (e.Data.Count == 0)
                    {
                        device_.OnCGRetrieved(string.Empty);
                    }
                    else
                    {
                        foreach (var cmd in e.Data)
                        {
                            device_.OnCGRetrieved(cmd.Trim());
                        }
                    }
                    break;

                case AMCPCommand.CLEAR:
                    if (e.Data.Count == 0)
                    {
                        device_.OnCleared(string.Empty);
                    }
                    else
                    {
                        foreach (var cmd in e.Data)
                        {
                            device_.OnCleared(cmd.Trim());
                        }
                    }
                    break;

                case AMCPCommand.CG:
                    if (e.Data.Count == 0)
                    {
                        device_.OnCGRetrieved(string.Empty);
                    }
                    else
                    {
                        foreach (var cmd in e.Data)
                        {
                            device_.OnCGRetrieved(cmd.Trim());
                        }
                    }
                    break;

                case AMCPCommand.CINF:
                    break;

                case AMCPCommand.DATA:
                    OnData(e);
                    break;

                case AMCPCommand.ADD:
                    OnAdd(e);
                    break;

                case AMCPCommand.REMOVE:
                    OnRemove(e);
                    break;

                case AMCPCommand.SWAP:
                    device_.OnSwap();
                    break;

                case AMCPCommand.MIXER:
                    device_.OnMixer();
                    break;
                }
            }
            else
            {
                if (e.Command == AMCPCommand.DATA)
                {
                    OnData(e);
                }
                else if (e.Command == AMCPCommand.CG)
                {
                    device_.OnCGRetrieved(e.Error.ToString().Trim());
                }
            }
        }