Tests for 'format' and string interpolation.

--- csharp/NShovel/ShovelTests/VmTests.cs
+++ csharp/NShovel/ShovelTests/VmTests.cs
@@ -607,9 +607,9 @@
 3 -> f($, 2) -> g(3, $)
 ";
             Utils.TestValue(program, Shovel.Value.Kinds.Integer, (long)15);
-        }
-
-        [Test]
+        }
+
+        [Test]
         public void WeaveChainNest()
         {
             var program = @"
@@ -618,8 +618,26 @@
 3 -> f($, 2) -> g(2 -> (1 + $), $)
 ";
             Utils.TestValue(program, Shovel.Value.Kinds.Integer, (long)15);
-        }
-
+        }
+
+        [Test]
+        public void ReplacementWithoutWeave()
+        {
+            var program = @"
+$";
+            Utils.ExpectException<ShovelException>(() =>
+            {
+                Utils.TestValue(program, Shovel.Value.Kinds.Integer, (long)6);
+            }, (ex) =>
+            {
+                Assert.IsNotNull(ex);
+                Assert.AreEqual(@"'$' without '->'.
+file 'test.sho' line 2: $
+file 'test.sho' line 2: ^".TrimCarriageReturn(), ex.Message.TrimCarriageReturn());
+                Assert.AreEqual("test.sho", ex.FileName);
+            });
+        }
+
         [Test]
         public void Apply()
         {
@@ -856,5 +874,106 @@
             Assert.AreEqual(1, log.Count);
             Assert.AreEqual("hello", log[0]);
         }
+
+        [Test]
+        public void Format()
+        {
+            var program = @"
+var product = hash('name', 'paperweight', 'price', 20)
+format('The {0} is {1:C2}.', product.name, product.price)
+";
+            Utils.TestValue(program, Shovel.Value.Kinds.String, "The paperweight is $20.00.");
+        }
+
+        [Test]
+        public void StringInterpolation()
+        {
+            var program = @"
+var name = 'John'
+var quality = 'wise'
+'${name} is ${quality}.'
+";
+            Utils.TestValue(program, Shovel.Value.Kinds.String, "John is wise.");
+        }
+
+        [Test]
+        public void StringInterpolationEscape()
+        {
+            var program = @"
+var name = 'John'
+var quality = 'wise'
+'\${name} is ${quality}.'
+";
+            Utils.TestValue(program, Shovel.Value.Kinds.String, "${name} is wise.");
+        }
+
+        [Test]
+        public void StringInterpolationError1()
+        {
+            var program = @"
+var name = 'John'
+var quality = 'wise'
+'${name is ${quality}.'
+";
+            Utils.ExpectException<ShovelException>(() =>
+            {
+                Utils.TestValue(program, Shovel.Value.Kinds.String, "John is wise.");
+            }, (ex) =>
+            {
+                Assert.IsNotNull(ex);
+                Assert.AreEqual(@"While interpolating a string value:
+Expected a identifier, but reached the end of input.
+file 'test.sho' line 4: '${name is ${quality}.'
+file 'test.sho' line 4: ^^^^^^^^^^^^^^^^^^^^^^^".TrimCarriageReturn(), ex.Message.TrimCarriageReturn());
+                Assert.AreEqual("test.sho", ex.FileName);
+            });
+
+        }
+
+        [Test]
+        public void StringInterpolationError2()
+        {
+            var program = @"
+var product = hash('name', 'paperweight', 'price', 19.90)
+var names = array('John', 'Smith')
+'Mr. ${upper(names[1)}, the ${product.name} is ${product.price:C2}.'
+";
+            Utils.ExpectException<ShovelException>(() =>
+            {
+                Utils.TestValue(program, Shovel.Value.Kinds.String, "John is wise.");
+            }, (ex) =>
+            {
+                Assert.IsNotNull(ex);
+                Assert.AreEqual(@"While interpolating a string value:
+Expected ']', but got ')'.
+file 'test.sho' line 4: 'Mr. ${upper(names[1)}, the ${product.name} is ${product.price:C2}.'
+file 'test.sho' line 4:                     ^
+file 'test.sho' line 4: 'Mr. ${upper(names[1)}, the ${product.name} is ${product.price:C2}.'
+file 'test.sho' line 4: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^".TrimCarriageReturn(), ex.Message.TrimCarriageReturn());
+                Assert.AreEqual("test.sho", ex.FileName);
+            });
+        }
+
+        [Test]
+        public void StringInterpolationComplex()
+        {
+            var program = @"
+var product = hash('name', 'paperweight', 'price', 19.90)
+var names = array('John', 'Smith')
+'Mr. ${upper(names[1])}, the ${product.name} is ${product.price:C2}.'
+";
+            Utils.TestValue(program, Shovel.Value.Kinds.String, "Mr. SMITH, the paperweight is $19.90.");
+        }
+
+        [Test]
+        public void StringInterpolationMany()
+        {
+            var program = @"
+var product = hash('name', 'paperweight', 'price', 19.90, 'category', 'stuff')
+var names = array('John', 'Smith')
+'Mr. ${upper(names[1])}, the ${product.name} is ${product.price:C2} (category ""${product.category}"").'
+";
+            Utils.TestValue(program, Shovel.Value.Kinds.String, "Mr. SMITH, the paperweight is $19.90 (category \"stuff\").");
+        }
     }
 }


bunch of improvements to wind and dynPressure accuracy. Runaway still occurs.

--- Simulation/CellUpdater.cs
+++ Simulation/CellUpdater.cs
@@ -180,6 +180,7 @@

             double DeltaTime = WeatherFunctions.GetDeltaTime(PD.index);
             double DeltaAltitude = WeatherFunctions.GetDeltaLayerAltitude(PD.index, cell);
+            double DeltaDistance_Avg = 0.0;

             {
                 int neighborIndex = 0;
@@ -950,17 +951,21 @@
             for (int layer = 0; layer < layerCount; layer++)
             {
                 WeatherCell wCell = PD.LiveMap[layer][cell];
+
+                // Horizontal wind
                 wsDiv[layer] = 0;
                 int n = 0;
+                DeltaDistance_Avg = 0.0;
                 float Pressure_eq = 0;
+                float cell_Z = WeatherFunctions.GetCellAltitude(PD.index, layer, cell);
                 DP[layer] = new float[cell.GetNeighbors(PD.gridLevel).ToList().Count];
                 foreach (Cell neighbor in cell.GetNeighbors(PD.gridLevel))
                 {
                     WeatherCell wCellNeighbor = PD.LiveMap[layer][neighbor];
                     double DeltaDistance = WeatherFunctions.GetDistanceBetweenCells(PD.index, cell, neighbor, WeatherFunctions.GetCellAltitude(PD.index, layer, cell));
+                    DeltaDistance_Avg += DeltaDistance;
                     double CosDir = Math.Cos(direction[n]);
                     double SinDir = Math.Sin(direction[n]);
-                    float cell_Z = WeatherFunctions.GetCellAltitude(PD.index, layer, cell);
                     float neigh_Z = WeatherFunctions.GetCellAltitude(PD.index, layer, neighbor);
                     Pressure_eq = 0;
                     if (layer == 0)
@@ -973,7 +978,7 @@
                             / (PD.SHF * PD.LiveMap[layer - 1][neighbor].temperature)));  // all pressures need be reduced at the same altitude (that of the current cell, layer) before comparing them
                     }
                     float deltaPressure = (float)((wCell.pressure - Pressure_eq) / DeltaDistance);
-                    // DP.Add(deltaPressure);
+
                     DP[layer][n] = deltaPressure;
                     Divg[layer] += deltaPressure;

@@ -993,6 +998,7 @@
                 Divg[layer] /= n;
                 wsN[layer] /= n;
                 wsE[layer] /= n;
+                DeltaDistance_Avg /= n;

                 // tensor components on the x-z local plane due to airflow from adjacent cells
                 tensStr[layer].x *= PD.LiveMap[layer][cell].windVector.x * DeltaTime / n;
@@ -1000,20 +1006,16 @@
                 rotrStr[layer].x *= PD.LiveMap[layer][cell].windVector.x * DeltaTime / n;
                 rotrStr[layer].z *= PD.LiveMap[layer][cell].windVector.z * DeltaTime / n;

-                // float DPInt = Mathf.Sqrt((wsN[layer] * wsN[layer]) + (wsE[layer] * wsE[layer]));
-
-                // float DPacc = DPInt / D_wet[layer];
-
-                float Mu = Suth_B / (wCell.temperature + Suth_S) * Mathf.Pow(wCell.temperature, 3f / 2f);

                 Total_N[layer] = wCell.windVector.x;
                 Total_E[layer] = wCell.windVector.z;

                 // windspeed increase due to Coriolis forces
                 float Cor_N = (float)(2 * Total_E[layer] * PD.body.angularV * Mathf.Sin(latitude * Mathf.Deg2Rad) * DeltaTime);
-                float Cor_E = (float)(2 * Total_N[layer] * PD.body.angularV * Mathf.Sin(latitude * Mathf.Deg2Rad) * DeltaTime);
-
+                float Cor_E = (float)(-2 * Total_N[layer] * PD.body.angularV * Mathf.Sin(latitude * Mathf.Deg2Rad) * DeltaTime);
+
                 // windspeed increase due to air viscosity (decrease, but takes sign opposite to the current wind)
+                float Mu = Suth_B / (wCell.temperature + Suth_S) * Mathf.Pow(wCell.temperature, 3f / 2f);
                 float Mu_dec_N = 0;
                 float Mu_dec_E = 0;
                 if (layer == 0)
@@ -1034,6 +1036,7 @@
                 Total_N[layer] += W_N_P + Cor_N + Mu_dec_N + (float)tensStr[layer].x - (float)rotrStr[layer].z;
                 Total_E[layer] += W_E_P + Cor_E + Mu_dec_E + (float)tensStr[layer].z + (float)rotrStr[layer].x;

+                // vertical wind
                 // Buoyancy
                 WeatherCell wCellLive = PD.LiveMap[layer][cell];
                 if (layer == 0)
@@ -1079,31 +1082,8 @@
                         / PD.LiveMap[layer + 1][cell].pressure + D_wet[layer]) / 2 / DeltaAltitude);
                 }

