public void RuntimeIdsAreUnique() { var ridA = new RuntimeId(this.testResource); var ridB = new RuntimeId(this.testResource); Assert.AreNotEqual(ridA, ridB); }
public void RuntimeIdFromString() { var rid = new RuntimeId(this.testResourceId); Assert.AreEqual(this.testResourceId, rid.ResourceId); Assert.AreEqual(this.GetType().FullName, rid.TypeName); }
/// <summary>Removes controllers for a target from all event handler sets</summary> /// <param name="targetId">Runtime identifier of the controller target</param> public void RemoveControllerTarget(RuntimeId targetId) { foreach (var handlerSet in this.eventHandlers.Values) { handlerSet.RemoveControllerTarget(targetId); } }
/// <summary>Send an event to a specific controller</summary> /// <param name="targetId">Runtime identifier of the controller's target</param> /// <param name="e">Event data</param> public void SendEvent(RuntimeId targetId, EventArgs e) { #if DEBUG if (!this.eventType.IsAssignableFrom(e.GetType())) { throw new ArgumentException("Incorrect event type. Was: {0}, Expecting: {1}".FormatInvariant(e.GetType().FullName, this.eventType.FullName), "e"); } #endif if (!this.handlers.ContainsKey(targetId)) { #if LOG_VERBOSE /* * Log.Trace( * "SendEvent<{0}> - Controller not found: '{1}'\nControllers:\n", * this.EventType.FullName, * targetId, * this.Controllers.Keys); */ #endif return; } var eventArgs = (TEventArgs)e; foreach (var handler in this.handlers[targetId]) { handler(eventArgs); } }
public void RuntimeIdsAreByValue() { var ridA = new RuntimeId(this.testResource); var ridB = ridA; Assert.AreEqual(ridA, ridB); Assert.AreNotSame(ridA, ridB); }
/// <summary>Sends the event to controllers implementing the named event handler for the specified target</summary> /// <typeparam name="TEventArgs">Type of the EventArgs</typeparam> /// <param name="eventHandler">The event handler</param> /// <param name="targetId">Runtime identifier of the controller target</param> /// <param name="e">Data for the event</param> public void SendEvent <TEventArgs>(string eventHandler, RuntimeId targetId, TEventArgs e) where TEventArgs : EventArgs { var controllerSet = this.FindControllerSet(eventHandler); if (controllerSet != null) { controllerSet.SendEvent(targetId, e); } }
AttachableProcessInfo(ulong processId, RuntimeId runtimeId, string runtimeName, string name, string title, string filename, string commandLine, string architecture) { ProcessId = processId; RuntimeId = runtimeId ?? throw new ArgumentNullException(nameof(runtimeId)); RuntimeName = runtimeName ?? throw new ArgumentNullException(nameof(runtimeName)); Name = name ?? throw new ArgumentNullException(nameof(name)); Title = title ?? throw new ArgumentNullException(nameof(title)); Filename = filename ?? throw new ArgumentNullException(nameof(filename)); CommandLine = commandLine ?? throw new ArgumentNullException(nameof(commandLine)); Architecture = architecture ?? throw new ArgumentNullException(nameof(architecture)); }
public void RuntimeIdAsString() { var rid = new RuntimeId(this.testResource); Assert.AreEqual(rid.AsString, rid.ToString()); Assert.IsTrue(rid.AsString.Contains(rid.Guid.ToString("N"))); Assert.IsTrue(rid.AsString.Contains(rid.TypeName)); Assert.IsTrue(rid.AsString.Contains(this.testResource.GetType().FullName)); Assert.IsTrue(rid.AsString.Contains(rid.ResourceId)); Assert.IsTrue(rid.AsString.Contains(this.testResource.Id)); }
/// <summary>Removes a mapped input handler</summary> /// <param name="mapping">Input mapping.</param> /// <param name="id">Identifier of the handler to remove.</param> /// <returns>True if the input was found and removed; otherwise, false.</returns> public bool RemoveMappedInputHandler(IInputMapping mapping, RuntimeId id) { lock (this.inputMappings) { if (!this.inputMappings.ContainsKey(mapping)) { return(false); } return(this.inputMappings[mapping].Remove(id)); } }
/// <summary>Adds a mapped input handler</summary> /// <param name="mapping">Input mapping.</param> /// <param name="id">Identifier (used to later remove).</param> /// <param name="handler">Handler to add.</param> public void AddMappedInputHandler(IInputMapping mapping, RuntimeId id, MappedInputHandler handler) { lock (this.inputMappings) { if (!this.inputMappings.ContainsKey(mapping)) { this.inputMappings.Add(mapping, new Dictionary <RuntimeId, MappedInputHandler>()); } this.inputMappings[mapping][id] = handler; } }
AttachableProcessInfo(int processId, RuntimeId runtimeId, Guid runtimeGuid, Guid runtimeKindGuid, string runtimeName, string name, string title, string filename, string commandLine, DbgArchitecture architecture, DbgOperatingSystem operatingSystem) { ProcessId = processId; RuntimeId = runtimeId ?? throw new ArgumentNullException(nameof(runtimeId)); RuntimeGuid = runtimeGuid; RuntimeKindGuid = runtimeKindGuid; RuntimeName = runtimeName ?? throw new ArgumentNullException(nameof(runtimeName)); Name = name ?? throw new ArgumentNullException(nameof(name)); Title = title ?? throw new ArgumentNullException(nameof(title)); Filename = filename ?? throw new ArgumentNullException(nameof(filename)); CommandLine = commandLine ?? throw new ArgumentNullException(nameof(commandLine)); Architecture = architecture; OperatingSystem = operatingSystem; }
/// <summary> /// Constructor /// </summary> /// <param name="guid">GUID returned by <see cref="DbgRuntime.Guid"/></param> /// <param name="runtimeKindGuid">GUID returned by <see cref="DbgRuntime.RuntimeKindGuid"/></param> /// <param name="name">Name returned by <see cref="DbgRuntime.Name"/></param> /// <param name="id">Id returned by <see cref="DbgRuntime.Id"/></param> /// <param name="tags">Tags returned by <see cref="DbgRuntime.Tags"/></param> public DbgEngineRuntimeInfo(Guid guid, Guid runtimeKindGuid, string name, RuntimeId id, ReadOnlyCollection <string> tags) { if (guid == Guid.Empty) { throw new ArgumentOutOfRangeException(nameof(guid)); } if (runtimeKindGuid == Guid.Empty) { throw new ArgumentOutOfRangeException(nameof(runtimeKindGuid)); } Guid = guid; RuntimeKindGuid = runtimeKindGuid; Name = name ?? throw new ArgumentNullException(nameof(name)); Id = id ?? throw new ArgumentNullException(nameof(id)); Tags = tags ?? throw new ArgumentNullException(nameof(tags)); }
public ProcessKey(int pid, RuntimeId rid) { this.pid = pid; this.rid = rid ?? throw new ArgumentNullException(nameof(rid)); }
public override string ToString() { return(nameof(ElementRemovedWaiter) + (this._runtimeId != null ? " with RuntimeId: " + RuntimeId.StringFromParts(runtimeIdParts: this._runtimeId) : "")); }
public ElementRemovedWaiter(UIObject root, Scope scope, string runtimeId) : this(root : root, scope : scope, runtimeId : RuntimeId.PartsFromString(runtimeIdString : runtimeId)) { }
/// <summary>Removes all handlers for the specified controller target.</summary> /// <returns>True, if controller was removed; otherwise, false.</returns> public bool RemoveControllerTarget(RuntimeId targetId) { return(this.handlers.Remove(targetId)); }