コード例 #1
0
ファイル: BelchPlugin.cs プロジェクト: detmach/SharpIrcBot
        public BelchPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("belch"),
                    CommandUtil.NoOptions,
                    CommandUtil.NoArguments,
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleBelchCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("skittles"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(RestTaker.Instance),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleSkittlesCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("tel"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(RestTaker.Instance),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleTelCommand
                );
        }
コード例 #2
0
        protected virtual void ReregisterCommands()
        {
            var currentCommandCopy = new List <Command>(CurrentCommands);

            foreach (Command command in currentCommandCopy)
            {
                ConnectionManager.CommandManager.UnregisterChannelMessageCommandHandler(
                    command,
                    HandleCounterCommand
                    );
                CurrentCommands.Remove(command);
            }

            foreach (Counter counter in Config.Counters)
            {
                var command = new Command(
                    CommandUtil.MakeNames(counter.CommandName),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(RestTaker.Instance),
                    forbiddenFlags: MessageFlags.UserBanned
                    );
                ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                    command,
                    HandleCounterCommand
                    );
                CurrentCommands.Add(command);
            }
        }
コード例 #3
0
        public override string ToString()
        {
            string fieldValue = string.Empty;

            //判断类型
            if (this._value.GetType() == typeof(string))
            {
                fieldValue = this._value.ToString();
            }
            if (this._value.GetType() == typeof(bool))
            {
                fieldValue = CommandUtil.GetBooleanString(Convert.ToBoolean(this._value));
            }

            //是否是固定宽度
            if (_isFixed)
            {
                if (fieldValue.Length < FixedLength)
                {
                    fieldValue = fieldValue.PadRight(FixedLength, ' ');
                }
                else
                {
                    throw new ParameterException($"fixed field value {fieldValue} length is more then fixed length {FixedLength}");
                }
            }

            return($"{this.ID ?? string.Empty}{fieldValue}{this.Split ?? string.Empty}");
        }
コード例 #4
0
        public IKnewThatPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new IKnewThatConfig(config);

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("iknewthat"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker // keyword
                        ),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleIKnewThatChannelCommand
                );
            ConnectionManager.CommandManager.RegisterQueryMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("iknowthat"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker, // keyword
                        RestTaker.Instance                                 // description
                        ),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleIKnowThatQueryCommand
                );
        }
コード例 #5
0
        public byte[] ToBytes()
        {
            byte[] bytes = null;
            byte   startindex;

            bytes    = new byte[14 + GradingAlarmItems.Count];
            bytes[0] = 0x3E;
            bytes[1] = 0xE3;
            bytes[2] = 0x80;
            bytes[3] = 0x08;
            bytes[4] = (byte)def.Fzh;
            bytes[5] = 0x56;
            CommandUtil.ConvertInt16ToByte((ushort)(bytes.Length - 4), bytes, 6, false);//长度,6,7
            bytes[8]   = (byte)(this.LastAcceptFlag);
            bytes[9]   = (byte)GradingAlarmItems.Count;
            startindex = 10;
            if (GradingAlarmItems != null)
            {
                for (int i = 0; i < GradingAlarmItems.Count; i++)
                {
                    bytes[startindex++] = (byte)(byte.Parse(GradingAlarmItems[i].Channel) + (GradingAlarmItems[i].AlarmStep << 5));
                }
            }
            CommandUtil.AddSumToBytes(bytes, 4, bytes.Length);//累加和
            return(bytes);
        }
