Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@ianhays
Copy link
Contributor

@ianhays ianhays commented Jun 13, 2018

This is a net-zero change PR to move around some files in the System.IO.Compression.ZipFile assembly in preparation for some upcoming major additions.

  • src/ZipFile is split up into:
    • src/ZipFile.Create
    • src/ZipFile.Extract
    • src/ZipFileUtils
  • src/ZipFileExtensions is split up into:
    • src/ZipFileExtensions.ZipArchive.Create
    • src/ZipFileExtensions.ZipArchive.Extract
    • src/ZipFileExtensions.ZipArchiveEntryExtract
  • Tests from ZipFileConvenienceMethods, ZipFileConvenienceMethods.netcoreapp1.1, ZipFileInvalidFileTests, and ZipFileReadOpenUpdateTests are split up by their operating class and moved into:
    • tests/ZipFile.Create
    • tests/ZipFile.Extract
    • tests/ZipFileExtensions.ZipArchive.Create
    • tests/ZipFileExtensions.ZipArchive.Extract
    • tests/ZipFileExtensions.ZipArchiveEntryExtract

Note that this is not a comprehensive cleanup of the ZipFile classes/members themselves, but rather a clean up and reorganization of the files. My aim is not to make any code changes yet so that I can keep this PR simple.

PTAL: @stephentoub @ViktorHofer

This is a net-zero change PR to move around some files in the System.IO.Compression.ZipFile assembly in preparation for some upcoming major additions.
@ianhays ianhays added enhancement Product code improvement that does NOT require public API changes/additions area-System.IO.Compression labels Jun 13, 2018
@ianhays ianhays added this to the Future milestone Jun 13, 2018
@ianhays ianhays self-assigned this Jun 13, 2018
private static void DoCreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName,
CompressionLevel? compressionLevel, bool includeBaseDirectory,
Encoding entryNameEncoding)
CompressionLevel? compressionLevel, bool includeBaseDirectory, Encoding entryNameEncoding)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indenting?

///
/// <param name="sourceArchiveFileName">The path to the archive on the file system that is to be extracted.</param>
/// <param name="destinationDirectoryName">The path to the directory on the file system. The directory specified must not exist, but the directory that it is contained in must exist.</param>
public static void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName) => ExtractToDirectory(sourceArchiveFileName, destinationDirectoryName, entryNameEncoding: null, overwrite: false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: These are long lines... maybe you could split them, at least moving this to the next line and indenting.

internal static ZipArchiveEntry DoCreateEntryFromFile(this ZipArchive destination,
string sourceFileName, string entryName, CompressionLevel? compressionLevel)
{
if (destination == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indenting, here and the line above

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only just skimmed it since you said there were zero actual code changes.

Assert.Equal(fileName, Path.GetFileName(results[0]));
}

#if netcoreapp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: put that into its separate file: ZipFile.Extract.netcoreapp.cs?

/// <returns>A wrapper for the newly created entry.</returns>
public static ZipArchiveEntry CreateEntryFromFile(this ZipArchive destination,
string sourceFileName, string entryName, CompressionLevel compressionLevel) =>
DoCreateEntryFromFile(destination, sourceFileName, entryName, compressionLevel);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also this line

@stephentoub
Copy link
Member

@dotnet-bot test OSX x64 Debug Build please ("Error during cleanup: java.lang.IllegalArgumentException: Failed to prepare archiveArtifacts step")

@ianhays ianhays merged commit c6efb24 into dotnet:master Jun 14, 2018
@karelz karelz modified the milestones: Future, 3.0 Jul 8, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Refactor, clean up ZipFile assembly

Commit migrated from dotnet/corefx@c6efb24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.IO.Compression enhancement Product code improvement that does NOT require public API changes/additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants