update unit tests

update unit tests

--- Plugin.BluetoothLE.Tests/DeviceTests.cs
+++ Plugin.BluetoothLE.Tests/DeviceTests.cs
@@ -30,29 +30,33 @@
                 .ToTask();

             if (connect)
-                await this.device
-                    .ConnectWait()
-                    .Timeout(Constants.ConnectTimeout)
-                    .ToTask();
-        }
+                await this.Connect();
+        }
+
+
+        Task Connect() => this.device
+            .ConnectWait()
+            .Timeout(Constants.ConnectTimeout)
+            .ToTask();

         [Fact]
         public async Task RssiTests()
         {
             await this.Setup(false);
-            var task = this.device
+            var obs = this.device
                 .WhenReadRssiContinuously()
                 .Take(2)
-                .Timeout(TimeSpan.FromSeconds(30))
-                .ToTask();
-
-            await this.device
-                .ConnectWait()
-                .Timeout(Constants.ConnectTimeout)
-                .ToTask();
-
-            await task;
+                .Timeout(TimeSpan.FromSeconds(30));
+
+            await this.Connect();
+            await obs.ToTask();
+
+            this.device.CancelConnection();
+            await this.device.WhenDisconnected().Take(1).ToTask();
+
+            await this.Connect();
+            await obs.ToTask();
         }


Code Style: Reformat and small refactor

Code Style: Reformat and small refactor

