예제 #1
0
        private IEnumerable <string> FilterMsgArray(List <string> msgarray, CommandName commandName)
        {
            var botname = _config.BotSettings.IrcBotName;

            msgarray.RemoveAll(n => n.Equals(botname, StringComparison.InvariantCultureIgnoreCase));
            msgarray.RemoveAll(n => n.Equals(commandName.ToString(), StringComparison.InvariantCultureIgnoreCase));
            msgarray.Remove(commandName.ToString());
            return(msgarray);
        }
예제 #2
0
            public int Compare(object x, object y)
            {
                CommandName a = (CommandName)x;
                CommandName b = (CommandName)y;

                string aName = a.ToString();
                string bName = a.ToString();

                return(aName.CompareTo(bName));
            }
예제 #3
0
        public bool TryRewrite(Dictionary <string, object> context)
        {
            if (!ContextHelper.TryGetOptions(context, out var options))
            {
                return(false);
            }

            if (!options.Any(IsHelpOption))
            {
                return(false);
            }

            if (ContextHelper.TryGetCommandName(context, out var commandNameParts) && commandNameParts.Length > 0)
            {
                if (_commandResolver.TryResolve(context, _appModel.Commands, out var command) &&
                    command.Arguments.Any(IsHelpOption))
                {
                    return(false);
                }

                var commandName = new CommandName(commandNameParts);
                ContextHelper.SetOperands(context, new[] { commandName.ToString() });
            }
            else
            {
                // General help
                ContextHelper.SetOperands(context, ContextHelper.EmptyOperands);
            }

            ContextHelper.SetCommandName(context, new[] { "help" });
            ContextHelper.SetOptions(context, ContextHelper.EmptyOptions);

            return(true);
        }
예제 #4
0
        private void initialPage()
        {
            lbCommandName.Text = CommandName.ToString();

            switch (CommandName)
            {
            case CommandNameEnum.Add:
                txtName.Enabled   = true;
                btnSave.Enabled   = true;
                btnCancel.Enabled = true;

                break;

            case CommandNameEnum.Edit:
                fillinScreen();

                txtName.Enabled   = true;
                btnSave.Enabled   = true;
                btnCancel.Enabled = true;


                break;

            case CommandNameEnum.View:
                fillinScreen();

                txtName.Enabled   = false;
                btnSave.Enabled   = false;
                btnCancel.Enabled = true;

                break;
            }
        }
예제 #5
0
        private void initialPage()
        {
            lbCommandName.Text = CommandName.ToString();

            switch (CommandName)
            {
            case CommandNameEnum.Add:
                //txtPathSourceFile.ReadOnly = true;
                btnSave.Enabled   = true;
                btnCancel.Enabled = true;
                break;

            case CommandNameEnum.Edit:
                fillinScreen();
                //txtPathSourceFile.ReadOnly = true;
                btnSave.Enabled   = true;
                btnCancel.Enabled = true;
                break;

            case CommandNameEnum.View:
                fillinScreen();
                //txtPathSourceFile.ReadOnly = false;
                btnSave.Enabled   = false;
                btnCancel.Enabled = true;
                break;
            }
        }
예제 #6
0
        /// <summary>
        /// Reports that the given command is starting its execution, typically to be called right at the
        /// begining of the command's handler method.
        /// </summary>
        /// <param name="command">The name of the command. Must not be null.</param>
        /// <param name="invocationSource">From where the command was invoked.</param>
        public static void ReportCommand(CommandName command, CommandInvocationSource invocationSource)
        {
            ActivityLogUtils.LogInfo($"Reporting: Starting command {command} from source {invocationSource}");

            s_reporter.Value?.ReportEvent(
                category: command.ToString(),
                action: invocationSource.ToString());
        }
예제 #7
0
 public CommandDefinition GetCommand(CommandName commandName)
 {
     if (!_commandDefinitions.ContainsKey(commandName))
     {
         throw new ArgumentException("Command code '" + commandName.ToString() + "' not found.");
     }
     return(_commandDefinitions[commandName]);
 }
 public virtual IDictionary <string, string> ToDictionary()
 {
     return(new Dictionary <string, string>()
     {
         { "commandName", CommandName.ToString() },
         { "message", Message.ToString() },
         { "stackTrace", StackTrace.ToString() }
     });
 }
