Ejemplo n.º 1
0
        private int Docs(DocsOptions opts)
        {
            // If version provided is "latest", it is being replaced with currently most recent one
            if (opts.Version == "latest")
            {
                opts.Version = installationManager.GetLatestDarkRiftVersion();
            }

            if (opts.Version == null)
            {
                // If version info was omitted, overwrite any parameters with current project settings
                if (context.Project?.Runtime != null)
                {
                    opts.Version = context.Project.Runtime.Version;
                }
                else
                {
                    Console.Error.WriteLine(Output.Red($"Couldn't find a version to download documentation. To download latest version 'latest'"));
                    return(1);
                }
            }

            if (opts.Local)
            {
                DocumentationInstallation installation = documentationManager.GetInstallation(opts.Version);
                if (installation != null)
                {
                    installation.Open();
                }
                else
                {
                    Console.Error.WriteLine(Output.Red($"Documentation not installed, consider running \"darkrift pull {opts.Version} --docs\""));
                }
            }
            else if (opts.Version != null)
            {
                BrowserUtil.OpenTo($"https://darkriftnetworking.com/DarkRift2/Docs/{opts.Version}");
            }

            return(0);
        }
Ejemplo n.º 2
0
        private static int Docs(DocsOptions opts)
        {
            // If "latest" option is provided we use the most recent version
            if (opts.Version == "latest")
            {
                opts.Version = VersionManager.GetLatestDarkRiftVersion();
            }

            if (opts.Version == null)
            {
                // If version info was omitted, overwrite version with current project settings
                if (Project.Loaded)
                {
                    opts.Version = Project.Runtime.Version;
                }
                else
                {
                    Console.Error.WriteLine(Output.Red($"Couldn't find a version to download documentation. To download latest version 'latest'"));
                    return(2);
                }
            }

            if (opts.Local)
            {
                if (VersionManager.IsDocumentationInstalled(opts.Version))
                {
                    BrowserUtil.OpenTo("file://" + VersionManager.GetDocumentationPath(opts.Version) + "/index.html");
                }
                else
                {
                    Console.Error.WriteLine(Output.Red($"Documentation not installed, consider running \"darkrift pull {opts.Version} --docs\""));
                }
            }
            else if (opts.Version != null)
            {
                BrowserUtil.OpenTo($"{Config.DR_DR2_DOCS_URI}/{opts.Version}");
            }

            return(0);
        }