Disabling all LDAP Testkit tests using Blacklist

--- Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/TestBlackList.cs
+++ Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/TestBlackList.cs
@@ -97,20 +97,20 @@
 			("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_pull_using_session_run",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_begin_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_begin_using_tx_run",
+				"Temporarily disabled whilst being developed"),

 			("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_run_using_tx_run",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_pull_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_commit_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_rollback_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_pull_using_tx_run",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_commit_using_tx_run",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTests.test_should_fail_with_auth_expired_on_rollback_using_tx_run",
+				"Temporarily disabled whilst being developed"),

 			("stub.authorization.AuthorizationTests.test_should_retry_on_auth_expired_on_begin_using_tx_function",
 				"Temporarily disabled whilst being developed"),
@@ -124,11 +124,11 @@
 			("stub.authorization.AuthorizationTests.test_should_retry_on_auth_expired_on_commit_using_tx_function",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTests.test_should_drop_connection_after_AuthorizationExpired",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTests.test_should_be_able_to_use_current_sessions_after_AuthorizationExpired",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTests.test_should_drop_connection_after_AuthorizationExpired",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTests.test_should_be_able_to_use_current_sessions_after_AuthorizationExpired",
+				"Temporarily disabled whilst being developed"),

@@ -141,20 +141,20 @@
 			("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_pull_using_session_run",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_begin_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_begin_using_tx_run",
+				"Temporarily disabled whilst being developed"),

 			("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_run_using_tx_run",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_pull_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_commit_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_rollback_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_pull_using_tx_run",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_commit_using_tx_run",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTestsV4.test_should_fail_with_auth_expired_on_rollback_using_tx_run",
+				"Temporarily disabled whilst being developed"),

 			("stub.authorization.AuthorizationTestsV4.test_should_retry_on_auth_expired_on_begin_using_tx_function",
 				"Temporarily disabled whilst being developed"),
@@ -168,11 +168,11 @@
 			("stub.authorization.AuthorizationTestsV4.test_should_retry_on_auth_expired_on_commit_using_tx_function",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTestsV4.test_should_drop_connection_after_AuthorizationExpired",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTestsV4.test_should_be_able_to_use_current_sessions_after_AuthorizationExpired",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTestsV4.test_should_drop_connection_after_AuthorizationExpired",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTestsV4.test_should_be_able_to_use_current_sessions_after_AuthorizationExpired",
+				"Temporarily disabled whilst being developed"),

@@ -184,20 +184,20 @@
 			("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_pull_using_session_run",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_begin_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_begin_using_tx_run",
+				"Temporarily disabled whilst being developed"),

 			("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_run_using_tx_run",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_pull_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_commit_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_rollback_using_tx_run",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_pull_using_tx_run",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_commit_using_tx_run",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTestsV3.test_should_fail_with_auth_expired_on_rollback_using_tx_run",
+				"Temporarily disabled whilst being developed"),

 			("stub.authorization.AuthorizationTestsV3.test_should_retry_on_auth_expired_on_begin_using_tx_function",
 				"Temporarily disabled whilst being developed"),
@@ -211,11 +211,11 @@
 			("stub.authorization.AuthorizationTestsV3.test_should_retry_on_auth_expired_on_commit_using_tx_function",
 				"Temporarily disabled whilst being developed"),

-			//("stub.authorization.AuthorizationTestsV3.test_should_drop_connection_after_AuthorizationExpired",
-			//	"Temporarily disabled whilst being developed"),
-
-			//("stub.authorization.AuthorizationTestsV3.test_should_be_able_to_use_current_sessions_after_AuthorizationExpired",
-			//	"Temporarily disabled whilst being developed"),
+			("stub.authorization.AuthorizationTestsV3.test_should_drop_connection_after_AuthorizationExpired",
+				"Temporarily disabled whilst being developed"),
+
+			("stub.authorization.AuthorizationTestsV3.test_should_be_able_to_use_current_sessions_after_AuthorizationExpired",
+				"Temporarily disabled whilst being developed"),
 		};

 		public static bool FindTest(string testName, out string reason)


use HTTPS for the default FwLink. Work Items: 444

