Exemplo n.º 1
0
 private static DlcOwnershipInput GetDlcOwnershipInputs(CmdLineArgs cmdLineArgs)
 {
     return(new DlcOwnershipInput
     {
         DlcFolder2014 = cmdLineArgs.DlcFolder,
         DlcFolder2012 = cmdLineArgs.rs1DlcFolder,
         OfficialDlcSource = cmdLineArgs.OfficialDlcSource,
         OfficialDlcSongNodeSelector = cmdLineArgs.OfficialSourceXPath,
         TuningSource = cmdLineArgs.TuningSource
     });
 }
Exemplo n.º 2
0
        static CmdLineArgs ParseCommandLine(string[] args)
        {
            var p           = new FluentCommandLineParser();
            var cmdLineArgs = new CmdLineArgs();

            p.Setup <string>("dlcfolder")
            .Callback(dlcFolder => cmdLineArgs.DlcFolder = dlcFolder)
            .WithDescription("Path to dlc folder for Rocksmith")
            .Required();

            p.Setup <string>("rs1dlcfolder")
            .Callback(rs1DlcFolder => cmdLineArgs.rs1DlcFolder = rs1DlcFolder)
            .WithDescription("Path to RS1 dlc");

            p.Setup <string>("source")
            .Callback(val => cmdLineArgs.OfficialDlcSource = val)
            .WithDescription("Where to find the list of Rocksmith dlc")
            .Required();

            p.Setup <string>("outputdir")
            .Callback(val => cmdLineArgs.OutputDirPath = val)
            .WithDescription("Where to write the output files")
            .Required();

            p.Setup <string>("officialsourcexpath")
            .Callback(val => cmdLineArgs.OfficialSourceXPath = val)
            .WithDescription("XPath to find the <songs> node in the official source")
            .SetDefault("//div[@class='tabPanel downloads']/songs")
            .Required();

            p.Setup <bool>("convert")
            .Callback(val => cmdLineArgs.ConvertEncoding = val)
            .WithDescription("Try to convert unicode characters to ASCII where possible (eg ’ to ')");

            p.Setup <string>("dlcmap")
            .Callback(val => cmdLineArgs.RemapFilePathOfficialToDlc = val)
            .WithDescription("Path to the mapping file for helping map official dlc list to dlc items")
            .SetDefault("OfficialEntriesToDlc.xml");

            p.Setup <string>("tuningmap")
            .Callback(val => cmdLineArgs.OutputDirPath = val)
            .WithDescription("Path to the mapping file for helping map official dlc list to tunings list")
            .SetDefault("OfficialEntriesToTunings.xml");

            p.Setup <bool>("checkdlc")
            .Callback(val => cmdLineArgs.CheckDlc = val)
            .WithDescription("compare sources to find missing items");

            p.Setup <string>("tunings")
            .Callback(val => cmdLineArgs.TuningSource = val)
            .WithDescription("DlcTuning tunings list");

            p.SetupHelp("h", "help", "?")
            .Callback(text => Console.WriteLine(text));

            var result = p.Parse(args);

            if (result.HasErrors == true)
            {
                Console.WriteLine(result.ErrorText);
                return(null);
            }
            if (result.HelpCalled)
            {
                return(null);
            }

            return(cmdLineArgs);
        }