--- Plugins/Android/GooglePlayDownloader.cs
+++ Plugins/Android/GooglePlayDownloader.cs
@@ -7,86 +7,78 @@
 {
 #if UNITY_ANDROID && !UNITY_EDITOR
 	private static string PUBLIC_KEY = "REPLACE THIS WITH YOUR PUBLIC KEY";
+	private static AndroidJavaClass AndroidOSBuildClass = new AndroidJavaClass("android.os.Build");
+	private static AndroidJavaClass EnvironmentClass = new AndroidJavaClass("android.os.Environment");
+	private const string Environment_MediaMounted = "mounted";

-	private static AndroidJavaClass detectAndroidJNI;
 	public static bool RunningOnAndroid()
-	{
-		if (detectAndroidJNI == null)
-			detectAndroidJNI = new AndroidJavaClass("android.os.Build");
-		return detectAndroidJNI.GetRawClass() != IntPtr.Zero;
+	{
+		return AndroidOSBuildClass.GetRawClass() != IntPtr.Zero;
 	}
-
-	private static AndroidJavaClass Environment;
-	private const string Environment_MEDIA_MOUNTED = "mounted";

 	static GooglePlayDownloader()
 	{
 		if (!RunningOnAndroid())
 			return;

-		Environment = new AndroidJavaClass("android.os.Environment");
-
-		using (AndroidJavaClass dl_service = new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderService"))
-		{
-	    // stuff for LVL -- MODIFY FOR YOUR APPLICATION!
-			dl_service.SetStatic("BASE64_PUBLIC_KEY", PUBLIC_KEY);
-	    // used by the preference obfuscater
-			dl_service.SetStatic("SALT", new byte[]{1, 43, 256-12, 256-1, 54, 98, 256-100, 256-12, 43, 2, 256-8, 256-4, 9, 5, 256-106, 256-108, 256-33, 45, 256-1, 84});
+		using (AndroidJavaClass downloaderServiceClass = new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderService"))
+		{
+			downloaderServiceClass.SetStatic("BASE64_PUBLIC_KEY", PublicKey);
+			// Used by the preference obfuscater
+			downloaderServiceClass.SetStatic("SALT", new byte[]{1, 43, 256-12, 256-1, 54, 98, 256-100, 256-12, 43, 2, 256-8, 256-4, 9, 5, 256-106, 256-108, 256-33, 45, 256-1, 84});
 		}
 	}

 	public static string GetExpansionFilePath()
 	{
-		populateOBBData();
-
-		if (Environment.CallStatic<string>("getExternalStorageState") != Environment_MEDIA_MOUNTED)
+		PopulateOBBData();
+
+		if (EnvironmentClass.CallStatic<string>("getExternalStorageState") != Environment_MediaMounted)
 			return null;

-		const string obbPath = "Android/obb";
-
-		using (AndroidJavaObject externalStorageDirectory = Environment.CallStatic<AndroidJavaObject>("getExternalStorageDirectory"))
+		const string obbPath = "Android/obb";
+
+		using (AndroidJavaObject externalStorageDirectory = EnvironmentClass.CallStatic<AndroidJavaObject>("getExternalStorageDirectory"))
 		{
-			string root = externalStorageDirectory.Call<string>("getPath");
-			return String.Format("{0}/{1}/{2}", root, obbPath, obb_package);
+			string root = externalStorageDirectory.Call<string>("getPath");
+			return String.Format("{0}/{1}/{2}", root, obbPath, ObbPackage);
 		}
 	}
+
 	public static string GetMainOBBPath(string expansionFilePath)
-	{
-		populateOBBData();
+	{
+		if (expansionFilePath == null)
+			return null;
+
+		PopulateOBBData();
+		string main = String.Format("{0}/main.{1}.{2}.obb", expansionFilePath, ObbVersion, ObbPackage);
+		return File.Exists(main) ? main : null;
+	}

-		if (expansionFilePath == null)
-			return null;
-		string main = String.Format("{0}/main.{1}.{2}.obb", expansionFilePath, obb_version, obb_package);
-		if (!File.Exists(main))
-			return null;
-		return main;
+	public static string GetPatchOBBPath(string expansionFilePath)
+	{
+		if (expansionFilePath == null)
+			return null;
+
+		PopulateOBBData();
+		string main = String.Format("{0}/patch.{1}.{2}.obb", expansionFilePath, ObbVersion, ObbPackage);
+		return File.Exists(main) ? main : null;
 	}
-	public static string GetPatchOBBPath(string expansionFilePath)
-	{
-		populateOBBData();

-		if (expansionFilePath == null)
-			return null;
-		string main = String.Format("{0}/patch.{1}.{2}.obb", expansionFilePath, obb_version, obb_package);
-		if (!File.Exists(main))
-			return null;
-		return main;
-	}
 	public static void FetchOBB()
 	{
-		using (AndroidJavaClass unity_player = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
-		{
-			AndroidJavaObject current_activity = unity_player.GetStatic<AndroidJavaObject>("currentActivity");
-
-			AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent",
-															current_activity,
+		using (AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
+		{
+			AndroidJavaObject currentActivity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
+			AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent",
+															currentActivity,
 															new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderActivity"));

-			int Intent_FLAG_ACTIVITY_NO_ANIMATION = 0x10000;
+			const int Intent_FLAG_ACTIVITY_NO_ANIMATION = 0x10000;
 			intent.Call<AndroidJavaObject>("addFlags", Intent_FLAG_ACTIVITY_NO_ANIMATION);
-			intent.Call<AndroidJavaObject>("putExtra", "unityplayer.Activity",
-														current_activity.Call<AndroidJavaObject>("getClass").Call<string>("getName"));
-			current_activity.Call("startActivity", intent);
+			intent.Call<AndroidJavaObject>("putExtra", "unityplayer.Activity",
+														currentActivity.Call<AndroidJavaObject>("getClass").Call<string>("getName"));
+			currentActivity.Call("startActivity", intent);

 			if (AndroidJNI.ExceptionOccurred() != System.IntPtr.Zero)
 			{
@@ -98,20 +90,20 @@
 	}

 	// This code will reuse the package version from the .apk when looking for the .obb
-	// Modify as appropriate
-	private static string obb_package;
-	private static int obb_version = 0;
-	private static void populateOBBData()
-	{
-		if (obb_version != 0)
+	// Modify as appropriate
+	private static string ObbPackage;
+	private static int ObbVersion = 0;
+	private static void PopulateOBBData()
+	{
+		if (ObbVersion != 0)
 			return;
-		using (AndroidJavaClass unity_player = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
+		using (AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
 		{
-			AndroidJavaObject current_activity = unity_player.GetStatic<AndroidJavaObject>("currentActivity");
-			obb_package = current_activity.Call<string>("getPackageName");
-			AndroidJavaObject package_info = current_activity.Call<AndroidJavaObject>("getPackageManager").Call<AndroidJavaObject>("getPackageInfo", obb_package, 0);
-			obb_version = package_info.Get<int>("versionCode");
+			AndroidJavaObject currentActivity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
+			ObbPackage = currentActivity.Call<string>("getPackageName");
+			AndroidJavaObject packageInfo = currentActivity.Call<AndroidJavaObject>("getPackageManager").Call<AndroidJavaObject>("getPackageInfo", ObbPackage, 0);
+			ObbVersion = packageInfo.Get<int>("versionCode");
 		}
 	}
-#endif
+#endif
 }


Removed comment

Removed comment

--- CoreTweet/Request.cs
+++ CoreTweet/Request.cs
@@ -48,7 +48,6 @@

     /// <summary>
     /// Sends a request to Twitter and some other web services.
-    /// Added a comment...
     /// </summary>
     internal static partial class Request
     {


- Adding IsLive property to Twitch V5 Stream model

--- Twitch/Twitch.Base/Models/V5/Streams/StreamModel.cs
+++ Twitch/Twitch.Base/Models/V5/Streams/StreamModel.cs
@@ -50,5 +50,11 @@
         /// The total number of viewers for the stream.
         /// </summary>
         public long viewers { get; set; }
+
+        /// <summary>
+        /// Whether the stream is currently live or not.
+        /// </summary>
+        [JsonIgnore]
+        public bool IsLive { get { return this.id > 0 && !this.is_playlist; } }
     }
 }


PUSH-299 enfrce tls 1.2, add more headers

--- PushSharp.Apple/AppleHttpPushChannel.cs
+++ PushSharp.Apple/AppleHttpPushChannel.cs
@@ -1,6 +1,7 @@
 using PushSharp.Core;
 using System;
 using System.Net.Http;
+using System.Security.Authentication;
 using System.Text;

 namespace PushSharp.Apple
@@ -17,7 +18,7 @@

             _appleSettings = channelSettings;

-            var requestHandler = new Http2CustomHandler();
+            var requestHandler = new WinHttpHandler() { SslProtocols = SslProtocols.Tls12 };
             requestHandler.ClientCertificates.Add(_appleSettings.Certificate);
             _httpClient = new HttpClient(requestHandler, true)
             {
@@ -35,7 +36,11 @@

             try
             {
-                var message = new HttpRequestMessage(HttpMethod.Post, $"/3/device/{appleNotification.DeviceToken}");
+                var path = $"/3/device/{appleNotification.DeviceToken}";
+                var message = new HttpRequestMessage(HttpMethod.Post, path);
+                message.Version = new Version(2, 0);
+                message.Headers.TryAddWithoutValidation(":method", "POST");
+                message.Headers.TryAddWithoutValidation(":path", path);
                 message.Headers.Add("apns-id", appleNotification.Identifier.ToString());
                 message.Headers.Add("apns-expiration", appleNotification.ExpirationEpochSeconds.ToString());
                 message.Headers.Add("apns-push-type", Enum.GetName(typeof(AppleNotificationType), appleNotification.Type).ToLower());
@@ -43,7 +48,7 @@
                 //message.Headers.Add("apns-topic", "");
                 //message.Headers.Add("apns-collapse-id", "");

-                message.Content = new StringContent(appleNotification.Payload.ToString(), Encoding.UTF8, "application/json");
+                message.Content = new StringContent(appleNotification.Payload.ToString());

                 var response = _httpClient.SendAsync(message).ConfigureAwait(false).GetAwaiter().GetResult();

@@ -54,7 +59,11 @@
                 }
                 else
                 {
-
+                    if (callback != null)
+                    {
+                        // discart notification
+                        callback(this, new SendNotificationResult(notification, false, new Exception("APNs notification discarted.")));
+                    }
                 }


Shortcut key for cycling projection models

--- Puzzles/MagicTile/MagicTile/MainForm.cs
+++ Puzzles/MagicTile/MagicTile/MainForm.cs
@@ -10,6 +10,7 @@
 	using System.Threading;
 	using System.Threading.Tasks;
 	using System.Windows.Forms;
+	using R3.Geometry;

 	public partial class MainForm : Form, IStatusCallback
 	{
@@ -391,6 +392,18 @@
 			if( e.KeyCode == Keys.F6 )
 			{
 				m_settings.SurfaceDisplay = !m_settings.SurfaceDisplay;
+			}
+
+			if( e.KeyCode == Keys.F7 )
+			{
+				if( m_puzzle != null && m_puzzle.Config != null )
+				{
+					if( m_puzzle.Config.Geometry == Geometry.Spherical )
+						m_settings.SphericalModel = (SphericalModel)((int)(m_settings.SphericalModel + 1) % 3);
+
+					if( m_puzzle.Config.Geometry == Geometry.Hyperbolic )
+						m_settings.HyperbolicModel = (HModel)(((int)m_settings.HyperbolicModel + 1) % 2);
+				}
 			}

 			if( e.KeyCode == Keys.F12 )
@@ -785,7 +798,8 @@
 				"\n  x,y,z keys: Remove Layers" +
 				"\n  X,Y,Z keys: Add Layers" +
 				"\n\nOther:" +
-				"\n  F6: Toggles surface display";
+				"\n  F6: Toggles surface display" +
+				"\n  F7: Cycles projection models for spherical and hyperbolic puzzles";

 			string caption = "Mouse Commands";
 			MessageBox.Show( this, text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information );


code review comment

code review comment

--- src/kafka-tests/Unit/KafkaTcpSocketTests.cs
+++ src/kafka-tests/Unit/KafkaTcpSocketTests.cs
@@ -40,7 +40,7 @@
         [Test, Repeat(IntegrationConfig.NumberOfRepeat)]
         public void KafkaTcpSocketShouldConstruct()
         {
-            using (var test = new KafkaTcpSocket(_log, _fakeServerUrl, 5))
+            using (var test = new KafkaTcpSocket(_log, _fakeServerUrl, _maxRetry))
             {
                 Assert.That(test, Is.Not.Null);
                 Assert.That(test.Endpoint, Is.EqualTo(_fakeServerUrl));


Move foo type to static member

Move foo type to static member

--- src/AppHarbor.Tests/TypeNameMatcherTest.cs
+++ src/AppHarbor.Tests/TypeNameMatcherTest.cs
@@ -13,6 +13,8 @@

 		class Foo : IFoo { }

+		private static Type FooType = typeof(Foo);
+
 		[Fact]
 		public void ShouldThrowIfInitializedWithUnnasignableType()
 		{
@@ -20,19 +22,19 @@
 		}

 		[Theory]
-		[InlineData("Foo", typeof(Foo))]
-		[InlineData("foo", typeof(Foo))]
-		public void ShouldGetTypeStartingWithCommandName(string commandName, Type fooType)
+		[InlineData("Foo")]
+		[InlineData("foo")]
+		public void ShouldGetTypeStartingWithCommandName(string commandName)
 		{
-			var matcher = new TypeNameMatcher<IFoo>(new Type[] { fooType });
-			Assert.Equal(fooType, matcher.GetMatchedType(commandName));
+			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
+			Assert.Equal(FooType, matcher.GetMatchedType(commandName));
 		}

 		[Theory]
-		[InlineData("Bar", typeof(Foo))]
-		public void ShouldThrowWhenNoTypesMatches(string commandName, Type fooType)
+		[InlineData("Bar")]
+		public void ShouldThrowWhenNoTypesMatches(string commandName)
 		{
-			var matcher = new TypeNameMatcher<IFoo>(new Type[] { fooType });
+			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
 			Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName));
 		}
 	}


Extract default importer instantiation to protected virtual method.

--- src/AsmResolver.DotNet/ModuleDefinition.cs
+++ src/AsmResolver.DotNet/ModuleDefinition.cs
@@ -770,7 +770,7 @@
             get
             {
                 if (_defaultImporter is null)
-                    Interlocked.CompareExchange(ref _defaultImporter, new ReferenceImporter(this), null);
+                    Interlocked.CompareExchange(ref _defaultImporter, GetDefaultImporter(), null);
                 return _defaultImporter;
             }
         }
@@ -1061,6 +1061,15 @@
         /// This method is called upon initialization of the <see cref="DebugData"/> property.
         /// </remarks>
         protected virtual IList<DebugDataEntry> GetDebugData() => new List<DebugDataEntry>();
+
+        /// <summary>
+        /// Obtains the default reference importer assigned to this module.
+        /// </summary>
+        /// <returns>The importer.</returns>
+        /// <remarks>
+        /// This method is called upon initialization of the <see cref="DefaultImporter"/> property.
+        /// </remarks>
+        protected virtual ReferenceImporter GetDefaultImporter() => new(this);

         /// <summary>
         /// Detects the runtime that this module targets.


Enum States

Enum States

--- src/CAPNet/SpaceDelimitedElementsParser.cs
+++ src/CAPNet/SpaceDelimitedElementsParser.cs
@@ -11,10 +11,12 @@
     /// </summary>
     public static class SpaceDelimitedElementsParser
     {
-        private const int BETWEEN_ELEMENTS = 0;
-        private const int IN_SPACE_CONTAINING_ELEMENTS = 1;
-        private const int IN_ELEMENTS_WITH_NO_SPACE = 2;
-
+        enum States
+        {
+            BETWEEN_ELEMENTS = 0,
+            IN_SPACE_CONTAINING_ELEMENTS = 1,
+            IN_ELEMENTS_WITH_NO_SPACE = 2
+        }
         private static int state;
         private static string partialElement;
         private static int currentPosition;
@@ -32,22 +34,22 @@
             representation = value;
             elements = new List<string>();
             partialElement = "";
-            state = BETWEEN_ELEMENTS;
+            state = (int) States.BETWEEN_ELEMENTS;

             for (currentPosition = 0; currentPosition < representation.Length; currentPosition++)
             {
                 char currentChar = representation[currentPosition];
                 switch (state)
                 {
-                    case BETWEEN_ELEMENTS:
+                    case (int) States.BETWEEN_ELEMENTS:
                         BetweenElementsState(currentChar);
                         break;

-                    case IN_ELEMENTS_WITH_NO_SPACE:
+                    case (int) States.IN_ELEMENTS_WITH_NO_SPACE:
                         InAddressWithNoSpaceState(currentChar);
                         break;

-                    case IN_SPACE_CONTAINING_ELEMENTS:
+                    case (int) States.IN_SPACE_CONTAINING_ELEMENTS:
                         InSpaceContainingAddressState(currentChar);
                         break;
                 }
@@ -70,7 +72,7 @@
             {
                 elements.Add(partialElement);
                 partialElement = "";
-                state = BETWEEN_ELEMENTS;
+                state = (int) States.BETWEEN_ELEMENTS;
             }
         }

@@ -88,7 +90,7 @@
             {
                 elements.Add(partialElement);
                 partialElement = "";
-                state = BETWEEN_ELEMENTS;
+                state = (int) States.BETWEEN_ELEMENTS;
             }

         }
@@ -97,11 +99,11 @@
         {
             if (currentChar.IsQuote())
             {
-                state = IN_SPACE_CONTAINING_ELEMENTS;
+                state = (int) States.IN_SPACE_CONTAINING_ELEMENTS;
             }
             else if (currentChar.IsElementCharacter())
             {
-                state = IN_ELEMENTS_WITH_NO_SPACE;
+                state = (int) States.IN_ELEMENTS_WITH_NO_SPACE;
                 partialElement += currentChar;
                 if (currentPosition == representation.Length - 1)
                 {


Update HashMacAddress calculation

Update HashMacAddress calculation

--- src/Common/Commands.Common/MetricHelper.cs
+++ src/Common/Commands.Common/MetricHelper.cs
@@ -54,22 +54,18 @@
         /// </summary>
         private readonly object _lock = new object();

-        private static string _hashMacAddress = string.Empty;
-
-        private static string HashMacAddress
+        private string _hashMacAddress = string.Empty;
+
+        private string HashMacAddress
         {
             get
             {
                 if (_hashMacAddress == string.Empty)
                 {
-                    _hashMacAddress = null;
                     var macAddress = NetworkInterface.GetAllNetworkInterfaces()
                         .FirstOrDefault(nic => nic.OperationalStatus == OperationalStatus.Up)?
                         .GetPhysicalAddress().ToString();
-                    if (macAddress != null)
-                    {
-                        _hashMacAddress = GenerateSha256HashString(macAddress).Replace("-", string.Empty).ToLowerInvariant();
-                    }
+                    _hashMacAddress = macAddress == null ? null : GenerateSha256HashString(macAddress).Replace("-", string.Empty).ToLowerInvariant();
                 }

                 return _hashMacAddress;


Update AvaloniaRenderer.cs

Update AvaloniaRenderer.cs

--- src/Core2D.UI/Renderer/AvaloniaRenderer.cs
+++ src/Core2D.UI/Renderer/AvaloniaRenderer.cs
@@ -974,7 +974,10 @@
                     //point.Invalidate();
                 }

-                drawNodeCached.Draw(context, dx, dy, _state.ZoomX);
+                if (_state.DrawPoints == true)
+                {
+                    drawNodeCached.Draw(context, dx, dy, _state.ZoomX);
+                }
             }
             else
             {
@@ -984,7 +987,10 @@

                 _drawNodeCache.Set(point, drawNode);

-                drawNode.Draw(context, dx, dy, _state.ZoomX);
+                if (_state.DrawPoints == true)
+                {
+                    drawNode.Draw(context, dx, dy, _state.ZoomX);
+                }
             }
         }


Downlitor: Autocomplete for subquest control

--- Programs/Downlitor/Downlitor/SubquestInfoControl.cs
+++ Programs/Downlitor/Downlitor/SubquestInfoControl.cs
@@ -19,6 +19,8 @@
             for (int i = 0; i < manager.NumEntries; i++)
                 comboSubquest.Items.Add(manager.GetEntry(i));
             comboSubquest.SelectedIndex = manager.GetIndex(dlc.Index);
+            comboSubquest.AutoCompleteMode = AutoCompleteMode.Suggest;
+            comboSubquest.AutoCompleteSource = AutoCompleteSource.ListItems;

             comboSubquest.SelectedIndexChanged += delegate {
                 dlc.Index = (ushort)manager.GetNumber(comboSubquest.SelectedIndex);


Extracts common code out to a helper method for testing simple binary expressions.

--- ProjectHekate.Grammar.Tests/THekateScriptVisitor.cs
+++ ProjectHekate.Grammar.Tests/THekateScriptVisitor.cs
@@ -72,13 +72,12 @@
         [TestClass]
         public class VisitBinaryExpression : THekateScriptVisitor
         {
-            [TestMethod]
-            public void ShouldGenerateCodeForAddition()
+            private void TestCodeGenerationForOperator(string operatorString, Instruction op)
             {
                 // Setup: dummy data + mock vm out
-                const int left = 3;
-                const float right = 5.35f;
-                var expression = String.Format("{0}+{1}", left, right);
+                const int left = 1;
+                const float right = 0;
+                var expression = String.Format("{0}{1}{2}", left, operatorString, right);

                 ResetSubject();

@@ -91,29 +90,21 @@
                 result.Code[1].Should().Be(left);
                 result.Code[2].Should().Be((byte)Instruction.Push);
                 result.Code[3].Should().Be(right);
-                result.Code[4].Should().Be((byte)Instruction.OperatorAdd);
+                result.Code[4].Should().Be((byte)op);
+            }
+
+            [TestMethod]
+            public void ShouldGenerateCodeForAddition()
+            {
+                TestCodeGenerationForOperator("+", Instruction.OperatorAdd);
             }

             [TestMethod]
             public void ShouldGenerateCodeForSubtraction()
             {
-                // Setup: dummy data + mock vm out
-                const int left = 3;
-                const float right = 5.39f;
-                var expression = String.Format("{0}-{1}", left, right);
+                TestCodeGenerationForOperator("+", Instruction.OperatorSubtract);
+            }

-                ResetSubject();
-
-                // Act
-                var result = Subject.VisitBinaryExpression(GenerateContext<HekateParser.BinaryExpressionContext>(expression));
-
-                // Verify
-                result.Code.Should().HaveCount(5);
-                result.Code[0].Should().Be((byte)Instruction.Push);
-                result.Code[1].Should().Be(left);
-                result.Code[2].Should().Be((byte)Instruction.Push);
-                result.Code[3].Should().Be(right);
-                result.Code[4].Should().Be((byte)Instruction.OperatorSubtract);
             }
         }


admin: Display current  user

admin: Display current  user

Display current user on the main navbar

--- src/Web/views/admin/master.cshtml
+++ src/Web/views/admin/master.cshtml
@@ -53,7 +53,7 @@

-                        Pekka
+                        @RenderContext.Context.CurrentUser.UserName

Change Password


hey look unit testing found some bugs it's almost like this process should have been in place from the start

--- RelhaxModpack/RelhaxModpack/Atlases/AtlasCreator.cs
+++ RelhaxModpack/RelhaxModpack/Atlases/AtlasCreator.cs
@@ -580,7 +580,7 @@
         #region IDisposable Support
         private void Cleanup()
         {
-            Logging.Info("[atlas file {0}]: Disposing resources from DisposeCleanup()", Atlas.AtlasFile);
+            Logging.Debug(LogOptions.ClassName, "Disposing resources");
             //dispose main atlas image
             if (atlasImage != null)
             {
@@ -613,10 +613,13 @@
             }

             //delete the temp files if they exist
-            if (File.Exists(Atlas.TempAtlasImageFilePath))
-                File.Delete(Atlas.TempAtlasImageFilePath);
-            if (File.Exists(Atlas.TempAtlasMapFilePath))
-                File.Delete(Atlas.TempAtlasMapFilePath);
+            if (Atlas != null)
+            {
+                if (File.Exists(Atlas.TempAtlasImageFilePath))
+                    File.Delete(Atlas.TempAtlasImageFilePath);
+                if (File.Exists(Atlas.TempAtlasMapFilePath))
+                    File.Delete(Atlas.TempAtlasMapFilePath);
+            }
         }

         private bool disposedValue = false; // To detect redundant calls


Revert "Corrected naming for credits, added known specialtist list to credits (NEEDS TESTING!) (See commit notes)"

This reverts commit 38b31125f0c3fc5196a9ae1e9e01c74354cc317c.

--- RelhaxModpack/RelhaxModpack/Windows/Credits.xaml.cs
+++ RelhaxModpack/RelhaxModpack/Windows/Credits.xaml.cs
@@ -35,18 +35,14 @@
             StringBuilder creditsBuilder = new StringBuilder();
             //project lead and database managers
             creditsBuilder.AppendFormat("{0}: Willster419{1}{1}", Translations.GetTranslatedString("creditsProjectLeader"), nl);
-            creditsBuilder.AppendFormat("{0}:{1}", "XVM Specialtist", string.Join(", ", new string[] { "elektrosmoker" }), nl);
-            creditsBuilder.AppendFormat("{0}:{1}", "Consistancy Manager", string.Join(", ", new string[] { "elektrosmoker" }), nl);
-            creditsBuilder.AppendFormat("{0}:{1}", "Configuration Builder", string.Join(", ", new string[] { "The Illusion" }), nl);
-            creditsBuilder.AppendFormat("{0}:{1}", "Custom Tank Skins Specialtist", string.Join(", ", new string[] { "The Illusion" }), nl);
             creditsBuilder.AppendFormat("{0}:{1}", Translations.GetTranslatedString("creditsDatabaseManagers"), nl);
-            creditsBuilder.AppendLine(string.Join(", ",new string[] { "elektrosmoker", "dirty20067", "123Gauss", "The Illusion"}));
+            creditsBuilder.AppendLine(string.Join(", ",new string[] { "elektrosmoker", "Dirty20067", "123GAUSS", "TheIllusion"}));
             creditsBuilder.AppendLine();

             //Translators
             creditsBuilder.AppendFormat("{0}:{1}", Translations.GetTranslatedString("creditsTranslators"), nl);
             creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageEnglish, string.Join(", ",new string[] { "Rkk1945", "Willster419"}), nl);
-            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageGerman, string.Join(", ", new string[] {"Grumpelumpf", "dirty20067", "123Gauss", "elektrosmoker" }), nl);
+            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageGerman, string.Join(", ", new string[] {"Grumpelumpf", "Dirty20067", "123GAUSS", "elektrosmoker" }), nl);
             creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageFrench, string.Join(", ", new string[] {"Merkk", "Toshiro" }), nl);
             creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageSpanish, "LordFelix", nl);
             creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguagePolish, string.Join(", ", new string[] {"Neoros","Nullmaruzero" }), nl);


fix: first item cannot be selected

fix: first item cannot be selected

--- NextcloudApp/ViewModels/ShareTargetPageViewModel.cs
+++ NextcloudApp/ViewModels/ShareTargetPageViewModel.cs
@@ -47,33 +47,30 @@
             GroupByNameAscendingCommand = new DelegateCommand(() =>
             {
                 Directory.GroupByNameAscending();
-                SelectedFileOrFolder = null;
             });
             GroupByNameDescendingCommand = new DelegateCommand(() =>
             {
                 Directory.GroupByNameDescending();
-                SelectedFileOrFolder = null;
             });
             GroupByDateAscendingCommand = new DelegateCommand(() =>
             {
                 Directory.GroupByDateAscending();
-                SelectedFileOrFolder = null;
             });
             GroupByDateDescendingCommand = new DelegateCommand(() =>
             {
                 Directory.GroupByDateDescending();
-                SelectedFileOrFolder = null;
             });
             GroupBySizeAscendingCommand = new DelegateCommand(() =>
             {
                 Directory.GroupBySizeAscending();
-                SelectedFileOrFolder = null;
             });
             GroupBySizeDescendingCommand = new DelegateCommand(() =>
             {
                 Directory.GroupBySizeDescending();
-                SelectedFileOrFolder = null;
-            });
+            });
+
+            SelectedFileOrFolder = null;
+
             RefreshCommand = new DelegateCommand(async () =>
             {
                 ShowProgressIndicator();
@@ -289,14 +286,13 @@

         private async void StartDirectoryListing()
         {
-            await OnUiThread(async () =>
-            {
-                ShowProgressIndicator();
-
-                await Directory.StartDirectoryListing();
-
-                HideProgressIndicator();
-            });
+            ShowProgressIndicator();
+
+            await Directory.StartDirectoryListing();
+
+            HideProgressIndicator();
+
+            SelectedFileOrFolder = null;
         }

         public override bool CanRevertState()


Fixes an exception when setting the localPosition of the SimplePolygon without having an entity already attached to the component.

--- Nez-PCL/ECS/Components/Renderables/SimplePolygon.cs
+++ Nez-PCL/ECS/Components/Renderables/SimplePolygon.cs
@@ -43,8 +43,13 @@
 				{
 					if( _rotation == 0f )
 					{
-						for( var i = 0; i < _points.Length; i++ )
-							_worldSpacePoints[i] = _points[i] + entity.position + _localPosition - _origin;
+						for (var i = 0; i < _points.Length; i++) {
+							if (entity != null) {
+								_worldSpacePoints[i] = _points[i] + entity.position + _localPosition - _origin;
+							} else {
+								_worldSpacePoints[i] = _points[i] + _localPosition - _origin;
+							}
+						}
 					}
 					else
 					{


Static methods

Static methods

--- VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs
+++ VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;

 namespace VaderSharp
 {
@@ -9,6 +10,119 @@

         public SentimentIntensityAnalyzer() { }

+        #region Static Methods
+
+        /// <summary>
+        /// Determine if word is ALL CAPS
+        /// </summary>
+        /// <param name="word"></param>
+        /// <returns></returns>
+        private static bool IsUpper(string word)
+        {
+            return !word.Any(char.IsLower);
+        }
+
+        /// <summary>
+        /// Determine if input contains negation words
+        /// </summary>
+        /// <param name="inputWords"></param>
+        /// <param name="includenT"></param>
+        /// <returns></returns>
+        private static bool Negated(IList<string> inputWords, bool includenT)
+        {
+            foreach (var word in Negate)
+            {
+                if (inputWords.Contains(word))
+                    return true;
+            }
+
+            if (includenT)
+            {
+                foreach (var word in inputWords)
+                {
+                    if (word.Contains(@"n't"))
+                        return true;
+                }
+            }
+
+            if (inputWords.Contains("least"))
+            {
+                int i = inputWords.IndexOf("least");
+                if (i > 0 && inputWords[i - 1] != "at")
+                    return true;
+            }
+
+            return false;
+        }
+
+        /// <summary>
+        /// Normalizes score to be between -1 and 1
+        /// </summary>
+        /// <param name="score"></param>
+        /// <param name="alpha"></param>
+        /// <returns></returns>
+        private static double Normalize(double score, double alpha = 15)
+        {
+            double normScore = score / Math.Sqrt(score * score + alpha);
+
+            if (normScore < -1.0)
+                return -1.0;
+
+            if (normScore > 1.0)
+                return 1.0;
+
+            return normScore;
+        }
+
+        /// <summary>
+        /// Checks whether some but not all of words in input are ALL CAPS
+        /// </summary>
+        /// <param name="words"></param>
+        /// <returns></returns>
+        private static bool AllCapDifferential(IList<string> words)
+        {
+            int allCapWords = 0;
+
+            foreach (var word in words)
+            {
+                if (IsUpper(word))
+                    allCapWords++;
+            }
+
+            int capDifferential = words.Count - allCapWords;
+            if (capDifferential > 0 && capDifferential < words.Count)
+                return true;
+
+            return false;
+        }
+
+        /// <summary>
+        /// Check if preceding words increase, decrease or negate the valence
+        /// </summary>
+        /// <param name="word"></param>
+        /// <param name="valence"></param>
+        /// <param name="isCapDiff"></param>
+        /// <returns></returns>
+        private static double ScalarIncDec(string word, double valence, bool isCapDiff)
+        {
+            string wordLower = word.ToLower();
+            if (!BoosterDict.ContainsKey(wordLower))
+                return 0.0;
+
+            double scalar = BoosterDict[word];
+            if (valence < 0)
+                scalar *= -1;
+
+            if (IsUpper(word) && isCapDiff)
+            {
+                scalar += (valence > 0) ? CIncr :  -CIncr;
+            }
+
+            return scalar;
+        }
+
+        #endregion
+

     }
 }


Fixed most of the bugs

Fixed most of the bugs

--- Voyagers.Utilities.ObjectComparer/ObjectComparer.cs
+++ Voyagers.Utilities.ObjectComparer/ObjectComparer.cs
@@ -145,9 +145,17 @@
                 yield break;
             }

+            /*** TEST CODE ***/
+            parentVariance = new ObjectVariance(propertyName, object1, object2, parentVariance);
+            /*** TEST CODE ***/
             foreach (
                 ObjectVariance objectVariance in GetVariancesFromProperties(object1, object2, parentVariance))
             {
+                //yield return
+                //    new ObjectVariance(propertyName,
+                //                       objectVariance.PropertyValue1,
+                //                       objectVariance.PropertyValue2,
+                //                       objectVariance.ParentVariance);
                 yield return objectVariance;
             }
         }
@@ -281,13 +289,13 @@
                 {
                     // Tried return GetObjectVariances(propertyInfo1Enumerator.Current, propertyInfo2Enumerator.Current,
                     // ++level, object1, object2). Does not work
-                    var testParentVariance = new ObjectVariance(parentVariance != null ? parentVariance.PropertyName : null,
-                                                                object1,
-                                                                object2,
-                                                                parentVariance);
+                    //var testParentVariance = new ObjectVariance(parentVariance != null ? parentVariance.PropertyName : null,
+                    //                                            object1,
+                    //                                            object2,
+                    //                                            parentVariance);
                     foreach (ObjectVariance diff in GetObjectVariances(propertyInfo1Enumerator.Current,
                                                                        propertyInfo2Enumerator.Current,
-                                                                       testParentVariance))
+                                                                       parentVariance))
                     {
                         yield return diff;
                     }


feat: animation can disable auto origin correct

--- Raccoon/Graphics/Drawables/Animation.cs
+++ Raccoon/Graphics/Drawables/Animation.cs
@@ -61,6 +61,12 @@
         #region Public Properties

         public bool IsPlaying { get; private set; }
+
+        /// <summary>
+        /// Should Animation handle frame's destination positioning.
+        /// </summary>
+        public bool AutoHandleFramePositioning { get; set; } = true;
+
         public KeyType CurrentKey { get; private set; }
         public Track CurrentTrack { get; private set; }
         public int ElapsedTime { get; set; }
@@ -516,6 +522,64 @@
             if (CurrentTrack != null) {
                 UpdateClippingRegion();
             }
+        }
+
+        public void CalculateCurrentFrameOrigin(ImageFlip flip, ref Vector2 origin) {
+            if (CurrentTrack == null || CurrentTrack.Frames.Length <= 0) {
+                return;
+            }
+
+            // frame destination works like a guide to where render at local space
+            // 'frameDestination.position' should be interpreted as 'origin'
+            ref Track.Frame frame = ref CurrentTrack.CurrentFrame;
+
+            if (!frame.FrameDestination.HasValue || frame.FrameDestination.Value.Position == Vector2.Zero) {
+                return;
+            }
+
+            // frame region defines the crop rectangle at it's texture
+            //ref Rectangle frameRegion = ref CurrentTrack.CurrentFrameRegion;
+
+            if (flip.IsHorizontal()) {
+                if (flip.IsVertical()) {
+                    float rightSideSpacing = frame.FrameDestination.Value.Width - frame.FrameRegion.Width + frame.FrameDestination.Value.X,
+                          bottomSideSpacing = frame.FrameDestination.Value.Height - frame.FrameRegion.Height + frame.FrameDestination.Value.Y;
+
+                    origin = new Vector2(
+                        (frame.FrameRegion.Width - origin.X) - rightSideSpacing,
+                        (frame.FrameRegion.Height - origin.Y) - bottomSideSpacing
+                    );
+                } else {
+                    float rightSideSpacing = frame.FrameDestination.Value.Width - frame.FrameRegion.Width + frame.FrameDestination.Value.X;
+
+                    origin = new Vector2(
+                        (frame.FrameRegion.Width - origin.X) - rightSideSpacing,
+                        origin.Y + frame.FrameDestination.Value.Y
+                    );
+                }
+            } else if (flip.IsVertical()) {
+                float bottomSideSpacing = frame.FrameDestination.Value.Height - frame.FrameRegion.Height + frame.FrameDestination.Value.Y;
+
+                origin = new Vector2(
+                    origin.X + frame.FrameDestination.Value.X,
+                    (frame.FrameRegion.Height - origin.Y) - bottomSideSpacing
+                );
+            } else {
+                origin += frame.FrameDestination.Value.Position;
+            }
+
+            // maybe we should make a careful check before modifying DestinationRegion here
+            // user could modify value globally to Animation and we'll be interfering
+            // making a change frame based here
+
+            /*
+            // there we give the power to frame regions deform animations
+            // I don't know if it will be usefull anywhere, but we can do this
+            ref Rectangle frameRegion = ref CurrentTrack.CurrentFrameRegion;
+            if (frameDestination.Size != frameRegion.Size) {
+                DestinationRegion = new Rectangle(frameDestination.Size);
+            }
+            */
         }

         public override void Dispose() {
@@ -578,7 +642,9 @@
             Vector2 origin,
             float layerDepth
         ) {
-            CalculateFrameOrigin(flip, ref origin);
+            if (AutoHandleFramePositioning) {
+                CalculateCurrentFrameOrigin(flip, ref origin);
+            }

             base.Draw(
                 position,
@@ -601,64 +667,6 @@
             return key;
         }

-        protected void CalculateFrameOrigin(ImageFlip flip, ref Vector2 origin) {
-            if (CurrentTrack == null || CurrentTrack.Frames.Length <= 0) {
-                return;
-            }
-
-            // frame destination works like a guide to where render at local space
-            // 'frameDestination.position' should be interpreted as 'origin'
-            ref Track.Frame frame = ref CurrentTrack.CurrentFrame;
-
-            if (!frame.FrameDestination.HasValue || frame.FrameDestination.Value.Position == Vector2.Zero) {
-                return;
-            }
-
-            // frame region defines the crop rectangle at it's texture
-            //ref Rectangle frameRegion = ref CurrentTrack.CurrentFrameRegion;
-
-            if (flip.IsHorizontal()) {
-                if (flip.IsVertical()) {
-                    float rightSideSpacing = frame.FrameDestination.Value.Width - frame.FrameRegion.Width + frame.FrameDestination.Value.X,
-                          bottomSideSpacing = frame.FrameDestination.Value.Height - frame.FrameRegion.Height + frame.FrameDestination.Value.Y;
-
-                    origin = new Vector2(
-                        (frame.FrameRegion.Width - origin.X) - rightSideSpacing,
-                        (frame.FrameRegion.Height - origin.Y) - bottomSideSpacing
-                    );
-                } else {
-                    float rightSideSpacing = frame.FrameDestination.Value.Width - frame.FrameRegion.Width + frame.FrameDestination.Value.X;
-
-                    origin = new Vector2(
-                        (frame.FrameRegion.Width - origin.X) - rightSideSpacing,
-                        origin.Y + frame.FrameDestination.Value.Y
-                    );
-                }
-            } else if (flip.IsVertical()) {
-                float bottomSideSpacing = frame.FrameDestination.Value.Height - frame.FrameRegion.Height + frame.FrameDestination.Value.Y;
-
-                origin = new Vector2(
-                    origin.X + frame.FrameDestination.Value.X,
-                    (frame.FrameRegion.Height - origin.Y) - bottomSideSpacing
-                );
-            } else {
-                origin += frame.FrameDestination.Value.Position;
-            }
-
-            // maybe we should make a careful check before modifying DestinationRegion here
-            // user could modify value globally to Animation and we'll be interfering
-            // making a change frame based here
-
-            /*
-            // there we give the power to frame regions deform animations
-            // I don't know if it will be usefull anywhere, but we can do this
-            ref Rectangle frameRegion = ref CurrentTrack.CurrentFrameRegion;
-            if (frameDestination.Size != frameRegion.Size) {
-                DestinationRegion = new Rectangle(frameDestination.Size);
-            }
-            */
-        }
-
         #endregion Protected Methods

         #region Private Methods


2.1.2 for fixes

2.1.2 for fixes

--- Resources/SolutionAssemblyInfo.cs
+++ Resources/SolutionAssemblyInfo.cs
@@ -2,7 +2,7 @@
 using System.Runtime.CompilerServices;

 // This is the real version number, used in NuGet packages and for display purposes.
-[assembly: AssemblyFileVersion("2.1.1")]
+[assembly: AssemblyFileVersion("2.1.2")]

 // Only use major version here, with others kept at zero, for correct assembly binding logic.
 [assembly: AssemblyVersion("2.0.0")]


Limit BinaryMessage to displaying the first 128 bytes

--- GTBase/Net/Messages.cs
+++ GTBase/Net/Messages.cs
@@ -79,7 +79,7 @@
             result.Append(": ");
             result.Append(bytes.LongLength);
             result.Append(" bytes");
-            for (int i = 0; i < bytes.Length; i += 16)
+            for (int i = 0; i < Math.Min(bytes.Length, 128); i += 16)
             {
                 result.Append("\n  ");
                 result.Append(i.ToString("X3"));
@@ -87,6 +87,7 @@
                 result.Append(ByteUtils.DumpBytes(bytes, i, 16));
                 result.Append(ByteUtils.AsPrintable(bytes, i, 16));
             }
+            if (bytes.Length > 128) { result.Append("\n..."); }
             return result.ToString();
         }
     }


Option to include only SLA items

Option to include only SLA items

--- GeckoboardConnector.cs
+++ GeckoboardConnector.cs
@@ -24,7 +24,7 @@
     {
         public void RegisterRoutes(RouteCollection routes)
         {
-            routes.MapHttpRoute(null, "api/wallboard/{cardId}/{boardoption}/{limit}/{restrictTo}", new { controller = "Geckoboard", action = "Get", limit = RouteParameter.Optional, restrictTo = RouteParameter.Optional }, new { httpMethod = new HttpMethodConstraint(new string[] { "GET" }) });
+            routes.MapHttpRoute(null, "api/wallboard/{cardId}/{boardoption}/{limit}/{restrictTo}/{onlySlaItems}", new { controller = "Geckoboard", action = "Get", limit = RouteParameter.Optional, restrictTo = RouteParameter.Optional, onlySlaItems = RouteParameter.Optional }, new { httpMethod = new HttpMethodConstraint(new string[] { "GET" }) });
         }
     }

@@ -32,12 +32,14 @@
     public class GeckoboardController : BaseApiController
     {
         [System.Web.Mvc.HttpGet]
-        public object Get(int cardId, string boardOption, int limit = 0, string restrictTo = "")
+        public object Get(int cardId, string boardOption, int limit = 0, string restrictTo = "", int onlySlaItems = 0)
         {
             object result = string.Empty;

             string username = string.Empty;
-
+
+            bool onlyIncludeSlaItems = onlySlaItems == 1 ? true : false;
+
             if (Request.Headers.Authorization != null && Request.Headers.Authorization.Parameter != null)
             {
                 username = Encoding.Default.GetString(Convert.FromBase64String(Request.Headers.Authorization.Parameter));
@@ -473,11 +475,13 @@
                     result = getSlaCount(boardOption, filter, restrictTo);
                     break;
                 case "average-sla-response":
-                case "average-sla-closing":
+                case "average-sla-closing":
+                    filter.OnlySLAItems = onlyIncludeSlaItems;
                     result = getSlaTime(boardOption, filter, restrictTo);
                     break;
                 case "average-sla-response-total":
                 case "average-sla-closing-total":
+                    filter.OnlySLAItems = onlyIncludeSlaItems;
                     result = getSlaTimeTotal(boardOption, filter, restrictTo);
                     break;
                 case "sla-status-breakdown-list":


[UNG_801] Nesting Roc

[UNG_801] Nesting Roc

--- SabberStoneCore/CardSets/Standard/UngoroCardsGen.cs
+++ SabberStoneCore/CardSets/Standard/UngoroCardsGen.cs
@@ -3319,11 +3319,12 @@
             // --------------------------------------------------------
             cards.Add("UNG_801", new List<Enchantment>
             {
-                // TODO [UNG_801] Nesting Roc && Test: Nesting Roc_UNG_801
-                new Enchantment
-                {
-                    Activation = EnchantmentActivation.BATTLECRY,
-                    SingleTask = null,
+                new Enchantment
+                {
+                    Activation = EnchantmentActivation.BATTLECRY,
+                    SingleTask = ComplexTask.Create(
+                        new ConditionTask(EntityType.SOURCE, SelfCondition.IsBoardCount(3, RelaSign.GEQ)),
+                        new FlagTask(true, ComplexTask.Taunt(EntityType.SOURCE)))
                 },
             });


Add comment

Add comment

--- WalletWasabi/Services/Terminate/TerminateService.cs
+++ WalletWasabi/Services/Terminate/TerminateService.cs
@@ -27,10 +27,14 @@

 			if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Debugger.IsAttached)
 			{
+				// If the debugger is attached and you subscribe to SystemEvents, then on quit Wasabi gracefully stops but never returns from console.
 				Logger.LogInfo($"{nameof(TerminateService)} subscribed to SystemEvents");
 				SystemEvents.SessionEnding += Windows_SystemEvents_SessionEnding;
+				IsSystemEventsSubscribed = true;
 			}
 		}
+
+		private bool IsSystemEventsSubscribed { get; }

 		public bool IsTerminateRequested => Interlocked.Read(ref _terminateStatus) > TerminateStatusNotStarted;

@@ -117,7 +121,7 @@
 			AssemblyLoadContext.Default.Unloading -= Default_Unloading;
 			AppDomain.CurrentDomain.DomainUnload -= CurrentDomain_DomainUnload;

-			if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Debugger.IsAttached)
+			if (IsSystemEventsSubscribed)
 			{
 				SystemEvents.SessionEnding -= Windows_SystemEvents_SessionEnding;
 			}


Adding tests

Adding tests

--- ShareLink.Tests/Services/TestShareDataRepository.cs
+++ ShareLink.Tests/Services/TestShareDataRepository.cs
@@ -40,7 +40,7 @@
                 () => repository.ShareDataObservable, 0, 10, 100
                 );

-            IList<Recorded<Notification<ShareData>>> expected = new List<Recorded<Notification<ShareData>>>();
+            var expected = new List<Recorded<Notification<ShareData>>>();

             ReactiveAssert.AreElementsEqual(expected, actual.Messages);
         }
@@ -51,7 +51,7 @@
             var scheduler = new TestScheduler();
             var shareData = new ShareData();
             A.CallTo(() => _cacheService.GetDataAsync<ICollection<ShareData>>(A<string>.Ignored, A<CancellationToken>.Ignored))
-                .Returns(Task.FromResult<ICollection<ShareData>>(new Collection<ShareData>(){shareData}));
+                .Returns(Task.FromResult<ICollection<ShareData>>(new Collection<ShareData>{shareData}));
             var repository = CreateService();

             var actual = scheduler.Start(
@@ -71,7 +71,7 @@
             var shareData2 = new ShareData();
             var shareData3 = new ShareData();
             A.CallTo(() => _cacheService.GetDataAsync<ICollection<ShareData>>(A<string>.Ignored, A<CancellationToken>.Ignored))
-                .Returns(Task.FromResult<ICollection<ShareData>>(new Collection<ShareData>() { shareData1, shareData2, shareData3 }));
+                .Returns(Task.FromResult<ICollection<ShareData>>(new Collection<ShareData> { shareData1, shareData2, shareData3 }));
             var repository = CreateService();

             var actual = scheduler.Start(
@@ -87,5 +87,57 @@

             ReactiveAssert.AreElementsEqual(expected, actual.Messages);
         }
+
+        [TestMethod]
+        public void MultipleSubscriptionsRetriggerSharedData()
+        {
+            var scheduler = new TestScheduler();
+            var shareData1 = new ShareData();
+            var shareData2 = new ShareData();
+            var shareData3 = new ShareData();
+            A.CallTo(() => _cacheService.GetDataAsync<ICollection<ShareData>>(A<string>.Ignored, A<CancellationToken>.Ignored))
+                .Returns(Task.FromResult<ICollection<ShareData>>(new Collection<ShareData> { shareData1, shareData2, shareData3 }));
+            var repository = CreateService();
+
+            scheduler.Start(
+                () => repository.ShareDataObservable, 0, 10, 1000
+                );
+            var actual2 = scheduler.Start(
+                () => repository.ShareDataObservable, 1000, 1010, 2000
+                );
+
+            var expected = new[]
+            {
+                OnNext(1010, shareData1),
+                OnNext(1010, shareData2),
+                OnNext(1010, shareData3)
+            };
+
+            ReactiveAssert.AreElementsEqual(expected, actual2.Messages);
+        }
+
+        [TestMethod]
+        public void AddingNewDataUpdatesStream()
+        {
+            var scheduler = new TestScheduler();
+            var shareData1 = new ShareData();
+            var shareData2 = new ShareData();
+            A.CallTo(() => _cacheService.GetDataAsync<ICollection<ShareData>>(A<string>.Ignored, A<CancellationToken>.Ignored))
+                .Returns(Task.FromResult<ICollection<ShareData>>(new Collection<ShareData> { shareData1}));
+            var repository = CreateService();
+
+            repository.Add(shareData2);
+            var actual = scheduler.Start(
+                () => repository.ShareDataObservable, 0, 10, 1000
+                );
+
+            var expected = new[]
+            {
+                OnNext(10, shareData1),
+                OnNext(10, shareData2)
+            };
+
+            ReactiveAssert.AreElementsEqual(expected, actual.Messages);
+        }
     }
 }


DE2150: Set event room id if not sent from frontend

--- SignInCheckIn/SignInCheckIn/Services/RoomService.cs
+++ SignInCheckIn/SignInCheckIn/Services/RoomService.cs
@@ -195,6 +195,12 @@
                 eventRoom.EventId = eventId;
                 eventRoom.RoomId = roomId;
             }
+            else
+            {
+                // This is needed in case the frontend does not send the EventRoomId (for instance, when multiple
+                // updates are made on the page, but the frontend does not update its model with the new event room id)
+                eventRoom.EventRoomId = existingEventRoom.EventRoomId;
+            }

             // Create nursery event groups
             CreateEventGroups(authenticationToken,


Remove crap

Remove crap

--- src/ExampleWorker/SimpleEventHubSpammer.cs
+++ src/ExampleWorker/SimpleEventHubSpammer.cs
@@ -58,15 +58,6 @@
             return memoryStream.ToArray();
         }

-        public static LogEntry FromByteArray(byte[] entry)
-        {
-            var memoryStream = new MemoryStream(entry);
-            var binaryFormatter = new BinaryFormatter();
-
-            return binaryFormatter.Deserialize(memoryStream) as LogEntry;
-        }
-
-
         public static LogEntry FromStream(Stream stream)
         {
             var binaryFormatter = new BinaryFormatter();


fixes union all

fixes union all

--- Signum.Engine/Linq/ExpressionVisitor/QueryBinder.cs
+++ Signum.Engine/Linq/ExpressionVisitor/QueryBinder.cs
@@ -764,32 +764,37 @@

         private Expression GetOrderExpression(LambdaExpression lambda, ProjectionExpression projection)
         {
-            var expr = MapVisitExpand(lambda, projection);
-
-            if (expr is LiteReferenceExpression)
-            {
-                LiteReferenceExpression lite = (LiteReferenceExpression)expr;
-                expr = lite.Reference is ImplementedByAllExpression ? ((ImplementedByAllExpression)lite.Reference).Id :
-                      BindMethodCall(Expression.Call(lite.Reference, EntityExpression.ToStringMethod));
-            }
-            else if (expr is EntityExpression || expr is ImplementedByExpression)
-            {
-                expr = BindMethodCall(Expression.Call(expr, EntityExpression.ToStringMethod));
-            }
-            else if (expr is ImplementedByAllExpression)
-            {
-                expr = ((ImplementedByAllExpression)expr).Id;
-            }
-            else if (expr is MethodCallExpression && ReflectionTools.MethodEqual(((MethodCallExpression)expr).Method, miToUserInterface))
-            {
-                expr = ((MethodCallExpression)expr).Arguments[0];
-            }
-            else if (expr.Type == typeof(Type))
-            {
-                expr = ExtractTypeId(expr);
-            }
-
-            return DbExpressionNominator.FullNominate(expr);
+            using (SetCurrentSource(projection.Select))
+            {
+                map.Add(lambda.Parameters[0], projection.Projector);
+                Expression expr = Visit(lambda.Body);
+                map.Remove(lambda.Parameters[0]);
+
+                if (expr is LiteReferenceExpression)
+                {
+                    LiteReferenceExpression lite = (LiteReferenceExpression)expr;
+                    expr = lite.Reference is ImplementedByAllExpression ? ((ImplementedByAllExpression)lite.Reference).Id :
+                          BindMethodCall(Expression.Call(lite.Reference, EntityExpression.ToStringMethod));
+                }
+                else if (expr is EntityExpression || expr is ImplementedByExpression)
+                {
+                    expr = BindMethodCall(Expression.Call(expr, EntityExpression.ToStringMethod));
+                }
+                else if (expr is ImplementedByAllExpression)
+                {
+                    expr = ((ImplementedByAllExpression)expr).Id;
+                }
+                else if (expr is MethodCallExpression && ReflectionTools.MethodEqual(((MethodCallExpression)expr).Method, miToUserInterface))
+                {
+                    expr = ((MethodCallExpression)expr).Arguments[0];
+                }
+                else if (expr.Type == typeof(Type))
+                {
+                    expr = ExtractTypeId(expr);
+                }
+
+                return DbExpressionNominator.FullNominate(expr);
+            }
         }

         static MethodInfo miToUserInterface = ReflectionTools.GetMethodInfo(() => DateTime.MinValue.ToUserInterface());
@@ -2069,7 +2074,7 @@
             {
                 var knownAliases = KnownAliases(s);

-                return external.All(knownAliases.Contains);
+                return external.Intersect(knownAliases).Any();
             });
         }


