summary refs log tree commit diff
path: root/crypto/src/util/Platform.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-01-21 14:51:32 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-01-21 14:51:32 +0700
commit31525ff4a76773fa0cc85d4abcee7d5418cbd984 (patch)
tree0c3fa4c3b580f68c58f1476502fdaa1d25ec44f4 /crypto/src/util/Platform.cs
parentBring Fp field element code mostly up-to-date with Java version (diff)
downloadBouncyCastle.NET-ed25519-31525ff4a76773fa0cc85d4abcee7d5418cbd984.tar.xz
Make static utility classes abstract instead of sealed
Add Arrays.GetHashCode for int[]
Formatting
Diffstat (limited to 'crypto/src/util/Platform.cs')
-rw-r--r--crypto/src/util/Platform.cs96
1 files changed, 46 insertions, 50 deletions
diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs
index cdfba789e..99d3982ea 100644
--- a/crypto/src/util/Platform.cs
+++ b/crypto/src/util/Platform.cs
@@ -11,22 +11,18 @@ using System.Collections;
 
 namespace Org.BouncyCastle.Utilities
 {
-	internal sealed class Platform
-	{
-		private Platform()
-		{
-		}
-
+    internal abstract class Platform
+    {
 #if NETCF_1_0 || NETCF_2_0
-		private static string GetNewLine()
-		{
-			MemoryStream buf = new MemoryStream();
-			StreamWriter w = new StreamWriter(buf, Encoding.UTF8);
-			w.WriteLine();
-			w.Close();
-			byte[] bs = buf.ToArray();
+        private static string GetNewLine()
+        {
+            MemoryStream buf = new MemoryStream();
+            StreamWriter w = new StreamWriter(buf, Encoding.UTF8);
+            w.WriteLine();
+            w.Close();
+            byte[] bs = buf.ToArray();
             return Encoding.UTF8.GetString(bs, 0, bs.Length);
-		}
+        }
 #else
         private static string GetNewLine()
         {
@@ -44,47 +40,47 @@ namespace Org.BouncyCastle.Utilities
         }
 
 #if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT
-		internal static string GetEnvironmentVariable(
-			string variable)
-		{
-			return null;
-		}
+        internal static string GetEnvironmentVariable(
+            string variable)
+        {
+            return null;
+        }
 #else
-		internal static string GetEnvironmentVariable(
-			string variable)
-		{
-			try
-			{
-				return Environment.GetEnvironmentVariable(variable);
-			}
-			catch (System.Security.SecurityException)
-			{
-				// We don't have the required permission to read this environment variable,
-				// which is fine, just act as if it's not set
-				return null;
-			}
-		}
+        internal static string GetEnvironmentVariable(
+            string variable)
+        {
+            try
+            {
+                return Environment.GetEnvironmentVariable(variable);
+            }
+            catch (System.Security.SecurityException)
+            {
+                // We don't have the required permission to read this environment variable,
+                // which is fine, just act as if it's not set
+                return null;
+            }
+        }
 #endif
 
 #if NETCF_1_0
-		internal static Exception CreateNotImplementedException(
-			string message)
-		{
-			return new Exception("Not implemented: " + message);
-		}
+        internal static Exception CreateNotImplementedException(
+            string message)
+        {
+            return new Exception("Not implemented: " + message);
+        }
 
-		internal static bool Equals(
-			object	a,
-			object	b)
-		{
-			return a == b || (a != null && b != null && a.Equals(b));
-		}
+        internal static bool Equals(
+            object	a,
+            object	b)
+        {
+            return a == b || (a != null && b != null && a.Equals(b));
+        }
 #else
-		internal static Exception CreateNotImplementedException(
-			string message)
-		{
-			return new NotImplementedException(message);
-		}
+        internal static Exception CreateNotImplementedException(
+            string message)
+        {
+            return new NotImplementedException(message);
+        }
 #endif
 
 #if SILVERLIGHT
@@ -178,5 +174,5 @@ namespace Org.BouncyCastle.Utilities
         }
 
         internal static readonly string NewLine = GetNewLine();
-	}
+    }
 }