예제 #9
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(CommandName.ToString());

            if (null != arguments && (arguments.Count > 0))
            {
                foreach (object argument in arguments)
                {
                    builder.Append(textDelimiter.ToString());
                    switch (argument.GetType().ToString())
                    {
                    case "System.Boolean":
                        builder.Append("b:" + argument.ToString());
                        break;

                    case "System.Double":
                        double value = ((double)argument);
                        builder.Append("d:" + value.ToString("0.0#######"));
                        break;

                    case "System.Int32":
                        builder.Append("i:" + argument.ToString());
                        break;

                    case "System.String":
                        string transformed = argument as string;
                        // @TODO(Zx): We should never have to worry about '\r'.
                        transformed = transformed.Replace("\r\n", "\\n");
                        transformed = transformed.Replace("\n\r", "\\n");
                        transformed = transformed.Replace("\n", "\\n");
                        builder.Append("s:" + transformed);
                        break;

                    case "System.UInt32":
                        uint unsignedValue = ((uint)argument);
                        builder.Append("u:0x" + unsignedValue.ToString("x8"));
                        break;

                    default:
                    {
                        if (argument is System.Enum)
                        {
                            builder.Append(string.Format("e:{0},{1}",
                                                         argument.GetType().FullName, argument.ToString()));
                            break;
                        }

                        throw new InvalidOperationException("Unhandled argument type");
                    }
                    }
                }
            }

            return(builder.ToString());
        }
예제 #10
0
        private void initialPage()
        {
            lbCommandName.Text = CommandName.ToString();


            m_specification specification = new m_specification();

            ddlSpecification.Items.Clear();
            ddlSpecification.DataSource = specification.SelectAll();
            ddlSpecification.DataBind();
            ddlSpecification.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, ""));
            m_template template = new m_template();

            ddlPathUrl.Items.Clear();
            ddlPathUrl.DataSource = template.SelectAllByActive();
            ddlPathUrl.DataBind();
            ddlPathUrl.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, ""));



            switch (CommandName)
            {
            case CommandNameEnum.Add:
                ddlSpecification.Enabled = true;
                txtPrefix.Enabled        = true;
                txtName.Enabled          = true;

                btnSave.Enabled   = true;
                btnCancel.Enabled = true;

                break;

            case CommandNameEnum.Edit:
                fillinScreen();

                ddlSpecification.Enabled = true;
                txtPrefix.Enabled        = true;
                txtName.Enabled          = true;

                btnSave.Enabled   = true;
                btnCancel.Enabled = true;


                break;

            case CommandNameEnum.View:
                fillinScreen();

                ddlSpecification.Enabled = false;
                txtPrefix.Enabled        = false;
                txtName.Enabled          = false;
                btnSave.Enabled          = false;
                btnCancel.Enabled        = true;

                break;
            }
        }
예제 #11
0
        private GenericCommandName ConvertCommandNameToGenericCommandName(CommandName commandName)
        {
            if (!_commandNameToGenericCommandName.ContainsKey(commandName))
            {
                throw new ArgumentException($"Unable to convert {commandName.ToString()} to a GenericCommandName.", nameof(commandName));
            }

            return(_commandNameToGenericCommandName[commandName]);
        }
        /// <summary>
        /// Serializes the response to a dictionary. It should be treated as an opaque serialization format to be
        /// deserialized with <see cref="TryDeserializeFromValueSet"/>.
        /// </summary>
        public void SerializeToValueSet(IDictionary <string, object> valueSet)
        {
            valueSet.Add(ParamName.CommandName.ToString(), CommandName.ToString());
            valueSet.Add(ParamName.CommandResult.ToString(), Result);
            valueSet.Add(ParamName.ErrorCode.ToString(), ErrorCode.ToString());

            if (ErrorCode != ServiceCommandErrorCode.Success)
            {
                valueSet.Add(ParamName.ErrorMessage.ToString(), ErrorMessage);
            }
        }
예제 #13
0
        private void initialPage()
        {
            lbCommandName.Text = CommandName.ToString();

            switch (CommandName)
            {
            case CommandNameEnum.Add:
                txtName.Enabled   = true;
                btnSave.Enabled   = true;
                btnCancel.Enabled = true;

                break;

            case CommandNameEnum.Edit:
                fillinScreen();

                txtName.Enabled   = true;
                btnSave.Enabled   = true;
                btnCancel.Enabled = true;


                break;

            case CommandNameEnum.View:
                fillinScreen();

                txtName.Enabled   = false;
                btnSave.Enabled   = false;
                btnCancel.Enabled = true;
                //

                break;
            }


            menu_role menuRoleBiz = new menu_role();
            MenuBiz   menuBiz     = new MenuBiz();

            List <menu_role> _menuRoles = menuRoleBiz.getRoleListByRoleId(PKID);

            menuBiz.getmenuByTree(ref this.tvPermission, _menuRoles);
        }
