Implementation of SQLServerSchema

Implementation of SQLServerSchema

--- src/Evolve/Dialect/SQLServer/SQLServerSchema.cs
+++ src/Evolve/Dialect/SQLServer/SQLServerSchema.cs
@@ -10,7 +10,7 @@

         protected override bool IsExists()
         {
-            string sql = $"SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '{Name}';";
+            string sql = $"SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '{Name}'";
             return _wrappedConnection.DbConnection.QueryForLong(sql) > 0;
         }

@@ -33,7 +33,7 @@

         protected override bool Create()
         {
-            string sql = $"CREATE SCHEMA '{Name}'";
+            string sql = $"CREATE SCHEMA [{Name}]";
             _wrappedConnection.DbConnection.ExecuteNonQuery(sql, _wrappedConnection.CurrentTx);

             return true;
@@ -43,7 +43,7 @@
         {
             Clean();

-            string sql = $"DROP SCHEMA '{Name}'";
+            string sql = $"DROP SCHEMA [{Name}]";
             _wrappedConnection.DbConnection.ExecuteNonQuery(sql, _wrappedConnection.CurrentTx);

             return true;
@@ -56,6 +56,10 @@
             CleanProcedures();
             CleanViews();
             CleanTables();
+            CleanFunctions();
+            CleanTypes();
+            CleanSynonyms();
+            CleanSequences(); // SELECT CAST(LEFT(CAST(SERVERPROPERTY ('productversion') as VARCHAR), 2) as int)

             return true;
         }
@@ -63,13 +67,13 @@
         private void CleanForeignKeys()
         {
             string sql = "SELECT TABLE_NAME, CONSTRAINT_NAME " +
-                         "FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " +
-                         "WHERE TYPE IN ('FOREIGN KEY','CHECK') " +
+                         "FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " +
+                         "WHERE CONSTRAINT_TYPE IN ('FOREIGN KEY','CHECK') " +
                         $"AND TABLE_SCHEMA = '{Name}'";

             _wrappedConnection.DbConnection.QueryForListOfT(sql, (r) => new { Table = r.GetString(0), Constraint = r.GetString(1) }).ToList().ForEach(x =>
             {
-                string drop = $"ALTER TABLE '{Name}.{x.Table}' DROP CONSTRAINT '{x.Constraint}';";
+                string drop = $"ALTER TABLE [{Name}].[{x.Table}] DROP CONSTRAINT [{x.Constraint}]";
                 _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
             });
         }
@@ -84,34 +88,79 @@

             _wrappedConnection.DbConnection.QueryForListOfT(sql, (r) => new { Table = r.GetString(0), Constraint = r.GetString(1) }).ToList().ForEach(x =>
             {
-                string drop = $"ALTER TABLE '{Name}.{x.Table}' DROP CONSTRAINT '{x.Constraint}';";
+                string drop = $"ALTER TABLE [{Name}].[{x.Table}] DROP CONSTRAINT [{x.Constraint}]";
                 _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
             });
         }

         private void CleanProcedures()
         {
-            string sql = $"SELECT routine_name FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_schema = '{Name}' AND routine_type = 'PROCEDURE' ORDER BY created DESC;";
+            string sql = $"SELECT routine_name FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_schema = '{Name}' AND routine_type = 'PROCEDURE' ORDER BY created DESC";
             _wrappedConnection.DbConnection.QueryForListOfString(sql).ToList().ForEach(proc =>
             {
-                string drop = $"DROP PROCEDURE '{Name}.{proc}';";
+                string drop = $"DROP PROCEDURE [{Name}].[{proc}]";
                 _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
             });
         }

         private void CleanViews()
         {
-            string sql = $"SELECT table_name FROM INFORMATION_SCHEMA.VIEWS WHERE table_schema = '{Name}';";
+            string sql = $"SELECT table_name FROM INFORMATION_SCHEMA.VIEWS WHERE table_schema = '{Name}'";
             _wrappedConnection.DbConnection.QueryForListOfString(sql).ToList().ForEach(vw =>
             {
-                string drop = $"DROP VIEW '{Name}.{vw}';";
+                string drop = $"DROP VIEW [{Name}].[{vw}]";
                 _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
             });
         }

         private void CleanTables()
         {
-            // TODO
+            string sql = $"SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='BASE TABLE' AND table_schema = '{Name}'";
+            _wrappedConnection.DbConnection.QueryForListOfString(sql).ToList().ForEach(t =>
+            {
+                string drop = $"DROP TABLE [{Name}].[{t}]";
+                _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
+            });
+        }
+
+        private void CleanFunctions()
+        {
+            string sql = $"SELECT routine_name FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_schema = '{Name}' AND routine_type = 'FUNCTION' ORDER BY created DESC";
+            _wrappedConnection.DbConnection.QueryForListOfString(sql).ToList().ForEach(fn =>
+            {
+                string drop = $"DROP FUNCTION [{Name}].[{fn}]";
+                _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
+            });
+        }
+
+        private void CleanTypes()
+        {
+            string sql = $"SELECT t.name FROM sys.types t INNER JOIN sys.schemas s ON t.schema_id = s.schema_id WHERE t.is_user_defined = 1 AND s.name = '{Name}'";
+            _wrappedConnection.DbConnection.QueryForListOfString(sql).ToList().ForEach(t =>
+            {
+                string drop = $"DROP TYPE [{Name}].[{t}]";
+                _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
+            });
+        }
+
+        private void CleanSynonyms()
+        {
+            string sql = $"SELECT sn.name FROM sys.synonyms sn INNER JOIN sys.schemas s ON sn.schema_id = s.schema_id WHERE s.name = '{Name}'";
+            _wrappedConnection.DbConnection.QueryForListOfString(sql).ToList().ForEach(s =>
+            {
+                string drop = $"DROP SYNONYM [{Name}].[{s}]";
+                _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
+            });
+        }
+
+        private void CleanSequences()
+        {
+            string sql = $"SELECT sequence_name FROM INFORMATION_SCHEMA.SEQUENCES WHERE sequence_schema = '{Name}'";
+            _wrappedConnection.DbConnection.QueryForListOfString(sql).ToList().ForEach(s =>
+            {
+                string drop = $"DROP SEQUENCE [{Name}].[{s}]";
+                _wrappedConnection.DbConnection.ExecuteNonQuery(drop, _wrappedConnection.CurrentTx);
+            });
         }
     }
 }


Update version number.

Update version number.

--- editor/Properties/AssemblyInfo.cs
+++ editor/Properties/AssemblyInfo.cs
@@ -31,4 +31,4 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.58.*")]
+[assembly: AssemblyVersion("1.59.*")]


Resolve duplication between test cases.

Resolve duplication between test cases.

--- src/Fixie.Tests/Cases/ParameterizedCaseTests.cs
+++ src/Fixie.Tests/Cases/ParameterizedCaseTests.cs
@@ -106,10 +106,10 @@
                         ".ZeroArgs passed"));
         }

