public static void PrerequisiteCheck() { if (!CommandUtility.ExistCommand(Constants.PdfCommandName)) { throw new DocfxException(Constants.PdfCommandNotExistMessage); } }
private static void CMConfig() { CommandUtility.Register("DeceitBraziers", Access, OnSystemCommand); RegisterLocation(Map.Trammel, 5175, 615, 0); RegisterLocation(Map.Felucca, 5175, 615, 0); RegisterSpawns(typeof(Rat), typeof(Cat), typeof(Dog), typeof(Rabbit), typeof(Sheep), typeof(Cow)); RegisterSpawns(typeof(Zombie), typeof(Mummy), typeof(Wraith), typeof(Spectre), typeof(Lich), typeof(LichLord)); RegisterSpawns( typeof(Skeleton), typeof(SkeletalMage), typeof(SkeletalKnight), typeof(HellCat), typeof(HellHound), typeof(HellSteed)); RegisterSpawns( typeof(Wisp), typeof(DarkWisp), typeof(ShadowWisp), typeof(EnergyVortex), typeof(BladeSpirits), typeof(HeadlessOne)); RegisterSpawns(typeof(Ettin), typeof(Cyclops), typeof(Gazer), typeof(ElderGazer), typeof(Ogre), typeof(OgreLord)); RegisterSpawns( typeof(Mongbat), typeof(StrongMongbat), typeof(GreaterMongbat), typeof(GrizzlyBear), typeof(BlackBear), typeof(EnragedBlackBear)); RegisterSpawns( typeof(Harpy), typeof(StoneHarpy), typeof(Balron), typeof(Daemon), typeof(Dragon), typeof(GreaterDragon)); RegisterSpawns( typeof(Wyvern), typeof(WhiteWyrm), typeof(ShadowWyrm), typeof(Drake), typeof(SkeletalDragon), typeof(Troll)); }
public Task Delete(params IGuildChannel[] channels) { return(CommandUtility.ForEvery(Context, channels, CommandUtility.Action( delegate(IGuildChannel channel) { return channel.DeleteAsync(); }))); }
public static void Initialize() { CommandUtility.Register( "ExportBounds2D", AccessLevel.GameMaster, e => { if (e != null && e.Mobile != null) { OnExportBounds2D(e.Mobile, e.GetString(0), e.GetString(1)); } }); CommandUtility.RegisterAlias("ExportBounds2D", "XB2D"); CommandUtility.Register( "ExportBounds3D", AccessLevel.GameMaster, e => { if (e != null && e.Mobile != null) { OnExportBounds3D(e.Mobile, e.GetString(0), e.GetString(1)); } }); CommandUtility.RegisterAlias("ExportBounds3D", "XB3D"); }
/// <summary> /// Class constructor /// </summary> public DocumentViewModel(string pluginModelName, IMessageBoxService msgBox) { _MsgBox = msgBox; // Create and initialize the data model. _DataModel = new DocumentDataModel(pluginModelName); // TODO XXX _dataModel.New((Size)SettingsManager.Settings["DefaultPageSize"], (Thickness)SettingsManager.Settings["DefaultPageMargins"]); _DataModel.New(new PageViewModelBase()); _DataModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { // Suggest to WPF to refresh commands when the DocumentDataModel changes state. if (e.PropertyName == "State") { CommandManager.InvalidateRequerySuggested(); } }; // Create the commands in this view model. _CommandUtility = new CommandUtility(this, msgBox); // Create the view models. _CanvasViewModel = new CanvasViewModel(this, msgBox); this.vm_XmlViewModel = new XmlViewModel(this); }
public static void Configure() { EventSink.WorldLoad += () => { foreach (var c in World.Items.Values.OfType <CellarAddon>().ToArray()) { c.InvalidateComponents(); } }; CommandUtility.Register( "Cellar", AccessLevel.Counselor, e => { BaseHouse house = BaseHouse.FindHouseAt(e.Mobile); if (house == null) { e.Mobile.SendMessage("You must be inside a house to use that command."); return; } var cellar = house.Addons.OfType <CellarAddon>().FirstOrDefault(); if (cellar == null) { e.Mobile.SendMessage("This house does not have a cellar."); return; } e.Mobile.SendGump(new PropertiesGump(e.Mobile, cellar)); }); }
/// <summary> /// 检索是否有TCP在线终端的命令待发送。 /// 条件: /// 1、预定发送时间在30s以内 /// 2、命令的状态为等待发送状态(等待发送或等待重发) /// 3、终端为TCP链接状态的 /// </summary> /// <returns></returns> public void CheckCommand() { if (null == _server) { return; } var list = CommandInstance.FindList(f => f.ScheduleTime >= DateTime.Now.AddSeconds(-30) && f.Status <= (byte)CommandStatus.ReSending && f.TB_Terminal.OnlineStyle == (byte)LinkType.TCP).ToList(); foreach (var cmd in list) { // 0==链接不存在1=发送成功2=网络处理错误 var ret = _server.Send(cmd.TB_Terminal.Socket.Value, Wbs.Utilities.CustomConvert.GetBytes(cmd.Content)); if (ret == 0) { // TCP链接丢失,重新用SMS方式发送 CommandUtility.SendSMSCommand(cmd); } else { UpdateCommand(cmd, (1 == ret ? CommandStatus.SentByTCP : CommandStatus.TCPNetworkError)); } } }
public static void Initialize() { CommandUtility.Register( "explorer", AccessLevel.Owner, e => new FileExplorerGump(e.Mobile, null, null).Send()); }
public static void Initialize() { if (_Initialized) { return; } _Initialized = true; CommandUtility.Register( "GC", AccessLevel.Administrator, e => { var message = true; if (e.Arguments != null && e.Arguments.Length > 0) { message = e.GetBoolean(0); } Optimize(e.Mobile, message); }); CommandUtility.RegisterAlias("GC", "Optimize"); }
private static void CMConfig() { EventSink.Speech += OnSpeech; EventSink.Login += OnLogin; EventSink.Logout += OnLogout; CommandUtility.Register("ChatAdmin", Access, e => new WorldChatAdminGump(e.Mobile as PlayerMobile).Send()); }
private static void CMDisabled() { EventSink.Login -= OnLogin; CommandUtility.Unregister(CMOptions.PopupCommand); CommandUtility.Unregister(CMOptions.PositionCommand); CloseAll(); }
public async Task Softban(params IGuildUser[] users) { var action = CommandUtility.Action(async u => { ulong id = u.Id; await u.BanAsync(7); // Prune 7 day's worth of messages await u.Guild.RemoveBanAsync(id); }); await CommandUtility.ForEvery(Context, users, action); }
private static void CMConfig() { CommandUtility.Register("CheckDonate", AccessLevel.Player, e => CheckDonate(e.Mobile as PlayerMobile)); CommandUtility.Register("DonateConfig", Access, e => CheckConfig(e.Mobile as PlayerMobile)); CommandUtility.Register("DonateSync", Access, e => Sync()); EventSink.Login += OnLogin; DonationEvents.OnTransDelivered += OnTransDelivered; }
public static void Configure() { if (_Configured) { return; } CommandUtility.Register("AddShape3D", AccessLevel.GameMaster, OnCommand); _Configured = true; }
private static void CMEnabled() { EventSink.Login += OnLogin; CommandUtility.Register(CMOptions.PopupCommand, AccessLevel.Player, CMOptions.HandlePopupCommand); CommandUtility.Register(CMOptions.PositionCommand, AccessLevel.Player, CMOptions.HandlePositionCommand); if (CMOptions.LoginPopup) { OpenAll(); } }
private static void RunGitCommand(string repoPath, string arguments, Action <string> processOutput) { var encoding = Encoding.UTF8; const int bufferSize = 4096; if (!Directory.Exists(repoPath)) { throw new ArgumentException($"Can't find repo: {repoPath}"); } using (var outputStream = new MemoryStream()) using (var errorStream = new MemoryStream()) { int exitCode; using (var outputStreamWriter = new StreamWriter(outputStream, encoding, bufferSize, true)) using (var errorStreamWriter = new StreamWriter(errorStream, encoding, bufferSize, true)) { exitCode = CommandUtility.RunCommand(new CommandInfo { Name = CommandName, Arguments = arguments, WorkingDirectory = repoPath, }, outputStreamWriter, errorStreamWriter, GitTimeOut); // writer streams have to be flushed before reading from memory streams // make sure that streamwriter is not closed before reading from memory stream outputStreamWriter.Flush(); errorStreamWriter.Flush(); if (exitCode != 0) { errorStream.Position = 0; using (var errorStreamReader = new StreamReader(errorStream, encoding, false, bufferSize, true)) { ProcessErrorMessage(errorStreamReader.ReadToEnd()); } } else { outputStream.Position = 0; using (var streamReader = new StreamReader(outputStream, encoding, false, bufferSize, true)) { string line; while ((line = streamReader.ReadLine()) != null) { processOutput(line); } } } } } }
public async Task RoleBan(IRole role, params IGuildUser[] users) { var action = CommandUtility.Action( async u => { await u.RemoveRolesAsync(role); var guildUser = Database.GetGuildUser(u); guildUser.BanRole(role); }); await Database.Save(); await CommandUtility.ForEvery(Context, users, action); }
public async Task RoleUnban(IRole role, params IGuildUser[] users) { var action = CommandUtility.Action( u => { var guildUser = Database.GetGuildUser(u); guildUser.UnbanRole(role); return(Task.CompletedTask); }); await Database.Save(); await CommandUtility.ForEvery(Context, users, action); }
protected override void CompileList(List <CommandEntry> list) { list.Clear(); var commands = CommandUtility.EnumerateCommands(User.AccessLevel); commands = commands.Where(c => !Insensitive.Equals(c.Command, "MyCommands")); list.AddRange(commands); base.CompileList(list); }
private static void CSInvoke() { CommandUtility.Register( "Templates", AccessLevel.Player, e => { if (e.Mobile is PlayerMobile) { DisplayManagerGump((PlayerMobile)e.Mobile); } }); }
private static void CMConfig() { CommandUtility.Register("CheckDonate", AccessLevel.Player, e => CheckDonate(e.Mobile)); CommandUtility.Register("DonateConfig", Access, e => CheckConfig(e.Mobile)); CommandUtility.RegisterAlias("DonateConfig", "DonateAdmin"); EventSink.Login += OnLogin; WebAPI.Register("/donate/ipn", HandleIPN); WebAPI.Register("/donate/acc", HandleAccountCheck); WebAPI.Register("/donate/form", HandleWebForm); }
private static void CMInvoke() { CommandUtility.Register( "AntiAds", Access, e => { if (e.Mobile is PlayerMobile) { SuperGump.Send(new AntiAvertsReportsGump((PlayerMobile)e.Mobile)); } }); }
private static void CSConfig() { CommandUtility.Register( "Schedules", Access, e => { if (e != null && e.Mobile is PlayerMobile) { SuperGump.Send(new ScheduleListGump((PlayerMobile)e.Mobile)); } }); }
/// <summary> /// 发送命令 /// </summary> /// <param name="obj"></param> /// <param name="sms"></param> /// <returns></returns> private string SendCommand(TB_Terminal obj, bool sms) { if (null == User) { return(ResponseMessage(-1, "Your session was expired, please try to login again.")); } else { var extra = GetParamenter("param"); var id = CommandUtility.SendCommand(obj, cmd, sms, User.id, extra); return(ResponseMessage(0, id.ToString())); } }
private void RemoveLicenseHeaderFromAllProjectsCallback(object sender, EventArgs e) { Solution solution = _dte.Solution; IVsStatusbar statusBar = (IVsStatusbar)GetService(typeof(SVsStatusbar)); var removeLicenseHeaderFromAllProjects = new RemoveLicenseHeaderFromAllProjectsCommand(statusBar, _licenseReplacer); bool resharperSuspended = CommandUtility.ExecuteCommandIfExists("ReSharper_Suspend", _dte); removeLicenseHeaderFromAllProjects.Execute(solution); if (resharperSuspended) { CommandUtility.ExecuteCommand("ReSharper_Resume", _dte); } }
private static void CSInvoke() { CommandUtility.Register( "Donations", AccessLevel.Developer, e => { if (!(e.Mobile is PlayerMobile)) { return; } new DonationsUI(e.Mobile as PlayerMobile).Send(); }); }
private static void CSConfig() { Core.CrashedHandler = OnServerCrashed; EventSink.Crashed += e => { if (!World.Loading && !World.Saving) { NotifyPlayers(); } }; BackupSource = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Saves/"); BackupTarget = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Backups/Crashed/"); ReportTarget = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Reports/"); _CrashState = IOUtility.EnsureFile(VitaNexCore.CacheDirectory + "/CrashState.bin"); _LastOnline = new List <PlayerMobile>(); _CrashNotes = new List <CrashNote>(); CommandUtility.Register( "CrashGuard", Access, e => { if (e.Mobile is PlayerMobile) { SuperGump.Send(new CrashNoteListGump((PlayerMobile)e.Mobile)); } }); CommandUtility.Register( "Crash", AccessLevel.Administrator, e => { if (e.Mobile is PlayerMobile) { SuperGump.Send( new ConfirmDialogGump((PlayerMobile)e.Mobile) { Title = "Force Crash", Html = "Click OK to force the server to crash.", AcceptHandler = b => { throw new Exception("Forced Crash Exception"); } }); } }); }
private static void CSInvoke() { CommandUtility.Register( "UOF", AccessLevel.Player, e => { if (!(e.Mobile is PlayerMobile)) { return; } new CentralGumpUI(e.Mobile as PlayerMobile, EnsureProfile(e.Mobile as PlayerMobile), CentralGumpType.News).Send(); }); }
private static void CMInvoke() { //EventSink.WorldBroadcast += OnWorldBroadcast; CommandUtility.Register( "Discord", Access, e => { var message = String.Format("[{0}]: {1}", e.Mobile.RawName, e.ArgString); SendMessage(message, false); }); CommandUtility.Register("DiscordAdmin", Access, e => new DiscordBotUI(e.Mobile).Send()); }
/// <summary> /// 处理查询命令发送状态的请求 /// </summary> /// <returns></returns> private string HandleQueryCommandStatusRequest() { string ret = ""; using (var bll = new CommandBLL()) { var cmd = bll.Find(f => f.id == ParseInt(data)); if (null == cmd) { ret = ResponseMessage(-1, "No such command record exists."); } else { byte status = cmd.Status.Value; CommandStatus state = (CommandStatus)status; if (state == CommandStatus.Returned) { using (var dbll = new DataBLL()) { var list = dbll.FindList <TB_HISTORIES>(f => f.command_id.Equals(cmd.Command) && f.terminal_id.Equals(cmd.DestinationNo) && f.receive_time > cmd.ActualSendTime, "receive_time", true); var data = list.FirstOrDefault(); var desc = CommandUtility.GetCommandStatus(state); if (null != data) { desc += GetCommandData(data); } ret = ResponseMessage(status, desc); } } else { ret = ResponseMessage(status, CommandUtility.GetCommandStatus(state)); if (cmd.Command == "0x4000" && (state == CommandStatus.SentBySMS || state == CommandStatus.SentByTCP)) { // 将重置终端连接的命令状态改成不需要回复的状态 bll.Update(f => f.id == cmd.id, act => { act.Status = (byte)CommandStatus.NotNeedReturn; }); } } } } return(ret); }