From dd8480d4024831acd1802d73173190bff773ec40 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Tue, 2 Aug 2005 10:26:05 +0000 Subject: [PATCH] Summary comment updates --- src/AssemblyInfo.cs | 2 +- src/Checksums/StrangeCRC.cs | 2 +- src/Core/FileSystemScanner.cs | 104 +++++++++++++++++- src/Core/NameFilter.cs | 2 +- src/Core/PathFilter.cs | 24 +++- src/Encryption/PkzipClassic.cs | 20 +++- src/ICSharpCode.SharpZLib.prjx | 8 +- src/Zip/Compression/DeflaterEngine.cs | 12 +- .../Streams/InflaterInputStream.cs | 7 ++ src/Zip/FastZip.cs | 90 ++++++++++++++- src/Zip/ZipFile.cs | 4 +- src/Zip/ZipInputStream.cs | 2 +- 12 files changed, 250 insertions(+), 27 deletions(-) diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs index 2243aedc4..7f5cd0cb4 100644 --- a/src/AssemblyInfo.cs +++ b/src/AssemblyInfo.cs @@ -48,7 +48,7 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.83.3.0")] +[assembly: AssemblyVersion("0.84.0.0")] [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("../ICSharpCode.SharpZipLib.key")] diff --git a/src/Checksums/StrangeCRC.cs b/src/Checksums/StrangeCRC.cs index c71180f86..2098b4512 100644 --- a/src/Checksums/StrangeCRC.cs +++ b/src/Checksums/StrangeCRC.cs @@ -115,7 +115,7 @@ public class StrangeCRC : IChecksum int globalCrc; /// - /// Initialise a default instance of + /// Initialise a default instance of /// public StrangeCRC() { diff --git a/src/Core/FileSystemScanner.cs b/src/Core/FileSystemScanner.cs index b5831f1f0..c1cdc6f58 100644 --- a/src/Core/FileSystemScanner.cs +++ b/src/Core/FileSystemScanner.cs @@ -39,8 +39,15 @@ namespace ICSharpCode.SharpZipLib.Core { + /// + /// Event arguments for scanning. + /// public class ScanEventArgs : EventArgs { + /// + /// Initialise a new instance of + /// + /// public ScanEventArgs(string name) { this.name = name; @@ -49,6 +56,9 @@ public ScanEventArgs(string name) string name; + /// + /// The name for this event. + /// public string Name { get { return name; } @@ -56,6 +66,9 @@ public string Name bool continueRunning; + /// + /// Get set a value indicating if scanning should continue or not. + /// public bool ContinueRunning { get { return continueRunning; } @@ -63,13 +76,16 @@ public bool ContinueRunning } } + /// + /// Event arguments for directories. + /// public class DirectoryEventArgs : ScanEventArgs { /// - /// Initialize an instance of . + /// Initialize an instance of . /// /// The name for this directory. - /// Flag value indicating if any matching files are contained in this directory. + /// Flag value indicating if any matching files are contained in this directory. public DirectoryEventArgs(string name, bool hasMatchingFiles) : base (name) { @@ -77,7 +93,7 @@ public DirectoryEventArgs(string name, bool hasMatchingFiles) } /// - /// Geta value indicating if the directory contains any matching files or not. + /// Get a value indicating if the directory contains any matching files or not. /// public bool HasMatchingFiles { @@ -87,8 +103,16 @@ public bool HasMatchingFiles bool hasMatchingFiles; } + /// + /// Arguments passed when scan failures are detected. + /// public class ScanFailureEventArgs { + /// + /// Initialise a new instance of + /// + /// The name to apply. + /// The exception to use. public ScanFailureEventArgs(string name, Exception e) { this.name = name; @@ -97,12 +121,20 @@ public ScanFailureEventArgs(string name, Exception e) } string name; + + /// + /// The applicable name. + /// public string Name { get { return name; } } Exception exception; + + /// + /// The applicable exception. + /// public Exception Exception { get { return exception; } @@ -110,6 +142,9 @@ public Exception Exception bool continueRunning; + /// + /// Get / set a value indicating wether scanning should continue. + /// public bool ContinueRunning { get { return continueRunning; } @@ -117,9 +152,24 @@ public bool ContinueRunning } } + /// + /// Delegate invokked when a directory is processed. + /// public delegate void ProcessDirectoryDelegate(object Sender, DirectoryEventArgs e); + + /// + /// Delegate invoked when a file is processed. + /// public delegate void ProcessFileDelegate(object sender, ScanEventArgs e); + + /// + /// Delegate invoked when a directory failure is detected. + /// public delegate void DirectoryFailureDelegate(object sender, ScanFailureEventArgs e); + + /// + /// Delegate invoked when a file failure is detected. + /// public delegate void FileFailureDelegate(object sender, ScanFailureEventArgs e); /// @@ -128,7 +178,7 @@ public bool ContinueRunning public class FileSystemScanner { /// - /// Initialise a new instance of + /// Initialise a new instance of /// /// The file filter to apply when scanning. public FileSystemScanner(string filter) @@ -139,7 +189,7 @@ public FileSystemScanner(string filter) /// /// Initialise a new instance of /// - /// + /// The file filter to apply. /// The directory filter to apply. public FileSystemScanner(string fileFilter, string directoryFilter) { @@ -147,23 +197,51 @@ public FileSystemScanner(string fileFilter, string directoryFilter) this.directoryFilter = new PathFilter(directoryFilter); } + /// + /// Initialise a new instance of + /// + /// The file filter to apply. public FileSystemScanner(IScanFilter fileFilter) { this.fileFilter = fileFilter; } + /// + /// Initialise a new instance of + /// + /// The file filter to apply. + /// The directory filter to apply. public FileSystemScanner(IScanFilter fileFilter, IScanFilter directoryFilter) { this.fileFilter = fileFilter; this.directoryFilter = directoryFilter; } + /// + /// Delegate to invoke when a directory is processed. + /// public ProcessDirectoryDelegate ProcessDirectory; + + /// + /// Delegate to invoke when a file is processed. + /// public ProcessFileDelegate ProcessFile; + /// + /// Delegate to invoke when a directory failure is detected. + /// public DirectoryFailureDelegate DirectoryFailure; + + /// + /// Delegate to invoke when a file failure is detected. + /// public FileFailureDelegate FileFailure; + /// + /// Raise the DirectoryFailure event. + /// + /// Rhe directory name. + /// The exception detected. public void OnDirectoryFailure(string directory, Exception e) { if ( DirectoryFailure == null ) { @@ -175,6 +253,11 @@ public void OnDirectoryFailure(string directory, Exception e) } } + /// + /// Raise the FileFailure event. + /// + /// The file name. + /// The exception detected. public void OnFileFailure(string file, Exception e) { if ( FileFailure == null ) { @@ -185,7 +268,11 @@ public void OnFileFailure(string file, Exception e) alive = args.ContinueRunning; } } - + + /// + /// Raise the ProcessFile event. + /// + /// The file name. public void OnProcessFile(string file) { if ( ProcessFile != null ) { @@ -195,6 +282,11 @@ public void OnProcessFile(string file) } } + /// + /// Raise the ProcessDirectory event. + /// + /// The directory name. + /// Flag indicating if the directory has matching files. public void OnProcessDirectory(string directory, bool hasMatchingFiles) { if ( ProcessDirectory != null ) { diff --git a/src/Core/NameFilter.cs b/src/Core/NameFilter.cs index afc24e0b5..cb8036f05 100644 --- a/src/Core/NameFilter.cs +++ b/src/Core/NameFilter.cs @@ -68,7 +68,7 @@ public NameFilter(string filter) /// Test a string to see if it is a valid regular expression. /// /// The expression to test. - /// True if expression is a valid false otherwise. + /// True if expression is a valid false otherwise. public static bool IsValidExpression(string e) { bool result = true; diff --git a/src/Core/PathFilter.cs b/src/Core/PathFilter.cs index b1d6a2629..0f05efdde 100644 --- a/src/Core/PathFilter.cs +++ b/src/Core/PathFilter.cs @@ -80,16 +80,30 @@ public virtual bool IsMatch(string name) NameFilter nameFilter; #endregion } - + + /// + /// NameAnsSizeFilter filters based on name and file size. + /// public class NameAndSizeFilter : PathFilter { - + + /// + /// Initialise a new instance of NameAndSizeFilter. + /// + /// The filter to apply. + /// The minimum file size to include. + /// The maximum file size to include. public NameAndSizeFilter(string filter, long minSize, long maxSize) : base(filter) { this.minSize = minSize; this.maxSize = maxSize; } + /// + /// Test a filename to see if it matches the filter. + /// + /// The filename to test. + /// True if the filter matches, false otherwise. public override bool IsMatch(string fileName) { FileInfo fileInfo = new FileInfo(fileName); @@ -100,6 +114,9 @@ public override bool IsMatch(string fileName) long minSize = 0; + /// + /// The minimum size for a file that will match this filter. + /// public long MinSize { get { return minSize; } @@ -108,6 +125,9 @@ public long MinSize long maxSize = long.MaxValue; + /// + /// The maximum size for a file that will match this filter. + /// public long MaxSize { get { return maxSize; } diff --git a/src/Encryption/PkzipClassic.cs b/src/Encryption/PkzipClassic.cs index d0bbe62a7..3051b9b33 100644 --- a/src/Encryption/PkzipClassic.cs +++ b/src/Encryption/PkzipClassic.cs @@ -161,7 +161,7 @@ class PkzipClassicEncryptCryptoTransform : PkzipClassicCryptoBase, ICryptoTransf /// /// Initialise a new instance of /// - /// The key block to with. + /// The key block to use. internal PkzipClassicEncryptCryptoTransform(byte[] keyBlock) { SetKeys(keyBlock); @@ -267,7 +267,7 @@ class PkzipClassicDecryptCryptoTransform : PkzipClassicCryptoBase, ICryptoTransf /// /// Initialise a new instance of . /// - /// The key block to with. + /// The key block to decrypt with. internal PkzipClassicDecryptCryptoTransform(byte[] keyBlock) { SetKeys(keyBlock); @@ -370,6 +370,10 @@ public void Dispose() /// public sealed class PkzipClassicManaged : PkzipClassic { + /// + /// Get / set the applicable block size. + /// + /// The only valid block size is 8. public override int BlockSize { get { return 8; } @@ -379,6 +383,9 @@ public override int BlockSize } } + /// + /// Get an array of legal key sizes. + /// public override KeySizes[] LegalKeySizes { get { @@ -388,11 +395,17 @@ public override KeySizes[] LegalKeySizes } } + /// + /// Generate an initial vector. + /// public override void GenerateIV() { // Do nothing. } + /// + /// Get an array of legal block sizes. + /// public override KeySizes[] LegalBlockSizes { get { @@ -404,6 +417,9 @@ public override KeySizes[] LegalBlockSizes byte[] key; + /// + /// Get / set the key value applicable. + /// public override byte[] Key { get { diff --git a/src/ICSharpCode.SharpZLib.prjx b/src/ICSharpCode.SharpZLib.prjx index 4bcb9fcda..931b91107 100644 --- a/src/ICSharpCode.SharpZLib.prjx +++ b/src/ICSharpCode.SharpZLib.prjx @@ -62,14 +62,14 @@ - - + + - + - + diff --git a/src/Zip/Compression/DeflaterEngine.cs b/src/Zip/Compression/DeflaterEngine.cs index 8a8e4f38b..b6604f456 100644 --- a/src/Zip/Compression/DeflaterEngine.cs +++ b/src/Zip/Compression/DeflaterEngine.cs @@ -102,7 +102,7 @@ public class DeflaterEngine : DeflaterConstants short[] head; /// - /// prev[index & WMASK] points to the previous index that has the + /// prev[index & WMASK] points to the previous index that has the /// same hash code as the string starting at index. This way /// entries with the same hash code are in a linked list. /// Note that the array should really be unsigned short, so you need @@ -400,7 +400,7 @@ public void FillWindow() /// /// Preconditions: /// - /// strstart + MAX_MATCH <= window.length. + /// strstart + MAX_MATCH <= window.length. /// /// /// True if a match greater than the minimum length is found @@ -752,8 +752,14 @@ public bool Deflate(bool flush, bool finish) return progress; } + + /// /// Sets input data to be deflated. Should only be called when NeedsInput() /// returns true + /// + /// The buffer containing input data. + /// The index of the first byte of data. + /// The number of bytes of data to use as input. public void SetInput(byte[] buf, int off, int len) { if (inputOff < inputEnd) { @@ -775,7 +781,7 @@ public void SetInput(byte[] buf, int off, int len) } /// - /// Return true if input is needed via SetInput + /// Return true if input is needed via SetInput /// public bool NeedsInput() { diff --git a/src/Zip/Compression/Streams/InflaterInputStream.cs b/src/Zip/Compression/Streams/InflaterInputStream.cs index b4dcf186b..f4b959042 100644 --- a/src/Zip/Compression/Streams/InflaterInputStream.cs +++ b/src/Zip/Compression/Streams/InflaterInputStream.cs @@ -55,6 +55,10 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams /// public class InflaterInputBuffer { + /// + /// Initialise a new instance of + /// + /// The stream to buffer. public InflaterInputBuffer(Stream stream) { inputStream = stream; @@ -328,6 +332,9 @@ public class InflaterInputStream : Stream /// protected Inflater inf; + /// + /// Input buffer for this stream. + /// protected InflaterInputBuffer inputBuffer; /// diff --git a/src/Zip/FastZip.cs b/src/Zip/FastZip.cs index 8408b1ea1..1457c7496 100644 --- a/src/Zip/FastZip.cs +++ b/src/Zip/FastZip.cs @@ -40,14 +40,36 @@ namespace ICSharpCode.SharpZipLib.Zip { + /// + /// FastZipEvents supports all events applicable to FastZip operations. + /// public class FastZipEvents { + /// + /// Delegate to invoke when processing directories. + /// public ProcessDirectoryDelegate ProcessDirectory; + + /// + /// Delegate to invoke when processing files. + /// public ProcessFileDelegate ProcessFile; + /// + /// Delegate to invoke when processing directory failures. + /// public DirectoryFailureDelegate DirectoryFailure; + + /// + /// Delegate to invoke when processing file failures. + /// public FileFailureDelegate FileFailure; + /// + /// Raise the directory failure event. + /// + /// The directory. + /// The exception for this event. public void OnDirectoryFailure(string directory, Exception e) { if ( DirectoryFailure != null ) { @@ -56,6 +78,11 @@ public void OnDirectoryFailure(string directory, Exception e) } } + /// + /// Raises the file failure event. + /// + /// The file for this event. + /// The exception for this event. public void OnFileFailure(string file, Exception e) { if ( FileFailure != null ) { @@ -80,7 +107,7 @@ public void OnProcessFile(string file) /// Raises the ProcessDirectoryEvent. /// /// The directory for this event. - /// Flag indicating if directory is empty as determined by the current filter. + /// Flag indicating if directory has matching files as determined by the current filter. public void OnProcessDirectory(string directory, bool hasMatchingFiles) { if ( ProcessDirectory != null ) { @@ -97,30 +124,63 @@ public void OnProcessDirectory(string directory, bool hasMatchingFiles) /// public class FastZip { + /// + /// Initialize a default instance of FastZip. + /// public FastZip() { this.events = null; } + /// + /// Initialise a new instance of + /// + /// public FastZip(FastZipEvents events) { this.events = events; } + /// + /// Defines the desired handling when overwriting files. + /// public enum Overwrite { + /// + /// Prompt the user to confirm overwriting + /// Prompt, + /// + /// Never overwrite files. + /// Never, + /// + /// Always overwrite files. + /// Always } + /// + /// Get/set a value indicating wether empty directories should be created. + /// public bool CreateEmptyDirectories { get { return createEmptyDirectories; } set { createEmptyDirectories = value; } } - + + /// + /// Delegate called when confirming overwriting of files. + /// public delegate bool ConfirmOverwriteDelegate(string fileName); + /// + /// Create a zip file. + /// + /// The name of the zip file to create. + /// The directory to source files from. + /// True to recurse directories, false for no recursion. + /// The file filter to apply. + /// The directory filter to apply. public void CreateZip(string zipFileName, string sourceDirectory, bool recurse, string fileFilter, string directoryFilter) { NameTransform = new ZipNameTransform(true, sourceDirectory); @@ -139,17 +199,39 @@ public void CreateZip(string zipFileName, string sourceDirectory, bool recurse, outputStream.Close(); } } - + + /// + /// Create a zip file/archive. + /// + /// The name of the zip file to create. + /// The directory to obtain files and directories from. + /// True to recurse directories, false for no recursion. + /// The file filter to apply. public void CreateZip(string zipFileName, string sourceDirectory, bool recurse, string fileFilter) { CreateZip(zipFileName, sourceDirectory, recurse, fileFilter, null); } - + + /// + /// Extract the contents of a zip file. + /// + /// The zip file to extract from. + /// The directory to save extracted information in. + /// A filter to apply to files. public void ExtractZip(string zipFileName, string targetDirectory, string fileFilter) { ExtractZip(zipFileName, targetDirectory, Overwrite.Always, null, fileFilter, null); } + /// + /// Exatract the contents of a zip file. + /// + /// The zip file to extract from. + /// The directory to save extracted information in. + /// The style of overwriting to apply. + /// A delegate to invoke when confirming overwriting. + /// A filter to apply to files. + /// A filter to apply to directories. public void ExtractZip(string zipFileName, string targetDirectory, Overwrite overwrite, ConfirmOverwriteDelegate confirmDelegate, string fileFilter, string directoryFilter) diff --git a/src/Zip/ZipFile.cs b/src/Zip/ZipFile.cs index 3961b2ec8..da351649d 100644 --- a/src/Zip/ZipFile.cs +++ b/src/Zip/ZipFile.cs @@ -590,7 +590,7 @@ public bool TestArchive(bool testData) /// /// If true be extremely picky about the testing, otherwise be relaxed /// - /// + /// /// Apply extra testing to see if the entry can be extracted by the library /// /// The offset of the entries data in the file @@ -830,7 +830,7 @@ public Stream GetInputStream(ZipEntry entry) /// /// The ZipFile has already been closed /// - /// + /// /// The compression method for the entry is unknown /// /// diff --git a/src/Zip/ZipInputStream.cs b/src/Zip/ZipInputStream.cs index d4c38c569..c39987032 100644 --- a/src/Zip/ZipInputStream.cs +++ b/src/Zip/ZipInputStream.cs @@ -375,7 +375,7 @@ int InitialRead(byte[] destination, int offset, int count) throw new ZipException("No password set."); } - /// Generate and set crypto transform... + // Generate and set crypto transform... PkzipClassicManaged managed = new PkzipClassicManaged(); byte[] key = PkzipClassic.GenerateKeys(Encoding.ASCII.GetBytes(password));