-        public async Task ShouldFailWithClearExplanationWhenParameterGenerationThrows()
-        {
-            var execution = new ParameterizedExecution(BuggyParameterSource);
-            (await RunAsync<ParameterizedTestClass>(execution))
+        public async Task ShouldSupportIsolatingFailuresToTheAffectedTestMethodWhenParameterGenerationThrows()
+        {
+            var isolatedExecution = new ParameterizedExecution(BuggyParameterSource);
+            (await RunAsync<ParameterizedTestClass>(isolatedExecution))
                 .ShouldBe(
                     For<ParameterizedTestClass>(
                         ".IntArg(0) passed",
@@ -123,34 +123,8 @@
                         ".ZeroArgs passed"));
         }

-        public async Task ShouldSupportIsolatingFailuresToTheAffectedTestMethodWhenParameterGenerationThrows()
-        {
-            //Because the ParameterizedExecution convention explicitly catches and
-            //handles these exceptions at an appropriate granularity, it demonstrates
-            //how a failure can be isolated to the affected test method. A user may
-            //wish to do this to isolate a problematic parameter generation scheme
-            //while keeping as much of their build passing as possible.
-
-            //Because the FailFastParameterizedExecution convention does not attempt
-            //to handle these exceptions, the convention exits early and the runner
-            //acknowledges that fact with failure and skip results on the elided tests.
-            //A user may wish to do this to 'fail fast' when their testing infrastructure
-            //is clearly in an untrustworthy state to begin with.
-
-            var isolatedExecution = new ParameterizedExecution(BuggyParameterSource);
-            (await RunAsync<ParameterizedTestClass>(isolatedExecution))
-                .ShouldBe(
-                    For<ParameterizedTestClass>(
-                        ".IntArg(0) passed",
-                        ".IntArg(1) failed: Expected 0, but was 1",
-                        ".IntArg failed: Exception thrown while attempting to yield input parameters for method: IntArg",
-
-                        ".MultipleCasesFromAttributes(0) failed: Parameter count mismatch.",
-                        ".MultipleCasesFromAttributes(1) failed: Parameter count mismatch.",
-                        ".MultipleCasesFromAttributes failed: Exception thrown while attempting to yield input parameters for method: MultipleCasesFromAttributes",
-
-                        ".ZeroArgs passed"));
-
+        public async Task ShouldSupportEndingTheRunEarlyWhenParameterGenerationThrows()
+        {
             var failFastExecution = new FailFastParameterizedExecution(BuggyParameterSource);
             (await RunAsync<ParameterizedTestClass>(failFastExecution))
                 .ShouldBe(


Fixed the moving of operators to classes to discard the original name space and function.

Signed-off-by: Dimitar Dobrev <ca751a5c976abad79158718440750fc638d19ebc@yahoo.com>

--- src/Generator/Passes/MoveOperatorToClassPass.cs
+++ src/Generator/Passes/MoveOperatorToClassPass.cs
@@ -29,7 +29,7 @@
             var method = new Method()
             {
                 Namespace = @class,
-                OriginalNamespace = function.Namespace,
+                OriginalNamespace = @class,
                 Name = function.Name,
                 OriginalName = function.OriginalName,
                 Mangled = function.Mangled,
@@ -41,8 +41,7 @@
                 IsVariadic = function.IsVariadic,
                 IsInline = function.IsInline,
                 OperatorKind = function.OperatorKind,
-                SynthKind = FunctionSynthKind.NonMemberOperator,
-                OriginalFunction = function
+                SynthKind = FunctionSynthKind.NonMemberOperator
             };

             @class.Methods.Add(method);


Revert broken session creation synchronization.

--- src/Host/Broker/Impl/Sessions/SessionManager.cs
+++ src/Host/Broker/Impl/Sessions/SessionManager.cs
@@ -46,8 +46,8 @@
         public Session CreateSession(IIdentity user, string id, Interpreter interpreter, SecureString password, string commandLineArguments) {
             Session session;

-            List<Session> userSessions;
             lock (_sessions) {
+                List<Session> userSessions;
                 _sessions.TryGetValue(user.Name, out userSessions);
                 if (userSessions == null) {
                     _sessions[user.Name] = userSessions = new List<Session>();
@@ -60,6 +60,7 @@
                 }

                 session = new Session(this, user, id, interpreter, commandLineArguments);
+                userSessions.Add(session);
             }

             session.StartHost(
@@ -67,10 +68,6 @@
                 _loggingOptions.LogHostOutput ? _hostOutputLogger : null,
                 _loggingOptions.LogPackets ? _messageLogger : null);

-            lock (_sessions) {
-                userSessions.Add(session);
-            }
-
             return session;
         }
     }


Adding all code pages for dotnet CLI.

Adding all code pages for dotnet CLI.

Since we write to the console and create new processes and read from their stdout and stderr, we need to ensure we have all the code pages in our process.  This way we can encode/decode strings correctly when writing to our Console, and when reading from spawned process's output.

Fix #2486

--- src/dotnet/Program.cs
+++ src/dotnet/Program.cs
@@ -5,6 +5,7 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Text;
 using Microsoft.DotNet.Cli.Utils;
 using Microsoft.DotNet.ProjectModel.Server;
 using Microsoft.DotNet.Tools.Build;
@@ -41,6 +42,8 @@
         {
             DebugHelper.HandleDebugSwitch(ref args);

+            InitializeProcess();
+
             try
             {
                 return Program.ProcessArgs(args, new Telemetry());
@@ -136,6 +139,13 @@

             return exitCode;

+        }
+
+        private static void InitializeProcess()
+        {
+            // by default, .NET Core doesn't have all code pages needed for Console apps.
+            // see the .NET Core Notes in https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx
+            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
         }

         internal static bool TryGetBuiltInCommand(string commandName, out Func<string[], int> builtInCommand)


Handle errors in message handler

Handle errors in message handler

--- RockLib.Messaging.NamedPipes/NamedPipeReceiver.cs
+++ RockLib.Messaging.NamedPipes/NamedPipeReceiver.cs
@@ -87,7 +87,16 @@
         private void Consume()
         {
             foreach (var sentMessage in _messages.GetConsumingEnumerable())
-                MessageHandler.OnMessageReceivedAsync(this, new NamedPipeReceiverMessage(sentMessage)).Wait();
+            {
+                try
+                {
+                    MessageHandler.OnMessageReceivedAsync(this, new NamedPipeReceiverMessage(sentMessage)).GetAwaiter().GetResult();
+                }
+                catch (Exception ex)
+                {
+                    OnError("Error in MessageHandler.OnMessageReceivedAsync.", ex);
+                }
+            }
         }

         /// <summary>


I decided my Rotator code doesnt make a bit of sense. Now zeros will round trip correctly

--- RocketLeagueReplayParser/NetworkStream/Rotator.cs
+++ RocketLeagueReplayParser/NetworkStream/Rotator.cs
@@ -12,17 +12,21 @@
         public float Yaw { get; private set; }
         public float Roll { get; private set; }

-        private float Normalize(float axis)
+        private static float Normalize(float axis)
         {
             axis %= 360f;
             if ( axis < 0 ) axis += 360;
             return axis;
         }

-        private bool IsNearlyZero(float axis)
+        private static byte AxisToByte(float axis)
         {
-            const float threshold = 1E-4f; //KINDA_SMALL_NUMBER
-            return Math.Abs(Normalize(axis) - 180) < threshold;
+            return (byte)(Normalize(axis) / 360f * 256f);
+        }
+
+        private static float ByteToAxis(byte b)
+        {
+            return b / 256f * 360f;
         }

         public static Rotator Deserialize(BitReader br)
@@ -30,38 +34,40 @@
             var r = new Rotator();
             if (br.ReadBit())
             {
-                r.Pitch = br.ReadByte() / 256f * 360f;
+                r.Pitch = ByteToAxis(br.ReadByte());
             }
             if ( br.ReadBit() )
             {
-                r.Yaw = br.ReadByte() / 256f * 360f;
+                r.Yaw = ByteToAxis(br.ReadByte());
             }
             if (br.ReadBit())
             {
-                r.Roll = br.ReadByte() / 256f * 360f;
+                r.Roll = ByteToAxis(br.ReadByte());
             }
             return r;
         }

         public void Serialize(BitWriter bw)
         {
-            bool nearlyZero = IsNearlyZero(Pitch);
-            bw.Write(!nearlyZero);
-            if (!nearlyZero)
+            byte b = AxisToByte(Pitch);
+            bw.Write(b != 0);
+            if (b != 0)
             {
-                bw.Write((byte)Normalize(Pitch) / 360f * 256f);
+                bw.Write(b);
             }
-            nearlyZero = IsNearlyZero(Yaw);
-            bw.Write(!nearlyZero);
-            if (!nearlyZero)
+
+            b = AxisToByte(Yaw);
+            bw.Write(b != 0);
+            if (b != 0)
             {
-                bw.Write((byte)Normalize(Yaw) / 360f * 256f);
+                bw.Write(b);
             }
-            nearlyZero = IsNearlyZero(Roll);
-            bw.Write(!nearlyZero);
-            if (!nearlyZero)
+
+            b = AxisToByte(Roll);
+            bw.Write(b != 0);
+            if (b != 0)
             {
-                bw.Write((byte)Normalize(Roll) / 360f * 256f);
+                bw.Write(b);
             }
         }


React to naming changes in aspnet/Mvc

React to naming changes in aspnet/Mvc

https://github.com/aspnet/Mvc/commit/779edb6fe13cb37b8e88c627b3ceae71f42d6862

--- samples/Mvc.Server/Controllers/ResourceController.cs
+++ samples/Mvc.Server/Controllers/ResourceController.cs
@@ -11,7 +11,7 @@
         public IActionResult GetMessage() {
             var identity = User.Identity as ClaimsIdentity;
             if (identity == null) {
-                return HttpBadRequest();
+                return BadRequest();
             }

             return Content($"{identity.Name} has been successfully authenticated.");


ForValues plays nicely with ForValue (strings)

--- src/test/Sieve.NET.Core.Tests/EqualitySieveTests.cs
+++ src/test/Sieve.NET.Core.Tests/EqualitySieveTests.cs
@@ -469,7 +469,13 @@
             [Fact]
             public void PlaysNiceWithForValue_UsingStrings()
             {
-                throw new NotImplementedException();
+                var expectedValues = new List<int> { 1, 2, 3 };
+                var sut = new EqualitySieve<ABusinessObject>()
+                    .ForProperty(x => x.AnInt)
+                    .ForValues("1, 2")
+                    .ForValue("3");
+
+                sut.AcceptableValues.ShouldBeEquivalentTo(expectedValues);
             }

             [Fact]


Add X-Debug HTTP response header

Add X-Debug HTTP response header

Add a X-Debug HTTP response header for debug builds.

--- src/API/Middleware/CustomHttpHeadersMiddleware.cs
+++ src/API/Middleware/CustomHttpHeadersMiddleware.cs
@@ -91,6 +91,10 @@

                     context.Response.Headers.Add("X-Datacenter", _datacenter);

+#if DEBUG
+                    context.Response.Headers.Add("X-Debug", "true");
+#endif
+
                     if (_environmentName != null)
                     {
                         context.Response.Headers.Add("X-Environment", _environmentName);


Fixing a typo

Fixing a typo

--- src/Agent.Worker/TestResults/TrxResultReader.cs
+++ src/Agent.Worker/TestResults/TrxResultReader.cs
@@ -104,7 +104,7 @@
             //Parse the Deployment node for the runDeploymentRoot - this is the attachment root.
             XmlNode deploymentNode = doc.SelectSingleNode("/TestRun/TestSettings/Deployment");
             var _attachmentRoot = string.Empty;
-            if (node != null && deploymentNode.Attributes["runDeploymentRoot"] != null )
+            if (deploymentNode != null && deploymentNode.Attributes["runDeploymentRoot"] != null )
             {
                 _attachmentRoot = deploymentNode.Attributes["runDeploymentRoot"].Value;
             }


Added support for private ID. Can be useful to identify account if it's loaded from DB (for example 1, 2, 3, etc.)

--- src/ChannelAdvisorAccess/ChannelAdvisorAccount.cs
+++ src/ChannelAdvisorAccess/ChannelAdvisorAccount.cs
@@ -12,11 +12,17 @@
 	{
 		private readonly ICurrencyConverter _currencyConverter;

-		public ChannelAdvisorAccount( string name, string id, string currencyCode, bool isActive, bool isMain, IChannelAdvisorServicesFactory servicesFactory, ICurrencyConverter currencyConverter )
+		public ChannelAdvisorAccount( string name, string id, string currencyCode, bool isActive, bool isMain, IChannelAdvisorServicesFactory servicesFactory, ICurrencyConverter currencyConverter ) :
+			this( name, id, 0, currencyCode, isActive, isMain, servicesFactory, currencyConverter )
+		{
+		}
+
+		public ChannelAdvisorAccount( string name, string id, int privateId, string currencyCode, bool isActive, bool isMain, IChannelAdvisorServicesFactory servicesFactory, ICurrencyConverter currencyConverter )
 		{
 			this._currencyConverter = currencyConverter;
 			this.Name = name;
 			this.Id = id;
+			this.PrivateId = privateId;
 			this.CurrencyCode = currencyCode;
 			this.IsActive = isActive;
 			this.IsMain = isMain;
@@ -29,6 +35,7 @@

 		public string Name { get; private set; }
 		public string Id { get; private set; }
+		public int PrivateId { get; private set; }
 		public string CurrencyCode { get; private set; }
 		public bool IsActive { get; private set; }
 		public bool IsMain{ get; private set; }


liten ending i teksten

liten ending i teksten

--- kode/SysUt14Gr03/SysUt14Gr03/Classes/SessionSjekk.cs
+++ kode/SysUt14Gr03/SysUt14Gr03/Classes/SessionSjekk.cs
@@ -30,7 +30,7 @@
                 http.Session["fornavn"] = null;
                 http.Session["brukernavn"] = null;
                 http.Session["loggedIn"] = null;
-                http.Session["flashMelding"] = "Du må være logget inn som administrator for aksessere siden du prøvde å nå";
+                http.Session["flashMelding"] = "Du har ikke korrekte rettighet for aksessere siden du prøvde å nå";
                 http.Session["flashStatus"] = Konstanter.notifikasjonsTyper.danger.ToString();
                 http.Response.Redirect(("~/Login.aspx"), true);
             }


new types need to be added to TypeToDefinition

--- src/Aggregates.NET/Internal/VersionRegistrar.cs
+++ src/Aggregates.NET/Internal/VersionRegistrar.cs
@@ -68,12 +68,13 @@
                 list = new List<VersionDefinition>();

             var definition = new VersionDefinition(name, @namespace, version, type);
+
+            TypeToDefinition[type] = definition;
             if (list.Any(x => x.Name == name && x.Namespace == @namespace && x.Version == version))
                 return;

             list.Add(definition);
             NameToType[$"{@namespace}.{name}"] = list;
-            TypeToDefinition[type] = definition;
         }

         public string GetVersionedName(Type versionedType)


Fix typo

Fix typo

--- SlicerConfiguration/SliceSettingsDetailControl.cs
+++ SlicerConfiguration/SliceSettingsDetailControl.cs
@@ -20,18 +20,18 @@

 		private static string resetToDefaultsMessage = "Resetting to default values will remove your current overrides and restore your original printer settings.\nAre you sure you want to continue?".Localize();
 		private static string resetToDefaultsWindowTitle = "Revert Settings".Localize();
-		bool pimarySettingsView;
+		bool primarySettingsView;

 		public SliceSettingsDetailControl(List<PrinterSettingsLayer> layerCascade)
 		{
-			pimarySettingsView = layerCascade == null;
+			primarySettingsView = layerCascade == null;
 			settingsDetailSelector = new DropDownList("Basic", maxHeight: 200);
 			settingsDetailSelector.Name = "User Level Dropdown";
 			settingsDetailSelector.AddItem("Basic".Localize(), "Simple");
 			settingsDetailSelector.AddItem("Standard".Localize(), "Intermediate");
 			settingsDetailSelector.AddItem("Advanced".Localize(), "Advanced");

-			if (pimarySettingsView)
+			if (primarySettingsView)
 			{
 				// set to the user requested value when in default view
 				if (UserSettings.Instance.get(SliceSettingsLevelEntry) != null
@@ -51,7 +51,7 @@
 			settingsDetailSelector.Margin = new BorderDouble(5, 3);
 			settingsDetailSelector.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100);

-			if (pimarySettingsView)
+			if (primarySettingsView)
 			{
 				// only add these in the default view
 				this.AddChild(settingsDetailSelector);
@@ -65,7 +65,7 @@

 		public string SelectedValue => settingsDetailSelector.SelectedValue;

-		public bool ShowingHelp => pimarySettingsView ? showHelpBox.Checked : false;
+		public bool ShowingHelp => primarySettingsView ? showHelpBox.Checked : false;

 		private DropDownMenu GetSliceOptionsMenuDropList()
 		{
@@ -86,7 +86,7 @@

 			showHelpBox = new CheckBox("Show Help".Localize());

-			if (pimarySettingsView)
+			if (primarySettingsView)
 			{
 				// only turn on the help if in the main view and it is set to on
 				showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";
@@ -94,7 +94,7 @@

 			showHelpBox.CheckedStateChanged += (s, e) =>
 			{
-				if (pimarySettingsView)
+				if (primarySettingsView)
 				{
 					// only save the help settings if in the main view
 					UserSettings.Instance.set(SliceSettingsShowHelpEntry, showHelpBox.Checked.ToString().ToLower());


clean

clean

--- src/BizwebSharp/Infrastructure/RequestEngine.cs
+++ src/BizwebSharp/Infrastructure/RequestEngine.cs
@@ -74,8 +74,8 @@
         {
             if ((response.StatusCode != HttpStatusCode.OK) && (response.StatusCode != HttpStatusCode.Created))
             {
-                var json = response.Content;
-                var errors = ParseErrorJson(json);
+                var rawResponse = response.Content;
+                var errors = ParseErrorJson(rawResponse);
                 var requestInfo = new RequestSimpleInfo(response);

                 var code = response.StatusCode;
@@ -100,9 +100,9 @@

                 // If the error was caused by reaching the API rate limit, throw a rate limit exception.
                 if ((int) code == 429 /* Too many requests */)
-                    throw new ApiRateLimitException(code, errors, message, json, requestInfo);
-
-                throw new BizwebSharpException(code, errors, message, json, requestInfo);
+                    throw new ApiRateLimitException(code, errors, message, rawResponse, requestInfo);
+
+                throw new BizwebSharpException(code, errors, message, rawResponse, requestInfo);
             }

             //if (response.ErrorException != null)


unnecessary stuff

unnecessary stuff

--- SoraBot-v2/SoraBot-v2/Module/InteractionModule.cs
+++ SoraBot-v2/SoraBot-v2/Module/InteractionModule.cs
@@ -173,13 +173,6 @@
             await Context.Channel.SendMessageAsync("", embed: eb);
         }

-        [Command("reset"), Summary("Resets your own stats")]
-        public async Task Reset()
-        {
-            //TODO AFFINITY RESET
-            await ReplyAsync("Under construction");
-        }
-
         [Command("poke",RunMode = RunMode.Async), Summary("Pokes the specified person")]
         public async Task Poke([Summary("Mention the users you want to poke and maybe add a reason"), Remainder]string reason)
         {


[Direct2D1] Fix issue #392. Dispose BitmapFrameEncode.Options to avoid a memory leak

--- Source/SharpDX.Direct2D1/WIC/BitmapFrameEncode.cs
+++ Source/SharpDX.Direct2D1/WIC/BitmapFrameEncode.cs
@@ -123,5 +123,16 @@
         {
             WriteSource(bitmapSource, null);
         }
+
+        protected override unsafe void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                Options.Dispose();
+                Options = null;
+            }
+
+            base.Dispose(disposing);
+        }
     }
 }


Fix PCL contract for Pause/Resume analysis change

--- Source/ZXing.Net.Mobile.WindowsRT/NotSupported.cs
+++ Source/ZXing.Net.Mobile.WindowsRT/NotSupported.cs
@@ -54,6 +54,16 @@
             throw ex;
         }

+        public override void PauseAnalysis()
+        {
+            throw ex;
+        }
+
+        public override void ResumeAnalysis()
+        {
+            throw ex;
+        }
+
         public override bool IsTorchOn
         {
             get


Changed exception type thrown

Changed exception type thrown

when service provider has no GuidAttribute, an ArgumentException should be thrown, rather than InvalidOperationException as before.

--- Src/Clide/Extensions/ServiceProviderExtensions.cs
+++ Src/Clide/Extensions/ServiceProviderExtensions.cs
@@ -59,7 +59,7 @@
                     .FirstOrDefault();

                 if (guidString == null)
-                    throw new InvalidOperationException(Strings.IServiceProviderExtensions.MissingGuidAttribute(typeof(TPackage)));
+                    throw new ArgumentException(Strings.IServiceProviderExtensions.MissingGuidAttribute(typeof(TPackage)));

                 var guid = new Guid(guidString);
                 var vsPackage = default(IVsPackage);


PrefixMap tests update

PrefixMap tests update

--- Src/DSInternals.DataStore.Test/PrefixMapTester.cs
+++ Src/DSInternals.DataStore.Test/PrefixMapTester.cs
@@ -7,8 +7,11 @@
     [TestClass]
     public class PrefixMapTester
     {
-        // Sample prefix map after Exchange 2016 schema import
+        // Sample prefix map after Exchange 2016 schema import.
         private static byte[] ExchangeBinaryPrefixMap = "060000006200000023480b002a864886f7140104b658664f310c002a864886f7140104b658668331090c002a864886f7140105b6583e83dc600a002a864886f714010614014b6d0a002a864886f714010614024f750b002a864886f7140106140183".HexToBinary();
+
+        // Sample prefix map Christoffer Andersson. Contains duplicate prefixes, which is a little bit strange.
+        private static byte[] SamplePrefixMap = "0E000000D800000023480B002A864886F7140104B65866BE180B002A864886F7140105B6583E84670C002A864886F7140104B6586683E14A0C002A864886F7140104B65866816C3D0C002A864886F7140105B6583E81D62C0C002A864886F7140105B6583E83AE720A002A864886F7140106140152690A002A864886F71401061402905F0A002A864886F7140106180249160A002A864886F71401061801F16D0B002A864886F71401061D0201F15A0B002A864886F71401061D0202BB410B002A864886F7140106140183E92609002A864886F714010283".HexToBinary();

         [TestMethod]
         public void PrefixMap_Vector1()
@@ -28,6 +31,15 @@
             // Test non-existing prefix
             bool contains2 = map.ContainsPrefix(1234);
             Assert.AreEqual(false, contains2);
+        }
+
+        [TestMethod]
+        public void PrefixMap_Vector2()
+        {
+            var map = new PrefixMap(SamplePrefixMap);
+
+            // Should contain 31 builtin refixes + 14 additional
+            Assert.AreEqual(45, map.Count);
         }

         [TestMethod]


PublicClientApp should throw NotImplException only on specific platforms

--- msal/src/Microsoft.Identity.Client/PublicClientApplication.cs
+++ msal/src/Microsoft.Identity.Client/PublicClientApplication.cs
@@ -496,15 +496,19 @@

         private void GuardNetCore()
         {
+#if NET_CORE
             throw new PlatformNotSupportedException("On .NET Core, interactive authentication is not supported. " +
                 "Consider using Device Code Flow https://aka.ms/msal-net-device-code-flow or Integrated Windows Auth https://aka.ms/msal-net-iwa");
+#endif
         }

         private void GuardUIParentAndroid()
         {
+#if ANDROID
             throw new PlatformNotSupportedException("To enable interactive authentication on Android, please call an overload of AcquireTokenAsync that " +
-                "takes in an UIParent object, which you should initialize to an Activity. " +
+                "takes in an UIParent object, which you should initialize to an Activity. " +
                 "See https://aka.ms/msal-interactive-android for details.");
+#endif
         }

         private async Task<AuthenticationResult> AcquireTokenForLoginHintCommonAsync(


MiniProfilerHandler: use ConcurrentDictionary instead of Dictionary to avoid races; see http://blogs.msdn.com/b/tess/archive/2009/12/21/high-cpu-in-net-app-using-a-static-generic-dictionary.aspx

--- StackExchange.Profiling/UI/MiniProfilerHandler.cs
+++ StackExchange.Profiling/UI/MiniProfilerHandler.cs
@@ -6,7 +6,8 @@
 using System.Linq;

 using StackExchange.Profiling.Helpers;
-using System.Text;
+using System.Text;
+using System.Collections.Concurrent;

 namespace StackExchange.Profiling.UI
 {
@@ -381,8 +382,8 @@

         /// <summary>
         /// Embedded resource contents keyed by filename.
-        /// </summary>
-        private static readonly Dictionary<string, string> _ResourceCache = new Dictionary<string, string>();
+        /// </summary>
+        private static readonly ConcurrentDictionary<string, string> _ResourceCache = new ConcurrentDictionary<string, string>();

         /// <summary>
         /// Helper method that sets a proper 404 response code.


Add  IsJSONNullOrEmpty(this JToken JSONToken)

--- Styx/Illias/ExtensionMethods/JObjectExtentions.cs
+++ Styx/Illias/ExtensionMethods/JObjectExtentions.cs
@@ -57,6 +57,17 @@

         #endregion

+        #region IsJSONNullOrEmpty(this JSONToken)
+
+        /// <summary>
+        /// Checks whether the given JSON token is null or "null".
+        /// </summary>
+        /// <param name="JSONToken">A JSON token</param>
+        public static Boolean IsJSONNullOrEmpty(this JToken JSONToken)
+            => JSONToken == null || JSONToken.Value<String>().IsNullOrEmpty();
+
+        #endregion
+
     }

 }


Kolumnrubrik "Produkter" visades endast i översta sektionen på avtalet

--- TESS/Views/CustomerContract/_ModuleSection.cshtml
+++ TESS/Views/CustomerContract/_ModuleSection.cshtml
@@ -104,11 +104,11 @@

-                                    @if (canShowTitle)
+                                    @*@if (canShowTitle)
                                     {
-                                        canShowTitle = false;
+                                        canShowTitle = false;*@
                                         @title
-                                    }
+                                    @*}*@

                                 @if (currentPriceType != previousPriceType)


Created code that should have been using a concurrent dictionary.

--- netfusion/src/Web/NetFusion.Rest.Client/Core/RequestClient.cs
+++ netfusion/src/Web/NetFusion.Rest.Client/Core/RequestClient.cs
@@ -13,6 +13,8 @@

 namespace NetFusion.Rest.Client.Core
 {
+    using System.Collections.Concurrent;
+
     /// <summary>
     /// Client used to make HTTP requests.
     /// </summary>
@@ -21,7 +23,7 @@
         private readonly HttpClient _httpClient;
         private readonly ILogger _logger;
         private string _correlationHeaderName;
-        private readonly IDictionary<string, IMediaTypeSerializer> _mediaTypeSerializers;
+        private readonly ConcurrentDictionary<string, IMediaTypeSerializer> _mediaTypeSerializers;
         private readonly IRequestSettings _defaultRequestSettings;

         // Optional registered services specified using RequestClientBuilder:
@@ -48,11 +50,15 @@
             _logger = logger ?? throw new ArgumentNullException(nameof(httpClient),
                 "Logger cannot be null.");

-            _mediaTypeSerializers = contentSerializers ?? throw new ArgumentNullException(nameof(contentSerializers),
-                "HTTP Context Serializers cannot be null.");
-
             _defaultRequestSettings = requestSettings ?? throw new ArgumentNullException(nameof(requestSettings),
                 "Default Request Settings cannot be null.");
+
+            if (contentSerializers == null)
+            {
+                throw new ArgumentNullException(nameof(contentSerializers), "HTTP Context Serializers cannot be null.");
+            }
+
+            _mediaTypeSerializers = new ConcurrentDictionary<string, IMediaTypeSerializer>(contentSerializers);
         }

         public async Task<HalEntryPointResource> GetApiEntry()


Add CssCommentParser.

Add CssCommentParser.

--- src/Cassette.UnitTests/CommonReferenceParser.cs
+++ src/Cassette.UnitTests/CommonReferenceParser.cs
@@ -61,6 +61,41 @@
             comments[1].SourceLineNumber.ShouldEqual(2);
             comments[1].Value.ShouldEqual("text2");
         }
+    }
+
+    public class CssCommentParser_Tests
+    {
+        [Fact]
+        public void WhenParseMultilineComment_ThenReturnCommentPerLine()
+        {
+            var parser = new CssCommentParser();
+            var comments = parser.Parse("/*text1\r\ntext2*/").ToArray();
+            comments[0].SourceLineNumber.ShouldEqual(1);
+            comments[0].Value.ShouldEqual("text1");
+            comments[1].SourceLineNumber.ShouldEqual(2);
+            comments[1].Value.ShouldEqual("text2");
+        }
+
+        [Fact]
+        public void WhenParseMultilineCommentWithUnixNewLines_ThenReturnCommentPerLine()
+        {
+            var parser = new CssCommentParser();
+            var comments = parser.Parse("/*text1\ntext2*/").ToArray();
+            comments[0].SourceLineNumber.ShouldEqual(1);
+            comments[0].Value.ShouldEqual("text1");
+            comments[1].SourceLineNumber.ShouldEqual(2);
+            comments[1].Value.ShouldEqual("text2");
+        }
+    }
+
+    public class HtmlTemplateCommentParser_Tests
+    {
+
+    }
+
+    public class CoffeeScriptCommentParser_Tests
+    {
+
     }

     public class ReferenceParser_Test
@@ -241,6 +276,103 @@
         }
     }

+    public class CssCommentParser : ICommentParser
+    {
+        enum State
+        {
+            Code, MultiLineComment
+        }
+
+        public IEnumerable<Comment> Parse(string code)
+        {
+            var state = State.Code;
+            var commentStart = 0;
+            var line = 1;
+            for (var i = 0; i < code.Length; i++)
+            {
+                var c = code[i];
+
+                if (c == '\r')
+                {
+                    i++;
+                    if (i < code.Length && code[i] == '\n')
+                    {
+                        i++;
+                    }
+                    line++;
+                    continue;
+                }
+                else if (c == '\n')
+                {
+                    i++;
+                    line++;
+                    continue;
+                }
+
+                switch (state)
+                {
+                    case State.Code:
+                        if (c != '/') continue;
+                        if (i >= code.Length - 2) yield break;
+                        if (code[i + 1] == '*')
+                        {
+                            state = State.MultiLineComment;
+                            commentStart = i + 2;
+                            i++; // Skip the '*'
+                        }
+                        break;
+
+                    case State.MultiLineComment:
+                        // Scan forwards until "*/" or end of code.
+                        while (i < code.Length - 1 && (code[i] != '*' || code[i + 1] != '/'))
+                        {
+                            // Track new lines within the comment.
+                            if (code[i] == '\r')
+                            {
+                                yield return new Comment
+                                {
+                                    SourceLineNumber = line,
+                                    Value = code.Substring(commentStart, i - commentStart)
+                                };
+                                i++;
+                                if (i < code.Length && code[i] == '\n')
+                                {
+                                    i++;
+                                }
+                                commentStart = i;
+                                line++;
+                                continue;
+                            }
+                            else if (code[i] == '\n')
+                            {
+                                yield return new Comment
+                                {
+                                    SourceLineNumber = line,
+                                    Value = code.Substring(commentStart, i - commentStart)
+                                };
+                                i++;
+                                commentStart = i;
+                                line++;
+                                continue;
+                            }
+                            else
+                            {
+                                i++;
+                            }
+                        }
+                        yield return new Comment
+                        {
+                            SourceLineNumber = line,
+                            Value = code.Substring(commentStart, i - commentStart)
+                        };
+                        i++; // Skip the '/'
+                        state = State.Code;
+                        break;
+                }
+            }
+        }
+    }
+
     public class Comment
     {
         public int SourceLineNumber;


Fixed issues in delivery excel export when no delivery items are available or recipientname is not set

--- src/FLS.Server.Service/Exporting/ExcelExporter.cs
+++ src/FLS.Server.Service/Exporting/ExcelExporter.cs
@@ -33,15 +33,32 @@

         public byte[] ExportDeliveriesToExcel(List<DeliveryDetails> deliveryDetailList)
         {
-            var list = new List<string>();
+            var recipientSortedDeliveries = new Dictionary<string, List<DeliveryDetails>>();
             foreach (var ruleBasedDelivery in deliveryDetailList)
             {
                 //check if there are some line items in the invoice, if not, check next invoice
-                if (ruleBasedDelivery.DeliveryItems.Any() == false) continue;
-
-                if (list.Contains(ruleBasedDelivery.RecipientDetails.RecipientName) == false)
-                {
-                    list.Add(ruleBasedDelivery.RecipientDetails.RecipientName);
+                if (ruleBasedDelivery.DeliveryItems.Any() == false)
+                {
+                    Logger.Warn($"Delivery (ID: {ruleBasedDelivery.DeliveryId}) without items found. Will exclude it from export into excel!");
+                    continue;
+                }
+
+                var recipientName = ruleBasedDelivery.RecipientDetails.RecipientName;
+                if (string.IsNullOrWhiteSpace(recipientName))
+                {
+                    Logger.Warn($"Delivery (ID: {ruleBasedDelivery.DeliveryId}) has no recipient name or is null!");
+                    recipientName = "NO_RECIPIENT";
+                }
+
+                if (recipientSortedDeliveries.ContainsKey(recipientName) == false)
+                {
+                    var deliveryList = new List<DeliveryDetails>();
+                    deliveryList.Add(ruleBasedDelivery);
+                    recipientSortedDeliveries.Add(recipientName, deliveryList);
+                }
+                else
+                {
+                    recipientSortedDeliveries[recipientName].Add(ruleBasedDelivery);
                 }
             }

@@ -49,7 +66,7 @@
             {
                 using (ZipFile zip = new ZipFile())
                 {
-                    foreach (var recipient in list)
+                    foreach (var recipient in recipientSortedDeliveries.Keys)
                     {
                         var filename = $"Rechnung {DateTime.Now.Date.ToString("yyyy-MM-dd")} {recipient}.xlsx";
                         filename = filename.SanitizeFilename();
@@ -86,13 +103,8 @@
                             int flightNr = 1;
                             int rowNumber = 2;

-                            foreach (var ruleBasedDelivery in deliveryDetailList.OrderBy(o => o.FlightInformation.FlightDate))
+                            foreach (var ruleBasedDelivery in recipientSortedDeliveries[recipient].OrderBy(o => o.FlightInformation.FlightDate))
                             {
-                                if (ruleBasedDelivery.RecipientDetails.RecipientName != recipient)
-                                {
-                                    continue;
-                                }
-
                                 int flightBeginRowNumber = rowNumber;

                                 foreach (var flightInvoiceLineItem in ruleBasedDelivery.DeliveryItems.OrderBy(o => o.Position))
@@ -135,16 +147,12 @@

                             if (rowNumber > 2)
                             {
-                                worksheet.Cells[2, 1, rowNumber - 1, nrOfColumns].Style.Numberformat.Format = "@";
-                                    //Format as text
-                                worksheet.Cells[2, 6, rowNumber - 1, 6].Style.Numberformat.Format = "dd.mm.yyyy";
-                                //Format as date
-                                worksheet.Cells[2, 9, rowNumber - 1, 10].Style.Numberformat.Format = "0";
-                                    //Format as number
-                                worksheet.Cells[2, 12, rowNumber - 1, 12].Style.Numberformat.Format = "0";
+                                worksheet.Cells[2, 1, rowNumber - 1, nrOfColumns].Style.Numberformat.Format = "@"; //Format as text
+                                worksheet.Cells[2, 6, rowNumber - 1, 6].Style.Numberformat.Format = "dd.mm.yyyy"; //Format as date
+                                worksheet.Cells[2, 9, rowNumber - 1, 10].Style.Numberformat.Format = "0"; //Format as number --> Item position
+                                worksheet.Cells[2, 12, rowNumber - 1, 12].Style.Numberformat.Format = "0.00"; //Format as number with 2 decimals --> Quantity
                             }

-                            //Format as number
                             worksheet.Cells.AutoFitColumns(0); //Autofit columns for all cells

                             // set some document properties


Correctly used my own Random extension

Correctly used my own Random extension

--- src/FireworksNet/Explode/InitialSparkGenerator.cs
+++ src/FireworksNet/Explode/InitialSparkGenerator.cs
@@ -42,7 +42,7 @@
 			foreach (Dimension dimension in dimensions)
 			{
                 Range dimensionRange = initialDimensionRanges[dimension];
-                spark.Coordinates[dimension] = dimensionRange.Minimum + randomizer.NextDouble(0.0, 1.0) * dimensionRange.Length; // TODO: use extension method properly
+                spark.Coordinates[dimension] = randomizer.NextDouble(dimensionRange);
 			}

 			return spark;


Add more og:image tags

Add more og:image tags

Add more OpenGraph image tags for the default image.

--- src/LondonTravel.Site/Views/Shared/_Meta.cshtml
+++ src/LondonTravel.Site/Views/Shared/_Meta.cshtml
@@ -30,6 +30,10 @@
     else
     {
     <meta property="og:image" content="@Url.CdnContent("london-travel-216x216.png", Options)" />
+    <meta property="og:image:secure_url" content="@Url.CdnContent("london-travel-216x216.png", Options)" />
+    <meta property="og:image:type" content="image/png" />
+    <meta property="og:image:width" content="216" />
+    <meta property="og:image:height" content="216" />
     <meta name="twitter:image" content="@Url.CdnContent("london-travel-108x108.png", Options)" />
     <meta name="twitter:image:alt" content="@Model.SiteName" />
     }


Use async command execution instead of sync execution when killing a remote unix process (#701)

--- src/MICore/Transports/UnixShellPortTransport.cs
+++ src/MICore/Transports/UnixShellPortTransport.cs
@@ -28,6 +28,24 @@
         private const string ErrorPrefix = "Error:";
         private const string ShellScriptName = "GetClrDbg.sh";

+        private class UnixShellAsyncCommandCallback: IDebugUnixShellCommandCallback
+        {
+            UnixShellPortTransport _parent;
+            public UnixShellAsyncCommandCallback(UnixShellPortTransport parent)
+            {
+                this._parent = parent;
+            }
+
+            public void OnOutputLine(string line)
+            {
+                ((IDebugUnixShellCommandCallback)_parent).OnOutputLine(line);
+            }
+
+            public void OnExit(string exitCode)
+            {
+            }
+        }
+
         public UnixShellPortTransport()
         {
         }
@@ -199,26 +217,21 @@

         public bool Interrupt(int pid)
         {
-            int exitCode = -1;
-            string output = null;
-            string error = null;
             string killCmd = string.Format(CultureInfo.InvariantCulture, "kill -2 {0}", pid);

             try
             {
-                exitCode = ExecuteSyncCommand(MICoreResources.Info_KillingPipeProcess, killCmd, System.Threading.Timeout.Infinite, out output, out error);
-
-                if (exitCode != 0)
-                {
-                    this._callback.OnStdErrorLine(string.Format(CultureInfo.InvariantCulture, MICoreResources.Warn_ProcessExit, killCmd, exitCode));
-                }
+                IDebugUnixShellAsyncCommand asyncCommand;
+                UnixShellAsyncCommandCallback callbacks = new UnixShellAsyncCommandCallback(this);
+                _launchOptions.UnixPort.BeginExecuteAsyncCommand(killCmd, false, callbacks, out asyncCommand);
             }
             catch (Exception e)
             {
                 this._callback.OnStdErrorLine(string.Format(CultureInfo.InvariantCulture, MICoreResources.Warn_ProcessException, killCmd, e.Message));
-            }
-
-            return exitCode == 0;
+                return false;
+            }
+
+            return true;
         }
     }
 }


Use var instead.

Use var instead.

--- src/Magick.NET/Formats/Psd/PsdAdditionalInfo.cs
+++ src/Magick.NET/Formats/Psd/PsdAdditionalInfo.cs
@@ -61,7 +61,7 @@
                 var key = Encoding.ASCII.GetString(bytes, offset, 4);
                 offset += 4;

-                int size = bytes[offset++] << 24;
+                var size = bytes[offset++] << 24;
                 size |= bytes[offset++] << 16;
                 size |= bytes[offset++] << 8;
                 size |= bytes[offset++];
@@ -71,7 +71,7 @@

                 if ("luni".Equals(key, StringComparison.OrdinalIgnoreCase))
                 {
-                    int count = bytes[offset++] << 24;
+                    var count = bytes[offset++] << 24;
                     count |= bytes[offset++] << 16;
                     count |= bytes[offset++] << 8;
                     count |= bytes[offset++];


+ GetEvents using rest api (commented out)

--- src/FacebookSharp.Extensions/EventExtensions.cs
+++ src/FacebookSharp.Extensions/EventExtensions.cs
@@ -1,7 +1,11 @@
+
+using System.Text;

 namespace FacebookSharp.Extensions
 {
+    using System;
     using System.Collections.Generic;
+    using FacebookSharp.Schemas;
     using FacebookSharp.Schemas.Graph;

     public static partial class FacebookExtensions
@@ -47,6 +51,34 @@
             return facebook.GetEvent(eventId, null);
         }

+        [Obsolete(Facebook.OldRestApiWarningMessage)]
+        public static string GetEvents(this Facebook facebook, string userId, string[] eventIds, int? startTime, int? endTime, RsvpStatus? rsvpStatus, IDictionary<string, string> parameters)
+        {
+            if (parameters == null)
+                parameters = new Dictionary<string, string>();
+
+            if (!string.IsNullOrEmpty(userId))
+                parameters.Add("uid", userId);
+
+            var eids = FacebookUtils.ToCommaSeperatedValues(eventIds);
+
+            if (!string.IsNullOrEmpty(eids))
+                parameters.Add("eids", eids);
+
+            if (startTime != null)
+                parameters.Add("start_time", startTime.Value.ToString());
+
+            if (endTime != null)
+                parameters.Add("end_time", endTime.Value.ToString());
+
+            if (rsvpStatus != null)
+                parameters.Add("rsvp_status", FacebookUtils.ToString(rsvpStatus.Value));
+
+            var result = facebook.GetUsingRestApi("events.get", parameters);
+
+            return result;
+        }
+
         // note: there's a problem with facebook graph api, so till then will just comment this.
         ///// <summary>
         ///// Creates a new event.


Delete GeneratedConstants.cs

Delete GeneratedConstants.cs

--- configware/Klli.Sensact.Config/GeneratedConstants.cs
+++ configware/Klli.Sensact.Config/GeneratedConstants.cs
@@ -1,7 +0,0 @@
-namespace Klli.Sensact.Config
-{
-    public static class GeneratedConstants
-    {
-        public const string ConfigSHA = /*ReplaceConfigSHA*/"26e97e48ab0fe9374b6c764650c1b11841796800"/*ReplaceConfigSHA*/;
-    }
-}


fixed null reference exception when using MultiBinding without StringFormat and Converter

--- src/Markup/Avalonia.Markup/Data/MultiBinding.cs
+++ src/Markup/Avalonia.Markup/Data/MultiBinding.cs
@@ -116,7 +116,8 @@
             }

             var culture = CultureInfo.CurrentCulture;
-            var converted = converter.Convert(values, targetType, ConverterParameter, culture);
+            var converted = converter?.Convert(values, targetType, ConverterParameter, culture)
+                ?? values.ToArray();

             if (converted == null)
             {


* MonoTorrent/MonoTorrent.Client/NetworkIO.cs: Put try/catches in
  the right place so that we don't explode horribly if a socket is
  closed while we're rate limting.

svn path=/trunk/bitsharp/; revision=156976

--- src/MonoTorrent/MonoTorrent.Client/NetworkIO.cs
+++ src/MonoTorrent/MonoTorrent.Client/NetworkIO.cs
@@ -115,25 +115,15 @@
         public static void EnqueueReceive (IConnection connection, byte[] buffer, int offset, int count, IRateLimiter rateLimiter, ConnectionMonitor peerMonitor, ConnectionMonitor managerMonitor, AsyncIOCallback callback, object state)
         {
             var data = transferCache.Dequeue ().Initialise (connection, buffer, offset, count, callback, state, rateLimiter, peerMonitor, managerMonitor);
-            try {
-                lock (receiveQueue)
-                    ReceiveOrEnqueue (data);
-            } catch {
-                data.Callback (false, 0, state);
-                transferCache.Enqueue (data);
-            }
+            lock (receiveQueue)
+                ReceiveOrEnqueue (data);
         }

         public static void EnqueueSend (IConnection connection, byte[] buffer, int offset, int count, IRateLimiter rateLimiter, ConnectionMonitor peerMonitor, ConnectionMonitor managerMonitor, AsyncIOCallback callback, object state)
         {
             var data = transferCache.Dequeue ().Initialise (connection, buffer, offset, count, callback, state, rateLimiter, peerMonitor, managerMonitor);
-            try {
-                lock (sendQueue)
-                    SendOrEnqueue (data);
-            } catch {
-                callback (false, 0, state);
-                transferCache.Enqueue (data);
-            }
+            lock (sendQueue)
+                SendOrEnqueue (data);
         }

         static void EndConnect (IAsyncResult result)
@@ -214,7 +204,12 @@
         {
             int count = Math.Min (ChunkLength, data.Remaining);
             if (data.RateLimiter == null || data.RateLimiter.TryProcess (1)) {
-                data.Connection.BeginReceive (data.Buffer, data.Offset, count, EndReceiveCallback, data);
+                try {
+                    data.Connection.BeginReceive (data.Buffer, data.Offset, count, EndReceiveCallback, data);
+                } catch {
+                    data.Callback (false, 0, data.State);
+                    transferCache.Enqueue (data);
+                }
             } else {
                 receiveQueue.Enqueue (data);
             }
@@ -224,7 +219,12 @@
         {
             int count = Math.Min (ChunkLength, data.Remaining);
             if (data.RateLimiter == null || data.RateLimiter.TryProcess (1)) {
-                data.Connection.BeginSend (data.Buffer, data.Offset, count, EndSendCallback, data);
+                try {
+                    data.Connection.BeginSend (data.Buffer, data.Offset, count, EndSendCallback, data);
+                } catch {
+                    data.Callback (false, 0, data.State);
+                    transferCache.Enqueue (data);
+                }
             } else {
                 sendQueue.Enqueue (data);
             }


That patch isn't complete - revert ;)

That patch isn't complete - revert ;)

svn path=/trunk/bitsharp/; revision=91767

--- src/MonoTorrent/Tracker/SimpleTorrentManager.cs
+++ src/MonoTorrent/Tracker/SimpleTorrentManager.cs
@@ -120,16 +120,17 @@

         #region Constructors

-        public SimpleTorrentManager(ITrackable trackable)
-            : this(trackable, new IPAddressComparer())
-        {
-
-        }
-
-        public SimpleTorrentManager(ITrackable trackable, IEqualityComparer<Peer> comparer)
+        //public SimpleTorrentManager(ITrackable trackable)
+        //    : this(trackable, new IPAddressComparer())
+        //{
+
+        //}
+
+        // FIXME: Use the comparer
+        public SimpleTorrentManager(ITrackable trackable)//, IEqualityComparer<Peer> comparer)
         {
             this.trackable = trackable;
-            peers = new Dictionary<IPAddress, Peer>(comparer);
+            peers = new Dictionary<IPAddress, Peer>();
             random = new Random();
         }


Unused file.

Unused file.

--- src/NEventStore/Dispatcher/PollingDispatcher.cs
+++ src/NEventStore/Dispatcher/PollingDispatcher.cs
@@ -1,178 +0,0 @@
-/*namespace NEventStore.Dispatcher
-{
-    using System;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
-    using NEventStore.Logging;
-    using NEventStore.Persistence;
-
-    public class PollingDispatcher : IScheduleDispatches
-    {
-        private static readonly ILog Logger = LogFactory.BuildLogger(typeof (PollingDispatcher));
-        private readonly Dictionary<string, List<TaskCompletionSource<Commit>>> _awaiting = new Dictionary<string, List<TaskCompletionSource<Commit>>>();
-        private readonly ICheckpointHolder _checkpointHolder;
-        private readonly IDispatchCommits _dispatcher;
-        private readonly IPersistStreams _persistence;
-        private CancellationTokenSource _cancellationTokenSource;
-        private bool _disposed;
-        private Task _internalTask;
-
-        public PollingDispatcher(IDispatchCommits dispatcher, IPersistStreams persistence, ICheckpointHolder checkpointHolder)
-        {
-            _dispatcher = dispatcher;
-            _persistence = persistence;
-            _checkpointHolder = checkpointHolder;
-
-            Logger.Debug(Resources.InitializingPersistence);
-            _persistence.Initialize();
-        }
-
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        public void ScheduleDispatch(Commit commit)
-        {
-            Task<Commit> task = AwaitDispatchOf(commit);
-            Task.WaitAll(task);
-        }
-
-        protected virtual void Dispose(bool disposing)
-        {
-            if (!disposing || _disposed)
-            {
-                return;
-            }
-
-            Logger.Debug(Resources.ShuttingDownDispatchScheduler);
-            _disposed = true;
-            _dispatcher.Dispose();
-            _persistence.Dispose();
-        }
-
-        public void StartPolling(TimeSpan interval)
-        {
-            if (_internalTask != null)
-            {
-                return;
-            }
-            _cancellationTokenSource = new CancellationTokenSource();
-            Logger.Debug("polling started");
-            _internalTask = Task.Factory.StartNew(x =>
-                {
-                    var token = (CancellationToken) x;
-                    while (!token.IsCancellationRequested)
-                    {
-                        GetAndProcessNext();
-                        Thread.Sleep(interval);
-                    }
-                },
-                _cancellationTokenSource,
-                _cancellationTokenSource.Token,
-                TaskCreationOptions.LongRunning,
-                TaskScheduler.Default);
-        }
-
-        private void GetAndProcessNext()
-        {
-            lock (this)
-            {
-                var items = _persistence.GetFrom(Guid.Parse(_checkpointHolder.GetCheckpoint()));
-                foreach (var c in items)
-                {
-                    Dispatch(c);
-                }
-            }
-        }
-
-        public void StopPolling()
-        {
-            if (_internalTask == null)
-            {
-                return;
-            }
-            _cancellationTokenSource.Cancel();
-        }
-
-        public Task<Commit> AwaitDispatchOf(Commit commit)
-        {
-            TaskCompletionSource<Commit> source = CheckAwaiting(commit);
-            return source.Task;
-        }
-
-        private TaskCompletionSource<Commit> CheckAwaiting(Commit commit)
-        {
-            //have we already done this before?
-            if (commit.Checkpoint.IsAfter(_checkpointHolder.GetCheckpoint()))
-            {
-                var x = new TaskCompletionSource<Commit>();
-                x.SetResult(commit);
-            }
-
-            lock (_awaiting)
-            {
-                List<TaskCompletionSource<Commit>> tasks;
-                if (!_awaiting.TryGetValue(commit.Checkpoint.AsSavable(), out tasks))
-                {
-                    tasks = new List<TaskCompletionSource<Commit>>();
-                    _awaiting.Add(commit.Checkpoint.AsSavable(), tasks);
-                }
-                var result = new TaskCompletionSource<Commit>();
-                tasks.Add(result);
-                return result;
-            }
-        }
-
-        private void NotifyAsyncs(Commit commit)
-        {
-            lock (_awaiting)
-            {
-                List<TaskCompletionSource<Commit>> tasks;
-                if (_awaiting.TryGetValue(commit.Checkpoint.AsSavable(), out tasks))
-                {
-                    tasks.ForEach(x => x.SetResult(commit));
-                }
-                _awaiting.Remove(commit.Checkpoint.AsSavable());
-            }
-        }
-
-        private void NotifyAsyncsOfError(Commit commit, Exception exception)
-        {
-            lock (_awaiting)
-            {
-                List<TaskCompletionSource<Commit>> tasks;
-                if (_awaiting.TryGetValue(commit.Checkpoint.AsSavable(), out tasks))
-                {
-                    tasks.ForEach(x => x.SetException(exception));
-                }
-                _awaiting.Remove(commit.CommitId);
-            }
-        }
-
-        private void Dispatch(Commit commit)
-        {
-            try
-            {
-                Logger.Info(Resources.SchedulingDispatch, commit.CommitId);
-                _dispatcher.Dispatch(commit);
-                _checkpointHolder.SetCheckpoint(commit.CommitId);
-                NotifyAsyncs(commit);
-            }
-            catch (Exception ex)
-            {
-                NotifyAsyncsOfError(commit, ex);
-                Logger.Error(Resources.UnableToDispatch, _dispatcher.GetType(), commit.CommitId);
-            }
-        }
-    }
-
-    public interface ICheckpointHolder
-    {
-        void SetCheckpoint(string checkpoint);
-
-        string GetCheckpoint();
-    }
-}*/


单元测试代码清理

单元测试代码清理

--- src/ObjectServer.Test/Sql/SelectBuilderTests.cs
+++ src/ObjectServer.Test/Sql/SelectBuilderTests.cs
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using NUnit.Framework;
-
-namespace ObjectServer.Model.Test
-{
-    [TestFixture]
-    public class SelectBuilderTests : LocalTestCase
-    {
-
-        [Test]
-        public void Test_without_joins()
-        {
-        }
-    }
-}


Use GetStates for joystick handler

Use GetStates for joystick handler

--- osu.Framework/Input/Handlers/Joystick/OsuTKJoystickHandler.cs
+++ osu.Framework/Input/Handlers/Joystick/OsuTKJoystickHandler.cs
@@ -3,6 +3,7 @@

 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using osu.Framework.Input.StateChanges;
 using osu.Framework.Logging;
 using osu.Framework.MathUtils;
@@ -19,8 +20,6 @@
         private ScheduledDelegate scheduledPoll;
         private ScheduledDelegate scheduledRefreshDevices;

-        private int mostSeenDevices;
-
         private readonly List<JoystickDevice> devices = new List<JoystickDevice>();

         public override bool Initialize(GameHost host)
@@ -56,7 +55,6 @@
                     }

                     devices.Clear();
-                    mostSeenDevices = 0;
                 }
             }, true);

@@ -72,35 +70,28 @@

         private void refreshDevices()
         {
-            // Update devices and add them to newDevices if still connected
-            for (int i = 0; i < devices.Count; i++)
-            {
-                var dev = devices[i];
-
-                dev.Refresh();
-
-                if (!dev.RawState.IsConnected)
-                {
-                    mostSeenDevices--;
-                    if (dev.LastState != null)
-                        handleState(dev, new JoystickState());
-
-                    devices.RemoveAt(i--);
-                }
-            }
-
-            // Find any newly-connected devices
-            while (true)
-            {
-                if (!osuTK.Input.Joystick.GetCapabilities(mostSeenDevices).IsConnected)
-                    break;
-
-                var newDevice = new JoystickDevice(mostSeenDevices);
-
-                Logger.Log($"Connected joystick device: {newDevice.Guid}");
-
-                devices.Add(newDevice);
-                mostSeenDevices++;
+            // update states and add newly connected devices
+            var rawStates = osuTK.Input.Joystick.GetStates();
+
+            // it seems like OpenTK leaves all disconnected devices with IsConnceted == false
+            Debug.Assert(devices.Count <= rawStates.Length);
+
+            for (int index = 0; index < rawStates.Length; index++)
+            {
+                var rawState = rawStates[index];
+                if (index < devices.Count)
+                {
+                    devices[index].UpdateRawState(rawState);
+                }
+                else
+                {
+                    var guid = osuTK.Input.Joystick.GetGuid(index);
+
+                    var newDevice = new JoystickDevice(guid, rawState);
+                    devices.Add(newDevice);
+
+                    Logger.Log($"Connected joystick device: {newDevice.Guid}");
+                }
             }
         }

@@ -178,7 +169,7 @@

             /// <summary>
             /// The last state of this <see cref="JoystickDevice"/>.
-            /// This is updated with ever invocation of <see cref="Refresh"/>.
+            /// This is updated with ever invocation of <see cref="UpdateRawState"/>.
             /// </summary>
             public osuTK.Input.JoystickState? LastRawState { get; private set; }

@@ -186,7 +177,7 @@

             /// <summary>
             /// The current state of this <see cref="JoystickDevice"/>.
-            /// Use <see cref="Refresh"/> to update the state.
+            /// Use <see cref="UpdateRawState"/> to update the state.
             /// </summary>
             public osuTK.Input.JoystickState RawState { get; private set; }

@@ -202,24 +193,16 @@
             /// </summary>
             public readonly Guid Guid;

-            private readonly int deviceIndex;
-
-            public JoystickDevice(int deviceIndex)
-            {
-                this.deviceIndex = deviceIndex;
-
-                Guid = osuTK.Input.Joystick.GetGuid(deviceIndex);
-
-                Refresh();
-            }
-
-            /// <summary>
-            /// Refreshes the state of this <see cref="JoystickDevice"/>.
-            /// </summary>
-            public void Refresh()
+            public JoystickDevice(Guid guid, osuTK.Input.JoystickState rawState)
+            {
+                Guid = guid;
+                UpdateRawState(rawState);
+            }
+
+            public void UpdateRawState(osuTK.Input.JoystickState rawState)
             {
                 LastRawState = RawState;
-                RawState = osuTK.Input.Joystick.GetState(deviceIndex);
+                RawState = rawState;

                 if (!defaultDeadZones.IsValueCreated)
                 {


Schedule SetUp()

Schedule SetUp()

--- osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs
+++ osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs
@@ -41,11 +41,11 @@
         }

         [SetUp]
-        public void SetUp()
+        public void SetUp() => Schedule(() =>
         {
             isBreakTime.Value = false;
             lightenDuringBreaks.Value = false;
-        }
+        });

         [TestCase(0.6f, 0.3f)]
         [TestCase(0.2f, 0.0f)]


Fix ticks displaying higher than control point info

--- osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs
+++ osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs
@@ -86,8 +86,8 @@
                             MidColour = colours.BlueDark,
                             HighColour = colours.BlueDarker,
                         },
+                        ticks = new TimelineTickDisplay(),
                         controlPoints = new TimelineControlPointDisplay(),
-                        ticks = new TimelineTickDisplay(),
                     }
                 },
             });


Add missing newline

Add missing newline

--- osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs
+++ osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs
@@ -87,6 +87,7 @@
                         placementHandler.Delete(h.HitObject.HitObject);
                     return true;
             }
+
             return base.OnKeyDown(e);
         }


Fix potential crash in `DrawableRoom` due to lack of null check on post-lookup beatmap

--- osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs
+++ osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs
@@ -418,10 +418,16 @@
                                       var retrievedBeatmap = task.GetResultSafely();

                                       statusText.Text = "Currently playing ";
-                                      beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(),
-                                          LinkAction.OpenBeatmap,
-                                          retrievedBeatmap.OnlineID.ToString(),
-                                          creationParameters: s => s.Truncate = true);
+
+                                      if (retrievedBeatmap != null)
+                                      {
+                                          beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(),
+                                              LinkAction.OpenBeatmap,
+                                              retrievedBeatmap.OnlineID.ToString(),
+                                              creationParameters: s => s.Truncate = true);
+                                      }
+                                      else
+                                          beatmapText.AddText("unknown beatmap");
                                   }), cancellationSource.Token);
             }
         }


