Example #1
0
        public bool TestWebConfigViewModal()
        {
            Console.WriteLine("TestWebConfigViewModal");

            XmlConfigurationHotfix update = new XmlConfigurationHotfix();

            update.objXMLContentFixes = new XmlContentFix[1];
            XmlContentFix[] xmlFixes = update.objXMLContentFixes;

            xmlFixes[0]                        = new XmlContentFix();
            xmlFixes[0].description            = "Add openModal=\"true\" attribute to View nodes";
            xmlFixes[0].objContentFixAttribute =
                new ContentFixAttribute(
                    new Utilities.Hotfix.Xml.Attribute[]
            {
                new Utilities.Hotfix.Xml.Attribute(
                    @"/configuration/uipConfiguration/views/view",
                    "openModal",
                    "true")
            },
                    null,
                    null,
                    null);

            xmlFixes[0].contentXmlFilePath = @"D:\Tech\5.2\\.W2.Web.Application\Web.config";
            update.Save(@"c:\.Web.config.openModal.xml");
            update.Install(log);


            return(true);
        }
Example #2
0
        public bool UpdateTarget()
        {
            XmlConfigurationHotfix update = new XmlConfigurationHotfix();

            update.objXMLContentFixes = new XmlContentFix[1];
            XmlContentFix[] xmlFixes = update.objXMLContentFixes;

            xmlFixes[0]                        = new XmlContentFix();
            xmlFixes[0].description            = "Add openModal=\"true\" attribute to View nodes";
            xmlFixes[0].objContentFixAttribute =
                new ContentFixAttribute(
                    new Utilities.Hotfix.Xml.Attribute[]
            {
                new Utilities.Hotfix.Xml.Attribute(
                    @"/configuration/uipConfiguration/views/view",
                    "openModal",
                    "true")
            },
                    null,
                    null,
                    null);

            foreach (FileRef objFileRef in mobjTargetFiles)
            {
                xmlFixes[0].contentXmlFilePath = objFileRef.ConfigFile;
                update.Install(log);
            }

            log.Show();

            return(true);
        }
Example #3
0
        public bool TestHF6Issue12()
        {
            Console.WriteLine("TestHF6Issue12");
            string strConfig = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\Admin\Check\Partial.Config. Admin.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\Admin\Check\NOT_Working_Admin_Web.config";
            update.Install(log);
            return(true);
        }
Example #4
0
        public bool TestHF6Issue10()
        {
            Console.WriteLine("TestHF6Issue10");
            string strConfig = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\Issue 10 ComputerName\Changes.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\Issue 10 ComputerName\Copy of Web.config";
            update.Install(log);
            return(true);
        }
Example #5
0
        public bool TestMessageRouter()
        {
            Console.WriteLine("MessageRouter");
            string strConfig = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\Message\Changes.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\Message\Copy of Message.xml";
            update.Install(log);
            return(true);
        }
Example #6
0
        public bool TestIssueContentElements()
        {
            Console.WriteLine("ContentElements");
            string strConfig = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\ContentElements\Config. Web Site.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"d:\ALEXANDER\SUBJECTS\2007.09.03 Hotfix 6 Issues\ContentElements\Copy of Web.config";
            update.Install(log);
            return(true);
        }
Example #7
0
        public bool TestInstallXmlConfigWebSite()
        {
            Logger log       = new Logger(Logger.GetNewLogFilename());
            string strConfig = @"c:\Hotfix 5\Setup\Config. Web Site.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\Inetpub\wwwroot\\Web.config";
            update.Install(log);
            return(true);
        }
Example #8
0
        public bool TestIssue5inHF6()
        {
            Console.WriteLine("TestIssue5inHF6");
            string strConfig = @"c:\ALEXANDER\SUBJECTS\29.08.2007 HF6 Config Changes\Test Issue 6\Config.Issue5.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\ALEXANDER\SUBJECTS\29.08.2007 HF6 Config Changes\Test Issue 6\Copy of Issue5TestWeb.origin.config";
            update.Install(log);
            return(true);
        }
Example #9
0
        public bool TestLEUMI()
        {
            Console.WriteLine("TestLEUMI");
            string strConfig = @"c:\LEUMI\TestLeumi\Config. Admin.AdminConfig.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\LEUMI\TestLeumi\AdminConfig.xml";
            update.Install(log);
            return(true);
        }