-            }
-
-            //calc the vertical divergence
-            /*
-            float posFactor = 0;
-            for (int i = Divg.Length - 1; i >= 0; i--)
-            {
-                if (i >= Divg.Length / 2)
-                {
-                    posFactor += (i + 1 - Divg.Length / 2) * Divg[i];
-                }
-                else
-                {
-                    posFactor += (i - Divg.Length / 2) * Divg[i];
-                }
-            }
-            float ws_V_div = K_DIVG * posFactor;
-            */
-
-            for (int layer = 0; layer < layerCount; layer++)
-            {
-                WeatherCell wCell = PD.BufferMap[layer][cell];
-                WeatherCell wCellLive = PD.LiveMap[layer][cell];
                 Ws_V_ana[layer] = 0;  // TODO: here is where to compute anabatic wind (after orography)
-                float Mu = Suth_B / (wCell.temperature + Suth_S) * Mathf.Pow(wCell.temperature, 3f / 2f);
+                // float Mu = Suth_B / (wCell.temperature + Suth_S) * Mathf.Pow(wCell.temperature, 3f / 2f);
                 double wsVdiff = ((layer < layerCount - 1 ? (wCellLive.windVector.y - PD.LiveMap[layer + 1][cell].windVector.y) : 0) +
                     (layer > 0 ? (wCellLive.windVector.y - PD.LiveMap[layer - 1][cell].windVector.y) : 0));
                 tensStr[layer].y = Math.Abs(wCellLive.windVector.y) / DeltaAltitude * wsVdiff; //wind * tensor gradient
@@ -1112,13 +1092,38 @@
                 float wsV = (float)(wCellLive.windVector.y + (buoyancy[layer] + DP_V[layer] - (wCellLive.windVector.y
                     * Mu / D_wet[layer])) * DeltaTime / 2 - wsVdiff / 2 * TCtens + Ws_V_ana[layer]);

-                #region dynamicPressure
+                WeatherCell wCellBuffer = PD.BufferMap[layer][cell];
+                wCellBuffer.windVector = new Vector3(Total_N[layer], wsV, Total_E[layer]);
+                PD.BufferMap[layer][cell] = wCellBuffer;
+            }
+            #endregion
+
+            //calc the vertical divergence
+            /*
+            float posFactor = 0;
+            for (int i = Divg.Length - 1; i >= 0; i--)
+            {
+                if (i >= Divg.Length / 2)
+                {
+                    posFactor += (i + 1 - Divg.Length / 2) * Divg[i];
+                }
+                else
+                {
+                    posFactor += (i - Divg.Length / 2) * Divg[i];
+                }
+            }
+            float ws_V_div = K_DIVG * posFactor;
+            */
+            #region dynamicPressure
+            for (int layer = 0; layer < layerCount; layer++)
+            {
+                WeatherCell wCellBuffer = PD.BufferMap[layer][cell];
+                float wsV = wCellBuffer.windVector.y;
                 float staticPressureChange = 0;
                 float dynPressureAbove = 0;
                 float dynPressureBelow = 0;
                 float dynPressureLayer = 0;

-                double DeltaDistance = WeatherFunctions.GetDistanceBetweenCells(PD.index, cell, cell.GetNeighbors(PD.gridLevel).First(), WeatherFunctions.GetCellAltitude(PD.index, layer, cell));
                 if(DeltaAltitude == 0 || double.IsNaN(DeltaAltitude))
                 {
                     KWSerror = true;
@@ -1135,14 +1140,16 @@
                     Logger("wsV went wrong" + " @ cell: " + cell.Index);
                 }
                 double TimeChargeV = Math.Sign(wsV)*(1.0 - Math.Exp(-Math.Abs(DeltaTime * wsV / DeltaAltitude)));  // needed to stabilize V_disp from variance in DeltaTime
-                double TimeChargeH = Math.Sign(wsDiv[layer])*(1.0 - Math.Exp((float)-Math.Abs(DeltaTime * wsDiv[layer] / DeltaDistance)));  // needed to stabilize H_disp from variance in DeltaTime
+                double TimeChargeH = Math.Sign(wsDiv[layer])*(1.0 - Math.Exp((float)-Math.Abs(DeltaTime * wsDiv[layer] / DeltaDistance_Avg)));  // needed to stabilize H_disp from variance in DeltaTime

                 dynPressure[layer] = (float)(0.5f * D_wet[layer] * -wsDiv[layer] * Math.Abs(wsDiv[layer])); // horizontal dynamicPressure
                 staticPressureChange = (float)(-TimeChargeH);  // static pressure change (%) due to horizontal flow

                 if (layer > 0)  // go with layer below
                 {
-                    dynPressureBelow = wsV>0 ? 0.5f * D_wet[layer-1] * wsV * wsV: 0;  //TODO: for even more accuracy, use average wsV with layer below
+                    float wsV_below = PD.BufferMap[layer - 1][cell].windVector.y;
+                    float wsV_avg = (wsV + wsV_below) / 2.0f;
+                    dynPressureBelow = wsV_avg>0 ? 0.5f * D_wet[layer - 1] * wsV_avg * wsV_avg : 0; // dynamic pressure due to wind with layer below
                     double D_variance = TimeChargeV < 0 ? 1.0f : (float)((D_wet[layer] + D_wet[layer - 1] * TimeChargeV) / D_wet[layer]);
                     if (D_variance < 0)
                     {
@@ -1158,7 +1165,9 @@
                 }
                 if (layer < layerCount-1)  // go with layer above
                 {
-                    dynPressureAbove = (wsV<0 ? (0.5f * D_wet[layer + 1] * wsV * wsV) : 0);  // dynamic pressure due to wind with layer above
+                    float wsV_above = PD.BufferMap[layer + 1][cell].windVector.y;
+                    float wsV_avg = (wsV + wsV_above) / 2.0f;
+                    dynPressureAbove = (wsV_avg<0 ? (0.5f * D_wet[layer + 1] * wsV_avg * wsV_avg) : 0);  // dynamic pressure due to wind with layer above
                     double D_variance = TimeChargeV > 0 ? 1.0f : (float)((D_wet[layer] - D_wet[layer + 1] * TimeChargeV) / D_wet[layer]);
                     if (D_variance < 0)
                     {
@@ -1192,7 +1201,7 @@
                 }
                 // go with this layer
                 dynPressureLayer = (wsV > 0 || layer > 0) ? (0.5f * D_wet[layer] * wsV * wsV) : 0;
-                staticPressureChange = (float)(wCellLive.pressure * (staticPressureChange - ((wsV > 0 || layer > 0) ? Math.Abs(TimeChargeV) : 0)) / DeltaTime);
+                staticPressureChange = (float)(PD.LiveMap[layer][cell].pressure * (staticPressureChange - ((wsV > 0 || layer > 0) ? Math.Abs(TimeChargeV) : 0)) / DeltaTime);
                 dynPressure[layer] += dynPressureAbove + dynPressureBelow - dynPressureLayer + staticPressureChange;
                 if (float.IsNaN(dynPressure[layer]))
                 {
@@ -1200,8 +1209,6 @@
                     Logger(" dynamicPressure went NaN" + " @ cell: " + cell.Index);
                 }

-                #endregion
-
                 //calc V_disp
                 float V_disp_limit = (float)(TimeChargeV / staticPressureChange * (wsV < 0 ? dynPressureAbove : dynPressureBelow));

@@ -1213,8 +1220,6 @@
                     Logger("V_disp is NaN" + " @ cell: " + cell.Index);
                 }

-                wCell.windVector = new Vector3(Total_N[layer], wsV, Total_E[layer]); //new Vector3(Total_N[layer], wsV, Total_E[layer]);
-                PD.BufferMap[layer][cell] = wCell;
             }
             #endregion


(#3733) Show relative path of addin assemblies that are being loaded

--- src/Cake.Core/Scripting/ScriptProcessor.cs
+++ src/Cake.Core/Scripting/ScriptProcessor.cs
@@ -112,7 +112,19 @@
                     // Reference found assemblies.
                     foreach (var assembly in assemblies)
                     {
-                        _log.Debug("The addin {0} will reference {1}.", addin.Package, assembly.Path.GetFilename());
+                        var assemblyPath = assembly.Path.MakeAbsolute(_environment);
+
+                        try
+                        {
+                            assemblyPath = _environment.WorkingDirectory.GetRelativePath(assemblyPath);
+                        }
+                        catch (InvalidOperationException)
+                        {
+                            // Paths must share a common prefix.
+                        }
+
+                        _log.Debug("The addin {0} will reference {1}.", addin.Package, assemblyPath);
+
                         result.Add(assembly.Path);
                     }
                 }


added [assembly: CLSCompliant(true)] review: Wojtek Chrobak

--- Objectivity.Test.Automation.Common/Properties/AssemblyInfo.cs
+++ Objectivity.Test.Automation.Common/Properties/AssemblyInfo.cs
@@ -22,6 +22,7 @@
 SOFTWARE.
 */

+using System;
 using System.Reflection;
 using System.Runtime.InteropServices;

@@ -36,6 +37,7 @@
 [assembly: AssemblyCopyright("Copyright ©  2015")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
+[assembly: CLSCompliant(true)]

 // Setting ComVisible to false makes the types in this assembly not visible
 // to COM components.  If you need to access a type in this assembly from


Fix for issue 2125

Fix for issue 2125

The GetPackagesPath function was incorrectly assuming that there would
be a repositoryPath element in the NuGet.config file.  This is not
necessarily true as it's a user controlled XML file.  It is also not
added in core scenarios where the user has only run a limited set of
NuGet.exe commands.  If the element wasn't there NuGet.exe would
terminate with a NullReferenceException

This fix addresse the problem by properly checking the XmlElement for
null.

--- src/CommandLine/Commands/ProjectFactory.cs
+++ src/CommandLine/Commands/ProjectFactory.cs
@@ -513,7 +513,13 @@
                 {
                     using (Stream stream = File.OpenRead(configPath))
                     {
-                        return XDocument.Load(stream).Root.Element("repositoryPath").Value;
+                        // It's possible for the repositoryPath element to be missing in older versions of
+                        // a NuGet.config file.
+                        var repositoryPathElement = XDocument.Load(stream).Root.Element("repositoryPath");
+                        if (repositoryPathElement != null)
+                        {
+                            return repositoryPathElement.Value;
+                        }
                     }
                 }
             }


Extracted the ContentEquals() method for better testability.

--- src/CommandLine/Commands/ProjectFactory.cs
+++ src/CommandLine/Commands/ProjectFactory.cs
@@ -675,12 +675,7 @@
                 if (targetFile != null)
                 {
                     // Compare contents as well
-                    bool isEqual;
-                    using (var dependencyFileStream = targetFile.GetStream())
-                    using (var fileContentsStream = File.Open(fullPath, FileMode.Open))
-                    {
-                        isEqual = dependencyFileStream.ContentEquals(fileContentsStream);
-                    }
+                    var isEqual = ContentEquals(targetFile, fullPath);
                     if (isEqual)
                     {
                         Logger.Log(MessageLevel.Info, NuGetResources.PackageCommandFileFromDependencyIsNotChanged, targetFilePath);
@@ -696,6 +691,17 @@
                     TargetPath = targetPath
                 });
             }
+        }
+
+        internal static bool ContentEquals(IPackageFile targetFile, string fullPath)
+        {
+            bool isEqual;
+            using (var dependencyFileStream = targetFile.GetStream())
+            using (var fileContentsStream = File.Open(fullPath, FileMode.Open))
+            {
+                isEqual = dependencyFileStream.ContentEquals(fileContentsStream);
+            }
+            return isEqual;
         }

         private string GetTargetPath(ProjectItem item)


[Blazor] Fixes reliability issues in the blazor reliability tests (#15223)

Some tests get stuck when run on the CI likely due to spikes on the CI machine load. This fix doubles the startup timeout of the reliability tests to account for that.

--- src/Components/Ignitor/src/BlazorClient.cs
+++ src/Components/Ignitor/src/BlazorClient.cs
@@ -31,7 +31,7 @@
             });
         }

-        public TimeSpan? DefaultConnectionTimeout { get; set; } = TimeSpan.FromSeconds(10);
+        public TimeSpan? DefaultConnectionTimeout { get; set; } = TimeSpan.FromSeconds(20);
         public TimeSpan? DefaultOperationTimeout { get; set; } = TimeSpan.FromMilliseconds(500);

         /// <summary>


fix Mailing \:

fix Mailing \:

--- Signum.Engine.Extensions/Mailing/EmailTemplateParser.Nodes.cs
+++ Signum.Engine.Extensions/Mailing/EmailTemplateParser.Nodes.cs
@@ -137,7 +137,8 @@
                 if (IsRaw)
                     sb.Append("raw");

-                ValueProvider.ToString(sb, variables, Format.HasText() ? (":" + Format) : null);
+                ValueProvider.ToString(sb, variables,
+                    Format.HasText() ? (":" + TemplateUtils.ScapeColon(Format)) : null);
             }

             public override void Synchronize(SyncronizationContext sc)


add ReplaceSmtpSetting method

add ReplaceSmtpSetting method

--- src/Core/XmlTransformDocumentExtensions.cs
+++ src/Core/XmlTransformDocumentExtensions.cs
@@ -190,6 +190,41 @@
             }
             attribute = document.CreateAttribute("Transform", ConfigurationTransformer.TransformNamespace);
             attribute.Value = "Insert";
