stub Firefox support run all configured browsers for each test

--- src/FluentWebUITesting/UITestRunner.cs
+++ src/FluentWebUITesting/UITestRunner.cs
@@ -12,6 +12,9 @@
 {
     public class UITestRunner
     {
+        public static bool UseFirefox = false;
+        public static bool UseIE = true;
+
         public static IEnumerable<Action<Browser>> InitializeWorkFlowContainer(params Action<Browser>[] steps)
         {
             return steps;
@@ -51,6 +54,21 @@

             public string FailureReason { get; private set; }

+            private IEnumerable<Browser> GetBrowsers()
+            {
+                if (UseFirefox)
+                {
+                    yield return new FireFox();
+                }
+                if (UseIE)
+                {
+                    yield return new IE
+                        {
+                            AutoClose = true
+                        };
+                }
+            }
+
             public bool PassesTest()
             {
                 _monitor.Reset();
@@ -66,35 +84,35 @@

             private void RunTest()
             {
-                Browser browser = null;
-                try
+                foreach (var browser in GetBrowsers())
                 {
-                    //todo figure out IE Settings in new WatiN
-                    //					IE.Settings.AutoMoveMousePointerToTopLeft = false;
-                    //					IE.Settings.WaitForCompleteTimeOut = 120;
-                    browser = new IE
+                    try
+                    {
+                        //todo figure out IE Settings in new WatiN
+                        //					IE.Settings.AutoMoveMousePointerToTopLeft = false;
+                        //					IE.Settings.WaitForCompleteTimeOut = 120;
+
+                        foreach (var step in _steps)
                         {
-                            AutoClose = true
-                        };
-                    foreach (var step in _steps)
+                            step(browser);
+                        }
+                    }
+                    catch (Exception exception)
                     {
-                        step(browser);
+                        _failed = true;
+                        FailureReason = exception.Message;
+                        _monitor.Set();
+                        return;
+                    }
+                    finally
+                    {
+                        if (browser != null)
+                        {
+                            browser.Dispose();
+                        }
                     }
                 }
-                catch (Exception exception)
-                {
-                    _failed = true;
-                    FailureReason = exception.Message;
-                    return;
-                }
-                finally
-                {
-                    if (browser != null)
-                    {
-                        browser.Dispose();
-                    }
-                    _monitor.Set();
-                }
+                _monitor.Set();
             }
         }
     }


Add missing nullguard and add an extra url parsing check

Fixes #361

--- src/GitHub.Extensions/UriExtensions.cs
+++ src/GitHub.Extensions/UriExtensions.cs
@@ -1,4 +1,5 @@
-using System;
+using NullGuard;
+using System;

 namespace GitHub.Extensions
 {
@@ -11,6 +12,8 @@

         public static bool IsSameHost(this Uri uri, Uri compareUri)
         {
+            if (compareUri == null)
+                return false;
             return uri.Host.Equals(compareUri.Host, StringComparison.OrdinalIgnoreCase);
         }

@@ -21,6 +24,7 @@
             return new Uri(uri, new Uri(absolutePath, UriKind.Relative));
         }

+        [return: AllowNull]
         public static Uri ToHttps(this Uri uri)
         {
             if (uri == null
@@ -41,10 +45,12 @@
             return uri == null ? "" : uri.ToString().ToUpperInvariant();
         }

+        [return: AllowNull]
         public static string GetUser(this Uri uri)
         {
             var parts = uri.Segments;
-            if (parts.Length < 2)
+            // only parse urls in the format domain/user/repo
+            if (parts.Length < 3)
                 return null;
             var u = parts[1];
             if (u == null)
@@ -53,9 +59,11 @@
             return u;
         }

+        [return: AllowNull]
         public static string GetRepo(this Uri uri)
         {
             var parts = uri.Segments;
+            // only parse urls in the format domain/user/repo
             if (parts.Length < 3)
                 return null;
             var name = parts[2];


host endpoint

host endpoint

--- util/Setup/Program.cs
+++ util/Setup/Program.cs
@@ -155,7 +155,7 @@

         private static bool ValidateInstallation()
         {
-            Console.Write("(!) Enter your installation id (get it at https://bitwarden.com/install): ");
+            Console.Write("(!) Enter your installation id (get it at https://bitwarden.com/host): ");
             var installationId = Console.ReadLine();
             Guid installationidGuid;
             if(!Guid.TryParse(installationId.Trim(), out installationidGuid))


tests/DateTime: Fix test

tests/DateTime: Fix test

--- tests/SerializableTest.cs
+++ tests/SerializableTest.cs
@@ -125,7 +125,7 @@
             var found = _db.Get<ComplexType>(m => m.ID == model.ID);
             var endOfPreviousSecond = value.AddMilliseconds(-value.Millisecond - 1);
             var startOfNextSecond = value.AddMilliseconds(1000 - value.Millisecond + 1);
-            Assert.That(found.DateTimeValue.InnerValue, Is.InRange(endOfPreviousSecond, startOfNextSecond));
+            Assert.That(found.DateTimeValue.InnerValue.ToUniversalTime(), Is.InRange(endOfPreviousSecond, startOfNextSecond));
         }

         [Test]


adding tests

adding tests

--- tests/EasyRpc.Tests/DynamicClient/RpcProxyServiceTests.cs
+++ tests/EasyRpc.Tests/DynamicClient/RpcProxyServiceTests.cs
@@ -5,6 +5,7 @@
 using System.Text;
 using EasyRpc.AspNetCore.Messages;
 using EasyRpc.DynamicClient;
+using EasyRpc.DynamicClient.Exceptions;
 using EasyRpc.DynamicClient.ProxyGenerator;
 using EasyRpc.Tests.Middleware;
 using NSubstitute;
@@ -12,6 +13,7 @@
 using SimpleFixture.NSubstitute;
 using SimpleFixture.xUnit;
 using Xunit;
+using JsonRpcErrorCode = EasyRpc.AspNetCore.Messages.JsonRpcErrorCode;

 namespace EasyRpc.Tests.DynamicClient
 {
@@ -64,6 +66,66 @@
             client.Received().SendAsync(Arg.Is<HttpRequestMessage>(message => ValidateSomeClassSomeMethod(message)));
         }

+        [Theory]
+        [AutoData]
+        public void RpcProxyServiceMakeCallMethodNotFound(IRpcHttpClient client,
+            IRpcHttpClientProvider clientProvider,
+            RpcProxyService proxyService)
+        {
+            var response = new HttpResponseMessage(HttpStatusCode.Accepted)
+            {
+                Content = new StreamContent(new ErrorResponseMessage("2,0","1",JsonRpcErrorCode.MethodNotFound, "Not Found").SerializeToStream())
+            };
+
+            client.SendAsync(Arg.Any<HttpRequestMessage>()).Returns(response);
+
+            clientProvider.GetHttpClient(Arg.Any<string>()).Returns(client);
+
+            var bytes = new byte[] { 0, 1, 1, 0 };
+
+            Assert.Throws<AggregateException>(() => proxyService.MakeCallNoReturn("SomeClass", "SomeMethod", bytes));
+        }
+
+        [Theory]
+        [AutoData]
+        public void RpcProxyServiceMakeCallMethodNotAuthorized(IRpcHttpClient client,
+            IRpcHttpClientProvider clientProvider,
+            RpcProxyService proxyService)
+        {
+            var response = new HttpResponseMessage(HttpStatusCode.Accepted)
+            {
+                Content = new StreamContent(new ErrorResponseMessage("2,0", "1", JsonRpcErrorCode.UnauthorizedAccess, "Not Authorized").SerializeToStream())
+            };
+
+            client.SendAsync(Arg.Any<HttpRequestMessage>()).Returns(response);
+
+            clientProvider.GetHttpClient(Arg.Any<string>()).Returns(client);
+
+            var bytes = new byte[] { 0, 1, 1, 0 };
+
+            Assert.Throws<AggregateException>(() => proxyService.MakeCallNoReturn("SomeClass", "SomeMethod", bytes));
+        }
+
+        [Theory]
+        [AutoData]
+        public void RpcProxyServiceMakeCallInternalError(IRpcHttpClient client,
+            IRpcHttpClientProvider clientProvider,
+            RpcProxyService proxyService)
+        {
+            var response = new HttpResponseMessage(HttpStatusCode.Accepted)
+            {
+                Content = new StreamContent(new ErrorResponseMessage("2,0", "1", JsonRpcErrorCode.InternalServerError, "Internal Server Error").SerializeToStream())
+            };
+
+            client.SendAsync(Arg.Any<HttpRequestMessage>()).Returns(response);
+
+            clientProvider.GetHttpClient(Arg.Any<string>()).Returns(client);
+
+            var bytes = new byte[] { 0, 1, 1, 0 };
+
+            Assert.Throws<AggregateException>(() => proxyService.MakeCallNoReturn("SomeClass", "SomeMethod", bytes));
+        }
+
         private bool ValidateSomeClassSomeMethod(HttpRequestMessage message)
         {
             var data = message.Content.ReadAsByteArrayAsync().Result;


This test is unreliable (can't guarantee memory will change after freeing)

--- tests/Tests/SKDataTest.cs
+++ tests/Tests/SKDataTest.cs
@@ -19,6 +19,7 @@
 		}

 		[Test]
+		[Ignore]
 		public void DataDisposedReturnsInvalidStream()
 		{
 			// create data


Added ContentRootPath to theme path

Added ContentRootPath to theme path

--- src/IdentityBase.Shared/ThemeHelper.cs
+++ src/IdentityBase.Shared/ThemeHelper.cs
@@ -3,6 +3,7 @@
     using System.IO;
     using IdentityBase.Configuration;
     using IdentityBase.Models;
+    using Microsoft.AspNetCore.Hosting;
     using Microsoft.AspNetCore.Http;
     using ServiceBase.Extensions;

@@ -10,13 +11,16 @@
     {
         private readonly IHttpContextAccessor _httpContextAccessor;
         private readonly ApplicationOptions _applicationOptions;
+        private readonly IHostingEnvironment _environment;

         public ThemeHelper(
             ApplicationOptions applicationOptions,
-            IHttpContextAccessor httpContextAccessor)
+            IHttpContextAccessor httpContextAccessor,
+            IHostingEnvironment environment)
         {
             this._httpContextAccessor = httpContextAccessor;
             this._applicationOptions = applicationOptions;
+            this._environment = environment;
         }

         // TODO: return theme object instead of string
@@ -29,7 +33,7 @@

             if (!identityBaseContext.IsValid)
             {
-                return "Default";
+                return "Default";
             }

             ClientProperties clientProperties = identityBaseContext.Client
@@ -44,8 +48,11 @@
         {
             string theme = this.GetTheme();

+            // TODO: support rooted ThemeDirectoryPath
+
             string path = Path.GetFullPath(
                 Path.Combine(
+                    this._environment.ContentRootPath,
                     this._applicationOptions.ThemeDirectoryPath,
                     theme));


Remove array allocation overhead in `ClearTransformsAfter`

--- osu.Framework/Graphics/Transforms/TargetGroupingTransformTracker.cs
+++ osu.Framework/Graphics/Transforms/TargetGroupingTransformTracker.cs
@@ -263,21 +263,32 @@
         {
             resetLastAppliedCache();

-            Transform[] toAbort;
-
             if (targetMember == null)
             {
-                toAbort = transforms.Where(t => t.StartTime >= time).ToArray();
-                transforms.RemoveAll(t => t.StartTime >= time);
+                for (int i = 0; i < transforms.Count; i++)
+                {
+                    var t = transforms[i];
+
+                    if (t.StartTime >= time)
+                    {
+                        transforms.RemoveAt(i--);
+                        t.OnAbort?.Invoke();
+                    }
+                }
             }
             else
             {
-                toAbort = transforms.Where(t => t.TargetMember == targetMember && t.StartTime >= time).ToArray();
-                transforms.RemoveAll(t => t.TargetMember == targetMember && t.StartTime >= time);
-            }
-
-            foreach (var t in toAbort)
-                t.OnAbort?.Invoke();
+                for (int i = 0; i < transforms.Count; i++)
+                {
+                    var t = transforms[i];
+
+                    if (t.TargetMember == targetMember && t.StartTime >= time)
+                    {
+                        transforms.RemoveAt(i--);
+                        t.OnAbort?.Invoke();
+                    }
+                }
+            }
         }

         /// <summary>


Added object overrides to Core.Support.HashMap so it can be used as a dictionary key based on values within the dictionary rather than by reference equality.

--- src/Lucene.Net.Core/Support/HashMap.cs
+++ src/Lucene.Net.Core/Support/HashMap.cs
@@ -125,6 +125,84 @@
             return this[key];
         }

+        #region Object overrides
+
+        public override bool Equals(object obj)
+        {
+            if (obj == this)
+                return true;
+
+            if (!(obj is IDictionary<TKey, TValue>))
+                return false;
+            IDictionary<TKey, TValue> m = (IDictionary<TKey, TValue>)obj;
+            if (m.Count != Count)
+                return false;
+
+            try
+            {
+                var i = GetEnumerator();
+                while (i.MoveNext())
+                {
+                    KeyValuePair<TKey, TValue> e = i.Current;
+                    TKey key = e.Key;
+                    TValue value = e.Value;
+                    if (value == null)
+                    {
+                        if (!(m[key] == null && m.ContainsKey(key)))
+                            return false;
+                    }
+                    else
+                    {
+                        if (!value.Equals(m[key]))
+                            return false;
+                    }
+                }
+            }
+            catch (InvalidCastException)
+            {
+                return false;
+            }
+            catch (NullReferenceException)
+            {
+                return false;
+            }
+
+            return true;
+        }
+
+        public override int GetHashCode()
+        {
+            int h = 0;
+            var i = GetEnumerator();
+            while (i.MoveNext())
+                h += i.Current.GetHashCode();
+            return h;
+        }
+
+        public override string ToString()
+        {
+            var i = GetEnumerator();
+            if (!i.MoveNext())
+                return "{}";
+
+            StringBuilder sb = new StringBuilder();
+            sb.Append('{');
+            for (;;)
+            {
+                var e = i.Current;
+                TKey key = e.Key;
+                TValue value = e.Value;
+                sb.Append(key);
+                sb.Append('=');
+                sb.Append(value);
+                if (!i.MoveNext())
+                    return sb.Append('}').ToString();
+                sb.Append(',').Append(' ');
+            }
+        }
+
+        #endregion
+
         #region Implementation of IEnumerable

         public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()


MySQLDialect.cs: Fix line endings.

MySQLDialect.cs: Fix line endings.

--- src/NHibernate/Dialect/MySQLDialect.cs
+++ src/NHibernate/Dialect/MySQLDialect.cs
@@ -1,35 +1,35 @@
-using System;
-using System.Data;
-using System.Data.Common;
-using System.Text;
-using NHibernate.Dialect.Function;
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Text;
+using NHibernate.Dialect.Function;
 using NHibernate.Dialect.Schema;
 using NHibernate.Mapping;
-using NHibernate.SqlCommand;
-using NHibernate.SqlTypes;
-using NHibernate.Util;
-using Environment=NHibernate.Cfg.Environment;
-
-namespace NHibernate.Dialect
-{
-	///
-	/// A SQL dialect for MySQL
-	///
-	/// <remarks>
-	/// The MySQLDialect defaults the following configuration properties:
-	/// <list type="table">
-	///		<listheader>
-	///			<term>Property</term>
-	///			<description>Default Value</description>
-	///		</listheader>
-	///		<item>
-	///			<term>connection.driver_class</term>
-	///			<description><see cref="NHibernate.Driver.MySqlDataDriver" /></description>
-	///		</item>
-	/// </list>
-	/// </remarks>
-	public class MySQLDialect : Dialect
-	{
+using NHibernate.SqlCommand;
+using NHibernate.SqlTypes;
+using NHibernate.Util;
+using Environment=NHibernate.Cfg.Environment;
+
+namespace NHibernate.Dialect
+{
+	///
+	/// A SQL dialect for MySQL
+	///
+	/// <remarks>
+	/// The MySQLDialect defaults the following configuration properties:
+	/// <list type="table">
+	///		<listheader>
+	///			<term>Property</term>
+	///			<description>Default Value</description>
+	///		</listheader>
+	///		<item>
+	///			<term>connection.driver_class</term>
+	///			<description><see cref="NHibernate.Driver.MySqlDataDriver" /></description>
+	///		</item>
+	/// </list>
+	/// </remarks>
+	public class MySQLDialect : Dialect
+	{
 		private readonly TypeNames castTypeNames = new TypeNames();

 		public MySQLDialect()
@@ -181,173 +181,173 @@
 			RegisterFunction("last_day", new StandardSQLFunction("last_day", NHibernateUtil.Date));
 		}

-		///
-		public override string AddColumnString
-		{
-			get { return "add column"; }
-		}
-
-		///
-		public override bool QualifyIndexName
-		{
-			get { return false; }
-		}
-
-		///
-		public override bool SupportsIdentityColumns
-		{
-			get { return true; }
-		}
-
-		///
-		public override string IdentitySelectString
-		{
-			get { return "SELECT LAST_INSERT_ID()"; }
-		}
-
-		///
-		public override string IdentityColumnString
-		{
-			get { return "NOT NULL AUTO_INCREMENT"; }
-		}
-
-		///
-		public override char CloseQuote
-		{
-			get { return '`'; }
-		}
-
-		///
-		public override char OpenQuote
-		{
-			get { return '`'; }
-		}
-
-		public override bool SupportsIfExistsBeforeTableName
-		{
-			get { return true; }
-		}
-
-		///
-		public override bool SupportsLimit
-		{
-			get { return true; }
-		}
-
-		public override IDataBaseSchema GetDataBaseSchema(DbConnection connection)
-		{
-			return new MySQLDataBaseSchema(connection);
-		}
-
-		public override bool SupportsSubSelects
-		{
-			get { return false; }
-		}
-
-		public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
-		{
-			var pagingBuilder = new SqlStringBuilder(queryString);
-			pagingBuilder.Add(" limit ");
-
-			if (offset != null)
-			{
-				pagingBuilder.Add(offset);
-				pagingBuilder.Add(", ");
-			}
-
-			if (limit != null)
-				pagingBuilder.Add(limit);
-			else
-				pagingBuilder.Add(int.MaxValue.ToString());
-
-			return pagingBuilder.ToSqlString();
-		}
-
-		public override string GetAddForeignKeyConstraintString(string constraintName, string[] foreignKey,
-																string referencedTable, string[] primaryKey,
-																bool referencesPrimaryKey)
-		{
-			string cols = String.Join(StringHelper.CommaSpace, foreignKey);
-			return
-				new StringBuilder(30).Append(" add index (").Append(cols).Append("), add constraint ").Append(constraintName).Append
-					(" foreign key (").Append(cols).Append(") references ").Append(referencedTable).Append(" (").Append(
-					String.Join(StringHelper.CommaSpace, primaryKey)).Append(')').ToString();
-		}
-
-		///
-		/// Create the SQL string to drop a foreign key constraint.
-		///
-		/// <param name="constraintName">The name of the foreign key to drop.</param>
-		/// <returns>The SQL string to drop the foreign key constraint.</returns>
-		public override string GetDropForeignKeyConstraintString(string constraintName)
-		{
-			return " drop foreign key " + constraintName;
-		}
-
-		///
-		/// Create the SQL string to drop a primary key constraint.
-		///
-		/// <param name="constraintName">The name of the primary key to drop.</param>
-		/// <returns>The SQL string to drop the primary key constraint.</returns>
-		public override string GetDropPrimaryKeyConstraintString(string constraintName)
-		{
-			return " drop primary key " + constraintName;
-		}
-
-		///
-		/// Create the SQL string to drop an index.
-		///
-		/// <param name="constraintName">The name of the index to drop.</param>
-		/// <returns>The SQL string to drop the index constraint.</returns>
-		public override string GetDropIndexConstraintString(string constraintName)
-		{
-			return " drop index " + constraintName;
-		}
-
-		public override bool SupportsTemporaryTables
-		{
-			get { return true; }
-		}
-
-		public override string CreateTemporaryTableString
-		{
-			get { return "create temporary table if not exists"; }
-		}
-
-		protected virtual void RegisterCastTypes()
-		{
-			// According to the MySql documentation (http://dev.mysql.com/doc/refman/4.1/en/cast-functions.html)
-			// only a few values are supported for the cast target type: BINARY, CHAR, DATE, DATETIME,
-			// SIGNED, TIME, and UNSIGNED. So we must limit our possible cast types to these
-
-			// The Dialect.GetCastTypeName() method uses the default length, precision, and
-			// scale values, so there's no need to consider those values here either, just use the defaults
-			RegisterCastType(DbType.AnsiString, "CHAR");
-			RegisterCastType(DbType.AnsiStringFixedLength, "CHAR");
-			RegisterCastType(DbType.String, "CHAR");
-			RegisterCastType(DbType.StringFixedLength, "CHAR");
-			RegisterCastType(DbType.Binary, "BINARY");
-			RegisterCastType(DbType.Int16, "SIGNED");
-			RegisterCastType(DbType.Int32, "SIGNED");
-			RegisterCastType(DbType.Int64, "SIGNED");
-			RegisterCastType(DbType.UInt16, "UNSIGNED");
-			RegisterCastType(DbType.UInt32, "UNSIGNED");
-			RegisterCastType(DbType.UInt64, "UNSIGNED");
-			RegisterCastType(DbType.Guid, "CHAR(40)");
-			RegisterCastType(DbType.Time, "TIME");
-			RegisterCastType(DbType.Date, "DATE");
-			RegisterCastType(DbType.DateTime, "DATETIME");
-		}
-
-		///
-		/// Subclasses register a typename for the given type code, to be used in CAST()
-		/// statements.
-		///
-		/// <param name="code">The typecode</param>
-		/// <param name="name">The database type name</param>
-		protected void RegisterCastType(DbType code, string name)
-		{
-			castTypeNames.Put(code, name);
+		///
+		public override string AddColumnString
+		{
+			get { return "add column"; }
+		}
+
+		///
+		public override bool QualifyIndexName
+		{
+			get { return false; }
+		}
+
+		///
+		public override bool SupportsIdentityColumns
+		{
+			get { return true; }
+		}
+
+		///
+		public override string IdentitySelectString
+		{
+			get { return "SELECT LAST_INSERT_ID()"; }
+		}
+
+		///
+		public override string IdentityColumnString
+		{
+			get { return "NOT NULL AUTO_INCREMENT"; }
+		}
+
+		///
+		public override char CloseQuote
+		{
+			get { return '`'; }
+		}
+
+		///
+		public override char OpenQuote
+		{
+			get { return '`'; }
+		}
+
+		public override bool SupportsIfExistsBeforeTableName
+		{
+			get { return true; }
+		}
+
+		///
+		public override bool SupportsLimit
+		{
+			get { return true; }
+		}
+
+		public override IDataBaseSchema GetDataBaseSchema(DbConnection connection)
+		{
+			return new MySQLDataBaseSchema(connection);
+		}
+
+		public override bool SupportsSubSelects
+		{
+			get { return false; }
+		}
+
+		public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
+		{
+			var pagingBuilder = new SqlStringBuilder(queryString);
+			pagingBuilder.Add(" limit ");
+
+			if (offset != null)
+			{
+				pagingBuilder.Add(offset);
+				pagingBuilder.Add(", ");
+			}
+
+			if (limit != null)
+				pagingBuilder.Add(limit);
+			else
+				pagingBuilder.Add(int.MaxValue.ToString());
+
+			return pagingBuilder.ToSqlString();
+		}
+
+		public override string GetAddForeignKeyConstraintString(string constraintName, string[] foreignKey,
+																string referencedTable, string[] primaryKey,
+																bool referencesPrimaryKey)
+		{
+			string cols = String.Join(StringHelper.CommaSpace, foreignKey);
+			return
+				new StringBuilder(30).Append(" add index (").Append(cols).Append("), add constraint ").Append(constraintName).Append
+					(" foreign key (").Append(cols).Append(") references ").Append(referencedTable).Append(" (").Append(
+					String.Join(StringHelper.CommaSpace, primaryKey)).Append(')').ToString();
+		}
+
+		///
+		/// Create the SQL string to drop a foreign key constraint.
+		///
+		/// <param name="constraintName">The name of the foreign key to drop.</param>
+		/// <returns>The SQL string to drop the foreign key constraint.</returns>
+		public override string GetDropForeignKeyConstraintString(string constraintName)
+		{
+			return " drop foreign key " + constraintName;
+		}
+
+		///
+		/// Create the SQL string to drop a primary key constraint.
+		///
+		/// <param name="constraintName">The name of the primary key to drop.</param>
+		/// <returns>The SQL string to drop the primary key constraint.</returns>
+		public override string GetDropPrimaryKeyConstraintString(string constraintName)
+		{
+			return " drop primary key " + constraintName;
+		}
+
+		///
+		/// Create the SQL string to drop an index.
+		///
+		/// <param name="constraintName">The name of the index to drop.</param>
+		/// <returns>The SQL string to drop the index constraint.</returns>
+		public override string GetDropIndexConstraintString(string constraintName)
+		{
+			return " drop index " + constraintName;
+		}
+
+		public override bool SupportsTemporaryTables
+		{
+			get { return true; }
+		}
+
+		public override string CreateTemporaryTableString
+		{
+			get { return "create temporary table if not exists"; }
+		}
+
+		protected virtual void RegisterCastTypes()
+		{
+			// According to the MySql documentation (http://dev.mysql.com/doc/refman/4.1/en/cast-functions.html)
+			// only a few values are supported for the cast target type: BINARY, CHAR, DATE, DATETIME,
+			// SIGNED, TIME, and UNSIGNED. So we must limit our possible cast types to these
+
+			// The Dialect.GetCastTypeName() method uses the default length, precision, and
+			// scale values, so there's no need to consider those values here either, just use the defaults
+			RegisterCastType(DbType.AnsiString, "CHAR");
+			RegisterCastType(DbType.AnsiStringFixedLength, "CHAR");
+			RegisterCastType(DbType.String, "CHAR");
+			RegisterCastType(DbType.StringFixedLength, "CHAR");
+			RegisterCastType(DbType.Binary, "BINARY");
+			RegisterCastType(DbType.Int16, "SIGNED");
+			RegisterCastType(DbType.Int32, "SIGNED");
+			RegisterCastType(DbType.Int64, "SIGNED");
+			RegisterCastType(DbType.UInt16, "UNSIGNED");
+			RegisterCastType(DbType.UInt32, "UNSIGNED");
+			RegisterCastType(DbType.UInt64, "UNSIGNED");
+			RegisterCastType(DbType.Guid, "CHAR(40)");
+			RegisterCastType(DbType.Time, "TIME");
+			RegisterCastType(DbType.Date, "DATE");
+			RegisterCastType(DbType.DateTime, "DATETIME");
+		}
+
+		///
+		/// Subclasses register a typename for the given type code, to be used in CAST()
+		/// statements.
+		///
+		/// <param name="code">The typecode</param>
+		/// <param name="name">The database type name</param>
+		protected void RegisterCastType(DbType code, string name)
+		{
+			castTypeNames.Put(code, name);
 		}

 		///
@@ -361,21 +361,21 @@
 		{
 			castTypeNames.Put(code, capacity, name);
 		}
-
-		///
-		/// Get the name of the database type appropriate for casting operations
-		/// (via the CAST() SQL function) for the given <see cref="SqlType"/> typecode.
-		///
-		/// <param name="sqlType">The <see cref="SqlType"/> typecode </param>
-		/// <returns> The database type name </returns>
-		public override string GetCastTypeName(SqlType sqlType)
-		{
-			string result = castTypeNames.Get(sqlType.DbType, Column.DefaultLength, Column.DefaultPrecision, Column.DefaultScale);
-			if (result == null)
-			{
-				throw new HibernateException(string.Format("No CAST() type mapping for SqlType {0}", sqlType));
-			}
-			return result;
-		}
-	}
+
+		///
+		/// Get the name of the database type appropriate for casting operations
+		/// (via the CAST() SQL function) for the given <see cref="SqlType"/> typecode.
+		///
+		/// <param name="sqlType">The <see cref="SqlType"/> typecode </param>
+		/// <returns> The database type name </returns>
+		public override string GetCastTypeName(SqlType sqlType)
+		{
+			string result = castTypeNames.Get(sqlType.DbType, Column.DefaultLength, Column.DefaultPrecision, Column.DefaultScale);
+			if (result == null)
+			{
+				throw new HibernateException(string.Format("No CAST() type mapping for SqlType {0}", sqlType));
+			}
+			return result;
+		}
+	}
 }


remove unnecessary sampling

remove unnecessary sampling

--- src/Numerics/Distributions/Logistic.cs
+++ src/Numerics/Distributions/Logistic.cs
@@ -326,8 +326,7 @@
             {
                 return;
             }
-            var uniform = rnd.NextDoubles(values.Length);
-
+
             for (int i = 0; i < values.Length; i++)
             {
                 values[i] = SampleUnchecked(rnd, mean, scale);


git diff --cached

git diff --cached

--- src/Pomelo.NetCore.Node/Hubs/GitHub.cs
+++ src/Pomelo.NetCore.Node/Hubs/GitHub.cs
@@ -146,7 +146,7 @@
                 var proc = new Process();
                 proc.StartInfo.WorkingDirectory = Path.Combine(Config.RootPath, projectName);
                 proc.StartInfo.FileName = "git";
-                proc.StartInfo.Arguments = "--no-pager diff --no-color";
+                proc.StartInfo.Arguments = "--no-pager diff --no-color --cached";
                 proc.StartInfo.RedirectStandardError = true;
                 proc.StartInfo.RedirectStandardOutput = true;
                 proc.StartInfo.RedirectStandardInput = true;


Move namespace

Move namespace

--- src/PublicApiGenerator.Tool/Program.cs
+++ src/PublicApiGenerator.Tool/Program.cs
@@ -1,10 +1,10 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using Process = System.Diagnostics.Process;
-
-namespace PubliApiGenerator.Tool
+namespace PublicApiGenerator.Tool
 {
+    using System;
+    using System.Diagnostics;
+    using System.IO;
+    using Process = System.Diagnostics.Process;
+
     /// <summary>
     /// Program for dotnet tool
     /// </summary>


add option to disable get / form / query for JsonFilter

--- src/Serenity.Net.Web/Mvc/JsonFilter.cs
+++ src/Serenity.Net.Web/Mvc/JsonFilter.cs
@@ -2,145 +2,131 @@
 using System;
 using System.IO;
 using System.Linq;
-#if !ASPNETMVC
+using System.Globalization;
 using Microsoft.AspNetCore.Mvc.Controllers;
 using Microsoft.AspNetCore.Mvc.Filters;
-#else
-using System.Web.Mvc;
-#endif
+using Microsoft.AspNetCore.Http;

 namespace Serenity.Services
 {
     public class JsonFilter : ActionFilterAttribute
     {
+        public JsonFilter()
+        {
+            ParamName = "request";
+        }
+
         public override void OnActionExecuting(ActionExecutingContext filterContext)
         {
+            if (filterContext == null)
+                throw new ArgumentNullException(nameof(filterContext));
+
             var request = filterContext.HttpContext.Request;
-#if !ASPNETMVC
             string method = request.Method ?? "";
-#else
-            string method = request.HttpMethod ?? "";
-#endif
             var prms = filterContext.ActionDescriptor
-#if !ASPNETMVC
                 .Parameters
-#else
-                .GetParameters()
-#endif
                 .Where(x => !x.ParameterType.IsInterface);

-            if (!prms.Any())
+            if (!prms.Any() || string.IsNullOrEmpty(ParamName))
                 return;

             if (prms.Count() != 1)
             {
-#if !ASPNETMVC
-                prms = prms.Where(x => x.Name == "request");
-#else
-                prms = prms.Where(x => x.ParameterName == "request");
-#endif
+                prms = prms.Where(x => x.Name == ParamName);

                 if (prms.Count() != 1)
-                    throw new ArgumentOutOfRangeException(string.Format(
+                    throw new ArgumentOutOfRangeException(string.Format(CultureInfo.CurrentCulture,
                         "Method {0} has {1} parameters. JsonFilter requires an action method with only one parameter," +
-                        "or a parameter with name 'request'!",
-#if !ASPNETMVC
-                            ((ControllerActionDescriptor)filterContext.ActionDescriptor).ActionName, filterContext.ActionDescriptor.Parameters.Count));
-#else
-                            filterContext.ActionDescriptor.ActionName, filterContext.ActionDescriptor.GetParameters().Length));
-#endif
+                        "or a parameter with name '{2}'!",
+                            ((ControllerActionDescriptor)filterContext.ActionDescriptor).ActionName,
+                            filterContext.ActionDescriptor.Parameters.Count,
+                            ParamName));
             }

             var prm = prms.Single();

-#if !ASPNETMVC
             if (method.Equals("POST", StringComparison.OrdinalIgnoreCase) ||
                 method.Equals("PUT", StringComparison.OrdinalIgnoreCase))
-#else
-            if (method.Equals("POST", StringComparison.InvariantCultureIgnoreCase) ||
-                method.Equals("PUT", StringComparison.InvariantCultureIgnoreCase))
-#endif
             {
                 if ((request.ContentType ?? string.Empty)
-                    .Contains("application/json"))
+                    .Contains("application/json", StringComparison.OrdinalIgnoreCase))
                 {
-                    if (request.ContentLength == 0 &&
-#if !ASPNETMVC
-                        !((string)request.Headers["HTTP_VIA"]).IsTrimmedEmpty())
-#else
-                        !request.Headers["HTTP_VIA"].IsTrimmedEmpty())
-#endif
-                        throw new InvalidDataException("Sunucuya gelen isteğin gövdesi boş! " +
-                            "Sisteme bir vekil sunucu (proxy) üzerinden bağlandınız. Sorun bundan kaynaklanıyor olabilir. " +
-                            "Lütfen sunucu adresini tarayıcınızın istisna listesine ekleyiniz.");
-
-#if !ASPNETMVC
                     if (filterContext.HttpContext.Request.Body.CanSeek)
                         filterContext.HttpContext.Request.Body.Seek(0, SeekOrigin.Begin);

                     using (var sr = new StreamReader(filterContext.HttpContext.Request.Body,
-                        System.Text.Encoding.GetEncoding((string)filterContext.HttpContext.Request.Headers["Content-Encoding"] ?? "utf-8"), true, 4096, true))
-#else
-                    if (filterContext.HttpContext.Request.InputStream.CanSeek)
-                        filterContext.HttpContext.Request.InputStream.Seek(0, SeekOrigin.Begin);
-
-                    using (var sr = new StreamReader(filterContext.HttpContext.Request.InputStream,
-                        filterContext.HttpContext.Request.ContentEncoding, true, 4096, true))
-#endif
-
+                        System.Text.Encoding.GetEncoding((string)filterContext.HttpContext
+                            .Request.Headers["Content-Encoding"] ?? "utf-8"), true, 4096, true))
                     {
                         var js = JsonSerializer.Create(JsonSettings.Strict);
                         using (var jr = new JsonTextReader(sr))
                         {
                             var obj = js.Deserialize(jr, prm.ParameterType);
-#if !ASPNETMVC
                             filterContext.ActionArguments[prm.Name] = obj;
-#else
-                            filterContext.ActionParameters[prm.ParameterName] = obj;
-#endif
                         }
                     }
                 }
-                else
+                else
                 {
-#if !ASPNETMVC
-                    string req = (string)request.Form[prm.Name] ?? (string)request.Query[prm.Name] ??
-                            (string)request.Form["request"] ?? request.Query["request"];
-#else
-                    string req = request.Form[prm.ParameterName] ?? request.QueryString[prm.ParameterName] ??
-                            request.Form["request"] ?? request.QueryString["request"];
-#endif
+                    var req = FromFormOrQuery(request, prm.Name);
                     if (req != null)
                     {
                         var obj = JsonConvert.DeserializeObject(req, prm.ParameterType, JsonSettings.Strict);
-#if !ASPNETMVC
                         filterContext.ActionArguments[prm.Name] = obj;
-#else
-                        filterContext.ActionParameters[prm.ParameterName] = obj;
-#endif
                     }
                 }
             }
-            else
+            else if ((AllowGet ?? DefaultAllowGet) &&
+                method.Equals("GET", StringComparison.OrdinalIgnoreCase))
             {
-#if !ASPNETMVC
-                string req = (string)request.Form[prm.Name] ?? (string)request.Query[prm.Name] ??
-                        (string)request.Form["request"] ?? request.Query["request"];
-#else
-                string req = request.Form[prm.ParameterName] ?? request.QueryString[prm.ParameterName] ??
-                        request.Form["request"] ?? request.QueryString["request"];
-#endif
-
+                var req = FromFormOrQuery(request, prm.Name);
                 if (req != null)
                 {
                     var obj = JsonConvert.DeserializeObject(req, prm.ParameterType, JsonSettings.Strict);
-#if !ASPNETMVC
                     filterContext.ActionArguments[prm.Name] = obj;
-#else
-                    filterContext.ActionParameters[prm.ParameterName] = obj;
-#endif
                 }
             }
         }
+
+        private string FromFormOrQuery(HttpRequest request, string name)
+        {
+            var allowForm = AllowForm ?? DefaultAllowForm;
+            var allowQuery = AllowQuery ?? DefaultAllowQuery;
+            if (!allowForm && !allowQuery)
+                return null;
+
+            string value;
+            if (allowForm)
+            {
+                value = request.Form[name];
+                if (value != null)
+                    return value;
+            }
+
+            if (allowQuery)
+            {
+                value = request.Query[name];
+                if (value != null)
+                    return value;
+            }
+
+            if (name != ParamName && !string.IsNullOrEmpty(ParamName))
+                return FromFormOrQuery(request, ParamName);
+
+            if (name != "request")
+                return FromFormOrQuery(request, "request");
+
+            return null;
+        }
+
+        public string ParamName { get; set; }
+
+        public bool? AllowGet { get; set; }
+        public bool? AllowQuery { get; set; }
+        public bool? AllowForm { get; set; }
+
+        public static bool DefaultAllowGet { get; set; } = true;
+        public static bool DefaultAllowQuery { get; set; } = true;
+        public static bool DefaultAllowForm { get; set; } = true;
     }
 }


DebuggerDisplay added to UnitOfWork

DebuggerDisplay added to UnitOfWork

--- src/Stove/Domain/Uow/UnitOfWorkBase.cs
+++ src/Stove/Domain/Uow/UnitOfWorkBase.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Collections.Immutable;
+using System.Diagnostics;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
@@ -16,6 +17,7 @@
     /// <summary>
     ///     Base for all Unit Of Work classes.
     /// </summary>
+    [DebuggerDisplay("Id = {" + nameof(Id) + "}")]
     public abstract class UnitOfWorkBase : IUnitOfWork
     {
         private readonly List<DataFilterConfiguration> _filters;


src/WWT.Caching/WwtStreamSerializer.cs: decrease a log message to Debug level

--- src/WWT.Caching/WwtStreamSerializer.cs
+++ src/WWT.Caching/WwtStreamSerializer.cs
@@ -10,14 +10,17 @@
 namespace WWT
 {
     /// <summary>
-    /// This implements a serializer and transformer for the caching library to manager Streams. Streams pose two problems while caching:
-    ///
-    /// 1. Streams modify state while being read and cannot be reread without resetting the position
-    /// 2. Not all streams support the ability to reset position
-    ///
-    /// This then hooks into the caching mechanism to transform any stream to a MemoryStream which will then have a byte[] available which is
-    /// used during the serialization process. By using a transformer, it can do this copy using async methods and ensure the resulting
-    /// stream can be reset.
+    /// This implements a serializer and transformer for the caching library to
+    /// manager Streams. Streams pose two problems while caching:
+    ///
+    /// 1. Streams modify state while being read and cannot be reread without
+    ///    resetting the position
+    /// 2. Not all streams support the ability to reset position.
+    ///
+    /// This then hooks into the caching mechanism to transform any stream to a
+    /// MemoryStream which will then have a byte[] available which is used
+    /// during the serialization process. By using a transformer, it can do this
+    /// copy using async methods and ensure the resulting stream can be reset.
     /// </summary>
     internal class WwtStreamSerializer : ICacheSerializer, IResultTransformer<Stream>
     {
@@ -70,7 +73,7 @@
         {
             if (input is null)
             {
-                _logger.LogInformation("Input to serialize was null.");
+                _logger.LogDebug("Input to serialize was null.");
                 return null;
             }


converted scenario step storage from List to Queue

--- src/Xbehave.Net40/Internal/Scenario.cs
+++ src/Xbehave.Net40/Internal/Scenario.cs
@@ -18,11 +18,11 @@
         private readonly ICommandFactory thenTestFactory;
         private readonly ICommandFactory thenSkipTestFactory;

-        private readonly List<Step> givens = new List<Step>();
-        private readonly List<Step> whens = new List<Step>();
-        private readonly List<Step> thens = new List<Step>();
-        private readonly List<Step> thensInIsolation = new List<Step>();
-        private readonly List<Step> thenSkips = new List<Step>();
+        private readonly Queue<Step> givens = new Queue<Step>();
+        private readonly Queue<Step> whens = new Queue<Step>();
+        private readonly Queue<Step> thens = new Queue<Step>();
+        private readonly Queue<Step> thensInIsolation = new Queue<Step>();
+        private readonly Queue<Step> thenSkips = new Queue<Step>();
 #if NET40
         private readonly dynamic context = new ExpandoObject();
 #endif
@@ -46,27 +46,27 @@
 #endif
         public Step Given(string message, Func<IDisposable> arrange)
         {
-            return AddStep(this.givens, message, arrange);
+            return Enqueue(this.whens, new Step(message, arrange));
         }

         public Step When(string message, Func<IDisposable> action)
         {
-            return AddStep(this.whens, message, action);
+            return Enqueue(this.whens, new Step(message, action));
         }

         public Step ThenInIsolation(string message, Func<IDisposable> assert)
         {
-            return AddStep(this.thensInIsolation, message, assert);
+            return Enqueue(this.thensInIsolation, new Step(message, assert));
         }

         public Step Then(string message, Func<IDisposable> assert)
         {
-            return AddStep(this.thens, message, assert);
+            return Enqueue(this.thens, new Step(message, assert));
         }

         public Step ThenSkip(string message, Func<IDisposable> assert)
         {
-            return AddStep(this.thenSkips, message, assert);
+            return Enqueue(this.thenSkips, new Step(message, assert));
         }

         public IEnumerable<ITestCommand> GetTestCommands(IMethodInfo method)
@@ -77,10 +77,9 @@
                .Concat(this.thenSkipTestFactory.Create(contextSteps, this.thenSkips, method));
         }

-        private static Step AddStep(IList<Step> list, string message, Func<IDisposable> func)
+        private static Step Enqueue(Queue<Step> list, Step step)
         {
-            var step = new Step(message, func);
-            list.Add(step);
+            list.Enqueue(step);
             return step;
         }
     }


SetDefaultLifetime as a method

SetDefaultLifetime as a method

--- src/tests/ExistsForAll.Shepherd.DependencyInjection.UnitTests/ShepherdTests.cs
+++ src/tests/ExistsForAll.Shepherd.DependencyInjection.UnitTests/ShepherdTests.cs
@@ -15,6 +15,7 @@
 		{
 			var sut = new ServiceCollection()
 			    .Scan(x => x.WithAssembly<INoImplInterface>()
+				    .SetDefaultLifetime(ServiceLifetime.Singleton)
 			        .WithOptions(o => o.ServiceIndexer
 				        .Filters
 				        .Add(new InterfaceAccumulationFilter(typeof(IFilterService)))));


suppressed CA1031 in ScenarioAttribute

suppressed CA1031 in ScenarioAttribute

--- src/Xbehave.Net40/ScenarioAttribute.cs
+++ src/Xbehave.Net40/ScenarioAttribute.cs
@@ -47,6 +47,10 @@
             return scenarioDefinitions.SelectMany(definition => CreateCommands(method, definition));
         }

+        [SuppressMessage(
+            "Microsoft.Design",
+            "CA1031:DoNotCatchGeneralExceptionTypes",
+            Justification = "Required to prevent infinite loops in test runners (TestDrive.NET, Resharper) when they are allowed to handle exceptions.")]
         private static IEnumerable<ITestCommand> CreateCommands(IMethodInfo method, ITestCommand scenarioDefinition)
         {
             var feature = method.IsStatic ? null : method.CreateInstance();


Fixed test AT_077

Fixed test AT_077

--- SabberStoneCoreTest/src/CardSets/TgtCardsGenTest.cs
+++ SabberStoneCoreTest/src/CardSets/TgtCardsGenTest.cs
@@ -1522,23 +1522,23 @@
 				Player1HeroClass = CardClass.PALADIN,
 				Player1Deck = new List<Card>
 				{
-					Cards.FromName("Sen'jin Shieldmasta"),
-					Cards.FromName("Sen'jin Shieldmasta"),
+					Cards.FromName("Sen'jin Shieldmasta"), // 4-cost
+					Cards.FromName("Sen'jin Shieldmasta"),
+					Cards.FromName("Grimestreet Enforcer"), // 5-cost
 					Cards.FromName("Grimestreet Enforcer"),
-					Cards.FromName("Grimestreet Enforcer"),
-					Cards.FromName("Tirion Fordring"),
-					Cards.FromName("Argent Commander"),
+					Cards.FromName("Tirion Fordring"), // 8-cost
+					Cards.FromName("Argent Commander"), // 6-cost
 					Cards.FromName("Argent Commander"),
 				},
 				Player2HeroClass = CardClass.PALADIN,
 				Player2Deck = new List<Card>
 				{
-					Cards.FromName("Sir Finley Mrrgglton"),
+					Cards.FromName("Sir Finley Mrrgglton"), // 1-cost
+					Cards.FromName("Worgen Infiltrator"), // 2-cost
 					Cards.FromName("Worgen Infiltrator"),
-					Cards.FromName("Worgen Infiltrator"),
+					Cards.FromName("Acolyte of Pain"), // 3-cost
 					Cards.FromName("Acolyte of Pain"),
-					Cards.FromName("Acolyte of Pain"),
-					Cards.FromName("Argent Horserider"),
+					Cards.FromName("Argent Horserider"), // 3-cost
 					Cards.FromName("Argent Horserider"),
 				},
 				FillDecks = false,
@@ -1547,7 +1547,7 @@
 			game.StartGame();
 			game.Player1.BaseMana = 10;
 			game.Player2.BaseMana = 10;
-			var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Argent Lance"));
+			IPlayable testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Argent Lance"));
 			game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard));
 			Assert.NotNull(game.CurrentPlayer.Hero.Weapon);
 			Assert.Equal(3, game.CurrentPlayer.Hero.Weapon.Durability);


Writing a string

Writing a string

--- Tui/Screen.cs
+++ Tui/Screen.cs
@@ -219,6 +219,24 @@
             Draw(x, y);
         }

+        public void WriteString(string str, int x, int y)
+        {
+            for (int i = 0; i < str.Length; i++)
+            {
+                WriteChar(str[i], x, y);
+                x++;
+                if (x >= Width)
+                {
+                    x = 0;
+                    y++;
+                    if (y >= Height)
+                    {
+                        y = 0;
+                    }
+                }
+            }
+        }
+
         public Timer StartTimer(TimeSpan interval)
         {
             Timer timer = new Timer();


unity plugin demo fixes

unity plugin demo fixes

--- unity_plugin/unity_src/Assets/OpenIAB-demo/OpenIABTest.cs
+++ unity_plugin/unity_src/Assets/OpenIAB-demo/OpenIABTest.cs
@@ -47,13 +47,15 @@
             // Application public key
             var public_key = "key";

-            // Transmit list of supported stores
-            OpenIAB.init(new Dictionary<string, string> {
+            var options = new Options();
+            options.verifyMode = OptionsVerifyMode.VERIFY_SKIP;
+            options.storeKeys = new Dictionary<string, string> {
                 {OpenIAB_Android.STORE_GOOGLE, public_key},
-                {OpenIAB_Android.STORE_TSTORE, public_key},
-                {OpenIAB_Android.STORE_SAMSUNG, public_key},
                 {OpenIAB_Android.STORE_YANDEX, public_key}
-            });
+            };
+
+            // Transmit options and start the service
+            OpenIAB.init(options);
         }

         if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Purchase")) {


change order

change order

--- src/esencialAdmin/Services/PdfGenerationService.cs
+++ src/esencialAdmin/Services/PdfGenerationService.cs
@@ -87,7 +87,7 @@
                             (x.FkSubscriptionStatus == filter.statusID || filterStatus) &&
                             (x.SubscriptionPhotos.Count == 0)
                             select new { Firstname = x.FkCustomer.FirstName, Lastname = x.FkCustomer.LastName, PlantNr = x.PlantNumber }
-                            ).OrderBy(c => c.Lastname).ThenBy(c => c.Firstname).ToList();
+                            ).OrderBy(c => c.PlantNr).ThenBy(c => c.Lastname).ToList();

             //((x.Periodes.Any(c => c.PeriodesGoodies.Any(y => y.Received == false && y.SubPeriodeYear <= currentYear))) || !filter.Goody)
             List<PdfSinglePictureTemplateViewModel> labelList = new List<PdfSinglePictureTemplateViewModel>();


