string ValidateZipSourceDestinationFileOperation(IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst, IDev2ZipOperationTO args, Func <string> performAfterValidation) { _common.AddMissingFileDirectoryParts(src, dst); if (dst.PathIs(dst.IOPath) == enPathType.Directory) { var sourcePart = src.IOPath.Path.Split(src.PathSeperator().ToCharArray(), StringSplitOptions.RemoveEmptyEntries) .Last(); if (src.PathIs(src.IOPath) == enPathType.File) { var fileInfo = new FileInfo(sourcePart); dst.IOPath.Path = dst.Combine(sourcePart.Replace(fileInfo.Extension, ".zip")); } else { dst.IOPath.Path = dst.IOPath.Path + ".zip"; } } else { var sourcePart = dst.IOPath.Path.Split(dst.PathSeperator().ToCharArray(), StringSplitOptions.RemoveEmptyEntries) .Last(); var fileInfo = new FileInfo(sourcePart); dst.IOPath.Path = dst.IOPath.Path.Replace(fileInfo.Extension, ".zip"); } if (!args.Overwrite && dst.PathExist(dst.IOPath)) { throw new Exception(ErrorResource.DestinationFileAlreadyExists); } var opStatus = CreateEndPoint(dst, new Dev2CRUDOperationTO(args.Overwrite), dst.PathIs(dst.IOPath) == enPathType.Directory); if (!opStatus.Equals(ResultOk)) { throw new Exception(string.Format(ErrorResource.RecursiveDirectoryCreateFailed, dst.IOPath.Path)); } return(performAfterValidation()); }