Adding Deviance in DescriptiveAnalysis.

Adding Deviance in DescriptiveAnalysis.

--- Sources/Accord.Statistics/Analysis/DescriptiveAnalysis.cs
+++ Sources/Accord.Statistics/Analysis/DescriptiveAnalysis.cs
@@ -99,6 +99,7 @@

         private DoubleRange[] ranges;
         private DoubleRange[] confidence;
+        private DoubleRange[] deviance;

         private double[] kurtosis;
         private Double[] skewness;
@@ -258,6 +259,7 @@
             this.correlationMatrix = CorrelationMatrix;

             this.confidence = Confidence;
+            this.deviance = Deviance;
         }

         private void reset()
@@ -277,6 +279,7 @@
             this.zScores = null;
             this.covarianceMatrix = null;
             this.correlationMatrix = null;
+            this.deviance = null;
         }

         #region Properties
@@ -466,6 +469,25 @@
         }

         /// <summary>
+        ///   Gets the 95% confidence intervals for the <see cref="Means"/>.
+        /// </summary>
+        ///
+        public DoubleRange[] Deviance
+        {
+            get
+            {
+                if (deviance == null)
+                {
+                    deviance = new DoubleRange[variables];
+                    for (int i = 0; i < deviance.Length; i++)
+                        deviance[i] = GetDevianceInterval(i);
+                }
+
+                return deviance;
+            }
+        }
+
+        /// <summary>
         ///   Gets a vector containing the Mode of each column of data.
         /// </summary>
         ///
@@ -666,6 +688,29 @@
             return new DoubleRange(
                 Means[index] - z * StandardErrors[index],
                 Means[index] + z * StandardErrors[index]);
+        }
+
+        /// <summary>
+        ///   Gets a deviance interval for the <see cref="Means"/>
+        ///   within the given confidence level percentage (i.e. uses
+        ///   the standard deviation rather than the standard error to
+        ///   compute the range interval for the variable).
+        /// </summary>
+        ///
+        /// <param name="percent">The confidence level. Default is 0.95.</param>
+        /// <param name="index">The index of the data column whose confidence
+        ///   interval should be calculated.</param>
+        ///
+        /// <returns>A confidence interval for the estimated value.</returns>
+        ///
+        public DoubleRange GetDevianceInterval(int index, double percent = 0.95)
+        {
+            double z = NormalDistribution.Standard
+                .InverseDistributionFunction(0.5 + percent / 2.0);
+
+            return new DoubleRange(
+                Means[index] - z * StandardDeviations[index],
+                Means[index] + z * StandardDeviations[index]);
         }

     }
@@ -840,6 +885,15 @@
         public DoubleRange Confidence
         {
             get { return analysis.Confidence[index]; }
+        }
+
+        /// <summary>
+        ///   Gets the 95% deviance interval around the <see cref="Mean"/>.
+        /// </summary>
+        ///
+        public DoubleRange Deviance
+        {
+            get { return analysis.Deviance[index]; }
         }

         /// <summary>


Fixed typo in test names

Fixed typo in test names

--- src/stream-net-tests/FeedTests.cs
+++ src/stream-net-tests/FeedTests.cs
@@ -28,7 +28,7 @@
         }

         [Test]
-        public void TestAddActivityArugments()
+        public void TestAddActivityArguments()
         {
             Assert.Throws<ArgumentNullException>(() =>
             {
@@ -37,7 +37,7 @@
         }

         [Test]
-        public void TestAddActivitiesArugments()
+        public void TestAddActivitiesArguments()
         {
             Assert.Throws<ArgumentNullException>(() =>
             {
@@ -46,7 +46,7 @@
         }

         [Test]
-        public void TestUpdateActivityArugments()
+        public void TestUpdateActivityArguments()
         {
             Assert.Throws<ArgumentNullException>(() =>
             {
@@ -55,7 +55,7 @@
         }

         [Test]
-        public void TestUpdateActivitiesArugments()
+        public void TestUpdateActivitiesArguments()
         {
             Assert.Throws<ArgumentNullException>(() =>
             {
@@ -68,7 +68,7 @@
         }

         [Test]
-        public void TestGetActivitiesArugments()
+        public void TestGetActivitiesArguments()
         {
             Assert.Throws<ArgumentOutOfRangeException>(() =>
             {
@@ -81,7 +81,7 @@
         }

         [Test]
-        public void TestFollowFeedArugments()
+        public void TestFollowFeedArguments()
         {
             Assert.Throws<ArgumentNullException>(() =>
             {
@@ -94,7 +94,7 @@
         }

         [Test]
-        public void TestUnfollowFeedArugments()
+        public void TestUnfollowFeedArguments()
         {
             Assert.Throws<ArgumentNullException>(() =>
             {
@@ -107,7 +107,7 @@
         }

         [Test]
-        public void TestFollowersArugments()
+        public void TestFollowersArguments()
         {
             Assert.Throws<ArgumentOutOfRangeException>(() =>
             {
@@ -120,7 +120,7 @@
         }

         [Test]
-        public void TestFollowingArugments()
+        public void TestFollowingArguments()
         {
             Assert.Throws<ArgumentOutOfRangeException>(() =>
             {


Update System Programming Lab2 AutomatonBuilder.cs

--- SystemProgramming/Lab2/Lab2/Automaton/AutomatonBuilder.cs
+++ SystemProgramming/Lab2/Lab2/Automaton/AutomatonBuilder.cs
@@ -33,7 +33,7 @@
             }
             else
             {
-                symbol = new EpsilonSymbol();
+                symbol = EpsilonSymbol.Instance;
             }
             head.AddNewTransition(symbol, tale);
         }


bank of Russia added to providers list

bank of Russia added to providers list

--- TIKSN.Core/Finance/ForeignExchange/ExchangeRateService.cs
+++ TIKSN.Core/Finance/ForeignExchange/ExchangeRateService.cs
@@ -7,23 +7,23 @@

 namespace TIKSN.Finance.ForeignExchange
 {
-	public class ExchangeRateService : IExchangeRateService
-	{
-		private readonly Dictionary<int, IExchangeRateProvider> _providers;
+    public class ExchangeRateService : IExchangeRateService
+    {
+        private readonly Dictionary<int, IExchangeRateProvider> _providers;

-		public ExchangeRateService(ICurrencyFactory currencyFactory, IRegionFactory regionFactory)
-		{
-			_providers = new Dictionary<int, IExchangeRateProvider>();
+        public ExchangeRateService(ICurrencyFactory currencyFactory, IRegionFactory regionFactory)
+        {
+            _providers = new Dictionary<int, IExchangeRateProvider>();

-			_providers.Add(9596, new CentralBankOfArmenia(currencyFactory));
-			_providers.Add(2893, new MyCurrencyDotNet(currencyFactory, regionFactory));
+            _providers.Add(9596, new CentralBankOfArmenia(currencyFactory));
+            _providers.Add(2893, new MyCurrencyDotNet(currencyFactory, regionFactory));
             _providers.Add(2328, new BankOfRussia(currencyFactory));

         }

-		public Task InitializeAsync()
-		{
-			throw new NotImplementedException();
-		}
-	}
+        public Task InitializeAsync()
+        {
+            throw new NotImplementedException();
+        }
+    }
 }


Redundant history manipulation fixed

Redundant history manipulation fixed

--- TaskCat.Automaton/TaskCat.Automaton/FiniteStateMachine.cs
+++ TaskCat.Automaton/TaskCat.Automaton/FiniteStateMachine.cs
@@ -135,7 +135,6 @@
             return this.currentCandidateNodes;
         }

-
         public IEnumerable<TransitionEvent> GetEvents(string candidateNodeId)
         {
             var candidateNode = this.currentCandidateNodes.FirstOrDefault(x => x.Id == candidateNodeId);
@@ -157,9 +156,12 @@
             if (this.currentCandidateNodes == null || !currentCandidateNodes.Any())
                 throw new NotSupportedException($"{nameof(currentCandidateNodes)} is either empty or null");

-            var currentCandidateNode = this.currentCandidateNodes.FirstOrDefault(x => x.Id == eventDef.NodeId);
+            var currentCandidateNode = this.currentCandidateNodes.FirstOrDefault(x => x.Id == eventDef.NodeId);
             if (currentCandidateNode == null)
                 return;
+
+            // Removing the selected candidate node since it will go down to history anyway
+            this.currentCandidateNodes.Remove(currentCandidateNode);

             // Find a event that matches the currentCandidate
             var selectedEvent = this.Events.First(
@@ -187,7 +189,6 @@

                     var newNode = JsonConvert.DeserializeObject<Node>(JsonConvert.SerializeObject(currentCandidateNode));
                     newNode.Id = new Guid().ToString();
-                    this.NodeHistory.Add(currentCandidateNode);
                     currentCandidateNode = newNode;
                 }
             }
@@ -201,11 +202,12 @@
                 var dummyNode = this.Nodes.FirstOrDefault(x => x.Id == selectedEvent.Target);
                 if (dummyNode == null)
                     throw new NullReferenceException($"Node of type {selectedEvent.Target} is not present in Nodes");
-                this.NodeHistory.Add(currentCandidateNode);

                 dummyNode.Id = new Guid().ToString();
                 currentCandidateNode = dummyNode;
             }
+
+            this.currentCandidateNodes.Add(currentCandidateNode);
         }

         // TODO: Refactor the open source codebase of Marvin.JsonPatch or write a equality comparer, this is shit.


Fix culture specific test

Fix culture specific test

--- Test/NakedObjects.SystemTest/Attributes/TestAttributes.cs
+++ Test/NakedObjects.SystemTest/Attributes/TestAttributes.cs
@@ -10,8 +10,11 @@
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
 using System.Data.Entity;
+using System.Globalization;
 using System.Linq;
+using System.Threading;
 using SystemTest.Attributes;
+using AdventureWorksModel;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using NakedObjects;
 using NakedObjects.Architecture.Spec;
@@ -527,15 +530,22 @@

         [TestMethod]
         public virtual void CMaskOnDecimalProperty() {
-            var mask1 = NewTestObject<Mask2>();
-            var prop1 = mask1.GetPropertyByName("Prop1");
-            prop1.SetValue("32.70");
-            var dom = (Mask2) mask1.GetDomainObject();
-            Equals("32.7", dom.Prop1.ToString());
-            Equals("32.70", prop1.Content.Title);
-            Equals("32.70", prop1.Title);
-            prop1.AssertTitleIsEqual("32.70");
-            prop1.AssertValueIsEqual("32.70");
+            var culture = Thread.CurrentThread.CurrentCulture;
+            try {
+                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+                var mask1 = NewTestObject<Mask2>();
+                var prop1 = mask1.GetPropertyByName("Prop1");
+                prop1.SetValue("32.70");
+                var dom = (Mask2)mask1.GetDomainObject();
+                Equals("32.7", dom.Prop1.ToString());
+                Equals("32.70", prop1.Content.Title);
+                Equals("32.70", prop1.Title);
+                prop1.AssertTitleIsEqual("32.70");
+                prop1.AssertValueIsEqual("32.70");
+            }
+            finally {
+                Thread.CurrentThread.CurrentCulture = culture;
+            }
         }

         [TestMethod]


added click threshold

added click threshold

--- TouchlessScreen/TouchlessScreenLibrary/TouchlessScreen.cs
+++ TouchlessScreen/TouchlessScreenLibrary/TouchlessScreen.cs
@@ -36,6 +36,10 @@
         private byte[] intensityValues;
         public DepthImagePoint handPoint;
         public DepthImagePoint headPoint;
+        public DepthImagePoint shoulderPoint;
+        public DepthImagePoint elbowPoint;
+        public DepthImagePoint wristPoint;
+        public int threshold;
         private static readonly Lazy<TouchlessScreen> lazy = new Lazy<TouchlessScreen>(() => new TouchlessScreen());

         private bool isInitalized;
@@ -238,13 +242,44 @@

             this.isInitalized = true;
         }
-
+
         public void HandleSensorEvent(object sender, AllFramesReadyEventArgs e)
         {
+
             try
             {
                 this.handPoint = GetSkeletonDepthPoint(e, JointType.HandLeft);
                 this.headPoint = GetSkeletonDepthPoint(e, JointType.Head);
+                this.shoulderPoint = GetSkeletonDepthPoint(e, JointType.ShoulderLeft);
+                this.elbowPoint = GetSkeletonDepthPoint(e, JointType.ElbowLeft);
+                this.wristPoint = GetSkeletonDepthPoint(e, JointType.WristLeft);
+
+                double lenPartOne;
+                double lenPartTwo;
+                double lenPartThree;
+                double armLength;
+
+                //get arm length to determine threshold
+                lenPartOne = Math.Sqrt(Math.Pow(shoulderPoint.X - elbowPoint.X,2) + Math.Pow(shoulderPoint.Y - elbowPoint.Y,2) + Math.Pow(shoulderPoint.Depth - elbowPoint.Depth,2));
+                lenPartTwo = Math.Sqrt(Math.Pow(elbowPoint.X - wristPoint.X, 2) + Math.Pow(elbowPoint.Y - wristPoint.Y, 2) + Math.Pow(elbowPoint.Depth - wristPoint.Depth, 2));
+                lenPartThree = Math.Sqrt(Math.Pow(wristPoint.X - handPoint.X, 2) + Math.Pow(wristPoint.Y - handPoint.Y, 2) + Math.Pow(wristPoint.Depth - handPoint.Depth, 2));
+                armLength = lenPartOne + lenPartTwo + lenPartThree;
+
+                //set click zone threshold as 25mm less than arm length
+                //may need to move to own method
+                threshold = Convert.ToInt32(armLength) - 25;
+
+                //enter click zone threshold
+                if (shoulderPoint.Depth - handPoint.Depth > threshold)
+                {
+                    //if single tracked finger; single click
+                    //if two tracked fingers; right click
+                    //if single tracked finger twice; double click
+                    //if two tracked fingers twice; enter scroll lock
+                }
+
+
+

                 //Point3d<int> pointerRay = this.CalculateVector(this.handPoint, this.headPoint);
                 //System.Diagnostics.Debug.WriteLine(this.ConvertDepthImagePointToPoint3d(this.handPoint).ToString());
@@ -261,11 +296,14 @@
                 System.Diagnostics.Debug.WriteLine(screenPos.ToString());
                 // *** END POINTER CODE

+
+
                 using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
                 {
                     int minDepth;
                     int maxDepth;
                     int maxY, minY, maxX, minX, centerX = 0, centerY = 0;
+                    //int threshold;

                     if (depthFrame != null)
                     {


Remove debug logs

Remove debug logs

--- UnityProject/Assets/Scripts/UI/Lobby/GUI_LobbyDialogue.cs
+++ UnityProject/Assets/Scripts/UI/Lobby/GUI_LobbyDialogue.cs
@@ -64,12 +64,10 @@
             dialogueTitle.text = "Starting Game...";
             if (Managers.instance.isForRelease || !hostServerToggle.isOn)
             {
-                Debug.Log("Connecting to server");
                 ConnectToServer();
             }
             else
             {
-                Debug.Log("Starting local host");
                 networkManager.StartHost();
             }


Minor code cleanup.

Minor code cleanup.

--- VsChromiumCore/Configuration/ConfigurationFileProvider.cs
+++ VsChromiumCore/Configuration/ConfigurationFileProvider.cs
@@ -12,6 +12,9 @@
 namespace VsChromiumCore.Configuration {
   [Export(typeof(IConfigurationFileProvider))]
   public class ConfigurationFileProvider : IConfigurationFileProvider {
+    private const string _configurationDirectoryName = "Configuration";
+    private const string _localConfigurationDirectoryName = ".VsChromium";
+
     public IEnumerable<string> ReadFile(string name, Func<IEnumerable<string>, IEnumerable<string>> postProcessing) {
       foreach (var directoryName in PossibleDirectoryNames()) {
         var path = Path.Combine(directoryName, name);
@@ -25,8 +28,8 @@
     }

     private IEnumerable<string> PossibleDirectoryNames() {
-      yield return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".VsChromium");
-      yield return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Configuration");
+      yield return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), _localConfigurationDirectoryName);
+      yield return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), _configurationDirectoryName);
     }
   }
 }


make ip message more clear

make ip message more clear

--- WebAPI.API/Handlers/Delegating/AuthorizeRequestHandler.cs
+++ WebAPI.API/Handlers/Delegating/AuthorizeRequestHandler.cs
@@ -202,7 +202,9 @@
                         new ResultContainer
                         {
                             Status = (int) HttpStatusCode.BadRequest,
-                            Message = string.Format("Invalid API key. Pattern does not match {0}.", userHostAddress)
+                            Message = string.Format("Invalid API key. The IP you provided does not match what the API " +
+                                                    "is receiving. Double check your API key or create a new one using `{0}` " +
+                                                    "as the pattern.", userHostAddress)
                         },
                         new MediaTypeHeaderValue("application/json"));
                 }
@@ -255,4 +257,4 @@
             return isLocalBasedOnOrigin || isLocalBasedOnReferrer;
         }
     }
-}+}


implemented UpdateUserContactInformationFromUserInput in UsersAsyncService

--- WhenItsDone/Lib/WhenItsDone.Services/UsersAsyncService.cs
+++ WhenItsDone/Lib/WhenItsDone.Services/UsersAsyncService.cs
@@ -61,7 +61,7 @@

             foundUser.ProfilePicture = updatedProfilePicture;

-            return this.SaveChangesToDatabase(foundUser);
+            return this.CommitChanges(foundUser);
         }

         public User UpdateUserProfilePictureFromUrl(string username, string profilePictureUrl)
@@ -81,7 +81,7 @@

             foundUser.ProfilePicture = updatedProfilePicture;

-            return this.SaveChangesToDatabase(foundUser);
+            return this.CommitChanges(foundUser);
         }

         public MedicalInformationUserViewDTO GetCurrentUserMedicalInformation(string username)
@@ -118,7 +118,7 @@
                 foundUser.MedicalInformation.BMI = (int)(foundUser.MedicalInformation.WeightInKg / foundUser.MedicalInformation.HeightInCm * foundUser.MedicalInformation.HeightInCm);
             }

-            return this.SaveChangesToDatabase(foundUser);
+            return this.CommitChanges(foundUser);
         }

         public ContactInformationUserViewDTO GetCurrentUserContactInformation(string username)
@@ -140,13 +140,17 @@

             if (foundUser.ContactInformation.Address == null)
             {
-                foundUser.ContactInformation.Address = this.addressFactory.CreateAddress();
+                foundUser.ContactInformation.Address = this.CreateNewAddress();
             }

-            return this.SaveChangesToDatabase(foundUser);
+            foundUser.ContactInformation.Address.Country = country ?? foundUser.ContactInformation.Address.Country;
+            foundUser.ContactInformation.Address.Street = street ?? foundUser.ContactInformation.Address.Street;
+            foundUser.ContactInformation.Address.City = city ?? foundUser.ContactInformation.Address.City;
+
+            return this.CommitChanges(foundUser);
         }

-        private User SaveChangesToDatabase(User user)
+        private User CommitChanges(User user)
         {
             this.asyncRepository.Update(user);
             using (var unitOfWork = base.UnitOfWorkFactory.CreateUnitOfWork())
@@ -161,5 +165,15 @@
                 }
             }
         }
+
+        private Address CreateNewAddress()
+        {
+            var newAddress = this.addressFactory.CreateAddress();
+            newAddress.Country = "Not set.";
+            newAddress.Street = "Not set.";
+            newAddress.City = "Not set.";
+
+            return newAddress;
+        }
     }
 }