no message

no message

--- SmartDataViewer/Assets/DemoEntity/SupportsConfig.cs
+++ SmartDataViewer/Assets/DemoEntity/SupportsConfig.cs
@@ -27,6 +27,7 @@
 {
 	public Supports()
 	{
+		testFloat = 0;
 		boolList = new List<bool>();
 		description = string.Empty;
 		colorList = new List<Color>();
@@ -38,6 +39,7 @@
 		testPointlist = new List<Vector2>();
 		testPointlist3 = new List<Vector3>();
 		testPointlist4 = new List<Vector4>();
+		floatList = new List<float>();
 	}


Framework.Gac.cs: Correction to LogError message

--- Solutions/Main3.5/MSBuildFramework/Framework/Gac.cs
+++ Solutions/Main3.5/MSBuildFramework/Framework/Gac.cs
@@ -226,7 +226,7 @@
                 {
                     if (string.IsNullOrEmpty(this.RemoteAssemblyPath))
                     {
-                        this.Log.LogError("RemotePath is Required");
+                        this.Log.LogError("RemoteAssemblyPath is Required");
                         return;
                     }


Restore code to add rules so the NotifyDataErrorInfo test works. bugid: 776

--- Source/Csla.test/ValidationRules/ValidationTests.cs
+++ Source/Csla.test/ValidationRules/ValidationTests.cs
@@ -634,6 +634,13 @@
       get { return GetProperty(Value2Property); }
       set { SetProperty(Value2Property, value); }
     }
+
+    protected override void AddBusinessRules()
+    {
+      base.AddBusinessRules();
+      BusinessRules.AddRule(new TwoProps(Value1Property, Value2Property));
+      BusinessRules.AddRule(new TwoProps(Value2Property, Value1Property));
+    }
   }

   public class TwoProps : Csla.Rules.BusinessRule


TreeListBox: Check items when removing.

TreeListBox: Check items when removing.

OTD 9734: No clear error message when importing old js file.

The item will not be added into TreeList if the property isExpanded of
its parent is false. Then we will get error if we try to remove this
item(from script).

--- Source/PropertyTools.Wpf/TreeListBox/TreeListBox.cs
+++ Source/PropertyTools.Wpf/TreeListBox/TreeListBox.cs
@@ -636,19 +636,22 @@
             while (queue.Count > 0)
             {
                 var item = queue.Dequeue();
-                if (this.isExpanded[item])
+                if (this.Items.Contains(item))
                 {
-                    IList children;
-                    if (this.itemToChildrenMap.TryGetValue(item, out children) && children != null)
+                    if (this.isExpanded[item])
                     {
-                        foreach (var child in children)
+                        IList children;
+                        if (this.itemToChildrenMap.TryGetValue(item, out children) && children != null)
                         {
-                            queue.Enqueue(child);
+                            foreach (var child in children)
+                            {
+                                queue.Enqueue(child);
+                            }
                         }
                     }
+
+                    this.RemoveItem(item);
                 }
-
-                this.RemoveItem(item);
             }
         }


-added a few illusion types -added a few more effects

--- SpellParser.cs
+++ SpellParser.cs
@@ -36,7 +36,10 @@
         CHA = 10,
         Current_Mana = 15,
         Fear = 23,