+            smtpNode.Attributes.Append(attribute);
+        public static XmlDocument ReplaceSmtpSetting(this XmlDocument document, SmtpDeliveryFormat? smtpDeliveryFormat = null, SmtpDeliveryMethod? smtpDeliveryMethod = null, string from = null,
+            Action<SmtpBuilder> smtpBuilder = null)
+        {
+            var systemNet = document.DocumentElement.SelectSingleNode("system.net") ??
+                document.CreateNode(XmlNodeType.Element, "system.net", "");
+            var mailSettingsNode = systemNet.SelectSingleNode("mailSettings") ??
+                               document.CreateNode(XmlNodeType.Element, "mailSettings", "");
+            var smtpNode = mailSettingsNode.SelectSingleNode("smtp") ??
+                               document.CreateNode(XmlNodeType.Element, "smtp", "");
+
+            XmlAttribute attribute;
+            if (smtpDeliveryFormat != null)
+            {
+                attribute = document.CreateAttribute("smtpDeliveryFormat");
+                attribute.Value = smtpDeliveryFormat.ToString();
+                smtpNode.Attributes.Append(attribute);
+            }
+            if (smtpDeliveryMethod != null)
+            {
+                attribute = document.CreateAttribute("smtpDeliveryMethod");
+                attribute.Value = smtpDeliveryMethod.ToString();
+                smtpNode.Attributes.Append(attribute);
+            }
+            if (from != null)
+            {
+                attribute = document.CreateAttribute("from");
+                attribute.Value = from;
+                smtpNode.Attributes.Append(attribute);
+            }
+            attribute = document.CreateAttribute("Transform", ConfigurationTransformer.TransformNamespace);
+            attribute.Value = "Replace";
+            smtpNode.Attributes.Append(attribute);
+            attribute = document.CreateAttribute("Locator", ConfigurationTransformer.TransformNamespace);
+            attribute.Value = "Match(name)";
             smtpNode.Attributes.Append(attribute);

             if (smtpBuilder != null)


Update AvaloniaRenderer.cs

Update AvaloniaRenderer.cs

--- src/Core2D.UI/Renderer/AvaloniaRenderer.cs
+++ src/Core2D.UI/Renderer/AvaloniaRenderer.cs
@@ -536,7 +536,11 @@
     internal class TextDrawNode : DrawNode
     {
         public ITextShape Text { get; set; }
-        // TODO:
+        public A.Rect Rect { get; set; }
+        public A.Point Origin { get; set; }
+        public AM.Typeface Typeface { get; set; }
+        public AM.FormattedText FormattedText { get; set; }
+        public string BoundText { get; set; }

         public TextDrawNode(ITextShape text, IShapeStyle style)
         {
@@ -545,123 +549,88 @@
             UpdateGeometry();
         }

-        /*
-        private A.Point GetTextOrigin(IShapeStyle style, ref Rect2 rect, ref A.Size size)
-        {
-            var ox = style.TextStyle.TextHAlignment switch
-            {
-                TextHAlignment.Left => rect.X,
-                TextHAlignment.Right => rect.Right - size.Width,
-                _ => (rect.Left + rect.Width / 2.0) - (size.Width / 2.0),
+        public override void UpdateGeometry()
+        {
+            ScaleThickness = Text.State.Flags.HasFlag(ShapeStateFlags.Thickness);
+            ScaleSize = Text.State.Flags.HasFlag(ShapeStateFlags.Size);
+            var rect2 = Rect2.FromPoints(Text.TopLeft.X, Text.TopLeft.Y, Text.BottomRight.X, Text.BottomRight.Y, 0, 0);
+            Rect = new A.Rect(rect2.X, rect2.Y, rect2.Width, rect2.Height);
+            Center = Rect.Center;
+
+            BoundText = Text.GetProperty(nameof(ITextShape.Text)) is string boundText ? boundText : Text.Text;
+
+            if (BoundText == null)
+            {
+                return;
+            }
+
+            if (Style.TextStyle.FontSize < 0.0)
+            {
+                return;
+            }
+
+            var fontStyle = AM.FontStyle.Normal;
+            var fontWeight = AM.FontWeight.Normal;
+
+            if (Style.TextStyle.FontStyle.Flags.HasFlag(FontStyleFlags.Italic))
+            {
+                fontStyle |= AM.FontStyle.Italic;
+            }
+
+            if (Style.TextStyle.FontStyle.Flags.HasFlag(FontStyleFlags.Bold))
+            {
+                fontWeight |= AM.FontWeight.Bold;
+            }
+
+            // TODO: Cache Typeface
+            // TODO: Cache FormattedText
+
+            Typeface = new AM.Typeface(Style.TextStyle.FontName, fontWeight, fontStyle);
+
+            var textAlignment = Style.TextStyle.TextHAlignment switch
+            {
+                TextHAlignment.Right => AM.TextAlignment.Right,
+                TextHAlignment.Center => AM.TextAlignment.Center,
+                _ => AM.TextAlignment.Left,
             };
-            var oy = style.TextStyle.TextVAlignment switch
+
+            FormattedText = new AM.FormattedText()
+            {
+                Typeface = Typeface,
+                Text = BoundText,
+                TextAlignment = textAlignment,
+                TextWrapping = AM.TextWrapping.NoWrap,
+                FontSize = Style.TextStyle.FontSize,
+                Constraint = Rect.Size
+            };
+
+            var size = FormattedText.Bounds.Size;
+            var rect = Rect;
+
+            var originX = 0.0; // NOTE: Using AM.TextAlignment
+            //var originX = Style.TextStyle.TextHAlignment switch
+            //{
+            //    TextHAlignment.Left => rect.X,
+            //    TextHAlignment.Right => rect.Right - size.Width,
+            //    _ => (rect.Left + rect.Width / 2.0) - (size.Width / 2.0)
+            //};
+
+            var originY = Style.TextStyle.TextVAlignment switch
             {
                 TextVAlignment.Top => rect.Y,
                 TextVAlignment.Bottom => rect.Bottom - size.Height,
-                _ => (rect.Bottom - rect.Height / 2f) - (size.Height / 2f),
+                _ => (rect.Bottom - rect.Height / 2f) - (size.Height / 2f)
             };
-            return new A.Point(ox, oy);
-        }
-        */
-
-        public override void UpdateGeometry()
-        {
-            ScaleThickness = Text.State.Flags.HasFlag(ShapeStateFlags.Thickness);
-            ScaleSize = Text.State.Flags.HasFlag(ShapeStateFlags.Size);
-            // TODO:
-            // TODO: Center
+
+            Origin = new A.Point(originX, originY);
         }

         public override void OnDraw(AM.DrawingContext context, double dx, double dy, double zoom)
         {
-            // TODO:
-            /*
-            var _dc = dc as AM.DrawingContext;
-
-            var style = text.Style;
-            if (style == null)
-            {
-                return;
-            }
-
-            if (!(text.GetProperty(nameof(ITextShape.Text)) is string tbind))
-            {
-                tbind = text.Text;
-            }
-
-            if (tbind == null)
-            {
-                return;
-            }
-
-            var scaleThickness = text.State.Flags.HasFlag(ShapeStateFlags.Thickness);
-            var scaleSize = text.State.Flags.HasFlag(ShapeStateFlags.Size);
-            var rect = Rect2.FromPoints(text.TopLeft.X, text.TopLeft.Y, text.BottomRight.X, text.BottomRight.Y, dx, dy);
-
-            var scale = scaleSize ? 1.0 / _state.ZoomX : 1.0;
-            var scaleToPage = scale == 1.0 ? _scaleToPage : (value) => (float)(_scaleToPage(value) / scale);
-            var center = rect.Center;
-            var translateX = 0.0 - (center.X * scale) + center.X;
-            var translateY = 0.0 - (center.Y * scale) + center.Y;
-
-            GetCached(style, out _, out var stroke, scaleThickness);
-
-            var translateDisposable = scale != 1.0 ? _dc.PushPreTransform(AME.MatrixHelper.Translate(translateX, translateY)) : default(IDisposable);
-            var scaleDisposable = scale != 1.0 ? _dc.PushPreTransform(AME.MatrixHelper.Scale(scale, scale)) : default(IDisposable);
-
-            (string ct, var ft, var cs) = _textCache.Get(text);
-            if (string.Compare(ct, tbind) == 0 && cs == style)
-            {
-                var size = ft.Bounds.Size;
-                var origin = GetTextOrigin(style, ref rect, ref size);
-                _dc.DrawText(stroke.Brush, origin, ft);
-            }
-            else
-            {
-                var fontStyle = AM.FontStyle.Normal;
-                var fontWeight = AM.FontWeight.Normal;
-
-                if (style.TextStyle.FontStyle != null)
-                {
-                    if (style.TextStyle.FontStyle.Flags.HasFlag(FontStyleFlags.Italic))
-                    {
-                        fontStyle |= AM.FontStyle.Italic;
-                    }
-
-                    if (style.TextStyle.FontStyle.Flags.HasFlag(FontStyleFlags.Bold))
-                    {
-                        fontWeight |= AM.FontWeight.Bold;
-                    }
-                }
-
-                if (style.TextStyle.FontSize >= 0.0)
-                {
-                    var tf = new AM.Typeface(
-                        style.TextStyle.FontName,
-                        fontWeight,
-                        fontStyle);
-
-                    ft = new AM.FormattedText()
-                    {
-                        Typeface = tf,
-                        Text = tbind,
-                        TextAlignment = AM.TextAlignment.Left,
-                        TextWrapping = AM.TextWrapping.NoWrap,
-                        FontSize = style.TextStyle.FontSize * _textScaleFactor
-                    };
-
-                    var size = ft.Bounds.Size;
-                    var origin = GetTextOrigin(style, ref rect, ref size);
-
-                    _textCache.Set(text, (tbind, ft, style));
-
-                    _dc.DrawText(stroke.Brush, origin, ft);
-                }
-            }
-
-            scaleDisposable?.Dispose();
-            translateDisposable?.Dispose();
-            */
+            if (FormattedText != null)
+            {
+                context.DrawText(Stroke.Brush, Origin, FormattedText);
+            }
         }
     }

@@ -785,10 +754,8 @@
     {
         private readonly IServiceProvider _serviceProvider;
         private IShapeRendererState _state;
-        private readonly ICache<ITextShape, (string, AM.FormattedText, IShapeStyle)> _textCache;
         private readonly ICache<string, AMI.Bitmap> _biCache;
         private readonly ICache<object, DrawNode> _drawNodeCache;
-        private readonly double _textScaleFactor;

         /// <inheritdoc/>
         public IShapeRendererState State
@@ -801,15 +768,12 @@
         /// Initializes a new instance of the <see cref="AvaloniaRenderer"/> class.
         /// </summary>
         /// <param name="serviceProvider">The service provider.</param>
-        /// <param name="textScaleFactor">The text scale factor.</param>
-        public AvaloniaRenderer(IServiceProvider serviceProvider, double textScaleFactor = 1.0)
+        public AvaloniaRenderer(IServiceProvider serviceProvider)
         {
             _serviceProvider = serviceProvider;
             _state = _serviceProvider.GetService<IFactory>().CreateShapeRendererState();
-            _textCache = _serviceProvider.GetService<IFactory>().CreateCache<ITextShape, (string, AM.FormattedText, IShapeStyle)>();
             _biCache = _serviceProvider.GetService<IFactory>().CreateCache<string, AMI.Bitmap>(x => x.Dispose());
             _drawNodeCache = _serviceProvider.GetService<IFactory>().CreateCache<object, DrawNode>(x => x.Dispose());
-            _textScaleFactor = textScaleFactor;
             ClearCache(isZooming: false);
         }

@@ -836,7 +800,6 @@
         {
             if (!isZooming)
             {
-                _textCache.Reset();
                 // TODO: _biCache.Reset();
                 // TODO: _drawNodeCache.Reset();
             }


remove blocking socket property

remove blocking socket property

--- src/DotNetTor/SocksPort/SocksConnection.cs
+++ src/DotNetTor/SocksPort/SocksConnection.cs
@@ -45,10 +45,7 @@

 		private void ConnectSocket()
 		{
-			Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
-			{
-				Blocking = true
-			};
+			Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 			Socket.Connect(EndPoint);
 		}


Update AndreasBittner.cs

Update AndreasBittner.cs

Fix missing decimal points.

--- src/Firehose.Web/Authors/AndreasBittner.cs
+++ src/Firehose.Web/Authors/AndreasBittner.cs
@@ -16,9 +16,9 @@
         public string TwitterHandle => "Andreas_Bittner";
         public string GitHubHandle => "bobruhny";
         public string GravatarHash => "9e94e1e9014ad138df3f5281f814d755";
-        public GeoPosition Position => new GeoPosition(49,4833, 10,7167);
+        public GeoPosition Position => new GeoPosition(49.4833, 10.7167);
         public Uri WebSite => new Uri("http://joinpowershell.de/de/new/");
         public IEnumerable<Uri> FeedUris { get { yield return new Uri(""); } }

     }
-}+}