axis cwv.

axis cwv.

--- YetAnotherChartComponent/YetAnotherChartComponent/Axis.cs
+++ YetAnotherChartComponent/YetAnotherChartComponent/Axis.cs
@@ -12,16 +12,37 @@
 namespace eScapeLLC.UWP.Charts {
 	#region AxisCommon
 	/// <summary>
-	/// Consolidate common properties for axes.
+	/// Consolidate common properties for axes and implement IChartAxis.
 	/// </summary>
-	public abstract class AxisCommon : ChartComponent {
+	public abstract class AxisCommon : ChartComponent, IChartAxis {
 		#region properties
+		/// <summary>
+		/// The axis type.
+		/// </summary>
 		public AxisType Type { get; private set; }
+		/// <summary>
+		/// The axis orientation.
+		/// </summary>
 		public AxisOrientation Orientation { get; private set; }
+		/// <summary>
+		/// The lower limit or NaN if not initialized.
+		/// </summary>
 		public double Minimum { get; protected set; } = double.NaN;
+		/// <summary>
+		/// The upper limit or NaN if not initialized.
+		/// </summary>
 		public double Maximum { get; protected set; } = double.NaN;
+		/// <summary>
+		/// The axis range or NaN if limits were not initialized.
+		/// </summary>
 		public double Range { get { return double.IsNaN(Minimum) || double.IsNaN(Maximum) ? double.NaN : Maximum - Minimum; } }
+		/// <summary>
+		/// The PX width of the axis "line".
+		/// </summary>
 		public double AxisLineThickness { get; set; } = 2;
+		/// <summary>
+		/// The PX margin of the axis "line" from the edge of its bounds facing the data area.
+		/// </summary>
 		public double AxisMargin { get; set; } = 2;
 		/// <summary>
 		/// The brush for the axis "line".
@@ -45,13 +66,29 @@
 			Orientation = ao;
 		}
 		#endregion
+		#region public
+		/// <summary>
+		/// Reset the limits to NaN.
+		/// </summary>
+		public void ResetLimits() { Minimum = double.NaN; Maximum = double.NaN; Dirty = true; }
+		/// <summary>
+		/// Update limits based on given value.
+		/// </summary>
+		/// <param name="value">Value to "see".</param>
+		/// <returns>The "mapped" value. By default it's the identity.</returns>
+		public double For(double value) {
+			if (double.IsNaN(Minimum) || value < Minimum) { Minimum = value; Dirty = true; }
+			if (double.IsNaN(Maximum) || value > Maximum) { Maximum = value; Dirty = true; }
+			return value;
+		}
+		#endregion
 	}
 	#endregion
 	#region ValueAxis
 	/// <summary>
 	/// Value axis is a vertical axis that represents the "Y" coordinate.
 	/// </summary>
-	public class ValueAxis : AxisCommon, IChartAxis {
+	public class ValueAxis : AxisCommon {
 		static LogTools.Flag _trace = LogTools.Add("ValueAxis", LogTools.Level.Verbose);
 		#region properties
 		protected Path Segments { get; set; }
@@ -65,14 +102,6 @@
 			BindBrush(this, "Brush", Segments, Path.FillProperty);
 		}
 		#endregion
-		#region IChartAxis
-		public void ResetLimits() { Minimum = double.NaN; Maximum = double.NaN; Dirty = true; }
-		public double For(double value) {
-			if (double.IsNaN(Minimum) || value < Minimum) { Minimum = value; Dirty = true; }
-			if (double.IsNaN(Maximum) || value > Maximum) { Maximum = value; Dirty = true; }
-			return value;
-		}
-		#endregion
 		#region extensions
 		public override void Enter(IChartEnterLeaveContext icelc) {
 			icelc.Add(Segments);
@@ -81,13 +110,21 @@
 			icelc.Remove(Segments);
 		}
 		public override void Layout(IChartLayoutContext iclc) {
-			iclc.ClaimSpace(this, Side.Right, 100);
+			// TODO add space for "nominal" label width
+			var space = AxisMargin + AxisLineThickness + 48;
+			iclc.ClaimSpace(this, Side.Right, space);
 		}
 		public override void Render(IChartRenderContext icrc) {
 			if (!Dirty) return;
 			_trace.Verbose($"{Name} min:{Minimum} max:{Maximum} r:{Range}");
 			Geometry.Figures.Clear();
 			var pf = PathHelper.Rectangle(0, Minimum, AxisLineThickness, Maximum);
+			var start = Math.Round(Minimum);
+			var end = Math.Round(Maximum);
+			var incr = 1.0;
+			_trace.Verbose($"grid start:{start} end:{end} inc:{incr}");
+			for(var vx = start; vx <= end; vx += incr) {
+			}
 			Geometry.Figures.Add(pf);
 			Dirty = false;
 		}
@@ -103,7 +140,7 @@
 	/// <summary>
 	/// Horizontal Category axis.
 	/// </summary>
-	public class CategoryAxis : AxisCommon, IChartAxis {
+	public class CategoryAxis : AxisCommon {
 		static LogTools.Flag _trace = LogTools.Add("CategoryAxis", LogTools.Level.Verbose);
 		#region properties
 		protected Path Segments { get; set; }
@@ -117,14 +154,6 @@
 			BindBrush(this, "Brush", Segments, Path.FillProperty);
 		}
 		#endregion
-		#region IChartAxis
-		public void ResetLimits() { Minimum = double.NaN; Maximum = double.NaN; Dirty = true; }
-		public double For(double value) {
-			if (double.IsNaN(Minimum) || value < Minimum) { Minimum = value; Dirty = true; }
-			if (double.IsNaN(Maximum) || value > Maximum) { Maximum = value; Dirty = true; }
-			return value;
-		}
-		#endregion
 		#region extensions
 		public override void Enter(IChartEnterLeaveContext icelc) {
 			icelc.Add(Segments);
@@ -133,7 +162,9 @@
 			icelc.Remove(Segments);
 		}
 		public override void Layout(IChartLayoutContext iclc) {
-			iclc.ClaimSpace(this, Side.Bottom, 32);
+			// TODO add space for "nominal" text height
+			var space = AxisMargin + AxisLineThickness + 24;
+			iclc.ClaimSpace(this, Side.Bottom, space);
 		}
 		public override void Render(IChartRenderContext icrc) {
 			if (!Dirty) return;


Improved handling of SocketException

Improved handling of SocketException

--- UdpTool/MainForm.cs
+++ UdpTool/MainForm.cs
@@ -138,10 +138,10 @@
                 {
                     udpClient.Client.SetSocketOption(SocketOptionLevel.Socket,
                         SocketOptionName.ReuseAddress, false);
-                }
+                }
                 udpClient.Client.Bind(localEndPoint);
             }
-            catch (Exception ex)
+            catch (SocketException ex)
             {
                 MessageBox.Show(this, ex.Message, this.Text);
                 udpClient = null;
@@ -172,9 +172,11 @@
                 ShowReceivedData(endPoint, data);
             }
             catch (ObjectDisposedException) { }
-            catch (Exception e)
+            catch (SocketException e)
             {
                 MessageBox.Show(e.Message);
+                udpClient = null;
+                CloseUdpClient();
             }
         }

@@ -219,8 +221,17 @@

         private void CloseUdpClient()
         {
-            udpClient.Close();
-            udpClient = null;
+            if (InvokeRequired)
+            {
+                Invoke(new MethodInvoker( delegate { CloseUdpClient(); }));
+                return;
+            }
+
+            if (udpClient != null)
+            {
+                udpClient.Close();
+                udpClient = null;
+            }
             sourceIPAddress.Enabled = true;
             sourcePort.Enabled = true;
             bind.Enabled = true;


CA-212899 : Don't repeatedly write to xenstore waiting for tools to be installed

--- src/xenguestlib/PVInstallation.cs
+++ src/xenguestlib/PVInstallation.cs
@@ -1,4 +1,4 @@
-/* Copyright (c) Citrix Systems Inc.
+/* Copyright (c) Citrix Systems Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms,
@@ -107,9 +107,10 @@
             }
             if (needsinstalling)
                 return true;
-            if (pvinstalledStatus != FeatureLicensed.IsLicensed())
+            if (pvinstalledStatus != FeatureLicensed.IsLicensed()){
             // For license status not match the PVAddon registe status, we need to refresh the status of PVAddon
                 return true;
+            }
             return false;

         }
@@ -125,7 +126,9 @@
                 {
                     Feature.Advertise(wmisession);
                 }
-                if ((needsinstalling && !installing()) || (pvinstalledStatus != FeatureLicensed.IsLicensed()))
+                if ((needsinstalling && !installing())
+                    || ((pvinstalledStatus != FeatureLicensed.IsLicensed())
+                         && (pvinstalledStatus == true)))
                 {
                     RefreshXenstore();
                     return true;


Made proper error message for empty function that need to return something. Made contains operator handle aliased types that aliases a base type.

--- VM12/T12/Emitter.cs
+++ VM12/T12/Emitter.cs
@@ -1702,6 +1702,10 @@

                 var returnStatement = new ASTReturnStatement(trace, null);
                 func.Body.Add(returnStatement);
+            }
+            else if (func.Body.Count == 0)
+            {
+                Fail(func.Trace, $"The function '{func.Name}' must return a value!");
             }
             else if (func.Body.Last() is ASTReturnStatement == false)
             {
@@ -2813,10 +2817,16 @@
                         var valueType = ResolveType(CalcReturnType(containsExpression.Value, scope, typeMap, functionMap, constMap, globalMap), typeMap);
                         var lowerType = ResolveType(CalcReturnType(containsExpression.LowerBound, scope, typeMap, functionMap, constMap, globalMap), typeMap);
                         var upperType = ResolveType(CalcReturnType(containsExpression.UpperBound, scope, typeMap, functionMap, constMap, globalMap), typeMap);
-
+
+                        // FIXME: We can only do this on numeric types!!! Not string, void etc
                         if (valueType is ASTBaseType == false)
-                            Fail(containsExpression.Value.Trace, $"Can only do contains expressions on number types! Got '{valueType}'!");
-
+                        {
+                            if ((valueType is ASTAliasedType alias && alias.RealType is ASTBaseType) == false)
+                            {
+                                Fail(containsExpression.Value.Trace, $"Can only do contains expressions on number types! Got '{valueType}'!");
+                            }
+                        }
+
                         // FIXME! If we are comparing a word with 2 dwords we want to cast up!

                         if (TryGenerateImplicitCast(containsExpression.LowerBound, valueType, scope, typeMap, functionMap, constMap, globalMap, out var typedLower, out var lowerError) == false)


Fix word wrap

Fix word wrap

--- test/HtmlSanitizer.Tests/Tests.cs
+++ test/HtmlSanitizer.Tests/Tests.cs
@@ -3442,7 +3442,8 @@
             + @"style=""background-color: rgba(0, 0, 0, 1)"">Test
";
         var sanitized = sanitizer.Sanitize(html, "https://www.example.com");
-        var expected = @"
Test
";
+        var expected = @"
"
+            + @"Test
";
         Assert.Equal(expected, sanitized);
     }
 }


navigation for licenses view

navigation for licenses view

--- bstrkr.mobile/bstrkr.android/Views/HomeView.cs
+++ bstrkr.mobile/bstrkr.android/Views/HomeView.cs
@@ -492,6 +492,20 @@
 					this.DisableDrawer();
 				}
 			}
+
+			if (request.ViewModelType == typeof(LicensesViewModel))
+			{
+				var licensesView = new LicensesView();
+				licensesView.ViewModel = loaderService.LoadViewModel(request, null);
+				_frag2tag[typeof(LicensesView)] = "licenses_view";
+
+				this.FragmentManager.BeginTransaction()
+					.Replace(Resource.Id.content_frame, licensesView, "licenses_view")
+					.AddToBackStack(null)
+					.Commit();
+
+				this.DisableDrawer();
+			}
 		}

 		private void DisableDrawer()


oops, it should be checked, not enabled.

--- samples/mmk/mmk.cs
+++ samples/mmk/mmk.cs
@@ -51,12 +51,12 @@

 			var rb = new RadioButton () { Text = "Normal" };
 			rb.Location = new Point (30, 30);
-			rb.EnabledChanged += delegate { if (rb.Enabled) channel = 0; };
+			rb.CheckedChanged += delegate { if (rb.Checked) channel = 0; };
 			Controls.Add (rb);

 			var rb2 = new RadioButton () { Text = "Drum" };
 			rb2.Location = new Point (150, 30);
-			rb2.EnabledChanged += delegate { if (rb2.Enabled) channel = 9; };
+			rb2.CheckedChanged += delegate { if (rb2.Checked) channel = 9; };
 			Controls.Add (rb2);

 			rb.Enabled = true;


remove tmp file of pythonwrapper

remove tmp file of pythonwrapper

--- src/PythonWrapper.cs
+++ src/PythonWrapper.cs
@@ -166,7 +166,7 @@
         /// <summary>
         /// exec given code through a temp file
         /// </summary>
-        public StringWrapper Exec(StringWrapper code)
+        public StringWrapper Exec(StringWrapper code, bool remove_tmp_file = true)
         {
             string tmp_pathfilename = null;
             if (TempFolder == null)
@@ -224,7 +224,7 @@
             sw.Stop();
             debug?.Invoke($"python took [{sw.Elapsed}]");

-            File.Delete(tmp_pathfilename);
+            if (remove_tmp_file) File.Delete(tmp_pathfilename);

             return new StringWrapper() { str = res };
         }


Refactoring - Doing Object Calisthenics

Refactoring - Doing Object Calisthenics

--- src/ReplaceTokens.cs
+++ src/ReplaceTokens.cs
@@ -8,10 +8,10 @@
 namespace kgrep {

     public class ReplaceTokens : IFileAction {
-        protected static Logger logger = LogManager.GetCurrentClassLogger();
+        private static Logger logger = LogManager.GetCurrentClassLogger();
         public IHandleOutput sw = new WriteStdout();
-        protected int _countOfMatchesInFile = 0;
-        protected int _lineNumber = 0;
+        private int _countOfMatchesInFile = 0;
+        private int _lineNumber = 0;
         private Command _command;
         private readonly Pickup _pickup;

@@ -51,8 +51,9 @@
         public string ApplyCommandsToLine(string argline, List<Command> commandList) {
             string line = argline;
             foreach (Command command in commandList) {
+                if ( ! isCandidateForReplacement(line, command)) break;
                 if (command.IsReplaceFirstMatchCommand) {
-                   line = (ApplyCommandsFirstMatch(line, command));
+                   line = ApplyCommandsFirstMatch(line, command);
                    if (command.SubjectString.IsMatch(argline)) break;
                 }
                 else
@@ -62,25 +63,21 @@
         }

         public string ApplyCommandsAllMatches(string line, Command command) {
-            if (isCandidateForReplacement(line, command)) {
-                if (command.Style == Command.CommandType.Pickup)
-                    _pickup.CollectAllPickupsInLine(line, command);
-                else
-                    line = ApplySingleCommand(line, command);
-            }
+            if (command.Style == Command.CommandType.Pickup)
+                _pickup.CollectAllPickupsInLine(line, command);
+            else
+                line = ApplySingleCommand(line, command);
             return line;
         }

         public string ApplyCommandsFirstMatch(string line, Command command) {
-            if (isCandidateForReplacement(line, command)) {
-                if (command.SubjectString.IsMatch(line)) {
-                    if (command.Style == Command.CommandType.Normal || command.Style == Command.CommandType.Anchored) {
-                        _pickup.CollectAllPickupsInLine(line, command);
-                        line = command.SubjectString.Replace(line, _pickup.ReplacePickupsWithStoredValue(command.ReplacementString)); //,1);
-                    }
-                    _pickup.CollectAllPickupsInLine(line, command);
-                }
+            if ( ! command.SubjectString.IsMatch(line))
+                return line;
+
+            if (command.Style == Command.CommandType.Normal || command.Style == Command.CommandType.Anchored) {
+                line = ApplySingleCommand(line, command);
             }
+            _pickup.CollectAllPickupsInLine(line, command);
             return line;
         }

@@ -102,14 +99,13 @@
         }

         private bool isCandidateForReplacement(string line, Command command) {
-            // Has a matching AnchorString?
-            if (command.AnchorString.Length > 0) {
-                if (Regex.IsMatch(line, command.AnchorString))
-                    return true;
-                logger.Trace("   is not a Command candidate");
-                return false;
-            }
-            return true;
+            if (command.AnchorString.Length == 0)   // no anchor present
+                return true;
+
+            if (Regex.IsMatch(line, command.AnchorString))
+                return true;
+            logger.Trace("   is not a Command candidate");
+            return false;
         }
     }
 }


Add CurrentMemory class.

Add CurrentMemory class.

--- src/SilDev/Memory.cs
+++ src/SilDev/Memory.cs
@@ -5,7 +5,7 @@
 // ==============================================
 //
 // Filename: Memory.cs
-// Version:  2020-01-24 20:58
+// Version:  2020-01-28 20:16
 //
 // Copyright (c) 2020, Si13n7 Developments(tm)
 // All rights reserved.
@@ -23,6 +23,48 @@
     using Properties;

     /// <summary>
+    ///     Provides static methods to reduce the memory usage of the current process.
+    /// </summary>
+    public static class CurrentMemory
+    {
+        /// <summary>
+        ///     Removes the specified element from current process memory.
+        ///     <para>
+        ///         Note that the element is only removed if you set all references to
+        ///         <see langword="null"/>, except for the one with which you call this
+        ///         method; otherwise the element will remain in memory even if it appears
+        ///         to be removed.
+        ///     </para>
+        /// </summary>
+        /// <typeparam name="TElement">
+        ///     The type of the element.
+        /// </typeparam>
+        /// <param name="element">
+        ///     The element to be removed.
+        /// </param>
+        public static void Destroy<TElement>(ref TElement element) where TElement : class
+        {
+            if (element == null)
+                return;
+            var isCollection = false;
+            switch (element)
+            {
+                case ICollection _:
+                    isCollection = !(element is Array);
+                    break;
+                case IDisposable disposable:
+                    disposable.Dispose();
+                    break;
+            }
+            var generation = GC.GetGeneration(element);
+            element = null;
+            GC.Collect(generation, GCCollectionMode.Forced);
+            if (isCollection)
+                GC.Collect();
+        }
+    }
+
+    /// <summary>
     ///     Provides a way to pin a managed object from unmanaged memory.
     /// </summary>
     public class MemoryPinner : IDisposable


Added Hooks to Chain workflow.

Added Hooks to Chain workflow.

Updated unit test

--- Chain.Test/ChainTest.cs
+++ Chain.Test/ChainTest.cs
@@ -22,18 +22,39 @@
         }

         [TestMethod]
+        public void AddHookTest()
+        {
+            IHook hook = Substitute.For<IHook>();
+
+            Chain chain = new Chain();
+
+            Assert.AreEqual(0, chain.Hooks.Count);
+
+            chain.AddHook(hook);
+
+            Assert.AreEqual(1, chain.Hooks.Count);
+            Assert.AreEqual(hook, chain.Hooks[0]);
+        }
+
+        [TestMethod]
         public void RunLinksWithEnabledLinkTest()
         {
             ILink link = Substitute.For<Link>();
+            IHook hook = Substitute.For<Hook>();

             Chain chain = new Chain();
             chain.AddLink(link);
+            chain.AddHook(hook);

             chain.RunLinks();

+            hook.Received(1).OnChainStart(chain);
+            hook.Received(1).OnLinkStart(link);
             link.Received(1).HookBeforeLink();
             link.Received(1).RunLink();
             link.Received(1).HookAfterLink();
+            hook.Received(1).OnLinkEnd(link);
+            hook.Received(1).OnChainEnd(chain);
         }

         [TestMethod]


Mark MoveType with FlagsAttribute

Mark MoveType with FlagsAttribute

--- ChessDotNet/MoveType.cs
+++ ChessDotNet/MoveType.cs
@@ -1,11 +1,12 @@
 namespace ChessDotNet
 {
+    [System.Flags]
     public enum MoveType
     {
-        Move,
-        Capture,
-        Castling,
-        Promotion,
-        Invalid
+        Invalid = 1,
+        Move = 2,
+        Capture = 4,
+        Castling = 8,
+        Promotion = 16
     }
 }


Added employment stats and made the panel slightly smaller

--- CityVitalsWatchPanel.cs
+++ CityVitalsWatchPanel.cs
@@ -9,7 +9,7 @@
     private static float WidthScale;
     private static float HeightScale;
     private static float PanelWidth = 275f;
-    private static float PanelHeight = 400f;
+    private static float PanelHeight = 370f;
     private static float DistanceFromLeft = 10f;
     private static float DistanceFromTop = 65f;
     private static float ControlHeight = 25f;
@@ -25,6 +25,7 @@
     private UISlider incineratorMeter;
     private UISlider cemeteryMeter;
     private UISlider crematoriumMeter;
+    private UISlider employmentMeter;

     public override void Start() {
         WidthScale = 1f;//Screen.currentResolution.width / 1920f;
@@ -131,7 +132,7 @@
         this.infoPanel.autoLayoutDirection = LayoutDirection.Vertical;
         this.infoPanel.autoLayoutStart = LayoutStart.TopLeft;
         var widthPadding = Mathf.RoundToInt(8 * WidthScale);
-        this.infoPanel.autoLayoutPadding = new RectOffset(widthPadding, widthPadding * 2, 0, Mathf.RoundToInt(10 * HeightScale));
+        this.infoPanel.autoLayoutPadding = new RectOffset(widthPadding, widthPadding * 2, 0, Mathf.RoundToInt(5 * HeightScale));
         this.infoPanel.autoLayout = true;
         this.infoPanel.relativePosition = new Vector3(0f, 45f * HeightScale);
         this.infoPanel.autoSize = true;
@@ -203,6 +204,16 @@

         this.crematoriumMeter = GameObject.Instantiate<UISlider>(healthPanel.Find<UISlider>("DeathcareMeter"));
         zOrder = this.SetUpInfoControl(this.crematoriumMeter, zOrder);
+
+        // Set up unemployment controls
+        GameObject employmentLabelObject = new GameObject("Employment");
+        var employmentLabel = employmentLabelObject.AddComponent<UILabel>();
+        employmentLabel.font = title.font;
+        employmentLabel.localeID = "STATS_9";
+        zOrder = this.SetUpInfoControl(employmentLabel, zOrder);
+
+        this.employmentMeter = GameObject.Instantiate<UISlider>(healthPanel.Find<UISlider>("CemetaryMeter"));
+        zOrder = this.SetUpInfoControl(this.employmentMeter, zOrder);
     }

     private int SetUpInfoControl(UIComponent control, int zOrder) {
@@ -216,7 +227,7 @@

     private void CopyLabel(UILabel source, UILabel target) {
         target.font = source.font;
-        target.text = source.text;
+        target.localeID = source.localeID;
         target.color = source.color;
     }

@@ -235,22 +246,25 @@
         int deadAmount = 0;
         int cremateCapacity = 0;
         int deadCount = 0;
+        float unemployment = 0f;

         if (Singleton<DistrictManager>.exists) {
-            electricityCapacity = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetElectricityCapacity();
-            electricityConsumption = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetElectricityConsumption();
-            waterCapacity = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetWaterCapacity();
-            waterConsumption = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetWaterConsumption();
-            sewageCapacity = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetSewageCapacity();
-            sewageAccumulation = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetSewageAccumulation();
-            garbageCapacity = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetGarbageCapacity();
-            garbageAmount = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetGarbageAmount();
-            incinerationCapacity = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetIncinerationCapacity();
-            garbageAccumulation = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetGarbageAccumulation();
-            deadCapacity = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetDeadCapacity();
-            deadAmount = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetDeadAmount();
-            cremateCapacity = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetCremateCapacity();
-            deadCount = Singleton<DistrictManager>.instance.m_districts.m_buffer[0].GetDeadCount();
+            var info = Singleton<DistrictManager>.instance.m_districts.m_buffer[0];
+            electricityCapacity = info.GetElectricityCapacity();
+            electricityConsumption = info.GetElectricityConsumption();
+            waterCapacity = info.GetWaterCapacity();
+            waterConsumption = info.GetWaterConsumption();
+            sewageCapacity = info.GetSewageCapacity();
+            sewageAccumulation = info.GetSewageAccumulation();
+            garbageCapacity = info.GetGarbageCapacity();
+            garbageAmount = info.GetGarbageAmount();
+            incinerationCapacity = info.GetIncinerationCapacity();
+            garbageAccumulation = info.GetGarbageAccumulation();
+            deadCapacity = info.GetDeadCapacity();
+            deadAmount = info.GetDeadAmount();
+            cremateCapacity = info.GetCremateCapacity();
+            deadCount = info.GetDeadCount();
+            unemployment = info.GetUnemployment();
         }

         this.electricityMeter.value = this.GetPercentage(electricityCapacity, electricityConsumption);
@@ -291,6 +305,8 @@
             "{0} / {1}",
             deadCount == 0 ? "0" : deadCount.ToString("#,#", CultureInfo.InvariantCulture),
             cremateCapacity == 0 ? "0" : cremateCapacity.ToString("#,#", CultureInfo.InvariantCulture));
+        this.employmentMeter.value = Mathf.Round(100f - unemployment);
+        this.employmentMeter.tooltip = this.employmentMeter.value + "%";
     }

     private float GetPercentage(int capacity, int consumption, int consumptionMin = 45, int consumptionMax = 55) {


Remove unnecessary ToInvariantString extension methods. They're already implemented in object.ToInvariantString

--- ClosedXML/Extensions.cs
+++ ClosedXML/Extensions.cs
@@ -172,11 +172,6 @@

     internal static class IntegerExtensions
     {
-        public static String ToInvariantString(this Int32 value)
-        {
-            return value.ToString(CultureInfo.InvariantCulture.NumberFormat);
-        }
-
         public static bool Between(this int val, int from, int to)
         {
             return val >= from && val <= to;
@@ -185,12 +180,6 @@

     internal static class DecimalExtensions
     {
-        //All numbers are stored in XL files as invarient culture this is just a easy helper
-        public static String ToInvariantString(this Decimal value)
-        {
-            return value.ToString(CultureInfo.InvariantCulture);
-        }
-
         public static Decimal SaveRound(this Decimal value)
         {
             return Math.Round(value, 6);
@@ -199,12 +188,6 @@

     internal static class DoubleExtensions
     {
-        //All numbers are stored in XL files as invarient culture this is just a easy helper
-        public static String ToInvariantString(this Double value)
-        {
-            return value.ToString(CultureInfo.InvariantCulture);
-        }
-
         public static Double SaveRound(this Double value)
         {
             return Math.Round(value, 6);
@@ -387,6 +370,12 @@
                 case decimal v:
                     return v.ToString(CultureInfo.InvariantCulture);

+                case TimeSpan ts:
+                    return ts.ToString("c", CultureInfo.InvariantCulture);
+
+                case DateTime d:
+                    return d.ToString(CultureInfo.InvariantCulture);
+
                 default:
                     return value.ToString();
             }


Fixed a bug with writing to the log from multiple threads.

--- CoCSharp/Logging/Log.cs
+++ CoCSharp/Logging/Log.cs
@@ -54,6 +54,9 @@
         /// save everytime after <see cref="LogData(object[])"/> is called.
         /// </summary>
         public virtual bool AutoSave { get; set; }
+
+        private static object m_Locker = new object();
+
         /// <summary>
         /// Gets or sets whether the <see cref="LogBuilder"/> is going to
         /// log each block of logs to the console.
@@ -93,7 +96,10 @@
         /// </summary>
         public void Save()
         {
-            File.WriteAllText(Path, LogString);
+            lock (m_Locker)
+            {
+                File.WriteAllText(Path, LogString);
+            }
         }

         /// <summary>
@@ -101,7 +107,10 @@
         /// </summary>
         public void Save(string path)
         {
-            File.WriteAllText(path, LogString);
+            lock (m_Locker)
+            {
+                File.WriteAllText(path, LogString);
+            }
         }

         /// <summary>


Fixed recursion losing decryption delegate in LoadFromConfig.

--- ConnectionDescriptor.cs
+++ ConnectionDescriptor.cs
@@ -106,7 +106,7 @@
                                + otherName + "[" + otherSection + "]");
                 }
                 // Recurse with different config values.
-                retVal = LoadFromConfig(Config.GetConfig(otherName), otherSection);
+                retVal = LoadFromConfig(Config.GetConfig(otherName), otherSection, decryptionDelegate);
             }
             else
             {


Updated editor to use new Data model

Updated editor to use new Data model

--- Core2D/Editor/Editor.cs
+++ Core2D/Editor/Editor.cs
@@ -1015,17 +1015,17 @@
         /// <param name="property"></param>
         public void AddProperty(Container container, Property property)
         {
-            var previous = container.Properties;
-
-            if (_enableHistory)
-            {
-                var next = container.Properties.Add(property);
-                _history.Snapshot(previous, next, (p) => container.Properties = p);
-                container.Properties = next;
-            }
-            else
-            {
-                container.Properties = container.Properties.Add(property);
+            var previous = container.Data.Properties;
+
+            if (_enableHistory)
+            {
+                var next = container.Data.Properties.Add(property);
+                _history.Snapshot(previous, next, (p) => container.Data.Properties = p);
+                container.Data.Properties = next;
+            }
+            else
+            {
+                container.Data.Properties = container.Data.Properties.Add(property);
             }
         }

@@ -1039,14 +1039,15 @@
             if (_project == null)
                 return;

+            var db = Database.Create(name);
             var builder = ImmutableArray.CreateBuilder<Column>();

             for (int i = 0; i < columns; i++)
             {
-                builder.Add(Column.Create("Column" + i));
-            }
-
-            var db = Database.Create(name, builder.ToImmutable());
+                builder.Add(Column.Create("Column" + i, db));
+            }
+
+            db.Columns = builder.ToImmutable();

             if (_enableHistory)
             {
@@ -1103,13 +1104,13 @@
                 if (_enableHistory)
                 {
                     var previous = db.Columns;
-                    var next = db.Columns.Add(Column.Create(name + db.Columns.Length));
+                    var next = db.Columns.Add(Column.Create(name + db.Columns.Length, db));
                     _history.Snapshot(previous, next, (p) => db.Columns = p);
                     db.Columns = next;
                 }
                 else
                 {
-                    db.Columns = db.Columns.Add(Column.Create(name + db.Columns.Length));
+                    db.Columns = db.Columns.Add(Column.Create(name + db.Columns.Length, db));
                 }
             }
         }
@@ -1128,7 +1129,8 @@
             var values = Enumerable.Repeat(value, db.Columns.Length).Select(c => Value.Create(c));
             var record = Record.Create(
                 db.Columns,
-                ImmutableArray.CreateRange<Value>(values));
+                ImmutableArray.CreateRange<Value>(values),
+                db);

             if (_enableHistory)
             {
@@ -1159,7 +1161,7 @@
                     data.Bindings = ImmutableArray.Create<Binding>();
                 }

-                AddBinding(data, Binding.Create(property, path));
+                AddBinding(data, Binding.Create(property, path, data));
             }
         }

@@ -1181,17 +1183,17 @@
                         data.Properties = ImmutableArray.Create<Property>();
                     }

-                    AddProperty(data, Property.Create(name, value));
+                    AddProperty(data, Property.Create(name, value, data));
                 }
                 else if (owner is Container)
                 {
                     var container = owner as Container;
-                    if (container.Properties == null)
-                    {
-                        container.Properties = ImmutableArray.Create<Property>();
-                    }
-
-                    AddProperty(container, Property.Create(name, value));
+                    if (container.Data.Properties == null)
+                    {
+                        container.Data.Properties = ImmutableArray.Create<Property>();
+                    }
+
+                    AddProperty(container, Property.Create(name, value, container.Data));
                 }
             }
         }
@@ -1547,10 +1549,10 @@
         /// <param name="parameter"></param>
         public void RemoveColumn(object parameter)
         {
-            if (parameter != null && parameter is ColumnParameter)
-            {
-                var owner = (parameter as ColumnParameter).Owner;
-                var column = (parameter as ColumnParameter).Column;
+            if (parameter != null && parameter is Column)
+            {
+                var column = parameter as Column;
+                var owner = column.Owner;

                 if (owner is Database)
                 {
@@ -1634,14 +1636,14 @@
         /// <param name="parameter"></param>
         public void RemoveBinding(object parameter)
         {
-            if (parameter != null && parameter is BindingParameter)
-            {
-                var owner = (parameter as BindingParameter).Owner;
-                var binding = (parameter as BindingParameter).Binding;
+            if (parameter != null && parameter is Binding)
+            {
+                var binding = parameter as Binding;
+                var owner = binding.Owner;

                 if (owner != null && owner is Data)
                 {
-                    var data = owner as Data;
+                    var data = owner;
                     if (data.Bindings != null)
                     {
                         if (_enableHistory)
@@ -1666,14 +1668,14 @@
         /// <param name="parameter"></param>
         public void RemoveProperty(object parameter)
         {
-            if (parameter != null && parameter is PropertyParameter)
-            {
-                var owner = (parameter as PropertyParameter).Owner;
-                var property = (parameter as PropertyParameter).Property;
+            if (parameter != null && parameter is Property)
+            {
+                var property = parameter as Property;
+                var owner = property.Owner;

                 if (owner is Data)
                 {
-                    var data = owner as Data;
+                    var data = owner;
                     if (data.Properties != null)
                     {
                         if (_enableHistory)
@@ -1686,24 +1688,6 @@
                         else
                         {
                             data.Properties = data.Properties.Remove(property);
-                        }
-                    }
-                }
-                else if (owner is Container)
-                {
-                    var container = owner as Container;
-                    if (container.Properties != null)
-                    {
-                        if (_enableHistory)
-                        {
-                            var previous = container.Properties;
-                            var next = container.Properties.Remove(property);
-                            _history.Snapshot(previous, next, (p) => container.Properties = p);
-                            container.Properties = next;
-                        }
-                        else
-                        {
-                            container.Properties = container.Properties.Remove(property);
                         }
                     }
                 }


Add todo

Add todo

--- CtCI/BitManipulation.cs
+++ CtCI/BitManipulation.cs
@@ -168,7 +168,7 @@
         #endregion

         #region 5.8
-        /* I don't feel this question is really worth my time... */
+        /* TODO I don't feel this question is really worth my time right now - moving on to OOP problems */
         #endregion
     }
 }