예제 #14
0
    //操作事件--接收档案
    protected void LinkButtonALL_Command(object sender, CommandEventArgs e)
    {
        string CommandName;

        string[] CurrentValueId;
        CurrentValueId = e.CommandArgument.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        CommandName    = e.CommandName;
        //接收档案
        if (CommandName.ToString() == "FileTransfer")
        {
            DataRow drdg = fedal.GetRow(CurrentValueId[1]);
            if (drdg != null)
            {
                ArrayList alsql  = new ArrayList();
                string    sqlStr = ""; //接收移交记录
                sqlStr = " update FileTransfer set  sjzt=2,Jssj='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',AcceptPeople='" + LoginUser.GetUserName + "',AcceptUnit='" + LoginUser.OrganizerName + "' where id='" + CurrentValueId[0] + "' ";
                alsql.Add(sqlStr);
                string strupdate = ""; //接收更新档案状态
                strupdate = " update FileEnter set  ReceiptTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',oldEnteCountyId='" + drdg["EnteCountyId"] + "',oldEnteUserName='******',EnteCountyId='" + LoginUser.CountyId + "',EnteUserName='******',EnforcementID_new='" + LoginUser.OrganizerId + "',EnforcementName_new='" + LoginUser.OrganizerName + "',FileLibraryID_old='" + drdg["FileLibraryID"] + "',FileLibraryName_old='" + drdg["FileLibraryName"] + "',FileLibraryID='',FileLibraryName='',FileTransferSJLX=1,FileTransferID='" + CurrentValueId[0] + "'  where id='" + CurrentValueId[1] + "' ";
                alsql.Add(strupdate);
                Boolean flag = TSQLServer.execTriggerAll(alsql);
                if (flag == true)
                {
                    new MessageBox(Page).ShowAndJump("执法档案接收成功!", "Manage_Center.aspx");
                    //操作日志
                    LogListDal.Insert(DateTime.Now, "接收执法档案" + CurrentValueId[0] + "", LoginUser.GetUserId, LoginUser.GetUserName);
                }
                else
                {
                    new MessageBox(Page).ShowAndJump("执法档案接收失败!", "Manage_Center.aspx");
                }
            }
            else
            {
                new MessageBox(Page).ShowAndJump("执法档案接收失败!", "Manage_Center.aspx");
            }
        }
    }
예제 #15
0
        private void initialPage()
        {
            lbCommandName.Text       = CommandName.ToString();
            this.List                = new List <m_customer_contract_person>();
            this.ListCustomerAddress = new List <m_customer_address>();
            switch (CommandName)
            {
            case CommandNameEnum.Add:

                btnSave.Enabled   = true;
                btnCancel.Enabled = true;


                break;

            case CommandNameEnum.Edit:
                fillinScreen();


                btnSave.Enabled   = true;
                btnCancel.Enabled = true;


                break;

            case CommandNameEnum.View:
                fillinScreen();

                btnSave.Visible   = false;
                btnCancel.Enabled = true;
                //
                btnAdd.Visible = false;
                btnAddCustomerAddress.Visible = false;
                txtCompanyName.ReadOnly       = true;
                break;
            }
        }
