Fix the computation for the elapsed time computation property.

--- it.unifi.dsi.stlab.networkreasoner.gas.system/exactly-dimensioned-instance/system-operations/FluidDynamicSystemStateTransitionNewtonRaphsonSolve.cs
+++ it.unifi.dsi.stlab.networkreasoner.gas.system/exactly-dimensioned-instance/system-operations/FluidDynamicSystemStateTransitionNewtonRaphsonSolve.cs
@@ -11,13 +11,9 @@
 		: FluidDynamicSystemStateTransition
 	{
 		public List<UntilConditionAbstract> UntilConditions{ get; set; }
-
 		//public Func<Vector<NodeForNetwonRaphsonSystem>, Vector<NodeForNetwonRaphsonSystem>> FromDimensionalToAdimensionalTranslator{ get; set; }
-
 		public GasFormulaVisitor FormulaVisitor{ get; set; }
-
 		#region computation driver classes
-
 		abstract class MutateComputationDriver
 		{
 			public abstract bool canDoOneMoreStep ();
@@ -54,9 +50,7 @@
 			}
 			#endregion
 		}
-
 		#endregion
-
 		#region FluidDynamicSystemStateTransition implementation
 		public FluidDynamicSystemStateAbstract forBareSystemState (
 			FluidDynamicSystemStateBare fluidDynamicSystemStateBare)
@@ -69,14 +63,15 @@
 		{
 			var mathematicallySolvedState = new FluidDynamicSystemStateMathematicallySolved ();

+			var startTimeStamp = DateTime.UtcNow;
+
 			OneStepMutationResults previousOneStepMutationResults = null;

 			OneStepMutationResults currentOneStepMutationResults =
-			new OneStepMutationResults{
+			new OneStepMutationResults {
 				IterationNumber = 0,
 				Unknowns = fluidDynamicSystemStateUnsolved.InitialUnknownVector,
-				Fvector = fluidDynamicSystemStateUnsolved.InitialFvector,
-				ComputationStartTimestamp = DateTime.UtcNow
+				Fvector = fluidDynamicSystemStateUnsolved.InitialFvector
 			};

 			MutateComputationDriver mutateComputationDriver =
@@ -87,8 +82,8 @@
 				UntilConditions.ForEach (condition => {

 					if (this.decideIfComputationShouldBeStopped (condition,
-					                              previousOneStepMutationResults,
-					                              currentOneStepMutationResults)) {
+					                                             previousOneStepMutationResults,
+					                                             currentOneStepMutationResults)) {

 						mutateComputationDriver = new MutateComputationDriverStopMutate ();
 					}
@@ -117,6 +112,7 @@
 				fluidDynamicSystemStateUnsolved.Edges);

 			currentOneStepMutationResults.ComputationEndTimestamp = DateTime.UtcNow;
+			currentOneStepMutationResults.ComputationStartTimestamp = startTimeStamp;
 			mathematicallySolvedState.MutationResult = currentOneStepMutationResults;
 			mathematicallySolvedState.SolvedBy = this;

@@ -137,7 +133,6 @@
 			return fluidDynamicSystemStateNegativeLoadsCorrected;
 		}
 		#endregion
-
 		protected virtual bool decideIfComputationShouldBeStopped (
 			UntilConditionAbstract condition,
 			OneStepMutationResults previousOneStepMutationResults,
@@ -156,6 +151,8 @@
 			OneStepMutationResults previousStepMutationResults,
 			FluidDynamicSystemStateUnsolved fluidDynamicSystemStateUnsolved)
 		{
+			var mutateStartTimestamp = DateTime.UtcNow;
+
 			var unknownVectorAtPreviousStep = computeUnknownVectorAtPreviousStep (
 				previousStepMutationResults);

@@ -188,11 +185,11 @@

 			DimensionalObjectWrapper<Vector<NodeForNetwonRaphsonSystem>> unknownVectorAtCurrentStep =
 				computeUnknowns (
-					AmatrixAtCurrentStep,
-					adimensionalUnknownVectorAtPreviousStep.WrappedObject,
-					coefficientsVectorAtCurrentStep,
-					JacobianMatrixAtCurrentStep,
-					fluidDynamicSystemStateUnsolved.NodesEnumeration);
+				AmatrixAtCurrentStep,
+				adimensionalUnknownVectorAtPreviousStep.WrappedObject,
+				coefficientsVectorAtCurrentStep,
+				JacobianMatrixAtCurrentStep,
+				fluidDynamicSystemStateUnsolved.NodesEnumeration);

 			fixNegativeUnknowns (unknownVectorAtCurrentStep.WrappedObject);

@@ -213,14 +210,12 @@
 			                                           JacobianMatrixAtCurrentStep,
 			                                           FvectorAtCurrentStep,
 			                                           previousStepMutationResults.IterationNumber,
+			                                           mutateStartTimestamp,
 			                                           fluidDynamicSystemStateUnsolved);

 			return result;
 		}
-
 		#region ``compute'' methods
-
-
 		protected virtual DimensionalObjectWrapper<Vector<NodeForNetwonRaphsonSystem>> makeAdimensionalUnknowns (
 			DimensionalObjectWrapper<Vector<NodeForNetwonRaphsonSystem>> unknownVectorAtPreviousStep)
 		{
@@ -280,12 +275,13 @@

 		public OneStepMutationResults computeOneStepMutationResult (
 			Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem> AmatrixAtCurrentStep,
-		    DimensionalObjectWrapper<Vector<NodeForNetwonRaphsonSystem>> unknownVectorAtCurrentStep,
+			DimensionalObjectWrapper<Vector<NodeForNetwonRaphsonSystem>> unknownVectorAtCurrentStep,
 			Vector<NodeForNetwonRaphsonSystem> coefficientsVectorAtCurrentStep,
 			Vector<EdgeForNetwonRaphsonSystem> QvectorAtCurrentStep,
 			Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem> JacobianMatrixAtCurrentStep,
 			Vector<EdgeForNetwonRaphsonSystem> FvectorAtCurrentStep,
 			int iterationNumber,
+			DateTime stepStartTimestamp,
 			FluidDynamicSystemStateUnsolved fluidDynamicSystemStateUnsolved)
 		{
 			var result = new OneStepMutationResults ();
@@ -298,13 +294,14 @@
 			result.IterationNumber = iterationNumber;
 			result.StartingUnsolvedState = fluidDynamicSystemStateUnsolved;
 			result.UsedFormulae = FormulaVisitor;
-
+			result.ComputationStartTimestamp = stepStartTimestamp;
+			result.ComputationEndTimestamp = DateTime.UtcNow;
 			return result;
 		}

 		protected virtual Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem>
 			computeAmatrix (Vector<EdgeForNetwonRaphsonSystem> kvectorAtCurrentStep,
-			                List<EdgeForNetwonRaphsonSystem> edges)
+		                 List<EdgeForNetwonRaphsonSystem> edges)
 		{
 			Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem> Amatrix =
 				new Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem> ();
@@ -318,7 +315,7 @@

 		protected virtual Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem>
 			computeJacobianMatrix (Vector<EdgeForNetwonRaphsonSystem> kvectorAtCurrentStep,
-			                       List<EdgeForNetwonRaphsonSystem> edges)
+		                        List<EdgeForNetwonRaphsonSystem> edges)
 		{
 			Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem> JacobianMatrix =
 				new Matrix<NodeForNetwonRaphsonSystem, NodeForNetwonRaphsonSystem> ();
@@ -359,9 +356,9 @@

 			Vector<NodeForNetwonRaphsonSystem> unknownVectorFromJacobianSystemAtCurrentStep =
 				jacobianMatrixAtCurrentStep.SolveWithGivenEnumerations (
-					nodesEnumeration,
-					nodesEnumeration,
-					coefficientVectorForJacobianSystemFactorization);
+				nodesEnumeration,
+				nodesEnumeration,
+				coefficientVectorForJacobianSystemFactorization);

 			unknownVectorFromJacobianSystemAtCurrentStep.updateEach (
 				(node, currentValue) => currentValue * .75);
@@ -369,7 +366,7 @@
 			Vector<NodeForNetwonRaphsonSystem> unknownVectorAtCurrentStep =
 				unknownVectorAtPreviousStep.minus (unknownVectorFromJacobianSystemAtCurrentStep);

-			return new DimensionalObjectWrapperWithAdimensionalValues<Vector<NodeForNetwonRaphsonSystem>>{
+			return new DimensionalObjectWrapperWithAdimensionalValues<Vector<NodeForNetwonRaphsonSystem>> {
 				WrappedObject = unknownVectorAtCurrentStep
 			};
 		}
@@ -413,7 +410,7 @@
 			Vector<EdgeForNetwonRaphsonSystem> velocityVector =
 				new Vector<EdgeForNetwonRaphsonSystem> ();

-			var absolutePressures = pressuresWrapper.translateTo (new AbsolutePressures{
+			var absolutePressures = pressuresWrapper.translateTo (new AbsolutePressures {
 				Nodes = nodes,
 				Formulae = FormulaVisitor
 			}
@@ -431,8 +428,6 @@
 			throw new System.NotImplementedException ();
 		}
 		#endregion
-
-
 	}
 }


Make CI happy instead of codefactor

Make CI happy instead of codefactor

--- osu.Framework/Audio/Track/TrackVirtual.cs
+++ osu.Framework/Audio/Track/TrackVirtual.cs
@@ -81,7 +81,7 @@

             lock (clock)
             {
-                if ((!Looping && hasRaisedCompleted) || !(CurrentTime >= Length))
+                if (!Looping && hasRaisedCompleted || !(CurrentTime >= Length))
                     return;

                 Stop();


Add test coverage of various `ScoreInfo` mod set operations

--- osu.Game.Tests/NonVisual/ScoreInfoTest.cs
+++ osu.Game.Tests/NonVisual/ScoreInfoTest.cs
@@ -2,6 +2,11 @@
 // See the LICENCE file in the repository root for full licence text.

 using NUnit.Framework;
+using osu.Game.Online.API;
+using osu.Game.Rulesets.Mania;
+using osu.Game.Rulesets.Mania.Mods;
+using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.Osu.Mods;
 using osu.Game.Rulesets.Scoring;
 using osu.Game.Scoring;

@@ -29,5 +34,41 @@
             Assert.That(scoreCopy.Rank, Is.EqualTo(ScoreRank.B));
             Assert.That(score.Rank, Is.EqualTo(ScoreRank.X));
         }
+
+        [Test]
+        public void TestModsInitiallyEmpty()
+        {
+            var score = new ScoreInfo();
+
+            Assert.That(score.Mods, Is.Empty);
+            Assert.That(score.APIMods, Is.Empty);
+            Assert.That(score.ModsJson, Is.Empty);
+        }
+
+        [Test]
+        public void TestModsUpdatedCorrectly()
+        {
+            var score = new ScoreInfo
+            {
+                Mods = new Mod[] { new ManiaModClassic() },
+                Ruleset = new ManiaRuleset().RulesetInfo,
+            };
+
+            Assert.That(score.Mods, Contains.Item(new ManiaModClassic()));
+            Assert.That(score.APIMods, Contains.Item(new APIMod(new ManiaModClassic())));
+            Assert.That(score.ModsJson, Contains.Substring("CL"));
+
+            score.APIMods = new[] { new APIMod(new ManiaModDoubleTime()) };
+
+            Assert.That(score.Mods, Contains.Item(new ManiaModDoubleTime()));
+            Assert.That(score.APIMods, Contains.Item(new APIMod(new ManiaModDoubleTime())));
+            Assert.That(score.ModsJson, Contains.Substring("DT"));
+
+            score.Mods = new Mod[] { new ManiaModClassic() };
+
+            Assert.That(score.Mods, Contains.Item(new ManiaModClassic()));
+            Assert.That(score.APIMods, Contains.Item(new APIMod(new ManiaModClassic())));
+            Assert.That(score.ModsJson, Contains.Substring("CL"));
+        }
     }
 }