Convention construction no longer injects RunContext.

--- src/Fixie/Internal/ConventionDiscoverer.cs
+++ src/Fixie/Internal/ConventionDiscoverer.cs
@@ -24,7 +24,7 @@

             var customConventions =
                 conventionTypes
-                    .Select(t => Construct<Convention>(t, runContext))
+                    .Select(Construct<Convention>)
                     .ToArray();

             if (customConventions.Any())
@@ -44,7 +44,7 @@
         Type[] ExplicitlyAppliedConventionTypes(Type[] testAssemblyTypes)
         {
             return testAssemblyTypes
-                .Select(t => Construct<TestAssembly>(t, runContext))
+                .Select(Construct<TestAssembly>)
                 .SelectMany(x => x.ConventionTypes)
                 .ToArray();
         }
@@ -57,17 +57,12 @@
                 .ToArray();
         }

-        static T Construct<T>(Type type, RunContext runContext)
+        static T Construct<T>(Type type)
         {
             var constructor = GetConstructor(type);

             try
             {
-                var parameters = constructor.GetParameters();
-
-                if (parameters.Length == 1 && parameters.Single().ParameterType == typeof(RunContext))
-                    return (T)constructor.Invoke(new object[] { runContext });
-
                 return (T)constructor.Invoke(null);
             }
             catch (Exception ex)


Fix god/ungod failing on SkillAdvancementClass (#2905)

--- Source/ACE.Server/Command/Handlers/AdminCommands.cs
+++ Source/ACE.Server/Command/Handlers/AdminCommands.cs
@@ -1804,7 +1804,7 @@
                     {
                         returnState += $"{(int)kvp.Key}=";
                         returnState += $"{sk.LevelFromPP}=";
-                        returnState += $"{sk.SAC}=";
+                        returnState += $"{(uint)sk.SAC}=";
                         returnState += $"{sk.PP}=";
                         returnState += $"{sk.InitLevel}=";
                     }
@@ -1944,7 +1944,18 @@
                             case int n when (n <= 238):
                                 var playerSkill = currentPlayer.Skills[(Skill)int.Parse(returnStringArr[i])];
                                 playerSkill.Ranks = ushort.Parse(returnStringArr[i + 1]);
-                                playerSkill.AdvancementClass = (SkillAdvancementClass)uint.Parse(returnStringArr[i + 2]);
+
+                                // Handle god users stuck in god mode due to bad godstate with Enum string
+                                SkillAdvancementClass advancement;
+                                if (Enum.TryParse(returnStringArr[i + 2], out advancement))
+                                {
+                                    playerSkill.AdvancementClass = advancement;
+                                }
+                                else
+                                {
+                                    playerSkill.AdvancementClass = (SkillAdvancementClass)uint.Parse(returnStringArr[i + 2]);
+                                }
+
                                 playerSkill.ExperienceSpent = uint.Parse(returnStringArr[i + 3]);
                                 playerSkill.InitLevel = uint.Parse(returnStringArr[i + 4]);
                                 currentPlayer.Session.Network.EnqueueSend(new GameMessagePrivateUpdateSkill(currentPlayer, playerSkill));


Ignore FileNotFoundException and DirectoryNotFoundException in DeleteFileAsync method of FolderFileStorage

--- src/Foundatio/Storage/FolderFileStorage.cs
+++ src/Foundatio/Storage/FolderFileStorage.cs
@@ -161,7 +161,7 @@

                     File.Copy(Path.Combine(Folder, path), Path.Combine(Folder, targetpath));
                 }
-            } catch (Exception ex) when(!(ex is FileNotFoundException || ex is DirectoryNotFoundException)) {
+            } catch (Exception ex) {
                 _logger.LogError(ex, "Error trying to copy file {Path} to {TargetPath}.", path, targetpath);
                 return Task.FromResult(false);
             }
