├── .gitattributes ├── .gitignore ├── CLRSharp ├── CLRSharp.csproj ├── CLRSharp │ ├── CLRSharp_Env.cs │ ├── CLRSharp_Env.cs.meta │ ├── CrossBind.meta │ ├── CrossBind │ │ ├── Yield.cs │ │ └── Yield.cs.meta │ ├── Execute.meta │ ├── Execute │ │ ├── CodeBody.cs │ │ ├── CodeBody.cs.meta │ │ ├── Context.cs │ │ ├── Context.cs.meta │ │ ├── StackFrame.cs │ │ ├── StackFrame.cs.meta │ │ ├── ValueOnStack.cs │ │ └── ValueOnStack.cs.meta │ ├── Interface.meta │ ├── Interface │ │ ├── EnvAndLog.cs │ │ └── EnvAndLog.cs.meta │ ├── Type.meta │ └── Type │ │ ├── CLRSharp.meta │ │ ├── CLRSharp │ │ ├── CLRSharp_Instance.cs │ │ ├── CLRSharp_Instance.cs.meta │ │ ├── CLRSharp_Type.cs │ │ └── CLRSharp_Type.cs.meta │ │ ├── Delegate.meta │ │ ├── Delegate │ │ ├── Delegate_Helper.cs │ │ └── Delegate_Helper.cs.meta │ │ ├── System.meta │ │ ├── System │ │ ├── System_Type.cs │ │ └── System_Type.cs.meta │ │ ├── Type_Common.cs │ │ ├── Type_Common.cs.meta │ │ ├── Type_List.cs │ │ └── Type_List.cs.meta └── Properties │ └── AssemblyInfo.cs ├── DLLDump ├── DLLDump.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── app.config ├── ForUnity ├── LSharp_U3D_HelloWorld_20150204.zip ├── LSharp_U3D_HelloWorld_20150313.zip └── readme.txt ├── LSharp.sln ├── LSharp.userprefs ├── Mono.Cecil.20 ├── Mono.Cecil.20.csproj └── MonoCecil │ ├── 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 │ ├── ArrayType.cs │ ├── AssemblyDefinition.cs │ ├── AssemblyFlags.cs │ ├── AssemblyHashAlgorithm.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 ├── Mono.Cecil.Mdb ├── Mono.Cecil.Mdb.csproj ├── Properties │ └── AssemblyInfo.cs └── mdb │ ├── Mono.Cecil.Mdb │ ├── MdbReader.cs │ └── MdbReaderProvider.cs │ └── Mono.CompilerServices.SymbolWriter │ ├── AnonymousScopeEntry.cs │ ├── CapturedScope.cs │ ├── CapturedVariable.cs │ ├── CodeBlockEntry.cs │ ├── CompileUnitEntry.cs │ ├── ICompileUnit.cs │ ├── IMethodDef.cs │ ├── ISourceFile.cs │ ├── LineNumberEntry.cs │ ├── LineNumberTable.cs │ ├── LocalVariableEntry.cs │ ├── MethodEntry.cs │ ├── MonoSymbolFile.cs │ ├── MonoSymbolFileException.cs │ ├── MonoSymbolWriter.cs │ ├── MyBinaryReader.cs │ ├── MyBinaryWriter.cs │ ├── NamespaceEntry.cs │ ├── NamespaceInfo.cs │ ├── OffsetTable.cs │ ├── ScopeVariable.cs │ ├── SourceFileEntry.cs │ ├── SourceMethodBuilder.cs │ ├── SourceMethodImpl.cs │ ├── SymbolDocumentWriterImpl.cs │ └── SymbolWriterImpl.cs ├── Mono.Cecil.Pdb ├── Mono.Cecil.Pdb.csproj ├── Properties │ └── AssemblyInfo.cs └── pdb │ ├── Microsoft.Cci.Pdb │ ├── BitAccess.cs │ ├── BitSet.cs │ ├── CvInfo.cs │ ├── DataStream.cs │ ├── DbiDbgHdr.cs │ ├── DbiHeader.cs │ ├── DbiModuleInfo.cs │ ├── DbiSecCon.cs │ ├── IntHashTable.cs │ ├── Interfaces.cs │ ├── MsfDirectory.cs │ ├── PdbConstant.cs │ ├── PdbDebugException.cs │ ├── PdbException.cs │ ├── PdbFile.cs │ ├── PdbFileHeader.cs │ ├── PdbFunction.cs │ ├── PdbLine.cs │ ├── PdbLines.cs │ ├── PdbReader.cs │ ├── PdbScope.cs │ ├── PdbSlot.cs │ ├── PdbSource.cs │ └── SourceLocationProvider.cs │ └── Mono.Cecil.Pdb │ ├── ISymUnmanagedDocumentWriter.cs │ ├── ISymUnmanagedWriter2.cs │ ├── ModuleMetadata.cs │ ├── PdbHelper.cs │ ├── PdbReader.cs │ ├── PdbWriter.cs │ ├── SymDocumentWriter.cs │ └── SymWriter.cs ├── Test ├── test01 │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── GameObject.cs │ ├── MyCrossBind.cs │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── app.config │ └── test01.csproj └── testdll01 │ ├── Class1.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── TestClass.cs │ └── testdll01.csproj ├── UnitTest ├── CLScriptExt │ ├── CSLEConvert.cs │ ├── Country.cs │ ├── LSharpConvert.cs │ ├── MyClass.cs │ ├── MyJson.cs │ ├── MyJsonCompress.cs │ ├── Student.cs │ ├── TestClass.cs │ ├── TestDele.cs │ └── Vector3.cs ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Logger.cs ├── Perform │ └── Perform.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── SimU3D │ └── GameObject.cs ├── UnitTest.csproj └── app.config ├── UnitTestConsole ├── CLScriptExt │ ├── CSLEConvert.cs │ ├── Country.cs │ ├── LSharpConvert.cs │ ├── MyClass.cs │ ├── MyJson.cs │ ├── MyJsonCompress.cs │ ├── Student.cs │ ├── TestClass.cs │ ├── TestDele.cs │ └── Vector3.cs ├── Perform │ └── Perform.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SimU3D │ └── GameObject.cs ├── UnitTestConsole.csproj └── app.config ├── UnitTestDll ├── Eviltestor │ ├── EvilTestor.cs │ ├── test01 │ │ ├── Test01.cs │ │ └── test.txt │ ├── test02 │ │ ├── Test02.cs │ │ └── test.txt │ ├── test03 │ │ ├── Test03.cs │ │ └── test.txt │ ├── test04 │ │ ├── Test04.cs │ │ └── test.txt │ ├── test05 │ │ ├── Test05.cs │ │ └── test.txt │ ├── test06 │ │ ├── Test06.cs │ │ └── test.txt │ ├── test07 │ │ ├── Test07.cs │ │ └── test.txt │ ├── test08 │ │ ├── Test08.cs │ │ └── test.txt │ ├── test09 │ │ ├── Test09.cs │ │ └── test.txt │ └── test10.cs ├── LightTestor │ ├── ExpTest_10.cs │ ├── ExpTest_20.cs │ ├── ExpTest_30.cs │ ├── ExpTest_40.cs │ ├── ExpTest_50.cs │ ├── ExpTest_60.cs │ ├── ExpTest_70.cs │ └── Perform_01.cs ├── Properties │ └── AssemblyInfo.cs ├── SimU3D │ ├── TestU3D.cs │ └── TestYield.cs ├── Test0.cs ├── Test_ByDuskforest.cs ├── Test_ByLynn.cs ├── UnitTestDll.csproj ├── test │ └── TestClass.cs ├── test_RefOut.cs ├── test_enum.cs ├── test_string_switch.cs └── 没有实现的IL.cs └── readme.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | 18 | # Windows shortcuts 19 | *.lnk 20 | 21 | bin 22 | obj 23 | temp 24 | Bin 25 | Debug 26 | *.suo 27 | *.Suo 28 | # ========================= 29 | # Operating System Files 30 | # ========================= 31 | 32 | # OSX 33 | # ========================= 34 | 35 | .DS_Store 36 | .AppleDouble 37 | .LSOverride 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear on external disk 43 | .Spotlight-V100 44 | .Trashes 45 | 46 | # Directories potentially created on remote AFP share 47 | .AppleDB 48 | .AppleDesktop 49 | Network Trash Folder 50 | Temporary Items 51 | .apdisk 52 | 53 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/CLRSharp_Env.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ccc354edaf0ba741be8ccabea8f28b9 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/CrossBind.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d37db62475788664f90cb1e611fd8cb2 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/CrossBind/Yield.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ffc4ee9ef8edac438f8f1a4fac47a41 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Execute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04af843a480fd934dbe8166135358b22 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Execute/CodeBody.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0f95d2a1c9a9af47969f5c0df59af53 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Execute/Context.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc17fbf613d7be4429c33b6fc1f502c6 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Execute/StackFrame.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 838bbff288387bf45b27e788d3ab4dab 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Execute/ValueOnStack.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ce3551611051c440a4f92790307a06c 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Interface.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7543e4f61e3ad842bf75e84d8f10f49 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Interface/EnvAndLog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CLRSharp 6 | { 7 | public interface ICLRSharp_Logger 8 | { 9 | void Log(string str); 10 | void Log_Warning(string str); 11 | void Log_Error(string str); 12 | } 13 | public interface ICLRSharp_Environment 14 | { 15 | string version 16 | { 17 | get; 18 | } 19 | void LoadModule(System.IO.Stream dllStream); 20 | 21 | void LoadModule(System.IO.Stream dllStream, System.IO.Stream pdbStream, Mono.Cecil.Cil.ISymbolReaderProvider debugInfoLoader); 22 | 23 | ////仅仅加载模块的名字和他引用的模块名字 24 | //void LoadModule_OnlyName(System.IO.Stream dllStream); 25 | 26 | void AddSerachAssembly(System.Reflection.Assembly assembly); 27 | string[] GetAllTypes(); 28 | ICLRType GetType(string name); 29 | 30 | string[] GetModuleRefNames(); 31 | ICLRType GetType(System.Type systemType); 32 | 33 | void RegType(ICLRType type); 34 | ICLRSharp_Logger logger 35 | { 36 | get; 37 | } 38 | 39 | void RegCrossBind(ICrossBind bind); 40 | 41 | ICrossBind GetCrossBind(Type type); 42 | 43 | } 44 | public interface ICrossBind 45 | { 46 | Type Type 47 | { get; } 48 | object CreateBind(CLRSharp_Instance inst); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Interface/EnvAndLog.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acd4794f09421a44e9cf756c8b7ce256 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f034f9e8f048bb4ca7337e4a84c514b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/CLRSharp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86eac08f62847994eaf4c2787670380f 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/CLRSharp/CLRSharp_Instance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CLRSharp 6 | { 7 | public class CLRSharp_Instance 8 | { 9 | public ICLRType_Sharp type 10 | { 11 | get; 12 | private set; 13 | } 14 | public CLRSharp_Instance(ICLRType_Sharp type) 15 | { 16 | this.type = type; 17 | } 18 | public object system_base; 19 | public Dictionary Fields = new Dictionary(); 20 | 21 | //每个方法都可以产生一个代理 22 | public Dictionary Delegates = new Dictionary(); 23 | 24 | public Delegate GetDelegate(ThreadContext context, Type deleType, IMethod method) 25 | { 26 | Delegate dele = null; 27 | if (!Delegates.TryGetValue(method, out dele)) 28 | { 29 | dele = Delegate_Binder.MakeDelegate(deleType, this, method); 30 | Delegates[method] = dele; 31 | //需要从Delegate转换成实际类型赋值的帮助类 32 | 33 | 34 | } 35 | return dele; 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/CLRSharp/CLRSharp_Instance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da7073d46c0d54d4d9ffc52de3411661 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/CLRSharp/CLRSharp_Type.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac73fba17fb55fa40a1f50559d8c8665 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/Delegate.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64436cea59acfc346b5f468b0f209d01 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/Delegate/Delegate_Helper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c47d69bfe4e6cf49b92a2b6d5cecacb 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/System.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 890c56c760294904abb9f88343a119d0 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/System/System_Type.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42c3f2e5c3b50e5458673a9215251765 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/Type_Common.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2cca4ee7518c1740a9cb71d9ea5c3b1 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/CLRSharp/Type/Type_List.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92f42f56d2bb2c64c9da323d08501d33 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /CLRSharp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("CLRSharp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CLRSharp")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("ff1396b8-0146-40e1-8a24-ad58f9459594")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DLLDump/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("DLLDump")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DLLDump")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("310aedb8-29f9-4713-afaf-8ae8a0bbec79")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DLLDump/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ForUnity/LSharp_U3D_HelloWorld_20150204.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightszero/LSharp/ba261973c580a02e76b8c34f00e238b8f0495a9a/ForUnity/LSharp_U3D_HelloWorld_20150204.zip -------------------------------------------------------------------------------- /ForUnity/LSharp_U3D_HelloWorld_20150313.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightszero/LSharp/ba261973c580a02e76b8c34f00e238b8f0495a9a/ForUnity/LSharp_U3D_HelloWorld_20150313.zip -------------------------------------------------------------------------------- /ForUnity/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightszero/LSharp/ba261973c580a02e76b8c34f00e238b8f0495a9a/ForUnity/readme.txt -------------------------------------------------------------------------------- /LSharp.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Cil/CodeWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CodeWriter.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.Collections.Generic; 31 | 32 | using Mono.Collections.Generic; 33 | 34 | using Mono.Cecil.Metadata; 35 | using Mono.Cecil.PE; 36 | 37 | using RVA = System.UInt32; 38 | 39 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Cil/SequencePoint.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SequencePoint.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 SequencePoint { 32 | 33 | Document document; 34 | 35 | int start_line; 36 | int start_column; 37 | int end_line; 38 | int end_column; 39 | 40 | public int StartLine { 41 | get { return start_line; } 42 | set { start_line = value; } 43 | } 44 | 45 | public int StartColumn { 46 | get { return start_column; } 47 | set { start_column = value; } 48 | } 49 | 50 | public int EndLine { 51 | get { return end_line; } 52 | set { end_line = value; } 53 | } 54 | 55 | public int EndColumn { 56 | get { return end_column; } 57 | set { end_column = value; } 58 | } 59 | 60 | public Document Document { 61 | get { return document; } 62 | set { document = value; } 63 | } 64 | 65 | public SequencePoint (Document document) 66 | { 67 | this.document = document; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Cil/VariableReference.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VariableReference.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 abstract class VariableReference { 32 | 33 | string name; 34 | internal int index = -1; 35 | protected TypeReference variable_type; 36 | 37 | public string Name { 38 | get { return name; } 39 | set { name = value; } 40 | } 41 | 42 | public TypeReference VariableType { 43 | get { return variable_type; } 44 | set { variable_type = value; } 45 | } 46 | 47 | public int Index { 48 | get { return index; } 49 | } 50 | 51 | internal VariableReference (TypeReference variable_type) 52 | : this (string.Empty, variable_type) 53 | { 54 | } 55 | 56 | internal VariableReference (string name, TypeReference variable_type) 57 | { 58 | this.name = name; 59 | this.variable_type = variable_type; 60 | } 61 | 62 | public abstract VariableDefinition Resolve (); 63 | 64 | public override string ToString () 65 | { 66 | if (!string.IsNullOrEmpty (name)) 67 | return name; 68 | 69 | if (index >= 0) 70 | return "V_" + index; 71 | 72 | return string.Empty; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Metadata/BlobHeap.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BlobHeap.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 Mono.Cecil.PE; 32 | 33 | namespace Mono.Cecil.Metadata 34 | { 35 | 36 | sealed class BlobHeap : Heap 37 | { 38 | 39 | public BlobHeap(Section section, uint start, uint size) 40 | : base(section, start, size) 41 | { 42 | } 43 | 44 | public byte[] Read(uint index) 45 | { 46 | if (index == 0 || index > Size - 1) 47 | return Empty.Array; 48 | 49 | var data = Section.Data; 50 | 51 | int position = (int)(index + Offset); 52 | int length = (int)Mixin.ReadCompressedUInt32(data, ref position); 53 | 54 | var buffer = new byte[length]; 55 | 56 | Buffer.BlockCopy(data, position, buffer, 0, length); 57 | 58 | return buffer; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Metadata/Buffers.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TableHeapBuffer.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.Collections.Generic; 31 | using System.Text; 32 | 33 | using Mono.Cecil.PE; 34 | 35 | using RVA = System.UInt32; 36 | 37 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Metadata/GuidHeap.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GuidHeap.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 Mono.Cecil.PE; 32 | 33 | namespace Mono.Cecil.Metadata { 34 | 35 | sealed class GuidHeap : Heap { 36 | 37 | public GuidHeap (Section section, uint start, uint size) 38 | : base (section, start, size) 39 | { 40 | } 41 | 42 | public Guid Read (uint index) 43 | { 44 | if (index == 0) 45 | return new Guid (); 46 | 47 | const int guid_size = 16; 48 | 49 | var buffer = new byte [guid_size]; 50 | 51 | index--; 52 | 53 | Buffer.BlockCopy (Section.Data, (int) (Offset + index), buffer, 0, guid_size); 54 | 55 | return new Guid (buffer); 56 | 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Metadata/TokenType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TokenType.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 TokenType : uint { 32 | Module = 0x00000000, 33 | TypeRef = 0x01000000, 34 | TypeDef = 0x02000000, 35 | Field = 0x04000000, 36 | Method = 0x06000000, 37 | Param = 0x08000000, 38 | InterfaceImpl = 0x09000000, 39 | MemberRef = 0x0a000000, 40 | CustomAttribute = 0x0c000000, 41 | Permission = 0x0e000000, 42 | Signature = 0x11000000, 43 | Event = 0x14000000, 44 | Property = 0x17000000, 45 | ModuleRef = 0x1a000000, 46 | TypeSpec = 0x1b000000, 47 | Assembly = 0x20000000, 48 | AssemblyRef = 0x23000000, 49 | File = 0x26000000, 50 | ExportedType = 0x27000000, 51 | ManifestResource = 0x28000000, 52 | GenericParam = 0x2a000000, 53 | MethodSpec = 0x2b000000, 54 | String = 0x70000000, 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.Metadata/UserStringHeap.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UserStringHeap.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 Mono.Cecil.PE; 32 | 33 | namespace Mono.Cecil.Metadata 34 | { 35 | 36 | sealed class UserStringHeap : StringHeap 37 | { 38 | 39 | public UserStringHeap(Section section, uint start, uint size) 40 | : base(section, start, size) 41 | { 42 | } 43 | 44 | protected override string ReadStringAt(uint index) 45 | { 46 | byte[] data = Section.Data; 47 | int start = (int)(index + Offset); 48 | 49 | uint length = (uint)(Mixin.ReadCompressedUInt32(data, ref start) & ~1); 50 | if (length < 1) 51 | return string.Empty; 52 | 53 | var chars = new char[length / 2]; 54 | 55 | for (int i = start, j = 0; i < start + length; i += 2) 56 | chars[j++] = (char)(data[i] | (data[i + 1] << 8)); 57 | 58 | return new string(chars); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.PE/BinaryStreamWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BinaryStreamWriter.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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.PE/ImageWriter.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightszero/LSharp/ba261973c580a02e76b8c34f00e238b8f0495a9a/Mono.Cecil.20/MonoCecil/Mono.Cecil.PE/ImageWriter.cs -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil.PE/TextMap.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightszero/LSharp/ba261973c580a02e76b8c34f00e238b8f0495a9a/Mono.Cecil.20/MonoCecil/Mono.Cecil.PE/TextMap.cs -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/AssemblyLinkedResource.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyLinkedResource.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 AssemblyLinkedResource : Resource { 34 | 35 | AssemblyNameReference reference; 36 | 37 | public AssemblyNameReference Assembly { 38 | get { return reference; } 39 | set { reference = value; } 40 | } 41 | 42 | public override ResourceType ResourceType { 43 | get { return ResourceType.AssemblyLinked; } 44 | } 45 | 46 | public AssemblyLinkedResource (string name, ManifestResourceAttributes flags) 47 | : base (name, flags) 48 | { 49 | } 50 | 51 | public AssemblyLinkedResource (string name, ManifestResourceAttributes flags, AssemblyNameReference reference) 52 | : base (name, flags) 53 | { 54 | this.reference = reference; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/AssemblyWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyWriter.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.Collections.Generic; 31 | using System.IO; 32 | using System.Text; 33 | 34 | using Mono.Collections.Generic; 35 | using Mono.Cecil.Cil; 36 | using Mono.Cecil.Metadata; 37 | using Mono.Cecil.PE; 38 | 39 | using RVA = System.UInt32; 40 | using RID = System.UInt32; 41 | using CodedRID = System.UInt32; 42 | using StringIndex = System.UInt32; 43 | using BlobIndex = System.UInt32; 44 | 45 | namespace Mono.Cecil { 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/EventReference.cs: -------------------------------------------------------------------------------- 1 | // 2 | // EventReference.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 abstract class EventReference : MemberReference { 34 | 35 | TypeReference event_type; 36 | 37 | public TypeReference EventType { 38 | get { return event_type; } 39 | set { event_type = value; } 40 | } 41 | 42 | public override string FullName { 43 | get { return event_type.FullName + " " + MemberFullName (); } 44 | } 45 | 46 | protected EventReference (string name, TypeReference eventType) 47 | : base (name) 48 | { 49 | if (eventType == null) 50 | throw new ArgumentNullException ("eventType"); 51 | 52 | event_type = eventType; 53 | } 54 | 55 | public abstract EventDefinition Resolve (); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/IConstantProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IConstantProvider.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 IConstantProvider : IMetadataTokenProvider { 32 | 33 | bool HasConstant { get; set; } 34 | object Constant { get; set; } 35 | } 36 | 37 | static partial class Mixin { 38 | 39 | internal static object NoValue = new object (); 40 | internal static object NotResolved = new object (); 41 | 42 | public static void ResolveConstant ( 43 | IConstantProvider self, 44 | ref object constant, 45 | ModuleDefinition module) 46 | { 47 | lock (module.SyncRoot) { 48 | if (constant != Mixin.NotResolved) 49 | return; 50 | if (Mixin.HasImage (module)) 51 | constant = module.Read (self, (provider, reader) => reader.ReadConstant (provider)); 52 | else 53 | constant = Mixin.NoValue; 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/IGenericInstance.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IGenericInstance.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.Text; 30 | 31 | using Mono.Collections.Generic; 32 | 33 | namespace Mono.Cecil { 34 | 35 | public interface IGenericInstance : IMetadataTokenProvider { 36 | 37 | bool HasGenericArguments { get; } 38 | Collection GenericArguments { get; } 39 | } 40 | 41 | static partial class Mixin { 42 | 43 | public static bool ContainsGenericParameter (IGenericInstance self) 44 | { 45 | var arguments = self.GenericArguments; 46 | 47 | for (int i = 0; i < arguments.Count; i++) 48 | if (arguments [i].ContainsGenericParameter) 49 | return true; 50 | 51 | return false; 52 | } 53 | 54 | public static void GenericInstanceFullName (IGenericInstance self, StringBuilder builder) 55 | { 56 | builder.Append ("<"); 57 | var arguments = self.GenericArguments; 58 | for (int i = 0; i < arguments.Count; i++) { 59 | if (i > 0) 60 | builder.Append (","); 61 | builder.Append (arguments [i].FullName); 62 | } 63 | builder.Append (">"); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/IMarshalInfoProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IMarshalInfoProvider.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 | 32 | public interface IMarshalInfoProvider : IMetadataTokenProvider 33 | { 34 | 35 | bool HasMarshalInfo { get; } 36 | MarshalInfo MarshalInfo { get; set; } 37 | } 38 | 39 | static partial class Mixin 40 | { 41 | 42 | public static bool GetHasMarshalInfo( 43 | IMarshalInfoProvider self, 44 | ModuleDefinition module) 45 | { 46 | return Mixin.HasImage(module) && module.Read(self, (provider, reader) => reader.HasMarshalInfo(provider)); 47 | } 48 | 49 | public static MarshalInfo GetMarshalInfo( 50 | IMarshalInfoProvider self, 51 | ref MarshalInfo variable, 52 | ModuleDefinition module) 53 | { 54 | return Mixin.HasImage(module) 55 | ? module.Read(ref variable, self, (provider, reader) => reader.ReadMarshalInfo(provider)) 56 | : null; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/LinkedResource.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LinkedResource.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 sealed class LinkedResource : Resource { 32 | 33 | internal byte [] hash; 34 | string file; 35 | 36 | public byte [] Hash { 37 | get { return hash; } 38 | } 39 | 40 | public string File { 41 | get { return file; } 42 | set { file = value; } 43 | } 44 | 45 | public override ResourceType ResourceType { 46 | get { return ResourceType.Linked; } 47 | } 48 | 49 | public LinkedResource (string name, ManifestResourceAttributes flags) 50 | : base (name, flags) 51 | { 52 | } 53 | 54 | public LinkedResource (string name, ManifestResourceAttributes flags, string file) 55 | : base (name, flags) 56 | { 57 | this.file = file; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/ModuleKind.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleKind.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 enum ModuleKind { 34 | Dll, 35 | Console, 36 | Windows, 37 | NetModule, 38 | } 39 | 40 | public enum TargetArchitecture { 41 | I386, 42 | AMD64, 43 | IA64, 44 | ARMv7, 45 | } 46 | 47 | [Flags] 48 | public enum ModuleAttributes { 49 | ILOnly = 1, 50 | Required32Bit = 2, 51 | StrongNameSigned = 8, 52 | Preferred32Bit = 0x00020000, 53 | } 54 | 55 | [Flags] 56 | public enum ModuleCharacteristics { 57 | HighEntropyVA = 0x0020, 58 | DynamicBase = 0x0040, 59 | NoSEH = 0x0400, 60 | NXCompat = 0x0100, 61 | AppContainer = 0x1000, 62 | TerminalServerAware = 0x8000, 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/ModuleReference.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleReference.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 class ModuleReference : IMetadataScope { 32 | 33 | string name; 34 | 35 | internal MetadataToken token; 36 | 37 | public string Name { 38 | get { return name; } 39 | set { name = value; } 40 | } 41 | 42 | public virtual MetadataScopeType MetadataScopeType { 43 | get { return MetadataScopeType.ModuleReference; } 44 | } 45 | 46 | public MetadataToken MetadataToken { 47 | get { return token; } 48 | set { token = value; } 49 | } 50 | 51 | internal ModuleReference () 52 | { 53 | this.token = new MetadataToken (TokenType.ModuleRef); 54 | } 55 | 56 | public ModuleReference (string name) 57 | : this () 58 | { 59 | this.name = name; 60 | } 61 | 62 | public override string ToString () 63 | { 64 | return name; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/NativeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NativeType.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 NativeType { 32 | None = 0x66, 33 | 34 | Boolean = 0x02, 35 | I1 = 0x03, 36 | U1 = 0x04, 37 | I2 = 0x05, 38 | U2 = 0x06, 39 | I4 = 0x07, 40 | U4 = 0x08, 41 | I8 = 0x09, 42 | U8 = 0x0a, 43 | R4 = 0x0b, 44 | R8 = 0x0c, 45 | LPStr = 0x14, 46 | Int = 0x1f, 47 | UInt = 0x20, 48 | Func = 0x26, 49 | Array = 0x2a, 50 | 51 | // Msft specific 52 | Currency = 0x0f, 53 | BStr = 0x13, 54 | LPWStr = 0x15, 55 | LPTStr = 0x16, 56 | FixedSysString = 0x17, 57 | IUnknown = 0x19, 58 | IDispatch = 0x1a, 59 | Struct = 0x1b, 60 | IntF = 0x1c, 61 | SafeArray = 0x1d, 62 | FixedArray = 0x1e, 63 | ByValStr = 0x22, 64 | ANSIBStr = 0x23, 65 | TBStr = 0x24, 66 | VariantBool = 0x25, 67 | ASAny = 0x28, 68 | LPStruct = 0x2b, 69 | CustomMarshaler = 0x2c, 70 | Error = 0x2d, 71 | Max = 0x50 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/PInvokeAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PInvokeAttributes.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 PInvokeAttributes : ushort { 35 | NoMangle = 0x0001, // PInvoke is to use the member name as specified 36 | 37 | // Character set 38 | CharSetMask = 0x0006, 39 | CharSetNotSpec = 0x0000, 40 | CharSetAnsi = 0x0002, 41 | CharSetUnicode = 0x0004, 42 | CharSetAuto = 0x0006, 43 | 44 | SupportsLastError = 0x0040, // Information about target function. Not relevant for fields 45 | 46 | // Calling convetion 47 | CallConvMask = 0x0700, 48 | CallConvWinapi = 0x0100, 49 | CallConvCdecl = 0x0200, 50 | CallConvStdCall = 0x0300, 51 | CallConvThiscall = 0x0400, 52 | CallConvFastcall = 0x0500, 53 | 54 | BestFitMask = 0x0030, 55 | BestFitEnabled = 0x0010, 56 | BestFitDisabled = 0x0020, 57 | 58 | ThrowOnUnmappableCharMask = 0x3000, 59 | ThrowOnUnmappableCharEnabled = 0x1000, 60 | ThrowOnUnmappableCharDisabled = 0x2000, 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/PointerType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PointerType.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 PointerType : TypeSpecification { 36 | 37 | public override string Name { 38 | get { return base.Name + "*"; } 39 | } 40 | 41 | public override string FullName { 42 | get { return base.FullName + "*"; } 43 | } 44 | 45 | public override bool IsValueType { 46 | get { return false; } 47 | set { throw new InvalidOperationException (); } 48 | } 49 | 50 | public override bool IsPointer { 51 | get { return true; } 52 | } 53 | 54 | public PointerType (TypeReference type) 55 | : base (type) 56 | { 57 | Mixin.CheckType (type); 58 | this.etype = MD.ElementType.Ptr; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/PropertyReference.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PropertyReference.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 Mono.Collections.Generic; 32 | 33 | namespace Mono.Cecil { 34 | 35 | public abstract class PropertyReference : MemberReference { 36 | 37 | TypeReference property_type; 38 | 39 | public TypeReference PropertyType { 40 | get { return property_type; } 41 | set { property_type = value; } 42 | } 43 | 44 | public abstract Collection Parameters { 45 | get; 46 | } 47 | 48 | internal PropertyReference (string name, TypeReference propertyType) 49 | : base (name) 50 | { 51 | if (propertyType == null) 52 | throw new ArgumentNullException ("propertyType"); 53 | 54 | property_type = propertyType; 55 | } 56 | 57 | public abstract PropertyDefinition Resolve (); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Cecil/ReferenceType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ByReferenceType.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 ByReferenceType : TypeSpecification { 36 | 37 | public override string Name { 38 | get { return base.Name + "&"; } 39 | } 40 | 41 | public override string FullName { 42 | get { return base.FullName + "&"; } 43 | } 44 | 45 | public override bool IsValueType { 46 | get { return false; } 47 | set { throw new InvalidOperationException (); } 48 | } 49 | 50 | public override bool IsByReference { 51 | get { return true; } 52 | } 53 | 54 | public ByReferenceType (TypeReference type) 55 | : base (type) 56 | { 57 | Mixin.CheckType (type); 58 | this.etype = MD.ElementType.ByRef; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Security.Cryptography/CryptoConvert.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightszero/LSharp/ba261973c580a02e76b8c34f00e238b8f0495a9a/Mono.Cecil.20/MonoCecil/Mono.Security.Cryptography/CryptoConvert.cs -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/Mono.Security.Cryptography/CryptoService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoService.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 | using System.Reflection; 32 | using System.Security.Cryptography; 33 | 34 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 (T [] self) 44 | { 45 | return self == null || self.Length == 0; 46 | } 47 | 48 | public static bool IsNullOrEmpty (Collection self) 49 | { 50 | return self == null || self.size == 0; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Mono.Cecil.20/MonoCecil/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 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列特性集 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Mono.Cecil.Mdb")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Mono.Cecil.Mdb")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 程序集的版本信息由下面四个值组成: 18 | // 19 | // 主版本 20 | // 次版本 21 | // 生成号 22 | // 修订号 23 | // 24 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 25 | // 方法是按如下所示使用“*”: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.Cecil.Mdb/MdbReaderProvider.cs: -------------------------------------------------------------------------------- 1 | using Mono.Cecil.Cil; 2 | using Mono.CompilerServices.SymbolWriter; 3 | using System; 4 | using System.IO; 5 | namespace Mono.Cecil.Mdb 6 | { 7 | public class MdbReaderProvider : ISymbolReaderProvider 8 | { 9 | public ISymbolReader GetSymbolReader(ModuleDefinition module, string fileName) 10 | { 11 | return new MdbReader(MonoSymbolFile.ReadSymbolFile(module, fileName)); 12 | } 13 | public ISymbolReader GetSymbolReader(ModuleDefinition module, Stream symbolStream) 14 | { 15 | return new MdbReader(MonoSymbolFile.ReadSymbolFile(module, symbolStream)); 16 | //throw new NotImplementedException(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/CapturedScope.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public struct CapturedScope 5 | { 6 | public readonly int Scope; 7 | public readonly string CapturedName; 8 | public CapturedScope(int scope, string captured_name) 9 | { 10 | this.Scope = scope; 11 | this.CapturedName = captured_name; 12 | } 13 | internal CapturedScope(MyBinaryReader reader) 14 | { 15 | this.Scope = reader.ReadLeb128(); 16 | this.CapturedName = reader.ReadString(); 17 | } 18 | //internal void Write(MyBinaryWriter bw) 19 | //{ 20 | // bw.WriteLeb128(this.Scope); 21 | // bw.Write(this.CapturedName); 22 | //} 23 | public override string ToString() 24 | { 25 | return string.Format("[CapturedScope {0}:{1}]", this.Scope, this.CapturedName); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/CapturedVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public struct CapturedVariable 5 | { 6 | public enum CapturedKind : byte 7 | { 8 | Local, 9 | Parameter, 10 | This 11 | } 12 | public readonly string Name; 13 | public readonly string CapturedName; 14 | public readonly CapturedVariable.CapturedKind Kind; 15 | public CapturedVariable(string name, string captured_name, CapturedVariable.CapturedKind kind) 16 | { 17 | this.Name = name; 18 | this.CapturedName = captured_name; 19 | this.Kind = kind; 20 | } 21 | internal CapturedVariable(MyBinaryReader reader) 22 | { 23 | this.Name = reader.ReadString(); 24 | this.CapturedName = reader.ReadString(); 25 | this.Kind = (CapturedVariable.CapturedKind)reader.ReadByte(); 26 | } 27 | //internal void Write(MyBinaryWriter bw) 28 | //{ 29 | // bw.Write(this.Name); 30 | // bw.Write(this.CapturedName); 31 | // bw.Write((byte)this.Kind); 32 | //} 33 | public override string ToString() 34 | { 35 | return string.Format("[CapturedVariable {0}:{1}:{2}]", this.Name, this.CapturedName, this.Kind); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/CodeBlockEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public class CodeBlockEntry 5 | { 6 | public enum Type 7 | { 8 | Lexical = 1, 9 | CompilerGenerated, 10 | IteratorBody, 11 | IteratorDispatcher 12 | } 13 | public int Index; 14 | public int Parent; 15 | public CodeBlockEntry.Type BlockType; 16 | public int StartOffset; 17 | public int EndOffset; 18 | public CodeBlockEntry(int index, int parent, CodeBlockEntry.Type type, int start_offset) 19 | { 20 | this.Index = index; 21 | this.Parent = parent; 22 | this.BlockType = type; 23 | this.StartOffset = start_offset; 24 | } 25 | internal CodeBlockEntry(int index, MyBinaryReader reader) 26 | { 27 | this.Index = index; 28 | int type_flag = reader.ReadLeb128(); 29 | this.BlockType = (CodeBlockEntry.Type)(type_flag & 63); 30 | this.Parent = reader.ReadLeb128(); 31 | this.StartOffset = reader.ReadLeb128(); 32 | this.EndOffset = reader.ReadLeb128(); 33 | if ((type_flag & 64) != 0) 34 | { 35 | int data_size = (int)reader.ReadInt16(); 36 | reader.BaseStream.Position += (long)data_size; 37 | } 38 | } 39 | public void Close(int end_offset) 40 | { 41 | this.EndOffset = end_offset; 42 | } 43 | //internal void Write(MyBinaryWriter bw) 44 | //{ 45 | // bw.WriteLeb128((int)this.BlockType); 46 | // bw.WriteLeb128(this.Parent); 47 | // bw.WriteLeb128(this.StartOffset); 48 | // bw.WriteLeb128(this.EndOffset); 49 | //} 50 | public override string ToString() 51 | { 52 | return string.Format("[CodeBlock {0}:{1}:{2}:{3}:{4}]", new object[] 53 | { 54 | this.Index, 55 | this.Parent, 56 | this.BlockType, 57 | this.StartOffset, 58 | this.EndOffset 59 | }); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/ICompileUnit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public interface ICompileUnit 5 | { 6 | CompileUnitEntry Entry 7 | { 8 | get; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/IMethodDef.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public interface IMethodDef 5 | { 6 | string Name 7 | { 8 | get; 9 | } 10 | int Token 11 | { 12 | get; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/ISourceFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public interface ISourceFile 5 | { 6 | SourceFileEntry Entry 7 | { 8 | get; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/LineNumberEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | namespace Mono.CompilerServices.SymbolWriter 4 | { 5 | public class LineNumberEntry 6 | { 7 | private class OffsetComparerClass : IComparer 8 | { 9 | public int Compare(LineNumberEntry l1, LineNumberEntry l2) 10 | { 11 | int result; 12 | if (l1.Offset < l2.Offset) 13 | { 14 | result = -1; 15 | } 16 | else 17 | { 18 | if (l1.Offset > l2.Offset) 19 | { 20 | result = 1; 21 | } 22 | else 23 | { 24 | result = 0; 25 | } 26 | } 27 | return result; 28 | } 29 | } 30 | private class RowComparerClass : IComparer 31 | { 32 | public int Compare(LineNumberEntry l1, LineNumberEntry l2) 33 | { 34 | int result; 35 | if (l1.Row < l2.Row) 36 | { 37 | result = -1; 38 | } 39 | else 40 | { 41 | if (l1.Row > l2.Row) 42 | { 43 | result = 1; 44 | } 45 | else 46 | { 47 | result = 0; 48 | } 49 | } 50 | return result; 51 | } 52 | } 53 | public readonly int Row; 54 | public readonly int File; 55 | public readonly int Offset; 56 | public readonly bool IsHidden; 57 | public static LineNumberEntry Null = new LineNumberEntry(0, 0, 0); 58 | public static readonly IComparer OffsetComparer = new LineNumberEntry.OffsetComparerClass(); 59 | public static readonly IComparer RowComparer = new LineNumberEntry.RowComparerClass(); 60 | public LineNumberEntry(int file, int row, int offset) : this(file, row, offset, false) 61 | { 62 | } 63 | public LineNumberEntry(int file, int row, int offset, bool is_hidden) 64 | { 65 | this.File = file; 66 | this.Row = row; 67 | this.Offset = offset; 68 | this.IsHidden = is_hidden; 69 | } 70 | public override string ToString() 71 | { 72 | return string.Format("[Line {0}:{1}:{2}]", this.File, this.Row, this.Offset); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/LocalVariableEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public struct LocalVariableEntry 5 | { 6 | public readonly int Index; 7 | public readonly string Name; 8 | public readonly int BlockIndex; 9 | public LocalVariableEntry(int index, string name, int block) 10 | { 11 | this.Index = index; 12 | this.Name = name; 13 | this.BlockIndex = block; 14 | } 15 | internal LocalVariableEntry(MonoSymbolFile file, MyBinaryReader reader) 16 | { 17 | this.Index = reader.ReadLeb128(); 18 | this.Name = reader.ReadString(); 19 | this.BlockIndex = reader.ReadLeb128(); 20 | } 21 | //internal void Write(MonoSymbolFile file, MyBinaryWriter bw) 22 | //{ 23 | // bw.WriteLeb128(this.Index); 24 | // bw.Write(this.Name); 25 | // bw.WriteLeb128(this.BlockIndex); 26 | //} 27 | public override string ToString() 28 | { 29 | return string.Format("[LocalVariable {0}:{1}:{2}]", this.Name, this.Index, this.BlockIndex - 1); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/MonoSymbolFileException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public class MonoSymbolFileException : Exception 5 | { 6 | public MonoSymbolFileException() 7 | { 8 | } 9 | public MonoSymbolFileException(string message, params object[] args) : base(string.Format(message, args)) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/MyBinaryReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | namespace Mono.CompilerServices.SymbolWriter 4 | { 5 | internal class MyBinaryReader : BinaryReader 6 | { 7 | public MyBinaryReader(Stream stream) : base(stream) 8 | { 9 | } 10 | public int ReadLeb128() 11 | { 12 | return base.Read7BitEncodedInt(); 13 | } 14 | public string ReadString(int offset) 15 | { 16 | long old_pos = this.BaseStream.Position; 17 | this.BaseStream.Position = (long)offset; 18 | string text = this.ReadString(); 19 | this.BaseStream.Position = old_pos; 20 | return text; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/MyBinaryWriter.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.IO; 3 | //namespace Mono.CompilerServices.SymbolWriter 4 | //{ 5 | // internal class MyBinaryWriter : BinaryWriter 6 | // { 7 | // public MyBinaryWriter(Stream stream) : base(stream) 8 | // { 9 | // } 10 | // public void WriteLeb128(int value) 11 | // { 12 | // base.Write7BitEncodedInt(value); 13 | // } 14 | // } 15 | //} 16 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/NamespaceEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public struct NamespaceEntry 5 | { 6 | public readonly string Name; 7 | public readonly int Index; 8 | public readonly int Parent; 9 | public readonly string[] UsingClauses; 10 | public NamespaceEntry(string name, int index, string[] using_clauses, int parent) 11 | { 12 | this.Name = name; 13 | this.Index = index; 14 | this.Parent = parent; 15 | this.UsingClauses = ((using_clauses != null) ? using_clauses : new string[0]); 16 | } 17 | internal NamespaceEntry(MonoSymbolFile file, MyBinaryReader reader) 18 | { 19 | this.Name = reader.ReadString(); 20 | this.Index = reader.ReadLeb128(); 21 | this.Parent = reader.ReadLeb128(); 22 | int count = reader.ReadLeb128(); 23 | this.UsingClauses = new string[count]; 24 | for (int i = 0; i < count; i++) 25 | { 26 | this.UsingClauses[i] = reader.ReadString(); 27 | } 28 | } 29 | //internal void Write(MonoSymbolFile file, MyBinaryWriter bw) 30 | //{ 31 | // bw.Write(this.Name); 32 | // bw.WriteLeb128(this.Index); 33 | // bw.WriteLeb128(this.Parent); 34 | // bw.WriteLeb128(this.UsingClauses.Length); 35 | // string[] usingClauses = this.UsingClauses; 36 | // for (int i = 0; i < usingClauses.Length; i++) 37 | // { 38 | // string uc = usingClauses[i]; 39 | // bw.Write(uc); 40 | // } 41 | //} 42 | public override string ToString() 43 | { 44 | return string.Format("[Namespace {0}:{1}:{2}]", this.Name, this.Index, this.Parent); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/NamespaceInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | namespace Mono.CompilerServices.SymbolWriter 4 | { 5 | internal class NamespaceInfo 6 | { 7 | public string Name; 8 | public int NamespaceID; 9 | public ArrayList UsingClauses = new ArrayList(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/ScopeVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | public struct ScopeVariable 5 | { 6 | public readonly int Scope; 7 | public readonly int Index; 8 | public ScopeVariable(int scope, int index) 9 | { 10 | this.Scope = scope; 11 | this.Index = index; 12 | } 13 | internal ScopeVariable(MyBinaryReader reader) 14 | { 15 | this.Scope = reader.ReadLeb128(); 16 | this.Index = reader.ReadLeb128(); 17 | } 18 | //internal void Write(MyBinaryWriter bw) 19 | //{ 20 | // bw.WriteLeb128(this.Scope); 21 | // bw.WriteLeb128(this.Index); 22 | //} 23 | public override string ToString() 24 | { 25 | return string.Format("[ScopeVariable {0}:{1}]", this.Scope, this.Index); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/SourceMethodImpl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Mono.CompilerServices.SymbolWriter 3 | { 4 | internal class SourceMethodImpl : IMethodDef 5 | { 6 | private string name; 7 | private int token; 8 | private int namespaceID; 9 | public string Name 10 | { 11 | get 12 | { 13 | return this.name; 14 | } 15 | } 16 | public int NamespaceID 17 | { 18 | get 19 | { 20 | return this.namespaceID; 21 | } 22 | } 23 | public int Token 24 | { 25 | get 26 | { 27 | return this.token; 28 | } 29 | } 30 | public SourceMethodImpl(string name, int token, int namespaceID) 31 | { 32 | this.name = name; 33 | this.token = token; 34 | this.namespaceID = namespaceID; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Mono.Cecil.Mdb/mdb/Mono.CompilerServices.SymbolWriter/SymbolDocumentWriterImpl.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.Diagnostics.SymbolStore; 3 | //namespace Mono.CompilerServices.SymbolWriter 4 | //{ 5 | // internal class SymbolDocumentWriterImpl : ISymbolDocumentWriter, ISourceFile, ICompileUnit 6 | // { 7 | // private CompileUnitEntry comp_unit; 8 | // SourceFileEntry ISourceFile.Entry 9 | // { 10 | // get 11 | // { 12 | // return this.comp_unit.SourceFile; 13 | // } 14 | // } 15 | // public CompileUnitEntry Entry 16 | // { 17 | // get 18 | // { 19 | // return this.comp_unit; 20 | // } 21 | // } 22 | // public SymbolDocumentWriterImpl(CompileUnitEntry comp_unit) 23 | // { 24 | // this.comp_unit = comp_unit; 25 | // } 26 | // public void SetCheckSum(Guid algorithmId, byte[] checkSum) 27 | // { 28 | // } 29 | // public void SetSource(byte[] source) 30 | // { 31 | // } 32 | // } 33 | //} 34 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Mono.Cecil.Pdb")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Mono.Cecil.Pdb")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("37439f61-a9af-46e6-8389-746e2ceda89a")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/BitSet.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal struct BitSet { 15 | internal BitSet(BitAccess bits) { 16 | bits.ReadInt32(out size); // 0..3 : Number of words 17 | words = new uint[size]; 18 | bits.ReadUInt32(words); 19 | } 20 | 21 | //internal BitSet(int size) { 22 | // this.size = size; 23 | // words = new uint[size]; 24 | //} 25 | 26 | internal bool IsSet(int index) { 27 | int word = index / 32; 28 | if (word >= this.size) return false; 29 | return ((words[word] & GetBit(index)) != 0); 30 | } 31 | 32 | //internal void Set(int index) { 33 | // int word = index / 32; 34 | // if (word >= this.size) return; 35 | // words[word] |= GetBit(index); 36 | //} 37 | 38 | //internal void Clear(int index) { 39 | // int word = index / 32; 40 | // if (word >= this.size) return; 41 | // words[word] &= ~GetBit(index); 42 | //} 43 | 44 | private static uint GetBit(int index) { 45 | return ((uint)1 << (index % 32)); 46 | } 47 | 48 | //private static uint ReverseBits(uint value) { 49 | // uint o = 0; 50 | // for (int i = 0; i < 32; i++) { 51 | // o = (o << 1) | (value & 1); 52 | // value >>= 1; 53 | // } 54 | // return o; 55 | //} 56 | 57 | internal bool IsEmpty { 58 | get { return size == 0; } 59 | } 60 | 61 | //internal bool GetWord(int index, out uint word) { 62 | // if (index < size) { 63 | // word = ReverseBits(words[index]); 64 | // return true; 65 | // } 66 | // word = 0; 67 | // return false; 68 | //} 69 | 70 | private int size; 71 | private uint[] words; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/DbiDbgHdr.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal struct DbiDbgHdr { 15 | internal DbiDbgHdr(BitAccess bits) { 16 | bits.ReadUInt16(out snFPO); 17 | bits.ReadUInt16(out snException); 18 | bits.ReadUInt16(out snFixup); 19 | bits.ReadUInt16(out snOmapToSrc); 20 | bits.ReadUInt16(out snOmapFromSrc); 21 | bits.ReadUInt16(out snSectionHdr); 22 | bits.ReadUInt16(out snTokenRidMap); 23 | bits.ReadUInt16(out snXdata); 24 | bits.ReadUInt16(out snPdata); 25 | bits.ReadUInt16(out snNewFPO); 26 | bits.ReadUInt16(out snSectionHdrOrig); 27 | } 28 | 29 | internal ushort snFPO; // 0..1 30 | internal ushort snException; // 2..3 (deprecated) 31 | internal ushort snFixup; // 4..5 32 | internal ushort snOmapToSrc; // 6..7 33 | internal ushort snOmapFromSrc; // 8..9 34 | internal ushort snSectionHdr; // 10..11 35 | internal ushort snTokenRidMap; // 12..13 36 | internal ushort snXdata; // 14..15 37 | internal ushort snPdata; // 16..17 38 | internal ushort snNewFPO; // 18..19 39 | internal ushort snSectionHdrOrig; // 20..21 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/DbiModuleInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal class DbiModuleInfo { 15 | internal DbiModuleInfo(BitAccess bits, bool readStrings) { 16 | bits.ReadInt32(out opened); 17 | new DbiSecCon(bits); 18 | bits.ReadUInt16(out flags); 19 | bits.ReadInt16(out stream); 20 | bits.ReadInt32(out cbSyms); 21 | bits.ReadInt32(out cbOldLines); 22 | bits.ReadInt32(out cbLines); 23 | bits.ReadInt16(out files); 24 | bits.ReadInt16(out pad1); 25 | bits.ReadUInt32(out offsets); 26 | bits.ReadInt32(out niSource); 27 | bits.ReadInt32(out niCompiler); 28 | if (readStrings) { 29 | bits.ReadCString(out moduleName); 30 | bits.ReadCString(out objectName); 31 | } else { 32 | bits.SkipCString(out moduleName); 33 | bits.SkipCString(out objectName); 34 | } 35 | bits.Align(4); 36 | //if (opened != 0 || pad1 != 0) { 37 | // throw new PdbException("Invalid DBI module. "+ 38 | // "(opened={0}, pad={1})", opened, pad1); 39 | //} 40 | } 41 | 42 | internal int opened; // 0..3 43 | //internal DbiSecCon section; // 4..31 44 | internal ushort flags; // 32..33 45 | internal short stream; // 34..35 46 | internal int cbSyms; // 36..39 47 | internal int cbOldLines; // 40..43 48 | internal int cbLines; // 44..57 49 | internal short files; // 48..49 50 | internal short pad1; // 50..51 51 | internal uint offsets; 52 | internal int niSource; 53 | internal int niCompiler; 54 | internal string moduleName; 55 | internal string objectName; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/DbiSecCon.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal struct DbiSecCon { 15 | internal DbiSecCon(BitAccess bits) { 16 | bits.ReadInt16(out section); 17 | bits.ReadInt16(out pad1); 18 | bits.ReadInt32(out offset); 19 | bits.ReadInt32(out size); 20 | bits.ReadUInt32(out flags); 21 | bits.ReadInt16(out module); 22 | bits.ReadInt16(out pad2); 23 | bits.ReadUInt32(out dataCrc); 24 | bits.ReadUInt32(out relocCrc); 25 | //if (pad1 != 0 || pad2 != 0) { 26 | // throw new PdbException("Invalid DBI section. "+ 27 | // "(pad1={0}, pad2={1})", 28 | // pad1, pad2); 29 | //} 30 | } 31 | 32 | internal short section; // 0..1 33 | internal short pad1; // 2..3 34 | internal int offset; // 4..7 35 | internal int size; // 8..11 36 | internal uint flags; // 12..15 37 | internal short module; // 16..17 38 | internal short pad2; // 18..19 39 | internal uint dataCrc; // 20..23 40 | internal uint relocCrc; // 24..27 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/MsfDirectory.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal class MsfDirectory { 15 | internal MsfDirectory(PdbReader reader, PdbFileHeader head, BitAccess bits) { 16 | int pages = reader.PagesFromSize(head.directorySize); 17 | 18 | // 0..n in page of directory pages. 19 | bits.MinCapacity(head.directorySize); 20 | int directoryRootPages = head.directoryRoot.Length; 21 | int pagesPerPage = head.pageSize / 4; 22 | int pagesToGo = pages; 23 | for (int i = 0; i < directoryRootPages; i++) { 24 | int pagesInThisPage = pagesToGo <= pagesPerPage ? pagesToGo : pagesPerPage; 25 | reader.Seek(head.directoryRoot[i], 0); 26 | bits.Append(reader.reader, pagesInThisPage * 4); 27 | pagesToGo -= pagesInThisPage; 28 | } 29 | bits.Position = 0; 30 | 31 | DataStream stream = new DataStream(head.directorySize, bits, pages); 32 | bits.MinCapacity(head.directorySize); 33 | stream.Read(reader, bits); 34 | 35 | // 0..3 in directory pages 36 | int count; 37 | bits.ReadInt32(out count); 38 | 39 | // 4..n 40 | int[] sizes = new int[count]; 41 | bits.ReadInt32(sizes); 42 | 43 | // n..m 44 | streams = new DataStream[count]; 45 | for (int i = 0; i < count; i++) { 46 | if (sizes[i] <= 0) { 47 | streams[i] = new DataStream(); 48 | } else { 49 | streams[i] = new DataStream(sizes[i], bits, 50 | reader.PagesFromSize(sizes[i])); 51 | } 52 | } 53 | } 54 | 55 | internal DataStream[] streams; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/PdbDebugException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | using System.IO; 13 | 14 | namespace Microsoft.Cci.Pdb { 15 | internal class PdbDebugException : IOException { 16 | internal PdbDebugException(String format, params object[] args) 17 | : base(String.Format(format, args)) { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/PdbException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | using System.IO; 13 | 14 | namespace Microsoft.Cci.Pdb { 15 | internal class PdbException : IOException { 16 | internal PdbException(String format, params object[] args) 17 | : base(String.Format(format, args)) { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/PdbLine.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal struct PdbLine { 15 | internal uint offset; 16 | internal uint lineBegin; 17 | internal uint lineEnd; 18 | internal ushort colBegin; 19 | internal ushort colEnd; 20 | 21 | internal PdbLine(uint offset, uint lineBegin, ushort colBegin, uint lineEnd, ushort colEnd) { 22 | this.offset = offset; 23 | this.lineBegin = lineBegin; 24 | this.colBegin = colBegin; 25 | this.lineEnd = lineEnd; 26 | this.colEnd = colEnd; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/PdbLines.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal class PdbLines { 15 | internal PdbSource file; 16 | internal PdbLine[] lines; 17 | 18 | internal PdbLines(PdbSource file, uint count) { 19 | this.file = file; 20 | this.lines = new PdbLine[count]; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/PdbReader.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | using System.IO; 13 | 14 | namespace Microsoft.Cci.Pdb { 15 | internal class PdbReader { 16 | internal PdbReader(Stream reader, int pageSize) { 17 | this.pageSize = pageSize; 18 | this.reader = reader; 19 | } 20 | 21 | internal void Seek(int page, int offset) { 22 | reader.Seek(page * pageSize + offset, SeekOrigin.Begin); 23 | } 24 | 25 | internal void Read(byte[] bytes, int offset, int count) { 26 | reader.Read(bytes, offset, count); 27 | } 28 | 29 | internal int PagesFromSize(int size) { 30 | return (size + pageSize - 1) / (pageSize); 31 | } 32 | 33 | //internal int PageSize { 34 | // get { return pageSize; } 35 | //} 36 | 37 | internal readonly int pageSize; 38 | internal readonly Stream reader; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/PdbSlot.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal class PdbSlot { 15 | internal uint slot; 16 | internal string name; 17 | internal ushort flags; 18 | //internal uint segment; 19 | //internal uint address; 20 | 21 | internal PdbSlot(BitAccess bits, out uint typind) { 22 | AttrSlotSym slot; 23 | 24 | bits.ReadUInt32(out slot.index); 25 | bits.ReadUInt32(out slot.typind); 26 | bits.ReadUInt32(out slot.offCod); 27 | bits.ReadUInt16(out slot.segCod); 28 | bits.ReadUInt16(out slot.flags); 29 | bits.ReadCString(out slot.name); 30 | 31 | this.slot = slot.index; 32 | this.name = slot.name; 33 | this.flags = slot.flags; 34 | //this.segment = slot.segCod; 35 | //this.address = slot.offCod; 36 | 37 | typind = slot.typind; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/PdbSource.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the Microsoft Public License. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //----------------------------------------------------------------------------- 11 | using System; 12 | 13 | namespace Microsoft.Cci.Pdb { 14 | internal class PdbSource { 15 | //internal uint index; 16 | internal string name; 17 | internal Guid doctype; 18 | internal Guid language; 19 | internal Guid vendor; 20 | 21 | internal PdbSource(/*uint index, */string name, Guid doctype, Guid language, Guid vendor) { 22 | //this.index = index; 23 | this.name = name; 24 | this.doctype = doctype; 25 | this.language = language; 26 | this.vendor = vendor; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Microsoft.Cci.Pdb/SourceLocationProvider.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | //----------------------------------------------------------------------------- 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using Microsoft.Cci; 10 | using Microsoft.Cci.Pdb; 11 | using System.Text; 12 | using System.Diagnostics.SymbolStore; 13 | 14 | namespace Microsoft.Cci { 15 | 16 | internal sealed class PdbIteratorScope : ILocalScope { 17 | 18 | internal PdbIteratorScope(uint offset, uint length) { 19 | this.offset = offset; 20 | this.length = length; 21 | } 22 | 23 | public uint Offset { 24 | get { return this.offset; } 25 | } 26 | uint offset; 27 | 28 | public uint Length { 29 | get { return this.length; } 30 | } 31 | uint length; 32 | } 33 | } -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Mono.Cecil.Pdb/ISymUnmanagedDocumentWriter.cs: -------------------------------------------------------------------------------- 1 | // ISymUnmanagedDocumentWriter.cs 2 | // 3 | // Author: 4 | // Juerg Billeter (j@bitron.ch) 5 | // 6 | // (C) 2008 Juerg Billeter 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining 9 | // a copy of this software and associated documentation files (the 10 | // "Software"), to deal in the Software without restriction, including 11 | // without limitation the rights to use, copy, modify, merge, publish, 12 | // distribute, sublicense, and/or sell copies of the Software, and to 13 | // permit persons to whom the Software is furnished to do so, subject to 14 | // the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be 17 | // included in all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | // 27 | 28 | using System.Runtime.InteropServices; 29 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Mono.Cecil.Pdb/ISymUnmanagedWriter2.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ISymUnmanagedWriter2.cs 3 | // 4 | // Author: 5 | // Juerg Billeter (j@bitron.ch) 6 | // 7 | // (C) 2008 Juerg Billeter 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.Diagnostics.SymbolStore; 31 | using System.Runtime.InteropServices; 32 | using System.Runtime.InteropServices.ComTypes; 33 | 34 | using Mono.Cecil.Cil; 35 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Mono.Cecil.Pdb/ModuleMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Mono.Cecil.Pdb/PdbWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PdbWriter.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.Collections.Generic; 31 | using System.Diagnostics.SymbolStore; 32 | 33 | using Mono.Cecil.Cil; 34 | using Mono.Collections.Generic; 35 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Mono.Cecil.Pdb/SymDocumentWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SymDocumentWriter.cs 3 | // 4 | // Author: 5 | // Juerg Billeter (j@bitron.ch) 6 | // 7 | // (C) 2008 Juerg Billeter 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 | -------------------------------------------------------------------------------- /Mono.Cecil.Pdb/pdb/Mono.Cecil.Pdb/SymWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SymWriter.cs 3 | // 4 | // Author: 5 | // Juerg Billeter (j@bitron.ch) 6 | // 7 | // (C) 2008 Juerg Billeter 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.Collections.Generic; 31 | using System.Diagnostics.SymbolStore; 32 | using System.Runtime.InteropServices; 33 | 34 | using Mono.Cecil.Cil; 35 | using Mono.Collections.Generic; 36 | 37 | 38 | -------------------------------------------------------------------------------- /Test/test01/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace test01 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows 窗体设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.listBox1 = new System.Windows.Forms.ListBox(); 32 | this.SuspendLayout(); 33 | // 34 | // listBox1 35 | // 36 | this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill; 37 | this.listBox1.FormattingEnabled = true; 38 | this.listBox1.ItemHeight = 12; 39 | this.listBox1.Location = new System.Drawing.Point(0, 0); 40 | this.listBox1.Name = "listBox1"; 41 | this.listBox1.Size = new System.Drawing.Size(284, 261); 42 | this.listBox1.TabIndex = 0; 43 | // 44 | // Form1 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(284, 261); 49 | this.Controls.Add(this.listBox1); 50 | this.Name = "Form1"; 51 | this.Text = "Form1"; 52 | this.Load += new System.EventHandler(this.Form1_Load); 53 | this.ResumeLayout(false); 54 | 55 | } 56 | 57 | #endregion 58 | 59 | private System.Windows.Forms.ListBox listBox1; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Test/test01/GameObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace UnityEngine 6 | { 7 | public sealed class GameObject 8 | { 9 | Dictionary component = new Dictionary(); 10 | public GameObject() 11 | { 12 | component["trans"] = new Transform(); 13 | } 14 | public Transform transform 15 | { 16 | get 17 | { 18 | return component["trans"] as Transform; 19 | } 20 | } 21 | 22 | } 23 | public class Component 24 | { 25 | 26 | } 27 | public class Transform:Component 28 | { 29 | public Transform() 30 | { 31 | 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Test/test01/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | 5 | namespace test01 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// 应用程序的主入口点。 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | Application.EnableVisualStyles(); 16 | Application.SetCompatibleTextRenderingDefault(false); 17 | Application.Run(new Form1()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Test/test01/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("test01")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("test01")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("3e2df08b-c34d-4c59-8d90-dbc9a7290761")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Test/test01/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.0 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace test01.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Test/test01/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Test/test01/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Test/testdll01/Class1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace testdll01 6 | { 7 | public class Class1 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Test/testdll01/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("testdll01")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("testdll01")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("42bb2cbe-ace3-4f64-89be-e94afeff35b6")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Test/testdll01/TestClass.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.0 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | using System; 11 | using test01; 12 | using UnityEngine; 13 | namespace HoxFixCode 14 | { 15 | public class TestClass 16 | { 17 | public int name = 213; 18 | public int v2 = 33; 19 | public TestClass() 20 | { 21 | } 22 | 23 | public static void Test1() 24 | { 25 | Interface.Test1(); 26 | } 27 | Transform transform = null; 28 | public void Test2() 29 | { 30 | v2++; 31 | Interface.Test2(); 32 | if (transform == null) 33 | { 34 | Console.WriteLine("fuu"); 35 | GameObject go = new GameObject(); 36 | transform = go.transform; 37 | } 38 | //Vector3 vector3 = new Vector3(0, 0, 0); 39 | //transform.localPosition = vector3; 40 | } 41 | 42 | public void Test3(int abc, string def) 43 | { 44 | Console.WriteLine(def + "=" + abc); 45 | Interface.SetMyType(CreateMyI()); 46 | Interface.UseType(); 47 | } 48 | public static Interface.IMyType CreateMyI() 49 | { 50 | return new myi(); 51 | } 52 | public class myi : Interface.IMyType 53 | { 54 | string name = ""; 55 | public string GetName() 56 | { 57 | return name; 58 | } 59 | 60 | public string GetDesc() 61 | { 62 | return "crossbind very cool."; 63 | } 64 | public void SetName(string name) 65 | { 66 | this.name = name; 67 | } 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /UnitTest/CLScriptExt/Country.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnitTest; 5 | 6 | namespace CLScriptExt 7 | { 8 | public enum Country:ushort 9 | { 10 | Chinese, 11 | English, 12 | Japnese, 13 | }; 14 | public class UserData 15 | { 16 | public static void ShowContry(Country c) 17 | { 18 | Logger.Log(c.ToString()); 19 | } 20 | public static UserData g_this = new UserData(); 21 | public static UserData Instance() 22 | { 23 | return g_this; 24 | } 25 | public Dictionary HeroDataMap = new Dictionary(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /UnitTest/CLScriptExt/MyClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using System.Reflection.Emit; 5 | using System.Text; 6 | 7 | 8 | 9 | public class MyClass2 10 | { 11 | public static bool b; 12 | public static char bc; 13 | public static byte bb; 14 | public static sbyte bsb; 15 | public static Int16 bi16; 16 | public static UInt16 bu16; 17 | public static Int32 bi32; 18 | public static UInt32 bu32; 19 | public static Int64 bi64; 20 | public static UInt64 bu64; 21 | 22 | } 23 | public class config 24 | { 25 | public static int Cell(double i) 26 | { 27 | return (int)i; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /UnitTest/CLScriptExt/Student.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CLScriptExt 6 | { 7 | public class P1 8 | { 9 | public static void t1() 10 | { 11 | 12 | } 13 | public static int t2; 14 | public static int t3 15 | { 16 | get; 17 | set; 18 | } 19 | } 20 | public class P2 : P1 21 | { 22 | public static void TestS() 23 | { 24 | Console.WriteLine(typeof(T).ToString()); 25 | } 26 | public static void TestS2() 27 | { 28 | Console.WriteLine(typeof(T1).ToString() + "," + typeof(T2).ToString()); 29 | } 30 | } 31 | public class MyClass2 32 | { 33 | public static MyClass2 instance = new MyClass2(); 34 | 35 | public T GetComponent(MyClass2 obj, int deep) 36 | { 37 | return default(T); 38 | } 39 | } 40 | 41 | 42 | public class Student : P2 43 | { 44 | public void Test(string str,int i=0) 45 | { 46 | Console.WriteLine("str=" + i); 47 | } 48 | public class StudentAss 49 | { 50 | public int size = 10; 51 | 52 | } 53 | public string name 54 | { 55 | get; 56 | set; 57 | } 58 | public static int page; 59 | public int age; 60 | public class S1 61 | { 62 | public int v; 63 | } 64 | public List vs = new List(); 65 | public int[] vs2 = new int[] { 1, 2, 3, 4 }; 66 | 67 | public void ToString2() 68 | { 69 | 70 | } 71 | public void ToString2(T obj) 72 | { 73 | Console.WriteLine(obj.ToString()); 74 | } 75 | 76 | 77 | 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /UnitTest/CLScriptExt/TestClass.cs: -------------------------------------------------------------------------------- 1 |  2 | using CLRSharp; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | using System.Text; 7 | using System.Threading; 8 | using UnitTest; 9 | 10 | 11 | public class TestClass 12 | { 13 | public TestClass() 14 | { 15 | } 16 | 17 | public TestClass(byte b) 18 | { 19 | } 20 | 21 | public string name 22 | { 23 | get 24 | { 25 | return "hi"; 26 | } 27 | set 28 | { 29 | Logger.Log(value); 30 | } 31 | } 32 | public bool b; 33 | public string ttc = "123"; 34 | 35 | private static TestClass g_this = null; 36 | public static TestClass instance 37 | { 38 | get 39 | { 40 | if(g_this==null) 41 | { 42 | g_this = new TestClass(); 43 | } 44 | return g_this; 45 | } 46 | } 47 | int i = 0; 48 | public void Log() 49 | { 50 | i++; 51 | Logger.Log("i=" + i); 52 | } 53 | public static bool TF(bool b) 54 | { 55 | return b; 56 | } 57 | 58 | public static void TestObjectArg(Object o) 59 | { 60 | bool b = (bool)o; 61 | } 62 | 63 | public static void TestByteArg(byte b) 64 | { 65 | } 66 | 67 | public static void StartThread(Action action) 68 | { 69 | Thread t = new Thread(new ThreadStart( 70 | () => 71 | { 72 | if (ThreadContext.activeContext == null) 73 | { 74 | ThreadContext c = new ThreadContext(Form1.g_this.env); 75 | } 76 | action(); 77 | })); 78 | t.Start(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /UnitTest/CLScriptExt/TestDele.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | 6 | public class TestDele 7 | { 8 | public static TestDele instance 9 | { 10 | get 11 | { 12 | if (g_this == null) 13 | g_this = new TestDele(); 14 | return g_this; 15 | } 16 | } 17 | static TestDele g_this = null; 18 | public delegate void myup(); 19 | public myup onUpdateD; 20 | 21 | public event myup onUpdate; 22 | public event Action onUpdate2; 23 | public delegate void Action2(T1 p1, T2 p2); 24 | public event Action2 onUpdate3; 25 | 26 | public void Run() 27 | { 28 | if (onUpdateD != null) 29 | onUpdateD(); 30 | if (onUpdate != null) 31 | onUpdate(); 32 | if (onUpdate2 != null) 33 | { 34 | onUpdate2(12346); 35 | } 36 | if (onUpdate3 != null) 37 | { 38 | onUpdate3(123, "hello world."); 39 | } 40 | } 41 | public void AddDele(Action dele) 42 | { 43 | onUpdate2 += dele; 44 | } 45 | public void AddDeleT(Action dele) 46 | { 47 | if (dele is Action) 48 | { 49 | onUpdate2 += dele as Action; 50 | } 51 | } 52 | 53 | public void AddDeleT3(Action2 dele) 54 | { 55 | if (dele is Action2) 56 | { 57 | onUpdate3 += dele as Action2; 58 | } 59 | } 60 | public void ClearDele() 61 | { 62 | onUpdate = null; 63 | onUpdate2 = null; 64 | onUpdate3 = null; 65 | 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /UnitTest/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace UnitTest 6 | { 7 | public class Logger 8 | { 9 | public static void Log(string str) 10 | { 11 | Form1.g_this.Log(str); 12 | } 13 | public static void test(ulong dod) 14 | { 15 | 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /UnitTest/Perform/Perform.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace UnitTest.Perform 8 | { 9 | public delegate void Action(); 10 | public class Perform 11 | { 12 | 13 | public static double PerformSystem01(int count) 14 | { 15 | DateTime t0 = DateTime.Now; 16 | for (int i = 0; i < count; i++) 17 | { 18 | GameObject go = new GameObject(); 19 | UnityEngine.GameObject.Destory(go); 20 | } 21 | double o = (DateTime.Now - t0).TotalSeconds; 22 | Logger.Log("time=" + o); 23 | return o; 24 | } 25 | public static double PerformSystem02(int count) 26 | { 27 | DateTime t0 = DateTime.Now; 28 | for (int i = 0; i < count; i++) 29 | { 30 | Vector3 p; 31 | p.x = 1; 32 | p.y = 2; 33 | p.z = 3; 34 | } 35 | double o = (DateTime.Now - t0).TotalSeconds; 36 | Logger.Log("time=" + o); 37 | return o; 38 | } 39 | public static double PerformSystem03(int count) 40 | { 41 | DateTime t0 = DateTime.Now; 42 | for (int c = 0; c < count; c++) 43 | { 44 | double num = 1.11111f; 45 | for (int i = 0; i < 1000; i++) 46 | { 47 | num *= 1.01f; 48 | } 49 | } 50 | double o = (DateTime.Now - t0).TotalSeconds; 51 | Logger.Log("time=" + o); 52 | return o; 53 | } 54 | public static double Call(Action act, int count) 55 | { 56 | DateTime t0 = DateTime.Now; 57 | for (int i = 0; i < count; i++) 58 | { 59 | act(); 60 | } 61 | double o = (DateTime.Now - t0).TotalSeconds; 62 | Logger.Log("time=" + o); 63 | return o; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /UnitTest/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | 5 | namespace UnitTest 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// 应用程序的主入口点。 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | Application.EnableVisualStyles(); 16 | Application.SetCompatibleTextRenderingDefault(false); 17 | Application.Run(new Form1()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /UnitTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("UnitTest")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("UnitTest")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("6a77d1d8-ba2f-4856-ab95-4989c3c736cb")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /UnitTest/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.0 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace UnitTest.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /UnitTest/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /UnitTest/SimU3D/GameObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace UnityEngine 6 | { 7 | public sealed class GameObject 8 | { 9 | Dictionary component = new Dictionary(); 10 | public GameObject() 11 | { 12 | component["trans"] = new Transform(); 13 | } 14 | public GameObject(short s) 15 | { 16 | component["trans"] = new Transform(); 17 | this.id = s; 18 | } 19 | short id; 20 | public short GetId() 21 | { 22 | return id; 23 | } 24 | public void Destory() 25 | { 26 | component.Clear(); 27 | } 28 | public Transform transform 29 | { 30 | get 31 | { 32 | return component["trans"] as Transform; 33 | } 34 | } 35 | public static void Destory(GameObject obj) 36 | { 37 | obj.Destory(); 38 | } 39 | 40 | } 41 | public class Component 42 | { 43 | 44 | } 45 | public class Transform:Component 46 | { 47 | public Transform() 48 | { 49 | 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /UnitTest/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /UnitTestConsole/CLScriptExt/Country.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnitTest; 5 | using UnitTestConsole; 6 | 7 | namespace CLScriptExt 8 | { 9 | public enum Country:ushort 10 | { 11 | Chinese, 12 | English, 13 | Japnese, 14 | }; 15 | public class UserData 16 | { 17 | public static void ShowContry(Country c) 18 | { 19 | Logger.Log(c.ToString()); 20 | } 21 | public static UserData g_this = new UserData(); 22 | public static UserData Instance() 23 | { 24 | return g_this; 25 | } 26 | public Dictionary HeroDataMap = new Dictionary(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /UnitTestConsole/CLScriptExt/MyClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using System.Reflection.Emit; 5 | using System.Text; 6 | 7 | 8 | 9 | public class MyClass2 10 | { 11 | 12 | } 13 | public class config 14 | { 15 | public static int Cell(double i) 16 | { 17 | return (int)i; 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /UnitTestConsole/CLScriptExt/Student.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CLScriptExt 6 | { 7 | public class P1 8 | { 9 | public static void t1() 10 | { 11 | 12 | } 13 | public static int t2; 14 | public static int t3 15 | { 16 | get; 17 | set; 18 | } 19 | } 20 | public class P2 : P1 21 | { 22 | public static void TestS() 23 | { 24 | Console.WriteLine(typeof(T).ToString()); 25 | } 26 | public static void TestS2() 27 | { 28 | Console.WriteLine(typeof(T1).ToString() + "," + typeof(T2).ToString()); 29 | } 30 | } 31 | public class MyClass2 32 | { 33 | public static MyClass2 instance = new MyClass2(); 34 | 35 | public T GetComponent(MyClass2 obj, int deep) 36 | { 37 | return default(T); 38 | } 39 | } 40 | 41 | 42 | public class Student : P2 43 | { 44 | public void Test(string str,int i=0) 45 | { 46 | Console.WriteLine("str=" + i); 47 | } 48 | public class StudentAss 49 | { 50 | public int size = 10; 51 | 52 | } 53 | public string name 54 | { 55 | get; 56 | set; 57 | } 58 | public static int page; 59 | public int age; 60 | public class S1 61 | { 62 | public int v; 63 | } 64 | public List vs = new List(); 65 | public int[] vs2 = new int[] { 1, 2, 3, 4 }; 66 | 67 | public void ToString2() 68 | { 69 | 70 | } 71 | public void ToString2(T obj) 72 | { 73 | Console.WriteLine(obj.ToString()); 74 | } 75 | 76 | 77 | 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /UnitTestConsole/CLScriptExt/TestClass.cs: -------------------------------------------------------------------------------- 1 |  2 | using CLRSharp; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | using System.Text; 7 | using System.Threading; 8 | using UnitTest; 9 | using UnitTestConsole; 10 | 11 | 12 | public class TestClass 13 | { 14 | public TestClass() 15 | { 16 | } 17 | 18 | public TestClass(byte b) 19 | { 20 | } 21 | 22 | public string name 23 | { 24 | get 25 | { 26 | return "hi"; 27 | } 28 | set 29 | { 30 | Logger.Log(value); 31 | } 32 | } 33 | public bool b; 34 | public string ttc = "123"; 35 | 36 | private static TestClass g_this = null; 37 | public static TestClass instance 38 | { 39 | get 40 | { 41 | if(g_this==null) 42 | { 43 | g_this = new TestClass(); 44 | } 45 | return g_this; 46 | } 47 | } 48 | int i = 0; 49 | public void Log() 50 | { 51 | i++; 52 | Logger.Log("i=" + i); 53 | } 54 | public static bool TF(bool b) 55 | { 56 | return b; 57 | } 58 | 59 | public static void TestObjectArg(Object o) 60 | { 61 | bool b = (bool)o; 62 | } 63 | 64 | public static void TestByteArg(byte b) 65 | { 66 | } 67 | 68 | public static void StartThread(Action action) 69 | { 70 | Thread t = new Thread(new ThreadStart( 71 | () => 72 | { 73 | if (ThreadContext.activeContext == null) 74 | { 75 | ThreadContext c = new ThreadContext(Program.env); 76 | } 77 | action(); 78 | })); 79 | t.Start(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /UnitTestConsole/CLScriptExt/TestDele.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | 6 | public class TestDele 7 | { 8 | public static TestDele instance 9 | { 10 | get 11 | { 12 | if (g_this == null) 13 | g_this = new TestDele(); 14 | return g_this; 15 | } 16 | } 17 | static TestDele g_this = null; 18 | public delegate void myup(); 19 | public myup onUpdateD; 20 | 21 | public event myup onUpdate; 22 | public event Action onUpdate2; 23 | public delegate void Action2(T1 p1, T2 p2); 24 | public event Action2 onUpdate3; 25 | 26 | public void Run() 27 | { 28 | if (onUpdateD != null) 29 | onUpdateD(); 30 | if (onUpdate != null) 31 | onUpdate(); 32 | if (onUpdate2 != null) 33 | { 34 | onUpdate2(12346); 35 | } 36 | if (onUpdate3 != null) 37 | { 38 | onUpdate3(123, "hello world."); 39 | } 40 | } 41 | public void AddDele(Action dele) 42 | { 43 | onUpdate2 += dele; 44 | } 45 | public void AddDeleT(Action dele) 46 | { 47 | if (dele is Action) 48 | { 49 | onUpdate2 += dele as Action; 50 | } 51 | } 52 | 53 | public void AddDeleT3(Action2 dele) 54 | { 55 | if (dele is Action2) 56 | { 57 | onUpdate3 += dele as Action2; 58 | } 59 | } 60 | public void ClearDele() 61 | { 62 | onUpdate = null; 63 | onUpdate2 = null; 64 | onUpdate3 = null; 65 | 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /UnitTestConsole/Perform/Perform.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTestConsole; 6 | using UnityEngine; 7 | 8 | namespace UnitTest.Perform 9 | { 10 | public delegate void Action(); 11 | public class Perform 12 | { 13 | 14 | public static double PerformSystem01(int count) 15 | { 16 | DateTime t0 = DateTime.Now; 17 | for (int i = 0; i < count; i++) 18 | { 19 | GameObject go = new GameObject(); 20 | UnityEngine.GameObject.Destory(go); 21 | } 22 | double o = (DateTime.Now - t0).TotalSeconds; 23 | Logger.Log("time=" + o); 24 | return o; 25 | } 26 | public static double PerformSystem02(int count) 27 | { 28 | DateTime t0 = DateTime.Now; 29 | for (int i = 0; i < count; i++) 30 | { 31 | Vector3 p; 32 | p.x = 1; 33 | p.y = 2; 34 | p.z = 3; 35 | } 36 | double o = (DateTime.Now - t0).TotalSeconds; 37 | Logger.Log("time=" + o); 38 | return o; 39 | } 40 | public static double PerformSystem03(int count) 41 | { 42 | DateTime t0 = DateTime.Now; 43 | for (int c = 0; c < count; c++) 44 | { 45 | double num = 1.11111f; 46 | for (int i = 0; i < 1000; i++) 47 | { 48 | num *= 1.01f; 49 | } 50 | } 51 | double o = (DateTime.Now - t0).TotalSeconds; 52 | Logger.Log("time=" + o); 53 | return o; 54 | } 55 | public static double Call(Action act, int count) 56 | { 57 | DateTime t0 = DateTime.Now; 58 | for (int i = 0; i < count; i++) 59 | { 60 | act(); 61 | } 62 | double o = (DateTime.Now - t0).TotalSeconds; 63 | Logger.Log("time=" + o); 64 | return o; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /UnitTestConsole/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("UnitTestConsole")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("UnitTestConsole")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("e3d74fa7-576d-4c7e-8399-92728762a957")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /UnitTestConsole/SimU3D/GameObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace UnityEngine 6 | { 7 | public sealed class GameObject 8 | { 9 | Dictionary component = new Dictionary(); 10 | public GameObject() 11 | { 12 | component["trans"] = new Transform(); 13 | } 14 | public GameObject(short s) 15 | { 16 | component["trans"] = new Transform(); 17 | this.id = s; 18 | } 19 | short id; 20 | public short GetId() 21 | { 22 | return id; 23 | } 24 | public void Destory() 25 | { 26 | component.Clear(); 27 | } 28 | public Transform transform 29 | { 30 | get 31 | { 32 | return component["trans"] as Transform; 33 | } 34 | } 35 | public static void Destory(GameObject obj) 36 | { 37 | obj.Destory(); 38 | } 39 | 40 | } 41 | public class Component 42 | { 43 | 44 | } 45 | public class Transform:Component 46 | { 47 | public Transform() 48 | { 49 | 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /UnitTestConsole/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test01/Test01.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using System; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using UnitTest; 7 | 8 | public class Script_TestConstructor 9 | { 10 | string abc = ("dd" as string).ToString(); 11 | private int[] a = new int[] { 1, 3, 4 }; 12 | public static int[] b = new int[234]; 13 | public static Dictionary objs = new Dictionary(); 14 | public static Dictionary dicHasBlock = new Dictionary(); 15 | 16 | public static List objs2 = new List(); 17 | public Script_TestConstructor() 18 | { 19 | Dictionary objs = new Dictionary(); 20 | //Test(); 21 | ////Debug.Log(null); 22 | //Test2(); 23 | //Test3(22, 33, 44); 24 | objs.Add("abb",this); 25 | objs2.Add(this); 26 | Script_TestConstructor thisislist= objs["abb"] as Script_TestConstructor; 27 | thisislist.LogtT(); 28 | } 29 | public int[] TTT(int[] ttt) 30 | { 31 | return ttt; 32 | } 33 | public void LogtT() 34 | { 35 | Logger.Log("LogtT"); 36 | } 37 | public static void Test3(int a, int b, int c) 38 | { 39 | ////// 这个是正确的. 40 | int v = (a * (b + 1)) * (c + 2); 41 | int value1 = config.Cell(v); 42 | Logger.Log("value1=>" + value1); 43 | 44 | ////// 发生运行时错误 => 找不到 CeilToInt 方法. 45 | int value2 = config.Cell((a * (b + 1)) * (c + 2)); 46 | Logger.Log("value2=>" + value2); 47 | } 48 | public bool Test() 49 | { 50 | return false; 51 | } 52 | 53 | public static void Test2() 54 | { 55 | for (int i = 0; i < 10; i++) 56 | { 57 | TestClass.instance.Log(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test01/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试完成Helloworld. 2 | 3 | 4 | Script_TestConstructor tc= new Script_TestConstructor(); -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test02/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试完成Delegate. 2 | //脚本通过各种方式向程序中添加回调 3 | 4 | Test02.Run(); -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test03/Test03.cs: -------------------------------------------------------------------------------- 1 |  2 | //using CSEvilTestor; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | class Test03 8 | { 9 | public static void Run() 10 | { 11 | List list1 = new List();//c#Light 不支持模板,所以这里要注意一下 12 | //List 可以 List < int > 有空格不可以 13 | list1.Add(1); 14 | list1.Add(2); 15 | list1.Add(3); 16 | List> list2 = new List>(); 17 | 18 | list2.Add(list1); 19 | List>> list3 = new List>>(); 20 | list3.Add(list2); 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test03/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试测试一些奇特的类型名 2 | //List 3 | //List> 4 | //List>> 5 | 6 | Test03.Run(); -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test04/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试测试接口继承 2 | 3 | Test04.Run(); -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test05/Test05.cs: -------------------------------------------------------------------------------- 1 |  2 | //using CSEvilTestor; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using UnitTest; 7 | 8 | class Test05 9 | { 10 | public static void Run() 11 | { 12 | if (c5 == null) 13 | { 14 | c5 = new C5(); 15 | 16 | } 17 | try 18 | { 19 | 20 | 21 | throw new NotImplementedException("E2"); 22 | } 23 | catch (NotSupportedException err) 24 | { 25 | Logger.Log("not here."); 26 | } 27 | catch (NotImplementedException err) 28 | { 29 | Logger.Log("Got."); 30 | } 31 | catch (Exception err) 32 | { 33 | Logger.Log("Got 2."); 34 | } 35 | } 36 | static C5 c5 = null; 37 | } 38 | 39 | class C5 40 | { 41 | 42 | } 43 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test05/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试测试try catch throw 2 | Test05.Run(); -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test06/Test06.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using UnitTest; 7 | 8 | public class ReturnClass 9 | { 10 | public static ReturnClass ins; 11 | } 12 | 13 | public class Block 14 | { 15 | public Block(string name, int blockType, int inLayer, bool canMove, string imgName) 16 | { 17 | blockName = name; 18 | type = blockType; 19 | layer = inLayer; 20 | move = canMove; 21 | spriteName = imgName; 22 | Dictionary> dic = new Dictionary>(); 23 | Action function = Function; 24 | dic.Add(1, function); 25 | ReturnClass.ins = FunReturnClas(); 26 | } 27 | 28 | public static void Function(MyClass2 i) 29 | { 30 | } 31 | 32 | public static ReturnClass FunReturnClas() 33 | { 34 | ReturnClass r = new ReturnClass(); 35 | Logger.Log("====+++++++++++++++"); 36 | return r; 37 | } 38 | 39 | public string blockName; 40 | public string spriteName; 41 | public int type; 42 | public int layer; 43 | public bool move; 44 | } 45 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test06/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试测试 2 | 3 | 4 | Dictionary dicNameToBlock = new Dictionary(); 5 | Block b = new Block("gg1", 2, 3, true, "2"); 6 | dicNameToBlock.Add("1", b); 7 | 8 | foreach (var item in dicNameToBlock) 9 | { 10 | Debug.Log("key="+item.Key); 11 | Block bb = item.Value as Block; 12 | Debug.Log("bb.name="+bb.blockName); 13 | } 14 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test07/Test07.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | 7 | class Test07 8 | { 9 | public void Run() 10 | { 11 | Logger.Log("===-----------==="); 12 | Fun1(); 13 | } 14 | //static C5 c5 = null; 15 | 16 | public void Fun1() 17 | { 18 | Logger.Log("Fun1 in"); 19 | Fun2(); 20 | Logger.Log("Fun1 out"); 21 | } 22 | 23 | 24 | int _pix = int.MinValue; 25 | int _piy = int.MinValue; 26 | public void Fun2() 27 | { 28 | Logger.Log("Fun3 in"); // !!!!!!!!!!!!!!没有了 29 | int pix = 0; 30 | int piy = 0; 31 | if (pix == _pix && piy == _piy) 32 | { 33 | return; 34 | } 35 | 36 | Logger.Log("Fun3"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test07/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试测试try catch throw 2 | Test07 t = new Test07(); 3 | t.Run(); -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test08/Test08.cs: -------------------------------------------------------------------------------- 1 |  2 | using CLScriptExt; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using UnitTest; 7 | 8 | class T04 9 | { 10 | public void Test() 11 | { 12 | Logger.Log("tcall:" + name); 13 | } 14 | public string name; 15 | } 16 | class Test08 17 | { 18 | public int i; 19 | public Test08() 20 | { 21 | i = 5; 22 | } 23 | public Color32 vv; 24 | public void Call() 25 | { 26 | Logger.Log("i=" + i); 27 | } 28 | public static void F() 29 | { 30 | Test08 tt = new Test08(); 31 | tt.Call(); 32 | tt.vv = new Color32(1,1,1,1);//.FromArgb(1); 33 | 34 | tlist = new List(); 35 | tlist.Add(new T04()); 36 | tlist[0].name="cool"; 37 | tlist.Add(new T04()); 38 | tlist[1].name = "fuck"; 39 | Logger.Log("tt:" + tlist[0].name); 40 | tlist[1].Test(); 41 | } 42 | /// 43 | /// T04 44 | /// 45 | static List tlist; 46 | } 47 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test08/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试测试try catch throw 2 | 3 | 4 | Test08.F(); 5 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test09/Test09.cs: -------------------------------------------------------------------------------- 1 |  2 | using CLScriptExt; 3 | using CSEvilTestor.testfunc; 4 | //using CSEvilTestor; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using UnitTest; 9 | 10 | 11 | class Like 12 | { 13 | public string name; 14 | public string desc; 15 | } 16 | class Love 17 | { 18 | public int id; 19 | } 20 | class TSave 21 | { 22 | public string name; 23 | public int age; 24 | public Love love; 25 | public List like; 26 | public List strs; 27 | public Dictionary sths; 28 | } 29 | class Test09 30 | { 31 | public Color32 vv; 32 | 33 | public static void Test() 34 | { 35 | MyJson.JsonNode_Object objst = MyJson.Parse 36 | ("{\"sths\":{\"a\":\"001\",\"b\":\"002\"},\"love\":{\"id\":12345}\"name\":\"aname\",\"age\":123,\"like\":[{\"name\":\"aaa\",\"desc\":\"aaaaaa\"},{\"name\":\"bbb\",\"desc\":\"bbbbbb\"}],\"strs\":[\"aa\",\"bb\"]}") 37 | as MyJson.JsonNode_Object; 38 | 39 | //throw new NotImplementedException("仍然未改写"); 40 | TSave read = LSharpConvert.FromJson(typeof(TSave), objst) as TSave; 41 | 42 | Logger.Log("read.sths[\"a\"]=" + read.sths["a"]); 43 | Logger.Log("read.name=" + read.name); 44 | Logger.Log("read.like[0].name=" + read.like[0].name); 45 | Like l = read.like[0]; 46 | Logger.Log(l.name); 47 | 48 | Logger.Log("read.strs[1]=" + read.strs[1]); 49 | Logger.Log("read.love.id=" + read.love.id); 50 | Logger.Log("write" + LSharpConvert.ToJson(read).ToString()); 51 | } 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test09/test.txt: -------------------------------------------------------------------------------- 1 | //这个测试测试try catch throw 2 | 3 | 4 | Test09.Test(); 5 | -------------------------------------------------------------------------------- /UnitTestDll/Eviltestor/test10.cs: -------------------------------------------------------------------------------- 1 | using UnitTest; 2 | class Test10 3 | { 4 | private int i = 0; 5 | short j = 0; 6 | long k = 0; 7 | public Test10() 8 | { 9 | i = 10; 10 | j = 35; 11 | k = 58; 12 | } 13 | 14 | public void Debug() 15 | { 16 | Logger.Log(i.ToString()); 17 | } 18 | 19 | public static void TestInnerClass() 20 | { 21 | new InnerClass(); 22 | } 23 | 24 | public class InnerClass 25 | { 26 | public InnerClass() 27 | { 28 | 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /UnitTestDll/LightTestor/ExpTest_10.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | namespace UnitTestDll 7 | { 8 | //原来C#LightTestor的部分 9 | public class ExpTest_10 10 | { 11 | //只要有一个静态函数包含UnitTest名称的,就作为单元测试 12 | public static object UnitTest_1001() 13 | { 14 | //1001 _1001_expression 15 | return 1 + 2 > 3 / 4; 16 | 17 | } 18 | public static object UnitTest_1002() 19 | { 20 | //1002 _1002_expression 21 | 22 | int a = (int)(Math.Pow(1.4f, 5) * 5f); 23 | 24 | Vector3 v3 = new Vector3((252.0f / 255.0f), (207.0f / 255.0f), (20.0f / 255.0f)); 25 | Logger.Log("v3=" + v3); 26 | return (2 + 55) * 3434; 27 | 28 | } 29 | public static object UnitTest_1003() 30 | { 31 | //1003 _1003_expression 32 | return 1 + 2 * 2 + 55 * 3434 + (2 - 3) - (3 - 3) + 5; 33 | 34 | } 35 | public static object UnitTest_1004() 36 | { 37 | //1004 _1004_expression 38 | string a = "abc"; 39 | string b = "abd"; 40 | 41 | return "str=" + a + b; 42 | 43 | } 44 | public static object UnitTest_1005() 45 | { 46 | float s = 0.2f; 47 | if (s <= 0f || s >= 2f) 48 | { 49 | Logger.Log(""+1); 50 | } 51 | else 52 | { 53 | Logger.Log(""+2); 54 | } 55 | return 1; 56 | } 57 | 58 | public static void UnitTest_1006() 59 | { 60 | byte b = 11; 61 | b.ToString(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /UnitTestDll/LightTestor/ExpTest_20.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | namespace UnitTestDll 7 | { 8 | public class ExpTest_20 9 | { 10 | //只要有一个静态函数包含UnitTest名称的,就作为单元测试 11 | public static void UnitTest_2001() 12 | { 13 | //2001 define and set. 14 | 15 | int inta = 0; 16 | int intb = 0; 17 | int intc = inta; 18 | bool boola = false; 19 | bool boolb = true; 20 | bool boolc = boola; 21 | string stra = ""; 22 | string strb = "oo中o"; 23 | string strc = stra; 24 | char ca = 'd'; 25 | 26 | return; 27 | 28 | } 29 | public static object UnitTest_2002() 30 | { 31 | int a; 32 | a = 5; 33 | 34 | return a; 35 | 36 | } 37 | public static object UnitTest_2003() 38 | { 39 | float b = (float)1; 40 | var c = b; 41 | 42 | return c; 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /UnitTestDll/LightTestor/ExpTest_30.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | namespace UnitTestDll 7 | { 8 | public class ExpTest_30 9 | { 10 | //只要有一个静态函数包含UnitTest名称的,就作为单元测试 11 | public static object UnitTest_3001() 12 | { 13 | TT t; 14 | t.abc = 1.0f; 15 | int i = 4; 16 | int c = 5; 17 | DateTime t1 = DateTime.Now; 18 | DateTime t2 = DateTime.Now; 19 | TimeSpan sp = t2 - t1; 20 | bool b = (i < 3 || c <= 5) && 1 < 2; 21 | return b; 22 | 23 | } 24 | public static object UnitTest_3002() 25 | { 26 | //3002 27 | 28 | byte b = 12; 29 | byte bt =(byte)( b + 3); 30 | Logger.Log ("b=" + b + " bt=" + bt); 31 | 32 | sbyte sb = -12; 33 | sbyte sb2 = (sbyte)(bt + b); 34 | Logger.Log("sb=" + sb + " sb2=" + sb2); 35 | 36 | short ssb = 123; 37 | short ssb2 =(short)( ssb + 4); 38 | Logger.Log("ssb=" + ssb + " ssb2=" + ssb2); 39 | 40 | Student s = new Student(); 41 | for (int i = 0; i < 10; i++) 42 | { 43 | s.age++; 44 | Logger.Log(s.age.ToString()); 45 | } 46 | for (int i = 0; i < 10; i++) 47 | { 48 | Student.page++; 49 | Logger.Log(Student.page.ToString()); 50 | } 51 | 52 | return 0; 53 | } 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /UnitTestDll/LightTestor/ExpTest_50.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | namespace UnitTestDll 7 | { 8 | public class ExpTest_50 9 | { 10 | //只要有一个静态函数包含UnitTest名称的,就作为单元测试 11 | public static object UnitTest_5001() 12 | { 13 | //5001 function 14 | //trace的两种用法 15 | int b = 50; 16 | Logger.Log("this is trace");//trace 只有一个参数时可以用空格; 17 | Logger.Log("test sth" + b); 18 | Logger.Log("test sth2" + "," + b);//trace 多个参数必须用函数调用语法 19 | 20 | return b; 21 | } 22 | public static void UnitTest_5002() 23 | { 24 | //5002 function 25 | //函数原型 testCallAdd(int a, int b) 26 | int b = 1 + 5; 27 | int c = (1 + (int)5.0f); 28 | int d = (1 + (int)5.0f); 29 | Logger.Log(b + "," + c + "," + d); 30 | 31 | 32 | return; 33 | } 34 | public static void UnitTest_5003() 35 | { 36 | //5003 function 37 | //函数原型 int testCallAdd4(int a, int b, int c = 0, int d = 0) 38 | int b = (1 + 5 + 1 + 1); 39 | int c = (int)(1 + 5.0f + 2); 40 | int d = (int)(1 + 5.0f); 41 | Logger.Log(b + "," + c + "," + d); 42 | 43 | Action callnoname = (abc) => 44 | { 45 | 46 | Logger.Log("nonamecall abc=" + abc + "d=" + d); 47 | 48 | }; 49 | callnoname(44565); 50 | return; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /UnitTestDll/LightTestor/ExpTest_70.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | namespace UnitTestDll 7 | { 8 | public class ExpTest_70 9 | { 10 | //只要有一个静态函数包含UnitTest名称的,就作为单元测试 11 | public static void UnitTest_7001() 12 | { 13 | int[] ints3 = new int[] { 1, 2, 3 }; 14 | int v = ints3[0];// = 44; 15 | Logger.Log("=" + v); 16 | //7001 array 17 | List> list = new List>(); 18 | list.Add(new List()); 19 | list.Add(new List()); 20 | Logger.Log("listc=" + list.Count); 21 | list[0].Add(1); 22 | list[0].Add(2); 23 | list[0].Add(4); 24 | Logger.Log("i=" + list[0][1]); 25 | 26 | 27 | int[] ints2 = new int[3]; 28 | ints2[1] = 44; 29 | Logger.Log("=" + ints2[1]); 30 | 31 | 32 | } 33 | public static void UnitTest_7002() 34 | { 35 | //7001 array 36 | 37 | string[] ints2 = new string[] { "55", "55", "55" }; 38 | long i = 1; 39 | ints2[i] = "44"; 40 | Logger.Log("=" + ints2[i]); 41 | 42 | } 43 | public static object UnitTest_7003() 44 | { 45 | //7003 array 46 | 47 | Dictionary hip = new Dictionary(); 48 | hip[3] = "ff"; 49 | hip[5] = "fff"; 50 | hip[6] = "ffff"; 51 | 52 | foreach (var i in hip) 53 | { 54 | Logger.Log("key=" + i.Key + ",v=" + i.Value); 55 | } 56 | 57 | return 0; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /UnitTestDll/LightTestor/Perform_01.cs: -------------------------------------------------------------------------------- 1 | using CLScriptExt; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | using UnitTest.Perform; 7 | using UnityEngine; 8 | 9 | namespace UnitTestDll 10 | { 11 | class Perform_01 12 | { 13 | public static void UnitTest01() 14 | { 15 | int count = 100; 16 | double v1 = Perform.PerformSystem01(count); 17 | double v2 = Perform.PerformSystem02(count); 18 | double v3 = Perform.PerformSystem03(count); 19 | Logger.Log("timeSys=" + v1 + "," + v2 + "," + v3); 20 | 21 | double sv1 = Perform.Call(() => 22 | { 23 | GameObject go = new GameObject(); 24 | UnityEngine.GameObject.Destory(go); 25 | }, count); 26 | double sv2 = Perform.Call(() => 27 | { 28 | Vector3 p; 29 | p.x = 1; 30 | p.y = 2; 31 | p.z = 3; 32 | }, count); 33 | double sv3 = Perform.Call(() => 34 | { 35 | double num = 1.11111f; 36 | for (int i = 0; i < 1000; i++) 37 | { 38 | num *= 1.01f; 39 | } 40 | }, count); 41 | Logger.Log("timeSys=" + sv1 + "," + sv2 + "," + sv3); 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /UnitTestDll/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("UnitTestDll")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("UnitTestDll")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("f5c4f359-c32c-4d4e-93dc-e88430c06166")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /UnitTestDll/SimU3D/TestU3D.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnitTest; 5 | using UnityEngine; 6 | 7 | namespace UnitTestDll.SimU3D 8 | { 9 | class TestU3D 10 | { 11 | public static void UnitTest_01() 12 | { 13 | GameObject obj = new GameObject(); 14 | Logger.Log("c1=" + (obj == null)); 15 | Logger.Log("c2=" + (obj.transform == null)); 16 | TT t = new TT(); 17 | for (int i = 0; i < 10; i++) 18 | { 19 | t.Test(); 20 | } 21 | } 22 | } 23 | class TT 24 | { 25 | Transform tra = null; 26 | public void Test() 27 | { 28 | if (tra == null) 29 | { 30 | Logger.Log("c1=" + (tra == null)); 31 | GameObject obj = new GameObject(); 32 | tra = obj.transform; 33 | } 34 | else 35 | { 36 | Logger.Log("c1=" + (tra == null)); 37 | } 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /UnitTestDll/SimU3D/TestYield.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnitTest; 6 | 7 | namespace UnitTestDll.SimU3D 8 | { 9 | class TestYield 10 | { 11 | public static void UnitTest_01() 12 | { 13 | var vv = yoo(); 14 | Logger.Log("got"); 15 | foreach (var y in vv) 16 | { 17 | Logger.Log("y=" + y); 18 | } 19 | //var vv2 = yoo2("aa","bb"); 20 | 21 | } 22 | static IEnumerable yoo() 23 | { 24 | yield return "a"; 25 | yield return "b"; 26 | yield return "c"; 27 | } 28 | //static IEnumerator yoo2(string name,string name2) 29 | //{ 30 | // yield return "a"; 31 | // yield return "b"; 32 | // yield return "c"; 33 | //} 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /UnitTestDll/Test_ByLynn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnitTest; 6 | using System.Collections; 7 | 8 | namespace UnitTestDll 9 | { 10 | class Test_ByLynn 11 | { 12 | public static void UnitTest_01() 13 | { 14 | int[] arr = new int[10]; 15 | int[] arr2 = new int[11]; 16 | 17 | if ( arr[0] > arr2[0] ) 18 | { 19 | Logger.Log("1"); 20 | } 21 | else 22 | { 23 | Logger.Log("2"); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /UnitTestDll/test/TestClass.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.0 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | using System; 11 | namespace HoxFixCode 12 | { 13 | public class TestClass 14 | { 15 | public TestClass () 16 | { 17 | } 18 | 19 | public static void Test1 () 20 | { 21 | Interface.Test1 (); 22 | } 23 | 24 | public void Test2 () 25 | { 26 | Interface.Test2 (); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /UnitTestDll/test_RefOut.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnitTest; 3 | using System.Collections.Generic; 4 | 5 | namespace UnitTestDll 6 | { 7 | public class test_RefOut 8 | { 9 | private class UserDefClass 10 | { 11 | public int value01; 12 | public string value02 = ""; 13 | 14 | public void StringToValue(ref string v, string str) 15 | { 16 | v = str; 17 | } 18 | public void IntToValue(ref int v, int str) 19 | { 20 | v = str; 21 | } 22 | } 23 | 24 | 25 | public static void UnitTest_Out() 26 | { 27 | 28 | Dictionary dict = new Dictionary(); 29 | UserDefClass obj = new UserDefClass(); 30 | obj.value01 = 888; 31 | dict.Add(0, obj); 32 | UserDefClass testObj; 33 | if (dict.ContainsKey(0)) 34 | { 35 | testObj = dict[0]; 36 | Logger.Log(string.Format("Value01 : {0}", testObj.value01)); 37 | } 38 | 39 | Logger.Log("这个错误是无法避免的,UserDefClass是个脚本类型,他不能在字典的操作中以ref out来操作"); 40 | //if (dict.TryGetValue(0, out testObj)) 41 | //{ 42 | // Logger.Log("Test OK."); 43 | //} 44 | 45 | } 46 | 47 | public static void UnitTest_Ref() 48 | { 49 | UserDefClass obj = new UserDefClass(); 50 | 51 | string abc = "abc"; 52 | obj.StringToValue(ref abc, "test"); 53 | int i = 0; 54 | obj.IntToValue(ref i, 777); 55 | Logger.Log("abc=" + abc + "|i=" + i); 56 | 57 | } 58 | 59 | } 60 | } 61 | --------------------------------------------------------------------------------