[V2] Shell scripts now have content generated via a delegate. Both prebuild and post build shell script build phases are now possible. Can cache pre and post build steps prior to the Target being created, which are then pulled in when it is

--- packages/XcodeBuilder/dev/XcodeBuilder.cs
+++ packages/XcodeBuilder/dev/XcodeBuilder.cs
@@ -608,17 +608,24 @@
     public sealed class ShellScriptBuildPhase :
         BuildPhase
     {
+        public delegate string GenerateScriptDelegate(Target target);
+
         public ShellScriptBuildPhase(
-            Target target)
-        {
-            this.Name = "ShellScript";
+            Target target,
+            string name,
+            GenerateScriptDelegate generateScript)
+        {
+            this.Name = name;
             this.IsA = "PBXShellScriptBuildPhase";
             this.ShellPath = "/bin/sh";
             this.ShowEnvironmentInLog = true;
             this.InputPaths = new Bam.Core.StringArray();
             this.OutputPaths = new Bam.Core.StringArray();
             this.AssociatedTarget = target;
-        }
+            this.GenerateScript = generateScript;
+        }
+
+        private GenerateScriptDelegate GenerateScript;

         protected override string BuildActionMask
         {
@@ -701,6 +708,8 @@
                 text.AppendFormat("{0});", indent2);
                 text.AppendLine();
             }
+            text.AppendFormat("{0}name = \"{1}\";", indent2, this.Name);
+            text.AppendLine();
             if (this.OutputPaths.Count > 0)
             {
                 text.AppendFormat("{0}outputPaths = (", indent2);
@@ -717,17 +726,8 @@
             text.AppendLine();
             text.AppendFormat("{0}shellPath = {1};", indent2, this.ShellPath);
             text.AppendLine();
-            var shellScript = new System.Text.StringBuilder();
-            foreach (var config in this.AssociatedTarget.ConfigurationList)
-            {
-                shellScript.AppendFormat("if [ \\\"$CONFIGURATION\\\" = \\\"{0}\\\" ]; then\\n\\n", config.Name);
-                foreach (var line in config.PostBuildCommands)
-                {
-                    shellScript.AppendFormat("  {0}\\n", line);
-                }
-                shellScript.AppendFormat("fi\\n\\n");
-            }
-            text.AppendFormat("{0}shellScript = \"{1}\";", indent2, shellScript.ToString());
+            var scriptContent = this.GenerateScript(this.AssociatedTarget);
+            text.AppendFormat("{0}shellScript = \"{1}\";", indent2, scriptContent);
             text.AppendLine();
             if (!this.ShowEnvironmentInLog)
             {
@@ -999,12 +999,18 @@
             return newTarget;
         }

-        private void
+        public void
         AddNewProjectConfiguration(
             Bam.Core.V2.Module module)
         {
+            var config = module.BuildEnvironment.Configuration;
+            if (this.ProjectConfigurations.ContainsKey(config))
+            {
+                return;
+            }
+
             // add configuration to project
-            var projectConfig = new Configuration(module.BuildEnvironment.Configuration.ToString());
+            var projectConfig = new Configuration(config.ToString());
             projectConfig["USE_HEADERMAP"] = new UniqueConfigurationValue("NO");
             projectConfig["COMBINE_HIDPI_IMAGES"] = new UniqueConfigurationValue("NO"); // TODO: needed to quieten Xcode 4 verification

@@ -1028,7 +1034,7 @@

             this.ConfigurationLists[0].AddConfiguration(projectConfig);
             this.AllConfigurations.Add(projectConfig);
-            this.ProjectConfigurations.Add(module.BuildEnvironment.Configuration, projectConfig);
+            this.ProjectConfigurations.Add(config, projectConfig);
         }

         public Configuration
@@ -1655,7 +1661,9 @@
                 var package = module.Package;
                 if (this.Projects.ContainsKey(package))
                 {
-                    return this.Projects[package];
+                    var project = this.Projects[package];
+                    project.AddNewProjectConfiguration(module);
+                    return project;
                 }
                 else
                 {
@@ -1874,6 +1882,21 @@
         {
         }

+        protected void
+        PullInProjectPreOrPostBuildSteps()
+        {
+            var postBuildCommands = this.Project.ProjectConfigurations[this.ProjectModule.BuildEnvironment.Configuration].PostBuildCommands;
+            if (postBuildCommands.Count > 0)
+            {
+                this.AddPostBuildCommands(postBuildCommands);
+            }
+            var preBuildCommands = this.Project.ProjectConfigurations[this.ProjectModule.BuildEnvironment.Configuration].PreBuildCommands;
+            if (preBuildCommands.Count > 0)
+            {
+                this.AddPreBuildCommands(preBuildCommands);
+            }
+        }
+
         public void
         AddHeader(
             FileReference header)
@@ -1905,7 +1928,20 @@
         {
             if (null == this.Target.PreBuildBuildPhase)
             {
-                var preBuildBuildPhase = new ShellScriptBuildPhase(this.Target);
+                var preBuildBuildPhase = new ShellScriptBuildPhase(this.Target, "Pre Build", (target) =>
+                    {
+                        var content = new System.Text.StringBuilder();
+                        foreach (var config in target.ConfigurationList)
+                        {
+                            content.AppendFormat("if [ \\\"$CONFIGURATION\\\" = \\\"{0}\\\" ]; then\\n\\n", config.Name);
+                            foreach (var line in config.PreBuildCommands)
+                            {
+                                content.AppendFormat("  {0}\\n", line);
+                            }
+                            content.AppendFormat("fi\\n\\n");
+                        }
+                        return content.ToString();
+                    });
                 this.Project.ShellScriptsBuildPhases.Add(preBuildBuildPhase);
                 this.Target.BuildPhases.Add(preBuildBuildPhase);
                 this.Target.PreBuildBuildPhase = preBuildBuildPhase;
@@ -1920,7 +1956,20 @@
         {
             if (null == this.Target.PostBuildBuildPhase)
             {
-                var postBuildBuildPhase = new ShellScriptBuildPhase(this.Target);
+                var postBuildBuildPhase = new ShellScriptBuildPhase(this.Target, "Post Build", (target) =>
+                    {
+                        var content = new System.Text.StringBuilder();
+                        foreach (var config in target.ConfigurationList)
+                        {
+                            content.AppendFormat("if [ \\\"$CONFIGURATION\\\" = \\\"{0}\\\" ]; then\\n\\n", config.Name);
+                            foreach (var line in config.PostBuildCommands)
+                            {
+                                content.AppendFormat("  {0}\\n", line);
+                            }
+                            content.AppendFormat("fi\\n\\n");
+                        }
+                        return content.ToString();
+                    });
                 this.Project.ShellScriptsBuildPhases.Add(postBuildBuildPhase);
                 this.Target.BuildPhases.Add(postBuildBuildPhase);
                 this.Target.PostBuildBuildPhase = postBuildBuildPhase;
@@ -1953,6 +2002,7 @@
             this.Project.ProductRefGroup.AddReference(library);
             this.Target = this.Project.FindOrCreateTarget(module, library, V2.Target.EProductType.StaticLibrary);
             this.Configuration = this.Project.AddNewTargetConfiguration(module, this.Target);
+            this.PullInProjectPreOrPostBuildSteps();
         }
     }

@@ -2033,6 +2083,7 @@
             this.Project.ProductRefGroup.AddReference(application);
             this.Target = this.Project.FindOrCreateTarget(module, application, V2.Target.EProductType.Executable);
             this.Configuration = this.Project.AddNewTargetConfiguration(module, this.Target);
+            this.PullInProjectPreOrPostBuildSteps();
         }
     }

@@ -2053,6 +2104,7 @@
             this.Project.ProductRefGroup.AddReference(dynamicLibrary);
             this.Target = this.Project.FindOrCreateTarget(module, dynamicLibrary, V2.Target.EProductType.DynamicLibrary);
             this.Configuration = this.Project.AddNewTargetConfiguration(module, this.Target);
+            this.PullInProjectPreOrPostBuildSteps();
         }
     }


Update IShapeFactory.cs

Update IShapeFactory.cs

--- src/Core2D/Model/IShapeFactory.cs
+++ src/Core2D/Model/IShapeFactory.cs
@@ -8,39 +8,39 @@

 public interface IShapeFactory
 {
-    PointShapeViewModel Point(double x, double y, bool isStandalone);
+    PointShapeViewModel? Point(double x, double y, bool isStandalone);

-    LineShapeViewModel Line(double x1, double y1, double x2, double y2, bool isStroked);
+    LineShapeViewModel? Line(double x1, double y1, double x2, double y2, bool isStroked);

-    LineShapeViewModel Line(PointShapeViewModel? start, PointShapeViewModel? end, bool isStroked);
+    LineShapeViewModel? Line(PointShapeViewModel? start, PointShapeViewModel? end, bool isStroked);

-    ArcShapeViewModel Arc(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, bool isStroked, bool isFilled);
+    ArcShapeViewModel? Arc(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, bool isStroked, bool isFilled);

-    ArcShapeViewModel Arc(PointShapeViewModel? point1, PointShapeViewModel? point2, PointShapeViewModel? point3, PointShapeViewModel? point4, bool isStroked, bool isFilled);
+    ArcShapeViewModel? Arc(PointShapeViewModel? point1, PointShapeViewModel? point2, PointShapeViewModel? point3, PointShapeViewModel? point4, bool isStroked, bool isFilled);

-    CubicBezierShapeViewModel CubicBezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, bool isStroked, bool isFilled);
+    CubicBezierShapeViewModel? CubicBezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, bool isStroked, bool isFilled);

-    CubicBezierShapeViewModel CubicBezier(PointShapeViewModel? point1, PointShapeViewModel? point2, PointShapeViewModel? point3, PointShapeViewModel? point4, bool isStroked, bool isFilled);
+    CubicBezierShapeViewModel? CubicBezier(PointShapeViewModel? point1, PointShapeViewModel? point2, PointShapeViewModel? point3, PointShapeViewModel? point4, bool isStroked, bool isFilled);

-    QuadraticBezierShapeViewModel QuadraticBezier(double x1, double y1, double x2, double y2, double x3, double y3, bool isStroked, bool isFilled);
+    QuadraticBezierShapeViewModel? QuadraticBezier(double x1, double y1, double x2, double y2, double x3, double y3, bool isStroked, bool isFilled);

-    QuadraticBezierShapeViewModel QuadraticBezier(PointShapeViewModel? point1, PointShapeViewModel? point2, PointShapeViewModel? point3, bool isStroked, bool isFilled);
+    QuadraticBezierShapeViewModel? QuadraticBezier(PointShapeViewModel? point1, PointShapeViewModel? point2, PointShapeViewModel? point3, bool isStroked, bool isFilled);

-    PathShapeViewModel Path(ImmutableArray<PathFigureViewModel> figures, FillRule fillRule, bool isStroked, bool isFilled);
+    PathShapeViewModel? Path(ImmutableArray<PathFigureViewModel> figures, FillRule fillRule, bool isStroked, bool isFilled);

-    RectangleShapeViewModel Rectangle(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string? text);
+    RectangleShapeViewModel? Rectangle(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string? text);