@@ -177,7 +177,7 @@

             try {
                 File.Delete(Path.Combine(Folder, path));
-            } catch (Exception ex) {
+            } catch (Exception ex) when (ex is FileNotFoundException || ex is DirectoryNotFoundException) {
                 _logger.LogError(ex, "Error trying to delete file: {Path}.", path);
                 return Task.FromResult(false);
             }


log player levels when swearing allegiance (#3898)

--- Source/ACE.Server/WorldObjects/Player_Allegiance.cs
+++ Source/ACE.Server/WorldObjects/Player_Allegiance.cs
@@ -94,7 +94,7 @@
                 return;
             }

-            log.Debug($"[ALLEGIANCE] {Name} swearing allegiance to {patron.Name}");
+            log.Debug($"[ALLEGIANCE] {Name} ({Level}) swearing allegiance to {patron.Name} ({patron.Level})");

             PatronId = targetGuid;


updating multi-projectile spells to be closer to original spellcasting code / match spell descriptions (#2613)

* updating multi-projectile spells to be closer to original spellcasting code / match spell descriptions

* revision

--- Source/ACE.Server/WorldObjects/WorldObject_Magic.cs
+++ Source/ACE.Server/WorldObjects/WorldObject_Magic.cs
@@ -1295,8 +1295,10 @@

             var spellProjectiles = new List<SpellProjectile>();

-            foreach (var origin in origins)
-            {
+            for (var i = 0; i < origins.Count; i++)
+            {
+                var origin = origins[i];
+
                 var sp = WorldObjectFactory.CreateNewWorldObject(spell.Wcid) as SpellProjectile;

                 if (sp == null)
@@ -1322,7 +1324,10 @@

                 sp.ProjectileSource = this;
                 sp.Caster = caster;
-                sp.ProjectileTarget = target;
+
+                // side projectiles always untargeted?
+                if (i == 0)
+                    sp.ProjectileTarget = target;

                 sp.SetProjectilePhysicsState(target, useGravity);
                 sp.SpawnPos = new Position(sp.Location);


use EnsurePropertyAvailable return value

--- HarshPoint/HarshUrl.cs
+++ HarshPoint/HarshUrl.cs
@@ -45,8 +45,10 @@
                 throw Error.ArgumentNull(nameof(web));
             }

-            await web.EnsurePropertyAvailable(w => w.ServerRelativeUrl);
-            return EnsureUrlServerRelative(web.ServerRelativeUrl, url);
+            var webServerRelativeUrl =
+                await web.EnsurePropertyAvailable(w => w.ServerRelativeUrl);
+
+            return EnsureUrlServerRelative(webServerRelativeUrl, url);
         }

         public static String GetLeaf(String url)


included JsonIgnore in GeocodeResponse status

--- src/GeocodeSharp/Google/GeocodeResponse.cs
+++ src/GeocodeSharp/Google/GeocodeResponse.cs
@@ -7,6 +7,7 @@
         [JsonProperty("results")]
         public GeocodeResult[] Results { get; set; }

+        [JsonIgnore]
         public GeocodeStatus Status
         {
             get


Changed order of disposing objects

Changed order of disposing objects

--- Source/ChromeCast.Desktop.AudioStreamer/MainForm.cs
+++ Source/ChromeCast.Desktop.AudioStreamer/MainForm.cs
@@ -1043,11 +1043,10 @@
                 {
                     components.Dispose();
                 }
-
-                loopbackRecorder?.Dispose();
-                wavGenerator?.Dispose();
             }
             base.Dispose(disposing);
+            loopbackRecorder?.Dispose();
+            wavGenerator?.Dispose();
         }
     }
 }