Delete Transient.cs

Delete Transient.cs

--- src/LoopBack.Sdk.Xamarin/Remooting/Transient.cs
+++ src/LoopBack.Sdk.Xamarin/Remooting/Transient.cs
@@ -1,12 +0,0 @@
-using System;
-
-namespace LoopBack.Sdk.Xamarin
-{
-	public class Transient
-	{
-		public Transient ()
-		{
-		}
-	}
-}
-


added repeated and unreachable code (checking sonarqube)

--- src/Playground.Calculator/StandardCalculator.cs
+++ src/Playground.Calculator/StandardCalculator.cs
@@ -36,6 +36,12 @@
             if (secondNumber == 0)
                 return 0;

+            if (firstNumber == 0)
+            {
+                _logger.Log("First number was zero.");
+                return secondNumber;
+            }
+
             var result = Math.BigMul(firstNumber, secondNumber);

             if (result > int.MaxValue)


Revert "Bitcoin code simplification"

Revert "Bitcoin code simplification"

This reverts commit 6c3d43b7dddf40d5ae1272bedfee7a40d2a7aca2.

--- src/MiningCore/Blockchain/Bitcoin/BitcoinJob.cs
+++ src/MiningCore/Blockchain/Bitcoin/BitcoinJob.cs
@@ -116,94 +116,120 @@
                 .ToArray();
         }

