Ejemplo n.º 1
0
        /// <summary> Sending/Receiving Messages in a channel
        /// Received: MSG { "character": string, "message": string, "channel": string }
        /// Send  As: MSG { "channel": string, "message": string }</summary>
        internal static void MSG(SystemCommand C)
        {
            Message m = new Message(C);

            m.sourceChannel.MessageReceived(m);
            ProcessPossibleCommand(m);
        }
Ejemplo n.º 2
0
        /// <summary> This command requires channel op or higher. Set a new channel owner.
        /// Received: CSO {"character":"string","channel":"string"}
        /// Send  As: CSO {"character":"string","channel":"string"}</summary>
        internal static void CSO(SystemCommand C)
        {
            string action = string.Format("Ownership of channel '{0}' has been transferred to {1}", C.sourceChannel, C.Data["character"]);

            C.sourceChannel.ChannelModLog.Log(action);
            C.sourceChannel.Log(action, true);
        }
Ejemplo n.º 3
0
        /// <summary> This command requires channel op or higher. Temporarily bans a user from the channel for 1-90 minutes. A channel timeout.
        /// Send  As: CTU { "channel":string, "character":string, "length":int }
        /// Received: CTU {"operator":"string","channel":"string","length":int,"character":"string"}</summary>
        internal static void CTU(SystemCommand C)
        {
            string action = string.Format("{0} has been suspended from {1} for {2} minutes by {3}", C.Data["character"], C.sourceChannel, C.Data["length"], C.Data["operator"]);

            C.sourceChannel.ChannelModLog.Log(action);
            C.sourceChannel.Log(action, true);
        }
Ejemplo n.º 4
0
        /// <summary> This command requires channel op or higher. Bans a character from a channel.
        /// Send  As: CBU {"character": string, "channel": string}
        /// Received: CBU {"operator":string,"channel":string,"character":string}</summary>
        internal static void CBU(SystemCommand C)
        {
            string action = string.Format("{0} has banned {1} from {2}", C.Data["operator"], C.Data["character"], C.sourceChannel);

            C.sourceChannel.ChannelModLog.Log(action);
            C.sourceChannel.Log(action, true);
        }
Ejemplo n.º 5
0
        /// <summary> A user connected.
        /// Received: NLN { "identity": string, "gender": enum, "status": enum }</summary>
        internal static void NLN(SystemCommand C)
        {
            User u = Core.getUser(C.Data["identity"].ToString());

            u.Status = (Status)Enum.Parse(typeof(Status), C.Data["status"].ToString());
            u.Gender = C.Data["gender"].ToString();
        }
Ejemplo n.º 6
0
 /// <summary> Gives a list of open private rooms.
 /// Received: ORS { "channels": [object] }
 /// e.g. "channels": [{"name":"ADH-300f8f419e0c4814c6a8","characters":0,"title":"Ariel's Fun Club"}] etc. etc.
 /// Send  As: ORS</summary>
 internal static void ORS(SystemCommand C)
 {
     Newtonsoft.Json.Linq.JArray AllChannelData = Newtonsoft.Json.Linq.JArray.Parse(C.Data["channels"].ToString());
     if (AllChannelData.Count > 0)
     {
         try{
             List <Dictionary <string, object> > _AllChannelData = AllChannelData.ToObject <List <Dictionary <string, object> > >();
             for (int l = 0; l < _AllChannelData.Count; l++)
             {
                 Dictionary <string, object> currentChannel = _AllChannelData[l];                        //removal of whole-list lookup for, uh, about 100 public channels and 1000+ privates...
                 string cTitle = currentChannel["title"].ToString();
                 if (Core.channels.Count(x => x.Name == cTitle) == 0)
                 {
                     Channel ch = new Channel(cTitle, currentChannel["name"].ToString(), int.Parse(currentChannel["characters"].ToString()));
                 }
             }
         }
         catch (Exception ex) { Core.ErrorLog.Log(String.Format("Private Channel parsing failed:\n\t{0}\n\t{1}\n\t{2}", ex.Message, ex.InnerException, ex.StackTrace)); }
     }
     new IO.SystemCommand("STA { \"status\": \"online\", \"statusmsg\": \"Running CogitoMini v" + Config.AppSettings.Version + "\" }").Send();
     foreach (string cn in Core.XMLConfig["autoJoin"].Split(';'))
     {
         if (Core.channels.Count(x => x.Name == cn) > 0)
         {
             Core.channels.First(y => y.Name == cn).Join();
         }
     }
 }
Ejemplo n.º 7
0
        private static void SetBinaryMode(IPrimitiveSink connection)
        {
            var binaryModeCommand = new SystemCommand(SystemOp.SetBinaryMode);
            var binaryModeMessage = new MessageBuilder(binaryModeCommand);

            binaryModeMessage.Send(connection);
        }
Ejemplo n.º 8
0
        /// <summary>  Invites a user to a channel. Sending requires channel op or higher.
        /// Send  As: CIU { "channel": string, "character": string }
        /// Received: CIU { "sender":string,"title":string,"name":string } </summary>
        internal static void CIU(SystemCommand C)
        {
            Channel ch = Core.getChannel(C.Data["name"].ToString(), C.Data["title"].ToString());

            Core.SystemLog.Log(String.Format("Joining channel '{0}' by invitation of user '{1}'", C.Data["title"].ToString(), C.Data["sender"].ToString()));
            ch.Join();
        }
Ejemplo n.º 9
0
        private static ILoginResult TryLogin(SeededPrimitiveConnection seedConn, IAuthPromptResponse authPrompt)
        {
            var(seed, conn) = seedConn;

            var username        = authPrompt.Username;
            var password        = authPrompt.Password;
            var securedPassword = Md5Sum(string.Concat(seed, Md5Sum(password)));

            var loginCmd     = new SystemCommand(SystemOp.Login);
            var loginMessage = new MessageBuilder(loginCmd).Add(username).Add(securedPassword);

            loginMessage.Send(conn);

            var(matched, authResult, description) = conn.ReceiveSystemStringCommand(SystemOp.LoginResult);
            if (!matched)
            {
                return(new InvalidProtocolLoginResult("login result listen"));
            }

            var authenticated = CommandUnpacking.Value(authResult) == 0;

            if (!authenticated)
            {
                return(new UserLoginException(description ?? "(no description)"));
            }
            return(new SuccessLoginResult());
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MonoBrick.EV3.Command"/> class.
 /// </summary>
 /// <param name="data">Data.</param>
 public Command(byte[] data)
 {
     if (data.Length < 4)
     {
         throw new System.ArgumentException("Invalid EV3 Command");
     }
     for (int i = 0; i < data.Length; i++)
     {
         dataArr.Add(data[i]);
     }
     this.sequenceNumber = (UInt16)(0x0000 | dataArr[0] | (dataArr[1] << 2));
     try
     {
         commandType = (CommandType)(data[2] & 0x7f);
         if (commandType == CommandType.SystemCommand)
         {
             systemCommand = (SystemCommand)data[3];
         }
         else
         {
             systemCommand = SystemCommand.None;
         }
     }
     catch (BrickException)
     {
         throw new System.ArgumentException("Invalid EV3 Command");
     }
     replyRequired = !Convert.ToBoolean(data[2] & 0x80);
 }
Ejemplo n.º 11
0
 public CommandViewModel()
 {
     SystemCommand  = new SystemCommand();
     BuildCommand   = new BuildCommand {
     };
     BuildSlaveList = new List <string>();
 }
Ejemplo n.º 12
0
 /// <summary> After connecting and identifying you will receive a CON command, giving the number of connected users to the network.
 /// Received: CON { "count": int }</summary>
 internal static void CON(SystemCommand C)
 {
     using (FileStream fs = File.Open(Config.AppSettings.LoggingPath + "Connections.log", FileMode.Append)) {
         StreamWriter fsw = new StreamWriter(fs);
         DateTime     Now = DateTime.Now;
         fsw.Write(String.Format("{0}\t{1}\t{2}\t{3}\t{4}\tusers connected\r\n", Now.ToString("yyyy-MM-dd"), Now.ToString("HH:mm:ss"), Core.XMLConfig["server"], Core.XMLConfig["port"], C.Data["count"].ToString()));
     }
 }
Ejemplo n.º 13
0
 public Task SendSystemCommand(SystemCommand command, CancellationToken cancellationToken)
 {
     return(SendCommand(new WebSocketMessage <string>
     {
         MessageType = "SystemCommand",
         Data = command.ToString()
     }, cancellationToken));
 }
Ejemplo n.º 14
0
        public Task SendSystemCommand(SystemCommand command, CancellationToken cancellationToken)
        {
            return SendCommand(new WebSocketMessage<string>
            {
                MessageType = "SystemCommand",
                Data = command.ToString()

            }, cancellationToken);
        }
Ejemplo n.º 15
0
        private void Announce_Click(object sender, RoutedEventArgs e)
        {
            var sysCommand = new SystemCommand
            {
                Message = _buildCommandVM.AnnounceMessage
            };

            _publishSystemCommandChannel.Publish <SystemCommand>(sysCommand);
        }
Ejemplo n.º 16
0
        /// <summary> Initial channel data. Received in response to JCH, along with CDS.
        /// Received: ICH { "users": [object], "channel": string, "title": string, "mode": enum }
        /// ICH {"users": [{"identity": "Shadlor"}], "channel": "Frontpage", mode: "chat"}</summary>
        internal static void ICH(SystemCommand C)
        {
            IList <string> Users = ((JArray)C.Data["users"]).ToObject <List <Dictionary <string, string> > >().Select(n => n.Values.ToArray()[0]).ToList();       //List<Dictionary<string, string>> //TODO custom JSON fix...

            foreach (string u in Users)
            {
                C.sourceChannel.Users.Add(new User(u));
            }
        }
Ejemplo n.º 17
0
        public void TestPacked_NullaryCommand()
        {
            var expected = (ushort)(CommandGroup.System.ToWordBits() | SystemOp.Quit.ToWordBits());

            var unpacked = new SystemCommand(SystemOp.Quit);
            var actual   = unpacked.Packed;

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 18
0
        public void TestZeroArgumentCommandSend()
        {
            var cmd = new SystemCommand(SystemOp.Quit);
            var m   = new MessageBuilder(cmd);
            // Even zero-argument commands have a trailing length (of 0).
            const uint expectedLength = 0;

            AssertMessage(m, cmd, expectedLength);
        }
Ejemplo n.º 19
0
    BaseMessage ProcessMessage(string inRawMessage, bool inGlobalInbox)
    {
        //Debug.Log( inRawMessage );

        try
        {
            // Construct message from raw string...
            BaseMessage message = ConstructMessage(inRawMessage, (inGlobalInbox ? E_Mailbox.Global : E_Mailbox.Product));

            // If this message is System command deliver it into specified target system...
            if (message is SystemCommand)
            {
                SystemCommand sys_command = (SystemCommand)message;
                switch (sys_command.m_TargetSystem)
                {
                case "Game.FriendList":
                    GameCloudManager.friendList.ProcessMessage(message);
                    break;

                case "Game.News":
                    GameCloudManager.news.ProcessMessage(message as NewsMessage);
                    break;

                case "Game.ResetResearch":
                    UserGuideAction_ResetResearch.NotifyUser = true;
                    //Debug.LogWarning(" ### Game.ResetResearch ### ");
                    break;

                case "Game.AccountExtended":
                    Debug.LogWarning(" ### Game.AccountExtended ### ");
                    break;

                default:
                    Debug.LogError("Unknown target system " + ((SystemCommand)message).m_TargetSystem);
                    break;
                }
            }
            else if (message is FriendMessage)
            {
                if (GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == message.m_Sender) == null)
                {
                    // ignore message from non-friend user
                    return(null);
                }
            }

            return(message);
        }
        catch
        {
            Debug.LogWarning("Error during message processing. See callstack for more info.");

            //Construct simple message in this case...
            return(new BaseMessage(inRawMessage, (inGlobalInbox ? E_Mailbox.Global : E_Mailbox.Product), null));
        }
    }
Ejemplo n.º 20
0
        /// <summary>Sends the client the current list of chatops.
        /// Received: ADL { "ops": [string] }</summary>
        internal static void ADL(SystemCommand C)
        {
            List <string> AllOpsData = ((JArray)C.Data["ops"]).ToObject <List <string> >();

            foreach (string Op in AllOpsData)
            {
                User _Op = Core.getUser(Op);
                Core.globalOps.Add(_Op);
            }
        }
Ejemplo n.º 21
0
        public Task SendSystemCommand(SystemCommand command, CancellationToken cancellationToken)
        {
            var socket = GetActiveSocket();

            return(socket.SendAsync(new WebSocketMessage <string>
            {
                MessageType = "SystemCommand",
                Data = command.ToString()
            }, cancellationToken));
        }
Ejemplo n.º 22
0
        internal static void OnWebsocketMessage(object sender, WebSocket4Net.MessageReceivedEventArgs e)
        {
            SystemCommand C = new SystemCommand(e.Message.ToString());

            if (C.OpCode == "PIN")
            {
                Core.websocket.Send("PIN"); return;
            }
            IncomingMessageQueue.Enqueue(C);
        }
Ejemplo n.º 23
0
        /// <summary> Private Messaging
        /// Received: PRI { "character": string, "message": string }
        /// Send  As: PRI { "recipient": string, "message": string }</summary>
        internal static void PRI(SystemCommand C)
        {
            Message message = new Message(C);

            try{
                message.sourceUser.MessageReceived(message);
                ProcessPossibleCommand(message);
            }
            catch (Exception ex) { Core.ErrorLog.Log(String.Format("Error parsing message from {0}: {1} {2} {3}", message.sourceUser.Name, message.ToString(), ex.Message, ex.StackTrace)); }
        }
Ejemplo n.º 24
0
        public Task SendSystemCommand(SessionInfo session, SystemCommand command, CancellationToken cancellationToken)
        {
            var socket = GetSocket(session);

            return socket.SendAsync(new WebSocketMessage<string>
            {
                MessageType = "SystemCommand",
                Data = command.ToString()

            }, cancellationToken);
        }
Ejemplo n.º 25
0
        /// <summary> This command requires channel op or higher. Promotes a user to channel operator.
        /// Received: COA {"character":string, "channel":string}
        /// Send  As: COA { "channel": string, "character": string }</summary>
        internal static void COA(SystemCommand C)
        {
            string action = string.Format("{0} has promoted {1} to operator status in '{2}'", C.Data["operator"], C.sourceUser.Name, C.sourceChannel);

            C.sourceChannel.ChannelModLog.Log(action);
            C.sourceChannel.Log(action, true);
            C.sourceUser.isMod = true;
            if (C.sourceUser != null && !C.sourceChannel.Mods.Contains(C.sourceUser))
            {
                C.sourceChannel.Mods.Add(C.sourceUser);
            }
        }
Ejemplo n.º 26
0
        public void Initialize_SystemCommand_Test()
        {
            // Arrange
            var commandId   = "Fork";
            var description = "TestCommand One";

            // Act
            var command = new SystemCommand(commandId, description, () => { });

            // Assert
            Assert.NotNull(command);
        }
Ejemplo n.º 27
0
        /// <summary> This command requires channel op or higher. Demotes a channel operator (channel moderator) to a normal user.
        /// Send  As: COR { "channel": string, "character": string }
        /// Received: COR {"character":"character_name", "channel":"channel_name"}</summary>
        internal static void COR(SystemCommand C)
        {
            string action = string.Format("{0} has been demoted from operator status in '{1}'", C.sourceUser.Name, C.sourceChannel);

            C.sourceChannel.ChannelModLog.Log(action);
            C.sourceChannel.Log(action, true);
            C.sourceUser.isMod = false;
            if (C.sourceChannel.Mods.Contains(C.sourceUser))
            {
                C.sourceChannel.Mods.Remove(C.sourceUser);
            }
        }
Ejemplo n.º 28
0
 /// <summary> Gives a list of channel ops. Sent in response to JCH.
 /// Received: COL { "channel": string, "oplist": [string] }
 /// Send  As: COL { "channel": string }</summary>
 internal static void COL(SystemCommand C)
 {
                 #if DEBUG
     Console.WriteLine("Modlist for '" + C.sourceChannel.Name + "': " + C.Data["oplist"]);
                 #endif
     C.sourceChannel.Mods.Clear();
     foreach (string s in (JArray)C.Data["oplist"])
     {
         User u = Core.getUser(s);
         u.isMod = true;
         C.sourceChannel.Mods.Add(u);
     }
 }
Ejemplo n.º 29
0
        /// <summary> An indicator that the given character has left the channel. This may also be the client's character.
        /// Received: LCH { "channel": string, "character": character }
        /// Send  As: LCH { "channel": string }</summary>
        internal static void LCH(SystemCommand C)
        {
            //Channel ch = Core.getChannel(C.Data["channel"].ToString()); //"title" would be the channel's name, which in case of private channels can collide!
            string us = C.Data["character"].ToString();

            C.sourceChannel.Log(string.Format("User '{0}' left Channel '{1}'", us, C.sourceChannel.Name));
            C.sourceChannel.Users.Remove(Core.getUser(us));
            if (us == Core.OwnUser.Name)
            {
                Core.joinedChannels.Remove(C.sourceChannel);
                C.sourceChannel.joinIndex = -1;
            }
        }
Ejemplo n.º 30
0
        public void TestStringSystemCommandSend(string value)
        {
            var cmd = new SystemCommand(SystemOp.SendLogMessage);

            // Strings are UTF-8, so the command length is equal to the number of UTF-8 bytes in the value, plus four
            // characters for the on-wire representation of the string's length.
            var valueLength    = Encoding.UTF8.GetByteCount(value);
            var expectedLength = (uint)valueLength + 4;

            var m = new MessageBuilder(new SystemCommand(SystemOp.SendLogMessage)).Add(value);

            AssertMessage(m, cmd, expectedLength,
                          actualValue => Assert.Equal(value, Assert.IsAssignableFrom <string>(actualValue)));
        }
Ejemplo n.º 31
0
        protected void HandleRestart()
        {
            _restartPending = true;

            SystemCommand command;
            var           windowStyle = ProcessWindowStyle.Hidden;

            if (Environment.UserInteractive)
            {
                // console
                windowStyle = ProcessWindowStyle.Normal;
                command     = new SystemCommand
                {
                    RestartConsole = new RestartConsoleInstruction
                    {
                        ProcessId = Process.GetCurrentProcess().Id
                    }
                };

                Logger.Debug("Writing console restart instruction file");
            }
            else
            {
                // service
                command = new SystemCommand
                {
                    RestartService = new RestartServiceInstruction
                    {
                        ServiceName = "Wolfpack"
                    }
                };
                Logger.Debug("Writing service restart instruction file");
            }

            Serialiser.ToXmlInFile(SystemCommand.Filename, command);

            Logger.Info("Launching Wolfpack Helper to manage system restart...");
            var managerProcess = Process.Start(new ProcessStartInfo("wolfpack.manager.exe")
            {
                WindowStyle = windowStyle
            });

            if (managerProcess == null)
            {
                return;
            }

            Logger.Debug("Calling AllowSetForegroundWindow() on manager process...");
            AllowSetForegroundWindow(managerProcess.MainWindowHandle);
        }
Ejemplo n.º 32
0
        public void Visit(SystemCommand command)
        {
            switch (command.Op)
            {
            case SystemOp.SendLogMessage:
                DecodeSendLogMessage();
                break;

            case SystemOp.Filename when command.ModeFlag:
                DecodeDirectoryFileAdd(command.Value);
                break;

            case SystemOp.Filename when !command.ModeFlag:
                DecodeDirectoryPrepare(command.Value);
                break;

            case SystemOp.ServerVersion:
                DecodeServerVersion();
                break;

            case SystemOp.Feedback:
                DecodeFeedback();
                break;

            case SystemOp.SendMessage:
                DecodeSendMessage();
                break;

            case SystemOp.ClientChange:
                DecodeClientChange();
                break;

            case SystemOp.ScrollText:
                DecodeTextSetting(command.Value, TextSetting.Scroll);
                break;

            case SystemOp.TextSize:
                DecodeTextSetting(command.Value, TextSetting.FontSize);
                break;

            case SystemOp.Quit:
                DecodeQuit();
                break;

            default:
                ReportMalformedCommand(CommandGroup.System);
                break;
            }
        }
 public SystemCommandEventArgs(SystemCommand command)
 {
     Command = command;
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.EV3.Command"/> class as a system command
		/// </summary>
		/// <param name="systemCommand">System command.</param>
		/// <param name="sequenceNumber">Sequence number.</param>
		/// <param name="reply">If set to <c>true</c> reply will be send from brick</param>
		public Command(SystemCommand systemCommand, UInt16 sequenceNumber, bool reply)
		{
			this.systemCommand = systemCommand;
			this.commandType = CommandType.SystemCommand;
			this.sequenceNumber = sequenceNumber;
			this.Append(sequenceNumber);

			if (reply){
				replyRequired = true;
				dataArr.Add((byte)commandType);
			}
			else{
				replyRequired = false;
				dataArr.Add((byte)((byte) commandType | 0x80));
			}
			dataArr.Add((byte)systemCommand);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.EV3.Command"/> as a direct command
		/// </summary>
		/// <param name="globalVariables">Global bytes.</param>
		/// <param name="localVariables">Number of global variables</param>
		/// <param name="sequenceNumber">Number of local variables</param>
		/// <param name="reply">If set to <c>true</c> reply will be send from brick</param>
		public Command(int globalVariables, int localVariables, UInt16 sequenceNumber, bool reply)
		{
			this.systemCommand = SystemCommand.None;
			this.commandType = CommandType.DirectCommand;
			this.sequenceNumber = sequenceNumber;
			this.Append(sequenceNumber);
			if (reply){
				replyRequired = true;
				dataArr.Add((byte)commandType);
			}
			else{
				replyRequired = false;
				dataArr.Add((byte)((byte) commandType | 0x80));
			}
			byte firstByte = (byte)(globalVariables & 0xFF);
			byte secondByte = (byte)((localVariables << 2) | (globalVariables >> 8));
			this.Append(firstByte);
			this.Append(secondByte);
		}
Ejemplo n.º 36
0
 protected override void GetContentFromMessage(List<byte> payload)
 {
     this.Command = (SystemCommand)payload[1];
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.EV3.Command"/> class.
		/// </summary>
		/// <param name="data">Data.</param>
		public Command(byte [] data){
			if(data.Length < 4){
				throw new System.ArgumentException("Invalid EV3 Command");
			}
			for(int i = 0; i < data.Length; i++){
				dataArr.Add(data[i]);
			}
			this.sequenceNumber = (UInt16)(0x0000 | dataArr[0] | (dataArr[1] << 2));
			try{
				commandType = (CommandType) (data[2] & 0x7f);
				if(commandType == CommandType.SystemCommand){
					systemCommand = (SystemCommand) data[3];
				}
				else{
					systemCommand = SystemCommand.None;	
				}

			}
			catch(BrickException){
				throw new System.ArgumentException("Invalid EV3 Command");
			}
			replyRequired = !Convert.ToBoolean(data[2]&0x80);
		}
Ejemplo n.º 38
0
        /// <summary>
        /// Sends the system command.
        /// </summary>
        /// <param name="sessionId">The session id.</param>
        /// <param name="command">The command.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public Task SendSystemCommand(Guid sessionId, SystemCommand command, CancellationToken cancellationToken)
        {
            var session = GetSessionForRemoteControl(sessionId);

            var tasks = GetControllers(session).Select(i => i.SendSystemCommand(session, command, cancellationToken));

            return Task.WhenAll(tasks);
        }
Ejemplo n.º 39
0
 /// <summary>
 /// The constructor.
 /// </summary>
 public API(Robot _robot)
     : base(_robot)
 {
     DirectCommand = new NXT.API.DirectCommand(_robot);
     SystemCommand = new NXT.API.SystemCommand(_robot);
 }
Ejemplo n.º 40
0
        /// <summary>
        /// Sends the system command.
        /// </summary>
        /// <param name="sessionId">The session id.</param>
        /// <param name="command">The command.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public Task SendSystemCommand(Guid sessionId, SystemCommand command, CancellationToken cancellationToken)
        {
            var session = GetSessionForRemoteControl(sessionId);

            return session.SessionController.SendSystemCommand(command, cancellationToken);
        }
Ejemplo n.º 41
0
 public SystemMessage(SystemCommand command)
     : this()
 {
     this.Command = command;
 }
Ejemplo n.º 42
0
 public Task SendSystemCommand(SystemCommand command, CancellationToken cancellationToken)
 {
     switch (command)
     {
         case SystemCommand.VolumeDown:
             return _device.VolumeDown();
         case SystemCommand.VolumeUp:
             return _device.VolumeUp();
         case SystemCommand.Mute:
             return _device.VolumeDown(true);
         case SystemCommand.Unmute:
             return _device.VolumeUp(true);
         case SystemCommand.ToggleMute:
             return _device.ToggleMute();
         default:
             return Task.FromResult(true);
     }
 }