Update Startup.cs for simple dependency injection through IoC container

--- src/GraphApiAppOnlyWebApiSample/Startup.cs
+++ src/GraphApiAppOnlyWebApiSample/Startup.cs
@@ -1,4 +1,6 @@
-using Microsoft.AspNet.Builder;
+using GraphApiAppOnlyWebApiSample.Models;
+
+using Microsoft.AspNet.Builder;
 using Microsoft.AspNet.Hosting;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
@@ -25,6 +27,9 @@
         {
             // Add framework services.
             services.AddMvc();
+
+            // Add app settings.
+            services.Configure<GraphApp>(this.Configuration.GetSection("GraphApp"));
         }

         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.


fixes #1047 (#1341)

fixes #1047 (#1341)

--- src/GraphQL/Execution/ExecutionStrategy.cs
+++ src/GraphQL/Execution/ExecutionStrategy.cs
@@ -318,7 +318,7 @@

             if (objectType?.IsTypeOf != null && !objectType.IsTypeOf(result))
             {
-                throw new ExecutionError($"Expected value of type \"{objectType}\" for \"{objectType.Name}\" but got: {result}.");
+                throw new ExecutionError($"\"{result}\" value of type \"{result.GetType()}\" is not allowed for \"{objectType.Name}\". Either change IsTypeOf method of \"{objectType.Name}\" to accept this value or return another value from your resolver.");
             }
         }