-        protected virtual void BuildCoinbase()
-        {
-            // generate script parts
-            var sigScriptInitial = GenerateScriptSigInitial();
-            var sigScriptInitialBytes = sigScriptInitial.ToBytes();
-
-            var sigScriptLength = (uint) (
-                sigScriptInitial.Length +
-                extraNoncePlaceHolderLength +
-                scriptSigFinalBytes.Length);
-
-            // output transaction
-            txOut = CreateOutputTransaction();
-
-            // build coinbase initial
-            using (var stream = new MemoryStream())
-            {
-                var bs = new BitcoinStream(stream, true);
-
-                // version
-                bs.ReadWrite(ref txVersion);
-
-                // timestamp for POS coins
-                if (isPoS)
-                {
-                    var timestamp = BlockTemplate.CurTime;
-                    bs.ReadWrite(ref timestamp);
-                }
-
-                // serialize (simulated) input transaction
-                bs.ReadWriteAsVarInt(ref txInputCount);
-                bs.ReadWrite(ref sha256Empty);
-                bs.ReadWrite(ref txInPrevOutIndex);
-
-                // signature script initial part
-                bs.ReadWriteAsVarInt(ref sigScriptLength);
-                bs.ReadWrite(ref sigScriptInitialBytes);
-
-                // done
-                coinbaseInitial = stream.ToArray();
-                coinbaseInitialHex = coinbaseInitial.ToHexString();
-            }
-
-            // build coinbase final
-            using (var stream = new MemoryStream())
-            {
-                var bs = new BitcoinStream(stream, true);
-
-                // signature script final part
-                bs.ReadWrite(ref scriptSigFinalBytes);
-
-                // tx in sequence
-                bs.ReadWrite(ref txInSequence);
-
-                // serialize output transaction
-                var txOutBytes = SerializeOutputTransaction(txOut);
-                bs.ReadWrite(ref txOutBytes);
-
-                // misc
-                bs.ReadWrite(ref txLockTime);
-
-                // done
-                coinbaseFinal = stream.ToArray();
-                coinbaseFinalHex = coinbaseFinal.ToHexString();
-            }
-        }
-
-        protected virtual byte[] SerializeOutputTransaction(Transaction tx)
-        {
-            using (var stream = new MemoryStream())
-            {
-                var bs = new BitcoinStream(stream, true);
-
-                // serialize outputs
-                var vout = tx.Outputs;
-                bs.ReadWrite<TxOutList, TxOut>(ref vout);
-
-                // serialize witness (segwit)
-                if (!string.IsNullOrEmpty(BlockTemplate.DefaultWitnessCommitment))
-                {
-                    var witScript = new WitScript(BlockTemplate.DefaultWitnessCommitment);
-                    var raw = witScript.ToBytes();
-                    bs.ReadWrite(ref raw);
-                }
-
-                return stream.ToArray();
-            }
-        }
+        protected virtual void BuildCoinbase()
+        {
+            // generate script parts
+            var sigScriptInitial = GenerateScriptSigInitial();
+            var sigScriptInitialBytes = sigScriptInitial.ToBytes();
+
+            var sigScriptLength = (uint) (
+                sigScriptInitial.Length +
+                extraNoncePlaceHolderLength +
+                scriptSigFinalBytes.Length);
+
+            // output transaction
+            txOut = CreateOutputTransaction();
+
+            // build coinbase initial
+            using (var stream = new MemoryStream())
+            {
+                var bs = new BitcoinStream(stream, true);
+
+                // version
+                bs.ReadWrite(ref txVersion);
+
+                // timestamp for POS coins
+                if (isPoS)
+                {
+                    var timestamp = BlockTemplate.CurTime;
+                    bs.ReadWrite(ref timestamp);
+                }
+
+                // serialize (simulated) input transaction
+                bs.ReadWriteAsVarInt(ref txInputCount);
+                bs.ReadWrite(ref sha256Empty);
+                bs.ReadWrite(ref txInPrevOutIndex);
+
+                // signature script initial part
+                bs.ReadWriteAsVarInt(ref sigScriptLength);
+                bs.ReadWrite(ref sigScriptInitialBytes);
+
+                // done
+                coinbaseInitial = stream.ToArray();
+                coinbaseInitialHex = coinbaseInitial.ToHexString();
+            }
+
+            // build coinbase final
+            using (var stream = new MemoryStream())
+            {
+                var bs = new BitcoinStream(stream, true);
+
+                // signature script final part
+                bs.ReadWrite(ref scriptSigFinalBytes);
+
+                // tx in sequence
+                bs.ReadWrite(ref txInSequence);
+
+                // serialize output transaction
+                var txOutBytes = SerializeOutputTransaction(txOut);
+                bs.ReadWrite(ref txOutBytes);
+
+                // misc
+                bs.ReadWrite(ref txLockTime);
+
+                // done
+                coinbaseFinal = stream.ToArray();
+                coinbaseFinalHex = coinbaseFinal.ToHexString();
+            }
+        }
+
+        protected virtual byte[] SerializeOutputTransaction(Transaction tx)
+        {
+            var withDefaultWitnessCommitment = !string.IsNullOrEmpty(BlockTemplate.DefaultWitnessCommitment);
+
+            var outputCount = (uint)tx.Outputs.Count;
+            if (withDefaultWitnessCommitment)
+                outputCount++;
+
+            using (var stream = new MemoryStream())
+            {
+                var bs = new BitcoinStream(stream, true);
+
+                // write output count
+                bs.ReadWriteAsVarInt(ref outputCount);
+
+                long amount;
+                byte[] raw;
+                uint rawLength;
+
+                // serialize witness (segwit)
+                if (withDefaultWitnessCommitment)
+                {
+                    amount = 0;
+                    raw = BlockTemplate.DefaultWitnessCommitment.HexToByteArray();
+                    rawLength = (uint)raw.Length;
+
+                    bs.ReadWrite(ref amount);
+                    bs.ReadWriteAsVarInt(ref rawLength);
+                    bs.ReadWrite(ref raw);
+                }
+
+                // serialize outputs
+                foreach (var output in tx.Outputs)
+                {
+                    amount = output.Value.Satoshi;
+                    var outScript = output.ScriptPubKey;
+                    raw = outScript.ToBytes(true);
+                    rawLength = (uint)raw.Length;
+
+                    bs.ReadWrite(ref amount);
+                    bs.ReadWriteAsVarInt(ref rawLength);
+                    bs.ReadWrite(ref raw);
+                }
+
+                return stream.ToArray();
+            }
+        }

         protected virtual Script GenerateScriptSigInitial()
         {


Adding tests

Adding tests

--- src/RazorMailer.Tests/RazorMailerEngineTests.cs
+++ src/RazorMailer.Tests/RazorMailerEngineTests.cs
@@ -1,4 +1,5 @@
-using System.Net.Mail;
+using System;
+using System.Net.Mail;
 using System.Threading.Tasks;
 using Moq;
 using RazorMailer.Tests.Models;
@@ -19,7 +20,7 @@
         }

         [Fact]
