Example #1
0
 /// <summary>
 /// Creates a new Construct Context
 /// </summary>
 /// <param name="g">Graph to construct Triples in</param>
 /// <param name="s">Set to construct from</param>
 /// <param name="preserveBNodes">Whether Blank Nodes bound to variables should be preserved as-is</param>
 /// <remarks>
 /// <para>
 /// Either the <paramref name="s">Set</paramref>  or <paramref name="g">Graph</paramref> parameters may be null if required
 /// </para>
 /// </remarks>
 public ConstructContext(IGraph g, ISet s, bool preserveBNodes)
 {
     this._g = g;
     this._factory = (this._g != null ? (INodeFactory)this._g : _globalFactory.Value);
     this._s = s;
     this._preserveBNodes = preserveBNodes;
 }
Example #2
0
        protected Node(INodeFactory factory)
        {
            if(factory == null)
                throw new ArgumentNullException("factory");

            this.Factory = factory;
        }
 /// <summary>
 /// Constructor to create the instance of the node control.
 /// </summary>
 /// <param name="parentNodeFactory">Parent node factory for this control.</param>
 public ReportNodeControl(INodeFactory parentNodeFactory) : this()
 {
     if (parentNodeFactory == null)
     {
         ExceptionManager.Throw(new ArgumentNullException("parentNodeFactory"));
     }
     _parentNodeFactory = parentNodeFactory;
 }
        public static INode ToNode(this EntityId entityId, INodeFactory factory)
        {
            if (entityId is BlankId)
            {
                return factory.CreateBlankNode(entityId.Uri.Authority);
            }

            return factory.CreateUriNode(entityId.Uri);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultNodeFactory"/> class.
 /// </summary>
 /// <param name="types">The types.</param>
 /// <exception cref="System.ArgumentNullException">types</exception>
 /// <exception cref="System.ArgumentException">types</exception>
 public DefaultNodeFactory(IEnumerable<Type> types)
 {
     if(types == null)
         throw new ArgumentNullException("types");
     
     _types = types.ToArray();
     if(_types.Any(t => t == null))
         throw new ArgumentException("types");
     _innerFactory = this.CreateFactory();
 }
        public FolderNode(IProjectIO projectIO, INodeFactory nodeFactory, string dirpath, bool isRoot = false)
        {
            _io = projectIO;
            _nodeFactory = nodeFactory;
            _dirpath = dirpath;
            _isRoot = isRoot;

            _children.CollectionChanged += OnCollectionChanged;

            LoadFilesAndDirectories();
        }
        internal static MemberBindingNode Create(INodeFactory factory, MemberBinding memberBinding)
        {
            MemberBindingNode memberBindingNode = null;

            if (memberBinding is MemberAssignment)
                memberBindingNode = new MemberAssignmentNode(factory, (MemberAssignment)memberBinding);
            else if (memberBinding is MemberListBinding)
                memberBindingNode = new MemberListBindingNode(factory, (MemberListBinding)memberBinding);
            else if (memberBinding is MemberMemberBinding)
                memberBindingNode = new MemberMemberBindingNode(factory, (MemberMemberBinding)memberBinding);
            else if (memberBinding != null)
                throw new ArgumentException("Unknown member binding of type " + memberBinding.GetType(), "memberBinding");

            return memberBindingNode;
        }
Example #8
0
        public override System.Collections.Generic.IEnumerable<INodeFactory> ResolvePath(
            PowerShell.Provider.PathNodeProcessors.IContext context, string path)
        {
            path = context.SessionState.Path.GetUnresolvedProviderPathFromPSPath(path);
            
            var nf = PathCache.Get(path);
            if (null != nf)
            {
                return nf;
            }

            var driveInfo = GetDriveFromPath(context, path);

            if (null == driveInfo)
            {
                context.WriteWarning(String.Format("Could not determine drive for path [{0}]", path));
                return base.ResolvePath(context, path);
            }

            string fileOrServerPath = Regex.Replace(path, @"^[^::]+::", String.Empty);

            var re = new Regex("^.*(" + Regex.Escape(driveInfo.Root) + ")(.*)$", RegexOptions.IgnoreCase);
            var matches = re.Match(path);
            fileOrServerPath = matches.Groups[1].Value;
            path = matches.Groups[2].Value;

            if (File.Exists(fileOrServerPath) || Directory.Exists(fileOrServerPath))
            {
                _root = new BipsFileRootNodeFactory(driveInfo, fileOrServerPath);
            }
            else
            {
                _root = new BipsRootNodeFactory(driveInfo);
            }

            var nodes = base.ResolvePath(context, path);
            if (null == nodes || !nodes.Any())
            {
                return nodes;
            }

            nodes = nodes.ToList();

            PathCache.Add( path, nodes );

            return nodes;
        }
        /// <summary>Converts a RomanticWeb's <see cref="Node"/> into dotNetRDF's <see cref="INode"/>.</summary>
        public static INode UnWrapNode(this Node node, INodeFactory nodeFactory)
        {
            if (node.IsUri)
            {
                return nodeFactory.CreateUriNode(node.Uri);
            }

            if (node.IsLiteral)
            {
                if (node.Language != null)
                {
                    return nodeFactory.CreateLiteralNode(node.Literal, node.Language);
                }

                if (node.DataType != null)
                {
                    return nodeFactory.CreateLiteralNode(node.Literal, node.DataType);
                }

                return nodeFactory.CreateLiteralNode(node.Literal);
            }

            return nodeFactory.CreateBlankNode(node.BlankNode);
        }
Example #10
0
        void RemoveItem(string path, INodeFactory factory, bool recurse)
        {
            var remove = factory as IRemoveItem;

            if (null == factory || null == remove)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.RemoveItem, RemoveItemNotSupportedErrorID);
                return;
            }

            if (!ShouldProcess(path, ProviderCmdlet.RemoveItem))
            {
                return;
            }

            try
            {
                DoRemoveItem(path, recurse, remove);
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, RemoveItemInvokeErrorID, path);
            }
        }