예제 #16
0
        private void AnalizeRotCommand(CommandName CurCommand, byte[] bBuf)
        {
            int index = 0;

            switch (CurCommand)
            {
                case CommandName.GetStatus:
                    {
                        byte MainWrk = bBuf[index++];
                        if (_devStatus == null)
                            _devStatus = new DevStatus();

                        _devStatus.MainWrk = MainWrk;

                        if(bBuf.Length<=index) break;
                        bool FlagWrk = ((bBuf[index++] != 0) ? true : false);
                        DevStatus _curStatus = new DevStatus();

                        _curStatus.MainWrk = MainWrk;
                        _curStatus.FlagWrk = FlagWrk;

                        try
                        {
                            UInt32 iButton = bBuf[index++]; iButton <<= 8;
                            iButton |= bBuf[index++]; iButton <<= 8;
                            iButton |= bBuf[index++]; iButton <<= 8;
                            iButton |= bBuf[index++];

                            for (int i = 0; i < 30; i++)
                                _curStatus.bufRButton[i].IsActive = ((iButton & (1 << i)) != 0) ? true : false;

                            iButton = bBuf[index++];
                            for (int i = 0; i < 4; i++)
                                _curStatus.bufCButton[i].IsActive = ((iButton & (1 << i)) != 0) ? true : false;
                            _curStatus.LightStatus = new byte[30+8];

                            for (int i = 0; i < 30;i++)
                            {
                                _curStatus.LightStatus[i] = (byte)(_curStatus.bufRButton[i].IsActive ? 1 : 0);
                            }

                            _curStatus.CancelButton = bBuf[index++];

                            uint tButton = bBuf[index++]; tButton <<= 8;
                            tButton |= bBuf[index++]; tButton <<= 8;
                            tButton |= bBuf[index++]; tButton <<= 8;
                            tButton |= bBuf[index++];
                            _curStatus.TmpMaskRoomKey = tButton;
                            _curStatus.TmpMaskConfKey = bBuf[index++];

                        }
                        catch
                        {

                        }

                        if (eStatus != null)
                            eStatus(_curStatus);

                        AnalizeChangeKey(_curStatus);
                        _devStatus = _curStatus;
                    }
                    break;

                default:
                    {
                        string str = "";
                        byte[] bbb = new byte[4];
                        bbb[0] = bBuf[index++];
                        bbb[1] = bBuf[index++];
                        bbb[2] = bBuf[index++];
                        bbb[3] = bBuf[index++];

                        for (int i = 0; i < bbb.Length; i++)
                            str += bbb[i].ToString() + " ";

                        Console.WriteLine("Unknown com =" + CurCommand.ToString() + " " + str);
                    }
                    break;
            }

            if(lst_WaitCommand.Count!=0)
            {
                var x = lst_WaitCommand.Where(p => p._com_name == CurCommand).ToList();
                foreach (var commandExch in x)
                {
                    if (commandExch.evHand != null)
                        commandExch.evHand(null, null);
                }

                lst_WaitCommand = lst_WaitCommand.Where(p => p._com_name != CurCommand).ToList();

            }
        }
예제 #17
0
 public override string ToString()
 => CommandName.ToString();