-        public void simple_template_with_typed_model_test()
+        public void mailmessage_simple_template_with_typed_model_test()
         {
             var email = _mailerEngine.Create("WelcomeSimple", new WelcomeModel { Name = "Joe Blogs" }, "joe@blogs.com", "Welcome to our service");
             _mailerEngine.Send(email);
@@ -29,7 +30,7 @@
         }

         [Fact]
-        public void simple_template_without_model()
+        public void mailmessage_simple_template_without_model()
         {
             var email = _mailerEngine.Create("WelcomeSimpleNoModel", "joe@blogs.com", "Welcome to our service");
             _mailerEngine.Send(email);
@@ -38,7 +39,7 @@
         }

         [Fact]
-        public async Task async_simple_template_with_typed_model_test()
+        public async Task mailmessage_async_simple_template_with_typed_model()
         {
             var email = _mailerEngine.Create("WelcomeSimple", new WelcomeModel { Name = "Joe Blogs" }, "joe@blogs.com", "Welcome to our service");
             await _mailerEngine.SendAsync(email);
@@ -48,7 +49,7 @@
         }

         [Fact]
-        public void layout_template_with_typed_model_test()
+        public void mailmessage_layout_template_with_typed_model()
         {
             var email = _mailerEngine.Create("WelcomePartial", new WelcomeModel { Name = "Joe Blogs" }, "joe@blogs.com", "Welcome to our service");
             _mailerEngine.Send(email);
@@ -58,7 +59,7 @@
         }

         [Fact]