-    RectangleShapeViewModel Rectangle(PointShapeViewModel? topLeft, PointShapeViewModel? bottomRight, bool isStroked, bool isFilled, string? text);
+    RectangleShapeViewModel? Rectangle(PointShapeViewModel? topLeft, PointShapeViewModel? bottomRight, bool isStroked, bool isFilled, string? text);

-    EllipseShapeViewModel Ellipse(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string? text);
+    EllipseShapeViewModel? Ellipse(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string? text);

-    EllipseShapeViewModel Ellipse(PointShapeViewModel? topLeft, PointShapeViewModel? bottomRight, bool isStroked, bool isFilled, string? text);
+    EllipseShapeViewModel? Ellipse(PointShapeViewModel? topLeft, PointShapeViewModel? bottomRight, bool isStroked, bool isFilled, string? text);

-    TextShapeViewModel Text(double x1, double y1, double x2, double y2, string? text, bool isStroked);
+    TextShapeViewModel? Text(double x1, double y1, double x2, double y2, string? text, bool isStroked);

-    TextShapeViewModel Text(PointShapeViewModel? topLeft, PointShapeViewModel? bottomRight, string? text, bool isStroked);
+    TextShapeViewModel? Text(PointShapeViewModel? topLeft, PointShapeViewModel? bottomRight, string? text, bool isStroked);

     ImageShapeViewModel? Image(string? path, double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string? text);

     ImageShapeViewModel? Image(string? path, PointShapeViewModel? topLeft, PointShapeViewModel? bottomRight, bool isStroked, bool isFilled, string? text);
-}+}


yay even more different change

yay even more different change

--- shiftos.main/shiftos/apps/terminal.cs
+++ shiftos.main/shiftos/apps/terminal.cs
@@ -2,6 +2,8 @@
 using System.Windows.Forms;
 using ShiftOS.Engine;
 using ShiftOS.Main.Terminal;
+using System.Linq;
+using System.Collections.Generic;

 namespace ShiftOS.Main.ShiftOS.Apps
 {
@@ -14,6 +16,7 @@
         public bool RunningCommand = false;
         public bool WaitingResponse = false;
         public string InputReturnText = "";
+        public List<string> c = TerminalBackend.commandBuffer;

 		// The below variables makes the terminal... a terminal!
 		string OldText = "";
@@ -127,6 +130,11 @@
                 Print();
 				e.Handled = true;
 			}
-		}
+            else if (e.KeyCode == Keys.Up)
+            {
+                if (c.Count == 0) return;
+                termmain.AppendText(c.Last());
+            }
+        }
 	}
 }


I think we need this.

I think we need this.

--- src/Dolstagis.Web/CoreServices.cs
+++ src/Dolstagis.Web/CoreServices.cs
@@ -14,7 +14,7 @@
     {
         public CoreServices()
         {
-            For<RouteTable>().Singleton();
+            For<RouteTable>().Singleton().Use<RouteTable>();
             For<IMimeTypes>().Singleton().Use<MimeTypes>();

             For<IRequestProcessor>().Use<RequestProcessor>();


Change text

Change text

--- src/IFS.Web/Models/UploadModel.cs
+++ src/IFS.Web/Models/UploadModel.cs
@@ -27,7 +27,7 @@
         [Display]
         public DateTime Expiration { get; set; }

-        [Display(Name = "When will the file expiration start counting?")]
+        [Display(Name = "When will the file expiration start?")]
         public ExpirationMode ExpirationMode { get; set; }

         public long SuggestedFileSize { get; set; }


All events exception failed, received and consumed are now deprecated in favor of simplicity

--- src/Lime.Protocol/Notification.cs
+++ src/Lime.Protocol/Notification.cs
@@ -51,60 +51,54 @@
     }

     /// <summary>
-    /// Events that can happen
-    /// in the message pipeline
+    /// Events that can happen in the message pipeline.
     /// </summary>
     [DataContract(Namespace = "http://limeprotocol.org/2014")]
     public enum Event
     {
         /// <summary>
-        /// A problem occurred during the processing
-        /// of the message. In this case, the reason
-        /// property of the notification SHOULD be
-        /// present.
+        /// A problem occurred during the processing of the message.
+        /// In this case, the reason  property of the notification SHOULD be present.
         /// </summary>
         [EnumMember(Value = "failed")]
         Failed,

         /// <summary>
-        /// The message was received
-        /// and accepted by the server.
+        /// The message was received and accepted by the server.
         /// </summary>
         [EnumMember(Value = "accepted")]
+        [Obsolete("Use the 'Received' event instead")]
         Accepted,

         /// <summary>
-        /// The message format was
-        /// validated by the server.
+        /// The message format was validated by the server.
         /// </summary>
         [EnumMember(Value = "validated")]
+        [Obsolete("This specific event should not be sent anymore")]
         Validated,

         /// <summary>
-        /// The dispatch of the message
-        /// was authorized by the server.
+        /// The dispatch of the message was authorized by the server.
         /// </summary>
         [EnumMember(Value = "authorized")]
+        [Obsolete("This specific event should not be sent anymore")]
         Authorized,

         /// <summary>
-        /// The message was dispatched to
-        /// the destination by the server.
+        /// The message was dispatched to the destination by the server.
         /// </summary>
         [EnumMember(Value = "dispatched")]
+        [Obsolete("Use the 'Consumed' event instead")]
         Dispatched,

         /// <summary>
-        /// The destination has
-        /// received the message.
+        /// The node has received the message.
         /// </summary>
-        [EnumMember(Value = "received")]
+        [EnumMember(Value = "received")]
         Received,

         /// <summary>
-        /// The destination has
-        /// consumed the content of
-        /// the message.
+        /// The node has consumed the content of the message.
         /// </summary>
         [EnumMember(Value = "consumed")]
         Consumed


Update AsyncLogger.cs

Update AsyncLogger.cs

--- src/LogentriesCore/AsyncLogger.cs
+++ src/LogentriesCore/AsyncLogger.cs
@@ -635,9 +635,9 @@
             WriteDebugMessages("Queueing: " + line);
             // If individual string is too long add it to the queue recursively as sub-strings
     		if (line.Length > LOG_LENGTH_LIMIT) {
-    			if (!Queue.TryAdd(line.substring(0, LOG_LENGTH_LIMIT))) {
+    			if (!Queue.TryAdd(line.Substring(0, LOG_LENGTH_LIMIT))) {
     				Queue.Dequeue();
-    				if (!Queue.TryAdd(line.substring(0, LOG_LENGTH_LIMIT)))
+    				if (!Queue.TryAdd(line.Substring(0, LOG_LENGTH_LIMIT)))
     					WriteDebugMessages(QueueOverflowMessage);
     			}
     			addLine(line.substring(LOG_LENGTH_LIMIT, line.Length), limit - 1);


InternalLogger IncludeTimestamp = true by default to restore behavior from startup-settings (#4775)

--- src/NLog/Common/InternalLogger.cs
+++ src/NLog/Common/InternalLogger.cs
@@ -64,7 +64,7 @@

             LogToConsole = GetSetting("nlog.internalLogToConsole", "NLOG_INTERNAL_LOG_TO_CONSOLE", false);
             LogToConsoleError = GetSetting("nlog.internalLogToConsoleError", "NLOG_INTERNAL_LOG_TO_CONSOLE_ERROR", false);
-            LogLevel = GetSetting("nlog.internalLogLevel", "NLOG_INTERNAL_LOG_LEVEL", LogLevel.Info);
+            LogLevel = GetSetting("nlog.internalLogLevel", "NLOG_INTERNAL_LOG_LEVEL", LogLevel.Off);
             LogFile = GetSetting("nlog.internalLogFile", "NLOG_INTERNAL_LOG_FILE", string.Empty);
             LogToTrace = GetSetting("nlog.internalLogToTrace", "NLOG_INTERNAL_LOG_TO_TRACE", false);
             IncludeTimestamp = GetSetting("nlog.internalLogIncludeTimestamp", "NLOG_INTERNAL_INCLUDE_TIMESTAMP", true);
@@ -138,7 +138,7 @@
         /// <summary>
         /// Gets or sets a value indicating whether timestamp should be included in internal log output.
         /// </summary>
-        public static bool IncludeTimestamp { get; set; }
+        public static bool IncludeTimestamp { get; set; } = true;

         /// <summary>
         /// Is there an <see cref="Exception"/> thrown when writing the message?


ScreenCam runs in editor now

ScreenCam runs in editor now

--- misc/ScreenCam.cs
+++ misc/ScreenCam.cs
@@ -1,6 +1,7 @@
 using UnityEngine;
 using System.Collections;

+[ExecuteInEditMode]
 public class ScreenCam : MonoBehaviour {
 	//public Transform target;
 	public float width = 16f;


Remove print and using

Remove print and using

--- model/Database.cs
+++ model/Database.cs
@@ -7,7 +7,6 @@
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
-using System.Web.Security;

 namespace SchemaZen.model {
 	public class Database {
@@ -290,8 +289,6 @@
 	set script = @roleDesc
 	where name = @RoleName

-	print @roleDesc
-
 end

 select


Use OriginalX for CatchHitObject.X instead of EffectiveX

And explicitly implement IHasXPosition interface to prevent use of the X property.
It should be preferred for beatmap conversion purpose.

--- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
+++ osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
@@ -1,7 +1,6 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

-using System;
 using osu.Framework.Bindables;
 using osu.Game.Beatmaps;
 using osu.Game.Beatmaps.ControlPoints;
@@ -31,14 +30,11 @@
             set => OriginalXBindable.Value = value;
         }

-        /// <summary>
-        /// The horizontal position of the fruit between 0 and <see cref="CatchPlayfield.WIDTH"/>.
-        /// </summary>
+        float IHasXPosition.X => OriginalX;
+
         public float X
         {
-            [Obsolete("Use EffectiveX instead")]
-            get => EffectiveX;
-            set => OriginalXBindable.Value = value;
+            set => OriginalX = value;
         }

         public readonly Bindable<float> EffectiveXBindable = new Bindable<float>();


Revert unnecessary change to testcase

Revert unnecessary change to testcase

--- osu.Game.Tests/Visual/TestCasePollingComponent.cs
+++ osu.Game.Tests/Visual/TestCasePollingComponent.cs
@@ -122,7 +122,7 @@
             };
         });

-        protected override double TimePerAction => 5000;
+        protected override double TimePerAction => 500;

         public class TestPoller : PollingComponent
         {


Move todo to appease dotnet-format

Move todo to appease dotnet-format

--- osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs
+++ osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs
@@ -187,14 +187,13 @@

             writer.WriteLine("[HitObjects]");

+            // TODO: implement other legacy rulesets
             switch (beatmap.BeatmapInfo.RulesetID)
             {
                 case 0:
                     foreach (var h in beatmap.HitObjects)
                         handleOsuHitObject(writer, h);
                     break;
-
-                // TODO: implement other legacy rulesets
             }
         }


Internalise bindable and progress handling to ensure transforms don't go backwards

--- osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs
+++ osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs
@@ -5,7 +5,6 @@
 using System.ComponentModel;
 using System.Linq;
 using osu.Framework.Allocation;
-using osu.Framework.Bindables;
 using osu.Framework.Graphics;
 using osu.Game.Beatmaps.Drawables;
 using osu.Game.Database;
@@ -129,7 +128,7 @@

             downloadTracker.Progress.BindValueChanged(progress =>
             {
-                downloadTutorialButton.Current.Value = progress.NewValue;
+                downloadTutorialButton.SetProgress(progress.NewValue, false);

                 if (progress.NewValue == 1)
                     downloadTutorialButton.Complete();
@@ -152,10 +151,10 @@
             {
                 double progress = (double)bundledDownloader.DownloadTrackers.Count(t => t.State.Value == DownloadState.LocallyAvailable) / bundledDownloader.DownloadTrackers.Count();

-                this.TransformBindableTo(downloadBundledButton.Current, progress, 2000, Easing.OutQuint);
-
                 if (progress == 1)
                     downloadBundledButton.Complete();
+                else
+                    downloadBundledButton.SetProgress(progress, true);
             }
         }

@@ -165,8 +164,6 @@
             private OsuColour colours { get; set; } = null!;

             private ProgressBar progressBar = null!;
-
-            public Bindable<double> Current => progressBar.Current;

             protected override void LoadComplete()
             {
@@ -189,7 +186,15 @@
                 Background.FadeColour(colours.Green, 500, Easing.OutQuint);
                 progressBar.FillColour = colours.Green;

-                this.TransformBindableTo(Current, 1, 500, Easing.OutQuint);
+                this.TransformBindableTo(progressBar.Current, 1, 500, Easing.OutQuint);
+            }
+
+            public void SetProgress(double progress, bool animated)
+            {
+                if (!Enabled.Value)
+                    return;
+
+                this.TransformBindableTo(progressBar.Current, progress, animated ? 500 : 0, Easing.OutQuint);
             }
         }
     }


Remove unnecessary centering logic in `DrawableJudgement`

--- osu.Game/Rulesets/Judgements/DrawableJudgement.cs
+++ osu.Game/Rulesets/Judgements/DrawableJudgement.cs
@@ -168,11 +168,7 @@
                 RemoveInternal(JudgementBody, true);

             AddInternal(JudgementBody = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ =>
-                CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling)
-            {
-                Anchor = Anchor.Centre,
-                Origin = Anchor.Centre,
-            });
+                CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling));

             JudgementBody.OnSkinChanged += () =>
             {


Update ScriptableBuild.cs

Update ScriptableBuild.cs

--- Runtime/LibMisc/ScriptableBuild.cs
+++ Runtime/LibMisc/ScriptableBuild.cs
@@ -46,4 +46,12 @@
 			helpers.Clear();
 		}
 	}
