Пример #1
0
        public override void AppendChild(Node child)
        {
            var item = child as Parameter;

            if (item != null)
            {
                Entities.Add(item);
                return;
            }

            var ns = child as Namespace;

            if (ns != null)
            {
                Namespaces.Add(ns);
                return;
            }

            var entity = child as Entity;

            if (entity != null)
            {
                Entities.Add(entity);
                return;
            }
            base.AppendChild(child);
        }
Пример #2
0
 /// <summary>
 /// Opens a new namespace for current script.
 /// </summary>
 private void declareOpenNamespace(UseNode node)
 {
     if (!Namespaces.ContainsKey(node.Namespace))
     {
         Namespaces.Add(node.Namespace, true);
     }
 }
Пример #3
0
        public DefaultNamespaceManager()
        {
            var asm = typeof(Eto.Forms.Application).Assembly;

            DefaultNamespace = new NamespaceInfo("Eto.Forms", asm);
            Namespaces.Add("drawing", new NamespaceInfo("Eto.Drawing", asm));
        }
Пример #4
0
 public void AddNamespace(SDNamespace sdNamespace)
 {
     if (!Namespaces.ContainsKey(sdNamespace.Identifier))
     {
         Namespaces.Add(sdNamespace.Identifier, sdNamespace);
     }
 }
        private void LoadResources()
        {
            GitIgnores.Add(string.Empty, Strings.Common_ChooseAGitIgnore);
            SelectedGitIgnore = string.Empty;
            foreach (var line in _git.GetGitIgnores())
            {
                GitIgnores.Add(line, $"{line} - .gitignore");
            }

            Licenses.Add(string.Empty, Strings.Common_ChooseALicense);
            SelectedLicense = string.Empty;
            foreach (var line in _git.GetLicenses())
            {
                Licenses.Add(line, line);
            }
            string defaultnamespace = _storage.GetUser().Username;

            foreach (var path in _web.GetNamespacesPathList())
            {
                Namespaces.Add(path.id.ToString(), $"{path.name} - {path.full_path}");
                if (path.full_path == defaultnamespace)
                {
                    SelectedNamespaces = path.id.ToString();
                }
            }
        }
Пример #6
0
        private void ChangeActiveTaxonomy(TaxonomyItem newTaxonomyItem)
        {
            // handle the case where no taxonomy is selected
            // this can happen when all taxonomies are closed
            if (newTaxonomyItem == null)
            {
                Namespaces.Clear();
                CurrentDirectory = "";
                return;
            }

            var taxonomy = newTaxonomyItem.Taxonomy.Value;

            Namespaces.Clear();
            foreach (var ns in taxonomy.AllNamespaces())
            {
                var namespaceItem = new NamespaceItem(ns);
                foreach (var tag in taxonomy.TagsInNamespace(ns))
                {
                    namespaceItem.Tags.Add(tag);
                }
                Namespaces.Add(namespaceItem);
            }
            CurrentDirectory = taxonomy.RootPath;
        }
Пример #7
0
 static AssemblyTypes()
 {
     Namespaces.Add("UnityEngine");
     Namespaces.Add("System");
     Namespaces.Add("UnityEngine");
     Initialize();
 }
 public CompilationUnit(NamespaceDeclaration namespaceDeclaration)
 {
     if (namespaceDeclaration != null)
     {
         Namespaces.Add(namespaceDeclaration);
     }
 }
Пример #9
0
        /// <summary>
        /// Parses an XML document for its namespaces.
        /// </summary>
        /// <param name="navigator">The navigator.</param>
        public void ParseNamespaces(XPathNavigator navigator)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }

            if (Namespaces == null)
            {
                Namespaces = new Dictionary <string, string>();
            }

            if (String.IsNullOrEmpty(DefaultPrefix))
            {
                DefaultPrefix = "d";
            }

            DefaultNamespaces.Clear();

            navigator.MoveToRoot();
            RrecursiveParse(navigator);

            //add default namespaces
            int defaultIndex = 0;

            foreach (string name in DefaultNamespaces)
            {
                string key = GetDefaultKey(defaultIndex++);
                Namespaces.Add(key, name);
            }
        }
