示例#1
0
        static int Main(string[] args)
        {
            // Read command line
            var options = new CommandLineOptions();
            
            var parser = new CommandLineParser(options);
            if (!parser.ParseCommandLine(args))
            {
                return 1;
            }

            var config = LoadConfig(options);

            // Export Samples
            foreach (var sample in config.Samples)
            {
                SampleExporter.Export(config, sample);
            }

            // Copy individual files
            foreach (var file in config.FilesToCopy)
            {
                File.Copy(Path.Combine(config.Options.Root, file), Path.Combine(config.Options.Dest, file), true);
            }

            return 0;
        }
示例#2
0
        public Configuration(CommandLineOptions options)
        {
            this.Options = options;

            var doc = XDocument.Load(options.Config);

            foreach (var element in doc.Element("ExportSamples").Elements())
            {
                switch (element.Name.ToString())
                {
                    case "Property":
                        Properties.Add(
                            element.Attribute("Name").Value,
                            Path.GetFullPath(Path.Combine(options.Root, element.Attribute("Value").Value)));
                        break;

                    case "Sample":
                        Samples.Add(new SampleDirectory(element, options.Root, options.Dest));
                        break;

                    case "InlineImport":
                        InlineImports.Add(new InlineImport(element));
                        break;

                    case "DuplicateIntoSample":
                        DuplicateFiles.Add(
                            Path.GetFullPath(Path.Combine(options.Root, element.Attribute("Source").Value)),
                            element.Attribute("Destination").Value);
                        break;

                    case "MSBuildPropertyIsFileReference":
                        FileReferenceProperties.Add(element.Attribute("Name").Value);
                        break;

                    case "Win2DProject":
                        Win2DProjects.Add(element.Attribute("Name").Value);
                        break;

                    case "File":
                        FilesToCopy.Add(element.Attribute("Source").Value);
                        break;

                    case "FlattenCondition":
                        PropertiesToFlatten.Add(element.Attribute("Property").Value);
                        break;
                }
            }
        }
示例#3
0
        private static Configuration LoadConfig(CommandLineOptions options)
        {
            if (options.Config == null)
            {
                options.Config = FindConfigFile();
            }

            if (options.Root == null)
            {
                string dir = Path.GetFullPath(options.Config);
                if (!FindEnlistmentRoot(dir, out options.Root))
                {
                    throw new FileNotFoundException("Couldn't find enlistment root");
                }
            }

            if (options.Win2DVersion == null)
            {
                options.Win2DVersion = File.ReadAllText(Path.Combine(options.Root, "build", "nuget", "VERSION")).Trim();
            }

            return new Configuration(options);
        }