Esempio n. 1
0
        public override void GetTypeDefProps(
            TypeHandle typeDef,
            out string name,
            out string namespaceName,
            out TypeAttributes flags,
            out MetadataToken extends)
        {
            base.GetTypeDefProps(typeDef,
                                 out name,
                                 out namespaceName,
                                 out flags,
                                 out extends);

            TypeDefTreatment treatment =
                GetTypeDefTreatment(typeDef, flags, name, namespaceName, extends);

            switch (treatment & TypeDefTreatment.TreatmentMask)
            {
            case TypeDefTreatment.None:
                break;

            case TypeDefTreatment.NormalNonAttribute:
                flags |= TypeAttributes.WindowsRuntime | TypeAttributes.Import;
                break;

            case TypeDefTreatment.NormalAttribute:
                flags |= TypeAttributes.WindowsRuntime | TypeAttributes.Sealed;
                break;

            case TypeDefTreatment.UnmangleWinRTName:
                name   = name.Substring(clrPrefix.Length);
                flags |= TypeAttributes.Public;
                break;

            case TypeDefTreatment.PrefixWinRTName:
                name   = winRtPrefix + name;
                flags &= TypeAttributes.Public;
                flags |= TypeAttributes.Import;
                break;

            case TypeDefTreatment.RedirectedToCLRType:
                flags &= ~TypeAttributes.Public;
                flags |= TypeAttributes.Import;
                break;

            case TypeDefTreatment.RedirectedToCLRAttribute:
                flags &= ~TypeAttributes.Public;
                break;
            }

            if (treatment.HasFlag(TypeDefTreatment.MarkAbstractFlag))
            {
                flags |= TypeAttributes.Abstract;
            }

            if (treatment.HasFlag(TypeDefTreatment.MarkInternalFlag))
            {
                flags &= ~TypeAttributes.Public;
            }
        }
Esempio n. 2
0
 public ProjectionInfo(
     string winRtNamespace,
     StringHandle.VirtualIndex clrNamespace,
     StringHandle.VirtualIndex clrName,
     AssemblyReferenceHandle.VirtualIndex clrAssembly,
     TypeDefTreatment treatment = TypeDefTreatment.RedirectedToClrType,
     bool isIDisposable         = false)
 {
     this.WinRTNamespace = winRtNamespace;
     this.ClrNamespace   = clrNamespace;
     this.ClrName        = clrName;
     this.AssemblyRef    = clrAssembly;
     this.Treatment      = treatment;
     this.IsIDisposable  = isIDisposable;
 }
Esempio n. 3
0
 public ProjectionInfo(
     string winRtNamespace,
     StringHandle.VirtualIndex clrNamespace,
     StringHandle.VirtualIndex clrName,
     AssemblyReferenceHandle.VirtualIndex clrAssembly,
     TypeDefTreatment treatment = TypeDefTreatment.RedirectedToClrType,
     bool isIDisposable = false)
 {
     this.WinRTNamespace = winRtNamespace;
     this.ClrNamespace = clrNamespace;
     this.ClrName = clrName;
     this.AssemblyRef = clrAssembly;
     this.Treatment = treatment;
     this.IsIDisposable = isIDisposable;
 }
Esempio n. 4
0
 public ProjectionInfo(
     string winRtNamespace,
     string dotNetNamespace,
     string dotNetName,
     uint dotNetAssemblyOffset,
     TypeDefTreatment treatment = TypeDefTreatment.RedirectedToCLRType,
     bool isIDisposable         = false)
 {
     this.WinRTNamespace       = winRtNamespace;
     this.DotNetNamespace      = dotNetNamespace;
     this.DotNetName           = dotNetName;
     this.DotNetAssemblyOffset = dotNetAssemblyOffset;
     this.Treatment            = treatment;
     this.IsIDisposable        = isIDisposable;
 }
Esempio n. 5
0
 public ProjectionInfo(
     string winRtNamespace,
     string dotNetNamespace,
     string dotNetName,
     uint dotNetAssemblyOffset,
     TypeDefTreatment treatment = TypeDefTreatment.RedirectedToCLRType,
     bool isIDisposable = false)
 {
     this.WinRTNamespace = winRtNamespace;
     this.DotNetNamespace = dotNetNamespace;
     this.DotNetName = dotNetName;
     this.DotNetAssemblyOffset = dotNetAssemblyOffset;
     this.Treatment = treatment;
     this.IsIDisposable = isIDisposable;
 }