/// <summary> /// Injects the hook into the specified process /// </summary> /// <param name="process">The process to inject into</param> public void Inject(Process process) { // Skip if the process is already hooked, or if there is no main window if (this.GraphicsInterface != null || this.SpeedHackInterface != null || (process == null || process.MainWindowHandle == IntPtr.Zero)) { return; } String projectDirectory = Path.GetDirectoryName(ProjectExplorerViewModel.GetInstance().ProjectFilePath); String channelName = null; this.GraphicsInterface = GraphicsFactory.GetGraphicsInterface(projectDirectory); this.SpeedHackInterface = new SpeedHackInterface(); // Initialize the IPC server, giving the server access to the interfaces defined here RemoteHooking.IpcCreateServer <HookClient>(ref channelName, WellKnownObjectMode.Singleton, this); try { // Inject DLL into target process RemoteHooking.Inject( process.Id, InjectionOptions.Default, typeof(HookClient).Assembly.Location, typeof(HookClient).Assembly.Location, channelName, projectDirectory); } catch (Exception ex) { throw new Exception("Unable to Inject:" + ex); } }
public static IDisposable Reload(ProjectExplorerViewModel model) { return(new StateSaver <bool>( value: true, getter: () => model._suspendReload, setter: value => model._suspendReload = value)); }
public void WhenUsingDefaultSettings_ThenOnlyWindowsIsIncluded() { var viewModel = new ProjectExplorerViewModel(this.settingsRepository); Assert.IsTrue(viewModel.IsWindowsIncluded); Assert.IsFalse(viewModel.IsLinuxIncluded); }
public static IDisposable ProjectsRoot(ProjectExplorerViewModel model) { ThreadHelper.ThrowIfNotOnUIThread(); return(new StateSaver <string>( value: model._optionService.ProjectsRoot, getter: () => model._optionService.ProjectsRoot, setter: value => model._optionService.ProjectsRoot = value)); }
/// <summary> /// Adds the given scan results to the project explorer. /// </summary> /// <param name="scanResults">The scan results to add to the project explorer.</param> private void AddScanResults(IEnumerable <PointerItem> scanResults) { if (scanResults == null) { return; } ProjectExplorerViewModel.GetInstance().AddNewProjectItems(addToSelected: false, projectItems: scanResults); }
private async Task <ObservableCollection <ProjectExplorerViewModel.ViewModelNode> > GetInstancesAsync( ProjectExplorerViewModel viewModel) { var projects = await viewModel.RootNode.GetFilteredNodesAsync(false); var zones = await projects[0].GetFilteredNodesAsync(false); return(await zones[0].GetFilteredNodesAsync(false)); }
/// <summary> /// Closes the main window. /// </summary> /// <param name="window">The window to close.</param> private void Close(Window window) { if (!ProjectExplorerViewModel.GetInstance().PromptSave()) { return; } window.Close(); }
/// <summary> /// Adds the given instructions to the project explorer. /// </summary> /// <param name="instructions">The instructions to add to the project explorer.</param> private void AddInstructions(IEnumerable <InstructionItem> instructions) { if (instructions == null) { return; } ProjectExplorerViewModel.GetInstance().AddNewProjectItems(addToSelected: false, projectItems: instructions); }
/// <summary> /// Adds the given instructions to the project explorer. /// </summary> /// <param name="instructions">The instructions to add to the project explorer.</param> private void AddInstructions(IEnumerable <InstructionItem> instructions) { if (instructions == null) { return; } ProjectExplorerViewModel.GetInstance().AddProjectItems(instructions.ToArray()); }
private void ExtractPointer(Int32 levelIndex) { Pointer pointer = this.DiscoveredPointers.GetRandomPointer(levelIndex); if (pointer != null) { PointerItem pointerItem = new PointerItem(pointer.BaseAddress, this.ActiveType, "New Pointer", null, pointer.Offsets); ProjectExplorerViewModel.GetInstance().AddProjectItems(pointerItem); } }
/// <summary> /// Determines the matching view for a specific given type of viewmodel. /// </summary> /// <param name="item">Identifies the viewmodel object for which we require an associated view.</param> /// <param name="container">Identifies the container's instance that wants to resolve this association.</param> public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container) { return(item switch { IDocumentViewModel _ => FileViewTemplate, LogViewModel _ => LogViewTemplate, ProjectExplorerViewModel _ => ProjectExplorerTemplate, _ => base.SelectTemplate(item, container) });
/// <summary> /// Adds a .Net object to the project explorer. /// </summary> /// <param name="dotNetObjectViewModel">The view model of the .Net object.</param> private void AddDotNetObject(DotNetObjectViewModel dotNetObjectViewModel) { DotNetObject dotNetObject = dotNetObjectViewModel.DotNetObject; DotNetItem dotnetItem = new DotNetItem( dotNetObject.Name, dotNetObject.ElementType == DataType.Boolean ? DataType.Byte : dotNetObject.ElementType, dotNetObject.GetFullName()); ProjectExplorerViewModel.GetInstance().AddProjectItems(dotnetItem); }
/// <summary> /// Adds a .Net object to the project explorer. /// </summary> /// <param name="dotNetObjectViewModel">The view model of the .Net object.</param> private void AddDotNetObject(DotNetObjectViewModel dotNetObjectViewModel) { DotNetObject dotNetObject = dotNetObjectViewModel.DotNetObject; DotNetItem dotnetItem = new DotNetItem( dotNetObject.Name, dotNetObject.ElementType == typeof(Boolean) ? typeof(Byte) : dotNetObject.ElementType, dotNetObject.GetFullName() ); ProjectExplorerViewModel.GetInstance().AddNewProjectItems(true, dotnetItem); }
/// <summary> /// Adds the given scan results to the project explorer. /// </summary> /// <param name="scanResults">The scan results to add to the project explorer.</param> private void AddScanResults(IEnumerable <ScanResult> scanResults) { if (scanResults == null) { return; } IEnumerable <PointerItem> projectItems = scanResults.Select(scanResult => scanResult.PointerItem); ProjectExplorerViewModel.GetInstance().AddNewProjectItems(addToSelected: true, projectItems: projectItems); }
/// <summary> /// Adds the given scan results to the project explorer. /// </summary> /// <param name="scanResults">The scan results to add to the project explorer.</param> private void AddScanResults(IEnumerable <ScanResult> scanResults) { if (scanResults == null) { return; } IEnumerable <PointerItem> projectItems = scanResults.Select(scanResult => scanResult.PointerItem?.ProjectItem as PointerItem); ProjectExplorerViewModel.GetInstance().AddProjectItems(projectItems.ToArray()); }
/// <summary> /// Adds a .Net object to the project explorer. /// </summary> /// <param name="dotNetObjectViewModel">The view model of the .Net object.</param> private void AddDotNetObject(DotNetObjectViewModel dotNetObjectViewModel) { DotNetObject dotNetObject = dotNetObjectViewModel.DotNetObject; AddressItem addressItem = new AddressItem(); addressItem.Description = dotNetObject.Name; addressItem.ElementType = dotNetObject.ElementType == typeof(Boolean) ? typeof(Byte) : dotNetObject.ElementType; addressItem.BaseIdentifier = dotNetObject.GetFullName(); addressItem.ResolveType = AddressResolver.ResolveTypeEnum.DotNet; ProjectExplorerViewModel.GetInstance().AddNewProjectItems(true, addressItem); }
/// <summary> /// Adds the given code trace results to the project explorer. /// </summary> /// <param name="codeTraceResults">The code trace results to add to the project explorer.</param> private void AddCodeTraceResults(IEnumerable <CodeTraceResult> codeTraceResults) { if (codeTraceResults == null) { return; } IEnumerable <InstructionItem> projectItems = codeTraceResults.Select( codeTraceEvent => new InstructionItem(codeTraceEvent.Address, "", "nop", new Byte[] { 0x90 })); ProjectExplorerViewModel.GetInstance().AddProjectItems(projectItems.ToArray()); }
/// <summary> /// Closes the main window. /// </summary> /// <param name="window">The window to close.</param> private void Close(Window window) { if (!ProjectExplorerViewModel.GetInstance().ProjectItemStorage.PromptSave()) { return; } SettingsViewModel.GetInstance().Save(); ProjectExplorerViewModel.GetInstance().DisableAllProjectItems(); window.Close(); }
/// <summary> /// Adds the given scan results to the project explorer. /// </summary> /// <param name="scanResults">The scan results to add to the project explorer.</param> private void AddScanResults(IEnumerable <ScanResult> scanResults) { if (scanResults == null) { return; } foreach (ScanResult scanResult in scanResults) { ProjectExplorerViewModel.GetInstance().AddSpecificAddressItem(scanResult.ElementAddress, this.ActiveType); } }
/// <summary> /// Closes the main window. /// </summary> /// <param name="window">The window to close.</param> protected override void Close(Window window) { if (!ProjectExplorerViewModel.GetInstance().ProjectItemStorage.PromptSave()) { return; } SettingsViewModel.GetInstance().Save(); ProjectExplorerViewModel.GetInstance().DisableAllProjectItems(); base.Close(window); }
/// <summary> /// Event invoked when a download has been completed in the browser. /// </summary> /// <param name="sender">Sending object.</param> /// <param name="e">Download event args.</param> private void DownloadDataCompleted(Object sender, DownloadDataCompletedEventArgs e) { try { // Load and import the file. String file = Path.GetTempFileName(); File.WriteAllBytes(file, e.Result); ProjectExplorerViewModel.GetInstance().ImportSpecificProjectCommand.Execute(file); } catch { } }
/// <summary> /// Initializes a new instance of the <see cref="ProjectExplorer" /> class. /// </summary> public ProjectExplorer() { this.InitializeComponent(); this.nodeCache = new BiDictionary <ProjectItem, ProjectNode>(); this.projectTree = new TreeModel(); this.InitializeDesigner(); this.projectExplorerTreeViewContainer.Children.Add(WinformsHostingHelper.CreateHostedControl(this.projectExplorerTreeView)); EngineCore.GetInstance().Input?.GetKeyboardCapture().Subscribe(this); ProjectExplorerViewModel.GetInstance().Subscribe(this); }
public void WhenAllOsDisabledInSettings_ThenNoOsAreIncluded() { // Write settings. var viewModel = new ProjectExplorerViewModel(this.settingsRepository); viewModel.IsWindowsIncluded = false; viewModel.IsLinuxIncluded = false; // Read again. viewModel = new ProjectExplorerViewModel(this.settingsRepository); Assert.IsFalse(viewModel.IsWindowsIncluded); Assert.IsFalse(viewModel.IsLinuxIncluded); }
public void WhenAllOsEnabledInSettings_ThenAllOsAreIncluded() { // Write settings. new ProjectExplorerViewModel(this.settingsRepository) { IsWindowsIncluded = true, IsLinuxIncluded = true }; // Read again. var viewModel = new ProjectExplorerViewModel(this.settingsRepository); Assert.IsTrue(viewModel.IsWindowsIncluded); Assert.IsTrue(viewModel.IsLinuxIncluded); }
/// <summary> /// Adds a project item as a child under this one. /// </summary> /// <param name="newChild">The child project item.</param> public void AddChild(ProjectItem newChild) { lock (this.ChildrenLock) { newChild.Parent = this; if (this.Children == null) { this.Children = new List <ProjectItem>(); } this.Children.Add(newChild); } ProjectExplorerViewModel.GetInstance().HasUnsavedChanges = true; }
public void Initialize() { _eventAggregator.GetEvent <SplashScreenUpdateEvent>().Publish(new SplashScreenUpdateEvent { Text = "Loading Project Explorer..." }); _container.RegisterType <ProjectExplorerViewModel>(); _container.RegisterType <IProjectExplorerToolboxToolbarService, ProjectExplorerToolboxToolbarService>(new ContainerControlledLifetimeManager()); _viewModel = _container.Resolve <ProjectExplorerViewModel>(); LoadCommands(); LoadToolbar(); _workspace.Tools.Add(_viewModel); }
/// <inheritdoc /> public void OnValidateStateChanged(ProjectExplorerViewModel projectExplorerViewModel) { var debugHost = Host.GetSharedExportedValue <IDebugHost>(); try { var svnManager = Host.GetSharedExportedValue <SvnManagerPlugin>(); svnManager.UpdateCache(); debugHost.LogMessage(new DebugMessage("Viewpoint.Svn", DebugMessageSeverity.Information, $"Status Cache Updated")); } catch (Exception e) { debugHost.LogMessage(new DebugMessage("Viewpoint.Svn", DebugMessageSeverity.Error, $"Failed to Update Cache {e.Message}")); const string caption = "Error SVN"; var result = System.Windows.Forms.MessageBox.Show(e.Message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DeploymentViewModel(ProjectExplorerViewModel projectExplorerViewModel, DeploymentModel deployment) { // Inicializa los datos principales ExplorerViewModel = projectExplorerViewModel; Project = projectExplorerViewModel.Project; IsNew = deployment == null; if (deployment == null) { Deployment = new DeploymentModel(); } else { Deployment = deployment; } ConnectionsListViewModel = new DeploymentConnectionListViewModel(Project); ParametersListViewModel = new Parameters.ParameterListViewModel(); ScriptsTreeViewModel = new Scripts.TreeScriptsViewModel(ExplorerViewModel.ProjectPath, Deployment); ReportOutputListViewModel = new BauMvvm.ViewModels.Forms.ControlItems.ControlListViewModel(); // Inicializa el viewModel InitViewModel(); }
/// <summary> /// Adds a project item as a sibling to the specified object. /// </summary> /// <param name="targetChild">The child project item.</param> /// <param name="newChild">The new child project item to add as a sibling.</param> /// <param name="after">A value indicating whether or not the new child should be inserted before or after the target.</param> public void AddSibling(ProjectItem targetChild, ProjectItem newChild, Boolean after) { lock (this.ChildrenLock) { if (!this.Children.Contains(targetChild)) { return; } newChild.Parent = this; if (after) { this.Children?.Insert(this.Children.IndexOf(targetChild) + 1, newChild); } else { this.Children?.Insert(this.Children.IndexOf(targetChild), newChild); } } ProjectExplorerViewModel.GetInstance().HasUnsavedChanges = true; }
public void AddSelectionToTable(Int32 minIndex, Int32 maxIndex) { if (minIndex < 0) { minIndex = 0; } if (maxIndex > this.AcceptedPointers.Count) { maxIndex = this.AcceptedPointers.Count; } Int32 count = 0; for (Int32 index = minIndex; index <= maxIndex; index++) { String pointerValue = String.Empty; this.IndexValueMap.TryGetValue(index, out pointerValue); AddressItem newPointer = new AddressItem( this.AcceptedPointers[index].Item1, this.ElementType, "New Pointer", AddressResolver.ResolveTypeEnum.Module, String.Empty, this.AcceptedPointers[index].Item2, false, pointerValue); ProjectExplorerViewModel.GetInstance().AddNewProjectItems(true, newPointer); if (++count >= PointerScannerModel.MaxAdd) { break; } } }