예제 #18
0
        public static SMB1Command ReadCommandRequest(byte[] buffer, int offset, CommandName commandName, bool isUnicode)
        {
            switch (commandName)
            {
            case CommandName.SMB_COM_CREATE_DIRECTORY:
                return(new CreateDirectoryRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_DELETE_DIRECTORY:
                return(new DeleteDirectoryRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_CLOSE:
                return(new CloseRequest(buffer, offset));

            case CommandName.SMB_COM_FLUSH:
                return(new FlushRequest(buffer, offset));

            case CommandName.SMB_COM_DELETE:
                return(new DeleteRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_RENAME:
                return(new RenameRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_QUERY_INFORMATION:
                return(new QueryInformationRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_SET_INFORMATION:
                return(new SetInformationRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_READ:
                return(new ReadRequest(buffer, offset));

            case CommandName.SMB_COM_WRITE:
                return(new WriteRequest(buffer, offset));

            case CommandName.SMB_COM_CHECK_DIRECTORY:
                return(new CheckDirectoryRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_WRITE_RAW:
                return(new WriteRawRequest(buffer, offset));

            case CommandName.SMB_COM_SET_INFORMATION2:
                return(new SetInformation2Request(buffer, offset));

            case CommandName.SMB_COM_LOCKING_ANDX:
                return(new LockingAndXRequest(buffer, offset));

            case CommandName.SMB_COM_TRANSACTION:
                return(new TransactionRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_TRANSACTION_SECONDARY:
                return(new TransactionSecondaryRequest(buffer, offset));

            case CommandName.SMB_COM_ECHO:
                return(new EchoRequest(buffer, offset));

            case CommandName.SMB_COM_OPEN_ANDX:
                return(new OpenAndXRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_READ_ANDX:
                return(new ReadAndXRequest(buffer, offset));

            case CommandName.SMB_COM_WRITE_ANDX:
                return(new WriteAndXRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_TRANSACTION2:
                return(new Transaction2Request(buffer, offset, isUnicode));

            case CommandName.SMB_COM_TRANSACTION2_SECONDARY:
                return(new Transaction2SecondaryRequest(buffer, offset));

            case CommandName.SMB_COM_FIND_CLOSE2:
                return(new FindClose2Request(buffer, offset));

            case CommandName.SMB_COM_TREE_DISCONNECT:
                return(new TreeDisconnectRequest(buffer, offset));

            case CommandName.SMB_COM_NEGOTIATE:
                return(new NegotiateRequest(buffer, offset));

            case CommandName.SMB_COM_SESSION_SETUP_ANDX:
            {
                byte wordCount = ByteReader.ReadByte(buffer, offset);
                if (wordCount * 2 == SessionSetupAndXRequest.ParametersLength)
                {
                    return(new SessionSetupAndXRequest(buffer, offset, isUnicode));
                }
                else if (wordCount * 2 == SessionSetupAndXRequestExtended.ParametersLength)
                {
                    return(new SessionSetupAndXRequestExtended(buffer, offset, isUnicode));
                }
                else
                {
                    throw new InvalidRequestException();
                }
            }

            case CommandName.SMB_COM_LOGOFF_ANDX:
                return(new LogoffAndXRequest(buffer, offset));

            case CommandName.SMB_COM_TREE_CONNECT_ANDX:
                return(new TreeConnectAndXRequest(buffer, offset, isUnicode));

            case CommandName.SMB_COM_NT_TRANSACT:
                return(new NTTransactRequest(buffer, offset));

            case CommandName.SMB_COM_NT_TRANSACT_SECONDARY:
                return(new NTTransactSecondaryRequest(buffer, offset));

            case CommandName.SMB_COM_NT_CREATE_ANDX:
                return(new NTCreateAndXRequest(buffer, offset, isUnicode));

            default:
                throw new NotImplementedException("SMB Command 0x" + commandName.ToString("X"));
            }
        }
예제 #19
0
        private void initialPage()
        {
            lbCommandName.Text = CommandName.ToString();
            m_role role = new m_role();

            ddlRole.Items.Clear();
            ddlRole.DataSource = role.SelectAll();
            ddlRole.DataBind();
            ddlRole.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, ""));

            m_title title = new m_title();

            ddlTitle.Items.Clear();
            ddlTitle.DataSource = title.SelectAll();
            ddlTitle.DataBind();
            ddlTitle.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, ""));



            lstTypeOfTest.Items.Clear();
            lstTypeOfTest.DataSource = new m_type_of_test().SelectDistinct();
            lstTypeOfTest.DataBind();
            lstTypeOfTest.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, ""));

            switch (CommandName)
            {
            case CommandNameEnum.Add:

                ddlRole.Enabled      = true;
                txtUser.Enabled      = true;
                txtPassword.Enabled  = true;
                txtEmail.Enabled     = true;
                ddlTitle.Enabled     = true;
                txtFirstName.Enabled = true;
                txtLastName.Enabled  = true;

                btnSave.Enabled   = true;
                btnCancel.Enabled = true;


                break;

            case CommandNameEnum.Edit:
                fillinScreen();
                ddlRole.Enabled      = true;
                txtUser.Enabled      = false;
                txtPassword.Enabled  = true;
                txtEmail.Enabled     = true;
                ddlTitle.Enabled     = true;
                txtFirstName.Enabled = true;
                txtLastName.Enabled  = true;

                btnSave.Enabled   = true;
                btnCancel.Enabled = true;


                break;

            case CommandNameEnum.View:
                fillinScreen();
                ddlRole.Enabled      = false;
                txtUser.Enabled      = false;
                txtPassword.Enabled  = false;
                txtEmail.Enabled     = false;
                ddlTitle.Enabled     = false;
                txtFirstName.Enabled = false;
                txtLastName.Enabled  = false;

                btnSave.Enabled   = false;
                btnCancel.Enabled = true;

                break;
            }
        }
예제 #20
0
 public override string ToString()
 {
     return($"CommandName: {(CommandName!=null? CommandName.ToString(): "")}, CharName {(Character!=null? Character.ToString(): "") }, ImageName: {(ImageName!=null? ImageName.ToString() : "")}, Expression: {(Expression!=null? Expression.ToString(): "")}, StagePosition: {(Position!=null? Position.ToString():"")}, Args: {(Args!=null? Args.ToString():"")}");
 }