コード例 #1
0
ファイル: AstParserScopeManager.cs プロジェクト: japj/vulcan
 public AstParserScopeManager Clone()
 {
     AstParserScopeManager clone = new AstParserScopeManager();
     clone._PathTracker = new Stack<AstNode>(_PathTracker);
     clone._ScopeTracker = new Stack<AstNode>(_ScopeTracker);
     return clone;
 }
コード例 #2
0
        private bool BindASTNodeReference(BindingItem item)
        {
            Type t = item.BoundProperty.PropertyType;

            if (IsContainerOf(typeof(ICollection <object>), t))
            {
                t = t.GetGenericArguments()[0];
            }

            string  value        = item.XValue;
            AstNode boundASTNode = null;
            AstParserScopeManager scopeManager = item.ScopeManager.Clone();

            // Walk scopes
            while (boundASTNode == null && !scopeManager.IsEmpty)
            {
                boundASTNode = FindASTNode(t, scopeManager.GetScopedName(value));
                scopeManager.Pop();
            }

            // Attempt scopeless binding
            if (boundASTNode == null)
            {
                boundASTNode = FindASTNode(t, value);
            }

            if (boundASTNode != null)
            {
                BindProperty(item.BoundProperty, item.ParentASTNode, boundASTNode, item.XObject, true);
                return(true);
            }
            return(false);
        }
コード例 #3
0
 public NewBindingItem(XmlIRDocumentType docType, XObject XObject, string XValue, AstNamedNode ParentASTNode, AstParserScopeManager scopeManager)
 {
     this.docType      = docType;
     this.XObject      = XObject;
     this.XValue       = XValue;
     this.node         = ParentASTNode;
     this.ScopeManager = scopeManager;
 }
コード例 #4
0
 public BindingItem(PropertyInfo BoundProperty, XObject XObject, string XValue, AstNode ParentASTNode, AstParserScopeManager scopeManager)
 {
     this.BoundProperty = BoundProperty;
     this.XObject       = XObject;
     this.XValue        = XValue;
     this.ParentASTNode = ParentASTNode;
     this.ScopeManager  = scopeManager;
 }
コード例 #5
0
        public AstParserScopeManager Clone()
        {
            AstParserScopeManager clone = new AstParserScopeManager();

            clone._PathTracker  = new Stack <AstNode>(_PathTracker);
            clone._ScopeTracker = new Stack <AstNode>(_ScopeTracker);
            return(clone);
        }
コード例 #6
0
        private bool FindASTNodeReferenceForNewObject(XmlIR xmlIR, NewBindingItem item)
        {
            Type t = item.node.GetType();

            if (IsContainerOf(typeof(ICollection <object>), t))
            {
                t = t.GetGenericArguments()[0];
            }

            string  value        = item.XValue;
            AstNode boundASTNode = null;
            AstParserScopeManager scopeManager = item.ScopeManager.Clone();

            // Walk scopes
            while (boundASTNode == null && !scopeManager.IsEmpty)
            {
                boundASTNode = FindASTNode(t, scopeManager.GetScopedName(value));
                scopeManager.Pop();
            }

            // Attempt scopeless binding
            if (boundASTNode == null)
            {
                boundASTNode = FindASTNode(t, value);
            }

            if (boundASTNode != null)
            {
                XElement        xElement     = new XElement((XElement)boundASTNode.BoundXElement);
                XmlSchemaObject schemaObject = ((XElement)boundASTNode.BoundXElement).GetSchemaInfo().SchemaElement;
                xElement.SetAttributeValue("AsClassOnly", false);
                xElement.SetAttributeValue("Name", item.node.Name);
                Dictionary <string, string> dictParams = new Dictionary <string, string>();
                foreach (XElement param in xElement.Elements(XName.Get("Argument", GetDefaultXMLNamespace(boundASTNode))))
                {
                    string     sParam     = param.Attribute("Name").Value;
                    XAttribute xAttribute = (item.node.BoundXElement as XElement).
                                            Element(XName.Get("New", GetDefaultXMLNamespace(item.node))).Attribute(sParam);
                    if (xAttribute != null)
                    {
                        dictParams.Add("{argument(" + sParam + ")}", xAttribute.Value);
                    }
                    else
                    {
                        dictParams.Add("{argument(" + sParam + ")}", param.Attribute("DefaultValue").Value);
                    }
                }
                ReplaceParameters(xElement, dictParams);
                xmlIR.ValidateXElement(schemaObject, xElement);
                parseElement(xElement, item.node, item.docType);
                return(true);
            }
            return(false);
        }
