Esempio n. 1
0
        /// <summary>
        /// Converts Portable PDB stream to Windows PDB.
        /// </summary>
        /// <param name="peStream">PE image stream (.dll or .exe)</param>
        /// <param name="sourcePdbStream">Source stream of Portable PDB data. Must be readable.</param>
        /// <param name="targetPdbStream">Target stream of Windows PDB data. Must be writable.</param>
        /// <exception cref="ArgumentNullException"><paramref name="peStream"/>, <paramref name="sourcePdbStream"/>, or <paramref name="targetPdbStream"/> is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="peStream"/> does not support read and seek operations.</exception>
        /// <exception cref="ArgumentException"><paramref name="sourcePdbStream"/> does not support reading.</exception>
        /// <exception cref="ArgumentException"><paramref name="targetPdbStream"/> does not support writing.</exception>
        /// <exception cref="BadImageFormatException">The format of the PE image or the source PDB image is invalid.</exception>
        /// <exception cref="InvalidDataException">Unexpected data found in the PE image or the source PDB image.</exception>
        /// <exception cref="IOException">IO error while reading from or writing to a stream.</exception>
        public static void ConvertPortableToWindows(Stream peStream, Stream sourcePdbStream, Stream targetPdbStream)
        {
            StreamUtilities.ValidateStream(peStream, nameof(peStream), readRequired: true, seekRequired: true);
            StreamUtilities.ValidateStream(sourcePdbStream, nameof(sourcePdbStream), readRequired: true);
            StreamUtilities.ValidateStream(targetPdbStream, nameof(targetPdbStream), writeRequired: true);

            PdbConverterPortableToWindows.Convert(peStream, sourcePdbStream, targetPdbStream);
        }
        public PortablePdbConversionOptions(
            bool suppressSourceLinkConversion = false,
            IEnumerable <KeyValuePair <string, string> > srcSvrVariables = null)
        {
            var variables = srcSvrVariables?.ToImmutableArray() ?? ImmutableArray <KeyValuePair <string, string> > .Empty;

            PdbConverterPortableToWindows.ValidateSrcSvrVariables(variables, nameof(srcSvrVariables));

            SuppressSourceLinkConversion = suppressSourceLinkConversion;
            SrcSvrVariables = variables;
        }