+        Mesmerize = 31,
         Summon_Item = 32,
+        Disease_Counter = 35,
+        Poison_Counter = 36,
         Invulnerability = 40,
         Lycanthropy = 44,
         Fire_Resist = 46,
@@ -45,11 +48,12 @@
         Disease_Resist = 49,
         Magic_Resist = 50,
         Rune = 55,
+        Levitate = 57,
         Damage_Shield = 59,
         Assist_Radius = 86,
         Max_HP = 69,
         Max_Mana = 97,
-        Add_Spell_Proc = 100,
+        Current_HP_Repeating = 100,
         Current_HP_Percent = 147,
         Mana_Burn = 350,
         Corruption_Counter = 369,
@@ -146,7 +150,7 @@

     public enum SpellTarget
     {
-        Directional = 1,
+        Line_of_Sight = 1,
         Caster_AE = 2,
         Caster_Group = 3,
         Caster_PB = 4,
@@ -165,6 +169,7 @@
         Hatelist = 33,
         Chest = 34,
         Target_Group = 41,
+        Directional = 42
     }

     public enum SpellIllusion
@@ -185,20 +190,39 @@
         Werewolf = 14,
         Brownie = 15,
         Centaur = 16,
-        Golem = 17,
         Froglok = 26,
         Froglok_Ghoul = 27,
         Gargoyle = 29,
         Wolf = 42,
         Bear = 43,
         Imp = 46,
