Streamline library directory detection code.

--- Compiler/LibraryManager.cs
+++ Compiler/LibraryManager.cs
@@ -97,8 +97,6 @@
             string nullableBuildFileCrayonPath,
             string nullableProjectDirectory)
         {
-            List<string> libraryPathsByName = new List<string>();
-
             string crayonHome = System.Environment.GetEnvironmentVariable("CRAYON_HOME");

 #if RELEASE
@@ -108,36 +106,32 @@
                 }
 #endif

-            List<string> directoriesToCheck = new List<string>();
-
+            string placesWhereLibraryDirectoriesCanExist = "";
+
             if (crayonHome != null)
             {
-                string crayonHomeLibraries = System.IO.Path.Combine(crayonHome, "libs");
-                if (System.IO.Directory.Exists(crayonHomeLibraries))
-                {
-                    directoriesToCheck.AddRange(System.IO.Directory.GetDirectories(crayonHomeLibraries));
-                }
-            }
-            string crayonPaths =
-                (nullableBuildFileCrayonPath ?? "") + ";" +
-                (System.Environment.GetEnvironmentVariable("CRAYON_PATH") ?? "");
+                placesWhereLibraryDirectoriesCanExist += ";" + System.IO.Path.Combine(crayonHome, "libs");
+            }
+            if (nullableBuildFileCrayonPath != null)
+            {
+                placesWhereLibraryDirectoriesCanExist += ";" + nullableBuildFileCrayonPath;
+            }
+            placesWhereLibraryDirectoriesCanExist += ";" + (System.Environment.GetEnvironmentVariable("CRAYON_PATH") ?? "");

 #if OSX
-            crayonPaths = crayonPaths.Replace(':', ';');
+            placesWhereLibraryDirectoriesCanExist = placesWhereLibraryDirectoriesCanExist.Replace(':', ';');
 #endif
-            string[] paths = crayonPaths.Split(';');
+            string[] paths = placesWhereLibraryDirectoriesCanExist.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries);
+            List<string> unverifiedLibraryDirectories = new List<string>();
             foreach (string path in paths)
             {
-                if (path.Length > 0)
-                {
-                    string absolutePath = FileUtil.IsAbsolutePath(path)
-                        ? path
-                        : System.IO.Path.Combine(nullableProjectDirectory, path);
-                    absolutePath = System.IO.Path.GetFullPath(absolutePath);
-                    if (System.IO.Directory.Exists(absolutePath))
-                    {
-                        directoriesToCheck.AddRange(System.IO.Directory.GetDirectories(absolutePath));
-                    }
+                string absolutePath = FileUtil.IsAbsolutePath(path)
+                    ? path
+                    : System.IO.Path.Combine(nullableProjectDirectory, path);
+                absolutePath = System.IO.Path.GetFullPath(absolutePath);
+                if (System.IO.Directory.Exists(absolutePath))
+                {
+                    unverifiedLibraryDirectories.AddRange(System.IO.Directory.GetDirectories(absolutePath));
                 }
             }

@@ -148,25 +142,32 @@
             while (!string.IsNullOrEmpty(currentDirectory))
             {
                 string path = System.IO.Path.Combine(currentDirectory, "Libraries");
-                if (System.IO.Directory.Exists(path))
-                {
-                    directoriesToCheck.AddRange(System.IO.Directory.GetDirectories(path));
+                if (System.IO.Directory.Exists(path) &&
+                    System.IO.Directory.Exists(System.IO.Path.Combine(currentDirectory, "Compiler", "CrayonWindows.sln"))) // quick sanity check
+                {
+                    unverifiedLibraryDirectories.AddRange(System.IO.Directory.GetDirectories(path));
                     break;
                 }
                 currentDirectory = System.IO.Path.GetDirectoryName(currentDirectory);
             }
 #endif
-            foreach (string dir in directoriesToCheck)
+            List<string> verifiedLibraryPaths = new List<string>();
+
+            foreach (string dir in unverifiedLibraryDirectories)
             {
                 string manifestPath = System.IO.Path.Combine(dir, "manifest.txt");
                 if (System.IO.File.Exists(manifestPath))
                 {
-                    libraryPathsByName.Add(dir);
-                }
-            }
-
+                    verifiedLibraryPaths.Add(dir);
+                }
+            }
+
+            // Library name collisions will override any previous definition.
+            // For example, a custom library referenced by a build file will override a built-in library.
+            // An example use case of this would be to define a custom library called "Gamepad" for mobile that puts
+            // buttons in the corners of the screen, but without having to change any code to be platform-aware.
             Dictionary<string, LibraryMetadata> uniqueLibraries = new Dictionary<string, LibraryMetadata>();
-            foreach (string path in libraryPathsByName)
+            foreach (string path in verifiedLibraryPaths)
             {
                 string defaultName = System.IO.Path.GetFileName(path);
                 LibraryMetadata metadata = new LibraryMetadata(path, defaultName);


Disable Broadcast button (#2752)

Disable Broadcast button (#2752)

Disable Broadcast button

--- WalletWasabi.Gui/Controls/WalletExplorer/TransactionBroadcasterViewModel.cs
+++ WalletWasabi.Gui/Controls/WalletExplorer/TransactionBroadcasterViewModel.cs
@@ -17,6 +17,7 @@
 using WalletWasabi.Gui.Helpers;
 using WalletWasabi.Gui.Models.StatusBarStatuses;
 using WalletWasabi.Gui.ViewModels;
+using WalletWasabi.Gui.ViewModels.Validation;
 using WalletWasabi.Helpers;
 using WalletWasabi.Logging;

@@ -73,7 +74,10 @@
 				TransactionString = textToPaste;
 			});

-			BroadcastTransactionCommand = ReactiveCommand.CreateFromTask(async () => await OnDoTransactionBroadcastAsync());
+			BroadcastTransactionCommand = ReactiveCommand.CreateFromTask(
+				async () => await OnDoTransactionBroadcastAsync(),
+				this.WhenAny(x => x.TransactionString, (transactionString) => (!string.IsNullOrWhiteSpace(transactionString.Value)))
+					.ObserveOn(RxApp.MainThreadScheduler));

 			ImportTransactionCommand = ReactiveCommand.CreateFromTask(async () =>
 			{


Conxext synch for single and multi items

--- Components/ModelFactory.cs
+++ Components/ModelFactory.cs
@@ -345,6 +345,8 @@
                         url = hbEngine.Execute(Manifest.DetailUrl, dynForHBS);
                     }
                     context["DetailUrl"] = Globals.NavigateURL(MainTabId, false, PortalSettings, "", GetCurrentCultureCode(), url.CleanupUrl(), "id=" + Data.Id);
+                    context["Id"] = Data.Id;
+                    context["EditUrl"] = DnnUrlUtils.EditUrl("id", Data.Id, Module.ModuleID, PortalSettings);
                 }
             }
         }


Add CSRF Token to AppDeployment path since that seperate for now.

--- WindowsDevicePortalWrapper/WindowsDevicePortalWrapper/Core/AppDeployment.cs
+++ WindowsDevicePortalWrapper/WindowsDevicePortalWrapper/Core/AppDeployment.cs
@@ -161,6 +161,12 @@
                 request.ServerCertificateValidationCallback = this.ServerCertificateValidation;
                 request.Timeout = timeoutInMinutes * 60 * 1000;

+                // Set the CSRF-Token if we have one
+                if (!string.IsNullOrEmpty(this.csrfToken))
+                {
+                    request.Headers.Add("X-" + CsrfTokenName, this.csrfToken);
+                }
+
                 using (Stream requestStream = request.GetRequestStream())
                 {
                     byte[] data;


Do not disable heuristic after first run

--- resharper/resharper-unity/src/Yaml/Psi/Modules/UnityYamlDisableStrategy.cs
+++ resharper/resharper-unity/src/Yaml/Psi/Modules/UnityYamlDisableStrategy.cs
@@ -47,9 +47,9 @@
         {
             if (myShouldRunHeuristic && myUnityYamlSupport.IsUnityYamlParsingEnabled.Value)
             {
-                mySolutionCaches.PersistentProperties[SolutionCachesId] = false.ToString();
                 if (IsAnyFilePreventYamlParsing(directoryEntries) || myTotalSize > TotalFileSizeThreshold)
                 {
+                    mySolutionCaches.PersistentProperties[SolutionCachesId] = false.ToString();
                     myUnityYamlSupport.IsUnityYamlParsingEnabled.Value = false;
                     NotifyYamlParsingDisabled();
                 }


Add failing instance field import test.

Add failing instance field import test.

--- test/AsmResolver.DotNet.Tests/ReferenceImporterTest.cs
+++ test/AsmResolver.DotNet.Tests/ReferenceImporterTest.cs
@@ -4,6 +4,7 @@
 using System.Linq;
 using AsmResolver.DotNet.Signatures;
 using AsmResolver.DotNet.Signatures.Types;
+using AsmResolver.DotNet.TestCases.Fields;
 using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
 using Xunit;

@@ -464,5 +465,26 @@
             var newInstance = Assert.IsAssignableFrom<FunctionPointerTypeSignature>(imported);
             Assert.Same(signature, newInstance);
         }
+
+        [Fact]
+        public void ImportInstanceFieldByReflectionShouldConstructValidFieldSignature()
+        {
+            // https://github.com/Washi1337/AsmResolver/issues/307
+
+            var module = ModuleDefinition.FromFile(typeof(SingleField).Assembly.Location);
+            var field = module.GetAllTypes()
+                .First(t => t.Name == nameof(SingleField))
+                .Fields
+                .First(f => f.Name == nameof(SingleField.IntField));
+
+            var fieldInfo = typeof(SingleField).GetField(nameof(SingleField.IntField))!;
+
+            var importer = new ReferenceImporter(module);
+            var imported = importer.ImportField(fieldInfo);
+            var resolved = imported.Resolve();
+
+            Assert.NotNull(resolved);
+            Assert.Equal(field, resolved);
+        }
     }
 }


Add nested typedef import test.

Add nested typedef import test.

--- test/AsmResolver.DotNet.Tests/ReferenceImporterTest.cs
+++ test/AsmResolver.DotNet.Tests/ReferenceImporterTest.cs
@@ -11,9 +11,9 @@
 {
     public class ReferenceImporterTest
     {
-        private static readonly SignatureComparer _comparer = new SignatureComparer();
-
-        private readonly AssemblyReference _dummyAssembly = new AssemblyReference("SomeAssembly", new Version(1, 2, 3, 4));
+        private static readonly SignatureComparer Comparer = new();
+
+        private readonly AssemblyReference _dummyAssembly = new("SomeAssembly", new Version(1, 2, 3, 4));
         private readonly ModuleDefinition _module;
         private readonly ReferenceImporter _importer;

@@ -28,7 +28,7 @@
         {
             var result = _importer.ImportScope(_dummyAssembly);

-            Assert.Equal(_dummyAssembly, result, _comparer);
+            Assert.Equal(_dummyAssembly, result, Comparer);
             Assert.Contains(result, _module.AssemblyReferences);
         }

@@ -52,7 +52,7 @@
             var type = new TypeReference(_dummyAssembly, "SomeNamespace", "SomeName");
             var result = _importer.ImportType(type);

-            Assert.Equal(type, result, _comparer);
+            Assert.Equal(type, result, Comparer);
             Assert.Equal(_module, result.Module);
         }

@@ -78,7 +78,7 @@
             var result = _importer.ImportType(definition);

             Assert.IsAssignableFrom<TypeReference>(result);
-            Assert.Equal(definition, result, _comparer);
+            Assert.Equal(definition, result, Comparer);
         }

         [Fact]
@@ -100,9 +100,30 @@

             var result = _importer.ImportType(nested);

-            Assert.Equal(nested, result, _comparer);
+            Assert.Equal(nested, result, Comparer);
             Assert.Equal(_module, result.Module);
             Assert.Equal(_module, result.DeclaringType.Module);