Example #11
0
        void NewItem(string path, bool isParentPathNodeFactory, INodeFactory factory, string itemTypeName, object newItemValue)
        {
            var @new = factory as INewItem;

            if (null == factory || null == @new)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.NewItem, NewItemNotSupportedErrorID);
                return;
            }

            var fullPath   = path;
            var parentPath = fullPath;
            var child      = isParentPathNodeFactory ? GetChildName(path) : null;

            if (null != child)
            {
                parentPath = GetParentPath(fullPath, GetRootPath());
            }

            if (!ShouldProcess(fullPath, ProviderCmdlet.NewItem))
            {
                return;
            }

            try
            {
                var      item = @new.NewItem(CreateContext(fullPath), child, itemTypeName, newItemValue);
                PathNode node = item as PathNode;

                WritePathNode(parentPath, node);
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, NewItemInvokeErrorID, fullPath);
            }
        }
Example #12
0
        /// <summary>Converts a RomanticWeb's <see cref="Node"/> into dotNetRDF's <see cref="VDS.RDF.INode"/>.</summary>
        public static VDS.RDF.INode UnWrapNode(this Model.INode node, INodeFactory nodeFactory)
        {
            if (node.IsUri)
            {
                return(nodeFactory.CreateUriNode(node.Uri));
            }

            if (node.IsLiteral)
            {
                if (node.Language != null)
                {
                    return(nodeFactory.CreateLiteralNode(node.Literal, node.Language));
                }

                if (node.DataType != null)
                {
                    return(nodeFactory.CreateLiteralNode(node.Literal, node.DataType));
                }

                return(nodeFactory.CreateLiteralNode(node.Literal));
            }

            return(nodeFactory.CreateBlankNode(node.BlankNode));
        }