-        Elemental = 75,
-        Skeleton = 85,
+        Elemental = 75, // has subtypes
+        Scarecrow = 82,
+        //Skeleton = 85,
         Iksar = 128,
-        Iksar_Skeleton = 161,
+        Kunark_Goblin = 137,
+        Tree = 143,
+        Iksar_Skeleton = 161,
+        Guktan = 330,
+        Scaled_Wolf = 356,
+        Skeleton = 367,
+        Golem = 374, // has subtypes
+        Pyrilen = 411,
+        Goblin = 433, // has subtypes
+        Basilisk = 436,
+        Gnomework = 457,
         Orc = 458,
+        Stone_Gargoyle = 464,
+        Evil_Eye = 469,
+        Minotaur = 470,
         Zombie = 471,
-        Drakkin = 522
+        Fairy = 473,
+        Spectre = 485,
+        Banshee = 487,
+        Scrykin = 495, // has subtypes
+        Bixie = 520,
+        Drakkin = 522,
+        Hideous_Harpy = 527
     }

     public class Spell
@@ -447,6 +471,7 @@
                 // it's a bit of a hack to put this here
                 if (calc == 123)
                     spell.Slots[i] += " (avg/random)";
+
                 if (calc == 107 || calc == 108 || calc == 120 || calc == 122)
                     spell.Slots[i] += " (avg/growing)";

@@ -787,7 +812,7 @@
                 case 57:
                     return "Levitate";
                 case 58:
-                    return String.Format("Illusion: {0}", TrimEnum((SpellIllusion)value));
+                    return String.Format("Illusion: {0} ({1})", TrimEnum((SpellIllusion)value), value2);
                 case 59:
                     return FormatCount("Damage Shield", -value);
                 case 61:
@@ -857,7 +882,7 @@
                     return "Sacrifice";
                 case 96:
                     // silence, but named this way to match melee version
