Example #1
0
        public void TestOnBackupFailedVBScript()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            // First set up a script
            string script = @"Sub OnBackupFailed(reason)
                               EventLog.Write(""Failed: "" & reason)
                           End Sub";

            hMailServer.Scripting scripting = _settings.Scripting;
            string file = scripting.CurrentScriptFile;

            Utilities.WriteFile(file, script);
            scripting.Enabled = true;
            scripting.Reload();

            BackupRestore back = new BackupRestore();

            back.InitializeBackupSettings();
            back.SetBackupDir(@"C:\some-non-existant-directory");
            Assert.IsFalse(back.Execute());

            Utilities.AssertReportedError();
            string eventLogText = Utilities.ReadExistingTextFile(Utilities.GetEventLogFileName());

            Assert.IsTrue(eventLogText.Contains("The specified backup directory is not accessible"));
        }
Example #2
0
        public void TestOnBackupCompletedJScript()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.Scripting scripting = _settings.Scripting;
            scripting.Language = "JScript";

            // First set up a script
            string script = @"function OnBackupCompleted()
                           {
                               EventLog.Write('Backup process completed')
                           }";


            string file = scripting.CurrentScriptFile;

            Utilities.WriteFile(file, script);
            scripting.Enabled = true;
            scripting.Reload();

            BackupRestore back = new BackupRestore();

            back.InitializeBackupSettings();
            back.TestWithMessages();


            string eventLogText = Utilities.ReadExistingTextFile(Utilities.GetEventLogFileName());

            Assert.IsTrue(eventLogText.Contains("Backup process completed"));
        }
 public static void OpenBrowser()
 {
     _driver = DriverFactory.GetDriver();
     BackupRestore.BackupDatabase(Constants.Server,
         Constants.DatabaseName,
         Constants.BackUpPath);
 }
Example #4
0
        public ActionResult DownloadFile()
        {
            string file        = BackupRestore.BackupDatabase();
            string contentType = "application/octet-stream";
            var    fileName    = Path.GetFileName(file);

            return(File(file, contentType, fileName));
        }
        public void TestUpdateIMAPFolderUID()
        {
            // Set up a basic environment which we can work with.
             BackupRestore backupRestore = new BackupRestore();
             backupRestore.SetUp();
             backupRestore.SetupEnvironment();

             _application.Utilities.PerformMaintenance(hMailServer.eMaintenanceOperation.eUpdateIMAPFolderUID);
        }
Example #6
0
        public BackupProgress StartBackupRestore(BackupRestore backupRestore)
        {
            if (CoreBaseSettings.Standalone)
            {
                TenantExtra.DemandControlPanelPermission();
            }

            BackupHandler.StartRestore(backupRestore.BackupId, backupRestore.StorageType, backupRestore.StorageParams, backupRestore.Notify);
            return(BackupHandler.GetBackupProgress());
        }
Example #7
0
        public void TestUpdateIMAPFolderUID()
        {
            // Set up a basic environment which we can work with.
            var backupRestore = new BackupRestore();

            backupRestore.SetUp();
            backupRestore.SetupEnvironment();

            _application.Utilities.PerformMaintenance(eMaintenanceOperation.eUpdateIMAPFolderUID);
        }
Example #8
0
        private BackupProgress StartBackupRestore(BackupRestore backupRestore)
        {
            if (CoreBaseSettings.Standalone)
            {
                TenantExtra.DemandControlPanelPermission();
            }
            var storageParams = backupRestore.StorageParams == null ? new Dictionary <string, string>() : backupRestore.StorageParams.ToDictionary(r => r.Key.ToString(), r => r.Value.ToString());

            BackupHandler.StartRestore(backupRestore.BackupId, (BackupStorageType)Int32.Parse(backupRestore.StorageType.ToString()), storageParams, backupRestore.Notify);
            return(BackupHandler.GetBackupProgress());
        }
Example #9
0
        public void Restore()
        {
            var restore = new BackupRestore
            {
                ExtractPath = WExtractPath,
                // ReSharper disable once AssignNullToNotNullAttribute
                BackupPath = Path.Combine(WExtractPath, Path.GetFileNameWithoutExtension(FileName)) + ".Bak"
            };

            restore.RestoreDb();
            OkRestore = restore.RestoreOk;
        }
Example #10
0
        static int Main(string[] args)
        {
            // set up a simple configuration that logs on the console.
            XmlConfigurator.Configure();

            try
            {
                Options           options = new Options();
                CommandLineParser parser  = new CommandLineParser(options);
                parser.Parse();

                _log.Info(parser.UsageInfo.GetHeaderAsString(LINE_WIDTH));
                if (options.Help)
                {
                    _log.Info(parser.UsageInfo.GetOptionsAsString(LINE_WIDTH));
                    return(0);
                }
                else if (parser.HasErrors)
                {
                    _log.Error(parser.UsageInfo.GetErrorsAsString(LINE_WIDTH));
                    return(-1);
                }
                // --- get mode -----------------------------------------------
                string mode = options.m;
                // --- get zip file path --------------------------------------
                string zipFilePath = options.f;
                // --- get destination directory
                string             destinationDirectory = options.d;
                ProcessingCallback callback             = new ProcessingCallback();
                if (string.Equals(mode, "backup", StringComparison.CurrentCultureIgnoreCase)) // restore
                {
                    string errorMessage = string.Empty;
                    if (!BackupRestore.BackupFull(zipFilePath, callback))
                    {
                        return(-1);
                    }
                }
                else // back
                {
                    string errorMessage = string.Empty;
                    if (!BackupRestore.Restore(zipFilePath, callback))
                    {
                        return(-1);
                    }
                }
            }
            catch (System.Exception ex)
            {
                _log.Error(ex.ToString());
            }

            return(0);
        }