コード例 #6
0
        public byte[] ToBytes()
        {
            byte[] buffer = new byte[11];
            int    index  = 0;

            buffer[index] = (byte)def.Fzh;                             //分站号
            index++;
            buffer[index] = (byte)(((buffer.Length - 3) >> 8) & 0xFF); //长度高
            index++;
            buffer[index] = (byte)((buffer.Length - 3) & 0xFF);        //长度低
            index++;
            buffer[index] = 0x44;                                      //D命令
            index++;
            buffer[index] = 0x07;                                      //标志位4、3、2、1位 =3表示分站远程升级相关命令;第0位=1表示接收正确
            index++;
            buffer[index] = 0x06;                                      //状态标志位
            index++;
            //buffer[index] = DeviceId; //设备编码
            //index++;
            //buffer[index] = HardVersion;   //硬件版本号
            //index++;
            //buffer[index] = FileVersion;  //升级文件版本号
            buffer[index] = 0;                                   //设备编码
            index++;
            buffer[index] = 0;                                   //硬件版本号
            index++;
            buffer[index] = 0;                                   //升级文件版本号

            CommandUtil.AddSumToBytes(buffer, 0, buffer.Length); //累加和

            return(buffer);
        }
コード例 #7
0
        public LinkInfoPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new LinkInfoConfig(config);
            IDNMapping        = new IdnMapping();
            Plugins           = new List <ILinkResolverPlugin>();

            LastLinkAndInfo = null;
            LinkDetector    = null;

            ConnectionManager.ChannelMessage         += HandleChannelMessage;
            ConnectionManager.OutgoingChannelMessage += HandleOutgoingChannelMessage;
            ConnectionManager.SplitToChunks          += HandleSplitToChunks;

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("ll", "lastlink"),
                    CommandUtil.NoOptions,
                    CommandUtil.NoArguments,
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleLastLinkCommand
                );

            RepopulatePluginList();
        }
コード例 #8
0
 /// <summary>
 /// prepares the nuGet exe path if it has not been set yet
 /// </summary>
 /// <returns>true if the nuGet exe path needed to be set, false otherwise</returns>
 private bool PrepareNuGetExePath()
 {
     //-----try to get the nuGet exe path from command line as long as its not set
     if (string.IsNullOrEmpty(_configuration.GeneralOptions.NuGetOptions.ExePath))
     {
         string result = null;
         string error  = null;
         try
         {
             CommandUtil.ExecuteCommand("where nuget", new string[] { "/C" }, out result, out error);
             if (result != null && result.EndsWith("\r\n"))
             {
                 result = result.Replace("\r\n", "");
             }
         }
         catch (Exception ex) { LoggingManager.Instance.Logger.Error(ex); }
         //-----set path and save settings if found
         if (!string.IsNullOrEmpty(result))
         {
             _configuration.GeneralOptions.NuGetOptions.ExePath = result;
             return(true);
         }
     }
     return(false);
 }
コード例 #9
0
ファイル: CommandBlock.cs プロジェクト: pca006132/pcb
        public override string ToString()
        {
            string block = "";

            switch (cbType)
            {
            case type.rcb:
                block = "repeating_command_block";
                break;

            case type.ccb:
                block = "chain_command_block";
                break;

            case type.icb:
                block = "command_block";
                break;
            }
            string cmd = command;

            if (CommandUtil.needEscape(command))
            {
                cmd = "\"" + CommandUtil.escape(cmd) + "\"";
            }
            return(String.Format("setblock ~{0} ~{1} ~{2} {3} {4} replace {{Command:{5}{6}}}", relativeX, relativeY, relativeZ, block, damage + (isCond ? 8 : 0), cmd, (isAuto ? ",auto:1b" : "")));
        }
コード例 #10
0
        private int SetChouFDefine(byte[] bytes, int index)
        {
            List <DeviceInfo> items;                                                                //测点设备集合
            ushort            ljlDefine          = 0;
            ushort            analogderaildefine = CommandUtil.ConvertByteToInt16(bytes, 9, false); //定义的模开控

            for (int i = 0; i < 16; i++)
            {
                if ((analogderaildefine & (1 << i)) == (1 << i))//此设备有定义
                {
                    items = DeviceListItem.FindAll(delegate(DeviceInfo p) { return(p.Fzh == def.Fzh && p.Kh == i + 1 && ((p.DevPropertyID == 1 || p.DevPropertyID == 2) || (p.DevPropertyID == 3 && p.Dzh != 0))); });
                    if (items == null || items.Count == 0 || items.Count > 1)
                    {//表示前面有这个测点现在没有这个测点了,此时,把对应的定义标记设置为0
                        continue;
                    }
                    if (items[0].Bz20 == "1")
                    {
                        ljlDefine += (ushort)(1 << i);
                    }
                }
            }
            CommandUtil.ConvertInt16ToByte(ljlDefine, bytes, index, false);

            index += 2;
            return(index);
        }
