public IPlatform CreatePlatform(IPlatformRuntimeContext platformRuntimeContext, IPlatformReferenceContext platformReferenceContext, IPlatformService platformService, IPlatformHost platformHost)
        {
            IPlatform platform;

            if (platformReferenceContext == null)
            {
                if (this.defaultPlatformReferenceContext == null)
                {
                    this.defaultPlatformReferenceContext = new DefaultPlatformReferenceContext(this.RuntimeFramework);
                }
                platformReferenceContext = this.defaultPlatformReferenceContext;
            }
            using (IEnumerator <IPlatform> enumerator = this.platformTable.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IPlatform current = enumerator.Current;
                    if (!platformReferenceContext.Equals(current.Metadata.ReferenceContext))
                    {
                        continue;
                    }
                    this.platformTable[current] = this.platformTable[current] + 1;
                    platform = current;
                    return(platform);
                }
                PlatformBase platformBase = this.CreatePlatformInternal(platformRuntimeContext, platformReferenceContext, platformService, platformHost);
                platformBase.Initialize();
                platformBase.PlatformHost = platformHost;
                RuntimeGeneratedTypesHelper.RegisterRuntimeAssemblies(platformBase.Metadata);
                this.OnPlatformCreated(new PlatformEventArgs(platformBase));
                this.platformTable.Add(platformBase, 1);
                return(platformBase);
            }
            return(platform);
        }
Beispiel #2
0
 public AttachedPropertyMetadataBackgroundWorker(IProjectContext projectContext, IPlatformRuntimeContext runtimeContext, IPlatformReferenceContext referenceContext, bool shouldRescanDuplicateAssemblies)
 {
     this.projectContext   = projectContext;
     this.runtimeContext   = runtimeContext;
     this.referenceContext = referenceContext;
     this.properties       = new GapList <AttachedPropertyMetadata>();
     this.shouldRescanDuplicateAssemblies = shouldRescanDuplicateAssemblies;
 }
Beispiel #3
0
 public AttachedPropertyReferenceAssembly(Assembly runtimeAssembly, IPlatformRuntimeContext runtimeContext, IPlatformReferenceContext referenceContext)
 {
     this.runtimeAssembly = runtimeAssembly;
     if (runtimeContext == null || !(runtimeContext.ResolveRuntimeAssembly(AssemblyHelper.GetAssemblyName(runtimeAssembly)) != (Assembly)null))
     {
         return;
     }
     this.referenceAssembly = referenceContext != null?referenceContext.ResolveReferenceAssembly(runtimeAssembly) : (Assembly)null;
 }
Beispiel #4
0
 public AttachedPropertiesMetadata(IProjectContext projectContext, IPlatformRuntimeContext runtimeContext, IPlatformReferenceContext referenceContext, IPlatformService platformService, IAssemblyService assemblyService)
 {
     this.projectContext  = projectContext;
     this.platformService = platformService;
     this.platformService.PlatformDisposing += new EventHandler <PlatformEventArgs>(this.AttachedPropertiesMetadata_PlatformDisposing);
     this.assemblyService              = assemblyService;
     this.projectTypesWorker           = new AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker(this.projectContext, runtimeContext, referenceContext, true);
     this.projectTypesWorker.Complete += new EventHandler(this.OnAttachedPropertiesScanningComplete);
     lock (AttachedPropertiesMetadata.platformTypesWorkerLock)
     {
         if (AttachedPropertiesMetadata.platformWorkerTable.TryGetValue(this.projectContext.Platform, out this.platformTypesWorker))
         {
             return;
         }
         this.platformTypesWorker           = new AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker(this.projectContext, runtimeContext, referenceContext, false);
         this.platformTypesWorker.Complete += new EventHandler(this.OnAttachedPropertiesScanningComplete);
         AttachedPropertiesMetadata.platformWorkerTable.Add(this.projectContext.Platform, this.platformTypesWorker);
     }
 }
 protected abstract PlatformBase CreatePlatformInternal(IPlatformRuntimeContext platformRuntimeContext, IPlatformReferenceContext platformReferenceContext, IPlatformService platformService, IPlatformHost platformHost);