From cce678e8a31066f189281bdc073b965d2b18a3fb Mon Sep 17 00:00:00 2001 From: Mohammad Rahhal Date: Sat, 28 Mar 2015 15:39:50 +0300 Subject: [PATCH 01/92] Just use the already parsed int --- Splat/Android/Bitmaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Splat/Android/Bitmaps.cs b/Splat/Android/Bitmaps.cs index 0c191e189..6a5bbf695 100644 --- a/Splat/Android/Bitmaps.cs +++ b/Splat/Android/Bitmaps.cs @@ -59,7 +59,7 @@ public Task LoadFromResource(string source, float? desiredWidth, float? var id = default(int); if (Int32.TryParse(source, out id)) { - return Task.Run(() => (IBitmap)new DrawableBitmap(res.GetDrawable(Int32.Parse(source)))); + return Task.Run(() => (IBitmap)new DrawableBitmap(res.GetDrawable(id))); } if (drawableList.ContainsKey(source)) { From 8c2cda553bb474d5503f779a3552a61dd61b794c Mon Sep 17 00:00:00 2001 From: Kent Boogaart Date: Thu, 14 May 2015 16:48:30 +0930 Subject: [PATCH 02/92] Fixes #104. --- Splat/Logging.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Splat/Logging.cs b/Splat/Logging.cs index caaa5ec64..aa5f401ba 100644 --- a/Splat/Logging.cs +++ b/Splat/Logging.cs @@ -117,7 +117,6 @@ public DefaultLogManager(IDependencyResolver dependencyResolver = null) static readonly IFullLogger nullLogger = new WrappingFullLogger(new NullLogger(), typeof(MemoizingMRUCache)); public IFullLogger GetLogger(Type type) { - if (LogHost.suppressLogging) return nullLogger; if (type == typeof(MemoizingMRUCache)) return nullLogger; lock (loggerCache) { @@ -180,17 +179,12 @@ public interface IEnableLogger { } public static class LogHost { - static internal bool suppressLogging = false; - static readonly IFullLogger nullLogger = new WrappingFullLogger(new NullLogger(), typeof(string)); - /// /// Use this logger inside miscellaneous static methods where creating /// a class-specific logger isn't really worth it. /// public static IFullLogger Default { get { - if (suppressLogging) return nullLogger; - var factory = Locator.Current.GetService(); if (factory == null) { throw new Exception("ILogManager is null. This should never happen, your dependency resolver is broken"); @@ -205,8 +199,6 @@ public static IFullLogger Default { /// public static IFullLogger Log(this T This) where T : IEnableLogger { - if (suppressLogging) return nullLogger; - var factory = Locator.Current.GetService(); if (factory == null) { throw new Exception("ILogManager is null. This should never happen, your dependency resolver is broken"); From 2f2b8df09cca1ae5d1123ef13fb560b4a5f9f760 Mon Sep 17 00:00:00 2001 From: Kent Boogaart Date: Fri, 15 May 2015 10:32:34 +0930 Subject: [PATCH 03/92] Fixes #111. --- Splat/ServiceLocation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Splat/ServiceLocation.cs b/Splat/ServiceLocation.cs index 094c8715d..f34c49d1a 100644 --- a/Splat/ServiceLocation.cs +++ b/Splat/ServiceLocation.cs @@ -195,7 +195,7 @@ public static void RegisterLazySingleton(this IMutableDependencyResolver This, F public static void InitializeSplat(this IMutableDependencyResolver This) { This.Register(() => new DefaultLogManager(), typeof(ILogManager)); - This.Register(() => new DebugLogger(), typeof(ILogger)); + This.RegisterConstant(new DebugLogger(), typeof(ILogger)); } } From 3a0c7eb7e1312cfb979505d9f4e524c67fe8d8dd Mon Sep 17 00:00:00 2001 From: Pat Sissons Date: Tue, 2 Jun 2015 21:57:49 -0600 Subject: [PATCH 04/92] adding three generic mixins for Register, RegisterConstant, and RegisterLazySingleton --- Splat/ServiceLocation.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Splat/ServiceLocation.cs b/Splat/ServiceLocation.cs index f34c49d1a..0defe7b3f 100644 --- a/Splat/ServiceLocation.cs +++ b/Splat/ServiceLocation.cs @@ -180,18 +180,33 @@ public static IDisposable WithResolver(this IDependencyResolver resolver) return new ActionDisposable(() => Locator.Current = origResolver); } + + public static void Register(this IMutableDependencyResolver This, Func factory, string contract = null) + { + This.Register(factory, typeof(T), contract); + } public static void RegisterConstant(this IMutableDependencyResolver This, object value, Type serviceType, string contract = null) { This.Register(() => value, serviceType, contract); } + public static void RegisterConstant(this IMutableDependencyResolver This, object value, string contract = null) + { + RegisterConstant(This, value, typeof(T), contract); + } + public static void RegisterLazySingleton(this IMutableDependencyResolver This, Func valueFactory, Type serviceType, string contract = null) { var val = new Lazy(valueFactory, LazyThreadSafetyMode.ExecutionAndPublication); This.Register(() => val.Value, serviceType, contract); } + public static void RegisterLazySingleton(this IMutableDependencyResolver This, Func valueFactory, string contract = null) + { + RegisterLazySingleton(This, valueFactory, typeof(T), contract); + } + public static void InitializeSplat(this IMutableDependencyResolver This) { This.Register(() => new DefaultLogManager(), typeof(ILogManager)); From 4916bd78932c285779f1cf477508cedec3018572 Mon Sep 17 00:00:00 2001 From: "Elliott B. Edwards" Date: Sat, 13 Jun 2015 09:34:00 -0700 Subject: [PATCH 05/92] Support MsTest in VS2013 added string to match: Microsoft.VisualStudio.QualityTools.UnitTestFramework --- Splat/PlatformModeDetector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Splat/PlatformModeDetector.cs b/Splat/PlatformModeDetector.cs index 99f3aec44..aaaca2665 100644 --- a/Splat/PlatformModeDetector.cs +++ b/Splat/PlatformModeDetector.cs @@ -23,6 +23,7 @@ public class PlatformModeDetector : IModeDetector "XUNIT", "MBUNIT", "NBEHAVE", + "VISUALSTUDIO.QUALITYTOOLS", }; try { From a52d8c8a508211ce949a0f9de42ca9c2880da4ab Mon Sep 17 00:00:00 2001 From: mteper Date: Thu, 18 Jun 2015 09:39:22 -0700 Subject: [PATCH 06/92] Attempt to fix #117 (Xam.Mac Unified w/o dependency on System.Drawing) --- Splat/Cocoa/Bitmaps.cs | 2 +- Splat/Splat-XamarinMac.csproj | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Splat/Cocoa/Bitmaps.cs b/Splat/Cocoa/Bitmaps.cs index e8f727bba..5b233454c 100644 --- a/Splat/Cocoa/Bitmaps.cs +++ b/Splat/Cocoa/Bitmaps.cs @@ -2,7 +2,6 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using System.Drawing; #if UIKIT && !UNIFIED using MonoTouch.UIKit; @@ -17,6 +16,7 @@ using UIImage = AppKit.NSImage; using UIApplication = AppKit.NSApplication; #else +using System.Drawing; using MonoMac.AppKit; using MonoMac.Foundation; diff --git a/Splat/Splat-XamarinMac.csproj b/Splat/Splat-XamarinMac.csproj index 5540db2b2..81c3a1fd8 100644 --- a/Splat/Splat-XamarinMac.csproj +++ b/Splat/Splat-XamarinMac.csproj @@ -67,6 +67,9 @@ + + + From 7499a58fbc8fa3571ead264cd7bf880d248006f7 Mon Sep 17 00:00:00 2001 From: mteper Date: Wed, 24 Jun 2015 09:47:17 -0700 Subject: [PATCH 07/92] Updated the Xam.Mac path to Xamarin.Mac2.0 and added the .nuspec file to the XS solution --- Splat-XamarinStudio.sln | 7 +++++++ Splat/Splat-XamarinMac.csproj | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Splat-XamarinStudio.sln b/Splat-XamarinStudio.sln index 453bec420..dec78acf3 100644 --- a/Splat-XamarinStudio.sln +++ b/Splat-XamarinStudio.sln @@ -13,6 +13,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Splat-XamarinIOS", "Splat\S EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Splat-XamarinMac", "Splat\Splat-XamarinMac.csproj", "{990825BE-73ED-4A31-9178-B88119A72F61}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{CC27C91B-B3B1-4B86-ADAF-6361D0EE495E}" + ProjectSection(SolutionItems) = preProject + Splat.nuspec = Splat.nuspec + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -44,6 +49,8 @@ Global {E5EEF584-2A8A-4067-8309-15FE4D65DD64}.Release|Any CPU.ActiveCfg = Release|Any CPU {E5EEF584-2A8A-4067-8309-15FE4D65DD64}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection + GlobalSection(NestedProjects) = preSolution + EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Splat\Splat-monotouch.csproj Policies = $0 diff --git a/Splat/Splat-XamarinMac.csproj b/Splat/Splat-XamarinMac.csproj index 81c3a1fd8..0d6bd35be 100644 --- a/Splat/Splat-XamarinMac.csproj +++ b/Splat/Splat-XamarinMac.csproj @@ -18,7 +18,7 @@ true full false - bin\Debug\Xamarin.Mac10 + bin\Debug\Xamarin.Mac20 bin\Debug\Xamarin.Mac10 DEBUG;UNIFIED prompt @@ -35,7 +35,7 @@ full true UNIFIED - bin\Release\Xamarin.Mac10 + bin\Release\Xamarin.Mac20 bin\Release\Xamarin.Mac10 prompt 4 From f9b6971b6fbd5dbedf24c662b37ea5f5b31d7e63 Mon Sep 17 00:00:00 2001 From: Jani Lirkki Date: Wed, 30 Sep 2015 13:17:39 +0300 Subject: [PATCH 08/92] Enable also relative URI in Xaml Bitmap PlatformBitmapLoader.LoadFromResource --- Splat/Xaml/Bitmaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Splat/Xaml/Bitmaps.cs b/Splat/Xaml/Bitmaps.cs index 5c62687d1..20e5e864b 100644 --- a/Splat/Xaml/Bitmaps.cs +++ b/Splat/Xaml/Bitmaps.cs @@ -54,7 +54,7 @@ public Task LoadFromResource(string resource, float? desiredWidth, floa x.DecodePixelHeight = (int)desiredHeight; } - x.UriSource = new Uri(resource); + x.UriSource = new Uri(resource, UriKind.RelativeOrAbsolute); }); return (IBitmap) new BitmapSourceBitmap(ret); From 72ae43775d21ffda7cb82189c6e19862abdfc6fd Mon Sep 17 00:00:00 2001 From: Dennis Daume Date: Fri, 2 Oct 2015 11:58:53 +0200 Subject: [PATCH 09/92] If available, use the dispatcher for the current thread on WinRT This is necessary for applications that are a share target and want to load images while being a share target, as the share window gets its own dispatcher. --- Splat/WinRT/Bitmaps.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Splat/WinRT/Bitmaps.cs b/Splat/WinRT/Bitmaps.cs index 48c87fc5c..91b81d67f 100644 --- a/Splat/WinRT/Bitmaps.cs +++ b/Splat/WinRT/Bitmaps.cs @@ -17,7 +17,7 @@ public class PlatformBitmapLoader : IBitmapLoader { public async Task Load(Stream sourceStream, float? desiredWidth, float? desiredHeight) { - return await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(async () => { + return await GetDispatcher().RunAsync(async () => { using (var rwStream = new InMemoryRandomAccessStream()) { var writer = rwStream.AsStreamForWrite(); await sourceStream.CopyToAsync(writer); @@ -48,7 +48,7 @@ public async Task Load(Stream sourceStream, float? desiredWidth, float? public async Task LoadFromResource(string resource, float? desiredWidth, float? desiredHeight) { - return await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(async () => { + return await GetDispatcher().RunAsync(async () => { var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(resource)); using (var stream = await file.OpenAsync(FileAccessMode.Read)) { return await Load(stream.AsStreamForRead(), desiredWidth, desiredHeight); @@ -60,6 +60,11 @@ public IBitmap Create(float width, float height) { return new WriteableBitmapImageBitmap(new WriteableBitmap((int)width, (int)height)); } + + private static CoreDispatcher GetDispatcher() + { + return CoreWindow.GetForCurrentThread()?.Dispatcher ?? CoreApplication.MainView.CoreWindow.Dispatcher; + } } class WriteableBitmapImageBitmap : IBitmap From 0abf496d13b054d1341d9e85473e26556f446501 Mon Sep 17 00:00:00 2001 From: Dennis Daume Date: Fri, 2 Oct 2015 20:29:58 +0200 Subject: [PATCH 10/92] Rewrite the GetDispatcher method with C# 5 --- Splat/WinRT/Bitmaps.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Splat/WinRT/Bitmaps.cs b/Splat/WinRT/Bitmaps.cs index 91b81d67f..a2c900159 100644 --- a/Splat/WinRT/Bitmaps.cs +++ b/Splat/WinRT/Bitmaps.cs @@ -63,7 +63,9 @@ public IBitmap Create(float width, float height) private static CoreDispatcher GetDispatcher() { - return CoreWindow.GetForCurrentThread()?.Dispatcher ?? CoreApplication.MainView.CoreWindow.Dispatcher; + CoreWindow currentThreadWindow = CoreWindow.GetForCurrentThread(); + + return currentThreadWindow == null ? CoreApplication.MainView.CoreWindow.Dispatcher : currentThreadWindow.Dispatcher; } } From a286b504372ad0d85599eac9addf187e19ade7d2 Mon Sep 17 00:00:00 2001 From: Dennis Daume Date: Tue, 22 Dec 2015 21:05:03 +0100 Subject: [PATCH 11/92] Make the assembly lookup in the ModeDetector more efficient Pull the call to ToUpperInvariant out of the inner loop into the outer loop so it's only called once per assembly --- Splat/PlatformModeDetector.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Splat/PlatformModeDetector.cs b/Splat/PlatformModeDetector.cs index aaaca2665..76c4d7e20 100644 --- a/Splat/PlatformModeDetector.cs +++ b/Splat/PlatformModeDetector.cs @@ -65,10 +65,10 @@ public class PlatformModeDetector : IModeDetector static bool searchForAssembly(IEnumerable assemblyList) { #if SILVERLIGHT - return Deployment.Current.Parts.Any(x => assemblyList.Any(name => x.Source.ToUpperInvariant().Contains(name))); + return Deployment.Current.Parts.Select(x => x.Source.ToUpperInvariant()).Any(x => assemblyList.Any(name => x.Contains(name))); #elif NETFX_CORE - var depPackages = Package.Current.Dependencies.Select(x => x.Id.FullName); - if (depPackages.Any(x => assemblyList.Any(name => x.ToUpperInvariant().Contains(name)))) return true; + var depPackages = Package.Current.Dependencies.Select(x => x.Id.FullName.ToUpperInvariant()); + if (depPackages.Any(x => assemblyList.Any(name => x.Contains(name)))) return true; var fileTask = Task.Factory.StartNew(async () => { var files = await Package.Current.InstalledLocation.GetFilesAsync(); @@ -78,7 +78,8 @@ static bool searchForAssembly(IEnumerable assemblyList) return fileTask.Result.Any(x => assemblyList.Any(name => x.ToUpperInvariant().Contains(name))); #else return AppDomain.CurrentDomain.GetAssemblies() - .Any(x => assemblyList.Any(name => x.FullName.ToUpperInvariant().Contains(name))); + .Select(x => x.FullName.ToUpperInvariant()) + .Any(x => assemblyList.Any(name => x.Contains(name))); #endif } } From a3a219d6aac2bbeb66a6e4de92f3a7bd302e1736 Mon Sep 17 00:00:00 2001 From: Antao Almada Date: Mon, 28 Dec 2015 15:18:18 +0000 Subject: [PATCH 12/92] Implement IEquatable Implementation of the IEquatable to avoid boxing as suggested by the .NET guidelines (8.6) --- Splat/Points/Point.cs | 16 +++++++++++++++- Splat/Points/PointF.cs | 16 +++++++++++++++- Splat/Points/Rectangle.cs | 17 ++++++++++++++++- Splat/Points/RectangleF.cs | 17 ++++++++++++++++- Splat/Points/Size.cs | 17 ++++++++++++++++- Splat/Points/SizeF.cs | 17 ++++++++++++++++- 6 files changed, 94 insertions(+), 6 deletions(-) diff --git a/Splat/Points/Point.cs b/Splat/Points/Point.cs index 42a68a855..44e609dbc 100644 --- a/Splat/Points/Point.cs +++ b/Splat/Points/Point.cs @@ -39,6 +39,7 @@ namespace System.Drawing { public struct Point + : IEquatable { // Private x and y coordinate fields. private int x, y; @@ -317,6 +318,19 @@ public int Y } } + /// + /// Equals Method + /// + /// + /// + /// Checks equivalence of this Point and another Point. + /// + + public bool Equals(Point other) + { + return ((this.X == other.X) && (this.Y == other.Y)); + } + /// /// Equals Method /// @@ -330,7 +344,7 @@ public override bool Equals(object obj) if (!(obj is Point)) return false; - return (this == (Point)obj); + return this.Equals((Point)obj); } /// diff --git a/Splat/Points/PointF.cs b/Splat/Points/PointF.cs index b9f533f2a..71d04de9d 100644 --- a/Splat/Points/PointF.cs +++ b/Splat/Points/PointF.cs @@ -35,6 +35,7 @@ namespace System.Drawing { public struct PointF + : IEquatable { // Private x and y coordinate fields. private float x, y; @@ -201,6 +202,19 @@ public float Y } } + /// + /// Equals Method + /// + /// + /// + /// Checks equivalence of this PointF and another PointF. + /// + + public bool Equals(PointF other) + { + return ((this.X == other.X) && (this.Y == other.Y)); + } + /// /// Equals Method /// @@ -214,7 +228,7 @@ public override bool Equals(object obj) if (!(obj is PointF)) return false; - return (this == (PointF)obj); + return this.Equals((PointF)obj); } /// diff --git a/Splat/Points/Rectangle.cs b/Splat/Points/Rectangle.cs index 8831fa965..e88864461 100644 --- a/Splat/Points/Rectangle.cs +++ b/Splat/Points/Rectangle.cs @@ -38,6 +38,7 @@ namespace System.Drawing { public struct Rectangle + : IEquatable { private int x, y, width, height; @@ -564,6 +565,20 @@ public bool Contains(Rectangle rect) return (rect == Intersect(this, rect)); } + /// + /// Equals Method + /// + /// + /// + /// Checks equivalence of this Rectangle and another Rectangle. + /// + + public bool Equals(Rectangle other) + { + return ((this.Location == other.Location) && + (this.Size == other.Size)); + } + /// /// Equals Method /// @@ -577,7 +592,7 @@ public override bool Equals(object obj) if (!(obj is Rectangle)) return false; - return (this == (Rectangle)obj); + return this.Equals((Rectangle)obj); } /// diff --git a/Splat/Points/RectangleF.cs b/Splat/Points/RectangleF.cs index d17b33477..40c5caec5 100644 --- a/Splat/Points/RectangleF.cs +++ b/Splat/Points/RectangleF.cs @@ -33,6 +33,7 @@ namespace System.Drawing { public struct RectangleF + : IEquatable { private float x, y, width, height; @@ -510,6 +511,20 @@ public bool Contains(RectangleF rect) return (rect == Intersect(this, rect)); } + /// + /// Equals Method + /// + /// + /// + /// Checks equivalence of this RectangleF and an RectangleF. + /// + + public bool Equals(RectangleF other) + { + return ((this.Location == other.Location) && + (this.Size == other.Size)); + } + /// /// Equals Method /// @@ -523,7 +538,7 @@ public override bool Equals(object obj) if (!(obj is RectangleF)) return false; - return (this == (RectangleF)obj); + return this.Equals((RectangleF)obj); } /// diff --git a/Splat/Points/Size.cs b/Splat/Points/Size.cs index f9a1c7e85..c2505d15b 100644 --- a/Splat/Points/Size.cs +++ b/Splat/Points/Size.cs @@ -39,6 +39,7 @@ namespace System.Drawing { public struct Size + : IEquatable { // Private Height and width fields. @@ -302,6 +303,20 @@ public int Height } } + /// + /// Equals Method + /// + /// + /// + /// Checks equivalence of this Size and another Size. + /// + + public bool Equals(Size other) + { + return ((this.Width == other.Width) && + (this.Height == other.Height)); + } + /// /// Equals Method /// @@ -315,7 +330,7 @@ public override bool Equals(object obj) if (!(obj is Size)) return false; - return (this == (Size)obj); + return this.Equals((Size)obj); } /// diff --git a/Splat/Points/SizeF.cs b/Splat/Points/SizeF.cs index 11343dc84..73ec3afd5 100644 --- a/Splat/Points/SizeF.cs +++ b/Splat/Points/SizeF.cs @@ -39,6 +39,7 @@ namespace System.Drawing { public struct SizeF + : IEquatable { // Private height and width fields. private float width, height; @@ -238,6 +239,20 @@ public float Height } } + /// + /// Equals Method + /// + /// + /// + /// Checks equivalence of this SizeF and another SizeF. + /// + + public bool Equals(SizeF other) + { + return ((this.Width == other.Width) && + (this.Height == other.Height)); + } + /// /// Equals Method /// @@ -251,7 +266,7 @@ public override bool Equals(object obj) if (!(obj is SizeF)) return false; - return (this == (SizeF)obj); + return this.Equals((SizeF)obj); } /// From 0a7946740e6091d7a825626dbb8beef452906cb7 Mon Sep 17 00:00:00 2001 From: Kent Boogaart Date: Tue, 19 Jan 2016 17:00:39 +1030 Subject: [PATCH 13/92] Add rebracer settings. --- Rebracer.xml | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Rebracer.xml diff --git a/Rebracer.xml b/Rebracer.xml new file mode 100644 index 000000000..c33407287 --- /dev/null +++ b/Rebracer.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 2 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 1 + + + + \ No newline at end of file From 6c4e9eb70e906d70265d886781965570d7225b15 Mon Sep 17 00:00:00 2001 From: Kent Boogaart Date: Tue, 19 Jan 2016 18:17:34 +1030 Subject: [PATCH 14/92] Use generic type to restrict values. --- Splat/ServiceLocation.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Splat/ServiceLocation.cs b/Splat/ServiceLocation.cs index 0defe7b3f..53f23a31c 100644 --- a/Splat/ServiceLocation.cs +++ b/Splat/ServiceLocation.cs @@ -181,17 +181,17 @@ public static IDisposable WithResolver(this IDependencyResolver resolver) return new ActionDisposable(() => Locator.Current = origResolver); } - public static void Register(this IMutableDependencyResolver This, Func factory, string contract = null) + public static void Register(this IMutableDependencyResolver This, Func factory, string contract = null) { - This.Register(factory, typeof(T), contract); + This.Register(() => factory(), typeof(T), contract); } - + public static void RegisterConstant(this IMutableDependencyResolver This, object value, Type serviceType, string contract = null) { This.Register(() => value, serviceType, contract); } - public static void RegisterConstant(this IMutableDependencyResolver This, object value, string contract = null) + public static void RegisterConstant(this IMutableDependencyResolver This, T value, string contract = null) { RegisterConstant(This, value, typeof(T), contract); } @@ -202,9 +202,9 @@ public static void RegisterLazySingleton(this IMutableDependencyResolver This, F This.Register(() => val.Value, serviceType, contract); } - public static void RegisterLazySingleton(this IMutableDependencyResolver This, Func valueFactory, string contract = null) + public static void RegisterLazySingleton(this IMutableDependencyResolver This, Func valueFactory, string contract = null) { - RegisterLazySingleton(This, valueFactory, typeof(T), contract); + RegisterLazySingleton(This, () => valueFactory(), typeof(T), contract); } public static void InitializeSplat(this IMutableDependencyResolver This) From 549f2f5dc51a1e4604086841b3adfff16b64d4d7 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Fri, 22 Jan 2016 14:26:29 -0800 Subject: [PATCH 15/92] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..fb82d68b1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,50 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of +fostering an open and welcoming community, we pledge to respect all people who +contribute through reporting issues, posting feature requests, updating +documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free +experience for everyone, regardless of level of experience, gender, gender +identity and expression, sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic + addresses, without explicit permission +* Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +By adopting this Code of Conduct, project maintainers commit themselves to +fairly and consistently applying these principles to every aspect of managing +this project. Project maintainers who do not follow or enforce the Code of +Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting a project maintainer at [INSERT EMAIL ADDRESS]. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. Maintainers are +obligated to maintain confidentiality with regard to the reporter of an +incident. + + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.3.0, available at +[http://contributor-covenant.org/version/1/3/0/][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/3/0/ From 20e3f535b1b645f5b673582f4a4a9a6faca098a2 Mon Sep 17 00:00:00 2001 From: Dennis Daume Date: Fri, 25 Mar 2016 12:10:17 +0100 Subject: [PATCH 16/92] Use Dictionary.TryGetValue in the MemoizingMRUCache where possible This avoids the duplicate lookup of the dictionary entry --- Splat/MemoizingMRUCache.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Splat/MemoizingMRUCache.cs b/Splat/MemoizingMRUCache.cs index c51f21759..6e8c8fac0 100644 --- a/Splat/MemoizingMRUCache.cs +++ b/Splat/MemoizingMRUCache.cs @@ -60,8 +60,9 @@ public TVal Get(TParam key, object context = null) { Contract.Requires(key != null); - if (cacheEntries.ContainsKey(key)) { - var found = cacheEntries[key]; + Tuple, TVal> found; + + if (cacheEntries.TryGetValue(key, out found)) { cacheMRUList.Remove(found.Item1); cacheMRUList.AddFirst(found.Item1); return found.Item2; @@ -101,10 +102,11 @@ public void Invalidate(TParam key) { Contract.Requires(key != null); - if (!cacheEntries.ContainsKey(key)) + Tuple, TVal> to_remove; + + if (!cacheEntries.TryGetValue(key, out to_remove)) return; - var to_remove = cacheEntries[key]; if (releaseFunction != null) releaseFunction(to_remove.Item2); From 44eea43451649e5df6019809db66b33acaf14b0a Mon Sep 17 00:00:00 2001 From: Tomasz Wiernik Date: Tue, 29 Mar 2016 12:38:09 +0200 Subject: [PATCH 17/92] ModeDetector detects Fixie test runner --- Splat/PlatformModeDetector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Splat/PlatformModeDetector.cs b/Splat/PlatformModeDetector.cs index 76c4d7e20..fa5e7d758 100644 --- a/Splat/PlatformModeDetector.cs +++ b/Splat/PlatformModeDetector.cs @@ -24,6 +24,7 @@ public class PlatformModeDetector : IModeDetector "MBUNIT", "NBEHAVE", "VISUALSTUDIO.QUALITYTOOLS", + "FIXIE", }; try { From f14fda195c93958e0e028befa553eb7ea622278a Mon Sep 17 00:00:00 2001 From: Kent Boogaart Date: Sat, 16 Apr 2016 18:57:21 +0930 Subject: [PATCH 18/92] Recognize NCrunch as a test runner. --- Splat/PlatformModeDetector.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Splat/PlatformModeDetector.cs b/Splat/PlatformModeDetector.cs index fa5e7d758..21a2362c6 100644 --- a/Splat/PlatformModeDetector.cs +++ b/Splat/PlatformModeDetector.cs @@ -25,6 +25,7 @@ public class PlatformModeDetector : IModeDetector "NBEHAVE", "VISUALSTUDIO.QUALITYTOOLS", "FIXIE", + "NCRUNCH", }; try { @@ -62,7 +63,7 @@ public class PlatformModeDetector : IModeDetector return false; #endif } - + static bool searchForAssembly(IEnumerable assemblyList) { #if SILVERLIGHT From e491ee4439128700a075238d3fca0234f909e298 Mon Sep 17 00:00:00 2001 From: Dennis Daume Date: Thu, 12 May 2016 15:23:42 +0200 Subject: [PATCH 19/92] Remove the support for WinRT80 The WinRT80 project can't even be opened with VS 2015 anymore --- README.md | 3 +- Splat-VisualStudio.sln | 22 +----- Splat/Splat-NetCore45.csproj | 141 ----------------------------------- Splat/Splat-Portable.csproj | 8 +- 4 files changed, 7 insertions(+), 167 deletions(-) delete mode 100644 Splat/Splat-NetCore45.csproj diff --git a/README.md b/README.md index 205251eb4..c3557501a 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,7 @@ Splat currently supports: * WPF (.NET 4.5) * Windows Forms * Windows Phone 8 -* Windows Phone 8.1 Universal -* WinRT +* Windows 8.1/Windows Phone 8.1 Universal ## Cross-platform Image Loading diff --git a/Splat-VisualStudio.sln b/Splat-VisualStudio.sln index def2efc42..84409d856 100644 --- a/Splat-VisualStudio.sln +++ b/Splat-VisualStudio.sln @@ -1,12 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30324.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Splat-WP8", "Splat\Splat-WP8.csproj", "{95309EA3-055A-4B66-84DE-7771237CCF6C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Splat-NetCore45", "Splat\Splat-NetCore45.csproj", "{18DCE642-06B7-4092-B8F4-30A675DA6929}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Splat-Net45", "Splat\Splat-Net45.csproj", "{252CE1C2-027A-4445-A3C2-E4D6C80A935A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Splat-Portable", "Splat\Splat-Portable.csproj", "{0EC8DBA1-D745-4EE5-993A-6026440EC3BF}" @@ -51,22 +49,6 @@ Global {95309EA3-055A-4B66-84DE-7771237CCF6C}.Release|x64.ActiveCfg = Release|Any CPU {95309EA3-055A-4B66-84DE-7771237CCF6C}.Release|x86.ActiveCfg = Release|x86 {95309EA3-055A-4B66-84DE-7771237CCF6C}.Release|x86.Build.0 = Release|x86 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|Any CPU.Build.0 = Debug|Any CPU - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|ARM.ActiveCfg = Debug|ARM - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|ARM.Build.0 = Debug|ARM - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|x64.ActiveCfg = Debug|x64 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|x64.Build.0 = Debug|x64 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|x86.ActiveCfg = Debug|x86 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Debug|x86.Build.0 = Debug|x86 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|Any CPU.ActiveCfg = Release|Any CPU - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|Any CPU.Build.0 = Release|Any CPU - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|ARM.ActiveCfg = Release|ARM - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|ARM.Build.0 = Release|ARM - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|x64.ActiveCfg = Release|x64 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|x64.Build.0 = Release|x64 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|x86.ActiveCfg = Release|x86 - {18DCE642-06B7-4092-B8F4-30A675DA6929}.Release|x86.Build.0 = Release|x86 {252CE1C2-027A-4445-A3C2-E4D6C80A935A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {252CE1C2-027A-4445-A3C2-E4D6C80A935A}.Debug|Any CPU.Build.0 = Debug|Any CPU {252CE1C2-027A-4445-A3C2-E4D6C80A935A}.Debug|ARM.ActiveCfg = Debug|Any CPU diff --git a/Splat/Splat-NetCore45.csproj b/Splat/Splat-NetCore45.csproj deleted file mode 100644 index 8504c4daa..000000000 --- a/Splat/Splat-NetCore45.csproj +++ /dev/null @@ -1,141 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {18DCE642-06B7-4092-B8F4-30A675DA6929} - Library - Properties - Splat - Splat - en-US - 8.0 - 11 - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - true - full - false - bin\Debug\NetCore45\ - obj\Debug\NetCore45\ - DEBUG;TRACE;NETFX_CORE - prompt - 4 - - - pdbonly - true - bin\Release\NetCore45\ - obj\Release\NetCore45\ - TRACE;NETFX_CORE - prompt - 4 - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - ARM - false - prompt - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x64 - false - prompt - true - - - bin\x64\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x64 - false - prompt - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x86 - false - prompt - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Splat/Splat-Portable.csproj b/Splat/Splat-Portable.csproj index 3f2498b58..cbce8b559 100644 --- a/Splat/Splat-Portable.csproj +++ b/Splat/Splat-Portable.csproj @@ -2,7 +2,7 @@ - 11.0 + 10.0 Debug AnyCPU {0EC8DBA1-D745-4EE5-993A-6026440EC3BF} @@ -11,7 +11,7 @@ Splat Splat v4.5 - Profile78 + Profile259 512 {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0.0 @@ -21,7 +21,7 @@ true full false - bin\Debug\Portable-net45+win+wpa81+wp80\ + bin\Debug\Portable-net45+win81+wpa81+wp8\ obj\Debug\Portable-net45+win+wpa81+wp80\ DEBUG;TRACE;PORTABLE prompt @@ -70,4 +70,4 @@ --> - + \ No newline at end of file From 4284fea734a89154154aca2b2d9c4c7668f87a37 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Mon, 15 Aug 2016 18:20:30 +1000 Subject: [PATCH 20/92] docs: added issue/pr templates and contrib guidelines --- .github/ISSUE_TEMPLATE.md | 27 +++++ .github/PULL_REQUEST_TEMPLATE.md | 23 ++++ CONTRIBUTING.md | 200 +++++++++++++++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..b864473c9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,27 @@ +***Note*: for support questions, please ask on StackOverflow: https://stackoverflow.com/questions/tagged/splat . This repository's issues are reserved for feature requests and bug reports.** + +**Do you want to request a *feature* or report a *bug*?** + + + +**What is the current behavior?** + + + +**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** + + + +**What is the expected behavior?** + + + +**What is the motivation / use case for changing the behavior?** + + + +**Which versions of Splat, and which platform / OS are affected by this issue? Did this work in previous versions of Splat? Please also test with the latest stable and snapshot (https://www.myget.org/feed/Splat/package/nuget/Splat) versions.** + + + +**Other information (e.g. stacktraces, related issues, suggestions how to fix)** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..88182abad --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,23 @@ +**What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)** + + + +**What is the current behavior? (You can also link to an open issue here)** + + + +**What is the new behavior (if this is a feature change)?** + + + +**Does this PR introduce a breaking change?** + + + +**Please check if the PR fulfills these requirements** +- [ ] The commit follows our guidelines: https://github.com/paulcbetts/splat/blob/master/CONTRIBUTING.md +- [ ] Tests for the changes have been added (for bug fixes / features) +- [ ] Docs have been added / updated (for bug fixes / features) + +**Other information**: + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..af2cc21b7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,200 @@ +# Contributing to Splat + +We'd love for you to contribute to our source code and to make Splat even better than it is +today! Here are the guidelines we'd like you to follow: + + - [Code of Conduct](#coc) + - [Question or Problem?](#question) + - [Issues and Bugs](#issue) + - [Feature Requests](#feature) + - [Submission Guidelines](#submit) + - [Coding Rules](#rules) + - [Commit Message Guidelines](#commit) + +## Code of Conduct + +Help us keep the project open and inclusive. Please read and follow our [Code of Conduct][coc]. + +## Got a Question or Problem? + +If you have questions about how to use Splat, please direct these to [StackOverflow](https://stackoverflow.com/questions/tagged/splat). The project maintainers hang out in this [Slack](https://github.com/reactiveui/reactiveui#slack) channel. + +## Found an Issue? + +If you find a bug in the source code or a mistake in the documentation, you can help us by +submitting an issue to our [GitHub Repository](https://github.com/paulcbetts/Splat). Even better you can submit a Pull Request +with a fix. + +**Please see the [Submission Guidelines](#submit) below.** + +## Want a Feature? + +You can request a new feature by submitting an issue to our [GitHub Repository](https://github.com/paulcbetts/splat). If you +would like to implement a new feature then consider what kind of change it is: + +* **Major Changes** that you wish to contribute to the project should be discussed first in [Slack](https://github.com/reactiveui/reactiveui#slack) so that we can better coordinate our efforts, + prevent duplication of work, and help you to craft the change so that it is successfully accepted + into the project. +* **Small Changes** can be crafted and submitted to the [GitHub Repository](https://github.com/paulcbetts/splat) as a Pull + Request. + +## Submission Guidelines + +### Submitting an Issue + +If your issue appears to be a bug, and hasn't been reported, open a new issue. Help us to maximize +the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. + +Providing the following information will increase the chances of your issue being dealt with +quickly: + +* **Overview of the Issue** - if an error is being thrown a stack trace helps +* **Motivation for or Use Case** - explain why this is a bug for you +* **Splat Version(s)** - is it a regression? +* **Operating System** - is this a problem with all browsers or only specific ones? +* **Reproduce the Error** - provide a example or an unambiguous set of steps. +* **Related Issues** - has a similar issue been reported before? +* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be + causing the problem (line of code or commit) + +**If you get help, help others. Good karma rulez!** + +### Submitting a Pull Request +Before you submit your pull request consider the following guidelines: + +* Search [GitHub](https://github.com/paulcbetts/Splat/pulls) for an open or closed Pull Request + that relates to your submission. You don't want to duplicate effort. +* Make your changes in a new git branch: + + ```shell + git checkout -b my-fix-branch master + ``` + +* Create your patch, **including appropriate test cases**. +* Follow our [Coding Rules](#rules). +* Run the test suite, as described below. +* Commit your changes using a descriptive commit message that follows our + [commit message conventions](#commit). + + ```shell + git commit -a + ``` + Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files. + +* Build your changes locally to ensure all the tests pass: + + ```shell + build.cmd + ``` + +* Push your branch to GitHub: + + ```shell + git push origin my-fix-branch + ``` + +In GitHub, send a pull request to `splat:master`. + +If we suggest changes, then: + +* Make the required updates. +* Re-run the test suite to ensure tests are still passing. +* Commit your changes to your branch (e.g. `my-fix-branch`). +* Push the changes to your GitHub repository (this will update your Pull Request). + +If the PR gets too outdated we may ask you to rebase and force push to update the PR: + +```shell +git rebase master -i +git push origin my-fix-branch -f +``` + +_WARNING: Squashing or reverting commits and force-pushing thereafter may remove GitHub comments +on code that were previously made by you or others in your commits. Avoid any form of rebasing +unless necessary._ + +That's it! Thank you for your contribution! + +#### After your pull request is merged + +After your pull request is merged, you can safely delete your branch and pull the changes +from the main (upstream) repository: + +* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: + + ```shell + git push origin --delete my-fix-branch + ``` + +* Check out the master branch: + + ```shell + git checkout master -f + ``` + +* Delete the local branch: + + ```shell + git branch -D my-fix-branch + ``` + +* Update your master with the latest upstream version: + + ```shell + git pull --ff upstream master + ``` + +## Coding Rules + +To ensure consistency throughout the source code, keep these rules in mind as you are working: + +* All features or bug fixes **must be tested** by one or more unit tests. +* All public API methods **must be documented** with XML documentation. + +## Git Commit Guidelines + +Each commit message consists of a **header**, a **body** and a **footer**. The header has a special +format that includes a **type** and a **subject**: + +``` +: + + +