├── 1033 ├── PEVerify.exe ├── PEVerify.exe.config └── pevrfyrc.dll ├── .gitattributes ├── .gitignore ├── Cecil ├── .gitignore ├── Mono.Cecil.Cil │ ├── Code.cs │ ├── CodeReader.cs │ ├── CodeWriter.cs │ ├── Document.cs │ ├── ExceptionHandler.cs │ ├── ILProcessor.cs │ ├── Instruction.cs │ ├── MethodBody.cs │ ├── OpCode.cs │ ├── OpCodes.cs │ ├── SequencePoint.cs │ ├── Symbols.cs │ ├── VariableDefinition.cs │ └── VariableReference.cs ├── Mono.Cecil.Metadata │ ├── BlobHeap.cs │ ├── Buffers.cs │ ├── CodedIndex.cs │ ├── ElementType.cs │ ├── GuidHeap.cs │ ├── Heap.cs │ ├── MetadataToken.cs │ ├── Row.cs │ ├── StringHeap.cs │ ├── TableHeap.cs │ ├── TokenType.cs │ ├── UserStringHeap.cs │ └── Utilities.cs ├── Mono.Cecil.PE │ ├── BinaryStreamReader.cs │ ├── BinaryStreamWriter.cs │ ├── ByteBuffer.cs │ ├── ByteBufferEqualityComparer.cs │ ├── DataDirectory.cs │ ├── Image.cs │ ├── ImageReader.cs │ ├── ImageWriter.cs │ ├── Section.cs │ └── TextMap.cs ├── Mono.Cecil.csproj ├── Mono.Cecil.nunit ├── Mono.Cecil.nuspec ├── Mono.Cecil.sln ├── Mono.Cecil.sln.DotSettings ├── Mono.Cecil │ ├── ArrayType.cs │ ├── AssemblyDefinition.cs │ ├── AssemblyFlags.cs │ ├── AssemblyHashAlgorithm.cs │ ├── AssemblyInfo.cs │ ├── AssemblyLinkedResource.cs │ ├── AssemblyNameDefinition.cs │ ├── AssemblyNameReference.cs │ ├── AssemblyReader.cs │ ├── AssemblyWriter.cs │ ├── BaseAssemblyResolver.cs │ ├── CallSite.cs │ ├── CustomAttribute.cs │ ├── DefaultAssemblyResolver.cs │ ├── EmbeddedResource.cs │ ├── EventAttributes.cs │ ├── EventDefinition.cs │ ├── EventReference.cs │ ├── ExportedType.cs │ ├── FieldAttributes.cs │ ├── FieldDefinition.cs │ ├── FieldReference.cs │ ├── FileAttributes.cs │ ├── FunctionPointerType.cs │ ├── GenericInstanceMethod.cs │ ├── GenericInstanceType.cs │ ├── GenericParameter.cs │ ├── GenericParameterAttributes.cs │ ├── IConstantProvider.cs │ ├── ICustomAttributeProvider.cs │ ├── IGenericInstance.cs │ ├── IGenericParameterProvider.cs │ ├── IMarshalInfoProvider.cs │ ├── IMemberDefinition.cs │ ├── IMetadataScope.cs │ ├── IMetadataTokenProvider.cs │ ├── IMethodSignature.cs │ ├── Import.cs │ ├── LinkedResource.cs │ ├── ManifestResourceAttributes.cs │ ├── MarshalInfo.cs │ ├── MemberDefinitionCollection.cs │ ├── MemberReference.cs │ ├── MetadataResolver.cs │ ├── MetadataSystem.cs │ ├── MethodAttributes.cs │ ├── MethodCallingConvention.cs │ ├── MethodDefinition.cs │ ├── MethodImplAttributes.cs │ ├── MethodReference.cs │ ├── MethodReturnType.cs │ ├── MethodSemanticsAttributes.cs │ ├── MethodSpecification.cs │ ├── Modifiers.cs │ ├── ModuleDefinition.cs │ ├── ModuleKind.cs │ ├── ModuleReference.cs │ ├── NativeType.cs │ ├── PInvokeAttributes.cs │ ├── PInvokeInfo.cs │ ├── ParameterAttributes.cs │ ├── ParameterDefinition.cs │ ├── ParameterDefinitionCollection.cs │ ├── ParameterReference.cs │ ├── PinnedType.cs │ ├── PointerType.cs │ ├── PropertyAttributes.cs │ ├── PropertyDefinition.cs │ ├── PropertyReference.cs │ ├── ReferenceType.cs │ ├── Resource.cs │ ├── SecurityDeclaration.cs │ ├── SentinelType.cs │ ├── TargetRuntime.cs │ ├── TypeAttributes.cs │ ├── TypeDefinition.cs │ ├── TypeDefinitionCollection.cs │ ├── TypeParser.cs │ ├── TypeReference.cs │ ├── TypeSpecification.cs │ ├── TypeSystem.cs │ └── VariantType.cs ├── Mono.Collections.Generic │ ├── Collection.cs │ └── ReadOnlyCollection.cs ├── Mono.Security.Cryptography │ ├── CryptoConvert.cs │ └── CryptoService.cs ├── Mono │ ├── Actions.cs │ ├── Empty.cs │ └── Funcs.cs ├── NOTES.txt ├── System.Runtime.CompilerServices │ └── ExtensionAttribute.cs ├── Test │ ├── .gitignore │ ├── Mono.Cecil.Tests.csproj │ ├── Mono.Cecil.Tests │ │ ├── Addin.cs │ │ ├── AssemblyInfo.cs │ │ ├── AssemblyTests.cs │ │ ├── BaseTestFixture.cs │ │ ├── CompilationService.cs │ │ ├── CustomAttributesTests.cs │ │ ├── EventTests.cs │ │ ├── Extensions.cs │ │ ├── FieldTests.cs │ │ ├── Formatter.cs │ │ ├── ILProcessorTests.cs │ │ ├── ImageReadTests.cs │ │ ├── ImportCecilTests.cs │ │ ├── ImportReflectionTests.cs │ │ ├── Linq.cs │ │ ├── MethodBodyTests.cs │ │ ├── MethodTests.cs │ │ ├── ModuleTests.cs │ │ ├── NestedTypesTests.cs │ │ ├── ParameterTests.cs │ │ ├── PropertyTests.cs │ │ ├── ResolveTests.cs │ │ ├── SecurityDeclarationTests.cs │ │ ├── TypeParserTests.cs │ │ ├── TypeTests.cs │ │ └── VariableTests.cs │ ├── Resources │ │ ├── assemblies │ │ │ ├── boxedoptarg.dll │ │ │ ├── cppcli.dll │ │ │ ├── cscgpbug.dll │ │ │ ├── decsec-att.dll │ │ │ ├── decsec-xml.dll │ │ │ ├── decsec1-xml.dll │ │ │ ├── delay-signed.dll │ │ │ ├── empty-decsec-att.dll │ │ │ ├── libhello.dll │ │ │ ├── libres.dll │ │ │ ├── marshal.dll │ │ │ ├── moda.netmodule │ │ │ ├── modb.netmodule │ │ │ ├── noblob.dll │ │ │ ├── text_file.txt │ │ │ └── wp7.dll │ │ ├── cs │ │ │ ├── CustomAttributes.cs │ │ │ ├── Events.cs │ │ │ ├── Fields.cs │ │ │ ├── Generics.cs │ │ │ ├── Interfaces.cs │ │ │ ├── Layouts.cs │ │ │ ├── Methods.cs │ │ │ ├── NestedTypes.cs │ │ │ └── Properties.cs │ │ └── il │ │ │ ├── explicitthis.il │ │ │ ├── hello.il │ │ │ ├── methodspecs.il │ │ │ ├── others.il │ │ │ └── types.il │ └── libs │ │ ├── nunit-2.4.8 │ │ └── license.txt │ │ └── nunit-2.5.10 │ │ ├── nunit.core.dll │ │ ├── nunit.core.interfaces.dll │ │ └── nunit.framework.dll ├── dbg │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── dbg.csproj ├── jbevain-cecil-aea2ceb │ ├── .gitignore │ ├── Mono.Cecil.Cil │ │ ├── Code.cs │ │ ├── CodeReader.cs │ │ ├── CodeWriter.cs │ │ ├── Document.cs │ │ ├── ExceptionHandler.cs │ │ ├── ILProcessor.cs │ │ ├── Instruction.cs │ │ ├── MethodBody.cs │ │ ├── OpCode.cs │ │ ├── OpCodes.cs │ │ ├── SequencePoint.cs │ │ ├── Symbols.cs │ │ ├── VariableDefinition.cs │ │ └── VariableReference.cs │ ├── Mono.Cecil.Metadata │ │ ├── BlobHeap.cs │ │ ├── Buffers.cs │ │ ├── CodedIndex.cs │ │ ├── ElementType.cs │ │ ├── GuidHeap.cs │ │ ├── Heap.cs │ │ ├── MetadataToken.cs │ │ ├── Row.cs │ │ ├── StringHeap.cs │ │ ├── TableHeap.cs │ │ ├── TokenType.cs │ │ ├── UserStringHeap.cs │ │ └── Utilities.cs │ ├── Mono.Cecil.PE │ │ ├── BinaryStreamReader.cs │ │ ├── BinaryStreamWriter.cs │ │ ├── ByteBuffer.cs │ │ ├── ByteBufferEqualityComparer.cs │ │ ├── DataDirectory.cs │ │ ├── Image.cs │ │ ├── ImageReader.cs │ │ ├── ImageWriter.cs │ │ ├── Section.cs │ │ └── TextMap.cs │ ├── Mono.Cecil.csproj │ ├── Mono.Cecil.nunit │ ├── Mono.Cecil.nuspec │ ├── Mono.Cecil.sln │ ├── Mono.Cecil.sln.DotSettings │ ├── Mono.Cecil │ │ ├── ArrayType.cs │ │ ├── AssemblyDefinition.cs │ │ ├── AssemblyFlags.cs │ │ ├── AssemblyHashAlgorithm.cs │ │ ├── AssemblyInfo.cs │ │ ├── AssemblyLinkedResource.cs │ │ ├── AssemblyNameDefinition.cs │ │ ├── AssemblyNameReference.cs │ │ ├── AssemblyReader.cs │ │ ├── AssemblyWriter.cs │ │ ├── BaseAssemblyResolver.cs │ │ ├── CallSite.cs │ │ ├── CustomAttribute.cs │ │ ├── DefaultAssemblyResolver.cs │ │ ├── EmbeddedResource.cs │ │ ├── EventAttributes.cs │ │ ├── EventDefinition.cs │ │ ├── EventReference.cs │ │ ├── ExportedType.cs │ │ ├── FieldAttributes.cs │ │ ├── FieldDefinition.cs │ │ ├── FieldReference.cs │ │ ├── FileAttributes.cs │ │ ├── FunctionPointerType.cs │ │ ├── GenericInstanceMethod.cs │ │ ├── GenericInstanceType.cs │ │ ├── GenericParameter.cs │ │ ├── GenericParameterAttributes.cs │ │ ├── IConstantProvider.cs │ │ ├── ICustomAttributeProvider.cs │ │ ├── IGenericInstance.cs │ │ ├── IGenericParameterProvider.cs │ │ ├── IMarshalInfoProvider.cs │ │ ├── IMemberDefinition.cs │ │ ├── IMetadataScope.cs │ │ ├── IMetadataTokenProvider.cs │ │ ├── IMethodSignature.cs │ │ ├── Import.cs │ │ ├── LinkedResource.cs │ │ ├── ManifestResourceAttributes.cs │ │ ├── MarshalInfo.cs │ │ ├── MemberDefinitionCollection.cs │ │ ├── MemberReference.cs │ │ ├── MetadataResolver.cs │ │ ├── MetadataSystem.cs │ │ ├── MethodAttributes.cs │ │ ├── MethodCallingConvention.cs │ │ ├── MethodDefinition.cs │ │ ├── MethodImplAttributes.cs │ │ ├── MethodReference.cs │ │ ├── MethodReturnType.cs │ │ ├── MethodSemanticsAttributes.cs │ │ ├── MethodSpecification.cs │ │ ├── Modifiers.cs │ │ ├── ModuleDefinition.cs │ │ ├── ModuleKind.cs │ │ ├── ModuleReference.cs │ │ ├── NativeType.cs │ │ ├── PInvokeAttributes.cs │ │ ├── PInvokeInfo.cs │ │ ├── ParameterAttributes.cs │ │ ├── ParameterDefinition.cs │ │ ├── ParameterDefinitionCollection.cs │ │ ├── ParameterReference.cs │ │ ├── PinnedType.cs │ │ ├── PointerType.cs │ │ ├── PropertyAttributes.cs │ │ ├── PropertyDefinition.cs │ │ ├── PropertyReference.cs │ │ ├── ReferenceType.cs │ │ ├── Resource.cs │ │ ├── SecurityDeclaration.cs │ │ ├── SentinelType.cs │ │ ├── TargetRuntime.cs │ │ ├── TypeAttributes.cs │ │ ├── TypeDefinition.cs │ │ ├── TypeDefinitionCollection.cs │ │ ├── TypeParser.cs │ │ ├── TypeReference.cs │ │ ├── TypeSpecification.cs │ │ ├── TypeSystem.cs │ │ └── VariantType.cs │ ├── Mono.Collections.Generic │ │ ├── Collection.cs │ │ └── ReadOnlyCollection.cs │ ├── Mono.Security.Cryptography │ │ ├── CryptoConvert.cs │ │ └── CryptoService.cs │ ├── Mono │ │ ├── Actions.cs │ │ ├── Empty.cs │ │ └── Funcs.cs │ ├── NOTES.txt │ ├── System.Runtime.CompilerServices │ │ └── ExtensionAttribute.cs │ ├── Test │ │ ├── .gitignore │ │ ├── Mono.Cecil.Tests.csproj │ │ ├── Mono.Cecil.Tests │ │ │ ├── Addin.cs │ │ │ ├── AssemblyInfo.cs │ │ │ ├── AssemblyTests.cs │ │ │ ├── BaseTestFixture.cs │ │ │ ├── CompilationService.cs │ │ │ ├── CustomAttributesTests.cs │ │ │ ├── EventTests.cs │ │ │ ├── Extensions.cs │ │ │ ├── FieldTests.cs │ │ │ ├── Formatter.cs │ │ │ ├── ILProcessorTests.cs │ │ │ ├── ImageReadTests.cs │ │ │ ├── ImportCecilTests.cs │ │ │ ├── ImportReflectionTests.cs │ │ │ ├── Linq.cs │ │ │ ├── MethodBodyTests.cs │ │ │ ├── MethodTests.cs │ │ │ ├── ModuleTests.cs │ │ │ ├── NestedTypesTests.cs │ │ │ ├── ParameterTests.cs │ │ │ ├── PropertyTests.cs │ │ │ ├── ResolveTests.cs │ │ │ ├── SecurityDeclarationTests.cs │ │ │ ├── TypeParserTests.cs │ │ │ ├── TypeTests.cs │ │ │ └── VariableTests.cs │ │ ├── Resources │ │ │ ├── assemblies │ │ │ │ ├── boxedoptarg.dll │ │ │ │ ├── cppcli.dll │ │ │ │ ├── cscgpbug.dll │ │ │ │ ├── decsec-att.dll │ │ │ │ ├── decsec-xml.dll │ │ │ │ ├── decsec1-xml.dll │ │ │ │ ├── delay-signed.dll │ │ │ │ ├── empty-decsec-att.dll │ │ │ │ ├── libhello.dll │ │ │ │ ├── libres.dll │ │ │ │ ├── marshal.dll │ │ │ │ ├── moda.netmodule │ │ │ │ ├── modb.netmodule │ │ │ │ ├── noblob.dll │ │ │ │ ├── text_file.txt │ │ │ │ └── wp7.dll │ │ │ ├── cs │ │ │ │ ├── CustomAttributes.cs │ │ │ │ ├── Events.cs │ │ │ │ ├── Fields.cs │ │ │ │ ├── Generics.cs │ │ │ │ ├── Interfaces.cs │ │ │ │ ├── Layouts.cs │ │ │ │ ├── Methods.cs │ │ │ │ ├── NestedTypes.cs │ │ │ │ └── Properties.cs │ │ │ └── il │ │ │ │ ├── explicitthis.il │ │ │ │ ├── hello.il │ │ │ │ ├── methodspecs.il │ │ │ │ ├── others.il │ │ │ │ └── types.il │ │ └── libs │ │ │ ├── nunit-2.4.8 │ │ │ └── license.txt │ │ │ └── nunit-2.5.10 │ │ │ ├── nunit.core.dll │ │ │ ├── nunit.core.interfaces.dll │ │ │ └── nunit.framework.dll │ ├── dbg │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── dbg.csproj │ ├── mono.snk │ ├── rocks │ │ ├── .gitignore │ │ ├── Mono.Cecil.Rocks.csproj │ │ ├── Mono.Cecil.Rocks │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Functional.cs │ │ │ ├── ILParser.cs │ │ │ ├── MethodBodyRocks.cs │ │ │ ├── MethodDefinitionRocks.cs │ │ │ ├── ModuleDefinitionRocks.cs │ │ │ ├── ParameterReferenceRocks.cs │ │ │ ├── SecurityDeclarationRocks.cs │ │ │ ├── TypeDefinitionRocks.cs │ │ │ └── TypeReferenceRocks.cs │ │ └── Test │ │ │ ├── .gitignore │ │ │ ├── Mono.Cecil.Rocks.Tests.csproj │ │ │ ├── Mono.Cecil.Tests │ │ │ ├── Addin.cs │ │ │ ├── MethodDefinitionRocksTests.cs │ │ │ ├── ModuleDefinitionRocksTests.cs │ │ │ ├── SecurityDeclarationRocksTests.cs │ │ │ ├── TypeDefinitionRocksTests.cs │ │ │ └── TypeReferenceRocksTests.cs │ │ │ └── Resources │ │ │ ├── assemblies │ │ │ ├── decsec-att.dll │ │ │ └── decsec-xml.dll │ │ │ └── cs │ │ │ └── Types.cs │ └── symbols │ │ ├── mdb │ │ ├── .gitignore │ │ ├── Mono.Cecil.Mdb.csproj │ │ ├── Mono.Cecil.Mdb │ │ │ ├── AssemblyInfo.cs │ │ │ ├── MdbReader.cs │ │ │ └── MdbWriter.cs │ │ ├── Mono.CompilerServices.SymbolWriter │ │ │ ├── MonoSymbolFile.cs │ │ │ ├── MonoSymbolTable.cs │ │ │ ├── MonoSymbolWriter.cs │ │ │ └── SymbolWriterImpl.cs │ │ └── Test │ │ │ ├── .gitignore │ │ │ ├── Mono.Cecil.Mdb.Tests.csproj │ │ │ ├── Mono.Cecil.Tests │ │ │ ├── Addin.cs │ │ │ └── MdbTests.cs │ │ │ └── Resources │ │ │ └── assemblies │ │ │ └── hello.exe.mdb │ │ └── pdb │ │ ├── .gitignore │ │ ├── Mono.Cecil.Pdb.csproj │ │ └── Test │ │ ├── .gitignore │ │ ├── Mono.Cecil.Pdb.Tests.csproj │ │ └── Mono.Cecil.Tests │ │ ├── Addin.cs │ │ ├── Linq.cs │ │ └── PdbTests.cs ├── mono.snk └── symbols │ ├── mdb │ ├── .gitignore │ ├── Mono.Cecil.Mdb.csproj │ ├── Mono.Cecil.Mdb │ │ ├── AssemblyInfo.cs │ │ ├── MdbReader.cs │ │ └── MdbWriter.cs │ ├── Mono.CompilerServices.SymbolWriter │ │ ├── MonoSymbolFile.cs │ │ ├── MonoSymbolTable.cs │ │ ├── MonoSymbolWriter.cs │ │ └── SymbolWriterImpl.cs │ └── Test │ │ ├── .gitignore │ │ ├── Mono.Cecil.Mdb.Tests.csproj │ │ ├── Mono.Cecil.Tests │ │ ├── Addin.cs │ │ └── MdbTests.cs │ │ └── Resources │ │ └── assemblies │ │ └── hello.exe.mdb │ └── pdb │ ├── .gitignore │ ├── Mono.Cecil.Pdb.csproj │ └── Test │ ├── .gitignore │ ├── Mono.Cecil.Pdb.Tests.csproj │ └── Mono.Cecil.Tests │ ├── Addin.cs │ ├── Linq.cs │ └── PdbTests.cs ├── NETPack.Console ├── .gitignore ├── NETPack.Console.csproj ├── Options.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── app.config ├── NETPack.Core ├── .gitignore ├── Engine │ ├── Compression │ │ ├── DeflateStream.cs │ │ └── QuickLZ.cs │ ├── ConsoleLogger.cs │ ├── PackerContext.cs │ ├── Packing │ │ ├── Analysis │ │ │ ├── ArchitectureAnalyzer.cs │ │ │ ├── AssemblyReferenceAnalyzer.cs │ │ │ ├── CLRVersionAnalyzer.cs │ │ │ ├── EntrypointAnalyzer.cs │ │ │ ├── IconAnalyzer.cs │ │ │ ├── ReflectionAnalyzer.cs │ │ │ └── SubsystemAnalyzer.cs │ │ └── Steps │ │ │ ├── AnalysisStep.cs │ │ │ ├── CompressingStep.cs │ │ │ ├── FinalizerStep.cs │ │ │ ├── InitializerStep.cs │ │ │ ├── LinkerStep.cs │ │ │ ├── PEVerifyStep.cs │ │ │ └── ReferencePackerStep.cs │ ├── QuickLZ.cs │ ├── Structs, Enums & Interfaces │ │ ├── AnalysisEntry.cs │ │ ├── Analyzer.cs │ │ ├── Bugster │ │ │ └── NETPackExceptionFormatter.cs │ │ ├── IUserInterfaceProvider.cs │ │ ├── LogLevel.cs │ │ ├── PackingStep.cs │ │ └── StandardContext.cs │ └── Utils │ │ ├── Bugster.cs │ │ ├── CecilHelper.cs │ │ ├── Extensions │ │ ├── Array.cs │ │ ├── AssemblyDefinition.cs │ │ ├── AssemblyNameReference.cs │ │ ├── Dictionary.cs │ │ ├── Int32.cs │ │ ├── ModuleDefinition.cs │ │ └── String.cs │ │ ├── Logger.cs │ │ ├── NativeHelper.cs │ │ ├── PEVerifyWrapper.cs │ │ └── StubWorker.cs ├── Globals.cs ├── Injections │ ├── Decompressor.cs │ ├── Loader.cs │ ├── Resolver.cs │ └── Watermark.cs ├── Mono libs │ └── Linker │ │ ├── Mono.Linker.Steps │ │ ├── BaseStep.cs │ │ ├── BlacklistStep.cs │ │ ├── CleanStep.cs │ │ ├── IStep.cs │ │ ├── LoadI18nAssemblies.cs │ │ ├── LoadReferencesStep.cs │ │ ├── MarkStep.cs │ │ ├── OutputStep.cs │ │ ├── RegenerateGuidStep.cs │ │ ├── ResolveFromAssemblyStep.cs │ │ ├── ResolveFromXApiStep.cs │ │ ├── ResolveFromXmlStep.cs │ │ ├── ResolveStep.cs │ │ ├── SweepStep.cs │ │ └── TypeMapStep.cs │ │ └── Mono.Linker │ │ ├── Annotations.cs │ │ ├── AssemblyAction.cs │ │ ├── AssemblyResolver.cs │ │ ├── Driver.cs │ │ ├── I18nAssemblies.cs │ │ ├── IXApiVisitor.cs │ │ ├── LinkContext.cs │ │ ├── MethodAction.cs │ │ ├── Pipeline.cs │ │ ├── TypePreserve.cs │ │ └── XApiReader.cs ├── NETPack.Core.csproj ├── NETPack.Core.sln ├── OptionSet.cs ├── Packer.cs ├── Properties │ └── AssemblyInfo.cs └── bin │ ├── Debug │ ├── 1033 │ │ ├── PEVerify.exe │ │ ├── PEVerify.exe.config │ │ └── pevrfyrc.dll │ ├── Mono.Cecil.dll │ ├── NDesk.Options.dll │ ├── NETPack.Console.exe │ ├── NETPack.Console.exe.config │ ├── NETPack.Console.vshost.exe.config │ ├── NETPack.Console.vshost.exe.manifest │ ├── NETPack.Core.dll │ └── log.txt │ └── Release │ ├── 1033 │ ├── PEVerify.exe │ ├── PEVerify.exe.config │ └── pevrfyrc.dll │ ├── Mono.Cecil.dll │ ├── NDesk.Options.dll │ ├── NETPack.Console.exe │ ├── NETPack.Console.exe.config │ ├── NETPack.Console.vshost.exe.config │ ├── NETPack.Console.vshost.exe.manifest │ ├── NETPack.Core.dll │ └── log.txt └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | ################# 4 | ## Visual Studio 5 | ################# 6 | 7 | ## Ignore Visual Studio temporary files, build results, and 8 | ## files generated by popular Visual Studio add-ons. 9 | 10 | # User-specific files 11 | *.suo 12 | *.user 13 | *.sln.docstates 14 | 15 | # Build results 16 | 17 | [Oo]bj/ 18 | *_i.c 19 | *_p.c 20 | *.ilk 21 | *.meta 22 | *.obj 23 | *.pch 24 | *.pdb 25 | *.pgc 26 | *.pgd 27 | *.rsp 28 | *.sbr 29 | *.tlb 30 | *.tli 31 | *.tlh 32 | *.tmp 33 | *.vspscc 34 | .builds 35 | *.dotCover 36 | *.cache 37 | *.exe 38 | *.pdb 39 | *.bin 40 | *.dat 41 | 42 | 43 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 44 | #packages/ 45 | 46 | # Visual C++ cache files 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opensdf 51 | *.sdf 52 | 53 | # Visual Studio profiler 54 | *.psess 55 | *.vsp 56 | 57 | # ReSharper is a .NET coding add-in 58 | _ReSharper* 59 | 60 | # Installshield output folder 61 | [Ee]xpress 62 | 63 | # DocProject is a documentation generator add-in 64 | DocProject/buildhelp/ 65 | DocProject/Help/*.HxT 66 | DocProject/Help/*.HxC 67 | DocProject/Help/*.hhc 68 | DocProject/Help/*.hhk 69 | DocProject/Help/*.hhp 70 | DocProject/Help/Html2 71 | DocProject/Help/html 72 | 73 | # Click-Once directory 74 | publish 75 | 76 | # Others 77 | 78 | [Oo]bj 79 | sql 80 | TestResults 81 | *.Cache 82 | ClientBin 83 | stylecop.* 84 | ~$* 85 | *.dbmdl 86 | Generated_Code #added for RIA/Silverlight projects 87 | 88 | # Backup & report files from converting an old project file to a newer 89 | # Visual Studio version. Backup files are not needed, because we have git ;-) 90 | _UpgradeReport_Files/ 91 | Backup*/ 92 | UpgradeLog*.XML 93 | 94 | !PEVerify.exe 95 | 96 | 97 | # Mac crap 98 | .DS_Store 99 | -------------------------------------------------------------------------------- /1033/PEVerify.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/1033/PEVerify.exe -------------------------------------------------------------------------------- /1033/PEVerify.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /1033/pevrfyrc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/1033/pevrfyrc.dll -------------------------------------------------------------------------------- /Cecil/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.user 5 | *.pidb 6 | *.userprefs 7 | *.xml 8 | *.nupkg 9 | **/test-results/* 10 | *Resharper* 11 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.Cil/VariableDefinition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VariableDefinition.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil.Cil { 30 | 31 | public sealed class VariableDefinition : VariableReference { 32 | 33 | public bool IsPinned { 34 | get { return variable_type.IsPinned; } 35 | } 36 | 37 | public VariableDefinition (TypeReference variableType) 38 | : base (variableType) 39 | { 40 | } 41 | 42 | public VariableDefinition (string name, TypeReference variableType) 43 | : base (name, variableType) 44 | { 45 | } 46 | 47 | public override VariableDefinition Resolve () 48 | { 49 | return this; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.Metadata/CodedIndex.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CodedIndex.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil.Metadata { 30 | 31 | enum CodedIndex { 32 | TypeDefOrRef, 33 | HasConstant, 34 | HasCustomAttribute, 35 | HasFieldMarshal, 36 | HasDeclSecurity, 37 | MemberRefParent, 38 | HasSemantics, 39 | MethodDefOrRef, 40 | MemberForwarded, 41 | Implementation, 42 | CustomAttributeType, 43 | ResolutionScope, 44 | TypeOrMethodDef 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.Metadata/Heap.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using Mono.Cecil.PE; 30 | 31 | namespace Mono.Cecil.Metadata { 32 | 33 | abstract class Heap { 34 | 35 | public int IndexSize; 36 | 37 | public readonly Section Section; 38 | public readonly uint Offset; 39 | public readonly uint Size; 40 | 41 | protected Heap (Section section, uint offset, uint size) 42 | { 43 | this.Section = section; 44 | this.Offset = offset; 45 | this.Size = size; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.PE/BinaryStreamReader.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BinaryStreamReader.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | using System.IO; 31 | 32 | namespace Mono.Cecil.PE { 33 | 34 | class BinaryStreamReader : BinaryReader { 35 | 36 | public BinaryStreamReader (Stream stream) 37 | : base (stream) 38 | { 39 | } 40 | 41 | protected void Advance (int bytes) 42 | { 43 | BaseStream.Seek (bytes, SeekOrigin.Current); 44 | } 45 | 46 | protected DataDirectory ReadDataDirectory () 47 | { 48 | return new DataDirectory (ReadUInt32 (), ReadUInt32 ()); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.PE/DataDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DataDirectory.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using RVA = System.UInt32; 32 | 33 | namespace Mono.Cecil.PE { 34 | 35 | struct DataDirectory { 36 | 37 | public readonly RVA VirtualAddress; 38 | public readonly uint Size; 39 | 40 | public bool IsZero { 41 | get { return VirtualAddress == 0 && Size == 0; } 42 | } 43 | 44 | public DataDirectory (RVA rva, uint size) 45 | { 46 | this.VirtualAddress = rva; 47 | this.Size = size; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.PE/Section.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Section.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using RVA = System.UInt32; 32 | 33 | namespace Mono.Cecil.PE { 34 | public sealed class Section { 35 | public string Name; 36 | public RVA VirtualAddress; 37 | public uint VirtualSize; 38 | public uint SizeOfRawData; 39 | public uint PointerToRawData; 40 | public byte [] Data; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.nunit: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mono.Cecil 5 | 0.9.5.3 6 | Mono.Cecil 7 | Jb Evain 8 | Jb Evain 9 | http://opensource.org/licenses/mit-license.php 10 | false 11 | http://github.com/jbevain/cecil/ 12 | Cecil is a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. 13 | Cecil is a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. It has full support for generics, and support some debugging symbol format. In simple English, with Cecil, you can load existing managed assemblies, browse all the contained types, modify them on the fly and save back to the disk the modified assembly. 14 | en-US 15 | assembly assemblies module modules il cil msil bytecode reflection injection cecil mono aop 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/AssemblyFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyFlags.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum AssemblyAttributes : uint { 35 | PublicKey = 0x0001, 36 | SideBySideCompatible = 0x0000, 37 | Retargetable = 0x0100, 38 | WindowsRuntime = 0x0200, 39 | DisableJITCompileOptimizer = 0x4000, 40 | EnableJITCompileTracking = 0x8000, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/AssemblyHashAlgorithm.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyHashAlgorithm.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum AssemblyHashAlgorithm : uint { 32 | None = 0x0000, 33 | Reserved = 0x8003, // MD5 34 | SHA1 = 0x8004 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/AssemblyNameDefinition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyNameDefinition.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | public sealed class AssemblyNameDefinition : AssemblyNameReference { 34 | 35 | public override byte [] Hash { 36 | get { return Empty.Array; } 37 | } 38 | 39 | internal AssemblyNameDefinition () 40 | { 41 | this.token = new MetadataToken (TokenType.Assembly, 1); 42 | } 43 | 44 | public AssemblyNameDefinition (string name, Version version) 45 | : base (name, version) 46 | { 47 | this.token = new MetadataToken (TokenType.Assembly, 1); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/EventAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // EventAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum EventAttributes : ushort { 35 | None = 0x0000, 36 | SpecialName = 0x0200, // Event is special 37 | RTSpecialName = 0x0400 // CLI provides 'special' behavior, depending upon the name of the event 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/FileAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // FileAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | enum FileAttributes : uint { 32 | ContainsMetaData = 0x0000, // This is not a resource file 33 | ContainsNoMetaData = 0x0001, // This is a resource file or other non-metadata-containing file 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/GenericParameterAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GenericParameterAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum GenericParameterAttributes : ushort { 35 | VarianceMask = 0x0003, 36 | NonVariant = 0x0000, 37 | Covariant = 0x0001, 38 | Contravariant = 0x0002, 39 | 40 | SpecialConstraintMask = 0x001c, 41 | ReferenceTypeConstraint = 0x0004, 42 | NotNullableValueTypeConstraint = 0x0008, 43 | DefaultConstructorConstraint = 0x0010 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/IMetadataScope.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IMetadataScope.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum MetadataScopeType { 32 | AssemblyNameReference, 33 | ModuleReference, 34 | ModuleDefinition, 35 | } 36 | 37 | public interface IMetadataScope : IMetadataTokenProvider { 38 | MetadataScopeType MetadataScopeType { get; } 39 | string Name { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/IMetadataTokenProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IMetadataTokenProvider.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public interface IMetadataTokenProvider { 32 | 33 | MetadataToken MetadataToken { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/ManifestResourceAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ManifestResourceAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum ManifestResourceAttributes : uint { 35 | VisibilityMask = 0x0007, 36 | Public = 0x0001, // The resource is exported from the Assembly 37 | Private = 0x0002 // The resource is private to the Assembly 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/MethodCallingConvention.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MethodCallingConvention.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum MethodCallingConvention : byte { 32 | Default = 0x0, 33 | C = 0x1, 34 | StdCall = 0x2, 35 | ThisCall = 0x3, 36 | FastCall = 0x4, 37 | VarArg = 0x5, 38 | Generic = 0x10, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/MethodSemanticsAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MethodSemanticsattributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum MethodSemanticsAttributes : ushort { 35 | None = 0x0000, 36 | Setter = 0x0001, // Setter for property 37 | Getter = 0x0002, // Getter for property 38 | Other = 0x0004, // Other method for property or event 39 | AddOn = 0x0008, // AddOn method for event 40 | RemoveOn = 0x0010, // RemoveOn method for event 41 | Fire = 0x0020 // Fire method for event 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/ParameterAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ParameterAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum ParameterAttributes : ushort { 35 | None = 0x0000, 36 | In = 0x0001, // Param is [In] 37 | Out = 0x0002, // Param is [Out] 38 | Lcid = 0x0004, 39 | Retval = 0x0008, 40 | Optional = 0x0010, // Param is optional 41 | HasDefault = 0x1000, // Param has default value 42 | HasFieldMarshal = 0x2000, // Param has field marshal 43 | Unused = 0xcfe0 // Reserved: shall be zero in a conforming implementation 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/PinnedType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PinnedType.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using MD = Mono.Cecil.Metadata; 32 | 33 | namespace Mono.Cecil { 34 | 35 | public sealed class PinnedType : TypeSpecification { 36 | 37 | public override bool IsValueType { 38 | get { return false; } 39 | set { throw new InvalidOperationException (); } 40 | } 41 | 42 | public override bool IsPinned { 43 | get { return true; } 44 | } 45 | 46 | public PinnedType (TypeReference type) 47 | : base (type) 48 | { 49 | Mixin.CheckType (type); 50 | this.etype = MD.ElementType.Pinned; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/PropertyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PropertyAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum PropertyAttributes : ushort { 35 | None = 0x0000, 36 | SpecialName = 0x0200, // Property is special 37 | RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding 38 | HasDefault = 0x1000, // Property has default 39 | Unused = 0xe9ff // Reserved: shall be zero in a conforming implementation 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/SentinelType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SentinelType.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using MD = Mono.Cecil.Metadata; 32 | 33 | namespace Mono.Cecil { 34 | 35 | public sealed class SentinelType : TypeSpecification { 36 | 37 | public override bool IsValueType { 38 | get { return false; } 39 | set { throw new InvalidOperationException (); } 40 | } 41 | 42 | public override bool IsSentinel { 43 | get { return true; } 44 | } 45 | 46 | public SentinelType (TypeReference type) 47 | : base (type) 48 | { 49 | Mixin.CheckType (type); 50 | this.etype = MD.ElementType.Sentinel; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/TargetRuntime.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TargetRuntime.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum TargetRuntime { 32 | Net_1_0, 33 | Net_1_1, 34 | Net_2_0, 35 | Net_4_0, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Cecil/Mono.Cecil/VariantType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VariantType.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum VariantType { 32 | None = 0, 33 | I2 = 2, 34 | I4 = 3, 35 | R4 = 4, 36 | R8 = 5, 37 | CY = 6, 38 | Date = 7, 39 | BStr = 8, 40 | Dispatch = 9, 41 | Error = 10, 42 | Bool = 11, 43 | Variant = 12, 44 | Unknown = 13, 45 | Decimal = 14, 46 | I1 = 16, 47 | UI1 = 17, 48 | UI2 = 18, 49 | UI4 = 19, 50 | Int = 22, 51 | UInt = 23 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/Mono/Actions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Actions.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if !NET_3_5 && !NET_4_0 30 | 31 | namespace Mono { 32 | //delegate void Action (); 33 | delegate void Action (T1 arg1, T2 arg2); 34 | //delegate void Action (T1 arg1, T2 arg2, T3 arg3); 35 | //delegate void Action (T1 arg1, T2 arg2, T3 arg3, T4 arg4); 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Cecil/Mono/Empty.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Empty.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using Mono.Collections.Generic; 30 | 31 | namespace Mono { 32 | 33 | static class Empty { 34 | 35 | public static readonly T [] Array = new T [0]; 36 | } 37 | } 38 | 39 | namespace Mono.Cecil { 40 | 41 | static partial class Mixin { 42 | 43 | public static bool IsNullOrEmpty (this T [] self) 44 | { 45 | return self == null || self.Length == 0; 46 | } 47 | 48 | public static bool IsNullOrEmpty (this Collection self) 49 | { 50 | return self == null || self.size == 0; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/Mono/Funcs.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Funcs.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if !NET_3_5 && !NET_4_0 30 | 31 | namespace Mono { 32 | delegate TResult Func (); 33 | delegate TResult Func (T arg1); 34 | delegate TResult Func (T1 arg1, T2 arg2); 35 | //delegate TResult Func (T1 arg1, T2 arg2, T3 arg3); 36 | //delegate TResult Func (T1 arg1, T2 arg2, T3 arg3, T4 arg4); 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Cecil/System.Runtime.CompilerServices/ExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ExtensionAttribute.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | #if !NET_3_5 && !NET_4_0 32 | 33 | namespace System.Runtime.CompilerServices { 34 | 35 | [AttributeUsage (AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] 36 | sealed class ExtensionAttribute : Attribute { 37 | } 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /Cecil/Test/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.user 5 | *.xml 6 | *.pidb 7 | *.userprefs 8 | -------------------------------------------------------------------------------- /Cecil/Test/Mono.Cecil.Tests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle ("Mono.Cecil.Tests")] 6 | [assembly: AssemblyProduct ("Mono.Cecil")] 7 | [assembly: AssemblyCopyright ("Copyright © 2008 - 2011 Jb Evain")] 8 | 9 | [assembly: ComVisible (false)] 10 | 11 | [assembly: Guid ("da96c202-696a-457e-89af-5fa74e6bda0d")] 12 | 13 | [assembly: AssemblyVersion ("1.0.0.0")] 14 | [assembly: AssemblyFileVersion ("1.0.0.0")] 15 | -------------------------------------------------------------------------------- /Cecil/Test/Mono.Cecil.Tests/AssemblyTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Mono.Cecil; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace Mono.Cecil.Tests { 8 | 9 | [TestFixture] 10 | public class AssemblyTests : BaseTestFixture { 11 | 12 | [TestModule ("hello.exe")] 13 | public void Name (ModuleDefinition module) 14 | { 15 | var name = module.Assembly.Name; 16 | 17 | Assert.IsNotNull (name); 18 | 19 | Assert.AreEqual ("hello", name.Name); 20 | Assert.AreEqual (string.Empty, name.Culture); 21 | Assert.AreEqual (new Version (0, 0, 0, 0), name.Version); 22 | Assert.AreEqual (AssemblyHashAlgorithm.SHA1, name.HashAlgorithm); 23 | } 24 | 25 | [Test] 26 | public void ParseLowerCaseNameParts() 27 | { 28 | var name = AssemblyNameReference.Parse ("Foo, version=2.0.0.0, culture=fr-FR"); 29 | Assert.AreEqual ("Foo", name.Name); 30 | Assert.AreEqual (2, name.Version.Major); 31 | Assert.AreEqual (0, name.Version.Minor); 32 | Assert.AreEqual ("fr-FR", name.Culture); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Cecil/Test/Mono.Cecil.Tests/EventTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Mono.Cecil; 4 | using Mono.Cecil.Metadata; 5 | 6 | using NUnit.Framework; 7 | 8 | namespace Mono.Cecil.Tests { 9 | 10 | [TestFixture] 11 | public class EventTests : BaseTestFixture { 12 | 13 | [TestCSharp ("Events.cs")] 14 | public void AbstractMethod (ModuleDefinition module) 15 | { 16 | var type = module.GetType ("Foo"); 17 | 18 | Assert.IsTrue (type.HasEvents); 19 | 20 | var events = type.Events; 21 | 22 | Assert.AreEqual (1, events.Count); 23 | 24 | var @event = events [0]; 25 | 26 | Assert.IsNotNull (@event); 27 | Assert.AreEqual ("Bar", @event.Name); 28 | Assert.IsNotNull (@event.EventType); 29 | Assert.AreEqual ("Pan", @event.EventType.FullName); 30 | 31 | Assert.IsNotNull (@event.AddMethod); 32 | Assert.AreEqual (MethodSemanticsAttributes.AddOn, @event.AddMethod.SemanticsAttributes); 33 | Assert.IsNotNull (@event.RemoveMethod); 34 | Assert.AreEqual (MethodSemanticsAttributes.RemoveOn, @event.RemoveMethod.SemanticsAttributes); 35 | } 36 | 37 | [TestIL ("others.il")] 38 | public void OtherMethod (ModuleDefinition module) 39 | { 40 | var type = module.GetType ("Others"); 41 | 42 | Assert.IsTrue (type.HasEvents); 43 | 44 | var events = type.Events; 45 | 46 | Assert.AreEqual (1, events.Count); 47 | 48 | var @event = events [0]; 49 | 50 | Assert.IsNotNull (@event); 51 | Assert.AreEqual ("Handler", @event.Name); 52 | Assert.IsNotNull (@event.EventType); 53 | Assert.AreEqual ("System.EventHandler", @event.EventType.FullName); 54 | 55 | Assert.IsTrue (@event.HasOtherMethods); 56 | 57 | Assert.AreEqual (2, @event.OtherMethods.Count); 58 | 59 | var other = @event.OtherMethods [0]; 60 | Assert.AreEqual ("dang_Handler", other.Name); 61 | 62 | other = @event.OtherMethods [1]; 63 | Assert.AreEqual ("fang_Handler", other.Name); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Cecil/Test/Mono.Cecil.Tests/Linq.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Mono; 5 | 6 | #if !NET_3_5 && !NET_4_0 7 | 8 | namespace System.Linq { 9 | 10 | static class Enumerable { 11 | 12 | public static IEnumerable Select (this IEnumerable self, Func selector) 13 | { 14 | foreach (var item in self) 15 | yield return selector (item); 16 | } 17 | 18 | public static IEnumerable Where (this IEnumerable self, Func predicate) 19 | { 20 | foreach (var item in self) 21 | if (predicate (item)) 22 | yield return item; 23 | } 24 | 25 | public static List ToList (this IEnumerable self) 26 | { 27 | return new List (self); 28 | } 29 | 30 | public static T [] ToArray (this IEnumerable self) 31 | { 32 | return self.ToList ().ToArray (); 33 | } 34 | 35 | public static T First (this IEnumerable self) 36 | { 37 | using (var enumerator = self.GetEnumerator ()) { 38 | if (!enumerator.MoveNext ()) 39 | throw new InvalidOperationException (); 40 | 41 | return enumerator.Current; 42 | } 43 | } 44 | } 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Cecil/Test/Mono.Cecil.Tests/NestedTypesTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Mono.Cecil; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace Mono.Cecil.Tests { 8 | 9 | [TestFixture] 10 | public class NestedTypesTests : BaseTestFixture { 11 | 12 | [TestCSharp ("NestedTypes.cs")] 13 | public void NestedTypes (ModuleDefinition module) 14 | { 15 | var foo = module.GetType ("Foo"); 16 | 17 | Assert.AreEqual ("Foo", foo.Name); 18 | Assert.AreEqual ("Foo", foo.FullName); 19 | Assert.AreEqual (module, foo.Module); 20 | Assert.AreEqual (1, foo.NestedTypes.Count); 21 | 22 | var bar = foo.NestedTypes [0]; 23 | 24 | Assert.AreEqual ("Bar", bar.Name); 25 | Assert.AreEqual ("Foo/Bar", bar.FullName); 26 | Assert.AreEqual (module, bar.Module); 27 | Assert.AreEqual (1, bar.NestedTypes.Count); 28 | 29 | var baz = bar.NestedTypes [0]; 30 | 31 | Assert.AreEqual ("Baz", baz.Name); 32 | Assert.AreEqual ("Foo/Bar/Baz", baz.FullName); 33 | Assert.AreEqual (module, baz.Module); 34 | } 35 | 36 | [TestCSharp ("NestedTypes.cs")] 37 | public void DirectNestedType (ModuleDefinition module) 38 | { 39 | var bingo = module.GetType ("Bingo"); 40 | var get_fuel = bingo.GetMethod ("GetFuel"); 41 | 42 | Assert.AreEqual ("Bingo/Fuel", get_fuel.ReturnType.FullName); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/boxedoptarg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/boxedoptarg.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/cppcli.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/cppcli.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/cscgpbug.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/cscgpbug.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/decsec-att.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/decsec-att.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/decsec-xml.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/decsec-xml.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/decsec1-xml.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/decsec1-xml.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/delay-signed.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/delay-signed.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/empty-decsec-att.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/empty-decsec-att.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/libhello.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/libhello.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/libres.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/libres.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/marshal.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/marshal.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/moda.netmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/moda.netmodule -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/modb.netmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/modb.netmodule -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/noblob.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/noblob.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/text_file.txt: -------------------------------------------------------------------------------- 1 | Cecil ftw! 2 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/assemblies/wp7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/Resources/assemblies/wp7.dll -------------------------------------------------------------------------------- /Cecil/Test/Resources/cs/Events.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | delegate void Pan (object sender, EventArgs args); 4 | 5 | abstract class Foo { 6 | 7 | public abstract event Pan Bar; 8 | } 9 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/cs/Fields.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | class Foo { 5 | Bar bar; 6 | } 7 | 8 | class Bar { 9 | volatile int oiseau; 10 | } 11 | 12 | class Baz { 13 | bool @bool; 14 | char @char; 15 | sbyte @sbyte; 16 | byte @byte; 17 | short int16; 18 | ushort uint16; 19 | int int32; 20 | uint uint32; 21 | long int64; 22 | ulong uint64; 23 | float single; 24 | double @double; 25 | string @string; 26 | object @object; 27 | } 28 | 29 | enum Pim { 30 | Pam = 1, 31 | Poum = 2, 32 | } 33 | 34 | class PanPan { 35 | 36 | public const PanPan Peter = null; 37 | public const string QQ = "qq"; 38 | public const string nil = null; 39 | public const object obj = null; 40 | public const int [] ints = null; 41 | } 42 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/cs/Interfaces.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | interface IFoo {} 4 | interface IBar : IFoo {} 5 | 6 | abstract class Bar : IBar {} 7 | 8 | interface IBingo { 9 | void Foo (); 10 | void Bar (); 11 | } 12 | 13 | class Bingo : IBingo { 14 | 15 | void IBingo.Foo () 16 | { 17 | } 18 | 19 | void IBingo.Bar () 20 | { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/cs/Layouts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | [StructLayout (LayoutKind.Explicit, Size = 16)] 5 | public struct Foo { 6 | [FieldOffset (0)] public ushort Bar; 7 | [FieldOffset (2)] public ushort Baz; 8 | [FieldOffset (4)] public uint Gazonk; 9 | } 10 | 11 | class Babar { 12 | } 13 | 14 | class Locke { 15 | public int [] integers = new int [] { 1, 2, 3, 4 }; 16 | } 17 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/cs/Methods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | abstract class Foo { 5 | public abstract void Bar (int a); 6 | } 7 | 8 | class Bar { 9 | 10 | [DllImport ("foo.dll")] 11 | public extern static void Pan ([MarshalAs (UnmanagedType.I4)] int i); 12 | } 13 | 14 | public class Baz { 15 | 16 | public void PrintAnswer () 17 | { 18 | Console.WriteLine ("answer: {0}", 42); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/cs/NestedTypes.cs: -------------------------------------------------------------------------------- 1 | class Foo { 2 | class Bar { 3 | class Baz { 4 | } 5 | } 6 | } 7 | 8 | class Bingo { 9 | public class Fuel { 10 | } 11 | 12 | public static Fuel GetFuel () 13 | { 14 | return null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/cs/Properties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | abstract class Foo { 4 | 5 | public abstract int Bar { get; } 6 | public abstract string Baz { get; set; } 7 | public abstract string Gazonk { set; } 8 | } 9 | 10 | abstract class Bar { 11 | 12 | public abstract Foo this [int a, string s] { set; } 13 | } 14 | 15 | class Baz { 16 | 17 | public string Bingo { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/il/hello.il: -------------------------------------------------------------------------------- 1 | .assembly extern mscorlib 2 | { 3 | .publickeytoken = (B7 7A 5C 56 19 34 E0 89) 4 | .ver 2:0:0:0 5 | } 6 | 7 | .assembly Hello {} 8 | 9 | .module Hello.dll 10 | 11 | .class private auto ansi Foo { 12 | 13 | .method public specialname rtspecialname instance void .ctor () cil managed 14 | { 15 | ldarg.0 16 | call instance void [mscorlib]System.Object::.ctor () 17 | ret 18 | } 19 | 20 | .method public static void Bar (int32 a, int32 b) 21 | { 22 | .locals init (int32 res) 23 | ldarg.0 24 | ldarg.1 25 | mul 26 | stloc.0 27 | ldloc.0 28 | call void Foo::Baz (int32) 29 | ret 30 | } 31 | 32 | .method public static void Baz (int32 a) 33 | { 34 | ret 35 | } 36 | 37 | .method public void Gazonk () 38 | { 39 | ldarg 0 40 | pop 41 | ret 42 | } 43 | 44 | .method public static void PrintEmpty () 45 | { 46 | ldsfld string [mscorlib]System.String::Empty 47 | call void [mscorlib]System.Console::WriteLine(string) 48 | ret 49 | } 50 | 51 | .method public static bool TestFilter (bool b) cil managed 52 | { 53 | .maxstack 2 54 | .locals init (bool flag) 55 | beginTry: 56 | newobj instance void [mscorlib]System.Exception::.ctor () 57 | throw 58 | leave endCatch 59 | startFilter: 60 | pop 61 | ldarg.0 62 | endfilter 63 | startCatch: 64 | ldc.i4.1 65 | stloc.0 66 | leave return 67 | leave endCatch 68 | endCatch: 69 | L_001b: ldc.i4.0 70 | L_001c: stloc.0 71 | return: 72 | L_001d: ldloc.0 73 | L_001e: ret 74 | .try beginTry to startFilter filter startFilter handler startCatch to endCatch 75 | } 76 | 77 | .method public static !!T GetState(string var, [opt] !!T defaultValue) cil managed 78 | { 79 | .param [2] = nullref 80 | 81 | ldarg.1 82 | ret 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/il/methodspecs.il: -------------------------------------------------------------------------------- 1 | 2 | .assembly extern mscorlib 3 | { 4 | .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) 5 | .ver 2:0:0:0 6 | } 7 | 8 | .assembly MethodSpecs 9 | { 10 | } 11 | 12 | .module MethodSpecs.dll 13 | 14 | .class private auto ansi beforefieldinit Tamtam 15 | extends [mscorlib]System.Object 16 | { 17 | .method private hidebysig static void Foo(!!TFoo tf) cil managed 18 | { 19 | // Code size 1 (0x1) 20 | .maxstack 8 21 | IL_0000: ret 22 | } // end of method Tamtam::Foo 23 | 24 | .method private hidebysig static void Bar() cil managed 25 | { 26 | // Code size 7 (0x7) 27 | .maxstack 8 28 | IL_0000: ldc.i4.2 29 | IL_0001: call void Tamtam::Foo(!!0) 30 | IL_0006: ret 31 | } // end of method Tamtam::Bar 32 | 33 | .method public hidebysig specialname rtspecialname 34 | instance void .ctor() cil managed 35 | { 36 | // Code size 7 (0x7) 37 | .maxstack 8 38 | IL_0000: ldarg.0 39 | IL_0001: call instance void [mscorlib]System.Object::.ctor() 40 | IL_0006: ret 41 | } // end of method Tamtam::.ctor 42 | 43 | } // end of class Tamtam 44 | -------------------------------------------------------------------------------- /Cecil/Test/Resources/il/types.il: -------------------------------------------------------------------------------- 1 | .assembly extern mscorlib 2 | { 3 | .publickeytoken = (B7 7A 5C 56 19 34 E0 89) 4 | .ver 2:0:0:0 5 | } 6 | 7 | .assembly Types {} 8 | 9 | .module Types.dll 10 | 11 | .class private auto ansi Types { 12 | 13 | .field public int32[,] rank_two 14 | .field public int32[0...,0...] rank_two_low_bound_zero 15 | .field public int32[-1...4] rank_one_low_bound_m1 16 | 17 | .method public specialname rtspecialname instance void .ctor () cil managed 18 | { 19 | ldarg.0 20 | call instance void [mscorlib]System.Object::.ctor () 21 | ret 22 | } 23 | } 24 | 25 | .class interface private abstract auto ansi IFoo 26 | { 27 | } 28 | 29 | .class interface private abstract auto ansi IBar 30 | implements IFoo 31 | { 32 | } 33 | 34 | .class interface private abstract IBaz 35 | implements IBar, IFoo 36 | { 37 | } 38 | 39 | .class private Fields { 40 | 41 | .field private static literal int32 int32_int16 = int16(0x0001) 42 | .field private static literal int16 int16_int32 = int32(0x00000001) 43 | .field private static literal char char_int16 = int16(0x0001) 44 | .field private static literal int16 int16_char = char(0x0073) 45 | .field private static literal int32 int32_nullref = nullref 46 | } 47 | 48 | .class public auto ansi CustomAttribute extends [mscorlib]System.Attribute 49 | { 50 | .custom instance void CustomAttribute::.ctor() = () 51 | 52 | .method public hidebysig specialname rtspecialname instance void .ctor() 53 | { 54 | ldarg.0 55 | call instance void [mscorlib]System.Attribute::.ctor() 56 | ret 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Cecil/Test/libs/nunit-2.4.8/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/libs/nunit-2.4.8/license.txt -------------------------------------------------------------------------------- /Cecil/Test/libs/nunit-2.5.10/nunit.core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/libs/nunit-2.5.10/nunit.core.dll -------------------------------------------------------------------------------- /Cecil/Test/libs/nunit-2.5.10/nunit.core.interfaces.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/libs/nunit-2.5.10/nunit.core.interfaces.dll -------------------------------------------------------------------------------- /Cecil/Test/libs/nunit-2.5.10/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/Test/libs/nunit-2.5.10/nunit.framework.dll -------------------------------------------------------------------------------- /Cecil/dbg/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | 6 | using Mono.Cecil.Mdb; 7 | 8 | namespace Mono.Cecil.Debug { 9 | 10 | interface IFoo { } 11 | interface IBar : IFoo { } 12 | 13 | abstract class Bar : IBar { } 14 | 15 | delegate void Action (); 16 | 17 | class Program { 18 | 19 | static int Answer () 20 | { 21 | return 42; 22 | } 23 | 24 | static void Main (string [] args) 25 | { 26 | Time (() => { 27 | var module = GetCurrentModule (); 28 | 29 | module.Write ("dbg.rt.exe"); 30 | }); 31 | } 32 | 33 | static void Time (Action action) 34 | { 35 | var watch = new Stopwatch (); 36 | watch.Start (); 37 | action (); 38 | watch.Stop (); 39 | 40 | Console.WriteLine ("Elapsed: {0}", watch.Elapsed); 41 | } 42 | 43 | //static TypeDefinition GetCurrentType () 44 | //{ 45 | // return GetCurrentModule ().Types [typeof (Program).FullName]; 46 | //} 47 | 48 | static ModuleDefinition GetModule (string module) 49 | { 50 | return ModuleDefinition.ReadModule (module, new ReaderParameters { 51 | ReadingMode = ReadingMode.Deferred, 52 | }); 53 | } 54 | 55 | static ModuleDefinition GetCurrentModule () 56 | { 57 | return GetModule (typeof (object).Module.FullyQualifiedName); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Cecil/dbg/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle ("dbg")] 9 | [assembly: AssemblyDescription ("")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("")] 12 | [assembly: AssemblyProduct ("dbg")] 13 | [assembly: AssemblyCopyright ("Copyright © 2008")] 14 | [assembly: AssemblyTrademark ("")] 15 | [assembly: AssemblyCulture ("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible (false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid ("6f6c7314-315c-47b7-928e-e9ad1330ff1a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion ("1.0.0.0")] 36 | [assembly: AssemblyFileVersion ("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.user 5 | *.pidb 6 | *.userprefs 7 | *.xml 8 | *.nupkg 9 | **/test-results/* 10 | *Resharper* 11 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.Cil/VariableDefinition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VariableDefinition.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil.Cil { 30 | 31 | public sealed class VariableDefinition : VariableReference { 32 | 33 | public bool IsPinned { 34 | get { return variable_type.IsPinned; } 35 | } 36 | 37 | public VariableDefinition (TypeReference variableType) 38 | : base (variableType) 39 | { 40 | } 41 | 42 | public VariableDefinition (string name, TypeReference variableType) 43 | : base (name, variableType) 44 | { 45 | } 46 | 47 | public override VariableDefinition Resolve () 48 | { 49 | return this; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.Metadata/CodedIndex.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CodedIndex.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil.Metadata { 30 | 31 | enum CodedIndex { 32 | TypeDefOrRef, 33 | HasConstant, 34 | HasCustomAttribute, 35 | HasFieldMarshal, 36 | HasDeclSecurity, 37 | MemberRefParent, 38 | HasSemantics, 39 | MethodDefOrRef, 40 | MemberForwarded, 41 | Implementation, 42 | CustomAttributeType, 43 | ResolutionScope, 44 | TypeOrMethodDef 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.Metadata/Heap.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using Mono.Cecil.PE; 30 | 31 | namespace Mono.Cecil.Metadata { 32 | 33 | abstract class Heap { 34 | 35 | public int IndexSize; 36 | 37 | public readonly Section Section; 38 | public readonly uint Offset; 39 | public readonly uint Size; 40 | 41 | protected Heap (Section section, uint offset, uint size) 42 | { 43 | this.Section = section; 44 | this.Offset = offset; 45 | this.Size = size; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.PE/BinaryStreamReader.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BinaryStreamReader.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | using System.IO; 31 | 32 | namespace Mono.Cecil.PE { 33 | 34 | class BinaryStreamReader : BinaryReader { 35 | 36 | public BinaryStreamReader (Stream stream) 37 | : base (stream) 38 | { 39 | } 40 | 41 | protected void Advance (int bytes) 42 | { 43 | BaseStream.Seek (bytes, SeekOrigin.Current); 44 | } 45 | 46 | protected DataDirectory ReadDataDirectory () 47 | { 48 | return new DataDirectory (ReadUInt32 (), ReadUInt32 ()); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.PE/DataDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DataDirectory.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using RVA = System.UInt32; 32 | 33 | namespace Mono.Cecil.PE { 34 | 35 | struct DataDirectory { 36 | 37 | public readonly RVA VirtualAddress; 38 | public readonly uint Size; 39 | 40 | public bool IsZero { 41 | get { return VirtualAddress == 0 && Size == 0; } 42 | } 43 | 44 | public DataDirectory (RVA rva, uint size) 45 | { 46 | this.VirtualAddress = rva; 47 | this.Size = size; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.PE/Section.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Section.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using RVA = System.UInt32; 32 | 33 | namespace Mono.Cecil.PE { 34 | 35 | sealed class Section { 36 | public string Name; 37 | public RVA VirtualAddress; 38 | public uint VirtualSize; 39 | public uint SizeOfRawData; 40 | public uint PointerToRawData; 41 | public byte [] Data; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.nunit: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mono.Cecil 5 | 0.9.5.3 6 | Mono.Cecil 7 | Jb Evain 8 | Jb Evain 9 | http://opensource.org/licenses/mit-license.php 10 | false 11 | http://github.com/jbevain/cecil/ 12 | Cecil is a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. 13 | Cecil is a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. It has full support for generics, and support some debugging symbol format. In simple English, with Cecil, you can load existing managed assemblies, browse all the contained types, modify them on the fly and save back to the disk the modified assembly. 14 | en-US 15 | assembly assemblies module modules il cil msil bytecode reflection injection cecil mono aop 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/AssemblyFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyFlags.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum AssemblyAttributes : uint { 35 | PublicKey = 0x0001, 36 | SideBySideCompatible = 0x0000, 37 | Retargetable = 0x0100, 38 | WindowsRuntime = 0x0200, 39 | DisableJITCompileOptimizer = 0x4000, 40 | EnableJITCompileTracking = 0x8000, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/AssemblyHashAlgorithm.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyHashAlgorithm.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum AssemblyHashAlgorithm : uint { 32 | None = 0x0000, 33 | Reserved = 0x8003, // MD5 34 | SHA1 = 0x8004 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/AssemblyNameDefinition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyNameDefinition.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | public sealed class AssemblyNameDefinition : AssemblyNameReference { 34 | 35 | public override byte [] Hash { 36 | get { return Empty.Array; } 37 | } 38 | 39 | internal AssemblyNameDefinition () 40 | { 41 | this.token = new MetadataToken (TokenType.Assembly, 1); 42 | } 43 | 44 | public AssemblyNameDefinition (string name, Version version) 45 | : base (name, version) 46 | { 47 | this.token = new MetadataToken (TokenType.Assembly, 1); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/EventAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // EventAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum EventAttributes : ushort { 35 | None = 0x0000, 36 | SpecialName = 0x0200, // Event is special 37 | RTSpecialName = 0x0400 // CLI provides 'special' behavior, depending upon the name of the event 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/FileAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // FileAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | enum FileAttributes : uint { 32 | ContainsMetaData = 0x0000, // This is not a resource file 33 | ContainsNoMetaData = 0x0001, // This is a resource file or other non-metadata-containing file 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/GenericParameterAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GenericParameterAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum GenericParameterAttributes : ushort { 35 | VarianceMask = 0x0003, 36 | NonVariant = 0x0000, 37 | Covariant = 0x0001, 38 | Contravariant = 0x0002, 39 | 40 | SpecialConstraintMask = 0x001c, 41 | ReferenceTypeConstraint = 0x0004, 42 | NotNullableValueTypeConstraint = 0x0008, 43 | DefaultConstructorConstraint = 0x0010 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/IMetadataScope.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IMetadataScope.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum MetadataScopeType { 32 | AssemblyNameReference, 33 | ModuleReference, 34 | ModuleDefinition, 35 | } 36 | 37 | public interface IMetadataScope : IMetadataTokenProvider { 38 | MetadataScopeType MetadataScopeType { get; } 39 | string Name { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/IMetadataTokenProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IMetadataTokenProvider.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public interface IMetadataTokenProvider { 32 | 33 | MetadataToken MetadataToken { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/ManifestResourceAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ManifestResourceAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum ManifestResourceAttributes : uint { 35 | VisibilityMask = 0x0007, 36 | Public = 0x0001, // The resource is exported from the Assembly 37 | Private = 0x0002 // The resource is private to the Assembly 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/MethodCallingConvention.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MethodCallingConvention.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum MethodCallingConvention : byte { 32 | Default = 0x0, 33 | C = 0x1, 34 | StdCall = 0x2, 35 | ThisCall = 0x3, 36 | FastCall = 0x4, 37 | VarArg = 0x5, 38 | Generic = 0x10, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/MethodSemanticsAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MethodSemanticsattributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum MethodSemanticsAttributes : ushort { 35 | None = 0x0000, 36 | Setter = 0x0001, // Setter for property 37 | Getter = 0x0002, // Getter for property 38 | Other = 0x0004, // Other method for property or event 39 | AddOn = 0x0008, // AddOn method for event 40 | RemoveOn = 0x0010, // RemoveOn method for event 41 | Fire = 0x0020 // Fire method for event 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/ParameterAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ParameterAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum ParameterAttributes : ushort { 35 | None = 0x0000, 36 | In = 0x0001, // Param is [In] 37 | Out = 0x0002, // Param is [Out] 38 | Lcid = 0x0004, 39 | Retval = 0x0008, 40 | Optional = 0x0010, // Param is optional 41 | HasDefault = 0x1000, // Param has default value 42 | HasFieldMarshal = 0x2000, // Param has field marshal 43 | Unused = 0xcfe0 // Reserved: shall be zero in a conforming implementation 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/PinnedType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PinnedType.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using MD = Mono.Cecil.Metadata; 32 | 33 | namespace Mono.Cecil { 34 | 35 | public sealed class PinnedType : TypeSpecification { 36 | 37 | public override bool IsValueType { 38 | get { return false; } 39 | set { throw new InvalidOperationException (); } 40 | } 41 | 42 | public override bool IsPinned { 43 | get { return true; } 44 | } 45 | 46 | public PinnedType (TypeReference type) 47 | : base (type) 48 | { 49 | Mixin.CheckType (type); 50 | this.etype = MD.ElementType.Pinned; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/PropertyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PropertyAttributes.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Mono.Cecil { 32 | 33 | [Flags] 34 | public enum PropertyAttributes : ushort { 35 | None = 0x0000, 36 | SpecialName = 0x0200, // Property is special 37 | RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding 38 | HasDefault = 0x1000, // Property has default 39 | Unused = 0xe9ff // Reserved: shall be zero in a conforming implementation 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/SentinelType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SentinelType.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | using MD = Mono.Cecil.Metadata; 32 | 33 | namespace Mono.Cecil { 34 | 35 | public sealed class SentinelType : TypeSpecification { 36 | 37 | public override bool IsValueType { 38 | get { return false; } 39 | set { throw new InvalidOperationException (); } 40 | } 41 | 42 | public override bool IsSentinel { 43 | get { return true; } 44 | } 45 | 46 | public SentinelType (TypeReference type) 47 | : base (type) 48 | { 49 | Mixin.CheckType (type); 50 | this.etype = MD.ElementType.Sentinel; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/TargetRuntime.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TargetRuntime.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum TargetRuntime { 32 | Net_1_0, 33 | Net_1_1, 34 | Net_2_0, 35 | Net_4_0, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono.Cecil/VariantType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VariantType.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Mono.Cecil { 30 | 31 | public enum VariantType { 32 | None = 0, 33 | I2 = 2, 34 | I4 = 3, 35 | R4 = 4, 36 | R8 = 5, 37 | CY = 6, 38 | Date = 7, 39 | BStr = 8, 40 | Dispatch = 9, 41 | Error = 10, 42 | Bool = 11, 43 | Variant = 12, 44 | Unknown = 13, 45 | Decimal = 14, 46 | I1 = 16, 47 | UI1 = 17, 48 | UI2 = 18, 49 | UI4 = 19, 50 | Int = 22, 51 | UInt = 23 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono/Actions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Actions.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if !NET_3_5 && !NET_4_0 30 | 31 | namespace Mono { 32 | //delegate void Action (); 33 | delegate void Action (T1 arg1, T2 arg2); 34 | //delegate void Action (T1 arg1, T2 arg2, T3 arg3); 35 | //delegate void Action (T1 arg1, T2 arg2, T3 arg3, T4 arg4); 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono/Empty.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Empty.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using Mono.Collections.Generic; 30 | 31 | namespace Mono { 32 | 33 | static class Empty { 34 | 35 | public static readonly T [] Array = new T [0]; 36 | } 37 | } 38 | 39 | namespace Mono.Cecil { 40 | 41 | static partial class Mixin { 42 | 43 | public static bool IsNullOrEmpty (this T [] self) 44 | { 45 | return self == null || self.Length == 0; 46 | } 47 | 48 | public static bool IsNullOrEmpty (this Collection self) 49 | { 50 | return self == null || self.size == 0; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Mono/Funcs.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Funcs.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if !NET_3_5 && !NET_4_0 30 | 31 | namespace Mono { 32 | delegate TResult Func (); 33 | delegate TResult Func (T arg1); 34 | delegate TResult Func (T1 arg1, T2 arg2); 35 | //delegate TResult Func (T1 arg1, T2 arg2, T3 arg3); 36 | //delegate TResult Func (T1 arg1, T2 arg2, T3 arg3, T4 arg4); 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/System.Runtime.CompilerServices/ExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ExtensionAttribute.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | #if !NET_3_5 && !NET_4_0 32 | 33 | namespace System.Runtime.CompilerServices { 34 | 35 | [AttributeUsage (AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] 36 | sealed class ExtensionAttribute : Attribute { 37 | } 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.user 5 | *.xml 6 | *.pidb 7 | *.userprefs 8 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Mono.Cecil.Tests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle ("Mono.Cecil.Tests")] 6 | [assembly: AssemblyProduct ("Mono.Cecil")] 7 | [assembly: AssemblyCopyright ("Copyright © 2008 - 2011 Jb Evain")] 8 | 9 | [assembly: ComVisible (false)] 10 | 11 | [assembly: Guid ("da96c202-696a-457e-89af-5fa74e6bda0d")] 12 | 13 | [assembly: AssemblyVersion ("1.0.0.0")] 14 | [assembly: AssemblyFileVersion ("1.0.0.0")] 15 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Mono.Cecil.Tests/AssemblyTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Mono.Cecil; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace Mono.Cecil.Tests { 8 | 9 | [TestFixture] 10 | public class AssemblyTests : BaseTestFixture { 11 | 12 | [TestModule ("hello.exe")] 13 | public void Name (ModuleDefinition module) 14 | { 15 | var name = module.Assembly.Name; 16 | 17 | Assert.IsNotNull (name); 18 | 19 | Assert.AreEqual ("hello", name.Name); 20 | Assert.AreEqual (string.Empty, name.Culture); 21 | Assert.AreEqual (new Version (0, 0, 0, 0), name.Version); 22 | Assert.AreEqual (AssemblyHashAlgorithm.SHA1, name.HashAlgorithm); 23 | } 24 | 25 | [Test] 26 | public void ParseLowerCaseNameParts() 27 | { 28 | var name = AssemblyNameReference.Parse ("Foo, version=2.0.0.0, culture=fr-FR"); 29 | Assert.AreEqual ("Foo", name.Name); 30 | Assert.AreEqual (2, name.Version.Major); 31 | Assert.AreEqual (0, name.Version.Minor); 32 | Assert.AreEqual ("fr-FR", name.Culture); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Mono.Cecil.Tests/Linq.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Mono; 5 | 6 | #if !NET_3_5 && !NET_4_0 7 | 8 | namespace System.Linq { 9 | 10 | static class Enumerable { 11 | 12 | public static IEnumerable Select (this IEnumerable self, Func selector) 13 | { 14 | foreach (var item in self) 15 | yield return selector (item); 16 | } 17 | 18 | public static IEnumerable Where (this IEnumerable self, Func predicate) 19 | { 20 | foreach (var item in self) 21 | if (predicate (item)) 22 | yield return item; 23 | } 24 | 25 | public static List ToList (this IEnumerable self) 26 | { 27 | return new List (self); 28 | } 29 | 30 | public static T [] ToArray (this IEnumerable self) 31 | { 32 | return self.ToList ().ToArray (); 33 | } 34 | 35 | public static T First (this IEnumerable self) 36 | { 37 | using (var enumerator = self.GetEnumerator ()) { 38 | if (!enumerator.MoveNext ()) 39 | throw new InvalidOperationException (); 40 | 41 | return enumerator.Current; 42 | } 43 | } 44 | } 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Mono.Cecil.Tests/NestedTypesTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Mono.Cecil; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace Mono.Cecil.Tests { 8 | 9 | [TestFixture] 10 | public class NestedTypesTests : BaseTestFixture { 11 | 12 | [TestCSharp ("NestedTypes.cs")] 13 | public void NestedTypes (ModuleDefinition module) 14 | { 15 | var foo = module.GetType ("Foo"); 16 | 17 | Assert.AreEqual ("Foo", foo.Name); 18 | Assert.AreEqual ("Foo", foo.FullName); 19 | Assert.AreEqual (module, foo.Module); 20 | Assert.AreEqual (1, foo.NestedTypes.Count); 21 | 22 | var bar = foo.NestedTypes [0]; 23 | 24 | Assert.AreEqual ("Bar", bar.Name); 25 | Assert.AreEqual ("Foo/Bar", bar.FullName); 26 | Assert.AreEqual (module, bar.Module); 27 | Assert.AreEqual (1, bar.NestedTypes.Count); 28 | 29 | var baz = bar.NestedTypes [0]; 30 | 31 | Assert.AreEqual ("Baz", baz.Name); 32 | Assert.AreEqual ("Foo/Bar/Baz", baz.FullName); 33 | Assert.AreEqual (module, baz.Module); 34 | } 35 | 36 | [TestCSharp ("NestedTypes.cs")] 37 | public void DirectNestedType (ModuleDefinition module) 38 | { 39 | var bingo = module.GetType ("Bingo"); 40 | var get_fuel = bingo.GetMethod ("GetFuel"); 41 | 42 | Assert.AreEqual ("Bingo/Fuel", get_fuel.ReturnType.FullName); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/boxedoptarg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/boxedoptarg.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/cppcli.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/cppcli.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/cscgpbug.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/cscgpbug.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/decsec-att.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/decsec-att.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/decsec-xml.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/decsec-xml.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/decsec1-xml.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/decsec1-xml.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/delay-signed.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/delay-signed.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/empty-decsec-att.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/empty-decsec-att.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/libhello.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/libhello.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/libres.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/libres.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/marshal.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/marshal.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/moda.netmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/moda.netmodule -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/modb.netmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/modb.netmodule -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/noblob.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/noblob.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/text_file.txt: -------------------------------------------------------------------------------- 1 | Cecil ftw! 2 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/wp7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/Resources/assemblies/wp7.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/cs/Events.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | delegate void Pan (object sender, EventArgs args); 4 | 5 | abstract class Foo { 6 | 7 | public abstract event Pan Bar; 8 | } 9 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/cs/Fields.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | class Foo { 5 | Bar bar; 6 | } 7 | 8 | class Bar { 9 | volatile int oiseau; 10 | } 11 | 12 | class Baz { 13 | bool @bool; 14 | char @char; 15 | sbyte @sbyte; 16 | byte @byte; 17 | short int16; 18 | ushort uint16; 19 | int int32; 20 | uint uint32; 21 | long int64; 22 | ulong uint64; 23 | float single; 24 | double @double; 25 | string @string; 26 | object @object; 27 | } 28 | 29 | enum Pim { 30 | Pam = 1, 31 | Poum = 2, 32 | } 33 | 34 | class PanPan { 35 | 36 | public const PanPan Peter = null; 37 | public const string QQ = "qq"; 38 | public const string nil = null; 39 | public const object obj = null; 40 | public const int [] ints = null; 41 | } 42 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/cs/Interfaces.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | interface IFoo {} 4 | interface IBar : IFoo {} 5 | 6 | abstract class Bar : IBar {} 7 | 8 | interface IBingo { 9 | void Foo (); 10 | void Bar (); 11 | } 12 | 13 | class Bingo : IBingo { 14 | 15 | void IBingo.Foo () 16 | { 17 | } 18 | 19 | void IBingo.Bar () 20 | { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/cs/Layouts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | [StructLayout (LayoutKind.Explicit, Size = 16)] 5 | public struct Foo { 6 | [FieldOffset (0)] public ushort Bar; 7 | [FieldOffset (2)] public ushort Baz; 8 | [FieldOffset (4)] public uint Gazonk; 9 | } 10 | 11 | class Babar { 12 | } 13 | 14 | class Locke { 15 | public int [] integers = new int [] { 1, 2, 3, 4 }; 16 | } 17 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/cs/Methods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | abstract class Foo { 5 | public abstract void Bar (int a); 6 | } 7 | 8 | class Bar { 9 | 10 | [DllImport ("foo.dll")] 11 | public extern static void Pan ([MarshalAs (UnmanagedType.I4)] int i); 12 | } 13 | 14 | public class Baz { 15 | 16 | public void PrintAnswer () 17 | { 18 | Console.WriteLine ("answer: {0}", 42); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/cs/NestedTypes.cs: -------------------------------------------------------------------------------- 1 | class Foo { 2 | class Bar { 3 | class Baz { 4 | } 5 | } 6 | } 7 | 8 | class Bingo { 9 | public class Fuel { 10 | } 11 | 12 | public static Fuel GetFuel () 13 | { 14 | return null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/cs/Properties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | abstract class Foo { 4 | 5 | public abstract int Bar { get; } 6 | public abstract string Baz { get; set; } 7 | public abstract string Gazonk { set; } 8 | } 9 | 10 | abstract class Bar { 11 | 12 | public abstract Foo this [int a, string s] { set; } 13 | } 14 | 15 | class Baz { 16 | 17 | public string Bingo { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/il/hello.il: -------------------------------------------------------------------------------- 1 | .assembly extern mscorlib 2 | { 3 | .publickeytoken = (B7 7A 5C 56 19 34 E0 89) 4 | .ver 2:0:0:0 5 | } 6 | 7 | .assembly Hello {} 8 | 9 | .module Hello.dll 10 | 11 | .class private auto ansi Foo { 12 | 13 | .method public specialname rtspecialname instance void .ctor () cil managed 14 | { 15 | ldarg.0 16 | call instance void [mscorlib]System.Object::.ctor () 17 | ret 18 | } 19 | 20 | .method public static void Bar (int32 a, int32 b) 21 | { 22 | .locals init (int32 res) 23 | ldarg.0 24 | ldarg.1 25 | mul 26 | stloc.0 27 | ldloc.0 28 | call void Foo::Baz (int32) 29 | ret 30 | } 31 | 32 | .method public static void Baz (int32 a) 33 | { 34 | ret 35 | } 36 | 37 | .method public void Gazonk () 38 | { 39 | ldarg 0 40 | pop 41 | ret 42 | } 43 | 44 | .method public static void PrintEmpty () 45 | { 46 | ldsfld string [mscorlib]System.String::Empty 47 | call void [mscorlib]System.Console::WriteLine(string) 48 | ret 49 | } 50 | 51 | .method public static bool TestFilter (bool b) cil managed 52 | { 53 | .maxstack 2 54 | .locals init (bool flag) 55 | beginTry: 56 | newobj instance void [mscorlib]System.Exception::.ctor () 57 | throw 58 | leave endCatch 59 | startFilter: 60 | pop 61 | ldarg.0 62 | endfilter 63 | startCatch: 64 | ldc.i4.1 65 | stloc.0 66 | leave return 67 | leave endCatch 68 | endCatch: 69 | L_001b: ldc.i4.0 70 | L_001c: stloc.0 71 | return: 72 | L_001d: ldloc.0 73 | L_001e: ret 74 | .try beginTry to startFilter filter startFilter handler startCatch to endCatch 75 | } 76 | 77 | .method public static !!T GetState(string var, [opt] !!T defaultValue) cil managed 78 | { 79 | .param [2] = nullref 80 | 81 | ldarg.1 82 | ret 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/il/methodspecs.il: -------------------------------------------------------------------------------- 1 | 2 | .assembly extern mscorlib 3 | { 4 | .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) 5 | .ver 2:0:0:0 6 | } 7 | 8 | .assembly MethodSpecs 9 | { 10 | } 11 | 12 | .module MethodSpecs.dll 13 | 14 | .class private auto ansi beforefieldinit Tamtam 15 | extends [mscorlib]System.Object 16 | { 17 | .method private hidebysig static void Foo(!!TFoo tf) cil managed 18 | { 19 | // Code size 1 (0x1) 20 | .maxstack 8 21 | IL_0000: ret 22 | } // end of method Tamtam::Foo 23 | 24 | .method private hidebysig static void Bar() cil managed 25 | { 26 | // Code size 7 (0x7) 27 | .maxstack 8 28 | IL_0000: ldc.i4.2 29 | IL_0001: call void Tamtam::Foo(!!0) 30 | IL_0006: ret 31 | } // end of method Tamtam::Bar 32 | 33 | .method public hidebysig specialname rtspecialname 34 | instance void .ctor() cil managed 35 | { 36 | // Code size 7 (0x7) 37 | .maxstack 8 38 | IL_0000: ldarg.0 39 | IL_0001: call instance void [mscorlib]System.Object::.ctor() 40 | IL_0006: ret 41 | } // end of method Tamtam::.ctor 42 | 43 | } // end of class Tamtam 44 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/Resources/il/types.il: -------------------------------------------------------------------------------- 1 | .assembly extern mscorlib 2 | { 3 | .publickeytoken = (B7 7A 5C 56 19 34 E0 89) 4 | .ver 2:0:0:0 5 | } 6 | 7 | .assembly Types {} 8 | 9 | .module Types.dll 10 | 11 | .class private auto ansi Types { 12 | 13 | .field public int32[,] rank_two 14 | .field public int32[0...,0...] rank_two_low_bound_zero 15 | .field public int32[-1...4] rank_one_low_bound_m1 16 | 17 | .method public specialname rtspecialname instance void .ctor () cil managed 18 | { 19 | ldarg.0 20 | call instance void [mscorlib]System.Object::.ctor () 21 | ret 22 | } 23 | } 24 | 25 | .class interface private abstract auto ansi IFoo 26 | { 27 | } 28 | 29 | .class interface private abstract auto ansi IBar 30 | implements IFoo 31 | { 32 | } 33 | 34 | .class interface private abstract IBaz 35 | implements IBar, IFoo 36 | { 37 | } 38 | 39 | .class private Fields { 40 | 41 | .field private static literal int32 int32_int16 = int16(0x0001) 42 | .field private static literal int16 int16_int32 = int32(0x00000001) 43 | .field private static literal char char_int16 = int16(0x0001) 44 | .field private static literal int16 int16_char = char(0x0073) 45 | .field private static literal int32 int32_nullref = nullref 46 | } 47 | 48 | .class public auto ansi CustomAttribute extends [mscorlib]System.Attribute 49 | { 50 | .custom instance void CustomAttribute::.ctor() = () 51 | 52 | .method public hidebysig specialname rtspecialname instance void .ctor() 53 | { 54 | ldarg.0 55 | call instance void [mscorlib]System.Attribute::.ctor() 56 | ret 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.4.8/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.4.8/license.txt -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.5.10/nunit.core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.5.10/nunit.core.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.5.10/nunit.core.interfaces.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.5.10/nunit.core.interfaces.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.5.10/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/Test/libs/nunit-2.5.10/nunit.framework.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/dbg/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | 6 | using Mono.Cecil.Mdb; 7 | 8 | namespace Mono.Cecil.Debug { 9 | 10 | interface IFoo { } 11 | interface IBar : IFoo { } 12 | 13 | abstract class Bar : IBar { } 14 | 15 | delegate void Action (); 16 | 17 | class Program { 18 | 19 | static int Answer () 20 | { 21 | return 42; 22 | } 23 | 24 | static void Main (string [] args) 25 | { 26 | Time (() => { 27 | var module = GetCurrentModule (); 28 | 29 | module.Write ("dbg.rt.exe"); 30 | }); 31 | } 32 | 33 | static void Time (Action action) 34 | { 35 | var watch = new Stopwatch (); 36 | watch.Start (); 37 | action (); 38 | watch.Stop (); 39 | 40 | Console.WriteLine ("Elapsed: {0}", watch.Elapsed); 41 | } 42 | 43 | //static TypeDefinition GetCurrentType () 44 | //{ 45 | // return GetCurrentModule ().Types [typeof (Program).FullName]; 46 | //} 47 | 48 | static ModuleDefinition GetModule (string module) 49 | { 50 | return ModuleDefinition.ReadModule (module, new ReaderParameters { 51 | ReadingMode = ReadingMode.Deferred, 52 | }); 53 | } 54 | 55 | static ModuleDefinition GetCurrentModule () 56 | { 57 | return GetModule (typeof (object).Module.FullyQualifiedName); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/dbg/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle ("dbg")] 9 | [assembly: AssemblyDescription ("")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("")] 12 | [assembly: AssemblyProduct ("dbg")] 13 | [assembly: AssemblyCopyright ("Copyright © 2008")] 14 | [assembly: AssemblyTrademark ("")] 15 | [assembly: AssemblyCulture ("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible (false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid ("6f6c7314-315c-47b7-928e-e9ad1330ff1a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion ("1.0.0.0")] 36 | [assembly: AssemblyFileVersion ("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/mono.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/mono.snk -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.user 5 | *.pidb 6 | *.userprefs 7 | *.xml 8 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // Copyright (c) 2008 - 2011 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | using System.Reflection; 31 | using System.Runtime.InteropServices; 32 | 33 | [assembly: AssemblyTitle ("Mono.Cecil.Rocks")] 34 | [assembly: AssemblyProduct ("Mono.Cecil")] 35 | [assembly: AssemblyCopyright ("Copyright © 2008 - 2011 Jb Evain")] 36 | 37 | [assembly: CLSCompliant (false)] 38 | [assembly: ComVisible (false)] 39 | 40 | [assembly: AssemblyVersion ("0.9.5.0")] 41 | [assembly: AssemblyFileVersion ("0.9.5.0")] 42 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Mono.Cecil.Rocks/ParameterReferenceRocks.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Mono.Cecil.Rocks { 3 | 4 | public static class ParameterReferenceRocks { 5 | 6 | public static int GetSequence (this ParameterReference self) 7 | { 8 | return self.Index + 1; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Test/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.user 5 | *.pidb 6 | *.userprefs 7 | *.xml 8 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Test/Mono.Cecil.Tests/Addin.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Core.Extensibility; 2 | 3 | namespace Mono.Cecil.Tests { 4 | 5 | [NUnitAddin] 6 | public class CecilRocksAddin : CecilTestAddin { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Test/Mono.Cecil.Tests/MethodDefinitionRocksTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | using NUnit.Framework; 4 | 5 | using Mono.Cecil.Rocks; 6 | 7 | namespace Mono.Cecil.Tests { 8 | 9 | [TestFixture] 10 | public class MethodDefinitionRocksTests : BaseTestFixture { 11 | 12 | abstract class Foo { 13 | public abstract void DoFoo (); 14 | } 15 | 16 | class Bar : Foo { 17 | public override void DoFoo () 18 | { 19 | } 20 | } 21 | 22 | class Baz : Bar { 23 | public override void DoFoo () 24 | { 25 | } 26 | } 27 | 28 | [Test] 29 | public void GetBaseMethod () 30 | { 31 | var baz = typeof (Baz).ToDefinition (); 32 | var baz_dofoo = baz.GetMethod ("DoFoo"); 33 | 34 | var @base = baz_dofoo.GetBaseMethod (); 35 | Assert.AreEqual ("Bar", @base.DeclaringType.Name); 36 | 37 | @base = @base.GetBaseMethod (); 38 | Assert.AreEqual ("Foo", @base.DeclaringType.Name); 39 | 40 | Assert.AreEqual (@base, @base.GetBaseMethod ()); 41 | } 42 | 43 | [Test] 44 | public void GetOriginalBaseMethod () 45 | { 46 | var baz = typeof (Baz).ToDefinition (); 47 | var baz_dofoo = baz.GetMethod ("DoFoo"); 48 | 49 | var @base = baz_dofoo.GetOriginalBaseMethod (); 50 | Assert.AreEqual ("Foo", @base.DeclaringType.Name); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Test/Mono.Cecil.Tests/ModuleDefinitionRocksTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | using NUnit.Framework; 4 | 5 | using Mono.Cecil.Rocks; 6 | 7 | namespace Mono.Cecil.Tests { 8 | 9 | [TestFixture] 10 | public class ModuleDefinitionRocksTests : BaseTestFixture { 11 | 12 | [TestCSharp ("Types.cs")] 13 | public void GetAllTypesTest (ModuleDefinition module) 14 | { 15 | var sequence = new [] { 16 | module.GetType (""), 17 | module.GetType ("Foo"), 18 | module.GetType ("Foo/Bar"), 19 | module.GetType ("Foo/Gazonk"), 20 | module.GetType ("Foo/Gazonk/Baz"), 21 | module.GetType ("Pan"), 22 | }; 23 | 24 | Assert.IsTrue (sequence.SequenceEqual (module.GetAllTypes ())); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Test/Resources/assemblies/decsec-att.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/rocks/Test/Resources/assemblies/decsec-att.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Test/Resources/assemblies/decsec-xml.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/rocks/Test/Resources/assemblies/decsec-xml.dll -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/rocks/Test/Resources/cs/Types.cs: -------------------------------------------------------------------------------- 1 | public class Foo { 2 | 3 | public class Bar { 4 | } 5 | 6 | public class Gazonk { 7 | 8 | public class Baz { 9 | } 10 | } 11 | } 12 | 13 | public class Pan { 14 | } 15 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/mdb/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/mdb/Test/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/mdb/Test/Mono.Cecil.Tests/Addin.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Core.Extensibility; 2 | 3 | namespace Mono.Cecil.Tests { 4 | 5 | [NUnitAddin] 6 | public class CecilMdbAddin : CecilTestAddin { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/mdb/Test/Mono.Cecil.Tests/MdbTests.cs: -------------------------------------------------------------------------------- 1 | 2 | using Mono.Cecil.Mdb; 3 | 4 | using NUnit.Framework; 5 | 6 | namespace Mono.Cecil.Tests { 7 | 8 | [TestFixture] 9 | public class MdbTests : BaseTestFixture { 10 | 11 | [TestModule ("hello.exe", SymbolReaderProvider = typeof (MdbReaderProvider), SymbolWriterProvider = typeof (MdbWriterProvider))] 12 | public void Main (ModuleDefinition module) 13 | { 14 | var type = module.GetType ("Program"); 15 | var main = type.GetMethod ("Main"); 16 | 17 | AssertCode (@" 18 | .locals init (System.Int32 i) 19 | .line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 20 | IL_0000: ldc.i4.0 21 | IL_0001: stloc.0 22 | .line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 23 | IL_0002: br IL_0013 24 | .line 8,8:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 25 | IL_0007: ldarg.0 26 | IL_0008: ldloc.0 27 | IL_0009: ldelem.ref 28 | IL_000a: call System.Void Program::Print(System.String) 29 | .line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 30 | IL_000f: ldloc.0 31 | IL_0010: ldc.i4.1 32 | IL_0011: add 33 | IL_0012: stloc.0 34 | IL_0013: ldloc.0 35 | IL_0014: ldarg.0 36 | IL_0015: ldlen 37 | IL_0016: conv.i4 38 | IL_0017: blt IL_0007 39 | .line 10,10:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 40 | IL_001c: ldc.i4.0 41 | IL_001d: ret 42 | ", main); 43 | } 44 | 45 | static void AssertCode (string expected, MethodDefinition method) 46 | { 47 | Assert.IsTrue (method.HasBody); 48 | Assert.IsNotNull (method.Body); 49 | 50 | Assert.AreEqual (Normalize (expected), Normalize (Formatter.FormatMethodBody (method))); 51 | } 52 | 53 | static string Normalize (string str) 54 | { 55 | return str.Trim ().Replace ("\r\n", "\n"); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/mdb/Test/Resources/assemblies/hello.exe.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/jbevain-cecil-aea2ceb/symbols/mdb/Test/Resources/assemblies/hello.exe.mdb -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/pdb/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/pdb/Test/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/pdb/Test/Mono.Cecil.Tests/Addin.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Core.Extensibility; 2 | 3 | namespace Mono.Cecil.Tests { 4 | 5 | [NUnitAddin] 6 | public class CecilPdbAddin : CecilTestAddin { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Cecil/jbevain-cecil-aea2ceb/symbols/pdb/Test/Mono.Cecil.Tests/Linq.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | #if !NET_3_5 && !NET_4_0 5 | 6 | namespace System { 7 | 8 | delegate TResult Func (T t); 9 | } 10 | 11 | namespace System.Runtime.CompilerServices { 12 | 13 | [AttributeUsage (AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] 14 | sealed class ExtensionAttribute : Attribute { 15 | } 16 | } 17 | 18 | namespace System.Linq { 19 | 20 | static class Enumerable { 21 | 22 | public static IEnumerable Select (this IEnumerable self, Func selector) 23 | { 24 | foreach (var item in self) 25 | yield return selector (item); 26 | } 27 | 28 | public static IEnumerable Where (this IEnumerable self, Func predicate) 29 | { 30 | foreach (var item in self) 31 | if (predicate (item)) 32 | yield return item; 33 | } 34 | 35 | public static T First (this IEnumerable self) 36 | { 37 | using (var enumerator = self.GetEnumerator ()) { 38 | if (!enumerator.MoveNext ()) 39 | throw new InvalidOperationException (); 40 | 41 | return enumerator.Current; 42 | } 43 | } 44 | } 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Cecil/mono.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/mono.snk -------------------------------------------------------------------------------- /Cecil/symbols/mdb/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs -------------------------------------------------------------------------------- /Cecil/symbols/mdb/Test/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/symbols/mdb/Test/Mono.Cecil.Tests/Addin.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Core.Extensibility; 2 | 3 | namespace Mono.Cecil.Tests { 4 | 5 | [NUnitAddin] 6 | public class CecilMdbAddin : CecilTestAddin { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Cecil/symbols/mdb/Test/Mono.Cecil.Tests/MdbTests.cs: -------------------------------------------------------------------------------- 1 | 2 | using Mono.Cecil.Mdb; 3 | 4 | using NUnit.Framework; 5 | 6 | namespace Mono.Cecil.Tests { 7 | 8 | [TestFixture] 9 | public class MdbTests : BaseTestFixture { 10 | 11 | [TestModule ("hello.exe", SymbolReaderProvider = typeof (MdbReaderProvider), SymbolWriterProvider = typeof (MdbWriterProvider))] 12 | public void Main (ModuleDefinition module) 13 | { 14 | var type = module.GetType ("Program"); 15 | var main = type.GetMethod ("Main"); 16 | 17 | AssertCode (@" 18 | .locals init (System.Int32 i) 19 | .line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 20 | IL_0000: ldc.i4.0 21 | IL_0001: stloc.0 22 | .line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 23 | IL_0002: br IL_0013 24 | .line 8,8:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 25 | IL_0007: ldarg.0 26 | IL_0008: ldloc.0 27 | IL_0009: ldelem.ref 28 | IL_000a: call System.Void Program::Print(System.String) 29 | .line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 30 | IL_000f: ldloc.0 31 | IL_0010: ldc.i4.1 32 | IL_0011: add 33 | IL_0012: stloc.0 34 | IL_0013: ldloc.0 35 | IL_0014: ldarg.0 36 | IL_0015: ldlen 37 | IL_0016: conv.i4 38 | IL_0017: blt IL_0007 39 | .line 10,10:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs' 40 | IL_001c: ldc.i4.0 41 | IL_001d: ret 42 | ", main); 43 | } 44 | 45 | static void AssertCode (string expected, MethodDefinition method) 46 | { 47 | Assert.IsTrue (method.HasBody); 48 | Assert.IsNotNull (method.Body); 49 | 50 | Assert.AreEqual (Normalize (expected), Normalize (Formatter.FormatMethodBody (method))); 51 | } 52 | 53 | static string Normalize (string str) 54 | { 55 | return str.Trim ().Replace ("\r\n", "\n"); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Cecil/symbols/mdb/Test/Resources/assemblies/hello.exe.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/Cecil/symbols/mdb/Test/Resources/assemblies/hello.exe.mdb -------------------------------------------------------------------------------- /Cecil/symbols/pdb/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/symbols/pdb/Test/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.xml 4 | *.user 5 | -------------------------------------------------------------------------------- /Cecil/symbols/pdb/Test/Mono.Cecil.Tests/Addin.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Core.Extensibility; 2 | 3 | namespace Mono.Cecil.Tests { 4 | 5 | [NUnitAddin] 6 | public class CecilPdbAddin : CecilTestAddin { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Cecil/symbols/pdb/Test/Mono.Cecil.Tests/Linq.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | #if !NET_3_5 && !NET_4_0 5 | 6 | namespace System { 7 | 8 | delegate TResult Func (T t); 9 | } 10 | 11 | namespace System.Runtime.CompilerServices { 12 | 13 | [AttributeUsage (AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] 14 | sealed class ExtensionAttribute : Attribute { 15 | } 16 | } 17 | 18 | namespace System.Linq { 19 | 20 | static class Enumerable { 21 | 22 | public static IEnumerable Select (this IEnumerable self, Func selector) 23 | { 24 | foreach (var item in self) 25 | yield return selector (item); 26 | } 27 | 28 | public static IEnumerable Where (this IEnumerable self, Func predicate) 29 | { 30 | foreach (var item in self) 31 | if (predicate (item)) 32 | yield return item; 33 | } 34 | 35 | public static T First (this IEnumerable self) 36 | { 37 | using (var enumerator = self.GetEnumerator ()) { 38 | if (!enumerator.MoveNext ()) 39 | throw new InvalidOperationException (); 40 | 41 | return enumerator.Current; 42 | } 43 | } 44 | } 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /NETPack.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NETPack.Console")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NETPack.Console")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a5644428-d790-497b-9c46-a0aa1c7cd585")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /NETPack.Console/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NETPack.Core/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # User-specific files 3 | *.suo 4 | *.user 5 | *.sln.docstates 6 | 7 | # Build results 8 | [Oo]bj/ 9 | *_i.c 10 | *_p.c 11 | *.ilk 12 | *.meta 13 | *.obj 14 | *.pch 15 | *.pdb 16 | *.pgc 17 | *.pgd 18 | *.rsp 19 | *.sbr 20 | *.tlb 21 | *.tli 22 | *.tlh 23 | *.tmp 24 | *.vspscc 25 | .builds 26 | *.dotCover 27 | 28 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 29 | #packages/ 30 | 31 | # Visual C++ cache files 32 | ipch/ 33 | *.aps 34 | *.ncb 35 | *.opensdf 36 | *.sdf 37 | 38 | # Visual Studio profiler 39 | *.psess 40 | *.vsp 41 | 42 | # ReSharper is a .NET coding add-in 43 | _ReSharper* 44 | 45 | # Installshield output folder 46 | [Ee]xpress 47 | 48 | # DocProject is a documentation generator add-in 49 | DocProject/buildhelp/ 50 | DocProject/Help/*.HxT 51 | DocProject/Help/*.HxC 52 | DocProject/Help/*.hhc 53 | DocProject/Help/*.hhk 54 | DocProject/Help/*.hhp 55 | DocProject/Help/Html2 56 | DocProject/Help/html 57 | 58 | # Click-Once directory 59 | publish 60 | 61 | # Others 62 | 63 | [Oo]bj 64 | sql 65 | TestResults 66 | *.Cache 67 | ClientBin 68 | stylecop.* 69 | ~$* 70 | *.dbmdl 71 | Generated_Code #added for RIA/Silverlight projects 72 | 73 | # Backup & report files from converting an old project file to a newer 74 | # Visual Studio version. Backup files are not needed, because we have git ;-) 75 | _UpgradeReport_Files/ 76 | Backup*/ 77 | UpgradeLog*.XML 78 | 79 | 80 | !PEVerify.exe 81 | !1033/ 82 | !NETPack.Console.exe 83 | !NETPack.Core.dll 84 | 85 | #Mr Developer 86 | .mr.developer.cfg 87 | 88 | # Mac crap 89 | .DS_Store 90 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Compression/DeflateStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.IO.Compression; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace NETPack.Core.Engine.Compression 9 | { 10 | public static class DeflateCompression 11 | { 12 | public static byte[] Compress(byte[] raw) 13 | { 14 | using (var ms = new MemoryStream(raw)) 15 | { 16 | using (var ds = new DeflateStream(ms, CompressionMode.Compress)) 17 | { 18 | ds.Write(raw, 0, raw.Length); 19 | ds.Flush(); 20 | } 21 | return ms.ToArray(); 22 | } 23 | } 24 | 25 | public static byte[] Decompress(byte[] compressed) 26 | { 27 | var decompressedStream = new MemoryStream(); 28 | 29 | using (var ms = new MemoryStream(compressed)) 30 | { 31 | using (var ds = new DeflateStream(ms, CompressionMode.Decompress)) 32 | { 33 | ds.CopyTo(decompressedStream); 34 | } 35 | return decompressedStream.ToArray(); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/ConsoleLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 6 | 7 | namespace NETPack.Core.Engine 8 | { 9 | public class ConsoleLogger : DefaultUIProvider 10 | { 11 | public ConsoleLogger(LogLevel logLevel) 12 | : base(logLevel) 13 | { 14 | } 15 | 16 | public override Action GlobalLog 17 | { 18 | get { return msg => Console.WriteLine(Indentation + msg); } 19 | } 20 | 21 | public override Action VerboseLog 22 | { 23 | get { return msg => { if (Globals.Context.Options.LogLevel == LogLevel.Verbose) Console.WriteLine(Indentation + msg); }; } 24 | } 25 | 26 | public override Action SubtleLog 27 | { 28 | get { return msg => { if (Globals.Context.Options.LogLevel == LogLevel.Subtle) Console.WriteLine(Indentation + msg); }; } 29 | } 30 | 31 | public override Action GlobalLogNoNewline 32 | { 33 | get { return msg => Console.Write(Indentation + msg); } 34 | } 35 | 36 | public override Action VerboseLogNoNewline 37 | { 38 | get { return msg => { if (Globals.Context.Options.LogLevel == LogLevel.Verbose) Console.Write(Indentation + msg); }; } 39 | } 40 | 41 | public override Action SubtleLogNoNewline 42 | { 43 | get { return msg => { if (Globals.Context.Options.LogLevel == LogLevel.Subtle) Console.Write(Indentation + msg); }; } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Packing/Analysis/ArchitectureAnalyzer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Mono.Cecil; 6 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 7 | using NETPack.Core.Engine.Utils; 8 | 9 | namespace NETPack.Core.Engine.Packing.Analysis 10 | { 11 | public class ArchitectureAnalyzer : IAnalyzer 12 | { 13 | public List LocalValues { get; set; } 14 | 15 | public string AnalyzationKey { get { return "Architecture"; } } 16 | public AnalysisEntry Entry { get; set; } 17 | 18 | public ArchitectureAnalyzer() 19 | { 20 | LocalValues = new List(); 21 | } 22 | 23 | public void Analyze(object param) 24 | { 25 | var asmDef = (param as AssemblyDefinition); 26 | var targetArchitecture = asmDef.MainModule.Architecture; 27 | 28 | LocalValues.Add(targetArchitecture); 29 | 30 | Entry = new AnalysisEntry(LocalValues[0]); 31 | } 32 | 33 | public void Output() 34 | { 35 | Globals.Context.UIProvider.VerboseLog("[Analyze(Architecture)] -> Detected: " + LocalValues[0]); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Packing/Analysis/CLRVersionAnalyzer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Mono.Cecil; 6 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 7 | using NETPack.Core.Engine.Utils; 8 | 9 | namespace NETPack.Core.Engine.Packing.Analysis 10 | { 11 | public class CLRVersionAnalyzer : IAnalyzer 12 | { 13 | public List LocalValues { get; set; } 14 | 15 | public string AnalyzationKey { get { return "CLRVer"; } } 16 | public AnalysisEntry Entry { get; set; } 17 | 18 | public CLRVersionAnalyzer() 19 | { 20 | LocalValues = new List(); 21 | } 22 | 23 | public void Analyze(object param) 24 | { 25 | var asmDef = (param as AssemblyDefinition); 26 | var targetRuntime = asmDef.MainModule.Runtime; 27 | 28 | LocalValues.Add(targetRuntime); 29 | 30 | Entry = new AnalysisEntry(LocalValues[0]); 31 | } 32 | 33 | public void Output() 34 | { 35 | Globals.Context.UIProvider.VerboseLog("[Analyze(CLRVer)] -> Detected: " + LocalValues[0]); 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Packing/Analysis/EntrypointAnalyzer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Mono.Cecil; 3 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 4 | using NETPack.Core.Engine.Utils; 5 | 6 | namespace NETPack.Core.Engine.Packing.Analysis 7 | { 8 | public class EntrypointAnalyzer : IAnalyzer 9 | { 10 | public List LocalValues { get; set; } 11 | 12 | public string AnalyzationKey { get { return "Entrypoint"; } } 13 | public AnalysisEntry Entry { get; set; } 14 | 15 | public EntrypointAnalyzer() 16 | { 17 | LocalValues = new List(); 18 | } 19 | 20 | public void Analyze(object param) 21 | { 22 | var asmDef = (param as AssemblyDefinition); 23 | var ep = asmDef.EntryPoint; 24 | 25 | var @params = ep.Parameters; 26 | 27 | LocalValues.Add(@params); 28 | Entry = new AnalysisEntry(LocalValues[0]); 29 | } 30 | 31 | public void Output() 32 | { 33 | Globals.Context.UIProvider.VerboseLog("[Analyze(Entrypoint)] -> " + (LocalValues[0].Count == 1 ? "(string[] args)" : "no param")); 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Packing/Analysis/IconAnalyzer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using Mono.Cecil; 5 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 6 | using NETPack.Core.Engine.Utils; 7 | 8 | namespace NETPack.Core.Engine.Packing.Analysis 9 | { 10 | public class IconAnalyzer : IAnalyzer 11 | { 12 | public List LocalValues { get; set; } 13 | 14 | public string AnalyzationKey { get { return "Icon"; } } 15 | public AnalysisEntry Entry { get; set; } 16 | 17 | public IconAnalyzer() 18 | { 19 | LocalValues = new List(); 20 | } 21 | 22 | public void Analyze(object param) 23 | { 24 | int size; 25 | var ico = NativeHelper.ExtractIcon(param as string, out size); 26 | 27 | LocalValues.Add(Tuple.Create(ico, size)); 28 | Entry = new AnalysisEntry(LocalValues[0]); 29 | } 30 | 31 | public void Output() 32 | { 33 | Globals.Context.UIProvider.VerboseLog("[Analyze(Icon)] -> Extracted icon"); 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Packing/Analysis/ReflectionAnalyzer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Mono.Cecil; 6 | 7 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 8 | using NETPack.Core.Engine.Utils; 9 | using NETPack.Core.Engine.Utils.Extensions; 10 | 11 | namespace NETPack.Core.Engine.Packing.Analysis 12 | { 13 | public class ReflectionAnalyzer : IAnalyzer 14 | { 15 | public List LocalValues { get; set; } 16 | 17 | public string AnalyzationKey { get { return "Reflection"; } } 18 | public AnalysisEntry Entry { get; set; } 19 | 20 | public ReflectionAnalyzer() 21 | { 22 | LocalValues = new List(); 23 | } 24 | 25 | public void Analyze(object param) 26 | { 27 | var asmDef = (param as AssemblyDefinition); 28 | 29 | foreach (var tDef in asmDef.MainModule.GetAllTypes()) 30 | { 31 | foreach (var mDef in tDef.Methods.Where(x => x.HasBody)) 32 | foreach (var instr in mDef.Body.Instructions) 33 | if (instr.OpCode.OperandType == Mono.Cecil.Cil.OperandType.InlineMethod) 34 | if (instr.Operand.ToString().Contains("System.Reflection")) 35 | { 36 | LocalValues.Add(true); 37 | break; 38 | } 39 | } 40 | 41 | if (LocalValues.Count == 0) 42 | LocalValues.Add(false); 43 | 44 | Entry = new AnalysisEntry(LocalValues[0]); 45 | } 46 | 47 | public void Output() 48 | { 49 | Globals.Context.UIProvider.VerboseLog("[Analyze(Reflection)] -> " + LocalValues[0].ToString()); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Packing/Analysis/SubsystemAnalyzer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Mono.Cecil; 6 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 7 | using NETPack.Core.Engine.Utils; 8 | 9 | namespace NETPack.Core.Engine.Packing.Analysis 10 | { 11 | public class SubsystemAnalyzer : IAnalyzer 12 | { 13 | public List LocalValues { get; set; } 14 | 15 | public string AnalyzationKey { get { return "Subsys"; } } 16 | public AnalysisEntry Entry { get; set; } 17 | 18 | public SubsystemAnalyzer() 19 | { 20 | LocalValues = new List(); 21 | } 22 | 23 | public void Analyze(object param) 24 | { 25 | var asmDef = (param as AssemblyDefinition); 26 | var subSystem = asmDef.MainModule.Kind; 27 | 28 | if (subSystem == ModuleKind.Dll) 29 | throw new BadImageFormatException("Dll not supported"); 30 | 31 | LocalValues.Add(subSystem); 32 | 33 | Entry = new AnalysisEntry(LocalValues[0]); 34 | } 35 | 36 | public void Output() 37 | { 38 | Globals.Context.UIProvider.VerboseLog("[Analyze(Subsystem)] -> Subsystem: " + LocalValues[0].ToString()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Packing/Steps/ReferencePackerStep.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using Mono.Cecil; 7 | using Mono.Cecil.Cil; 8 | using NETPack.Core.Engine.Compression; 9 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 10 | using NETPack.Core.Engine.Utils; 11 | using NETPack.Core.Engine.Utils.Extensions; 12 | 13 | namespace NETPack.Core.Engine.Packing.Steps 14 | { 15 | public class ReferencePackerStep : PackingStep 16 | { 17 | public ReferencePackerStep(AssemblyDefinition asmDef) 18 | : base(asmDef) 19 | { 20 | } 21 | 22 | public override string StepDescription 23 | { 24 | get { return "Packs referenced assemblies into output file..."; } 25 | } 26 | 27 | public override string StepOutput 28 | { 29 | get { return "Packing references..."; } 30 | } 31 | 32 | public override void ProcessStep() 33 | { 34 | var target = Globals.Context.TargetAssembly; 35 | Globals.Context.Options.MoveReferences = false; 36 | 37 | foreach (var markedRef in Globals.Context.MarkedReferences) 38 | { 39 | var buff = QuickLZ.compress(File.ReadAllBytes(markedRef.Value), Globals.Context.Options.CompressionLevel); 40 | var asm = markedRef.Key; 41 | 42 | target.MainModule.Resources.Add(new EmbeddedResource(asm.Name.Name.MangleName(), 43 | ManifestResourceAttributes.Private, buff)); 44 | Globals.Context.UIProvider.VerboseLog(string.Format("[Packing(Ref)] -> Packed reference ({0})", asm.Name.Name)); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Structs, Enums & Interfaces/AnalysisEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NETPack.Core.Engine.Structs__Enums___Interfaces 7 | { 8 | public class AnalysisEntry 9 | { 10 | public AnalysisEntry(params dynamic[] @params) 11 | { 12 | Values = new List(); 13 | Values.AddRange(@params); 14 | } 15 | 16 | public List Values { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Structs, Enums & Interfaces/Analyzer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NETPack.Core.Engine.Structs__Enums___Interfaces 7 | { 8 | public interface IAnalyzer 9 | { 10 | string AnalyzationKey { get; } 11 | AnalysisEntry Entry { get; set; } 12 | 13 | void Analyze(object param); 14 | void Output(); 15 | } 16 | 17 | public abstract class Analyzer : IAnalyzer 18 | { 19 | public abstract string AnalyzationKey { get; } 20 | 21 | public abstract void Output(); 22 | public List LocalValues { get; set; } 23 | 24 | public abstract AnalysisEntry Entry { get; set; } 25 | public abstract void Analyze(object param); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Structs, Enums & Interfaces/Bugster/NETPackExceptionFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NETPack.Core.Engine.Utils; 6 | 7 | namespace NETPack.Core.Engine.Structs__Enums___Interfaces.Bugster 8 | { 9 | class NETPackExceptionFormatter : IExceptionFormatter 10 | { 11 | public string Format(Exception exception) 12 | { 13 | var errorInformation = new StringBuilder(); 14 | 15 | errorInformation.Append("Error message:\r\n\t" + exception.Message); 16 | errorInformation.Append("\r\n\r\nTarget site:\r\n\t" + exception.TargetSite); 17 | errorInformation.Append("\r\n\r\nInner Exception:\r\n\t" + exception.InnerException); 18 | errorInformation.Append("\r\n\r\nStack trace:\r\n\r\n"); 19 | 20 | foreach (var obj in exception.StackTrace) 21 | errorInformation.Append(obj.ToString()); 22 | 23 | return errorInformation.ToString(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Structs, Enums & Interfaces/LogLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NETPack.Core.Engine.Structs__Enums___Interfaces 7 | { 8 | [Flags] 9 | public enum LogLevel : byte 10 | { 11 | Verbose = 0x0, 12 | Subtle = 0x1, 13 | Log = 0x2 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Structs, Enums & Interfaces/PackingStep.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Mono.Cecil; 6 | using NETPack.Core.Engine.Utils; 7 | 8 | namespace NETPack.Core.Engine.Structs__Enums___Interfaces 9 | { 10 | public interface IPackingStep 11 | { 12 | void Initialize(); 13 | void ProcessStep(); 14 | void FinalizeStep(); 15 | void Output(); 16 | 17 | bool Delay { get; } 18 | } 19 | 20 | public abstract class PackingStep : IPackingStep 21 | { 22 | public AssemblyDefinition AsmDef; 23 | 24 | protected PackingStep(AssemblyDefinition asmDef) 25 | { 26 | AsmDef = asmDef; 27 | NewLine = true; 28 | } 29 | 30 | public virtual bool NewLine { get; set; } 31 | public virtual bool Delay { get { return false; } } 32 | public abstract string StepDescription { get; } 33 | public abstract string StepOutput { get; } 34 | 35 | public virtual void Output() 36 | { 37 | if (NewLine) 38 | Globals.Context.UIProvider.GlobalLog(StepOutput); 39 | else 40 | Globals.Context.UIProvider.GlobalLogNoNewline(StepOutput); 41 | } 42 | 43 | public virtual void Initialize() 44 | { 45 | Globals.Context.UIProvider.Indent(); 46 | } 47 | public abstract void ProcessStep(); 48 | public virtual void FinalizeStep() 49 | { 50 | Globals.Context.UIProvider.DeIndent(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Structs, Enums & Interfaces/StandardContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using Mono.Cecil; 7 | 8 | namespace NETPack.Core.Engine.Structs__Enums___Interfaces 9 | { 10 | public class StandardPackerContext : PackerContext 11 | { 12 | public StandardPackerContext(IUserInterfaceProvider uiProvider) 13 | { 14 | MarkedAssemblies = new List(); 15 | MarkedReferences = new Dictionary(); 16 | AnalysisDatabase = new Dictionary(); 17 | UIProvider = uiProvider; 18 | PackingSteps = new List(); 19 | } 20 | 21 | public override bool VerifyContext() 22 | { 23 | return true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Utils/Extensions/Array.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NETPack.Core.Engine.Utils.Extensions 7 | { 8 | public static class ArrayExt 9 | { 10 | public static T[] From(this T[] arr, int index) 11 | { 12 | return GetFrom(arr, index).ToArray(); 13 | } 14 | 15 | private static IEnumerable GetFrom(T[] arr, int index) 16 | { 17 | for (var i = index; i < arr.Length; i++) 18 | yield return arr[i]; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Utils/Extensions/AssemblyDefinition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Threading; 7 | using Mono.Cecil; 8 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 9 | 10 | namespace NETPack.Core.Engine.Utils.Extensions 11 | { 12 | public static class AssemblyDefinitionExt 13 | { 14 | public static IMemberDefinition GetInjection(this AssemblyDefinition asmDef, string name) 15 | { 16 | IMemberDefinition target = 17 | asmDef.MainModule.GetAllTypes().First( 18 | t => (t.Namespace == "NETPack.Core.Injections" && t.Name == name)); 19 | 20 | switch (name) 21 | { 22 | case "Decompressor": 23 | (target as TypeDefinition).Namespace = "N"; 24 | target.Name = "K"; 25 | 26 | return target; 27 | 28 | case "Loader": 29 | (target as TypeDefinition).Namespace = "npack"; 30 | target.Name = "netpack"; 31 | 32 | var main = (target as TypeDefinition).Methods[0]; 33 | StubWorker.SetApartmentState(ref main); 34 | 35 | return target ; 36 | 37 | case "Resolver": 38 | (target as TypeDefinition).Namespace = "R"; 39 | target.Name = "RS"; 40 | 41 | return target; 42 | 43 | case "Watermark": 44 | target.Name = "netpackAttrib"; 45 | 46 | return target; 47 | } 48 | 49 | throw new Exception("Missing injection"); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Utils/Extensions/AssemblyNameReference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using Mono.Cecil; 7 | 8 | namespace NETPack.Core.Engine.Utils.Extensions 9 | { 10 | public static class AssemblyNameReferenceExt 11 | { 12 | public static AssemblyDefinition ResolveReference(this AssemblyNameReference @ref) 13 | { 14 | var fixedPath = Path.Combine(Path.GetDirectoryName(Globals.Context.InPath), @ref.Name + ".dll"); 15 | return AssemblyDefinition.ReadAssembly(fixedPath); 16 | } 17 | 18 | public static AssemblyDefinition ResolveReference(this AssemblyNameReference @ref, out string path) 19 | { 20 | path = Path.Combine(Path.GetDirectoryName(Globals.Context.InPath), @ref.Name + ".dll"); 21 | return AssemblyDefinition.ReadAssembly(path); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Utils/Extensions/Dictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace NETPack.Core.Engine.Utils.Extensions 8 | { 9 | public static class DictionaryExt 10 | { 11 | public static void ForEach(this Dictionary dictionary, Action> func) 12 | { 13 | foreach (var itm in dictionary) 14 | func(itm); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Utils/Extensions/Int32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NETPack.Core.Engine.Utils.Extensions 7 | { 8 | public static class Int32Ext 9 | { 10 | public static string GetSuffix(this int size) 11 | { 12 | if (size >= 0 && size <= 1048576) 13 | return Convert.ToString(size/1024) + "kb"; 14 | if (size >= 1048576 && size <= 1073741824) 15 | return Convert.ToString(size/1048576) + "mb"; 16 | 17 | return Convert.ToString(size / 1073741824) + "gb"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Utils/Extensions/ModuleDefinition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Mono.Cecil; 6 | 7 | namespace NETPack.Core.Engine.Utils.Extensions 8 | { 9 | static class Functional 10 | { 11 | 12 | public static System.Func Y(System.Func, System.Func> f) 13 | { 14 | System.Func g = null; 15 | g = f(a => g(a)); 16 | return g; 17 | } 18 | 19 | public static IEnumerable Prepend(this IEnumerable source, TSource element) 20 | { 21 | if (source == null) 22 | throw new ArgumentNullException("source"); 23 | 24 | return PrependIterator(source, element); 25 | } 26 | 27 | static IEnumerable PrependIterator(IEnumerable source, TSource element) 28 | { 29 | yield return element; 30 | 31 | foreach (var item in source) 32 | yield return item; 33 | } 34 | } 35 | 36 | public static class ModuleDefinitionExt 37 | { 38 | public static IEnumerable GetAllTypes(this ModuleDefinition self) 39 | { 40 | if (self == null) 41 | throw new ArgumentNullException("self"); 42 | 43 | // it was fun to write, but we need a somewhat less convoluted implementation 44 | return self.Types.SelectMany( 45 | Functional.Y>(f => type => type.NestedTypes.SelectMany(f).Prepend(type))); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /NETPack.Core/Engine/Utils/Extensions/String.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace NETPack.Core.Engine.Utils.Extensions 8 | { 9 | public static class StringExt 10 | { 11 | public static string ParameterFriendly(this string str) 12 | { 13 | return @"""" + str + @""""; 14 | } 15 | 16 | public static string GetPath(this string fullPath) 17 | { 18 | return Path.GetDirectoryName(fullPath); 19 | } 20 | 21 | public static string MangleName(this string original) 22 | { 23 | return new string(original.Select(x => (char) (x ^ 13)).ToArray()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /NETPack.Core/Globals.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NETPack.Core.Engine; 6 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 7 | using NETPack.Core.Engine.Utils; 8 | 9 | namespace NETPack.Core 10 | { 11 | public static class Globals 12 | { 13 | public static IPackerContext Context; 14 | public static BugReporter Bugster; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /NETPack.Core/Injections/Loader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Threading; 7 | 8 | namespace NETPack.Core.Injections 9 | { 10 | public class Loader 11 | { 12 | [STAThread] 13 | public static void Main(string[] args) 14 | { 15 | var buff = new byte[0]; 16 | 17 | using (var asmStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("X")) 18 | { 19 | buff = new byte[asmStream.Length]; 20 | asmStream.Read(buff, 0, buff.Length); 21 | 22 | buff = Decompressor.D(buff); 23 | } 24 | var T = new Thread(run); 25 | T.SetApartmentState(ApartmentState.STA); 26 | T.Start(new[] {(object)buff, args}); 27 | } 28 | 29 | public static void run(object param) 30 | { 31 | var data = ((object[])param)[0] as byte[]; 32 | var args = ((object[])param)[1] as string[]; 33 | 34 | var asm = Assembly.Load(data); 35 | asm.EntryPoint.Invoke(null, new object[] { args }); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /NETPack.Core/Injections/Resolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Windows.Forms; 7 | 8 | namespace NETPack.Core.Injections 9 | { 10 | public static class Resolver 11 | { 12 | public static void AddHandler() 13 | { 14 | AppDomain.CurrentDomain.AssemblyResolve += ResolveHandler; 15 | } 16 | 17 | public static Assembly ResolveHandler(object sender, ResolveEventArgs e) 18 | { 19 | byte[] asmBuff; 20 | var demangledName = DemangleName(e.Name.Split(',')[0]); 21 | 22 | using(var resStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(demangledName)) 23 | { 24 | asmBuff = new byte[resStream.Length]; 25 | resStream.Read(asmBuff, 0, asmBuff.Length); 26 | 27 | asmBuff = Decompressor.D(asmBuff); 28 | } 29 | 30 | return Assembly.Load(asmBuff); 31 | } 32 | 33 | public static string DemangleName(string original) 34 | { 35 | char[] outStr = original.ToCharArray(); 36 | 37 | for (var i = 0; i < outStr.Length; i++) 38 | outStr[i] = (char) (outStr[i] ^ 13); 39 | 40 | return new string(outStr); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /NETPack.Core/Injections/Watermark.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NETPack.Core.Injections 7 | { 8 | public class Watermark : Attribute 9 | { 10 | public Version @Version; 11 | 12 | public Watermark() 13 | { 14 | @Version = new Version(0, 1, 0, 0); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /NETPack.Core/Mono libs/Linker/Mono.Linker.Steps/IStep.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IStep.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // (C) 2006 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace NETPack.Core.Linker.Mono.Linker.Steps { 30 | 31 | public interface IStep { 32 | void Process (LinkContext context); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /NETPack.Core/Mono libs/Linker/Mono.Linker.Steps/RegenerateGuidStep.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CleanStep.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // (C) 2008 Novell, Inc. (http://www.novell.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | using Mono.Cecil; 31 | 32 | namespace NETPack.Core.Linker.Mono.Linker.Steps { 33 | 34 | public class RegenerateGuidStep : BaseStep { 35 | 36 | protected override void ProcessAssembly (AssemblyDefinition assembly) 37 | { 38 | if (Annotations.GetAction (assembly) == AssemblyAction.Link) 39 | RegenerateGuid (assembly); 40 | } 41 | 42 | static void RegenerateGuid (AssemblyDefinition asm) 43 | { 44 | asm.MainModule.Mvid = Guid.NewGuid (); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /NETPack.Core/Mono libs/Linker/Mono.Linker/AssemblyAction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyAction.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // (C) 2006 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace NETPack.Core.Linker.Mono.Linker { 30 | 31 | public enum AssemblyAction { 32 | Skip, 33 | Copy, 34 | Link, 35 | Delete, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /NETPack.Core/Mono libs/Linker/Mono.Linker/I18nAssemblies.cs: -------------------------------------------------------------------------------- 1 | // 2 | // I18nAssemblies.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@novell.com) 6 | // 7 | // (C) 2007 Novell, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace NETPack.Core.Linker.Mono.Linker { 32 | 33 | [Flags] 34 | public enum I18nAssemblies { 35 | 36 | None = 0, 37 | 38 | CJK = 1, 39 | MidEast = 2, 40 | Other = 4, 41 | Rare = 8, 42 | West = 16, 43 | 44 | All = CJK | MidEast | Other | Rare | West, 45 | Base 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /NETPack.Core/Mono libs/Linker/Mono.Linker/MethodAction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MethodAction.cs 3 | // 4 | // Author: 5 | // Jb Evain (jbevain@gmail.com) 6 | // 7 | // (C) 2006 Jb Evain 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace NETPack.Core.Linker.Mono.Linker { 30 | 31 | public enum MethodAction { 32 | Nothing, 33 | Parse, 34 | ForceParse 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /NETPack.Core/Mono libs/Linker/Mono.Linker/TypePreserve.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TypePreserve.cs 3 | // 4 | // Author: 5 | // Jb Evain (jb@nurv.fr) 6 | // 7 | // (C) 2007 Novell, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace NETPack.Core.Linker.Mono.Linker { 30 | 31 | public enum TypePreserve { 32 | Nothing, 33 | All, 34 | Fields, 35 | Methods, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /NETPack.Core/OptionSet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using NETPack.Core.Engine.Structs__Enums___Interfaces; 7 | 8 | namespace NETPack.Core 9 | { 10 | public class PackerOptionSet 11 | { 12 | public bool MoveReferences = true; 13 | public bool VerifyOutput = true; 14 | public bool PreserveIcon; 15 | 16 | public int CompressionLevel = 3; 17 | 18 | public ApartmentState ApmtState = ApartmentState.STA; 19 | public LogLevel @LogLevel = LogLevel.Subtle; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /NETPack.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NETPack.Core")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NETPack.Core")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d0a7affc-ee05-442f-b6b0-e8770e74fdfa")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/1033/PEVerify.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Debug/1033/PEVerify.exe -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/1033/PEVerify.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/1033/pevrfyrc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Debug/1033/pevrfyrc.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Debug/Mono.Cecil.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/NDesk.Options.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Debug/NDesk.Options.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/NETPack.Console.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Debug/NETPack.Console.exe -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/NETPack.Console.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/NETPack.Console.vshost.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/NETPack.Console.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/NETPack.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Debug/NETPack.Core.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Debug/log.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Debug/log.txt -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/1033/PEVerify.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Release/1033/PEVerify.exe -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/1033/PEVerify.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/1033/pevrfyrc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Release/1033/pevrfyrc.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Release/Mono.Cecil.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/NDesk.Options.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Release/NDesk.Options.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/NETPack.Console.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Release/NETPack.Console.exe -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/NETPack.Console.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/NETPack.Console.vshost.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/NETPack.Console.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/NETPack.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Release/NETPack.Core.dll -------------------------------------------------------------------------------- /NETPack.Core/bin/Release/log.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maddnias/NETPack/05ba8f52e4c9ae7b6371694ebc588b995d542b7a/NETPack.Core/bin/Release/log.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NETPack 2 | Lightweight and flexible .NET packer utilizing Mono.Cecil 3 | --------------------------------------------------------------------------------