Skip to content

Commit

Permalink
Removed Fody so Cimbalino.Toolkit.Core PCL will only throw a few NotI…
Browse files Browse the repository at this point in the history
…mplementedException
  • Loading branch information
pedrolamas committed Mar 8, 2017
1 parent 372a817 commit 4cc946f
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
<Compile Include="Compression\CompressionLevel.cs" />
</ItemGroup>
<ItemGroup>
<None Include="FodyWeavers.xml" />
<None Include="project.json" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
Expand Down
19 changes: 14 additions & 5 deletions src/Cimbalino.Toolkit.Core (Portable)/Compression/ZlibStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#if PORTABLE
using System;
using System.IO;
using Cimbalino.Toolkit.Helpers;
#else
using System;
using System.IO;
Expand Down Expand Up @@ -57,7 +58,9 @@ public ZlibStream(Stream stream, CompressionLevel compressionLevel)
/// <param name="leaveOpen">true to leave the stream open after disposing the <see cref="ZlibStream"/> object; otherwise, false.</param>
public ZlibStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen)
{
#if !PORTABLE
#if PORTABLE
ExceptionHelper.ThrowNotSupported();
#else
_stream = stream;
_leaveOpen = leaveOpen;

Expand All @@ -73,7 +76,9 @@ public ZlibStream(Stream stream, CompressionLevel compressionLevel, bool leaveOp
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
public override void Flush()
{
#if !PORTABLE
#if PORTABLE
ExceptionHelper.ThrowNotSupported();
#else
_deflateStream.Flush();
#endif
}
Expand Down Expand Up @@ -117,7 +122,9 @@ public override void SetLength(long value)
/// <param name="buffer">An array of bytes. This method copies <paramref name="count"/> bytes from <paramref name="buffer"/> to the current stream. </param><param name="offset">The zero-based byte offset in <paramref name="buffer"/> at which to begin copying bytes to the current stream. </param><param name="count">The number of bytes to be written to the current stream. </param>
public override void Write(byte[] buffer, int offset, int count)
{
#if !PORTABLE
#if PORTABLE
ExceptionHelper.ThrowNotSupported();
#else
_deflateStream.Write(buffer, offset, count);

_adler = Adler32.Update(_adler, buffer, offset, count);
Expand Down Expand Up @@ -206,11 +213,13 @@ public override long Position
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
protected override void Dispose(bool disposing)
{
#if !PORTABLE
#if PORTABLE
ExceptionHelper.ThrowNotSupported();
#else
WriteFooter();
#endif

base.Dispose(disposing);
#endif
}

#if !PORTABLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#if PORTABLE
using System;
using System.Text;
using Cimbalino.Toolkit.Helpers;
#else
using System;
using System.Security.Cryptography;
Expand Down Expand Up @@ -57,7 +58,7 @@ public static string ToString(this byte[] input, Encoding encoding)
public static byte[] ComputeSHA1Hash(this byte[] input)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new SHA1Managed())
{
Expand All @@ -76,7 +77,7 @@ public static byte[] ComputeSHA1Hash(this byte[] input)
public static byte[] ComputeSHA1Hash(this byte[] input, int offset, int count)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new SHA1Managed())
{
Expand All @@ -93,7 +94,7 @@ public static byte[] ComputeSHA1Hash(this byte[] input, int offset, int count)
public static byte[] ComputeSHA256Hash(this byte[] input)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new SHA256Managed())
{
Expand All @@ -112,7 +113,7 @@ public static byte[] ComputeSHA256Hash(this byte[] input)
public static byte[] ComputeSHA256Hash(this byte[] input, int offset, int count)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new SHA256Managed())
{
Expand All @@ -129,7 +130,7 @@ public static byte[] ComputeSHA256Hash(this byte[] input, int offset, int count)
public static byte[] ComputeMD5Hash(this byte[] input)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new MD5Managed())
{
Expand All @@ -148,7 +149,7 @@ public static byte[] ComputeMD5Hash(this byte[] input)
public static byte[] ComputeMD5Hash(this byte[] input, int offset, int count)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new MD5Managed())
{
Expand All @@ -166,7 +167,7 @@ public static byte[] ComputeMD5Hash(this byte[] input, int offset, int count)
public static byte[] ComputeHMACSHA1Hash(this byte[] input, byte[] key)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACSHA1())
{
Expand All @@ -188,7 +189,7 @@ public static byte[] ComputeHMACSHA1Hash(this byte[] input, byte[] key)
public static byte[] ComputeHMACSHA1Hash(this byte[] input, byte[] key, int offset, int count)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACSHA1())
{
Expand All @@ -208,7 +209,7 @@ public static byte[] ComputeHMACSHA1Hash(this byte[] input, byte[] key, int offs
public static byte[] ComputeHMACSHA256Hash(this byte[] input, byte[] key)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACSHA256())
{
Expand All @@ -230,7 +231,7 @@ public static byte[] ComputeHMACSHA256Hash(this byte[] input, byte[] key)
public static byte[] ComputeHMACSHA256Hash(this byte[] input, byte[] key, int offset, int count)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACSHA256())
{
Expand All @@ -250,7 +251,7 @@ public static byte[] ComputeHMACSHA256Hash(this byte[] input, byte[] key, int of
public static byte[] ComputeHMACMD5Hash(this byte[] input, byte[] key)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACMD5())
{
Expand All @@ -272,7 +273,7 @@ public static byte[] ComputeHMACMD5Hash(this byte[] input, byte[] key)
public static byte[] ComputeHMACMD5Hash(this byte[] input, byte[] key, int offset, int count)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACMD5())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#if PORTABLE
using System.IO;
using System.Threading.Tasks;
using Cimbalino.Toolkit.Helpers;
#else
using System.IO;
using System.Security.Cryptography;
Expand Down Expand Up @@ -51,7 +52,7 @@ public static byte[] ToArray(this Stream input)
public static byte[] ComputeSHA1Hash(this Stream input)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new SHA1Managed())
{
Expand All @@ -68,7 +69,7 @@ public static byte[] ComputeSHA1Hash(this Stream input)
public static byte[] ComputeSHA256Hash(this Stream input)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new SHA256Managed())
{
Expand All @@ -85,7 +86,7 @@ public static byte[] ComputeSHA256Hash(this Stream input)
public static byte[] ComputeMD5Hash(this Stream input)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new MD5Managed())
{
Expand All @@ -103,7 +104,7 @@ public static byte[] ComputeMD5Hash(this Stream input)
public static byte[] ComputeHMACSHA1Hash(this Stream input, byte[] key)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACSHA1())
{
Expand All @@ -123,7 +124,7 @@ public static byte[] ComputeHMACSHA1Hash(this Stream input, byte[] key)
public static byte[] ComputeHMACSHA256Hash(this Stream input, byte[] key)
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<byte[]>();
#else
using (var hash = new HMACSHA256())
{
Expand Down
4 changes: 0 additions & 4 deletions src/Cimbalino.Toolkit.Core (Portable)/FodyWeavers.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Cimbalino.Toolkit.Helpers;
#elif WINDOWS_PHONE || WINDOWS_PHONE_81
using System;
using System.IO;
Expand Down Expand Up @@ -50,7 +51,7 @@ public string FileName
get
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<string>();
#else
return _storageFile.Name;
#endif
Expand All @@ -66,7 +67,7 @@ public string FileType
get
{
#if PORTABLE
return null;
return ExceptionHelper.ThrowNotSupported<string>();
#else
return _storageFile.FileType;
#endif
Expand All @@ -91,7 +92,7 @@ public FilePickerServiceFileResult(StorageFile storageFile)
public Task<Stream> OpenStreamForReadAsync()
{
#if PORTABLE
return Task.FromResult((Stream)null);
return ExceptionHelper.ThrowNotSupported<Task<Stream>>();
#else
return _storageFile.OpenStreamForReadAsync();
#endif
Expand Down
1 change: 0 additions & 1 deletion src/Cimbalino.Toolkit.Core (Portable)/project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"dependencies": {
"Fody": "1.30.0-beta01",
"StyleCop.Analyzers": "1.0.0"
},
"frameworks": {
Expand Down
21 changes: 0 additions & 21 deletions src/Cimbalino.Toolkit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cimbalino.Toolkit.Core (Portable)", "Cimbalino.Toolkit.Core (Portable)\Cimbalino.Toolkit.Core (Portable).csproj", "{DF37406D-0261-4F84-9576-35387A3DE8C5}"
ProjectSection(ProjectDependencies) = postProject
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43} = {FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cimbalino.Toolkit (WP8)", "Cimbalino.Toolkit (WP8)\Cimbalino.Toolkit (WP8).csproj", "{1C6E97D3-7D3F-486F-AC01-869210F657C5}"
EndProject
Expand All @@ -24,8 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cimbalino.Toolkit (UWP)", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cimbalino.Toolkit.Core (UWP)", "Cimbalino.Toolkit.Core (UWP)\Cimbalino.Toolkit.Core (UWP).csproj", "{D79208C1-8C83-4D03-BBD8-208B52137627}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weavers", "Weavers\Weavers.csproj", "{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cimbalino.Toolkit.Controls (UWP)", "Cimbalino.Toolkit.Controls (UWP)\Cimbalino.Toolkit.Controls (UWP).csproj", "{2F16C309-AC5D-4828-A30F-0C858315FF85}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cimbalino.Toolkit.Core (WP81)", "Cimbalino.Toolkit.Core (WP81)\Cimbalino.Toolkit.Core (WP81).csproj", "{F573D090-BABC-49BF-B072-DC189196F7D4}"
Expand Down Expand Up @@ -174,22 +169,6 @@ Global
{D79208C1-8C83-4D03-BBD8-208B52137627}.Release|x64.Build.0 = Release|x64
{D79208C1-8C83-4D03-BBD8-208B52137627}.Release|x86.ActiveCfg = Release|x86
{D79208C1-8C83-4D03-BBD8-208B52137627}.Release|x86.Build.0 = Release|x86
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|ARM.ActiveCfg = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|ARM.Build.0 = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|x64.ActiveCfg = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|x64.Build.0 = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|x86.ActiveCfg = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Debug|x86.Build.0 = Debug|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|Any CPU.Build.0 = Release|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|ARM.ActiveCfg = Release|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|ARM.Build.0 = Release|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|x64.ActiveCfg = Release|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|x64.Build.0 = Release|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|x86.ActiveCfg = Release|Any CPU
{FE4155A2-8D09-49CB-843B-AE5ED2EA4C43}.Release|x86.Build.0 = Release|Any CPU
{2F16C309-AC5D-4828-A30F-0C858315FF85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F16C309-AC5D-4828-A30F-0C858315FF85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F16C309-AC5D-4828-A30F-0C858315FF85}.Debug|ARM.ActiveCfg = Debug|ARM
Expand Down

0 comments on commit 4cc946f

Please sign in to comment.