-                    return "Prevent Casting";
+                    return "Prevent Spell Casting";
                 case 97:
                     return FormatCount("Max Mana", value);
                 case 98:
@@ -1082,6 +1107,8 @@
                     return FormatCount(TrimEnum((SpellSkill)value2) + " Damage Bonus", value);
                 case 227:
                     return String.Format("Reduce {0} Timer by {1}s", TrimEnum((SpellSkill)value2), value);
+                case 232:
+                    return String.Format("Divine Save: [Spell {0}] Chance: {1}%", value2, value);
                 case 258:
                     return String.Format("Triple Backstab ({0})", value);
                 case 262:
@@ -1150,7 +1177,8 @@
                 case 333:
                     return String.Format("Cast on Fade/Cancel: [Spell {0}]", value);
                 case 335:
-                    return "Prevent Spell Matching Limits from Landing";
+                    // prevent spells that match limit rules from landing
+                    return "Prevent Spell Landing On Match";
                 case 337:
                     return FormatPercent("Experience Gain", value);
                 case 339:
@@ -1172,6 +1200,8 @@
                     return String.Format("Aura Effect: [Spell {0}]", spell.ID + 3);
                 case 360:
                     return String.Format("Add Killshot Proc: [Spell {0}] Chance: {1}%", value2, value);
+                case 367:
+                    return String.Format("Transform Body Type ({0})", value);
                 case 368:
                     return String.Format("Faction {0} Modifier: {1}", value, value2);
                 case 369:
@@ -1194,6 +1224,10 @@
                     return String.Format("Cast on Fade: [Spell {0}]", value);
                 case 381:
                     return "Call of Hero";
+                case 382:
+                    return String.Format("Inhibit Buff Effect: {0}", TrimEnum((SpellEffect)Math.Abs(value2)));
+                case 383:
+                    return String.Format("Cast on Match: [Spell {0}] Chance: {1}%", value2, value);
                 case 385:
                     return String.Format("Limit Spells: {1}[Group {0}]", Math.Abs(value), value >= 0 ? "" : "Exclude ");
                 case 392:


Made example easier

Made example easier

git-svn-id: 863145cc519c2863d1f5bf616d0af53f127ae11a@27 d67282b6-fa03-11dd-a7be-4b3ef3b0700c

--- tar/Program.cs
+++ tar/Program.cs
@@ -17,7 +17,6 @@
                 dataSize -= 512;
                 yield return buffer;
             }
-
         }

         private static void Main(string[] args)
@@ -28,44 +27,9 @@
                 return;
             }

-            if(args.Length == 2 && args[0] == "--test-big")
+            using(var archUsTar = File.Create(args[0]))
             {
-                using(var file = File.Create(args[1]))
-                using(var tar = new UsTarWriter(file))
-                {
-                    IEnumerator<byte[]> i = NextDataBlock(9255295864);
-
-                    tar.Write("bigFile.bin", 9255295864, "v", "v", 0777, DateTime.Now, delegate(IDataWriter writer)
-                    {
-//                        i.MoveNext();
-//                        byte[] current = i.Current;
-//                        writer.Write(current, current.Length);
-                    });
-                }
-
-                return;
-            }
-
-            using (FileStream archiveFile = File.Create(args[0]))
-            {
-                using (TarWriter tar = new TarWriter(archiveFile))
-                {
-                    for (int i = 1; i < args.Length; ++i)
-                    {
-                        tar.Write(args[i]);
-                    }
-                    MemoryStream stream = new MemoryStream();
-                    StreamWriter writer = new StreamWriter(stream);
-                    writer.WriteLine("This archive created with tar-cs.");
-                    writer.Flush();
-                    stream.Position = 0;
-                    tar.Write(stream, stream.Length, "README.TXT");
-                }
-            }
-
-            using(var archUsTar = File.Create(args[0]+".ustar.tar"))
-            {
-                using(var tar = new UsTarWriter(archUsTar))
+                using(var tar = new TarWriter(archUsTar))
                 {
                     for (int i = 1; i < args.Length; ++i)
                     {


Don't fetch the IViewManager every time the model changes

--- Stylet/View.cs
+++ Stylet/View.cs
@@ -11,7 +11,13 @@
 {
     public class View : DependencyObject
     {
-        static readonly ContentPropertyAttribute DefaultContentProperty = new ContentPropertyAttribute("Content");
+        private static readonly ContentPropertyAttribute defaultContentProperty = new ContentPropertyAttribute("Content");
+        private static IViewManager viewManager;
+
+        static View()
+        {
+            viewManager = IoC.Get<IViewManager>();
+        }

         public static object GetActionTarget(DependencyObject obj)
         {
@@ -37,13 +43,13 @@
         }

         public static readonly DependencyProperty ModelProperty =
-            DependencyProperty.RegisterAttached("Model", typeof(object), typeof(View), new PropertyMetadata(null, (d, e) => IoC.Get<IViewManager>().OnModelChanged(d, e) ));
+            DependencyProperty.RegisterAttached("Model", typeof(object), typeof(View), new PropertyMetadata(null, (d, e) => viewManager.OnModelChanged(d, e) ));

         public static void SetContentProperty(DependencyObject targetLocation, UIElement view)
         {
             var type = targetLocation.GetType();
-            var contentProperty = Attribute.GetCustomAttributes(type, true).OfType<ContentPropertyAttribute>().FirstOrDefault() ?? DefaultContentProperty;
+            var contentProperty = Attribute.GetCustomAttributes(type, true).OfType<ContentPropertyAttribute>().FirstOrDefault() ?? defaultContentProperty;

             type.GetProperty(contentProperty.Name).SetValue(targetLocation, view, null);
         }


Simplify IsAsync

Simplify IsAsync

A possible reason for the somewhat odd implementation.
`IsAsync` was introduced in be215cf5ef9a21857bd6deddfd9bf48ba0cc3517 and released as part of 3.5.0.
`AsyncStateMachineAttribute` was introduced in net45, but with FA 3.5.0 we still supported net40.

--- Src/FluentAssertions/Common/MethodInfoExtensions.cs
+++ Src/FluentAssertions/Common/MethodInfoExtensions.cs
@@ -18,7 +18,7 @@

         internal static bool IsAsync(this MethodInfo methodInfo)
         {
-            return methodInfo.GetMatchingAttributes<Attribute>(a => a.GetType().FullName == "System.Runtime.CompilerServices.AsyncStateMachineAttribute").Any();
+            return methodInfo.IsDecoratedWith<AsyncStateMachineAttribute>();
         }

         internal static IEnumerable<TAttribute> GetMatchingAttributes<TAttribute>(this MemberInfo memberInfo, Expression<Func<TAttribute, bool>> isMatchingAttributePredicate)


missing fix

missing fix

--- webapp-net/SmartTarget/Mapping/SmartTargetModelBuilder.cs
+++ webapp-net/SmartTarget/Mapping/SmartTargetModelBuilder.cs
@@ -197,14 +197,10 @@
             const string allowDuplicatesFieldName = "allowDuplicationOnSamePage";
             const string allowDuplicatesConfig = "smarttarget.allowDuplicationOnSamePageConfig";

-            string allowDuplicates;
+            string allowDuplicates = null;
             if (pageTemplate != null && pageTemplate.MetadataFields != null && pageTemplate.MetadataFields.ContainsKey(allowDuplicatesFieldName))
             {
                 allowDuplicates = pageTemplate.MetadataFields[allowDuplicatesFieldName].Value;
-            }
-            else
-            {
-                allowDuplicates = "true";
             }

             if (String.IsNullOrEmpty(allowDuplicates) || allowDuplicates.Equals("Use core configuration", StringComparison.OrdinalIgnoreCase))


added time scale tweening

added time scale tweening

--- TimeManager.cs
+++ TimeManager.cs
@@ -56,6 +56,8 @@
         public const float NORMAL_TIME = 1f;
         public const float FREEZE_TIME = 0f;

+        private static ITween _timeScaleTween;
+
         public static float TimeScale
         {
             get
@@ -64,8 +66,34 @@
             }
             set
             {
+                stopTimeScaleTween();
+
                 Time.timeScale = value;
             }
+        }
+
+        private static void stopTimeScaleTween()
+        {
+            if (_timeScaleTween != null)
+            {
+                _timeScaleTween.Pause();
+                _timeScaleTween = null;
+            }
+        }
+
+        public static void TweenTimeScale(EasingFunctions.EasingFunction p_easingFunction, double p_from, double p_to, double p_duration)
+        {
+            stopTimeScaleTween();
+
+            Time.timeScale = (float) p_from;
+
+            _timeScaleTween = TweenManager.CreateTween(p_easingFunction, p_duration).OnStep((double p_value) => {
+
+                Time.timeScale = (float) (p_from + (p_to - p_from) * p_value);
+            }).OnFinish((double p_value) => {
+
+                Time.timeScale = (float) p_to;
+            }).Start();
         }

         public static ITimeStamp CreateTimeStamp()


inline LzoStream.GetByte

inline LzoStream.GetByte

--- src/LzoStream.cs
+++ src/LzoStream.cs
@@ -98,20 +98,14 @@

         private void DecodeFirstByte()
         {
-            Instruction = GetByte();
+            Instruction = _base.ReadByte();
+            InputPosition++;
+            if (Instruction == -1)
+                throw new EndOfStreamException();
             if (Instruction > 15 && Instruction <= 17)
             {
                 throw new Exception();
             }
-        }
-
-        private byte GetByte()
-        {
-            var result = _base.ReadByte();
-            InputPosition++;
-            if (result == -1)
-                throw new EndOfStreamException();
-            return (byte)result;
         }

         private void Copy(byte[] buffer, int offset, int count)
@@ -139,11 +133,10 @@
                 /*
                  * Depends on the number of literals copied by the last instruction.
                  */
-                int distance;
-                int length;
                 switch (State)
                 {
                     case LzoState.ZeroCopy:
+                    {
                         /*
                          * this encoding will be a copy of 4 or more literal, and must be interpreted
                          * like this :                         *
@@ -151,7 +144,7 @@
                          * length = 3 + (L ?: 15 + (zero_bytes * 255) + non_zero_byte)
                          * state = 4  (no extra literals are copied)
                          */
-                        length = 3;
+                        var length = 3;
                         if (Instruction != 0)
                         {
                             length += Instruction;
@@ -163,8 +156,8 @@
                         if (length > count)
                         {
                             Copy(buffer, offset, count);
-                            DecodedBuffer = new byte[length-count];
-                            Copy(DecodedBuffer, 0, length-count);
+                            DecodedBuffer = new byte[length - count];
+                            Copy(DecodedBuffer, 0, length - count);
                             read = count;
                         }
                         else
@@ -173,41 +166,15 @@
                             read = length;
                         }
                         State = LzoState.LargeCopy;
+                    }
                         break;
                     case LzoState.SmallCopy1:
                     case LzoState.SmallCopy2:
                     case LzoState.SmallCopy3:
-                        /*
-                         * the instruction is a copy of a
-                         * 2-byte block from the dictionary within a 1kB distance. It is worth
-                         * noting that this instruction provides little savings since it uses 2
-                         * bytes to encode a copy of 2 other bytes but it encodes the number of
-                         * following literals for free. It must be interpreted like this :
-                         *
-                         * 0 0 0 0 D D S S  (0..15)  : copy 2 bytes from <= 1kB distance
-                         * length = 2
-                         * state = S (copy S literals after this block)
-                         * Always followed by exactly one byte : H H H H H H H H
-                         * distance = (H << 2) + D + 1
-                         */
-                        var h = GetByte();
-                        distance = (h << 2) + ((Instruction & 0xc) >> 2) + 1;
-
-                        read = CopyFromRingBuffer(buffer, offset, count, distance, 2, Instruction & 0x3);
+                        read = CopySmall(buffer, offset, count);
                         break;
                     case LzoState.LargeCopy:
-                        /*
-                         *the instruction becomes a copy of a 3-byte block from the
-                         * dictionary from a 2..3kB distance, and must be interpreted like this :
-                         * 0 0 0 0 D D S S  (0..15)  : copy 3 bytes from 2..3 kB distance
-                         * length = 3
-                         * state = S (copy S literals after this block)
-                         * Always followed by exactly one byte : H H H H H H H H
-                         * distance = (H << 2) + D + 2049
-                         */
-                        distance = (GetByte() << 2) + ((Instruction & 0xc) >> 2) + 2049;
-
-                        read = CopyFromRingBuffer(buffer, offset, count, distance, 3, Instruction & 0x3);
+                        read = LargeCopy(buffer, offset, count);
                         break;
                     default:
                         throw new ArgumentOutOfRangeException();
@@ -234,9 +201,14 @@
                 {
                     length = 2 + l;
                 }
-                var s = GetByte();
-                var d = GetByte() << 8;
-                d = (d | s) >> 2;
+                var s = _base.ReadByte();
+                if (s == -1)
+                    throw new EndOfStreamException();
+                var d = _base.ReadByte();
+                if (d == -1)
+                    throw new EndOfStreamException();
+                InputPosition += 3;
+                d = ((d << 8) | s) >> 2;
                 var distance = 16384 + ((Instruction & 0x8) << 11) | d;
                 if (distance == 16384)
                     return -1;
@@ -263,9 +235,14 @@
                 {
                     length = 2 + l;
                 }
-                var s = GetByte();
-                var d = GetByte() << 8;
-                d = (d | s) >> 2;
+                var s = _base.ReadByte();
+                if (s == -1)
+                    throw new EndOfStreamException();
+                var d = _base.ReadByte();
+                if (d == -1)
+                    throw new EndOfStreamException();
+                InputPosition += 3;
+                d = ((d << 8) | s) >> 2;
                 var distance = d + 1;

                 read = CopyFromRingBuffer(buffer, offset, count, distance, length, s & 0x3);
@@ -281,7 +258,11 @@
                  * distance = (H << 3) + D + 1
                  */
                 var length = 3 + ((Instruction >> 5) & 0x1);
-                var distance = (GetByte() << 3) + ((Instruction >> 2) & 0x7) + 1;
+                var result = _base.ReadByte();
+                InputPosition += 2;
+                if (result == -1)
+                    throw new EndOfStreamException();
+                var distance = (result << 3) + ((Instruction >> 2) & 0x7) + 1;

                 read = CopyFromRingBuffer(buffer, offset, count, distance, length, Instruction & 0x3);
             }
@@ -296,28 +277,83 @@
                  * distance = (H << 3) + D + 1
                  */
                 var length = 5 + ((Instruction >> 5) & 0x3);
-                var distance = (GetByte() << 3) + ((Instruction & 0x1c) >> 2) + 1;
+                var result = _base.ReadByte();
+                InputPosition += 2;
+                if (result == -1)
+                    throw new EndOfStreamException();
+                var distance = (result << 3) + ((Instruction & 0x1c) >> 2) + 1;

                 read = CopyFromRingBuffer(buffer, offset, count, distance, length, Instruction & 0x3);
             }

-            Instruction = GetByte();
+            Instruction = _base.ReadByte();
+            if (Instruction == -1)
+                throw new EndOfStreamException();
             OutputPosition += read;
             return read;
         }

+        private int LargeCopy(byte[] buffer, int offset, int count)
+        {
+            /*
+             *the instruction becomes a copy of a 3-byte block from the
+             * dictionary from a 2..3kB distance, and must be interpreted like this :
+             * 0 0 0 0 D D S S  (0..15)  : copy 3 bytes from 2..3 kB distance
+             * length = 3
+             * state = S (copy S literals after this block)
+             * Always followed by exactly one byte : H H H H H H H H
+             * distance = (H << 2) + D + 2049
+             */
+            var result = _base.ReadByte();
+            InputPosition += 2;
+            if (result == -1)
+                throw new EndOfStreamException();
+            var distance = (result << 2) + ((Instruction & 0xc) >> 2) + 2049;
+
+            return CopyFromRingBuffer(buffer, offset, count, distance, 3, Instruction & 0x3);
+        }
+
+        private int CopySmall(byte[] buffer, int offset, int count)
+        {
+            /*
+             * the instruction is a copy of a
+             * 2-byte block from the dictionary within a 1kB distance. It is worth
+             * noting that this instruction provides little savings since it uses 2
+             * bytes to encode a copy of 2 other bytes but it encodes the number of
+             * following literals for free. It must be interpreted like this :
+             *
+             * 0 0 0 0 D D S S  (0..15)  : copy 2 bytes from <= 1kB distance
+             * length = 2
+             * state = S (copy S literals after this block)
+             * Always followed by exactly one byte : H H H H H H H H
+             * distance = (H << 2) + D + 1
+             */
+            var h = _base.ReadByte();
+            InputPosition += 2;
+            if (h == -1)
+                throw new EndOfStreamException();
+
+            var distance = (h << 2) + ((Instruction & 0xc) >> 2) + 1;
+
+            return CopyFromRingBuffer(buffer, offset, count, distance, 2, Instruction & 0x3);
+        }
+
         private int ReadLength()
         {
-            byte b;
+            int b;
             int length = 0;
-            while ((b = GetByte()) == 0)
+            while ((b = _base.ReadByte()) == 0)
             {
                 if (length >= Int32.MaxValue - 1000)
                 {
                     throw new Exception();
                 }
+                InputPosition += 1;
                 length += 255;
             }
+            if (b == -1)
+                throw new EndOfStreamException();
+            InputPosition += 1;
             return length + b;
         }


Url - Simplified GetQuery

Url - Simplified GetQuery

--- src/Nancy/Url.cs
+++ src/Nancy/Url.cs
@@ -121,18 +121,6 @@
                 GetCorrectPath(this.BasePath) +
                 GetCorrectPath(this.Path) +
                 GetQuery(this.Query);
-        }
-
-        private static string GetQuery(string query)
-        {
-            if (string.IsNullOrEmpty(query))
-            {
-                return string.Empty;
-            }
-
-            return query.StartsWith("?", StringComparison.OrdinalIgnoreCase) ?
-                query :
-                string.Concat("?", query);
         }

         /// <summary>
@@ -210,6 +198,11 @@
             return url;
         }

