/// <summary>
 /// Creates new instance of <see cref="TinyResourcesTable"/> object.
 /// </summary>
 /// <param name="resources">Original list of resouces in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyResourcesTable(
     IEnumerable<Resource> resources,
     TinyTablesContext context)
 {
     _resources = resources.ToList();
     _context = context;
 }
Exemple #2
0
 /// <summary>
 /// Creates new instance of <see cref="TinyResourcesTable"/> object.
 /// </summary>
 /// <param name="resources">Original list of resouces in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyResourcesTable(
     IEnumerable <Resource> resources,
     TinyTablesContext context)
 {
     _resources = resources.ToList();
     _context   = context;
 }
Exemple #3
0
 /// <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);
 }
Exemple #5
0
        /// <summary>
        /// Creates new instance of <see cref="TinyAttributesTable"/> object.
        /// </summary>
        /// <param name="typesAttributes">
        /// List of custom attributes in Mono.Cecil format for all internal types.
        /// </param>
        /// <param name="fieldsAttributes">
        /// List of custom attributes in Mono.Cecil format for all internal fields.
        /// </param>
        /// <param name="methodsAttributes">
        /// List of custom attributes in Mono.Cecil format for all internal methods.
        /// </param>
        /// <param name="context">
        /// Assembly tables context - contains all tables used for building target assembly.
        /// </param>
        public TinyAttributesTable(
            IEnumerable <Tuple <CustomAttribute, UInt16> > typesAttributes,
            IEnumerable <Tuple <CustomAttribute, UInt16> > fieldsAttributes,
            IEnumerable <Tuple <CustomAttribute, UInt16> > methodsAttributes,
            TinyTablesContext context)
        {
            _typesAttributes   = typesAttributes.ToList();
            _fieldsAttributes  = fieldsAttributes.ToList();
            _methodsAttributes = methodsAttributes.ToList();

            _context = context;
        }
        /// <summary>
        /// Creates new instance of <see cref="TinyAttributesTable"/> object.
        /// </summary>
        /// <param name="typesAttributes">
        /// List of custom attributes in Mono.Cecil format for all internal types.
        /// </param>
        /// <param name="fieldsAttributes">
        /// List of custom attributes in Mono.Cecil format for all internal fields.
        /// </param>
        /// <param name="methodsAttributes">
        /// List of custom attributes in Mono.Cecil format for all internal methods.
        /// </param>
        /// <param name="context">
        /// Assembly tables context - contains all tables used for building target assembly.
        /// </param>
        public TinyAttributesTable(
            IEnumerable<Tuple<CustomAttribute, UInt16>> typesAttributes,
            IEnumerable<Tuple<CustomAttribute, UInt16>> fieldsAttributes,
            IEnumerable<Tuple<CustomAttribute, UInt16>> methodsAttributes,
            TinyTablesContext context)
        {
            _typesAttributes = typesAttributes.ToList();
            _fieldsAttributes = fieldsAttributes.ToList();
            _methodsAttributes = methodsAttributes.ToList();

            _context = context;
        }
Exemple #7
0
        /// <summary>
        /// Creates new instance of <see cref="Mono.Cecil.Cil.CodeWriter"/> object.
        /// </summary>
        /// <param name="method">Original method body in Mono.Cecil format.</param>
        /// <param name="writer">Binary writer for writing byte code in correct endianess.</param>
        /// <param name="stringTable">String references table (for obtaining string ID).</param>
        /// <param name="context">
        /// Assembly tables context - contains all tables used for building target assembly.
        /// </param>
        public CodeWriter(
            MethodDefinition method,
            TinyBinaryWriter writer,
            TinyStringTable stringTable,
            TinyTablesContext context)
        {
            _stringTable = stringTable;

            _body    = method.Body;
            _context = context;
            _writer  = writer;
        }
        /// <summary>
        /// Creates new instance of <see cref="Mono.Cecil.Cil.CodeWriter"/> object.
        /// </summary>
        /// <param name="method">Original method body in Mono.Cecil format.</param>
        /// <param name="writer">Binary writer for writing byte code in correct endianess.</param>
        /// <param name="stringTable">String references table (for obtaining string ID).</param>
        /// <param name="context">
        /// Assembly tables context - contains all tables used for building target assembly.
        /// </param>
        public CodeWriter(
	        MethodDefinition method,
            TinyBinaryWriter writer,
            TinyStringTable stringTable,
            TinyTablesContext context)
	    {
            _stringTable = stringTable;

            _body = method.Body;
            _context = context;
            _writer = writer;
        }
Exemple #9
0
        /// <summary>
        /// Creates new instance of <see cref="TinyReferenceTableBase{T}"/> object.
        /// </summary>
        /// <param name="tinyTableItems">List of items for initial loading.</param>
        /// <param name="comparer">Custom comparer for items (type-specific).</param>
        /// <param name="context">
        /// Assembly tables context - contains all tables used for building target assembly.
        /// </param>
        protected TinyReferenceTableBase(
            IEnumerable <T> tinyTableItems,
            IEqualityComparer <T> comparer,
            TinyTablesContext context)
        {
            _idsByItemsDictionary = tinyTableItems
                                    .Select((reference, index) => new { reference, index })
                                    .ToDictionary(item => item.reference, item => (UInt16)item.index,
                                                  comparer);

            _context = context;
        }
        private static IEnumerable<ITinyTable> GetTables(
            TinyTablesContext context)
        {
            yield return context.AssemblyReferenceTable;

            yield return context.TypeReferencesTable;

            yield return context.FieldReferencesTable;

            yield return context.MethodReferencesTable;

            yield return context.TypeDefinitionTable;

            yield return context.FieldsTable;

            yield return context.MethodDefinitionTable;

            yield return context.AttributesTable;

            yield return context.TypeSpecificationsTable;

            yield return context.ResourcesTable;

            yield return context.ResourceDataTable;

            context.ByteCodeTable.UpdateStringTable();
            context.StringTable.GetOrCreateStringId(
                context.AssemblyDefinition.Name.Name);

            yield return context.StringTable;
            
            yield return context.SignaturesTable;

            yield return context.ByteCodeTable;

            yield return context.ResourceFileTable;

            yield return TinyEmptyTable.Instance;
        }
