public InstallerInfo(string tempFolder, string manifest, string sitePath)
 {
     _TempInstallFolder = tempFolder;
     _PhysicalSitePath = sitePath;
     _InstallMode = InstallMode.Install;
     if (!string.IsNullOrEmpty(manifest))
     {
         _ManifestFile = new InstallFile(manifest, this);
     }
 }
示例#2
0
 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));
 }
示例#3
0
 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;
 }
示例#4
0
 public static void DeleteFile(InstallFile installFile, string basePath, Logger log)
 {
     DeleteFile(installFile.FullName, basePath, log);
 }
示例#5
0
 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));
 }
示例#6
0
 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));
 }
示例#7
0
 public static void DeleteFile(InstallFile installFile, string basePath, Logger log)
 {
     DeleteFile(installFile.FullName, basePath, log);
 }
示例#8
0
        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();
        }
 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();
 }