Exemplo n.º 1
0
        public static AssemblyProcessorApp CreateAssemblyProcessorApp(string[] args, TextWriter logger, out OptionSet p, out bool showHelp, out string outputFilePath, out List <string> inputFiles)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            bool   localShowHelp       = false;
            string localOutputFilePath = null;

            var app = new AssemblyProcessorApp(logger);

            p = new OptionSet()
            {
                "Copyright (C) 2011-2012 Silicon Studio Corporation. All Rights Reserved",
                "Xenko Assembly Processor tool - Version: "
                +
                String.Format(
                    "{0}.{1}.{2}",
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Major,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Minor,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Build) + string.Empty,
                string.Format("Usage: {0} [options]* inputfile -o [outputfile]", ExeName),
                string.Empty,
                "=== Options ===",
                string.Empty,
                { "h|help", "Show this message and exit", v => localShowHelp = v != null },
                { "o|output=", "Output file name", v => localOutputFilePath = v },
                { "p|platform=", "The platform (Windows, Android, iOS)", v => app.Platform = (PlatformType)Enum.Parse(typeof(PlatformType), v) },
                { "t|targetFramework=", "The .NET target platform (platform specific)", v => app.TargetFramework = v },
                { "auto-notify-property", "Automatically implements INotifyPropertyChanged", v => app.AutoNotifyProperty = true },
                { "parameter-key", "Automatically initialize parameter keys in module static constructor", v => app.ParameterKey = true },
                { "rename-assembly=", "Rename assembly", v => app.NewAssemblyName = v },
                { "auto-module-initializer", "Execute function tagged with [ModuleInitializer] at module initialization (automatically enabled)", v => app.ModuleInitializer = true },
                { "serialization", "Generate serialiation assembly", v => app.SerializationAssembly = true },
                { "docfile=", "Generate user documentation from XML file", v => app.DocumentationFile = v },
                { "d|directory=", "Additional search directory for assemblies", app.SearchDirectories.Add },
                { "a|assembly=", "Additional assembly (for now, it will add the assembly directory to search path)", v => app.SearchDirectories.Add(Path.GetDirectoryName(v)) },
                { "signkeyfile=", "Signing Key File", v => app.SignKeyFile = v },
                { "references-file=", "Project reference stored in a path", v => app.References.AddRange(File.ReadAllLines(v)) },
                { "add-reference=", "References to explicitely add", v => app.ReferencesToAdd.Add(v) },
                { "Werror", "Promote warnings to errors", v => app.TreatWarningsAsErrors = true },
                { "delete-output-on-error", "Delete output file if an error happened", v => app.DeleteOutputOnError = true },
                { "keep-original", "Keep copy of the original assembly", v => app.KeepOriginal = true },
            };

            inputFiles     = p.Parse(args);
            showHelp       = localShowHelp;
            outputFilePath = localOutputFilePath;
            return(app);
        }
Exemplo n.º 2
0
        public static AssemblyProcessorApp CreateAssemblyProcessorApp(string[] args, out OptionSet p, out bool showHelp, out string outputFilePath, out List<string> inputFiles)
        {
            bool localShowHelp = false;
            string localOutputFilePath = null;

            var app = new AssemblyProcessorApp();
            p = new OptionSet()
            {
                "Copyright (C) 2011-2012 Silicon Studio Corporation. All Rights Reserved",
                "Paradox Assembly Processor tool - Version: "
                +
                String.Format(
                    "{0}.{1}.{2}",
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Major,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Minor,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Build) + string.Empty,
                string.Format("Usage: {0} [options]* inputfile -o [outputfile]", ExeName),
                string.Empty,
                "=== Options ===",
                string.Empty,
                { "h|help", "Show this message and exit", v => localShowHelp = v != null },
                { "o|output=", "Output file name", v => localOutputFilePath = v },
                { "p|platform=", "The platform (Windows, Android, iOS)", v => app.Platform = (PlatformType)Enum.Parse(typeof(PlatformType), v) },
                { "t|targetFramework=", "The .NET target platform (platform specific)", v => app.TargetFramework = v },
                { "auto-notify-property", "Automatically implements INotifyPropertyChanged", v => app.AutoNotifyProperty = true },
                { "parameter-key", "Automatically initialize parameter keys in module static constructor", v => app.ParameterKey = true },
                { "rename-assembly=", "Rename assembly", v => app.NewAssemblyName = v },
                { "auto-module-initializer", "Execute function tagged with [ModuleInitializer] at module initialization (automatically enabled)", v => app.ModuleInitializer = true },
                { "serialization", "Generate serialiation assembly", v => app.SerializationAssembly = true },
                { "docfile=", "Generate user documentation from XML file", v => app.DocumentationFile = v },
                { "d|directory=", "Additional search directory for assemblies", app.SearchDirectories.Add },
                { "a|assembly=", "Additional assembly (for now, it will add the assembly directory to search path)", v => app.SearchDirectories.Add(Path.GetDirectoryName(v)) },
                { "signkeyfile=", "Signing Key File", v => app.SignKeyFile = v },
                { "references-file=", "Project reference stored in a path", v => app.References.AddRange(File.ReadAllLines(v)) },
                { "add-reference=", "References to explicitely add", v => app.ReferencesToAdd.Add(v) },
                { "Werror", "Promote warnings to errors", v => app.TreatWarningsAsErrors = true },
                { "delete-output-on-error", "Delete output file if an error happened", v => app.DeleteOutputOnError = true },
            };

            showHelp = localShowHelp;
            outputFilePath = localOutputFilePath;
            inputFiles = p.Parse(args);
            return app;
        }