-        public async Task async_layout_template_with_typed_model_test()
+        public async Task mailmessage_async_layout_template_with_typed_model()
         {
             var email = _mailerEngine.Create("WelcomePartial", new WelcomeModel { Name = "Joe Blogs" }, "joe@blogs.com", "Welcome to our service");
             await _mailerEngine.SendAsync(email);
@@ -66,5 +67,49 @@
             dispatcher.Verify(x => x.SendAsync(It.IsAny<MailMessage>()), Times.Once);
             Assert.Contains("Joe Blogs", email.Body);
         }
+
+        [Fact]
+        public void string_simple_template_without_model()
+        {
+            var text = _mailerEngine.Create("WelcomeSimpleNoModel");
+            Assert.Contains("Toodles", text);
+        }
+
+        [Fact]
+        public void string_simple_template_with_typed_model()
+        {
+            var text = _mailerEngine.Create("WelcomeSimple", new WelcomeModel { Name = "Joe Blogs" });
+            Assert.Contains("Joe Blogs", text);
+        }
+
+        [Fact]
+        public void string_layout_template_with_typed_model_test()
+        {
+            var text = _mailerEngine.Create("WelcomePartial", new WelcomeModel { Name = "Joe Blogs" });
+            Assert.Contains("Joe Blogs", text);
+        }
+
+        [Fact]
+        public async Task implicit_ctor_smtp_host_not_provided()
+        {
+            _mailerEngine = new RazorMailerEngine("templates", "hello@sampleapp.com", "SampleApp");
+            var email = _mailerEngine.Create("WelcomePartial", new WelcomeModel { Name = "Joe Blogs" }, "joe@blogs.com", "Welcome to our service");
+            await Assert.ThrowsAsync<InvalidOperationException>(() => _mailerEngine.SendAsync(email));
+        }
+
+        [Fact]
+        public void reduced_ctor_able_to_create_string()
+        {
+            _mailerEngine = new RazorMailerEngine("templates");
+            var text = _mailerEngine.Create("WelcomePartial", new WelcomeModel { Name = "Joe Blogs" });
+            Assert.Contains("Joe Blogs", text);
+        }
+
+        [Fact]
+        public void reduced_ctor_not_able_to_create_mailmessage()
+        {
+            _mailerEngine = new RazorMailerEngine("templates");
+            Assert.Throws<MissingInformationException>(() => _mailerEngine.Create("WelcomePartial", new WelcomeModel { Name = "Joe Blogs" }, "joe@blogs.com", "Welcome to our service"));
+        }
     }
 }