+
+	public static class HelperScriptableBuild
+	{
+		public static ModelComposer GetModelComposer(this ScriptableBuild sb)
+		{
+			return sb.helpers[sb.GetHashCode()];
+		}
+	}
 }


New member DrawQRCode

New member DrawQRCode

--- SLOTaxService/Services/BarCodes.cs
+++ SLOTaxService/Services/BarCodes.cs
@@ -5,9 +5,13 @@
 //-----------------------------------------------------------------------

 using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
 using System.Xml;
+using Gma.QrCodeNet.Encoding;
+using Gma.QrCodeNet.Encoding.Windows.Render;
+using MNet.SLOTaxService.Modulo;
 using MNet.SLOTaxService.Utils;

 namespace MNet.SLOTaxService.Services
@@ -26,8 +30,24 @@
       return BarCodesHelpers.SplitCode(this.BarCodeValue, noLines);
     }

+    public Image DrawQRCode(int qrImageSize, ImageFormat imgFormat)
+    {
+      QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.M);
+      QrCode qrCode = qrEncoder.Encode(this.BarCodeValue);
+
+      GraphicsRenderer renderer = new GraphicsRenderer(new FixedCodeSize(qrImageSize, QuietZoneModules.Two), Brushes.Black, Brushes.White);
+      using (MemoryStream stream = new MemoryStream())
+      {
+        renderer.WriteToStream(qrCode.Matrix, imgFormat, stream);
+
+        return Image.FromStream(stream);
+      }
+    }
+
     private BarCodes(XmlDocument invoice)
     {
+      // People at FURS say that modulo is just easy modulo 10 and not luhn!
+      IModulo modulo = new Modulo10_Easy();
       this.invoice = invoice;

       XmlNode protectedIDNode = XmlHelperFunctions.GetSubNode(invoice.DocumentElement, "fu:ProtectedID");
@@ -37,9 +57,9 @@
       if ((protectedIDNode == null) || (taxNumberNode == null) || (timeStampNode == null))
         this.BarCodeValue = string.Empty;
       else
-        this.BarCodeValue = BarCodesHelpers.GenerateCode(protectedIDNode.InnerText, taxNumberNode.InnerText, Convert.ToDateTime(timeStampNode.InnerText));
+        this.BarCodeValue = BarCodesHelpers.GenerateCode(protectedIDNode.InnerText, taxNumberNode.InnerText, Convert.ToDateTime(timeStampNode.InnerText), modulo);
     }

     private XmlDocument invoice;
   }
-}
+}


Added code to QuicknotesControl to allow show/hiding of quicknotes.

--- Saveyour/Saveyour/Settings.xaml.cs
+++ Saveyour/Saveyour/Settings.xaml.cs
@@ -44,11 +44,7 @@

 	private void toggleAll(){
                 qnotes.ToggleVisibility();
-            else if (qnotes.IsLoaded) {
-                qnotes.Show();
-                qnotes.Activate();
-                //qnotes.Topmost = true;
-            }
+
             if (weeklytd.IsVisible)
             {
                 weeklytd.Hide();
@@ -85,10 +81,7 @@

         private void QN_Click(object sender, RoutedEventArgs e)
         {
-            if (qnotes.IsVisible)
-                qnotes.Hide();
-            else if (qnotes.IsLoaded)
-                qnotes.Show();
+            qnotes.toggleVisibility;
         }

         private void WTD_Click(object sender, RoutedEventArgs e)
@@ -107,9 +100,9 @@
                 gcalendar.Show();
         }

-        public void addQNotes(Window module)
+        public void addQNotes(QuicknotesControl qnc)
         {
-            qnotes = module;
+            qnotes = qnc;
         }

         public void addWTD(Window module)


more methods

more methods

--- Scripts/CallJniExtensionMethods.cs
+++ Scripts/CallJniExtensionMethods.cs
@@ -3,7 +3,7 @@

 namespace DeadMosquito.JniToolkit
 {
-    #if UNITY_ANDROID
+#if UNITY_ANDROID
     static class CallJniExtensionMethods
     {

@@ -139,26 +139,44 @@
         #endregion

         #region main_thread_get
+        public static void MainThreadCallNonBlocking<T>(this AndroidJavaObject ajo, string methodName, params object[] args)
+        {
+            JniToolkitUtils.RunOnUiThread(() =>
+            {
+                ajo.Call<T>(methodName, args);
+            });
+        }
+
+        public static void MainThreadCallNonBlocking(this AndroidJavaObject ajo, string methodName, params object[] args)
+        {
+            JniToolkitUtils.RunOnUiThread(() =>
+            {
+                ajo.Call(methodName, args);
+            });
+        }
+
         public static T MainThreadCall<T>(this AndroidJavaObject ajo, string methodName, params object[] args)
         {
             T result = default(T);
             bool wasSet = false;
-            JniToolkitUtils.RunOnUiThread(() => {
+            JniToolkitUtils.RunOnUiThread(() =>
+            {
                 result = ajo.Call<T>(methodName, args);
                 wasSet = true;
             });
-            while(!wasSet) {}
+            while (!wasSet) { }
             return result;
         }

         public static void MainThreadCall(this AndroidJavaObject ajo, string methodName, params object[] args)
         {
             bool finished = false;
-            JniToolkitUtils.RunOnUiThread(() => {
+            JniToolkitUtils.RunOnUiThread(() =>
+            {
                 ajo.Call(methodName, args);
                 finished = true;
             });
-            while(!finished) {}
+            while (!finished) { }
             return;
         }

@@ -193,5 +211,5 @@
         }
         #endregion
     }
-    #endif
+#endif
 }


laser middle section fix

laser middle section fix

--- SimpleScene/Extra/Lasers/SLaser.cs
+++ SimpleScene/Extra/Lasers/SLaser.cs
@@ -221,9 +221,34 @@
             _periodicIntensity = laserParams.intensityPeriodicFunction (periodicT);
             _periodicIntensity *= laserParams.intensityModulation (periodicT);

-			// beam emission point placement
+            // intersects with any of the intersecting objects
+            _hitsAnObstacle = false;
+            if (_laser.beamObstacles != null) {
+                //if (false) {
+                // TODO note the code below is slow. Wen you start having many lasers
+                // this will cause problems. Consider using BVH for ray tests or analyzing
+                // intersection math.
+                var ray = this.ray();
+                float closestDistance = float.PositiveInfinity;
+                foreach (var obj in _laser.beamObstacles) {
+                    float distanceToInterect;
+                    if (obj.Intersect(ref ray, out distanceToInterect)) {
+
+                        if (distanceToInterect < closestDistance) {
+                            closestDistance = distanceToInterect;
+                            _hitsAnObstacle = true;
+                            _beamEnd = _beamStart + ray.dir * closestDistance;
+                        }
+                    }
+                }
+            }
+
+            // final start and end points of the beam (for this update)
             _beamStart = _laser.sourcePos();
-            _beamEnd = _laser.destPos();
+            if (!_hitsAnObstacle) {
+                _beamEnd = _laser.destPos();
+            }
+
             Vector3 localPlacement = laserParams.beamStartPlacementFunc(
                     _beamId, laserParams.numBeams, absoluteTimeS);
             if (localPlacement != Vector3.Zero) {
@@ -247,28 +272,6 @@
 				OpenTKHelper.TwoPerpAxes (_laser.direction(), out driftXAxis, out driftYAxis);
 				_beamEnd += (driftX * driftXAxis + driftY * driftYAxis);
 			}
-
-            // intersects with any of the intersecting objects
-            _hitsAnObstacle = false;
-            if (_laser.beamObstacles != null) {
-            //if (false) {
-                // TODO note the code below is slow. Wen you start having many lasers
-                // this will cause problems. Consider using BVH for ray tests or analyzing
-                // intersection math.
-                var ray = this.ray();
-                float closestDistance = this.lengthFast();
-                foreach (var obj in _laser.beamObstacles) {
-                    float distanceToInterect;
-                    if (obj.Intersect(ref ray, out distanceToInterect)) {
-
-                        if (distanceToInterect < closestDistance) {
-                            closestDistance = distanceToInterect;
-                            _hitsAnObstacle = true;
-                        }
-                    }
-                }
-                _beamEnd = _beamStart + ray.dir * closestDistance;
-            }
 		}
 	}
 }


Changed delete function to ignore ReadOnly image

--- SnowyImageCopy/Models/Operation.cs
+++ SnowyImageCopy/Models/Operation.cs
@@ -1121,7 +1121,7 @@
 					}

 					if (Settings.Current.DeleteOnCopy &&
-						IsCopiedLocal(item))
+						!item.IsReadOnly && IsCopiedLocal(item))
 					{
 						await FileManager.DeleteFileAsync(item.FilePath, _tokenSourceWorking.Token);
 					}


PHP.VS:
- updated for PhpNetCore.Parsers 4.0.0.5598
- updated ControlFlow framework