Resharper code

Resharper code

--- DownloadPDF/FormMain.cs
+++ DownloadPDF/FormMain.cs
@@ -119,7 +119,7 @@

     private static void CreateLanguageFile()
     {
-      List<string> minimumVersion = new List<string>
+      var minimumVersion = new List<string>
       {
         "<?xml version=\"1.0\" encoding=\"utf - 8\" ?>",
         "<Document>",
@@ -619,6 +619,7 @@
           downloadList.Add(href.Value);
         }
       }
+
       downloadList = new List<string>();
       foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
       {
@@ -890,7 +891,7 @@
       ebooksNOK = null;
       ebooks = null;
       var ebooksNoFileFormat = new List<Tuple<string, string, string>>();
-      var ebooksFileFormatOK = new List<Tuple<string, string, string>>();
+      var ebooksFileFormatOk = new List<Tuple<string, string, string>>();
       foreach (Tuple<string, string, string> t in ebooksOK)
       {
         if (t.Item1 == "")
@@ -899,14 +900,14 @@
         }
         else
         {
-          ebooksFileFormatOK.Add(t);
+          ebooksFileFormatOk.Add(t);
         }
       }

       ebooksOK = null;
       var ebooksWellformatted = new List<Tuple<string, string, string>>();
       int bookNb = 1;