Add minPower to SelectDispel filter (#3470)

--- Source/ACE.Server/WorldObjects/Managers/EnchantmentManager.cs
+++ Source/ACE.Server/WorldObjects/Managers/EnchantmentManager.cs
@@ -532,7 +532,7 @@
             //var enchantments = GetEnchantments_TopLayer(WorldObject.Biota.GetEnchantments(WorldObject.BiotaDatabaseLock));
             var enchantments = WorldObject.Biota.PropertiesEnchantmentRegistry.Clone(WorldObject.BiotaDatabaseLock);

-            var filtered = enchantments.Where(e => e.PowerLevel <= maxPower);
+            var filtered = enchantments.Where(e => e.PowerLevel >= minPower && e.PowerLevel <= maxPower);

             // no dispel for enchantments from item sources (and vitae)
             filtered = filtered.Where(e => e.Duration != -1);


Done for the night...

Done for the night...

--- MvcReportViewer/ReportRunner.cs
+++ MvcReportViewer/ReportRunner.cs
@@ -288,7 +288,7 @@

         private void Validate()
         {
-            if (string.IsNullOrEmpty(_viewerParameters.ReportServerUrl))
+            if (_viewerParameters.ProcessingMode == ProcessingMode.Remote && string.IsNullOrEmpty(_viewerParameters.ReportServerUrl))
             {
                 throw new MvcReportViewerException("Report Server is not specified.");
             }


correct error when targetsite null

correct error when targetsite null

--- NLog.MongoDB/MongoTargetBase.cs
+++ NLog.MongoDB/MongoTargetBase.cs
@@ -21,7 +21,6 @@
             DatabaseName = "Logs";
             AppName = "Application";
             CollectionName = AppName + "Log";
-
         }

         public byte ExceptionRecursionLevel { get; set; }
@@ -99,11 +98,14 @@
             var doc = new BsonDocument();
             AddStringProperties(ex, doc);
             AddIntProperties(ex, doc);
-            doc.Add("TargetSite", ex.TargetSite.Name);
             doc.Add("exType", ex.GetType().FullName);
-            if (ex.TargetSite.DeclaringType != null)
+            if (ex.TargetSite != null)
             {
-                doc.Add("ClassName", ex.TargetSite.DeclaringType.FullName);
+                doc.Add("TargetSite", ex.TargetSite.Name);
+                if (ex.TargetSite.DeclaringType != null)
+                {
+                    doc.Add("ClassName", ex.TargetSite.DeclaringType.FullName);
+                }
             }
             if (ex.InnerException != null && level > 0)
             {


Updated due to latest VS2019 preview

Updated due to latest VS2019 preview

--- Source/Csla.Validation.Android/Resources/Resource.Designer.cs
+++ Source/Csla.Validation.Android/Resources/Resource.Designer.cs
@@ -2,7 +2,6 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -15,7 +14,7 @@
 {

-	[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
 	public partial class Resource
 	{


Improve viewbox hit test on the pie

Improve viewbox hit test on the pie

--- Source/HelixToolkit.SharpDX.Shared/Model/Scene/ViewBoxNode.cs
+++ Source/HelixToolkit.SharpDX.Shared/Model/Scene/ViewBoxNode.cs
@@ -115,7 +115,7 @@
             {
                 return upDirection;
             }
-        }
+        }
         #endregion

         #region Fields
@@ -179,7 +179,7 @@
         public ViewBoxNode()
         {
             RelativeScreenLocationX = 0.8f;
-            ViewBoxMeshModel = new MeshNode() { EnableViewFrustumCheck = false };
+            ViewBoxMeshModel = new MeshNode() { EnableViewFrustumCheck = false, CullMode = CullMode.Back };
             ViewBoxMeshModel.RenderCore.RenderType = RenderType.ScreenSpaced;
             var sampler = DefaultSamplers.LinearSamplerWrapAni1;
             sampler.BorderColor = Color.Gray;
@@ -244,7 +244,7 @@
             {
                 isRightHanded = e;
                 UpdateModel(UpDirection);
-            }
+            }
         }

         private void UpdateTexture(Stream texture)
@@ -288,7 +288,15 @@
             builder.AddTriangleStrip(pts);
             var pie = builder.ToMesh();
             int count = pie.Indices.Count;
-
+            for (int i = 0; i < count;)
+            {
+                var v1 = pie.Indices[i++];
+                var v2 = pie.Indices[i++];
+                var v3 = pie.Indices[i++];
+                pie.Indices.Add(v1);
+                pie.Indices.Add(v3);
+                pie.Indices.Add(v2);
+            }
             var newMesh = MeshGeometry3D.Merge(new MeshGeometry3D[] { pie, mesh });

             if (!isRightHanded)
@@ -313,11 +321,11 @@
             int faces = 6;
             int segment = 4;
             float inc = 1f / faces;
-
+
             for (int i = 0; i < mesh.TextureCoordinates.Count; ++i)
             {
                 mesh.TextureCoordinates[i] = new Vector2(mesh.TextureCoordinates[i].X * inc + inc * (int)(i / segment), mesh.TextureCoordinates[i].Y);
-            }
+            }
         }

         protected override bool CanHitTest(RenderContext context)
@@ -382,6 +390,11 @@
                 if (hit.ModelHit == ViewBoxMeshModel)
                 {
                     normal = -hit.NormalAtHit * inv;
+                    //Fix the normal if returned normal is reversed
+                    if(Vector3.Dot(normal, context.Camera.LookDirection) < 0)
+                    {
+                        normal *= -1;
+                    }
                 }
                 else if (hit.Tag is int)
                 {


Cloud: fixing bug where external diagnostics sources (with non-default contexts) have not always been captured

--- Source/Lokad.Cloud.Framework/Diagnostics/DiagnosticsModule.cs
+++ Source/Lokad.Cloud.Framework/Diagnostics/DiagnosticsModule.cs
@@ -24,7 +24,9 @@
 			// Cloud Monitoring
 			builder.Register<BlobDiagnosticsRepository>().As<ICloudDiagnosticsRepository>();
 			builder.Register<ServiceMonitor>().As<IServiceMonitor>();
-			builder.Register<DiagnosticsAcquisition>();
+			builder.Register<DiagnosticsAcquisition>()
+				.OnActivating(ActivatingHandler.InjectUnsetProperties)
+				.FactoryScoped();
 		}
 	}
 }


- Fixed typos

- Fixed typos

--- Source/Mosa.Compiler.Framework/Stages/ConvertCompoundStage.cs
+++ Source/Mosa.Compiler.Framework/Stages/ConvertCompoundStage.cs
@@ -11,7 +11,7 @@
 using System.Collections.Generic;

 // FIXME: This stage depends on Node.Next & Node.Previous properties but the compiler may insert empty nodes.
