From 0a69c584b4efbd39a6b1542e41c922c52687ec6b Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Sun, 28 Apr 2013 12:45:44 +0100 Subject: [PATCH] Removed Silverlight project and renamed WP7 project to Portable --- SharpCompress.sln | 8 +- SharpCompress/Common/ArchiveEncoding.cs | 2 +- .../Common/Zip/WinzipAesCryptoStream.cs | 2 +- SharpCompress/Common/Zip/ZipHeaderFactory.cs | 4 +- .../Compressor/Deflate/GZipStream.cs | 7 - .../Deflate/ParallelDeflateOutputStream.cs | 6 - SharpCompress/Compressor/LZMA/CRC.cs | 2 +- SharpCompress/Compressor/LZMA/Log.cs | 8 +- SharpCompress/Compressor/LZMA/Registry.cs | 2 +- SharpCompress/IO/MarkingBinaryReader.cs | 2 +- SharpCompress/SharpCompress.3.5.csproj | 318 ---------------- SharpCompress/SharpCompress.Mono.csproj | 230 ------------ ...7.csproj => SharpCompress.Portable.csproj} | 2 +- .../SharpCompress.Silverlight.csproj | 339 ------------------ SharpCompress/Utility.cs | 52 +-- 15 files changed, 39 insertions(+), 945 deletions(-) delete mode 100644 SharpCompress/SharpCompress.3.5.csproj delete mode 100644 SharpCompress/SharpCompress.Mono.csproj rename SharpCompress/{SharpCompress.WP7.csproj => SharpCompress.Portable.csproj} (97%) delete mode 100644 SharpCompress/SharpCompress.Silverlight.csproj diff --git a/SharpCompress.sln b/SharpCompress.sln index 8a63ace6..773018e0 100644 --- a/SharpCompress.sln +++ b/SharpCompress.sln @@ -5,9 +5,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress", "SharpCompr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Test", "SharpCompress.Test\SharpCompress.Test.csproj", "{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Silverlight", "SharpCompress\SharpCompress.Silverlight.csproj", "{185ED218-A74F-4F57-85A5-30647495E615}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.WP7", "SharpCompress\SharpCompress.WP7.csproj", "{7FA7D133-1417-4F85-9998-4C618AC8FEDA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Portable", "SharpCompress\SharpCompress.Portable.csproj", "{7FA7D133-1417-4F85-9998-4C618AC8FEDA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.WindowsStore", "SharpCompress\SharpCompress.WindowsStore.csproj", "{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}" EndProject @@ -25,10 +23,6 @@ Global {15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Release|Any CPU.ActiveCfg = Release|Any CPU {15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Release|Any CPU.Build.0 = Release|Any CPU - {185ED218-A74F-4F57-85A5-30647495E615}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {185ED218-A74F-4F57-85A5-30647495E615}.Debug|Any CPU.Build.0 = Debug|Any CPU - {185ED218-A74F-4F57-85A5-30647495E615}.Release|Any CPU.ActiveCfg = Release|Any CPU - {185ED218-A74F-4F57-85A5-30647495E615}.Release|Any CPU.Build.0 = Release|Any CPU {7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Debug|Any CPU.Build.0 = Debug|Any CPU {7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/SharpCompress/Common/ArchiveEncoding.cs b/SharpCompress/Common/ArchiveEncoding.cs index f56f9c47..af507745 100644 --- a/SharpCompress/Common/ArchiveEncoding.cs +++ b/SharpCompress/Common/ArchiveEncoding.cs @@ -17,7 +17,7 @@ namespace SharpCompress.Common static ArchiveEncoding() { -#if SILVERLIGHT || PORTABLE +#if PORTABLE Default = Encoding.UTF8; Password = Encoding.UTF8; #else diff --git a/SharpCompress/Common/Zip/WinzipAesCryptoStream.cs b/SharpCompress/Common/Zip/WinzipAesCryptoStream.cs index a5091917..59669c79 100644 --- a/SharpCompress/Common/Zip/WinzipAesCryptoStream.cs +++ b/SharpCompress/Common/Zip/WinzipAesCryptoStream.cs @@ -41,7 +41,7 @@ namespace SharpCompress.Common.Zip private SymmetricAlgorithm CreateCipher(WinzipAesEncryptionData winzipAesEncryptionData) { -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE RijndaelManaged cipher = new RijndaelManaged(); cipher.BlockSize = BLOCK_SIZE_IN_BYTES*8; cipher.KeySize = winzipAesEncryptionData.KeyBytes.Length*8; diff --git a/SharpCompress/Common/Zip/ZipHeaderFactory.cs b/SharpCompress/Common/Zip/ZipHeaderFactory.cs index 85e4f0b3..8a102466 100644 --- a/SharpCompress/Common/Zip/ZipHeaderFactory.cs +++ b/SharpCompress/Common/Zip/ZipHeaderFactory.cs @@ -2,7 +2,7 @@ using System.IO; using SharpCompress.Common.Zip.Headers; using SharpCompress.IO; -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE using System.Linq; #endif @@ -135,7 +135,7 @@ namespace SharpCompress.Common.Zip } else { -#if SILVERLIGHT || PORTABLE +#if PORTABLE throw new NotSupportedException("Cannot decrypt Winzip AES with Silverlight or WP7."); #else diff --git a/SharpCompress/Compressor/Deflate/GZipStream.cs b/SharpCompress/Compressor/Deflate/GZipStream.cs index 3709aa57..1bf44df0 100644 --- a/SharpCompress/Compressor/Deflate/GZipStream.cs +++ b/SharpCompress/Compressor/Deflate/GZipStream.cs @@ -36,13 +36,6 @@ namespace SharpCompress.Compressor.Deflate public class GZipStream : Stream { internal static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - /* - #if SILVERLIGHT || PORTABLE || MONO - internal static readonly Encoding Iso8859Dash1 = Encoding.UTF8; - #else - internal static readonly Encoding Iso8859Dash1 = Encoding.GetEncoding("iso-8859-1"); - #endif - */ public DateTime? LastModified { get; set; } diff --git a/SharpCompress/Compressor/Deflate/ParallelDeflateOutputStream.cs b/SharpCompress/Compressor/Deflate/ParallelDeflateOutputStream.cs index 66a4f626..f48f1184 100644 --- a/SharpCompress/Compressor/Deflate/ParallelDeflateOutputStream.cs +++ b/SharpCompress/Compressor/Deflate/ParallelDeflateOutputStream.cs @@ -1074,14 +1074,8 @@ namespace SharpCompress.Compressor.Deflate lock (_outputLock) { int tid = Thread.CurrentThread.GetHashCode(); -#if !SILVERLIGHT - Console.ForegroundColor = (ConsoleColor) (tid%8 + 8); -#endif Console.Write("{0:000} PDOS ", tid); Console.WriteLine(format, varParams); -#if !SILVERLIGHT - Console.ResetColor(); -#endif } } } diff --git a/SharpCompress/Compressor/LZMA/CRC.cs b/SharpCompress/Compressor/LZMA/CRC.cs index edaf3f90..f153dbf5 100644 --- a/SharpCompress/Compressor/LZMA/CRC.cs +++ b/SharpCompress/Compressor/LZMA/CRC.cs @@ -80,7 +80,7 @@ namespace SharpCompress.Compressor.LZMA return crc; } -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE public static unsafe uint Update(uint crc, byte* buffer, int length) { while (length > 0 && ((int) buffer & 3) != 0) diff --git a/SharpCompress/Compressor/LZMA/Log.cs b/SharpCompress/Compressor/LZMA/Log.cs index ec915d8c..894c3a32 100644 --- a/SharpCompress/Compressor/LZMA/Log.cs +++ b/SharpCompress/Compressor/LZMA/Log.cs @@ -31,7 +31,7 @@ namespace SharpCompress.Compressor.LZMA if (_needsIndent) { _needsIndent = false; -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE System.Diagnostics.Debug.Write(_indent.Peek()); #endif } @@ -40,7 +40,7 @@ namespace SharpCompress.Compressor.LZMA public static void Write(object value) { EnsureIndent(); -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE System.Diagnostics.Debug.Write(value); #endif } @@ -48,7 +48,7 @@ namespace SharpCompress.Compressor.LZMA public static void Write(string text) { EnsureIndent(); -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE System.Diagnostics.Debug.Write(text); #endif } @@ -56,7 +56,7 @@ namespace SharpCompress.Compressor.LZMA public static void Write(string format, params object[] args) { EnsureIndent(); -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE System.Diagnostics.Debug.Write(string.Format(format, args)); #endif } diff --git a/SharpCompress/Compressor/LZMA/Registry.cs b/SharpCompress/Compressor/LZMA/Registry.cs index 321b5670..5534d492 100644 --- a/SharpCompress/Compressor/LZMA/Registry.cs +++ b/SharpCompress/Compressor/LZMA/Registry.cs @@ -33,7 +33,7 @@ namespace SharpCompress.Compressor.LZMA case k_LZMA: case k_LZMA2: return new LzmaStream(info, inStreams.Single(), -1, limit); -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE case CMethodId.kAESId: return new AesDecoderStream(inStreams.Single(), info, pass, limit); #endif diff --git a/SharpCompress/IO/MarkingBinaryReader.cs b/SharpCompress/IO/MarkingBinaryReader.cs index db8ead28..f0154641 100644 --- a/SharpCompress/IO/MarkingBinaryReader.cs +++ b/SharpCompress/IO/MarkingBinaryReader.cs @@ -62,7 +62,7 @@ namespace SharpCompress.IO throw new NotImplementedException(); } -#if !SILVERLIGHT && !PORTABLE +#if !PORTABLE public override decimal ReadDecimal() { CurrentReadByteCount += 16; diff --git a/SharpCompress/SharpCompress.3.5.csproj b/SharpCompress/SharpCompress.3.5.csproj deleted file mode 100644 index 659a38e0..00000000 --- a/SharpCompress/SharpCompress.3.5.csproj +++ /dev/null @@ -1,318 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {43F219EC-21D3-4EA8-8379-151AF9580CB8} - Library - Properties - SharpCompress - SharpCompress.3.5 - v3.5 - 512 - Client - - - - - - - - - ..\..\sharpcompress\ - true - - - true - full - false - ..\bin\ - TRACE;DEBUG;THREEFIVE - prompt - 4 - true - true - - - pdbonly - true - ..\bin\ - TRACE;THREEFIVE - prompt - 4 - true - true - - - true - - - SharpCompress.pfx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SharpCompress/SharpCompress.Mono.csproj b/SharpCompress/SharpCompress.Mono.csproj deleted file mode 100644 index 2404a688..00000000 --- a/SharpCompress/SharpCompress.Mono.csproj +++ /dev/null @@ -1,230 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {51F02DE5-3A3D-4545-A309-7F4514B88A9E} - Library - Properties - SharpCompress - SharpCompress.Mono - v4.0 - 512 - - - - - - - - - - - true - full - false - ..\bin\ - TRACE;DEBUG;MONO - prompt - 4 - true - - - pdbonly - true - ..\bin\ - TRACE;MONO - prompt - 4 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SharpCompress/SharpCompress.WP7.csproj b/SharpCompress/SharpCompress.Portable.csproj similarity index 97% rename from SharpCompress/SharpCompress.WP7.csproj rename to SharpCompress/SharpCompress.Portable.csproj index ddaa5cd5..ad8c3a62 100644 --- a/SharpCompress/SharpCompress.WP7.csproj +++ b/SharpCompress/SharpCompress.Portable.csproj @@ -7,7 +7,7 @@ Library Properties SharpCompress - SharpCompress.WP7 + SharpCompress.Portable v4.0 Profile1 512 diff --git a/SharpCompress/SharpCompress.Silverlight.csproj b/SharpCompress/SharpCompress.Silverlight.csproj deleted file mode 100644 index ff9bdf90..00000000 --- a/SharpCompress/SharpCompress.Silverlight.csproj +++ /dev/null @@ -1,339 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {185ED218-A74F-4F57-85A5-30647495E615} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SharpCompress - SharpCompress.Silverlight - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - true - true - - - - - - - - - - ..\..\sharpcompress\ - true - - - - v3.5 - - - true - full - false - ..\bin\ - DEBUG;TRACE;SILVERLIGHT - true - true - prompt - 4 - true - - - pdbonly - true - ..\bin\ - TRACE;SILVERLIGHT - true - true - prompt - 4 - true - - - true - - - SharpCompress.pfx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SharpCompress/Utility.cs b/SharpCompress/Utility.cs index c3693482..a8eea8d4 100644 --- a/SharpCompress/Utility.cs +++ b/SharpCompress/Utility.cs @@ -37,7 +37,7 @@ namespace SharpCompress /// The resulting number from the shift operation public static int URShift(int number, long bits) { - return URShift(number, (int) bits); + return URShift(number, (int)bits); } /// @@ -62,7 +62,7 @@ namespace SharpCompress /// The resulting number from the shift operation public static long URShift(long number, long bits) { - return URShift(number, (int) bits); + return URShift(number, (int)bits); } /// @@ -82,7 +82,7 @@ namespace SharpCompress { throw new ArgumentException(); } - if ((fromindex < 0) || ((System.Array) array).Length < toindex) + if ((fromindex < 0) || ((System.Array)array).Length < toindex) { throw new IndexOutOfRangeException(); } @@ -183,10 +183,10 @@ namespace SharpCompress /// public static void writeIntBigEndian(byte[] array, int pos, int value) { - array[pos] = (byte) ((Utility.URShift(value, 24)) & 0xff); - array[pos + 1] = (byte) ((Utility.URShift(value, 16)) & 0xff); - array[pos + 2] = (byte) ((Utility.URShift(value, 8)) & 0xff); - array[pos + 3] = (byte) ((value) & 0xff); + array[pos] = (byte)((Utility.URShift(value, 24)) & 0xff); + array[pos + 1] = (byte)((Utility.URShift(value, 16)) & 0xff); + array[pos + 2] = (byte)((Utility.URShift(value, 8)) & 0xff); + array[pos + 3] = (byte)((value) & 0xff); } /// Write a short value into the byte array at the given position (little @@ -199,7 +199,7 @@ namespace SharpCompress /// /// the value to write /// -#if SILVERLIGHT || MONO || PORTABLE +#if PORTABLE public static void WriteLittleEndian(byte[] array, int pos, short value) { byte[] newBytes = BitConverter.GetBytes(value); @@ -210,7 +210,7 @@ namespace SharpCompress { fixed (byte* numRef = &(array[pos])) { - *((short*) numRef) = value; + *((short*)numRef) = value; } } #endif @@ -241,7 +241,7 @@ namespace SharpCompress /// /// the value to write /// -#if SILVERLIGHT || MONO || PORTABLE +#if PORTABLE public static void WriteLittleEndian(byte[] array, int pos, int value) { byte[] newBytes = BitConverter.GetBytes(value); @@ -252,7 +252,7 @@ namespace SharpCompress { fixed (byte* numRef = &(array[pos])) { - *((int*) numRef) = value; + *((int*)numRef) = value; } } #endif @@ -305,7 +305,7 @@ namespace SharpCompress public static void Skip(this Stream source, long advanceAmount) { - byte[] buffer = new byte[32*1024]; + byte[] buffer = new byte[32 * 1024]; int read = 0; int readCount = 0; do @@ -313,7 +313,7 @@ namespace SharpCompress readCount = buffer.Length; if (readCount > advanceAmount) { - readCount = (int) advanceAmount; + readCount = (int)advanceAmount; } read = source.Read(buffer, 0, readCount); if (read < 0) @@ -330,7 +330,7 @@ namespace SharpCompress public static void SkipAll(this Stream source) { - byte[] buffer = new byte[32*1024]; + byte[] buffer = new byte[32 * 1024]; do { } while (source.Read(buffer, 0, buffer.Length) == buffer.Length); @@ -350,12 +350,12 @@ namespace SharpCompress public static DateTime DosDateToDateTime(UInt16 iDate, UInt16 iTime) { - int year = iDate/512 + 1980; - int month = iDate%512/32; - int day = iDate%512%32; - int hour = iTime/2048; - int minute = iTime%2048/32; - int second = iTime%2048%32*2; + int year = iDate / 512 + 1980; + int month = iDate % 512 / 32; + int day = iDate % 512 % 32; + int hour = iTime / 2048; + int minute = iTime % 2048 / 32; + int second = iTime % 2048 % 32 * 2; if (iDate == UInt16.MaxValue || month == 0 || day == 0) { @@ -387,8 +387,8 @@ namespace SharpCompress { return 0; } - return (uint) ( - (dateTime.Value.Second/2) | (dateTime.Value.Minute << 5) | (dateTime.Value.Hour << 11) | + return (uint)( + (dateTime.Value.Second / 2) | (dateTime.Value.Minute << 5) | (dateTime.Value.Hour << 11) | (dateTime.Value.Day << 16) | (dateTime.Value.Month << 21) | ((dateTime.Value.Year - 1980) << 25)); } @@ -396,13 +396,13 @@ namespace SharpCompress public static DateTime DosDateToDateTime(UInt32 iTime) { - return DosDateToDateTime((UInt16) (iTime/65536), - (UInt16) (iTime%65536)); + return DosDateToDateTime((UInt16)(iTime / 65536), + (UInt16)(iTime % 65536)); } public static DateTime DosDateToDateTime(Int32 iTime) { - return DosDateToDateTime((UInt32) iTime); + return DosDateToDateTime((UInt32)iTime); } public static long TransferTo(this Stream source, Stream destination) @@ -467,7 +467,7 @@ namespace SharpCompress archive.EnsureEntriesLoaded(); archive.FireEntryExtractionBegin(entry); - ((IStreamListener) archive).FireFilePartExtractionBegin(entry.FilePath, entry.Size, entry.CompressedSize); + ((IStreamListener)archive).FireFilePartExtractionBegin(entry.FilePath, entry.Size, entry.CompressedSize); using (Stream s = new ListeningStream(archive, entry.OpenEntryStream())) { s.TransferTo(streamToWriteTo);