private void CleanUpPackageDirectories(List <UpdateItem> updateItems, string rootDirectory, string sourceDirectory) { string relativeDirectory = sourceDirectory.Substring(rootDirectory.Length).TrimStart(new char[] { '\\' }); foreach (UpdateItem updateItem in updateItems) { if (Directory.Exists(Path.Combine(rootDirectory, updateItem.RelativeDirectory)) == false) { AutoUpdateManager.DeleteFolderFromPackage(this.Target, updateItem.RelativeDirectory); } } }
protected void wcFileManager_SelectedItemsAction(object sender, IZ.WebFileManager.SelectedItemsActionCancelEventArgs e) { //string relativePath = e.DestinationDirectory.FileManagerPath.Replace('/', '\\').TrimStart(new char[] { '\\' }); string destinationRelativePath = TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, e.DestinationDirectory.FileManagerPath); switch (e.Action) { case IZ.WebFileManager.SelectedItemsAction.Copy: foreach (var selectedItem in e.SelectedItems) { string sourceFile = TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, selectedItem.FileManagerPath); AutoUpdateManager.CopyFileInPackage(this.Target, Path.GetDirectoryName(sourceFile), Path.GetFileName(sourceFile), destinationRelativePath); } break; case IZ.WebFileManager.SelectedItemsAction.Delete: foreach (var selectedItem in e.SelectedItems) { if ((File.GetAttributes(selectedItem.PhysicalPath) & FileAttributes.Directory) == FileAttributes.Directory) { AutoUpdateManager.DeleteFolderFromPackage(this.Target, destinationRelativePath); } else { AutoUpdateManager.DeleteFileFromPackage(this.Target, destinationRelativePath, Path.GetFileName(selectedItem.PhysicalPath)); } } break; case IZ.WebFileManager.SelectedItemsAction.Move: foreach (var selectedItem in e.SelectedItems) { if ((File.GetAttributes(selectedItem.PhysicalPath) & FileAttributes.Directory) == FileAttributes.Directory) { AutoUpdateManager.MoveFolderInPackage(this.Target, TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, selectedItem.FileManagerPath), destinationRelativePath); } else { AutoUpdateManager.MoveFileInPackage(this.Target, TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, selectedItem.FileManagerPath), Path.GetFileName(selectedItem.PhysicalPath), destinationRelativePath, Path.GetFileName(selectedItem.PhysicalPath)); } } break; } }