private string ContractAttributesAsString() { string result = string.Empty; result = NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdStatic, "static "); result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdInitOnly, "initonly "); result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdLiteral, "literal "); result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdNotSerialized, "notserialized "); result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdSpecialName, "specialname "); if ((Flags & CorFieldAttr.fdPinvokeImpl) == CorFieldAttr.fdPinvokeImpl) { result += "pinvokeimpl("; if (PinvokeMap == null) { result += "/* No map */"; } else { result += PinvokeMap; } result += ") "; } return(result); }
private string ReservedFlagsAsString() { string result = string.Empty; CorFieldAttr reservedFlags = Flags & CorFieldAttr.fdReservedMask; result = NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdRTSpecialName, "rtsspecialname "); result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdHasFieldMarshal, "marshal "); return(result); }
public void Initialize() { CodeLines = new List <NuGenCodeLine>(); StringBuilder definition = new StringBuilder(); definition.Append(".assembly extern "); definition.Append(NuGenHelperFunctions.EnumAsString(Flags, CorAssemblyFlags.afRetargetable, "retargetable ")); definition.Append(Name); NuGenCodeLine definitionLine = new NuGenCodeLine(0, definition.ToString()); CodeLines.Add(definitionLine); CodeLines.Add(new NuGenCodeLine(0, "{")); if (FullPath != null && FullPath.Length > 0) { CodeLines.Add(new NuGenCodeLine(1, "//Full Path: " + FullPath)); } else { CodeLines.Add(new NuGenCodeLine(1, "//Full Path: exact location not found. ")); } CodeLines.Add(new NuGenCodeLine(1, ".publickeytoken = " + NuGenHelperFunctions.ReadBlobAsString(PublicKeyOrToken, PublicKeyOrTokenLength))); if (HashBlobLength > 0) { CodeLines.Add(new NuGenCodeLine(1, ".hash = " + NuGenHelperFunctions.ReadBlobAsString(HashBlob, HashBlobLength))); } CodeLines.Add(new NuGenCodeLine(1, string.Format(".ver {0}:{1}:{2}:{3}", Metadata.usMajorVersion, Metadata.usMinorVersion, Metadata.usBuildNumber, Metadata.usRevisionNumber))); CodeLines.Add(new NuGenCodeLine(0, "} //end of assembly reference " + Name)); }