Remove PCL support

This commit is contained in:
Frank A. Krueger 2018-03-13 17:56:11 -07:00
parent 9733254d68
commit 1473bb693f
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
12 changed files with 3 additions and 128 deletions

View File

@ -64,11 +64,7 @@ namespace Xamarin.Forms
public Assembly[] GetAssemblies () public Assembly[] GetAssemblies ()
{ {
#if PCL
return new[] { typeof (Xamarin.Forms.View).GetTypeInfo ().Assembly, typeof (Forms.OouiPlatformServices).GetTypeInfo ().Assembly };
#else
return AppDomain.CurrentDomain.GetAssemblies (); return AppDomain.CurrentDomain.GetAssemblies ();
#endif
} }
public string GetMD5Hash (string input) 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() public void QuitApplication()
{ {
} }

View File

@ -9,7 +9,7 @@
<PackageProjectUrl>https://github.com/praeclarum/Ooui</PackageProjectUrl> <PackageProjectUrl>https://github.com/praeclarum/Ooui</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/praeclarum/Ooui/blob/master/LICENSE</PackageLicenseUrl> <PackageLicenseUrl>https://github.com/praeclarum/Ooui/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/praeclarum/Ooui.git</RepositoryUrl> <RepositoryUrl>https://github.com/praeclarum/Ooui.git</RepositoryUrl>
<TargetFrameworks>netstandard2.0;netstandard1.0</TargetFrameworks> <TargetFrameworks>netstandard2.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>

View File

@ -5,7 +5,6 @@ namespace Xamarin.Forms
{ {
public static class PageExtensions public static class PageExtensions
{ {
#if !PCL
public static void Publish (this Xamarin.Forms.Page page, string path) public static void Publish (this Xamarin.Forms.Page page, string path)
{ {
Ooui.UI.Publish (path, () => page.CreateElement ()); Ooui.UI.Publish (path, () => page.CreateElement ());
@ -16,7 +15,6 @@ namespace Xamarin.Forms
var lazyPage = new Lazy<Ooui.Element> ((() => page.CreateElement ()), true); var lazyPage = new Lazy<Ooui.Element> ((() => page.CreateElement ()), true);
Ooui.UI.Publish (path, () => lazyPage.Value); Ooui.UI.Publish (path, () => lazyPage.Value);
} }
#endif
public static Ooui.Element GetOouiElement (this Xamarin.Forms.Page page) public static Ooui.Element GetOouiElement (this Xamarin.Forms.Page page)
{ {

View File

@ -142,9 +142,6 @@ namespace Ooui.Forms.Renderers
#pragma warning disable 1998 #pragma warning disable 1998
public async Task<string> LoadImageAsync (ImageSource imagesource, CancellationToken cancelationToken = default (CancellationToken), float scale = 1f) public async Task<string> LoadImageAsync (ImageSource imagesource, CancellationToken cancelationToken = default (CancellationToken), float scale = 1f)
{ {
#if PCL
return null;
#else
string image = null; string image = null;
var filesource = imagesource as FileImageSource; var filesource = imagesource as FileImageSource;
var file = filesource?.File; var file = filesource?.File;
@ -159,7 +156,6 @@ namespace Ooui.Forms.Renderers
} }
} }
return image; return image;
#endif
} }
} }
@ -167,9 +163,6 @@ namespace Ooui.Forms.Renderers
{ {
public async Task<string> LoadImageAsync (ImageSource imagesource, CancellationToken cancelationToken = default (CancellationToken), float scale = 1f) public async Task<string> LoadImageAsync (ImageSource imagesource, CancellationToken cancelationToken = default (CancellationToken), float scale = 1f)
{ {
#if PCL
return null;
#else
string image = null; string image = null;
var streamsource = imagesource as StreamImageSource; var streamsource = imagesource as StreamImageSource;
if (streamsource?.Stream != null) { if (streamsource?.Stream != null) {
@ -196,7 +189,6 @@ namespace Ooui.Forms.Renderers
System.Diagnostics.Debug.WriteLine ("Could not load image: {0}", streamsource); System.Diagnostics.Debug.WriteLine ("Could not load image: {0}", streamsource);
} }
return image; return image;
#endif
} }
} }

View File

