Example #1
0
        private static void Run(IReadOnlyList <string> args)
        {
            if (args.Count > 0)
            {
                // Allows for drag & drop of the launcher onto Packsly executable to initiate installation
                FileInfo launcher = new FileInfo(args[0]);

                if (launcher.Exists)
                {
                    logger.Debug("Running in drag & drop mode!");
                    pauseWhenFinished = true;

                    DirectoryInfo workspace = string.Equals(launcher.Extension, ".lnk", StringComparison.OrdinalIgnoreCase)
                        ? ShortcutHelper.GetShortcutTarget(launcher).Directory
                        : launcher.Directory;

                    Installer.Run(new InstallOptions {
                        Source    = Packsly.Configuration.DefaultModpackSource,
                        Workspace = workspace.FullName
                    });
                }
                // Run usage as a CLI tool
                else
                {
                    logger.Debug("Running in command line mode!");
                    Parser.Default.ParseArguments <InstallOptions, LifecycleOptions>(args)
                    .WithParsed <InstallOptions>(Installer.Run)
                    .WithParsed <LifecycleOptions>(Lifecycle.Publish);
                }
            }
            // Run running as a application
            else
            {
                logger.Debug("Running in application mode!");
                pauseWhenFinished = true;
                Installer.Run(new InstallOptions {
                    Source = Packsly.Configuration.DefaultModpackSource
                });
            }
        }