Esempio n. 1
0
        public ModulePackage[] GetPackages()
        {
            var packs = new ModulePackage[packages.Count];

            packages.Values.CopyTo(packs, 0);
            return(packs);
        }
Esempio n. 2
0
        public ModulePackage GetOrCreateSubPackage(string package, bool create = false)
        {
            if (string.IsNullOrEmpty(package))
            {
                return(this);
            }

            var currentPackage = this;

            foreach (var p in ModuleNameHelper.SplitModuleName(package))
            {
                ModulePackage returnValue = null;

                if (!currentPackage.Packages.TryGetValue(p, out returnValue))
                {
                    if (create)
                    {
                        returnValue = currentPackage.Packages[p] =
                            new ModulePackage
                        {
                            Name   = p,
                            Parent = currentPackage
                        }
                    }
                    ;
                    else
                    {
                        return(null);
                    }
                }

                currentPackage = returnValue;
            }

            return(currentPackage);
        }
Esempio n. 3
0
 internal static ModulePackage GetOrCreatePackage(ModulePackage root, string package, bool create = false)
 {
     return(root.GetOrCreateSubPackage(package, create));
 }
Esempio n. 4
0
 internal ModulePackage(ModulePackage parent, string name)
 {
     this.Parent = parent;
     Strings.Add(name);
     NameHash = name.GetHashCode();
 }