Example #1
0
        internal void CopyFiles(string moduleName, bool @overrideSystemVersion)
        {
            var tempInstallationPath = _installationFileManager.GetTempInstallationPath(moduleName);

            if (!Directory.Exists(tempInstallationPath.PhysicalPath))
            {
                throw new Exception("The temporary installation directory has been deleted.".Localize());
            }
            ModulePath modulePath = new ModulePath(moduleName);

            Kooboo.IO.IOUtility.CopyDirectory(tempInstallationPath.PhysicalPath, modulePath.PhysicalPath);
            var assemblyFiles = Directory.EnumerateFiles(modulePath.GetModuleInstallationFilePath("Bin").PhysicalPath);
            var binPath       = Settings.BinDirectory;

            foreach (var item in assemblyFiles)
            {
                if (!_assemblyReferences.IsSystemAssembly(item))
                {
                    var fileName      = Path.GetFileName(item);
                    var fileNameInBin = Path.Combine(binPath, fileName);
                    var exists        = File.Exists(fileNameInBin);
                    if (!exists || (exists && overrideSystemVersion))
                    {
                        File.Copy(item, fileNameInBin, overrideSystemVersion);
                    }
                    _assemblyReferences.AddReference(fileNameInBin, moduleName);
                }
            }
        }
Example #2
0
 internal void CopyFiles(string moduleName, bool @overrideSystemVersion)
 {
     var tempInstallationPath = _installationFileManager.GetTempInstallationPath(moduleName);
     if (!Directory.Exists(tempInstallationPath.PhysicalPath))
     {
         throw new Exception("The temporary installation directory has been deleted.".Localize());
     }
     ModulePath modulePath = new ModulePath(moduleName);
     Kooboo.IO.IOUtility.CopyDirectory(tempInstallationPath.PhysicalPath, modulePath.PhysicalPath);
     var assemblyFiles = Directory.EnumerateFiles(modulePath.GetModuleInstallationFilePath("Bin").PhysicalPath);
     var binPath = Settings.BinDirectory;
     foreach (var item in assemblyFiles)
     {
         var fileName = Path.GetFileName(item);
         var fileNameInBin = Path.Combine(binPath, fileName);
         var exists = File.Exists(fileNameInBin);
         if (!exists || (exists && overrideSystemVersion))
         {
             File.Copy(item, fileNameInBin, overrideSystemVersion);
         }
         _assemblyReferences.AddReference(fileNameInBin, moduleName);
     }
 }