コード例 #7
0
        public XmlToAstParserPhase(string WorkflowUniqueName, string DefaultXmlNamespace)
        {
            this._DefaultXmlNamespace = DefaultXmlNamespace;
            this._DefaultXmlNamespacesByASTNodeType = new Dictionary <Type, string>();

            this._ScopeManager = new AstParserScopeManager();

            this._Loader = new PluginLoader <AstNode, AstSchemaTypeBindingAttribute>(Settings.Default.SubpathAstPluginFolder, 1, 2);
            this._ASTNodeTypesDictionary = new Dictionary <XmlQualifiedName, Type>();
            this.CopyPluginLoaderDataToASTNodeTypes(this._Loader);

            this._PropertyMappingDictionary    = new Dictionary <Type, Dictionary <XName, PropertyBindingAttributePair> >();
            this._GlobalASTNamedNodeDictionary = new Dictionary <Type, Dictionary <string, AstNamedNode> >();
            this.PreLoadPropertyMappingsAndGlobalDictionary();

            this._UnmappedProperties = new Dictionary <XName, List <AstNode> >();

            this._LateBindingItems = new List <BindingItem>();
            this._NewObjectItems   = new List <NewBindingItem>();
        }
コード例 #8
0
ファイル: XmlToAstParserPhase.cs プロジェクト: japj/vulcan
 public NewBindingItem(XmlIRDocumentType docType, XObject XObject, string XValue, AstNamedNode ParentASTNode, AstParserScopeManager scopeManager)
 {
     this.docType = docType;
     this.XObject = XObject;
     this.XValue = XValue;
     this.node = ParentASTNode;
     this.ScopeManager = scopeManager;
 }
コード例 #9
0
ファイル: XmlToAstParserPhase.cs プロジェクト: japj/vulcan
 public BindingItem(PropertyInfo BoundProperty, XObject XObject, string XValue, AstNode ParentASTNode, AstParserScopeManager scopeManager)
 {
     this.BoundProperty = BoundProperty;
     this.XObject = XObject;
     this.XValue = XValue;
     this.ParentASTNode = ParentASTNode;
     this.ScopeManager = scopeManager;
 }
コード例 #10
0
ファイル: XmlToAstParserPhase.cs プロジェクト: japj/vulcan
        public XmlToAstParserPhase(string WorkflowUniqueName, string DefaultXmlNamespace)
        {
            this._DefaultXmlNamespace = DefaultXmlNamespace;
            this._DefaultXmlNamespacesByASTNodeType = new Dictionary<Type, string>();

            this._ScopeManager = new AstParserScopeManager();

            this._Loader = new PluginLoader<AstNode, AstSchemaTypeBindingAttribute>(Settings.Default.SubpathAstPluginFolder, 1, 2);
            this._ASTNodeTypesDictionary = new Dictionary<XmlQualifiedName, Type>();
            this.CopyPluginLoaderDataToASTNodeTypes(this._Loader);

            this._PropertyMappingDictionary = new Dictionary<Type, Dictionary<XName, PropertyBindingAttributePair>>();
            this._GlobalASTNamedNodeDictionary = new Dictionary<Type, Dictionary<string, AstNamedNode>>();
            this.PreLoadPropertyMappingsAndGlobalDictionary();

            this._UnmappedProperties = new Dictionary<XName, List<AstNode>>();

            this._LateBindingItems = new List<BindingItem>();
            this._NewObjectItems = new List<NewBindingItem>();
        }