Example #1
0
        public void AddType(Type type)
        {
            String[] nameList = type.FullName.Split('.');

            TypeDictionary parent = Root;

            if (nameList.Length > 0)
            {
                String fullName = String.Empty;

                for (int i = 0; i < (nameList.Length - 1); i++)
                {
                    if (fullName != String.Empty)
                    {
                        fullName += ".";
                    }

                    String name = nameList[i];

                    fullName += name;

                    if (parent.SubTypeDictionary.ContainsKey(name))
                    {
                        parent = parent.SubTypeDictionary[name];
                    }
                    else
                    {
                        TypeDictionary dic = new TypeDictionary(name);
                        dic.FullName = fullName;
                        dic.Parent = parent;
                        parent.SubTypeDictionary.Add(name, dic);
                        parent = dic;
                    }
                }

                String typeName = nameList[nameList.Length - 1];

                if (!parent.Types.ContainsKey(typeName))
                {
                    parent.Types.Add(typeName, type);
                }
            }
        }
Example #2
0
 public void StepDown(String dir)
 {
     if (Now == null) return;
     if (Now.SubTypeDictionary.ContainsKey(dir))
     {
         Now = Now.SubTypeDictionary[dir];
     }
 }
Example #3
0
 public void StepUp()
 {
     if (Now == null) return;
     Now = Now.Parent;
 }
Example #4
0
 public TypeManager()
 {
     Root = new TypeDictionary("Root");
     Root.Parent = Root;
     Now = Root;
 }