Revert SetEntry to use older 2.4 SetEx method

--- src/ServiceStack.Redis/RedisClient.cs
+++ src/ServiceStack.Redis/RedisClient.cs
@@ -124,12 +124,17 @@

         public void SetEntry(string key, string value, TimeSpan expireIn)
         {
-            var bytesValue = value != null ? value.ToUtf8Bytes() : null;
-
-            if (expireIn.Milliseconds > 0)
-                base.Set(key, bytesValue, 0, (long)expireIn.TotalMilliseconds);
-            else
-                base.Set(key, bytesValue, (int)expireIn.TotalSeconds, 0);
+            var bytesValue = value != null
+                ? value.ToUtf8Bytes()
+                : null;
+
+            SetEx(key, (int)expireIn.TotalSeconds, bytesValue);
+
+            //New in 2.6.x - TODO change when 2.6 is most popular
+            //if (expireIn.Milliseconds > 0)
+            //    base.Set(key, bytesValue, 0, (long)expireIn.TotalMilliseconds);
+            //else
+            //    base.Set(key, bytesValue, (int)expireIn.TotalSeconds, 0);
         }

         public void SetEntryIfExists(string key, string value, TimeSpan expireIn)


Fix locking contention

Fix locking contention

--- src/SourceCode.Clay/Randoms/Normal.cs
+++ src/SourceCode.Clay/Randoms/Normal.cs
@@ -29,6 +29,7 @@
         private readonly double _μ;
         private readonly double _σ;

+        private readonly object _lock = new object();
         private double _chamber;
         private bool _chambered;