Update Provider.cs

Update Provider.cs

--- src/Hprose.RPC/Plugins/Reverse/Provider.cs
+++ src/Hprose.RPC/Plugins/Reverse/Provider.cs
@@ -8,12 +8,11 @@
 |                                                          |
 |  Provider class for C#.                                  |
 |                                                          |
-|  LastModified: Feb 2, 2019                               |
+|  LastModified: Feb 4, 2019                               |
 |  Author: Ma Bingyao <andot@hprose.com>                   |
 |                                                          |
 \*________________________________________________________*/

-using Hprose.IO;
 using System;
 using System.Collections.Generic;
 using System.Reflection;
@@ -123,6 +122,14 @@
                 }
             }
         }
+        public Provider Use(params InvokeHandler[] handlers) {
+            invokeManager.Use(handlers);
+            return this;
+        }
+        public Provider Unuse(params InvokeHandler[] handlers) {
+            invokeManager.Unuse(handlers);
+            return this;
+        }
         public Method Get(string fullname, int paramCount) {
             return methodManager.Get(fullname, paramCount);
         }


Update comments

Update comments

Update comments

--- src/HtmlAgilityPack.Shared/HtmlDocument.cs
+++ src/HtmlAgilityPack.Shared/HtmlDocument.cs
@@ -124,7 +124,7 @@
         public bool OptionFixNestedTags; // fix li, tr, th, td tags

         /// <summary>
-        /// Defines if output must conform to XML, instead of HTML.
+        /// Defines if output must conform to XML, instead of HTML. Default is false.
         /// </summary>
         public bool OptionOutputAsXml;

@@ -139,7 +139,7 @@
         public bool OptionOutputOptimizeAttributeValues;

         /// <summary>
-        /// Defines if name must be output with it's original case. Useful for asp.net tags and attributes
+        /// Defines if name must be output with it's original case. Useful for asp.net tags and attributes. Default is false.
         /// </summary>
         public bool OptionOutputOriginalCase;


DB set facility rating added

DB set facility rating added

--- Source/Data/SportsBook.Data/ApplicationDbContext.cs
+++ Source/Data/SportsBook.Data/ApplicationDbContext.cs
@@ -29,6 +29,8 @@
         public virtual IDbSet<FacilityComment> FacilityComments { get; set; }

         public virtual IDbSet<EventComment> EventComments { get; set; }
+
+        public virtual IDbSet<FacilityRating> FacilityRating { get; set; }

         public static SportsBookDbContext Create()
         {


Remove all redundant this.

Remove all redundant this.

--- Source/HelixToolkit.Wpf.SharpDX/Controls/Effects.cs
+++ Source/HelixToolkit.Wpf.SharpDX/Controls/Effects.cs
@@ -120,7 +120,7 @@
         /// </summary>
         ~EffectsManager()
         {
-            this.Dispose();
+            Dispose();
         }

         /// <summary>
@@ -330,7 +330,7 @@
             try
             {
                 var shaderBytes = Techniques.TechniquesSourceDict[techniques[0]];
-                this.RegisterEffect(shaderBytes, techniques);
+                RegisterEffect(shaderBytes, techniques);
             }
             catch (Exception ex)
             {
@@ -451,10 +451,10 @@
                     Disposer.RemoveAndDispose(ref o);
                 }
             }
-            this.data = null;
-
-            Disposer.RemoveAndDispose(ref this.device);
-            this.device = null;
+            data = null;
+
+            Disposer.RemoveAndDispose(ref device);
+            device = null;
         }

         /// <summary>
@@ -483,13 +483,13 @@
             {
                 get
                 {
-                    return this.stream;
+                    return stream;
                 }
                 set
                 {
-                    if (this.stream != null)
-                        this.stream.Dispose();
-                    this.stream = value as Stream;
+                    if (stream != null)
+                        stream.Dispose();
+                    stream = value as Stream;
                 }
             }


Improved predicate parsing.

Improved predicate parsing.

--- Source/Linq/Builder/ExpressionBuilder.SqlBuilder.cs
+++ Source/Linq/Builder/ExpressionBuilder.SqlBuilder.cs
@@ -872,7 +872,8 @@

 			if (expression.Type == typeof(bool) && _convertedPredicates.Add(expression))
 			{
-				var predicate = ConvertPredicate(context, expression);
+				var predicate = ConvertPredicate(context, expression);
+				_convertedPredicates.Remove(expression);
 				if (predicate != null)
 					return new SqlQuery.SearchCondition(new SqlQuery.Condition(false, predicate));
 			}


Lucene.Net.Support.StringExtensions: Added a TrimEnd() method that can be used on string arrays. This is to mimic Java's Split() method that removes only the null or empty elements from the end of the array that is returned, but leaves any prior empty elements intact.

--- src/Lucene.Net/Support/StringExtensions.cs
+++ src/Lucene.Net/Support/StringExtensions.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Util;
 using System;
+using System.Collections.Generic;
 using System.Text;

 namespace Lucene.Net.Support
@@ -136,5 +137,34 @@
             // codePoint is negative or not found in string
             return -1;
         }
+
+        // LUCENENET TODO: BUG Replace all calls to .Split("", StringSplitOptions.RemoveEmptyEntries)
+        // and Regex.Split("") with .Split("").TrimEnd() and Regex.Split("").TrimEnd() to match the
+        // behavior of Java's Split() method.
+
+        /// <summary>
+        /// Removes null or empty elements from the end of a string array.
+        /// </summary>
+        /// <param name="input">This string array.</param>
+        /// <returns>The array with any null or empty elements removed from the end.</returns>
+        public static string[] TrimEnd(this string[] input)
+        {
+            if (input == null)
+                return null;
+            int lastElement;
+            for (lastElement = input.Length - 1; lastElement >= 0; lastElement--)
+            {
+                if (!string.IsNullOrEmpty(input[lastElement]))
+                    break;
+            }
+            if (lastElement > 0 && lastElement < input.Length)
+            {
+                int end = lastElement + 1;
+                string[] result = new string[end];
+                Array.Copy(input, result, end);
+                return result;
+            }
+            return input;
+        }
     }
 }


#209: improve text measurements and alignment for iOS

