From 1661b7ec363c98420ac5b4e114e65a396fbc8410 Mon Sep 17 00:00:00 2001 From: benshoof Date: Mon, 25 Jan 2016 09:02:19 -0900 Subject: [PATCH] Added support for .NET 3.5 SharpCompress can now be compiled for .NET 3.5 by defining symbol NET35 --- SharpCompress/Archive/IWritableArchive.Extensions.cs | 2 +- SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs | 2 +- SharpCompress/EnumExtensions.cs | 6 ++++-- SharpCompress/SharpCompress.Portable.csproj | 1 + SharpCompress/SharpCompress.PortableTest.csproj | 3 ++- SharpCompress/SharpCompress.Unsigned.csproj | 3 ++- SharpCompress/SharpCompress.WindowsStore.csproj | 1 + SharpCompress/SharpCompress.csproj | 3 ++- SharpCompress/Writer/IWriter.Extensions.cs | 2 +- 9 files changed, 15 insertions(+), 8 deletions(-) diff --git a/SharpCompress/Archive/IWritableArchive.Extensions.cs b/SharpCompress/Archive/IWritableArchive.Extensions.cs index 83d45d40..2b577caa 100644 --- a/SharpCompress/Archive/IWritableArchive.Extensions.cs +++ b/SharpCompress/Archive/IWritableArchive.Extensions.cs @@ -60,7 +60,7 @@ namespace SharpCompress.Archive this IWritableArchive writableArchive, string filePath, string searchPattern = "*.*", SearchOption searchOption = SearchOption.AllDirectories) { -#if NET2 +#if NET35 foreach (var path in Directory.GetFiles(filePath, searchPattern, searchOption)) #else foreach (var path in Directory.EnumerateFiles(filePath, searchPattern, searchOption)) diff --git a/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs b/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs index 216d8652..66c9aca4 100644 --- a/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs +++ b/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs @@ -93,7 +93,7 @@ namespace SharpCompress.Common.Rar.Headers { if (!Options.HasFlag(Options.KeepStreamsOpen)) { -#if NET2 +#if NET35 reader.Close(); #else reader.Dispose(); diff --git a/SharpCompress/EnumExtensions.cs b/SharpCompress/EnumExtensions.cs index e72da2a6..a41fbaed 100644 --- a/SharpCompress/EnumExtensions.cs +++ b/SharpCompress/EnumExtensions.cs @@ -1,4 +1,5 @@ -using System; +#if NET35 +using System; namespace SharpCompress { @@ -12,4 +13,5 @@ namespace SharpCompress return (value & flagVal) == flagVal; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/SharpCompress/SharpCompress.Portable.csproj b/SharpCompress/SharpCompress.Portable.csproj index 49e43055..2f331a30 100644 --- a/SharpCompress/SharpCompress.Portable.csproj +++ b/SharpCompress/SharpCompress.Portable.csproj @@ -287,6 +287,7 @@ + diff --git a/SharpCompress/SharpCompress.PortableTest.csproj b/SharpCompress/SharpCompress.PortableTest.csproj index 71281f16..523e6901 100644 --- a/SharpCompress/SharpCompress.PortableTest.csproj +++ b/SharpCompress/SharpCompress.PortableTest.csproj @@ -129,7 +129,7 @@ - + @@ -257,6 +257,7 @@ + Code diff --git a/SharpCompress/SharpCompress.Unsigned.csproj b/SharpCompress/SharpCompress.Unsigned.csproj index bfb80856..86c4aa0f 100644 --- a/SharpCompress/SharpCompress.Unsigned.csproj +++ b/SharpCompress/SharpCompress.Unsigned.csproj @@ -131,7 +131,7 @@ - + @@ -244,6 +244,7 @@ + Code diff --git a/SharpCompress/SharpCompress.WindowsStore.csproj b/SharpCompress/SharpCompress.WindowsStore.csproj index b5c5547b..02f9e09b 100644 --- a/SharpCompress/SharpCompress.WindowsStore.csproj +++ b/SharpCompress/SharpCompress.WindowsStore.csproj @@ -273,6 +273,7 @@ + diff --git a/SharpCompress/SharpCompress.csproj b/SharpCompress/SharpCompress.csproj index fd033f1a..0fd10026 100644 --- a/SharpCompress/SharpCompress.csproj +++ b/SharpCompress/SharpCompress.csproj @@ -131,7 +131,7 @@ - + @@ -244,6 +244,7 @@ + Code diff --git a/SharpCompress/Writer/IWriter.Extensions.cs b/SharpCompress/Writer/IWriter.Extensions.cs index 6ccdbc68..75029f6f 100644 --- a/SharpCompress/Writer/IWriter.Extensions.cs +++ b/SharpCompress/Writer/IWriter.Extensions.cs @@ -35,7 +35,7 @@ namespace SharpCompress.Writer { throw new ArgumentException("Directory does not exist: " + directory); } -#if NET2 +#if NET35 foreach (var file in Directory.GetFiles(directory, searchPattern, option)) #else foreach (var file in Directory.EnumerateFiles(directory, searchPattern, option))