-// Rewrite not to depend on those properities.
+// Rewrite not to depend on those properties.

 namespace Mosa.Compiler.Framework.Stages
 {
@@ -78,7 +78,7 @@
 					while (nextNode.IsEmpty)
 						nextNode = nextNode.Next;

-					// If this move is preceded by a return then remove this instruction
+					// If this move is proceeded by a return then remove this instruction
 					// It is basically a double up caused by some instructions result in the same instruction output
 					if (nextNode.Instruction == IRInstruction.Return && nextNode.Operand1 == node.Result)
 					{
@@ -88,7 +88,7 @@
 						return;
 					}

-					// If this move is preceded by a compound move (which will turn into a compound move) remove this instruction
+					// If this move is proceeded by a compound move (which will turn into a compound move) remove this instruction
 					// It is basically a double up caused by some instructions result in the same IR output
 					if ((prevNode.Instruction == IRInstruction.CompoundMove
 							|| prevNode.Instruction == IRInstruction.CompoundLoad


bring window to front when opening a file

--- OpenCNCPilot/MainWindow.xaml.cs
+++ OpenCNCPilot/MainWindow.xaml.cs
@@ -412,6 +412,7 @@
 				string _strMsg = Marshal.PtrToStringUni(_dataStruct.lpData, _dataStruct.cbData / 2);
 				if (File.Exists(_strMsg))
 				{
+					Activate();
 					openFileDialogGCode.FileName = _strMsg;
 					OpenFileDialogGCode_FileOk(null, null);
 				}


Add one more check for key presence

Add one more check for key presence

--- OpenSim/Framework/PacketPool.cs
+++ OpenSim/Framework/PacketPool.cs
@@ -142,7 +142,7 @@
                     {
                         PacketType type = packet.Type;

-                        if (pool[type] == null)
+                        if (!pool.ContainsKey(type))
                         {
                             pool[type] = new Stack<Packet>();
                         }


ready to pack 1.4

ready to pack 1.4

Signed-off-by: Emmanuel Mathot <367ff60fe70ac02365998fe620af37ff67ae3274@gmail.com>

--- Terradue.Metadata.EarthObservation/Properties/AssemblyInfo.cs
+++ Terradue.Metadata.EarthObservation/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
 @{
     Terradue .Net C# library implementing the Earth Observation Metadata profile of Observations & Measurements

-    \xrefitem sw_version "Versions" "Software Package Version" 1.3.15
+    \xrefitem sw_version "Versions" "Software Package Version" 1.4

     \xrefitem sw_link "Link" "Software Package Link" [DotNetEarthObservation](https://github.com/Terradue/DotNetEarthObservation)

@@ -38,8 +38,8 @@
 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("1.3.15.*")]
-[assembly: AssemblyInformationalVersion("1.3.15")]
+[assembly: AssemblyVersion("1.4.1.*")]
+[assembly: AssemblyInformationalVersion("1.4")]
 [assembly: AssemblyAuthors("Emmanuel Mathot")]
 [assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetEarthObservation")]
 [assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetEarthObservation/blob/master/LICENSE")]


ready to pack 1.5.6

ready to pack 1.5.6

Signed-off-by: Emmanuel Mathot <367ff60fe70ac02365998fe620af37ff67ae3274@terradue.com>

--- Terradue.Metadata.EarthObservation/Properties/AssemblyInfo.cs
+++ Terradue.Metadata.EarthObservation/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
 @{
     Terradue .Net C# library implementing the Earth Observation Metadata profile of Observations & Measurements

-    \xrefitem sw_version "Versions" "Software Package Version" 1.5.1
+    \xrefitem sw_version "Versions" "Software Package Version" 1.5.6

     \xrefitem sw_link "Link" "Software Package Link" [DotNetEarthObservation](https://github.com/Terradue/DotNetEarthObservation)

@@ -38,8 +38,8 @@
 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("1.5.5.*")]
-[assembly: AssemblyInformationalVersion("1.5.5")]
+[assembly: AssemblyVersion("1.5.6.*")]
+[assembly: AssemblyInformationalVersion("1.5.6")]
 [assembly: AssemblyAuthors("Emmanuel Mathot")]
 [assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetEarthObservation")]
 [assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetEarthObservation/blob/master/LICENSE")]


Fixed PersonVerbEndingTests.cs. Note there are spacing fixes needed here.

--- src/MSG.UnitTests/PersonVerbEndingTests.cs
+++ src/MSG.UnitTests/PersonVerbEndingTests.cs
@@ -24,8 +24,7 @@
         [Test]
         public void VerifyPersonVerbAndComplementStreamline()
         {
-            // Insert 1 at position 6.
-            _defaults.Insert(6, 1);
+            _defaults.Insert(5, 1);
             MoqUtil.SetupRandMock(_defaults.ToArray());

             string output = DomainFactory.Generator.GetSentences(1)[0];
@@ -36,7 +35,7 @@
         [Test]
         public void VerifyPersonVerbAndComplementOverarching()
         {
-            _defaults.Insert(6, 2);
+            _defaults.Insert(5, 2);
             MoqUtil.SetupRandMock(_defaults.ToArray());

             string output = DomainFactory.Generator.GetSentences(1)[0];
@@ -47,7 +46,7 @@
         [Test]
         public void VerifyPersonVerbAndComplementValueChain()
         {
-            _defaults.Insert(6, 10);
+            _defaults.Insert(5, 10);
             MoqUtil.SetupRandMock(_defaults.ToArray());

             string output = DomainFactory.Generator.GetSentences(1)[0];
@@ -58,8 +57,8 @@
         [Test]
         public void VerifyBadThingIdentify()
         {
-            _defaults.ReplaceAt(5, 11);
-            _defaults.ReplaceAt(6, 2);
+            _defaults.ReplaceAt(4, 11);
+            _defaults.ReplaceAt(5, 2);

             MoqUtil.SetupRandMock(_defaults.ToArray());

@@ -71,8 +70,8 @@
         [Test]
         public void VerifyBadThingMitigate()
         {
-            _defaults.ReplaceAt(5, 11);
-            _defaults.ReplaceAt(6, 4);
+            _defaults.ReplaceAt(4, 11);
+            _defaults.ReplaceAt(5, 4);

             MoqUtil.SetupRandMock(_defaults.ToArray());

@@ -84,9 +83,9 @@
         [Test]
         public void VerifyRandomArticleThe()
         {
-            _defaults.ReplaceAt(5, 11);
-            _defaults.ReplaceAt(6, 4);
-            _defaults.ReplaceAt(9, 2);
+            _defaults.ReplaceAt(4, 11);
+            _defaults.ReplaceAt(5, 4);
+            _defaults.ReplaceAt(8, 2);

             MoqUtil.SetupRandMock(_defaults.ToArray());

@@ -98,24 +97,9 @@
         [Test]
         public void VerifyRandomArticleOur()
         {
-            // Within the industry
-            //_defaults.Insert(9, 2);
-            //_defaults.RemoveAt(10);
-
-            // going forward
-            //_defaults.Insert(8, 2);
-            //_defaults.RemoveAt(9);
-
-            // intricacies
-            //_defaults.Insert(7, 2);
-            //_defaults.RemoveAt(8);
-
-            //_defaults.Insert(5, 2);
-            //_defaults.RemoveAt(6);
-
-            _defaults.ReplaceAt(5, 11);
-            _defaults.ReplaceAt(6, 4);
-            _defaults.ReplaceAt(8, 3);
+            _defaults.ReplaceAt(4, 11);
+            _defaults.ReplaceAt(5, 4);
+            _defaults.ReplaceAt(7, 3);

             MoqUtil.SetupRandMock(_defaults.ToArray());

@@ -127,11 +111,10 @@
         [Test]
         public void VerifyGetPersonVerbAndEndingThirdBranch()
         {
-            _defaults.ReplaceAt(5, 17);
-            _defaults.ReplaceAt(6, 4);
-            _defaults.ReplaceAt(8, 3);
+            _defaults.ReplaceAt(4, 17);
+            _defaults.ReplaceAt(5, 4);
+            _defaults.ReplaceAt(7, 3);

-            _defaults.Add(2);
             _defaults.Add(2);
             _defaults.Add(3);
             MoqUtil.SetupRandMock(_defaults.ToArray());


Corrected relative path in transportOrderDetail view

--- Web/Areas/Procurement/Views/TransportOrder/OrderDetail.cshtml
+++ Web/Areas/Procurement/Views/TransportOrder/OrderDetail.cshtml
@@ -390,7 +390,7 @@
             $("#modalWindow").html("");
             $(".transChange").hide();
             $('#ContractHeader').addClass('cats_error');
-            $("#statusWindow").html('FAILED CONTRACT: Click Here to navigate to the new substitute contracts.');
+            $("#statusWindow").html('FAILED CONTRACT: Click Here  to navigate to the new substitute contracts.');
             wnd.center().close();
             //window.location.replace("/Procurement/TransportOrder/Index");
         }


don't format empty lines on enter

don't format empty lines on enter

--- src/OmniSharp/Workers/Format/Formatting.cs
+++ src/OmniSharp/Workers/Format/Formatting.cs
@@ -43,7 +43,10 @@
                 // format previous line on new line
                 var lines = (await document.GetTextAsync()).Lines;
                 var targetLine = lines[lines.GetLineFromPosition(position).LineNumber - 1];
-                return await GetFormattingChangesForRange(workspace, options, document, targetLine.Start, targetLine.End);
+                if(!string.IsNullOrWhiteSpace(targetLine.Text.ToString(targetLine.Span)))
+                {
+                    return await GetFormattingChangesForRange(workspace, options, document, targetLine.Start, targetLine.End);
+                }
             }
             else if(character == '}' || character == ';')
             {


Fixing syntax errors in WebRTCAudioDevice.cs

--- WebRtc.Mono.Droid/Org/Webrtc/Voiceengine/WebRTCAudioDevice.cs
+++ WebRtc.Mono.Droid/Org/Webrtc/Voiceengine/WebRTCAudioDevice.cs
@@ -1,6 +1,4 @@
-using System;
-
-/*
+/*
  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
@@ -9,18 +7,18 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
-
-namespace org.webrtc.voiceengine
+using System;
+using Android.Content;
+using Android.Media;
+using Android.OS;
+using Android.Util;
+using Java.Lang;
+using Java.Nio;
+using Java.Util.Concurrent.Locks;
+using Exception = System.Exception;
+
+namespace WebRtc.Org.Webrtc.Voiceengine
 {
-
-
-	using Context = android.content.Context;
-	using AudioFormat = android.media.AudioFormat;
-	using AudioManager = android.media.AudioManager;
-	using AudioRecord = android.media.AudioRecord;
-	using AudioTrack = android.media.AudioTrack;
-	using Log = android.util.Log;
-
 	internal class WebRTCAudioDevice
 	{
 		private AudioTrack _audioTrack = null;
@@ -31,8 +29,8 @@

 		private ByteBuffer _playBuffer;
 		private ByteBuffer _recBuffer;
-		private sbyte[] _tempBufPlay;
-		private sbyte[] _tempBufRec;
+		private byte[] _tempBufPlay;
+		private byte[] _tempBufRec;

 		private readonly ReentrantLock _playLock = new ReentrantLock();
 		private readonly ReentrantLock _recLock = new ReentrantLock();
@@ -50,9 +48,9 @@
 		{
 			try
 			{
-				_playBuffer = ByteBuffer.allocateDirect(2 * 480); // Max 10 ms @ 48
+				_playBuffer = ByteBuffer.AllocateDirect(2 * 480); // Max 10 ms @ 48
 																  // kHz
-				_recBuffer = ByteBuffer.allocateDirect(2 * 480); // Max 10 ms @ 48
+				_recBuffer = ByteBuffer.AllocateDirect(2 * 480); // Max 10 ms @ 48
 																 // kHz
 			}
 			catch (Exception e)
@@ -60,16 +58,14 @@
 				DoLog(e.Message);
 			}

-			_tempBufPlay = new sbyte[2 * 480];
-			_tempBufRec = new sbyte[2 * 480];
-		}
-
-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int InitRecording(int audioSource, int sampleRate)
-		private int InitRecording(int audioSource, int sampleRate)
+			_tempBufPlay = new byte[2 * 480];
+			_tempBufRec = new byte[2 * 480];
+		}
+
+		private int InitRecording(AudioSource audioSource, int sampleRate)
 		{
 			// get the minimum buffer size that can be used
-			int minRecBufSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
+			int minRecBufSize = AudioRecord.GetMinBufferSize(sampleRate, ChannelIn.Mono, Encoding.Pcm16bit);

 			// DoLog("min rec buf size is " + minRecBufSize);

@@ -81,13 +77,13 @@
 			// release the object
 			if (_audioRecord != null)
 			{
-				_audioRecord.release();
+				_audioRecord.Release();
 				_audioRecord = null;
 			}

 			try
 			{
-				_audioRecord = new AudioRecord(audioSource, sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, recBufSize);
+				_audioRecord = new AudioRecord(audioSource, sampleRate, ChannelIn.Mono, Encoding.Pcm16bit, recBufSize);

 			}
 			catch (Exception e)
@@ -97,7 +93,7 @@
 			}

 			// check that the audioRecord is ready to be used
-			if (_audioRecord.State != AudioRecord.STATE_INITIALIZED)
+			if (_audioRecord.State != State.Initialized)
 			{
 				// DoLog("rec not initialized " + sampleRate);
 				return -1;
@@ -108,8 +104,6 @@
 			return _bufferedRecSamples;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int StartRecording()
 		private int StartRecording()
 		{
 			if (_isPlaying == false)
@@ -120,7 +114,7 @@
 			// start recording
 			try
 			{
-				_audioRecord.startRecording();
+				_audioRecord.StartRecording();

 			}
 			catch (IllegalStateException e)
@@ -134,12 +128,10 @@
 			return 0;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int InitPlayback(int sampleRate)
 		private int InitPlayback(int sampleRate)
 		{
 			// get the minimum buffer size that can be used
-			int minPlayBufSize = AudioTrack.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT);
+			int minPlayBufSize = AudioTrack.GetMinBufferSize(sampleRate, ChannelOut.Mono, Encoding.Pcm16bit);

 			// DoLog("min play buf size is " + minPlayBufSize);

@@ -154,13 +146,13 @@
 			// release the object
 			if (_audioTrack != null)
 			{
-				_audioTrack.release();
+				_audioTrack.Release();
 				_audioTrack = null;
 			}

 			try
 			{
-				_audioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, sampleRate, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, playBufSize, AudioTrack.MODE_STREAM);
+				_audioTrack = new AudioTrack(Stream.VoiceCall, sampleRate, ChannelConfiguration.Mono, Encoding.Pcm16bit, playBufSize, AudioTrackMode.Stream);
 			}
 			catch (Exception e)
 			{
@@ -169,7 +161,7 @@
 			}

 			// check that the audioRecord is ready to be used
-			if (_audioTrack.State != AudioTrack.STATE_INITIALIZED)
+			if (_audioTrack.State != AudioTrackState.Initialized)
 			{
 				// DoLog("play not initialized " + sampleRate);
 				return -1;
@@ -179,7 +171,7 @@

 			if (_audioManager == null && _context != null)
 			{
-				_audioManager = (AudioManager) _context.getSystemService(Context.AUDIO_SERVICE);
+				_audioManager = (AudioManager) _context.GetSystemService(Context.AudioService);
 			}

 			// Return max playout volume
@@ -189,11 +181,9 @@
 				// so we should not return error.
 				return 0;
 			}
-			return _audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);
-		}
-
-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int StartPlayback()
+			return _audioManager.GetStreamMaxVolume(Stream.VoiceCall);
+		}
+
 		private int StartPlayback()
 		{
 			if (_isRecording == false)
@@ -204,7 +194,7 @@
 			// start playout
 			try
 			{
-				_audioTrack.play();
+				_audioTrack.Play();

 			}
 			catch (IllegalStateException e)
@@ -218,20 +208,18 @@
 			return 0;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int StopRecording()
 		private int StopRecording()
 		{
-			_recLock.@lock();
+			_recLock.Lock();
 			try
 			{
 				// only stop if we are recording
-				if (_audioRecord.RecordingState == AudioRecord.RECORDSTATE_RECORDING)
+				if (_audioRecord.RecordingState == RecordState.Recording)
 				{
 					// stop recording
 					try
 					{
-						_audioRecord.stop();
+						_audioRecord.Stop();
 					}
 					catch (IllegalStateException e)
 					{
@@ -242,7 +230,7 @@
 				}

 				// release the object
-				_audioRecord.release();
+				_audioRecord.Release();
 				_audioRecord = null;

 			}
@@ -251,7 +239,7 @@
 				// Ensure we always unlock, both for success, exception or error
 				// return.
 				_doRecInit = true;
-				_recLock.unlock();
+				_recLock.Unlock();
 			}

 			if (_isPlaying == false)
@@ -263,20 +251,18 @@
 			return 0;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int StopPlayback()
 		private int StopPlayback()
 		{
-			_playLock.@lock();
+			_playLock.Lock();
 			try
 			{
 				// only stop if we are playing
-				if (_audioTrack.PlayState == AudioTrack.PLAYSTATE_PLAYING)
+				if (_audioTrack.PlayState == PlayState.Playing)
 				{
 					// stop playout
 					try
 					{
-						_audioTrack.stop();
+						_audioTrack.Stop();
 					}
 					catch (IllegalStateException e)
 					{
@@ -286,11 +272,11 @@
 					}

 					// flush the buffers
-					_audioTrack.flush();
+					_audioTrack.Flush();
 				}

 				// release the object
-				_audioTrack.release();
+				_audioTrack.Release();
 				_audioTrack = null;

 			}
@@ -299,7 +285,7 @@
 				// Ensure we always unlock, both for success, exception or error
 				// return.
 				_doPlayInit = true;
-				_playLock.unlock();
+				_playLock.Unlock();
 			}

 			if (_isRecording == false)
@@ -311,14 +297,12 @@
 			return 0;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int PlayAudio(int lengthInBytes)
 		private int PlayAudio(int lengthInBytes)
 		{

 			int bufferedSamples = 0;

-			_playLock.@lock();
+			_playLock.Lock();
 			try
 			{
 				if (_audioTrack == null)
@@ -332,7 +316,7 @@
 				{
 					try
 					{
-						android.os.Process.ThreadPriority = android.os.Process.THREAD_PRIORITY_URGENT_AUDIO;
+						Android.OS.Process.SetThreadPriority(ThreadPriority.UrgentAudio);
 					}
 					catch (Exception e)
 					{
@@ -342,9 +326,9 @@
 				}

 				int written = 0;
-				_playBuffer.get(_tempBufPlay);
-				written = _audioTrack.write(_tempBufPlay, 0, lengthInBytes);
-				_playBuffer.rewind(); // Reset the position to start of buffer
+				_playBuffer.Get(_tempBufPlay);
+				written = _audioTrack.Write(_tempBufPlay, 0, lengthInBytes);
+				_playBuffer.Rewind(); // Reset the position to start of buffer

 				// DoLog("Wrote data to sndCard");

@@ -377,17 +361,15 @@
 			{
 				// Ensure we always unlock, both for success, exception or error
 				// return.
-				_playLock.unlock();
+				_playLock.Unlock();
 			}

 			return bufferedSamples;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int RecordAudio(int lengthInBytes)
 		private int RecordAudio(int lengthInBytes)
 		{
-			_recLock.@lock();
+			_recLock.Lock();

 			try
 			{
@@ -398,11 +380,11 @@
 				}

 				// Set priority, only do once
-				if (_doRecInit == true)
+				if (_doRecInit)
 				{
 					try
 					{
-						android.os.Process.ThreadPriority = android.os.Process.THREAD_PRIORITY_URGENT_AUDIO;
+						Android.OS.Process.SetThreadPriority(ThreadPriority.UrgentAudio);
 					}
 					catch (Exception e)
 					{
@@ -412,10 +394,10 @@
 				}

 				int readBytes = 0;
-				_recBuffer.rewind(); // Reset the position to start of buffer
-				readBytes = _audioRecord.read(_tempBufRec, 0, lengthInBytes);
+				_recBuffer.Rewind(); // Reset the position to start of buffer
+				readBytes = _audioRecord.Read(_tempBufRec, 0, lengthInBytes);
 				// DoLog("read " + readBytes + "from SC");
-				_recBuffer.put(_tempBufRec);
+				_recBuffer.Put(_tempBufRec);

 				if (readBytes != lengthInBytes)
 				{
@@ -434,20 +416,18 @@
 			{
 				// Ensure we always unlock, both for success, exception or error
 				// return.
-				_recLock.unlock();
+				_recLock.Unlock();
 			}

 			return (_bufferedPlaySamples);
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int SetPlayoutSpeaker(boolean loudspeakerOn)
 		private int SetPlayoutSpeaker(bool loudspeakerOn)
 		{
 			// create audio manager if needed
 			if (_audioManager == null && _context != null)
 			{
-				_audioManager = (AudioManager) _context.getSystemService(Context.AUDIO_SERVICE);
+				_audioManager = (AudioManager) _context.GetSystemService(Context.AudioService);
 			}

 			if (_audioManager == null)
@@ -456,39 +436,39 @@
 				return -1;
 			}

-			int apiLevel = android.os.Build.VERSION.SDK_INT;
-
-			if ((3 == apiLevel) || (4 == apiLevel))
+			var apiLevel = Build.VERSION.SdkInt;
+
+			if ((BuildVersionCodes.Cupcake == apiLevel) || (BuildVersionCodes.Donut == apiLevel))
 			{
 				// 1.5 and 1.6 devices
 				if (loudspeakerOn)
 				{
 					// route audio to back speaker
-					_audioManager.Mode = AudioManager.MODE_NORMAL;
+					_audioManager.Mode = Mode.Normal;
 				}
 				else
 				{
 					// route audio to earpiece
-					_audioManager.Mode = AudioManager.MODE_IN_CALL;
+					_audioManager.Mode = Mode.InCall;
 				}
 			}
 			else
 			{
 				// 2.x devices
-				if ((android.os.Build.BRAND.Equals("Samsung") || android.os.Build.BRAND.Equals("samsung")) && ((5 == apiLevel) || (6 == apiLevel) || (7 == apiLevel)))
+				if ((Build.Brand.Equals("Samsung") || Build.Brand.Equals("samsung")) && ((BuildVersionCodes.Eclair == apiLevel) || (BuildVersionCodes.Eclair01 == apiLevel) || (BuildVersionCodes.EclairMr1 == apiLevel)))
 				{
 					// Samsung 2.0, 2.0.1 and 2.1 devices
 					if (loudspeakerOn)
 					{
 						// route audio to back speaker
-						_audioManager.Mode = AudioManager.MODE_IN_CALL;
+						_audioManager.Mode = Mode.InCall;
 						_audioManager.SpeakerphoneOn = loudspeakerOn;
 					}
 					else
 					{
 						// route audio to earpiece
 						_audioManager.SpeakerphoneOn = loudspeakerOn;
-						_audioManager.Mode = AudioManager.MODE_NORMAL;
+						_audioManager.Mode = Mode.Normal;
 					}
 				}
 				else
@@ -501,44 +481,40 @@
 			return 0;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int SetPlayoutVolume(int level)
 		private int SetPlayoutVolume(int level)
 		{

 			// create audio manager if needed
 			if (_audioManager == null && _context != null)
 			{
-				_audioManager = (AudioManager) _context.getSystemService(Context.AUDIO_SERVICE);
+				_audioManager = (AudioManager) _context.GetSystemService(Context.AudioService);
 			}

 			int retVal = -1;

 			if (_audioManager != null)
 			{
-				_audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, level, 0);
+				_audioManager.SetStreamVolume(Stream.VoiceCall, level, 0);
 				retVal = 0;
 			}

 			return retVal;
 		}

-//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
-//ORIGINAL LINE: @SuppressWarnings("unused") private int GetPlayoutVolume()
 		private int GetPlayoutVolume()
 		{

 			// create audio manager if needed
 			if (_audioManager == null && _context != null)
 			{
-				_audioManager = (AudioManager) _context.getSystemService(Context.AUDIO_SERVICE);
+				_audioManager = (AudioManager) _context.GetSystemService(Context.AudioService);
 			}

 			int level = -1;

 			if (_audioManager != null)
 			{
-				level = _audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
+				level = _audioManager.GetStreamVolume(Stream.VoiceCall);
 			}

 			return level;
@@ -546,11 +522,11 @@

 		private void SetAudioMode(bool startCall)
 		{
-			int apiLevel = android.os.Build.VERSION.SDK_INT;
+			var apiLevel = Build.VERSION.SdkInt;

 			if (_audioManager == null && _context != null)
 			{
-				_audioManager = (AudioManager) _context.getSystemService(Context.AUDIO_SERVICE);
+				_audioManager = (AudioManager) _context.GetSystemService(Context.AudioService);
 			}

 			if (_audioManager == null)
@@ -562,11 +538,11 @@
 			// ***IMPORTANT*** When the API level for honeycomb (H) has been
 			// decided,
 			// the condition should be changed to include API level 8 to H-1.
-			if ((android.os.Build.BRAND.Equals("Samsung") || android.os.Build.BRAND.Equals("samsung")) && (8 == apiLevel))
+			if ((Build.Brand.Equals("Samsung") || Build.Brand.Equals("samsung")) && (BuildVersionCodes.Froyo == apiLevel))
 			{
 				// Set Samsung specific VoIP mode for 2.2 devices
 				// 4 is VoIP mode
-				int mode = (startCall ? 4 : AudioManager.MODE_NORMAL);
+				var mode = (startCall ? Mode.InCall : Mode.Normal);
 				_audioManager.Mode = mode;
 				if (_audioManager.Mode != mode)
 				{
@@ -579,12 +555,12 @@

 		private void DoLog(string msg)
 		{
-			Log.d(logTag, msg);
+			Log.Debug(logTag, msg);
 		}

 		private void DoLogErr(string msg)
 		{
-			Log.e(logTag, msg);
+			Log.Error(logTag, msg);
 		}
 	}


[A]Fix potential crash when calling ClearFocus in SearchBarRenderer

--- Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs
+++ Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs
@@ -33,7 +33,7 @@
 		bool SearchView.IOnQueryTextListener.OnQueryTextSubmit(string query)
 		{
 			((ISearchBarController)Element).OnSearchButtonPressed();
-			Control.ClearFocus();
+			ClearFocus(Control);
 			return true;
 		}

@@ -67,7 +67,7 @@
 				_inputType = InputTypes.ClassText | InputTypes.TextFlagAutoComplete | InputTypes.TextFlagNoSuggestions;
 			}

-			searchView.ClearFocus();
+			ClearFocus(searchView);
 			UpdatePlaceholder();
 			UpdateText();
 			UpdateEnabled();
@@ -113,7 +113,7 @@
 		internal override void OnNativeFocusChanged(bool hasFocus)
 		{
 			if (hasFocus && !Element.IsEnabled)
-				Control.ClearFocus();
+				ClearFocus(Control);
 		}

 		void UpdateAlignment()
@@ -148,12 +148,24 @@
 			SearchView control = Control;
 			if (!model.IsEnabled)
 			{
-				control.ClearFocus();
+				ClearFocus(control);
 				// removes cursor in SearchView
 				control.SetInputType(InputTypes.Null);
 			}
 			else
 				control.SetInputType(_inputType);
+		}
+
+		void ClearFocus(SearchView view)
+		{
+			try
+			{
+				view.ClearFocus();
+			}
+			catch (Java.Lang.UnsupportedOperationException)
+			{
+				// silently catch these as they happen in the previewer due to some bugs in upstread android
+			}
 		}

 		void UpdateFont()


Adding common call to check if server URL and appKey are correct.

--- countlyCommon/countlyCommon/CountlyBase.cs
+++ countlyCommon/countlyCommon/CountlyBase.cs
@@ -649,6 +649,23 @@
             return await Countly.Instance.DeviceData.GetDeviceId();
         }

+        protected bool IsServerURLCorrect(String url)
+        {
+            if (String.IsNullOrEmpty(url))//todo, in future replace with "String.IsNullOrWhiteSpace"
+            {
+                return false;
+            }
+            return true;
+        }
+
+        protected bool IsAppKeyCorrect(String appKey)
+        {
+            if (String.IsNullOrEmpty(appKey))//todo, in future replace with "String.IsNullOrWhiteSpace"
+            {
+                return false;
+            }
+            return true;
+        }

         protected abstract void SessionTimerStart();
         protected abstract void SessionTimerStop();


Added test method for copy constructor.

Added test method for copy constructor.

--- Tests/ImageStack8Tests.cs
+++ Tests/ImageStack8Tests.cs
@@ -85,5 +85,19 @@
             }
             ims.Dispose();
         }
+
+        [TestMethod]
+        public void CopyConstructor_Correct()
+        {
+            var ims = new ImageStack8(50, 50, 50, 50, ImageStack.SliceOrders.TBeforeZ);
+            var copy = new ImageStack8(ims);
+            Assert.IsFalse(ims.ImageData == copy.ImageData,"Source and its copy point to the same buffer");
+            byte* sourceStart = ims.ImageData;
+            byte* copyStart = copy.ImageData;
+            for (long i = 0; i < ims.ImageNB; i++)
+                Assert.AreEqual(sourceStart[i], copyStart[i], "Found non-matching pixel");
+            ims.Dispose();
+            copy.Dispose();
+        }
     }
 }


fix test case due to last commit

fix test case due to last commit

--- csharp/AdapterTest/StreamingContextTest.cs
+++ csharp/AdapterTest/StreamingContextTest.cs
@@ -31,11 +31,7 @@
             var socketStream = ssc.SocketTextStream(IPAddress.Loopback.ToString(), 12345);
             Assert.IsNotNull(socketStream.DStreamProxy);

-<<<<<<< 1b025447650d8c2a36b151dfb9e1b5ed5039e5f7
-            var kafkaStream = ssc.KafkaStream(IPAddress.Loopback + ":2181", "testGroupId", new Dictionary<string, int> { { "testTopic1", 1 } }, new Dictionary<string, string>());
-=======
-            var kafkaStream = KafkaUtils.CreateStream(ssc, "127.0.0.1:2181", "testGroupId", new Dictionary<string, int> { { "testTopic1", 1 } }, new Dictionary<string, string>());
->>>>>>> add an overload of UpdateStateByKey API and move kafka DStream to KafkaUtil class
+            var kafkaStream = KafkaUtils.CreateStream(ssc, IPAddress.Loopback + ":2181", "testGroupId", new Dictionary<string, int> { { "testTopic1", 1 } }, new Dictionary<string, string>());
             Assert.IsNotNull(kafkaStream.DStreamProxy);

             var directKafkaStream = KafkaUtils.CreateDirectStream(ssc, new List<string> { "testTopic2" }, new Dictionary<string, string>(), new Dictionary<string, long>());


updated rhythmbonus to be OD sensitive

updated rhythmbonus to be OD sensitive

--- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs
+++ osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs
@@ -21,7 +21,7 @@
         private const double pi_over_4 = Math.PI / 4;
         private const double pi_over_2 = Math.PI / 2;

-        private const double rhythm_multiplier = 0.5;
+        private const double rhythm_multiplier = 2.0;
         private const int history_time_max = 5000; // 5 seconds of calculatingRhythmBonus max.

         private double skillMultiplier => 1375;
@@ -80,9 +80,7 @@
                     double effectiveRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta);

                     if (effectiveRatio > 0.5)
-                        effectiveRatio = 0.5 + (effectiveRatio - 0.5) * 10; // large buff for 1/3 -> 1/4 type transitions.
-
-                    effectiveRatio *= Math.Max(prevDelta, currDelta) / greatWindowFull; // Increase scaling for when hitwindow is large but accuracy range is small.
+                        effectiveRatio = 0.5 + (effectiveRatio - 0.5) * 5; // large buff for 1/3 -> 1/4 type transitions.

                     effectiveRatio *= currHistoricalDecay; // scale with time

@@ -130,7 +128,7 @@
                 }
             }

-            return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though)
+            return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier * Math.Sqrt(52 / greatWindowFull)) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though)
         }

         private double tapStrainOf(DifficultyHitObject current, double speedBonus, double strainTime)


Set a sane default keyboard step for mod settings

--- osu.Game/Configuration/SettingSourceAttribute.cs
+++ osu.Game/Configuration/SettingSourceAttribute.cs
@@ -45,7 +45,8 @@
                         yield return new SettingsSlider<float>
                         {
                             LabelText = attr.Label,
-                            Bindable = bNumber
+                            Bindable = bNumber,
+                            KeyboardStep = 0.1f,
                         };

                         break;
@@ -54,7 +55,8 @@
                         yield return new SettingsSlider<double>
                         {
                             LabelText = attr.Label,
-                            Bindable = bNumber
+                            Bindable = bNumber,
+                            KeyboardStep = 0.1f,
                         };

                         break;


Fix order

Fix order

--- osu.Game/Database/ArchiveDownloadModelManager.cs
+++ osu.Game/Database/ArchiveDownloadModelManager.cs
@@ -73,14 +73,8 @@
         }

         /// <summary>
-        /// Checks whether a given <see cref="TModel"/> is available in the local store already.
-        /// </summary>
-        /// <param name="model">The <see cref="TModel"/> whose existence needs to be checked.</param>
-        /// <returns>Whether the <see cref="TModel"/> exists locally.</returns>
-        public bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model));
-
-        /// <summary>
         /// Downloads a <see cref="TModel"/> with optional parameters for the download request.
+        /// This will post notifications tracking progress.
         /// </summary>
         /// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
         /// <param name="extra">Optional parameters to be used for creating the download request.</param>
@@ -95,6 +89,13 @@

             return true;
         }
+
+        /// <summary>
+        /// Checks whether a given <see cref="TModel"/> is available in the local store already.
+        /// </summary>
+        /// <param name="model">The <see cref="TModel"/> whose existence needs to be checked.</param>
+        /// <returns>Whether the <see cref="TModel"/> exists locally.</returns>
+        public bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model));

         /// <summary>
         /// Gets an existing <see cref="TModel"/> download request if it exists.


[050dev] Changed the archive action to C.AR=

--- packages/C/dev/Scripts/Actions/ArchiverAction.cs
+++ packages/C/dev/Scripts/Actions/ArchiverAction.cs
@@ -26,7 +26,7 @@
         {
             get
             {
-                return "-C.LIB";
+                return "-C.AR";
             }
         }


Code support for .DBValue is needed for SmartDate properties

--- trunk/Solutions/CslaGenFork/CodeGen/CslaTemplateHelperCS.cs
+++ trunk/Solutions/CslaGenFork/CodeGen/CslaTemplateHelperCS.cs
@@ -3,7 +3,6 @@
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
-using System.Net;
 using System.Reflection;
 using System.Text;
 using System.Text.RegularExpressions;
@@ -258,8 +257,8 @@

         public bool AllowNull(Property prop)
         {
-            return (GeneratorController.Current.CurrentUnit.GenerationParams.NullableSupport && prop.Nullable &&
-                    prop.PropertyType != TypeCodeEx.SmartDate);
+            return GeneratorController.Current.CurrentUnit.GenerationParams.NullableSupport && prop.Nullable &&
+                    prop.PropertyType != TypeCodeEx.SmartDate;
         }

         public virtual string GetParameterSet(Property prop, bool criteria)
@@ -297,8 +296,6 @@

             switch (propType)
             {
-                case TypeCodeEx.SmartDate:
-                    return propName + ".DBValue";
                 case TypeCodeEx.Guid:
                     return propName + ".Equals(Guid.Empty) ? (object) DBNull.Value : " + propName;
                 default:


One file down, many to go.

One file down, many to go.

Former-commit-id: ef2de549759fecdbc6e4d8a554cebe9ea52064e9

--- src/RiakClient/Auth/RiakSecurityManager.cs
+++ src/RiakClient/Auth/RiakSecurityManager.cs
@@ -97,8 +97,11 @@
         /// <param name="chain">The X509 certificate chain</param>
         /// <param name="sslPolicyErrors">The set of errors according to SSL policy</param>
         /// <returns>boolean indicating validity of server certificate</returns>
-        public bool ServerCertificateValidationCallback(object sender, X509Certificate certificate,
-            X509Chain chain, SslPolicyErrors sslPolicyErrors)
+        public bool ServerCertificateValidationCallback(
+            object sender,
+            X509Certificate certificate,
+            X509Chain chain,
+            SslPolicyErrors sslPolicyErrors)
         {
             if (sslPolicyErrors == SslPolicyErrors.None)
             {
@@ -163,8 +166,12 @@
         /// <param name="remoteCertificate">The remote certificate</param>
         /// <param name="acceptableIssuers">The collection of acceptable issuers</param>
         /// <returns>A matching certificate for authentication</returns>
-        public X509Certificate ClientCertificateSelectionCallback(object sender, string targetHost,
-            X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers)
+        public X509Certificate ClientCertificateSelectionCallback(
+            object sender,
+            string targetHost,
+            X509CertificateCollection localCertificates,
+            X509Certificate remoteCertificate,
+            string[] acceptableIssuers)
         {
             X509Certificate clientCertToPresent = null;

@@ -232,8 +239,7 @@
         {
             X509Certificate2 certificateAuthorityCert = null;

-            if ((!string.IsNullOrWhiteSpace(authConfig.CertificateAuthorityFile)) &&
-                (File.Exists(authConfig.CertificateAuthorityFile)))
+            if (!string.IsNullOrWhiteSpace(authConfig.CertificateAuthorityFile) && File.Exists(authConfig.CertificateAuthorityFile))
             {
                 certificateAuthorityCert = new X509Certificate2(authConfig.CertificateAuthorityFile);
             }
@@ -250,8 +256,7 @@
             var clientCertificates = new X509CertificateCollection();

             // http://stackoverflow.com/questions/18462064/associate-a-private-key-with-the-x509certificate2-class-in-net
-            if ((!string.IsNullOrWhiteSpace(authConfig.ClientCertificateFile)) &&
-                (File.Exists(authConfig.ClientCertificateFile)))
+            if (!string.IsNullOrWhiteSpace(authConfig.ClientCertificateFile) && File.Exists(authConfig.ClientCertificateFile))
             {
                 var cert = new X509Certificate2(authConfig.ClientCertificateFile);
                 clientCertificates.Add(cert);


expressions

expressions

--- src/StandardContainer/StandardContainer.cs
+++ src/StandardContainer/StandardContainer.cs
@@ -6,12 +6,7 @@
 using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Text;
-/*
- * Instance
- * Singleton -> instance
- * Tranient -> factory
- * Factory -> factory
-*/
+
 namespace StandardContainer
 {
     internal enum Lifestyle { Transient, Singleton, Instance, Factory }
@@ -155,7 +150,6 @@
         private Registration CreateRegistration(Type type, Registration dependent)
         {
             var typeInfo = type.GetTypeInfo();
-            Registration reg;
             if (typeof(IEnumerable).GetTypeInfo().IsAssignableFrom(typeInfo) && type != typeof(string))
             {
                 var genericType = type.GenericTypeArguments.Single().GetTypeInfo();
@@ -171,7 +165,7 @@
                     throw new TypeAccessException($"No types found assignable to generic type '{genericType.AsString()}'.");
                 Log($"Creating list of {expressions.Count} types assignable to '{genericType.AsString()}'.");
                 var expression = Expression.NewArrayInit(genericType.AsType(), expressions);
-                reg = new Registration
+                return new Registration
                 {
                     Type = typeInfo,
                     Lifestyle = Lifestyle.Transient,
@@ -179,7 +173,7 @@
                     Factory = Expression.Lambda<Func<object>>(expression).Compile()
                 };
             }
-            else if (type.IsFunc())
+            if (type.IsFunc())
             {
                 var generic = type.GenericTypeArguments.Single();
                 var regDependent = new Registration { Lifestyle = Lifestyle.Factory };
@@ -191,7 +185,7 @@
                     expression = Expression.Constant(genericReg.Factory);
                 else
                     throw new TypeAccessException($"Type from factory '{type.AsString()}' is a {genericReg.Lifestyle}.");
-                reg = new Registration
+                return new Registration
                 {
                     Type = typeInfo,
                     Lifestyle = genericReg.Lifestyle,
@@ -199,17 +193,13 @@
                     Factory = Expression.Lambda<Func<object>>(expression).Compile()
                 };
             }
-            else
-            {
-                if (defaultLifestyle == DefaultLifestyle.None)
-                    throw new TypeAccessException($"Cannot resolve unregistered type '{type.AsString()}'.");
-                var style = dependent?.Lifestyle != Lifestyle.Factory &&
-                            (dependent?.Lifestyle == Lifestyle.Singleton || dependent?.Lifestyle == Lifestyle.Instance ||
-                             defaultLifestyle == DefaultLifestyle.Singleton)
-                    ? Lifestyle.Singleton : Lifestyle.Transient;
-                reg = AddRegistration(typeInfo, null, style, null, "Auto-registration");
-            }
-            return reg;
+            if (defaultLifestyle == DefaultLifestyle.None)
+                throw new TypeAccessException($"Cannot resolve unregistered type '{type.AsString()}'.");
+            var style = dependent?.Lifestyle != Lifestyle.Factory &&
+                        (dependent?.Lifestyle == Lifestyle.Singleton || dependent?.Lifestyle == Lifestyle.Instance ||
+                            defaultLifestyle == DefaultLifestyle.Singleton)
+                ? Lifestyle.Singleton : Lifestyle.Transient;
+            return AddRegistration(typeInfo, null, style, null, "Auto-registration");
         }

         private void Initialize(Registration reg, Registration dependent)


removed space from boundary, closes #802 (#809)

--- src/Stripe.net/Infrastructure/Requestor.cs
+++ src/Stripe.net/Infrastructure/Requestor.cs
@@ -202,7 +202,7 @@
             fileContent.Headers.ContentType = new MediaTypeHeaderValue(MimeTypes.GetMimeType(fileName));

             var multiPartContent =
-                new MultipartFormDataContent($"----------Upload: { DateTime.UtcNow.Ticks.ToString("x") }")
+                new MultipartFormDataContent($"----------Upload:{ DateTime.UtcNow.Ticks.ToString("x") }")
                 {
                     { new StringContent(purpose), "\"purpose\"" },
                     fileContent


Renamed create-bug-report to create-report

--- Duplicati/CommandLine/Program.cs
+++ Duplicati/CommandLine/Program.cs
@@ -172,7 +172,7 @@
                 knownCommands["repair"] = Commands.Repair;

                 knownCommands["compact"] = Commands.Compact;
-                knownCommands["create-bug-report"] = Commands.CreateBugReport;
+                knownCommands["create-report"] = Commands.CreateBugReport;
                 knownCommands["list-changes"] = Commands.ListChanges;
                 knownCommands["test"] = Commands.Test;


Updated URI regexp to be even more flexible

--- Duplicati/Library/Utility/Uri.cs
+++ Duplicati/Library/Utility/Uri.cs
@@ -33,7 +33,7 @@
         /// <summary>
         /// A very lax version of a URL parser
         /// </summary>
-        private static System.Text.RegularExpressions.Regex URL_PARSER = new System.Text.RegularExpressions.Regex(@"(?<scheme>[^:]+)://(((?<username>[^\:]+)\:((?<password>[^@]*))\@))?((?<hostname>[^/\?\:]+)(\:(?<port>\d+))?(/(?<path>[^\?]*))|(?<path>([^\?]*)))?(\?(?<query>.+))?");
+        private static System.Text.RegularExpressions.Regex URL_PARSER = new System.Text.RegularExpressions.Regex(@"(?<scheme>[^:]+)://(((?<username>[^\:]+)(\:(?<password>[^@]*))?\@))?((?<hostname>[^/\?\:]+)(\:(?<port>\d+))?)(/(?<path>[^\?]*))?(\?(?<query>.+))?");

         /// <summary>
         /// The URL scheme, e.g. http


Polishing DotNetWebClientProxy internals (naming, consolidation/reuse, etc.)

--- Elmah.Io/DotNetWebClientProxy.cs
+++ Elmah.Io/DotNetWebClientProxy.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
 using System.Net;
 using System.Net.Mime;
 using System.Text;
@@ -29,24 +30,22 @@
                 // and therefore must be treated specially and go over
                 // the corresponding property on the HttpWebRequest object.

-                var headerz = new WebHeaderCollection {headers};
-                var contentType = headerz[HttpRequestHeader.ContentType];
+                headers = new WebHeaderCollection { headers };
+                var contentType = headers[HttpRequestHeader.ContentType];
                 if (contentType != null)
                 {
                     request.ContentType = contentType;
-                    headerz.Remove(HttpRequestHeader.ContentType);
+                    headers.Remove(HttpRequestHeader.ContentType);
                 }

-                request.Headers.Add(headerz);
+                request.Headers.Add(headers);
             }

             var encoding = Encoding.UTF8; // TODO parameterize?
             var bytes = encoding.GetBytes(data);
             request.ContentLength = bytes.Length;

-            var tcs = new TaskCompletionSource<T>();
-            Spawn(Post(request, bytes, tcs, resultor), tcs);
-            return tcs.Task;
+            return Spawn<T>(tcs => Post(request, bytes, tcs, resultor));
         }

         static IEnumerable<Task> Post<T>(WebRequest request, byte[] bytes, TaskCompletionSource<T> tcs, Func<WebHeaderCollection, string, T> resultor)
@@ -65,7 +64,7 @@
                 yield return writeTask;
             }

-            foreach (var task in Get(request, tcs, resultor))
+            foreach (var task in GetResponse(request, tcs, resultor))
                 yield return task;
         }

@@ -79,12 +78,10 @@
             if (headers != null)
                 request.Headers.Add(headers);

-            var tcs = new TaskCompletionSource<T>();
-            Spawn(Get(request, tcs, resultor), tcs);
-            return tcs.Task;
+            return Spawn<T>(tcs => GetResponse(request, tcs, resultor));
         }

-        static IEnumerable<Task> Get<T>(WebRequest request, TaskCompletionSource<T> tcs, Func<WebHeaderCollection, string, T> resultor)
+        static IEnumerable<Task> GetResponse<T>(WebRequest request, TaskCompletionSource<T> tcs, Func<WebHeaderCollection, string, T> resultor)
         {
             Debug.Assert(request != null);
             Debug.Assert(tcs != null);
@@ -98,38 +95,49 @@
             {
                 var contentType = response.Headers.Map(HttpResponseHeader.ContentType, h => new ContentType(h));
                 var encoding = contentType != null
-                    ? contentType.EncodingFromCharSet(Encoding.Default)
-                    : Encoding.Default;
+                             ? contentType.EncodingFromCharSet(Encoding.Default)
+                             : Encoding.Default;

-                var bytes = new byte[4096];
-                var chars = (char[]) null;
-                var decoder = encoding.GetDecoder();
                 var sb = new StringBuilder();
-                while (true)
-                {
-                    var readTask = stream.ReadAsync(bytes, 0, bytes.Length);
-                    yield return readTask;
-                    var readCount = readTask.Result;
-                    if (readCount == 0)
-                        break;
-                    var charCount = decoder.GetCharCount(bytes, 0, readCount);
-                    if (chars == null || charCount > chars.Length)
-                        chars = new char[charCount];
-                    var decodedCharCount = decoder.GetChars(bytes, 0, readCount, chars, 0, false);
-                    sb.Append(chars, 0, decodedCharCount);
-                }
+                foreach (var task in ReadAllText(stream, encoding, sb))
+                    yield return task;

                 tcs.SetResult(resultor(response.Headers, sb.ToString()));
             }
         }

-        static void Spawn<T>(IEnumerable<Task> job, TaskCompletionSource<T> tcs)
+        static IEnumerable<Task> ReadAllText(Stream stream, Encoding encoding, StringBuilder output)
         {
-            Debug.Assert(job != null);
-            Debug.Assert(tcs != null);
+            Debug.Assert(stream != null);
+            Debug.Assert(encoding != null);
+            Debug.Assert(output != null);

+            var bytes = new byte[4096];
+            var chars = (char[]) null;
+            var decoder = encoding.GetDecoder();
+            while (true)
+            {
+                var readTask = stream.ReadAsync(bytes, 0, bytes.Length);
+                yield return readTask;
+                var readCount = readTask.Result;
+                if (readCount == 0)
+                    break;
+                var charCount = decoder.GetCharCount(bytes, 0, readCount);
+                if (chars == null || charCount > chars.Length)
+                    chars = new char[charCount];
+                var decodedCharCount = decoder.GetChars(bytes, 0, readCount, chars, 0, false);
+                output.Append(chars, 0, decodedCharCount);
+            }
+        }
+
+        static Task<T> Spawn<T>(Func<TaskCompletionSource<T>, IEnumerable<Task>> jobFunc)
+        {
+            Debug.Assert(jobFunc != null);
+
+            var tcs = new TaskCompletionSource<T>();
+
             Task.Factory
-                .StartNew(job)
+                .StartNew(jobFunc(tcs))
                 .ContinueWith(t =>
                 {
                     if (t.IsCanceled)
@@ -148,6 +156,8 @@
                     }
                 },
                 TaskContinuationOptions.ExecuteSynchronously);
+
+            return tcs.Task;
         }
     }
 }


Adjust for Tesseract-4

Adjust for Tesseract-4

--- src/Tesseract.Tests/ResultRendererTests.cs
+++ src/Tesseract.Tests/ResultRendererTests.cs
@@ -62,7 +62,7 @@
         public void CanRenderResultsIntoPdfFile1()
         {
             var resultPath = TestResultRunFile(@"ResultRenderers\PDF\phototest");
-            using (var renderer = ResultRenderer.CreatePdfRenderer(resultPath, DataPath))
+            using (var renderer = ResultRenderer.CreatePdfRenderer(resultPath, DataPath, false))
             {
                 var examplePixPath = this.TestFilePath("Ocr/phototest.tif");
                 ProcessImageFile(renderer, examplePixPath);
@@ -89,7 +89,7 @@
         public void CanRenderMultiplePageDocumentToPdfFile1()
         {
             var resultPath = TestResultRunFile(@"ResultRenderers\PDF\multi-page");
-            using (var renderer = ResultRenderer.CreatePdfRenderer(resultPath, DataPath))
+            using (var renderer = ResultRenderer.CreatePdfRenderer(resultPath, DataPath, false))
             {
                 var examplePixPath = this.TestFilePath("processing/multi-page.tif");
                 ProcessImageFile(renderer, examplePixPath);


Another try to fix charger level decoding.

--- ExampleScripts/UOErebor/mage.csx
+++ ExampleScripts/UOErebor/mage.csx
@@ -4,6 +4,7 @@
 using System;
 using System.Linq;
 using Infusion.Gumps;
+using Infusion.LegacyApi.Events;

 public static class Mage
 {
@@ -15,40 +16,42 @@
         "Nyni budes kouzlit s vetsim usilim.", "Tve usili polevilo.");

     private static EventJournal journal = UO.CreateEventJournal();
-
+
+    private static readonly GumpInstanceId chargerGumpId = (GumpInstanceId)0x9600057B;
+
     public static int FireChargerLevel
     {
         get
         {
-            var lastCharger = journal
-                .Reverse()
-                .OfType<GumpReceivedEvent>()
-                .Where(ev =>
-                {
-                    if (Trace.Enabled) Trace.Log($"Id: {ev.Gump.Id}, GumpId: {ev.Gump.GumpId}");
-
-                    //return ev.Gump.Id == (GumpTypeId)0x40083F8E;
-                    //return ev.Gump.Id == (GumpTypeId)0x9600057B;
-                    return ev.Gump.GumpId == (GumpInstanceId)0x9600057B;
-                    //return ev.Gump.GumpId == (GumpInstanceId)0x40083F8E;
-                 })
-                .Select(ev => {
-                    var processor = new ChargerGumpProcessor(2257);
-                    var parser = new GumpParser(processor);
-
-                    parser.Parse(ev.Gump);
-
-                    if (Trace.Enabled) Trace.Log($"IsCharger: {processor.IsChargerGump}, Level: {processor.ChargerLevel}");
-
-                    return processor;
-                })
-                .Where(p => p.IsChargerGump)
-                .FirstOrDefault();
+            int lastCharger = 0;
+
+            journal
+                .When<ServerRequestedGumpCloseEvent>(ev => lastCharger = ProcessCloseRequest(ev, lastCharger))
+                .When<GumpReceivedEvent>(ev => lastCharger = ProcessGump(ev, lastCharger))
+                .All();

-             journal.Delete();
+            return lastCharger;
+        }
+    }

-             return lastCharger != null ? lastCharger.ChargerLevel : 0;
-        }
+    private static int ProcessGump(GumpReceivedEvent ev, int lastCharger)
+    {
+        if (ev.Gump.GumpId == chargerGumpId)
+            return lastCharger;
+
+        var processor = new ChargerGumpProcessor(2257);
+        var parser = new GumpParser(processor);
+
+        parser.Parse(ev.Gump);
+
+        if (Trace.Enabled) Trace.Log($"IsCharger: {processor.IsChargerGump}, Level: {processor.ChargerLevel}");
+
+        return processor.IsChargerGump ? processor.ChargerLevel : lastCharger;
+    }
+
+    private static int ProcessCloseRequest(ServerRequestedGumpCloseEvent ev, int lastCharger)
+    {
+        return ev.GumpId == chargerGumpId ? 0 : lastCharger;
     }

     private class ChargerGumpProcessor : IProcessGumpPic, IProcessTilePicHue


Cherry pick #8058 to fix #8038

Cherry pick #8058 to fix #8038

--- src/Umbraco.Core/Runtime/SqlMainDomLock.cs
+++ src/Umbraco.Core/Runtime/SqlMainDomLock.cs
@@ -3,8 +3,10 @@
 using System.Data.SqlClient;
 using System.Diagnostics;
 using System.Linq;
+using System.Security.Cryptography;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Web;
 using Umbraco.Core.Logging;
 using Umbraco.Core.Persistence;
 using Umbraco.Core.Persistence.Dtos;
@@ -16,7 +18,7 @@
     internal class SqlMainDomLock : IMainDomLock
     {
         private string _lockId;
-        private const string MainDomKey = "Umbraco.Core.Runtime.SqlMainDom";
+        private const string MainDomKeyPrefix = "Umbraco.Core.Runtime.SqlMainDom";
         private const string UpdatedSuffix = "_updated";
         private readonly ILogger _logger;
         private IUmbracoDatabase _db;
@@ -118,6 +120,16 @@
             return Task.Factory.StartNew(ListeningLoop, _cancellationTokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);

         }
+
+        /// <summary>
+        /// Returns the keyvalue table key for the current server/app
+        /// </summary>
+        /// <remarks>
+        /// The key is the the normal MainDomId which takes into account the AppDomainAppId and the physical file path of the app and this is
+        /// combined with the current machine name. The machine name is required because the default semaphore lock is machine wide so it implicitly
+        /// takes into account machine name whereas this needs to be explicitly per machine.
+        /// </remarks>
+        private string MainDomKey { get; } = MainDomKeyPrefix + "-" + (NetworkHelper.MachineName + MainDom.GetMainDomId()).GenerateHash<SHA1>();

         private void ListeningLoop()
         {