+        }
+
+        [Fact]
+        public void ImportNestedTypeDefinitionShouldImportParentType()
+        {
+            var otherAssembly = new AssemblyDefinition(_dummyAssembly.Name, _dummyAssembly.Version);
+            var otherModule = new ModuleDefinition("OtherModule");
+            otherAssembly.Modules.Add(otherModule);
+
+            var objectType = otherModule.CorLibTypeFactory.Object.ToTypeDefOrRef();
+            var declaringType = new TypeDefinition("SomeNamespace", "SomeName", TypeAttributes.Class | TypeAttributes.Public, objectType);
+            var nestedType = new TypeDefinition(null, "NestedType", TypeAttributes.Class | TypeAttributes.NestedPublic, objectType);
+            declaringType.NestedTypes.Add(nestedType);
+            otherModule.TopLevelTypes.Add(declaringType);
+
+            var reference = _importer.ImportType(nestedType);
+
+            Assert.NotNull(reference.DeclaringType);
+            Assert.Equal(declaringType, reference.DeclaringType, Comparer);
+            Assert.Equal(_module, reference.Module);
+            Assert.Equal(_module, reference.DeclaringType.Module);
         }

         [Fact]
@@ -170,7 +191,7 @@

             var result = _importer.ImportMethod(method);

-            Assert.Equal(method, result, _comparer);
+            Assert.Equal(method, result, Comparer);
             Assert.Same(_module, result.Module);
         }

@@ -217,7 +238,7 @@
             Assert.Equal(new TypeSignature[]
             {
                 _module.CorLibTypeFactory.String
-            }, specification.Signature.TypeArguments, _comparer);
+            }, specification.Signature.TypeArguments, Comparer);
         }

         [Fact]
@@ -231,7 +252,7 @@

             var result = _importer.ImportField(field);

-            Assert.Equal(field, result, _comparer);
+            Assert.Equal(field, result, Comparer);
             Assert.Same(_module, result.Module);
         }


- Added test case from GitHub issues #384 and #385

--- src/dotless.Test/Specs/ExtendFixture.cs
+++ src/dotless.Test/Specs/ExtendFixture.cs
@@ -245,5 +245,65 @@
             AssertLess(input, expected);
         }

+        [Test]
+        public void ParentSelector() {
+            var input = @"
+.btn-primary {
+  color: white;
+}
+
+a:link {
+  color: blue;
+}
+
+a:link {
+    &.btn-primary:extend(.btn-primary){}
+}
+";
+
+            var expected = @"
+.btn-primary,
+a:link.btn-primary {
+  color: white;
+}
+a:link {
+  color: blue;
+}
+";
+
+            AssertLess(input, expected);
+        }
+
+        [Test]
+        public void ParentSelectorWithMultipleOuterSelectors() {
+            var input = @"
+.btn-primary {
+  color: white;
+}
+
+a:active,a:visited
+{
+  color: blue;
+}
+
+a:active, a:visited {
+    &.btn-primary:extend(.btn-primary){}
+}
+";
+
+            var expected = @"
+.btn-primary,
+a:active.btn-primary,
+a:visited.btn-primary {
+  color: white;
+}
+a:active,
+a:visited {
+  color: blue;
+}
+";
+
+            AssertLess(input, expected);
+        }
     }
 }


Not fetching data when Layer.Enabled = false

