static int Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ProjectManager projectSelect; //Properties.Settings.Default.Upgrade(); settings = ProjectManagerSettings.Load(); StartupArgs startupArgs = new StartupArgs(); startupArgs.mode = CLIMode.None; FluentCommandLineParser parser = new FluentCommandLineParser(); // parse main options parser.Setup <CLIMode>('m', "mode").Callback((CLIMode mode) => { startupArgs.mode = mode; }); // parse split options parser.Setup <string>('f', "FileToSplit").Callback((string fileToSplit) => { startupArgs.filePath = fileToSplit; }); parser.Setup <string>('o', "OutputFolder").Callback((string folder) => { startupArgs.outputFolder = folder; }); parser.Setup <string>('d', "DataMappingFilePath").Callback((string mappingPath) => { startupArgs.dataMappingPath = mappingPath; }); parser.Setup <bool>('b', "BigEndian").Callback((bool bigEndian) => { startupArgs.isBigEndian = bigEndian; }); parser.Setup <List <string> >('a', "AnimationList").Callback((List <string> animationList) => { startupArgs.animationList = animationList.ToArray(); }); //parser.Setup<bool> // parse build options parser.Setup <string>('p', "ProjectName").Callback((string projectName) => { startupArgs.projectName = projectName; }); parser.Setup <SA_Tools.Game>('g', "Game").Callback((SA_Tools.Game game) => { startupArgs.game = game; }); parser.Setup <bool>('r', "RunAfterBuild").Callback((bool runAfterbuild) => { startupArgs.runAfterBuild = runAfterbuild; }); // do help parser.SetupHelp("?", "help").Callback((string text) => { Console.WriteLine("Project Manager cmd line options:"); Console.WriteLine(text); Console.WriteLine("NOTE: Not all of these options are valid in all contexts."); Console.WriteLine("You must set Mode. To either Split, SplitMDL, or Build."); Console.WriteLine("Split requires:"); Console.WriteLine(" FileToSplit: This is the file with the data you'd like to extract."); Console.WriteLine(" DataMappingFilePath: This is the INI file that says where things are in the data file."); Console.WriteLine(" OutputFolder: This is where the split data will be placed."); Console.WriteLine(); Console.WriteLine("SplitMDL requires everything Split does but also:"); Console.WriteLine(" BigEndian: true/false. States whether or not the file is big endian."); Console.WriteLine(" AnimationList: (optional) a list of SAAnimation files to use. Paths are relative to the mdl file."); Console.WriteLine("Build requires:"); Console.WriteLine(" ProjectName: name of the project to build."); Console.WriteLine(" Game: Game the project is for. Valid values are SADXPC and SA2B"); Console.WriteLine(" RunAfterBuild: true/false. Whether or not to start the game and load the mod after build is complete"); }); parser.Parse(args); if (startupArgs.mode != CLIMode.None) // user wants to use the CLI { switch (startupArgs.mode) { case CLIMode.Split: CLISplit(startupArgs); break; case CLIMode.SplitMDL: CLISplitMDL(startupArgs); break; case CLIMode.Build: CLIBuild(startupArgs); break; default: break; } } else { // first check to see if we're configured properly. if (!AnyGamesConfigured()) { GameConfig gameConfig = new GameConfig(); DialogResult configResult = gameConfig.ShowDialog(); if (configResult == DialogResult.Abort) { return((int)ERRORVALUE.InvalidConfig); } gameConfig.Dispose(); } // todo: catch unhandled exceptions projectSelect = new ProjectManager(); Application.ThreadException += Application_ThreadException; Application.Run(projectSelect); } return(0); }
static int Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ProjectManager projectSelect; //Properties.Settings.Default.Upgrade(); settings = ProjectManagerSettings.Load(); StartupArgs startupArgs = new StartupArgs(); startupArgs.mode = CLIMode.None; FluentCommandLineParser parser = new FluentCommandLineParser(); // parse main options parser.Setup <CLIMode>('m', "mode").Callback(mode => startupArgs.mode = mode); // parse split options parser.Setup <string>('f', "FileToSplit").Callback(fileToSplit => startupArgs.filePath = fileToSplit); parser.Setup <string>('d', "DataMappingFilePath").Callback(mappingPath => startupArgs.dataMappingPath = mappingPath); parser.Setup <bool>('b', "BigEndian").Callback(bigEndian => startupArgs.isBigEndian = bigEndian); parser.Setup <string>('o', "OutputFolder").Callback(folder => startupArgs.outputFolder = folder); parser.Setup <List <string> >('a', "AnimationList").Callback(animationList => startupArgs.animationList = animationList.ToArray()); //parser.Setup<bool> // parse build options parser.Setup <string>('p', "ProjectName").Callback(projectName => startupArgs.projectName = projectName); parser.Setup <SA_Tools.Game>('g', "Game").Callback(game => startupArgs.game = game); parser.Setup <bool>('r', "RunAfterBuild").Callback(runAfterbuild => startupArgs.runAfterBuild = runAfterbuild); // do help parser.SetupHelp("?", "help").Callback(text => Console.WriteLine(text)); parser.Parse(args); if (startupArgs.mode != CLIMode.None) // user wants to use the CLI { switch (startupArgs.mode) { case CLIMode.Split: CLISplit(startupArgs); break; case CLIMode.SplitMDL: CLISplitMDL(startupArgs); break; case CLIMode.Build: CLIBuild(startupArgs); break; default: break; } } else { // first check to see if we're configured properly. if (!AnyGamesConfigured()) { GameConfig gameConfig = new GameConfig(); DialogResult configResult = gameConfig.ShowDialog(); if (configResult == DialogResult.Abort) { return((int)ERRORVALUE.InvalidConfig); } gameConfig.Dispose(); } // todo: catch unhandled exceptions projectSelect = new ProjectManager(); Application.ThreadException += Application_ThreadException; Application.Run(projectSelect); } return(0); }