コード例 #11
0
ファイル: TriviaPlugin.cs プロジェクト: detmach/SharpIrcBot
        public TriviaPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new TriviaConfig(config);
            GameState         = null;
            Randomizer        = new Random();

            ConnectionManager.ChannelMessage  += HandleChannelMessage;
            ConnectionManager.BaseNickChanged += HandleBaseNickChanged;

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("question"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleQuestionCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("starttrivia"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleStartTriviaCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("stoptrivia"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleStopTriviaCommand
                );
        }
コード例 #12
0
        public AlsoKnownAsPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new AlsoKnownAsConfig(config);

            HostToNicks          = new DrillDownTree <string, HashSet <string> >();
            NickToMostRecentHost = new Dictionary <string, UserIdentifier>(StringComparer.OrdinalIgnoreCase);

            var akaCommand = new Command(
                CommandUtil.MakeNames("aka"),
                CommandUtil.NoOptions,
                CommandUtil.MakeArguments(
                    CommandUtil.NonzeroStringMatcherRequiredWordTaker // nickname
                    ),
                forbiddenFlags: MessageFlags.UserBanned
                );

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                akaCommand, HandleChannelAka
                );
            ConnectionManager.CommandManager.RegisterQueryMessageCommandHandler(
                akaCommand, HandleQueryAka
                );

            ConnectionManager.JoinedChannel += HandleJoinedChannel;
            ConnectionManager.NickChange    += HandleNickChange;
            ConnectionManager.RawMessage    += HandleRawMessage;
        }
コード例 #13
0
 public byte[] ToBytes()
 {
     byte[] bytes = null;
     bytes = GetControlBufferCapacity();
     CommandUtil.AddSumToBytes(bytes, 4, bytes.Length);//累加和
     return(bytes);
 }
        public byte[] ToBytes()
        {
            byte[] bytes = new byte[19];
            int    j     = 0;

            bytes[0] = 0x3E;
            bytes[1] = 0xE3;
            bytes[2] = 0x80;
            bytes[3] = 0x08;
            bytes[4] = (byte)def.Fzh;
            bytes[5] = 0x50;
            CommandUtil.ConvertInt16ToByte(15, bytes, 6, false);//长度,6,7
            bytes[8] = LastAcceptFlag;

            j          = (ushort)(this.SyncTime.Year - 2000);
            bytes[9]   = (byte)j;
            bytes[10]  = (byte)(this.SyncTime.Month);
            bytes[10] += (Byte)(((byte)this.SyncTime.DayOfWeek) << 5);
            bytes[11]  = (byte)this.SyncTime.Day;
            bytes[12]  = (byte)this.SyncTime.Hour;
            bytes[13]  = (byte)this.SyncTime.Minute;
            bytes[14]  = (byte)this.SyncTime.Second;
            CommandUtil.AddSumToBytes(bytes, 4, bytes.Length);//累加和
            return(bytes);
        }
コード例 #15
0
        public TimePlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new TimeConfig(config);

            LoadTimeZoneData();

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("time", "ltime"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        RestTaker.Instance // location
                        ),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleTimeCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("interval"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        RestTaker.Instance // date/time
                        ),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleIntervalCommand
                );
        }
コード例 #16
0
        public AllographPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager   = connMgr;
            Config              = new AllographConfig(config);
            Random              = new Random();
            CooldownsPerChannel = new Dictionary <string, List <int> >();
            ReplacerRegexes     = new List <ReplacerRegex>();

            RecompileReplacerRegexes();

            ConnectionManager.ChannelMessage += HandleChannelMessage;

            ConnectionManager.CommandManager.RegisterQueryMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("allostats"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        new RegexMatcher("^[#&]\\S{1,256}$").ToRequiredWordTaker(), // channel name
                        RestTaker.Instance                                          // test message (optional)
                        ),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleAlloStatsCommand
                );
        }
