Beispiel #1
0
 internal static DomAssemblyName[] Convert(System.Reflection.AssemblyName[] names)
 {
     if (names == null)
     {
         return(null);
     }
     DomAssemblyName[] n = new DomAssemblyName[names.Length];
     for (int i = 0; i < names.Length; i++)
     {
         n[i] = new DomAssemblyName(names[i].FullName);
     }
     return(n);
 }
 public ReflectionProjectContent(Assembly assembly, string assemblyLocation, ProjectContentRegistry registry)
     : this(assembly.FullName, assemblyLocation, DomAssemblyName.Convert(assembly.GetReferencedAssemblies()), registry)
 {
     foreach (Type type in assembly.GetExportedTypes())
     {
         string name = type.FullName;
         if (name.IndexOf('+') < 0)                   // type.IsNested
         {
             AddClassToNamespaceListInternal(new ReflectionClass(assemblyCompilationUnit, type, name, null));
         }
     }
     InitializeSpecialClasses();
 }
Beispiel #3
0
            public ReflectionProjectContent ReadProjectContent(ProjectContentRegistry registry)
            {
                if (_reader.ReadInt64() != FileMagic)
                {
                    LoggingService.Warn("Read dom: wrong magic");
                    return(null);
                }
                if (_reader.ReadInt16() != FileVersion)
                {
                    LoggingService.Warn("Read dom: wrong version");
                    return(null);
                }
                string assemblyName     = _reader.ReadString();
                string assemblyLocation = _reader.ReadString();
                long   time             = 0;

                try
                {
                    time = File.GetLastWriteTimeUtc(assemblyLocation).ToFileTime();
                }
                catch { }
                if (_reader.ReadInt64() != time)
                {
                    LoggingService.Warn("Read dom: assembly changed since cache was created");
                    return(null);
                }
                DomAssemblyName[] referencedAssemblies = new DomAssemblyName[_reader.ReadInt32()];
                for (int i = 0; i < referencedAssemblies.Length; i++)
                {
                    referencedAssemblies[i] = new DomAssemblyName(_reader.ReadString());
                }
                _pc = new ReflectionProjectContent(assemblyName, assemblyLocation, referencedAssemblies, registry);
                if (ReadClasses())
                {
                    return(_pc);
                }
                else
                {
                    LoggingService.Warn("Read dom: error in file (invalid control mark)");
                    return(null);
                }
            }
 public IProjectContent GetExistingProjectContent(DomAssemblyName assembly)
 {
     return(GetExistingProjectContent(assembly.FullName, assembly.FullName));
 }
 public ReflectionProjectContent(string assemblyFullName, string assemblyLocation, AssemblyName[] referencedAssemblies, ProjectContentRegistry registry)
     : this(assemblyFullName, assemblyLocation, DomAssemblyName.Convert(referencedAssemblies), registry)
 {
 }