You've already forked linux-packaging-mono
Imported Upstream version 3.10.0
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
5
external/cecil/Mono.Cecil.PE/Image.cs
vendored
5
external/cecil/Mono.Cecil.PE/Image.cs
vendored
@@ -150,6 +150,11 @@ namespace Mono.Cecil.PE {
|
||||
PointerToRawData = buffer.ReadInt32 (),
|
||||
};
|
||||
|
||||
if (directory.SizeOfData == 0 || directory.PointerToRawData == 0) {
|
||||
header = Empty<byte>.Array;
|
||||
return directory;
|
||||
}
|
||||
|
||||
buffer.position = (int) (directory.PointerToRawData - section.PointerToRawData);
|
||||
|
||||
header = new byte [directory.SizeOfData];
|
||||
|
22
external/cecil/Mono.Cecil/AssemblyReader.cs
vendored
22
external/cecil/Mono.Cecil/AssemblyReader.cs
vendored
@@ -3099,9 +3099,29 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
string UnescapeTypeName (string name)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder (name.Length);
|
||||
for (int i = 0; i < name.Length; i++) {
|
||||
char c = name [i];
|
||||
if (name [i] == '\\') {
|
||||
if ((i < name.Length - 1) && (name [i + 1] == '\\')) {
|
||||
sb.Append (c);
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
sb.Append (c);
|
||||
}
|
||||
}
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
public TypeReference ReadTypeReference ()
|
||||
{
|
||||
return TypeParser.ParseType (reader.module, ReadUTF8String ());
|
||||
string s = ReadUTF8String ();
|
||||
if (s != null && s.IndexOf ('\\') != -1)
|
||||
s = UnescapeTypeName (s);
|
||||
return TypeParser.ParseType (reader.module, s);
|
||||
}
|
||||
|
||||
object ReadCustomAttributeEnum (TypeReference enum_type)
|
||||
|
7
external/cecil/Mono.Cecil/AssemblyWriter.cs
vendored
7
external/cecil/Mono.Cecil/AssemblyWriter.cs
vendored
@@ -1164,9 +1164,14 @@ namespace Mono.Cecil {
|
||||
|
||||
MetadataToken GetTypeRefToken (TypeReference type)
|
||||
{
|
||||
MetadataToken token;
|
||||
if (module.CustomMetadataWriter != null) {
|
||||
if (module.CustomMetadataWriter.CreateTypeRefToken (ref type, out token))
|
||||
return token;
|
||||
}
|
||||
|
||||
var row = CreateTypeRefRow (type);
|
||||
|
||||
MetadataToken token;
|
||||
if (type_ref_map.TryGetValue (row, out token))
|
||||
return token;
|
||||
|
||||
|
5
external/cecil/Mono.Cecil/Import.cs
vendored
5
external/cecil/Mono.Cecil/Import.cs
vendored
@@ -437,7 +437,7 @@ namespace Mono.Cecil {
|
||||
}
|
||||
#endif
|
||||
|
||||
public TypeReference ImportType (TypeReference type, ImportGenericContext context)
|
||||
public virtual TypeReference ImportType (TypeReference type, ImportGenericContext context)
|
||||
{
|
||||
if (type.IsTypeSpecification ())
|
||||
return ImportTypeSpecification (type, context);
|
||||
@@ -466,6 +466,7 @@ namespace Mono.Cecil {
|
||||
case MetadataScopeType.AssemblyNameReference:
|
||||
return ImportAssemblyName ((AssemblyNameReference) scope);
|
||||
case MetadataScopeType.ModuleDefinition:
|
||||
if (scope == module) return scope;
|
||||
return ImportAssemblyName (((ModuleDefinition) scope).Assembly.Name);
|
||||
case MetadataScopeType.ModuleReference:
|
||||
throw new NotImplementedException ();
|
||||
@@ -474,7 +475,7 @@ namespace Mono.Cecil {
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
AssemblyNameReference ImportAssemblyName (AssemblyNameReference name)
|
||||
protected virtual AssemblyNameReference ImportAssemblyName (AssemblyNameReference name)
|
||||
{
|
||||
AssemblyNameReference reference;
|
||||
if (TryGetAssemblyNameReference (name, out reference))
|
||||
|
29
external/cecil/Mono.Cecil/ModuleDefinition.cs
vendored
29
external/cecil/Mono.Cecil/ModuleDefinition.cs
vendored
@@ -157,6 +157,22 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
interface ICustomMetadataWriter
|
||||
{
|
||||
/*
|
||||
* Remap TypeReference or create custom TypeRef token.
|
||||
*
|
||||
* Return true to use the returned custom 'token'.
|
||||
*
|
||||
* Return false to create a TypeRef token for 'type'
|
||||
* (which may have been replaced with a different TypeReference).
|
||||
*
|
||||
* This is necessary when types are moved from one assembly to another
|
||||
* to either adjust the scope or replace a TypeRef with a TypeDef token.
|
||||
*/
|
||||
bool CreateTypeRefToken (ref TypeReference type, out MetadataToken token);
|
||||
}
|
||||
|
||||
public sealed class WriterParameters {
|
||||
|
||||
Stream symbol_stream;
|
||||
@@ -216,6 +232,7 @@ namespace Mono.Cecil {
|
||||
|
||||
#if !READ_ONLY
|
||||
MetadataImporter importer;
|
||||
ICustomMetadataWriter custom_writer;
|
||||
#endif
|
||||
Collection<CustomAttribute> custom_attributes;
|
||||
Collection<AssemblyNameReference> references;
|
||||
@@ -286,6 +303,18 @@ namespace Mono.Cecil {
|
||||
internal MetadataImporter MetadataImporter {
|
||||
get { return importer ?? (importer = new MetadataImporter (this)); }
|
||||
}
|
||||
|
||||
internal void SetMetadataImporter (MetadataImporter importer)
|
||||
{
|
||||
if (this.importer != null)
|
||||
throw new InvalidOperationException ();
|
||||
this.importer = importer;
|
||||
}
|
||||
|
||||
internal ICustomMetadataWriter CustomMetadataWriter {
|
||||
get { return custom_writer; }
|
||||
set { custom_writer = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public IAssemblyResolver AssemblyResolver {
|
||||
|
Reference in New Issue
Block a user