コード例 #17
0
ファイル: CommandMain.cs プロジェクト: spedyte/DesignPatterns
        public void Run()
        {
            CommandManager commandManager = CommandManager.getManager();

            while (true)
            {
                string newLine = System.Console.ReadLine();
                if (string.IsNullOrEmpty(newLine.Trim()))
                {
                    continue;
                }

                string[] commandArgs  = CommandUtil.tokenizerArgs(newLine);
                string   commandName  = commandArgs[0];
                string[] commandArgs2 = null;
                if (commandArgs.Length > 1)
                {
                    List <string> paramsL = new List <string>();
                    for (int i = 1; i < commandArgs.Length; i++)
                    {
                        paramsL.Add(commandArgs[i]);
                    }
                    commandArgs2 = paramsL.ToArray();
                }

                ICommand command = commandManager.GetCommand(commandName);
                command.execute(commandArgs2);
            }
        }
コード例 #18
0
        private int SetLjlValue(byte[] bytes, int index)
        {
            ushort shrtvalue = 0xFFFF;

            byte[] fbyte;
            float  flt;

            CommandUtil.ConvertInt16ToByte(shrtvalue, bytes, index, false);
            index += 2;
            string[] str;
            if (def.Bz6 != null && def.Bz6 != "")
            {
                str = def.Bz6.Split('|');
                for (int i = 0; i < str.Length; i++)
                {
                    flt   = Convert.ToSingle(str[i]);
                    fbyte = BitConverter.GetBytes(flt);
                    Buffer.BlockCopy(bytes, index, fbyte, 0, 4);
                    index += 4;
                    if (i >= 15)
                    {
                        break;
                    }
                }
            }
            return(index);
        }
コード例 #19
0
ファイル: DeployWorker.cs プロジェクト: potatopp/NuGetDeploy
        /// <summary>
        /// pushes the nuPkg file to the given url
        /// </summary>
        /// <returns>true if the push was successfull, false otherwise</returns>
        private void PushNuGetPackage(string url, string apiKey, string nuPkgFilePath)
        {
            LoggingManager.Instance.Logger.Debug("pushing nupkg file");

            //-----push the nuPkg file to the server
            string result;
            string error;
            string command = string.Format(@" ""{0}"" push ""{1}"" -source ""{2}"" ""{3}"" ",
                                           OptionsManager.Instance.Configuration.GeneralOptions.NuGetOptions.ExePath,
                                           nuPkgFilePath,
                                           url,
                                           apiKey);

            LoggingManager.Instance.Logger.Debug(string.Format("Executing command [{0}]", command));
            CommandUtil.ExecuteCommand(command, new string[] { "/C" }, out result, out error);

            //-----show a message about success or error
            if (!string.IsNullOrEmpty(error))
            {
                throw new PublishNuGetPackageFailedExceptions(string.Format("An Error occured while deploying the nuPkg file: {0}", error));
            }

            //-----delete the nuPkg file is possible
            try
            {
                File.Delete(nuPkgFilePath);
            }
            catch (Exception ex)
            {
                LoggingManager.Instance.Logger.Warn(ex);
            }
            LoggingManager.Instance.Logger.Debug("pushing nupkg file finished");
        }