Exemplo n.º 3
0
        public static AssemblyProcessorApp CreateAssemblyProcessorApp(string[] args, out OptionSet p, out bool showHelp, out string outputFilePath, out List <string> inputFiles)
        {
            bool   localShowHelp       = false;
            string localOutputFilePath = null;

            var app = new AssemblyProcessorApp();

            p = new OptionSet()
            {
                "Copyright (C) 2011-2012 Silicon Studio Corporation. All Rights Reserved",
                "Paradox Assembly Processor tool - Version: "
                +
                String.Format(
                    "{0}.{1}.{2}",
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Major,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Minor,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Build) + string.Empty,
                string.Format("Usage: {0} [options]* inputfile -o [outputfile]", ExeName),
                string.Empty,
                "=== Options ===",
                string.Empty,
                { "h|help", "Show this message and exit", v => localShowHelp = v != null },
                { "o|output=", "Output file name", v => localOutputFilePath = v },
                { "p|platform=", "The platform (Windows, Android, iOS)", v => app.Platform = (PlatformType)Enum.Parse(typeof(PlatformType), v) },
                { "t|targetFramework=", "The .NET target platform (platform specific)", v => app.TargetFramework = v },
                { "auto-notify-property", "Automatically implements INotifyPropertyChanged", v => app.AutoNotifyProperty = true },
                { "parameter-key", "Automatically initialize parameter keys in module static constructor", v => app.ParameterKey = true },
                { "rename-assembly=", "Rename assembly", v => app.NewAssemblyName = v },
                { "auto-module-initializer", "Execute function tagged with [ModuleInitializer] at module initialization (automatically enabled)", v => app.ModuleInitializer = true },
                { "serialization", "Generate serialiation assembly", v => app.SerializationAssembly = true },
                { "generate-user-doc", "Generate user documentation from XML file", v => app.GenerateUserDocumentation = true },
                { "d|directory=", "Additional search directory for assemblies", app.SearchDirectories.Add },
                { "a|assembly=", "Additional assembly (for now, it will add the assembly directory to search path)", v => app.SearchDirectories.Add(Path.GetDirectoryName(v)) },
                { "signkeyfile=", "Signing Key File", v => app.SignKeyFile = v },
                { "serializationProjectReferencePaths=", "Project reference paths to auto-load by serialization module initializer (separated by semi-colon)", v => app.SerializationProjectReferences.AddRange(v.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) }
            };

            showHelp       = localShowHelp;
            outputFilePath = localOutputFilePath;
            inputFiles     = p.Parse(args);
            return(app);
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            var showHelp = false;

            var    app            = new AssemblyProcessorApp();
            string outputFilePath = null;

            var p = new OptionSet()
            {
                "Copyright (C) 2011-2012 Silicon Studio Corporation. All Rights Reserved",
                "Paradox Assembly Processor tool - Version: "
                +
                String.Format(
                    "{0}.{1}.{2}",
                    typeof(Program).Assembly.GetName().Version.Major,
                    typeof(Program).Assembly.GetName().Version.Minor,
                    typeof(Program).Assembly.GetName().Version.Build) + string.Empty,
                string.Format("Usage: {0} [options]* inputfile -o [outputfile]", ExeName),
                string.Empty,
                "=== Options ===",
                string.Empty,
                { "h|help", "Show this message and exit", v => showHelp = v != null },
                { "o|output=", "Output file name", v => outputFilePath = v },
                { "p|platform=", "The platform (Windows, Android, iOS)", v => app.Platform = (PlatformType)Enum.Parse(typeof(PlatformType), v) },
                { "t|targetFramework=", "The .NET target platform (platform specific)", v => app.TargetFramework = v },
                { "auto-notify-property", "Automatically implements INotifyPropertyChanged", v => app.AutoNotifyProperty = true },
                { "parameter-key", "Automatically initialize parameter keys in module static constructor", v => app.ParameterKey = true },
                { "rename-assembly=", "Rename assembly", v => app.NewAssemblyName = v },
                { "auto-module-initializer", "Execute function tagged with [ModuleInitializer] at module initialization (automatically enabled)", v => app.ModuleInitializer = true },
                { "serialization", "Generate serialiation assembly", v => app.SerializationAssembly = true },
                { "generate-user-doc", "Generate user documentation from XML file", v => app.GenerateUserDocumentation = true },
                { "d|directory=", "Additional search directory for assemblies", app.SearchDirectories.Add },
                { "a|assembly=", "Additional assembly (for now, it will add the assembly directory to search path)", v => app.SearchDirectories.Add(Path.GetDirectoryName(v)) },
                { "signkeyfile=", "Signing Key File", v => app.SignKeyFile = v },
            };

            List <string> inputFiles = null;

            inputFiles = p.Parse(args);
            if (showHelp)
            {
                p.WriteOptionDescriptions(Console.Out);
                return;
            }

            if (inputFiles.Count != 1)
            {
                p.WriteOptionDescriptions(Console.Out);
                ExitWithError("This tool requires one input file.");
            }

            var inputFile = inputFiles[0];

            // Add search path from input file
            app.SearchDirectories.Add(Path.GetDirectoryName(inputFile));

            // Load symbol file if it exists
            var symbolFile = Path.ChangeExtension(inputFile, "pdb");

            if (File.Exists(symbolFile))
            {
                app.UseSymbols = true;
            }

            // Setup output filestream
            if (outputFilePath == null)
            {
                outputFilePath = inputFile;
            }

            if (!app.Run(inputFile, outputFilePath))
            {
                ExitWithError();
            }
        }