Beispiel #1
0
        private void Backup(Group backupGroup)
        {
            if (backupGroup == null)
            {
                return;
            }

            ProgramOperation opPF = new ProgramOperation(backupGroup, Uninstall);

            opPF.Arguments = UninstallArgs;
            backupGroup.Operations.Add(opPF);

            if (Anolis.Core.Utility.Environment.IsX64)
            {
                String x86UninstString = null;

                if (Uninstall.StartsWith("%programfiles%", StringComparison.OrdinalIgnoreCase))
                {
                    x86UninstString = "%programfiles(x86)%" + Uninstall.Substring("%programfiles%".Length);
                }
                else if (Uninstall.StartsWith("%commonprogramfiles%", StringComparison.OrdinalIgnoreCase))
                {
                    x86UninstString = "%commonprogramfiles(x86)%" + Uninstall.Substring("%commonprogramfiles%".Length);
                }


                if (x86UninstString != null)
                {
                    ProgramOperation opPFx86 = new ProgramOperation(backupGroup, x86UninstString);
                    opPFx86.Arguments = UninstallArgs;
                    backupGroup.Operations.Add(opPFx86);
                }
            }
        }
Beispiel #2
0
        private void BackupPart2(Group backupGroup, List <String> progidsToDelete, List <String> extsToDelete, List <String> iconFilesToDelete)
        {
            if (backupGroup == null)
            {
                return;
            }

            foreach (String progId in progidsToDelete)
            {
                if (String.IsNullOrEmpty(progId))
                {
                    continue;                                                  // just in case
                }
                ProgramOperation pop = ProgramOperation.CreateRegistryOperation(backupGroup, "DELETE", @"HKEY_CLASSES_ROOT\" + progId);
                backupGroup.Operations.Add(pop);
            }

            foreach (String ext in extsToDelete)
            {
                if (String.IsNullOrEmpty(ext))
                {
                    continue;                                               // just in case
                }
                ProgramOperation pop = ProgramOperation.CreateRegistryOperation(backupGroup, "DELETE", @"HKEY_CLASSES_ROOT\" + ext);
                backupGroup.Operations.Add(pop);
            }

            foreach (String fileName in iconFilesToDelete)
            {
                FileOperation fop = new FileOperation(backupGroup, fileName);
                backupGroup.Operations.Add(fop);
            }
        }
Beispiel #3
0
/*		private static void GetFileName(String path, out String fileName, out String args) {
 *
 *                      if( !path.StartsWith("\"") ) {
 *                              fileName = path;
 *                              args     = String.Empty;
 *                              return;
 *                      }
 *
 *                      Int32 lastQuote = path.LastIndexOf('"');
 *                      if( lastQuote == -1 ) {
 *
 *                              fileName = path.Substring(1);
 *                              args     = String.Empty;
 *                              return;
 *                      }
 *
 *                      fileName = path.Substring( 1, lastQuote );
 *                      args     = path.Substring( lastQuote );
 *
 *              } */

        public static ProgramOperation CreateRegistryOperation(Group parentGroup, String regOperation, String keyPath)
        {
            ProgramOperation op = new ProgramOperation(parentGroup, @"%windir%\system32\reg.exe");

            op.Arguments = regOperation + " \"" + keyPath + "\" /F";
            return(op);
        }
Beispiel #4
0
        private void Backup(Group backupGroup, String regKeyPath)
        {
            if (backupGroup == null)
            {
                return;
            }

            // basically, run reg.exe such that it deletes the uninstallation registry key

            ProgramOperation op = ProgramOperation.CreateRegistryOperation(backupGroup, "DELETE", regKeyPath);

            backupGroup.Operations.Add(op);
        }