コード例 #20
0
        public CasinoPlayerBotPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new PlayerConfig(config);
            Dispatcher        = new EventDispatcher();
            State             = new BlackjackState();
            Randomizer        = new Random();
            CardCounter       = TabularCardCounter.Zen.Value;
            AssistPlayers     = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            StrategyDebuggers = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            ConnectionManager.ChannelMessage += HandleChannelMessage;
            ConnectionManager.QueryMessage   += HandleQueryMessage;
            ConnectionManager.QueryNotice    += HandleQueryNotice;

            ConnectionManager.CommandManager.RegisterQueryMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("casinoassist", "nocasinoassist"),
                    CommandUtil.NoOptions,
                    CommandUtil.NoArguments
                    ),
                HandleCasinoAssistCommand
                );
            ConnectionManager.CommandManager.RegisterQueryMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("stratdebug", "nostratdebug"),
                    CommandUtil.NoOptions,
                    CommandUtil.NoArguments
                    ),
                HandleStratDebugCommand
                );
        }
        public byte[] ToBytes()
        {
            byte[] bytes      = null;
            int    SoleCoding = 0;

            bytes    = new byte[18];
            bytes[0] = 0x5A;
            bytes[1] = 0xA5;
            bytes[2] = 0x7E;
            bytes[3] = 0xE7;
            bytes[4] = (byte)def.Fzh;
            bytes[5] = 0x58;
            CommandUtil.ConvertInt16ToByte((ushort)(bytes.Length - 4), bytes, 6); //长度,6,7
            bytes[8] = (byte)(this.LastAcceptFlag + 0x04);
            bytes[9] = RandomCode;                                                //随机数
            if (ModificationItems.Count > 0)
            {
                int tempInt = ModificationItems[0].DeviceType;                           //todo:服务端下发时填大类
                SoleCoding += (tempInt << 24);                                           //设备大类
                tempInt     = Convert.ToInt32(ModificationItems[0].SoleCoding.Substring(0, 4));
                SoleCoding += ((tempInt - 2018) << 19);                                  //年
                tempInt     = Convert.ToInt32(ModificationItems[0].SoleCoding.Substring(4, 2));
                SoleCoding += (tempInt << 15);                                           //月
                tempInt     = Convert.ToInt32(ModificationItems[0].SoleCoding.Substring(6, 2));
                SoleCoding += (tempInt << 10);                                           //日
                tempInt     = Convert.ToInt32(ModificationItems[0].SoleCoding.Substring(8, 4));
                SoleCoding += tempInt;                                                   //序列号
                CommandUtil.ConvertInt32ToByte(Convert.ToUInt32(SoleCoding), bytes, 10); //610  11  12  13
                bytes[14] = ModificationItems[0].BeforeModification;
                bytes[15] = ModificationItems[0].AfterModification;
            }
            CommandUtil.CRC16_CCITT(bytes, 4, bytes.Length - 2);//累加和
            return(bytes);
        }
コード例 #22
0
 protected virtual void Close(IDbCommand cmd)
 {
     try {
         CommandUtil.Close(cmd);
     } catch (Exception e) {
         HandleDbException(e, cmd);
     }
 }
コード例 #23
0
        public override void Execute(ActionContext context)
        {
            string itemId = System.Web.HttpContext.Current.Request.QueryString["id"];

            Item contentItem = EventManager.ItemUtil.GetContentItem(Guid.Parse(itemId));


            CommandUtil.OpenPageEditor(context.Owner.Page, contentItem);
        }
コード例 #24
0
            public override void Process(CmdTrigger <AuthServerCmdArgs> trigger)
            {
                var cfg = CommandUtil.GetConfig(AuthServerConfiguration.Instance, trigger);

                if (cfg != null)
                {
                    CommandUtil.ListCfgValues(cfg, trigger);
                }
            }
コード例 #25
0
        public DicePlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new DiceConfig(config);
            RNG               = new Random();
            CryptoRNG         = new CryptoRandom();
            ChannelToCooldown = new Dictionary <string, CooldownState>();

            ImmutableList <KeyValuePair <string, IArgumentTaker> > cryptoOption =
                CommandUtil.MakeOptions(
                    CommandUtil.MakeFlag("--crypto")
                    )
            ;

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("roll"),
                    cryptoOption,
                    CommandUtil.MakeArguments(new MultiMatchTaker(RollRegex, RollSeparatorRegex, 1)),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleRollCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("yn"),
                    cryptoOption,
                    CommandUtil.MakeArguments(RestTaker.Instance),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleYesNoCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("decide"),
                    cryptoOption,
                    CommandUtil.MakeArguments(RestTaker.Instance),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleDecideCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("shuffle"),
                    cryptoOption,
                    CommandUtil.MakeArguments(RestTaker.Instance),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleShuffleCommand
                );
            ConnectionManager.ChannelMessage += HandleChannelMessage;
        }