-      foreach (Tuple<string, string, string> t in ebooksFileFormatOK)
+      foreach (Tuple<string, string, string> t in ebooksFileFormatOk)
       {
         if (IsInList(t.Item1, new[] { "ZIP", "EPUB", "MOBI", "PDF", "DOC", "XPS", "DOCX", "PPTX" }))
         {
@@ -919,7 +920,7 @@
         }
       }

-      ebooksFileFormatOK = null;
+      ebooksFileFormatOk = null;
       listViewPdfFiles.Items.Clear();
       listViewPdfFiles.Columns.Add("Download", 65, HorizontalAlignment.Left);
       listViewPdfFiles.Columns.Add("Book Name", 240, HorizontalAlignment.Left);


Added finalizer to ThreadRunner

Added finalizer to ThreadRunner

--- bridge/NumCIL/NumCIL/ThreadRunner.cs
+++ bridge/NumCIL/NumCIL/ThreadRunner.cs
@@ -140,19 +140,40 @@
         /// </summary>
         public void Dispose()
         {
-            if (!m_disposed)
-            {
-                m_disposed = true;
-                m_startBarrier.RemoveParticipant();
-                m_finishBarrier.RemoveParticipant();
-
-                var ok = true;
-                foreach (var t in m_thread)
-                    ok &= t.Join(TimeSpan.FromSeconds(10));
-
-                if (!ok)
-                    throw new Exception("Failed to shut down threads?");
-            }
+			Dispose(true);
+        }
+
+        /// <summary>
+        /// Disposes the resources and shuts down the threadpool.
+        /// </summary>
+        /// <param name="disposing">Set to <c>true</c> if disposing, false otherwise.</param>
+        protected void Dispose(bool disposing)
+		{
+			if (!m_disposed)
+			{
+				m_disposed = true;
+				m_startBarrier.RemoveParticipant();
+				m_finishBarrier.RemoveParticipant();
+
+				if (disposing)
+					GC.SuppressFinalize(this);
+
+				var ok = true;
+				foreach (var t in m_thread)
+					ok &= t.Join(TimeSpan.FromSeconds(10));
+
+				if (!ok)
+					throw new Exception("Failed to shut down threads?");
+			}
+		}
+
+        /// <summary>
+        /// Releases unmanaged resources and performs other cleanup operations before the
+        /// <see cref="NumCIL.ThreadRunner"/> is reclaimed by garbage collection.
+        /// </summary>
+        ~ThreadRunner()
+        {
+        	Dispose(false);
         }
     }
 }