--- SharpMapCore/Layers/Layer.cs
+++ SharpMapCore/Layers/Layer.cs
@@ -130,8 +130,8 @@

         public void ViewChanged(bool changeEnd, BoundingBox extent, double resolution)
         {
+            if (!Enabled) return;
             if (DataSource == null) return;
-
             if (!changeEnd) return;

             this.extent = extent;


Add closing bracket and reformat whitespace

--- SketchSolveC#/SketchSolve.cs
+++ SketchSolveC#/SketchSolve.cs
@@ -6,65 +6,65 @@

   public enum ConstraintEnum {
     pointOnPoint,
-    pointToLine,
-    pointOnLine,
-    horizontal,
-    vertical,
-    internalAngle,
-    radiusValue,
-    tangentToArc,
-    tangentToCircle,
-    arcRules,
-    P2PDistance,
-    P2PDistanceVert,
-    P2PDistanceHorz,
-    P2LDistance,
-    P2LDistanceVert,
-    P2LDistanceHorz,
-    lineLength,
-    equalLegnth,
-    arcRadius,
-    equalRadiusArcs,
-    equalRadiusCircles,
-    equalRadiusCircArc,
-    concentricArcs,
-    concentricCircles,
-    concentricCircArc,
-    circleRadius,
-    externalAngle,
-    parallel,
-    perpendicular,
-    colinear,
-    pointOnCircle,
-    pointOnArc,
-    pointOnLineMidpoint,
-    pointOnArcMidpoint,
-    pointOnCircleQuad,
-    symmetricPoints,
-    symmetricLines,
-    symmetricCircles,
-    symmetricArcs
+      pointToLine,
+      pointOnLine,
+      horizontal,
+      vertical,
+      internalAngle,
+      radiusValue,
+      tangentToArc,
+      tangentToCircle,
+      arcRules,
+      P2PDistance,
+      P2PDistanceVert,
+      P2PDistanceHorz,
+      P2LDistance,
+      P2LDistanceVert,
+      P2LDistanceHorz,
+      lineLength,
+      equalLegnth,
+      arcRadius,
+      equalRadiusArcs,
+      equalRadiusCircles,
+      equalRadiusCircArc,
+      concentricArcs,
+      concentricCircles,
+      concentricCircArc,
+      circleRadius,
+      externalAngle,
+      parallel,
+      perpendicular,
+      colinear,
+      pointOnCircle,
+      pointOnArc,
+      pointOnLineMidpoint,
+      pointOnArcMidpoint,
+      pointOnCircleQuad,
+      symmetricPoints,
+      symmetricLines,
+      symmetricCircles,
+      symmetricArcs
   }

   public enum Result {
     error = -1,
-    succsess = 0,
-    noSolution = 1,
+          succsess = 0,
+          noSolution = 1,
   }

-/*
-
-///////////////////////////////////////
-/// Solve exit codes
-///////////////////////////////////////
+  /*
+
+  ///////////////////////////////////////
+  /// Solve exit codes
+  ///////////////////////////////////////

 #define succsess 0
 #define noSolution 1

-///////////////////////////////////////////////////////////////////////
-/// constraint defines (these make writing constraint equations easier
-///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  /// constraint defines (these make writing constraint equations easier
+  ///////////////////////////////////////////////////////////////////////
 #define P1_x       *cons[i].point1.x
 #define P1_y         *cons[i].point1.y
 #define P2_x           *cons[i].point2.x
@@ -114,7 +114,7 @@
 #define Sym_P1_y       *cons[i].SymLine.p1.y
 #define Sym_P2_x       *cons[i].SymLine.p2.x
 #define Sym_P2_y       *cons[i].SymLine.p2.y
-
+
 */

   public class Parameter {
@@ -179,7 +179,7 @@
     const double fine = 1;
     //Note that the total number of iterations allowed is MaxIterations *xLength;
     const double MaxIterations = 50 ;
-
+

     public static Result solve(Parameter []x, constraint[] cons, int isFine)
     {
@@ -219,11 +219,11 @@
         second = calc(cons,consLength);
         grad[j]=.5*(second-first)/pert;
         ftimes++;
-                /*
+        /*
 #ifdef DEBUG
-        cstr << "gradient: " << grad[j];
-        debugprint(cstr.str());
-        cstr.clear();
+cstr << "gradient: " << grad[j];
+debugprint(cstr.str());
+cstr.clear();
 #endif
 */
         *x[j]=temper;
@@ -643,13 +643,13 @@
       }
       ////Debug

-/*
+      /*
 #ifdef DEBUG

-      for(int i=0;i<xLength;i++)
-      {
-        cstr<<"Parameter("<<i<<"): "<<*(x[i])<<endl;
-        //cout<<xold[i]<<endl;
+for(int i=0;i<xLength;i++)
+{
+cstr<<"Parameter("<<i<<"): "<<*(x[i])<<endl;
+      //cout<<xold[i]<<endl;
       }
       cstr<<"Fnew: "<<fnew<<endl;
       cstr<<"Number of Iterations: "<<iterations<<endl;
@@ -659,538 +659,539 @@

 #endif
 */
-      ///End of function
-      double validSolution;
-      if(isFine==1) validSolution=validSolutionFine;
-      else validSolution=validSoltuionRough;
-      if(fnew<validSolution)
-      {
-        return succsess;
+///End of function
+double validSolution;
+if(isFine==1) validSolution=validSolutionFine;
+else validSolution=validSoltuionRough;
+if(fnew<validSolution)
+{
+  return succsess;
+}
+else
+{
+
+  //Replace the bad numbers with the last result
+  for(int i=0;i<xLength;i++)
+  {
+    *x[i]=origSolution[i];
+  }
+  return noSolution;
+}
+
+}
+
+
+public static double calc(constraint [] cons)
+{
+  int consLength=cons.Length;
+  double error=0;
+  double temp,dx,dy,m,n,Ex,Ey,rad1,rad2,t,Xint,Yint,dx2,dy2,hyp1,hyp2,temp2;
+  for(int i=0;i<consLength;i++)
+  {
+    if((cons[i]).type==pointOnPoint)
+    {
+      //Hopefully avoid this constraint, make coincident points use the same parameters
+      error += (P1_x - P2_x) * (P1_x - P2_x) + (P1_y - P2_y) * (P1_y - P2_y);
+    }
+
+
+    if(cons[i].type==P2PDistance)
+    {
+      error+= (P1_x - P2_x) * (P1_x - P2_x) + (P1_y - P2_y) * (P1_y - P2_y) - distance * distance;
+
+    }
+
+    if(cons[i].type==P2PDistanceVert)
+    {
+      error+= (P1_y - P2_y) * (P1_y - P2_y) - distance * distance;
+    }
+
+    if(cons[i].type==P2PDistanceHorz)
+    {
+      error+= (P1_x - P2_x) * (P1_x - P2_x) - distance * distance;
+    }
+
+
+    if((cons[i]).type==pointOnLine)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+
+      m=dy/dx; //Slope
+      n=dx/dy; //1/Slope
+
+      if(m<=1 && m>=-1)
+      {
+        //Calculate the expected y point given the x coordinate of the point
+        Ey=L1_P1_y+m*(P1_x-L1_P1_x);
+        error+=(Ey-P1_y)*(Ey-P1_y);
       }
       else
       {
-
-        //Replace the bad numbers with the last result
-        for(int i=0;i<xLength;i++)
-        {
-          *x[i]=origSolution[i];
-        }
-        return noSolution;
-      }
-
-    }
-
-
-    public static double calc(constraint [] cons)
-    {
-      int consLength=cons.Length;
-      double error=0;
-      double temp,dx,dy,m,n,Ex,Ey,rad1,rad2,t,Xint,Yint,dx2,dy2,hyp1,hyp2,temp2;
-      for(int i=0;i<consLength;i++)
-      {
-        if((cons[i]).type==pointOnPoint)
-        {
-          //Hopefully avoid this constraint, make coincident points use the same parameters
-          error += (P1_x - P2_x) * (P1_x - P2_x) + (P1_y - P2_y) * (P1_y - P2_y);
-        }
-
-
-        if(cons[i].type==P2PDistance)
-        {
-          error+= (P1_x - P2_x) * (P1_x - P2_x) + (P1_y - P2_y) * (P1_y - P2_y) - distance * distance;
-
-        }
-
-        if(cons[i].type==P2PDistanceVert)
-        {
-          error+= (P1_y - P2_y) * (P1_y - P2_y) - distance * distance;
-        }
-
-        if(cons[i].type==P2PDistanceHorz)
-        {
-          error+= (P1_x - P2_x) * (P1_x - P2_x) - distance * distance;
-        }
-
-
-        if((cons[i]).type==pointOnLine)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-
-          m=dy/dx; //Slope
-          n=dx/dy; //1/Slope
-
-          if(m<=1 && m>=-1)
-          {
-            //Calculate the expected y point given the x coordinate of the point
-            Ey=L1_P1_y+m*(P1_x-L1_P1_x);
-            error+=(Ey-P1_y)*(Ey-P1_y);
-          }
-          else
-          {
-            //Calculate the expected x point given the y coordinate of the point
-            Ex=L1_P1_x+n*(P1_y-L1_P1_y);
-            error+=(Ex-P1_x)*(Ex-P1_x);
-          }
-        }
-
-        if((cons[i]).type==P2LDistance)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-
-          t=-(L1_P1_x*dx-P1_x*dx+L1_P1_y*dy-P1_y*dy)/(dx*dx+dy*dy);
-          Xint=L1_P1_x+dx*t;
-          Yint=L1_P1_y+dy*t;
-          temp= _hypot((P1_x - Xint),(P1_y - Yint)) - distance;
-          error += temp*temp/10;
-
-        }
-        if((cons[i]).type==P2LDistanceVert)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-
-          t=(P1_x- L1_P1_x)/dx;
-          Yint=L1_P1_y+dy*t;
-          temp= fabs((P1_y - Yint)) - distance;
-          error += temp*temp;
-
-        }
-        if((cons[i]).type==P2LDistanceHorz)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-
-          t=(P1_y- L1_P1_y)/dy;
-          Xint=L1_P1_x+dx*t;
-          temp= fabs((P1_x - Xint)) - distance;
-          error += temp*temp/10;
-
-        }
-
-
-        if(cons[i].type==vertical)
-        {
-          double odx = L1_P2_x - L1_P1_x;
-          /*
-             double ody = L1_P2_y - L1_P1_y;
-
-             double hyp=_hypot(odx,ody);
-             dx = odx/hyp;
-             dy = ody/hyp;
-
-             double theta = atan2(dy,dx);
-             double p1 = odx-cos(theta)*cos(theta)*ody;
-             error+=p1*p1*10;
-             */
-          error+=odx*odx*1000;
-        }
-
-        if(cons[i].type==horizontal)
-        {
-          //double odx = L1_P2_x - L1_P1_x;
-          double ody = L1_P2_y - L1_P1_y;
-          /*
-             double hyp=_hypot(odx,ody);
-             dx = odx/hyp;
-             dy = ody/hyp;
-
-             double theta = atan2(dy,dx);
-             double p1 = (ody-sin(theta)*sin(theta)*odx);
-             error+=p1*p1*10;
-             */
-          error+=ody*ody*1000;
-        }
-
-        if(cons[i].type==tangentToCircle)
-        {
-          double Rpx,Rpy,RpxN,RpyN,hyp,error1,error2;
-          dx = L1_P2_x-L1_P1_x;
-          dy = L1_P2_y-L1_P1_y;
-          hyp=_hypot(dx,dy);
-          //Calculate the expected tangent intersection points
-          Rpx =C1_Center_x - dy / hyp * C1_rad;
-          Rpy =C1_Center_y + dx / hyp * C1_rad;
-          RpxN=C1_Center_x + dy / hyp * C1_rad;
-          RpyN=C1_Center_y - dx / hyp * C1_rad;
-
-          error1=(-dy * Rpx + dx * Rpy   + (L1_P1_x * L1_P2_y - L1_P2_x * L1_P1_y))/hyp;
-          error2=(-dy * RpxN + dx * RpyN + (L1_P1_x * L1_P2_y - L1_P2_x * L1_P1_y))/hyp;
-          error1=error1 * error1;
-          error2=error2 * error2;
-          if(error1<error2) error+=error1;
-          else error+=error2;
-
-        }
-
-        if(cons[i].type==tangentToArc)
-        {
-          /*
-             double dx,dy,Rpx,Rpy,RpxN,RpyN,hyp,error1,error2,rad;
-             dx = L1_P2_x - L1_P1_x;
-             dy = L1_P2_y - L1_P1_y;
-
-             hyp=_hypot(dx,dy);
-
-             double u = (A1_Center_x - L1_P1_x) * (L1_P2_x - L1_P1_x) + (A1_Center_y - L1_P1_y) * (L1_P2_y - L1_P1_y);
-             u/=hyp*hyp;
-
-             double x = L1_P1_x + u *(L1_P2_x - L1_P1_x);
-             double y = L1_P1_y + u *(L1_P2_y - L1_P1_y);
-
-             double dcsx = A1_Center_x - A1_Start_x;
-             double dcsy = A1_Center_y - A1_Start_y;
-             double dcex = A1_Center_x - A1_End_x;
-             double dcey = A1_Center_y - A1_End_y;
-             rad=(dcsx*dcsx + dcsy * dcsy);
-          //	rad+=(dcex*dcex + dcey * dcey)/4;
-
-          double dcx = A1_Center_x-x;
-          double dcy = A1_Center_y-y;
-          temp = (dcx * dcx + dcy * dcy) - rad;
-          error += temp*temp*100;
-          */
-
-          //#if defined(NEWARC)
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-
-
-          radsq = (A1_Center_x-A1_Start_x)*(A1_Center_x-A1_Start_x)+(A1_Center_y-A1_Start_y)*(A1_Center_y-A1_Start_y);
-          t=-(L1_P1_x*dx-A1_Center_x*dx+L1_P1_y*dy-A1_Center_y*dy)/(dx*dx+dy*dy);
-          Xint=L1_P1_x+dx*t;
-          Yint=L1_P1_y+dy*t;
-          temp= (A1_Center_x - Xint)*(A1_Center_x - Xint)+(A1_Center_y - Yint)*(A1_Center_y - Yint) - radsq;
-          error += temp*temp;
-        }
-
-        if(cons[i].type==arcRules)
-        {
-          //rad1=_hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
-          //rad2=_hypot(A1_Center_x - A1_End_x , A1_Center_y - A1_End_y);
-          //error += (rad1-rad2)*(rad1-rad2);
-          //double dx,dy,Rpx,Rpy,RpxN,RpyN,hyp,error1,error2,rad;
-          //dx = A1_End_x - A1_Start_x;
-          //dy = A1_End_y - A1_Start_y;
-
-          //hyp=_hypot(dx,dy);
-
-          //double u = (A1_Center_x - A1_Start_x) * (A1_End_x - A1_Start_x) + (A1_Center_y - A1_Start_y) * (A1_End_y - A1_Start_y);
-          //u/=hyp*hyp;
-
-          //temp = sin(u - .5);
-          //error+=temp*temp*temp*temp*100000;
-          //error+=pow(-2*A1_Center_x*A1_End_y - 2*A1_Center_y*A1_End_y + A1_End_x*A1_End_y + pow(A1_End_y,2) + 2*A1_Center_x*A1_Start_x - 2*A1_Center_y*A1_Start_x - A1_End_x*A1_Start_x + 4*A1_End_y*A1_Start_x - 3*pow(A1_Start_x,2) +  2*A1_Center_y*A1_Start_y + A1_Start_x*A1_Start_y - pow(A1_Start_y,2),2)/(8*pow(A1_End_y,2) + 8*pow(A1_Start_x,2) - 8*A1_End_y*A1_Start_y -  8*A1_Start_x*A1_Start_y + 4*pow(A1_Start_y,2));
-          double a1endx2 = A1_End_x * A1_End_x;
-          double a1endy2 = A1_End_y * A1_End_y;
-          double a1startx2 = A1_Start_x*A1_Start_x;
-          double a1starty2 = A1_Start_y*A1_Start_y;
-          double num = -2*A1_Center_x*A1_End_x+a1endx2-2*A1_Center_y*A1_End_y+a1endy2+2*A1_Center_x*A1_Start_x-a1startx2+2*A1_Center_y*A1_Start_y-a1starty2;
-          error += num * num /(4.0*a1endx2+a1endy2-2*A1_End_x*A1_Start_x+a1startx2-2*A1_End_y*A1_Start_y+a1starty2);
-
-        }
-
-        if(cons[i].type==lineLength)
-        {
-          temp= sqrt(pow(L1_P2_x - L1_P1_x,2) + pow(L1_P2_y - L1_P1_y,2)) - length;
-          //temp=_hypot(L1_P2_x - L1_P1_x , L1_P2_y - L1_P1_y) - length;
-          error += temp*temp*100;
-        }
-
-        if(cons[i].type==equalLegnth)
-        {
-          temp=_hypot(L1_P2_x - L1_P1_x , L1_P2_y - L1_P1_y) - _hypot(L2_P2_x - L2_P1_x , L2_P2_y - L2_P1_y);
-          error += temp*temp;
-        }
-
-        if(cons[i].type==arcRadius)
-        {
-          rad1 = _hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
-          rad2 = _hypot(A1_Center_x - A1_End_x , A1_Center_y - A1_End_y);
-          temp= rad1 - radius ;
-          error += temp*temp;
-        }
-
-        if(cons[i].type==equalRadiusArcs)
-        {
-          rad1 = _hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
-          rad2 = _hypot(A2_Center_x - A2_Start_x , A2_Center_y - A2_Start_y);
-          temp = rad1-rad2;
-          error += temp*temp;
-        }
-
-        if(cons[i].type==equalRadiusCircles)
-        {
-          temp = C1_rad - C2_rad;
-          error += temp*temp;
-        }
-
-        if(cons[i].type==equalRadiusCircArc)
-        {
-          rad1 = _hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
-          temp = rad1-C1_rad;
-          error += temp*temp;
-        }
-
-        if(cons[i].type==concentricArcs)
-        {
-          temp = _hypot(A1_Center_x - A2_Center_x , A1_Center_y - A2_Center_y);
-          error += temp*temp;
-        }
-
-        if(cons[i].type==concentricCircles)
-        {
-          temp = _hypot(C1_Center_x - C2_Center_x , C1_Center_y - C2_Center_y);
-          error += temp*temp;
-        }
-
-        if(cons[i].type==concentricCircArc)
-        {
-          temp = _hypot(A1_Center_x - C1_Center_x , A1_Center_y - C1_Center_y);
-          error += temp*temp;
-        }
-
-        if(cons[i].type==circleRadius)
-        {
-          error += (C1_rad - radius)*(C1_rad - radius);
-        }
-        if(cons[i].type==internalAngle)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-          dx2 = L2_P2_x - L2_P1_x;
-          dy2 = L2_P2_y - L2_P1_y;
-
-          hyp1=_hypot(dx,dy);
-          hyp2=_hypot(dx2,dy2);
-
-          dx=dx/hyp1;
-          dy=dy/hyp1;
-          dx2=dx2/hyp2;
-          dy2=dy2/hyp2;
-
-          temp = dx*dx2+dy*dy2;
-          temp2 = cos(angleP);
-          error += (temp+temp2)*(temp+temp2);
-        }
-
-        if(cons[i].type==externalAngle)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-          dx2 = L2_P2_x - L2_P1_x;
-          dy2 = L2_P2_y - L2_P1_y;
-
-          hyp1=_hypot(dx,dy);
-          hyp2=_hypot(dx2,dy2);
-
-          dx=dx/hyp1;
-          dy=dy/hyp1;
-          dx2=dx2/hyp2;
-          dy2=dy2/hyp2;
-
-          temp = dx*dx2-dy*dy2;
-          temp2 = cos(M_PI-angleP);
-          error += (temp+temp2)*(temp+temp2);
-        }
-
-        if(cons[i].type==perpendicular)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-          dx2 = L2_P2_x - L2_P1_x;
-          dy2 = L2_P2_y - L2_P1_y;
-
-          hyp1=_hypot(dx,dy);
-          hyp2=_hypot(dx2,dy2);
-
-          dx=dx/hyp1;
-          dy=dy/hyp1;
-          dx2=dx2/hyp2;
-          dy2=dy2/hyp2;
-
-          temp = dx*dx2+dy*dy2;
-          error += (temp)*(temp);
-        }
-
-        if(cons[i].type==parallel)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-          dx2 = L2_P2_x - L2_P1_x;
-          dy2 = L2_P2_y - L2_P1_y;
-
-          hyp1=_hypot(dx,dy);
-          hyp2=_hypot(dx2,dy2);
-
-          dx=dx/hyp1;
-          dy=dy/hyp1;
-          dx2=dx2/hyp2;
-          dy2=dy2/hyp2;
-
-          temp = dy*dx2-dx*dy2;
-          error += (temp)*(temp);
-        }
-        // Colinear constraint
-        if(cons[i].type==colinear)
-        {
-          dx = L1_P2_x - L1_P1_x;
-          dy = L1_P2_y - L1_P1_y;
-
-          m=dy/dx;
-          n=dx/dy;
-          // Calculate the error between the expected intersection point
-          // and the true point of the second lines two end points on the
-          // first line
-          if(m<=1 && m>-1)
-          {
-            //Calculate the expected y point given the x coordinate of the point
-            Ey=L1_P1_y+m*(L2_P1_x-L1_P1_x);
-            error+=(Ey-L2_P1_y)*(Ey-L2_P1_y);
-
-            Ey=L1_P1_y+m*(L2_P2_x-L1_P1_x);
-            error+=(Ey-L2_P2_y)*(Ey-L2_P2_y);
-          }
-          else
-          {
-            //Calculate the expected x point given the y coordinate of the point
-            Ex=L1_P1_x+n*(L2_P1_y-L1_P1_y);
-            error+=(Ex-L2_P1_x)*(Ex-L2_P1_x);
-
-            Ex=L1_P1_x+n*(L2_P2_y-L1_P1_y);
-            error+=(Ex-L2_P2_x)*(Ex-L2_P2_x);
-          }
-        }
-        // Point on a circle
-        if(cons[i].type == pointOnCircle)
-        {
-          //see what the current radius to the point is
-          rad1=_hypot(C1_Center_x-P1_x,C1_Center_y-P1_y);
-          //Compare this radius to the radius of the circle, return the error squared
-          temp = rad1-C1_rad;
-          error += temp*temp;
-          //cout<<"Point On circle error"<<temp*temp<<endl;
-        }
-        if(cons[i].type == pointOnArc)
-        {
-          //see what the current radius to the point is
-          rad1=_hypot(A1_Center_x-P1_x,A1_Center_y-P1_y);
-          rad2=_hypot(A1_Center_x-A1_Start_x,A1_Center_y-A1_Start_y);
-          //Compare this radius to the radius of the circle, return the error squared
-          temp = rad1-rad2;
-          error += temp*temp;
-          //cout<<"Point On circle error"<<temp*temp<<endl;
-        }
-        if(cons[i].type == pointOnLineMidpoint)
-        {
-          Ex=(L1_P1_x+L1_P2_x)/2;
-          Ey=(L1_P1_y+L1_P2_y)/2;
-          temp = Ex-P1_x;
-          temp2 = Ey-P1_y;
-          error += temp*temp+temp2*temp2;
-        }
-        if(cons[i].type == pointOnArcMidpoint)
-        {
-          rad1=_hypot(A1_Center_x-A1_Start_x,A1_Center_y-A1_Start_y);
-          temp = atan2(A1_Start_y-A1_Center_y,A1_Start_x-A1_Center_x);
-          temp2= atan2(A1_End_y-A1_Center_y,A1_End_x-A1_Center_x);
-          Ex=A1_Center_x+rad1*cos((temp2+temp)/2);
-          Ey=A1_Center_y+rad1*sin((temp2+temp)/2);
-          temp = (Ex-P1_x);
-          temp2 = (Ey-P1_y);
-          error += temp*temp+temp2*temp2;
-        }
-
-        if(cons[i].type == pointOnCircleQuad)
-        {
-          Ex=C1_Center_x;
-          Ey=C1_Center_y;
-          switch((int)quadIndex)
-          {
-            case 0:
-              Ex+=C1_rad;
-              break;
-            case 1:
-              Ey+=C1_rad;
-              break;
-            case 2:
-              Ex-=C1_rad;
-              break;
-            case 3:
-              Ey-=C1_rad;
-          }
-          temp = (Ex-P1_x);
-          temp2 = (Ey-P1_y);
-          error += temp*temp+temp2*temp2;
-        }
-        if(cons[i].type == symmetricPoints)
-        {
-          dx=Sym_P2_x-Sym_P1_x;
-          dy=Sym_P2_y-Sym_P1_y;
-          t=-(dy*P1_x-dx*P1_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
-          Ex = P1_x+dy*t*2;
-          Ey = P1_y-dx*t*2;
-          temp = (Ex-P2_x);
-          temp2 = (Ey-P2_y);
-          error += temp*temp+temp2*temp2;
-        }
-        if(cons[i].type == symmetricLines)
-        {
-          dx=Sym_P2_x-Sym_P1_x;
-          dy=Sym_P2_y-Sym_P1_y;
-          t=-(dy*L1_P1_x-dx*L1_P1_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
-          Ex = L1_P1_x+dy*t*2;
-          Ey = L1_P1_y-dx*t*2;
-          temp = (Ex-L2_P1_x);
-          temp2 = (Ey-L2_P1_y);
-          error += temp*temp+temp2*temp2;
-          t=-(dy*L1_P2_x-dx*L1_P2_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
-          Ex = L1_P2_x+dy*t*2;
-          Ey = L1_P2_y-dx*t*2;
-          temp = (Ex-L2_P2_x);
-          temp2 = (Ey-L2_P2_y);
-          error += temp*temp+temp2*temp2;
-        }
-        if(cons[i].type == symmetricCircles)
-        {
-          dx=Sym_P2_x-Sym_P1_x;
-          dy=Sym_P2_y-Sym_P1_y;
-          t=-(dy*C1_Center_x-dx*C1_Center_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
-          Ex = C1_Center_x+dy*t*2;
-          Ey = C1_Center_y-dx*t*2;
-          temp = (Ex-C2_Center_x);
-          temp2 = (Ey-C2_Center_y);
-          error += temp*temp+temp2*temp2;
-          temp = (C1_rad-C2_rad);
-          error += temp*temp;
-        }
-        if(cons[i].type == symmetricArcs)
-        {
-          dx=Sym_P2_x-Sym_P1_x;
-          dy=Sym_P2_y-Sym_P1_y;
-          t=-(dy*A1_Start_x-dx*A1_Start_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
-          Ex = A1_Start_x+dy*t*2;
-          Ey = A1_Start_y-dx*t*2;
-          temp = (Ex-A2_Start_x);
-          temp2 = (Ey-A2_Start_y);
-          error += temp*temp+temp2*temp2;
-          t=-(dy*A1_End_x-dx*A1_End_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
-          Ex = A1_End_x+dy*t*2;
-          Ey = A1_End_y-dx*t*2;
-          temp = (Ex-A2_End_x);
-          temp2 = (Ey-A2_End_y);
-          error += temp*temp+temp2*temp2;
-          t=-(dy*A1_Center_x-dx*A1_Center_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
-          Ex = A1_Center_x+dy*t*2;
-          Ey = A1_Center_y-dx*t*2;
-          temp = (Ex-A2_Center_x);
-          temp2 = (Ey-A2_Center_y);
-          error += temp*temp+temp2*temp2;
-        }
-      }
-      return error;
-
-    }
+        //Calculate the expected x point given the y coordinate of the point
+        Ex=L1_P1_x+n*(P1_y-L1_P1_y);
+        error+=(Ex-P1_x)*(Ex-P1_x);
+      }
+    }
+
+    if((cons[i]).type==P2LDistance)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+
+      t=-(L1_P1_x*dx-P1_x*dx+L1_P1_y*dy-P1_y*dy)/(dx*dx+dy*dy);
+      Xint=L1_P1_x+dx*t;
+      Yint=L1_P1_y+dy*t;
+      temp= _hypot((P1_x - Xint),(P1_y - Yint)) - distance;
+      error += temp*temp/10;
+
+    }
+    if((cons[i]).type==P2LDistanceVert)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+
+      t=(P1_x- L1_P1_x)/dx;
+      Yint=L1_P1_y+dy*t;
+      temp= fabs((P1_y - Yint)) - distance;
+      error += temp*temp;
+
+    }
+    if((cons[i]).type==P2LDistanceHorz)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+
+      t=(P1_y- L1_P1_y)/dy;
+      Xint=L1_P1_x+dx*t;
+      temp= fabs((P1_x - Xint)) - distance;
+      error += temp*temp/10;
+
+    }
+
+
+    if(cons[i].type==vertical)
+    {
+      double odx = L1_P2_x - L1_P1_x;
+      /*
+         double ody = L1_P2_y - L1_P1_y;
+
+         double hyp=_hypot(odx,ody);
+         dx = odx/hyp;
+         dy = ody/hyp;
+
+         double theta = atan2(dy,dx);
+         double p1 = odx-cos(theta)*cos(theta)*ody;
+         error+=p1*p1*10;
+         */
+      error+=odx*odx*1000;
+    }
+
+    if(cons[i].type==horizontal)
+    {
+      //double odx = L1_P2_x - L1_P1_x;
+      double ody = L1_P2_y - L1_P1_y;
+      /*
+         double hyp=_hypot(odx,ody);
+         dx = odx/hyp;
+         dy = ody/hyp;
+
+         double theta = atan2(dy,dx);
+         double p1 = (ody-sin(theta)*sin(theta)*odx);
+         error+=p1*p1*10;
+         */
+      error+=ody*ody*1000;
+    }
+
+    if(cons[i].type==tangentToCircle)
+    {
+      double Rpx,Rpy,RpxN,RpyN,hyp,error1,error2;
+      dx = L1_P2_x-L1_P1_x;
+      dy = L1_P2_y-L1_P1_y;
+      hyp=_hypot(dx,dy);
+      //Calculate the expected tangent intersection points
+      Rpx =C1_Center_x - dy / hyp * C1_rad;
+      Rpy =C1_Center_y + dx / hyp * C1_rad;
+      RpxN=C1_Center_x + dy / hyp * C1_rad;
+      RpyN=C1_Center_y - dx / hyp * C1_rad;
+
+      error1=(-dy * Rpx + dx * Rpy   + (L1_P1_x * L1_P2_y - L1_P2_x * L1_P1_y))/hyp;
+      error2=(-dy * RpxN + dx * RpyN + (L1_P1_x * L1_P2_y - L1_P2_x * L1_P1_y))/hyp;
+      error1=error1 * error1;
+      error2=error2 * error2;
+      if(error1<error2) error+=error1;
+      else error+=error2;
+
+    }
+
+    if(cons[i].type==tangentToArc)
+    {
+      /*
+         double dx,dy,Rpx,Rpy,RpxN,RpyN,hyp,error1,error2,rad;
+         dx = L1_P2_x - L1_P1_x;
+         dy = L1_P2_y - L1_P1_y;
+
+         hyp=_hypot(dx,dy);
+
+         double u = (A1_Center_x - L1_P1_x) * (L1_P2_x - L1_P1_x) + (A1_Center_y - L1_P1_y) * (L1_P2_y - L1_P1_y);
+         u/=hyp*hyp;
+
+         double x = L1_P1_x + u *(L1_P2_x - L1_P1_x);
+         double y = L1_P1_y + u *(L1_P2_y - L1_P1_y);
+
+         double dcsx = A1_Center_x - A1_Start_x;
+         double dcsy = A1_Center_y - A1_Start_y;
+         double dcex = A1_Center_x - A1_End_x;
+         double dcey = A1_Center_y - A1_End_y;
+         rad=(dcsx*dcsx + dcsy * dcsy);
+      //	rad+=(dcex*dcex + dcey * dcey)/4;
+
+      double dcx = A1_Center_x-x;
+      double dcy = A1_Center_y-y;
+      temp = (dcx * dcx + dcy * dcy) - rad;
+      error += temp*temp*100;
+      */
+
+      //#if defined(NEWARC)
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+
+
+      radsq = (A1_Center_x-A1_Start_x)*(A1_Center_x-A1_Start_x)+(A1_Center_y-A1_Start_y)*(A1_Center_y-A1_Start_y);
+      t=-(L1_P1_x*dx-A1_Center_x*dx+L1_P1_y*dy-A1_Center_y*dy)/(dx*dx+dy*dy);
+      Xint=L1_P1_x+dx*t;
+      Yint=L1_P1_y+dy*t;
+      temp= (A1_Center_x - Xint)*(A1_Center_x - Xint)+(A1_Center_y - Yint)*(A1_Center_y - Yint) - radsq;
+      error += temp*temp;
+    }
+
+    if(cons[i].type==arcRules)
+    {
+      //rad1=_hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
+      //rad2=_hypot(A1_Center_x - A1_End_x , A1_Center_y - A1_End_y);
+      //error += (rad1-rad2)*(rad1-rad2);
+      //double dx,dy,Rpx,Rpy,RpxN,RpyN,hyp,error1,error2,rad;
+      //dx = A1_End_x - A1_Start_x;
+      //dy = A1_End_y - A1_Start_y;
+
+      //hyp=_hypot(dx,dy);
+
+      //double u = (A1_Center_x - A1_Start_x) * (A1_End_x - A1_Start_x) + (A1_Center_y - A1_Start_y) * (A1_End_y - A1_Start_y);
+      //u/=hyp*hyp;
+
+      //temp = sin(u - .5);
+      //error+=temp*temp*temp*temp*100000;
+      //error+=pow(-2*A1_Center_x*A1_End_y - 2*A1_Center_y*A1_End_y + A1_End_x*A1_End_y + pow(A1_End_y,2) + 2*A1_Center_x*A1_Start_x - 2*A1_Center_y*A1_Start_x - A1_End_x*A1_Start_x + 4*A1_End_y*A1_Start_x - 3*pow(A1_Start_x,2) +  2*A1_Center_y*A1_Start_y + A1_Start_x*A1_Start_y - pow(A1_Start_y,2),2)/(8*pow(A1_End_y,2) + 8*pow(A1_Start_x,2) - 8*A1_End_y*A1_Start_y -  8*A1_Start_x*A1_Start_y + 4*pow(A1_Start_y,2));
+      double a1endx2 = A1_End_x * A1_End_x;
+      double a1endy2 = A1_End_y * A1_End_y;
+      double a1startx2 = A1_Start_x*A1_Start_x;
+      double a1starty2 = A1_Start_y*A1_Start_y;
+      double num = -2*A1_Center_x*A1_End_x+a1endx2-2*A1_Center_y*A1_End_y+a1endy2+2*A1_Center_x*A1_Start_x-a1startx2+2*A1_Center_y*A1_Start_y-a1starty2;
+      error += num * num /(4.0*a1endx2+a1endy2-2*A1_End_x*A1_Start_x+a1startx2-2*A1_End_y*A1_Start_y+a1starty2);
+
+    }
+
+    if(cons[i].type==lineLength)
+    {
+      temp= sqrt(pow(L1_P2_x - L1_P1_x,2) + pow(L1_P2_y - L1_P1_y,2)) - length;
+      //temp=_hypot(L1_P2_x - L1_P1_x , L1_P2_y - L1_P1_y) - length;
+      error += temp*temp*100;
+    }
+
+    if(cons[i].type==equalLegnth)
+    {
+      temp=_hypot(L1_P2_x - L1_P1_x , L1_P2_y - L1_P1_y) - _hypot(L2_P2_x - L2_P1_x , L2_P2_y - L2_P1_y);
+      error += temp*temp;
+    }
+
+    if(cons[i].type==arcRadius)
+    {
+      rad1 = _hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
+      rad2 = _hypot(A1_Center_x - A1_End_x , A1_Center_y - A1_End_y);
+      temp= rad1 - radius ;
+      error += temp*temp;
+    }
+
+    if(cons[i].type==equalRadiusArcs)
+    {
+      rad1 = _hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
+      rad2 = _hypot(A2_Center_x - A2_Start_x , A2_Center_y - A2_Start_y);
+      temp = rad1-rad2;
+      error += temp*temp;
+    }
+
+    if(cons[i].type==equalRadiusCircles)
+    {
+      temp = C1_rad - C2_rad;
+      error += temp*temp;
+    }
+
+    if(cons[i].type==equalRadiusCircArc)
+    {
+      rad1 = _hypot(A1_Center_x - A1_Start_x , A1_Center_y - A1_Start_y);
+      temp = rad1-C1_rad;
+      error += temp*temp;
+    }
+
+    if(cons[i].type==concentricArcs)
+    {
+      temp = _hypot(A1_Center_x - A2_Center_x , A1_Center_y - A2_Center_y);
+      error += temp*temp;
+    }
+
+    if(cons[i].type==concentricCircles)
+    {
+      temp = _hypot(C1_Center_x - C2_Center_x , C1_Center_y - C2_Center_y);
+      error += temp*temp;
+    }
+
+    if(cons[i].type==concentricCircArc)
+    {
+      temp = _hypot(A1_Center_x - C1_Center_x , A1_Center_y - C1_Center_y);
+      error += temp*temp;
+    }
+
+    if(cons[i].type==circleRadius)
+    {
+      error += (C1_rad - radius)*(C1_rad - radius);
+    }
+    if(cons[i].type==internalAngle)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+      dx2 = L2_P2_x - L2_P1_x;
+      dy2 = L2_P2_y - L2_P1_y;
+
+      hyp1=_hypot(dx,dy);
+      hyp2=_hypot(dx2,dy2);
+
+      dx=dx/hyp1;
+      dy=dy/hyp1;
+      dx2=dx2/hyp2;
+      dy2=dy2/hyp2;
+
+      temp = dx*dx2+dy*dy2;
+      temp2 = cos(angleP);
+      error += (temp+temp2)*(temp+temp2);
+    }
+
+    if(cons[i].type==externalAngle)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+      dx2 = L2_P2_x - L2_P1_x;
+      dy2 = L2_P2_y - L2_P1_y;
+
+      hyp1=_hypot(dx,dy);
+      hyp2=_hypot(dx2,dy2);
+
+      dx=dx/hyp1;
+      dy=dy/hyp1;
+      dx2=dx2/hyp2;
+      dy2=dy2/hyp2;
+
+      temp = dx*dx2-dy*dy2;
+      temp2 = cos(M_PI-angleP);
+      error += (temp+temp2)*(temp+temp2);
+    }
+
+    if(cons[i].type==perpendicular)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+      dx2 = L2_P2_x - L2_P1_x;
+      dy2 = L2_P2_y - L2_P1_y;
+
+      hyp1=_hypot(dx,dy);
+      hyp2=_hypot(dx2,dy2);
+
+      dx=dx/hyp1;
+      dy=dy/hyp1;
+      dx2=dx2/hyp2;
+      dy2=dy2/hyp2;
+
+      temp = dx*dx2+dy*dy2;
+      error += (temp)*(temp);
+    }
+
+    if(cons[i].type==parallel)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+      dx2 = L2_P2_x - L2_P1_x;
+      dy2 = L2_P2_y - L2_P1_y;
+
+      hyp1=_hypot(dx,dy);
+      hyp2=_hypot(dx2,dy2);
+
+      dx=dx/hyp1;
+      dy=dy/hyp1;
+      dx2=dx2/hyp2;
+      dy2=dy2/hyp2;
+
+      temp = dy*dx2-dx*dy2;
+      error += (temp)*(temp);
+    }
+    // Colinear constraint
+    if(cons[i].type==colinear)
+    {
+      dx = L1_P2_x - L1_P1_x;
+      dy = L1_P2_y - L1_P1_y;
+
+      m=dy/dx;
+      n=dx/dy;
+      // Calculate the error between the expected intersection point
+      // and the true point of the second lines two end points on the
+      // first line
+      if(m<=1 && m>-1)
+      {
+        //Calculate the expected y point given the x coordinate of the point
+        Ey=L1_P1_y+m*(L2_P1_x-L1_P1_x);
+        error+=(Ey-L2_P1_y)*(Ey-L2_P1_y);
+
+        Ey=L1_P1_y+m*(L2_P2_x-L1_P1_x);
+        error+=(Ey-L2_P2_y)*(Ey-L2_P2_y);
+      }
+      else
+      {
+        //Calculate the expected x point given the y coordinate of the point
+        Ex=L1_P1_x+n*(L2_P1_y-L1_P1_y);
+        error+=(Ex-L2_P1_x)*(Ex-L2_P1_x);
+
+        Ex=L1_P1_x+n*(L2_P2_y-L1_P1_y);
+        error+=(Ex-L2_P2_x)*(Ex-L2_P2_x);
+      }
+    }
+    // Point on a circle
+    if(cons[i].type == pointOnCircle)
+    {
+      //see what the current radius to the point is
+      rad1=_hypot(C1_Center_x-P1_x,C1_Center_y-P1_y);
+      //Compare this radius to the radius of the circle, return the error squared
+      temp = rad1-C1_rad;
+      error += temp*temp;
+      //cout<<"Point On circle error"<<temp*temp<<endl;
+    }
+    if(cons[i].type == pointOnArc)
+    {
+      //see what the current radius to the point is
+      rad1=_hypot(A1_Center_x-P1_x,A1_Center_y-P1_y);
+      rad2=_hypot(A1_Center_x-A1_Start_x,A1_Center_y-A1_Start_y);
+      //Compare this radius to the radius of the circle, return the error squared
+      temp = rad1-rad2;
+      error += temp*temp;
+      //cout<<"Point On circle error"<<temp*temp<<endl;
+    }
+    if(cons[i].type == pointOnLineMidpoint)
+    {
+      Ex=(L1_P1_x+L1_P2_x)/2;
+      Ey=(L1_P1_y+L1_P2_y)/2;
+      temp = Ex-P1_x;
+      temp2 = Ey-P1_y;
+      error += temp*temp+temp2*temp2;
+    }
+    if(cons[i].type == pointOnArcMidpoint)
+    {
+      rad1=_hypot(A1_Center_x-A1_Start_x,A1_Center_y-A1_Start_y);
+      temp = atan2(A1_Start_y-A1_Center_y,A1_Start_x-A1_Center_x);
+      temp2= atan2(A1_End_y-A1_Center_y,A1_End_x-A1_Center_x);
+      Ex=A1_Center_x+rad1*cos((temp2+temp)/2);
+      Ey=A1_Center_y+rad1*sin((temp2+temp)/2);
+      temp = (Ex-P1_x);
+      temp2 = (Ey-P1_y);
+      error += temp*temp+temp2*temp2;
+    }
+
+    if(cons[i].type == pointOnCircleQuad)
+    {
+      Ex=C1_Center_x;
+      Ey=C1_Center_y;
+      switch((int)quadIndex)
+      {
+        case 0:
+          Ex+=C1_rad;
+          break;
+        case 1:
+          Ey+=C1_rad;
+          break;
+        case 2:
+          Ex-=C1_rad;
+          break;
+        case 3:
+          Ey-=C1_rad;
+      }
+      temp = (Ex-P1_x);
+      temp2 = (Ey-P1_y);
+      error += temp*temp+temp2*temp2;
+    }
+    if(cons[i].type == symmetricPoints)
+    {
+      dx=Sym_P2_x-Sym_P1_x;
+      dy=Sym_P2_y-Sym_P1_y;
+      t=-(dy*P1_x-dx*P1_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
+      Ex = P1_x+dy*t*2;
+      Ey = P1_y-dx*t*2;
+      temp = (Ex-P2_x);
+      temp2 = (Ey-P2_y);
+      error += temp*temp+temp2*temp2;
+    }
+    if(cons[i].type == symmetricLines)
+    {
+      dx=Sym_P2_x-Sym_P1_x;
+      dy=Sym_P2_y-Sym_P1_y;
+      t=-(dy*L1_P1_x-dx*L1_P1_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
+      Ex = L1_P1_x+dy*t*2;
+      Ey = L1_P1_y-dx*t*2;
+      temp = (Ex-L2_P1_x);
+      temp2 = (Ey-L2_P1_y);
+      error += temp*temp+temp2*temp2;
+      t=-(dy*L1_P2_x-dx*L1_P2_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
+      Ex = L1_P2_x+dy*t*2;
+      Ey = L1_P2_y-dx*t*2;
+      temp = (Ex-L2_P2_x);
+      temp2 = (Ey-L2_P2_y);
+      error += temp*temp+temp2*temp2;
+    }
+    if(cons[i].type == symmetricCircles)
+    {
+      dx=Sym_P2_x-Sym_P1_x;
+      dy=Sym_P2_y-Sym_P1_y;
+      t=-(dy*C1_Center_x-dx*C1_Center_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
+      Ex = C1_Center_x+dy*t*2;
+      Ey = C1_Center_y-dx*t*2;
+      temp = (Ex-C2_Center_x);
+      temp2 = (Ey-C2_Center_y);
+      error += temp*temp+temp2*temp2;
+      temp = (C1_rad-C2_rad);
+      error += temp*temp;
+    }
+    if(cons[i].type == symmetricArcs)
+    {
+      dx=Sym_P2_x-Sym_P1_x;
+      dy=Sym_P2_y-Sym_P1_y;
+      t=-(dy*A1_Start_x-dx*A1_Start_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
+      Ex = A1_Start_x+dy*t*2;
+      Ey = A1_Start_y-dx*t*2;
+      temp = (Ex-A2_Start_x);
+      temp2 = (Ey-A2_Start_y);
+      error += temp*temp+temp2*temp2;
+      t=-(dy*A1_End_x-dx*A1_End_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
+      Ex = A1_End_x+dy*t*2;
+      Ey = A1_End_y-dx*t*2;
+      temp = (Ex-A2_End_x);
+      temp2 = (Ey-A2_End_y);
+      error += temp*temp+temp2*temp2;
+      t=-(dy*A1_Center_x-dx*A1_Center_y-dy*Sym_P1_x+dx*Sym_P1_y)/(dx*dx+dy*dy);
+      Ex = A1_Center_x+dy*t*2;
+      Ey = A1_Center_y-dx*t*2;
+      temp = (Ex-A2_Center_x);
+      temp2 = (Ey-A2_Center_y);
+      error += temp*temp+temp2*temp2;
+    }
+  }
+  return error;
+
 }
-
+}
+}
+


Updated to handle the case when you would say 'move Z to 94' and it would crash the application.  Currently does nothing other than avoid the crash.

--- SmartMirror/MainPage.xaml.cs
+++ SmartMirror/MainPage.xaml.cs
@@ -75,7 +75,7 @@
         {
             { 'A', new WidgetOption("Empty", "SmartMirror.Controls.EmptyPart") },
             { 'B', new WidgetOption("Profile picture", "SmartMirror.Controls.ProfilePicPart") },
-            { 'C', new WidgetOption("Daily agenda", "SmartMirror.Controls.ProfilePicPart") },
+            { 'C', new WidgetOption("Red Square", "SmartMirror.Controls.RedSquare") },
             { 'D', new WidgetOption("Weather", "SmartMirror.Controls.ProfilePicPart") },
             { 'E', new WidgetOption("Inbox", "SmartMirror.Controls.ProfilePicPart") },
             { 'F', new WidgetOption("Trending info", "SmartMirror.Controls.ProfilePicPart") },
@@ -213,8 +213,17 @@
                     {
                         text = text.Substring(text.IndexOf("add") + 4).Trim();
                         var parts = text.Split(' ');
-                        activeUser.Preferences[numMapping[parts[parts.Length - 1]]] = availableWidgets[Convert.ToChar(parts[0].ToUpper())].ClassName;
-                        repaint(this.RenderSize);
+
+                        var widgetName = Convert.ToChar(parts[0].ToUpper());
+                        var locationNumber = parts[parts.Length - 1];
+
+                        // Catch scenarios where the string doesn't match the fields
+                        // also known as the BadAustralianAccentExceptionHandler
+                        if (availableWidgets.ContainsKey(widgetName) && numMapping.ContainsKey(locationNumber) && activeUser.Preferences.ContainsKey(numMapping[locationNumber]))
+                        {
+                            activeUser.Preferences[numMapping[parts[parts.Length - 1]]] = availableWidgets[widgetName].ClassName;
+                            repaint(this.RenderSize);
+                        }
                     }
                 });
             };