コード例 #26
0
            public override void Process(CmdTrigger <AuthServerCmdArgs> trigger)
            {
                var cfg = CommandUtil.GetConfig(AuthServerConfiguration.Instance, trigger);

                if (cfg != null)
                {
                    cfg.Load();
                    trigger.Reply("Done.");
                }
            }
コード例 #27
0
        public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
        {
            if (buildTarget != BuildTarget.Android)
            {
                return;
            }

            // open project dir
            CommandUtil.ExecuteCommand("explorer " + path);
        }
コード例 #28
0
ファイル: AdminCommands.cs プロジェクト: 0xFh/Asda2-Project
        public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
        {
            var cfg = CommandUtil.GetConfig(RealmServerConfiguration.Instance, trigger);

            if (cfg != null)
            {
                cfg.Save(true, false);
                trigger.Reply("Done.");
            }
        }
コード例 #29
0
ファイル: UUID.xaml.cs プロジェクト: pca006132/pcb
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            long[] pair = CommandUtil.randomUUIDPair();
            id_most.Text  = pair[0].ToString();
            id_least.Text = pair[1].ToString();

            string id = CommandUtil.UUIDPairToString(pair[0], pair[1]);

            uuid.Text = id;
        }
コード例 #30
0
        public DatabaseNickMappingPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new DatabaseNickMappingConfig(config);

            ConnectionManager.NickMapping += HandleNickMapping;

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("linknicks"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker, // first nick (base)
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker  // second nick (alias)
                        ),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleLinkNicksCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("unlinknick"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker // nick
                        ),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleUnlinkNickCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("basenick"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker // nick
                        ),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleBaseNickCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("pseudoregister", "pseudounregister"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker // nick
                        ),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandlePseudoRegisterCommand
                );
        }
コード例 #31
0
ファイル: CommandUtilTest.cs プロジェクト: Yzzl/VsVim
        protected void Create(params string[] lines)
        {
            _vimHost = (MockVimHost)Vim.VimHost;
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            _vimTextBuffer = CreateVimTextBufferCore(_textBuffer);
            _localSettings = _vimTextBuffer.LocalSettings;

            var foldManager = CreateFoldManager(_textView);

            _factory = new MockRepository(MockBehavior.Loose);
            _statusUtil = _factory.Create<IStatusUtil>();
            _bulkOperations = new TestableBulkOperations();

            var vimBufferData = CreateVimBufferData(
                _vimTextBuffer,
                _textView,
                statusUtil: _statusUtil.Object);
            _jumpList = vimBufferData.JumpList;
            _windowSettings = vimBufferData.WindowSettings;

            _vimData = Vim.VimData;
            _macroRecorder = Vim.MacroRecorder;
            _globalSettings = Vim.GlobalSettings;

            var operations = CreateCommonOperations(vimBufferData);
            var lineChangeTracker = new LineChangeTracker(vimBufferData);
            _motionUtil = new MotionUtil(vimBufferData, operations);
            _commandUtil = new CommandUtil(
                vimBufferData,
                _motionUtil,
                operations,
                foldManager,
                new InsertUtil(vimBufferData, _motionUtil, operations),
                _bulkOperations,
                MouseDevice,
                lineChangeTracker);

            var outliningManagerService = CompositionContainer.GetExportedValue<IOutliningManagerService>();
            _outliningManager = outliningManagerService.GetOutliningManager(_textView);
        }