Removed not needed method in Reflection

Removed not needed method in Reflection

--- src/MyTested.HttpServer/Utilities/Reflection.cs
+++ src/MyTested.HttpServer/Utilities/Reflection.cs
@@ -59,14 +59,5 @@

             return string.Format("{0}<{1}>", friendlyGenericName, joinedGenericArgumentNames);
         }
-
-
-        private static bool ObjectImplementsIComparable(object obj)
-        {
-            return obj.GetType()
-                .GetTypeInfo()
-                .ImplementedInterfaces
-                .FirstOrDefault(i => i.Name.StartsWith("IComparable")) != null;
-        }
     }
 }


Fixed foreach loop resolver

Fixed foreach loop resolver

--- src/Remotus.Web/App_Code/ExpressionEvaluator.cs
+++ src/Remotus.Web/App_Code/ExpressionEvaluator.cs
@@ -52,10 +52,12 @@
                         }

                         var s = startIndex - "{{".Length;
-                        expr = expr.Remove(startIndex - "{{".Length, endloopIndex + "{{end:foreach}}".Length);
-                        expr = expr.Substring(0, s) + valueStr + expr.Substring(s);
-
-                        index = expr.IndexOf("{{");
+                        var l = (expr.Length - s) - (expr.Length - endloopIndex) + "{{end:foreach}}".Length;
+                        var res = expr.Remove(s, l);
+                        expr = res.Substring(0, s) + valueStr + res.Substring(s);
+
+                        //index = expr.IndexOf("{{");
+                        index = expr.IndexOf("{{", s +1);
                         continue;
                     }


Binders refactoring (removed unused methods)

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@4872

--- src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs
+++ src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -187,7 +186,7 @@
 				model.BatchSize = classMapping.BatchSize.Value;

 			// SELECT BEFORE UPDATE
-			model.SelectBeforeUpdate = classMapping.SelectBeforeUpdate;;
+			model.SelectBeforeUpdate = classMapping.SelectBeforeUpdate;

 			// META ATTRIBUTES
 			model.MetaAttributes = GetMetas(classMapping, inheritedMetas);
@@ -253,17 +252,6 @@
 				string tupClassName = FullQualifiedClassName(tuplizer.@class, mappings);
 				entity.AddTuplizer(EntityMode.Poco, tupClassName);
 			}
-		}
-
-		private XmlNode LocateTuplizerDefinition(XmlNode container, EntityMode mode)
-		{
-			string modeToFind = EntityModeHelper.ToString(mode);
-			foreach (XmlNode node in container.SelectNodes(HbmConstants.nsTuplizer, namespaceManager))
-			{
-				if (modeToFind.Equals(node.Attributes["entity-mode"].Value))
-					return node;
-			}
-			return null;
 		}

 		private void BindJoin(XmlNode node, Join join, IDictionary<string, MetaAttribute> inheritedMetas)
@@ -421,25 +409,6 @@
 			}
 		}

