From 1473bb693fcce9fad4093d3573b527d4691d11d6 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Tue, 13 Mar 2018 17:56:11 -0700 Subject: [PATCH] Remove PCL support --- Ooui.Forms/Forms.cs | 29 ------------------ Ooui.Forms/Ooui.Forms.csproj | 2 +- Ooui.Forms/PageExtensions.cs | 2 -- Ooui.Forms/Renderers/ImageRenderer.cs | 8 ----- Ooui.Forms/ResourcesProvider.cs | 9 ------ Ooui/Ooui.csproj | 6 +--- Ooui/Platform.cs | 10 ------- Ooui/Session.cs | 8 ----- Ooui/Style.cs | 4 --- Ooui/UI.cs | 4 --- Ooui/Utilities.cs | 43 --------------------------- Ooui/WebSocketSession.cs | 6 +--- 12 files changed, 3 insertions(+), 128 deletions(-) diff --git a/Ooui.Forms/Forms.cs b/Ooui.Forms/Forms.cs index e8e22e9..235927e 100644 --- a/Ooui.Forms/Forms.cs +++ b/Ooui.Forms/Forms.cs @@ -64,11 +64,7 @@ namespace Xamarin.Forms public Assembly[] GetAssemblies () { -#if PCL - return new[] { typeof (Xamarin.Forms.View).GetTypeInfo ().Assembly, typeof (Forms.OouiPlatformServices).GetTypeInfo ().Assembly }; -#else return AppDomain.CurrentDomain.GetAssemblies (); -#endif } public string GetMD5Hash (string input) @@ -144,31 +140,6 @@ namespace Xamarin.Forms } } -#if PCL - - public delegate void TimerCallback(object state); - - public sealed class Timer : CancellationTokenSource, IDisposable - { - public Timer (TimerCallback callback, object state, int dueTime, int period) - { - Task.Run (async () => { - await Task.Delay (dueTime).ConfigureAwait (false); - if (!IsCancellationRequested) - callback (state); - while (!IsCancellationRequested) { - await Task.Delay (period).ConfigureAwait (false); - if (!IsCancellationRequested) - callback (state); - } - }); - } - - public new void Dispose() { base.Cancel(); } - } - -#endif - public void QuitApplication() { } diff --git a/Ooui.Forms/Ooui.Forms.csproj b/Ooui.Forms/Ooui.Forms.csproj index b439ba6..9552095 100644 --- a/Ooui.Forms/Ooui.Forms.csproj +++ b/Ooui.Forms/Ooui.Forms.csproj @@ -9,7 +9,7 @@ https://github.com/praeclarum/Ooui https://github.com/praeclarum/Ooui/blob/master/LICENSE https://github.com/praeclarum/Ooui.git - netstandard2.0;netstandard1.0 + netstandard2.0 true diff --git a/Ooui.Forms/PageExtensions.cs b/Ooui.Forms/PageExtensions.cs index b2174cb..4ffe01d 100644 --- a/Ooui.Forms/PageExtensions.cs +++ b/Ooui.Forms/PageExtensions.cs @@ -5,7 +5,6 @@ namespace Xamarin.Forms { public static class PageExtensions { -#if !PCL public static void Publish (this Xamarin.Forms.Page page, string path) { Ooui.UI.Publish (path, () => page.CreateElement ()); @@ -16,7 +15,6 @@ namespace Xamarin.Forms var lazyPage = new Lazy ((() => page.CreateElement ()), true); Ooui.UI.Publish (path, () => lazyPage.Value); } -#endif public static Ooui.Element GetOouiElement (this Xamarin.Forms.Page page) { diff --git a/Ooui.Forms/Renderers/ImageRenderer.cs b/Ooui.Forms/Renderers/ImageRenderer.cs index 7b429bc..30e6458 100644 --- a/Ooui.Forms/Renderers/ImageRenderer.cs +++ b/Ooui.Forms/Renderers/ImageRenderer.cs @@ -142,9 +142,6 @@ namespace Ooui.Forms.Renderers #pragma warning disable 1998 public async Task LoadImageAsync (ImageSource imagesource, CancellationToken cancelationToken = default (CancellationToken), float scale = 1f) { -#if PCL - return null; -#else string image = null; var filesource = imagesource as FileImageSource; var file = filesource?.File; @@ -159,7 +156,6 @@ namespace Ooui.Forms.Renderers } } return image; -#endif } } @@ -167,9 +163,6 @@ namespace Ooui.Forms.Renderers { public async Task LoadImageAsync (ImageSource imagesource, CancellationToken cancelationToken = default (CancellationToken), float scale = 1f) { -#if PCL - return null; -#else string image = null; var streamsource = imagesource as StreamImageSource; if (streamsource?.Stream != null) { @@ -196,7 +189,6 @@ namespace Ooui.Forms.Renderers System.Diagnostics.Debug.WriteLine ("Could not load image: {0}", streamsource); } return image; -#endif } } diff --git a/Ooui.Forms/ResourcesProvider.cs b/Ooui.Forms/ResourcesProvider.cs index c71be52..c0c05a3 100644 --- a/Ooui.Forms/ResourcesProvider.cs +++ b/Ooui.Forms/ResourcesProvider.cs @@ -40,12 +40,3 @@ namespace Ooui.Forms } } } - -#if PCL -namespace System.Collections.Concurrent -{ - class ConcurrentDictionary : Dictionary - { - } -} -#endif diff --git a/Ooui/Ooui.csproj b/Ooui/Ooui.csproj index 5dcf5cd..5305768 100644 --- a/Ooui/Ooui.csproj +++ b/Ooui/Ooui.csproj @@ -8,11 +8,7 @@ https://github.com/praeclarum/Ooui https://github.com/praeclarum/Ooui/blob/master/LICENSE https://github.com/praeclarum/Ooui.git - netstandard2.0;netstandard1.0 - - - - PCL + netstandard2.0 diff --git a/Ooui/Platform.cs b/Ooui/Platform.cs index 9884253..cab8313 100644 --- a/Ooui/Platform.cs +++ b/Ooui/Platform.cs @@ -7,14 +7,6 @@ namespace Ooui { static class Platform { -#if PCL - - public static void OpenBrowser (string url, object presenter) - { - } - -#else - static readonly Assembly iosAssembly; static readonly Type iosUIViewControllerType; static readonly Type iosUIApplicationType; @@ -154,7 +146,5 @@ namespace Ooui Process.Start (new ProcessStartInfo (url) { UseShellExecute = true }); } } - -#endif } } diff --git a/Ooui/Session.cs b/Ooui/Session.cs index 2b8570e..07a1b0b 100644 --- a/Ooui/Session.cs +++ b/Ooui/Session.cs @@ -82,22 +82,14 @@ namespace Ooui protected void Error (string message, Exception ex) { -#if PCL - System.Diagnostics.Debug.WriteLine (string.Format ("{0}: {1}", message, ex)); -#else Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine ("{0}: {1}", message, ex); Console.ResetColor (); -#endif } protected void Info (string message) { -#if PCL - System.Diagnostics.Debug.WriteLine (message); -#else Console.WriteLine (message); -#endif } } } diff --git a/Ooui/Style.cs b/Ooui/Style.cs index c35f499..13e11b5 100644 --- a/Ooui/Style.cs +++ b/Ooui/Style.cs @@ -420,10 +420,8 @@ namespace Ooui if (val is float f) return f.ToString (System.Globalization.CultureInfo.InvariantCulture) + units; -#if !PCL if (val is IConvertible c) return c.ToString (System.Globalization.CultureInfo.InvariantCulture) + units; -#endif return val.ToString (); } @@ -449,10 +447,8 @@ namespace Ooui if (v is float f) return f; -#if !PCL if (v is IConvertible c) return c.ToDouble (System.Globalization.CultureInfo.InvariantCulture); -#endif return 0; } diff --git a/Ooui/UI.cs b/Ooui/UI.cs index fe8b5c9..a66ff59 100644 --- a/Ooui/UI.cs +++ b/Ooui/UI.cs @@ -14,8 +14,6 @@ namespace Ooui { public const int MaxFps = 30; -#if !PCL - static readonly ManualResetEvent started = new ManualResetEvent (false); static CancellationTokenSource serverCts; @@ -591,8 +589,6 @@ namespace Ooui Console.ResetColor (); } -#endif - static readonly Dictionary globalElementSessions = new Dictionary (); [Preserve] diff --git a/Ooui/Utilities.cs b/Ooui/Utilities.cs index a850099..af30793 100644 --- a/Ooui/Utilities.cs +++ b/Ooui/Utilities.cs @@ -5,47 +5,6 @@ namespace Ooui { public static class Utilities { -#if PCL - - static readonly uint[] crcTable; - - static Utilities () - { - uint p = 0x04C11DB7; - crcTable = new uint[256]; - for (uint c = 0; c <= 0xFF; c++) { - crcTable[c] = CrcReflect (c, 8) << 24; - for (uint i = 0; i < 8; i++) { - crcTable[c] = (crcTable[c] << 1) ^ (((crcTable[c] & (1u << 31)) != 0) ? p : 0); - } - crcTable[c] = CrcReflect (crcTable[c], 32); - } - } - - static uint CrcReflect (uint r, byte c) - { - uint v = 0; - for (int i = 1; i < (c + 1); i++) { - if ((r & 1) != 0) { - v |= (1u << (c - i)); - } - r >>= 1; - } - return v; - } - - public static string Hash (byte[] bytes) - { - uint crc = 0xffffffffu; - for (var i = 0; i < bytes.Length; i++) { - crc = (crc >> 8) ^ crcTable[(crc & 0xff) ^ bytes[i]]; - } - crc ^= 0xffffffffu; - return crc.ToString ("x8"); - } - -#else - [ThreadStatic] static System.Security.Cryptography.SHA256 sha256; @@ -63,7 +22,5 @@ namespace Ooui } return sBuilder.ToString (); } - -#endif } } diff --git a/Ooui/WebSocketSession.cs b/Ooui/WebSocketSession.cs index 3f8e3be..7dcb27c 100644 --- a/Ooui/WebSocketSession.cs +++ b/Ooui/WebSocketSession.cs @@ -1,6 +1,4 @@ -#if !PCL - -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -201,5 +199,3 @@ namespace Ooui } } } - -#endif