/// <summary>Removes the graph from the running object table.</summary> /// <param name="cookie">The cookie value for the registered graph.</param> private static void RemoveGraphFromRot(RunningObjectTableCookie cookie) { if (!cookie.IsValid) { throw new ArgumentException("cookie"); } IRunningObjectTable rot = null; try { // Get the running object table and revoke the cookie rot = GetRunningObjectTable(0); rot.Revoke(cookie.Value); cookie.IsValid = false; } finally { // Release the ROT if (rot != null) { while (Marshal.ReleaseComObject(rot) > 0) { ; } } } }
/// <summary>Disposes of the GraphPublisher, removing the graph from the ROT if it was previously added.</summary> void IDisposable.Dispose() { if (_cookie != null) { _cookie.Dispose(); _cookie = null; } }
/// <summary>Disposes of the GraphPublisher, removing the graph from the ROT if it was previously added.</summary> void IDisposable.Dispose() { if (_cookie != null) { _cookie.Dispose(); _cookie = null; } }
/// <summary>Publishes a graph to the running object table for GraphEdit to analyze and to a GRF file.</summary> /// <param name="graph">The graph to be published.</param> /// <param name="path">The path to the file to which the GRF file should be written.</param> /// <param name="useRot">Whether the graph should be added to the running object table.</param> public GraphPublisher(IGraphBuilder graph, string path, bool useRot) { if (graph == null) { throw new ArgumentNullException("graph"); } if (path != null) { SaveGraphToFile(graph, path); } if (useRot) { _cookie = AddGraphToRot(graph); } }
/// <summary>Publishes a graph to the running object table for GraphEdit to analyze and to a GRF file.</summary> /// <param name="graph">The graph to be published.</param> /// <param name="path">The path to the file to which the GRF file should be written.</param> /// <param name="useRot">Whether the graph should be added to the running object table.</param> public GraphPublisher(IGraphBuilder graph, string path, bool useRot) { if (graph == null) throw new ArgumentNullException("graph"); if (path != null) SaveGraphToFile(graph, path); if (useRot) _cookie = AddGraphToRot(graph); }
/// <summary>Removes the graph from the running object table.</summary> /// <param name="cookie">The cookie value for the registered graph.</param> private static void RemoveGraphFromRot(RunningObjectTableCookie cookie) { if (!cookie.IsValid) throw new ArgumentException("cookie"); IRunningObjectTable rot = null; try { // Get the running object table and revoke the cookie rot = GetRunningObjectTable(0); rot.Revoke(cookie.Value); cookie.IsValid = false; } finally { // Release the ROT if (rot != null) while (Marshal.ReleaseComObject(rot) > 0) ; } }