Example #10
0
        public bool TestService11exeConfigXmlUpdate()
        {
            Console.WriteLine("TestService11exeConfigXmlUpdate");
            string strConfig = @"C:\Config.Engine Service.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\Service1.1.exe.config";
            update.Install(log);
            return(true);
        }
Example #11
0
        public bool TestCopyAttributes()
        {
            Console.WriteLine("Test Copying of attributes ");
            string strConfig = @"c:\Delete\TestHotfix\hotfix\ConfigChangeTest.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\Program Files\! Solutions Test\Service A\Web.Config";
            update.Install(log);
            return(true);
        }
Example #12
0
        public bool TestInstallXmlConfigEcm4P8()
        {
            Logger log       = new Logger(Logger.GetNewLogFilename());
            string strConfig = @"c:\Hotfix 5\Setup\Config.  Permission Manager Service.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\Program Files\ Solutions\  Permission Manager Service\.PermissionManager.Provider.Service.exe.config";
            update.Install(log);
            return(true);
        }
Example #13
0
        public bool TestWebSiteXmlUpdate()
        {
            Console.WriteLine("Test Copying of attributes ");
//			string strConfig = @"D:\Tech\\Release Branches\5.0 SP1\Hotfixes\Hotfix 5\Setup\Config. Web Site.xml";
            string strConfig = @"c:\Config. URL.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\Inetpub\wwwroot\\Copy of Web.config";
            update.Install(log);
            return(true);
        }
Example #14
0
        static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                Usage();
            }
            else if (args.Length > 2)
            {
                Console.WriteLine("ERROR: Unexpected amount of arguments.");
                Usage();
            }
            else if (args.Length == 2)
            {
                string target    = args[0];
                string patchPath = args[1];

                if (!File.Exists(target))
                {
                    Console.WriteLine("ERROR: Target file not found.");
                    Usage();
                    return(1);
                }

                if (!File.Exists(patchPath))
                {
                    Console.WriteLine("ERROR: Patch file not found.");
                    Usage();
                    return(1);
                }

                try
                {
                    // Target and Patch files found,
                    // apply target path to all defindex content fix in the patch file
                    XmlConfigurationHotfix patchFix = XmlConfigurationHotfix.Load(patchPath);
                    foreach (var XmlContentFix in patchFix.objXMLContentFixes)
                    {
                        XmlContentFix.contentXmlFilePath = target;
                    }

                    // Run the install of the patch with a logger instance
                    Logger log = new Logger();
                    patchFix.Install(log);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ERROR: Unexpected behavior: {0}", ex.Message);
                    return(-1);
                }
            }

            return(0);
        }
