diff options
Diffstat (limited to 'crypto/src/util/Platform.cs')
-rw-r--r-- | crypto/src/util/Platform.cs | 96 |
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(); - } + } } |