@@ -100,19 +101,17 @@
         /// </summary>
         public double NextDouble()
         {
-            // https://stackoverflow.com/questions/25448070/getting-random-numbers-in-a-thread-safe-way/25448166#25448166
-            // https://docs.microsoft.com/en-us/dotnet/api/system.random?view=netframework-4.7.2#the-systemrandom-class-and-thread-safety
-            // It is safe to lock on _random since it is not exposed to outside use, so cannot be contended.
-            lock (_random)
+            // Do NOT lock on _random since this lock is on a different level.
+            lock (_lock)
             {
                 if (_chambered)
                 {
                     _chambered = false;
-                    return _chamber;
+                    return _chamber; // Would have needlessly locked on _random
                 }

                 double value;
-                (value, _chamber) = NextNormalPair();
+                (value, _chamber) = NextNormalPair(); // Internally locks on _random

                 _chambered = true;
                 return value;
@@ -169,7 +168,6 @@
             r2 = r2 * sq; // Gaussian value 2
             r2 = _μ + r2 * _σ; // Stretch and move origin

-            // Clamp
             if (_clamp != null)
             {
                 r1 = _clamp.Constrain(r1);
@@ -202,8 +200,7 @@
         /// <summary>
         /// Derives the mean and standard deviation, given the min and max.
         /// </summary>
-        /// <param name="min">The minimum of the population.</param>
-        /// <param name="max">The maximum of the population.</param>
+        /// <param name="clamp">The minimum and maximum of the population.</param>
         private static (double μ, double σ) DeriveMuSigma(Clamp clamp)
         {
             Debug.Assert(clamp != null);


fix bad merge

fix bad merge

--- WalletWasabi.Gui/Program.cs
+++ WalletWasabi.Gui/Program.cs
@@ -77,20 +77,6 @@

 		private static async void AppMainAsync(string[] args)
 		{
-			try
-			{
-				var uiConfigFilePath = Path.Combine(Global.DataDir, "UiConfig.json");
-				var uiConfig = new UiConfig(uiConfigFilePath);
-				await uiConfig.LoadOrCreateDefaultFileAsync();
-
-				Global.InitializeUiConfig(uiConfig);
-				Logger.LogInfo($"{nameof(Global.UiConfig)} is successfully initialized.");
-			}
-			catch (Exception ex)
-			{
-				Logger.LogError(ex);
-			}
-
 			AvalonStudio.Extensibility.Theme.ColorTheme.LoadTheme(AvalonStudio.Extensibility.Theme.ColorTheme.VisualStudioDark);
 			MainWindowViewModel.Instance = new MainWindowViewModel();
 			StatusBar = new StatusBarViewModel();


variable lockThreadPool renamed

variable lockThreadPool renamed

--- src/Titanium.Web.Proxy/ProxyServer.cs
+++ src/Titanium.Web.Proxy/ProxyServer.cs
@@ -57,11 +57,10 @@
         /// </summary>
         private WinHttpWebProxyFinder systemProxyResolver;

-
-        /// <summary>
-        ///
-        /// </summary>
-        private object lockThreadPoolSettings = new object();
+        /// <summary>
+        ///     lock for Thread Pool tuning
+        /// </summary>
+        private object lockThreadPoolTuning = new object();

         /// <inheritdoc />
         /// <summary>
@@ -755,7 +754,7 @@
         {
             if (EnableThreadPoolOptimizing)
             {
-                lock (lockThreadPoolSettings)
+                lock (lockThreadPoolTuning)
                 {
                     int iWorkerThreads, iCompletionPortThreads;
                     ThreadPool.GetMinThreads(out iWorkerThreads, out iCompletionPortThreads);


oops, trying to fix build

oops, trying to fix build

--- src/Umbraco.Web.UI.NetCore/Startup.cs
+++ src/Umbraco.Web.UI.NetCore/Startup.cs
@@ -4,7 +4,6 @@
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
-using Microsoft.Identity.Web;
 using Umbraco.Extensions;
 using Umbraco.Web.BackOffice.DependencyInjection;
 using Umbraco.Web.BackOffice.Security;


Adding UrlHelper to UmbracoUserControl

Adding UrlHelper to UmbracoUserControl

--- src/Umbraco.Web/UmbracoUserControl.cs
+++ src/Umbraco.Web/UmbracoUserControl.cs
@@ -1,4 +1,7 @@
 using System;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
 using System.Web.UI;
 using Umbraco.Core;
 using Umbraco.Core.Services;
@@ -68,5 +71,17 @@
         {
             get { return ApplicationContext.DatabaseContext; }
         }
+
+        private UrlHelper _url;
+        /// <summary>
+        /// Returns a UrlHelper
+        /// </summary>
+        /// <remarks>
+        /// This URL helper is created without any route data and an empty request context
+        /// </remarks>
+        public UrlHelper Url
+        {
+            get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); }
+        }
     }
 }


Add function to read in OpenSSL-style private key


Cleaned up $.each usages

Cleaned up $.each usages

--- Source/Applications/openMIC/openMIC/wwwroot/DranetzGraph.cshtml
+++ Source/Applications/openMIC/openMIC/wwwroot/DranetzGraph.cshtml
@@ -904,8 +904,8 @@

             self.initializeRegisters = function (records) {
                 // Set initial register bindings
-                $("[register]").each(function (_, element) {
-                    const target = $(element);
+                $("[register]").each(function () {
+                    const target = $(this);
                     const register = target.attr("register");
                     target.attr("data-bind", `text: registerMap[${register}].localeValue(), attr: { title: 'Register ${register}' }`);
                     target.attr("data-toggle", "tooltip");
@@ -1105,9 +1105,9 @@
                     $("#plotToolTip").hide();
                 });

-                $.each(self.plot.getData(), function (_, series) {
-                    if (series.enabled)
-                        self.plotLegend.push(series);
+                $.each(self.plot.getData(), function () {
+                    if (this.enabled)
+                        self.plotLegend.push(this);
                 });
             }

@@ -1119,9 +1119,9 @@
                     const scopePlot = $("#scopePlot");
                     const plotData = [];

-                    $.each(self.plotData, function (_, series) {
-                        if (series.visible())
-                            plotData.push(series);
+                    $.each(self.plotData, function () {
+                        if (this.visible())
+                            plotData.push(this);
                     });

                     let yaxisMin = undefined;


Added implementations

Added implementations

--- Source/LedControlApp/LedControlApp/Controllers/LedController.cs
+++ Source/LedControlApp/LedControlApp/Controllers/LedController.cs
@@ -2,15 +2,20 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using Plugin.BLE.Abstractions.Contracts;
+using Plugin.BLE.Abstractions.EventArgs;

 namespace LedControlApp.Controllers
 {
     public class LedController
     {
+        private Guid _serviceGuid = Guid.Parse("0000fff0-0000-1000-8000-00805f9b34fb");
+        private Guid _charGuid = Guid.Parse("0000fff1-0000-1000-8000-00805f9b34fb");
+
         private IAdapter _adapter;
-
+        private IDevice _device;
         public LedController(IAdapter adapter)
         {
             _adapter = adapter;
@@ -18,10 +23,39 @@

         public async Task<byte?> GetLedValue()
         {
-            return byte.MaxValue;
+            var service = await _device.GetServiceAsync(_serviceGuid);
+            var charact = await service.GetCharacteristicAsync(_charGuid);
+            return (await charact.ReadAsync()).First();
         }

         public async Task<bool> SetLedValue(byte value)
+        {
+            var service = await _device.GetServiceAsync(_serviceGuid);
+            var charact = await service.GetCharacteristicAsync(_charGuid);
+            return await charact.WriteAsync(new byte[] {value});
+        }
+
+        public async Task<bool> FindAndConnectToDevice()
+        {
+            _adapter.ScanTimeout = 10;
+            await _adapter.StartScanningForDevicesAsync();
+            var device =_adapter.DiscoveredDevices.FirstOrDefault(x => FilterDevice(x));
+            if (device != null && await ConnectToDevice(device))
+            {
+                _device = device;
+            }
+
+            return _device != null;
+        }
+
+
+
+        private bool FilterDevice(IDevice device)
+        {
+            return device.Name.ToLower().Contains("phito");
+        }
+
+        private async Task<bool> ConnectToDevice(IDevice device)
         {
             return true;
         }


Cosmetic code improvements.

Cosmetic code improvements.

--- Source/Lokad.Cloud.Framework/Mock/MemoryTableStorageProvider.cs
+++ Source/Lokad.Cloud.Framework/Mock/MemoryTableStorageProvider.cs
@@ -1,16 +1,11 @@
-#region Copyright (c) Lokad 2009
+#region Copyright (c) Lokad 2009-2010
 // This code is released under the terms of the new BSD licence.
 // URL: http://www.lokad.com/
 #endregion

-
 using System;
 using System.Collections.Generic;
-using System.Collections;
 using System.Linq;
-using System.Linq.Expressions;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Text;
 using Lokad.Cloud.Azure;

 namespace Lokad.Cloud.Mock
@@ -28,7 +23,7 @@
         readonly Dictionary<string, Dictionary<string, Dictionary<string,FatEntity>>> _tableStorage;

         //A formatter is requiered to handle FatEntities.
-        IBinaryFormatter _formatter;
+    	readonly IBinaryFormatter _formatter;

         /// <summary>naive global lock to make methods thread-safe.</summary>
         readonly object _syncRoot;
@@ -84,7 +79,7 @@
             }
         }

-        /// <see cref="ITableStorageProvider.Get{T}(string)<>"/>
+        /// <see cref="ITableStorageProvider.Get{T}(string)"/>
         public IEnumerable<CloudEntity<T>> Get<T>(string tableName)
         {
             lock (_syncRoot)
@@ -101,7 +96,7 @@

         }

-        /// <see cref="ITableStorageProvider.Get{T}(string,string)<>"/>
+        /// <see cref="ITableStorageProvider.Get{T}(string,string)"/>
         public IEnumerable<CloudEntity<T>> Get<T>(string tableName, string partitionKey)
         {
             lock (_syncRoot)
@@ -116,7 +111,7 @@
             }
         }

-        /// <see cref="ITableStorageProvider.Get{T}(string,string,string,string)<>"/>
+        /// <see cref="ITableStorageProvider.Get{T}(string,string,string,string)"/>
         public IEnumerable<CloudEntity<T>> Get<T>(string tableName, string partitionKey, string startRowKey, string endRowKey)
         {
             lock (_syncRoot)
@@ -135,7 +130,7 @@
             }
         }

-        /// <see cref="ITableStorageProvider.Get{T}(string,string,System.Collections.Generic.IEnumerable{string})<>"/>
+        /// <see cref="ITableStorageProvider.Get{T}(string,string,System.Collections.Generic.IEnumerable{string})"/>
         public IEnumerable<CloudEntity<T>> Get<T>(string tableName, string partitionKey, IEnumerable<string> rowKeys)
         {
             lock (_syncRoot)


GH-41: Adding extra padding bytes before and after memory that will be used in unsafe blocks as a temporary workaround for this issue.

--- Sources/Accord.Math/Integration/InfiniteAdaptiveGaussKronrod.cs
+++ Sources/Accord.Math/Integration/InfiniteAdaptiveGaussKronrod.cs
@@ -116,7 +116,39 @@
     ///   adaptive algorithms are just as efficient and effective as traditional
     ///   algorithms for "well behaved" integrands, but are also effective for
     ///   "badly behaved" integrands for which traditional algorithms fail.</para>
-    /// </remarks>
+    ///
+    /// <para>
+    ///   The algorithm implemented by this class has been based on the original FORTRAN
+    ///   implementation from QUADPACK. The function implemented the Non-adaptive Gauss-
+    ///   Kronrod integration is <c>qagi(f,bound,inf,epsabs,epsrel,result,abserr,neval,
+    ///   ier,limit,lenw,last,iwork,work)</c>. The original source code is in the public
+    ///   domain, but this version is under the LGPL. The original authors, as long as the
+    ///   original routine description, are listed below:</para>
+    ///
+    /// <para>
+    ///   Robert Piessens, Elise de Doncker; Applied Mathematics and Programming Division,
+    ///   K.U.Leuven, Leuvenappl. This routine calculates an approximation result to a given
+    ///   integral   i = integral of f over (bound,+infinity) or i = integral of f over
+    ///   (-infinity,bound) or i = integral of f over (-infinity,+infinity) hopefully satisfying
+    ///   following claim for accuracy abs(i-result).le.max(epsabs,epsrel*abs(i)).</para>
+    ///
+    /// <para>
+    ///   References:
+    ///   <list type="bullet">
+    ///     <item><description>
+    ///       Wikipedia, The Free Encyclopedia. Adaptive quadrature. Available on:
+    ///       http://en.wikipedia.org/wiki/Adaptive_quadrature </description></item>
+    ///     <item><description>
+    ///       Wikipedia, The Free Encyclopedia. QUADPACK. Available on:
+    ///       http://en.wikipedia.org/wiki/QUADPACK </description></item>
+    ///     <item><description>
+    ///       Robert Piessens, Elise de Doncker; Non-adaptive integration standard fortran
+    ///       subroutine (qng.f). Applied Mathematics and Programming Division, K.U.Leuven,
+    ///       Leuvenappl. Available at: http://www.netlib.no/netlib/quadpack/qagi.f
+    ///     </description></item>
+    ///   </list>
+    ///  </para>
+    ///  </remarks>
     ///
     /// <seealso cref="NonAdaptiveGaussKronrod"/>
     ///
@@ -129,6 +161,12 @@
         private double error;
         private int evaluations;

+        private double abstol;
+        private double reltol;
+
+        private int limit;
+        private int lenw;
+
         ///
         ///   Get the maximum number of subintervals to be utilized in the
         ///   partition of the <see cref="Range">integration interval</see>.
@@ -155,7 +193,11 @@
         ///   into account. Default is zero.
         ///
         ///
-        public double ToleranceAbsolute { get; set; }
+        public double ToleranceAbsolute
+        {
+            get { return abstol; }
+            set { abstol = value; }
+        }

         ///
         ///   Desired relative accuracy. If set to zero, this parameter
@@ -163,7 +205,23 @@
         ///   into account. Default is 1e-3.
         ///
         ///
-        public double ToleranceRelative { get; set; }
+        public double ToleranceRelative
+        {
+            get { return reltol; }
+            set
+            {
+                double limit = Math.Max(Constants.SingleEpsilon * 50.0, 5e-15);
+
+                if (value <= limit)
+                {
+                    throw new ArgumentOutOfRangeException("value",
+                        "Tolerance must be higher than machine precision"
+                        + "(must be greater than " + limit + ")");
+                }
+
+                reltol = value;
+            }
+        }

         ///
         ///   Get the exit code returned in the last call to the
@@ -202,7 +260,6 @@
         ///   partition of the given integration interval. Default is 100.</param>
         ///
         public InfiniteAdaptiveGaussKronrod(int subintervals)
-            : this(subintervals, null, Double.MinValue, Double.MaxValue)
         {
             init(subintervals, null, Double.MinValue, Double.MaxValue);
         }
@@ -216,7 +273,6 @@
         /// <param name="function">The function to be integrated.</param>
         ///
         public InfiniteAdaptiveGaussKronrod(int subintervals, Func<double, double> function)
-            : this(subintervals, function, Double.MinValue, Double.MaxValue)
         {
             if (function == null)
                 throw new ArgumentNullException("function");
@@ -257,8 +313,11 @@
             ToleranceAbsolute = 0;
             ToleranceRelative = 1e-3;

-            work = new double[subintervals * 4];
-            iwork = new int[subintervals];
+            work = new double[subintervals * 4 + 100];
+            iwork = new int[subintervals + 100];
+
+            limit = subintervals;
+            lenw = subintervals * 4;
         }

         ///
@@ -312,12 +371,16 @@

                 qagi_(Function, bound, inf, ToleranceAbsolute, ToleranceRelative,
                     out result, out error, out evaluations, out errorCode,
-                    iwork.Length, work.Length, out last, iwork, work);
+                    limit, lenw, out last, iwork, work);
             }

             if (errorCode == 6)
-                throw new InvalidOperationException("Unexpected internal error code.");
+            {
+                throw new InvalidOperationException("Invalid inputs. If this error happens, the "
+                    + "framework didn't check for inputs correctly. If you encounter this error, "
+                    + "please feel in a bug report at the framework's issue tracking system.");
+            }

             Status = (InfiniteAdaptiveGaussKronrodStatus)errorCode;

@@ -411,7 +474,7 @@
             result = 0.0;
             abserr = 0.0;

-            if (limit < 1 || lenw < limit << 2)
+            if (limit < 1 || lenw < (limit << 2))
             {
                 goto L10;
             }
@@ -419,8 +482,8 @@
             unsafe
             {
                 /*         preparef call for qagie. */
-                fixed (double* work = dwork)
-                fixed (int* Iwork = iwork)
+                fixed (double* work = &dwork[10])
+                fixed (int* Iwork = &iwork[10])
                 {
                     l1 = limit + 1;
                     l2 = limit + l1;
@@ -474,440 +537,450 @@
             bool noext;

             int iroff1, iroff2, iroff3;
-            double* res3la = stackalloc double[3];
-            double error1 = 0;
-            double error2 = 0;
-            double* rlist2 = stackalloc double[52];
-            int numrl2;
-            double defabs = 0, epmach;
-            double erlarg = 1;
-            double abseps = 0;
-            double correc = 0;
-            double errbnd;
-            double resabs = 0;
-            int jupbnd;
-            double erlast, errmax;
-            int maxerr;
-            double reseps = 0;
-            bool extrap;
-            double ertest = 0;
-            double errsum;
-
-            /* Parameter adjustments */
-            --iord;
-            --elist;
-            --rlist;
-            --blist;
-            --alist__;
-
-            /* Function Body */
-            epmach = Constants.SingleEpsilon;
-
-            /*           test on validity o parameters */
-            /*           ----------------------------- */
-
-            /* ***first executable statement  qagie */
-            ier = 0;
-            neval = 0;
-            last = 0;
-            result = 0.0;
-            abserr = 0.0;
-            alist__[1] = 0.0;
-            blist[1] = 1.0;
-            rlist[1] = 0.0;
-            elist[1] = 0.0;
-            iord[1] = 0;
-
-            if (epsabs <= 0.0 && epsrel < Math.Max(epmach * 50.0, 5e-15))
-            {
-                ier = 6;
-            }
-
-            if (ier == 6)
-            {
-                return 0;
-            }
-
-
-            /*           first approximation to the integral */
-            /*           ----------------------------------- */
-
-            /*           determine the interval to be mapped onto (0,1). */
-            /*           i in = 2 the integral is computed as i = i1+i2, wheref */
-            /*           i1 = integral o  over (-infinity,0), */
-            /*           i2 = integral o  over (0,+infinity). */
-
-            boun = bound;
-
-            if (inf == 2)
-            {
-                boun = 0.0;
-            }
-
-            qk15i_(f, ref boun, ref inf, 0.0, 1.0,
-                ref result, ref abserr, ref defabs, ref resabs);
-
-            /*           test on accuracy */
-
-            last = 1;
-            rlist[1] = result;
-            elist[1] = abserr;
-            iord[1] = 1;
-            dres = Math.Abs(result);
-
-            errbnd = Math.Max(epsabs, epsrel * dres);
-            if (abserr <= epmach * 100.0 * defabs && abserr > errbnd)
-            {
-                ier = 2;
-            }
-            if (limit == 1)
-            {
-                ier = 1;
-            }
-            if (ier != 0 || abserr <= errbnd && abserr != resabs || abserr == 0.0)
-            {
+
+            double[] res3la_ = new double[3 + 1];
+            double[] rlist2_ = new double[52 + 1];
+
+            fixed (double* res3la = res3la_)
+            fixed (double* rlist2 = rlist2_)
+            {
+                double error1 = 0;
+                double error2 = 0;
+
+                int numrl2;
+                double defabs = 0, epmach;
+                double erlarg = 1;
+                double abseps = 0;
+                double correc = 0;
+                double errbnd;
+                double resabs = 0;
+                int jupbnd;
+                double erlast, errmax;
+                int maxerr;
+                double reseps = 0;
+                bool extrap;
+                double ertest = 0;
+                double errsum;
+
+                /* Parameter adjustments */
+                --iord;
+                --elist;
+                --rlist;
+                --blist;
+                --alist__;
+
+                /* Function Body */
+                epmach = Constants.SingleEpsilon;
+
+                /*           test on validity o parameters */
+                /*           ----------------------------- */
+
+                /* ***first executable statement  qagie */
+                ier = 0;
+                neval = 0;
+                last = 0;
+                result = 0.0;
+                abserr = 0.0;
+                alist__[1] = 0.0;
+                blist[1] = 1.0;
+                rlist[1] = 0.0;
+                elist[1] = 0.0;
+                iord[1] = 0;
+
+                if (epsabs <= 0.0 && epsrel < Math.Max(epmach * 50.0, 5e-15))
+                {
+                    ier = 6;
+                }
+
+                if (ier == 6)
+                {
+                    return 0;
+                }
+
+
+                /*           first approximation to the integral */
+                /*           ----------------------------------- */
+
+                /*           determine the interval to be mapped onto (0,1). */
+                /*           i in = 2 the integral is computed as i = i1+i2, wheref */
+                /*           i1 = integral o  over (-infinity,0), */
+                /*           i2 = integral o  over (0,+infinity). */
+
+                boun = bound;
+
+                if (inf == 2)
+                {
+                    boun = 0.0;
+                }
+
+                qk15i_(f, ref boun, ref inf, 0.0, 1.0,
+                    ref result, ref abserr, ref defabs, ref resabs);
+
+                /*           test on accuracy */
+
+                last = 1;
+                rlist[1] = result;
+                elist[1] = abserr;
+                iord[1] = 1;
+                dres = Math.Abs(result);
+
+                errbnd = Math.Max(epsabs, epsrel * dres);
+                if (abserr <= epmach * 100.0 * defabs && abserr > errbnd)
+                {
+                    ier = 2;
+                }
+                if (limit == 1)
+                {
+                    ier = 1;
+                }
+                if (ier != 0 || abserr <= errbnd && abserr != resabs || abserr == 0.0)
+                {
+                    goto L130;
+                }
+
+                /*           initialization */
+                /*           -------------- */
+
+                uflow = Single.MinValue;
+                oflow = Single.MaxValue;
+                rlist2[0] = result;
+                errmax = abserr;
+                maxerr = 1;
+                area = result;
+                errsum = abserr;
+                abserr = oflow;
+                nrmax = 1;
+                nres = 0;
+                ktmin = 0;
+                numrl2 = 2;
+                extrap = false;
+                noext = false;
+                ierro = 0;
+                iroff1 = 0;
+                iroff2 = 0;
+                iroff3 = 0;
+                ksgn = -1;
+                if (dres >= (1.0 - epmach * 50.0) * defabs)
+                {
+                    ksgn = 1;
+                }
+
+                /*           main do-loop */
+                /*           ------------ */
+
+                i__1 = limit;
+                for (last = 2; last <= i__1; ++last)
+                {
+
+                    /*           bisect the subinterval with nrmax-th largest */
+                    /*           error estimate. */
+
+                    a1 = alist__[maxerr];
+                    b1 = (alist__[maxerr] + blist[maxerr]) * .5;
+                    a2 = b1;
+                    b2 = blist[maxerr];
+                    erlast = errmax;
+
+                    qk15i_(f, ref boun, ref inf, a1, b1, ref area1,
+                        ref error1, ref resabs, ref defab1);
+
+                    qk15i_(f, ref boun, ref inf, a2, b2, ref area2,
+                        ref error2, ref resabs, ref defab2);
+
+                    /*           improve previous approximations to integral */
+                    /*           and error and test for accuracy. */
+
+                    area12 = area1 + area2;
+                    erro12 = error1 + error2;
+                    errsum = errsum + erro12 - errmax;
+                    area = area + area12 - rlist[maxerr];
+                    if (defab1 == error1 || defab2 == error2)
+                    {
+                        goto L15;
+                    }
+                    if ((Math.Abs(rlist[maxerr] - area12)) > Math.Abs(area12) * 1e-5 || erro12 < errmax * 0.99)
+                    {
+                        goto L10;
+                    }
+                    if (extrap)
+                    {
+                        ++iroff2;
+                    }
+                    if (!extrap)
+                    {
+                        ++iroff1;
+                    }
+                L10:
+                    if (last > 10 && erro12 > errmax)
+                    {
+                        ++iroff3;
+                    }
+                L15:
+                    rlist[maxerr] = area1;
+                    rlist[last] = area2;
+                    errbnd = Math.Max(epsabs, epsrel * Math.Abs(area));
+
+                    /*           test for roundof error and eventually */
+                    /*           set error flag. */
+
+                    if (iroff1 + iroff2 >= 10 || iroff3 >= 20)
+                    {
+                        ier = 2;
+                    }
+                    if (iroff2 >= 5)
+                    {
+                        ierro = 3;
+                    }
+
+                    /*           set error flag in the case that the number o */
+                    /*           subintervals equals limit. */
+
+                    if (last == limit)
+                    {
+                        ier = 1;
+                    }
+
+                    /*           set error flag in the case o bad integrand behaviour */
+                    /*           at some points o the integration range. */
+
+                    double alpha = Math.Max(Math.Abs(a1), Math.Abs(b2));
+                    double beta = (epmach * 100.0 + 1.0) * (Math.Abs(a2) + uflow * 1e3);
+                    if (alpha <= beta)
+                    {
+                        ier = 4;
+                    }
+
+                    /*           append the newly-created intervals to the list. */
+
+                    if (error2 > error1)
+                    {
+                        goto L20;
+                    }
+                    alist__[last] = a2;
+                    blist[maxerr] = b1;
+                    blist[last] = b2;
+                    elist[maxerr] = error1;
+                    elist[last] = error2;
+                    goto L30;
+                L20:
+                    alist__[maxerr] = a2;
+                    alist__[last] = a1;
+                    blist[last] = b1;
+                    rlist[maxerr] = area2;
+                    rlist[last] = area1;
+                    elist[maxerr] = error2;
+                    elist[last] = error1;
+
+                /*           call subroutine qpsrt to maintain the descending ordering */
+                /*           in the list o error estimates and select the */
+                /*           subinterval with nrmax-th largest error estimate (to be */
+                /*           bisected next). */
+
+            L30:
+                    qpsrt_(ref limit, ref last, ref maxerr, ref errmax,
+                        &elist[1], &iord[1], ref nrmax);
+
+                    if (errsum <= errbnd)
+                    {
+                        goto L115;
+                    }
+                    if (ier != 0)
+                    {
+                        goto L100;
+                    }
+                    if (last == 2)
+                    {
+                        goto L80;
+                    }
+                    if (noext)
+                    {
+                        goto L90;
+                    }
+
+                    erlarg -= erlast;
+
+                    if (Math.Abs(b1 - a1) > small)
+                    {
+                        erlarg += erro12;
+                    }
+                    if (extrap)
+                    {
+                        goto L40;
+                    }
+
+                    /*           test whether the interval to be bisected next is the */
+                    /*           smallest interval. */
+
+                    if (Math.Abs(blist[maxerr] - alist__[maxerr]) > small)
+                    {
+                        goto L90;
+                    }
+                    extrap = true;
+                    nrmax = 2;
+                L40:
+                    if (ierro == 3 || erlarg <= ertest)
+                    {
+                        goto L60;
+                    }
+
+                    /*           the smallest interval has the largest error. */
+                    /*           beforef bisecting decrease the sum o the errors */
+                    /*           over the larger intervals (erlarg) and perform */
+                    /*           extrapolation. */
+
+                    id = nrmax;
+                    jupbnd = last;
+                    if (last > limit / 2 + 2)
+                    {
+                        jupbnd = limit + 3 - last;
+                    }
+                    i__2 = jupbnd;
+                    for (k = id; k <= i__2; ++k)
+                    {
+                        maxerr = iord[nrmax];
+                        errmax = elist[maxerr];
+                        if ((Math.Abs(blist[maxerr] - alist__[maxerr])) > small)
+                        {
+                            goto L90;
+                        }
+                        ++nrmax;
+                        /* L50: */
+                    }
+
+            /*           perform extrapolation. */
+
+            L60:
+                    ++numrl2;
+
+                    System.Diagnostics.Debug.Assert(numrl2 > 1);
+
+                    rlist2[numrl2 - 1] = area;
+                    qelg_(ref numrl2, rlist2, ref reseps, ref abseps, res3la, ref nres);
+
+                    ++ktmin;
+
+                    if (ktmin > 5 && abserr < errsum * .001)
+                    {
+                        ier = 5;
+                    }
+                    if (abseps >= abserr)
+                    {
+                        goto L70;
+                    }
+
+                    ktmin = 0;
+                    abserr = abseps;
+                    result = reseps;
+                    correc = erlarg;
+
+                    ertest = Math.Max(epsabs, epsrel * Math.Abs(reseps));
+
+                    if (abserr <= ertest)
+                    {
+                        goto L100;
+                    }
+
+            /*            preparef bisection o the smallest interval. */
+
+            L70:
+                    if (numrl2 == 1)
+                    {
+                        noext = true;
+                    }
+                    if (ier == 5)
+                    {
+                        goto L100;
+                    }
+                    maxerr = iord[1];
+                    errmax = elist[maxerr];
+                    nrmax = 1;
+                    extrap = false;
+                    small *= .5;
+                    erlarg = errsum;
+                    goto L90;
+                L80:
+                    small = .375;
+                    erlarg = errsum;
+                    ertest = errbnd;
+                    rlist2[1] = area;
+                L90:
+                    ;
+                }
+
+        /*           set final result and error estimate. */
+            /*           ------------------------------------ */
+
+        L100:
+                if (abserr == oflow)
+                {
+                    goto L115;
+                }
+                if (ier + ierro == 0)
+                {
+                    goto L110;
+                }
+                if (ierro == 3)
+                {
+                    abserr += correc;
+                }
+                if (ier == 0)
+                {
+                    ier = 3;
+                }
+                if (result != 0.0 && area != 0.0)
+                {
+                    goto L105;
+                }
+                if (abserr > errsum)
+                {
+                    goto L115;
+                }
+                if (area == 0.0)
+                {
+                    goto L130;
+                }
+                goto L110;
+            L105:
+                if (abserr / Math.Abs(result) > errsum / Math.Abs(area))
+                {
+                    goto L115;
+                }
+
+        /*           test on divergence */
+
+        L110:
+                /* Computing MAX */
+                if (ksgn == -1 && Math.Max(Math.Abs(result), Math.Abs(area)) <= defabs * 0.01)
+                {
+                    goto L130;
+                }
+                if (0.01 > result / area || result / area > 100.0 || errsum > Math.Abs(area)
+                    )
+                {
+                    ier = 6;
+                }
                 goto L130;
-            }
-
-            /*           initialization */
-            /*           -------------- */
-
-            uflow = Single.MinValue;
-            oflow = Single.MaxValue;
-            rlist2[0] = result;
-            errmax = abserr;
-            maxerr = 1;
-            area = result;
-            errsum = abserr;
-            abserr = oflow;
-            nrmax = 1;
-            nres = 0;
-            ktmin = 0;
-            numrl2 = 2;
-            extrap = false;
-            noext = false;
-            ierro = 0;
-            iroff1 = 0;
-            iroff2 = 0;
-            iroff3 = 0;
-            ksgn = -1;
-            if (dres >= (1.0 - epmach * 50.0) * defabs)
-            {
-                ksgn = 1;
-            }
-
-            /*           main do-loop */
-            /*           ------------ */
-
-            i__1 = limit;
-            for (last = 2; last <= i__1; ++last)
-            {
-
-                /*           bisect the subinterval with nrmax-th largest */
-                /*           error estimate. */
-
-                a1 = alist__[maxerr];
-                b1 = (alist__[maxerr] + blist[maxerr]) * .5;
-                a2 = b1;
-                b2 = blist[maxerr];
-                erlast = errmax;
-
-                qk15i_(f, ref boun, ref inf, a1, b1, ref area1,
-                    ref error1, ref resabs, ref defab1);
-
-                qk15i_(f, ref boun, ref inf, a2, b2, ref area2,
-                    ref error2, ref resabs, ref defab2);
-
-                /*           improve previous approximations to integral */
-                /*           and error and test for accuracy. */
-
-                area12 = area1 + area2;
-                erro12 = error1 + error2;
-                errsum = errsum + erro12 - errmax;
-                area = area + area12 - rlist[maxerr];
-                if (defab1 == error1 || defab2 == error2)
-                {
-                    goto L15;
-                }
-                if ((Math.Abs(rlist[maxerr] - area12)) > Math.Abs(area12) * 1e-5 || erro12 < errmax * 0.99)
-                {
-                    goto L10;
-                }
-                if (extrap)
-                {
-                    ++iroff2;
-                }
-                if (!extrap)
-                {
-                    ++iroff1;
-                }
-            L10:
-                if (last > 10 && erro12 > errmax)
-                {
-                    ++iroff3;
-                }
-            L15:
-                rlist[maxerr] = area1;
-                rlist[last] = area2;
-                errbnd = Math.Max(epsabs, epsrel * Math.Abs(area));
-
-                /*           test for roundof error and eventually */
-                /*           set error flag. */
-
-                if (iroff1 + iroff2 >= 10 || iroff3 >= 20)
-                {
-                    ier = 2;
-                }
-                if (iroff2 >= 5)
-                {
-                    ierro = 3;
-                }
-
-                /*           set error flag in the case that the number o */
-                /*           subintervals equals limit. */
-
-                if (last == limit)
-                {
-                    ier = 1;
-                }
-
-                /*           set error flag in the case o bad integrand behaviour */
-                /*           at some points o the integration range. */
-
-                double alpha = Math.Max(Math.Abs(a1), Math.Abs(b2));
-                double beta = (epmach * 100.0 + 1.0) * (Math.Abs(a2) + uflow * 1e3);
-                if (alpha <= beta)
-                {
-                    ier = 4;
-                }
-
-                /*           append the newly-created intervals to the list. */
-
-                if (error2 > error1)
-                {
-                    goto L20;
-                }
-                alist__[last] = a2;
-                blist[maxerr] = b1;
-                blist[last] = b2;
-                elist[maxerr] = error1;
-                elist[last] = error2;
-                goto L30;
-            L20:
-                alist__[maxerr] = a2;
-                alist__[last] = a1;
-                blist[last] = b1;
-                rlist[maxerr] = area2;
-                rlist[last] = area1;
-                elist[maxerr] = error2;
-                elist[last] = error1;
-
-        /*           call subroutine qpsrt to maintain the descending ordering */
-            /*           in the list o error estimates and select the */
-            /*           subinterval with nrmax-th largest error estimate (to be */
-            /*           bisected next). */
-
-        L30:
-                qpsrt_(ref limit, ref last, ref maxerr, ref errmax,
-                    &elist[1], &iord[1], ref nrmax);
-
-                if (errsum <= errbnd)
-                {
-                    goto L115;
-                }
-                if (ier != 0)
-                {
-                    goto L100;
-                }
-                if (last == 2)
-                {
-                    goto L80;
-                }
-                if (noext)
-                {
-                    goto L90;
-                }
-
-                erlarg -= erlast;
-
-                if (Math.Abs(b1 - a1) > small)
-                {
-                    erlarg += erro12;
-                }
-                if (extrap)
-                {
-                    goto L40;
-                }
-
-                /*           test whether the interval to be bisected next is the */
-                /*           smallest interval. */
-
-                if (Math.Abs(blist[maxerr] - alist__[maxerr]) > small)
-                {
-                    goto L90;
-                }
-                extrap = true;
-                nrmax = 2;
-            L40:
-                if (ierro == 3 || erlarg <= ertest)
-                {
-                    goto L60;
-                }
-
-                /*           the smallest interval has the largest error. */
-                /*           beforef bisecting decrease the sum o the errors */
-                /*           over the larger intervals (erlarg) and perform */
-                /*           extrapolation. */
-
-                id = nrmax;
-                jupbnd = last;
-                if (last > limit / 2 + 2)
-                {
-                    jupbnd = limit + 3 - last;
-                }
-                i__2 = jupbnd;
-                for (k = id; k <= i__2; ++k)
-                {
-                    maxerr = iord[nrmax];
-                    errmax = elist[maxerr];
-                    if ((Math.Abs(blist[maxerr] - alist__[maxerr])) > small)
-                    {
-                        goto L90;
-                    }
-                    ++nrmax;
-                    /* L50: */
-                }
-
-        /*           perform extrapolation. */
-
-        L60:
-                ++numrl2;
-                rlist2[numrl2 - 1] = area;
-                qelg_(ref numrl2, rlist2, ref reseps, ref abseps, res3la, ref nres);
-
-                ++ktmin;
-
-                if (ktmin > 5 && abserr < errsum * .001)
-                {
-                    ier = 5;
-                }
-                if (abseps >= abserr)
-                {
-                    goto L70;
-                }
-
-                ktmin = 0;
-                abserr = abseps;
-                result = reseps;
-                correc = erlarg;
-
-                ertest = Math.Max(epsabs, epsrel * Math.Abs(reseps));
-
-                if (abserr <= ertest)
-                {
-                    goto L100;
-                }
-
-        /*            preparef bisection o the smallest interval. */
-
-        L70:
-                if (numrl2 == 1)
-                {
-                    noext = true;
-                }
-                if (ier == 5)
-                {
-                    goto L100;
-                }
-                maxerr = iord[1];
-                errmax = elist[maxerr];
-                nrmax = 1;
-                extrap = false;
-                small *= .5;
-                erlarg = errsum;
-                goto L90;
-            L80:
-                small = .375;
-                erlarg = errsum;
-                ertest = errbnd;
-                rlist2[1] = area;
-            L90:
-                ;
-            }
-
-        /*           set final result and error estimate. */
-        /*           ------------------------------------ */
-
-        L100:
-            if (abserr == oflow)
-            {
-                goto L115;
-            }
-            if (ier + ierro == 0)
-            {
-                goto L110;
-            }
-            if (ierro == 3)
-            {
-                abserr += correc;
-            }
-            if (ier == 0)
-            {
-                ier = 3;
-            }
-            if (result != 0.0 && area != 0.0)
-            {
-                goto L105;
-            }
-            if (abserr > errsum)
-            {
-                goto L115;
-            }
-            if (area == 0.0)
-            {
-                goto L130;
-            }
-            goto L110;
-        L105:
-            if (abserr / Math.Abs(result) > errsum / Math.Abs(area))
-            {
-                goto L115;
-            }
-
-        /*           test on divergence */
-
-        L110:
-            /* Computing MAX */
-            if (ksgn == -1 && Math.Max(Math.Abs(result), Math.Abs(area)) <= defabs * 0.01)
-            {
-                goto L130;
-            }
-            if (0.01 > result / area || result / area > 100.0 || errsum > Math.Abs(area)
-                )
-            {
-                ier = 6;
-            }
-            goto L130;

         /*           compute global integral sum. */

         L115:
-            result = 0.0;
-            for (k = 1; k <= last; ++k)
-            {
-                result += rlist[k];
-                /* L120: */
-            }
-            abserr = errsum;
-        L130:
-            neval = last * 30 - 15;
-            if (inf == 2)
-            {
-                neval <<= 1;
-            }
-            if (ier > 2)
-            {
-                --(ier);
+                result = 0.0;
+                for (k = 1; k <= last; ++k)
+                {
+                    result += rlist[k];
+                    /* L120: */
+                }
+                abserr = errsum;
+            L130:
+                neval = last * 30 - 15;
+                if (inf == 2)
+                {
+                    neval <<= 1;
+                }
+                if (ier > 2)
+                {
+                    --(ier);
+                }
             }

             return 0;
@@ -943,12 +1016,19 @@
             oflow = Single.MaxValue;
             ++(nres);
             abserr = oflow;
+
+            System.Diagnostics.Debug.Assert(n > 0 && n < 52);
+
             result = epstab[n];
             if (n < 3)
             {
                 goto L100;
             }
             limexp = 50;
+
+            System.Diagnostics.Debug.Assert(n > 0 && n < 52);
+            System.Diagnostics.Debug.Assert(n + 2 > 0 && n + 2 < 52);
+
             epstab[n + 2] = epstab[n];
             newelm = (n - 1) / 2;
             epstab[n] = oflow;
@@ -959,6 +1039,10 @@
                 k2 = k1 - 1;
                 k3 = k1 - 2;
                 res = epstab[k1 + 2];
+
+                System.Diagnostics.Debug.Assert(k3 > 0 && k3 < 52);
+                System.Diagnostics.Debug.Assert(k2 > 0 && k2 < 52);
+
                 e0 = epstab[k3];
                 e1 = epstab[k2];
                 e2 = res;
@@ -984,6 +1068,9 @@
                 /* ***jump out o do-loop */
                 goto L100;
             L10:
+
+                System.Diagnostics.Debug.Assert(k1 > 0 && k1 < 52);
+
                 e3 = epstab[k1];
                 epstab[k1] = e1;
                 delta1 = e1 - e3;
@@ -1018,6 +1105,9 @@

                 L30:
                 res = e1 + 1.0 / ss;
+
+                System.Diagnostics.Debug.Assert(k1 > 0 && k1 < 52);
+
                 epstab[k1] = res;
                 k1 += -2;
                 error = err2 + Math.Abs(res - e2) + err3;
@@ -1048,6 +1138,10 @@
             for (i__ = 1; i__ <= i__1; ++i__)
             {
                 ib2 = ib + 2;
+
+                System.Diagnostics.Debug.Assert(ib > 0 && ib < 52);
+                System.Diagnostics.Debug.Assert(ib2 > 0 && ib2 < 52);
+
                 epstab[ib] = epstab[ib2];
                 ib = ib2;
                 /* L60: */
@@ -1059,6 +1153,9 @@
             indx = num - n + 1;
             for (i__ = 1; i__ <= n; ++i__)
             {
+                System.Diagnostics.Debug.Assert(i__ > 0 && i__ < 52);
+                System.Diagnostics.Debug.Assert(indx > 0 && indx < 52);
+
                 epstab[i__] = epstab[indx];
                 ++indx;
                 /* L70: */
@@ -1068,6 +1165,9 @@
             {
                 goto L90;
             }
+
+            System.Diagnostics.Debug.Assert(nres > 0 && nres < 4);
+
             res3la[nres] = result;
             abserr = oflow;
             goto L100;
@@ -1114,83 +1214,94 @@
             /* Local variables */
             int j;
             double fc;
-            double* fv1 = stackalloc double[7];
-            double* fv2 = stackalloc double[7];
-            double absc, din, resg, resk, fsum, absc1;
-            double absc2, fval1, fval2, hlgth, centr, reskh, uflow;
-            double tabsc1, tabsc2, epmach;
-
-
-            /* ***first executable statement  qk15i */
-            epmach = Constants.SingleEpsilon;
-            uflow = Single.MinValue;
-            din = Math.Min(1, inf);
-
-            centr = (a + b) * .5;
-            hlgth = (b - a) * .5;
-            tabsc1 = boun + din * (1.0 - centr) / centr;
-            fval1 = f(tabsc1);
-
-            if (inf == 2)
-                fval1 += f(-tabsc1);
-
-            fc = fval1 / centr / centr;
-
-            /*           compute the 15-point kronrod approximation to */
-            /*           the integral, and estimate the error. */
-
-            resg = wg[7] * fc;
-            resk = wgk[7] * fc;
-            resabs = Math.Abs(resk);
-            for (j = 1; j <= 7; ++j)
-            {
-                absc = hlgth * xgk[j - 1];
-                absc1 = centr - absc;
-                absc2 = centr + absc;
-                tabsc1 = boun + din * (1.0 - absc1) / absc1;
-                tabsc2 = boun + din * (1.0 - absc2) / absc2;
+            double[] fv1_ = new double[7 + 1];
+            double[] fv2_ = new double[7 + 1];
+
+            fixed (double* fv1 = fv1_)
+            fixed (double* fv2 = fv2_)
+            {
+                double absc, din, resg, resk, fsum, absc1;
+                double absc2, fval1, fval2, hlgth, centr, reskh, uflow;
+                double tabsc1, tabsc2, epmach;
+
+
+                /* ***first executable statement  qk15i */
+                epmach = Constants.SingleEpsilon;
+                uflow = Single.MinValue;
+                din = Math.Min(1, inf);
+
+                centr = (a + b) * .5;
+                hlgth = (b - a) * .5;
+                tabsc1 = boun + din * (1.0 - centr) / centr;
                 fval1 = f(tabsc1);
-                fval2 = f(tabsc2);
+
                 if (inf == 2)
-                {
                     fval1 += f(-tabsc1);
-                }
-                if (inf == 2)
-                {
-                    fval2 += f(-tabsc2);
-                }
-                fval1 = fval1 / absc1 / absc1;
-                fval2 = fval2 / absc2 / absc2;
-                fv1[j - 1] = fval1;
-                fv2[j - 1] = fval2;
-                fsum = fval1 + fval2;
-                resg += wg[j - 1] * fsum;
-                resk += wgk[j - 1] * fsum;
-                resabs += wgk[j - 1] * (Math.Abs(fval1) + Math.Abs(fval2));
-                /* L10: */
-            }
-            reskh = resk * .5;
-            resasc = wgk[7] * Math.Abs(fc - reskh);
-            for (j = 1; j <= 7; ++j)
-            {
-                resasc += wgk[j - 1] * (Math.Abs(fv1[j - 1] - reskh)
-                    + Math.Abs(fv2[j - 1] - reskh));
-                /* L20: */
-            }
-            result = resk * hlgth;
-            resasc *= hlgth;
-            resabs *= hlgth;
-            abserr = Math.Abs((resk - resg) * hlgth);
-
-            if (resasc != 0.0 && abserr != 0.0)
-            {
-                abserr = resasc * Math.Min(1.0, Math.Pow((abserr * 200.0 / resasc), 1.5));
-            }
-
-            if (resabs > uflow / (epmach * 50.0))
-            {
-                abserr = Math.Max(epmach * 50.0 * resabs, abserr);
-            }
+
+                fc = fval1 / centr / centr;
+
+                /*           compute the 15-point kronrod approximation to */
+                /*           the integral, and estimate the error. */
+
+                resg = wg[7] * fc;
+                resk = wgk[7] * fc;
+                resabs = Math.Abs(resk);
+                for (j = 1; j <= 7; ++j)
+                {
+                    absc = hlgth * xgk[j - 1];
+                    absc1 = centr - absc;
+                    absc2 = centr + absc;
+                    tabsc1 = boun + din * (1.0 - absc1) / absc1;
+                    tabsc2 = boun + din * (1.0 - absc2) / absc2;
+                    fval1 = f(tabsc1);
+                    fval2 = f(tabsc2);
+                    if (inf == 2)
+                    {
+                        fval1 += f(-tabsc1);
+                    }
+                    if (inf == 2)
+                    {
+                        fval2 += f(-tabsc2);
+                    }
+                    fval1 = fval1 / absc1 / absc1;
+                    fval2 = fval2 / absc2 / absc2;
+
+                    System.Diagnostics.Debug.Assert(j > 0);
+
+                    fv1[j - 1] = fval1;
+                    fv2[j - 1] = fval2;
+                    fsum = fval1 + fval2;
+                    resg += wg[j - 1] * fsum;
+                    resk += wgk[j - 1] * fsum;
+                    resabs += wgk[j - 1] * (Math.Abs(fval1) + Math.Abs(fval2));
+                    /* L10: */
+                }
+                reskh = resk * .5;
+                resasc = wgk[7] * Math.Abs(fc - reskh);
+                for (j = 1; j <= 7; ++j)
+                {
+                    System.Diagnostics.Debug.Assert(j > 0);
+
+                    resasc += wgk[j - 1] * (Math.Abs(fv1[j - 1] - reskh)
+                        + Math.Abs(fv2[j - 1] - reskh));
+                    /* L20: */
+                }
+                result = resk * hlgth;
+                resasc *= hlgth;
+                resabs *= hlgth;
+                abserr = Math.Abs((resk - resg) * hlgth);
+
+                if (resasc != 0.0 && abserr != 0.0)
+                {
+                    abserr = resasc * Math.Min(1.0, Math.Pow((abserr * 200.0 / resasc), 1.5));
+                }
+
+                if (resabs > uflow / (epmach * 50.0))
+                {
+                    abserr = Math.Max(epmach * 50.0 * resabs, abserr);
+                }
+            }
+
             return 0;
         }


Improve logging test result for TeamCity #9 - fix report file create condition

--- Src/MvcPages/Reports/ErrorReport/TelluriumErrorReportBuilder.cs
+++ Src/MvcPages/Reports/ErrorReport/TelluriumErrorReportBuilder.cs
@@ -56,19 +56,20 @@
                 reportInitizlized = true;
                 if (ciAdapter.IsAvailable())
                 {
-                    ciAdapter.SetEnvironmentVariable(TelluriumReportVariableName, "true");
+                    ciAdapter.SetEnvironmentVariable(ReportVariableName, ReportyVariableVal);
                 }

             }
         }

-        private const string TelluriumReportVariableName = "TelluriumReportCreated";
+        private const string ReportVariableName = "TelluriumReportCreated";
+        private const string ReportyVariableVal = "true";

         private bool ShouldCreateReportFile()
         {
-            if (ciAdapter.IsAvailable() && ciAdapter.GetEnvironmentVariable(TelluriumReportVariableName) != "true")
+            if (ciAdapter.IsAvailable() && ciAdapter.GetEnvironmentVariable(ReportVariableName) == ReportyVariableVal)
             {
-                return true;
+                return false;
             }
             return File.Exists(ReportFilePath) == false || reportInitizlized == false;
         }


Add Roughness float values to MetalRoughMap.cs

--- UnityGLTF/Assets/UnityGLTF/Scripts/UniformMaps/MetalRoughMap.cs
+++ UnityGLTF/Assets/UnityGLTF/Scripts/UniformMaps/MetalRoughMap.cs
@@ -86,6 +86,12 @@
 			set { return; }
 		}

+		public override double RoughnessFactor
+		{
+			get { return _material.GetFloat("_Glossiness"); }
+			set { _material.SetFloat("_Glossiness", (float)value); }
+		}
+
 		public override IUniformMap Clone()
 		{
 			var copy = new MetalRoughMap(new Material(_material));


Packet size fix

Packet size fix

--- UnityProject/Assets/Scripts/Messages/Server/TabUpdateMessage.cs
+++ UnityProject/Assets/Scripts/Messages/Server/TabUpdateMessage.cs
@@ -1,7 +1,10 @@
+using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 using UnityEngine;
 using Mirror;
+using Random = UnityEngine.Random;

 public class TabUpdateMessage : ServerMessage
 {
@@ -15,10 +18,39 @@

 	private static readonly ElementValue[] NoValues = new ElementValue[0];

+	private static Dictionary<int, ElementValue[]> ElementValuesCache = new Dictionary<int, ElementValue[]>();
+	public int ID;
+	public int UniqueID;
+
 	public override void Process()
 	{
 		Logger.LogTraceFormat("Processed {0}", Category.NetUI, this);
 		LoadNetworkObject(Provider);
+
+		//If start or middle of message add to cache then stop
+		if (ID == 1)
+		{
+			if (ElementValuesCache.Count == 0 || !ElementValuesCache.ContainsKey(UniqueID))
+			{
+				ElementValuesCache.Add(UniqueID, ElementValues);
+				Debug.LogError("Id 0");
+				return;
+			}
+
+			ElementValuesCache[UniqueID] = Concat(ElementValuesCache[UniqueID], ElementValues);
+			Debug.LogError("Id 1");
+			return;
+		}
+
+		//If end of message add
+		if(ID == 2)
+		{
+			ElementValues = Concat(ElementValuesCache[UniqueID], ElementValues);
+			ElementValuesCache.Remove(UniqueID);
+			Debug.LogError("Id 2");
+		}
+
+
 		switch (Action)
 		{
 			case TabAction.Open:
@@ -55,60 +87,140 @@
 		ElementValue[] values = null)
 	{

-		if (values != null)
+		if (tabAction == TabAction.Open)
+		{
+			values = NetworkTabManager.Instance.Get(provider, type).ElementValues;
+		}
+
+		// SingleMessage: 0, start/middle: 1, end: 2
+		var id = 0;
+
+		var uniqueID = Random.Range(0, 2000);
+
+		if (ElementValuesCache.ContainsKey(uniqueID))
+		{
+			uniqueID = Random.Range(2001, 20000);
+		}
+
+		var elementValuesLists = new Dictionary<List<ElementValue>, int>();
+
+		if (values != null && tabAction != TabAction.Close)
 		{
 			// get max possible packet size from current transform
 			int maxPacketSize = Transport.activeTransport.GetMaxPacketSize(0);
 			// set currentSize start value to max TCP header size (60b)
-			int currentSize = 60;
-
-			List<ElementValue> elementValues = new List<ElementValue>();
+			float currentSize = 60f;
+
+			var elementValues = new List<ElementValue>();
+
+			var length = values.Length;
+
+			var totalSize = 0f;

 			foreach (var value in values)
 			{
-				currentSize += value.GetSize();
+				totalSize += value.GetSize();
+			}
+
+			var divisions = (int)Math.Ceiling(totalSize / maxPacketSize);
+
+			var currentDivision = 0;
+
+			for (var i = 0; i < length; i++)
+			{
+				currentSize += values[i].GetSize();

 				if (currentSize > maxPacketSize)
 				{
-					Logger.LogError("[TabUpdateMessage.Send] - message is to big to send in one packet", Category.NetMessage);
-					break;
+					currentDivision ++;
+					currentSize = 60f;
+
+					Debug.LogError($"currentdivision: {currentDivision}   Divisions: {divisions}");
+
+					id = 1;
+
+					if (currentDivision == divisions)
+					{
+						id = 2;
+					}
+
+					elementValuesLists.Add(elementValues, id);
+					elementValues = new List<ElementValue>();
 				}

-				elementValues.Add(value);
-			}
-
-			values = elementValues.ToArray();
-		}
-
-
-		var msg = new TabUpdateMessage
-		{
-			Provider = provider.NetId(),
-			Type = type,
-			Action = tabAction,
-			ElementValues = values,
-			Touched = changedBy != null
-		};
+				elementValues.Add(values[i]);
+			}
+
+			if (elementValuesLists.Count == 0)
+			{
+				values = elementValues.ToArray();
+			}
+			else if (currentDivision != divisions)
+			{
+				elementValuesLists.Add(elementValues, 2);
+			}
+		}
+
+
+
+		if (elementValuesLists.Count == 0)
+		{
+			Debug.LogError("=0 Id: " + id);
+			var msg = new TabUpdateMessage
+			{
+				Provider = provider.NetId(),
+				Type = type,
+				Action = tabAction,
+				ElementValues = values,
+				Touched = changedBy != null,
+				ID = id,
+				UniqueID = uniqueID
+			};
+
+			SendMessageOptions(recipient, provider, type, tabAction, msg);
+		}
+		else
+		{
+			foreach (var value in elementValuesLists)
+			{
+				Debug.LogError("!=0 Id: " + value.Value);
+				var msg = new TabUpdateMessage
+				{
+					Provider = provider.NetId(),
+					Type = type,
+					Action = tabAction,
+					ElementValues = value.Key.ToArray(),
+					Touched = changedBy != null,
+					ID = value.Value,
+					UniqueID = uniqueID
+				};
+
+				SendMessageOptions(recipient, provider, type, tabAction, msg);
+			}
+		}
+
+		return null;
+	}
+
+	public static void SendMessageOptions(GameObject recipient, GameObject provider, NetTabType type, TabAction tabAction,
+		TabUpdateMessage msg)
+	{
 		switch (tabAction)
 		{
 			case TabAction.Open:
 				NetworkTabManager.Instance.Add(provider, type, recipient);
-				//!! resetting ElementValues
-				msg.ElementValues = NetworkTabManager.Instance.Get(provider, type).ElementValues;
-				//!!
 				break;
 			case TabAction.Close:
 				NetworkTabManager.Instance.Remove(provider, type, recipient);
 				break;
 			case TabAction.Update:
-
 				//fixme: duplication of NetTab.ValidatePeepers
 				//Not sending updates and closing tab for players that don't pass the validation anymore
 				var validate = Validations.CanApply(recipient, provider, NetworkSide.Server);
 				if (!validate)
 				{
 					Send(recipient, provider, type, TabAction.Close);
-					return msg;
+					return;
 				}

 				break;
@@ -116,7 +228,19 @@

 		msg.SendTo(recipient);
 		Logger.LogTraceFormat("{0}", Category.NetUI, msg);
-		return msg;
+	}
+
+	//Merge arrays together
+	public static T[] Concat<T>(params T[][] arrays)
+	{
+		var result = new T[arrays.Sum(a => a.Length)];
+		int offset = 0;
+		for (int x = 0; x < arrays.Length; x++)
+		{
+			arrays[x].CopyTo(result, offset);
+			offset += arrays[x].Length;
+		}
+		return result;
 	}
 }

@@ -134,7 +258,7 @@
 	/// Get size of this object (in bytes)
 	/// </summary>
 	/// <returns>size of this object (in bytes)</returns>
-	public int GetSize()
+	public float GetSize()
 	{
 		return sizeof(char) * Id.Length		// Id
 			+ sizeof(byte) * Value.Length;	// Value


Fix broken unit tests

Fix broken unit tests

--- src/Umbraco.Tests/UmbracoExamine/IndexInitializer.cs
+++ src/Umbraco.Tests/UmbracoExamine/IndexInitializer.cs
@@ -45,7 +45,7 @@
         public static ContentIndexPopulator GetContentIndexRebuilder(PropertyEditorCollection propertyEditors, IContentService contentService, IScopeProvider scopeProvider, bool publishedValuesOnly)
         {
             var contentValueSetBuilder = GetContentValueSetBuilder(propertyEditors, scopeProvider, publishedValuesOnly);
-            var contentIndexDataSource = new ContentIndexPopulator(true, null, contentService, scopeProvider.SqlContext, contentValueSetBuilder);
+            var contentIndexDataSource = new ContentIndexPopulator(publishedValuesOnly, null, contentService, scopeProvider.SqlContext, contentValueSetBuilder);
             return contentIndexDataSource;
         }


Fix broken test.

Fix broken test.

--- src/WebApiContrib.Testing/ApiControllerExtensions.cs
+++ src/WebApiContrib.Testing/ApiControllerExtensions.cs
@@ -34,12 +34,10 @@
             var controllerTypeName = controller.GetType().Name;
             var controllerName = controllerTypeName.Substring(0, controllerTypeName.IndexOf("Controller")).ToLower();
             var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", controllerName } });
+            request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;
+            request.Properties[HttpPropertyKeys.HttpRouteDataKey] = routeData;
             controller.ControllerContext = new HttpControllerContext(config, routeData, request);
             controller.ControllerContext.ControllerDescriptor = new HttpControllerDescriptor(config, controllerName, controller.GetType());
-            controller.Request = request;
-            controller.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;
-            controller.Request.Properties[HttpPropertyKeys.HttpRouteDataKey] = routeData;
-            controller.RequestContext = new HttpRequestContext { Configuration = config, RouteData = routeData, Url = new UrlHelper(controller.Request) };
         }
     }
 }


Implemented IUserRoleStore

Implemented IUserRoleStore

--- AspNetCore.Identity.LiteDB/AspNetCore.Identity.LiteDB/LiteDbUserStore.cs
+++ AspNetCore.Identity.LiteDB/AspNetCore.Identity.LiteDB/LiteDbUserStore.cs
@@ -17,6 +17,7 @@
    [SuppressMessage("ReSharper", "UnusedMember.Global")]
    [SuppressMessage("ReSharper", "RedundantExtendsListEntry")]
    public class LiteDbUserStore<TUser> : IUserStore<TUser>,
+      IUserRoleStore<TUser>,
       IUserLoginStore<TUser>,
       IUserPasswordStore<TUser>,
       IUserClaimStore<TUser>,
@@ -474,7 +475,6 @@
          var updatedCodes = new List<string>(splitCodes.Where(s => s != code));
          await ReplaceCodesAsync(user, updatedCodes, cancellationToken);
          return true;
-
       }

       public async Task<int> CountCodesAsync(TUser user, CancellationToken cancellationToken)
@@ -755,19 +755,66 @@
          Dispose(true);
          GC.SuppressFinalize(this);
       }
+
       protected virtual void Dispose(bool disposing)
       {
          if (_disposed)
             return;

-         if (disposing)
-         {
-            _handle.Dispose();
-         }
+         if (disposing) _handle.Dispose();

          _disposed = true;
       }

+      #endregion
+
+      #region IUserRoleStore
+
+      public Task AddToRoleAsync(TUser user, string roleName, CancellationToken cancellationToken)
+      {
+         cancellationToken.ThrowIfCancellationRequested();
+         ThrowIfDisposed();
+         if (user == null) throw new ArgumentNullException(nameof(user));
+         if (roleName == null) throw new ArgumentNullException(nameof(roleName));
+         user.Roles.Add(roleName);
+         return Task.CompletedTask;
+      }
+
+      public Task RemoveFromRoleAsync(TUser user, string roleName, CancellationToken cancellationToken)
+      {
+         cancellationToken.ThrowIfCancellationRequested();
+         ThrowIfDisposed();
+         if (user == null) throw new ArgumentNullException(nameof(user));
+         if (roleName == null) throw new ArgumentNullException(nameof(roleName));
+         user.Roles.Remove(roleName);
+         return Task.CompletedTask;
+      }
+
+      public Task<IList<string>> GetRolesAsync(TUser user, CancellationToken cancellationToken)
+      {
+         cancellationToken.ThrowIfCancellationRequested();
+         ThrowIfDisposed();
+         if (user == null) throw new ArgumentNullException(nameof(user));
+         IList<string> result = user.Roles;
+         return Task.FromResult(result);
+      }
+
+      public Task<bool> IsInRoleAsync(TUser user, string roleName, CancellationToken cancellationToken)
+      {
+         cancellationToken.ThrowIfCancellationRequested();
+         ThrowIfDisposed();
+         if (user == null) throw new ArgumentNullException(nameof(user));
+         if (roleName == null) throw new ArgumentNullException(nameof(roleName));
+         return Task.FromResult(user.Roles.Contains(roleName));
+      }
+
+      public Task<IList<TUser>> GetUsersInRoleAsync(string roleName, CancellationToken cancellationToken)
+      {
+         cancellationToken.ThrowIfCancellationRequested();
+         ThrowIfDisposed();
+         if (roleName == null) throw new ArgumentNullException(nameof(roleName));
+         return Task.FromResult((IList<TUser>)_users.Find(u => u.Roles.Contains(roleName)).ToList());
+      }
       #endregion
    }
 }


Update move's y value

Update move's y value

--- Assets/Pear.InteractionEngine/Scripts/Interactions/EventHandlers/Move.cs
+++ Assets/Pear.InteractionEngine/Scripts/Interactions/EventHandlers/Move.cs
@@ -22,13 +22,10 @@
         {
             _properties.ForEach(p =>
             {
-				Vector3 moveVector = p.Value;
-				moveVector.y *= -1; // y is reversed because of the object is in front of us
-
                 p.Owner.transform.GetOrAddComponent<ObjectWithAnchor>()
                     .AnchorElement
                     .transform
-                    .position += moveVector * MoveSpeed * Time.deltaTime;
+                    .position += p.Value * MoveSpeed * Time.deltaTime;
             });
         }


Added test cases.

Added test cases.

--- AudioWorks/AudioWorks.Api.Tests/DataSources/ExportValidFileDataSource.cs
+++ AudioWorks/AudioWorks.Api.Tests/DataSources/ExportValidFileDataSource.cs
@@ -161,10 +161,80 @@
             },
             new object[]
             {
+                "FLAC Level 5 8-bit 8000Hz Stereo.flac",
+                "FLAC",
+                null,
+                "44AA2E52CED28503D02D51957B19DF74"
+            },
+            new object[]
+            {
+                "FLAC Level 5 16-bit 44100Hz Mono.flac",
+                "FLAC",
+                null,
+                "588ACB7827AF0D1A6A18751EEFEA3604"
+            },
+            new object[]
+            {
+                "FLAC Level 5 16-bit 44100Hz Stereo.flac",
+                "FLAC",
+                null,
+                "3983A342A074A7E8871FEF4FBE0AC73F"
+            },
+            new object[]
+            {
+                "FLAC Level 5 16-bit 48000Hz Stereo.flac",
+                "FLAC",
+                null,
+                "8A532C4C9D61AF027BC6F684C59FE9A6"
+            },
+            new object[]
+            {
+                "FLAC Level 5 24-bit 96000Hz Stereo.flac",
+                "FLAC",
+                null,
+                "4A4DE0494E31D82F446421C876FB10EA"
+            },
+            new object[]
+            {
                 "FLAC Level 5 16-bit 44100Hz Stereo (Tagged using defaults).flac",
                 "FLAC",
                 null,
                 "A6B18F2B4DDC51DC37154410E701251F"
+            },
+            new object[]
+            {
+                "ALAC 16-bit 44100Hz Mono.m4a",
+                "FLAC",
+                null,
+                "588ACB7827AF0D1A6A18751EEFEA3604"
+            },
+            new object[]
+            {
+                "ALAC 16-bit 44100Hz Stereo.m4a",
+                "FLAC",
+                null,
+                "3983A342A074A7E8871FEF4FBE0AC73F"
+            },
+            new object[]
+            {
+                "ALAC 16-bit 48000Hz Stereo.m4a",
+                "FLAC",
+                null,
+                "8A532C4C9D61AF027BC6F684C59FE9A6"
+            },
+            new object[]
+            {
+                "ALAC 24-bit 96000Hz Stereo.m4a",
+                "FLAC",
+                null,
+                "4A4DE0494E31D82F446421C876FB10EA"
+            },
+            new object[]
+            {
+                "ALAC 16-bit 44100Hz Stereo (Tagged).m4a",
+                "FLAC",
+                null,
+                "0EE0AF9261C48854D66957F1567256C9"
             },
             new object[]
             {


GitHub provider wasn't remembering the new optional Scope.

--- Code/WorldDomination.Web.Authentication.ExtraProviders/GitHubProvider.cs
+++ Code/WorldDomination.Web.Authentication.ExtraProviders/GitHubProvider.cs
@@ -13,6 +13,7 @@
         private const string TokenTypeKey = "token_type";
         private readonly string _clientId;
         private readonly string _clientSecret;
+        private IAuthenticationServiceSettings _defaultAuthenticationServiceSettings;

         public GitHubProvider(ProviderParams providerParams)
         {
@@ -164,7 +165,8 @@

         public IAuthenticationServiceSettings DefaultAuthenticationServiceSettings
         {
-            get { return new GitHubAuthenticationServiceSettings(); }
+            get { return _defaultAuthenticationServiceSettings ??
+                (_defaultAuthenticationServiceSettings = new GitHubAuthenticationServiceSettings()); }
         }

         public Uri RedirectToAuthenticate(IAuthenticationServiceSettings authenticationServiceSettings)
@@ -185,8 +187,10 @@

             var oauthDialogUri =
                 string.Format(
-                    "https://github.com/login/oauth/authorize?client_id={0}&scope=" + ((GitHubAuthenticationServiceSettings)DefaultAuthenticationServiceSettings).Scope + "&redirect_uri={1}&response_type=code{2}",
-                    _clientId, authenticationServiceSettings.CallBackUri.AbsoluteUri, state);
+                    "https://github.com/login/oauth/authorize?client_id={0}&scope={1}&redirect_uri={2}&response_type=code{3}",
+                    _clientId,
+                    ((GitHubAuthenticationServiceSettings)DefaultAuthenticationServiceSettings).Scope,
+                    authenticationServiceSettings.CallBackUri.AbsoluteUri, state);

             return new Uri(oauthDialogUri);
         }


CCI - 2608 DeleteReIpAddressRules in the interface

--- ComputeClient/Compute.Client/Interfaces/Drs/IConsistencyGroupAccessor.cs
+++ ComputeClient/Compute.Client/Interfaces/Drs/IConsistencyGroupAccessor.cs
@@ -42,6 +42,13 @@
 		/// <param name="setDrsReIpAddressRules">Drs Target Server Re-IP details</param>
 		/// <returns>The <see cref="ResponseType"/></returns>
 		Task<ResponseType> SetDrsReIpAddressRules(SetDrsReIpAddressRulesType setDrsReIpAddressRules);
+
+		/// <summary>
+		/// The purpose of this API is to allow a customer user to Delete the Re-IP Address Rules associated with a Consistency Group Server Pair.
+		/// </summary>
+		/// <param name="drsServerPairIdType"></param>
+		/// <returns>The <see cref="ResponseType"/></returns>
+		Task<ResponseType> DeleteReIpAddressRules(DrsServerPairIdType drsServerPairIdType);

 		/// <summary>
 		/// The Create Consistency Group


Search current directory and executing assembly directory for data intakes

--- Devices/Gateways/GatewayService/Gateway/Utils/Loader/DataIntakeLoader.cs
+++ Devices/Gateways/GatewayService/Gateway/Utils/Loader/DataIntakeLoader.cs
@@ -4,6 +4,8 @@
 using Gateway.DataIntake;
 using Gateway.Utils.Logger;
 using SharedInterfaces;
+using System.IO;
+using System.Diagnostics;

 namespace Gateway.Utils.Loader
 {
@@ -22,27 +24,97 @@
                 throw new ArgumentException("List of DataIntake sources could be empty but not null");
             }

-            // enumerate all types with a IDataIntake interface
-            var nameTypeDict = new Dictionary<string, Type>();
-            foreach(string s in sources)
+            if ( sources.Count == 0 )
+            {
+                return;
+            }
+
+            //
+            // enumerate all types with a IDataIntake interface look in the current directory, in the
+            // running assembly directory and in the entry and executing assembly
+            //
+            var directories = new List<String>( );
+            directories.Add( Directory.GetCurrentDirectory( ) );
+            var di1 = Path.GetDirectoryName( Assembly.GetEntryAssembly( ).Location );
+            var di2 = Path.GetDirectoryName( Assembly.GetCallingAssembly( ).Location );
+            var di3 = Path.GetDirectoryName( Assembly.GetExecutingAssembly( ).Location );
+
+            // do not dupiclate search paths
+            if ( !directories.Contains( di1 ) )
+            {
+                directories.Add( di1 );
+            }
+            if ( !directories.Contains( di2 ) )
+            {
+                directories.Add( di2);
+            }
+            if ( !directories.Contains( di3 ) )
+            {
+                directories.Add( di3 );
+            }
+
+            // try and load assemblies from path
+            var nameTypeDict = new Dictionary<string, Type>( );
+            foreach ( string s in sources )
             {
                 try
                 {
-                    Assembly ass = Assembly.LoadFrom(s);
+                    Assembly assm = null;
+                    // try path from config first
+                    if ( File.Exists( s ) )
+                    {
+                        assm = Assembly.LoadFrom( s );

-                    foreach (Type t in ass.GetExportedTypes())
+                        // remember this directory as a potential source
+                        var lastDir = Path.GetDirectoryName( s );
+                        if ( !directories.Contains( lastDir ) )
+                        {
+                            directories.Add( lastDir );
+                        }
+                    }
+                    else
+                    {
+                        // try the other directories
+                        foreach(var d in directories)
+                        {
+                            var assmName =  Path.GetFileName( s );
+
+                            // try again
+                            string assmPath = Path.Combine( d, assmName );
+                            if ( File.Exists( s ) )
+                            {
+                                assm = Assembly.LoadFrom( s );
+                            }
+                        }
+
+                        if(assm == null)
+                        {
+                            // Log that we did not load our data sources correctly
+                            string allSources = "";
+                            foreach(var src in sources)
+                            {
+                                allSources += s + ";";
+                            }
+
+                            _Logger.LogError( String.Format( "Following data intakes were specificied, but could not be loaded: {0}", allSources ) );
+                        }
+                    }
+
+                    Debug.Assert( assm != null);
+
+                    foreach ( Type t in assm.GetExportedTypes( ) )
                     {
                         //Get all classes that implement the required interface
-                        if (t.GetInterface("IDataIntake", false) != null)
+                        if ( t.GetInterface( "IDataIntake", false ) != null )
                         {
-                            nameTypeDict.Add(t.Name, t); //Add to Dictonary
+                            nameTypeDict.Add( t.Name, t ); //Add to Dictonary
                         }
                     }
                 }
-                catch (Exception ex)
+                catch ( Exception ex )
                 {
                     //dont want to stop loading another modules if one fails
-                    _Logger.LogError(String.Format("Exception on loading DataIntake {0}: {1}", s, ex.Message));
+                    _Logger.LogError( String.Format( "Exception on loading DataIntake {0}: {1}", s, ex.Message ) );
                 }
             }

@@ -53,7 +125,9 @@
                     DataIntakeAbstract di = (DataIntakeAbstract)Activator.CreateInstance(t.Value, new object[] { _Logger });

                     if( di != null )
+                    {
                         _DataIntakes.Add(di);
+                    }
                 }
                 catch (Exception ex)
                 {


Adding more exception logging

Adding more exception logging

Adding some more exception logging.

--- DatabaseQuery/QueryNode.cs
+++ DatabaseQuery/QueryNode.cs
@@ -182,8 +182,9 @@
                 {
                     ProcessDataOperation(dataOperation, message);
                 }
-                catch
-                {
+                catch (Exception e)
+                {
+                    Logger.Log(e.Message + "\nStackTrace:" + e.StackTrace, LogLevel.Error);
                     SendMessage(new Message(message, new DataOperationResult(ErrorCodes.FailedMessage, "An exception occurred while processing the operation."), false));
                 }
             }


Ensure that we properly register non-public properties

--- src/ObjCRuntime/Class.cs
+++ src/ObjCRuntime/Class.cs
@@ -212,10 +212,10 @@
 			if (ea == null)
 				return;

-			var m = prop.GetGetMethod ();
+			var m = prop.GetGetMethod (true);
 			if (m != null)
 				RegisterMethod (m, ea.ToGetter (prop), type, k, handle);
-			m = prop.GetSetMethod ();
+			m = prop.GetSetMethod (true);
 			if (m != null)
 				RegisterMethod (m, ea.ToSetter (prop), type, k, handle);
 		}


Fixed type mismatch

Fixed type mismatch

--- src/PowerPing/Display.cs
+++ src/PowerPing/Display.cs
@@ -88,7 +88,7 @@
         private static CursorPosition perComplPos = new CursorPosition(0, 0);

         // Used to work out pings per second during ping flooding
-        private static long sentPings = 0;
+        private static ulong sentPings = 0;

         /// <summary>
         /// Displays current version number and build date


[Fix]修正图文回复信息错误的问题

[Fix]修正图文回复信息错误的问题

--- Wing.WeiXin.MP.SDK/Entities/ReturnMessages/ReturnMessageNews.cs
+++ Wing.WeiXin.MP.SDK/Entities/ReturnMessages/ReturnMessageNews.cs
@@ -22,7 +22,7 @@
         /// <summary>
         /// 多条图文消息信息，默认第一个item为大图,注意，如果图文数超过10，则将会无响应
         /// </summary>
-        public List<item> item { get; set; }
+        public List<item> Articles { get; set; }

         #region 实例化空数据回复图文消息 public ReturnMessageNews()
         /// <summary>
@@ -42,6 +42,7 @@
         /// <param name="entity">接收的实体</param>
         public ReturnMessageNews(List<item> item, BaseEntity entity)
         {
+            if (item == null || entity == null) throw new ArgumentNullException();
             MsgType = "news";
             FromUserName = entity.ToUserName;
             ToUserName = entity.FromUserName;


Renames tests assembly title to match project name.

--- magic_tests_project_name_magic/Properties/AssemblyInfo.cs
+++ magic_tests_project_name_magic/Properties/AssemblyInfo.cs
@@ -1,7 +1,7 @@
 using System.Reflection;

-[assembly: AssemblyTitle("magic_tests_project_title_magic")]
-[assembly: AssemblyDescription("magic_tests_project_description_magic")]
+[assembly: AssemblyTitle("magic_tests_project_name_magic")]
+[assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("magic_company_name_magic")]
 [assembly: AssemblyProduct("magic_product_name_magic")]


added namespace to route

added namespace to route

--- Zone.UmbracoPersonalisationGroups.Common/Routing/RouteConfig.cs
+++ Zone.UmbracoPersonalisationGroups.Common/Routing/RouteConfig.cs
@@ -30,7 +30,7 @@
             routes.MapRoute(
                 name: "Member methods",
                 url: "App_Plugins/UmbracoPersonalisationGroups/Member/{action}",
-                defaults: new { controller = "Member", action = "Index" });
+                defaults: new { controller = "Member", action = "Index" }, new[] { "Zone.UmbracoPersonalisationGroups.Controllers" });

             routes.MapRoute(
                 name: "Geo location methods",


Hopefully this is a bit better

Hopefully this is a bit better

--- GameServer/Logic/Packets/PacketHandlers/Handlers/HandleChatBoxMessage.cs
+++ GameServer/Logic/Packets/PacketHandlers/Handlers/HandleChatBoxMessage.cs
@@ -12,26 +12,37 @@
 {
     class HandleChatBoxMessage : IPacketHandler
     {
-        void SendDebugMsgFormatted(int type, string message)
-        {
+        enum DebugMsgType {ERROR, INFO, SYNTAX, SYNTAXERROR, NORMAL};
+
+        void SendDebugMsgFormatted(DebugMsgType type, string message = "")
+        {
             var formattedText = new StringBuilder();
-            int fontSize = 20;
+            int fontSize = 20; // Big fonts seem to make the chatbox buggy
+                               // This may need to be removed.
             switch (type)
             {
-                case 0:
+                case DebugMsgType.ERROR: // Tag: [ERROR], Color: Red
                     formattedText.Append("[ERROR]: ");
                     formattedText.Append(message);
                     PacketNotifier.notifyDebugMessage(formattedText.ToString());
                     break;
-                case 1:
+                case DebugMsgType.INFO: // Tag: [INFO], Color: Green
                     formattedText.Append("[INFO]: ");
                     formattedText.Append(message);
                     PacketNotifier.notifyDebugMessage(formattedText.ToString());
                     break;
-                case 2:
+                case DebugMsgType.SYNTAX: // Tag: [SYNTAX], Color: Blue
                     formattedText.Append("[SYNTAX]: ");
                     formattedText.Append(message);
                     PacketNotifier.notifyDebugMessage(formattedText.ToString());
+                    break;
+                case DebugMsgType.SYNTAXERROR: // Tag: [ERROR], Color: Red
+                    formattedText.Append("[ERROR]: ");
+                    formattedText.Append("Incorrect command syntax");
+                    PacketNotifier.notifyDebugMessage(formattedText.ToString());
+                    break;
+                case DebugMsgType.NORMAL: // No tag, no format
+                    PacketNotifier.notifyDebugMessage(message);
                     break;
             }
         }
@@ -67,10 +78,10 @@
                         float gold;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".gold goldAmount"); // It might be better to replace this
-                            return true;                                  // in the future with something like
-                        }                                                 // ShowCommandSyntax();
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".gold goldAmount"); // It might be better to replace this
+                            return true;                                                    // in the future with something like
+                        }                                                                   // ShowCommandSyntax();

                         if (float.TryParse(split[1], out gold))
                             game.GetPeerInfo(peer).GetChampion().GetStats().Gold = gold;
@@ -79,8 +90,8 @@
                         float speed;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".speed movementSpeed");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".speed movementSpeed");
                             return true;
                         }
                         if (float.TryParse(split[1], out speed))