Example #13
0
 public DiscoveryApp(
     INodesLocator nodesLocator,
     IDiscoveryManager discoveryManager,
     INodeFactory nodeFactory,
     INodeTable nodeTable,
     IMessageSerializationService messageSerializationService,
     ICryptoRandom cryptoRandom,
     INetworkStorage discoveryStorage,
     IConfigProvider configurationProvider,
     ILogManager logManager, IPerfService perfService)
 {
     _logManager                  = logManager;
     _perfService                 = perfService;
     _logger                      = _logManager.GetClassLogger();
     _configurationProvider       = configurationProvider.GetConfig <INetworkConfig>();
     _nodesLocator                = nodesLocator;
     _discoveryManager            = discoveryManager;
     _nodeFactory                 = nodeFactory;
     _nodeTable                   = nodeTable;
     _messageSerializationService = messageSerializationService;
     _cryptoRandom                = cryptoRandom;
     _discoveryStorage            = discoveryStorage;
     _discoveryStorage.StartBatch();
 }
 public PropertyInfoNode(INodeFactory factory, PropertyInfo memberInfo)
     : base(factory, memberInfo)
 {
 }
 public NewArrayExpressionNode(INodeFactory factory, NewArrayExpression expression)
     : base(factory, expression)
 {
 }
Example #16
0
 protected MemberBindingNode(INodeFactory factory)
     : base(factory)
 {
 }
Example #17
0
 /// <summary>
 /// Creates a new Construct Context
 /// </summary>
 /// <param name="factory">Factory to create nodes with</param>
 /// <param name="s">Set to construct from</param>
 /// <param name="preserveBNodes">Whether Blank Nodes bound to variables should be preserved as-is</param>
 /// <remarks>
 /// <para>
 /// Either the <paramref name="s">Set</paramref>  or <paramref name="factory">Factory</paramref> parameters may be null if required
 /// </para>
 /// </remarks>
 public ConstructContext(INodeFactory factory, ISet s, bool preserveBNodes)
 {
     this._factory = (factory != null ? factory : _globalFactory.Value);
     this._s = s;
     this._preserveBNodes = preserveBNodes;
 }
 public ConditionalExpressionNode(INodeFactory factory, ConditionalExpression expression)
     : base(factory, expression)
 {
 }
 public void Setup()
 {
     _graph = new Graph();
 }
Example #20
0
 public MemberInfoNode(INodeFactory factory, MemberInfo memberInfo)
     : base(factory, memberInfo)
 {
 }
Example #21
0
 void GetChildItems(string path, INodeFactory nodeFactory, bool recurse)
 {
     var context = CreateContext(path, recurse );
     var children = nodeFactory.GetNodeChildren(context);
     WriteChildItem(path, recurse, children);
 }
Example #22
0
 private bool ForceOrShouldContinue(INodeFactory factory, string fullPath, string op)
 {
     return ForceOrShouldContinue(factory.Name, fullPath, op);
 }
Example #23
0
        void CopyItem( string path, INodeFactory sourceNode, string copyPath, bool recurse )
        {
            ICopyItem copyItem = GetCopyItem(sourceNode);
            if (null == copyItem)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.CopyItem, CopyItemNotSupportedErrorID);
                return;
            }

            if (!ShouldProcess(path, ProviderCmdlet.CopyItem ))
            {
                return;
            }

            try
            {
                IPathNode node = DoCopyItem(path, copyPath, recurse, copyItem);
                WritePathNode(copyPath, node);
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, CopyItemInvokeErrorID, path);
            }
        }
Example #24
0
        void ClearItem( string path, INodeFactory factory )
        {
            var clear = factory as IClearItem;
            if (null == factory || null == clear)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.ClearItem, ClearItemNotSupportedErrorID);
                return;
            }

            var fullPath = path;
            path = GetChildName(path);

            if (!ShouldProcess(fullPath, ProviderCmdlet.ClearItem))
            {
                return;
            }

            try
            {
                clear.ClearItem(CreateContext(fullPath), path);
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, ClearItemInvokeErrorID, fullPath);
            }
        }
Example #25
0
        private void WritePathNode(string nodeContainerPath, INodeFactory factory)
        {
            var value = factory.GetNodeValue();
            if (null == value)
            {
                return;
            }

            PSObject pso = PSObject.AsPSObject(value.Item);
            pso.Properties.Add(new PSNoteProperty(ItemModePropertyName, factory.ItemMode));
            WriteItemObject(pso, nodeContainerPath, value.IsCollection);
        }