@@ -223,8 +232,15 @@
                 //TODO
             };

-            // Start the speechRecognizer with continuous recognition
-            await speechRecognizer.ContinuousRecognitionSession.StartAsync();
+            try
+            {
+                // Start the speechRecognizer with continuous recognition
+                await speechRecognizer.ContinuousRecognitionSession.StartAsync();
+            }
+            catch(Exception e)
+            {
+                var b = e;
+            }
         }

         /// <summary>


Clean up

Clean up

--- Assets/ViveGrip/Scripts/Prefab/ViveGrip_GripPoint.cs
+++ Assets/ViveGrip/Scripts/Prefab/ViveGrip_GripPoint.cs
@@ -15,12 +15,11 @@
   public ViveGrip_ControllerHandler controller;
   [HideInInspector]
   public ViveGrip_Grabber grabber;
-  private GameObject touchedObject; // TODO: replace with touch.NearestObject()?
   [HideInInspector]
   public ConfigurableJoint joint;
   [HideInInspector]
   public GameObject jointObject; // TODO: belongs in the grabber now?...
-  //[HideInInspector]
+  [HideInInspector]
   public Color tintColor = new Color(0.2f, 0.2f, 0.2f);
   public const string GRIP_SPHERE_NAME = "ViveGrip Touch Sphere";
   private ViveGrip_TouchDetection touch;