git-tfs-id: [http://falcon:8080/tfs/Projects]$/Phalanger/Main;C5599

--- Source/Build/AssemblyInfoCommon.cs
+++ Source/Build/AssemblyInfoCommon.cs
@@ -20,7 +20,7 @@
     public const string ReleaseVersion = "4.0";

     // Replaced by changeset number using build script.
-    public const string ChangesetNumber = "5099";
+    public const string ChangesetNumber = "5598";

     public const string StableVersion = ReleaseVersion + ".0.0";


Added AuthenticationException and UnauthorizedAccessException to log warnings

--- Source/Miruken.Castle/LogFilter.cs
+++ Source/Miruken.Castle/LogFilter.cs
@@ -4,6 +4,7 @@
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Linq;
+    using System.Security.Authentication;
     using System.Text;
     using System.Threading.Tasks;
     using Callback;
@@ -113,7 +114,9 @@
         public static Type[] WarningExceptions =
         {
             typeof(ArgumentException),
-            typeof(InvalidOperationException)
+            typeof(InvalidOperationException),
+            typeof(AuthenticationException),
+            typeof(UnauthorizedAccessException)
         };

         protected static readonly JsonSerializerSettings JsonSettings =


Added empty json container if server response is empty.

This fixes a possible NullReferenceException, which at least occurred in every call to SaveAlbums().

--- SpotifyAPI/Web/SpotifyWebClient.cs
+++ SpotifyAPI/Web/SpotifyWebClient.cs
@@ -37,7 +37,7 @@
             try
             {
                 Tuple<ResponseInfo, byte[]> raw = DownloadRaw(url);
-                response = new Tuple<ResponseInfo, string>(raw.Item1, _encoding.GetString(raw.Item2));
+                response = new Tuple<ResponseInfo, string>(raw.Item1, raw.Item2.Length > 0 ? _encoding.GetString(raw.Item2) : "{}");
             }
             catch (WebException e)
             {
@@ -58,7 +58,7 @@
             try
             {
                 Tuple<ResponseInfo, byte[]> raw = await DownloadRawAsync(url);
-                response = new Tuple<ResponseInfo, string>(raw.Item1, _encoding.GetString(raw.Item2));
+                response = new Tuple<ResponseInfo, string>(raw.Item1, raw.Item2.Length > 0 ? _encoding.GetString(raw.Item2) : "{}");
             }
             catch (WebException e)
             {
@@ -118,7 +118,7 @@
             try
             {
                 Tuple<ResponseInfo, byte[]> data = UploadRaw(url, body, method);
-                response = new Tuple<ResponseInfo, string>(data.Item1, _encoding.GetString(data.Item2));
+                response = new Tuple<ResponseInfo, string>(data.Item1, data.Item2.Length > 0 ? _encoding.GetString(data.Item2) : "{}");
             }
             catch (WebException e)
             {
@@ -139,7 +139,7 @@
             try
             {
                 Tuple<ResponseInfo, byte[]> data = await UploadRawAsync(url, body, method);
-                response = new Tuple<ResponseInfo, string>(data.Item1, _encoding.GetString(data.Item2));
+                response = new Tuple<ResponseInfo, string>(data.Item1, data.Item2.Length > 0 ? _encoding.GetString(data.Item2) : "{}");
             }
             catch (WebException e)
             {


Updated Method MovePlayer(); Updated  Thread.Sleep(250); Updated playerColor; Added method SetBonus Added method DrawBonus; Added method DetectCollisionsBonus();

--- Super-Pang/Super-Pang/SuperPang.cs
+++ Super-Pang/Super-Pang/SuperPang.cs
@@ -5,14 +5,15 @@

 namespace SuperPang
 {
-    class Program
+    class SuperPang
     {
         public static string playerHead = "(..)";
         public static string playerTorso = "<][>";
         public static string playerLegs = " /\\";
         public static string playerLegsTogether = " ||";
-        public const ConsoleColor playerColor = ConsoleColor.Green;
-
+        public static ConsoleColor playerColor = ConsoleColor.Green;
+        public static ConsoleColor sceneColor = ConsoleColor.Green;
+
         public const int FirstBallonRadius = 2;
         public static List<Balloon> balloons = new List<Balloon>();

@@ -23,6 +24,18 @@
         public static int timeLeft = 100;
         //static string shotSymbol = "^\n|";

+        // Generate random numbers for % (how often to run bonus 0-100%)
+        public static Random bonusRandom = new Random();
+        // Generate position of bonus)
+        public static Random bonusXposition = new Random();
+
+        public static int bonusPositionX;
+        public static int bonusCurrentPositionX;
+        public static int bonusCurrentPositionY;
+        public static int bonusPositionY;
+        public static char bonusChar;
+        public static ConsoleColor bonusColor;
+
         public static void Main()
         {
             Console.Title = "Super Pang";
@@ -35,6 +48,9 @@
             lives = 10;
             var firstBalloon = new Balloon(FirstBallonRadius);
             balloons.Add(firstBalloon);
+
+            //First bonus position
+            bonusPositionY = 1;

             Thread timing = new Thread(new ThreadStart(TimeCounter));
             Thread music = new Thread(new ThreadStart(Music.PlaySound));
@@ -46,10 +62,13 @@
                 while (true)
                 {
                     Console.Clear();
-                    DetectCollisions();
+                    DetectCollisionsBalloons();
+                    DetectCollisionsBonus();
                     MoveAllBalloons();
                     Draw();
-                    Thread.Sleep(200);
+                    //SetBonus();
+                    DrawBonus();
+                    Thread.Sleep(250);
                 }
             });

@@ -60,9 +79,12 @@
                     Console.Clear();
                     MovePlayer();
                     Draw();
-                }
-            }
-        }
+
+                }
+            }
+        }
+
+

         private static void MoveAllBalloons()
         {
@@ -110,20 +132,28 @@

         private static void MovePlayer()
         {
-            ConsoleKeyInfo pressedKey = Console.ReadKey(false);
-
-            if (pressedKey.Key == ConsoleKey.LeftArrow)
-            {
-                if (playerPositionX - 1 > 0)
-                {
-                    playerPositionX--;
-                }
-            }
-            else if (pressedKey.Key == ConsoleKey.RightArrow)
-            {
-                if (playerPositionX + 1 < Console.WindowWidth - 4)
-                {
-                    playerPositionX++;
+            if (Console.KeyAvailable)
+            {
+                ConsoleKeyInfo pressedKey = Console.ReadKey(true);
+
+                while (Console.KeyAvailable)
+                {
+                    Console.ReadKey(true);
+                }
+
+                if (pressedKey.Key == ConsoleKey.LeftArrow)
+                {
+                    if (playerPositionX - 1 > 0)
+                    {
+                        playerPositionX--;
+                    }
+                }
+                else if (pressedKey.Key == ConsoleKey.RightArrow)
+                {
+                    if (playerPositionX + 1 < Console.WindowWidth - 4)
+                    {
+                        playerPositionX++;
+                    }
                 }
             }
         }
@@ -137,6 +167,7 @@

         private static void DrawPlayer()
         {
+            Console.ForegroundColor = playerColor;
             Console.SetCursorPosition(playerPositionX, playerPositionY);
             Console.WriteLine(playerHead);

@@ -147,7 +178,7 @@
             if (playerPositionX % 2 == 0) Console.WriteLine(playerLegs);
             else Console.WriteLine(playerLegsTogether);

-            Console.ForegroundColor = playerColor;
+            Console.ForegroundColor = sceneColor;
         }

         private static void DrawBalloons()
@@ -181,7 +212,7 @@
             lives--;
         }

-        private static void DetectCollisions()
+        private static void DetectCollisionsBalloons()
         {
             foreach (var balloon in balloons)
             {
@@ -195,5 +226,76 @@
                 }
             }
         }
+
+        // Bonuses
+
+        private static void SetBonus()
+        {
+            int bonus = bonusRandom.Next(0, 100);
+            if (bonus <= 3)
+            {
+                bonusChar = '@';
+                bonusColor = ConsoleColor.Red;
+                bonusPositionX = bonusXposition.Next(0, Console.BufferWidth - 1);
+                bonusPositionY = 1;
+            }
+            else if (bonus > 3 && bonus <= 13)
+            {
+                bonusChar = '$';
+                bonusColor = ConsoleColor.Yellow;
+                bonusPositionX = bonusXposition.Next(0, Console.BufferWidth - 1);
+                bonusPositionY = 1;
+            }
+            else if (bonus > 13 && bonus <= 50)
+            {
+                bonusChar = '#';
+                bonusColor = ConsoleColor.Magenta;
+                bonusPositionX = bonusXposition.Next(0, Console.BufferWidth - 1);
+                bonusPositionY = 1;
+            }
+            else
+            {
+                bonusPositionY = Console.BufferHeight;
+            }
+        }
+
+
+        private static void DrawBonus()
+        {
+            if (bonusPositionY == 1 || bonusPositionY >= Console.BufferHeight - 2)
+            {
+                SetBonus();
+            }
+
+            if (bonusPositionY < Console.BufferHeight - 2)
+            {
+                Console.SetCursorPosition(bonusPositionX, bonusPositionY);
+                Console.ForegroundColor = bonusColor;
+                Console.WriteLine(bonusChar);
+                bonusCurrentPositionX = bonusPositionX;
+                bonusCurrentPositionY = bonusPositionY;
+                Console.ForegroundColor = playerColor;
+                bonusPositionY++;
+            }
+        }
+        private static void DetectCollisionsBonus()
+        {
+            if (bonusChar == '#' && (bonusCurrentPositionX >= playerPositionX) && (bonusCurrentPositionY == playerPositionY))
+            {
+                    playerScore+=50;
+            }
+            if (bonusChar == '$' && (bonusCurrentPositionX >= playerPositionX) && (bonusCurrentPositionY == playerPositionY))
+            {
+                playerScore += 100;
+                // strelbata da inishtozhava Big Ballon
+            }
+            if (bonusChar == '@' && (bonusCurrentPositionX >= playerPositionX) && (bonusCurrentPositionY == playerPositionY))
+            {
+                playerScore += 200;
+                lives++;
+                playerColor = ConsoleColor.Red;
+                // strelbata da inishtozhava Big Ballon
+            }
+        }
     }
 }


fix chat messages memory leak

fix chat messages memory leak

--- TCC.Core/Data/Chat/MessagePiece.cs
+++ TCC.Core/Data/Chat/MessagePiece.cs
@@ -174,6 +174,8 @@
         {
             Color = null;
             _container = null;
+            SettingsWindowViewModel.FontSizeChanged -= OnFontSizeChanged;
+
         }
     }
 }


slightly better test for #339

slightly better test for #339

--- Test/Flurl.Test/UrlBuilderTests.cs
+++ Test/Flurl.Test/UrlBuilderTests.cs
@@ -330,11 +330,10 @@
 		}

 		[Test]
-		public void Url_converts_to_uri()
-		{
+		public void Url_converts_to_uri() {
 			var url = new Url("http://www.mysite.com/more?x=1&y=2");
-			var someMethodThatTakesAUri = new Action<Uri>(s => { });
-			someMethodThatTakesAUri(url.ToUri()); // if this compiles, test passed.
+			var uri = url.ToUri();
+			Assert.AreEqual("http://www.mysite.com/more?x=1&y=2", uri.AbsoluteUri);
 		}

 		[Test]


Added immutable array updates history support

--- TestEDITOR/Editor/EditorContext.cs
+++ TestEDITOR/Editor/EditorContext.cs
@@ -291,8 +291,12 @@
                             if (document != null)
                             {
                                 var container = DefaultContainer(_editor.Project);
-                                _editor.History.Snapshot(_editor.Project);
-                                document.Containers = document.Containers.Add(container);
+
+                                var previous = document.Containers;
+                                var next = document.Containers.Add(container);
+                                _editor.History.Snapshot(previous, next, (p) => document.Containers = p);
+                                document.Containers = next;
+
                                 _editor.Project.CurrentContainer = container;
                             }
                         }