@ -40,12 +40,3 @@ namespace Ooui.Forms
} }
} }
} }
#if PCL
namespace System.Collections.Concurrent
{
class ConcurrentDictionary<K, V> : Dictionary<K, V>
{
}
}
#endif

View File

@ -8,11 +8,7 @@
<PackageProjectUrl>https://github.com/praeclarum/Ooui</PackageProjectUrl> <PackageProjectUrl>https://github.com/praeclarum/Ooui</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/praeclarum/Ooui/blob/master/LICENSE</PackageLicenseUrl> <PackageLicenseUrl>https://github.com/praeclarum/Ooui/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/praeclarum/Ooui.git</RepositoryUrl> <RepositoryUrl>https://github.com/praeclarum/Ooui.git</RepositoryUrl>
<TargetFrameworks>netstandard2.0;netstandard1.0</TargetFrameworks> <TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" $(TargetFramework) == 'netstandard1.0' ">
<DefineConstants>PCL</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -7,14 +7,6 @@ namespace Ooui
{ {
static class Platform static class Platform
{ {
#if PCL
public static void OpenBrowser (string url, object presenter)
{
}
#else
static readonly Assembly iosAssembly; static readonly Assembly iosAssembly;
static readonly Type iosUIViewControllerType; static readonly Type iosUIViewControllerType;
static readonly Type iosUIApplicationType; static readonly Type iosUIApplicationType;
@ -154,7 +146,5 @@ namespace Ooui
Process.Start (new ProcessStartInfo (url) { UseShellExecute = true }); Process.Start (new ProcessStartInfo (url) { UseShellExecute = true });
} }
} }
#endif
} }
} }

View File

@ -82,22 +82,14 @@ namespace Ooui
protected void Error (string message, Exception ex) 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.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ("{0}: {1}", message, ex); Console.WriteLine ("{0}: {1}", message, ex);
Console.ResetColor (); Console.ResetColor ();
#endif
} }
protected void Info (string message) protected void Info (string message)
{ {
#if PCL
System.Diagnostics.Debug.WriteLine (message);
#else
Console.WriteLine (message); Console.WriteLine (message);
#endif
} }
} }
} }

View File

@ -420,10 +420,8 @@ namespace Ooui
if (val is float f) if (val is float f)
return f.ToString (System.Globalization.CultureInfo.InvariantCulture) + units; return f.ToString (System.Globalization.CultureInfo.InvariantCulture) + units;
#if !PCL
if (val is IConvertible c) if (val is IConvertible c)
return c.ToString (System.Globalization.CultureInfo.InvariantCulture) + units; return c.ToString (System.Globalization.CultureInfo.InvariantCulture) + units;
#endif
return val.ToString (); return val.ToString ();
} }
@ -449,10 +447,8 @@ namespace Ooui
if (v is float f) if (v is float f)
return f; return f;
#if !PCL
if (v is IConvertible c) if (v is IConvertible c)
return c.ToDouble (System.Globalization.CultureInfo.InvariantCulture); return c.ToDouble (System.Globalization.CultureInfo.InvariantCulture);
#endif
return 0; return 0;
} }

View File

@ -14,8 +14,6 @@ namespace Ooui
{ {
public const int MaxFps = 30; public const int MaxFps = 30;
#if !PCL
static readonly ManualResetEvent started = new ManualResetEvent (false); static readonly ManualResetEvent started = new ManualResetEvent (false);
static CancellationTokenSource serverCts; static CancellationTokenSource serverCts;
@ -591,8 +589,6 @@ namespace Ooui
Console.ResetColor (); Console.ResetColor ();
} }
#endif
static readonly Dictionary<string, WebAssemblySession> globalElementSessions = new Dictionary<string, WebAssemblySession> (); static readonly Dictionary<string, WebAssemblySession> globalElementSessions = new Dictionary<string, WebAssemblySession> ();
[Preserve] [Preserve]

View File

@ -5,47 +5,6 @@ namespace Ooui
{ {
public static class Utilities 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] [ThreadStatic]
static System.Security.Cryptography.SHA256 sha256; static System.Security.Cryptography.SHA256 sha256;
@ -63,7 +22,5 @@ namespace Ooui
} }
return sBuilder.ToString (); return sBuilder.ToString ();
} }
#endif
} }
} }

View File

@ -1,6 +1,4 @@
#if !PCL using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -201,5 +199,3 @@ namespace Ooui
} }
} }
} }
#endif