private static String ProcessSingleFile(
            String name, String subDirectoryName,
            AssemblyDefinition assemblyDefinition,
            Func <BinaryWriter, TinyBinaryWriter> getBinaryWriter)
        {
            var peFileName   = String.Format(@"Data\{0}\{1}\{0}.pex", name, subDirectoryName);
            var pdbxFileName = String.Format(@"Data\{0}\{1}\{0}.pdbx", name, subDirectoryName);

            var builder = new TinyAssemblyBuilder(
                assemblyDefinition, _typesOrder, _stringSorter, true);

            using (var stream = File.Open(peFileName, FileMode.Create, FileAccess.ReadWrite))
                using (var writer = new BinaryWriter(stream))
                {
                    builder.Write(getBinaryWriter(writer));
                }

            using (var writer = XmlWriter.Create(pdbxFileName,
                                                 new XmlWriterSettings {
                Indent = true
            }))
            {
                builder.Write(writer);
            }

            return(peFileName);
        }
Beispiel #2
0
            public void Compile(String fileName)
            {
                try
                {
                    var builder = new TinyAssemblyBuilder(_assemblyDefinition);

                    using (var stream = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite))
                    using (var writer = new BinaryWriter(stream))
                    {
                        builder.Write(GetBinaryWriter(writer));
                    }

                    using (var writer = XmlWriter.Create(Path.ChangeExtension(fileName, "pdbx")))
                    {
                        builder.Write(writer);
                    }
                }
                catch (Exception)
                {
                    System.Console.Error.WriteLine(
                        "Unable to compile output assembly file '{0}' - check parse command results.", fileName);
                    throw;
                }
            }
Beispiel #3
0
            public void Compile(String fileName)
            {
                try
                {
                    var builder = new TinyAssemblyBuilder(_assemblyDefinition);

                    using (var stream = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite))
                        using (var writer = new BinaryWriter(stream))
                        {
                            builder.Write(GetBinaryWriter(writer));
                        }

                    using (var writer = XmlWriter.Create(Path.ChangeExtension(fileName, "pdbx")))
                    {
                        builder.Write(writer);
                    }
                }
                catch (Exception)
                {
                    System.Console.Error.WriteLine(
                        "Unable to compile output assembly file '{0}' - check parse command results.", fileName);
                    throw;
                }
            }
        private static String ProcessSingleFile(
            String name, String subDirectoryName,
            AssemblyDefinition assemblyDefinition,
            Func<BinaryWriter, TinyBinaryWriter> getBinaryWriter)
        {
            var peFileName = String.Format(@"Data\{0}\{1}\{0}.pex", name, subDirectoryName);
            var pdbxFileName = String.Format(@"Data\{0}\{1}\{0}.pdbx", name, subDirectoryName);

            var builder = new TinyAssemblyBuilder(
                assemblyDefinition, _typesOrder, _stringSorter, true);

            using (var stream = File.Open(peFileName, FileMode.Create, FileAccess.ReadWrite))
            using (var writer = new BinaryWriter(stream))
            {
                builder.Write(getBinaryWriter(writer));
            }

            using (var writer = XmlWriter.Create(pdbxFileName,
                new XmlWriterSettings { Indent = true }))
            {
                builder.Write(writer);
            }

            return peFileName;
        }