@@ -300,22 +304,30 @@
                         {
                             var selected = item as Document;
                             var container = DefaultContainer(_editor.Project);
-                            _editor.History.Snapshot(_editor.Project);
-                            selected.Containers = selected.Containers.Add(container);
+
+                            var previous = selected.Containers;
+                            var next = selected.Containers.Add(container);
+                            _editor.History.Snapshot(previous, next, (p) => selected.Containers = p);
+                            selected.Containers = next;
+
                             _editor.Project.CurrentContainer = container;
                         }
                         else if (item is Project)
                         {
                             var document = DefaultDocument(_editor.Project);
-                            _editor.History.Snapshot(_editor.Project);
-                            _editor.Project.Documents = _editor.Project.Documents.Add(document);
+
+                            var previous = _editor.Project.Documents;
+                            var next = _editor.Project.Documents.Add(document);
+                            _editor.History.Snapshot(previous, next, (p) => _editor.Project.Documents = p);
+                            _editor.Project.Documents = next;
+
                             _editor.Project.CurrentDocument = document;
                             _editor.Project.CurrentContainer = document.Containers.FirstOrDefault();
                         }
                         else if (item is EditorContext || item == null)
                         {
                             _editor.History.Reset();
-                            _editor.History.Snapshot(_editor.Project);
+
                             _editor.Load(DefaultProject());
                         }
                     },
@@ -402,14 +414,17 @@
                                 var document = _editor.Project.Documents.FirstOrDefault(d => d.Containers.Contains(container));
                                 if (document != null)
                                 {
-                                    _editor.History.Snapshot(_editor.Project);
                                     int index = document.Containers.IndexOf(container);
                                     var clone = Clone(_containerToCopy);

                                     var builder = document.Containers.ToBuilder();
                                     builder[index] = clone;
                                     document.Containers = builder.ToImmutable();
-                                    //document.Containers[index] = clone;
+
+                                    var previous = document.Containers;
+                                    var next = builder.ToImmutable();
+                                    _editor.History.Snapshot(previous, next, (p) => document.Containers = p);
+                                    document.Containers = next;

                                     _editor.Project.CurrentContainer = clone;
                                 }
@@ -420,9 +435,13 @@
                             if (_containerToCopy != null)
                             {
                                 var document = item as Document;
-                                _editor.History.Snapshot(_editor.Project);
                                 var clone = Clone(_containerToCopy);
-                                document.Containers = document.Containers.Add(clone);
+
+                                var previous = document.Containers;
+                                var next = document.Containers.Add(clone);
+                                _editor.History.Snapshot(previous, next, (p) => document.Containers = p);
+                                document.Containers = next;
+
                                 _editor.Project.CurrentContainer = clone;
                             }
                             else if (_documentToCopy != null)
@@ -433,8 +452,11 @@

                                 var builder = _editor.Project.Documents.ToBuilder();
                                 builder[index] = clone;
-                                _editor.Project.Documents = builder.ToImmutable();
-                                //_editor.Project.Documents[index] = clone;
+
+                                var previous = _editor.Project.Documents;
+                                var next = builder.ToImmutable();
+                                _editor.History.Snapshot(previous, next, (p) => _editor.Project.Documents = p);
+                                _editor.Project.Documents = next;

                                 _editor.Project.CurrentDocument = clone;
                             }
@@ -613,8 +635,10 @@
                                     shape.Bindings = ImmutableArray.Create<ShapeBinding>();
                                 }

-                                _editor.History.Snapshot(_editor.Project);
-                                shape.Bindings = shape.Bindings.Add(ShapeBinding.Create("", ""));
+                                var previous = shape.Bindings;
+                                var next = shape.Bindings.Add(ShapeBinding.Create("", ""));
+                                _editor.History.Snapshot(previous, next, (p) => shape.Bindings = p);
+                                shape.Bindings = next;
                             }
                         }
                     },
@@ -633,8 +657,10 @@
                                 var shape = owner as BaseShape;
                                 if (shape.Bindings != null)
                                 {
-                                    _editor.History.Snapshot(_editor.Project);
-                                    shape.Bindings = shape.Bindings.Remove(binding);
+                                    var previous = shape.Bindings;
+                                    var next = shape.Bindings.Remove(binding);
+                                    _editor.History.Snapshot(previous, next, (p) => shape.Bindings = p);
+                                    shape.Bindings = next;
                                 }
                             }
                         }
@@ -654,8 +680,10 @@
                                     shape.Properties = ImmutableArray.Create<ShapeProperty>();
                                 }

-                                _editor.History.Snapshot(_editor.Project);
-                                shape.Properties = shape.Properties.Add(ShapeProperty.Create("New", ""));
+                                var previous = shape.Properties;
+                                var next = shape.Properties.Add(ShapeProperty.Create("New", ""));
+                                _editor.History.Snapshot(previous, next, (p) => shape.Properties = p);
+                                shape.Properties = next;
                             }
                             else if (owner is Container)
                             {
@@ -665,8 +693,10 @@
                                     container.Properties = ImmutableArray.Create<ShapeProperty>();
                                 }

-                                _editor.History.Snapshot(_editor.Project);
-                                container.Properties = container.Properties.Add(ShapeProperty.Create("New", ""));
+                                var previous = container.Properties;
+                                var next = container.Properties.Add(ShapeProperty.Create("New", ""));
+                                _editor.History.Snapshot(previous, next, (p) => container.Properties = p);
+                                container.Properties = next;
                             }
                         }
                     },
@@ -685,8 +715,10 @@
                                 var shape = owner as BaseShape;
                                 if (shape.Properties != null)
                                 {
-                                    _editor.History.Snapshot(_editor.Project);
-                                    shape.Properties = shape.Properties.Remove(property);
+                                    var previous = shape.Properties;
+                                    var next = shape.Properties.Remove(property);
+                                    _editor.History.Snapshot(previous, next, (p) => shape.Properties = p);
+                                    shape.Properties = next;
                                 }
                             }
                             else if (owner is Container)
@@ -694,8 +726,10 @@
                                 var container = owner as Container;
                                 if (container.Properties != null)
                                 {
-                                    _editor.History.Snapshot(_editor.Project);
-                                    container.Properties = container.Properties.Remove(property);
+                                    var previous = container.Properties;
+                                    var next = container.Properties.Remove(property);
+                                    _editor.History.Snapshot(previous, next, (p) => container.Properties = p);
+                                    container.Properties = next;
                                 }
                             }
                         }
@@ -706,8 +740,11 @@
                     () =>
                     {
                         var gl = GroupLibrary.Create("New");
-                        _editor.History.Snapshot(_editor.Project);
-                        _editor.Project.GroupLibraries = _editor.Project.GroupLibraries.Add(gl);
+
+                        var previous = _editor.Project.GroupLibraries;
+                        var next = _editor.Project.GroupLibraries.Add(gl);
+                        _editor.History.Snapshot(previous, next, (p) => _editor.Project.GroupLibraries = p);
+                        _editor.Project.GroupLibraries = next;
                     },
                     () => IsEditMode());

@@ -729,8 +766,11 @@
                                 var clone = Clone(group as XGroup);
                                 if (clone != null)
                                 {
-                                    _editor.History.Snapshot(_editor.Project);
-                                    _editor.Project.CurrentGroupLibrary.Groups = _editor.Project.CurrentGroupLibrary.Groups.Add(clone);
+                                    var gl = _editor.Project.CurrentGroupLibrary;
+                                    var previous = gl.Groups;
+                                    var next = gl.Groups.Add(clone);
+                                    _editor.History.Snapshot(previous, next, (p) => gl.Groups = p);
+                                    gl.Groups = next;
                                 }
                             }
                         }
@@ -747,8 +787,11 @@
                 _commands.AddLayerCommand = new DelegateCommand(
                     () =>
                     {
-                        _editor.History.Snapshot(_editor.Project);
-                        _editor.Project.CurrentContainer.Layers = _editor.Project.CurrentContainer.Layers.Add(Layer.Create("New", _editor.Project.CurrentContainer));
+                        var container = _editor.Project.CurrentContainer;
+                        var previous = container.Layers;
+                        var next = container.Layers.Add(Layer.Create("New", container));
+                        _editor.History.Snapshot(previous, next, (p) => container.Layers = p);
+                        container.Layers = next;
                     },
                     () => IsEditMode());

@@ -763,8 +806,11 @@
                     () =>
                     {
                         var sg = ShapeStyleGroup.Create("New");
-                        _editor.History.Snapshot(_editor.Project);
-                        _editor.Project.StyleGroups = _editor.Project.StyleGroups.Add(sg);
+
+                        var previous = _editor.Project.StyleGroups;
+                        var next = _editor.Project.StyleGroups.Add(sg);
+                        _editor.History.Snapshot(previous, next, (p) => _editor.Project.StyleGroups = p);
+                        _editor.Project.StyleGroups = next;
                     },
                     () => IsEditMode());

@@ -778,8 +824,11 @@
                 _commands.AddStyleCommand = new DelegateCommand(
                     () =>
                     {
-                        _editor.History.Snapshot(_editor.Project);
-                        _editor.Project.CurrentStyleGroup.Styles = _editor.Project.CurrentStyleGroup.Styles.Add(ShapeStyle.Create("New"));
+                        var sg = _editor.Project.CurrentStyleGroup;
+                        var previous = sg.Styles;
+                        var next = sg.Styles.Add(ShapeStyle.Create("New"));
+                        _editor.History.Snapshot(previous, next, (p) => sg.Styles = p);
+                        sg.Styles = next;
                     },
                     () => IsEditMode());

@@ -835,8 +884,10 @@
                 _commands.AddTemplateCommand = new DelegateCommand(
                     () =>
                     {
-                        _editor.History.Snapshot(_editor.Project);
-                        _editor.Project.Templates = _editor.Project.Templates.Add(EmptyTemplate(_editor.Project));
+                        var previous = _editor.Project.Templates;
+                        var next = _editor.Project.Templates.Add(EmptyTemplate(_editor.Project));
+                        _editor.History.Snapshot(previous, next, (p) => _editor.Project.Templates = p);
+                        _editor.Project.Templates = next;
                     },
                     () => IsEditMode());

@@ -865,7 +916,8 @@
                         if (item is Container)
                         {
                             var template = item as Container;
-                            _editor.History.Snapshot(_editor.Project);
+
+                            // TODO: Add history snapshot.
                             _editor.Project.CurrentContainer.Template = template;
                         }
                     },
@@ -897,8 +949,13 @@
                     (item) =>
                     {
                         var container = DefaultContainer(_editor.Project);
-                        _editor.History.Snapshot(_editor.Project);
-                        _editor.Project.CurrentDocument.Containers = _editor.Project.CurrentDocument.Containers.Add(container);
+
+                        var document = _editor.Project.CurrentDocument;
+                        var previous = document.Containers;
+                        var next = document.Containers.Add(container);
+                        _editor.History.Snapshot(previous, next, (p) => document.Containers = p);
+                        document.Containers = next;
+
                         _editor.Project.CurrentContainer = container;
                     },
                     (item) => IsEditMode());
@@ -911,8 +968,13 @@
                             var selected = item as Container;
                             int index = _editor.Project.CurrentDocument.Containers.IndexOf(selected);
                             var container = DefaultContainer(_editor.Project);
-                            _editor.History.Snapshot(_editor.Project);
-                            _editor.Project.CurrentDocument.Containers.Insert(index, container);
+
+                            var document = _editor.Project.CurrentDocument;
+                            var previous = document.Containers;
+                            var next = document.Containers.Insert(index, container);
+                            _editor.History.Snapshot(previous, next, (p) => document.Containers = p);
+                            document.Containers = next;
+
                             _editor.Project.CurrentContainer = container;
                         }
                     },
