diff options
author | jbevain <jbevain@gmail.com> | 2011-07-23 19:28:01 +0400 |
---|---|---|
committer | jbevain <jbevain@gmail.com> | 2011-07-23 19:35:50 +0400 |
commit | 6cf188305da21e888390418b23784e9c1c048406 (patch) | |
tree | 7af92b0acd6fcafd9a2fd09cc21ee9570f2ce598 /Mono.Cecil | |
parent | 46587ed5344733543ac5e1d5e20c5fbcc4857439 (diff) |
Add a constructor to create a SecurityDeclaration from a blob byte array
Diffstat (limited to 'Mono.Cecil')
-rw-r--r-- | Mono.Cecil/SecurityDeclaration.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Mono.Cecil/SecurityDeclaration.cs b/Mono.Cecil/SecurityDeclaration.cs index ecafbc2..f4a4964 100644 --- a/Mono.Cecil/SecurityDeclaration.cs +++ b/Mono.Cecil/SecurityDeclaration.cs @@ -93,6 +93,7 @@ namespace Mono.Cecil { public sealed class SecurityDeclaration { readonly internal uint signature; + byte [] blob; readonly ModuleDefinition module; internal bool resolved; @@ -137,12 +138,22 @@ namespace Mono.Cecil { this.resolved = true; } + public SecurityDeclaration (SecurityAction action, byte [] blob) + { + this.action = action; + this.resolved = false; + this.blob = blob; + } + public byte [] GetBlob () { + if (blob != null) + return blob; + if (!HasImage || signature == 0) throw new NotSupportedException (); - return module.Read (this, (declaration, reader) => reader.ReadSecurityDeclarationBlob (declaration.signature)); + return blob = module.Read (this, (declaration, reader) => reader.ReadSecurityDeclarationBlob (declaration.signature)); } void Resolve () |