コード例 #1
0
        public override Task Execute(SocketCommandContext context)
        {
            IVoiceCommand voice        = this as IVoiceCommand;
            IVoiceChannel AudioChannel = context.Guild.GetVoiceChannel(GuildIds.voiceChannelId) as IVoiceChannel;

            Task.Run(() => voice.StartVoiceCommand(AudioChannel, Path));
            return(Task.CompletedTask);
        }
コード例 #2
0
        public IProcessHandle Execute(IVoiceCommand command)
        {
            //var startInfo = new ProcessStartInfo(@"cmd", @" /K ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" & " + command.BuildCommandString());
            var startInfo = new ProcessStartInfo(_launcher.Command, _launcher.DefaultArguments + " & " + command.BuildCommandString());

            var proc = new Process();

            proc.StartInfo = startInfo;
            proc.Start();

            return(new ProcessHandle(proc));
        }
コード例 #3
0
        protected virtual IEnumerable <ExpandedVoiceCommand> OnExpand(IVoiceCommand voiceCommand, string[] parameters)
        {
            if (!SupportsExpansion(voiceCommand))
            {
                Log.Trace("This expander does not handle commands of type {Type}", voiceCommand);
                yield break;
            }

            var pairsArray = GetParameterPairsMatrix(parameters, Lookup);

            foreach (var pairs in pairsArray)
            {
                yield return(new ExpandedVoiceCommand(voiceCommand.GetType(), voiceCommand.Template, pairs));
            }
        }
コード例 #4
0
        public IEnumerable <ExpandedVoiceCommand> Expand(IVoiceCommand voiceCommand)
        {
            var parameters = voiceCommand.GetTemplateParameters().ToArray();
            var error      = false;

            foreach (var parameter in parameters)
            {
                if (!Lookup.Contains(parameter))
                {
                    error = true;
                    Log.Error("Parameter {Parameter} is missing in lookup table", parameter);
                }
            }

            if (error)
            {
                yield break;
            }

            foreach (var expanded in OnExpand(voiceCommand, parameters))
            {
                yield return(expanded);
            }
        }
コード例 #5
0
 protected abstract bool SupportsExpansion(IVoiceCommand voiceCommand);
コード例 #6
0
 public void RegisterCommand(string commandString, IVoiceCommand commandToBeExecuted)
 {
     AllRegisteredCommands.Add(commandString.ToLower(), commandToBeExecuted);
 }
コード例 #7
0
 public void AddCommand(IVoiceCommand command)
 {
     this.Commands.Add(command);
 }
コード例 #8
0
 protected override bool SupportsExpansion(IVoiceCommand voiceCommand)
 {
     return(voiceCommand is AudioMasterOnCommand);
 }
コード例 #9
0
ファイル: SpeechRecogniser.cs プロジェクト: MahendraSv/csdpe
        public virtual void SetCommands(IVoiceCommand upCommand,
										IVoiceCommand downCommand)
        {
            this.upCommand = upCommand;
            this.downCommand = downCommand;
        }
コード例 #10
0
        public IProcessHandle Execute(IVoiceCommand command)
        {
            var proc = Process.Start(_launcher.Command, command.LaunchArgs);

            return(new ProcessHandle(proc));
        }
コード例 #11
0
 public virtual void SetCommands(IVoiceCommand upCommand, IVoiceCommand downCommand)
 {
     this.upCommand   = upCommand;
     this.downCommand = downCommand;
 }
コード例 #12
0
 protected override bool SupportsExpansion(IVoiceCommand voiceCommand)
 {
     return(voiceCommand is AudioApplicationOnCommand);
 }
コード例 #13
0
 public void Say(IVoiceCommand command)
 {
     _synth.SpeakAsync(command.ConfirmationText);
 }
コード例 #14
0
 public virtual void SetCommands(IVoiceCommand upCommand,
     IVoiceCommand downCommand)
 {
     _upCommand = upCommand;
     _downCommand = downCommand;
 }
コード例 #15
0
 public void AddCommand(IVoiceCommand command)
 {
     this.Commands.Add(command);
 }