@@ -926,8 +988,13 @@
                             var selected = item as Container;
                             int index = _editor.Project.CurrentDocument.Containers.IndexOf(selected);
                             var container = DefaultContainer(_editor.Project);
-                            _editor.History.Snapshot(_editor.Project);
-                            _editor.Project.CurrentDocument.Containers.Insert(index + 1, container);
+
+                            var document = _editor.Project.CurrentDocument;
+                            var previous = document.Containers;
+                            var next = document.Containers.Insert(index + 1, container);
+                            _editor.History.Snapshot(previous, next, (p) => document.Containers = p);
+                            document.Containers = next;
+
                             _editor.Project.CurrentContainer = container;
                         }
                     },
@@ -937,8 +1004,12 @@
                     (item) =>
                     {
                         var document = DefaultDocument(_editor.Project);
-                        _editor.History.Snapshot(_editor.Project);
-                        _editor.Project.Documents = _editor.Project.Documents.Add(document);
+
+                        var previous = _editor.Project.Documents;
+                        var next = _editor.Project.Documents.Add(document);
+                        _editor.History.Snapshot(previous, next, (p) => _editor.Project.Documents = p);
+                        _editor.Project.Documents = next;
+
                         _editor.Project.CurrentDocument = document;
                         _editor.Project.CurrentContainer = document.Containers.FirstOrDefault();
                     },
@@ -952,8 +1023,12 @@
                             var selected = item as Document;
                             int index = _editor.Project.Documents.IndexOf(selected);
                             var document = DefaultDocument(_editor.Project);
-                            _editor.History.Snapshot(_editor.Project);
-                            _editor.Project.Documents.Insert(index, document);
+
+                            var previous = _editor.Project.Documents;
+                            var next = _editor.Project.Documents.Insert(index, document);
+                            _editor.History.Snapshot(previous, next, (p) => _editor.Project.Documents = p);
+                            _editor.Project.Documents = next;
+
                             _editor.Project.CurrentDocument = document;
                             _editor.Project.CurrentContainer = document.Containers.FirstOrDefault();
                         }
@@ -969,8 +1044,12 @@
                             var selected = item as Document;
                             int index = _editor.Project.Documents.IndexOf(selected);
                             var document = DefaultDocument(_editor.Project);
-                            _editor.History.Snapshot(_editor.Project);
-                            _editor.Project.Documents.Insert(index + 1, document);
+
+                            var previous = _editor.Project.Documents;
+                            var next = _editor.Project.Documents.Insert(index + 1, document);
+                            _editor.History.Snapshot(previous, next, (p) => _editor.Project.Documents = p);
+                            _editor.Project.Documents = next;
+
                             _editor.Project.CurrentDocument = document;
                             _editor.Project.CurrentContainer = document.Containers.FirstOrDefault();
                         }
@@ -978,7 +1057,6 @@
                     (item) => IsEditMode());

                 WarmUpCSharpScript();
-                WarmUpHistory();
             }
             catch (Exception ex)
             {
@@ -1248,7 +1326,7 @@
                 var images = Editor.GetAllShapes<XImage>(project);
                 _editor.ToAbsoluteUri(root, images);

-                _editor.History.Snapshot(_editor.Project);
+                _editor.History.Reset();
                 _editor.Load(project);
             }
             catch (Exception ex)
@@ -1910,17 +1988,21 @@
             {
                 _editor.Deselect(_editor.Project.CurrentContainer);

-                _editor.History.Snapshot(_editor.Project);
-
                 TryToRestoreStyles(shapes);
                 TryToRestoreRecords(shapes);

-                var builder = _editor.Project.CurrentContainer.CurrentLayer.Shapes.ToBuilder();
+                var layer = _editor.Project.CurrentContainer.CurrentLayer;
+
+                var builder = layer.Shapes.ToBuilder();
                 foreach (var shape in shapes)
                 {
                     builder.Add(shape);
                 }
-                _editor.Project.CurrentContainer.CurrentLayer.Shapes = builder.ToImmutable();
+
+                var previous = layer.Shapes;
+                var next = builder.ToImmutable();
+                _editor.History.Snapshot(previous, next, (p) => layer.Shapes = p);
+                layer.Shapes = next;

                 _editor.Select(_editor.Project.CurrentContainer, ImmutableHashSet.CreateRange<BaseShape>(shapes));
             }
@@ -2148,8 +2230,14 @@
                 {
                     _editor.Deselect(_editor.Project.CurrentContainer);
                     clone.Move(sx, sy);
-                    _editor.History.Snapshot(_editor.Project);
-                    _editor.Project.CurrentContainer.CurrentLayer.Shapes = _editor.Project.CurrentContainer.CurrentLayer.Shapes.Add(clone);
+
+                    var layer = _editor.Project.CurrentContainer.CurrentLayer;
+
+                    var previous = layer.Shapes;
+                    var next = layer.Shapes.Add(clone);
+                    _editor.History.Snapshot(previous, next, (p) => layer.Shapes = p);
+                    layer.Shapes = next;
+
                     _editor.Select(_editor.Project.CurrentContainer, clone);
                 }
             }
@@ -2172,12 +2260,12 @@
             {
                 if (_editor.Renderer.SelectedShape != null)
                 {
-                    _editor.History.Snapshot(_editor.Project);
+                    // TODO: Add history snapshot.
                     _editor.Renderer.SelectedShape.Record = record;
                 }
                 else if (_editor.Renderer.SelectedShapes != null && _editor.Renderer.SelectedShapes.Count > 0)
                 {
-                    _editor.History.Snapshot(_editor.Project);
+                    // TODO: Add history snapshot.
                     foreach (var shape in _editor.Renderer.SelectedShapes)
                     {
                         shape.Record = record;
@@ -2191,7 +2279,7 @@
                         var result = ShapeBounds.HitTest(container, new Vector2(x, y), _editor.Project.Options.HitTreshold);
                         if (result != null)
                         {
-                            _editor.History.Snapshot(_editor.Project);
+                            // TODO: Add history snapshot.
                             result.Record = record;
                         }
                         else
@@ -2275,8 +2363,12 @@
             g.AddConnectorAsNone(pl);
             g.AddConnectorAsNone(pr);

-            _editor.History.Snapshot(_editor.Project);
-            _editor.Project.CurrentContainer.CurrentLayer.Shapes = _editor.Project.CurrentContainer.CurrentLayer.Shapes.Add(g);
+            var layer = _editor.Project.CurrentContainer.CurrentLayer;
+
+            var previous = layer.Shapes;
+            var next = layer.Shapes.Add(g);
+            _editor.History.Snapshot(previous, next, (p) => layer.Shapes = p);
+            layer.Shapes = next;
         }

         /// <summary>
@@ -2291,12 +2383,12 @@
             {
                 if (_editor.Renderer.SelectedShape != null)
                 {
-                    _editor.History.Snapshot(_editor.Project);
+                    // TODO: Add history snapshot.
                     _editor.Renderer.SelectedShape.Style = style;
                 }
                 else if (_editor.Renderer.SelectedShapes != null && _editor.Renderer.SelectedShapes.Count > 0)
                 {
-                    _editor.History.Snapshot(_editor.Project);
+                    // TODO: Add history snapshot.
                     foreach (var shape in _editor.Renderer.SelectedShapes)
                     {
                         shape.Style = style;
@@ -2310,7 +2402,7 @@
                         var result = ShapeBounds.HitTest(container, new Vector2(x, y), _editor.Project.Options.HitTreshold);
                         if (result != null)
                         {
-                            _editor.History.Snapshot(_editor.Project);
+                            // Add history snapshot.
                             result.Style = style;
                         }
                     }
@@ -2350,8 +2442,8 @@
             {
                 if (_editor.History.CanUndo())
                 {
-                    var project = _editor.History.Undo(_editor.Project);
-                    _editor.Load(project);
+                    _editor.Deselect();
+                    _editor.History.Undo();
                 }
             }
             catch (Exception ex)
@@ -2370,8 +2462,8 @@
             {
                 if (_editor.History.CanRedo())
                 {
-                    var project = _editor.History.Redo(_editor.Project);
-                    _editor.Load(project);
+                    _editor.Deselect();
+                    _editor.History.Redo();
                 }
             }
             catch (Exception ex)
@@ -2478,7 +2570,7 @@
         {
             try
             {
-                _editor.History.Snapshot(_editor.Project);
+                // TODO: Add history snapshot.
                 _editor.Project.CurrentContainer.Clear();
                 _editor.Project.CurrentContainer.Invalidate();
             }
@@ -2501,30 +2593,6 @@
                     () =>
                     {
                         Eval("Action a = () => { };", this, Execute);
-                    });
-            }
-            catch (Exception ex)
-            {
-                System.Diagnostics.Debug.Print(ex.Message);
-                System.Diagnostics.Debug.Print(ex.StackTrace);
-            }
-        }
-
-        /// <summary>
-        ///
-        /// </summary>
-        private void WarmUpHistory()
-        {
-            // NOTE: Warmup history serializer and compressor.
-            try
-            {
-                Task.Run(
-                    () =>
-                    {
-                        var history = new History<Project>(_serializer, _compressor);
-                        var project = DefaultProject();
-                        history.Snapshot(project);
-                        history.Undo(project);
                     });
             }
             catch (Exception ex)


progress in Sender.SendUdp

progress in Sender.SendUdp

--- TomP2P/TomP2P/Connection/Sender.cs
+++ TomP2P/TomP2P/Connection/Sender.cs
@@ -52,7 +52,7 @@
         /// <param name="channelCreator">The channel creator for the UDP channel.</param>
         /// <param name="idleUdpSeconds">The idle time of a message until fail.</param>
         /// <param name="broadcast">True, if the message is to be sent via layer 2 broadcast.</param>
-        public async Task SendUdpAsync(bool isFireAndForget, Message.Message message, ChannelCreator channelCreator, int idleUdpSeconds, bool broadcast)
+        public async Task<Message.Message> SendUdpAsync(bool isFireAndForget, Message.Message message, ChannelCreator channelCreator, int idleUdpSeconds, bool broadcast)
         {
             // TODO check for sync completion
             // TODO RemovePeerIfFailed(futureResponse, message);
@@ -123,50 +123,36 @@
             Task<int> task = udpClientSocket.SendAsync(messageBytes, receiverEp);

             // 7. await response message (if not fire&forget)
+            // 9. handle possible errors during send (normal vs. fire&forget)
             //  - decoder
+            if (isFireAndForget)
+            {
+                // close channel now
+                Logger.Debug("Fire and forget message {0} sent. Close channel {1} now.", message, udpClientSocket);
+                udpClientSocket.Close(); // TODO ok? what happens when during sending operation? (linger option?)
+
+                // TODO report message
+                return null; // TODO null for signaling fire&forget ok?
+            }
+            else
+            {
+                // not fire&forget -> await response
+                await task;
+                if (task.Exception != null)
+                {
+                    // fail
+                    // TODO report failed
+                    Logger.Warn("One or more exceptions occurred when sending {0}: {1}.", message, task.Exception);
+                }
+                else
+                {
+                    // success
+                    // decode message
+                }
+            }

             // 8. close channel/socket -> ChannelCreator -> SetupCloseListener
-
-            // 9. handle possible errors during send (normal vs. fire&forget)
-
-            // TODO check if everything ok
-
-            // no need to continue if already finished
-            if (futureResponse.IsCompleted)
-            {
-                return;
-            }
-
-            // TODO some handler configurations, probably not needed in .NET
-
-
-            else
-            {
-                UdpClientSocket udpSocket;
-                if (message.Recipient.IsRelayed)
-                {
-                    IList<PeerSocketAddress> psa = new List<PeerSocketAddress>(message.Recipient.PeerSocketAddresses);
-                    Logger.Debug("Send neighbor request to random relay peer {0}.", psa);
-                    if (psa.Count > 0)
-                    {
-                        PeerSocketAddress address = psa[_random.NextInt(psa.Count)];
-                        message.SetRecipientRelay(
-                            message.Recipient.ChangePeerSocketAddress(address).ChangeIsRelayed(true));
-                        udpSocket = channelCreator.CreateUdp(broadcast);
-                    }
-                    else
-                    {
-                        // set task to failed...
-                        return;
-                    }
-                }
-                else
-                {
-                    // TODO in Java, this is async
-                    udpSocket = channelCreator.CreateUdp(broadcast);
-                }
-                await AfterConnect(message, udpSocket, handler == null); // TODO correct use of FF?
-            }
+            udpClientSocket.Close();
         }

         /// <summary>


Also trigger transition events if we leave a transition state

--- TransitionStateMachineBehaviour.cs
+++ TransitionStateMachineBehaviour.cs
@@ -11,8 +11,10 @@
     public class TransitionStateMachineBehaviour : StateMachineBehaviour {
         [SerializeField]
         private TransitionStateDirection direction;
-        public const string DirectionPropertyName = nameof(direction);

+#if ODIN_INSPECTOR
+        [Sirenix.OdinInspector.ShowInInspector]
+#endif
         private bool done;

         public event Action<TransitionStateDirection> StateCompleted;
@@ -23,6 +25,15 @@
             base.OnStateEnter(animator, stateInfo, layerIndex);

             this.done = false;
+        }
+
+        public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
+            base.OnStateExit(animator, stateInfo, layerIndex);
+
+            if (!this.done) {
+                this.StateCompleted?.Invoke(this.direction);
+                this.done = true;
+            }
         }

         public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {


Improved tests

Improved tests

--- UnitTests/Html/HtmlTokenization.cs
+++ UnitTests/Html/HtmlTokenization.cs
@@ -27,7 +27,7 @@
             var t = new HtmlTokenizer(s);
             var token = t.Get();
             Assert.AreEqual(HtmlTokenType.Character, token.Type);
-            Assert.AreEqual(content, ((HtmlCharacterToken)token).Data);
+            Assert.AreEqual(content, token.Data);
         }

         [Test]
@@ -47,7 +47,7 @@
             var t = new HtmlTokenizer(s);
             var token = t.Get();
             Assert.AreEqual(HtmlTokenType.Comment, token.Type);
-            Assert.AreEqual(String.Empty, ((HtmlCommentToken)token).Data);
+            Assert.AreEqual(String.Empty, token.Data);
         }

         [Test]
@@ -57,7 +57,7 @@
             var t = new HtmlTokenizer(s);
             var token = t.Get();
             Assert.AreEqual(HtmlTokenType.Comment, token.Type);
-            Assert.AreEqual("?", ((HtmlCommentToken)token).Data);
+            Assert.AreEqual("?", token.Data);
         }

         [Test]
