void DrawNodeWindow(int id) { WindowListItem item = windows[id]; BehaviorNode node = windows[id].node; GUILayout.BeginHorizontal(); if (GUILayout.Button("×", GUILayout.Width(30))) { } if (GUILayout.Button("▲", GUILayout.Width(30))) { } if (GUILayout.Button("▼", GUILayout.Width(30))) { } if (GUILayout.Button(new GUIContent("T", "Send node to bottom"), GUILayout.Width(30))) { } if (GUILayout.Button(new GUIContent("B", "Send node to bottom"), GUILayout.Width(30))) { } GUILayout.EndHorizontal(); EditorGUI.BeginChangeCheck(); Editor.CreateEditor(node).OnInspectorGUI(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(node); } }
private void AddProcessToWinList() { try { bool optionChecked = false; WindowListItem selProc = (WindowListItem)lbProcList.SelectedItem; ProcessOptions options = new ProcessOptions(); if (chkIgnoreWinTitle.IsChecked == true) { options.IgnoreProcessTitle = true; optionChecked = true; } uDebugLogAdd($"Adding process to window list, {selProc.Display}"); if (optionChecked) { Toolbox.settings.AddWindow(WindowItem.Create(selProc.Process, selProc.Handle, options, selProc.Title)); } else { Toolbox.settings.AddWindow(WindowItem.Create(selProc.Process, selProc.Handle, null, selProc.Title)); } uDebugLogAdd("Added process to window list"); SendUserUpdateNotification($"Added entry for this process: {selProc.Display} "); //lbProcList.Items.Remove(selProc); //uDebugLogAdd("Removed existing selected item from the window list"); } catch (Exception ex) { LogException(ex); } }
private void CreateWindowsListFromBehaviorsNodeList() { windows.Clear(); List <BehaviorNode> list = _currentNodesList.list; for (int i = 0; i < list.Count(); i++) { var item = new WindowListItem(i, list[i].GetType().Name, new Rect(0, 0, 250, 0), list[i]); windows.Add(item); } }
private void lbProcList_SelectionChanged(object sender, SelectionChangedEventArgs e) { //try //{ // if (lbProcList.SelectedItem != null) // { // uDebugLogAdd($"Proc item wasn't null, item: {lbProcList.SelectedItem.ToString()}"); // Process proc = (Process)lbProcList.SelectedItem; // if (processOutline != null) // MoveProcessOutline(proc); // else // ShowProcessOutline(proc); // DisplayProcessInfo(proc); // } //} //catch (Exception ex) //{ // LogException(ex); //} try { if (lbProcList.SelectedItem != null) { try { uDebugLogAdd($"Proc item wasn't null, item: {lbProcList.SelectedItem.ToString()}"); WindowListItem proc = (WindowListItem)lbProcList.SelectedItem; if (processOutline != null) { MoveProcessOutline(proc.Handle); } else { ShowProcessOutline(proc.Handle); } DisplayProcessInfo(proc); } catch (Win32Exception we) { uDebugLogAdd($"Unable to draw process outline: {we.Message}"); lbProcList.Items.Remove(lbProcList.SelectedItem); return; } catch (Exception ex) { LogException(ex); } } } catch (Exception ex) { LogException(ex); } }
private void DisplayProcessInfo(WindowListItem proc) { try { var dimensions = WindowInfo.GetHandleDimensions(proc.Handle); TxtProcName.Text = $"Process Name: {proc.Process.ProcessName}"; TxtProcTitle.Text = $"Process Title: {proc.Title}"; TxtModName.Text = $"Module Name: {proc.Process.MainModule.ModuleName}"; TxtFilePath.Text = $"File Path: {proc.Process.MainModule.FileName}"; TxtProcLocation.Text = $"Location:{Environment.NewLine} X: {dimensions.Left}{Environment.NewLine} Y: {dimensions.Top}{Environment.NewLine} Width: {dimensions.Right - dimensions.Left}{Environment.NewLine} Height: {dimensions.Bottom - dimensions.Top}"; } catch (Exception ex) { LogException(ex); } }
private void UpdateWindowList() { try { ToggleLoading(LoadingType.Start); var stopWatch = new Stopwatch(); stopWatch.Start(); var tempWindowList = new List <WindowListItem>(); BackgroundWorker worker = new BackgroundWorker() { WorkerReportsProgress = true }; worker.DoWork += (ws, we) => { try { foreach (var proc in Process.GetProcesses()) { try { var rect = WindowInfo.GetProcessDimensions(proc); uDebugLogAdd($"Process {proc.ProcessName} | T{rect.Top} L{rect.Left} H{rect.Bottom - rect.Top} W{rect.Right - rect.Left}"); if (WindowInfo.DoesProcessHandleHaveSize(proc)) { uDebugLogAdd($"Process {proc.ProcessName} has size"); if (tempWindowList.Find(x => x.Process.MainWindowHandle == proc.MainWindowHandle) == null) { uDebugLogAdd($"Process {proc.ProcessName} doesn't currently exist in the windowList, adding process"); foreach (var handle in WinAPIWrapper.EnumerateProcessWindowHandles(proc.Id)) { try { if (WindowInfo.DoesHandleHaveSize(handle) && WinAPIWrapper.IsWindowVisible(handle)) { var windowListItem = WindowListItem.Create(proc, handle); if (tempWindowList.Find(x => x.Display == windowListItem.Display) == null) { tempWindowList.Add(windowListItem); uDebugLogAdd($"Added to list | [{windowListItem.Handle}]{windowListItem.Display}"); } else { uDebugLogAdd($"Item already in the list, skipping | {windowListItem.Display}"); } } else { uDebugLogAdd($"Handle window doesn't have size, skipping | [{handle}]{proc.ProcessName}"); } } catch (Exception ex) { uDebugLogAdd($"Unable to add handle to the list | [{handle}]{proc.ProcessName}: {ex.Message}"); } } } else { uDebugLogAdd($"Already enumerated through handles for {proc.ProcessName}, skipping this one"); } } } catch (Exception ex) { uDebugLogAdd($"Unable to get proc {proc.ProcessName}: {ex.Message}"); } } } catch (Exception ex) { LogException(ex); } worker.ReportProgress(1); }; worker.ProgressChanged += (ps, pe) => { if (pe.ProgressPercentage == 1) { lbProcList.ItemsSource = null; WindowList = tempWindowList.OrderBy(x => x.Display).ToList(); lbProcList.ItemsSource = WindowList; stopWatch.Stop(); uDebugLogAdd($"Updated window list, took: {stopWatch.Elapsed.Seconds}s {stopWatch.Elapsed.Milliseconds}ms"); ToggleLoading(LoadingType.Done); } }; worker.RunWorkerAsync(); } catch (Exception ex) { LogException(ex); } }