@@ -90,8 +101,8 @@
                         float hp;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".health healthAmount");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".health healthAmount");
                             return true;
                         }
                         if (float.TryParse(split[1], out hp))
@@ -106,8 +117,8 @@
                         float xp;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".xp xpAmount");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".xp xpAmount");
                             return true;
                         }
                         if (float.TryParse(split[1], out xp))
@@ -117,8 +128,8 @@
                         float ap;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".ap apAmount");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".ap apAmount");
                             return true;
                         }
                         if (float.TryParse(split[1], out ap))
@@ -128,8 +139,8 @@
                         float ad;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".ad adAmount");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".ad adAmount");
                             return true;
                         }
                         if (float.TryParse(split[1], out ad))
@@ -139,8 +150,8 @@
                         float mp;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".mana manaAmount");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".mana manaAmount");
                             return true;
                         }
                         if (float.TryParse(split[1], out mp))
@@ -154,15 +165,15 @@
                             game.getPeerInfo(peer).getChampion().setModel(split[1]);
                         else
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".model modelName");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".model modelName");
                             return true;
                         }
                         return true;
                     case ".help":
-                        SendDebugMsgFormatted(1, "List of available commands: ");
+                        SendDebugMsgFormatted(DebugMsgType.INFO, "List of available commands: ");
                         foreach (var cc in cmd)
