summary refs log tree commit diff
path: root/crypto/src/util
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@gmail.com>2022-06-21 23:10:22 +0700
committerPeter Dettman <peter.dettman@gmail.com>2022-06-21 23:10:22 +0700
commit454f5e65e84d49a34d7839343b584a21b34b7cd9 (patch)
tree18a13466d3a49a45daec6d982720409f6fd8bfd3 /crypto/src/util
parentRemove ApplicationSpecific classes (diff)
downloadBouncyCastle.NET-ed25519-454f5e65e84d49a34d7839343b584a21b34b7cd9.tar.xz
Cleanup old build systems
Diffstat (limited to 'crypto/src/util')
-rw-r--r--crypto/src/util/Enums.cs25
-rw-r--r--crypto/src/util/Platform.cs33
-rw-r--r--crypto/src/util/Strings.cs6
-rw-r--r--crypto/src/util/io/StreamOverflowException.cs2
-rw-r--r--crypto/src/util/io/pem/PemGenerationException.cs2
5 files changed, 9 insertions, 59 deletions
diff --git a/crypto/src/util/Enums.cs b/crypto/src/util/Enums.cs
index 9e908c4c0..c369511d4 100644
--- a/crypto/src/util/Enums.cs
+++ b/crypto/src/util/Enums.cs
@@ -1,7 +1,6 @@
 using System;
-using System.Text;
 
-#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE
+#if PORTABLE
 using System.Collections;
 using System.Reflection;
 #endif
@@ -23,15 +22,7 @@ namespace Org.BouncyCastle.Utilities
                 s = s.Replace('-', '_');
                 s = s.Replace('/', '_');
 
-#if NETCF_1_0
-                FieldInfo field = enumType.GetField(s, BindingFlags.Static | BindingFlags.Public);
-                if (field != null)
-                {
-                    return (Enum)field.GetValue(null);
-                }
-#else
                 return (Enum)Enum.Parse(enumType, s, false);
-#endif		
             }
 
             throw new ArgumentException();
@@ -42,21 +33,7 @@ namespace Org.BouncyCastle.Utilities
             if (!IsEnumType(enumType))
                 throw new ArgumentException("Not an enumeration type", "enumType");
 
-#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT
-            IList result = Platform.CreateArrayList();
-            FieldInfo[] fields = enumType.GetFields(BindingFlags.Static | BindingFlags.Public);
-            foreach (FieldInfo field in fields)
-            {
-                // Note: Argument to GetValue() ignored since the fields are static,
-                //     but Silverlight for Windows Phone throws exception if we pass null
-                result.Add(field.GetValue(enumType));
-            }
-            object[] arr = new object[result.Count];
-            result.CopyTo(arr, 0);
-            return arr;
-#else
             return Enum.GetValues(enumType);
-#endif
         }
 
         internal static Enum GetArbitraryValue(System.Type enumType)
diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs
index 547cef3fa..b0cd5dcb7 100644
--- a/crypto/src/util/Platform.cs
+++ b/crypto/src/util/Platform.cs
@@ -3,7 +3,7 @@ using System.Globalization;
 using System.IO;
 using System.Text;
 
-#if SILVERLIGHT || PORTABLE
+#if PORTABLE
 using System.Collections.Generic;
 #else
 using System.Collections;
@@ -15,22 +15,10 @@ namespace Org.BouncyCastle.Utilities
     {
         private static readonly CompareInfo InvariantCompareInfo = CultureInfo.InvariantCulture.CompareInfo;
 
-#if NETCF_1_0 || NETCF_2_0
-        private static string GetNewLine()
-        {
-            MemoryStream buf = new MemoryStream();
-            StreamWriter w = new StreamWriter(buf, Encoding.UTF8);
-            w.WriteLine();
-            Dispose(w);
-            byte[] bs = buf.ToArray();
-            return Encoding.UTF8.GetString(bs, 0, bs.Length);
-        }
-#else
         private static string GetNewLine()
         {
             return Environment.NewLine;
         }
-#endif
 
         internal static bool EqualsIgnoreCase(string a, string b)
         {
@@ -41,7 +29,7 @@ namespace Org.BouncyCastle.Utilities
 #endif
         }
 
-#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || (PORTABLE && !DOTNET)
+#if PORTABLE && !DOTNET
         internal static string GetEnvironmentVariable(
             string variable)
         {
@@ -64,28 +52,13 @@ namespace Org.BouncyCastle.Utilities
         }
 #endif
 
-#if NETCF_1_0
-        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));
-        }
-#else
         internal static Exception CreateNotImplementedException(
             string message)
         {
             return new NotImplementedException(message);
         }
-#endif
 
-#if SILVERLIGHT || PORTABLE
+#if PORTABLE
         internal static System.Collections.IList CreateArrayList()
         {
             return new List<object>();
diff --git a/crypto/src/util/Strings.cs b/crypto/src/util/Strings.cs
index 73a15ea73..83d1f13fb 100644
--- a/crypto/src/util/Strings.cs
+++ b/crypto/src/util/Strings.cs
@@ -77,7 +77,7 @@ namespace Org.BouncyCastle.Utilities
         public static string FromAsciiByteArray(
             byte[] bytes)
         {
-#if SILVERLIGHT || PORTABLE
+#if PORTABLE
             // TODO Check for non-ASCII bytes in input?
             return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
 #else
@@ -88,7 +88,7 @@ namespace Org.BouncyCastle.Utilities
         public static byte[] ToAsciiByteArray(
             char[] cs)
         {
-#if SILVERLIGHT || PORTABLE
+#if PORTABLE
             // TODO Check for non-ASCII characters in input?
             return Encoding.UTF8.GetBytes(cs);
 #else
@@ -99,7 +99,7 @@ namespace Org.BouncyCastle.Utilities
         public static byte[] ToAsciiByteArray(
             string s)
         {
-#if SILVERLIGHT || PORTABLE
+#if PORTABLE
             // TODO Check for non-ASCII characters in input?
             return Encoding.UTF8.GetBytes(s);
 #else
diff --git a/crypto/src/util/io/StreamOverflowException.cs b/crypto/src/util/io/StreamOverflowException.cs
index 36d21e23e..7e100e7b5 100644
--- a/crypto/src/util/io/StreamOverflowException.cs
+++ b/crypto/src/util/io/StreamOverflowException.cs
@@ -3,7 +3,7 @@ using System.IO;
 
 namespace Org.BouncyCastle.Utilities.IO
 {
-#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
+#if !PORTABLE
     [Serializable]
 #endif
     public class StreamOverflowException
diff --git a/crypto/src/util/io/pem/PemGenerationException.cs b/crypto/src/util/io/pem/PemGenerationException.cs
index 6b3958577..a49dda0e7 100644
--- a/crypto/src/util/io/pem/PemGenerationException.cs
+++ b/crypto/src/util/io/pem/PemGenerationException.cs
@@ -2,7 +2,7 @@ using System;
 
 namespace Org.BouncyCastle.Utilities.IO.Pem
 {
-#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
+#if !PORTABLE
     [Serializable]
 #endif
     public class PemGenerationException