Example #15
0
        public bool TestIssueCopyCodebase()
        {
            Console.WriteLine("TestIssueCopyCodebase");
            string strConfig = @"c:\ALEXANDER\SUBJECTS\29.08.2007 HF6 Config Changes\TestIssueCopyCodebase\Config. Web Site.xml";
            XmlConfigurationHotfix update = XmlConfigurationHotfix.Load(strConfig);

            update.objXMLContentFixes[0].contentXmlFilePath = @"c:\ALEXANDER\SUBJECTS\29.08.2007 HF6 Config Changes\TestIssueCopyCodebase\Copy of Web.config";
            update.objXMLContentFixes[1].contentXmlFilePath = update.objXMLContentFixes[0].contentXmlFilePath;
            update.objXMLContentFixes[2].contentXmlFilePath = update.objXMLContentFixes[0].contentXmlFilePath;
            update.Install(log);
            return(true);
        }
        public void Install()
        {
            try
            {
                log.WriteLine(LogType.Empty, "");
                log.WriteLine(LogType.Empty, "");
                string message = "INSTALLATION STARTED, PLEASE WAIT.";
                Console.WriteLine(message);
                log.WriteLine(LogType.Info, "HI058: " + message);

                //-------------------------------------------------------
                // Initilize installer object by settings given
                //-------------------------------------------------------
                settings = HotfixSettings.load(SettingsFile);

                //-------------------------------------------------------
                // Get last chance before installation
                //-------------------------------------------------------
                #region Get last chance before installation
                bool blnCancel = false;
                if (InstallationStartedEvent != null)
                {
                    InstallationStartedEvent(ref blnCancel, settings.strGeneralDescription);
                    if (blnCancel)
                    {
                        message = "INSTALLATION CANCELLED.";
                        Console.WriteLine(message);
                        log.WriteLine(LogType.Info, "HI014: " + message);
                        return;
                    }
                }
                #endregion                 // Get last chance before installation


                //-------------------------------------------------------
                // Print header of machine/user/os attributes
                //-------------------------------------------------------
                log.WriteLine(LogType.Info, string.Format(@"HI059: Machine          :\\{0}\{1}", Environment.UserDomainName, Environment.MachineName));
                log.WriteLine(LogType.Info, string.Format(@"HI060: Username         :{0}", Environment.UserName));
                log.WriteLine(LogType.Info, string.Format(@"HI061: Framework        :{0}", Environment.Version.ToString()));
                log.WriteLine(LogType.Info, string.Format(@"HI062: OS Version       :{0}", Environment.OSVersion.ToString()));
                log.WriteLine(LogType.Info, string.Format(@"HI063: Current directory:{0}", Environment.CurrentDirectory));


                //-------------------------------------------------------
                // Initialize "hotfix root folder" (where installed components are)
                // relative to start up path
                //-------------------------------------------------------
                DirectoryInfo hRootFolder = null;
                if (hRootPath == null)
                {
                    // determine path to installed components( relative/full qualified)
                    if (settings.ComponentsFolderSetting.blnIsRelative)
                    {
                        hRootPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                 settings.ComponentsFolderSetting.strFolder);
                    }
                    else
                    {
                        hRootPath = settings.ComponentsFolderSetting.strFolder;
                    }
                }
                hRootFolder = new DirectoryInfo(hRootPath);

                //-------------------------------------------------------
                // Initialize list of installed components (processed directories)
                // and possible destinations
                //-------------------------------------------------------
                #region Initialize list of processed directories
                foreach (DirectoryInfo sub in hRootFolder.GetDirectories())
                {
                    //if not excluded from installed components
                    if (!settings.IsExcluded(sub))
                    {
                        // found out destination folder of installed component
                        try
                        {
                            //exception will be thrown for some wrong arguments
                            DirectoryInfo[] dest = DiscoverDest(sub);

                            // add to list of installed components
                            SrcDestPair pair = new SrcDestPair(sub, dest);
                            processed.Add(pair);
                        }
                        catch (ArgumentException ex)
                        {
                            log.WriteLine(LogType.Error, "HI001: " + ex.ToString());
                        }
                    }
                }                //foreach

                if (processed.Count == 0)
                {
                    string strMessage = string.Format("Nothing found to be installed.{0}Check hotfix root folder: {1}.{0}Check the exlusions list.", Environment.NewLine, hRootFolder.FullName);
                    log.WriteLine(LogType.Info, "HI002: " + strMessage);
                    return;
                }
                #endregion

                //-------------------------------------------------------
                // Load NT Service processor with ONLY actually installed services
                //-------------------------------------------------------
                objServiceProcessor = new ServiceProcessor(this.settings, this.log);

                //-------------------------------------------------------
                // Checking available free disk space
                //-------------------------------------------------------
                #region Checking available free disk space
                bool         blnContinue = true;
                HotfixBackup objBackup   = new HotfixBackup(settings, log, processed);
                if (this.settings.Backup.blnIsDoBackup)
                {
                    Console.WriteLine("Checking available free disk space.");

                    long lngAvailable = objBackup.CalclateAvailable();
                    long lngRequired  = objBackup.CalculateRequiredFreeSpace();

                    message = string.Format("There is not enough free disk space for backuping. Required: {0}MB, Available: {1}MB",
                                            DriveInfoSystem.ToMB(lngRequired),
                                            DriveInfoSystem.ToMB(lngAvailable));

                    if (lngAvailable <= lngRequired)
                    {
                        log.WriteLine(LogType.Error, "HI055: " + message);
                        blnContinue = false;
                        return;
                    }
                    else
                    {
                        message = "[Checking available free disk space]";
                        log.WriteLine(LogType.Info, "HI057: " + message);
                        message = string.Format("Required: {0}MB, Available: {1}MB",
                                                DriveInfoSystem.ToMB(lngRequired),
                                                DriveInfoSystem.ToMB(lngAvailable));
                        log.WriteLine(LogType.Info, "HI056: " + message);
                    }
                }
                #endregion                 // Checking available free disk space


                //-------------------------------------------------------
                // Save current Status of service and Stop running services
                //-------------------------------------------------------
                Console.WriteLine("Stopping services.");

                log.WriteLine(LogType.Info, "HI003: " + "[STOP controlled services]");

                if (objServiceProcessor.Stop())
                {
                    log.WriteLine(LogType.Info, "HI004: " + "Controlled services stopped successfully.");

                    //-------------------------------------------------------
                    // Backup installed components in format of hotfix
                    //-------------------------------------------------------
                    #region Backup installed components in format of hotfix

                    if (this.settings.Backup.blnIsDoBackup)
                    {
                        Console.WriteLine("Backuping installed components.");
                        message = "[Backuping installed components]";

                        log.WriteLine(LogType.Info, "HI008: " + message);

                        blnContinue = objBackup.doBackup();

                        if (!blnContinue)
                        {
                            message = "Failed to backup installed components. Can't continue.";
                            log.WriteLine(LogType.Error, "HI005: " + message);
                            return;
                        }
                    }
                    #endregion

                    //-------------------------------------------------------
                    // Process each item in list of components.
                    // Copying from hotfix to destination folder.
                    //-------------------------------------------------------
                    Console.WriteLine("Installing components.");
                    #region Process each installed directory
                    log.WriteLine(LogType.Info, "HI006: " + "[INSTALLING Hotfix components]: " + processed.Count);
                    foreach (SrcDestPair item in processed)
                    {
                        try
                        {
                            foreach (DirectoryInfo destPath in item.destDir)
                            {
                                if (destPath.Exists)
                                {
                                    log.WriteLine(LogType.Info, "HI007: " +
                                                  String.Format(@"FOLDER: ""{0}"" found, INSTALLING ...", destPath.FullName)
                                                  );
                                    xDirectory.Copy(item.srcDir, destPath);
                                }
                                else
                                {
                                    //skipped
                                    log.WriteLine(LogType.Info, "HI008: " + String.Format(@"FOLDER: ""{0}"" is not installed, skipped.", destPath.FullName));
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            log.WriteLine(
                                LogType.Error, "HI009: " +
                                String.Format("Failed during installing:{0}, Error:{1}",
                                              item.srcDir.ToString(), ex.ToString())
                                );
                        }
                    }
                    #endregion

                    //-------------------------------------------------------
                    // Fix/Update Xml configuration files according to specification
                    // in <XmlFileFixes> for each <XmlFileFix>
                    //-------------------------------------------------------
                    Console.WriteLine("Applying changes in configuration files");

                    #region Xml Configuration Fixing

                    log.WriteLine(LogType.Info, "HI010: " + "[Xml configuration files update]");

                    //make each xml fix as it appearing in XmlFileFixes section
                    foreach (HotfixSettings.XmlFileFix filefix in settings.XmlFileFixes)
                    {
                        // find out which component we talk about to be able to find
                        // configuration xml file for: filefix
                        foreach (SrcDestPair comp in processed)
                        {
                            if (comp.srcDir.Name.ToLower() == filefix.folder.ToLower())
                            {
                                //path to fix describing changes for: filefix
                                string fileOfFixes = Path.Combine(comp.srcDir.FullName, filefix.update);

                                XmlConfigurationHotfix componentFix = XmlConfigurationHotfix.Load(fileOfFixes);

                                //get related pathes of patched files
                                if (componentFix.objXMLContentFixes.Length > 0)
                                {
                                    string[] pathes = new string[componentFix.objXMLContentFixes.Length];

                                    int index = 0;
                                    foreach (XmlContentFix contentfix in componentFix.objXMLContentFixes)
                                    {
                                        pathes[index] = contentfix.contentXmlFilePath;
                                        index++;
                                    }

                                    foreach (DirectoryInfo path in comp.destDir)
                                    {
                                        //create absolute full qualified path to fixed xml
                                        foreach (XmlContentFix contentfix in componentFix.objXMLContentFixes)
                                        {
                                            contentfix.contentXmlFilePath = Path.Combine(path.FullName, contentfix.contentXmlFilePath);
                                        }

                                        try
                                        {
                                            //---> install fixes on Xml <---
                                            componentFix.Install(log);
                                        }
                                        catch (Exception ex)
                                        {
                                            log.WriteLine(
                                                LogType.Error, "HI011: " +
                                                String.Format("Failed during Xml Configuration Fixing: {0}, Error:{1}",
                                                              fileOfFixes,
                                                              ex.ToString())
                                                );
                                        }

                                        // restore related path before next destination folder
                                        index = 0;
                                        foreach (XmlContentFix contentfix in componentFix.objXMLContentFixes)
                                        {
                                            contentfix.contentXmlFilePath = pathes[index];
                                            index++;
                                        }
                                    }
                                }
                                break;
                            }
                        }                //SrcDestPair
                    }                    //filefix
                    #endregion           // Xml Configuration Fixing

                    //-------------------------------------------------------
                    // Clear Temporary ASP.NET files cache
                    //-------------------------------------------------------
                    Console.WriteLine("Clear Temporary ASP.NET files cache.");
                    settings.mobjClearTempFiles.Do(log);

                    //-------------------------------------------------------
                    // Restore previous Status of controlled services
                    //-------------------------------------------------------
                    #region Restore controlled services Status

                    log.WriteLine(LogType.Info, "HI012: " + "[RESTORE Status of controlled services ]");
                    Console.WriteLine("Starting services.");

                    if (objServiceProcessor.Restore())
                    {
                        log.WriteLine(LogType.Info, "HI013: " + "Status of controlled services restored successfully.");
                    }
                    else
                    {
                        //-------------------------------------------------------
                        // Because KBXXXX of Microsoft not always ServiceController class able to start
                        // service. I found workaround with starting some other process that tries
                        // to start services again. This process takes as command line argument
                        // of space separeted services names collected in error handler of
                        // ServiceProcessor
                        //-------------------------------------------------------

                        System.Diagnostics.Process proc = new System.Diagnostics.Process();
                        try
                        {
                            proc.EnableRaisingEvents       = false;
                            proc.StartInfo.FileName        = "Utilities.Hotfix.StartService.exe";
                            proc.StartInfo.UseShellExecute = true;
                            proc.StartInfo.Arguments       = objServiceProcessor.strFailedList;
                            log.WriteLine(LogType.Error, "HI052: " + objServiceProcessor.strFailedList);
                            proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            proc.Start();
                        }
                        catch
                        {
                        }
                    }
                    #endregion                     // restore controlled services Status

                    //-------------------------------------------------------
                    // Log that installation finished
                    //-------------------------------------------------------
                    string strMsgFinished = "Installation finished.";
                    log.WriteLine(LogType.Info, "HI070: " + strMsgFinished);
                    Console.WriteLine(strMsgFinished);
                }
                else
                {
                    message = string.Format("Failed to stop controlled services. Can't continue.");
                    log.WriteLine(LogType.Error, "HI015: " + message);
                }
            }
            catch (System.InvalidOperationException)
            {
                string message = string.Format("Failed to load hotfix instalation settings file: {0}{1} ", Environment.NewLine, this.SettingsFile);
                Console.WriteLine();
                log.WriteLine(LogType.Error, "HI016: " + message);
            }
            finally
            {
                if (InstallationCompletedEvent != null)
                {
                    InstallationCompletedEvent(settings.strGeneralDescription, "Please check log file.");
                }
                log.Show();
            }
        }
Example #17
0
        public bool doBackup()
        {
            bool blnIsSucceed = true;

            //----------------------------------------------------------------------------
            // folder of all backups
            //----------------------------------------------------------------------------
            DirectoryInfo objBackups = new DirectoryInfo(strBackupFolder);

            //----------------------------------------------------------------------------
            // get/create folder of backups
            //----------------------------------------------------------------------------
            #region get/create folder of backups
            if (!objBackups.Exists)
            {
                try
                {
                    objBackups.Create();
                }
                catch (Exception objException)
                {
                    log.WriteLine(
                        LogType.Error,
                        string.Format("HI017: " + "Failed to create root folder of backups: {0}",
                                      objException.ToString())
                        );
                    return(false);
                }
            }

            //----------------------------------------------------------------------------
            // folder name of specific currently made backup
            //----------------------------------------------------------------------------
            //create specific backup folder under the folder of backups
            strSpecificBackup = "Backup " + DateTime.Now.ToString("[dd-MM-yyyy HHmmss]");
            DirectoryInfo objBackupFolder = null;
            try
            {
                objBackupFolder = objBackups.CreateSubdirectory(strSpecificBackup);
            }
            catch (Exception objException)
            {
                log.WriteLine(
                    LogType.Error,
                    string.Format("HI018: " + "Failed to create folder for specific backup: " + strSpecificBackup + ", Exception: {0}", objException.ToString())
                    );
                return(false);
            }

            #endregion             // get/create folder of backups

            //----------------------------------------------------------------------------
            // backup each installed component
            //----------------------------------------------------------------------------
            #region backup each installed component

            foreach (SrcDestPair objSrcDest in processed)
            {
                //----------------------------------------------------------
                // Skip backup of component if marked in ComponentFiltes section of BackupExclusions
                //----------------------------------------------------------
                if (this.settings.IsExcludedFromBackup(objSrcDest.srcDir.Name))
                {
                    log.WriteLine(LogType.Info, "HI069: " +
                                  String.Format(@"SKIPPED backuping of the component: ""{0}""", objSrcDest.srcDir.Name)
                                  );
                    continue;
                }

                // The path to currently backuped component
                string strBackuped = string.Empty;

                try
                {
                    foreach (DirectoryInfo destPath in objSrcDest.destDir)
                    {
                        strBackuped = destPath.FullName;

                        if (destPath.Exists)
                        {
                            log.WriteLine(LogType.Info, "HI019: " +
                                          String.Format(@"BACKUPING Component: ""{0}""", strBackuped)
                                          );

                            //create folder of backup for specific component
                            DirectoryInfo objComponentBackup = objBackupFolder.CreateSubdirectory(objSrcDest.srcDir.Name);

                            // Add masks for excluded files
                            xDirectory.arrExcludeFileFilters = settings.mobjBackupExclusions.strGlobalFileExclusions;

                            xDirectory.Copy(destPath, objComponentBackup);

                            // !!! Only first installed component will be backuped to prevent overwriting
                            break;
                        }
                    }

                    #region Check and log possible multiple backup pathes

                    if (objSrcDest.destDir.Length > 1)
                    {
                        int    mintAmountExists = 0;
                        string mstrBackuped     = String.Empty;

                        foreach (DirectoryInfo destPath in objSrcDest.destDir)
                        {
                            if (destPath.Exists)
                            {
                                mintAmountExists++;
                                mstrBackuped = destPath.FullName;
                            }
                        }

                        if (mintAmountExists > 1)
                        {
                            // Installed component will be copied to more than one destination
                            // the only one destination(first) will be backuped
                            log.WriteLine(LogType.Warning, "HI045: " +
                                          String.Format(@"Multiple destinations found for component: ""{0}"" ", objSrcDest.srcDir.ToString()) +
                                          String.Format("Only one component BACKUPED: {0}", mstrBackuped));
                        }
                    }
                    #endregion                     // Check and log possible multiple backup pathes
                }
                catch (Exception ex)
                {
                    blnIsSucceed = false;
                    #region Log: Failed during backup
                    log.WriteLine(
                        LogType.Error, "HI020: " +
                        String.Format("Failed during backup: {0}, Error:{1}",
                                      strBackuped, ex.ToString())
                        );
                    #endregion                     // Log: Failed during backup
                    break;
                }
            }

            #endregion             // backup each installed component

            //----------------------------------------------------------------------------
            // Prepare BIN folder of hotfix in Backup
            //----------------------------------------------------------------------------
            #region  Prepare BIN folder of hotfix in Backup
            //----------------------------------------------------------------------------
            // 1) prepare backup bin folder with all needed exe and dll files
            //----------------------------------------------------------------------------
            DirectoryInfo objFolderInstaller = objBackupFolder.CreateSubdirectory("Setup");

            string[] arrFileToCopy = new string[] {
                "Utilities.Hotfix.dll",
                "Utilities.Hotfix.Config.exe",
                "Utilities.Hotfix.StartService.exe"
            };
            // see also AppDomain Class usage example
            // http://207.46.16.251/en-us/library/system.appdomain.aspx

            FileInfo objExeInstaller = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location);
            objExeInstaller.CopyTo(Path.Combine(objFolderInstaller.FullName, objExeInstaller.Name), true);

            foreach (string strFileToCopy in arrFileToCopy)
            {
                FileInfo objDllInstaller = new FileInfo(strFileToCopy);
                objDllInstaller.CopyTo(Path.Combine(objFolderInstaller.FullName, objDllInstaller.Name), true);
            }

            //----------------------------------------------------------------------------
            // Create and save UNDO configuration file
            //----------------------------------------------------------------------------

            HotfixSettings objBackupSettings = new HotfixSettings();
            objBackupSettings = HotfixSettings.load(settings.SettingsFileName);
            objBackupSettings.strGeneralDescription = " ROOLBACK: " + objBackupSettings.strGeneralDescription;

            //----------------------------------------------------------------------------
            // Backup XML configuration files and update UNDO settings configuration
            //----------------------------------------------------------------------------
            #region Backup XML configuration files and update UNDO settings configuration

            HotfixSettings.DestinationRootFolder objXmlConfig = new HotfixSettings.DestinationRootFolder();

            objXmlConfig.TypeName = "Xml.Config.Backup";
            objXmlConfig.path     = "";
            objXmlConfig.Default  = false;

            objBackupSettings.DestinationRootFolders = (HotfixSettings.DestinationRootFolder[])
                                                       AppendItem(objBackupSettings.DestinationRootFolders,
                                                                  objXmlConfig,
                                                                  typeof(HotfixSettings.DestinationRootFolder));

            foreach (HotfixSettings.XmlFileFix filefix in settings.XmlFileFixes)
            {
                // find out which component we talk about to be able to find
                // configuration xml file for: filefix
                foreach (SrcDestPair comp in processed)
                {
                    if (comp.srcDir.Name.ToLower() == filefix.folder.ToLower())
                    {
                        //path to fix describing changes for: filefix
                        string fileOfFixes = Path.Combine(comp.srcDir.FullName, filefix.update);

                        XmlConfigurationHotfix componentFix = XmlConfigurationHotfix.Load(fileOfFixes);

                        //get related pathes of patched files
                        if (componentFix.objXMLContentFixes.Length > 0)
                        {
                            foreach (DirectoryInfo path in comp.destDir)
                            {
                                //create absolute full qualified path to fixed xml
                                foreach (XmlContentFix contentfix in componentFix.objXMLContentFixes)
                                {
                                    string   strFixedXmlFile = Path.Combine(path.FullName, contentfix.contentXmlFilePath);
                                    FileInfo objFixedXmlFile = new FileInfo(strFixedXmlFile);

                                    if (objFixedXmlFile.Exists)
                                    {
                                        HotfixSettings.FolderType objFolderType = new HotfixSettings.FolderType();
                                        objFolderType.TypeName        = objXmlConfig.TypeName;
                                        objFolderType.hotfix          = "Xml.Config." + comp.srcDir.Name;
                                        objBackupSettings.FolderTypes = (HotfixSettings.FolderType[])
                                                                        AppendItem(objBackupSettings.FolderTypes,
                                                                                   objFolderType,
                                                                                   typeof(HotfixSettings.FolderType));

                                        HotfixSettings.FolderMapping objFolderMapping = new HotfixSettings.FolderMapping();
                                        objFolderMapping.folder = objFolderType.hotfix;
                                        // ms-help://MS.MSDNQTR.2006JAN.1033/cpref/html/frlrfSystemIOPathClassGetDirectoryNameTopic.htm
                                        objFolderMapping.real            = Path.GetDirectoryName(strFixedXmlFile);
                                        objBackupSettings.FolderMappings = (HotfixSettings.FolderMapping[])
                                                                           AppendItem(objBackupSettings.FolderMappings,
                                                                                      objFolderMapping,
                                                                                      typeof(HotfixSettings.FolderMapping));

                                        objBackupFolder.CreateSubdirectory(objFolderType.hotfix);

                                        //Copy file to backup directory
                                        objFixedXmlFile.CopyTo(
                                            Path.Combine(Path.Combine(
                                                             objBackupFolder.FullName,
                                                             objFolderType.hotfix),
                                                         objFixedXmlFile.Name));
                                    }

                                    //only first configuration file of processed component backuped
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            #endregion             // Backup XML configuration files and update UNDO settings configuration

            //Disable hotfix "backup" for "backup"
            objBackupSettings.Backup.blnIsDoBackup = false;

            //Zeroes configuration for exlclusions of backup
            objBackupSettings.mobjBackupExclusions.arrComponentFilters     = new string[] {};
            objBackupSettings.mobjBackupExclusions.strGlobalFileExclusions = new string[] {};

            // Set components folder exactly to just created folder with backuped components
            objBackupSettings.ComponentsFolderSetting.blnIsRelative = false;
            objBackupSettings.ComponentsFolderSetting.strFolder     = objBackupFolder.FullName;

            //xml fixes unrelevant for restoration from backup
            objBackupSettings.XmlFileFixes = new HotfixSettings.XmlFileFix[] {};
            objBackupSettings.save(Path.Combine(objFolderInstaller.FullName, HotfixSettings.SETTINGS_FILENAME));

            #endregion

            return(blnIsSucceed);
        }