From bf1c8f0db3eb7cd0bafd9239d8715627dcc3cafd Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 28 Dec 2019 21:13:25 -0500 Subject: [PATCH] clean up code, remove unused ZIPSettings thing, ensure appropriate comments are added --- .../FileSystem/ZIP/ZIPDataFormat.cs | 28 +++++++++++++------ .../DataFormats/FileSystem/ZIP/ZIPSettings.cs | 9 ------ .../UniversalEditor.Plugins.FileSystem.csproj | 2 +- 3 files changed, 20 insertions(+), 19 deletions(-) delete mode 100644 CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPSettings.cs diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs index a7be239c..7bf9282e 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs @@ -17,16 +17,20 @@ namespace UniversalEditor.DataFormats.FileSystem.ZIP { // TODO: Fix the ZIP data format's saving!!! - + /// + /// Provides a to read and write data in the standardized PKWARE ZIP archive file format. + /// public class ZIPDataFormat : DataFormat { - private ZIPSettings mvarSettings = new ZIPSettings(); - private static readonly byte[] SIG_CENTRAL_DIRECTORY_ENTRY = new byte[] { 0x50, 0x4B, 0x01, 0x02 }; private static readonly byte[] SIG_DIRECTORY_ENTRY = new byte[] { 0x50, 0x4B, 0x03, 0x04 }; private static readonly byte[] SIG_END_OF_CENTRAL_DIRECTORY = new byte[] { 0x50, 0x4B, 0x05, 0x06 }; private string mvarComment = String.Empty; + /// + /// Gets or sets the comment written in the header of the ZIP archive. + /// + /// The comment to be written in the header of the ZIP archive. public string Comment { get { return mvarComment; } set { mvarComment = value; } } private long _offsetToBeginningOfZIPFile = 0; @@ -40,6 +44,10 @@ namespace UniversalEditor.DataFormats.FileSystem.ZIP return dfr; } + /// + /// Loads the data from the into the given . + /// + /// A into which to load the data. protected override void LoadInternal(ref ObjectModel objectModel) { FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); @@ -233,22 +241,22 @@ namespace UniversalEditor.DataFormats.FileSystem.ZIP short iCompressionMethod = br.ReadInt16(); switch (iCompressionMethod) { - case 8: + case 8: { method = CompressionMethod.Deflate; break; } - case 9: + case 9: { method = CompressionMethod.Deflate64; break; } - case 12: + case 12: { method = CompressionMethod.Bzip2; break; } - case 14: + case 14: { method = CompressionMethod.LZMA; break; @@ -406,6 +414,10 @@ namespace UniversalEditor.DataFormats.FileSystem.ZIP return true; } + /// + /// Saves the data to the . + /// + /// A that contains the data to save. protected override void SaveInternal(ObjectModel objectModel) { FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); @@ -803,8 +815,6 @@ namespace UniversalEditor.DataFormats.FileSystem.ZIP f.SetData(unpackedData); return f; } - - public ZIPSettings Settings { get { return mvarSettings; } } } } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPSettings.cs b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPSettings.cs deleted file mode 100644 index 3f6178c9..00000000 --- a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ZIP/ZIPSettings.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace UniversalEditor.DataFormats.FileSystem.ZIP -{ - public class ZIPSettings - { - } -} - diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj index b1aece38..fc43008c 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + ..\..\Output\Debug\Plugins\UniversalEditor.Plugins.FileSystem.xml pdbonly @@ -211,7 +212,6 @@ -