Example #26
0
        void SetProperty(string path, INodeFactory factory, PSObject propertyValue)
        {
            var node = factory.GetNodeValue();
            var value = node.Item;
            var propDescs = TypeDescriptor.GetProperties(value);
            var psoDesc = propertyValue.Properties;
            var props = (from PropertyDescriptor prop in propDescs
                         let psod = (from pso in psoDesc
                                     where StringComparer.InvariantCultureIgnoreCase.Equals(pso.Name, prop.Name)
                                     select pso).FirstOrDefault()
                         where null != psod
                         select new {PSProperty = psod, Property = prop});

            props.ToList().ForEach(p => p.Property.SetValue(value, p.PSProperty.Value));
        }
Example #27
0
        void SetItem( string path, INodeFactory factory, object value )
        {
            var @set = factory as ISetItem;
            if (null == factory || null == @set)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.SetItem, SetItemNotSupportedErrorID);
                return;
            }

            var fullPath = path;
            path = GetChildName(path);

            if (!ShouldProcess(fullPath, ProviderCmdlet.SetItem))
            {
                return;
            }

            try
            {
                var result = @set.SetItem(CreateContext(fullPath), path, value);
                if (null != result)
                {
                    WritePathNode(fullPath, result);
                }
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, SetItemInvokeErrorID, fullPath);
            }
        }
Example #28
0
 public SerializerDeserializer(IDataSource datasource, INodeFactory <ConversationNode <TNodeUI, TTransitionUI>, TTransitionUI, TUIRawData> nodeFactory, ISerializerDeserializerXml <TNodeUI, TUIRawData> nodeUISerializer)
 {
     deserializer = new Deserializer(datasource, nodeFactory, nodeUISerializer);
     serializer   = new Serializer(nodeUISerializer);
 }
 public NodeOne(INodeFactory nodeFactory)
 {
 }
Example #30
0
 void GetChildNames( string path, INodeFactory nodeFactory, ReturnContainers returnContainers )
 {
     nodeFactory.GetNodeChildren(CreateContext(path)).ToList().ForEach(
         f =>
             {
                 var i = f.GetNodeValue();
                 if (null == i)
                 {
                     return;
                 }
                 WriteItemObject(i.Name, path + "\\" + i.Name, i.IsCollection);
             });
 }
Example #31
0
        private void RenameItem(string path, INodeFactory factory, string newName)
        {
            var rename = factory as IRenameItem;
            if (null == factory || null == rename)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.RenameItem, RenameItemNotsupportedErrorID);
                return;
            }

            var fullPath = path;

            if (!ShouldProcess(fullPath, ProviderCmdlet.RenameItem))
            {
                return;
            }

            var child = GetChildName(path);
            try
            {
                rename.RenameItem(CreateContext(fullPath), child, newName);
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, RenameItemInvokeErrorID, fullPath);
            }
        }
Example #32
0
        private List<string> GetCmdletHelpKeysForNodeFactory(INodeFactory nodeFactory)
        {
            var nodeFactoryType = nodeFactory.GetType();
            var idsFromAttributes =
                from CmdletHelpPathIDAttribute attr in
                    nodeFactoryType.GetCustomAttributes(typeof (CmdletHelpPathIDAttribute), true)
                select attr.ID;

            List<string> keys = new List<string>(idsFromAttributes);
            keys.AddRange(new[]
                              {
                                  nodeFactoryType.FullName,
                                  nodeFactoryType.Name,
                                  nodeFactoryType.Name.Replace("NodeFactory", ""),
                              });
            return keys;
        }
Example #33
0
 public BaseDocumentHead(INodeFactory nodeFactory)
 {
     m_nodeFactory = nodeFactory;
 }
Example #34
0
        private IContentReader GetContentReader(string path, INodeFactory nodeFactory)
        {
            var getContentReader = nodeFactory as IGetItemContent;
            if( null == getContentReader )
            {
                return null;
            }

            return getContentReader.GetContentReader( CreateContext(path));
        }
Example #35
0
        void NewItem( string path, bool isParentPathNodeFactory, INodeFactory factory, string itemTypeName, object newItemValue )
        {
            var @new = factory as INewItem;
            if (null == factory || null == @new)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.NewItem, NewItemNotSupportedErrorID);
                return;
            }

            var fullPath = path;
            var parentPath = fullPath;
            var child = isParentPathNodeFactory ? GetChildName(path) : null;
            if( null != child )
            {
                parentPath = GetParentPath(fullPath, GetRootPath());
            }

            if (!ShouldProcess(fullPath, ProviderCmdlet.NewItem))
            {
                return;
            }

            try
            {
                var item = @new.NewItem(CreateContext(fullPath), child, itemTypeName, newItemValue);
                PathNode node = item as PathNode;

                WritePathNode(parentPath, node);
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, NewItemInvokeErrorID, fullPath);
            }
        }
Example #36
0
        private ICopyItem GetCopyItem(INodeFactory sourceNode)
        {
            var copyItem = sourceNode as ICopyItem;
            if (null == sourceNode || null == copyItem)
            {
                return null;
            }

            return copyItem;
        }
Example #37
0
 /// <summary>
 ///     Adds a node factory to this manager.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="loader"></param>
 internal void AddFactory <T>(INodeFactory <T> loader) where T : NodeModel
 {
     AddFactory(typeof(T), loader);
 }
Example #38
0
        //OPT: Replace with usage of MapTriple instead?

        /// <summary>
        /// Helper method which rewrites Blank Node IDs for Describe Queries
        /// </summary>
        /// <param name="t">Triple</param>
        /// <param name="mapping">Mapping of IDs to new Blank Nodes</param>
        /// <param name="factory">Factory to create Nodes in</param>
        /// <returns></returns>
        protected Triple RewriteDescribeBNodes(Triple t, Dictionary <String, INode> mapping, INodeFactory factory)
        {
            INode  s, p, o;
            String id;

            if (t.Subject.NodeType == NodeType.Blank)
            {
                id = t.Subject.GetHashCode() + "-" + t.Graph.GetHashCode();
                if (mapping.ContainsKey(id))
                {
                    s = mapping[id];
                }
                else
                {
                    s = factory.CreateBlankNode(id);
                    mapping.Add(id, s);
                }
            }
            else
            {
                s = Tools.CopyNode(t.Subject, factory);
            }

            if (t.Predicate.NodeType == NodeType.Blank)
            {
                id = t.Predicate.GetHashCode() + "-" + t.Graph.GetHashCode();
                if (mapping.ContainsKey(id))
                {
                    p = mapping[id];
                }
                else
                {
                    p = factory.CreateBlankNode(id);
                    mapping.Add(id, p);
                }
            }
            else
            {
                p = Tools.CopyNode(t.Predicate, factory);
            }

            if (t.Object.NodeType == NodeType.Blank)
            {
                id = t.Object.GetHashCode() + "-" + t.Graph.GetHashCode();
                if (mapping.ContainsKey(id))
                {
                    o = mapping[id];
                }
                else
                {
                    o = factory.CreateBlankNode(id);
                    mapping.Add(id, o);
                }
            }
            else
            {
                o = Tools.CopyNode(t.Object, factory);
            }

            return(new Triple(s, p, o));
        }
Example #39
0
 protected MemberBindingNode(INodeFactory factory, MemberBindingType bindingType, MemberInfo memberInfo)
     : base(factory)
 {
     this.BindingType = bindingType;
     this.Member      = new MemberInfoNode(this.Factory, memberInfo);
 }
 public LambdaExpressionNode(INodeFactory factory, LambdaExpression expression)
     : base(factory, expression)
 {
 }
