コード例 #1
0
        TypeToAssemblyNamespaceMap LoadAssemblyMap(BinaryReader reader, ExtendedFrameworkVersion frameworkVersion)
        {
            TypeToAssemblyNamespaceMap result = new TypeToAssemblyNamespaceMap();
              result._AssemblyPath = reader.ReadString();
              result._AssemblySignature = FileSignature.Read(reader);

              int typeCount = reader.ReadInt32();
              for (int typeIndex = 0; typeIndex < typeCount; typeIndex++)
              {
            string typeName = reader.ReadString();
            int namespaceCount = reader.ReadInt32();

            if (!result.ContainsKey(typeName))
              result.Add(typeName, new AssemblyNamespaceList());
            AssemblyNamespaceList assemblyNamespaces = result.GetNamespaceList(typeName);
            for (int i = 0; i < namespaceCount; i++)
            {
              int assemblyIndex = reader.ReadInt32();
              int namespaceIndex = reader.ReadInt32();
              assemblyNamespaces.Add(new AssemblyNamespace(frameworkVersion, assemblyIndex, namespaceIndex));
            }
              }
              return result;
        }
コード例 #2
0
        TypeToAssemblyNamespaceMap CollectTypes(string assemblyPath, ExtendedFrameworkVersion frameworkVersion)
        {
            assemblyPath = assemblyPath.ToLowerInvariant();

              TypeToAssemblyNamespaceMap result = new TypeToAssemblyNamespaceMap();
              result._AssemblyPath = assemblyPath;
              result._AssemblySignature = new FileSignature(assemblyPath);

              AssemblyTypeLoadResult typeLoadResult = LoadTypesFromAssembly(assemblyPath);
              if (typeLoadResult == null)
            return result;

              foreach (ITypeInfo typeInfo in typeLoadResult.Types)
              {
            if (!result.ContainsKey(typeInfo.NestedName))
              result.Add(typeInfo.NestedName, new AssemblyNamespaceList());
            AssemblyNamespaceList list = result.GetNamespaceList(typeInfo.NestedName);
            list.AddUnique(new AssemblyNamespace(typeLoadResult.AssemblyInfo.FullName, typeInfo.Namespace, frameworkVersion));
              }
              return result;
        }