Пример #10
0
        private void RrecursiveParse(XPathNavigator navigator)
        {
            var namespaces = navigator.GetNamespacesInScope(XmlNamespaceScope.Local);

            foreach (var map in namespaces)
            {
                if (String.IsNullOrEmpty(map.Key))
                {
                    DefaultNamespaces.Add(map.Value);
                }
                else if (!Namespaces.ContainsKey(map.Key))
                {
                    Namespaces.Add(map.Key, map.Value);
                }
            }

            // process child element nodes
            if (navigator.HasChildren &&
                (ParseChildren || navigator.NodeType == XPathNodeType.Root) &&
                navigator.MoveToFirstChild())
            {
                do
                {
                    RrecursiveParse(navigator);
                }while (navigator.MoveToNext(XPathNodeType.Element));

                // move back to the original parent node
                navigator.MoveToParent();
            }
        }
Пример #11
0
        public override void AppendChild(Node child)
        {
            var item = child as Attribute;

            if (item != null)
            {
                Attributes.Add(item);
                return;
            }

            var entity = child as Entity;

            if (entity != null)
            {
                DocumentElement = entity;
                entity.InitializeParent(this);
                Entities.Add(entity);
                return;
            }

            var ns = child as Namespace;

            if (ns != null)
            {
                Namespaces.Add(ns);
                return;
            }
            base.AppendChild(child);
        }
