Source/NFX/IO/FileSystem/Packaging/LocalInstallation.cs
/// <summary>
/// Unconditionally installs a package - copies a set of files contained in the FileSystemDirectory assigning it some mnemonic name
/// </summary>
Unconditionally installs a package - copies a set of files contained in the FileSystemDirectory assigning it some mnemonic name
Unconditionally installs a package - copies a set of files contained in the FileSystemDirectory assigning it some mnemonic name
public void InstallPackage(PackageInfo package)
      {
        if (!m_InstallationStarted)
         throw new NFXIOException(StringConsts.LOCAL_INSTALL_NOT_STARTED_INSTALL_PACKAGE_ERROR);
        var path = m_RootPath;
        if (package.RelativePath.IsNotNullOrWhiteSpace())
        {
         path = Path.Combine(path, package.RelativePath);
         IOMiscUtils.EnsureAccessibleDirectory(path);
        }
        var packageName = package.Name;
        var source = package.Source;
        var manifest = package.Manifest;
        using(var lfs = new Local.LocalFileSystem(null))
         using(var fss = lfs.StartSession(null))
         {
           var targetDir = fss[path] as FileSystemDirectory;
           if (targetDir==null)
             throw new NFXIOException(StringConsts.LOCAL_INSTALL_ROOT_PATH_NOT_FOUND_ERROR.Args(path));
           source.DeepCopyTo(targetDir, FileSystemDirectory.DirCopyFlags.FilesAndDirsOnly,
              filter: (item) =>
              {
                var file = item as FileSystemFile;
                if (file==null) return true;
                if (file.ParentPath==source.Path && file.Name == ManifestUtils.MANIFEST_FILE_NAME) return false;
                return true;
              }
            );
         }
        var existing = this[packageName];
        if (existing!=null) ((ConfigSectionNode)existing).Delete();
        m_Packages.AddChildNode(manifest);
        m_Modified = true;
      }
public void InstallPackage ( PackageInfo package ) { if ( ! m_InstallationStarted ) throw new NFXIOException ( StringConsts . LOCAL_INSTALL_NOT_STARTED_INSTALL_PACKAGE_ERROR ) ; var path = m_RootPath ; if ( package . RelativePath . IsNotNullOrWhiteSpace ( ) ) { path = Path . Combine ( path , package . RelativePath ) ; IOMiscUtils . EnsureAccessibleDirectory ( path ) ; } var packageName = package . Name ; var source = package . Source ; var manifest = package . Manifest ; using ( var lfs = new Local . LocalFileSystem ( null ) ) using ( var fss = lfs . StartSession ( null ) ) { var targetDir = fss [ path ] as FileSystemDirectory ; if ( targetDir == null ) throw new NFXIOException ( StringConsts . LOCAL_INSTALL_ROOT_PATH_NOT_FOUND_ERROR . Args ( path ) ) ; source . DeepCopyTo ( targetDir , FileSystemDirectory . DirCopyFlags . FilesAndDirsOnly , filter : ( item ) => { var file = item as FileSystemFile ; if ( file == null ) return true ; if ( file . ParentPath == source . Path && file . Name == ManifestUtils . MANIFEST_FILE_NAME ) return false ; return true ; } ) ; } var existing = this [ packageName ] ; if ( existing != null ) ( ( ConfigSectionNode ) existing ) . Delete ( ) ; m_Packages . AddChildNode ( manifest ) ; m_Modified = true ; }
Unconditionally installs a package - copies a set of files contained in the FileSystemDirectory assigning it some mnemonic name
Unconditionally installs a package - copies a set of files contained in the FileSystemDirectory assigning it some mnemonic name
package
PackageInfo