public InstallerInfo(string tempFolder, string manifest, string sitePath) { _TempInstallFolder = tempFolder; _PhysicalSitePath = sitePath; _InstallMode = InstallMode.Install; if (!string.IsNullOrEmpty(manifest)) { _ManifestFile = new InstallFile(manifest, this); } }
public static void RestoreFile(InstallFile installFile, string basePath, Logger log) { string fullFileName = Path.Combine(basePath, installFile.FullName); string backupFileName = Path.Combine(installFile.BackupPath, installFile.Name + ".config"); FileSystemUtils.CopyFile(backupFileName, fullFileName); log.AddInfo(string.Format(Util.FILE_RestoreBackup, installFile.FullName)); }
public static bool IsFileValid(InstallFile file, string packageWhiteList) { bool _IsFileValid = Null.NullBoolean; string systemWhiteList = Host.FileExtensions.ToLower(); string strExtension = file.Extension.ToLowerInvariant(); if ((strExtension == "dnn" || systemWhiteList.Contains(strExtension) || packageWhiteList.Contains(strExtension) || (packageWhiteList.Contains("*dataprovider") && strExtension.EndsWith("dataprovider")))) { _IsFileValid = true; } return _IsFileValid; }
public static void DeleteFile(InstallFile installFile, string basePath, Logger log) { DeleteFile(installFile.FullName, basePath, log); }
public static void CopyFile(InstallFile installFile, string basePath, Logger log) { string filePath = Path.Combine(basePath, installFile.Path); string fullFileName = Path.Combine(basePath, installFile.FullName); if (!Directory.Exists(filePath)) { log.AddInfo(string.Format(Util.FOLDER_Created, filePath)); Directory.CreateDirectory(filePath); } FileSystemUtils.CopyFile(installFile.TempFileName, fullFileName); log.AddInfo(string.Format(Util.FILE_Created, installFile.FullName)); }
public static void BackupFile(InstallFile installFile, string basePath, Logger log) { string fullFileName = Path.Combine(basePath, installFile.FullName); string backupFileName = Path.Combine(installFile.BackupPath, installFile.Name + ".config"); if (!Directory.Exists(installFile.BackupPath)) { Directory.CreateDirectory(installFile.BackupPath); } FileSystemUtils.CopyFile(fullFileName, backupFileName); log.AddInfo(string.Format(Util.FILE_CreateBackup, installFile.FullName)); }
private void ReadZipStream(Stream inputStream, bool isEmbeddedZip) { Log.StartJob(Util.FILES_Reading); ZipInputStream unzip = new ZipInputStream(inputStream); ZipEntry entry = unzip.GetNextEntry(); while (entry != null) { if (!entry.IsDirectory) { InstallFile file = new InstallFile(unzip, entry, this); if (file.Type == InstallFileType.Resources && (file.Name.ToLowerInvariant() == "containers.zip" || file.Name.ToLowerInvariant() == "skins.zip")) { string tmpInstallFolder = TempInstallFolder; FileStream zipStream = new FileStream(file.TempFileName, FileMode.Open, FileAccess.Read); _TempInstallFolder = Path.Combine(TempInstallFolder, Path.GetFileNameWithoutExtension(file.Name)); ReadZipStream(zipStream, true); _TempInstallFolder = tmpInstallFolder; FileInfo zipFile = new FileInfo(file.TempFileName); zipFile.Delete(); } else { Files[file.FullName.ToLower()] = file; if (file.Type == InstallFileType.Manifest && !isEmbeddedZip) { if (ManifestFile == null) { _ManifestFile = file; } else { if (ManifestFile.Extension == "dnn" && file.Extension == "dnn5") { _ManifestFile = file; } else { Log.AddFailure((Util.EXCEPTION_MultipleDnn + ManifestFile.Name + " and " + file.Name)); } } } } Log.AddInfo(string.Format(Util.FILE_ReadSuccess, file.FullName)); } entry = unzip.GetNextEntry(); } if (ManifestFile == null) { Log.AddFailure(Util.EXCEPTION_MissingDnn); } if (Log.Valid) { Log.EndJob(Util.FILES_ReadingEnd); } else { Log.AddFailure(new Exception(Util.EXCEPTION_FileLoad)); Log.EndJob(Util.FILES_ReadingEnd); } inputStream.Close(); }