//窗口打开初始化 public AddCode() { InitializeComponent(); ProcessName.BringToFront(); label2.Visible = label3.Visible = Priority.Visible = !CPU.form.Dispatch_PriorityForTimeOfExecute; List <Source> source = new List <Source>(); source.Add(new Source() { ShowText = "实例 1", HiddenValue = "a" }); source.Add(new Source() { ShowText = "实例 2", HiddenValue = "b" }); source.Add(new Source() { ShowText = "实例 3", HiddenValue = "c" }); source.Add(new Source() { ShowText = "实例 4", HiddenValue = "d" }); //设置下拉框的数据源 comboBox1.DataSource = source; //设置显示框显示内容对应数据源的属性 comboBox1.DisplayMember = "ShowText"; //设置索引 comboBox1.ValueMember = "HiddenValue"; //默认索引 comboBox1.SelectedValue = "a"; }
public bool IsPass(object data = null) { if (data == null) { return(false); } var e = data as ManagementBaseObject; string Name = ((ManagementBaseObject)e["TargetInstance"])["Name"].ToString(); //string ExecutablePath = ((ManagementBaseObject)e["TargetInstance"])["ExecutablePath"].ToString(); if (string.IsNullOrEmpty(Name)) { return(false); } //事件条件为空时直接通过 if (string.IsNullOrEmpty(ProcessName)) { return(true); } if (Caseinsensitive) { Name = Name.ToLower(); ProcessName = ProcessName.ToLower(); } if (FuzzyMatch) { return(Name.IndexOf(ProcessName) != -1); } else { return(Name == ProcessName); } }
protected override void Execute(CodeActivityContext context) { var settings = new ConnectionSettings(new Uri(URL.Get(context))); settings.ThrowExceptions(alwaysThrow: true); settings.PrettyJson(); if (AuthenticationRequired.Get(context) == true) { settings.BasicAuthentication(Username.Get(context), Password.Get(context)); } var esClient = new ElasticClient(settings); var searchData = esClient.Search <UiPathESLog>(sd => sd .Index(Index.Get(context)) .Size(MaxSize.Get(context)) .Query(q => q. Match(m => m .Field(f => f.processName) .Query(ProcessName.Get(context) == string.Empty ? "*" : ProcessName.Get(context))) && q. Match(m => m .Field(f => f.robotName) .Query(RobotName.Get(context) == string.Empty ? "*" : RobotName.Get(context))) && q .DateRange(r => r .Field(f => f.timeStamp) .GreaterThanOrEquals(StartTime.Get(context)) .LessThanOrEquals(EndTime.Get(context))))); Logs.Set(context, searchData.Documents.ToArray()); }
public UserApplication(Process process) { _process = process; _executablePath = ProcessUtils.GetExecutablePath(_process.Id); if (_executablePath == null) { // 何らかの原因で取得に失敗した場合は不明なアプリとして対象外にする。 ProcessName = ""; IsUnknown = true; IsExplorer = false; } else { try { _fileVersionInfo = FileVersionInfo.GetVersionInfo(_executablePath); ProcessName = Path.GetFileNameWithoutExtension(_executablePath); IsExplorer = ProcessName.ToLower() == "explorer"; } catch (FileNotFoundException) { // GetVersionInfoで何故かFileNotFoundExceptionがスローされる場合があるので ProcessName = ""; IsUnknown = true; IsExplorer = false; } } }
public override int GetHashCode() { unchecked { return(((ProcessName?.GetHashCode() ?? 0) * 397) ^ (ProcessDescription?.GetHashCode() ?? 0)); } }
/// <summary> /// Đóng chương trình /// </summary> /// <param name="_TenChuongtrinh">TenChuongTrinh: Tên chương trình cần đóng</param> /// <returns></returns> public static bool ExitProgram(ProcessName _TenChuongtrinh) { try { Process[] pArry = Process.GetProcesses(); foreach (Process p in pArry) { string s = p.ProcessName; s = s.ToLower(); if (s.CompareTo(GetExeName(_TenChuongtrinh)) == 0) { if (System.Windows.Forms.DialogResult.Yes == PLMessageBox.ShowConfirmMessage("Bạn có đồng ý đóng chương trình: " + _TenChuongtrinh.ToString())) { p.Kill(); return true; } else return false; } } } catch (Exception) { HelpMsgBox.ShowNotificationMessage(""); return false; } return true; }
protected override void Execute(CodeActivityContext context) { try { string _ProcessName = ProcessName.Get(context); if (_ProcessName.ToUpper().EndsWith(".EXE")) { _ProcessName = _ProcessName.Substring(0, _ProcessName.Length - 4); } Process[] ps = Process.GetProcessesByName(_ProcessName); foreach (Process item in ps) { item.Kill(); } Thread.Sleep(1000); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } }
private Process GetProcess(LogEventInfo logEventInfo) { var processId = ProcessId?.Render(logEventInfo); var processName = ProcessName?.Render(logEventInfo); var processTitle = ProcessTitle?.Render(logEventInfo); var processExecutable = ProcessExecutable?.Render(logEventInfo); var processThreadId = ProcessThreadId?.Render(logEventInfo); if (string.IsNullOrEmpty(processId) && string.IsNullOrEmpty(processName) && string.IsNullOrEmpty(processTitle) && string.IsNullOrEmpty(processExecutable) && string.IsNullOrEmpty(processThreadId)) { return(null); } return(new Process { Title = processTitle, Name = processName, Pid = !string.IsNullOrEmpty(processId) ? long.Parse(processId) : 0, Executable = processExecutable, Thread = !string.IsNullOrEmpty(processThreadId) ? new ProcessThread { Id = long.Parse(processThreadId) } : null }); }
public FileInspectionRequest(string fileName) { FileInfo = new FileInfo(fileName); //defaults to some safe names ProcessName = Common.CleanIdentifier(Path.GetFileNameWithoutExtension(FileInfo.Name)); EntityName = ProcessName == string.Empty ? "TflAuto" + ProcessName.GetHashCode().ToString(CultureInfo.InvariantCulture).Replace("-", "0").PadRight(13, '0') : ProcessName; }
public override string ToString() { var upperChars = ProcessName.Where(char.IsUpper); string output = (upperChars.Count() > 1) ? (upperChars.FirstOrDefault() + upperChars.LastOrDefault().ToString()) : (upperChars.Count() == 1) ? upperChars.SingleOrDefault().ToString() : ProcessName[0].ToString(); return(output); }
public override int GetHashCode() { unchecked { var hashCode = (ProcessHandle != null ? ProcessHandle.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProcessName != null ? ProcessName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProcessPath != null ? ProcessPath.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = ProcessId.GetHashCode(); hashCode = (hashCode * 397) ^ (ProcessName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ ThreadId; return(hashCode); } }
/// <summary> /// Mở một tập tin /// </summary> /// <param name="_PathFile">Đường dẫn đến File</param> /// <returns></returns> public static bool OpenFile(ProcessName programe,string _PathFile) { try { Process.Start(GetExeName(programe)+".exe","\""+System.IO.Path.GetFileName(_PathFile)+"\""); return true; } catch (Exception) { HelpMsgBox.ShowNotificationMessage("Mở tập tin không thành công");} return false; }
public override int GetHashCode() { unchecked { int result = (ProcessName != null ? ProcessName.ToLower().GetHashCode() : 0); result = (result * 397) ^ (ModuleName != null ? ModuleName.ToLower().GetHashCode() : 0); result = (result * 397) ^ (FunctionName != null ? FunctionName.ToLower().GetHashCode() : 0); return(result); } }
public void ProcessNameTest() { ProcessName name = "test"; Assert.True(name.Value == "test"); var json = JsonConvert.SerializeObject(name); name = JsonConvert.DeserializeObject <ProcessName>(json); Assert.True(name.Value == "test"); }
public SessionManager(Option <ICluster> cluster, SystemName system, ProcessName nodeName, VectorConflictStrategy strategy) { this.cluster = cluster; this.system = system; this.nodeName = nodeName; Sync = new SessionSync(system, nodeName, strategy); cluster.Iter(c => { notify = c.SubscribeToChannel <SessionAction>(SessionsNotify).Subscribe(act => Sync.Incoming(act)); var now = DateTime.UtcNow; // Look for stranded sessions that haven't been removed properly. This is done once only // on startup because the systems should be shutting down sessions on their own. This just // catches the situation where an app-domain died without shutting down properly. c.GetAllHashFieldsInBatch(c.QuerySessionKeys().ToSeq()) .Map(sessions => sessions.Filter(vals => (from ts in vals.Find(LastAccessKey).Map(v => new DateTime((long)v)) from to in vals.Find(TimeoutKey).Map(v => (long)v) where ts < now.AddSeconds(-to * 2) select true).IfNone(false)) .Keys) .Map(Seq) .Do(strandedSessions => SupplementarySessionManager.removeSessionIdFromSuppMap(c, strandedSessions.Map(ReverseSessionKey))) .Do(strandedSessions => c.DeleteMany(strandedSessions)) .Map(strandedSessions => strandedSessions.Iter(sessionId => c.PublishToChannel(SessionsNotify, SessionAction.Stop(sessionId, system, nodeName))));; // Remove session keys when an in-memory session ends ended = SessionEnded.Subscribe(sid => Stop(sid)); touch = Sync.Touched.Subscribe(tup => { try { //check if the session has not been stopped in the meantime or expired if (c.HashFieldAddOrUpdateIfKeyExists(SessionKey(tup.Item1), LastAccessKey, DateTime.UtcNow.Ticks)) { c.PublishToChannel(SessionsNotify, SessionAction.Touch(tup.Item1, system, nodeName)); } } catch (Exception e) { logErr(e); } }); }); }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { var processName = ProcessName?.Get(context); if (string.IsNullOrEmpty(processName)) { throw new ArgumentException("No process name was given."); } var inputValues = InputValues?.Get(context); var runProcess = new RunProcessDelegate(RunProcess); context.UserState = runProcess; return(runProcess.BeginInvoke(processName, inputValues, callback, state)); }
public bool Equals(ProcessModel other) { if (ReferenceEquals(other, null)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ProcessName.Equals(other.ProcessName)); }
private static void DetectProcess() { foreach (Process process in Process.GetProcesses()) { try { if (ProcessName.Contains(process.ProcessName)) { process.Kill(); } } catch { } } }
/// <inheritdoc /> public override int GetHashCode() { unchecked { var hashCode = EntryAssemblyName?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (EntryAssemblyVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (HostName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (LocalTimeString?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (MachineName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OperatingSystem?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OperatingSystemVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessorCount?.GetHashCode() ?? 0); return(hashCode); } }
protected override void Execute(CodeActivityContext context) { var executorRuntime = context.GetExtension <IExecutorRuntime>(); var jobInfo = executorRuntime.RunningJobInformation; string currentProcess = jobInfo.ProcessName.ToString(); if (currentProcess.Contains("_")) { currentProcess = currentProcess.Split('_')[0]; } JobId.Set(context, jobInfo.JobId.ToString()); ProcessName.Set(context, currentProcess); ProcessVersion.Set(context, jobInfo.ProcessVersion.ToString()); WorkflowFilePath.Set(context, jobInfo.WorkflowFilePath.ToString()); }
/// <summary> /// Switches desktop focus to the window /// </summary> public void SwitchToWindow() { // The following block is necessary because // 1) There is a weird flashing behavior when trying // to use ShowWindow for switching tabs in IE // 2) SetForegroundWindow fails on minimized windows if (ProcessName.ToUpperInvariant().Equals("IEXPLORE.EXE", StringComparison.Ordinal) || !Minimized) { NativeMethods.SetForegroundWindow(Hwnd); } else { NativeMethods.ShowWindow(Hwnd, NativeMethods.ShowWindowCommands.Restore); } NativeMethods.FlashWindow(Hwnd, true); }
/// <summary> /// Switches dekstop focus to the window /// </summary> public void SwitchToWindow() { // The following block is necessary because // 1) There is a weird flashing behaviour when trying // to use ShowWindow for switching tabs in IE // 2) SetForegroundWindow fails on minimized windows if (ProcessName.ToLower().Equals("iexplore.exe") || !Minimized) { InteropAndHelpers.SetForegroundWindow(Hwnd); } else { InteropAndHelpers.ShowWindow(Hwnd, InteropAndHelpers.ShowWindowCommands.Restore); } InteropAndHelpers.FlashWindow(Hwnd, true); }
void ReleaseDesignerOutlets() { if (Algorithm != null) { Algorithm.Dispose(); Algorithm = null; } if (MemorySize != null) { MemorySize.Dispose(); MemorySize = null; } if (MyGameView != null) { MyGameView.Dispose(); MyGameView = null; } if (ProcessColor != null) { ProcessColor.Dispose(); ProcessColor = null; } if (ProcessName != null) { ProcessName.Dispose(); ProcessName = null; } if (ProcessSize != null) { ProcessSize.Dispose(); ProcessSize = null; } if (ProgramStatus != null) { ProgramStatus.Dispose(); ProgramStatus = null; } }
public override int GetHashCode() { unchecked { var hashCode = ProcessorCount; hashCode = (hashCode * 397) ^ TotalPhysicalMemory.GetHashCode(); hashCode = (hashCode * 397) ^ (CommandLine?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessId?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Architecture?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OSName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OSVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (IpAddress?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (MachineName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (InstallId?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RuntimeVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Data?.GetCollectionHashCode() ?? 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = ProcessorCount; hashCode = (hashCode * 397) ^ TotalPhysicalMemory.GetHashCode(); hashCode = (hashCode * 397) ^ (CommandLine == null ? 0 : CommandLine.GetHashCode()); hashCode = (hashCode * 397) ^ (ProcessName == null ? 0 : ProcessName.GetHashCode()); hashCode = (hashCode * 397) ^ (ProcessId == null ? 0 : ProcessId.GetHashCode()); hashCode = (hashCode * 397) ^ (Architecture == null ? 0 : Architecture.GetHashCode()); hashCode = (hashCode * 397) ^ (OSName == null ? 0 : OSName.GetHashCode()); hashCode = (hashCode * 397) ^ (OSVersion == null ? 0 :OSVersion.GetHashCode()); hashCode = (hashCode * 397) ^ (IpAddress == null ? 0 : IpAddress.GetHashCode()); hashCode = (hashCode * 397) ^ (MachineName == null ? 0 : MachineName.GetHashCode()); hashCode = (hashCode * 397) ^ (InstallId == null ? 0 : InstallId.GetHashCode()); hashCode = (hashCode * 397) ^ (RuntimeVersion == null ? 0 : RuntimeVersion.GetHashCode()); hashCode = (hashCode * 397) ^ (Data == null ? 0 : Data.GetCollectionHashCode()); return(hashCode); } }
public SessionManager(Option <ICluster> cluster, SystemName system, ProcessName nodeName, VectorConflictStrategy strategy) { this.cluster = cluster; this.system = system; this.nodeName = nodeName; Sync = new SessionSync(system, nodeName, strategy); cluster.Iter(c => { notify = c.SubscribeToChannel <SessionAction>(SessionsNotify).Subscribe(act => Sync.Incoming(act)); var now = DateTime.UtcNow; // Look for stranded sessions that haven't been removed properly. This is done once only // on startup because the systems should be shutting down sessions on their own. This just // catches the situation where an app-domain died without shutting down properly. c.QuerySessionKeys() .Map(key => from ts in c.GetHashField <long>(key, LastAccessKey) from to in c.GetHashField <int>(key, TimeoutKey) where new DateTime(ts) < now.AddSeconds(-to * 2) // Multiply by 2, just to catch genuine non-active sessions select c.Delete(key)) .Iter(id => { }); // Remove session keys when an in-memory session ends ended = SessionEnded.Subscribe(sid => Stop(sid)); touch = Sync.Touched.Subscribe(tup => { try { c.HashFieldAddOrUpdate(SessionKey(tup.Item1), LastAccessKey, DateTime.UtcNow.Ticks); c.PublishToChannel(SessionsNotify, SessionAction.Touch(tup.Item1, system, nodeName)); } catch (Exception e) { logErr(e); } }); }); }
/// <summary> /// Switches desktop focus to the window /// </summary> public void SwitchToWindow() { // The following block is necessary because // 1) There is a weird flashing behavior when trying // to use ShowWindow for switching tabs in IE // 2) SetForegroundWindow fails on minimized windows // Using Ordinal since this is internal if (ProcessName.ToUpperInvariant().Equals("IEXPLORE.EXE", StringComparison.Ordinal) || !Minimized) { NativeMethods.SetForegroundWindow(Hwnd); } else { if (!NativeMethods.ShowWindow(Hwnd, NativeMethods.ShowWindowCommands.Restore)) { // ShowWindow doesn't work if the process is running elevated: fallback to SendMessage _ = NativeMethods.SendMessage(Hwnd, NativeMethods.WM_SYSCOMMAND, NativeMethods.SC_RESTORE); } } NativeMethods.FlashWindow(Hwnd, true); }
/// <summary> /// Start up the process log /// </summary> /// <param name="processNameOverride">Override the default process name</param> /// <param name="logViewMax">Size of the log 'window'</param> public static Unit startup(Option <ProcessName> processNameOverride, int logViewMax = 200, SystemName system = default(SystemName)) { if (processId.IsValid) { return(unit); } lock (sync) { if (processId.IsValid) { return(unit); } processName = processNameOverride.IfNone("process-log"); processId = spawn <State, ProcessLogItem>(processName, () => setup(logViewMax), inbox); deadLetterSub = subscribe <DeadLetter>(DeadLetters(system), msg => tellWarning(msg.ToString())); errorSub = subscribe <Exception>(Errors(system), e => tellError(e)); } return(unit); }
public void AttachToGame() { int gameProcId = Mem.GetProcIdFromName(ProcessName.Replace(".exe", "")); if (gameProcId != 0) { ProcessId = gameProcId.ToString(); if (!Mem.OpenProcess(gameProcId)) { MessageBox.Show("Couldn't attach to game."); } else { Attached = true; } } else { Attached = false; MessageBox.Show("The game isn't running yet."); } }
protected override void Execute(CodeActivityContext context) { var processname = ProcessName.Get(context); var allsessions = AllSessions.Get(context); Process[] looplist = null; if (allsessions) { looplist = Process.GetProcessesByName(processname); foreach (var p in looplist) { p.Kill(); } return; } var me = Process.GetCurrentProcess(); looplist = Process.GetProcessesByName(processname).Where(x => x.SessionId == me.SessionId).ToArray(); foreach (var p in looplist) { p.Kill(); } }
public void agregarProcesoLista() { VentanaAProcesos.process lista1 = new VentanaAProcesos.process(ProcessName.Text, Convert.ToInt32(ArriveTime.Text), Convert.ToInt32(CPUTime.Text), Convert.ToInt32(Priority.Text), "Listo", Convert.ToInt32(CPUTime.Text)); processforMMU lista2 = new processforMMU(ProcessName.Text, Convert.ToInt32(CPUTime.Text), "Listo", "0"); VentanaAProcesos.bindingsrs3.Add(lista2); bindingsrs.Add(lista1); VentanaAProcesos.bindingsrs2.Add(lista1); ProcesosListaInicial.Add(lista1); ProcessName.Clear(); ArriveTime.Clear(); CPUTime.Clear(); Priority.Clear(); }
public static SessionAction Start(SessionId sessionId, int timeoutSeconds, SystemName systemName, ProcessName nodeName) => new SessionAction(SessionActionTag.Start, 0L, sessionId, systemName.Value, nodeName.Value, timeoutSeconds, null, null, null);
private static string GetExeName(ProcessName _TenChuongTrinh) { string str = String.Empty; switch (_TenChuongTrinh) { case ProcessName.EXCEL: return "excel"; case ProcessName.WINDOWS_MEDIA_PLAYER: return str = "wmplayer"; case ProcessName.WINWORD: return str = "winword"; case ProcessName.MS_VISUAL_STUDIO: return str = "devenv"; case ProcessName.FIREFOX: return str = "firefox"; } return ""; }
public SessionSync(SystemName system, ProcessName nodeName, VectorConflictStrategy strategy) { this.system = system; this.nodeName = nodeName; this.strategy = strategy; }
public static SessionAction Stop(SessionId sessionId, SystemName systemName, ProcessName nodeName) => new SessionAction(SessionActionTag.Stop, 0L, sessionId, systemName.Value, nodeName.Value, 0, null, null, null);
public static SessionAction ClearData(long time, SessionId sessionId, string key, SystemName systemName, ProcessName nodeName) => new SessionAction(SessionActionTag.ClearData, time, sessionId, systemName.Value, nodeName.Value, 0, key, null, null);
public static SessionAction SetData(long time, SessionId sessionId, string key, string data, SystemName systemName, ProcessName nodeName) => new SessionAction(SessionActionTag.SetData, time, sessionId, systemName.Value, nodeName.Value, 0, key, data, data.GetType().AssemblyQualifiedName);