@@ -67,7 +67,7 @@
             var t = new HtmlTokenizer(s);
             var token = t.Get();
             Assert.AreEqual(HtmlTokenType.Comment, token.Type);
-            Assert.AreEqual(" ", ((HtmlCommentToken)token).Data);
+            Assert.AreEqual(" ", token.Data);
         }

         [Test]
@@ -138,9 +138,9 @@
                 token = t.Get();

                 if (token.Type == HtmlTokenType.Character)
-                    str += ((HtmlCharacterToken)token).Data;
+                    str += token.Data;
             }
-            while (token != HtmlToken.EOF);
+            while (token != HtmlToken.EndOfFile);

             Assert.AreEqual("I'm ∉ I tell you", str);
         }
@@ -159,9 +159,9 @@
                 token = t.Get();

                 if (token.Type == HtmlTokenType.Character)
-                    str += ((HtmlCharacterToken)token).Data;
+                    str += token.Data;
             }
-            while (token != HtmlToken.EOF);
+            while (token != HtmlToken.EndOfFile);

             Assert.AreEqual("I'm ¬it; I tell you", str);
         }
@@ -208,9 +208,9 @@
                 token = t.Get();

                 if (token.Type == HtmlTokenType.Character)
-                    sb.Append(((HtmlCharacterToken)token).Data);
+                    sb.Append(token.Data);
             }
-            while (token != HtmlToken.EOF);
+            while (token != HtmlToken.EndOfFile);

             Assert.AreEqual("hi mum how <!-- are you doing />", sb.ToString());
         }


Added more Socks5Client unit tests

Added more Socks5Client unit tests

--- UnitTests/Net/Socks5ClientTests.cs
+++ UnitTests/Net/Socks5ClientTests.cs
@@ -101,6 +101,38 @@
 		}

 		[Test]
+		public void TestGetAddressType ()
+		{
+			const string host = "www.google.com";
+			IPAddress ipv4 = null, ipv6 = null;
+			IPAddress ip;
+
+			var ipAddresses = Dns.GetHostAddresses (host);
+
+			for (int i = 0; i < ipAddresses.Length && ipv4 == null && ipv6 == null; i++) {
+				if (ipv6 == null && ipAddresses[i].AddressFamily == AddressFamily.InterNetworkV6)
+					ipv6 = ipAddresses[i];
+				else if (ipv4 == null && ipAddresses[i].AddressFamily == AddressFamily.InterNetwork)
+					ipv4 = ipAddresses[i];
+			}
+
+			Assert.AreEqual (Socks5Client.Socks5AddressType.Domain, Socks5Client.GetAddressType (host, out ip));
+			Assert.AreEqual (Socks5Client.Socks5AddressType.IPv4, Socks5Client.GetAddressType (ipv4.ToString (), out ip));
+			Assert.AreEqual (Socks5Client.Socks5AddressType.IPv6, Socks5Client.GetAddressType (ipv6.ToString (), out ip));
+		}
+
+		[Test]
+		public void TestGetFailureReason ()
+		{
+			for (byte i = 1; i < 10; i++) {
+				var reason = Socks5Client.GetFailureReason (i);
+
+				if (i > 8)
+					Assert.IsTrue (reason.StartsWith ("Unknown error", StringComparison.Ordinal));
+			}
+		}
+
+		[Test]
 		public void TestConnectAnonymous ()
 		{
 			var socks = new Socks5Client (Socks5ProxyList[0], Socks5ProxyPorts[0]);


Changed FocusType to Keyboard to allow keyboard navigation in editors

--- UnityWeld_Editor/InspectorUtils.cs
+++ UnityWeld_Editor/InspectorUtils.cs
@@ -23,7 +23,7 @@
             T[] items)
         {
             var labelRect = EditorGUILayout.GetControlRect(false, 16f, EditorStyles.popup);
-            var controlId = GUIUtility.GetControlID(FocusType.Passive, labelRect);
+            var controlId = GUIUtility.GetControlID(FocusType.Keyboard, labelRect);

             var buttonRect = EditorGUI.PrefixLabel(labelRect, controlId, label);


Fixed wrong Window Store review launch URI.

--- UniversalRateReminder/RatePopup.cs
+++ UniversalRateReminder/RatePopup.cs
@@ -1,4 +1,5 @@
 using System;
+using Windows.ApplicationModel;
 using Windows.ApplicationModel.Store;
 using Windows.Storage;
 using Windows.System;
@@ -117,7 +118,26 @@
                     MessageDialog dialog = new MessageDialog(Content, Title);
                     dialog.Commands.Add(new UICommand(RateButtonText, (command) =>
                     {
-                        Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId));
+                        bool runningOnPhone = true;
+
+                        // Ugly hack for detecting running platform at runtime
+                        try
+                        {
+                            object brush = Windows.UI.Xaml.Application.Current.Resources["PhoneAccentBrush"];
+                        }
+                        catch (Exception e)
+                        {
+                            runningOnPhone = false;
+                        }
+
+                        if (runningOnPhone)
+                        {
+                            Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId));
+                        }
+                        else
+                        {
+                            Launcher.LaunchUriAsync(new Uri("ms-windows-store:REVIEW?PFN=" + Package.Current.Id.FamilyName));
+                        }

                         reminderContainer.Values[DismissedPropertyName] = true;
                     }));


Added a basic tree walker implementation of the code generation pass.

--- Weave/Compiler/GenerateCodePass.cs
+++ Weave/Compiler/GenerateCodePass.cs
@@ -14,7 +14,22 @@
     {
         public override void Run(Template template, CompileResult result)
         {
-            result.Code = template.ToString();
+            new GenerateCodeWalker(result).WalkTemplate(template);
+        }
+
+        private class GenerateCodeWalker : TemplateWalker
+        {
+            private readonly CompileResult result;
+
+            public GenerateCodeWalker(CompileResult result)
+            {
+                this.result = result;
+            }
+
+            public override void WalkTemplate(Template template)
+            {
+                this.result.Code = template.ToString();
+            }
         }
     }
 }


v1.6.0

v1.6.0

git-svn-id: 5008db38907ec561f34461eb1c4be2b286fe5150@789 cb474c29-17db-0310-ba2e-db2fec5ab780

--- Web/HttpHandlers/SitemapHandler.cs
+++ Web/HttpHandlers/SitemapHandler.cs
@@ -161,9 +161,10 @@
 				// foreach( SitePage sitePage in sitePages )
 				foreach (Node node in nodes)
 				{
-					if (node.Status != (int) NodeStatus.Offline
+					if (node.Status == (int) NodeStatus.Online
 						&& !node.IsExternalLink
-						&& node.AnonymousViewAllowed)
+						&& node.AnonymousViewAllowed
+						&& node.ShowInNavigation)
 					{
 						SitePage sitePage = new SitePage();
 						sitePage.ChangeFreq = DefaultPageUpdateFrequency;
@@ -211,7 +212,10 @@
 			//start off the site map
 			writer.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
 			writer.WriteStartElement("urlset");
-			writer.WriteAttributeString("xmlns", "http://www.google.com/schemas/sitemap/0.84");
+			writer.WriteAttributeString("xmlns", "http://www.google.com/schemas/sitemap/0.9");
+
+
+
 		}

 		internal void WriteSiteMapFooter(XmlWriter writer)


Improve TaskAction canceled test

Improve TaskAction canceled test

--- WinRT.NET/Tests/TaskActionTests.cs
+++ WinRT.NET/Tests/TaskActionTests.cs
@@ -45,7 +45,12 @@
 			IAsyncAction action = new TaskAction (() => Thread.Sleep (1000));

 			bool completed = false;
-			action.Completed = a => completed = true;
+			action.Completed = a =>
+			{
+				Assert.AreEqual (AsyncStatus.Canceled, a.Status);
+				completed = true;
+			};
+
 			action.Start();

 			action.Cancel();


disabled video frame in minimal configuration

--- WpfApplication2/UI/Window1.xaml.cs
+++ WpfApplication2/UI/Window1.xaml.cs
@@ -220,6 +220,7 @@
             fe.Spellchecking = false;
             fe.Export = false;
             fe.SpeakerAttributes = false;
+            fe.VideoFrame = false;

 #endif


Changed message for test

Changed message for test

--- WpfApplication9/MainWindow.xaml.cs
+++ WpfApplication9/MainWindow.xaml.cs
@@ -38,7 +38,7 @@

            if (e.NavigationMode == NavigationMode.Back)
             {
-                MessageBox.Show("");
+                MessageBox.Show("Back");

             }
         }


Delete AssemblyInfo.cs

Delete AssemblyInfo.cs