示例#1
0
        protected void OnGenerateGameManifestButtonClicked(object sender, EventArgs e)
        {
            generateGameManifestButton.Sensitive      = false;
            generateLaunchpadManifestButton.Sensitive = false;

            string TargetDirectory = fileChooser.Filename;

            if (!Directory.GetFiles(TargetDirectory).Any(s => s.Contains("GameVersion.txt")))
            {
                MessageDialog dialog = new MessageDialog(this,
                                                         DialogFlags.Modal,
                                                         MessageType.Question,
                                                         ButtonsType.YesNo,
                                                         LocalizationCatalog.GetString("No GameVersion.txt file could be found in the target directory. This file is required.\n" +
                                                                                       "Would you like to add one? The version will be \"1.0.0\"."));

                if (dialog.Run() == (int)ResponseType.Yes)
                {
                    string gameVersionPath = $"{TargetDirectory}{System.IO.Path.DirectorySeparatorChar}GameVersion.txt";
                    File.WriteAllText(gameVersionPath, new Version("1.0.0").ToString());

                    dialog.Destroy();
                }
                else
                {
                    dialog.Destroy();
                    return;
                }
            }

            Manifest.GenerateManifest(TargetDirectory, EManifestType.Game);
        }
示例#2
0
        protected void OnGenerateLaunchpadManifestButtonClicked(object sender, EventArgs e)
        {
            generateGameManifestButton.Sensitive      = false;
            generateLaunchpadManifestButton.Sensitive = false;

            string TargetDirectory = fileChooser.Filename;

            ManifestHandler Manifest = new ManifestHandler();

            Manifest.ManifestGenerationProgressChanged += OnGenerateManifestProgressChanged;
            Manifest.ManifestGenerationFinished        += OnGenerateManifestFinished;

            Manifest.GenerateManifest(TargetDirectory, EManifestType.Launchpad);
        }
示例#3
0
        private static void Main(string[] args)
        {
            CLIOptions options = new CLIOptions();

            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                if (options.RunBatchProcessing)
                {
                    if (string.IsNullOrEmpty(options.TargetDirectory) || options.ManifestType == EManifestType.Unknown)
                    {
                        Console.Write(options.GetUsage());
                    }

                    // At this point, the options should be valid. Run batch processing.
                    if (Directory.Exists(options.TargetDirectory))
                    {
                        Log.Info("Generating manifest...");

                        ManifestHandler manifestHandler = new ManifestHandler();

                        manifestHandler.ManifestGenerationProgressChanged += OnProgressChanged;
                        manifestHandler.ManifestGenerationFinished        += OnGenerationFinished;

                        manifestHandler.GenerateManifest(options.TargetDirectory, options.ManifestType);
                    }
                    else
                    {
                        Log.Error("The selected directory did not exist.");
                    }
                }
                else if (string.IsNullOrEmpty(options.TargetDirectory) && options.ManifestType == EManifestType.Unknown)
                {
                    // Run a GTK UI instead of batch processing
                    Gtk.Application.Init();

                    MainWindow win = new MainWindow();
                    win.Show();
                    Gtk.Application.Run();
                }
                else
                {
                    Console.Write(options.GetUsage());
                }
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            List <string> Arguments = new List <string>(args);

            if (args.Length > 0)
            {
                if (Arguments.Contains(BatchSwitch))
                {
                    // Don't load the UI - instead, run the manifest generation directly
                    Console.WriteLine("[Info]: Running in batch mode.");

                    EManifestType ManifestType = EManifestType.Game;
                    if (Arguments.Contains(ManifestTypeSwitch))
                    {
                        if (Arguments.IndexOf(ManifestTypeSwitch) != args.Length - 1)
                        {
                            string targetManifest = Arguments[(Arguments.IndexOf(ManifestTypeSwitch) + 1)];

                            if (EManifestType.Game.ToString() == targetManifest)
                            {
                                ManifestType = EManifestType.Game;
                            }
                            else if (EManifestType.Launchpad.ToString() == targetManifest)
                            {
                                ManifestType = EManifestType.Launchpad;
                            }
                            else
                            {
                                Console.WriteLine("[Warning]: The '-m' manifest switch must be followed by either 'Game' or 'Launcher'.");
                            }
                        }
                        else
                        {
                            Console.WriteLine("[Warning]: The '-m' manifest switch must be followed by either 'Game' or 'Launcher'.");
                        }
                    }

                    if (Arguments.Contains(DirectorySwitch))
                    {
                        if (Arguments.IndexOf(DirectorySwitch) != args.Length - 1)
                        {
                            string TargetDirectory = Arguments[(Arguments.IndexOf(DirectorySwitch) + 1)].TrimEnd(Path.DirectorySeparatorChar);
                            Console.WriteLine(TargetDirectory);

                            if (Directory.Exists(TargetDirectory))
                            {
                                Console.WriteLine("[Info]: Generating manifest...");

                                ManifestHandler Manifest = new ManifestHandler();

                                Manifest.ManifestGenerationProgressChanged += OnProgressChanged;
                                Manifest.ManifestGenerationFinished        += OnGenerationFinished;

                                Manifest.GenerateManifest(TargetDirectory, ManifestType);
                            }
                            else
                            {
                                Console.WriteLine("[Warning]: The '-d' directory switch must be followed by a valid directory.");
                            }
                        }
                        else
                        {
                            Console.WriteLine("[Warning]: The '-d' directory switch must be followed by a valid directory.");
                        }
                    }
                    else
                    {
                        Console.WriteLine("[Warning]: No directory provided for batch mode, using working directory.");
                        Console.WriteLine("[Info]: Generating manifest...");

                        ManifestHandler Manifest = new ManifestHandler();

                        Manifest.ManifestGenerationProgressChanged += OnProgressChanged;
                        Manifest.ManifestGenerationFinished        += OnGenerationFinished;

                        Manifest.GenerateManifest(Directory.GetCurrentDirectory(), ManifestType);
                    }
                }
                else
                {
                    Console.WriteLine("[Info]: Run the program with -b to enable batch mode. Use -d <directory> to select the target directory, or omit it to use the working directory. Use -m [Game|Launcher] to select the type of manifest (default is Game).");
                }
            }
            else
            {
                // run a GTK UI instead of WinForms
                Gtk.Application.Init();

                MainWindow win = new MainWindow();
                win.Show();
                Gtk.Application.Run();
            }
        }