Пример #12
0
 public void AddNamespace(String ns)
 {
     if (!Namespaces.ContainsKey(ns))
     {
         Namespaces.Add(ns, null);
     }
 }
        /// <summary>
        /// Merge with another DefaultStyle.
        /// </summary>
        /// <param name="other">Other DefaultStyle to merge.</param>
        private void Merge(DefaultStyle other)
        {
            // Merge or lower namespaces
            foreach (KeyValuePair <string, string> ns in other.Namespaces)
            {
                string value = null;
                if (!Namespaces.TryGetValue(ns.Key, out value))
                {
                    Namespaces.Add(ns.Key, ns.Value);
                }
                else if (value != ns.Value)
                {
                    other.LowerNamespace(ns.Key);
                }
            }

            // Merge the resources
            foreach (KeyValuePair <string, XElement> resource in other.Resources)
            {
                if (Resources.ContainsKey(resource.Key))
                {
                    throw new InvalidOperationException(string.Format(
                                                            CultureInfo.InvariantCulture,
                                                            "Resource \"{0}\" is used by both {1} and {2}!",
                                                            resource.Key,
                                                            MergeHistory[resource.Key],
                                                            other.DefaultStylePath));
                }
                Resources[resource.Key]    = resource.Value;
                MergeHistory[resource.Key] = other.DefaultStylePath;
            }
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SvgDocument"/> class.
        /// </summary>
        public SvgDocument()
        {
            Ppi = PointsPerInch;

            Namespaces.Add(string.Empty, SvgNamespaces.SvgNamespace);
            Namespaces.Add(SvgNamespaces.XLinkPrefix, SvgNamespaces.XLinkNamespace);
            Namespaces.Add(SvgNamespaces.XmlPrefix, SvgNamespaces.XmlNamespace);
        }
Пример #15
0
        protected OutputFile()
        {
            var executingAssembly = Assembly.GetExecutingAssembly().GetName();

            Namespaces.Add("System");
            Namespaces.Add("System.CodeDom.Compiler");
            ClassAttributes.Add($"[GeneratedCode(\"{executingAssembly.Name}\", \"{executingAssembly.Version}\")]");
        }
Пример #16
0
 public void AddNamespace(string unityNamespace)
 {
     if (Namespaces.All(x => x.name != unityNamespace))
     {
         Namespaces.Add(new UnityNamespace {
             name = unityNamespace
         });
     }
 }
Пример #17
0
        /// <summary>
        /// Ajouter un namespace à la liste.
        /// </summary>
        /// <param name="nmspace">Le namespace à ajouter.</param>
        /// <exception cref="System.ArgumentNullException">Si nmspace est null.</exception>
        public void AddNamespace(ModelNamespace nmspace)
        {
            if (nmspace == null)
            {
                throw new ArgumentNullException("nmspace");
            }

            Namespaces.Add(nmspace.Name, nmspace);
        }
Пример #18
0
        /// <summary>
        /// Adds a namespace to this project. "@" represents the root namespace.
        /// </summary>
        public void AddNamespace(string name)
        {
            if (Namespaces.ContainsKey(name))
            {
                throw new Exception("A namespace already exists with this name.");
            }

            Namespaces.Add(name, new List <ClassModule>());
        }
Пример #19
0
        public void LoadFile(string filename)
        {
            XmlDocument document = new XmlDocument();

            document.Load(filename);

            XmlNode compositeNode = document.SelectSingleNode(CompositeXPath);
            string  rootNamespace = GetNodeValue(compositeNode, "@rootNamespace");

            RootNamespace = rootNamespace;

            XmlNodeList types = document.SelectNodes(TypesXPath);

            foreach (XmlNode typeNode in types)
            {
                string typeName     = GetNodeValue(typeNode, "@name");
                string className    = GetNodeValue(typeNode, "@className");
                string theNamespace = GetNodeValue(typeNode, "@namespace");
                if (!Namespaces.Contains(theNamespace))
                {
                    Namespaces.Add(theNamespace);
                }
                CompositeType compositeType = new CompositeType(typeName, className, theNamespace);

                Type foundType = FindType(className, theNamespace);

                foreach (PropertyInfo pi in foundType.GetProperties())
                {
                    if (pi.CanRead && pi.CanWrite)
                    {
                        CompositeProperty property = new CompositeProperty(typeName, pi.Name, pi.PropertyType);
                        compositeType.Properties.Add(property);
                    }
                }

                XmlNodeList hiddenNodes = typeNode.SelectNodes(PropertiesXPath);
                foreach (XmlNode propertyNode in hiddenNodes)
                {
                    string propertyName = GetNodeValue(propertyNode, "@name");
                    string alias        = GetNodeValue(propertyNode, "@alias");
                    bool   isReadOnly   = GetBooleanNodeValue(propertyNode, "@isReadOnly");
                    bool   isHidden     = GetBooleanNodeValue(propertyNode, "@isHidden");

                    CompositeProperty property = compositeType.Properties.FindCompositeProperty(typeName, propertyName);

                    if (property != null)
                    {
                        if (!String.IsNullOrEmpty(alias))
                        {
                            property.Alias = alias;
                        }
                        property.IsReadOnly = isReadOnly;
                        property.IsHidden   = isHidden;
                    }
                }
            }
        }
Пример #20
0
        public void AddNamespace(string @namespace)
        {
            OdcmNamespace ns;

            if (!TryResolveNamespace(@namespace, out ns))
            {
                Namespaces.Add(new OdcmNamespace(@namespace));
            }
        }
Пример #21
0
        public void ImportNamespaces(params string[] namespaces)
        {
            Guard.AgainstNullArgument("namespaces", namespaces);

            foreach (var @namespace in namespaces)
            {
                Namespaces.Add(@namespace);
            }
        }
        /// <summary> Add a new namespace definition to this object </summary>
        /// <param name="Prefix"> Prefix used for this namespace throughout the object </param>
        /// <param name="URI"> URI for the schema/namespace referred to by the prefix </param>
        public void Add_Namespace(string Prefix, string URI)
        {
            if (Namespaces == null)
            {
                Namespaces = new List <BriefItem_Namespace>();
            }

            Namespaces.Add(new BriefItem_Namespace(Prefix, URI));
        }
 /// <summary>
 /// Adds a namespace to the referenced namespaces
 /// used at compile time.
 /// </summary>
 /// <param name="nameSpace"></param>
 public void AddNamespace(string nameSpace)
 {
     if (string.IsNullOrEmpty(nameSpace))
     {
         Namespaces.Clear();
         return;
     }
     Namespaces.Add(nameSpace);
 }
Пример #24
0
        public void Read(RecursionCounter counter, IImageStream stream, uint scopeEnd)
        {
            if (!counter.Increment())
            {
                throw new PdbException("Scopes too deep");
            }

            while (stream.Position < scopeEnd)
            {
                var size  = stream.ReadUInt16();
                var begin = stream.Position;
                var end   = begin + size;

                var      type     = (SymbolType)stream.ReadUInt16();
                DbiScope child    = null;
                uint?    childEnd = null;
                switch (type)
                {
                case SymbolType.S_BLOCK32:
                {
                    stream.Position += 4;
                    childEnd         = stream.ReadUInt32();
                    var len  = stream.ReadUInt32();
                    var addr = PdbAddress.ReadAddress(stream);
                    var name = PdbReader.ReadCString(stream);
                    child = new DbiScope(name, addr.Offset, len);
                    break;
                }

                case SymbolType.S_UNAMESPACE:
                    Namespaces.Add(new DbiNamespace(PdbReader.ReadCString(stream)));
                    break;

                case SymbolType.S_MANSLOT:
                {
                    var variable = new DbiVariable();
                    variable.Read(stream);
                    Variables.Add(variable);
                    break;
                }
                }

                stream.Position = end;
                if (child != null)
                {
                    child.Read(counter, stream, childEnd.Value);
                    Children.Add(child);
                    child = null;
                }
            }
            counter.Decrement();
            if (stream.Position != scopeEnd)
            {
                Debugger.Break();
            }
        }
Пример #25
0
 public void AddNamespace(string nameSpace)
 {
     if (Namespaces.BinarySearch(nameSpace) < 0)
     {
         Namespaces.Add(nameSpace);
         Namespaces.Sort();
         IsDirty = true;
         Events.RaiseDataChangedEvent(GetType(), (MethodInfo)MethodBase.GetCurrentMethod(), null, nameSpace);
     }
 }
Пример #26
0
        private static void LoadFromAssembly(Assembly assembly, string rootNamespace)
        {
            var types = assembly.GetTypes().Where(t => t.IsPublic && !t.IsGenericType && !t.IsInterface && !t.IsSubclassOf(typeof(DbContext))).OrderBy(t => t.Namespace);
            var ns    = CreateNamespace(rootNamespace, types);

            if (ns != null)
            {
                Namespaces.Add(ns);
            }
        }
Пример #27
0
        private static void LoadFromAssembly(AssemblyMappingConfiguration assembly)
        {
            var types = assembly.Types.Select(t => t.UnderlineType).OrderBy(t => t.Namespace).AsEnumerable();
            var ns    = CreateNamespace(assembly.RootNamespace, types, assembly);

            if (ns != null)
            {
                Namespaces.Add(ns);
            }
        }
Пример #28
0
        TypeSyntax GetReturnType()
        {
            if (Method.Returns == null)
            {
                return(SF.ParseTypeName("void"));
            }

            Namespaces.Add(Method.Returns.Type);
            return(Symbols.GetTypeSyntax(Method.Returns.Type, Method.Returns.IsOptional));
        }
Пример #29
0
        protected override MemberDeclarationSyntax CreateType()
        {
            return(SF.ClassDeclaration
                   (
                       CreateAttributes(),
                       SF.TokenList(
                           SF.Token(SyntaxKind.InternalKeyword),
                           SF.Token(SyntaxKind.SealedKeyword)),
                       GetProxyTypeNameSyntax(),
                       null,
                       CreateBaseList(),
                       SF.List <TypeParameterConstraintClauseSyntax>(),
                       SF.List(CreateMembers())
                   ));

            SyntaxList <AttributeListSyntax> CreateAttributes()
            {
                var typeOfExpression          = SF.TypeOfExpression(Symbols.GetNameSyntax(Type));
                var fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName);

                return(SF.List(new[]
                {
                    SF.AttributeList(SF.SeparatedList(new[]
                    {
                        SF.Attribute(
                            SF.ParseName("JsiiTypeProxy"),
                            SF.ParseAttributeArgumentList($"({typeOfExpression}, {fullyQualifiedNameLiteral})")
                            )
                    }))
                }));
            }

            BaseListSyntax CreateBaseList()
            {
                return(SF.BaseList(SF.SeparatedList(GetBaseTypes())));

                IEnumerable <BaseTypeSyntax> GetBaseTypes()
                {
                    if (Type is InterfaceType)
                    {
                        yield return(SF.SimpleBaseType(SF.ParseTypeName("DeputyBase")));
                    }

                    Namespaces.Add(Type);
                    yield return(SF.SimpleBaseType(Symbols.GetNameSyntax(Type, disambiguate: true)));
                }
            }

            IEnumerable <MemberDeclarationSyntax> CreateMembers()
            {
                return(CreateConstructors()
                       .Concat(CreateProperties())
                       .Concat(CreateMethods()));
            }
        }
Пример #30
0
        public NamespaceModel AddNamespace(string name)
        {
            var ns = Namespaces.FirstOrDefault(n => n.Name == name);

            if (ns == null)
            {
                ns = new NamespaceModel(this, name);
                Namespaces.Add(ns);
            }
            return(ns);
        }