+        private static string GetQuery(string query)
+        {
+            return string.IsNullOrEmpty(query) ? string.Empty : (query[0] == '?' ? query : '?' + query);
+        }
+
         private static string GetCorrectPath(string path)
         {
             return (string.IsNullOrEmpty(path) || path.Equals("/")) ? string.Empty : path;


fixed bugs

fixed bugs

--- src/QueryRows.cs
+++ src/QueryRows.cs
@@ -85,10 +85,11 @@
         internal void _Fill(IDataReader _DataReader)
         {
             _RecordCount = -1;
-            _fieldCount = _DataReader.FieldCount;
-            _Ordinal    = new Dictionary<string , int>();
-            _Type       = new Dictionary<string , string>();
-            _Columns    = new List<string>();
+            _fieldCount  = _DataReader.FieldCount;
+            _Ordinal     = new Dictionary<string , int>();
+            _Names       = new Dictionary<int , string>();
+            _Type        = new Dictionary<string , string>();
+            _Columns     = new List<string>();

             Dictionary<string, int> _t_name = new Dictionary<string, int>();

@@ -103,6 +104,7 @@
                     _t_name[s] = 0;
                 }

+                _Names[i] = s;
                 _Columns.Add(s);
                 _Type[s] = _DataReader.GetFieldType(i).ToString();
                 _Ordinal[s] = i;
@@ -367,6 +369,10 @@
         {
             return _Type[Name];
         }
+        public string GetType(int i)
+        {
+            return _Type[_Names[i]];
+        }

         public object this[string name]
         {
@@ -405,6 +411,7 @@
         private List<string>  _Columns;
         private DbContext _DbContext;
         private Dictionary<string, int> _Ordinal;
+        private Dictionary<int, string> _Names;
         private Dictionary<string, string> _Type;
         private IDbConnection _dbConnecttion;
         private bool _KeepPrev       = false;


Update commented out code

Update commented out code

--- src/Signature.cs
+++ src/Signature.cs
@@ -26,17 +26,17 @@
 			return a.Value == b.Value;

 			/*
-			if (a.Data == null && b.Data == null)
+			if (a.data == null && b.data == null)
 				return true;

-			if (a.Data == null || b.Data == null)
+			if (a.data == null || b.data == null)
 				return false;

-			if (a.Data.Length != b.Data.Length)
+			if (a.data.Length != b.data.Length)
 				return false;

-			for (int i = 0 ; i != a.Data.Length ; i++)
-				if (a.Data[i] != b.Data[i])
+			for (int i = 0 ; i != a.data.Length ; i++)
+				if (a.data[i] != b.data[i])
 					return false;

 			return true;


[fluff] add method for logging progress bars.

--- TankLib/Helpers/Logger.cs
+++ TankLib/Helpers/Logger.cs
@@ -185,5 +185,45 @@
             writer.WriteLine();
             return builder.ToString();
         }
+
+        public static void LogProgress(string message, string pre, string post, double value, XTermColor messageColor, XTermColor preColor, XTermColor postColor, XTermColor brickColor, XTermColor processColor, bool showProgressValue, XTermColor processValueColor) {
+            if (Console.IsOutputRedirected) return;
+            var width = Console.WindowWidth;
+            var empty = new char[width];
+            Array.Fill(empty, ' ');
+            if (message != LastMessage) {
+                Console.Out.Write(empty);
+                Console.CursorLeft = 0;
+                LastMessage = message;
+                Logger.Log24Bit(messageColor, true, Console.Out, null, message);
+            }
+            Console.Out.Write(empty);
+            Console.CursorLeft = 0;
+            var remaining = width - pre.Length - post.Length - 4;
+            Logger.Log24Bit(preColor, false, Console.Out, null, pre);
+            if (remaining > 0) {
+                Logger.Log24Bit(brickColor, false, Console.Out, null, " [");
+                empty = new char[remaining];
+                Array.Fill(empty, ' ');
+                Array.Fill(empty, '=', 0, (int)Math.Round(remaining * Math.Min(value, 1)));
+                Logger.Log24Bit(processColor, false, Console.Out, null, string.Join("", empty));
+                Logger.Log24Bit(brickColor, false, Console.Out, null, "] ");
+
+                if(showProgressValue && remaining > 6) {
+                    var valueText = (Math.Min(value, 1) * 100).ToString().Split('.')[0] + "%";
+                    Console.CursorLeft = pre.Length + 2 + (int)Math.Floor(remaining / 2.0d - valueText.Length / 2.0d);
+                    Logger.Log24Bit(processValueColor, false, Console.Out, null, valueText);
+                    Console.CursorLeft = width - post.Length;
+                }
+            }
+            Logger.Log24Bit(postColor, false, Console.Out, null, post);
+            Console.CursorLeft = Console.WindowWidth - 1;
+            Console.CursorTop -= 1;
+        }
+
+        public static void FlushProgress() {
+            Console.CursorTop += 1;
+            Console.WriteLine();
+        }
     }
 }


Created failing empty == empty test.

Created failing empty == empty test.

--- TestMeMaybe/MaybeTests.cs
+++ TestMeMaybe/MaybeTests.cs
@@ -42,9 +42,16 @@

             Assert.IsFalse(emptyNumber.HasValue);
             Assert.IsFalse(emptyName.HasValue);
-
         }

+        [Test]
+        public void TestEmptyEquality()
+        {
+            var emptyNumber = Maybe.Empty<int>();
+            var emptyName = Maybe.Empty<string>();
+
+            Assert.AreEqual(emptyNumber, emptyName, "All empty maybes should be equal, just as null == null");
+        }
         // TODO: Test implicit casting

         // TODO: Test LINQ-style operators (including multiple selectManys)


Simplified test code by moving value to image pixel comparison to separate method

--- Tests/ImageStack8Tests.cs
+++ Tests/ImageStack8Tests.cs
@@ -24,15 +24,39 @@
     [TestClass]
     public unsafe class ImageStack8Tests
     {
+        /// <summary>
+        /// Creates an image stack with normal stride
+        /// </summary>
+        /// <returns></returns>
         private ImageStack8 CreateDefaultStack()
         {
             return new ImageStack8(41, 41, 41, 41, ImageStack.SliceOrders.TBeforeZ);
         }

+        /// <summary>
+        /// Creates an image stack as a shallow copy with non-aligned stride
+        /// </summary>
+        /// <returns></returns>
         private ImageStack8 CreateOffStrideStack()
         {
             byte* buffer = (byte*)Marshal.AllocHGlobal(41 * 41 * 41 * 41);
             return new ImageStack8(buffer, 41, 41, 41, 41, 41, ImageStack.SliceOrders.TBeforeZ);
+        }
+
+        /// <summary>
+        /// Compares every pixel in an image to a given value
+        /// </summary>
+        /// <param name="value">The value each pixel should have</param>
+        /// <param name="image">The image to compare</param>
+        private void CompareValImage(byte value, ImageStack8 image)
+        {
+            byte* imStart = image.ImageData;
+            //only compare outside of stride padding
+            for (long i = 0; i < image.ImageNB; i++)
+            {
+                if (i % image.Stride < image.ImageWidth)
+                    Assert.AreEqual(value, imStart[i], "Found non-matching pixel at position {0}", i);
+            }
         }

         [TestMethod]
@@ -89,11 +113,7 @@
             var ims = CreateDefaultStack();
             byte setVal = 25;
             ims.SetAll(setVal);
-            byte* imStart = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-            {
-                Assert.AreEqual(setVal, imStart[i], "Found non-matching pixel");
-            }
+            CompareValImage(setVal, ims);
             ims.Dispose();
         }

@@ -120,9 +140,7 @@
             var ims = CreateDefaultStack();
             ims.SetAll(initial);
             ims.AddConstant(add);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(initial + add, image[i], "Pixel addition wrong");
+            CompareValImage((byte)(initial + add), ims);
             ims.Dispose();
         }

@@ -134,9 +152,7 @@
             var ims = CreateOffStrideStack();
             ims.SetAll(initial);
             ims.AddConstant(add);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(initial + add, image[i], "Pixel addition wrong");
+            CompareValImage((byte)(initial + add), ims);
             Marshal.FreeHGlobal((IntPtr)ims.ImageData);
             ims.Dispose();
         }
@@ -149,9 +165,7 @@
             var ims = CreateDefaultStack();
             ims.SetAll(initial);
             ims.AddConstant(add);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(255, image[i], "Pixel addition rolls over");
+            CompareValImage(255, ims);
             ims.Dispose();
         }

@@ -163,9 +177,7 @@
             var ims = CreateOffStrideStack();
             ims.SetAll(initial);
             ims.AddConstant(add);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(255, image[i], "Pixel addition rolls over");
+            CompareValImage(255, ims);
             Marshal.FreeHGlobal((IntPtr)ims.ImageData);
             ims.Dispose();
         }
@@ -178,9 +190,7 @@
             var ims = CreateDefaultStack();
             ims.SetAll(initial);
             ims.SubConstant(sub);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(initial - sub, image[i], "Pixel subtraction wrong");
+            CompareValImage((byte)(initial - sub), ims);
             ims.Dispose();
         }

@@ -192,9 +202,7 @@
             var ims = CreateOffStrideStack();
             ims.SetAll(initial);
             ims.SubConstant(sub);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(initial - sub, image[i], "Pixel subtraction wrong");
+            CompareValImage((byte)(initial - sub), ims);
             Marshal.FreeHGlobal((IntPtr)ims.ImageData);
             ims.Dispose();
         }
@@ -207,9 +215,7 @@
             var ims = CreateDefaultStack();
             ims.SetAll(initial);
             ims.SubConstant(sub);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(0, image[i], "Pixel subtraction rolls over");
+            CompareValImage(0, ims);
             ims.Dispose();
         }

@@ -221,9 +227,7 @@
             var ims = CreateOffStrideStack();
             ims.SetAll(initial);
             ims.SubConstant(sub);
-            byte* image = ims.ImageData;
-            for (long i = 0; i < ims.ImageNB; i++)
-                Assert.AreEqual(0, image[i], "Pixel subtraction rolls over");
+            CompareValImage(0, ims);
             Marshal.FreeHGlobal((IntPtr)ims.ImageData);
             ims.Dispose();
         }
@@ -248,16 +252,7 @@
             ims1.SetAll(val1);
             ims2.SetAll(val2);
             ims1.Add(ims2);
-            byte* image = ims1.ImageData;
-            for (long i = 0; i < ims1.ImageNB; i++)
-            {
-                //as we loop bite-wise rather than pixel-wise, we need to exclude
-                //possible positions within the stride (they don't get updated by image addition unlike
-                //SetAll or AddC
-                if (i % ims1.Stride >= ims1.ImageWidth)
-                    continue;
-                Assert.AreEqual(val1 + val2, image[i], "Image addition failed at position {0}", i);
-            }
+            CompareValImage((byte)(val1 + val2), ims1);
             ims1.Dispose();
             ims2.Dispose();
         }
@@ -272,16 +267,7 @@
             ims1.SetAll(val1);
             ims2.SetAll(val2);
             ims1.Add(ims2);
-            byte* image = ims1.ImageData;
-            for (long i = 0; i < ims1.ImageNB; i++)
-            {
-                //as we loop bite-wise rather than pixel-wise, we need to exclude
-                //possible positions within the stride (they don't get updated by image addition unlike
-                //SetAll or AddC
-                if (i % ims1.Stride >= ims1.ImageWidth)
-                    continue;
-                Assert.AreEqual(val1 + val2, image[i], "Image addition failed at position {0}", i);
-            }
+            CompareValImage((byte)(val1 + val2), ims1);
             ims1.Dispose();
             Marshal.FreeHGlobal((IntPtr)ims2.ImageData);
             ims2.Dispose();
@@ -297,16 +283,7 @@
             ims1.SetAll(val1);
             ims2.SetAll(val2);
             ims1.Add(ims2);
-            byte* image = ims1.ImageData;
-            for (long i = 0; i < ims1.ImageNB; i++)
-            {
-                //as we loop bite-wise rather than pixel-wise, we need to exclude
-                //possible positions within the stride (they don't get updated by image addition unlike
-                //SetAll or AddC
-                if (i % ims1.Stride >= ims1.ImageWidth)
-                    continue;
-                Assert.AreEqual(255, image[i], "Image addition wrapped around at position {0}", i);
-            }
+            CompareValImage(255, ims1);
             ims1.Dispose();
             ims2.Dispose();
         }
@@ -321,16 +298,7 @@
             ims1.SetAll(val1);
             ims2.SetAll(val2);
             ims1.Add(ims2);
-            byte* image = ims1.ImageData;
-            for (long i = 0; i < ims1.ImageNB; i++)
-            {
-                //as we loop bite-wise rather than pixel-wise, we need to exclude
-                //possible positions within the stride (they don't get updated by image addition unlike
-                //SetAll or AddC
-                if (i % ims1.Stride >= ims1.ImageWidth)
-                    continue;
-                Assert.AreEqual(255, image[i], "Image addition wrapped around at position {0}", i);
-            }
+            CompareValImage(255, ims1);
             Marshal.FreeHGlobal((IntPtr)ims1.ImageData);
             ims1.Dispose();
             Marshal.FreeHGlobal((IntPtr)ims2.ImageData);
@@ -347,16 +315,7 @@
             ims1.SetAll(val1);
             ims2.SetAll(val2);
             ims1.Subtract(ims2);
-            byte* image = ims1.ImageData;
-            for (long i = 0; i < ims1.ImageNB; i++)
-            {
-                //as we loop bite-wise rather than pixel-wise, we need to exclude
-                //possible positions within the stride (they don't get updated by image addition unlike
-                //SetAll or AddC
-                if (i % ims1.Stride >= ims1.ImageWidth)
-                    continue;
-                Assert.AreEqual(val1 - val2, image[i], "Image addition failed at position {0}", i);
-            }
+            CompareValImage((byte)(val1 - val2), ims1);
             ims1.Dispose();
             ims2.Dispose();
         }
@@ -371,16 +330,7 @@
             ims1.SetAll(val1);
             ims2.SetAll(val2);
             ims1.Subtract(ims2);
-            byte* image = ims1.ImageData;
-            for (long i = 0; i < ims1.ImageNB; i++)
-            {
-                //as we loop bite-wise rather than pixel-wise, we need to exclude
-                //possible positions within the stride (they don't get updated by image addition unlike
-                //SetAll or AddC
-                if (i % ims1.Stride >= ims1.ImageWidth)
-                    continue;
-                Assert.AreEqual(val1 - val2, image[i], "Image addition failed at position {0}", i);
-            }
+            CompareValImage((byte)(val1 - val2), ims1);
             ims1.Dispose();
             Marshal.FreeHGlobal((IntPtr)ims2.ImageData);
             ims2.Dispose();
@@ -396,16 +346,7 @@
             ims1.SetAll(val1);
             ims2.SetAll(val2);
             ims1.Subtract(ims2);
-            byte* image = ims1.ImageData;
-            for (long i = 0; i < ims1.ImageNB; i++)
-            {
-                //as we loop bite-wise rather than pixel-wise, we need to exclude
-                //possible positions within the stride (they don't get updated by image addition unlike
-                //SetAll or AddC
-                if (i % ims1.Stride >= ims1.ImageWidth)
-                    continue;
-                Assert.AreEqual(0, image[i], "Image addition wrapped around at position {0}", i);
-            }
+            CompareValImage(0, ims1);
             Marshal.FreeHGlobal((IntPtr)ims1.ImageData);
             ims1.Dispose();
             Marshal.FreeHGlobal((IntPtr)ims2.ImageData);