Example #41
0
        public static void Test()
        {
            IEnumerable <GraphAndUI <NodeUIData> > nodes = Enumerable.Empty <GraphAndUI <NodeUIData> >();
            List <NodeGroup>               groups        = new List <NodeGroup>();
            MemoryStream                   rawData       = new MemoryStream();
            DocumentPath                   file          = DocumentPath.FromPath("DeleteMe.txt", new DirectoryInfo("."));
            ISerializer <TData>            serializer    = null;
            ReadOnlyCollection <LoadError> errors        = new ReadOnlyCollection <LoadError>(new List <LoadError>());
            INodeFactory                   nodeFactory   = null;
            GenerateAudio                  generateAudio = null;
            var source = new DynamicEnumParameter.Source();
            Func <IDynamicEnumParameter, object, DynamicEnumParameter.Source> getDocumentSource = (a, b) => source;
            IAudioLibrary audioProvider = new DummyAudioLibrary();

            List <List <ConversationNode> > states = new List <List <ConversationNode <INodeGui> > >
            {
                new List <ConversationNode>()
            };

            Random r = new Random(0);

            UpToDateFile.BackEnd backend = new UpToDateFile.BackEnd();
            var id = Id <FileInProject> .Parse("6a1bd06a-0028-4099-a375-475f1a5320db");

            using (ConversationFile conversationFile = new ConversationFile(id, nodes, groups, rawData, file, serializer, errors, nodeFactory, generateAudio, getDocumentSource, audioProvider, backend))
            {
                for (int i = 0; i < 10; i++)
                {
                    var node  = MakeNode();
                    var state = states[i].ToList();
                    state.Add(node);
                    conversationFile.Add(new[] { node }, Enumerable.Empty <NodeGroup>(), null);
                    CheckState(conversationFile, state);
                    states.Add(state);
                }

                Action <ConversationNode> CheckNode = node =>
                {
                    var connector = conversationFile.UIInfo(node.Data.Connectors.First(), false);
                    Assert.That(connector.Area.Value, Is.EqualTo(TopPosition(node.Renderer.Area)));
                };

                for (int n = 0; n < 10000; n++)
                {
                    var node = states.Last().Last();
                    node.Renderer.MoveTo(new PointF((float)r.NextDouble() * 1000, (float)r.NextDouble() * 1000));
                    CheckNode(node);
                }

                for (int i = 9; i >= 0; i--)
                {
                    conversationFile.UndoableFile.UndoQueue.Undo();
                    var state = states[i];
                    CheckState(conversationFile, state);
                }
                for (int i = 1; i <= 10; i++)
                {
                    conversationFile.UndoableFile.UndoQueue.Redo();
                    var state = states[i];
                    CheckState(conversationFile, state);
                }
            }
            Assert.Inconclusive();
        }
 public FieldInfoNode(INodeFactory factory, FieldInfo memberInfo)
     : base(factory, memberInfo)
 {
 }
Example #43
0
            public void ReadNodes(out IEnumerable <ConversationNode <TNodeUI, TTransitionUI> > nodes, out IEnumerable <NodeGroup <ConversationNode <TNodeUI, TTransitionUI> > > groups, Stream stream, IDataSource datasource, INodeFactory <ConversationNode <TNodeUI, TTransitionUI>, TTransitionUI, TUIRawData> nodeFactory)
            {
                stream.Position = 0;
                var d    = XDocument.Load(stream);
                var root = d.Element(ROOT);

                if (root.Attribute("xmlversion") == null || root.Attribute("xmlversion").Value != XML_VERSION)
                {
                    throw new Exception("unrecognised conversation xml version");
                }

                IDictionary <ConversationNode <TNodeUI, TTransitionUI>, IDictionary <Output, IEnumerable <NodeID> > > links = root.Elements("Node").Select(n => ReadEditable(n, datasource, nodeFactory)).ToDictionary(nnl => nnl.Node, nnl => nnl.Links);
                IDictionary <NodeID, ConversationNode <TNodeUI, TTransitionUI> > allnodes = links.Keys.ToDictionary(n => n.Id, n => n);

                foreach (var nodeAndLink in links)
                {
                    var node = nodeAndLink.Key;
                    foreach (var output in node.TransitionsOut)
                    {
                        if (nodeAndLink.Value.ContainsKey(output.Output))
                        {
                            foreach (var linkto in nodeAndLink.Value[output.Output])
                            {
                                if (allnodes.ContainsKey(linkto))
                                {
                                    output.ConnectTo(allnodes[linkto].TransitionsIn.First());
                                }
                            }
                        }
                    }
                }
                nodes = allnodes.Values;

                var groupsResult = new List <NodeGroup <ConversationNode <TNodeUI, TTransitionUI> > >();

                //TODO: Read groups when serialization has stabilized
                //foreach (var g in root.Elements("Group"))
                //{
                //    var contents = g.Elements("Node").Select(n => NodeID.Parse(n.Attribute("Id").Value));
                //    var containedNodes = contents.Where(id => allnodes.ContainsKey(id)).Select(id => allnodes[id]);
                //    m_nodeUISerializer.Read(g);
                //    //System.Drawing.RectangleF area = ReadArea(g);
                //    groupsResult.Add(new NodeGroup<ConversationNode<TNodeUI, TTransitionUI>>(area, containedNodes));
                //}
                groups = groupsResult;
            }
Example #44
0
 /// <summary>
 /// Internal Only constructor for Blank Nodes.
 /// </summary>
 /// <param name="factory">Node Factory from which to obtain a Node ID.</param>
 protected internal BlankNode(INodeFactory factory)
     : base(factory)
 {
 }
Example #45
0
 public Deserializer(IDataSource datasource, INodeFactory <ConversationNode <TNodeUI, TTransitionUI>, TTransitionUI, TUIRawData> nodeFactory, ISerializerDeserializerXml <TNodeUI, TUIRawData> nodeUISerializer)
 {
     m_datasource       = datasource;
     m_nodeFactory      = nodeFactory;
     m_nodeUISerializer = nodeUISerializer;
 }
Example #46
0
 public ConstructorInfoNode(INodeFactory factory, ConstructorInfo memberInfo)
     : base(factory, memberInfo)
 {
 }
 /// <summary>
 /// Constructor to create the instance of the control.
 /// </summary>
 /// <param name="nodeFactory">Node factory for the control.</param>
 public PatientNodeControl(INodeFactory nodeFactory) : this()
 {
     _nodeFactory = nodeFactory;
 }
Example #48
0
 public RenamedNodeFactoryDecorator(INodeFactory factory, string name)
 {
     _factory = factory;
     _name    = name;
 }
Example #49
0
 void GetItem( string path, INodeFactory factory )
 {
     try
     {
         WritePathNode(path, factory);
     }
     catch (Exception e)
     {
         WriteGeneralCmdletError(e, GetItemInvokeErrorID, path);
     }
 }
Example #50
0
        void RemoveItem( string path, INodeFactory factory, bool recurse)
        {
            var remove = factory as IRemoveItem;
            if (null == factory || null == remove)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.RemoveItem, RemoveItemNotSupportedErrorID);
                return;
            }

            if (!ShouldProcess(path, ProviderCmdlet.RemoveItem))
            {
                return;
            }

            try
            {
                DoRemoveItem(path, recurse, remove);
            }
            catch (Exception e)
            {
                WriteGeneralCmdletError(e, RemoveItemInvokeErrorID, path);
            }
        }
Example #51
0
 public CoreCalculationGraph(Func <IStat, IStatGraph> statGraphFactory, INodeFactory nodeFactory)
 {
     _nodeFactory      = nodeFactory;
     _statGraphFactory = statGraphFactory;
 }
Example #52
0
        void GetProperty(string path, INodeFactory factory, Collection<string> providerSpecificPickList)
        {
            var node = factory.GetNodeValue();
            PSObject values = null;

            if (null == providerSpecificPickList || 0 == providerSpecificPickList.Count)
            {
                values = PSObject.AsPSObject(node.Item);
            }
            else
            {
                values = new PSObject();
                var value = node.Item;
                var propDescs = TypeDescriptor.GetProperties(value);
                var props = (from PropertyDescriptor prop in propDescs
                             where (providerSpecificPickList.Contains(prop.Name,
                                                                      StringComparer.InvariantCultureIgnoreCase))
                             select prop);

                props.ToList().ForEach(p =>
                                           {
                                               var iv = p.GetValue(value);
                                               if (null != iv)
                                               {
                                                   values.Properties.Add(new PSNoteProperty(p.Name, p.GetValue(value)));
                                               }
                                           });
            }
            WritePropertyObject(values, path);
        }
