<commit_before>﻿using System.IO;
using System.Linq;
using System.Reflection;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Pdb;
using Mono.Cecil.Rocks;

public partial class ModuleWeaver
{
    private readonly ConstructorInfo _instructionConstructorInfo = typeof(Instruction).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(OpCode), typeof(object) }, null);
    private TypeDefinition _targetType;
    private TypeDefinition _sourceType;
    private TypeDefinition _commonType;
    private MethodDefinition _attachMethod;
    private MethodDefinition _loaderCctor;
    private bool _hasUnmanaged;
    private FieldDefinition _assemblyNamesField;
    private FieldDefinition _symbolNamesField;
    private FieldDefinition _preloadListField;
    private FieldDefinition _preload32ListField;
    private FieldDefinition _preload64ListField;
    private FieldDefinition _checksumsField;

    private void ImportAssemblyLoader(bool createTemporaryAssemblies)
    {
        var readerParameters = new ReaderParameters
        {
            AssemblyResolver = new NetStandardAssemblyResolver(this),
            ReadSymbols = true,
            SymbolReaderProvider = new PdbReaderProvider(),
            SymbolStream = GetType().Assembly.GetManifestResourceStream("Costura.Template.pdb"),
        };

        using (var resourceStream = GetType().Assembly.GetManifestResourceStream("Costura.Template.dll"))
        {
            var moduleDefinition = ModuleDefinition.ReadModule(resourceStream, readerParameters);

            if (createTemporaryAssemblies)
            {
                _sourceType = moduleDefinition.Types.Single(x => x.Name == "ILTemplateWithTempAssembly");
                DumpSource("ILTemplateWithTempAssembly");
            }
            else if (_hasUnmanaged)
            {
                _sourceType = moduleDefinition.Types.Single(x => x.Name == "ILTemplateWithUnmanagedHandler");
                DumpSource("ILTemplateWithUnmanagedHandler");
            }
            else
            {<commit_msg>Remove obsolete .pdb loading, now using embedded symbols.<commit_after>﻿using System.IO;
using System.Linq;
using System.Reflection;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Pdb;
using Mono.Cecil.Rocks;

public partial class ModuleWeaver
{
    private readonly ConstructorInfo _instructionConstructorInfo = typeof(Instruction).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(OpCode), typeof(object) }, null);
    private TypeDefinition _targetType;
    private TypeDefinition _sourceType;
    private TypeDefinition _commonType;
    private MethodDefinition _attachMethod;
    private MethodDefinition _loaderCctor;
    private bool _hasUnmanaged;
    private FieldDefinition _assemblyNamesField;
    private FieldDefinition _symbolNamesField;
    private FieldDefinition _preloadListField;
    private FieldDefinition _preload32ListField;
    private FieldDefinition _preload64ListField;
    private FieldDefinition _checksumsField;

    private void ImportAssemblyLoader(bool createTemporaryAssemblies)
    {
        var readerParameters = new ReaderParameters
        {
            AssemblyResolver = new NetStandardAssemblyResolver(this),
            ReadSymbols = true,
            SymbolReaderProvider = new PdbReaderProvider()
        };

        using (var resourceStream = GetType().Assembly.GetManifestResourceStream("Costura.Template.dll"))
        {
            var moduleDefinition = ModuleDefinition.ReadModule(resourceStream, readerParameters);

            if (createTemporaryAssemblies)
            {
                _sourceType = moduleDefinition.Types.Single(x => x.Name == "ILTemplateWithTempAssembly");
                DumpSource("ILTemplateWithTempAssembly");
            }
            else if (_hasUnmanaged)
            {
                _sourceType = moduleDefinition.Types.Single(x => x.Name == "ILTemplateWithUnmanagedHandler");
                DumpSource("ILTemplateWithUnmanagedHandler");
            }
            else
            {
{'fraction_non_alphanumeric': 0.07104360607545321, 'fraction_numerical': 0.0019598236158745713, 'mean_word_length': 3.2486992715920917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3389111', 'n_tokens_mistral': 1009, 'n_tokens_neox': 986, 'n_words': 219}