Convert `TrackBass` stop internal method to void

--- osu.Framework/Audio/Track/TrackBass.cs
+++ osu.Framework/Audio/Track/TrackBass.cs
@@ -215,7 +215,13 @@
             isRunning = isPlayed = false;
         });

-        private bool stopInternal() => isRunningState(bassMixer.ChannelIsActive(this)) && bassMixer.ChannelPause(this, true);
+        private void stopInternal()
+        {
+            if (!isRunningState(bassMixer.ChannelIsActive(this)))
+                return;
+
+            bassMixer.ChannelPause(this, true);
+        }

         private int direction;


Add documentation for variable

Add documentation for variable

--- osu.Framework/Audio/Track/TrackBass.cs
+++ osu.Framework/Audio/Track/TrackBass.cs
@@ -60,6 +60,7 @@
         /// </summary>
         /// <param name="data">The sample data stream.</param>
         /// <param name="quick">If true, the track will not be fully loaded, and should only be used for preview purposes.  Defaults to false.</param>
+        /// <param name="mixer">The <see cref="AudioMixer"/> to plug this Track into.</param>
         public TrackBass(Stream data, bool quick = false, AudioMixer mixer = null)
         {
             if (data == null)


Use structs for parts for added safety

Use structs for parts for added safety

--- osu.Game/Graphics/ParticleExplosion.cs
+++ osu.Game/Graphics/ParticleExplosion.cs
@@ -13,8 +13,12 @@

 namespace osu.Game.Graphics
 {
+    /// <summary>
+    /// An explosion of textured particles based on how osu-stable randomises the explosion pattern.
+    /// </summary>
     public class ParticleExplosion : Sprite
     {
+        private readonly int particleCount;
         private readonly double duration;
         private double startTime;

@@ -23,11 +27,9 @@
         public ParticleExplosion(Texture texture, int particleCount, double duration)
         {
             Texture = texture;
+            this.particleCount = particleCount;
             this.duration = duration;
             Blending = BlendingParameters.Additive;
-
-            for (int i = 0; i < particleCount; i++)
-                parts.Add(new ParticlePart(duration));
         }

         protected override void LoadComplete()
@@ -36,19 +38,23 @@
             Restart();
         }

+        /// <summary>
+        /// Restart the animation from the current point in time.
+        /// Supports transform time offset chaining.
+        /// </summary>
         public void Restart()
         {
             startTime = TransformStartTime;
             this.FadeOutFromOne(duration);

-            foreach (var p in parts)
-                p.Randomise();
+            parts.Clear();
+            for (int i = 0; i < particleCount; i++)
+                parts.Add(new ParticlePart(duration));
         }

         protected override void Update()
         {
             base.Update();
-
             Invalidate(Invalidation.DrawNode);
         }

@@ -56,7 +62,7 @@

         private class ParticleExplosionDrawNode : SpriteDrawNode
         {
-            private List<ParticlePart> parts = new List<ParticlePart>();
+            private readonly List<ParticlePart> parts = new List<ParticlePart>();

             private ParticleExplosion source => (ParticleExplosion)Source;

@@ -73,9 +79,9 @@
             {
                 base.ApplyState();

-                // this is mostly safe as the parts are immutable.
-                // the most that can go wrong is the random state be incorrect
-                parts = source.parts;
+                parts.Clear();
+                parts.AddRange(source.parts);
+
                 sourceSize = source.Size;
                 startTime = source.startTime;
                 currentTime = source.Time.Current;
@@ -111,22 +117,13 @@
             }
         }

-        private class ParticlePart
+        private readonly struct ParticlePart
         {
-            private readonly double availableDuration;
-
-            private double duration;
-            private double direction;
-            private float distance;
+            private readonly double duration;
+            private readonly double direction;
+            private readonly float distance;

             public ParticlePart(double availableDuration)
-            {
-                this.availableDuration = availableDuration;
-
-                Randomise();
-            }
-
-            public void Randomise()
             {
                 distance = RNG.NextSingle(0.5f);
                 duration = RNG.NextDouble(availableDuration / 3, availableDuration);
@@ -137,12 +134,8 @@

             public Vector2 PositionAtTime(double time)
             {
-                return new Vector2(0.5f) + positionForOffset(distance * progressAtTime(time));
-
-                Vector2 positionForOffset(float offset) => new Vector2(
-                    (float)(offset * Math.Sin(direction)),
-                    (float)(offset * Math.Cos(direction))
-                );
+                var travelledDistance = distance * progressAtTime(time);
+                return new Vector2(0.5f) + travelledDistance * new Vector2((float)Math.Sin(direction), (float)Math.Cos(direction));
             }

             private float progressAtTime(double time) => (float)Math.Clamp(time / duration, 0, 1);


Reworked reopening last tab to no longer use recursion

A reviewer of the pull request was concerned about recursion. I changed
the code to be iterative.

--- osu.Game/Online/Chat/ChannelManager.cs
+++ osu.Game/Online/Chat/ChannelManager.cs
@@ -445,32 +445,46 @@
                 return;
             }

-            string lastClosedChannelName = closedChannels.Last();
-            closedChannels.RemoveAt(closedChannels.Count - 1);
-
-            // types did not work with existing enumerable interfaces funcitons like Contains
-            for (int i = 0; i < joinedChannels.Count; i++)
-            {
-                // If the user already joined the channel, try the next
-                // channel in the list
-                if (joinedChannels[i].Name == lastClosedChannelName)
-                {
-                    JoinLastClosedChannel();
-                    return;
-                }
-            }
-
-            Channel lastClosedChannel = AvailableChannels.FirstOrDefault(c => c.Name == lastClosedChannelName);
-
-            if (lastClosedChannel == null)
-            {
-                JoinLastClosedChannel();
-            }
-            else
-            {
-                JoinChannel(lastClosedChannel);
-            }
-        }
+            // This nested loop could be eliminated if a check was added so that
+            // when the code opens a channel it removes from the closedChannel list.
+            // However, this would require adding an O(|closeChannels|) work operation
+            // every time the user joins a channel, which would make joining a channel
+            // slower. I wanted to centralize all major slowdowns so they
+            // can only occur if the user actually decides to use this feature.
+            for (int i = closedChannels.Count - 1; i >= 0; i--)
+            {
+                string lastClosedChannelName = closedChannels.Last();
+                closedChannels.RemoveAt(closedChannels.Count - 1);
+                bool alreadyJoined = false;
+                // If the user already joined the channel, do not
+                // try to join it
+                for (int j = 0; j < joinedChannels.Count; j++)
+                {
+                    if (joinedChannels[j].Name == lastClosedChannelName)
+                    {
+                        alreadyJoined = true;
+                        break;
+                    }
+                }
+
+                if (alreadyJoined == false)
+                {
+                    Channel lastClosedChannel = AvailableChannels.FirstOrDefault(c => c.Name == lastClosedChannelName);
+
+                    if (lastClosedChannel == null)
+                    {
+                        continue;
+                    }
+                    else
+                    {
+                        JoinChannel(lastClosedChannel);
+                        return;
+                    }
+                }
+            }
+        }
+
+

         private long lastMessageId;


Don't return overlay to null until it has been completely hidden

--- osu.Game/Overlays/BeatmapSetOverlay.cs
+++ osu.Game/Overlays/BeatmapSetOverlay.cs
@@ -126,8 +126,7 @@
             base.PopOut();
             header.Details.StopPreview();

-            FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
-            BeatmapSet = null;
+            FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null);
         }

         protected override bool OnClick(InputState state)


