public static bool IsConnected() { bool isConnected = false; try { // string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); var dir = GTPath.GetLocalApplicationDataPath(); DirectoryInfo dirInfo = new DirectoryInfo(new Uri(dir).LocalPath); Context ctx = new Context(dirInfo.FullName + "\\" + configFile); ProductionNode irNode = ctx.FindExistingNode(NodeType.IR) as IRGenerator; if (irNode != null) { isConnected = true; } irNode.Dispose(); ctx.Dispose(); } catch (Exception ex) { isConnected = false; } return(isConnected); }
/// @brief Used to release an added node /// /// This will release an added node from the context. /// @note - It is the responsibility of the caller to call this only on nodes created using the @ref CreateNode /// method and only when the context is valid! This method should be called on every node created BEFORE /// calling @ref Dispose. /// /// @param node The node to release public void ReleaseNode(ProductionNode node) { Log("disposing type=" + node.GetType(), NIEventLogger.Categories.Initialization, NIEventLogger.Sources.BaseObjects, NIEventLogger.VerboseLevel.Verbose); // note no need to stop generating a generator because disposing will do it for us. node.Dispose(); }