/// <summary> /// 命名空间归类 /// </summary> public static ClusterDict NamespaceClasses(ClusterSubDict classDict) { var classCluster = new ClusterDict(); classCluster.Add("________##", NewClassDict()); foreach (var name2type in classDict) { //主命名空间 if (name2type.Value.Namespace == null) { classCluster["________##"].Add(name2type.Key, name2type.Value); } else { if (classCluster.ContainsKey(name2type.Value.Namespace) == false) { classCluster.Add(name2type.Value.Namespace, NewClassDict()); } classCluster[name2type.Value.Namespace].Add(name2type.Key, name2type.Value); } } return(classCluster); }
static void EndNameCluster <T>( ref ClusterDict classCluster, SortedDictionary <string, Type> allClass, SortedDictionary <string, T> classDict ) { Dictionary <string, int> endNameCount = CountEndName(classDict); foreach (var i in endNameCount) { if (i.Value > 4 && i.Key.Length > 1 && classCluster.ContainsKey(i.Key) == false) { classCluster.Add(i.Key, new SortedDictionary <string, Type>()); foreach (var str2type in allClass) { if (str2type.Key.EndsWith(i.Key)) { classCluster[i.Key].Add(str2type.Key, str2type.Value); } } } } }