public Character(string characterName, CharacterConfig config, int slot, bool isLocal) : base(config) { this.characterName = characterName; this.slot = slot; this.isLocal = isLocal; cmdMgr = new CmdManager(config.commandContent, this); }
private void AddChatCommands() { CmdManager.GetOrCreateGroup("/bv2", new CmdGroupInitializer { { "help", x => RichHudTerminal.OpenToPage(helpMain) }, { "bind", x => UpdateBind(x[0], x.GetSubarray(1)), 2 }, { "resetBinds", x => BvBinds.Cfg = BindsConfig.Defaults }, { "save", x => BvConfig.SaveStart() }, { "load", x => BvConfig.LoadStart() }, { "resetConfig", x => BvConfig.ResetConfig() }, // Debug/Testing { "open", x => QuickActionHudSpace.TryOpenMenu() }, { "close", x => QuickActionHudSpace.CloseMenu() }, { "reload", x => ExceptionHandler.ReloadClients() }, { "crash", x => Crash() }, { "printControlsToLog", x => LogIO.WriteToLogStart($"Control List:\n{HelpText.controlList}") }, { "export", x => ExportBlockData() }, { "import", x => TryImportBlockData() }, { "checkType", x => ExceptionHandler.SendChatMessage($"Block Type: {(QuickActionHudSpace.Target?.SubtypeId.ToString() ?? "No Target")}") }, { "toggleDebug", x => QuickActionMenu.DrawDebug = !QuickActionMenu.DrawDebug }, { "toggleVisDbg", x => PropertyBlock.DebugVisibility = !PropertyBlock.DebugVisibility }, { "toggleBoundingBox", x => QuickActionHudSpace.DrawBoundingBox = !QuickActionHudSpace.DrawBoundingBox }, { "targetBench", TargetBench, 1 }, { "getTarget", x => GetTarget() }, }); }
/// <summary> /// 更新APP文件 /// </summary> /// <param name="model"></param> /// <returns></returns> private async Task UpdateAppFileAsync(UpdateAppFileModel model) { var appManager = ApplicationService.GetService <IAppService>(); string tempPath = Path.Combine(model.WorkingDirectory, $"Temp/{StringManager.GetRandomStrByGuid()}"); DirectoryInfo tempDirectoryInfo = null; if (!Directory.Exists(tempPath)) { tempDirectoryInfo = Directory.CreateDirectory(tempPath); } tempDirectoryInfo ??= new DirectoryInfo(tempPath); var cmdManager = new CmdManager(); string winRarCmd = Path.Combine(ApplicationConfig.WinRarPath, "UnRAR.exe"); await cmdManager.RunCmdCommandsAsync($"\"{winRarCmd}\" x -o+ -y {model.FilePath} {tempPath}"); DirectoryInfo[] directoryInfos = tempDirectoryInfo.GetDirectories(); string[] paths = directoryInfos.Select(m => m.Name).ToArray(); appManager.StopAppByPaths(paths); foreach (DirectoryInfo directoryInfo in directoryInfos) { try { string dirPath = Path.Combine(model.WorkingDirectory, directoryInfo.Name); CopyDirectory(directoryInfo, dirPath); } finally { directoryInfo.Delete(true); } } tempDirectoryInfo.Delete(true); }
private void initView() { bool isOpen = WindowsDenfenderManager.isOpen(); if (isOpen) { startUp = 2; } else { startUp = 1; cbWindowsDefender.IsChecked = true; } bool isScreenToolAdded = ScreenShotManager.isAdded(); if (isScreenToolAdded) { cbScreenShot.IsChecked = true; } if (CmdManager.isAdded() == true) { cbCmd.IsChecked = true; } }
public static void Init() { s_Instance = new CmdManager(); XmlDocument doc = new XmlDocument(); doc.Load(s_config_file); XmlNode root = doc.SelectSingleNode("GlobalConfig"); if (root != null) { XmlNode limit_node = root.SelectSingleNode("CmdCountLimit"); if (limit_node != null) { int.TryParse(limit_node.InnerText, out s_Instance.configLimit); if (s_Instance.configLimit >= 10) { s_Instance.cmdCountLimit = s_Instance.configLimit; } else { s_Instance.configLimit = 10000; } } } }
public new void OnMouseDown(object sender, MouseButtonEventArgs e) { if (CurrentMode == ADDMODE) { Point cp = e.GetPosition(context); //获取相关坐标 cp.X = cp.X + 7; cp.Y = cp.Y + 7; //设置为中心 WasteCover c = new WasteCover("污水检查井", GetMercator(cp), "双击查看详细信息"); c.Location = GetMercator(cp); //添加其他相关信息 JuncAddCommand cmd = new JuncAddCommand(this, c); cmd.Excute(); CmdManager.getInstance().PushCmd(cmd); } else if (CurrentMode == DELMODE) { Path path = e.Source as Path; if (path == null) { base.OnMouseDown(sender, e); //若都不是添加或删除命令,则交给父类进行处理 return; } JuncDelCommand cmd = new JuncDelCommand(this, path); cmd.Excute(); CmdManager.getInstance().PushCmd(cmd); } base.OnMouseDown(sender, e); //若都不是添加或删除命令,则交给父类进行处理 }
public void CompileFile(User user, string problemId) { var pathToSolution = PathManager.GetPath(FoldersPath.SolutionLocation, user.Username); var completePathToSolution = PathManager.GetPath(pathToSolution, $"{problemId}.cpp"); var outPath = PathManager.GetPath(pathToSolution, "a.exe"); CmdManager.RunCommand($"g++ {completePathToSolution} -o {outPath} -std=c++11"); }
protected override void AfterLoadData() { CmdManager.GetOrCreateGroup("/rhd", GetChatCommands()); FontManager.Init(); BindManager.Init(); MasterConfig.Load(true); }
private void OnAskSendFile(PeerSocket peer, string path) { try { CmdManager.AskSendFile(peer, path); } catch (Exception e) { Glue.Dialogs.MessageError("Ask Send File Error", e.Message); } }
private void OnFolderRefresh(object sender, string path) { FolderViewer folderViewer = sender as FolderViewer; Gtk.Application.Invoke(delegate { PeerSocket peer = P2PManager.KnownPeers[folderViewer.UserInfo] as PeerSocket; CmdManager.RequestFolder(peer, path); }); }
private void menuItemExtract_Click(object sender, EventArgs e) { try { CmdManager.ExecuteCommand("tls\\ResourcesExtract\\ResourcesExtract.exe"); } catch (Exception ex) { MessageBox.Show($"Impossible de démarrer le programme: {ex.Message}", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void CreateUserOutput(User user, string problemId) { var completePathToIn = PathManager.GetPath(FoldersPath.IOLocation, $"{problemId}.in"); var pathToSolution = PathManager.GetPath(FoldersPath.SolutionLocation, user.Username); var useroutPath = PathManager.GetPath(pathToSolution, $"userout-{problemId}.txt"); CmdManager.RunCommand(@$ "{pathToSolution}\a.exe < {completePathToIn} > {useroutPath}"); }
public void Stop() { // UnityEngine.Debug.Log("stop..." + m_status); if (m_status == CombatRobotStatus.STOP) { return; } // AddTips("stop"); CmdManager.Instance().Clear();//清空指令 //取消挂机定时器 KillTimer(COMBAT_TIMEID); if (m_bInCopy) { RemoveListener(GameEventID.ROBOTCOMBAT_COPYKILLWAVE); } RemoveListener(GameEventID.SKILLNONESTATE_ENTER); //播放完技能 RemoveListener(GameEventID.ROBOTCOMBAT_NEXTCMD); //技能连招 RemoveListener(GameEventID.SKILLGUIDE_PROGRESSBREAK); //技能使用失败 RemoveListener(GameEventID.JOYSTICK_UNPRESS); //摇杆松开 RemoveListener(GameEventID.JOYSTICK_PRESS); //摇杆按下 RemoveListener(GameEventID.ENTITYSYSTEM_CREATEENTITY); //物品拾取 RemoveListener(GameEventID.ENTITYSYSTEM_REMOVEENTITY); //物品拾取 RemoveListener(GameEventID.SKILLSYSTEM_ADDSKILL); //技能刷新 RemoveListener(GameEventID.SKILLSYSTEM_SKILLLISTCHANE); RemoveListener(GameEventID.NETWORK_CONNECTE_CLOSE); RemoveListener(GameEventID.RECONNECT_SUCESS); RemoveListener(GameEventID.SKILLSYSTEM_STIFFTIMEOVER); if (m_CombatRobotMono != null) { m_CombatRobotMono.m_lstLog.Clear(); } m_bInCopy = false; m_nTargetID = 0; m_nCopyId = 0; m_nLaskKillWave = 0; m_nLaskMovePosIndex = 0; m_nPickItemId = 0; if (m_lstSkills != null) { m_lstSkills.Clear(); } if (m_dicWaveInfo != null) { m_dicWaveInfo.Clear(); } ChangeRoleAction(RoleAction.NONE); ChangeStatus(CombatRobotStatus.STOP); StopMove(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_STOP, null); }
protected void OnAddProtocolCmd(P2PManager p2p, CmdManager cmd) { // Initalize Talk Manager TalkManager.Initialize(this.nyFolder); // Add Protocol Event Handler CmdManager.UnknownEvent += new ProtocolHandler(OnUnknownEvent); // Sensitivize Talk Menu SetSensitiveTalkMenu(true); }
public void CreateResult(User user, string problemId) { var completePathToOut = PathManager.GetPath(FoldersPath.IOLocation, $"{problemId}.out"); var pathToSolution = PathManager.GetPath(FoldersPath.SolutionLocation, user.Username); var useroutPath = PathManager.GetPath(pathToSolution, $"userout-{problemId}.txt"); var resPath = PathManager.GetPath(pathToSolution, $"res-{problemId}.txt"); CmdManager.RunCommand(@$ "fc {completePathToOut} {useroutPath} > {resPath}"); }
private void cbCmd_Checked(object sender, RoutedEventArgs e) { if (cbCmd.IsChecked == true) { CmdManager.addCmdToRightMenu(); } else { CmdManager.removeSCmdToRightMenu(); } }
// =================================================== // PRIVATE (Sub Methods) Protocol Event Handler // =================================================== public void OnGetEvent(PeerSocket peer, XmlRequest xml) { Gtk.Application.Invoke(delegate { string what = (string)xml.Attributes["what"]; if (what == "folder") { CmdManager.SendFileList(peer, xml.BodyText); } }); }
public void MainPlayStop() { IPlayer player = ClientGlobal.Instance().MainPlayer; if (player != null) { player.SendMessage(EntityMessage.EntityCommand_StopMove, player.GetPos()); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false); //关闭自动寻路中 } CmdManager.Instance().Clear(); //清除寻路 }
protected void OnDelProtocolCmd(P2PManager p2p, CmdManager cmd) { // Uninitalize Talk Manager TalkManager.Uninitialize(); // Del Protocol Event Handler CmdManager.UnknownEvent -= new ProtocolHandler(OnUnknownEvent); // Sensitivize Talk Menu SetSensitiveTalkMenu(false); }
public void CleanAll(User user, string problemId) { var pathToSolution = PathManager.GetPath(FoldersPath.SolutionLocation, user.Username); var useroutPath = PathManager.GetPath(pathToSolution, $"userout-{problemId}.txt"); var resPath = PathManager.GetPath(pathToSolution, $"res-{problemId}.txt"); var outPath = PathManager.GetPath(pathToSolution, "a.exe"); CmdManager.RunCommand($"del {outPath}"); CmdManager.RunCommand($"del {useroutPath}"); CmdManager.RunCommand($"del {resPath}"); }
// ============================================ // PRIVATE Methods // ============================================ private void UserConnect(UserInfo userInfo) { try { // Connect & Send Login P2PManager.AddPeer(userInfo, userInfo.Ip, userInfo.Port); PeerSocket peer = (PeerSocket)P2PManager.KnownPeers[userInfo]; CmdManager.Login(peer, MyInfo.GetInstance()); OnPeerLogin(peer, userInfo); } catch (Exception e) { Glue.Dialogs.MessageError("Connenting To " + userInfo.Name + " Failed", e.Message); } }
public static async Task Main() { const string path = @"E:\Project\Materal\Application\Materal.APP\Deploy.Server\Application\template\Start.cmd"; var cmdManager = new CmdManager(); cmdManager.OutputDataReceived += CmdManager_OutputDataReceived; cmdManager.ErrorDataReceived += CmdManager_ErrorDataReceived; //await cmdManager.RunCmdCommandsAsync("E:", @"cd Project\Materal\Application\Materal.APP\Deploy.Server\Application\template", "npm run deploy"); await cmdManager.RunCmdCommandsAsync("E:", @"cd Project\Materal\Application\Materal.APP\Deploy.Server\Application\template", "echo Hello World"); await cmdManager.RunCmdCommandsAsync("echo Hello World"); Console.ReadKey(); }
private void RunProgram(Item i) { try { CmdManager.ExecuteCommand(i.Target); if (settings.hideAfterLaunch) { Hide(); } } catch (Exception e) { MessageBox.Show($"Impossible de démarrer le programme: {e.Message}", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Inviter() { name2CID = new Dictionary <string, long> { }; Config = Interface.GetPluginConfig() as Configuration ?? new Configuration(); Config.Initialize(Interface); var easierProcessInvitePtr = SigScanner.ScanText("E8 ?? ?? ?? ?? EB 3E 44 0F B7 83 ?? ?? ?? ??"); var easierProcessEurekaInvitePtr = SigScanner.ScanText("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 8B 83 ?? ?? ?? ?? 48 85 C0 74 62"); var easierProcessCIDPtr = SigScanner.ScanText("40 53 48 83 EC 20 48 8B DA 48 8D 0D ?? ?? ?? ?? 8B 52 08"); getUIModulePtr = SigScanner.ScanText("E8 ?? ?? ?? ?? 48 83 7F ?? 00 48 8B F0"); uiModulePtr = SigScanner.GetStaticAddressFromSig("48 8B 0D ?? ?? ?? ?? 48 8D 54 24 ?? 48 83 C1 10 E8 ?? ?? ?? ??"); InitUi(); groupManagerAddress = SigScanner.GetStaticAddressFromSig("48 8D 0D ?? ?? ?? ?? 44 8B E7"); PluginLog.Log("===== I N V I T E R ====="); PluginLog.Log("Process Invite address {Address}", easierProcessInvitePtr); PluginLog.Log("Process CID address {Address}", easierProcessCIDPtr); PluginLog.Log("uiModule address {Address}", uiModule); PluginLog.Log("uiInvite address {Address}", uiInvite); PluginLog.Log("groupManager address {Address}", groupManagerAddress); //Log($"EurekaInvite:{easierProcessEurekaInvitePtr}"); //Interface.Framework.Gui.Chat.OnChatMessageRaw += Chat_OnChatMessageRaw; _EasierProcessInvite = Marshal.GetDelegateForFunctionPointer <EasierProcessInviteDelegate>(easierProcessInvitePtr); _EasierProcessEurekaInvite = Marshal.GetDelegateForFunctionPointer <EasierProcessEurekaInviteDelegate>(easierProcessEurekaInvitePtr); /* * easierProcessEurekaInviteHook = new Hook<EasierProcessEurekaInviteDelegate>(easierProcessEurekaInvitePtr, * new EasierProcessEurekaInviteDelegate(EasierProcessEurekaInviteDetour), * this); */ easierProcessCIDHook = new Hook <EasierProcessCIDDelegate>(easierProcessCIDPtr, new EasierProcessCIDDelegate(EasierProcessCIDDetour)); easierProcessCIDHook.Enable(); //easierProcessEurekaInviteHook.Enable(); CmdManager.AddHandler("/xinvite", new CommandInfo(CommandHandler) { HelpMessage = "/xinvite - open the inviter panel.\n" + "/xinvite <on/off> - turn the auto invite on/off.\n" + "/xinvite <minutes> - enable temporary auto invite for certain amount of time in minutes.\n" + "/xinvite <minutes> <attempts> - enable temporary auto invite for certain amount of time in minutes and finish it after certain amount of invite attempts.\n" }); Gui = new PluginUi(this); ChatGui.ChatMessage += Chat_OnChatMessage; // Interface.Framework.Network.OnNetworkMessage += Chat_OnNetworkMessage; ClientState.TerritoryChanged += TerritoryChanged; timedRecruitment = new TimedEnable(this); }
public override void KillProcess(ApplicationRuntimeModel model) { if (model.ApplicationInfo.ApplicationType == ApplicationTypeEnum.PM2) { var cmdManager = new CmdManager(); Task task = cmdManager.RunCmdCommandsAsync($"pm2 delete {model.ApplicationInfo.MainModule}"); Task.WaitAll(task); return; } if (_next == null) { throw new DeployException("未识别应用程序类型"); } _next.KillProcess(model); }
//------------------------------------------------------------------------------------------------------- /** * @brief 用来处理游戏中退回到登录或者选人界面 或者地图时使用 * @param bFlag 标识是否清理主角 true清理主角 */ public void Clear(bool bFlag = false) { Engine.IRenderSystem renderSys = Engine.RareEngine.Instance().GetRenderSystem(); if (renderSys != null && bFlag) { // 设置主Camera string strCameraName = "MainCamera"; Engine.ICamera cam = renderSys.GetCamera(ref strCameraName); if (cam != null) { cam.Enable(false); } } // 停止背景音乐 Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null && bFlag) { audio.StopMusic(); } if (bFlag) { CmdManager.Instance().Clear(); } if (m_ControllerSys != null) { m_ControllerSys.GetCombatRobot().Stop(true); } if (MainPlayer != null) { MainPlayer.SendMessage(EntityMessage.EntityCommand_StopMove, MainPlayer.GetPos()); } if (m_EntitySys != null) { m_EntitySys.Clear(bFlag); } if (m_MapSystem != null) { m_MapSystem.ExitMap(); } MainPlayer = null; Engine.RareEngine.Instance().UnloadUnusedResources(); }
private void AddAttackCmd(IEntity target, uint skillid) { Client.IPlayer player = ControllerSystem.m_ClientGlobal.MainPlayer; if (target != null && skillid != 0) { if (m_CombatRobotMono != null) { m_CombatRobotMono.AddLog(string.Format("添加攻击命令 技能id:{0} {1}", skillid, UnityEngine.Time.realtimeSinceStartup)); } CmdManager.Instance().AddCmd(Cmd.Attack, player.GetUID(), target.GetUID(), skillid); } else { ChangeRoleAction(RoleAction.NONE); } }
public void Dispose() { if (timedRecruitment.isRunning) { timedRecruitment.runUntil = 0; Config.Enable = false; } easierProcessCIDHook.Dispose(); // easierProcessEurekaInviteHook.Dispose(); ChatGui.ChatMessage -= Chat_OnChatMessage; // Interface.Framework.Network.OnNetworkMessage -= Chat_OnNetworkMessage; ClientState.TerritoryChanged -= TerritoryChanged; CmdManager.RemoveHandler("/xinvite"); Gui?.Dispose(); Interface?.Dispose(); }
// ============================================ // PUBLIC Constructors // ============================================ public NetworkManager(MenuManager menu, UserPanel userPanel, NotebookViewer nv) { this.userPanel = userPanel; this.notebookViewer = nv; this.menuManager = menu; // Initialize P2PManager & CMD Manager this.p2pManager = P2PManager.GetInstance(); this.cmdManager = CmdManager.GetInstance(); // Network SetSensitiveNetworkMenu(P2PManager.IsListening()); // Add Event Handlers this.menuManager.Activated += new EventHandler(OnMenuActivated); notebookViewer.NetworkViewer.ItemRemoved += new PeerSelectedHandler(OnPeerRemove); }
public bool PublishATMCertificate() { string username = Formatter.ParseName(Thread.CurrentPrincipal.Identity.Name); if (Thread.CurrentPrincipal.IsInRole("ATMGroup")) { // generisanje pin koda za klijenta Random rand = new Random(); string password = (rand.Next(1000, 9999)).ToString(); SecureString pin = new NetworkCredential("", password).SecurePassword; string CA = "SmartCardCA"; Console.WriteLine($"Generated password is: {password}. Please use it for registration.\nPress any key to continue"); // klijentski sertifikat //string path = @"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86"; string path = @"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x86"; string cmd = $"makecert -sv {username}.pvk -iv {CA}.pvk -n \"CN={username}\" -pe -ic {CA}.cer {username}.cer -sr localmachine -ss My -sky exchange"; cmd = cmd.Replace(@"\", ""); CmdManager.ExecuteCommand(path, cmd); CmdManager.ExecuteCommand(path, $"pvk2pfx.exe /pvk {username}.pvk /pi {password} /spc {username}.cer /pfx {username}.pfx"); //CmdManager.ExecuteCommand(path, $"CertMgr.exe /add {username}.cer /s /r localmachine personal"); // DA LI TREBA. ovo personal treba menjati TRUSTED PEOPLE KAD BUDE NA VISE KOMPOVA // klijentski sertifikat za potpis CmdManager.ExecuteCommand(path, $"makecert -sv {username}Sign.pvk -iv {CA}.pvk -n \"CN = {username}Sign\" -pe -ic {CA}.cer {username}Sign.cer -sr localmachine -ss My -sky signature"); CmdManager.ExecuteCommand(path, $"pvk2pfx.exe /pvk {username}Sign.pvk /pi {password} /spc {username}Sign.cer /pfx {username}Sign.pfx"); //CmdManager.ExecuteCommand(path, $"CertMgr.exe /add {username}Sign.cer /s /r localmachine personal"); // DA LI TREBA. ovo personal treba menjati path = @"C:\Program Files (x86)\Windows Resource Kits\Tools"; CmdManager.ExecuteCommand(path, $@"winhttpcertcfg -g -c LOCAL_MACHINE\My -s {username} -a {username}"); CmdManager.ExecuteCommand(path, $@"winhttpcertcfg -g -c LOCAL_MACHINE\My -s {username}Sign -a {username}"); // logovanje uspesnog izdavanja nove smart kartice SmartCardServiceLogger scsLogger = new SmartCardServiceLogger(); scsLogger.WriteInformation($"SCS has successfully published new smart card for client {username}."); return(true); } else { return(false); } }