Exemple #11
0
        private static IEnumerable <ITinyTable> GetTables(
            TinyTablesContext context)
        {
            yield return(context.AssemblyReferenceTable);

            yield return(context.TypeReferencesTable);

            yield return(context.FieldReferencesTable);

            yield return(context.MethodReferencesTable);

            yield return(context.TypeDefinitionTable);

            yield return(context.FieldsTable);

            yield return(context.MethodDefinitionTable);

            yield return(context.AttributesTable);

            yield return(context.TypeSpecificationsTable);

            yield return(context.ResourcesTable);

            yield return(context.ResourceDataTable);

            context.ByteCodeTable.UpdateStringTable();
            context.StringTable.GetOrCreateStringId(
                context.AssemblyDefinition.Name.Name);

            yield return(context.StringTable);

            yield return(context.SignaturesTable);

            yield return(context.ByteCodeTable);

            yield return(context.ResourceFileTable);

            yield return(TinyEmptyTable.Instance);
        }
Exemple #12
0
 /// <summary>
 /// Creates new instance of <see cref="TinyTypeSpecificationsTable"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyTypeSpecificationsTable(
     TinyTablesContext context)
 {
     _context = context;
 }
Exemple #13
0
 /// <summary>
 /// Creates new instance of <see cref="TinyMethodReferenceTable"/> object.
 /// </summary>
 /// <param name="items">List of member references in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyMethodReferenceTable(
     IEnumerable <MethodReference> items,
     TinyTablesContext context)
     : base(items, new MemberReferenceComparer(), context)
 {
 }
Exemple #14
0
 /// <summary>
 /// Creates new instance of <see cref="TinySignaturesTable"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinySignaturesTable(
     TinyTablesContext context)
 {
     _context = context;
 }
 /// <summary>
 /// Creates new instance of <see cref="TinyTypeReferenceTable"/> object.
 /// </summary>
 /// <param name="items">Type references list in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyTypeReferenceTable(
     IEnumerable <TypeReference> items,
     TinyTablesContext context)
     : base(items, new TypeReferenceEqualityComparer(), context)
 {
 }
Exemple #16
0
 /// <summary>
 /// Creates new instance of <see cref="TinyTypeDefinitionTable"/> object.
 /// </summary>
 /// <param name="items">List of types definitins in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyTypeDefinitionTable(
     IEnumerable <TypeDefinition> items,
     TinyTablesContext context)
     : base(items, new TypeDefinitionEqualityComparer(), context)
 {
 }
 public TinyPdbxFileWriter(
     TinyTablesContext context)
 {
     _context = context;
 }
 /// <summary>
 /// Creates new instance of <see cref="TinyByteCodeTable"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyByteCodeTable(
     TinyTablesContext context)
 {
     _context = context;
 }
 /// <summary>
 /// Creates new instance of <see cref="TinyMethodDefinitionTable"/> object.
 /// </summary>
 /// <param name="items">List of methods definitions in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyMethodDefinitionTable(
     IEnumerable <MethodDefinition> items,
     TinyTablesContext context)
     : base(items, new MethodDefinitionComparer(), context)
 {
 }
 /// <summary>
 /// Creates new instance of <see cref="TinyAssemblyDefinition"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyAssemblyDefinition(
     TinyTablesContext context)
 {
     _context = context;
 }
 public TinyPdbxFileWriter(
     TinyTablesContext context)
 {
     _context = context;
 }
Exemple #22
0
 /// <summary>
 /// Creates new instance of <see cref="TinyAssemblyReferenceTable"/> object.
 /// </summary>
 /// <param name="items">List of assembly references in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyAssemblyReferenceTable(
     IEnumerable <AssemblyNameReference> items,
     TinyTablesContext context)
     : base(items, new AssemblyNameReferenceComparer(), context)
 {
 }
 /// <summary>
 /// Creates new instance of <see cref="TinyByteCodeTable"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyByteCodeTable(
     TinyTablesContext context)
 {
     _context = context;
 }
Exemple #24
0
 /// <summary>
 /// Creates new instance of <see cref="TinyFieldDefinitionTable"/> object.
 /// </summary>
 /// <param name="items">List of field definitions in Mono.Cecil format.</param>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyFieldDefinitionTable(
     IEnumerable <FieldDefinition> items,
     TinyTablesContext context)
     : base(items, new FieldDefinitionComparer(), context)
 {
 }
 /// <summary>
 /// Creates new instance of <see cref="TinyAssemblyDefinition"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyAssemblyDefinition(
     TinyTablesContext context)
 {
     _context = context;
 }
 /// <summary>
 /// Creates new instance of <see cref="TinyResourceFileTable"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyResourceFileTable(
     TinyTablesContext context)
 {
     _context = context;
 }
Exemple #27
0
 /// <summary>
 /// Creates new instance of <see cref="TinyResourceFileTable"/> object.
 /// </summary>
 /// <param name="context">
 /// Assembly tables context - contains all tables used for building target assembly.
 /// </param>
 public TinyResourceFileTable(
     TinyTablesContext context)
 {
     _context = context;
 }