--- NuPack.VisualStudio/PackageSource/VSPackageSourceProvider.cs
+++ NuPack.VisualStudio/PackageSource/VSPackageSourceProvider.cs
@@ -8,7 +8,7 @@
     [PartCreationPolicy(CreationPolicy.Shared)]
     [Export(typeof(IPackageSourceProvider))]
     public class VsPackageSourceProvider : IPackageSourceProvider {
-        internal const string DefaultPackageSource = "http://go.microsoft.com/fwlink/?LinkID=206669";
+        internal const string DefaultPackageSource = "https://go.microsoft.com/fwlink/?LinkID=206669";
         internal const string OfficialFeedName = "NuGet official package source";
         internal static readonly PackageSource AggregateSource = new PackageSource("(Aggregate source)", "All") { IsAggregate = true };


update string constants, send logout request

--- OnedriveRESTWrapper/OnedriveRESTWrapper/OnedriveConnector.cs
+++ OnedriveRESTWrapper/OnedriveRESTWrapper/OnedriveConnector.cs
@@ -14,15 +14,21 @@
 {
     public sealed class OneDriveConnector
     {
+        /// <summary>
+        /// Is true if currently logged in to OneDrive, false otherwise.
+        /// </summary>
         public bool isLoggedIn { get; private set; } = false;
+
+        /// <summary>
+        /// A string that can be used to properly format the Uri for obtaining the access code.
+        /// </summary>
+        public const string LoginUriFormat = "https://login.live.com/oauth20_authorize.srf?client_id={0}&scope=wl.offline_access onedrive.readwrite&response_type=code&redirect_uri={2}";

         private const int ReauthSpanHours = 0;
         private const int ReauthSpanMinutes = 50;
         private const int ReauthSpanSeconds = 0;
-
-        private const string LoginUriFormat = "https://login.live.com/oauth20_authorize.srf?client_id={0}&scope={1}&response_type=code&redirect_uri={2}";
+
         private const string LogoutUriFormat = "https://login.live.com/oauth20_logout.srf?client_id={0}&redirect_uri={1}";
-        private const string ScopeForAuthRequests = "wl.offline_access onedrive.readwrite";
         private const string UploadUrlFormat = "https://api.onedrive.com/v1.0/drive/root:{1}/{2}:/content";
         private const string TokenUri = "https://login.live.com/oauth20_token.srf";
         private const string TokenContentFormat = "client_id={0}&redirect_uri={1}&client_secret={2}&{3}={4}&grant_type={5}";
@@ -111,8 +117,17 @@
         /// <summary>
         /// Disposes of any user specific data obtained during login process.
         /// </summary>
-        public void Logout()
+        public async Task Logout()
         {
+            string logoutUri = string.Format(LogoutUriFormat, clientId, redirectUrl);
+            using (HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, new Uri(logoutUri)))
+            {
+                using (HttpResponseMessage response = await httpClient.SendRequestAsync(requestMessage))
+                {
+                    response.EnsureSuccessStatusCode();
+                }
+            }
+
             clientId = "";
             clientSecret = "";
             redirectUrl = "";


bugfix - when the directory does not exist, we really can't do anything with uninstalling

--- src/Shimmer.Client/UpdateManager.cs
+++ src/Shimmer.Client/UpdateManager.cs
@@ -29,7 +29,7 @@

 namespace Shimmer.Client
 {
-    public sealed class UpdateManager : IUpdateManager
+    public sealed class UpdateManager : IUpdateManager, IEnableLogger
     {
         readonly IRxUIFullLogger log;
         readonly IFileSystemFactory fileSystem;
@@ -506,7 +506,13 @@

         IEnumerable<ShortcutCreationRequest> cleanUpOldVersions(Version newCurrentVersion)
         {
-            return fileSystem.GetDirectoryInfo(rootAppDirectory).GetDirectories()
+            var directory = fileSystem.GetDirectoryInfo(rootAppDirectory);
+            if (!directory.Exists) {
+                this.Log().Warn("The directory '{0}' does not exist", rootAppDirectory);
+                return Enumerable.Empty<ShortcutCreationRequest>();
+            }
+
+            return directory.GetDirectories()
                 .Where(x => x.Name.StartsWith("app-", StringComparison.InvariantCultureIgnoreCase))
                 .Where(x => x.Name != "app-" + newCurrentVersion)
                 .OrderBy(x => x.Name)


Nullchecks in equality operators in PolyLine2D

--- src/Spatial/Euclidean/PolyLine2D.cs
+++ src/Spatial/Euclidean/PolyLine2D.cs
@@ -74,7 +74,7 @@
         /// <returns>True if the lines are the same; otherwise false.</returns>
         public static bool operator ==(PolyLine2D left, PolyLine2D right)
         {
-            return left.Equals(right);
+            return left?.Equals(right) == true;
         }

         /// <summary>
@@ -85,7 +85,7 @@
         /// <returns>True if the lines are different; otherwise false.</returns>
         public static bool operator !=(PolyLine2D left, PolyLine2D right)
         {
-            return !left.Equals(right);
+            return left?.Equals(right) != true;
         }

         /// <summary>


Make Executor.PrepareProgram() thread safe by using a lock.

--- src/Symbooglix/Executor/Executor.cs
+++ src/Symbooglix/Executor/Executor.cs
@@ -69,138 +69,140 @@

         public event ExecutionStateEvent StateTerminated;

+        private Object PrepareProgramLock = new object();
         public bool PrepareProgram(Transform.PassManager passManager = null)
         {
-            // FIXME: Mutex Lock on HasBeenPrepared
-
-            if (HasBeenPrepared)
+            lock (PrepareProgramLock)
+            {
+                if (HasBeenPrepared)
+                    return true;
+
+                if (passManager == null)
+                    passManager = new Transform.PassManager(TheProgram);
+
+                if (passManager.TheProgram != TheProgram)
+                    throw new InvalidOperationException("PassManager must use same program as executor");
+
+                var FRF = new FindRecursiveFunctionsPass();
+                passManager.Add(FRF);
+                passManager.Add(new Transform.FunctionInliningPass());
+
+
+                // FIXME: Make this a pass
+                // FIXME: Remove this? We aren't using it!
+                // Make a list of all the functions that are uninterpreted or can't be inlined
+                var functions = TheProgram.TopLevelDeclarations.OfType<Function>();
+                foreach (var F in functions)
+                {
+                    // bvbuiltins are interpreted as SMT-LIBv2 functions
+                    if (F.FindAttribute("bvbuiltin") != null)
+                        continue;
+
+                    // Inlinable
+                    if (F.Body != null)
+                        continue;
+
+                    UninterpretedOrUninlinableFunctions.Add(F);
+                    Debug.WriteLine("Added uninterpreted function " + F);
+                }
+
+                // We need ProgramLocation annotations to work out where stuff comes from
+                passManager.Add(new Annotation.ProgramLocationAnnotater());
+
+                // Run our passes and any user requested passes
+                passManager.Run();
+
+                // Don't allow recursive function for now as we can't handle them!
+                if (FRF.RecursiveFunctions.Count > 0)
+                {
+                    Console.ForegroundColor = ConsoleColor.Red;
+                    Console.Error.WriteLine("Detected the following recursive functions");
+                    foreach (var function in FRF.RecursiveFunctions)
+                    {
+                        Console.Error.Write(function.Name + ": ");
+                        if (function.Body != null)
+                            Console.Error.WriteLine(function.Body.ToString());
+
+                        if (function.DefinitionAxiom != null)
+                            Console.Error.WriteLine(function.DefinitionAxiom.Expr.ToString());
+                    }
+                    Console.ResetColor();
+
+                    throw new NotSupportedException("Cannot handle recursive functions");
+                }
+
+                // Create initial execution state
+                InitialState = CurrentState = new ExecutionState();
+
+                // Load Global Variables and Constants
+                var GVs = TheProgram.TopLevelDeclarations.OfType<Variable>().Where(g => g is GlobalVariable || g is Constant);
+                var axioms = TheProgram.TopLevelDeclarations.OfType<Axiom>();
+                foreach (Variable gv in GVs)
+                {
+                    // Make symbolic
+                    var s = SymbolicPool.getFreshSymbolic(gv);
+                    Debug.Assert(!InitialState.Mem.Globals.ContainsKey(gv), "Cannot insert global that is already in memory");
+                    InitialState.Mem.Globals.Add(gv, s.Expr);
+                    InitialState.Symbolics.Add(s);
+
+                }
+
+                // Add the axioms as path constraints
+                // We must do this before concretising any variables
+                // otherwise we might end up adding constraints like
+                // 0bv8 == 0bv8, instead of symbolic_0 == 0bv8
+                foreach (var axiom in axioms)
+                {
+                    // Check The axiom can be satisfied
+                    TheSolver.SetConstraints(InitialState.Constraints);
+
+                    var VMR = new VariableMapRewriter(InitialState);
+                    VMR.ReplaceGlobalsOnly = true; // The stackframe doesn't exist yet!
+
+                    Expr constraint = (Expr) VMR.Visit(axiom.Expr);
+
+                    Solver.Result result = TheSolver.IsQuerySat(constraint);
+                    switch (result)
+                    {
+                        case Symbooglix.Solver.Result.SAT:
+                            break;
+                        case Symbooglix.Solver.Result.UNSAT:
+                        case Symbooglix.Solver.Result.UNKNOWN:
+                            goto default; // Eurgh...
+                        default:
+                            InitialState.Terminate(new TerminatedAtUnsatisfiableAxiom(axiom));
+                            if (StateTerminated != null)
+                            {
+                                StateTerminated(this, new ExecutionStateEventArgs(InitialState));
+                            }
+                            HasBeenPrepared = true; // Don't allow this method to run again
+                            return false;
+                    }
+
+                    InitialState.Constraints.AddConstraint(constraint, axiom.GetProgramLocation());
+                    Debug.WriteLine("Adding constraint : " + constraint);
+
+                }
+
+
+                // See if we can concretise using the program's axioms
+                foreach (var axiom in axioms)
+                {
+                    LiteralExpr literal = null;
+                    Variable assignedTo = null;
+                    if (FindLiteralAssignment.findAnyVariable(axiom.Expr, out assignedTo, out literal))
+                    {
+                        // Axioms should only be able to refer to globals
+                        Debug.WriteLine("Concretising " + assignedTo.Name + " := " + literal.ToString());
+                        Debug.Assert(InitialState.Mem.Globals.ContainsKey(assignedTo));
+                        InitialState.Mem.Globals[assignedTo] = literal;
+                    }
+                }
+
+
+                HasBeenPrepared = true;
                 return true;
-
-            if (passManager == null)
-                passManager = new Transform.PassManager(TheProgram);
-
-            if (passManager.TheProgram != TheProgram)
-                throw new InvalidOperationException("PassManager must use same program as executor");
-
-            var FRF = new FindRecursiveFunctionsPass();
-            passManager.Add(FRF);
-            passManager.Add(new Transform.FunctionInliningPass());
-
-
-            // FIXME: Make this a pass
-            // FIXME: Remove this? We aren't using it!
-            // Make a list of all the functions that are uninterpreted or can't be inlined
-            var functions = TheProgram.TopLevelDeclarations.OfType<Function>();
-            foreach (var F in functions)
-            {
-                // bvbuiltins are interpreted as SMT-LIBv2 functions
-                if (F.FindAttribute("bvbuiltin") != null)
-                    continue;
-
-                // Inlinable
-                if (F.Body != null)
-                    continue;
-
-                UninterpretedOrUninlinableFunctions.Add(F);
-                Debug.WriteLine("Added uninterpreted function " + F);
-            }
-
-            // We need ProgramLocation annotations to work out where stuff comes from
-            passManager.Add(new Annotation.ProgramLocationAnnotater());
-
-            // Run our passes and any user requested passes
-            passManager.Run();
-
-            // Don't allow recursive function for now as we can't handle them!
-            if (FRF.RecursiveFunctions.Count > 0)
-            {
-                Console.ForegroundColor = ConsoleColor.Red;
-                Console.Error.WriteLine("Detected the following recursive functions");
-                foreach (var function in FRF.RecursiveFunctions)
-                {
-                    Console.Error.Write(function.Name + ": ");
-                    if (function.Body != null)
-                        Console.Error.WriteLine(function.Body.ToString());
-
-                    if (function.DefinitionAxiom != null)
-                        Console.Error.WriteLine(function.DefinitionAxiom.Expr.ToString());
-                }
-                Console.ResetColor();
-
-                throw new NotSupportedException("Cannot handle recursive functions");
-            }
-
-            // Create initial execution state
-            InitialState = CurrentState = new ExecutionState();
-
-            // Load Global Variables and Constants
-            var GVs = TheProgram.TopLevelDeclarations.OfType<Variable>().Where(g => g is GlobalVariable || g is Constant);
-            var axioms = TheProgram.TopLevelDeclarations.OfType<Axiom>();
-            foreach (Variable gv in GVs)
-            {
-                // Make symbolic
-                var s = SymbolicPool.getFreshSymbolic(gv);
-                Debug.Assert(!InitialState.Mem.Globals.ContainsKey(gv), "Cannot insert global that is already in memory");
-                InitialState.Mem.Globals.Add(gv, s.Expr);
-                InitialState.Symbolics.Add(s);
-
-            }
-
-            // Add the axioms as path constraints
-            // We must do this before concretising any variables
-            // otherwise we might end up adding constraints like
-            // 0bv8 == 0bv8, instead of symbolic_0 == 0bv8
-            foreach (var axiom in axioms)
-            {
-                // Check The axiom can be satisfied
-                TheSolver.SetConstraints(InitialState.Constraints);
-
-                var VMR = new VariableMapRewriter(InitialState);
-                VMR.ReplaceGlobalsOnly = true; // The stackframe doesn't exist yet!
-
-                Expr constraint = (Expr) VMR.Visit(axiom.Expr);
-
-                Solver.Result result = TheSolver.IsQuerySat(constraint);
-                switch (result)
-                {
-                    case Symbooglix.Solver.Result.SAT:
-                        break;
-                    case Symbooglix.Solver.Result.UNSAT:
-                    case Symbooglix.Solver.Result.UNKNOWN:
-                        goto default; // Eurgh...
-                    default:
-                        InitialState.Terminate(new TerminatedAtUnsatisfiableAxiom(axiom));
-                        if (StateTerminated != null)
-                        {
-                            StateTerminated(this, new ExecutionStateEventArgs(InitialState));
-                        }
-                        HasBeenPrepared = true; // Don't allow this method to run again
-                        return false;
-                }
-
-                InitialState.Constraints.AddConstraint(constraint, axiom.GetProgramLocation());
-                Debug.WriteLine("Adding constraint : " + constraint);
-
-            }
-
-
-            // See if we can concretise using the program's axioms
-            foreach (var axiom in axioms)
-            {
-                LiteralExpr literal = null;
-                Variable assignedTo = null;
-                if (FindLiteralAssignment.findAnyVariable(axiom.Expr, out assignedTo, out literal))
-                {
-                    // Axioms should only be able to refer to globals
-                    Debug.WriteLine("Concretising " + assignedTo.Name + " := " + literal.ToString());
-                    Debug.Assert(InitialState.Mem.Globals.ContainsKey(assignedTo));
-                    InitialState.Mem.Globals[assignedTo] = literal;
-                }
-            }
-
-
-            HasBeenPrepared = true;
-            return true;
+            }
         }

         public void RegisterPreEventHandler(IExecutorHandler handler)
@@ -231,8 +233,11 @@

         public void Run(Implementation entryPoint)
         {
-            if (!HasBeenPrepared)
-                PrepareProgram();
+            lock (PrepareProgramLock)
+            {
+                if (!HasBeenPrepared)
+                    PrepareProgram();
+            }

             if (InitialState.Finished())
             {


orm: code generation

orm: code generation

--- src/TrackTv.Data/DbCodeGenerator.cs
+++ src/TrackTv.Data/DbCodeGenerator.cs
@@ -148,20 +148,13 @@
         {
             var pocoType = typeof(TPoco);
             var parameterType = typeof(NpgsqlParameter);
-            var genericParameterType = typeof(NpgsqlParameter<>);
-            var dbNullValue = typeof(DBNull).GetField("Value");
-
+
             var nonPrimaryKeyColumns = metadata.Columns.Where(x => !x.IsPrimaryKey).ToArray();

             return GenerateMethod<Func<TPoco, NpgsqlParameter[]>>(il =>
             {
                 il.DeclareLocal(typeof(NpgsqlParameter[]));
-
-                var nullableLocals = nonPrimaryKeyColumns
-                                     .Where(x => IsNullableType(x.ClrType))
-                                     .Select(x => x.ClrType).Distinct()
-                                     .ToDictionary(type => type, il.DeclareLocal);
-
+
                 // create the array and save it in local0
                 il.Emit(OpCodes.Ldc_I4, nonPrimaryKeyColumns.Length);
                 il.Emit(OpCodes.Newarr, parameterType);
@@ -177,117 +170,13 @@
                     il.Emit(OpCodes.Ldloc_0);
                     il.Emit(OpCodes.Ldc_I4, i++);

-                    #region CreateTheParameter
-
-                    if (!property.PropertyType.IsValueType)
-                    {
-                        var nullParameterType = genericParameterType.MakeGenericType(typeof(DBNull));
-                        var concreteParameterType = genericParameterType.MakeGenericType(property.PropertyType);
-
-                        il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-
-                        var ifNotNullLabel = il.DefineLabel();
-                        var endifLabel = il.DefineLabel();
-
-                        il.Emit(OpCodes.Brtrue_S, ifNotNullLabel);
-
-                        // if null
-                        il.Emit(OpCodes.Ldnull);
-                        il.Emit(OpCodes.Ldc_I4, (int)column.NpgsDataType);
-                        il.Emit(OpCodes.Newobj, nullParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                        il.Emit(OpCodes.Dup);
-
-                        il.Emit(OpCodes.Ldsfld, dbNullValue);
-                        il.Emit(OpCodes.Call, nullParameterType.GetProperty("TypedValue").SetMethod);
-
-                        il.Emit(OpCodes.Br_S, endifLabel);
-
-                        il.MarkLabel(ifNotNullLabel);
-
-                        // if not null
-                        il.Emit(OpCodes.Ldnull);
-                        il.Emit(OpCodes.Ldc_I4, (int)column.NpgsDataType);
-                        il.Emit(OpCodes.Newobj, concreteParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                        il.Emit(OpCodes.Dup);
-
-                        il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-                        il.Emit(OpCodes.Call, concreteParameterType.GetProperty("TypedValue").SetMethod);
-
-                        il.MarkLabel(endifLabel);
-                    }
-                    else if (IsNullableType(property.PropertyType))
-                    {
-                        var nullParameterType = genericParameterType.MakeGenericType(typeof(DBNull));
-                        var concreteParameterType = genericParameterType.MakeGenericType(Nullable.GetUnderlyingType(property.PropertyType));
-
-                        var nullableValueLocal = nullableLocals[property.PropertyType];
-
-                        il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-                        il.Emit(OpCodes.Stloc, nullableValueLocal);
-
-                        var ifNotNullLabel = il.DefineLabel();
-                        var endifLabel = il.DefineLabel();
-
-                        il.Emit(OpCodes.Ldloca_S, nullableValueLocal);
-                        il.Emit(OpCodes.Call, property.PropertyType.GetProperty("HasValue").GetMethod);
-
-                        il.Emit(OpCodes.Brtrue_S, ifNotNullLabel);
-
-                        // if null
-                        il.Emit(OpCodes.Ldnull);
-                        il.Emit(OpCodes.Ldc_I4, (int)column.NpgsDataType);
-                        il.Emit(OpCodes.Newobj, nullParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                        il.Emit(OpCodes.Dup);
-
-                        il.Emit(OpCodes.Ldsfld, dbNullValue);
-                        il.Emit(OpCodes.Call, nullParameterType.GetProperty("TypedValue").SetMethod);
-
-                        il.Emit(OpCodes.Br_S, endifLabel);
-
-                        il.MarkLabel(ifNotNullLabel);
-
-                        // if not null
-                        il.Emit(OpCodes.Ldnull);
-                        il.Emit(OpCodes.Ldc_I4, (int)column.NpgsDataType);
-                        il.Emit(OpCodes.Newobj, concreteParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                        il.Emit(OpCodes.Dup);
-
-                        il.Emit(OpCodes.Ldloca_S, nullableValueLocal);
-                        il.Emit(OpCodes.Call, property.PropertyType.GetMethod("GetValueOrDefault", Array.Empty<Type>()));
-                        il.Emit(OpCodes.Call, concreteParameterType.GetProperty("TypedValue").SetMethod);
-
-                        il.MarkLabel(endifLabel);
-                    }
-                    else
-                    {
-                        var concreteParameterType = genericParameterType.MakeGenericType(property.PropertyType);
-
-                        il.Emit(OpCodes.Ldnull);
-                        il.Emit(OpCodes.Ldc_I4, (int)column.NpgsDataType);
-                        il.Emit(OpCodes.Newobj, concreteParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                        il.Emit(OpCodes.Dup);
-
-                        il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-                        il.Emit(OpCodes.Call, concreteParameterType.GetProperty("TypedValue").SetMethod);
-                    }
-
-                    #endregion
+                    EmitNpgsqlParameter(il, property, column.NpgsDataType, () => il.Emit(OpCodes.Ldarg_0));

                     // set the parameter to the appropriate index
                     il.Emit(OpCodes.Stelem, parameterType);
                 }

                 il.Emit(OpCodes.Ldloc_0);
-
                 il.Emit(OpCodes.Ret);
             });
         }
@@ -297,8 +186,6 @@
         {
             var pocoType = typeof(TPoco);
             var parameterType = typeof(NpgsqlParameter);
-            var parameterValueProperty = parameterType.GetProperty("Value");
-            var dbNullValue = typeof(DBNull).GetField("Value");

             var tupleConstructor = typeof(ValueTuple<string[], NpgsqlParameter[]>)
                 .GetConstructor(new[] { typeof(string[]), typeof(NpgsqlParameter[]) });
@@ -307,73 +194,38 @@

             return GenerateMethod<Func<TPoco, ValueTuple<string[], NpgsqlParameter[]>>>(il =>
             {
-                il.DeclareLocal(typeof(string[]));
-                il.DeclareLocal(typeof(NpgsqlParameter[]));
-
-                // create the column name array and save it in local0
+                var columnNamesLocal = il.DeclareLocal(typeof(string[]));
+                var parametersLocal = il.DeclareLocal(typeof(NpgsqlParameter[]));
+
                 il.Emit(OpCodes.Ldc_I4, nonPrimaryKeyColumns.Length);
                 il.Emit(OpCodes.Newarr, typeof(string));
-                il.Emit(OpCodes.Stloc_0);
-
-                // create the parameter array and save it in local1
+                il.Emit(OpCodes.Stloc, columnNamesLocal);
+
                 il.Emit(OpCodes.Ldc_I4, nonPrimaryKeyColumns.Length);
                 il.Emit(OpCodes.Newarr, parameterType);
-                il.Emit(OpCodes.Stloc_1);
+                il.Emit(OpCodes.Stloc, parametersLocal);

                 int i = 0;

                 foreach (var column in nonPrimaryKeyColumns)
                 {
                     // add the column name to the array
-                    il.Emit(OpCodes.Ldloc_0);
+                    il.Emit(OpCodes.Ldloc, columnNamesLocal);
                     il.Emit(OpCodes.Ldc_I4, i);
                     il.Emit(OpCodes.Ldstr, column.ColumnName);
                     il.Emit(OpCodes.Stelem, typeof(string));

                     // add the parameter to the array
-                    il.Emit(OpCodes.Ldloc_1);
+                    il.Emit(OpCodes.Ldloc, parametersLocal);
                     il.Emit(OpCodes.Ldc_I4, i);
-
-                    // create the new parameter
-                    il.Emit(OpCodes.Ldnull);
-                    il.Emit(OpCodes.Ldc_I4, (int)column.NpgsDataType);
-                    il.Emit(OpCodes.Newobj, parameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                    // set the param.Value property to the property value
-                    var property = pocoType.GetProperty(column.PropertyName);
-
-                    il.Emit(OpCodes.Dup);
-                    il.Emit(OpCodes.Ldarg_0);
-                    il.Emit(OpCodes.Call, property.GetMethod);
-
-                    if (column.ClrType.IsValueType)
-                    {
-                        il.Emit(OpCodes.Box, column.ClrType);
-                    }
-
-                    // if its null then set it to dbnull
-                    var endif = il.DefineLabel();
-
-                    il.Emit(OpCodes.Dup);
-
-                    il.Emit(OpCodes.Brtrue_S, endif);
-
-                    il.Emit(OpCodes.Pop);
-                    il.Emit(OpCodes.Ldsfld, dbNullValue);
-
-                    il.MarkLabel(endif);
-
-                    // set the Value property of the NpgsqlParameter
-                    il.Emit(OpCodes.Call, parameterValueProperty.SetMethod);
-
-                    // set the parameter to the appropriate index
+                    EmitNpgsqlParameter(il, pocoType.GetProperty(column.PropertyName), column.NpgsDataType, () => il.Emit(OpCodes.Ldarg_0));
                     il.Emit(OpCodes.Stelem, parameterType);

                     i++;
                 }

-                il.Emit(OpCodes.Ldloc_0);
-                il.Emit(OpCodes.Ldloc_1);
+                il.Emit(OpCodes.Ldloc, columnNamesLocal);
+                il.Emit(OpCodes.Ldloc, parametersLocal);

                 il.Emit(OpCodes.Newobj, tupleConstructor);

@@ -385,7 +237,6 @@
             where TPoco : IPoco<TPoco>
         {
             var pocoType = typeof(TPoco);
-            var parameterType = typeof(NpgsqlParameter);

             var tupleConstructor = typeof(ValueTuple<List<string>, List<NpgsqlParameter>>)
                 .GetConstructor(new[] { typeof(List<string>), typeof(List<NpgsqlParameter>) });
@@ -406,11 +257,6 @@
                 var parameterListLocal = il.DeclareLocal(parameterListType);
                 il.Emit(OpCodes.Newobj, parameterListType.GetConstructor(Array.Empty<Type>()));
                 il.Emit(OpCodes.Stloc, parameterListLocal);
-
-                // for each unique nullable types declare 2 locals.
-                var nullableLocals = nonPrimaryKeyColumns
-                                     .Where(x => IsNullableType(x.ClrType)).Select(x => x.ClrType).Distinct()
-                                     .ToDictionary(type => type, type => (il.DeclareLocal(type), il.DeclareLocal(type)));

                 foreach (var column in nonPrimaryKeyColumns)
                 {
@@ -424,29 +270,24 @@
                         var getValueOrDefault = nullableType.GetMethod("GetValueOrDefault", Array.Empty<Type>());
                         var hasValue = nullableType.GetProperty("HasValue");

-                        var (local1, local2) = nullableLocals[nullableType];
-
-                        // get the first value and store it into a local
+                        // compare the HasValue properties
                         il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-                        il.Emit(OpCodes.Stloc, local1);
-
-                        // get the second value and store it into a local
+                        il.Emit(OpCodes.Ldflda, property.GetBackingField());
+                        il.Emit(OpCodes.Call, hasValue.GetMethod);
+
                         il.Emit(OpCodes.Ldarg_1);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-                        il.Emit(OpCodes.Stloc, local2);
-
-                        // compare the HasValue properties
-                        il.Emit(OpCodes.Ldloca_S, local1);
+                        il.Emit(OpCodes.Ldflda, property.GetBackingField());
                         il.Emit(OpCodes.Call, hasValue.GetMethod);
-                        il.Emit(OpCodes.Ldloca_S, local2);
-                        il.Emit(OpCodes.Call, hasValue.GetMethod);
+
                         il.Emit(OpCodes.Ceq);

                         // compare the GetValueOrDefault() result.
-                        il.Emit(OpCodes.Ldloca_S, local1);
+                        il.Emit(OpCodes.Ldarg_0);
+                        il.Emit(OpCodes.Ldflda, property.GetBackingField());
                         il.Emit(OpCodes.Call, getValueOrDefault);
-                        il.Emit(OpCodes.Ldloca_S, local2);
+
+                        il.Emit(OpCodes.Ldarg_1);
+                        il.Emit(OpCodes.Ldflda, property.GetBackingField());
                         il.Emit(OpCodes.Call, getValueOrDefault);

                         var underlyingType = Nullable.GetUnderlyingType(nullableType);
@@ -469,10 +310,10 @@
                         // simple equality check

                         il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
+                        il.Emit(OpCodes.Ldfld, property.GetBackingField());

                         il.Emit(OpCodes.Ldarg_1);
-                        il.Emit(OpCodes.Call, property.GetMethod);
+                        il.Emit(OpCodes.Ldfld, property.GetBackingField());

                         var eqOperator = property.PropertyType.GetMethod("op_Equality");

@@ -493,39 +334,8 @@
                     il.Emit(OpCodes.Ldstr, column.ColumnName);
                     il.Emit(OpCodes.Call, stringListType.GetMethod("Add"));

-
                     il.Emit(OpCodes.Ldloc, parameterListLocal); // the parameter list
-
-                    // create the new parameter
-                    il.Emit(OpCodes.Ldnull);
-                    il.Emit(OpCodes.Ldc_I4, (int)column.NpgsDataType);
-                    il.Emit(OpCodes.Newobj, parameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                    il.Emit(OpCodes.Dup);
-                    il.Emit(OpCodes.Ldarg_1);
-                    il.Emit(OpCodes.Call, property.GetMethod);
-
-                    if (column.ClrType.IsValueType)
-                    {
-                        il.Emit(OpCodes.Box, column.ClrType);
-                    }
-
-                    // if its null then set it to dbnull
-                    var endif = il.DefineLabel();
-
-                    il.Emit(OpCodes.Dup);
-
-                    il.Emit(OpCodes.Brtrue_S, endif);
-
-                    // the value is null, replace it with DbNull.Value
-                    il.Emit(OpCodes.Pop);
-                    il.Emit(OpCodes.Ldsfld, typeof(DBNull).GetField("Value"));
-
-                    il.MarkLabel(endif);
-
-                    // set the Value property of the NpgsqlParameter
-                    il.Emit(OpCodes.Call, parameterType.GetProperty("Value").SetMethod);
-
+                    EmitNpgsqlParameter(il, property, column.NpgsDataType, () => il.Emit(OpCodes.Ldarg_1));
                     il.Emit(OpCodes.Call, parameterListType.GetMethod("Add"));

                     il.MarkLabel(notChangedEndif);
@@ -545,22 +355,18 @@
             Type fmType)
             where TPoco : IPoco<TPoco>
         {
-            var parameterType = typeof(NpgsqlParameter);
-
             var tupleConstructor = typeof(ValueTuple<List<string>, List<NpgsqlParameter>, List<QueryOperatorType>>)
                 .GetConstructor(new[] { typeof(List<string>), typeof(List<NpgsqlParameter>), typeof(List<QueryOperatorType>) });

-            var nullableTypes = fmType.GetProperties().Select(x => x.PropertyType).Where(IsNullableType).Distinct().ToList();
-
-            var stringListType = typeof(List<string>);
+            var columnNamesListType = typeof(List<string>);
             var parameterListType = typeof(List<NpgsqlParameter>);
             var operatorListType = typeof(List<QueryOperatorType>);

             return GenerateMethod<Func<IFilterModel<TPoco>, ValueTuple<List<string>, List<NpgsqlParameter>, List<QueryOperatorType>>>>(il =>
             {
                 // create the columnNames list.
-                var columnNamesLocal = il.DeclareLocal(stringListType);
-                il.Emit(OpCodes.Newobj, stringListType.GetConstructor(Array.Empty<Type>()));
+                var columnNamesLocal = il.DeclareLocal(columnNamesListType);
+                il.Emit(OpCodes.Newobj, columnNamesListType.GetConstructor(Array.Empty<Type>()));
                 il.Emit(OpCodes.Stloc, columnNamesLocal);

                 // create the parameter list.
@@ -573,33 +379,21 @@
                 il.Emit(OpCodes.Newobj, operatorListType.GetConstructor(Array.Empty<Type>()));
                 il.Emit(OpCodes.Stloc, operatorListLocal);

-                // for each unique nullable types declare 2 locals.
-                var nullableLocals = nullableTypes.ToDictionary(type => type, il.DeclareLocal);
-
                 foreach (var property in fmType.GetProperties())
                 {
                     var includedEndif = il.DefineLabel();

                     if (IsNullableType(property.PropertyType))
                     {
-                        var nullableType = property.PropertyType;
-                        var hasValue = nullableType.GetProperty("HasValue");
-
-                        var local = nullableLocals[nullableType];
-
                         // get the first value and store it into a local
                         il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-                        il.Emit(OpCodes.Stloc, local);
-
-                        // compare the HasValue properties
-                        il.Emit(OpCodes.Ldloca_S, local);
-                        il.Emit(OpCodes.Call, hasValue.GetMethod);
+                        il.Emit(OpCodes.Ldflda, property.GetBackingField());
+                        il.Emit(OpCodes.Call, property.PropertyType.GetProperty("HasValue").GetMethod);
                     }
                     else
                     {
                         il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
+                        il.Emit(OpCodes.Ldfld, property.GetBackingField());
                     }

                     il.Emit(OpCodes.Brfalse_S, includedEndif);
@@ -611,7 +405,7 @@
                     // Add the column name
                     il.Emit(OpCodes.Ldloc, columnNamesLocal);
                     il.Emit(OpCodes.Ldstr, column.ColumnName);
-                    il.Emit(OpCodes.Call, stringListType.GetMethod("Add"));
+                    il.Emit(OpCodes.Call, columnNamesListType.GetMethod("Add"));

                     #region AddTheParameter

@@ -623,35 +417,8 @@
                     }
                     else
                     {
-                        // create the new parameter
-                        il.Emit(OpCodes.Ldnull);
-                        il.Emit(OpCodes.Ldc_I4, property.PropertyType.IsArray ? (int)(NpgsqlDbType.Array | column.NpgsDataType) : (int)column.NpgsDataType);
-                        il.Emit(OpCodes.Newobj, parameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
-
-                        il.Emit(OpCodes.Dup);
-                        il.Emit(OpCodes.Ldarg_0);
-                        il.Emit(OpCodes.Call, property.GetMethod);
-
-                        if (property.PropertyType.IsValueType)
-                        {
-                            il.Emit(OpCodes.Box, property.PropertyType);
-                        }
-
-                        // if its null then set it to dbnull
-                        var endif = il.DefineLabel();
-
-                        il.Emit(OpCodes.Dup);
-
-                        il.Emit(OpCodes.Brtrue_S, endif);
-
-                        // the value is null, replace it with DbNull.Value
-                        il.Emit(OpCodes.Pop);
-                        il.Emit(OpCodes.Ldsfld, typeof(DBNull).GetField("Value"));
-
-                        il.MarkLabel(endif);
-
-                        // set the Value property of the NpgsqlParameter
-                        il.Emit(OpCodes.Call, parameterType.GetProperty("Value").SetMethod);
+                        var npgsDataType = property.PropertyType.IsArray ? NpgsqlDbType.Array | column.NpgsDataType : column.NpgsDataType;
+                        EmitNpgsqlParameter(il, property, npgsDataType, () => il.Emit(OpCodes.Ldarg_0));
                     }

                     il.Emit(OpCodes.Call, parameterListType.GetMethod("Add"));
@@ -676,6 +443,116 @@
                 il.Emit(OpCodes.Ret);
             });
         }
+
+        /// <summary>
+        /// Emits a reference to a newly created NpgsqlParameter(Of T) object
+        /// </summary>
+        /// <param name="il">The generator.</param>
+        /// <param name="property">The property from which to retrieve the value for the parameter.</param>
+        /// <param name="npgsDataType">The NpgsqlDbType value for the parameter.</param>
+        /// <param name="loadObject">A function that emits the code required to push the clr object to the stack.</param>
+        private static void EmitNpgsqlParameter(ILGenerator il, PropertyInfo property, NpgsqlDbType npgsDataType, Action loadObject)
+        {
+            var genericParameterType = typeof(NpgsqlParameter<>);
+            var dbNullValue = typeof(DBNull).GetField("Value");
+
+            if (!property.PropertyType.IsValueType) {
+
+                var nullParameterType = genericParameterType.MakeGenericType(typeof(DBNull));
+                var concreteParameterType = genericParameterType.MakeGenericType(property.PropertyType);
+
+                loadObject();
+                il.Emit(OpCodes.Ldfld, property.GetBackingField());
+
+                var ifNotNullLabel = il.DefineLabel();
+                var endifLabel = il.DefineLabel();
+
+                il.Emit(OpCodes.Brtrue_S, ifNotNullLabel);
+
+                // if null
+                il.Emit(OpCodes.Ldnull);
+                il.Emit(OpCodes.Ldc_I4, (int)npgsDataType);
+                il.Emit(OpCodes.Newobj, nullParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
+
+                il.Emit(OpCodes.Dup);
+
+                il.Emit(OpCodes.Ldsfld, dbNullValue);
+                il.Emit(OpCodes.Stfld, nullParameterType.GetProperty("TypedValue").GetBackingField());
+
+                il.Emit(OpCodes.Br_S, endifLabel);
+
+                il.MarkLabel(ifNotNullLabel);
+
+                // if not null
+                il.Emit(OpCodes.Ldnull);
+                il.Emit(OpCodes.Ldc_I4, (int)npgsDataType);
+                il.Emit(OpCodes.Newobj, concreteParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
+
+                il.Emit(OpCodes.Dup);
+
+                loadObject();
+                il.Emit(OpCodes.Ldfld, property.GetBackingField());
+                il.Emit(OpCodes.Stfld, concreteParameterType.GetProperty("TypedValue").GetBackingField());
+
+                il.MarkLabel(endifLabel);
+            }
+            else if (IsNullableType(property.PropertyType))
+            {
+                var nullParameterType = genericParameterType.MakeGenericType(typeof(DBNull));
+                var concreteParameterType = genericParameterType.MakeGenericType(Nullable.GetUnderlyingType(property.PropertyType));
+
+                var ifNotNullLabel = il.DefineLabel();
+                var endifLabel = il.DefineLabel();
+
+                loadObject();
+                il.Emit(OpCodes.Ldflda, property.GetBackingField());
+                il.Emit(OpCodes.Call, property.PropertyType.GetProperty("HasValue").GetMethod);
+
+                il.Emit(OpCodes.Brtrue_S, ifNotNullLabel);
+
+                // if null
+                il.Emit(OpCodes.Ldnull);
+                il.Emit(OpCodes.Ldc_I4, (int)npgsDataType);
+                il.Emit(OpCodes.Newobj, nullParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
+
+                il.Emit(OpCodes.Dup);
+
+                il.Emit(OpCodes.Ldsfld, dbNullValue);
+                il.Emit(OpCodes.Stfld, nullParameterType.GetProperty("TypedValue").GetBackingField());
+
+                il.Emit(OpCodes.Br_S, endifLabel);
+
+                il.MarkLabel(ifNotNullLabel);
+
+                // if not null
+                il.Emit(OpCodes.Ldnull);
+                il.Emit(OpCodes.Ldc_I4, (int)npgsDataType);
+                il.Emit(OpCodes.Newobj, concreteParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
+
+                il.Emit(OpCodes.Dup);
+
+                loadObject();
+                il.Emit(OpCodes.Ldflda, property.GetBackingField());
+                il.Emit(OpCodes.Call, property.PropertyType.GetMethod("GetValueOrDefault", Array.Empty<Type>()));
+                il.Emit(OpCodes.Stfld, concreteParameterType.GetProperty("TypedValue").GetBackingField());
+
+                il.MarkLabel(endifLabel);
+            }
+            else
+            {
+                var concreteParameterType = genericParameterType.MakeGenericType(property.PropertyType);
+
+                il.Emit(OpCodes.Ldnull);
+                il.Emit(OpCodes.Ldc_I4, (int)npgsDataType);
+                il.Emit(OpCodes.Newobj, concreteParameterType.GetConstructor(new[] { typeof(string), typeof(NpgsqlDbType) }));
+
+                il.Emit(OpCodes.Dup);
+
+                loadObject();
+                il.Emit(OpCodes.Ldfld, property.GetBackingField());
+                il.Emit(OpCodes.Stfld, concreteParameterType.GetProperty("TypedValue").GetBackingField());
+            }
+        }
     }

     public static class PropertyInfoExtensions


Shifted config path resolution along 1 char to avoid \ issue

--- src/Unicorn/ConfigurationUtility.cs
+++ src/Unicorn/ConfigurationUtility.cs
@@ -8,9 +8,9 @@
 		/// </summary>
 		public static string ResolveConfigurationPath(string configPath)
 		{
-			if (configPath.StartsWith("~"))
+			if (configPath.StartsWith("~/"))
 			{
-				return System.Web.Hosting.HostingEnvironment.MapPath("~/") + configPath.Substring(1).Replace('/', '\\');
+				return System.Web.Hosting.HostingEnvironment.MapPath("~") + configPath.Substring(2).Replace('/', '\\');
 				// +1 to Stack Overflow:
 				// http://stackoverflow.com/questions/4742257/how-to-use-server-mappath-when-httpcontext-current-is-nothing
 			}


Remove incorrect header check assertions

--- LSLib/Granny/GR2/Reader.cs
+++ LSLib/Granny/GR2/Reader.cs
@@ -197,10 +197,6 @@
                 Debug.Assert(header.compressedSize == header.uncompressedSize);
                 Debug.Assert(header.offsetInFile + header.uncompressedSize <= Header.fileSize);
             }
-
-            // TODO: check alignment, secondaryDataOffset[2]
-            Debug.Assert(header.relocationsOffset <= Header.fileSize);
-            Debug.Assert(header.mixedMarshallingDataOffset <= Header.fileSize);

 #if DEBUG_GR2_SERIALIZATION
             System.Console.WriteLine(" ===== Section Header ===== ");


GetWindowPlacement implemented for non-absolute values. (#13)

--- src/WpfScreenHelper/WindowHelper.cs
+++ src/WpfScreenHelper/WindowHelper.cs
@@ -44,10 +44,21 @@
         /// </summary>
         public static Rect GetWindowAbsolutePlacement(this Window window)
         {
+            var placement = GetWindowPlacement(window);
+
+            return new Rect(
+                Math.Abs(placement.Left),
+                Math.Abs(placement.Top),
+                placement.Width,
+                placement.Height);
+        }
+
+        public static Rect GetWindowPlacement(this Window window)
+        {
             var screen = Screen.FromWindow(window);

-            var left = Math.Abs(screen.WpfBounds.Left - window.Left) * screen.ScaleFactor;
-            var top = Math.Abs(screen.WpfBounds.Top - window.Top) * screen.ScaleFactor;
+            var left = (screen.WpfBounds.Left - window.Left) * screen.ScaleFactor;
+            var top = (screen.WpfBounds.Top - window.Top) * screen.ScaleFactor;
             var width = window.Width * screen.ScaleFactor;
             var height = window.Height * screen.ScaleFactor;


Fix return statement

Fix return statement

--- PortableExtensions/System.DateTime/DateTime.LastDayOfWeek.cs
+++ PortableExtensions/System.DateTime/DateTime.LastDayOfWeek.cs
@@ -18,10 +18,9 @@
         /// <returns>Returns the last day of the given week.</returns>
         public static DateTime LastDayOfWeek ( this DateTime week )
         {
-            if ( week.DayOfWeek == DayOfWeek.Sunday )
-                return new DateTime( week.Year, week.Month, week.Day );
-
-            return new DateTime( week.Year, week.Month, week.Day ).AddDays( 7 - (Int32) week.DayOfWeek );
+            return week.DayOfWeek == DayOfWeek.Sunday
+                ? new DateTime( week.Year, week.Month, week.Day )
+                : new DateTime( week.Year, week.Month, week.Day ).AddDays( 7 - (Int32) week.DayOfWeek );
         }
     }
 }


Improved auto-name feature to change on model change Will not change name if user types value into name box

--- PrinterControls/PrinterConnections/SetupStepMakeModelName.cs
+++ PrinterControls/PrinterConnections/SetupStepMakeModelName.cs
@@ -29,6 +29,8 @@

         Button nextButton;

+		bool usingDefaultName;
+
         public SetupStepMakeModelName(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinter = null)
             : base(windowController, containerWindowToClose, setupPrinter)
         {
@@ -53,6 +55,8 @@
             footerRow.AddChild(nextButton);
             footerRow.AddChild(hSpacer);
             footerRow.AddChild(cancelButton);
+
+			usingDefaultName = true;

             SetElementState();
         }
@@ -78,6 +82,7 @@

             printerNameInput = new MHTextEditWidget(this.ActivePrinter.Name);
             printerNameInput.HAnchor = HAnchor.ParentLeftRight;
+			printerNameInput.KeyPressed += new KeyPressEventHandler(PrinterNameInput_KeyPressed);

 			printerNameError = new TextWidget(LocalizedString.Get("Give your printer a name."), 0, 0, 10);
 			printerNameError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
@@ -177,7 +182,16 @@
             LoadSetupSettings(ActivePrinter.Make, ActivePrinter.Model);
             printerModelError.Visible = false;
             SetElementState();
-        }
+			if(usingDefaultName)
+			{
+				printerNameInput.Text = String.Format ("{0} {1} ({2})", this.ActivePrinter.Make, this.ActivePrinter.Model, ExistingPrinterCount () + 1);
+			}
+        }
+
+		private void PrinterNameInput_KeyPressed(object sender, KeyPressEventArgs e)
+		{
+			this.usingDefaultName = false;
+		}

         string defaultMaterialPreset;
         string defaultQualityPreset;
@@ -425,10 +439,7 @@

         void NextButton_Click(object sender, EventArgs mouseEvent)
         {
-			if(printerNameInput.Text == "Default Printer ({0})".FormatWith(ExistingPrinterCount() + 1))
-			{
-				printerNameInput.Text = String.Format ("{0} {1} ({2})", this.ActivePrinter.Make, this.ActivePrinter.Model, ExistingPrinterCount () + 1);
-			}
+
             bool canContinue = this.OnSave();
             if (canContinue)
             {


not even covid will stop me from automating

--- RelhaxModpack/RelhaxModpack/Automation/DownloadStaticTask.cs
+++ RelhaxModpack/RelhaxModpack/Automation/DownloadStaticTask.cs
@@ -58,6 +58,8 @@

             using (WebClient = new WebClient())
             {
+                Logging.Info(Logfiles.AutomationRunner, "Downloading file");
+                Logging.Debug(Logfiles.AutomationRunner, "Download url = {0}, file = {1}", Url, DestinationPath);
                 //https://stackoverflow.com/questions/2953403/c-sharp-passing-method-as-the-argument-in-a-method
                 if (DatabaseAutomationRunner != null)
                     WebClient.DownloadProgressChanged += DatabaseAutomationRunner.DownloadProgressChanged;


AssemblyInfo added

AssemblyInfo added


TVA.PhasorProtocols: Fixed bug in insert query for secure publisher adapter.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/openpdc/Synchrophasor/Current Version;C74857

--- Source/Libraries/TVA.PhasorProtocols/CommonPhasorServices.cs
+++ Source/Libraries/TVA.PhasorProtocols/CommonPhasorServices.cs
@@ -1419,15 +1419,7 @@

                 if (Convert.ToInt32(connection.ExecuteScalar("SELECT COUNT(*) FROM CustomActionAdapter WHERE AdapterName='SecureDataPublisher'")) == 0)
                 {
-                    query = ParameterizedQueryString(adapterType, "INSERT INTO CustomActionAdapter(NodeID, AdapterName, AssemblyName, TypeName, ConnectionString, Enabled) " +
-                        "VALUES ({0}, {1}, {2}, {3}, {4}, {5})", "nodeID", "adapterName", "assemblyName", "typeName", "connectionString", "enabled");
-
-                    using (IDbCommand command = connection.CreateParameterizedCommand(query, nodeIDQueryString, "SecureDataPublisher", "TimeSeriesFramework.dll",
-                        "TimeSeriesFramework.Transport.DataPublisher", "requireAuthentication=true", 1))
-                    {
-                        command.ExecuteNonQuery();
-                    }
-
+                    connection.ExecuteNonQuery(string.Format("INSERT INTO CustomActionAdapter(NodeID, AdapterName, AssemblyName, TypeName, ConnectionString, Enabled) VALUES({0}, 'SecureDataPublisher', 'TimeSeriesFramework.dll', 'TimeSeriesFramework.Transport.DataPublisher', 'requireAuthentication=true', 1)", nodeIDQueryString));
                 }

             }


Synchrophasor: Modified CommonPhasorServices to update the publisher's DataSource.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/openpdc/Synchrophasor/Current Version;C68324

--- Source/Libraries/TVA.PhasorProtocols/CommonPhasorServices.cs
+++ Source/Libraries/TVA.PhasorProtocols/CommonPhasorServices.cs
@@ -283,6 +283,24 @@
                 }

                 return status.ToString();
+            }
+        }
+
+        /// <summary>
+        /// Gets or sets <see cref="DataSet"/> based data source available to the <see cref="CommonPhasorServices"/> instance.
+        /// </summary>
+        public override DataSet DataSource
+        {
+            get
+            {
+                return base.DataSource;
+            }
+            set
+            {
+                base.DataSource = value;
+
+                if (m_dataPublisher != null)
+                    m_dataPublisher.DataSource = value;
             }
         }


Now checks what tile a unit is on

Now checks what tile a unit is on

--- Squazz.HotCiv.Core/Game.cs
+++ Squazz.HotCiv.Core/Game.cs
@@ -165,6 +165,10 @@

             if (GetCityAt(unitPosition) != null)
                 attack *= 3;
+
+            if (GetTileAt(unitPosition).Type == GameConstants.Hills ||
+                GetTileAt(unitPosition).Type == GameConstants.Forest)
+                attack *= 2;

             return attack;
         }
@@ -172,8 +176,13 @@
         {
             var unit = GetUnitAt(unitPosition);
             var defence = unit.Defense;
+
             if (GetCityAt(unitPosition) != null)
                 defence *= 3;
+
+            if (GetTileAt(unitPosition).Type == GameConstants.Hills ||
+                GetTileAt(unitPosition).Type == GameConstants.Forest)
+                defence *= 2;

             return defence;
         }


-Documentation

-Documentation

--- Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
+++ Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
@@ -1367,7 +1367,7 @@
         }

         /// <summary>
-        /// Resolves the key of the dictionary. By default <see cref="M:ResolvePropertyName"/> is used to resolve dictionary keys.
+        /// Resolves the key of the dictionary. By default <see cref="ResolvePropertyName"/> is used to resolve dictionary keys.
         /// </summary>
         /// <param name="dictionaryKey">Key of the dictionary.</param>
         /// <returns>Resolved key of the dictionary.</returns>


Adds the hello world sample.

Adds the hello world sample.


Add unit test

Add unit test


Fix issue with MatterControlRuns test when no printers exist

--- Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs
+++ Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs
@@ -112,7 +112,7 @@

 				Assert.IsTrue(testRunner.NameExists("SettingsAndControls"));

-				MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
+				testRunner.ClickByName("Library Tab");

 				return Task.FromResult(0);
 			};


Updated to only list Tournaments you have admin permission on.

--- Scoreboard/Tourney.cs
+++ Scoreboard/Tourney.cs
@@ -45,6 +45,7 @@
         public Tourney(Score score)
         {
             _baseUrl = Properties.Settings.Default.TourneyUrl;
+            //_baseUrl = "http://localhost:8000"; // Testing
             if (Tourney._httpClient == null)
             {
                 Tourney._httpClient = new HttpClient();
@@ -145,7 +146,8 @@
                 UserCredential credential;
                 using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
                 {
-                    credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, new[] { "profile" }, "user", CancellationToken.None).Result;
+                    credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, new[] { "profile" }, "profile", CancellationToken.None).Result;
+                    var m = credential.GetAccessTokenForRequestAsync().Result;

                     _authenticated = true;
                     _googleToken = credential.Token.IdToken;
@@ -202,7 +204,7 @@
             // List Tournaments
             BackgroundWorker worker = new BackgroundWorker();
             worker.DoWork += delegate {
-                _tournaments = GetRequestAsJObject("/data/tournaments");
+                _tournaments = GetRequestAsJObject("/data/tournaments?admin=1");
             };
             worker.RunWorkerCompleted += delegate
             {


Deleted a couple of protected methods and moved their functionality to their only calling method.

--- TestRail/TestRailClient.cs
+++ TestRail/TestRailClient.cs
@@ -220,21 +220,39 @@
             return SendCommand<Run>(uri, jsonParams);
         }

-        /// Add a case
-        /// <param name="sectionId">section id to add the case to</param>
-        /// <param name="title">title of the case</param>
-        /// <param name="typeId">(optional)the ID of the case type</param>
-        /// <param name="priorityId">(optional)the id of the case priority</param>
-        /// <param name="estimate">(optional)the estimate, e.g. "30s" or "1m 45s"</param>
-        /// <param name="milestoneId">(optional)the ID of the milestone to link to the test case</param>
-        /// <param name="refs">(optional)a comma-separated list of references/requirements</param>
-        /// <param name="customFields">(optional)a json object for custom fields</param>
-        /// <returns>result of the command</returns>
-        public CommandResult<ulong> AddCase(ulong sectionId, string title, ulong? typeId = null, ulong? priorityId = null,
+        /// Creates a new test case.
+        /// <param name="sectionId">The ID of the section the test case should be added to.</param>
+        /// <param name="title">The title of the test case (required).</param>
+        /// <param name="typeId">The ID of the case type.</param>
+        /// <param name="priorityId">The ID of the case priority.</param>
+        /// <param name="estimate">The estimate, e.g. "30s" or "1m 45s".</param>
+        /// <param name="milestoneId">The ID of the milestone to link to the test case.</param>
+        /// <param name="refs">A comma-separated list of references/requirements.</param>
+        /// <param name="customFields">Custom fields are supported as well and must be submitted with their system name, prefixed with 'custom_', e.g. custom_preconds</param>
+        /// <returns>If successful, this method returns the new test case.</returns>
+        public RequestResult<Case> AddCase(ulong sectionId, string title, ulong? typeId = null, ulong? priorityId = null,
             string estimate = null, ulong? milestoneId = null, string refs = null, JObject customFields = null)
         {
-            // TODO: Update to RequestResult
-            return _AddCase_(sectionId, title, typeId, priorityId, estimate, milestoneId, refs, customFields);
+            if (string.IsNullOrWhiteSpace(title))
+            {
+                return new RequestResult<Case>(HttpStatusCode.BadRequest, thrownException: new ArgumentNullException(nameof(title)));
+            }
+
+            var uri = _CreateUri_(CommandType.Add, CommandAction.Case, sectionId);
+
+            var tmpCase = new Case
+            {
+                Title = title,
+                TypeId = typeId,
+                PriorityId = priorityId,
+                Estimate = estimate,
+                MilestoneId = milestoneId,
+                References = refs
+            };
+
+            var jsonParams = JsonUtility.Merge(tmpCase.GetJson(), customFields);
+
+            return SendCommand<Case>(uri, jsonParams);
         }

         /// Creates a new project (admin status required).
@@ -410,7 +428,26 @@
             // We should return the case object instead as the official API documentation suggests.
             // http://docs.gurock.com/testrail-api2/reference-cases#update_case

-            return _UpdateCase_(caseId, title, typeId, priorityId, estimate, milestoneId, refs, customs);
+            if (string.IsNullOrWhiteSpace(title))
+            {
+                return new CommandResult<ulong>(false, 0, new ArgumentNullException(nameof(title)));
+            }
+
+            var uri = _CreateUri_(CommandType.Update, CommandAction.Case, caseId);
+
+            var tmpCase = new Case
+            {
+                Title = title,
+                TypeId = typeId,
+                PriorityId = priorityId,
+                Estimate = estimate,
+                MilestoneId = milestoneId,
+                References = refs
+            };
+
+            var jsonParams = JsonUtility.Merge(tmpCase.GetJson(), customs);
+
+            return _SendCommand(uri, jsonParams);
         }

         /// updates an existing milestone (partial updates are supported,
@@ -1116,76 +1153,6 @@

             return uri;
         }
-
-        /// Add a case
-        /// <param name="sectionId">section id to add the case to</param>
-        /// <param name="title">title of the case</param>
-        /// <param name="typeId">(optional)the ID of the case type</param>
-        /// <param name="priorityId">(optional)the id of the case priority</param>
-        /// <param name="estimate">(optional)the estimate, e.g. "30s" or "1m 45s"</param>
-        /// <param name="milestoneId">(optional)the ID of the milestone to link to the test case</param>
-        /// <param name="refs">(optional)a comma-separated list of references/requirements</param>
-        /// <param name="customs">(optional)custom json params to add to the current json parameters</param>
-        /// <returns>result of the command</returns>
-        protected CommandResult<ulong> _AddCase_(ulong sectionId, string title, ulong? typeId = null,
-            ulong? priorityId = null, string estimate = null, ulong? milestoneId = null, string refs = null, JObject customs = null)
-        {
-            if (string.IsNullOrWhiteSpace(title))
-            {
-                return new CommandResult<ulong>(false, 0, new ArgumentNullException(nameof(title)));
-            }
-
-            var uri = _CreateUri_(CommandType.Add, CommandAction.Case, sectionId);
-
-            var tmpCase = new Case
-            {
-                Title = title,
-                TypeId = typeId,
-                PriorityId = priorityId,
-                Estimate = estimate,
-                MilestoneId = milestoneId,
-                References = refs
-            };
-
-            var jsonParams = JsonUtility.Merge(tmpCase.GetJson(), customs);
-
-            return _SendCommand(uri, jsonParams);
-        }
-
-        /// update an existing case
-        /// <param name="caseId">the ID of the test case</param>
-        /// <param name="title">title of the case</param>
-        /// <param name="typeId">(optional)the ID of the case type</param>
-        /// <param name="priorityId">(optional)the id of the case priority</param>
-        /// <param name="estimate">(optional)the estimate, e.g. "30s" or "1m 45s"</param>
-        /// <param name="milestoneId">(optional)the ID of the milestone to link to the test case</param>
-        /// <param name="refs">(optional)a comma-separated list of references/requirements</param>
-        /// <param name="customs">(optional)any extra parameters being passed into the update command</param>
-        /// <returns>result of the command</returns>
-        protected CommandResult<ulong> _UpdateCase_(ulong caseId, string title, ulong? typeId = null, ulong? priorityId = null, string estimate = null,
-            ulong? milestoneId = null, string refs = null, JObject customs = null)
-        {
-            if (string.IsNullOrWhiteSpace(title))
-            {
-                return new CommandResult<ulong>(false, 0, new ArgumentNullException(nameof(title)));
-            }
-
-            var uri = _CreateUri_(CommandType.Update, CommandAction.Case, caseId);
-
-            var tmpCase = new Case
-            {
-                Title = title,
-                TypeId = typeId,
-                PriorityId = priorityId,
-                Estimate = estimate,
-                MilestoneId = milestoneId,
-                References = refs
-            };
-
-            var jsonParams = JsonUtility.Merge(tmpCase.GetJson(), customs);
-
-            return _SendCommand(uri, jsonParams);
-        }
         #endregion Protected Methods

         #region Private Methods


Copy missing files ordered by size

Copy missing files ordered by size


Ensure a dead connection throws a SocketException on read.


Added getResponse with ParameterType parameter

Needed to specify Cookie parameter for Gamemaster API calls


Fix sync instance check (#58)

Fix sync instance check (#58)


Log tweaked (newest entries first).

Log tweaked (newest entries first).


change keyHeader to name (#10877)

change keyHeader to name (#10877)

--- sdk/core/Azure.Core/src/Shared/AzureKeyCredentialPolicy.cs
+++ sdk/core/Azure.Core/src/Shared/AzureKeyCredentialPolicy.cs
@@ -7,27 +7,27 @@
 {
     internal class AzureKeyCredentialPolicy : HttpPipelineSynchronousPolicy
     {
-        private readonly string _keyHeader;
+        private readonly string _name;
         private readonly AzureKeyCredential _credential;

         /// <summary>
         /// Initializes a new instance of the <see cref="AzureKeyCredentialPolicy"/> class.
         /// </summary>
         /// <param name="credential">The <see cref="AzureKeyCredential"/> used to authenticate requests.</param>
-        /// <param name="keyHeader">The name of the API key header used for signing requests.</param>
-        public AzureKeyCredentialPolicy(AzureKeyCredential credential, string keyHeader)
+        /// <param name="name">The name of the key header used for the credential.</param>
+        public AzureKeyCredentialPolicy(AzureKeyCredential credential, string name)
         {
             Argument.AssertNotNull(credential, nameof(credential));
-            Argument.AssertNotNullOrEmpty(keyHeader, nameof(keyHeader));
+            Argument.AssertNotNullOrEmpty(name, nameof(name));
             _credential = credential;
-            _keyHeader = keyHeader;
+            _name = name;
         }

         /// <inheritdoc/>
         public override void OnSendingRequest(HttpMessage message)
         {
             base.OnSendingRequest(message);
-            message.Request.Headers.SetValue(_keyHeader, _credential.Key);
+            message.Request.Headers.SetValue(_name, _credential.Key);
         }
     }
 }


test 3re

test 3re

--- testgit23/testgit23/Views/Home/Index.cshtml
+++ testgit23/testgit23/Views/Home/Index.cshtml
@@ -10,7 +10,7 @@

ASP.NET -david.z 1655 34234 test2-brah1 q

ASP.NET -david.z 1655 34234 test2-brah1

-
ASP.NET -david.z 1655 34234 test3-brah2

+
ASP.NET -david.z 1655 34234 test3-brah2 3re


Lock around contains too

Lock around contains too

--- src/Aggregates.NET/Internal/BulkInvokeHandlerTerminator.cs
+++ src/Aggregates.NET/Internal/BulkInvokeHandlerTerminator.cs
@@ -60,7 +60,11 @@

             var key = $"{messageHandler.HandlerType.FullName}:{msgType.FullName}";
-            if (IsNotDelayed.Contains(key))
+
+            bool contains = false;
+            lock (Lock) contains = IsNotDelayed.Contains(key);
+
+            if (contains)
             {
                 Logger.Write(LogLevel.Debug, () => $"Invoking handle for message {msgType.FullName} on handler {messageHandler.HandlerType.FullName}");
                 await messageHandler.Invoke(context.MessageBeingHandled, context).ConfigureAwait(false);


Added StyleRepo.Register overload that takes Type

This should simplify assignment of styles using reflection.

--- src/DotVVM.Framework/Compilation/Styles/StyleRepository.cs
+++ src/DotVVM.Framework/Compilation/Styles/StyleRepository.cs
@@ -37,6 +37,20 @@
         }

         /// <summary>
+        /// Registers a server-side style for <paramref name="type"/> that is applied upon compilation.
+        /// </summary>
+        /// <param name="type">All objects of this type will have the style applied to them unless <paramref name="matcher"/> is specified.</param>
+        /// <param name="matcher">If this function returns true, the style will be applied, otherwise not.</param>
+        /// <param name="allowDerived">Also allow classes that are derived from <paramref name="type"/>.</param>
+        /// <returns>A <see cref="StyleBuilder{T}"/> that can be used to style the control.</returns>
+        public StyleBuilder<DotvvmBindableObject> Register(Type type, Func<StyleMatchContext, bool> matcher = null, bool allowDerived = true)
+        {
+            var styleBuilder = new StyleBuilder<DotvvmBindableObject>(matcher, allowDerived);
+            Styles.Add(styleBuilder.GetStyle());
+            return styleBuilder;
+        }
+
+        /// <summary>
         /// Registers a server-side style for a HTML tag that is applied upon compilation.
         /// </summary>
         /// <param name="tagName">The HTML tag the style is applied to.</param>


Simplify code.

Simplify code.

--- src/EditorFeatures/Test/Workspaces/TestWorkspaceFactory.cs
+++ src/EditorFeatures/Test/Workspaces/TestWorkspaceFactory.cs
@@ -139,7 +139,7 @@
             return await CreateWorkspaceAsync(workspaceElement, exportProvider: exportProvider, workspaceKind: workspaceKind);
         }

-        internal static Task<TestWorkspace> CreateWorkspaceFromFilesAsync(
+        internal static Task<TestWorkspace> CreateWorkspaceAsync(
             string language,
             CompilationOptions compilationOptions,
             ParseOptions[] parseOptions,
@@ -208,7 +208,7 @@
             CompilationOptions compilationOptions = null,
             ExportProvider exportProvider = null)
         {
-            return CreateWorkspaceFromFilesAsync(LanguageNames.CSharp, compilationOptions, parseOptions, files, exportProvider);
+            return CreateWorkspaceAsync(LanguageNames.CSharp, compilationOptions, parseOptions, files, exportProvider);
         }

         #endregion
@@ -232,7 +232,7 @@
             ExportProvider exportProvider = null,
             string[] metadataReferences = null)
         {
-            return TestWorkspaceFactory.CreateWorkspaceAsync(LanguageNames.VisualBasic, compilationOptions, parseOptions, files, exportProvider, metadataReferences);
+            return CreateWorkspaceAsync(LanguageNames.VisualBasic, compilationOptions, parseOptions, files, exportProvider, metadataReferences);
         }

         /// <param name="files">Can pass in multiple file contents with individual source kind: files will be named test1.vb, test2.vbx, etc.</param>
@@ -242,7 +242,7 @@
             CompilationOptions compilationOptions = null,
             ExportProvider exportProvider = null)
         {
-            return TestWorkspaceFactory.CreateWorkspaceFromFilesAsync(LanguageNames.VisualBasic, compilationOptions, parseOptions, files, exportProvider);
+            return CreateWorkspaceAsync(LanguageNames.VisualBasic, compilationOptions, parseOptions, files, exportProvider);
         }

         #endregion


Use KnockoutBindingGroup.AddValue in HierarchyRepeaterLevel

--- src/Framework/Framework/Controls/HierarchyRepeaterLevel.cs
+++ src/Framework/Framework/Controls/HierarchyRepeaterLevel.cs
@@ -4,6 +4,7 @@
 using DotVVM.Framework.Binding;
 using DotVVM.Framework.Binding.Expressions;
 using DotVVM.Framework.Hosting;
+using DotVVM.Framework.Utils;

 namespace DotVVM.Framework.Controls
 {
@@ -28,11 +29,12 @@

             if (!RenderOnServer)
             {
-                writer.WriteKnockoutDataBindComment("template", new KnockoutBindingGroup {
-                    { "foreach", ForeachExpression },
-                    { "name", ItemTemplateId ?? string.Empty },
-                    { "hierarchyRole", IsRoot ? "Root" : "Child" }
-                }.ToString());
+                var koGroup = new KnockoutBindingGroup {
+                    { "foreach", ForeachExpression }
+                };
+                koGroup.AddValue("name", ItemTemplateId.NotNull());
+                koGroup.AddValue("hierarchyRole", IsRoot ? "Root" : "Child");
+                writer.WriteKnockoutDataBindComment("template", koGroup.ToString());
             }
             else
             {


added FIXME task

added FIXME task

--- src/HyperFastCgi/AppHosts/AspNet/AspNetNativeWebRequest.cs
+++ src/HyperFastCgi/AppHosts/AspNet/AspNetNativeWebRequest.cs
@@ -137,6 +137,7 @@

 		public new void AddServerVariable(string name, string value)
 		{
+			//FIXME: maybe we should use base.AddServerVariable
 			parameter_table.Add (name, value);
 		}


don't compare log lines individudally, as this is impossible. compare total count

--- src/IntegrationTests/NxLog/NxLogProcessFileWatcherTests.cs
+++ src/IntegrationTests/NxLog/NxLogProcessFileWatcherTests.cs
@@ -132,17 +132,7 @@
 			//There should be more lines logged with rotation than without due to extra "LogFile C:\Users\david.laing\AppData\Local\Temp\nxlog-data-565083914ab7404aaee03df6e8f759e7\nxlog.log reopened" messages
 			Assert.GreaterOrEqual(withRotation.Count, withoutRotation.Count);

-			var withoutRotationCount =
-				withoutRotation.GroupBy(val => val, (key, values) => new { Message = key, Count = values.Count() });
-
-			//Every line logged without rotation should appear once with rotation
-			foreach (var group in withoutRotationCount)
-			{
-				var matches = withRotation.FindAll(l => l == group.Message);
-
-				Assert.IsTrue(matches.Count > 0,
-					string.Format("{0} count doesn't match - {1} without rotation, {2} with rotation", group.Message, group.Count, matches.Count));
-			}
+			Assert.IsTrue(withRotation.Count < withoutRotation.Count * 2);
 		}

 		[Test]


Set IconEntry so that you can set IsPng to false when width or height is greater than 255.


Run from explorer

Run from explorer


added methods to game manager to get previous games hits


modify app title

modify app title


Remove Stub Assembly Info

Remove Stub Assembly Info

--- SharedAssemblyInfo.cs
+++ SharedAssemblyInfo.cs
@@ -1,8 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyCompany("Gelf4net")]
-[assembly: AssemblyFileVersion("3.0.0.3")]
-[assembly: AssemblyVersion("3.0.0.3")]
-[assembly: AssemblyCopyright("Copyright   2017")]
-[assembly: ComVisible(false)]


Update version to 1.3.0

Update version to 1.3.0

--- SharedAssemblyInfo.cs
+++ SharedAssemblyInfo.cs
@@ -18,5 +18,5 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("1.2.0.0")]
-[assembly: AssemblyFileVersion("1.2.0.0")]
+[assembly: AssemblyVersion("1.3.0.0")]
+[assembly: AssemblyFileVersion("1.3.0.0")]


Updated copyright

Updated copyright

--- SharedAssemblyInfo.cs
+++ SharedAssemblyInfo.cs
@@ -5,7 +5,7 @@
 // associated with an assembly.
 [assembly: AssemblyCompany("Daniel Saidi")]
 [assembly: AssemblyProduct("NExtra")]
-[assembly: AssemblyCopyright("Copyright  Daniel Saidi 2011")]
+[assembly: AssemblyCopyright("Copyright  Daniel Saidi 2009-2012")]
 [assembly: AssemblyTrademark("")]

 // Make it easy to distinguish Debug and Release (i.e. Retail) builds;


change: S98.HeaderがIFileHeaderを実装するよう変更

change: S98.HeaderがIFileHeaderを実装するよう変更

--- Sharp98/S98/Header.cs
+++ Sharp98/S98/Header.cs
@@ -33,7 +33,7 @@

 namespace Sharp98.S98
 {
-    public class Header
+    public class Header : IFileHeader
     {
         #region -- Private Static Fields --

@@ -59,20 +59,22 @@

         #region -- Public Properties --

-        public uint TimerInfo { get; private set; }
-
-        public uint TimerInfo2 { get; private set; }
-
-        public double SyncTime
+        public FileType FileType => FileType.S98;
+
+        public int SampleTimeNumerator { get; private set; }
+
+        public int SampleTimeDenominator { get; private set; }
+
+        public double SampleTime
         {
             get
             {
-                return (double)(this.TimerInfo == 0 ? DefaultNumerator : this.TimerInfo) /
-                    (double)(this.TimerInfo2 == 0 ? DefaultDenominator : this.TimerInfo2);
-            }
-        }
-
-        public int LoopPointDumpIndex { get; private set; }
+                return (double)(this.SampleTimeNumerator == 0 ? DefaultNumerator : this.SampleTimeNumerator) /
+                    (double)(this.SampleTimeDenominator == 0 ? DefaultDenominator : this.SampleTimeDenominator);
+            }
+        }
+
+        public int LoopPointIndex { get; private set; }

         public IReadOnlyList<DumpData> S98DumpData => this.s98DumpData;

@@ -80,8 +82,12 @@

         public TagCollection S98TagCollection => this.s98TagCollection;

-
-
+        public IReadOnlyList<IDumpData> DumpData => new CastedReadOnlyList<DumpData, IDumpData>(this.s98DumpData);
+
+        public ITagCollection TagCollection => this.s98TagCollection;
+
+        public IReadOnlyList<IDeviceInfo> Devices => new CastedReadOnlyList<DeviceInfo, IDeviceInfo>(this.s98Devices);
+
         #endregion

         #region -- Constructors --
@@ -99,7 +105,7 @@

             if (timerInfo2 == 0 || timerInfo2 > int.MaxValue)
                 throw new ArgumentOutOfRangeException(nameof(timerInfo2));
-
+
             if (dump == null)
                 throw new ArgumentNullException(nameof(dump));

@@ -112,9 +118,9 @@
             if (loopIndex < -1 || loopIndex >= dump.Count)
                 throw new ArgumentNullException(nameof(loopIndex));

-            this.TimerInfo = timerInfo;
-            this.TimerInfo2 = timerInfo2;
-            this.LoopPointDumpIndex = loopIndex;
+            this.SampleTimeNumerator = (int)timerInfo;
+            this.SampleTimeDenominator = (int)timerInfo2;
+            this.LoopPointIndex = loopIndex;
             this.s98DumpData = dump;
             this.s98TagCollection = tag;
             this.s98Devices = devices;
@@ -123,8 +129,13 @@
         #endregion

         #region -- Public Methods --
-
+
         public void Export(Stream stream)
+        {
+            this.Export(stream, null);
+        }
+
+        public void Export(Stream stream, Encoding encoding)
         {
             if (stream == null)
                 throw new ArgumentNullException(nameof(stream));
@@ -170,7 +181,7 @@

         #region -- Public Static Methods --

-        public static Header Import(Stream stream)
+        public static Header Import(Stream stream, Encoding encoding = null)
         {
             if (stream == null)
                 throw new ArgumentNullException(nameof(stream));
@@ -182,7 +193,6 @@
                 throw new InvalidOperationException("シークができないストリームが指定されました.");

             var buffer = new byte[32];
-            byte[] tagBuffer;
             int loop_index = 0;
             DeviceInfo[] di;
             TagCollection tagCollection;
@@ -209,19 +219,13 @@

             if ((loop > stream.Length) || (loop != 0 && loop < dump))
                 throw new InvalidDataException("ループ位置のオフセットが範囲外です.");
-
+
             if (device_count > 64)
                 throw new InvalidDataException("デバイス数が 64 個を超えています.");
-
+
             di = ImportDevice(device_count, stream, buffer);
-
-            stream.Seek(dump, SeekOrigin.Begin);
-            dumpData = ImportDump(stream, loop, out loop_index, buffer);
-
-            stream.Seek(tag, SeekOrigin.Begin);
-            tagBuffer = new byte[stream.Length - tag];
-            stream.Read(tagBuffer, 0, tagBuffer.Length);
-            tagCollection = new TagCollection(tagBuffer);
+            dumpData = ImportDump(stream, dump, loop, out loop_index, buffer);
+            tagCollection = ImportTag(stream, tag, encoding);

             return new Header(timerInfo, timerInfo2, loop_index, dumpData, tagCollection, di);
         }
@@ -241,10 +245,10 @@
             buffer[3] = (byte)'3';

             // Timer Info
-            (this.TimerInfo == 0 ? DefaultNumerator : this.TimerInfo).GetLEByte(buffer, 4);
+            ((uint)(this.SampleTimeNumerator == 0 ? DefaultNumerator : this.SampleTimeNumerator)).GetLEByte(buffer, 4);

             // Timer Info2
-            (this.TimerInfo2 == 0 ? DefaultDenominator : this.TimerInfo2).GetLEByte(buffer, 8);
+            ((uint)(this.SampleTimeDenominator == 0 ? DefaultDenominator : this.SampleTimeDenominator)).GetLEByte(buffer, 8);

             // Compressing == 0
             // File Offset to Dump Data
@@ -285,11 +289,13 @@
             }
         }

-        private static IReadOnlyList<DumpData> ImportDump(Stream stream, uint loop_offset, out int loop_index, byte[] buffer)
+        private static IReadOnlyList<DumpData> ImportDump(Stream stream, uint dump_offset, uint loop_offset, out int loop_index, byte[] buffer)
         {
             int buffer_int;
             var dumpData = new List<DumpData>();
             loop_index = -1;
+
+            stream.Seek(dump_offset, SeekOrigin.Begin);

             while (true)
             {
@@ -328,6 +334,25 @@
             return dumpData;
         }

+        private static TagCollection ImportTag(Stream stream, uint tag_offset, Encoding encoding)
+        {
+            if (tag_offset == 0)
+            {
+                return new TagCollection();
+            }
+            else
+            {
+                stream.Seek(tag_offset, SeekOrigin.Begin);
+                var tagBuffer = new byte[stream.Length - tag_offset];
+                stream.Read(tagBuffer, 0, tagBuffer.Length);
+
+                if (encoding == null)
+                    return new TagCollection(tagBuffer);
+                else
+                    return new TagCollection(tagBuffer, encoding);
+            }
+        }
+
         private void ExportDevice(Stream stream)
         {
             var buffer = new byte[16];
@@ -349,7 +374,7 @@

             foreach (var dump in this.s98DumpData)
             {
-                if (this.LoopPointDumpIndex == dumpCount)
+                if (this.LoopPointIndex == dumpCount)
                     loopPosition = stream.Position;

                 int dumpLength = dump.Export(buffer);


Finish merge.

Finish merge.

--- Sketchball/Program.cs
+++ Sketchball/Program.cs
@@ -29,9 +29,9 @@
             //f.Height = 500;

-            //Application.Run(new EditorForm());
-            Application.Run(new PlayForm(new PinballMachine()) { Width = 800, Height = 700 });
+            Application.Run(new SelectionForm());
+            //Application.Run(new PlayForm(new PinballMachine(new Size(470, 600))) { Width = 800, Height = 700 });

         }
     }
-}
+}


Style tweak

Style tweak

--- Source/CapComSkins.cs
+++ Source/CapComSkins.cs
@@ -237,6 +237,7 @@

 			menuButton = new GUIStyle(CC_SkinsLibrary.DefUnitySkin.label);
 			menuButton.fontSize = 12 + fontSize;
+			menuButton.fontStyle = FontStyle.Bold;
 			menuButton.padding = new RectOffset(26, 2, 2, 2);
 			menuButton.normal.textColor = XKCDColors.White;
 			menuButton.hover.textColor = XKCDColors.AlmostBlack;


Fix tests

Fix tests

--- Source/Tests/Mocks.cs
+++ Source/Tests/Mocks.cs
@@ -96,7 +96,11 @@
             Mock<IKeyboardState> keyboard = new Mock<IKeyboardState>();
             device.Setup(d => d.KeyboardState).Returns(keyboard.Object);

-            return new Resolver(device.Object);
+            var resolver = new Resolver(device.Object);
+
+            Mock<IAudioBackend> audio = new Mock<IAudioBackend>();
+            resolver.Builder.RegisterInstance(audio.Object);
+            return resolver;
         }

 		public TItem Create<TItem>(params Parameter[] parameters)


Fix SteamAuth memory leak I'll need to rewrite the entire module sooner or later anyway...

--- SteamAuth/SteamWeb.cs
+++ SteamAuth/SteamWeb.cs
@@ -115,18 +115,17 @@

             try
             {
-                HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync();
+	            using (HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync()) {

-                if (response.StatusCode != HttpStatusCode.OK)
-                {
-                    return null;
-                }
+		            if (response.StatusCode != HttpStatusCode.OK) {
+			            return null;
+		            }

-                using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
-                {
-                    string responseData = responseStream.ReadToEnd();
-                    return responseData;
-                }
+		            using (StreamReader responseStream = new StreamReader(response.GetResponseStream())) {
+			            string responseData = responseStream.ReadToEnd();
+			            return responseData;
+		            }
+	            }
             }
             catch (WebException)
             {


update ObservableTableSource

update ObservableTableSource

--- src/iOS/ObservableTableSource.cs
+++ src/iOS/ObservableTableSource.cs
@@ -122,8 +122,7 @@
                             var cell = _table.CellAt(NSIndexPath.FromRowSection(i, 0));
                             if (cell != null)
                             {
-                                _prepareView.Invoke(cell, _items[i]);
-                                cell.SetNeedsLayout();
+                                _table.ReloadRows(new []{ NSIndexPath.FromRowSection(i, 0) }, UITableViewRowAnimation.None);
                             }
                             break;
                         }
@@ -159,12 +158,11 @@
             }

             var item = _items[indexPath.Row];
-            var view = tableView.DequeueReusableCell(_cellIdentifier);
-
-            _prepareView.Invoke(view, item);
-            view.SetNeedsLayout();
-
-            return view;
+            var cell = tableView.DequeueReusableCell(_cellIdentifier);
+
+            _prepareView.Invoke(cell, item);
+
+            return cell;
         }

         public override nfloat EstimatedHeight(UITableView tableView, NSIndexPath indexPath)