--- Source/OxyPlot.XamarinIOS/MonoTouchRenderContext.cs
+++ Source/OxyPlot.XamarinIOS/MonoTouchRenderContext.cs
@@ -292,7 +292,7 @@
         /// <param name="maxSize">The maximum size of the text.</param>
         public override void DrawText(ScreenPoint p, string text, OxyColor fill, string fontFamily, double fontSize, double fontWeight, double rotate, HorizontalAlignment halign, VerticalAlignment valign, OxySize? maxSize)
         {
-            if (string.IsNullOrEmpty(text) || fontFamily == null)
+            if (string.IsNullOrEmpty(text))
             {
                 return;
             }
@@ -306,11 +306,17 @@
                 {
                     float width;
                     float height;
+
+                    this.gctx.TextPosition = new PointF(0, 0);
+
+                    float lineHeight, delta;
+                    this.GetFontMetrics(font, out lineHeight, out delta);
+                    var bounds = textLine.GetImageBounds(this.gctx);
+
                     if (maxSize.HasValue || halign != HorizontalAlignment.Left || valign != VerticalAlignment.Bottom)
                     {
-                        var bounds = textLine.GetImageBounds(this.gctx);
                         width = bounds.Width;
-                        height = bounds.Height;
+                        height = lineHeight;
                     }
                     else
                     {
@@ -330,28 +336,25 @@
                         }
                     }

-                    var x = p.X;
-                    var y = p.Y;
-
-                    this.gctx.SaveState();
+                    var dx = halign == HorizontalAlignment.Left ? 0d : (halign == HorizontalAlignment.Center ? -width * 0.5 : -width);
+                    var dy = valign == VerticalAlignment.Bottom ? 0d : (valign == VerticalAlignment.Middle ? height * 0.5 : height);

                     this.SetFill(fill);
                     this.SetAlias(false);

-                    this.gctx.SetTextDrawingMode(CGTextDrawingMode.Fill);
-                    this.gctx.TextPosition = new PointF(0, 0);
-
-                    var dx = halign == HorizontalAlignment.Left ? 0d : (halign == HorizontalAlignment.Center ? -width * 0.5 : -width);
-                    var dy = valign == VerticalAlignment.Bottom ? 0d : (valign == VerticalAlignment.Middle ? height * 0.5 : height);
-
-                    this.gctx.TranslateCTM((float)x, (float)y);
-                    this.gctx.RotateCTM((float)(rotate / 180 * Math.PI));
-                    this.gctx.TranslateCTM((float)dx, (float)dy);
+                    this.gctx.SaveState();
+                    this.gctx.TranslateCTM((float)p.X, (float)p.Y);
+                    if (rotate.Equals(0))
+                    {
+                        this.gctx.RotateCTM((float)(rotate / 180 * Math.PI));
+                    }
+
+                    this.gctx.TranslateCTM((float)dx - bounds.Left, (float)dy + delta);
                     this.gctx.ScaleCTM(1f, -1f);

                     if (maxSize.HasValue)
                     {
-                        this.gctx.ClipToRect(new RectangleF(0, 0, width, height));
+                        this.gctx.ClipToRect(new RectangleF(0, 0, (float)Math.Ceiling(width), (float)Math.Ceiling(height)));
                     }

                     textLine.Draw(this.gctx);
@@ -383,8 +386,11 @@
             {
                 using (var textLine = new CTLine(attributedString))
                 {
+                    float lineHeight, delta;
+                    this.GetFontMetrics(font, out lineHeight, out delta);
+                    this.gctx.TextPosition = new PointF(0, 0);
                     var bounds = textLine.GetImageBounds(this.gctx);
-                    return new OxySize(bounds.Width, bounds.Height);
+                    return new OxySize(bounds.Width, lineHeight);
                 }
             }
         }
@@ -447,6 +453,27 @@
         }

         /// <summary>
+        /// Gets font metrics for the specified font.
+        /// </summary>
+        /// <param name="font">The font.</param>
+        /// <param name="defaultLineHeight">Default line height.</param>
+        /// <param name="delta">The vertical delta.</param>
+        private void GetFontMetrics(CTFont font, out float defaultLineHeight, out float delta)
+        {
+            var ascent = font.AscentMetric;
+            var descent = font.DescentMetric;
+            var leading = font.LeadingMetric;
+
+            //// http://stackoverflow.com/questions/5511830/how-does-line-spacing-work-in-core-text-and-why-is-it-different-from-nslayoutm
+
+            leading = leading < 0 ? 0 : (float)Math.Floor(leading + 0.5f);
+            var lineHeight = (float)Math.Floor(ascent + 0.5f) + (float)Math.Floor(descent + 0.5) + leading;
+            var ascenderDelta = leading >= 0 ? 0 : (float)Math.Floor((0.2 * lineHeight) + 0.5);
+            defaultLineHeight = lineHeight + ascenderDelta;
+            delta = ascenderDelta - descent;
+        }
+
+        /// <summary>
         /// Gets the specified from cache.
         /// </summary>
         /// <returns>The font.</returns>


[Markdig.Wpf] Bump to version 0.2.0

[Markdig.Wpf] Bump to version 0.2.0

--- src/Markdig.Wpf/Properties/AssemblyInfo.cs
+++ src/Markdig.Wpf/Properties/AssemblyInfo.cs
@@ -18,7 +18,7 @@
 #endif
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("Markdig.Wpf")]
-[assembly: AssemblyCopyright("Copyright © Nicolas Musset 2016")]
+[assembly: AssemblyCopyright("Copyright © Nicolas Musset 2016-2017")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 [assembly: NeutralResourcesLanguage("en")]
@@ -31,6 +31,6 @@
 {
     public static partial class Markdown
     {
-        public const string Version = "0.0.1";
+        public const string Version = "0.2.0";
     }
 }


fixed the getpreviousitem to call appropriate sitecore function

--- Source/Synthesis/FieldTypes/Adapters/AxesAdapter.cs
+++ Source/Synthesis/FieldTypes/Adapters/AxesAdapter.cs
@@ -65,7 +65,7 @@
 		[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Following Sitecore Axes naming")]
 		public IStandardTemplateItem GetPreviousSibling()
 		{
-			return _axes.GetNextSibling().AsStronglyTyped();
+			return _axes.GetPreviousSibling().AsStronglyTyped();
 		}

 		public bool IsAncestorOf(IStandardTemplateItem item)


Scale each character in SpriteText rather than relying on DrawScale.

--- osu.Framework/Graphics/Sprites/SpriteText.cs
+++ osu.Framework/Graphics/Sprites/SpriteText.cs
@@ -58,7 +58,9 @@
             AutoSizeAxes = Axes.Both;
         }

-        private float textSize = 20;
+        const float default_text_size = 20;
+
+        private float textSize = default_text_size;

         public float TextSize
         {
@@ -69,11 +71,10 @@

                 textSize = value;

-                Invalidate(Invalidation.Geometry);
-            }
-        }
-
-        protected override Vector2 DrawScale => base.DrawScale * textSize;
+                foreach (Drawable d in Children)
+                    d.Scale = new Vector2(textSize);
+            }
+        }

         [BackgroundDependencyLoader]
         private void load(FontStore fonts)
@@ -81,7 +82,7 @@
             if (store == null)
                 store = fonts;

-            spaceWidth = getSprite('.')?.DrawWidth * 2 ?? 20;
+            spaceWidth = getSprite('.')?.DrawWidth * 2 ?? default_text_size;

             if (!string.IsNullOrEmpty(text))
             {
@@ -157,6 +158,7 @@
                         s = new Container
                         {
                             Size = new Vector2(width),
+                            Scale = new Vector2(textSize),
                             Colour = Color4.Transparent,
                         };
                     }
@@ -173,6 +175,7 @@
                         var ctn = new Container
                         {
                             Size = new Vector2(FixedWidth ? constantWidth.GetValueOrDefault() : s.DrawSize.X, 1f),
+                            Scale = new Vector2(textSize),
                             Children = new[] { s }
                         };


Clicking on an AlwaysOpen menu should clear all submenus.

--- osu.Framework/Graphics/UserInterface/Menu.cs
+++ osu.Framework/Graphics/UserInterface/Menu.cs
@@ -212,7 +212,11 @@
             set
             {
                 if (AlwaysOpen && value == MenuState.Closed)
+                {
+                    if (lazySubMenu.IsValueCreated)
+                        subMenu?.clearRecursively();
                     return;
+                }

                 if (state == value)
                     return;


Add a default padding to make menus more legible

--- osu.Framework/Graphics/UserInterface/Menu.cs
+++ osu.Framework/Graphics/UserInterface/Menu.cs
@@ -733,6 +733,7 @@
             {
                 Anchor = Anchor.CentreLeft,
                 Origin = Anchor.CentreLeft,
+                Padding = new MarginPadding(5),
                 TextSize = 17,
             };
         }


Add state changing event to Menu

Add state changing event to Menu

TestCase missing because https://github.com/ppy/osu-framework/pull/1019 is kinda required at this point, to make things sane.

--- osu.Framework/Graphics/UserInterface/Menu.cs
+++ osu.Framework/Graphics/UserInterface/Menu.cs
@@ -272,6 +272,7 @@
             drawableItem.RelativeSizeAxes = ItemsContainer.RelativeSizeAxes;
             drawableItem.Clicked = menuItemClicked;
             drawableItem.Hovered = menuItemHovered;
+            drawableItem.StateChanged += s => itemStateChanged(drawableItem, s);

             ItemsContainer.Add(drawableItem);
         }
@@ -401,12 +402,15 @@
             openSubmenuFor(item);
         }

+        private DrawableMenuItem currentlySelected;
+
         private void openSubmenuFor(DrawableMenuItem item)
         {
             if (subMenu == null)
             {
                 subMenuContainer.Add(subMenu = CreateSubMenu());
                 subMenu.parentMenu = this;
+                subMenu.StateChanged += subMenuStateChanged;
             }
             else
                 subMenu.Close();
@@ -416,7 +420,31 @@
                 Direction == Direction.Vertical ? Width : item.X,
                 Direction == Direction.Horizontal ? Height : item.Y);

+            currentlySelected = item;
             subMenu.Open();
+        }
+
+        private void itemStateChanged(DrawableMenuItem item, MenuItemState state)
+        {
+            switch (state)
+            {
+                case MenuItemState.Selected:
+                    openSubmenuFor(item);
+                    break;
+            }
+        }
+
+        private void subMenuStateChanged(MenuState state)
+        {
+            switch (state)
+            {
+                case MenuState.Closed:
+                    currentlySelected.State = MenuItemState.NotSelected;
+                    break;
+                case MenuState.Open:
+                    currentlySelected.State = MenuItemState.Selected;
+                    break;
+            }
         }

         private ScheduledDelegate openDelegate;
@@ -490,8 +518,13 @@
         protected virtual DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableMenuItem(item);

         #region DrawableMenuItem
-        protected class DrawableMenuItem : CompositeDrawable
-        {
+        protected class DrawableMenuItem : CompositeDrawable, IStateful<MenuItemState>
+        {
+            /// <summary>
+            /// Invoked when this <see cref="DrawableMenuItem"/>'s <see cref="State"/> changes.
+            /// </summary>
+            public event Action<MenuItemState> StateChanged;
+
             /// <summary>
             /// Invoked when this <see cref="DrawableMenuItem"/> is clicked. This occurs regardless of whether or not <see cref="MenuItem.Action"/> was
             /// invoked or not, or whether <see cref="Item"/> contains any sub-<see cref="MenuItem"/>s.
@@ -614,6 +647,21 @@
                 {
                     base.AutoSizeAxes = value;
                     Foreground.AutoSizeAxes = value;
+                }
+            }
+
+            private MenuItemState state;
+            public MenuItemState State
+            {
+                get { return state; }
+                set
+                {
+                    if (state == value)
+                        return;
+                    state = value;
+
+                    UpdateForegroundColour();
+                    UpdateBackgroundColour();
                 }
             }

@@ -710,4 +758,10 @@
         Closed,
         Open
     }
+
+    public enum MenuItemState
+    {
+        Selected,
+        NotSelected
+    }
 }


Fix referencing wrong ffmpeg var

Fix referencing wrong ffmpeg var

