Exemplo n.º 1
0
        private static NetGraph BuildGraph(ScriptContainer container, string classname, string selectionPath, out BasePipelineNode input, out ParseWithPipelineNode output)
        {
            DynamicNodeFactory           factory          = new DynamicNodeFactory("", Guid.NewGuid(), container, classname, null);
            ParseWithPipelineNodeFactory parseWithFactory = new ParseWithPipelineNodeFactory();

            factory.SelectionPath = selectionPath;

            NetGraphBuilder builder = new NetGraphBuilder();

            builder.AddNode(factory);
            builder.AddNode(parseWithFactory);
            builder.AddLine(factory, parseWithFactory, null);

            NetGraph graph = builder.Factory.Create(Logger.GetSystemLogger(), null, new MetaDictionary(), new MetaDictionary(), new PropertyBag("Connection"));

            input  = graph.Nodes[factory.Id];
            output = (ParseWithPipelineNode)graph.Nodes[parseWithFactory.Id];

            return(graph);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the local directory for configuration
        /// </summary>
        /// <param name="create">True to create the directory</param>
        /// <returns>The configuration directory, null if couldn't create</returns>
        public static string GetConfigDirectory(bool create)
        {
            string appData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                "Context Information Security", "CANAPE");

            if (create)
            {
                if (!Directory.Exists(appData))
                {
                    try
                    {
                        Directory.CreateDirectory(appData);
                    }
                    catch (IOException)
                    {
                        Logger.GetSystemLogger().LogError(Properties.Resources.GetConfigDir_ErrorCreatingDir);
                        appData = null;
                    }
                }
            }

            return appData;
        }