Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool Validate(string installDir, string dataDir, string backupDir, string logDir, string tempDir)
- {
- this._model.Model.Logger.Log("Validating Paths");
- if (!string.IsNullOrEmpty(installDir))
- this._model.Model.Logger.Log("installDir=" + installDir);
- if (!string.IsNullOrEmpty(dataDir))
- this._model.Model.Logger.Log("dataDir=" + dataDir);
- if (!string.IsNullOrEmpty(backupDir))
- this._model.Model.Logger.Log("backupDir=" + backupDir);
- if (!string.IsNullOrEmpty(logDir))
- this._model.Model.Logger.Log("logDir=" + logDir);
- if (!string.IsNullOrEmpty(tempDir))
- this._model.Model.Logger.Log("tempDir=" + tempDir);
- if (this.RequiredDiskSpace.PackageCacheSize > 0UL)
- this.AddFolderToDriveList(this._commonAppDataFolder, this.RequiredDiskSpace.PackageCacheSize);
- if (this.RequiredDiskSpace.SystemSize > 0UL)
- this.AddFolderToDriveList(this._systemFolder, this.RequiredDiskSpace.SystemSize);
- if (this.RequiredDiskSpace.InstallDirSize > 0UL || !string.IsNullOrEmpty(installDir))
- {
- if (!this.ValidateInstallDir(installDir))
- return false;
- this.AddFolderToDriveList(installDir, this.RequiredDiskSpace.InstallDirSize);
- }
- if (this.RequiredDiskSpace.DataDirSize > 0UL || !string.IsNullOrEmpty(dataDir))
- {
- if (!this.ValidateDataDir(dataDir))
- return false;
- this.AddFolderToDriveList(dataDir, this.RequiredDiskSpace.DataDirSize);
- }
- if (this.RequiredDiskSpace.BackupDirSize > 0UL || !string.IsNullOrEmpty(backupDir))
- {
- if (!this.ValidateBackupDir(backupDir))
- return false;
- this.AddFolderToDriveList(backupDir, this.RequiredDiskSpace.BackupDirSize);
- }
- if (this.RequiredDiskSpace.LogDirSize > 0UL || !string.IsNullOrEmpty(logDir))
- {
- if (!this.ValidateLogDir(logDir))
- return false;
- this.AddFolderToDriveList(logDir, this.RequiredDiskSpace.LogDirSize);
- }
- if (this.RequiredDiskSpace.TempDirSize > 0UL || !string.IsNullOrEmpty(tempDir))
- {
- if (!this.ValidateTempDir(tempDir))
- return false;
- this.AddFolderToDriveList(tempDir, this.RequiredDiskSpace.TempDirSize);
- }
- foreach (DiskSpaceCalculator.InstallDrive installDrive in this.InstallDrives)
- {
- if (installDrive.RequiredSize > installDrive.FreeDiskSpace)
- {
- double num1 = (double) installDrive.RequiredSize / 1048576.0;
- double num2 = (double) installDrive.FreeDiskSpace / 1048576.0;
- string str1 = string.Format(this._model.LocalizationReader.GetString("General_MB"), (object) num1);
- string str2 = string.Format(this._model.LocalizationReader.GetString("General_MB"), (object) num2);
- if (num1 > 1024.0)
- {
- double num3 = num1 / 1024.0;
- double num4 = num2 / 1024.0;
- str1 = string.Format(this._model.LocalizationReader.GetString("General_GB"), (object) num3);
- str2 = string.Format(this._model.LocalizationReader.GetString("General_GB"), (object) num4);
- }
- this.Message = string.Format(this._model.LocalizationReader.GetString("ErrorMessage_InvalidPath_NotEnoughDiskSpacce"), (object) installDrive.DriveName, (object) str1, (object) str2);
- return false;
- }
- }
- double num = (double) this.RequiredDiskSpace.TotalSize / 1048576.0;
- string str = string.Format(this._model.LocalizationReader.GetString("General_MB"), (object) num);
- if (num > 1024.0)
- str = string.Format(this._model.LocalizationReader.GetString("General_GB"), (object) (num / 1024.0));
- this.Message = string.Format(this._model.LocalizationReader.GetString("General_InstallSizeInformation"), (object) str);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement