Example #1
0
        public static Topology GetTopology(Install9WizardArgs args)
        {
            Topology topology = Topology.Undefined;

            var filesToPatch = GetConfigFilesToPatch(args);

            foreach (var fileToPatch in filesToPatch)
            {
                var fileName = Path.GetFileNameWithoutExtension(fileToPatch);

                if (fileName.IndexOf(Topology.XP0.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    return(Topology.XP0);
                }
                else if (fileName.IndexOf(Topology.XP1.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    return(Topology.XP1);
                }
                else if (fileName.IndexOf(Topology.XM1.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    return(Topology.XM1);
                }
            }

            return(topology);
        }
Example #2
0
        public void InitializeStep(WizardArgs wizardArgs)
        {
            Assert.ArgumentNotNull(wizardArgs, nameof(wizardArgs));
            Install9WizardArgs args = (Install9WizardArgs)wizardArgs;

            this.owner  = args.WizardWindow;
            this.tasker = args.Tasker;
            this.TasksList.DataContext = args.Tasker.Tasks.Where(t => (t.SupportsUninstall() && t.UnInstall) || !t.UnInstall);
        }
        public void UnpackInstallationFiles(Install9WizardArgs args)
        {
            RealZipFile zip = new RealZipFile(new RealFile(new RealFileSystem(), args.Product.PackagePath));

            zip.ExtractTo(new RealFolder(new RealFileSystem(), args.ScriptRoot));
            string      configFilesZipPath = Directory.GetFiles(args.ScriptRoot, "*Configuration files*.zip").First();
            RealZipFile configFilesZip     = new RealZipFile(new RealFile(new RealFileSystem(), configFilesZipPath));

            configFilesZip.ExtractTo(new RealFolder(new RealFileSystem(), args.ScriptRoot));
        }
Example #4
0
        public static void AddUninstallTasks(Install9WizardArgs args)
        {
            // Uninstallation tasks should be added only to SC90x parameter files (*.json).
            var versions = new List <int>()
            {
                900, 901, 902
            };

            var scVersion = args.Product?.Release?.Version;

            Log.Debug($"AddUnInstallationTasks: scVersion '{scVersion}'");

            if (scVersion == null || !versions.Contains(scVersion.MajorMinorUpdateInt))
            {
                // Starting from SC910 the uninstall tasks are included OOB.
                return;
            }

            var scVersionInt = scVersion.MajorMinorUpdateInt;

            var topology = GetTopology(args);

            if (topology == Topology.Undefined)
            {
                Log.Warn($"Topology was not recognized.");
                return;
            }

            // Try to load Uninstall Tasks files
            var uninstallTasksFolder = "SC90UninstallTasks";
            var path      = Path.Combine(Directory.GetCurrentDirectory(), uninstallTasksFolder, topology.ToString());
            var fileNames = Directory.GetFiles(path, "*.json", SearchOption.TopDirectoryOnly);

            if (fileNames.Length == 0)
            {
                Log.Warn($"Uninstall tasks patch files were not found. Path: {path}");
                return;
            }

            var uninstallTasksPatches = new Dictionary <string, JObject>();

            ReadUninstallTasksToDict(fileNames, uninstallTasksPatches);

            // Load version specific Uninstall Tasks files
            if (Directory.Exists(Path.Combine(path, scVersionInt.ToString())))
            {
                var versionSpecificFiles = Directory.GetFiles(Path.Combine(path, scVersionInt.ToString()), "*.json", SearchOption.TopDirectoryOnly);

                ReadUninstallTasksToDict(versionSpecificFiles, uninstallTasksPatches);
            }

            var listConfigFilesToPatch = GetConfigFilesToPatch(args);

            var result = PatchFilesWithUninstallTasks(listConfigFilesToPatch, uninstallTasksPatches);
        }
        public void UnpackInstallationFiles(Install9WizardArgs args)
        {
            string      packagename = Path.GetFileName(args.ScriptRoot) + ".zip";
            string      packagepath = Path.Combine(ProfileManager.Profile.LocalRepository, packagename);
            RealZipFile zip         = new RealZipFile(new RealFile(new RealFileSystem(), packagepath));

            zip.ExtractTo(new RealFolder(new RealFileSystem(), args.ScriptRoot));
            string      configFilesZipPath = Directory.GetFiles(args.ScriptRoot, "*Configuration files*.zip").First();
            RealZipFile configFilesZip     = new RealZipFile(new RealFile(new RealFileSystem(), configFilesZipPath));

            configFilesZip.ExtractTo(new RealFolder(new RealFileSystem(), args.ScriptRoot));
        }
Example #6
0
        public bool OnMovingNext(WizardArgs wizardArgs)
        {
            Assert.ArgumentNotNull(wizardArgs, nameof(wizardArgs));
            Install9WizardArgs args = (Install9WizardArgs)wizardArgs;

            if (!args.Tasker.Tasks.Any(t => t.ShouldRun))
            {
                MessageBox.Show("At least one task must be selected");
                return(false);
            }

            return(true);
        }
Example #7
0
        public static void CopyCustomSifConfig(Install9WizardArgs args)
        {
            var customConfigFolderName = "CustomSifConfig";

            var customConfigFolderPath = Path.Combine(Directory.GetCurrentDirectory(), customConfigFolderName);

            var topology = GetTopology(args);

            if (topology == Topology.Undefined)
            {
                Log.Warn($"SC topology could not be recognized.");

                return;
            }

            var version = args.Product?.Release?.Version;

            if (version == null)
            {
                return;
            }

            var sourcePath = Path.Combine(customConfigFolderPath, topology.ToString(), version.MajorMinorUpdateInt.ToString());

            if (!Directory.Exists(sourcePath))
            {
                Log.Debug($"Custom SIF config folder does not exist. Topology: {topology.ToString()}, Path: {sourcePath}");

                return;
            }

            var targetDir = args.ScriptRoot;

            if (!Directory.Exists(targetDir))
            {
                Log.Debug($"Custom SIF config could not be copied to target folder. Folder does not exist: {targetDir}");

                return;
            }

            var files = Directory.GetFiles(sourcePath, "*.json", SearchOption.TopDirectoryOnly);

            foreach (string s in files)
            {
                var fileName = Path.GetFileName(s);
                var destFile = Path.Combine(targetDir, fileName);
                File.Copy(s, destFile, true);
            }
        }
        public bool OnMovingNext(WizardArgs wizardArgs)
        {
            Assert.ArgumentNotNull(wizardArgs, nameof(wizardArgs));
            Install9WizardArgs args = (Install9WizardArgs)wizardArgs;

            if (this.Messages.Any(m => m.State != Sitecore9Installer.Validation.ValidatorState.Success))
            {
                if (MessageBox.Show("There are validation errors/warnings do you want to run install anyway?", "Validation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    return(true);
                }

                return(false);
            }

            return(true);
        }
        public void InitializeStep(WizardArgs wizardArgs)
        {
            Assert.ArgumentNotNull(wizardArgs, nameof(wizardArgs));
            Install9WizardArgs args = (Install9WizardArgs)wizardArgs;

            this.owner  = args.WizardWindow;
            this.tasker = args.Tasker;
            if (args.Validate)
            {
                TaskDialogResult result = WindowHelper.LongRunningTask(() => this.RunValidation(), "Running validation", owner);
                if (result == null)
                {
                    this.Caption.Text = "Validation aborted by user.";
                }
            }
            else
            {
                this.Caption.Text = "Validation skipped by user.";
            }
        }
 public static void Run(Install9WizardArgs args)
 {
     System.Diagnostics.Process.Start("explorer.exe", Path.Combine(args.ScriptRoot, "generated_scripts"));
 }
Example #11
0
 private static string[] GetConfigFilesToPatch(Install9WizardArgs args)
 {
     return(Directory.GetFiles(args.ScriptRoot, "*.json"));
 }