mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ZipFile, ZipFileEntry] Add regions for sanity
This commit is contained in:
@@ -111,6 +111,8 @@ namespace SabreTools.Helper
|
||||
|
||||
#endregion
|
||||
|
||||
#region Central Directory
|
||||
|
||||
/// <summary>
|
||||
/// Find the end of the central directory signature
|
||||
/// </summary>
|
||||
@@ -227,6 +229,10 @@ namespace SabreTools.Helper
|
||||
bw.Write(_fileComment, 0, _fileComment.Length);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Zip64 Central Directory
|
||||
|
||||
/// <summary>
|
||||
/// Read the end of the Zip64 central directory
|
||||
/// </summary>
|
||||
@@ -361,6 +367,10 @@ namespace SabreTools.Helper
|
||||
bw.Write((uint)1); // total number of disks
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Open, Create, Close
|
||||
|
||||
/// <summary>
|
||||
/// Open a new file as an archive
|
||||
/// </summary>
|
||||
@@ -737,6 +747,10 @@ namespace SabreTools.Helper
|
||||
_zipOpen = ZipOpenType.Closed;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Read and Write
|
||||
|
||||
/// <summary>
|
||||
/// Open the read file stream
|
||||
/// </summary>
|
||||
@@ -885,6 +899,10 @@ namespace SabreTools.Helper
|
||||
_entries[_entries.Count - 1].AddDirectory();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Scan every individual entry for validity
|
||||
/// </summary>
|
||||
@@ -994,5 +1012,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,15 +155,7 @@ namespace SabreTools.Helper
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Check if an entry equals another (use only name for now)
|
||||
/// </summary>
|
||||
/// <param name="zfe"></param>
|
||||
/// <returns></returns>
|
||||
public bool Equals(ZipFileEntry zfe)
|
||||
{
|
||||
return (String.Equals(_fileName, zfe.FileName, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
#region Central Directory
|
||||
|
||||
/// <summary>
|
||||
/// Read the central directory entry from the input stream
|
||||
@@ -387,6 +379,10 @@ namespace SabreTools.Helper
|
||||
// We have no file comment, so we don't have to write more
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Header
|
||||
|
||||
/// <summary>
|
||||
/// Read the local file header from the input stream
|
||||
/// </summary>
|
||||
@@ -778,6 +774,10 @@ namespace SabreTools.Helper
|
||||
bw.Write(extraField.ToArray(), 0, extraFieldLength);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Read and Write
|
||||
|
||||
/// <summary>
|
||||
/// Open the read file stream
|
||||
/// </summary>
|
||||
@@ -946,6 +946,10 @@ namespace SabreTools.Helper
|
||||
_zipstream.Seek(posNow, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Get the data from the current file, if not already checked
|
||||
/// </summary>
|
||||
@@ -1027,5 +1031,17 @@ namespace SabreTools.Helper
|
||||
ds.WriteByte(03);
|
||||
ds.WriteByte(00);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if an entry equals another (use only name for now)
|
||||
/// </summary>
|
||||
/// <param name="zfe"></param>
|
||||
/// <returns></returns>
|
||||
public bool Equals(ZipFileEntry zfe)
|
||||
{
|
||||
return (String.Equals(_fileName, zfe.FileName, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user