Example #53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElementInitNode"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="elementInit">The element init.</param>
 public ElementInitNode(INodeFactory factory, ElementInit elementInit)
     : base(factory)
 {
     this.Initialize(elementInit);
 }
Example #54
0
        void InvokeDefaultAction( string path, INodeFactory factory )
        {
            var invoke = factory as IInvokeItem;
            if (null == factory || null == invoke)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.InvokeItem, InvokeItemNotSupportedErrorID);
                return;
            }

            var fullPath = path;

            if (!ShouldProcess(fullPath, ProviderCmdlet.InvokeItem))
            {
                return;
            }

            path = GetChildName(path);
            try
            {
                var results = invoke.InvokeItem(CreateContext(fullPath), path);
                if (null == results)
                {
                    return;
                }

                // TODO: determine what exactly to return here
                //  http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCAQFjAA&url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.management.automation.provider.itemcmdletprovider.invokedefaultaction(v%3Dvs.85).aspx&ei=28vLTpyrJ42utwfUo6WYAQ&usg=AFQjCNFto_ye_BBjxxWfzBFGfNxw3eEgTw
                //  docs tell me to return the item being invoked... but I'm not sure.
                //  is there any way for the target of the invoke to return data to the runspace??
                //results.ToList().ForEach(r => this.WriteObject(r));
            }
            catch( Exception e )
            {
                WriteGeneralCmdletError(e, InvokeItemInvokeErrorID, fullPath);
            }
        }
Example #55
0
 public PingMessageSerializer(ISigner signer, IPrivateKeyGenerator privateKeyGenerator, IDiscoveryMessageFactory messageFactory, INodeIdResolver nodeIdResolver, INodeFactory nodeFactory) : base(signer, privateKeyGenerator, messageFactory, nodeIdResolver, nodeFactory)
 {
 }
Example #56
0
        void MoveItem(string path, INodeFactory sourceNode, string destination)
        {
            var copy = GetCopyItem(sourceNode);
            var remove = copy as IRemoveItem;
            if (null == copy || null == remove)
            {
                WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.MoveItem, MoveItemNotSupportedErrorID);
                return;
            }

            if (!ShouldProcess(path, ProviderCmdlet.MoveItem ))
            {
                return;
            }

            try
            {
                DoCopyItem(path, destination, true, copy);
                DoRemoveItem(path, true, remove);
            }
            catch( Exception e )
            {
                WriteGeneralCmdletError( e, MoveItemInvokeErrorID, path);
            }
        }
 public FindNodeMessageSerializer(ISigner signer, IPrivateKeyProvider privateKeyProvider, IDiscoveryMessageFactory messageFactory, INodeIdResolver nodeIdResolver, INodeFactory nodeFactory) : base(signer, privateKeyProvider, messageFactory, nodeIdResolver, nodeFactory)
 {
 }
 public MemberAssignmentNode(INodeFactory factory, MemberAssignment memberAssignment)
     : base(factory, memberAssignment.BindingType, memberAssignment.Member)
 {
     this.Expression = this.Factory.Create(memberAssignment.Expression);
 }
Example #59
0
 public StatNodeFactory(INodeFactory nodeFactory, IStat stat)
 {
     _nodeFactory = nodeFactory;
     _stat        = stat;
 }
 public MemberMemberBindingNode(INodeFactory factory, MemberMemberBinding memberMemberBinding)
     : base(factory, memberMemberBinding.BindingType, memberMemberBinding.Member)
 {
     this.Bindings = new MemberBindingNodeList(factory, memberMemberBinding.Bindings);
 }