public void SimpleWpfApplicationTest() { _stringSorter = new MoveStringsForSimpleWpfApplicationTest(); _typesOrder.AddRange(new[] { "<PrivateImplementationDetails>{75DDD5B0-8879-4688-82A2-E125CB344440}", "SimpleWPFApplicationSample.Resources", "SimpleWPFApplicationSample.Resources/BitmapResources", "SimpleWPFApplicationSample.GPIOButtonInputProvider", "SimpleWPFApplicationSample.GPIOButtonInputProvider/ButtonPad", "SimpleWPFApplicationSample.PresentationWindow", "SimpleWPFApplicationSample.StackPanelDemo", "SimpleWPFApplicationSample.StackPanelDemo/Cross", "SimpleWPFApplicationSample.Resources/FontResources", "SimpleWPFApplicationSample.CanvasPanelDemo", "SimpleWPFApplicationSample.FreeDrawingDemo", "SimpleWPFApplicationSample.MainMenuWindow", "SimpleWPFApplicationSample.MenuItem", "SimpleWPFApplicationSample.MenuItemPanel", "SimpleWPFApplicationSample.MySimpleWPFApplication", "SimpleWPFApplicationSample.ScrollPanelDemo", "SimpleWPFApplicationSample.ScrollerText", "SimpleWPFApplicationSample.TextScrollViewer", "SimpleWPFApplicationSample.Resources/StringResources", "<PrivateImplementationDetails>{75DDD5B0-8879-4688-82A2-E125CB344440}/__StaticArrayInitTypeSize=32", "<PrivateImplementationDetails>{75DDD5B0-8879-4688-82A2-E125CB344440}/__StaticArrayInitTypeSize=64", }); TestSingleAssembly("SimpleWPFApplication", "Microsoft.SPOT.Native", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Hardware"); }
/// <summary> /// Creates new instance of <see cref="TinyAssemblyBuilder"/> object. /// </summary> /// <param name="assemblyDefinition">Original assembly metadata in Mono.Cecil format.</param> /// <param name="explicitTypesOrder">List of full type names with explicit ordering.</param> /// <param name="stringSorter">Custom string literals sorter for UTs using only.</param> /// <param name="applyAttributesCompression"> /// If contains <c>true</c> each type/method/field should contains one attribute of each type. /// </param> public TinyAssemblyBuilder( AssemblyDefinition assemblyDefinition, List <String> explicitTypesOrder = null, ICustomStringSorter stringSorter = null, Boolean applyAttributesCompression = false) { _tablesContext = new TinyTablesContext( assemblyDefinition, explicitTypesOrder, stringSorter, applyAttributesCompression); }
/// <summary> /// Creates new instance of <see cref="TinyAssemblyBuilder"/> object. /// </summary> /// <param name="assemblyDefinition">Original assembly metadata in Mono.Cecil format.</param> /// <param name="explicitTypesOrder">List of full type names with explicit ordering.</param> /// <param name="stringSorter">Custom string literals sorter for UTs using only.</param> /// <param name="applyAttributesCompression"> /// If contains <c>true</c> each type/method/field should contains one attribute of each type. /// </param> public TinyAssemblyBuilder( AssemblyDefinition assemblyDefinition, List<String> explicitTypesOrder = null, ICustomStringSorter stringSorter = null, Boolean applyAttributesCompression = false) { _tablesContext = new TinyTablesContext( assemblyDefinition, explicitTypesOrder, stringSorter, applyAttributesCompression); }
public void StylusCaptureTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "StylusCaptureSample.Resources", "StylusCaptureSample.Resources/FontResources", "StylusCaptureSample.MyStylusCapture", "StylusCaptureSample.MyStylusCapture/MyWindow", "StylusCaptureSample.Resources/StringResources", "StylusCaptureSample.MyStylusCapture/MyWindow/point", }); TestSingleAssembly("StylusCapture", "Microsoft.SPOT.Native", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics"); }
public void HttpServerSampleTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "HttpServerSample.Resource1", "HttpServerSample.Resource1/BinaryResources", "HttpServerSample.MyHttpServer", "HttpServerSample.MyHttpServer/PrefixKeeper", "HttpServerSample.Resource1/StringResources", }); TestSingleAssembly("HTTPServer", "System.Http", "Microsoft.SPOT.Native", "Microsoft.SPOT.Update", "MFUpdate", "Microsoft.SPOT.IO"); }
public void SimpleServiceTest() { _stringSorter = new MoveStringsForSimpleServiceTest(); _typesOrder.AddRange(new[] { "<PrivateImplementationDetails>{3C01404A-A8E8-4D6C-94FD-61FAED567C73}", "Dpws.Device.Program", "Interop.SimpleService.SimpleDeviceHost", "<PrivateImplementationDetails>{3C01404A-A8E8-4D6C-94FD-61FAED567C73}/__StaticArrayInitTypeSize=4846", "schemas.example.org.AttachmentService.AttachmentService", "schemas.example.org.AttachmentService.IAttachmentService", "schemas.example.org.AttachmentService.AttachmentServiceImplementation", "schemas.example.org.AttachmentService.HelpIcon", "schemas.example.org.AttachmentService.OneWayAttachmentRequest", "schemas.example.org.AttachmentService.OneWayAttachmentRequestDataContractSerializer", "schemas.example.org.AttachmentService.TwoWayAttachmentRequest", "schemas.example.org.AttachmentService.TwoWayAttachmentRequestDataContractSerializer", "schemas.example.org.AttachmentService.TwoWayAttachmentResponse", "schemas.example.org.AttachmentService.TwoWayAttachmentResponseDataContractSerializer", "schemas.example.org.EventingService.EventSimulator", "schemas.example.org.EventingService.EventingService", "schemas.example.org.EventingService.IEventingService", "schemas.example.org.EventingService.IEventingServiceCallback", "schemas.example.org.EventingService.IntegerEventRequest", "schemas.example.org.EventingService.IntegerEventRequestDataContractSerializer", "schemas.example.org.EventingService.SimpleEventRequest", "schemas.example.org.EventingService.SimpleEventRequestDataContractSerializer", "schemas.example.org.SimpleService.AnyCheckRequest", "schemas.example.org.SimpleService.AnyCheckRequestDataContractSerializer", "schemas.example.org.SimpleService.AnyCheckResponse", "schemas.example.org.SimpleService.AnyCheckResponseDataContractSerializer", "schemas.example.org.SimpleService.ISimpleService", "schemas.example.org.SimpleService.OneWayRequest", "schemas.example.org.SimpleService.OneWayRequestDataContractSerializer", "schemas.example.org.SimpleService.SimpleService", "schemas.example.org.SimpleService.SimpleServiceImplementation", "schemas.example.org.SimpleService.TwoWayRequest", "schemas.example.org.SimpleService.TwoWayRequestDataContractSerializer", "schemas.example.org.SimpleService.TwoWayResponse", "schemas.example.org.SimpleService.TwoWayResponseDataContractSerializer", "schemas.example.org.SimpleService.TypeCheckRequest", "schemas.example.org.SimpleService.TypeCheckRequestDataContractSerializer", "schemas.example.org.SimpleService.TypeCheckResponse", "schemas.example.org.SimpleService.TypeCheckResponseDataContractSerializer" }); TestSingleAssembly("SimpleService", "MFWsStack", "MFDpwsDevice"); }
public void TouchScreenTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "TouchScreenSample.Resources", "TouchScreenSample.Resources/BitmapResources", "TouchScreenSample.Resources/FontResources", "TouchScreenSample.MyTouchScreen", "TouchScreenSample.MyTouchScreen/ScreenId", "TouchScreenSample.Resources/StringResources" }); TestSingleAssembly("TouchScreen", "Microsoft.SPOT.Touch", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Native"); }
public void TouchCalibrationTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "TouchCalibrationSample.GPIOButtonInputProvider", "TouchCalibrationSample.GPIOButtonInputProvider/ButtonPad", "TouchCalibrationSample.Resources", "TouchCalibrationSample.Resources/FontResources", "TouchCalibrationSample.MyTouchCalibration", "TouchCalibrationSample.MyTouchCalibration/MyWindow", "TouchCalibrationSample.Resources/StringResources", "TouchCalibrationSample.MyTouchCalibration/MyWindow/point" }); TestSingleAssembly("TouchCalibration", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Native", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Touch"); }
public void PuzzleSampleTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "<PrivateImplementationDetails>{143ADFEE-4589-467E-B091-DE1D534B7572}", "PuzzleSample.Resources", "PuzzleSample.Resources/BitmapResources", "PuzzleSample.MyPuzzle", "PuzzleSample.MyPuzzle/Button", "PuzzleSample.Resources/FontResources", "PuzzleSample.MyPuzzle/MyWindow", "PuzzleSample.MyPuzzle/PuzzleBoard", "PuzzleSample.Resources/StringResources", "<PrivateImplementationDetails>{143ADFEE-4589-467E-B091-DE1D534B7572}/__StaticArrayInitTypeSize=40" }); TestSingleAssembly("Puzzle", "Microsoft.SPOT.Native", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Ink", "Microsoft.SPOT.Touch"); }
public void TemperatureSampleTest() { _stringSorter = new MoveStringsForTemperatureSampleTest(); _typesOrder.AddRange(new[] { "TemperatureSample.Resources", "TemperatureSample.Resources/BitmapResources", "TemperatureSample.GPIOButtonInputProvider", "TemperatureSample.GPIOButtonInputProvider/ButtonPad", "TemperatureSample.Resources/FontResources", "TemperatureSample.StatusIndicator", "TemperatureSample.StatusIndicator/StatusType", "TemperatureSample.Resources/StringResources", "TemperatureSample.MyTemperature", "TemperatureSample.MyTemperature/TempMode", "TemperatureSample.BorderPanel", "TemperatureSample.SpiTemperatureSensor" }); TestSingleAssembly("TemperatureSample", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Native"); }
public void SimpleWpfApplicationTest() { _stringSorter = new MoveStringsForSimpleWpfApplicationTest(); _typesOrder.AddRange(new[] { "<PrivateImplementationDetails>{75DDD5B0-8879-4688-82A2-E125CB344440}", "SimpleWPFApplicationSample.Resources", "SimpleWPFApplicationSample.Resources/BitmapResources", "SimpleWPFApplicationSample.GPIOButtonInputProvider", "SimpleWPFApplicationSample.GPIOButtonInputProvider/ButtonPad", "SimpleWPFApplicationSample.PresentationWindow", "SimpleWPFApplicationSample.StackPanelDemo", "SimpleWPFApplicationSample.StackPanelDemo/Cross", "SimpleWPFApplicationSample.Resources/FontResources", "SimpleWPFApplicationSample.CanvasPanelDemo", "SimpleWPFApplicationSample.FreeDrawingDemo", "SimpleWPFApplicationSample.MainMenuWindow", "SimpleWPFApplicationSample.MenuItem", "SimpleWPFApplicationSample.MenuItemPanel", "SimpleWPFApplicationSample.MySimpleWPFApplication", "SimpleWPFApplicationSample.ScrollPanelDemo", "SimpleWPFApplicationSample.ScrollerText", "SimpleWPFApplicationSample.TextScrollViewer", "SimpleWPFApplicationSample.Resources/StringResources", "<PrivateImplementationDetails>{75DDD5B0-8879-4688-82A2-E125CB344440}/__StaticArrayInitTypeSize=32", "<PrivateImplementationDetails>{75DDD5B0-8879-4688-82A2-E125CB344440}/__StaticArrayInitTypeSize=64", }); TestSingleAssembly("SimpleWPFApplication", "Microsoft.SPOT.Native", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Hardware"); }
public void StylusCaptureTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "StylusCaptureSample.Resources", "StylusCaptureSample.Resources/FontResources", "StylusCaptureSample.MyStylusCapture", "StylusCaptureSample.MyStylusCapture/MyWindow", "StylusCaptureSample.Resources/StringResources", "StylusCaptureSample.MyStylusCapture/MyWindow/point", }); TestSingleAssembly("StylusCapture", "Microsoft.SPOT.Native", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics"); }
public void PuzzleSampleTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "<PrivateImplementationDetails>{143ADFEE-4589-467E-B091-DE1D534B7572}", "PuzzleSample.Resources", "PuzzleSample.Resources/BitmapResources", "PuzzleSample.MyPuzzle", "PuzzleSample.MyPuzzle/Button", "PuzzleSample.Resources/FontResources", "PuzzleSample.MyPuzzle/MyWindow", "PuzzleSample.MyPuzzle/PuzzleBoard", "PuzzleSample.Resources/StringResources", "<PrivateImplementationDetails>{143ADFEE-4589-467E-B091-DE1D534B7572}/__StaticArrayInitTypeSize=40" }); TestSingleAssembly("Puzzle", "Microsoft.SPOT.Native", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Ink", "Microsoft.SPOT.Touch"); }
public void SimpleServiceTest() { _stringSorter = new MoveStringsForSimpleServiceTest(); _typesOrder.AddRange(new[] { "<PrivateImplementationDetails>{3C01404A-A8E8-4D6C-94FD-61FAED567C73}", "Dpws.Device.Program", "Interop.SimpleService.SimpleDeviceHost", "<PrivateImplementationDetails>{3C01404A-A8E8-4D6C-94FD-61FAED567C73}/__StaticArrayInitTypeSize=4846", "schemas.example.org.AttachmentService.AttachmentService", "schemas.example.org.AttachmentService.IAttachmentService", "schemas.example.org.AttachmentService.AttachmentServiceImplementation", "schemas.example.org.AttachmentService.HelpIcon", "schemas.example.org.AttachmentService.OneWayAttachmentRequest", "schemas.example.org.AttachmentService.OneWayAttachmentRequestDataContractSerializer", "schemas.example.org.AttachmentService.TwoWayAttachmentRequest", "schemas.example.org.AttachmentService.TwoWayAttachmentRequestDataContractSerializer", "schemas.example.org.AttachmentService.TwoWayAttachmentResponse", "schemas.example.org.AttachmentService.TwoWayAttachmentResponseDataContractSerializer", "schemas.example.org.EventingService.EventSimulator", "schemas.example.org.EventingService.EventingService", "schemas.example.org.EventingService.IEventingService", "schemas.example.org.EventingService.IEventingServiceCallback", "schemas.example.org.EventingService.IntegerEventRequest", "schemas.example.org.EventingService.IntegerEventRequestDataContractSerializer", "schemas.example.org.EventingService.SimpleEventRequest", "schemas.example.org.EventingService.SimpleEventRequestDataContractSerializer", "schemas.example.org.SimpleService.AnyCheckRequest", "schemas.example.org.SimpleService.AnyCheckRequestDataContractSerializer", "schemas.example.org.SimpleService.AnyCheckResponse", "schemas.example.org.SimpleService.AnyCheckResponseDataContractSerializer", "schemas.example.org.SimpleService.ISimpleService", "schemas.example.org.SimpleService.OneWayRequest", "schemas.example.org.SimpleService.OneWayRequestDataContractSerializer", "schemas.example.org.SimpleService.SimpleService", "schemas.example.org.SimpleService.SimpleServiceImplementation", "schemas.example.org.SimpleService.TwoWayRequest", "schemas.example.org.SimpleService.TwoWayRequestDataContractSerializer", "schemas.example.org.SimpleService.TwoWayResponse", "schemas.example.org.SimpleService.TwoWayResponseDataContractSerializer", "schemas.example.org.SimpleService.TypeCheckRequest", "schemas.example.org.SimpleService.TypeCheckRequestDataContractSerializer", "schemas.example.org.SimpleService.TypeCheckResponse", "schemas.example.org.SimpleService.TypeCheckResponseDataContractSerializer" }); TestSingleAssembly("SimpleService", "MFWsStack", "MFDpwsDevice"); }
public void FtpServerSampleTest() { _stringSorter = new MoveStringsAfter("anon"); TestSingleAssembly("FtpServer", "System.Ftp", "Microsoft.SPOT.IO"); }
public void HttpServerSampleTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "HttpServerSample.Resource1", "HttpServerSample.Resource1/BinaryResources", "HttpServerSample.MyHttpServer", "HttpServerSample.MyHttpServer/PrefixKeeper", "HttpServerSample.Resource1/StringResources", }); TestSingleAssembly("HTTPServer", "System.Http", "Microsoft.SPOT.Native", "Microsoft.SPOT.Update", "MFUpdate", "Microsoft.SPOT.IO"); }
public void TestTearDown() { _typesOrder.Clear(); _stringSorter = null; }
public void TouchScreenTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "TouchScreenSample.Resources", "TouchScreenSample.Resources/BitmapResources", "TouchScreenSample.Resources/FontResources", "TouchScreenSample.MyTouchScreen", "TouchScreenSample.MyTouchScreen/ScreenId", "TouchScreenSample.Resources/StringResources" }); TestSingleAssembly("TouchScreen", "Microsoft.SPOT.Touch", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Native"); }
public TinyTablesContext( AssemblyDefinition assemblyDefinition, List<String> explicitTypesOrder, ICustomStringSorter stringSorter, Boolean applyAttributesCompression) { AssemblyDefinition = assemblyDefinition; foreach (var item in assemblyDefinition.CustomAttributes) { _ignoringAttributes.Add(item.AttributeType.FullName); } NativeMethodsCrc = new NativeMethodsCrc(assemblyDefinition); var mainModule = AssemblyDefinition.MainModule; // External references AssemblyReferenceTable = new TinyAssemblyReferenceTable( mainModule.AssemblyReferences, this); var typeReferences = mainModule.GetTypeReferences() .Where(item => !IsAttribute(item)) .ToList(); TypeReferencesTable = new TinyTypeReferenceTable( typeReferences, this); var typeReferencesNames = new HashSet<String>( typeReferences.Select(item => item.FullName), StringComparer.Ordinal); var memberReferences = mainModule.GetMemberReferences() .Where(item => typeReferencesNames.Contains(item.DeclaringType.FullName)) .ToList(); FieldReferencesTable = new TinyFieldReferenceTable( memberReferences.OfType<FieldReference>(), this); MethodReferencesTable = new TinyMethodReferenceTable( memberReferences.OfType<MethodReference>(), this); // Internal types definitions var types = GetOrderedTypes(mainModule, explicitTypesOrder); TypeDefinitionTable = new TinyTypeDefinitionTable(types, this); var fields = types .SelectMany(item => GetOrderedFields(item.Fields.Where(field => !field.HasConstant))) .ToList(); FieldsTable = new TinyFieldDefinitionTable(fields, this); var methods = types.SelectMany(item => GetOrderedMethods(item.Methods)).ToList(); MethodDefinitionTable = new TinyMethodDefinitionTable(methods, this); AttributesTable = new TinyAttributesTable( GetAttributes(types, applyAttributesCompression), GetAttributes(fields, applyAttributesCompression), GetAttributes(methods, applyAttributesCompression), this); TypeSpecificationsTable = new TinyTypeSpecificationsTable(this); // Resources information ResourcesTable = new TinyResourcesTable( mainModule.Resources, this); ResourceDataTable = new TinyResourceDataTable(); // Strings and signatures SignaturesTable = new TinySignaturesTable(this); StringTable = new TinyStringTable(stringSorter); // Byte code table ByteCodeTable = new TinyByteCodeTable(this); // Additional information ResourceFileTable = new TinyResourceFileTable(this); // Pre-allocate strings from some tables AssemblyReferenceTable.AllocateStrings(); TypeReferencesTable.AllocateStrings(); foreach (var item in memberReferences) { StringTable.GetOrCreateStringId(item.Name); var fieldReference = item as FieldReference; if (fieldReference != null) { SignaturesTable.GetOrCreateSignatureId(fieldReference); } var methodReference = item as MethodReference; if (methodReference != null) { SignaturesTable.GetOrCreateSignatureId(methodReference); } } }
public TinyTablesContext( AssemblyDefinition assemblyDefinition, List <String> explicitTypesOrder, ICustomStringSorter stringSorter, Boolean applyAttributesCompression) { AssemblyDefinition = assemblyDefinition; var assemblyAttributes = new HashSet <String>( assemblyDefinition.CustomAttributes.Select(item => item.AttributeType.FullName), StringComparer.Ordinal) { "System.Reflection.AssemblyCultureAttribute", "System.Reflection.AssemblyVersionAttribute", "System.Runtime.CompilerServices.MethodImplAttribute", "System.Runtime.CompilerServices.MethodImplOptions", "System.Runtime.InteropServices.StructLayoutAttribute", "System.Runtime.InteropServices.OutAttribute", "System.Runtime.InteropServices.LayoutKind", "System.SerializableAttribute", "System.Runtime.CompilerServices.ExtensionAttribute", "System.Diagnostics.DebuggerBrowsableAttribute", "System.Diagnostics.DebuggerBrowsableState", "System.Diagnostics.DebuggerHiddenAttribute", "System.Diagnostics.ConditionalAttribute", "System.ParamArrayAttribute" }; NativeMethodsCrc = new NativeMethodsCrc(assemblyDefinition); var mainModule = AssemblyDefinition.MainModule; // External references AssemblyReferenceTable = new TinyAssemblyReferenceTable( mainModule.AssemblyReferences, this); var typeReferences = mainModule.GetTypeReferences() .Where(item => !IsAttribute(item, assemblyAttributes)) .ToList(); TypeReferencesTable = new TinyTypeReferenceTable( typeReferences, this); var typeReferencesNames = new HashSet <String>( typeReferences.Select(item => item.FullName), StringComparer.Ordinal); var memberReferences = mainModule.GetMemberReferences() .Where(item => typeReferencesNames.Contains(item.DeclaringType.FullName)) .ToList(); FieldReferencesTable = new TinyFieldReferenceTable( memberReferences.OfType <FieldReference>(), this); MethodReferencesTable = new TinyMethodReferenceTable( memberReferences.OfType <MethodReference>(), this); // Internal types definitions var types = GetOrderedTypes(mainModule, explicitTypesOrder); TypeDefinitionTable = new TinyTypeDefinitionTable(types, this); var fields = types .SelectMany(item => GetOrderedFields(item.Fields.Where(field => !field.HasConstant))) .ToList(); FieldsTable = new TinyFieldDefinitionTable(fields, this); var methods = types.SelectMany(item => GetOrderedMethods(item.Methods)).ToList(); MethodDefinitionTable = new TinyMethodDefinitionTable(methods, this); var ignoringAttributes = new HashSet <String>(StringComparer.Ordinal) { "System.Runtime.CompilerServices.ExtensionAttribute", "System.Diagnostics.DebuggerBrowsableAttribute", "System.Diagnostics.DebuggerBrowsableState", "System.Diagnostics.DebuggerHiddenAttribute", "System.Diagnostics.ConditionalAttribute", "System.ParamArrayAttribute" }; AttributesTable = new TinyAttributesTable( GetAttributes(types, applyAttributesCompression, ignoringAttributes), GetAttributes(fields, applyAttributesCompression, ignoringAttributes), GetAttributes(methods, applyAttributesCompression, ignoringAttributes), this); TypeSpecificationsTable = new TinyTypeSpecificationsTable(this); // Resources information ResourcesTable = new TinyResourcesTable( mainModule.Resources, this); ResourceDataTable = new TinyResourceDataTable(); // Strings and signatures SignaturesTable = new TinySignaturesTable(this); StringTable = new TinyStringTable(stringSorter); // Byte code table ByteCodeTable = new TinyByteCodeTable(this); // Additional information ResourceFileTable = new TinyResourceFileTable(this); // Pre-allocate strings from some tables AssemblyReferenceTable.AllocateStrings(); TypeReferencesTable.AllocateStrings(); foreach (var item in memberReferences) { StringTable.GetOrCreateStringId(item.Name); var fieldReference = item as FieldReference; if (fieldReference != null) { SignaturesTable.GetOrCreateSignatureId(fieldReference); } var methodReference = item as MethodReference; if (methodReference != null) { SignaturesTable.GetOrCreateSignatureId(methodReference); } } }
public TinyTablesContext( AssemblyDefinition assemblyDefinition, List <String> explicitTypesOrder, ICustomStringSorter stringSorter, Boolean applyAttributesCompression) { AssemblyDefinition = assemblyDefinition; foreach (var item in assemblyDefinition.CustomAttributes) { _ignoringAttributes.Add(item.AttributeType.FullName); } NativeMethodsCrc = new NativeMethodsCrc(assemblyDefinition); var mainModule = AssemblyDefinition.MainModule; // External references AssemblyReferenceTable = new TinyAssemblyReferenceTable( mainModule.AssemblyReferences, this); var typeReferences = mainModule.GetTypeReferences() .Where(item => !IsAttribute(item)) .ToList(); TypeReferencesTable = new TinyTypeReferenceTable( typeReferences, this); var typeReferencesNames = new HashSet <String>( typeReferences.Select(item => item.FullName), StringComparer.Ordinal); var memberReferences = mainModule.GetMemberReferences() .Where(item => typeReferencesNames.Contains(item.DeclaringType.FullName)) .ToList(); FieldReferencesTable = new TinyFieldReferenceTable( memberReferences.OfType <FieldReference>(), this); MethodReferencesTable = new TinyMethodReferenceTable( memberReferences.OfType <MethodReference>(), this); // Internal types definitions var types = GetOrderedTypes(mainModule, explicitTypesOrder); TypeDefinitionTable = new TinyTypeDefinitionTable(types, this); var fields = types .SelectMany(item => GetOrderedFields(item.Fields.Where(field => !field.HasConstant))) .ToList(); FieldsTable = new TinyFieldDefinitionTable(fields, this); var methods = types.SelectMany(item => GetOrderedMethods(item.Methods)).ToList(); MethodDefinitionTable = new TinyMethodDefinitionTable(methods, this); AttributesTable = new TinyAttributesTable( GetAttributes(types, applyAttributesCompression), GetAttributes(fields, applyAttributesCompression), GetAttributes(methods, applyAttributesCompression), this); TypeSpecificationsTable = new TinyTypeSpecificationsTable(this); // Resources information ResourcesTable = new TinyResourcesTable( mainModule.Resources, this); ResourceDataTable = new TinyResourceDataTable(); // Strings and signatures SignaturesTable = new TinySignaturesTable(this); StringTable = new TinyStringTable(stringSorter); // Byte code table ByteCodeTable = new TinyByteCodeTable(this); // Additional information ResourceFileTable = new TinyResourceFileTable(this); // Pre-allocate strings from some tables AssemblyReferenceTable.AllocateStrings(); TypeReferencesTable.AllocateStrings(); foreach (var item in memberReferences) { StringTable.GetOrCreateStringId(item.Name); var fieldReference = item as FieldReference; if (fieldReference != null) { SignaturesTable.GetOrCreateSignatureId(fieldReference); } var methodReference = item as MethodReference; if (methodReference != null) { SignaturesTable.GetOrCreateSignatureId(methodReference); } } }
/// <summary> /// Creates new instance of <see cref="TinyStringTable"/> object. /// </summary> public TinyStringTable( ICustomStringSorter stringSorter = null) { GetOrCreateStringId(String.Empty); // First item in string table always empty string _stringSorter = stringSorter ?? new EmptyStringSorter(); }
/// <summary> /// Creates new instance of <see cref="TinyStringTable"/> object. /// </summary> public TinyStringTable( ICustomStringSorter stringSorter = null) { GetOrCreateStringId(String.Empty); // First item in string table always empty string _stringSorter = stringSorter ?? new EmptyStringSorter(); }
public void TemperatureSampleTest() { _stringSorter = new MoveStringsForTemperatureSampleTest(); _typesOrder.AddRange(new[] { "TemperatureSample.Resources", "TemperatureSample.Resources/BitmapResources", "TemperatureSample.GPIOButtonInputProvider", "TemperatureSample.GPIOButtonInputProvider/ButtonPad", "TemperatureSample.Resources/FontResources", "TemperatureSample.StatusIndicator", "TemperatureSample.StatusIndicator/StatusType", "TemperatureSample.Resources/StringResources", "TemperatureSample.MyTemperature", "TemperatureSample.MyTemperature/TempMode", "TemperatureSample.BorderPanel", "TemperatureSample.SpiTemperatureSensor" }); TestSingleAssembly("TemperatureSample", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Native"); }
public void FtpServerSampleTest() { _stringSorter = new MoveStringsAfter("anon"); TestSingleAssembly("FtpServer", "System.Ftp", "Microsoft.SPOT.IO"); }
public void TouchCalibrationTest() { _stringSorter = new MoveStringsBefore(".Resource"); _typesOrder.AddRange(new[] { "TouchCalibrationSample.GPIOButtonInputProvider", "TouchCalibrationSample.GPIOButtonInputProvider/ButtonPad", "TouchCalibrationSample.Resources", "TouchCalibrationSample.Resources/FontResources", "TouchCalibrationSample.MyTouchCalibration", "TouchCalibrationSample.MyTouchCalibration/MyWindow", "TouchCalibrationSample.Resources/StringResources", "TouchCalibrationSample.MyTouchCalibration/MyWindow/point" }); TestSingleAssembly("TouchCalibration", "Microsoft.SPOT.TinyCore", "Microsoft.SPOT.Hardware", "Microsoft.SPOT.Native", "Microsoft.SPOT.Graphics", "Microsoft.SPOT.Touch"); }
public void HttpClientSampleTest() { _stringSorter = new MoveStringsBefore(".Resource"); TestSingleAssembly("HTTPClient", "System.Http", "Microsoft.SPOT.Native"); }
public void TestTearDown() { _typesOrder.Clear(); _stringSorter = null; }
public void HttpClientSampleTest() { _stringSorter = new MoveStringsBefore(".Resource"); TestSingleAssembly("HTTPClient", "System.Http", "Microsoft.SPOT.Native"); }