Update Index.cshtml

Update Index.cshtml

Added stub for InterceptorMixinRequirement Recipe

--- pMixins.Mvc/Views/Recipes/Index.cshtml
+++ pMixins.Mvc/Views/Recipes/Index.cshtml
@@ -72,6 +72,7 @@

AOP - Logging / Exception Handling / Parameter Checking

Decorators via IMixinDependency

+
AOP - InterceptorMixinRequirement

                 Download the source for all recipes Here!


Themes. missed file

Themes. missed file

Missed file from previous push
1. Trilat screen now uses DGV scroller,
4. Mouse wheel scrolling works in DGV
5. Scroll button colours added for both text boxes and DGV views
7. DGV scroll bar disappears when not needed
10. Text box scroll bar only appears when needed
11. Assert if you use an old control - this is to warn people in the
future.
12. Drawn panels now highlight
13. Race condition in Travelhistory control - EDDCONFIG was null when it
was accessed in _load.  Moved code to initcontrol
14. Gripper now stays highlighed during drag
15. Added in menu drop down back/fore and toolstrip_back

--- EDDiscovery/EDDTheme.cs
+++ EDDiscovery/EDDTheme.cs
@@ -41,6 +41,7 @@
                 checkbox,
                 label,
                 tabcontrol_borderlines,
+                toolstrip_back
             };

             public string name;         // name of scheme
@@ -86,6 +87,7 @@
                 colors.Add(CI.label, l);
                 colors.Add(CI.group_back, grpb); colors.Add(CI.group_text, grpt); colors.Add(CI.group_borderlines, grlines);
                 colors.Add(CI.tabcontrol_borderlines, tabborderlines);
+                colors.Add(CI.toolstrip_back, ttb);
                 buttonstyle = bstyle; textboxborderstyle = tbbstyle;
                 windowsframe = wf; formopacity = op; fontname = ft; fontsize = fs;
             }
@@ -126,6 +128,7 @@
                 colors.Add(CI.label, SystemColors.MenuText);
                 colors.Add(CI.group_back, SystemColors.Menu); colors.Add(CI.group_text, SystemColors.MenuText); colors.Add(CI.group_borderlines, SystemColors.ControlDark);
                 colors.Add(CI.tabcontrol_borderlines, SystemColors.ControlDark);
+                colors.Add(CI.toolstrip_back, SystemColors.Menu);
                 buttonstyle = buttonstyle_system;
                 textboxborderstyle = textboxborderstyle_fixed3D;
                 windowsframe = true;


Add code for saving quizzes, along with a small refactoring of loading code

--- Eksamensprojekt/Quiz.cs
+++ Eksamensprojekt/Quiz.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Drawing;
+using System.Drawing.Imaging;
 using System.IO;
 using System.IO.Compression;
 using System.Linq;
@@ -40,23 +41,49 @@
             for (int i = 0; i < quiz.QuestionReferences.Count; i++)
 			{
                 QuestionReference reference = quiz.QuestionReferences[i];
-			    quiz.Questions.Add(Question.LoadFromReference(reference, archive));
+			    quiz.Questions.Add(reference.LoadQuestion(archive));
 			}

             quiz.Images = new List<Image>(quiz.ImageReferences.Count);
             for (int i = 0; i < quiz.ImageReferences.Count; i++)
 			{
                 ImageReference reference = quiz.ImageReferences[i];
-                Image image = null;
-			    using(Stream stream = archive.GetEntry(@"images/"+reference.Path).Open())
-                {
-                    image = Image.FromStream(stream);
-                }
-
-                quiz.Images.Add(image);
+                quiz.Images.Add(reference.LoadImage(archive));
 			}

             return quiz;
+        }
+
+        public static void StoreToZip(Quiz quiz, String path)
+        {
+            ZipArchive archive = ZipFile.Open(path, ZipArchiveMode.Update);
+
+            quiz.ImageReferences.Clear();
+            for (int i = 0; i < quiz.Images.Count; i++)
+            {
+                Image image = quiz.Images[i];
+                ImageReference reference = new ImageReference { Path = "image" + i + ".png" };
+                quiz.ImageReferences.Add(reference);
+
+                reference.SaveImage(image, archive);
+            }
+
+            quiz.QuestionReferences.Clear();
+            for (int i = 0; i < quiz.Questions.Count; i++)
+            {
+                Question question = quiz.Questions[i];
+                QuestionReference reference = new QuestionReference { Path = "question" + i + ".xml" };
+                quiz.QuestionReferences.Add(reference);
+
+                reference.SaveQuestion(question, archive);
+            }
+
+            ZipArchiveEntry quizEntry = archive.CreateEntry("quiz.xml");
+            using (Stream stream = quizEntry.Open())
+            {
+                XmlSerializer x = new XmlSerializer(typeof(Quiz));
+                x.Serialize(stream, quiz);
+            }
         }

     }
@@ -65,25 +92,37 @@
     class QuestionReference
     {
         public String Path;
+
+        public Question LoadQuestion(ZipArchive archive)
+        {
+            Question question = null;
+            using (Stream stream = archive.GetEntry(@"questions/" + Path).Open())
+            {
+                XmlSerializer x = new XmlSerializer(typeof(Question));
+                question = (Question)x.Deserialize(stream);
+            }
+
+            return question;
+        }
+
+        public void SaveQuestion(Question question, ZipArchive archive)
+        {
+            ZipArchiveEntry questionEntry = archive.CreateEntry(@"questions/" + Path);
+
+            using (Stream stream = questionEntry.Open())
+            {
+                XmlSerializer x = new XmlSerializer(typeof(Question));
+                x.Serialize(stream, question);
+            }
+        }
     }

     [Serializable()]
     class Question
     {
         public QuestionType Type;
-        public String Value;
-
-        public static Question LoadFromReference(QuestionReference reference, ZipArchive archive)
-        {
-            Question question = null;
-            using(Stream stream = archive.GetEntry(@"questions/"+reference.Path).Open())
-            {
-                XmlSerializer x = new XmlSerializer(typeof(Question));
-                question = (Question)x.Deserialize(stream);
-            }
-
-            return question;
-        }
+        public String Text;
+        public int ImageIndex;
     }

     enum QuestionType
@@ -95,5 +134,26 @@
     class ImageReference
     {
         public String Path;
+
+        public Image LoadImage(ZipArchive archive)
+        {
+            Image image = null;
+            ZipArchiveEntry imageEntry = archive.GetEntry(@"images/" + Path);
+            using (Stream stream = imageEntry.Open())
+            {
+                image = Image.FromStream(stream);
+            }
+
+            return image;
+        }
+
+        public void SaveImage(Image image, ZipArchive archive)
+        {
+            ZipArchiveEntry imageEntry = archive.CreateEntry(@"images/" + Path);
+            using (Stream stream = imageEntry.Open())
+            {
+                image.Save(stream, ImageFormat.Png);
+            }
+        }
     }
 }


添加跳转案例

添加跳转案例

--- sample/PaySharp.Demo/Controllers/NotifyController.cs
+++ sample/PaySharp.Demo/Controllers/NotifyController.cs
@@ -12,6 +12,7 @@
     public class NotifyController : Controller
     {
         private readonly IGateways _gateways;
+        private bool isRedirect;

         public NotifyController(IGateways gateways)
         {
@@ -30,6 +31,11 @@

             // 接收并处理支付通知
             await notify.ReceivedAsync();
+
+            if (isRedirect)
+            {
+                Response.Redirect("https://github.com/Varorbc/PaySharp");
+            }
         }

         private bool Notify_PaySucceed(object sender, PaySucceedEventArgs e)
@@ -46,7 +52,7 @@
                 //同步通知，即浏览器跳转返回
                 if (e.NotifyType == NotifyType.Sync)
                 {
-
+                    isRedirect = true;
                 }
             }


JimEvans: Forgot to simplify the default ChromeDriver constructor in the .NET bindings

git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@15778 07704840-8298-11de-bf8c-fd130f914ac9

--- dotnet/src/WebDriver/Chrome/ChromeDriver.cs
+++ dotnet/src/WebDriver/Chrome/ChromeDriver.cs
@@ -69,7 +69,7 @@
         /// Initializes a new instance of the ChromeDriver class.
         /// </summary>
         public ChromeDriver()