コード例 #32
0
        protected void Create(params string[] lines)
        {
            _vimHost = (MockVimHost)Vim.VimHost;
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            _vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            _localSettings = _vimTextBuffer.LocalSettings;

            var foldManager = CreateFoldManager(_textView);

            _factory = new MockRepository(MockBehavior.Loose);
            _statusUtil = _factory.Create<IStatusUtil>();
            _bulkOperations = new TestableBulkOperations();

            var vimBufferData = CreateVimBufferData(
                _vimTextBuffer,
                _textView,
                statusUtil: _statusUtil.Object);
            _jumpList = vimBufferData.JumpList;
            _windowSettings = vimBufferData.WindowSettings;

            _vimData = Vim.VimData;
            _macroRecorder = Vim.MacroRecorder;
            _globalSettings = Vim.GlobalSettings;

            var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
            _motionUtil = new MotionUtil(vimBufferData);
            _commandUtil = new CommandUtil(
                vimBufferData,
                _motionUtil,
                operations,
                foldManager,
                new InsertUtil(vimBufferData, operations),
                _bulkOperations);
        }
コード例 #33
0
ファイル: CommandUtilTest.cs プロジェクト: philipmat/VsVim
        private void Create(params string[] lines)
        {
            _vimHost = (MockVimHost)Vim.VimHost;
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            _vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            _localSettings = _vimTextBuffer.LocalSettings;

            _foldManager = FoldManagerFactory.GetFoldManager(_textView);

            _factory = new MockRepository(MockBehavior.Loose);
            _statusUtil = _factory.Create<IStatusUtil>();
            _smartIdentationService = _factory.Create<ISmartIndentationService>();

            var vimBufferData = CreateVimBufferData(
                _vimTextBuffer,
                _textView,
                statusUtil: _statusUtil.Object);
            _jumpList = vimBufferData.JumpList;
            _windowSettings = vimBufferData.WindowSettings;

            _vimData = Vim.VimData;
            _macroRecorder = Vim.MacroRecorder;
            _registerMap = Vim.RegisterMap;
            _globalSettings = Vim.GlobalSettings;

            var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
            _motionUtil = new MotionUtil(vimBufferData);
            _commandUtil = new CommandUtil(
                vimBufferData,
                _motionUtil,
                operations,
                _smartIdentationService.Object,
                _foldManager,
                new InsertUtil(vimBufferData, operations));
        }
コード例 #34
0
ファイル: CommandUtilTest.cs プロジェクト: bentayloruk/VsVim
        private void Create(params string[] lines)
        {
            _textView = EditorUtil.CreateView(lines);
            _textBuffer = _textView.TextBuffer;

            _factory = new MockRepository(MockBehavior.Loose);
            _vimHost = _factory.Create<IVimHost>();
            _statusUtil = _factory.Create<IStatusUtil>();
            _operations = _factory.Create<ICommonOperations>();
            _operations.Setup(x => x.EnsureCaretOnScreenAndTextExpanded());
            _operations.Setup(x => x.RaiseSearchResultMessages(It.IsAny<SearchResult>()));
            _operations.Setup(x => x.EditorOptions).Returns(EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(_textView));
            _recorder = _factory.Create<IMacroRecorder>(MockBehavior.Loose);
            _smartIdentationService = _factory.Create<ISmartIndentationService>();

            _vimData = new VimData();
            _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice().Object);
            _markMap = new MarkMap(new TrackingLineColumnService());
            _globalSettings = new GlobalSettings();
            _localSettings = new LocalSettings(_globalSettings, _textView);

            var localSettings = new LocalSettings(new Vim.GlobalSettings());
            _motionUtil = VimUtil.CreateTextViewMotionUtil(
                _textView,
                settings: localSettings,
                vimData: _vimData);
            _commandUtil = VimUtil.CreateCommandUtil(
                _textView,
                _operations.Object,
                _motionUtil,
                statusUtil: _statusUtil.Object,
                localSettings: _localSettings,
                registerMap: _registerMap,
                markMap: _markMap,
                vimData: _vimData,
                smartIndentationService: _smartIdentationService.Object,
                recorder: _recorder.Object);
            _jumpList = _commandUtil._jumpList;
        }