Example #11
0
        public void ReStoreDB()
        {
            BackupRestore BackUpRestoreDalObj = new BackupRestore();

            try
            {
                BackUpRestoreDalObj.ReStoreDB();
            }
            catch (Exception ex)
            {
                MessageBox.Show("BR:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #12
0
        public ActionResult Upload(HttpPostedFileBase file)
        {
            if (file != null && file.ContentLength > 0)
            {
                var fileName = Path.GetFileName(file.FileName);
                //var path = Path.Combine(Server.MapPath("~/Images/Database/"), fileName);
                file.SaveAs(BackupRestore.Getdatabases("(local)").BackupDirectory + "\\FullBackUp.bak");
                BackupRestore.RestoreDatabase();
            }



            return(RedirectToAction("RestoreDatabase"));
        }
Example #13
0
        public void Backup()
        {
            if (CloseOk)
            {
                DeleteOldestAutoBackup();
            }
            var backup = new BackupRestore
            {
                DirectoryName = DirectoryName,
                BackupPath    = DirectoryName + "\\" + FileName + ".Bak"
            };

            backup.BackUpDb();
            OkBackUp = backup.BackUpOk;
        }
Example #14
0
        private string _AutoBackupRestoreSqlite(BackupRestore _opts)
        {
            string _info       = "Success";
            string _fileBackup = string.Format(@"{0}\{1}.db", _bkFolderNameSQLite, CashierRegisterDAL.ConnectionDB.getSqlServerDataBaseName());

            if (_opts == BackupRestore.backup)
            {
                if (!Directory.Exists(_bkFolderNameSQLite))
                {
                    Directory.CreateDirectory(_bkFolderNameSQLite);
                }
                try
                {
                    CashierRegisterDAL.ConnectionDB.CloseConnect();
                    File.Copy(Directory.GetCurrentDirectory() + @"\Databases\CheckOut.db", _fileBackup, true);
                    CashierRegisterDAL.ConnectionDB.OpenConnect();
                }
                catch (Exception ex)
                {
                    _info = ex.Message;
                }
            }
            else if (_opts == BackupRestore.restore)
            {
                if (File.Exists(_fileBackup))
                {
                    try
                    {
                        CashierRegisterDAL.ConnectionDB.CloseConnect();
                        File.Copy(_fileBackup, Directory.GetCurrentDirectory() + @"\Databases\CheckOut.db", true);
                        CashierRegisterDAL.ConnectionDB.OpenConnect();
                    }
                    catch (Exception ex)
                    {
                        _info = ex.Message;
                    }
                }
                else
                {
                    _info = _fileBackup + " " + App.Current.FindResource("is_not_exists").ToString();
                }
            }
            return(_info);
        }
Example #15
0
        private void ExtractZip(object status)
        {
            IProcessingCallback callback = status as IProcessingCallback;

            callback.Begin();
            string sOpName = string.Empty;

            try
            {
                switch (MergeMode)
                {
                case Mode.Mode_Overwrite:
                    sOpName = "Updating with file ";
                    BackupRestore.Overwrite(
                        LocalLibraryFile
                        , this);
                    break;

                case Mode.Mode_Merge:
                    sOpName = "Merging with file ";
                    BackupRestore.Merge(
                        LocalLibraryFile
                        , this);
                    break;

                default:
                    Debug.Assert(false);
                    break;
                }
            }
            catch (Exception ex)
            {
                if (null != callback)
                {
                    callback.Error(string.Format("{0} {1} failed with error: {2}"
                                                 , sOpName, LocalLibraryFile, ex.Message));
                }
            }
            // ending
            callback.End();
        }
        public bool RealizarBackupDoBD(String caminho)
        {
            BackupRestore BR = new BackupRestore();

            return(BR.Backup(caminho));
        }
Example #17
0
        private void Trv_commandTreeView_DoubleClick(object sender, EventArgs e)
        {
            // todo add network capture tcpdump
            try
            {
                string tag;

                if ((tag = trv_commandTreeView.SelectedNode.Tag.ToString()) != null)
                {
                    if (tag.StartsWith("adb ") || tag.StartsWith("fastboot "))
                    {
                        // seriennummer für fastboot implementieren
                        cmdProcess.StartProcessing(tag, formMethods.SelectedDevice());
                    }

                    else if (tag.StartsWith("#"))
                    {
                        switch (tag)
                        {
                        case "#prop":
                            new SetProp(cmdProcess, formMethods).Show();
                            break;

                        case "#screenshot":

                            if (!String.IsNullOrEmpty(formMethods.SelectedDevice()))
                            {
                                saveFileDialog.FileName = "screenshot_" + DateTime.Now.ToString().Replace(' ', '_').Replace(':', '.');
                                saveFileDialog.Filter   = "PNG Image(.png)|*.png";
                                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                                {
                                    cmdProcess.StartProcessing("adb shell screencap -p > " + saveFileDialog.FileName, formMethods.SelectedDevice());
                                }
                            }

                            break;

                        case "#screenrecord":
                            if (screenRecord == null || screenRecord.IsDisposed)
                            {
                                screenRecord = new ScreenRecord(cmdProcess, formMethods);
                                screenRecord.Show();
                            }
                            else
                            {
                                screenRecord.Focus();
                            }
                            break;

                        case "#spoofmac":
                            if (spoofMac == null || spoofMac.IsDisposed)
                            {
                                spoofMac = new SpoofMac(cmdProcess, formMethods);
                                spoofMac.Show();
                            }
                            else
                            {
                                spoofMac.Focus();
                            }
                            break;

                        case "#resolution":
                            if (resolutionChange == null || resolutionChange.IsDisposed)
                            {
                                resolutionChange = new ResolutionChange(cmdProcess, formMethods);
                                resolutionChange.Show();
                            }
                            else
                            {
                                resolutionChange.Focus();
                            }
                            break;

                        case "#density":
                            if (densityChange == null || densityChange.IsDisposed)
                            {
                                densityChange = new Density(cmdProcess, formMethods);
                                densityChange.Show();
                            }
                            else
                            {
                                densityChange.Focus();
                            }
                            break;

                        case "#files":
                            if (fileOps == null || fileOps.IsDisposed)
                            {
                                fileOps = new FileOps(cmdProcess, formMethods);
                                fileOps.Show();
                            }
                            else
                            {
                                fileOps.Focus();
                            }
                            break;

                        case "#installuninstall":
                            if (installUninstall == null || installUninstall.IsDisposed)
                            {
                                installUninstall = new InstallUninstall(cmdProcess, formMethods);
                                installUninstall.Show();
                            }
                            else
                            {
                                installUninstall.Focus();
                            }
                            break;

                        case "#sideload":
                            if (sideLoad == null || sideLoad.IsDisposed)
                            {
                                sideLoad = new Sideload(cmdProcess, formMethods);
                                sideLoad.Show();
                            }
                            else
                            {
                                sideLoad.Focus();
                            }
                            break;

                        case "#backuprestore":
                            if (backupRestore == null || backupRestore.IsDisposed)
                            {
                                backupRestore = new BackupRestore(cmdProcess, formMethods);
                                backupRestore.Show();
                            }
                            else
                            {
                                backupRestore.Focus();
                            }
                            break;

                        case "#logcatadvanced":
                            if (logcatAdvanced == null || logcatAdvanced.IsDisposed)
                            {
                                logcatAdvanced = new LogcatAdvanced(cmdProcess, formMethods);
                                logcatAdvanced.Show();
                            }
                            else
                            {
                                logcatAdvanced.Focus();
                            }
                            break;

                        case "#credits":
                            new Credits().ShowDialog();
                            break;
                        }
                    }
                }
            }
            catch (Exception) { }
        }
Example #18
0
 public static void RestoreDatabaseFromBackUp()
 {
     BackupRestore.RestoreDatabase(Constants.Server,
         Constants.DatabaseName,
         Constants.BackUpPath);
 }
Example #19
0
        private string _AutoBackupRestoreSqlServer(BackupRestore _opts, string _DBName)
        {
            string _info       = "Success";
            string _fileBackup = string.Format(@"{0}\{1}.bak", _bkFolderNameSQL, CashierRegisterDAL.ConnectionDB.getSqlServerDataBaseName());

            if (_opts == BackupRestore.backup)
            {
                if (!Directory.Exists(_bkFolderNameSQL))
                {
                    Directory.CreateDirectory(_bkFolderNameSQL);
                }
                SqlConnection sqlConnect = CashierRegisterDAL.ConnectionDB.getSQLConnection();
                var           query      = String.Format("BACKUP DATABASE [{0}] TO DISK='{1}' WITH NOFORMAT, NOINIT,  NAME = N'data-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10", _DBName, @_fileBackup);
                try
                {
                    using (var command = new SqlCommand(query, sqlConnect))
                    {
                        command.ExecuteNonQuery();
                    }
                }
                catch (SqlException ex)
                {
                    _info = ex.Message;
                }
            }
            else if (_opts == BackupRestore.restore)
            {
                if (File.Exists(_fileBackup))
                {
                    CashierRegisterDAL.ConnectionDB.OpenConnect();
                    SqlConnection sqlConnect = CashierRegisterDAL.ConnectionDB.getSQLConnection();
                    using (var command = sqlConnect.CreateCommand())
                        try
                        {
                            command.CommandText = "Use Master";
                            command.ExecuteNonQuery();
                            command.CommandText = "ALTER DATABASE " + _DBName + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE;";
                            command.ExecuteNonQuery();
                            command.CommandText = "RESTORE DATABASE " + _DBName + " FROM DISK = '" + @_fileBackup + "' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10; ";
                            command.ExecuteNonQuery();
                            command.CommandText = "Use Master";
                            command.ExecuteNonQuery();
                            command.CommandText = "ALTER DATABASE " + _DBName + " SET MULTI_USER;";
                            command.ExecuteNonQuery();
                            command.CommandText = "Use " + _DBName;
                            command.ExecuteNonQuery();
                        }
                        catch (SqlException ex)
                        {
                            _info = ex.Message;
                        }
                    CashierRegisterDAL.ConnectionDB.CloseConnect();
                }
                else
                {
                    _info = _fileBackup + " " + App.Current.FindResource("is_not_exists").ToString();
                }
                //File.Delete(_path);
            }
            return(_info);
        }
Example #20
0
        public void TestOnBackupCompletedJScript()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
             hMailServer.Scripting scripting = _settings.Scripting;
             scripting.Language = "JScript";

             // First set up a script
             string script = @"function OnBackupCompleted()
                           {
                               EventLog.Write('Backup process completed')
                           }";

             string file = scripting.CurrentScriptFile;
             Utilities.WriteFile(file, script);
             scripting.Enabled = true;
             scripting.Reload();

             BackupRestore back = new BackupRestore();
             back.InitializeBackupSettings();
             back.TestWithMessages();

             string eventLogText = Utilities.ReadExistingTextFile(Utilities.GetEventLogFileName());
             Assert.IsTrue(eventLogText.Contains("Backup process completed"));
        }
 internal object InsertBackUpRestore(BackupRestore backupRestore)
 {
     throw new NotImplementedException();
 }
Example #22
0
        private void ExcuteBackupRestoreCommand(object obj)
        {
            var backupRestore = new BackupRestore(obj);

            backupRestore.Show();
        }
Example #23
0
        public void TestOnBackupFailedVBScript()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

             // First set up a script
             string script = @"Sub OnBackupFailed(reason)
                               EventLog.Write(""Failed: "" & reason)
                           End Sub";

             hMailServer.Scripting scripting = _settings.Scripting;
             string file = scripting.CurrentScriptFile;
             Utilities.WriteFile(file, script);
             scripting.Enabled = true;
             scripting.Reload();

             BackupRestore back = new BackupRestore();
             back.InitializeBackupSettings();
             back.SetBackupDir(@"C:\some-non-existant-directory");
             Assert.IsFalse(back.Execute());

             Utilities.AssertReportedError();
             string eventLogText = Utilities.ReadExistingTextFile(Utilities.GetEventLogFileName());
             Assert.IsTrue(eventLogText.Contains("The specified backup directory is not accessible"));
        }
Example #24
0
 public BackupProgress StartBackupRestoreFromBody([FromBody] BackupRestore backupRestore)
 {
     return(StartBackupRestore(backupRestore));
 }
 internal object InsertBackUpRestore(BackupRestore backupRestore)
 {
     return(_CondoDatabase.InsertBackUpRestore(backupRestore));
 }
Example #26
0
 public BackupProgress StartBackupRestoreFromForm([FromForm] BackupRestore backupRestore)
 {
     return(StartBackupRestore(backupRestore));
 }
        public bool ImportarBackupDoBD(String caminho)
        {
            BackupRestore BR = new BackupRestore();

            return(BR.Restore(caminho));
        }
Example #28
0
        public static ActionResult PreFillSettings(Session session)
        {
            Func <string, bool> HaveInstalledComponents = (string CfgFullPath) =>
            {
                var ComponentsPath = "//components";
                return(File.Exists(CfgFullPath) ? BackupRestore.HaveChild(CfgFullPath, ComponentsPath) : false);
            };
            Func <IEnumerable <string>, string> FindMainConfig = (IEnumerable <string> Dirs) =>
            {
                // Looking into directories with next priority:
                // Previous installation directory and her backup, "WebsitePanel" directories on fixed drives and their backups.
                // The last chance is an update from an installation based on previous installer version that installed to "Program Files".
                // Regular directories.
                foreach (var Dir in Dirs)
                {
                    var Result = Path.Combine(Dir, BackupRestore.MainConfig);
                    if (HaveInstalledComponents(Result))
                    {
                        return(Result);
                    }
                    else
                    {
                        var ComponentNames = new string[] { Global.Server.ComponentName, Global.EntServer.ComponentName, Global.WebPortal.ComponentName };
                        foreach (var Name in ComponentNames)
                        {
                            var Backup = BackupRestore.Find(Dir, Global.DefaultProductName, Name);
                            if (Backup != null && HaveInstalledComponents(Backup.BackupMainConfigFile))
                            {
                                return(Backup.BackupMainConfigFile);
                            }
                        }
                    }
                }
                // Looking into platform specific Program Files.
                {
                    var InstallerMainCfg = "WebsitePanel.Installer.exe.config";
                    var InstallerName    = "WebsitePanel Installer";
                    var PFolderType      = Environment.Is64BitOperatingSystem ? Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles;
                    var PFiles           = Environment.GetFolderPath(PFolderType);
                    var Result           = Path.Combine(PFiles, InstallerName, InstallerMainCfg);
                    if (HaveInstalledComponents(Result))
                    {
                        return(Result);
                    }
                }
                return(null);
            };
            Action <Session, SetupVariables> VersionGuard = (Session SesCtx, SetupVariables CtxVars) =>
            {
                var Current = SesCtx["ProductVersion"];
                var Found   = string.IsNullOrWhiteSpace(CtxVars.Version) ? "0.0.0" : CtxVars.Version;
                if ((new Version(Found) > new Version(Current)) && !CtxVars.InstallerType.ToLowerInvariant().Equals("msi"))
                {
                    throw new InvalidOperationException("New version must be greater than previous always.");
                }
            };

            var Ctx = session;

            Ctx.AttachToSetupLog();

            PopUpDebugger();

            Log.WriteStart("PreFillSettings");
            var WSP     = Ctx["WSP_INSTALL_DIR"];
            var DirList = new List <string>();

            DirList.Add(WSP);
            DirList.AddRange(from Drive in DriveInfo.GetDrives()
                             where Drive.DriveType == DriveType.Fixed
                             select Path.Combine(Drive.RootDirectory.FullName, Global.DefaultProductName));
            var CfgPath = FindMainConfig(DirList);

            if (!string.IsNullOrWhiteSpace(CfgPath))
            {
                try
                {
                    var EServerUrl = string.Empty;
                    AppConfig.LoadConfiguration(new ExeConfigurationFileMap {
                        ExeConfigFilename = CfgPath
                    });
                    var CtxVars = new SetupVariables();
                    CtxVars.ComponentId = WiXSetup.GetComponentID(CfgPath, Global.Server.ComponentCode);
                    if (!string.IsNullOrWhiteSpace(CtxVars.ComponentId))
                    {
                        AppConfig.LoadComponentSettings(CtxVars);
                        VersionGuard(Ctx, CtxVars);

                        SetProperty(Ctx, "COMPFOUND_SERVER_ID", CtxVars.ComponentId);
                        SetProperty(Ctx, "COMPFOUND_SERVER_MAIN_CFG", CfgPath);

                        SetProperty(Ctx, "PI_SERVER_IP", CtxVars.WebSiteIP);
                        SetProperty(Ctx, "PI_SERVER_PORT", CtxVars.WebSitePort);
                        SetProperty(Ctx, "PI_SERVER_HOST", CtxVars.WebSiteDomain);
                        SetProperty(Ctx, "PI_SERVER_LOGIN", CtxVars.UserAccount);
                        SetProperty(Ctx, "PI_SERVER_DOMAIN", CtxVars.UserDomain);

                        SetProperty(Ctx, "PI_SERVER_INSTALL_DIR", CtxVars.InstallFolder);
                        SetProperty(Ctx, "WSP_INSTALL_DIR", Directory.GetParent(CtxVars.InstallFolder).FullName);

                        var  HaveAccount = SecurityUtils.UserExists(CtxVars.UserDomain, CtxVars.UserAccount);
                        bool HavePool    = Tool.AppPoolExists(CtxVars.ApplicationPool);

                        Ctx["COMPFOUND_SERVER"] = (HaveAccount && HavePool) ? YesNo.Yes : YesNo.No;
                    }
                    CtxVars.ComponentId = WiXSetup.GetComponentID(CfgPath, Global.EntServer.ComponentCode);
                    if (!string.IsNullOrWhiteSpace(CtxVars.ComponentId))
                    {
                        AppConfig.LoadComponentSettings(CtxVars);
                        VersionGuard(Ctx, CtxVars);

                        SetProperty(Ctx, "COMPFOUND_ESERVER_ID", CtxVars.ComponentId);
                        SetProperty(Ctx, "COMPFOUND_ESERVER_MAIN_CFG", CfgPath);

                        SetProperty(Ctx, "PI_ESERVER_IP", CtxVars.WebSiteIP);
                        SetProperty(Ctx, "PI_ESERVER_PORT", CtxVars.WebSitePort);
                        SetProperty(Ctx, "PI_ESERVER_HOST", CtxVars.WebSiteDomain);
                        SetProperty(Ctx, "PI_ESERVER_LOGIN", CtxVars.UserAccount);
                        SetProperty(Ctx, "PI_ESERVER_DOMAIN", CtxVars.UserDomain);
                        EServerUrl = string.Format("http://{0}:{1}", CtxVars.WebSiteIP, CtxVars.WebSitePort);

                        SetProperty(Ctx, "PI_ESERVER_INSTALL_DIR", CtxVars.InstallFolder);
                        SetProperty(Ctx, "WSP_INSTALL_DIR", Directory.GetParent(CtxVars.InstallFolder).FullName);

                        var ConnStr = new SqlConnectionStringBuilder(CtxVars.DbInstallConnectionString);
                        SetProperty(Ctx, "DB_CONN", ConnStr.ToString());
                        SetProperty(Ctx, "DB_SERVER", ConnStr.DataSource);
                        SetProperty(Ctx, "DB_AUTH", ConnStr.IntegratedSecurity ? SQL_AUTH_WINDOWS : SQL_AUTH_SERVER);
                        if (!ConnStr.IntegratedSecurity)
                        {
                            SetProperty(Ctx, "DB_LOGIN", ConnStr.UserID);
                            SetProperty(Ctx, "DB_PASSWORD", ConnStr.Password);
                        }
                        ConnStr = new SqlConnectionStringBuilder(CtxVars.ConnectionString);
                        SetProperty(Ctx, "DB_DATABASE", ConnStr.InitialCatalog);

                        var  HaveAccount = SecurityUtils.UserExists(CtxVars.UserDomain, CtxVars.UserAccount);
                        bool HavePool    = Tool.AppPoolExists(CtxVars.ApplicationPool);

                        Ctx["COMPFOUND_ESERVER"] = (HaveAccount && HavePool) ? YesNo.Yes : YesNo.No;
                    }
                    CtxVars.ComponentId = WiXSetup.GetComponentID(CfgPath, Global.WebPortal.ComponentCode);
                    if (!string.IsNullOrWhiteSpace(CtxVars.ComponentId))
                    {
                        AppConfig.LoadComponentSettings(CtxVars);
                        VersionGuard(Ctx, CtxVars);

                        SetProperty(Ctx, "COMPFOUND_PORTAL_ID", CtxVars.ComponentId);
                        SetProperty(Ctx, "COMPFOUND_PORTAL_MAIN_CFG", CfgPath);

                        SetProperty(Ctx, "PI_PORTAL_IP", CtxVars.WebSiteIP);
                        SetProperty(Ctx, "PI_PORTAL_PORT", CtxVars.WebSitePort);
                        SetProperty(Ctx, "PI_PORTAL_HOST", CtxVars.WebSiteDomain);
                        SetProperty(Ctx, "PI_PORTAL_LOGIN", CtxVars.UserAccount);
                        SetProperty(Ctx, "PI_PORTAL_DOMAIN", CtxVars.UserDomain);
                        if (!SetProperty(Ctx, "PI_ESERVER_URL", CtxVars.EnterpriseServerURL))
                        {
                            if (!SetProperty(Ctx, "PI_ESERVER_URL", EServerUrl))
                            {
                                SetProperty(Ctx, "PI_ESERVER_URL", Global.WebPortal.DefaultEntServURL);
                            }
                        }

                        SetProperty(Ctx, "PI_PORTAL_INSTALL_DIR", CtxVars.InstallFolder);
                        SetProperty(Ctx, "WSP_INSTALL_DIR", Directory.GetParent(CtxVars.InstallFolder).FullName);

                        var  HaveAccount = SecurityUtils.UserExists(CtxVars.UserDomain, CtxVars.UserAccount);
                        bool HavePool    = Tool.AppPoolExists(CtxVars.ApplicationPool);

                        Ctx["COMPFOUND_PORTAL"] = (HaveAccount && HavePool) ? YesNo.Yes : YesNo.No;
                    }
                }
                catch (InvalidOperationException ioex)
                {
                    Log.WriteError(ioex.ToString());
                    var Text = new Record(1);
                    Text.SetString(0, ioex.Message);
                    Ctx.Message(InstallMessage.Error, Text);
                    return(ActionResult.Failure);
                }
            }
            TryApllyNewPassword(Ctx, "PI_SERVER_PASSWORD");
            TryApllyNewPassword(Ctx, "PI_ESERVER_PASSWORD");
            TryApllyNewPassword(Ctx, "PI_PORTAL_PASSWORD");
            TryApllyNewPassword(Ctx, "SERVER_ACCESS_PASSWORD");
            TryApllyNewPassword(Ctx, "SERVERADMIN_PASSWORD");
            Log.WriteEnd("PreFillSettings");
            return(ActionResult.Success);
        }