private bool ExtractPlugin()

in src/dotnet/RiderPlugin.UnrealLink/PluginInstaller/UnrealPluginInstaller.cs [277:347]


        private bool ExtractPlugin(Lifetime lifetime,
            UnrealPluginInstallInfo.InstallDescription installDescription,
            VirtualFileSystemPath engineRoot, IProperty<double> progressProperty, double range)
        {
            using var def = new LifetimeDefinition();
            var ZIP_STEP = 0.5 * range;
            var PATCH_STEP = 0.5 * range;

            var pluginRootFolder = installDescription.UnrealPluginRootFolder;
            pluginRootFolder.CreateDirectory().DeleteChildren();

            var editorPluginPathFile = myPathsProvider.PathToPackedPlugin;
            try
            {
                ZipFile.ExtractToDirectory(editorPluginPathFile.FullPath, pluginRootFolder.FullPath);
                progressProperty.Value += ZIP_STEP;
            }
            catch (Exception exception)
            {
                myLogger.Warn(exception, $"[UnrealLink]: Couldn't extract {editorPluginPathFile} to {pluginRootFolder}");

                const string unzipFailTitle = "Failed to unzip new RiderLink plugin";
                var unzipFailText =
                    $"Failed to unzip new version of RiderLink ({editorPluginPathFile.FullPath}) to user folder ({pluginRootFolder.FullPath})\n" +
                    "Try restarting Rider in administrative mode";

                myUnrealHost.myModel.RiderLinkInstallMessage(new InstallMessage(unzipFailTitle, ContentType.Error));
                myUnrealHost.myModel.RiderLinkInstallMessage(new InstallMessage(unzipFailText, ContentType.Error));
                return false;
            }

            if (!PatchUpluginFileAfterInstallation(pluginRootFolder))
            {
                const string failedToPatch = "Failed to patch RiderLink.uplugin";
                var failedPatchText = "Failed to set `EnableByDefault` to true in RiderLink.uplugin\n" +
                                      "You need to manually enable RiderLink in UnrealEditor";
                myUnrealHost.myModel.RiderLinkInstallMessage(new InstallMessage(failedToPatch, ContentType.Normal));
                myUnrealHost.myModel.RiderLinkInstallMessage(new InstallMessage(failedPatchText, ContentType.Normal));
            }

            progressProperty.Value += PATCH_STEP;

            lifetime.ToCancellationToken().ThrowIfCancellationRequested();

            installDescription.IsPluginAvailable = true;
            installDescription.PluginChecksum = myPathsProvider.CurrentPluginChecksum;

            var title = Strings.RiderLinkPluginExtracted_Title;
            var text = Strings.RiderLinkPluginExtracted_Message.Format(pluginRootFolder);

            myUnrealHost.myModel.RiderLinkInstallMessage(new InstallMessage(title, ContentType.Normal));
            myUnrealHost.myModel.RiderLinkInstallMessage(new InstallMessage(text, ContentType.Normal));

            var notification = new NotificationModel(mySolution.GetRdProjectId(), title, text, true,
              RdNotificationEntryType.INFO, new List<NotificationHyperlink>());

            mySolution.Locks.ExecuteOrQueue(Lifetime, "UnrealLink.InstallPlugin",
                () => { myNotificationsModel.Notification(notification); });

            var cppUe4SolutionDetector = mySolution.GetComponent<ICppUE4SolutionDetector>();
            var isSln = cppUe4SolutionDetector.SupportRiderProjectModel != CppUE4ProjectModelSupportMode.UprojectOpened;

            if (isSln)
            {
                RefreshSlnProjectFiles(installDescription, engineRoot);
            } else
            {
                RefreshUprojectProjectFiles(lifetime, pluginRootFolder);
            }
            return true;
        }