Esempio n. 1
0
        static async Task RunAsync()
        {
            string version     = Options.Version;
            bool   prefer32bit = Options.Prefer32Bit;

            if (string.IsNullOrEmpty(version))
            {
                Console.WriteLine("Please specify a Unity version");
                Environment.Exit(1);

                return;
            }

            try
            {
                var asset = await DownloadManager.GetEditorAsset(version).ConfigureAwait(false);

                var dirPath = await ArchiveManager.ExtractEditor(asset).ConfigureAwait(false);

                var zipPath = await ArchiveManager.CompressDLLs(asset, dirPath).ConfigureAwait(false);
            }
            catch (EditorVersionNotFoundException)
            {
                if (version != "-")
                {
                    Console.WriteLine($"Could not find assets for Unity Version {version}\n");
                    Console.WriteLine("Available Versions:");
                }

                foreach (var asset in DownloadManager.Assets.Values)
                {
                    Console.Write(asset.Version);
                    if (asset.Win32Url != null)
                    {
                        Console.Write("\t (64/32)");
                    }

                    Console.Write("\n");
                }

                Environment.Exit(1);
            }
            catch (System.ComponentModel.Win32Exception)
            {
                if (Options.SevenZipPath == null)
                {
                    Console.WriteLine("Could not find 7-Zip CLI in your PATH");
                    Console.WriteLine("You can use the -z flag to override the path search");
                }
                else
                {
                    Console.WriteLine("Could not find the 7-Zip CLI");
                }

                Environment.Exit(1);
            }
            finally
            {
                Cleanup();
            }
        }