-            : this(ChromeDriverService.CreateDefaultService(), new ChromeOptions(), TimeSpan.FromSeconds(60))
+            : this(new ChromeOptions())
         {
         }


Added slic assumes to function dispatch

Added slic assumes to function dispatch

--- AddOns/SmackInst/SmackInst/Program.cs
+++ AddOns/SmackInst/SmackInst/Program.cs
@@ -414,14 +414,14 @@
             program.AddTopLevelDeclarations(aliasQfuncs);
         }

-        public override Cmd VisitAssumeCmd(AssumeCmd node)
-        {
-            if (BoogieUtil.checkAttrExists("partition", node.Attributes))
-            {
-                node.Attributes = new QKeyValue(Token.NoToken, "fpcondition", new List<object>(), node.Attributes);
-            }
-            return node;
-        }
+        //public override Cmd VisitAssumeCmd(AssumeCmd node)
+        //{
+        //    if (BoogieUtil.checkAttrExists("partition", node.Attributes))
+        //    {
+        //        node.Attributes = new QKeyValue(Token.NoToken, "fpcondition", new List<object>(), node.Attributes);
+        //    }
+        //    return node;
+        //}

         AssumeCmd MkAssume(Expr funcPtr, Expr callee)
         {
@@ -462,7 +462,11 @@
                     var callee = callCmd.callee;
                     // watch out: varg functions have trailing arg types in function name
                     callee = callee.Split('.')[0];
-                    newCmds.Add(MkAssume(Expr.Ident("funcPtr", btype.Int), Expr.Ident(callee, btype.Int)));
+                    var aaCmd = MkAssume(Expr.Ident("funcPtr", btype.Int), Expr.Ident(callee, btype.Int));
+                    aaCmd.Attributes = new QKeyValue(Token.NoToken, "partition", new List<object>(),
+                        new QKeyValue(Token.NoToken, "slic", new List<object>(), aaCmd.Attributes));
+                    newCmds.Add(aaCmd);
+                    //newCmds.Add(MkAssume(Expr.Ident("funcPtr", btype.Int), Expr.Ident(callee, btype.Int)));
                     newCmds.Add(cmd);
                 }
                 else


DerivativesHelper. Check strike value

DerivativesHelper. Check strike value

--- Algo/Derivatives/DerivativesHelper.cs
+++ Algo/Derivatives/DerivativesHelper.cs
@@ -333,7 +333,10 @@

 			return assetPrice == null
 				? null
-				: allStrikes.OrderBy(s => Math.Abs((decimal)(s.Strike - assetPrice))).FirstOrDefault();
+				: allStrikes
+					.Where(s => s.Strike != null)
+					.OrderBy(s => Math.Abs((decimal)(s.Strike.Value - assetPrice)))
+					.FirstOrDefault();
 		}

 		/// <summary>
@@ -348,6 +351,7 @@
 			var group = underlyingAsset
 				.GetDerivatives(provider, expirationDate)
 				.Filter(OptionTypes.Call)
+				.Where(s => s.Strike != null)
 				.GroupBy(s => s.ExpiryDate)
 				.FirstOrDefault();

@@ -355,7 +359,7 @@
 				throw new InvalidOperationException(LocalizedStrings.Str708);

 			var orderedStrikes = group.OrderBy(s => s.Strike).Take(2).ToArray();
-			return (decimal)(orderedStrikes[1].Strike - orderedStrikes[0].Strike);
+			return orderedStrikes[1].Strike.Value - orderedStrikes[0].Strike.Value;
 		}

 		/// <summary>
@@ -384,7 +388,10 @@

 			var cs = underlyingAsset.GetCentralStrike(provider, allStrikes);

-			return allStrikes.Where(s => s.OptionType == OptionTypes.Call ? s.Strike < cs.Strike : s.Strike > cs.Strike);
+			if (cs == null)
+				return Enumerable.Empty<Security>();
+
+			return allStrikes.Where(s => s.Strike != null && s.OptionType == OptionTypes.Call ? s.Strike < cs.Strike : s.Strike > cs.Strike);
 		}

 		/// <summary>
@@ -413,7 +420,10 @@

 			var cs = underlyingAsset.GetCentralStrike(provider, allStrikes);

-			return allStrikes.Where(s => s.OptionType == OptionTypes.Call ? s.Strike > cs.Strike : s.Strike < cs.Strike);
+			if (cs == null)
+				return Enumerable.Empty<Security>();
+
+			return allStrikes.Where(s => s.Strike != null && s.OptionType == OptionTypes.Call ? s.Strike > cs.Strike : s.Strike < cs.Strike);
 		}

 		/// <summary>
@@ -469,12 +479,15 @@

 			option.CheckOption();

+			if (option.Strike == null)
+				return null;
+
 			var assetPrice = option.GetUnderlyingAsset(securityProvider).GetCurrentPrice(dataProvider);

 			if (assetPrice == null)
 				return null;

-			return ((decimal)((option.OptionType == OptionTypes.Call) ? assetPrice - option.Strike : option.Strike - assetPrice)).Max(0);
+			return ((decimal)(option.OptionType == OptionTypes.Call ? assetPrice - option.Strike : option.Strike - assetPrice)).Max(0);
 		}

 		/// <summary>


PartialDownloadMessageAdapter. Fix online message sending.


undoing delta changes that should have went to StateDelta branch

--- Asgard.Core/System/PlayerComponent.cs
+++ Asgard.Core/System/PlayerComponent.cs
@@ -32,16 +32,16 @@
         /// int = hashcode of the real NetworkObject
         /// NetworkObject = clone of the NetObject at Simtick time
         /// </summary>
-//        private Core.Collections.LinkedList<Tuple<uint, Dictionary<int, NetworkObject>>> _deltaBuffer;
-        private Dictionary<int, Queue<Tuple<uint, NetworkObject>>> _deltaBuffer;
+        private Core.Collections.LinkedList<Tuple<uint, Dictionary<int, NetworkObject>>> _deltaBuffer;
+

         public PlayerComponent(NetNode networkNode)
         {
             NetworkNode = networkNode;
             InputBuffer = new JitterBuffer<PlayerStateData>(30);
             _knownObjects = new Dictionary<NetworkObject, uint>();
-            _deltaBuffer =
-                new Dictionary<int, Queue<Tuple<uint, NetworkObject>>>();
+            _deltaBuffer =
+                new Core.Collections.LinkedList<Tuple<uint, Dictionary<int, NetworkObject>>>();
         }

         public PlayerStateData GetNextState()
@@ -104,22 +104,12 @@
         }

         bool useDeltaState = false;
-
         internal Tuple<uint, Dictionary<int, NetworkObject>> GetDeltaBaseline()
         {
             if (!useDeltaState) return null;

             if (_deltaBuffer.First == null) return null;
             return _deltaBuffer.First.Value;
-        }
-
-        internal Tuple<uint, NetworkObject> FindBaseline(NetworkObject baseObj)
-        {
-            Tuple<uint, Queue<NetworkObject>> objectList;
-            if (_deltaBuffer.TryGetValue(baseObj.GetHashCode(), out objectList))
-            {
-
-            }
         }

         internal void AckDeltaBaseline(uint simTick)


Fixed a bug of a moving operation.

Fixed a bug of a moving operation.

--- Assets/ChainVoxelModule/ChainVoxel.cs
+++ Assets/ChainVoxelModule/ChainVoxel.cs
@@ -66,38 +66,43 @@
      * @param textureType テクスチャ番号
      * @see Operation
      */