--- osu.Framework/Graphics/Video/VideoDecoder.cs
+++ osu.Framework/Graphics/Video/VideoDecoder.cs
@@ -14,6 +14,7 @@
 using SixLabors.ImageSharp.PixelFormats;
 using osu.Framework.Graphics.OpenGL.Textures;
 using osu.Framework.Platform;
+using AGffmpeg = FFmpeg.AutoGen.ffmpeg;

 namespace osu.Framework.Graphics.Video
 {
@@ -138,7 +139,7 @@

             decoderCommands.Enqueue(() =>
             {
-                ffmpeg.av_seek_frame(formatContext, stream->index, (long)(targetTimestamp / timeBaseInSeconds / 1000.0), FFmpeg.AutoGen.ffmpeg.AVSEEK_FLAG_BACKWARD);
+                ffmpeg.av_seek_frame(formatContext, stream->index, (long)(targetTimestamp / timeBaseInSeconds / 1000.0), AGffmpeg.AVSEEK_FLAG_BACKWARD);
                 skipOutputUntilTime = targetTimestamp;
             });
         }
@@ -242,7 +243,7 @@
                     decoder.videoStream.Seek(offset, SeekOrigin.Begin);
                     break;

-                case FFmpeg.AutoGen.ffmpeg.AVSEEK_SIZE:
+                case AGffmpeg.AVSEEK_SIZE:
                     return decoder.videoStream.Length;

                 default:
@@ -375,7 +376,7 @@
                                 }
                             }
                         }
-                        else if (readFrameResult == FFmpeg.AutoGen.ffmpeg.AVERROR_EOF)
+                        else if (readFrameResult == AGffmpeg.AVERROR_EOF)
                         {
                             if (Looping)
                                 Seek(0);
@@ -420,27 +421,27 @@

         protected virtual FfmpegFuncs CreateFuncs() => new FfmpegFuncs
         {
-            av_frame_alloc = ffmpeg.av_frame_alloc,
-            av_frame_free = ffmpeg.av_frame_free,
-            av_image_fill_arrays = ffmpeg.av_image_fill_arrays,
-            av_image_get_buffer_size = ffmpeg.av_image_get_buffer_size,
-            av_malloc = ffmpeg.av_malloc,
-            av_packet_alloc = ffmpeg.av_packet_alloc,
-            av_packet_free = ffmpeg.av_packet_free,
-            av_read_frame = ffmpeg.av_read_frame,
-            av_seek_frame = ffmpeg.av_seek_frame,
-            avcodec_find_decoder = ffmpeg.avcodec_find_decoder,
-            avcodec_open2 = ffmpeg.avcodec_open2,
-            avcodec_receive_frame = ffmpeg.avcodec_receive_frame,
-            avcodec_send_packet = ffmpeg.avcodec_send_packet,
-            avformat_alloc_context = ffmpeg.avformat_alloc_context,
-            avformat_close_input = ffmpeg.avformat_close_input,
-            avformat_find_stream_info = ffmpeg.avformat_find_stream_info,
-            avformat_open_input = ffmpeg.avformat_open_input,
-            avio_alloc_context = ffmpeg.avio_alloc_context,
-            sws_freeContext = ffmpeg.sws_freeContext,
-            sws_getContext = ffmpeg.sws_getContext,
-            sws_scale = ffmpeg.sws_scale
+            av_frame_alloc = AGffmpeg.av_frame_alloc,
+            av_frame_free = AGffmpeg.av_frame_free,
+            av_image_fill_arrays = AGffmpeg.av_image_fill_arrays,
+            av_image_get_buffer_size = AGffmpeg.av_image_get_buffer_size,
+            av_malloc = AGffmpeg.av_malloc,
+            av_packet_alloc = AGffmpeg.av_packet_alloc,
+            av_packet_free = AGffmpeg.av_packet_free,
+            av_read_frame = AGffmpeg.av_read_frame,
+            av_seek_frame = AGffmpeg.av_seek_frame,
+            avcodec_find_decoder = AGffmpeg.avcodec_find_decoder,
+            avcodec_open2 = AGffmpeg.avcodec_open2,
+            avcodec_receive_frame = AGffmpeg.avcodec_receive_frame,
+            avcodec_send_packet = AGffmpeg.avcodec_send_packet,
+            avformat_alloc_context = AGffmpeg.avformat_alloc_context,
+            avformat_close_input = AGffmpeg.avformat_close_input,
+            avformat_find_stream_info = AGffmpeg.avformat_find_stream_info,
+            avformat_open_input = AGffmpeg.avformat_open_input,
+            avio_alloc_context = AGffmpeg.avio_alloc_context,
+            sws_freeContext = AGffmpeg.sws_freeContext,
+            sws_getContext = AGffmpeg.sws_getContext,
+            sws_scale = AGffmpeg.sws_scale
         };

         #region Disposal


Ensure VideoTexture uploads are always of correct opacity setting

--- osu.Framework/Graphics/Video/VideoTexture.cs
+++ osu.Framework/Graphics/Video/VideoTexture.cs
@@ -29,6 +29,9 @@

         internal override void SetData(ITextureUpload upload, WrapMode wrapModeS, WrapMode wrapModeT, Opacity? uploadOpacity)
         {
+            if (uploadOpacity != null && uploadOpacity != Opacity.Opaque)
+                throw new InvalidOperationException("Video texture uploads must always be opaque");
+
             UploadComplete = false;

             // We do not support videos with transparency at this point,


Add one more level of null check

Add one more level of null check

--- osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -62,7 +62,7 @@

             localCursorContainer?.Expire();
             localCursorContainer = null;
-            GameplayCursor?.ActiveCursor.Show();
+            GameplayCursor?.ActiveCursor?.Show();
         }

         protected override bool OnHover(HoverEvent e) => true;


Fixed syntax warnings in Taiko playfield

--- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs
+++ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs
@@ -242,7 +242,6 @@
                 drawableHit = new DrawableFlyingCentreHit(Time.Current, isStrong);

             drumRollHitContainer.Add(drawableHit);
-
         }

         internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
@@ -289,8 +288,9 @@

             if (Time.Elapsed < 0)
             {
-                foreach (DrawableHit taikoHit in drumRollHitContainer.Objects)
-                {
+                foreach (var o in drumRollHitContainer.Objects)
+                {
+                    var taikoHit = (DrawableHit)o;
                     taikoHit.RemoveProxiedContent();
                     drumRollHitContainer.Remove(taikoHit);
                 }


Fix players potentially not displaying in spectator after restart

--- osu.Game/Online/Spectator/SpectatorClient.cs
+++ osu.Game/Online/Spectator/SpectatorClient.cs
@@ -206,6 +206,11 @@
                 if (!IsPlaying)
                     return;

+                // Disposal could be processed late, leading to EndPlaying potentially being called after a future BeginPlaying call.
+                // Account for this by ensuring the current score matches the score in the provided GameplayState.
+                if (currentScore != state.Score)
+                    return;
+
                 if (pendingFrames.Count > 0)
                     purgePendingFrames();


initial WikiPanelMarkdownContainer

initial WikiPanelMarkdownContainer

--- osu.Game/Overlays/Wiki/WikiPanelContainer.cs
+++ osu.Game/Overlays/Wiki/WikiPanelContainer.cs
@@ -44,7 +44,7 @@
                         RelativeSizeAxes = Axes.Both,
                     },
                 },
-                new WikiMarkdownContainer
+                new WikiPanelMarkdownContainer
                 {
                     Text = Text,
                     RelativeSizeAxes = Axes.X,
@@ -52,5 +52,15 @@
                 }
             };
         }
+
+        private class WikiPanelMarkdownContainer : WikiMarkdownContainer
+        {
+            public WikiPanelMarkdownContainer()
+            {
+                LineSpacing = 0;
+                DocumentPadding = new MarginPadding(30);
+                DocumentMargin = new MarginPadding(0);
+            }
+        }
     }
 }


Bug fix: add null check before using registry key object.

--- pGina/src/Plugin/Settings/DynamicSettings.cs
+++ pGina/src/Plugin/Settings/DynamicSettings.cs
@@ -63,7 +63,7 @@
         {
             using (RegistryKey key = Registry.LocalMachine.OpenSubKey(m_rootKey))
             {
-                if (key.GetValueNames().Contains(name))
+                if (key != null && key.GetValueNames().Contains(name))
                 {
                     object value = key.GetValue(name);
                     return new DynamicSetting(name, value);


Only turn off identity columns for artists and genres.

--- src/MusicStore/Models/MusicStoreContext.cs
+++ src/MusicStore/Models/MusicStoreContext.cs
@@ -34,12 +34,8 @@
             builder.Entity<OrderDetail>().Key(o => o.OrderDetailId);

             // TODO: Remove this when we start using auto generated values
-            builder.Entity<Album>().Property(a => a.AlbumId).GenerateValuesOnAdd(generateValues: false);
             builder.Entity<Artist>().Property(a => a.ArtistId).GenerateValuesOnAdd(generateValues: false);
-            builder.Entity<Order>().Property(o => o.OrderId).GenerateValuesOnAdd(generateValues: false);
             builder.Entity<Genre>().Property(g => g.GenreId).GenerateValuesOnAdd(generateValues: false);
-            builder.Entity<CartItem>().Property(c => c.CartItemId).GenerateValuesOnAdd(generateValues: false);
-            builder.Entity<OrderDetail>().Property(o => o.OrderDetailId).GenerateValuesOnAdd(generateValues: false);

             base.OnModelCreating(builder);
         }


53: ProcessReceivedData()

53: ProcessReceivedData()

--- src/NETCore/HttpWebServer/RecvIO_SendIO.cs
+++ src/NETCore/HttpWebServer/RecvIO_SendIO.cs
@@ -115,7 +115,7 @@
                 destBuffer,
                 0, count);
         }
-
+
         public void CopyTo(int srcIndex, MemoryStream ms, int count)
         {

@@ -173,7 +173,10 @@
         public void StartReceive()
         {
             recvArgs.SetBuffer(this.recvStartOffset, this.recvBufferSize);
-            recvArgs.AcceptSocket.ReceiveAsync(recvArgs);
+            if (!recvArgs.AcceptSocket.ReceiveAsync(recvArgs))
+            {
+                ProcessReceivedData();
+            }
         }
         /// <summary>
         /// start new receive
@@ -183,7 +186,10 @@
         public void StartReceive(byte[] buffer, int len)
         {
             recvArgs.SetBuffer(buffer, 0, len);
-            recvArgs.AcceptSocket.ReceiveAsync(recvArgs);
+            if (!recvArgs.AcceptSocket.ReceiveAsync(recvArgs))
+            {
+                ProcessReceivedData();
+            }
         }
         public int BytesTransferred
         {
@@ -393,7 +399,7 @@
                     sendingState = SendIOState.ReadyNextSend;
                     return;
                 }
-
+
             }
             else if (remaining < 0)
             {
@@ -455,7 +461,8 @@
                         sendingState = SendIOState.Error;
                         notify(SendIOEventCode.SocketError);
                         //manage socket errors here
-                    }break;
+                    }
+                    break;
                 case SocketError.Success:
                     {
                         this.sendingTransferredBytes += sendArgs.BytesTransferred;
@@ -534,7 +541,7 @@
                     }
                     break;
             }
-
+
         }
     }


added raffle ticket

added raffle ticket

- added raffle ticket emoji.
- made raffle look nice.

--- src/NadekoBot/Modules/Gambling/Gambling.cs
+++ src/NadekoBot/Modules/Gambling/Gambling.cs
@@ -42,7 +42,7 @@
             var members = role.Members().Where(u => u.Status != UserStatus.Offline && u.Status != UserStatus.Unknown);
             var membersArray = members as IUser[] ?? members.ToArray();
             var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
-            await channel.SendMessageAsync($"**Raffled user:** {usr.Username} (id: {usr.Id})").ConfigureAwait(false);
+            await channel.SendMessageAsync($"🎟 Raffled user: **{usr.Username}** ID: `{usr.Id}`").ConfigureAwait(false);
         }

         [NadekoCommand, Usage, Description, Aliases]