Example #1
0
        /// <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)
                    {
                        ;
                    }
                }
            }
        }
Example #2
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;
     }
 }
Example #3
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;
     }
 }
Example #4
0
 /// <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);
     }
 }
Example #5
0
 /// <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);
 }
Example #6
0
 /// <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) ;
     }
 }