-                            debugMsg.Append("
" + cc + "
, ");
+                            debugMsg.Append("" + cc + ", ");

                         var dm = new DebugMessage(debugMsg.ToString());
                         game.PacketHandlerManager.sendPacket(peer, dm, Channel.CHL_S2C);
@@ -174,8 +185,8 @@
                         float size;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".size size");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".size size");
                             return true;
                         }
                         if (float.TryParse(split[1], out size))
@@ -193,8 +204,8 @@
                         float lvl;
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".level level");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".level level");
                             return true;
                         }
                         if (float.TryParse(split[1], out lvl))
@@ -209,8 +220,8 @@
                         float x, y;
                         if (split.Length < 3)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".tp x y");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".tp x y");
                             return true;
                         }
                         if (float.TryParse(split[1], out x))
@@ -230,8 +241,8 @@
                     case ".ch":
                         if (split.Length < 2)
                         {
-                            SendDebugMsgFormatted(0, "Incorrect command syntax");
-                            SendDebugMsgFormatted(2, ".ch championName");
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAXERROR);
+                            SendDebugMsgFormatted(DebugMsgType.SYNTAX, ".ch championName");
                             return true;
                         }
                         new System.Threading.Thread(new System.Threading.ThreadStart(() =>
@@ -287,31 +298,13 @@
                         }
                         return true;
                     case ".inhib":
-                        var sender = game.GetPeerInfo(peer);
-                        var min = new Monster(game, game.GetNewNetID(), sender.GetChampion().getX(), sender.GetChampion().getY(), sender.GetChampion().getX(), sender.GetChampion().getY(), "AncientGolem", "AncientGolem1.1.1");
-                        game.GetMap().AddObject(min);
-                        return true;
-                    case ".reload":
-                        game.SetStarted(false);
-                        foreach (var obj in game.GetMap().GetObjects())
-                        {
-                            var m = obj.Value as Minion;
-                            if (m != null)
-                            {
-                                m.LoadLua();
-                            }
-
-                            var c = obj.Value as Champion;
-                            if (c != null)
-                            {
-                                c.LoadLua();
-                            }
-                        }
-                        game.SetStarted(true);
+                        var sender = game.getPeerInfo(peer);
+                        var min = new Monster(game.getMap(), Game.GetNewNetID(), sender.getChampion().getX(), sender.getChampion().getY(), sender.getChampion().getX(), sender.getChampion().getY(), "Worm", "Worm");//"AncientGolem", "AncientGolem1.1.1");
+                        game.getMap().addObject(min);
                         return true;
                     default:
-                        SendDebugMsgFormatted(0, "" + split[0] + " is not a valid command.");
-                        SendDebugMsgFormatted(1, "Type .help for a list of available commands");
+                        SendDebugMsgFormatted(DebugMsgType.ERROR, "" + split[0] + " is not a valid command.");
+                        SendDebugMsgFormatted(DebugMsgType.INFO, "Type .help for a list of available commands");
                         return true;
                 }
             }


Switched to 1.1.6-cssandra-updt2

Switched to 1.1.6-cssandra-updt2

--- src/SharedVersionInfo.cs
+++ src/SharedVersionInfo.cs
@@ -2,4 +2,4 @@

 [assembly: AssemblyVersion("1.1.6")]
 [assembly: AssemblyFileVersion("1.1.6")]
-[assembly: AssemblyInformationalVersion("1.1.6-cassandra-upd2")]+[assembly: AssemblyInformationalVersion("1.1.6-cssandra-updt2")]


Fix SharedVersionInfo.cs version

Fix SharedVersionInfo.cs version

--- src/SharedVersionInfo.cs
+++ src/SharedVersionInfo.cs
@@ -1,5 +1,5 @@
 using System.Reflection;

-[assembly: AssemblyVersion("1.5.1-beta")]
-[assembly: AssemblyFileVersion("1.5.1-beta")]
+[assembly: AssemblyVersion("1.5.1")]
+[assembly: AssemblyFileVersion("1.5.1")]
 [assembly: AssemblyInformationalVersion("1.5.1-beta")]