Example #1
0
        private IList <StatusReportItem> ExecuteRemote(string[] patchesRoots, string selectedVersion, string patchSet, string command)
        {
            IEnumerable <string> args = new[] { "-h", $"\"{ConfigManager.DocumentPath}\"", "-d", $"\"{_dcsRoot}\"", command }
            .Concat(patchesRoots.Select(root => $"\"{Path.Combine(root, selectedVersion, patchSet)}\""));
            string myDirectory    = Directory.GetParent(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location)).FullName;
            string executablePath = Path.Combine(myDirectory ?? "", "HeliosPatching.exe");

            using (ElevatedProcess elevated = new ElevatedProcess(executablePath, args))
            {
                if (!elevated.TryExecute())
                {
                    return(new StatusReportItem
                    {
                        Status =
                            $"Running the HeliosPatching.exe utility as administrator either failed or was canceled by the user.  No changes will be written to {LongDescription}",
                        Recommendation = "Try the patching operation again and give permission to execute HeliosPatching.exe as administrator",
                        Link = StatusReportItem.ProfileEditor,
                        Severity = StatusReportItem.SeverityCode.Warning
                                   // NOTE: configuration out of date indicates that this can be corrected by trying again
                    }.AsReport());
                }
                return(elevated.ReadResults());
            }
        }