-	public void apply(Operation op) {
+	public void apply (Operation op)
+	{
 		lock (ChainXController.thisLock) {

 			string posID, destPosID;
 			string[] posIDs;
 			bool isGrouping;
-			switch (op.getOpType()) {
+			switch (op.getOpType ()) {
 			case Operation.INSERT:
-				posID = op.getPosID();
-				if (this.stt.isGrouping(posID)) break;
-				this.insert(op, posID, op.getTextureType());
+				posID = op.getPosID ();
+				if (this.stt.isGrouping (posID))
+					break;
+				this.insert (op, posID, op.getTextureType ());
 				break;
 			case Operation.DELETE:
-				posID = op.getPosID();
-				if (this.stt.isGrouping(posID)) break;
-				this.delete(op, posID);
+				posID = op.getPosID ();
+				if (this.stt.isGrouping (posID))
+					break;
+				this.delete (op, posID);
 				break;
 			case Operation.CREATE:
-				this.create(op);
+				this.create (op);
 				break;
 			case Operation.JOIN:
-				this.join(op);
+				this.join (op);
 				break;
 			case Operation.LEAVE:
-				this.leave(op);
+				this.leave (op);
 				break;
 			case Operation.MOVE:
-				posID = op.getPosID();
-                destPosID = op.getDestPosID();
-				if (this.stt.isGrouping(posID)) break;
-				if (this.stt.isGrouping(destPosID)) break;
-				this.move(op, posID, destPosID);
+				posID = op.getPosID ();
+				destPosID = op.getDestPosID ();
+				if (this.stt.isGrouping (posID))
+					break;
+				if (this.stt.isGrouping (destPosID))
+					break;
+				this.move (op, posID, destPosID);
 				break;

 			case Operation.INSERT_ALL:
@@ -108,25 +113,30 @@
 						isGrouping = true;
 					}
 				}
-				if (isGrouping) { break; }
-				this.insertAll(op, posIDs, op.getTextureTypes());
+				if (isGrouping) {
+					break;
+				}
+				this.insertAll (op, op.getGID(), posIDs, op.getTextureTypes ());
 				break;
 			case Operation.DELETE_ALL:
-				posIDs = op.getPosIDs();
-                isGrouping = false;
-				for(int i = 0; i < posIDs.Length; ++i)  {
+				posIDs = op.getPosIDs ();
+				isGrouping = false;
+				for (int i = 0; i < posIDs.Length; ++i) {
 					if (this.stt.isGrouping (posIDs [i])) {
 						isGrouping = true;
+						break;
 					}
-                }
-				if (isGrouping) { break; }
-				this.deleteAll(op, posIDs);
+				}
+				if (isGrouping) {
+					break;
+				}
+				this.deleteAll (op, op.getGID(), posIDs);
 				break;
 			case Operation.JOIN_ALL:
-				this.joinAll(op);
+				this.joinAll (op, op.getGID(), op.getPosIDs());
 				break;
 			case Operation.LEAVE_ALL:
-				this.leaveAll(op);
+				this.leaveAll (op, op.getGID(), op.getPosIDs());
 				break;
 			case Operation.MOVE_ALL:
 				posIDs = op.getPosIDs ();
@@ -134,10 +144,12 @@
 				for (int i = 0; i < posIDs.Length; ++i) {
 					if (this.stt.isGrouping (posIDs [i])) {
 						isGrouping = true;
+						break;
 					}
 				}
-				if (isGrouping) { break; }
-				this.moveAll (op);
+				if (isGrouping) {
+					this.moveAll (op);
+				}
 				break;
 			default:
 				Debug.Assert (false);
@@ -231,23 +243,24 @@

 	//編集の必要がある
-	public void insertAll(Operation op, string[] posIDs, int[] textureTypes) {
+	public void insertAll(Operation op, string gid, string[] posIDs, int[] textureTypes) {
 		//insertAll時にtextureoTypesをInputする必要がある
 		for (int i = 0; i < posIDs.Length; ++i) {
 			this.insert (op, posIDs [i], textureTypes[i]);
 		}
-        this.joinAll(op);
-	}
-
-	public void deleteAll(Operation op, string[] posIDs) {
-        this.leaveAll(op);
+        this.joinAll(op, gid, posIDs);
+	}
+
+	public void deleteAll(Operation op, string gid, string[] posIDs) {
+		this.leaveAll(op, gid, posIDs);
 		foreach(string posID in posIDs) { this.delete(op, posID); }
 	}

-	public void moveAll(Operation op)
-    {
-        this.deleteAll(op, op.getPosIDs());
-		this.insertAll(op, op.getDestPosIDs(), this.getTextureTypesFrom(op.getPosIDs())); //Here
+	public void moveAll (Operation op)
+	{
+		int[] textureTypes = this.getTextureTypesFrom(op.getPosIDs());
+		this.deleteAll (op, op.getGID(), op.getPosIDs ());
+		this.insertAll(op, op.getGID(), op.getDestPosIDs(), textureTypes);
 	}

 	/**
@@ -273,9 +286,9 @@
      * @param op 操作オブジェクト
      * @see Operation
      */
-	public void joinAll(Operation op) {
-		this.stt.joinAll(op.getTimestamp(), op.getPosIDs(), op.getGID());
-		this.joinedGIDs.Add(op.getGID());//最新のタイムスタンプのグループをとる
+	public void joinAll(Operation op, string gid, string[] posIDs) {
+		this.stt.joinAll(op.getTimestamp(), posIDs, gid);
+		this.joinedGIDs.Add(gid);//最新のタイムスタンプのグループをとる
 	}

 	/**
@@ -294,9 +307,9 @@
      * @param op 操作オブジェクト
      * @see Operation
      */
-	public void leaveAll(Operation op) {
-		this.stt.leaveAll(op.getSID(), op.getTimestamp(), op.getPosIDs(), op.getGID());
-		foreach (string posID in op.getPosIDs()) {
+	public void leaveAll(Operation op, string gid, string[] posIDs) {
+		this.stt.leaveAll(op.getSID(), op.getTimestamp(), posIDs, gid);
+		foreach (string posID in posIDs) {
 			Voxel aVoxel = this.getVoxel (posID);
 			this.insert (op, posID, aVoxel.getTextureType());
 		}
@@ -504,8 +517,8 @@
 	/**
 	 * Test a ChainVoxel class.
 	 */
-	public static void Test() {
-		ChainVoxel cv = new ChainVoxel(new ChainXController());
+	public static void Test ()
+	{
 		/*
 		//
 		// 単体Voxel操作（挿入、削除、移動）をテスト
@@ -530,60 +543,60 @@

 		//
 		// グループVoxel（参加、離脱、移動）のテスト
-		// Here
 		//
 		int numberOfTest = Const.TEST_QUALITY;
-		//Debug.Log ("Number of test: " + numberOfTest);
-
-
-		for (int t = 0; t < numberOfTest; t++)
-		{
+
+		for (int t = 0; t < numberOfTest; t++) {
 			//Debug.Log("test " + t);
+
+			ChainVoxel cv = new ChainVoxel (new ChainXController ());
 			Operation o;
 			int numberOfPosIDs = UnityEngine.Random.Range (1, 3);
-			Vector3 transMatrix = Util.CreateRandomVector3(-1,2);
+			Vector3 transMatrix = Util.CreateRandomVector3 (-1, 2);
 			string[] posIDs = new string[numberOfPosIDs];
 			string[] destPosIDs = new string[numberOfPosIDs];
 			string textureTypes = "";
-			string gid = ChainXModel.PAINT_TOOL_GROUP_ID + Util.GetGUID();
+			string gid = ChainXModel.PAINT_TOOL_GROUP_ID + Util.GetGUID ();

 			for (int p = 0; p < numberOfPosIDs; ++p) {
 				Vector3 v = Util.CreateRandomVector3 (-1000, 1000);
 				Vector3 destV = v + transMatrix;
-				posIDs[p] = Util.CreatePosID(v);
-				destPosIDs[p] = Util.CreatePosID(destV);
-				textureTypes += UnityEngine.Random.Range(0, 8).ToString() + Const.SPLIT_CHAR;
+				posIDs [p] = Util.CreatePosID (v);
+				destPosIDs [p] = Util.CreatePosID (destV);
+				textureTypes += UnityEngine.Random.Range (0, 8).ToString () + Const.SPLIT_CHAR;
 			}
-			textureTypes = textureTypes.TrimEnd(Const.SPLIT_CHAR);
+			textureTypes = textureTypes.TrimEnd (Const.SPLIT_CHAR);

 			//複数Voxelをinsertした後、それらをjoinする
-			o = new Operation(0, Operation.CREATE,
+			o = new Operation (0, Operation.CREATE,
 				"{\"gid\": \"" + gid + "\"}");
-			cv.apply(o);
-
-			o = new Operation(0, Operation.INSERT_ALL,
-                "{\"gid\": \"" + gid +
-				"\", \"posIDs\": \"" + Util.GetCommaLineFrom(posIDs) +
+			cv.apply (o);
+
+			o = new Operation (0, Operation.INSERT_ALL,
+				"{\"gid\": \"" + gid +
+				"\", \"posIDs\": \"" + Util.GetCommaLineFrom (posIDs) +
 				"\", \"textureTypes\": \"" + textureTypes + "\"}");
-			cv.apply(o);
-			Debug.Assert(cv.isIncludingAll(posIDs));
-			Debug.Assert(cv.stt.isGroupingAll(posIDs));
-
-			Debug.Log ("Inserted posIDs: " + Util.GetCommaLineFrom(posIDs));
-			cv.show();
-			cv.stt.show();
-
-			/*
+			cv.apply (o);
+			Debug.Assert (cv.isIncludingAll (posIDs));
+			Debug.Assert (cv.stt.isGroupingAll (posIDs));
+			//Debug.Log ("Inserted posIDs: " + Util.GetCommaLineFrom(posIDs));
+			//cv.show ();
+			//cv.stt.show ();
+
 			o = new Operation(0, Operation.MOVE_ALL,
                 "{\"gid\": \"" + gid +
 				"\", \"posIDs\": \"" + Util.GetCommaLineFrom(posIDs) +
 				"\", \"transMatrix\": \"" + Util.CreatePosID(transMatrix) + "\"}");
 			cv.apply(o);
-			Debug.Log(o.opParams);
-			Debug.Log(Util.GetCommaLineFrom(destPosIDs));
+			Debug.Assert(cv.isIncludingAll(destPosIDs)); //ここもちょっとバグってる
 			Debug.Assert(cv.stt.isGroupingAll(destPosIDs)); //バグってる
-
-
+			cv.show();
+			cv.stt.show();
+			//Debug.Log ("Moved posIDs: " + Util.GetCommaLineFrom(posIDs));
+			Debug.Log ("Moved destPosIDs: " + Util.GetCommaLineFrom(destPosIDs));
+			//Debug.Log ("Moved textureType: " + textureTypes);
+
+			/*
 			o = new Operation(0, Operation.LEAVE_ALL,
                 "{\"gid\": \"" + gid +
 				"\", \"posIDs\": \"" + Util.GetCommaLineFrom(posIDs) + "\"}");


Fix prefixing spaces in BeatmapInfo's ToString when metadata is not populated yet

--- osu.Game/Beatmaps/BeatmapInfo.cs
+++ osu.Game/Beatmaps/BeatmapInfo.cs
@@ -119,7 +119,7 @@
         /// </summary>
         public List<ScoreInfo> Scores { get; set; }

-        public override string ToString() => $"{Metadata} [{Version}]";
+        public override string ToString() => $"{Metadata} [{Version}]".Trim();

         public bool Equals(BeatmapInfo other)
         {


Redundant parenthesis

Redundant parenthesis

--- osu.Game/Overlays/ChatOverlay.cs
+++ osu.Game/Overlays/ChatOverlay.cs
@@ -58,7 +58,7 @@
         private readonly Container channelSelectionContainer;
         private readonly ChannelSelectionOverlay channelSelection;

-        protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || (channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos));
+        protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos);

         public ChatOverlay()
         {


Use synchronous total score retrieval for bindable

--- osu.Game/Scoring/ScoreManager.cs
+++ osu.Game/Scoring/ScoreManager.cs
@@ -195,9 +195,6 @@
         {
             public readonly Bindable<ScoringMode> ScoringMode = new Bindable<ScoringMode>();

-            private readonly ScoreInfo score;
-            private readonly ScoreManager scoreManager;
-
             /// <summary>
             /// Creates a new <see cref="TotalScoreBindable"/>.
             /// </summary>
@@ -205,20 +202,7 @@
             /// <param name="scoreManager">The <see cref="ScoreManager"/>.</param>
             public TotalScoreBindable(ScoreInfo score, ScoreManager scoreManager)
             {
-                this.score = score;
-                this.scoreManager = scoreManager;
-
-                ScoringMode.BindValueChanged(onScoringModeChanged, true);
-            }
-
-            private CancellationTokenSource difficultyCancellationSource;
-
-            private void onScoringModeChanged(ValueChangedEvent<ScoringMode> mode)
-            {
-                difficultyCancellationSource?.Cancel();
-                difficultyCancellationSource = new CancellationTokenSource();
-
-                scoreManager.GetTotalScoreAsync(score, difficultyCancellationSource.Token).ContinueWith(s => Value = s.Result, TaskContinuationOptions.OnlyOnRanToCompletion);
+                ScoringMode.BindValueChanged(_ => Value = scoreManager.GetTotalScore(score), true);
             }
         }


Add missing `ToArray` call

Add missing `ToArray` call

Not sure where this went, was there in my original commit.

--- osu.Game/Skinning/SkinManager.cs
+++ osu.Game/Skinning/SkinManager.cs
@@ -145,10 +145,10 @@
                 if (!s.Protected)
                     return;

-                var existingSkinNames = realm.Run(r => r.All<SkinInfo>()
-                                                        .Where(skin => !skin.DeletePending)
-                                                        .AsEnumerable()
-                                                        .Select(skin => skin.Name));
+                string[] existingSkinNames = realm.Run(r => r.All<SkinInfo>()
+                                                             .Where(skin => !skin.DeletePending)
+                                                             .AsEnumerable()
+                                                             .Select(skin => skin.Name)).ToArray();

                 // if the user is attempting to save one of the default skin implementations, create a copy first.
                 var skinInfo = new SkinInfo


Normalize newlines before comparing

Normalize newlines before comparing

--- test/LtiLibrary.AspNetCore.Tests/BasicLaunch/ConsumerShould.cs
+++ test/LtiLibrary.AspNetCore.Tests/BasicLaunch/ConsumerShould.cs
@@ -37,8 +37,8 @@
         public async void EncodeBasicLaunchFormValues_Using_HttpResponseExtensions_WriteLtiRequest()
         {
             var url = new Uri(_client.BaseAddress, "toolconsumer/launch");
-            var response = await _client.GetStringAsync(url);
-            var expected = TestUtils.LoadReferenceTextFile(LtiConstants.BasicLaunchLtiMessageType);
+            var response = (await _client.GetStringAsync(url)).Replace("\r\n", "\n");
+            var expected = TestUtils.LoadReferenceTextFile(LtiConstants.BasicLaunchLtiMessageType).Replace("\r\n", "\n");
             Assert.Equal(expected, response);
         }


Handle locales with ',' decimal separator.

Fixes #535.

--- tests/Avalonia.Markup.UnitTests/Data/ExpressionSubjectTests.cs
+++ tests/Avalonia.Markup.UnitTests/Data/ExpressionSubjectTests.cs
@@ -72,12 +72,12 @@
         {
             CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;

-            var data = new Class1 { StringValue = "5.6" };
+            var data = new Class1 { StringValue = (5.6).ToString() };
             var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(double));

             target.OnNext(6.7);

-            Assert.Equal("6.7", data.StringValue);
+            Assert.Equal((6.7).ToString(), data.StringValue);
         }

         [Fact]
@@ -89,7 +89,7 @@
             var target = new ExpressionSubject(new ExpressionObserver(data, "DoubleValue"), typeof(string));
             var result = await target.Take(1);

-            Assert.Equal("5.6", result);
+            Assert.Equal((5.6).ToString(), result);
         }

         [Fact]


修改url

修改url

--- uwp_player/uwp_player/MainWindow.xaml.cs
+++ uwp_player/uwp_player/MainWindow.xaml.cs
@@ -20,7 +20,7 @@
         public const int DANMAKU_TTL = 10;
         public const int HORIZONTAL_PADDING = 20;
         public const int LAYER_OFFSET = 15;
-        public const string DANMAKU_SERVER_URL = "http://172.16.100.117:8080/buibui/get_danmakus";
+        public const string DANMAKU_SERVER_URL = "http://dm.ejoy.com/buibui/get_danmakus";
         public const int DANMAKU_SERVER_QUERY_INTERVAL = 1;
     };

@@ -58,7 +58,6 @@
             barrier.Reverse();

             var y = screenHeight - danmakuSize.Height - offset;
-            Debug.Print(String.Format("Y: {0}/{1}  height: {2}", y, screenHeight, danmakuSize.Height));
             foreach (var i in barrier)
             {
                 if (i.Item1 + i.Item2 < y && i.Item1 < y)