-		private static Versioning.OptimisticLock GetOptimisticLockMode(XmlAttribute olAtt)
-		{
-			if (olAtt == null)
-				return Versioning.OptimisticLock.Version;
-
-			string olMode = olAtt.Value;
-
-			if (olMode == null || "version".Equals(olMode))
-				return Versioning.OptimisticLock.Version;
-			else if ("dirty".Equals(olMode))
-				return Versioning.OptimisticLock.Dirty;
-			else if ("all".Equals(olMode))
-				return Versioning.OptimisticLock.All;
-			else if ("none".Equals(olMode))
-				return Versioning.OptimisticLock.None;
-			else
-				throw new MappingException("Unsupported optimistic-lock style: " + olMode);
-		}
-
 		protected PersistentClass GetSuperclass(XmlNode subnode)
 		{
 			XmlAttribute extendsAttr = subnode.Attributes["extends"];
@@ -983,7 +952,6 @@
 					{
 						case HbmCustomSQLCheck.None:
 							return ExecuteUpdateResultCheckStyle.None;
-							break;
 						case HbmCustomSQLCheck.Rowcount:
 							return ExecuteUpdateResultCheckStyle.Count;
 						case HbmCustomSQLCheck.Param:


SequenceStructure.cs: Change log wording, and remove unused sql parameter.

--- src/NHibernate/Id/Enhanced/SequenceStructure.cs
+++ src/NHibernate/Id/Enhanced/SequenceStructure.cs
@@ -90,7 +90,7 @@
 				_owner._accessCounter++;
 				try
 				{
-					IDbCommand st = _session.Batcher.PrepareCommand(CommandType.Text, _owner._sql, new SqlType[] { SqlTypeFactory.Int64 });
+					IDbCommand st = _session.Batcher.PrepareCommand(CommandType.Text, _owner._sql, SqlTypeFactory.NoTypes);
 					IDataReader rs = null;
 					try
 					{
@@ -101,7 +101,7 @@
 							long result = rs.GetInt64(0);
 							if (Log.IsDebugEnabled)
 							{
-								Log.Debug("Sequence identifier generated: " + result);
+								Log.Debug("Sequence value obtained: " + result);
 							}
 							return result;
 						}


Changed the hide nav check to the correct logic

- The logic handles both string and bool versions of the variable correctly

--- src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml
+++ src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml
@@ -138,7 +138,7 @@
                                     Settings

Your accounts

-                                        @if (string.IsNullOrWhiteSpace(ViewBag.HideNav))
+                                        @if (ViewBag.HideNav.ParseHideNavFromViewBag())
                                         {

Rename account

                                         }


Локализация

Локализация

--- src/ScriptEngine/Compiler/CompilerExceptions.cs
+++ src/ScriptEngine/Compiler/CompilerExceptions.cs
@@ -57,7 +57,7 @@
         internal static CompilerException TokenExpected(params Token[] expected)
         {
             var names = expected.Select(x => Enum.GetName(typeof(Token), x));
-            return new CompilerException(Locale.NStr("ru='Ожидается символ: ';en='Expecting: '") + String.Join("/", names));
+            return new CompilerException(Locale.NStr("ru='Ожидается символ: ';en='Expecting symbol: '") + String.Join("/", names));
         }

         internal static CompilerException TokenExpected(string tokens)


Modified assembly description.

Modified assembly description.

--- src/Shields.GraphViz/Properties/AssemblyInfo.cs
+++ src/Shields.GraphViz/Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 [assembly: AssemblyTitle("Shields.GraphViz")]
-[assembly: AssemblyDescription("A .NET wrapper for GraphViz. Easily enhance your applications with graph visualizations.")]
+[assembly: AssemblyDescription("Shields.GraphViz is a .NET wrapper for GraphViz. Easily enhance your applications with graph visualizations.")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("Timothy Shields")]
 [assembly: AssemblyProduct("Shields.GraphViz")]
@@ -32,5 +32,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.0.*")]
-[assembly: AssemblyVersion("1.0.0.5")]
-[assembly: AssemblyFileVersion("1.0.0.5")]
+[assembly: AssemblyVersion("1.0.0.6")]
+[assembly: AssemblyFileVersion("1.0.0.6")]


added a test that installing the content works the same

--- src/Shimmer.Tests/Client/InstallManagerTests.cs
+++ src/Shimmer.Tests/Client/InstallManagerTests.cs
@@ -22,8 +22,7 @@
 {
     public class InstallManagerTests
     {
-        [Fact(Skip="This test needs to be reviewed - it expects the " +
-            "SampleUpdatingApp.exe and RELEASES but those do not seem to be created")]
+        [Fact(Skip="The Zip test has some zero values - too fast lol")]
         public void EigenUpdateWithoutUpdateURL()
         {
             string dir;
@@ -41,7 +40,7 @@
                 var progressValues = new List<int>();
                 progress.Subscribe(progressValues.Add);

-                fixture.ExecuteInstall(dir, pkg, progress);
+                fixture.ExecuteInstall(dir, pkg, progress).Wait();

                 var filesToLookFor = new[] {
                     "SampleUpdatingApp\\app-1.1.0.0\\SampleUpdatingApp.exe",
@@ -123,5 +122,42 @@

             fixture.ExecuteUninstall().First();
         }
+
+        [Fact]
+        public void InstallWithContentInPackageDropsInSameFolder()
+        {
+            string dir;
+            string outDir;
+
+            var package = "ProjectWithContent.1.0.0.0-beta-full.nupkg";
+
+            using (Utility.WithTempDirectory(out outDir))
+            using (IntegrationTestHelper.WithFakeInstallDirectory(package, out dir))
+            {
+                try
+                {
+                    var di = new DirectoryInfo(dir);
+
+                    var bundledRelease = ReleaseEntry.GenerateFromFile(di.GetFiles("*.nupkg").First().FullName);
+                    var fixture = new InstallManager(bundledRelease, outDir);
+                    var pkg = new ZipPackage(Path.Combine(dir, package));
+
+                    fixture.ExecuteInstall(dir, pkg).Wait();
+
+                    var filesToLookFor = new[] {
+                        "ProjectWithContent\\app-1.0.0.0\\project-with-content.exe",
+                        "ProjectWithContent\\app-1.0.0.0\\some-words.txt",
+                        "ProjectWithContent\\packages\\RELEASES",
+                        "ProjectWithContent\\packages\\ProjectWithContent.1.0.0.0-beta-full.nupkg",
+                    };
+
+                    filesToLookFor.ForEach(f => Assert.True(File.Exists(Path.Combine(outDir, f)), "Could not find file: " + f));
+                }
+                finally
+                {
+                    Directory.Delete(dir, true);
+                }
+            }
+        }
     }
 }


get document by system ID

get document by system ID

--- src/Sir.Search/Session/DocumentStreamSession.cs
+++ src/Sir.Search/Session/DocumentStreamSession.cs
@@ -45,7 +45,7 @@
             }
         }

-        protected IDictionary<string, object> ReadDoc(
+        public IDictionary<string, object> ReadDoc(
             (ulong collectionId, long docId) docId,
             HashSet<string> select,
             double? score = null


Increase 'squish synced messages' dead time to 10 seconds

--- src/SyncTrayzor/NotifyIcon/NotifyIconManager.cs
+++ src/SyncTrayzor/NotifyIcon/NotifyIconManager.cs
@@ -25,6 +25,9 @@

     public class NotifyIconManager : INotifyIconManager
     {
+        // Amount of time to squish 'synced' messages for after a connectivity event
+        private static readonly TimeSpan syncedDeadTime = TimeSpan.FromSeconds(10);
+
         private readonly IViewManager viewManager;
         private readonly NotifyIconViewModel viewModel;
         private readonly IApplicationState application;
@@ -76,7 +79,7 @@
             this.syncThingManager.FolderSyncStateChanged += (o, e) =>
             {
                 if (this.ShowSynchronizedBalloon &&
-                    DateTime.UtcNow - this.syncThingManager.LastConnectivityEventTime > TimeSpan.FromSeconds(5) &&
+                    DateTime.UtcNow - this.syncThingManager.LastConnectivityEventTime > syncedDeadTime &&
                     e.SyncState == FolderSyncState.Idle && e.PrevSyncState == FolderSyncState.Syncing)
                 {
                     Application.Current.Dispatcher.CheckAccess(); // Double-check


Extract IsByteArray

Extract IsByteArray

--- src/Tasks/ResourceHandling/MSBuildResXReader.cs
+++ src/Tasks/ResourceHandling/MSBuildResXReader.cs
@@ -155,14 +155,10 @@

             if (mimetype == null)
             {
-                if (typename.IndexOf("System.Byte[]") != -1 && typename.IndexOf("mscorlib") != -1)
+                if (IsByteArray(typename))
                 {
                     byte[] byteArray = Convert.FromBase64String(value);

-                    // Comment and logic from https://github.com/dotnet/winforms/blob/16b192389b377c647ab3d280130781ab1a9d3385/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs#L411-L416
-                    // Handle byte[]'s, which are stored as base-64 encoded strings.
-                    // We can't hard-code byte[] type name due to version number
-                    // updates & potential whitespace issues with ResX files.
                     resources.Add(new LiveObjectResource(name, byteArray));
                     return;
                 }
@@ -239,6 +235,20 @@
         }

         /// <summary>
+        /// Does this assembly-qualified type name represent an array of bytes?
+        /// </summary>
+        /// <remarks>
+        /// Comment and logic from https://github.com/dotnet/winforms/blob/16b192389b377c647ab3d280130781ab1a9d3385/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs#L411-L416
+        /// </remarks>
+        // Handle byte[]'s, which are stored as base-64 encoded strings.
+        // We can't hard-code byte[] type name due to version number
+        // updates & potential whitespace issues with ResX files.
+        private static bool IsByteArray(string fileRefType)
+        {
+            return fileRefType.IndexOf("System.Byte[]") != -1 && fileRefType.IndexOf("mscorlib") != -1;
+        }
+
+        /// <summary>
         /// Extract <see cref="IResource"/>s from a given file on disk.
         /// </summary>
         public static IReadOnlyList<IResource> GetResourcesFromFile(string filename, bool pathsRelativeToBasePath)


Changed ToList to ToHashSet, so that items don't occur twice.

--- src/TestLinker/Actions/GotoLinkedTypesAction.cs
+++ src/TestLinker/Actions/GotoLinkedTypesAction.cs
@@ -62,7 +62,7 @@
       var typesInContext = GetTypesInContext(textControl, solution).ToList();

       var linkedTypesProvider = solution.GetComponent<LinkedTypesService>();
-      var linkedTypes = typesInContext.SelectMany(x => linkedTypesProvider.GetLinkedTypes(x)).ToList();
+      var linkedTypes = typesInContext.SelectMany(x => linkedTypesProvider.GetLinkedTypes(x)).ToHashSet();
       if (linkedTypes.IsEmpty())
         return;


reverts IQuery

reverts IQuery

--- src/Umbraco.Core/Persistence/Querying/IQuery.cs
+++ src/Umbraco.Core/Persistence/Querying/IQuery.cs
@@ -4,6 +4,28 @@

 namespace Umbraco.Core.Persistence.Querying
 {
+    /// <summary>
+    /// SD: This is a horrible hack but unless we break compatibility with anyone who's actually implemented IQuery{T} there's not much we can do.
+    /// The IQuery{T} interface is useless without having a GetWhereClauses method and cannot be used for tests.
+    /// We have to wait till v8 to make this change I suppose.
+    /// </summary>
+    internal static class QueryExtensions
+    {
+        /// <summary>
+        /// Returns all translated where clauses and their sql parameters
+        /// </summary>
+        /// <returns></returns>
+        public static IEnumerable<Tuple<string, object[]>> GetWhereClauses<T>(this IQuery<T> query)
+        {
+            var q = query as Query<T>;
+            if (q == null)
+            {
+                throw new NotSupportedException(typeof(IQuery<T>) + " cannot be cast to " + typeof(Query<T>));
+            }
+            return q.GetWhereClauses();
+        }
+    }
+
     /// <summary>
     /// Represents a query for building Linq translatable SQL queries
     /// </summary>
@@ -17,10 +39,6 @@
         /// <returns>This instance so calls to this method are chainable</returns>
         IQuery<T> Where(Expression<Func<T, bool>> predicate);

-        /// <summary>
-        /// Returns all translated where clauses and their sql parameters
-        /// </summary>
-        /// <returns></returns>
-        IEnumerable<Tuple<string, object[]>> GetWhereClauses();
+
     }
 }