@@ -39,24 +38,24 @@
 	}

   void Update() {
-    touchedObject = touch.NearestObject();
-    HandleHighlighting(touchedObject); // TODO: last touched is only needed here, cut the global state
+    GameObject touchedObject = TouchedObject();
+    HandleHighlighting(touchedObject);
     HandleGrabbing(touchedObject);
     HandleInteraction(touchedObject);
     HandleFumbling();
     lastTouchedObject = touchedObject;
   }

-  void HandleGrabbing(GameObject touchedObject) {
+  void HandleGrabbing(GameObject givenObject) {
     if (!GrabTriggered() && !externalGrabTriggered) { return; }
     externalGrabTriggered = false;
     if (HoldingSomething()) {
-      if (touchedObject != null) {
-        Message("ViveGripHighlightStart"); // TODO: necessary? wouldn't lastTouchedObject handle this in HandleHighlighting?
+      if (givenObject != null) {
+        Message("ViveGripHighlightStart");
       }
       DestroyConnection();
     }
-    else if (touchedObject != null && touchedObject.GetComponent<ViveGrip_Grabbable>() != null) {
+    else if (givenObject != null && givenObject.GetComponent<ViveGrip_Grabbable>() != null) {
       Message("ViveGripHighlightStop");
       Message("ViveGripGrabStart");
     }
@@ -68,6 +67,28 @@
       return controller.Pressed("grab");
     }
     return HoldingSomething() ? controller.Released("grab") : controller.Pressed("grab");
+  }
+
+  void DestroyConnection() {
+    firmlyGrabbed = false;
+    Message("ViveGripGrabStop", HeldObject()); // TODO: what if I don't specify an object here?
+  }
+
+  void HandleFumbling() {
+    if (HoldingSomething()) {
+      float grabDistance = CalculateGrabDistance();
+      bool withinRadius = grabDistance <= holdRadius;
+      firmlyGrabbed = firmlyGrabbed || withinRadius;
+      if (firmlyGrabbed && !withinRadius) {
+        DestroyConnection();
+      }
+    }
+  }
+
+  float CalculateGrabDistance() {
+    ViveGrip_Grabbable grabbable = joint.connectedBody.gameObject.GetComponent<ViveGrip_Grabbable>();
+    Vector3 grabbedAnchorPosition = grabbable.WorldAnchorPosition();
+    return Vector3.Distance(transform.position, grabbedAnchorPosition);
   }

   void HandleInteraction(GameObject givenObject) {
@@ -100,28 +121,6 @@
     return first.GetInstanceID() == second.GetInstanceID();
   }

-  void HandleFumbling() {
-    if (HoldingSomething()) {
-      float grabDistance = CalculateGrabDistance();
-      bool withinRadius = grabDistance <= holdRadius;
-      firmlyGrabbed = firmlyGrabbed || withinRadius;
-      if (firmlyGrabbed && !withinRadius) {
-        DestroyConnection();
-      }
-    }
-  }
-
-  float CalculateGrabDistance() {
-    ViveGrip_Grabbable grabbable = joint.connectedBody.gameObject.GetComponent<ViveGrip_Grabbable>();
-    Vector3 grabbedAnchorPosition = grabbable.WorldAnchorPosition();
-    return Vector3.Distance(transform.position, grabbedAnchorPosition);
-  }
-
-  void DestroyConnection() {
-    firmlyGrabbed = false;
-    Message("ViveGripGrabStop", HeldObject()); // TODO: what if I don't specify an object here?
-  }
-
   GameObject InstantiateTouchSphere() {
     GameObject gripSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
     Renderer sphereRenderer = gripSphere.GetComponent<Renderer>();
@@ -145,11 +144,11 @@
   }

   public bool TouchingSomething() {
-    return touch.NearestObject() != null;
+    return TouchedObject() != null;
   }

   public GameObject TouchedObject() {
-    return touchedObject;
+    return touch.NearestObject();
   }

   public GameObject HeldObject() {
@@ -168,7 +167,7 @@
   void Message(string name, GameObject objectToMessage = null) {
     // Debug.Log(name + " -- " + TrackedObject());
     TrackedObject().BroadcastMessage(name, this, SendMessageOptions.DontRequireReceiver); // TODO: can I get away with Send here for something like the hands?
-    objectToMessage = objectToMessage ?? touch.NearestObject();
+    objectToMessage = objectToMessage ?? TouchedObject();
     if (objectToMessage == null) { return; }
     // Debug.Log(Time.time + "\t-- " + name + "\t-- " + objectToMessage);
     objectToMessage.SendMessage(name, this, SendMessageOptions.DontRequireReceiver);


Added annotation to constructor.

Added annotation to constructor.

--- AudioWorks/AudioWorks.Extensions/SampleCollection.cs
+++ AudioWorks/AudioWorks.Extensions/SampleCollection.cs
@@ -40,6 +40,7 @@
         [CollectionAccess(CollectionAccessType.None)]
         public int Frames => _samples[0].Length;

+        [CollectionAccess(CollectionAccessType.UpdatedContent)]
         internal SampleCollection([NotNull] float[][] samples)
         {
             _samples = samples;


Make sure mnemonic phrase doesn't blend into background

--- BTCPayServer/Controllers/StoresController.BTCLike.cs
+++ BTCPayServer/Controllers/StoresController.BTCLike.cs
@@ -380,7 +380,7 @@
                 TempData.SetStatusMessageModel(new StatusMessageModel()
                 {
                     Severity = StatusMessageModel.StatusSeverity.Success,
-                    Html = $"Your wallet has been generated. Please store your seed securely!
{response.Mnemonic}"
+                    Html = $"Your wallet has been generated. Please store your seed securely!
{response.Mnemonic}"
                 });
             }
             else


Fix route sav

Fix route sav

--- Battery-Commander.Web/Controllers/UnitsController.cs
+++ Battery-Commander.Web/Controllers/UnitsController.cs
@@ -49,7 +49,7 @@
             return View(await db.Units.FindAsync(id));
         }

-        [Route, HttpPost, ValidateAntiForgeryToken]
+        [Route("Save"), HttpPost, ValidateAntiForgeryToken]
         public async Task<IActionResult> Save(Unit model)
         {
             if (await db.Units.AnyAsync(unit => unit.Id == model.Id) == false)


Language version mismatch fix

Language version mismatch fix

--- Commons.Collections.SquareList/VerticalLinkedList.cs
+++ Commons.Collections.SquareList/VerticalLinkedList.cs
@@ -74,7 +74,7 @@
         for (int i = Depth; i > 0; i--) {
             var value = _bigArray[next];
             if (predicate(value)) {
-                InnerRemove(next);
+                _ = InnerRemove(next);
                 removed++;
             } else
                 next++;
@@ -139,7 +139,8 @@
         _bigArray[slot] = value;
     }

-    internal void Receive(VerticalLinkedList<T> from!!) {
+    internal void Receive(VerticalLinkedList<T> from) {
+        if (from is null) throw new ArgumentNullException(nameof(from));
         int delta = from._firstIndex;
         for (int i = from.Depth - 1; i >= 0; i--)
             _bigArray[i] = _bigArray[i + delta];
@@ -163,7 +164,7 @@
                     var start = up;
                     while (upCompare == 0) {
                         removed++;
-                        InnerRemove(up);
+                        _ = InnerRemove(up);
                         if ((!removeAll) || (--i <= 0))
                             break;
                         upCompare = _bigArray[up].CompareTo(value);


Add bounds checking to EmptyPixel functions

This prevents memory access violations

--- QuickFont/QBitmap.cs
+++ QuickFont/QBitmap.cs
@@ -48,23 +48,23 @@
         }

         /// <summary>
-        /// Returns try if the given pixel is empty (i.e. black)
+        /// Returns true if the given pixel is empty (i.e. black)
         /// </summary>
         public static unsafe bool EmptyPixel(BitmapData bitmapData, int px, int py)
         {
-
+			if (px < 0 || py < 0 || px >= bitmapData.Width || py >= bitmapData.Height) return true;
             byte* addr = (byte*) (bitmapData.Scan0) + bitmapData.Stride*py + px*3;
             return (*addr == 0 && *(addr + 1) == 0 && *(addr + 2) == 0);

         }

         /// <summary>
-        /// Returns try if the given pixel is empty (i.e. alpha is zero)
+        /// Returns true if the given pixel is empty (i.e. alpha is zero)
         /// </summary>
         public static unsafe bool EmptyAlphaPixel(BitmapData bitmapData, int px, int py, byte alphaEmptyPixelTolerance)
         {
-
-            byte* addr = (byte*) (bitmapData.Scan0) + bitmapData.Stride*py + px*4;
+			if (px < 0 || py < 0 || px >= bitmapData.Width || py >= bitmapData.Height) return true;
+			byte* addr = (byte*) (bitmapData.Scan0) + bitmapData.Stride*py + px*4;
             return (*(addr + 3) <= alphaEmptyPixelTolerance);

         }


FileConfigProvider - work in progress

FileConfigProvider - work in progress

--- CustomBlocks/Config/Private/IConfigStorageBackend.cs
+++ CustomBlocks/Config/Private/IConfigStorageBackend.cs
@@ -31,29 +31,13 @@
 	/// <summary>
 	/// Internal interface, for use with config provider class.
 	/// Perform direct access to shared storage media: read and write of raw config data.
-	/// Object of this interface should resolve access conflicts and may be shared across different instances of config providers
+	/// Object of this interface should resolve access conflicts and may be shared across different instances of config providers.
 	/// May be used (but it is not required) to simplify and unify internal design of config provider class.
 	/// May be also used to simplify unit testing of config provider class.
+	/// Not for general and direct use: initialization, deinitialization, usage pattern and realization may differ with various config providers types.
 	/// </summary>
 	public interface IConfigStorageBackend
 	{
-		/// <summary>
-		/// Call this, to perform sorage media init.
-		/// You must call this method before any other read or write operation with ConfigStorageBackend.
-		/// This method may block while performing access to media.
-		/// If init process is failed (some serious error happened), exception from failed routine will be thrown.
-		/// When sharing one instance of IConfigStorageBackend across multiple instances of config provider,
-		/// this method should be threadsafe, and should not fail when running from different config providers.
-		/// </summary>
-		void Init();
-		/// <summary>
-		/// Async implementation of Init.
-		/// </summary>
-		void InitAsync();
-		/// <summary>
-		/// Perform deinit. IConfigStorageBackend must not be used anymore after calling this method.
-		/// </summary>
-		void Deinit();
 		/// <summary>
 		/// Is write of config data allowed by storage media ? This is an informational property:
 		/// It will try to detect on start, if all nessecary conditions are met to perform data write.
@@ -62,7 +46,7 @@
 		bool IsWriteAllowed { get; }
 		/// <summary>
 		/// Fetch latest snapshot of raw config data. Initial data snapshot must be read and cached from storage media,
-		/// when performing Init, and it must be updated on Commit. This method must be thread safe, and also it should not block
+		/// when creating object, and it must be updated on Commit. This method must be thread safe, and also it should not block
 		/// while performing commit operations.
 		/// </summary>
 		/// <returns>Copy of current in-memory raw config data snapshot</returns>
@@ -84,8 +68,8 @@
 		Task CommitAsync(byte[] data);
 		/// <summary>
 		/// Mark config data to be deleted on storage media resource close.
-		/// If sharing the same instance of ConfigStorageBackend between multiple providers, this flag will be reset,
-		/// if some other provider call Init method.
+		/// When sharing the same instance of ConfigStorageBackend between multiple providers to avoid resource access conflicts,
+		/// data deletion will be performed only after last client release this instance.
 		/// </summary>
 		void MarkForDelete();
 	}


UpdateAsync now uses Parallel.ForEachAsync

--- RdrLib/RdrService.cs
+++ RdrLib/RdrService.cs
@@ -3,9 +3,10 @@
 using System.Collections.ObjectModel;
 using System.Net;
 using System.Net.Http;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Xml.Linq;
-using RdrLib.Common;
+using RdrLib.Exceptions;
 using RdrLib.Helpers;
 using RdrLib.Model;

@@ -18,35 +19,39 @@

 		public RdrService() { }

-		[System.Diagnostics.DebuggerStepThrough]
-		public Task UpdateAsync(Feed feed)
-			=> UpdateFeedAsync(feed);
+		public ValueTask UpdateAsync(Feed feed)
+        {
+            if (feed is null)
+            {
+                throw new ArgumentNullException(nameof(feed));
+            }
+
+            return UpdateFeedAsync(feed, CancellationToken.None);
+        }

-		public Task UpdateAsync(IEnumerable<Feed> feedsToUpdate)
+		public async ValueTask UpdateAsync(IEnumerable<Feed> feedsToUpdate)
 		{
-			Collection<Task> tasks = new Collection<Task>();
-
-			foreach (Feed feed in feedsToUpdate)
-			{
-				Task task = Task.Run(() => UpdateAsync(feed));
-
-				tasks.Add(task);
-			}
-
-			return Task.WhenAll(tasks);
+            await Parallel.ForEachAsync(feedsToUpdate, UpdateFeedAsync).ConfigureAwait(true);
 		}

-		[System.Diagnostics.DebuggerStepThrough]
-		public Task UpdateAllAsync()
+		public ValueTask UpdateAllAsync()
 			=> UpdateAsync(_feeds);

-		private async Task UpdateFeedAsync(Feed feed)
+		private async ValueTask UpdateFeedAsync(Feed feed, CancellationToken cancellationToken)
 		{
 			feed.Status = FeedStatus.Updating;

 			static void configRequest(HttpRequestMessage request)
 			{
-				request.Headers.UserAgent.ParseAdd(UserAgents.Firefox_94_Windows);
+                string userAgentHeaderValue = UserAgents.Get(UserAgents.Firefox_102_Windows);
+
+                if (!request.Headers.UserAgent.TryParseAdd(userAgentHeaderValue))
+                {
+                    throw new HeaderException
+                    {
+                        UnaddableHeader = userAgentHeaderValue
+                    };
+                }
 			}

 			StringResponse response = await Web.DownloadStringAsync(feed.Link, configRequest).ConfigureAwait(false);
@@ -79,25 +84,27 @@
 			feed.Status = FeedStatus.Ok;
 		}

-		[System.Diagnostics.DebuggerStepThrough]
 		public Task<FileResponse> DownloadEnclosureAsync(Enclosure enclosure, string path)
 			=> DownloadEnclosureAsync(enclosure, path, null);

-		public async Task<FileResponse> DownloadEnclosureAsync(Enclosure enclosure, string path, IProgress<FileProgress>? progress)
+		public Task<FileResponse> DownloadEnclosureAsync(Enclosure enclosure, string path, IProgress<FileProgress>? progress)
 		{
-			if (progress is null)
-			{
-				return await Web.DownloadFileAsync(enclosure.Link, path).ConfigureAwait(false);
-			}
-			else
-			{
-				return await Web.DownloadFileAsync(enclosure.Link, path, progress).ConfigureAwait(false);
-			}
+			if (enclosure is null)
+            {
+                throw new ArgumentNullException(nameof(enclosure));
+            }
+
+            return Web.DownloadFileAsync(enclosure.Link, path, progress);
 		}

 		public bool Add(Feed feed)
 		{
-			if (!_feeds.Contains(feed))
+			if (feed is null)
+            {
+                throw new ArgumentNullException(nameof(feed));
+            }
+
+            if (!_feeds.Contains(feed))
 			{
 				_feeds.Add(feed);

@@ -109,7 +116,12 @@

 		public int Add(IReadOnlyCollection<Feed> feeds)
 		{
-			int added = 0;
+			if (feeds is null)
+            {
+                throw new ArgumentNullException(nameof(feeds));
+            }
+
+            int added = 0;

 			foreach (Feed feed in feeds)
 			{
@@ -124,7 +136,12 @@

 		public bool Remove(Feed feed)
 		{
-			if (_feeds.Contains(feed))
+			if (feed is null)
+            {
+                throw new ArgumentNullException(nameof(feed));
+            }
+
+            if (_feeds.Contains(feed))
 			{
 				return _feeds.Remove(feed);
 			}
@@ -136,7 +153,12 @@

 		public int Remove(IReadOnlyCollection<Feed> feeds)
 		{
-			int removed = 0;
+			if (feeds is null)
+            {
+                throw new ArgumentNullException(nameof(feeds));
+            }
+
+            int removed = 0;

 			foreach (Feed feed in feeds)
 			{
@@ -162,6 +184,14 @@
 			}
 		}

-		public void MarkAsRead(Item item) => item.Unread = false;
+		public void MarkAsRead(Item item)
+        {
+            if (item is null)
+            {
+                throw new ArgumentNullException(nameof(item));
+            }
+
+            item.Unread = false;
+        }
 	}
 }


Added vsync, auto resize and scaling

Added vsync, auto resize and scaling

--- DirectXRenderer/Rendering/DirectX/DirectXRenderer.cs
+++ DirectXRenderer/Rendering/DirectX/DirectXRenderer.cs
@@ -194,11 +194,18 @@
                 Usage = Usage.RenderTargetOutput,
                 OutputHandle = SGL.Components.Get<RenderTarget>().Handle,
                 IsWindowed = true,
-                ModeDescription = new ModeDescription(GraphicsDevice.DisplayMode.Width, GraphicsDevice.DisplayMode.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm),
+                ModeDescription = new ModeDescription(GraphicsDevice.DisplayMode.Width, GraphicsDevice.DisplayMode.Height, new Rational((int)SGL.Components.Get<GraphicsDevice>().RefreshRate, 1), Format.R8G8B8A8_UNorm),
                 SampleDescription = new SampleDescription(1, 0),
                 Flags = SwapChainFlags.AllowModeSwitch,
                 SwapEffect = SwapEffect.Discard
             };
+
+            if (VSync)
+            {
+                swapChainDesc.ModeDescription.RefreshRate = new Rational(60, 1);
+            }
+
+            swapChainDesc.ModeDescription.Scaling = GraphicsDevice.DisplayMode.Scaling ? DisplayModeScaling.Stretched : DisplayModeScaling.Unspecified;

             Device device;
             SwapChain swapChain;
@@ -238,6 +245,8 @@
         {
             CheckDisposed();

+            _swapChain.ResizeBuffers(2, GraphicsDevice.DisplayMode.Width, GraphicsDevice.DisplayMode.Height,
+                Format.R8G8B8A8_UNorm, SwapChainFlags.AllowModeSwitch);
             DirectXHelper.RenderTarget.BeginDraw();
             DirectXHelper.RenderTarget.Transform = Matrix3x2.Identity;
             DirectXHelper.RenderTarget.Clear(DirectXHelper.ConvertColor(GraphicsDevice.ClearColor));
@@ -334,7 +343,7 @@
         {
             if (IsDisposed)
             {
-                throw new ObjectDisposedException("GdiRenderer");
+                throw new ObjectDisposedException("DirectXRenderer");
             }
         }


autoformat

autoformat

--- ExpressionToCodeLib/Internal/ExpressionToCodeImpl.cs
+++ ExpressionToCodeLib/Internal/ExpressionToCodeImpl.cs
@@ -243,7 +243,7 @@
                 le.Parameters.Count == 1
                     ? NestExpression(e.NodeType, le.Parameters.Single())
                     : ArgListDispatch(le.Parameters.Select(SingleChildDispatch))
-                //though delegate lambdas do support ref/out parameters, expression tree lambda's don't
+            //though delegate lambdas do support ref/out parameters, expression tree lambda's don't
             );
             kids.Add(" => ");
             kids.Add(NestExpression(le.NodeType, le.Body));
@@ -342,7 +342,7 @@
                 && mce.Arguments.Count == 2
                 && mce.Arguments[0] is ConstantExpression formatStringExpr
                 && formatStringExpr.Type == typeof(string)
-                && mce.Arguments[1] .Type == typeof(object[])
+                && mce.Arguments[1].Type == typeof(object[])
                 && mce.Arguments[1] is NewArrayExpression interpolationArguments
             ) {
                 //.net 4.6
@@ -357,7 +357,7 @@
                 && mce.Arguments.Count >= 2
                 && mce.Arguments[0] is ConstantExpression formatString2Expr
                 && formatString2Expr.Type == typeof(string)
-                && mce.Method.GetParameters().Skip(1).All(pi=>pi.ParameterType == typeof(object))
+                && mce.Method.GetParameters().Skip(1).All(pi => pi.ParameterType == typeof(object))
             ) {
                 //.net 4.6
                 //string-interpolations are compiled into FormattableStringFactory.Create
@@ -505,7 +505,7 @@
                 || (haystack.IsArray || haystack.IsByRef) && ContainsInferableType(haystack.GetElementType(), needle)
                 || haystack.GetTypeInfo().IsGenericType
                     && !(typeof(Delegate).IsAssignableFrom(haystack)
-                        && haystack.GetTypeInfo().GetMethod("Invoke").GetParameters().Any(pi=>pi.ParameterType == needle)
+                        && haystack.GetTypeInfo().GetMethod("Invoke").GetParameters().Any(pi => pi.ParameterType == needle)
                     )
                     && haystack.GetTypeInfo().GetGenericArguments().Any(argType => ContainsInferableType(argType, needle));


Update Demo

Update Demo

--- SqlServerTest/Demos/Query.cs
+++ SqlServerTest/Demos/Query.cs
@@ -121,6 +121,8 @@
             var getAll = db.Queryable<Student>().ToList();
             var getAllNoLock = db.Queryable<Student>().With(SqlWith.NoLock).ToList();
             var getByPrimaryKey = db.Queryable<Student>().InSingle(2);
+            var getSingleOrDefault = db.Queryable<Student>().Single();
+            var getFirstOrDefault = db.Queryable<Student>().First();
             var getByWhere = db.Queryable<Student>().Where(it => it.Id == 1 || it.Name == "a").ToList();
             var getByFuns = db.Queryable<Student>().Where(it => SqlFunc.IsNullOrEmpty(it.Name)).ToList();
             var sum = db.Queryable<Student>().Sum(it => it.Id);


Refactorings

Refactorings

--- Styx/Illias/Ids/System_Id.cs
+++ Styx/Illias/Ids/System_Id.cs
@@ -28,9 +28,7 @@
     /// A system identification is unique identification of a single system
     /// within a larger distributed system.
     /// </summary>
-    public struct System_Id : IId,
-                              IEquatable<System_Id>,
-                              IComparable<System_Id>
+    public readonly struct System_Id : IId<System_Id>
     {

         #region Data


Don't use the gatekeeper in listening mode.

(performance optimization)

--- Syndll2/NetworkConnection.cs
+++ Syndll2/NetworkConnection.cs
@@ -18,6 +18,7 @@
         private readonly ManualResetEvent _acceptSignaler = new ManualResetEvent(false);
         private IPEndPoint _remoteEndPoint;
         private bool _disposed;
+        private bool _useGateKeeper;

         public bool Connected
@@ -38,10 +39,11 @@
             get { return _stream; }
         }

-        private NetworkConnection(Socket socket)
+        private NetworkConnection(Socket socket, bool useGateKeeper)
         {
             _socket = socket;
             _remoteEndPoint = (IPEndPoint) _socket.RemoteEndPoint;
+            _useGateKeeper = useGateKeeper;

             // If the socket is connected, get the stream.
             if (_socket.Connected)
@@ -104,7 +106,7 @@

             Util.Log("Connected!");

-            return new NetworkConnection(socket);
+            return new NetworkConnection(socket, true);
         }

 #if NET_45
@@ -182,7 +184,7 @@
         public static NetworkConnection Listen(int port, Action<NetworkConnection> action)
         {
             var listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-            var listener = new NetworkConnection(listenerSocket);
+            var listener = new NetworkConnection(listenerSocket, false);

             var localEndPoint = new IPEndPoint(IPAddress.Any, port);
             listener._socket.Bind(localEndPoint);
@@ -203,7 +205,7 @@
                             var ep = (IPEndPoint) socket.RemoteEndPoint;
                             Util.Log(string.Format("Inbound connection from {0}", ep.Address));

-                            using (var connection = new NetworkConnection(socket))
+                            using (var connection = new NetworkConnection(socket, false))
                             {
                                 connection._remoteEndPoint = (IPEndPoint) socket.RemoteEndPoint;
                                 action(connection);
@@ -276,8 +278,9 @@
             }
             finally
             {
-                // ALWAYS exit the gatekeeper
-                GateKeeper.Exit(_remoteEndPoint);
+                // Exit the gatekeeper
+                if (_useGateKeeper)
+                    GateKeeper.Exit(_remoteEndPoint);
             }
         }


Only blacklist qualified name accesses

Only blacklist qualified name accesses

--- Core/Services/Validator.cs
+++ Core/Services/Validator.cs
@@ -18,9 +18,13 @@
                     return false;
                 }

-                if (syntaxNode is QualifiedNameSyntax ||
+                // QualifiedNameExpression
+                // * represents a qualified name of the form <left-name>.<right-identifier-or-generic-name> such as System.IO
+                //
+
+                if (syntaxNode is QualifiedNameSyntax) /* ||
                     (syntaxNode is InvocationExpressionSyntax &&
-                     ((InvocationExpressionSyntax)syntaxNode).Expression is MemberAccessExpressionSyntax)) {
+                     ((InvocationExpressionSyntax)syntaxNode).Expression is MemberAccessExpressionSyntax)) */{
                     return false;
                 }
             }


New version number.

New version number.

--- CotcSdk/HighLevel/Cloud.cs
+++ CotcSdk/HighLevel/Cloud.cs
@@ -85,7 +85,7 @@
 		#endregion

 		#region Members
-		public const string SdkVersion = "1.0.4";
+		public const string SdkVersion = "1.0.5";
 		private string ApiKey, ApiSecret, Server;
 		internal int HttpTimeoutMillis {
 			get; private set;


support for changing street lights on roads that don't have a singular street light on all elevations

--- NetworkSkins/GUI/Lights/StreetLightPanelController.cs
+++ NetworkSkins/GUI/Lights/StreetLightPanelController.cs
@@ -136,8 +136,9 @@

             var groundStreetLight = StreetLightUtils.GetDefaultStreetLight(Prefab);
             if (groundStreetLight != null) {
-                if (!StreetLightUtils.HasSingularStreetLight(Prefab)) return new Dictionary<NetInfo, PropInfo>();
-                defaultStreetLights[Prefab] = groundStreetLight;
+                if (StreetLightUtils.HasSingularStreetLight(Prefab)) {
+                    defaultStreetLights[Prefab] = groundStreetLight;
+                }
             }

@@ -146,8 +147,9 @@
             {
                 var elevatedStreetLight = StreetLightUtils.GetDefaultStreetLight(elevatedPrefab);
                 if (elevatedStreetLight != null) {
-                    if (!StreetLightUtils.HasSingularStreetLight(elevatedPrefab)) return new Dictionary<NetInfo, PropInfo>();
-                    defaultStreetLights[elevatedPrefab] = elevatedStreetLight;
+                    if (StreetLightUtils.HasSingularStreetLight(elevatedPrefab)) {
+                        defaultStreetLights[elevatedPrefab] = elevatedStreetLight;
+                    }
                 }
             }

@@ -156,8 +158,9 @@
             {
                 var bridgeStreetLight = StreetLightUtils.GetDefaultStreetLight(bridgePrefab);
                 if (bridgeStreetLight != null) {
-                    if (!StreetLightUtils.HasSingularStreetLight(bridgePrefab)) return new Dictionary<NetInfo, PropInfo>();
-                    defaultStreetLights[bridgePrefab] = bridgeStreetLight;
+                    if (StreetLightUtils.HasSingularStreetLight(bridgePrefab)) {
+                        defaultStreetLights[bridgePrefab] = bridgeStreetLight;
+                    }
                 }
             }

@@ -179,13 +182,19 @@
                         new StreetLightModifier(item.Value, repeatDistance)
                     };

-                    modifiers[Prefab] = prefabModifiers;
+                    if (StreetLightUtils.HasSingularStreetLight(Prefab)) {
+                        modifiers[Prefab] = prefabModifiers;
+                    }

                     var elevatedPrefab = NetUtils.GetElevatedPrefab(Prefab);
-                    if (elevatedPrefab != null) modifiers[elevatedPrefab] = prefabModifiers;
+                    if (StreetLightUtils.HasSingularStreetLight(elevatedPrefab)) {
+                        modifiers[elevatedPrefab] = prefabModifiers;
+                    }

                     var bridgePrefab = NetUtils.GetBridgePrefab(Prefab);
-                    if (bridgePrefab != null) modifiers[bridgePrefab] = prefabModifiers;
+                    if (StreetLightUtils.HasSingularStreetLight(bridgePrefab)) {
+                        modifiers[bridgePrefab] = prefabModifiers;
+                    }
                 }
             }


not sure why this test is being reverted

--- Octokit.Tests.Integration/Clients/TeamsClientTests.cs
+++ Octokit.Tests.Integration/Clients/TeamsClientTests.cs
@@ -67,7 +67,7 @@
             Assert.Equal(HttpStatusCode.Unauthorized, e.StatusCode);
         }

-        [OrganizationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for the resolution to this failing test")]
+        [OrganizationTest]
         public async Task FailsWhenAuthenticatedWithBadCredentials()
         {
             var github = Helper.GetBadCredentialsClient();


varregion: fix for teleporting by double clicking on a map location. Thanks Garmin.

--- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -8942,6 +8942,19 @@
             TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest;
             if (handlerTeleportLocationRequest != null)
             {
+                // Adjust teleport location to base of a larger region if requested to teleport to a sub-region
+                uint locX, locY;
+                Util.RegionHandleToWorldLoc(tpLocReq.Info.RegionHandle, out locX, out locY);
+                if ((locX >= m_scene.RegionInfo.WorldLocX)
+                            && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX))
+                            && (locY >= m_scene.RegionInfo.WorldLocY)
+                            && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) )
+                {
+                    tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle;
+                    tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX;
+                    tpLocReq.Info.Position.Y += locY - m_scene.RegionInfo.WorldLocY;
+                }
+
                 handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
                                                tpLocReq.Info.LookAt, 16);
             }


Treat intersect masks like add masks.

Treat intersect masks like add masks.

--- LottieUWP/Model/Layer/BaseLayer.cs
+++ LottieUWP/Model/Layer/BaseLayer.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using Windows.Foundation;
 using LottieUWP.Animation.Content;
 using LottieUWP.Animation.Keyframe;
@@ -308,12 +309,30 @@
         private void ApplyMasks(BitmapCanvas canvas, Matrix3X3 matrix)
         {
             ApplyMasks(canvas, matrix, Mask.MaskMode.MaskModeAdd);
+            // Treat intersect masks like add masks. This is not correct but it's closer.
+            ApplyMasks(canvas, matrix, Mask.MaskMode.MaskModeIntersect);
             ApplyMasks(canvas, matrix, Mask.MaskMode.MaskModeSubtract);
         }

         private void ApplyMasks(BitmapCanvas canvas, Matrix3X3 matrix, Mask.MaskMode maskMode)
         {
-            var paint = maskMode == Mask.MaskMode.MaskModeSubtract ? _subtractMaskPaint : _addMaskPaint;
+            Paint paint;
+            switch (maskMode)
+            {
+                case Mask.MaskMode.MaskModeSubtract:
+                    paint = _subtractMaskPaint;
+                    break;
+                case Mask.MaskMode.MaskModeIntersect:
+                    Debug.WriteLine("Animation contains intersect masks. They are not supported but will be " +
+                                 "treated like intersect masks.", LottieLog.Tag);
+                    goto case Mask.MaskMode.MaskModeAdd;
+                case Mask.MaskMode.MaskModeAdd:
+                default:
+                    // As a hack, we treat all non-subtract masks like add masks. This is not correct but it's
+                    // better than nothing.
+                    paint = _addMaskPaint;
+                    break;
+            }

             var size = _mask.Masks.Count;


send zero velocity again on avatar full update or its ugly

--- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5291,7 +5291,7 @@

             byte[] objectData = new byte[76];

-            Vector3 velocity = data.Velocity;
+            Vector3 velocity = new Vector3(0, 0, 0);
             Vector3 acceleration = new Vector3(0, 0, 0);
             rotation.Normalize();
             Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z);