GetFieldType is correct for template type. We handle case when we are unable to provie generic type for field.

--- Source/GenerateUserTypesFromPdb/UserTypes/TemplateUserType.cs
+++ Source/GenerateUserTypesFromPdb/UserTypes/TemplateUserType.cs
@@ -8,8 +8,8 @@
 {
     internal class TemplateUserType : UserType
     {
-        private List<string> argumentsSymbols = new List<string>();
-        private List<UserType> argumentsUserType = new List<UserType>();
+        private readonly List<string> argumentsSymbols = new List<string>();
+        private readonly List<UserType> argumentsUserType = new List<UserType>();

         //  TODO consider new type holding specialized template usertypes.
         //
@@ -523,7 +523,7 @@

         public override UserTypeTree GetFieldType(SymbolField field, UserTypeFactory factory, bool extractingBaseClass, int bitLength = 0)
         {
-            if (extractingBaseClass)
+            if (extractingBaseClass || this.Arguments.Count == 0)
             {
                 // Do not match specializations when getting type for base class.
                 //
@@ -549,27 +549,33 @@
                 return GetTypeString(field.Type, factory, bitLength);
             }

-            //  Check Types for all specializations
             //
-            string[] specializedFieldTypes = specializedFields.Select(r => r.Item2.Type.Name).ToArray();
-
-            for (int argIndex = 0; argIndex < this.Arguments.Count; argIndex++)
-            {
-                string[] templateArguments = specializedTypes.Select(r => r.Arguments[argIndex]).ToArray();
-
-                bool allMatching = Enumerable.SequenceEqual(templateArguments, specializedFieldTypes);
-
-                if (allMatching)
-                {
-                    return new UserTypeTreeArgumentGenericsType(this.Arguments.Count > 1 ? argIndex + 1 : 0, this, factory);
-                }
-            }
-
-            // TODO
-            // Investigate further why we can't match template specialization.
-            //
-
-            return GetTypeString(field.Type, factory, bitLength);
+            UserTypeTree result = GetTypeString(field.Type, factory, bitLength);
+
+            if (result is UserTypeTreeBaseType)
+            {
+                // Correct result
+                //
+                UserType baseTypeUserType;
+
+                if (CreateFactory(factory).GetUserType(field.Type, out baseTypeUserType))
+                {
+                    UserTypeTree tree = UserTypeTreeUserType.Create(baseTypeUserType, factory);
+
+                    if (tree != null)
+                    {
+                        return tree;
+                    }
+                }
+
+                // Failed to match the type
+                // TODO, look for typedeclared
+                // Class is using different types than in template specialization.
+                // We cannot support it right now.
+                return new UserTypeTreeVariable();
+            }
+
+            return result;
         }
     }
 }


[Toolkit.Graphics] Change TextureDescription to use PixelFormat

--- Source/Toolkit/SharpDX.Toolkit.Graphics/TextureDescription.cs
+++ Source/Toolkit/SharpDX.Toolkit.Graphics/TextureDescription.cs
@@ -97,7 +97,7 @@
         /// <msdn-id>ff476252</msdn-id>
         /// <unmanaged>DXGI_FORMAT Format</unmanaged>
         /// <unmanaged-short>DXGI_FORMAT Format</unmanaged-short>
-        public SharpDX.DXGI.Format Format;
+        public PixelFormat Format;

         ///
         ///

Structure that specifies multisampling parameters for the texture. See <see cref="SharpDX.DXGI.SampleDescription"/>.


Fix Android API Rolling Period Bug, Enable Xamarin EN side. (#911)

--- XPlat/ExposureNotification/source/Xamarin.ExposureNotification/ExposureNotification.android.cs
+++ XPlat/ExposureNotification/source/Xamarin.ExposureNotification/ExposureNotification.android.cs
@@ -171,7 +171,7 @@
 						new TemporaryExposureKey(
 							k.GetKeyData(),
 							k.RollingStartIntervalNumber,
-							TimeSpan.Zero, // TODO: TimeSpan.FromMinutes(k.RollingDuration * 10),
+							TimeSpan.FromMinutes(k.RollingPeriod * 10),
 							k.TransmissionRiskLevel.FromNative()));
 				});


Remove ignoring tests. Issue #21

Remove ignoring tests. Issue #21

--- VersionOne.VisualStudio.Tests/WorkitemTreeControllerTester.cs
+++ VersionOne.VisualStudio.Tests/WorkitemTreeControllerTester.cs
@@ -259,34 +259,17 @@
         }

         [Test]
-        [Ignore("Rewrite to cover ProjectSelected")]
         public void ModelChangedEvent() {
+            ExpectRegisterAndPrepareView();
+
             Expect.Call(() => eventDispatcherMock.ModelChanged += null).IgnoreArguments();
             var raiser = LastCall.GetEventRaiser();
-            Expect.Call(viewMock.Controller).PropertyBehavior();
-            Expect.Call(dataLayerMock.CurrentProject).Return(null);
-            Expect.Call(viewMock.Title).IgnoreArguments().PropertyBehavior();
-            Expect.Call(viewMock.Model).IgnoreArguments().PropertyBehavior();
-            Expect.Call(viewMock.ReconfigureTreeColumns);
-            Expect.Call(viewMock.CheckSettingsAreValid()).Return(true);
-            Expect.Call(viewMock.ReconfigureTreeColumns);
-            Expect.Call(viewMock.SetSelection);
-            Expect.Call(viewMock.Refresh);
-            Expect.Call(viewMock.CurrentWorkitemDescriptor).Return(null);
-            Expect.Call(viewMock.AddTaskCommandEnabled).IgnoreArguments().PropertyBehavior();
-            Expect.Call(viewMock.AddTestCommandEnabled).IgnoreArguments().PropertyBehavior();
-            Expect.Call(viewMock.AddDefectCommandEnabled).IgnoreArguments().PropertyBehavior();
-
-            Expect.Call(dataLayerMock.CurrentProject).Return(null);
-            Expect.Call(viewMock.CheckSettingsAreValid()).Return(false);
-            Expect.Call(viewMock.ResetPropertyView);
-            Expect.Call(viewMock.Refresh);
-            Expect.Call(viewMock.CurrentWorkitemDescriptor).Return(null);
-
-            mockRepository.ReplayAll();
-
-            controller.Register(viewMock);
-            controller.PrepareView();
+
+            mockRepository.ReplayAll();
+
+            controller.Register(viewMock);
+            controller.PrepareView();
+
             raiser.Raise(null, new ModelChangedArgs(EventReceiver.WorkitemView, EventContext.ProjectSelected));

             mockRepository.VerifyAll();


Change TokenIndex to OriginalTokenIndex. The TokenIndex is the position in the PreProcessorStream. We get the Lexer stream back and need the original position

--- VisualStudio/ProjectPackage/Editors/XSharpCompletionSource.cs
+++ VisualStudio/ProjectPackage/Editors/XSharpCompletionSource.cs
@@ -3829,16 +3829,16 @@

             internal static IToken GetPreviousToken(ITokenStream tokens, IToken currentToken)
             {
-                IToken prev = null;
+                XSharpToken prev = null;
                 if (currentToken != null)
                 {
-                    prev = currentToken;
+                    prev = (XSharpToken) currentToken;
                     int Line = prev.Line;
                     do
                     {
-                        if (prev.TokenIndex == 0)
-                            break;
-                        prev = tokens.Get(prev.TokenIndex - 1);
+                        if (prev.OriginalTokenIndex == 0)
+                            break;
+                        prev = (XSharpToken)tokens.Get(prev.OriginalTokenIndex - 1);
                         if (prev.Line != Line)
                         {
                             prev = null;


correct selection status after target change

--- WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
+++ WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -458,6 +458,8 @@
 					isFinePrivate,
 					isStrongPrivate
 					);
+
+			SetSelections();
 		}

 		private void ClearRootList()


Better naming

Better naming

--- WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
+++ WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
@@ -19,7 +19,7 @@
 		private ObservableCollection<CategoryViewModel> _categories;
 		private CategoryViewModel _selectedCategory;
 		private ViewModelBase _currentView;
-		private LoadWalletViewModel LoadWalletViewModelDesktop { get; set; }
+		private LoadWalletViewModel LoadWalletDesktop { get; set; }

 		public WalletManagerViewModel() : base("Wallet Manager")
 		{
@@ -64,13 +64,13 @@
 		{
 			base.OnOpen(disposables);

-			LoadWalletViewModelDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop);
+			LoadWalletDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop);

 			Categories = new ObservableCollection<CategoryViewModel>
 			{
 				new GenerateWalletViewModel(this),
 				new RecoverWalletViewModel(this),
-				LoadWalletViewModelDesktop,
+				LoadWalletDesktop,
 				new LoadWalletViewModel(this, LoadWalletType.Password),
 				new ConnectHardwareWalletViewModel(this)
 			};


More descriptive guard

More descriptive guard

--- WalletWasabi/Crypto/ZeroKnowledge/LinearRelation/Statement.cs
+++ WalletWasabi/Crypto/ZeroKnowledge/LinearRelation/Statement.cs
@@ -30,9 +30,8 @@

 		public Statement(GroupElement[,] equations)
 		{
-			// need to have at least one generator and one public point
 			var terms = equations.GetLength(1);
-			Guard.True(nameof(terms), terms >= 2);
+			Guard.True(nameof(terms), terms >= 2, $"Invalid {nameof(terms)}. It needs to have at least one generator and one public point.");
 			foreach (var generator in equations)
 			{
 				Guard.NotNull(nameof(generator), generator);


Added Percentage sign for percentage values

--- Web/Areas/Logistics/Views/TransporterPerformance/Index.cshtml
+++ Web/Areas/Logistics/Views/TransporterPerformance/Index.cshtml
@@ -23,7 +23,7 @@
     columns.Bound(m => m.StartDate).HeaderHtmlAttributes(new { @class = "cats-date-pref-grid" });
     columns.Bound(m => m.NoOfDaysToComplete).Title(@Html.Translate2(PAGE_NAME, "Agreed to complete (days)")).HtmlAttributes(new { align = "Right" });
     columns.Bound(m => m.ElapsedDays).Title(@Html.Translate2(PAGE_NAME, "Elapsed Time(in Days)")).HtmlAttributes(new { align = "Right" });
-    columns.Bound(m => m.Percentage).Title(@Html.Translate2(PAGE_NAME, "Percentage Completed")).HtmlAttributes(new { align = "Center"}).Format("{0:N2}");
+    columns.Bound(m => m.Percentage).Title(@Html.Translate2(PAGE_NAME, "Percentage Completed")).HtmlAttributes(new { align = "Center"}).Format("{0:N2}%");
   })
     .Sortable()
     .Scrollable()


Bugfix PowerPoint converts for protected documents

--- WebFormsDocumentViewer/Converters/PowerPointToPdfConverter.cs
+++ WebFormsDocumentViewer/Converters/PowerPointToPdfConverter.cs
@@ -1,10 +1,10 @@
-using Microsoft.Office.Interop.PowerPoint;
+using Microsoft.Office.Core;
+using Microsoft.Office.Interop.PowerPoint;
 using System;
 using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Web;
-using WebFormsDocumentViewer.Infrastructure;

 namespace WebFormsDocumentViewer.Converters
 {
@@ -14,7 +14,7 @@
     /// <remarks>
     /// You should also have Microsoft Office installed on the server for this to work
     /// </remarks>
-    internal class PowerPointToPdfConverter : IConverter
+    internal class PowerPointToPdfConverter : Infrastructure.IConverter
     {
         /// <summary>
         /// Converts the PowerPoint document to PDF
@@ -28,7 +28,9 @@
             Presentation powerPointDocument = null;
             try
             {
-                powerPointDocument = appPowerPoint.Presentations.Open(HttpContext.Current.Server.MapPath(filePath));
+                powerPointDocument = appPowerPoint.Presentations.Open(HttpContext.Current.Server.MapPath(filePath),
+                    MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
+                powerPointDocument.Final = false;
                 string fileName = Path.GetFileNameWithoutExtension(filePath) + DateTime.Now.Ticks + ".pdf";

                 if (!Directory.Exists(HttpContext.Current.Server.MapPath(destinationPath)))


Fix websearch setting issues.

Fix websearch setting issues.

--- Wox.Plugin.SystemPlugins/WebSearch/WebSearchesSetting.xaml.cs
+++ Wox.Plugin.SystemPlugins/WebSearch/WebSearchesSetting.xaml.cs
@@ -101,8 +101,12 @@

         private void ComboBoxSuggestionSource_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            UserSettingStorage.Instance.WebSearchSuggestionSource = ((ComboBoxItem)e.AddedItems[0]).Content.ToString();
-            UserSettingStorage.Instance.Save();
+            if (e.AddedItems.Count > 0)
+            {
+                UserSettingStorage.Instance.WebSearchSuggestionSource =
+                    ((ComboBoxItem) e.AddedItems[0]).Content.ToString();
+                UserSettingStorage.Instance.Save();
+            }
         }
     }
 }


[iOS] Fix mock data for speed.

[iOS] Fix mock data for speed.

--- XamarinApp/MyTrips/MyTrips.DataStore.Mock/Stores/TripStore.cs
+++ XamarinApp/MyTrips/MyTrips.DataStore.Mock/Stores/TripStore.cs
@@ -208,7 +208,7 @@
 					pt.HasOBDData = true;
                 }

-				trip6.Points[0].Speed = 0;
+				trip6.Points[0].Speed = 0.0;
             }
             catch (Exception ex)
             {


Change the bounding box type of the Xmas Bell's clapper end.

--- Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/XmasBell/XmasBell.cs
+++ Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/XmasBell/XmasBell.cs
@@ -33,7 +33,7 @@
             // Setup the physics
             Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionCircle(this, "body.png", new Vector2(0f, 10f), 0.90f));
             Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionConvexPolygon(this, "clapper.png", Vector2.Zero, 1f));
-            Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionConvexPolygon(this, "clapper-ball.png", Vector2.Zero, 1f));
+            Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionCircle(this, "clapper-ball.png", Vector2.Zero, 1f));
         }

         protected override void UpdateBehaviourIndex()


Increase loading requirements

Increase loading requirements

--- RuneScapeCacheTools/Cache/Downloader/TcpFileDownloader.cs
+++ RuneScapeCacheTools/Cache/Downloader/TcpFileDownloader.cs
@@ -287,23 +287,8 @@
             Log.Debug($"Successfully connected to content server with version {serverVersion.Item1}.{serverVersion.Item2}.");

             var contentReader = new BinaryReader(this._contentClient.GetStream());
-            // Loading requirements. Whatever that might mean:
-            // 00 00 0c eb
-            // 00 01 10 a3
-            // 00 00 a2 b3
-            // 00 00 8c 1a
-            // 00 05 79 3c
-            // 00 42 d4 96
-            // 00 00 ad 57
-            // 00 00 47 3f
-            // 00 01 20 5a
-            // 00 07 57 09 00 14 2e 29 00 0a 38 83 00 0a f4 c6
-            // 00 14 4c 86 00 16 2c ef 00 00 a6 2e 00 14 5a d9
-            // 00 00 69 de 00 00 98 cd 00 00 04 dc 00 01 76 b0
-            // 00 00 09 20 00 00 00 77 00 13 4e 8a 00 53 8e 33
-            // 00 00 ac 18 00 00 61 e7 00 02 35 ce 00 00 bc 2a
-            // 00 07 b8 ba 00 00 02 b5
-            var loadingRequirements = contentReader.ReadBytesExactly(31 * 4);
+            // Not sure what loading requirements mean, but they grow every once in a while.
+            var loadingRequirements = contentReader.ReadBytesExactly(32 * 4);

             // Send the initial connection status and login packets to the server. I don't know what the individual
             // writes mean but they do the trick.


[ICC_032] Venomancer [ICC_026] Grim Necromancer [ICC_025] Rattling Rascal [ICC_023] Snowflipper Penguin [ICC_081] Drakkari Defender [ICC_065] Bone Baron

--- SabberStoneCore/src/CardSets/Standard/IcecrownCardsGen.cs
+++ SabberStoneCore/src/CardSets/Standard/IcecrownCardsGen.cs
@@ -2821,11 +2821,10 @@
 			// - DEATHRATTLE = 1
 			// --------------------------------------------------------
 			cards.Add("ICC_065", new List<Enchantment> {
-				// TODO [ICC_065] Bone Baron && Test: Bone Baron_ICC_065
 				new Enchantment
 				{
 					Activation = EnchantmentActivation.DEATHRATTLE,
-					SingleTask = null,
+					SingleTask = new EnqueueTask(2, new AddCardTo("ICC_026t", EntityType.HAND))
 				},
 			});

@@ -3188,14 +3187,7 @@
 			// - OVERLOAD = 3
 			// - OVERLOAD_OWED = 3
 			// --------------------------------------------------------
-			cards.Add("ICC_081", new List<Enchantment> {
-				// TODO [ICC_081] Drakkari Defender && Test: Drakkari Defender_ICC_081
-				new Enchantment
-				{
-					//Activation = null,
-					//SingleTask = null,
-				}
-			});
+			cards.Add("ICC_081", null);

 			// ---------------------------------------- MINION - SHAMAN
 			// [ICC_088] Voodoo Hexxer - COST:5 [ATK:2/HP:7]
@@ -3792,14 +3784,7 @@
 			// [ICC_023] Snowflipper Penguin - COST:0 [ATK:1/HP:1]
 			// - Race: beast, Set: icecrown, Rarity: common
 			// --------------------------------------------------------
-			cards.Add("ICC_023", new List<Enchantment> {
-				// TODO [ICC_023] Snowflipper Penguin && Test: Snowflipper Penguin_ICC_023
-				new Enchantment
-				{
-					//Activation = null,
-					//SingleTask = null,
-				}
-			});
+			cards.Add("ICC_023", null);

 			// --------------------------------------- MINION - NEUTRAL
 			// [ICC_025] Rattling Rascal - COST:4 [ATK:2/HP:2]
@@ -3815,16 +3800,15 @@
 			// - BATTLECRY = 1
 			// --------------------------------------------------------
 			cards.Add("ICC_025", new List<Enchantment> {
-				// TODO [ICC_025] Rattling Rascal && Test: Rattling Rascal_ICC_025
 				new Enchantment
 				{
 					Activation = EnchantmentActivation.BATTLECRY,
-					SingleTask = null,
+					SingleTask = new SummonTask("ICC_025t"),
 				},
 				new Enchantment
 				{
 					Activation = EnchantmentActivation.DEATHRATTLE,
-					SingleTask = null,
+					SingleTask = new SummonOpTask("ICC_025t"),
 				},
 			});

@@ -3838,12 +3822,11 @@
 			// - BATTLECRY = 1
 			// --------------------------------------------------------
 			cards.Add("ICC_026", new List<Enchantment> {
-				// TODO [ICC_026] Grim Necromancer && Test: Grim Necromancer_ICC_026
 				new Enchantment
 				{
 					Activation = EnchantmentActivation.BATTLECRY,
-					SingleTask = null,
-				},
+					SingleTask = new EnqueueTask(2, new SummonTask("ICC_026t"))
+				}
 			});

 			// --------------------------------------- MINION - NEUTRAL
@@ -3925,14 +3908,7 @@
 			// GameTag:
 			// - POISONOUS = 1
 			// --------------------------------------------------------
-			cards.Add("ICC_032", new List<Enchantment> {
-				// TODO [ICC_032] Venomancer && Test: Venomancer_ICC_032
-				new Enchantment
-				{
-					//Activation = null,
-					//SingleTask = null,
-				}
-			});
+			cards.Add("ICC_032", null);

 			// --------------------------------------- MINION - NEUTRAL
 			// [ICC_067] Vryghoul - COST:3 [ATK:3/HP:1]


Execution engine now makes use of property change aggregation.

--- Expressions/Expressions/Execution/ExecutionEngine.cs
+++ Expressions/Expressions/Execution/ExecutionEngine.cs
@@ -25,6 +25,7 @@
         public void CommitTransaction()
         {
             context.AggregateCollectionChanges(invalidNodes);
+            context.AggregatePropertyChanges(invalidNodes);
             Execute(invalidNodes);
             invalidNodes.Clear();
             TransactionActive = false;
@@ -40,6 +41,7 @@

             if (nodes.Length == 1)
             {
+                context.AggregatePropertyChanges(nodes);
                 context.AggregateCollectionChanges(nodes);
                 ExecuteSingle(nodes[0]);
             }
@@ -58,6 +60,7 @@
                 invalidNodes.Add(node);
             else
             {
+                context.AggregatePropertyChanges(new[] { node });
                 context.AggregateCollectionChanges(new[] { node });
                 ExecuteSingle(node);
             }


refactor

refactor

--- SDK/Mozu.Api/MozuClient.cs
+++ SDK/Mozu.Api/MozuClient.cs
@@ -420,7 +420,7 @@
 		    _httpResponseMessage = client.SendAsync(request, HttpCompletionOption.ResponseContentRead).Result;
             ResponseHelper.EnsureSuccess(_httpResponseMessage, _apiContext);

-            SetCache(_httpResponseMessage, requestUri);
+            SetCache(requestUri);

 		}
 		protected async Task ExecuteRequestAsync()
@@ -433,10 +433,10 @@
 			_httpResponseMessage = await client.SendAsync(request, HttpCompletionOption.ResponseContentRead);

             ResponseHelper.EnsureSuccess(_httpResponseMessage, _apiContext);
-            SetCache(_httpResponseMessage, requestUri);
-		}
-
-        private void SetCache(HttpResponseMessage responseMessage, string requestUri)
+            SetCache(requestUri);
+		}
+
+        private void SetCache(string requestUri)
         {
             var eTag = HttpHelper.GetHeaderValue(Headers.ETAG, _httpResponseMessage.Headers);
             var cacheItem = CacheManager.Instance.Get<CacheItem>(requestUri);
@@ -449,7 +449,6 @@
                 cacheItem = new CacheItem { ETag = eTag, Item = _httpResponseMessage, Uri = requestUri };
                 CacheManager.Instance.Add(cacheItem, requestUri);
             }
-
         }

         private HttpRequestMessage GetRequestMessage()


Fixed test

Fixed test

--- Tests/MatterControl.AutomationTests/PrintingTests.cs
+++ Tests/MatterControl.AutomationTests/PrintingTests.cs
@@ -35,21 +35,21 @@

 					testRunner.AddItemToBedplate();

+					// Sorten the delay so the test runs in a reasonable time
+					ApplicationController.Instance.ActivePrinter.Connection.TurnOffHeatDelay = 5;
+
 					testRunner.StartPrint();

 					// Wait for print to finish
 					testRunner.WaitForPrintFinished();

 					// Wait for expected temp
-					testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0);
+					testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0, 10);
 					Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0), 30);

 					// Wait for expected temp
 					testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature <= 10);
 					Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature, 10);
-
-					// Sorten the delay so the test runs in a reasonable time
-					ApplicationController.Instance.ActivePrinter.Connection.TurnOffHeatDelay = 5;

 					// Make sure we can run this whole thing again
 					testRunner.StartPrint();


Update LocalStorageFileSystemTests.cs

Update LocalStorageFileSystemTests.cs

--- File-Repository-Tests/LocalStorageFileSystemTests.cs
+++ File-Repository-Tests/LocalStorageFileSystemTests.cs
@@ -1,3 +1,22 @@
+/*
+ *  Copyright 2017 Craig Lee Mark Adams
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ *
+ *
+ * */
+
+
 using System;
 using Microsoft.VisualStudio.TestTools.UnitTesting;


formkey fix

formkey fix

--- Serenity.Script.UI/EntityDialog/EntityDialog_Inference.cs
+++ Serenity.Script.UI/EntityDialog/EntityDialog_Inference.cs
@@ -49,7 +49,7 @@
                 if (attributes.Length >= 1)
                     formKey = attributes[0].As<FormKeyAttribute>().Value;
                 else
-                    formKey = ("Db." + GetEntityType() + ".");
+                    formKey = GetEntityType();
             }

             return formKey;


update logging

update logging

--- FolderSync/SyncProvider.cs
+++ FolderSync/SyncProvider.cs
@@ -12,16 +12,19 @@
 using System.Threading;
 using System.Threading.Tasks;
 using CommonIO;
+using MediaBrowser.Model.Logging;

 namespace FolderSync
 {
     public class SyncProvider : IServerSyncProvider, ISupportsDirectCopy
     {
         private readonly IFileSystem _fileSystem;
-
-        public SyncProvider(IFileSystem fileSystem)
+        private readonly ILogger _logger;
+
+        public SyncProvider(IFileSystem fileSystem, ILogger logger)
         {
             _fileSystem = fileSystem;
+            _logger = logger;
         }

         public async Task<SyncedFileInfo> SendFile(Stream stream, string[] remotePath, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken)
@@ -29,6 +32,9 @@
             var fullPath = GetFullPath(remotePath, target);

             _fileSystem.CreateDirectory(Path.GetDirectoryName(fullPath));
+
+            _logger.Debug("Folder sync saving stream to {0}", fullPath);
+
             using (var fileStream = _fileSystem.GetFileStream(fullPath, FileMode.Create, FileAccess.Write, FileShare.Read, true))
             {
                 await stream.CopyToAsync(fileStream).ConfigureAwait(false);
@@ -188,6 +194,7 @@

             _fileSystem.CreateDirectory(Path.GetDirectoryName(fullPath));

+            _logger.Debug("Folder sync copying file from {0} to {1}", path, fullPath);
             _fileSystem.CopyFile(path, fullPath, true);

             return Task.FromResult(GetSyncedFileInfo(fullPath));


Revert "fix AssertClassName"

Revert "fix AssertClassName"

This reverts commit 1088b3bd2a2ef0c199fccc0526e6b949256bad26.

--- Signum.Windows.Extensions.UIAutomation/BasicExtensions.cs
+++ Signum.Windows.Extensions.UIAutomation/BasicExtensions.cs
@@ -167,7 +167,15 @@
             if (element.Current.ClassName == expectedType)
                 return;

-            throw new InvalidCastException("The AutomationElement is not a {0}, but a {1}".Formato(expectedType, element.Current.ClassName));
+            try
+            {
+                throw new InvalidCastException("The AutomationElement is not a {0}, but a {1}".Formato(expectedType, element.Current.ClassName));
+            }
+            catch (Exception e)
+            {
+                WaitExtensions.PrintEntries(e, expectedType, element.Current.ClassName);
+                throw;
+            }
         }
     }
 }


Speed up parsing of gdb output strings by using indexes into the orig… (#584)

* Speed up parsing of gdb output strings by using indexes into the original string rather than creating new strings at each step.

* remove Trim that was causing tests to fail.

* Code review response

--- src/MICore/MIResults.cs
+++ src/MICore/MIResults.cs
@@ -596,6 +596,93 @@

     public class MIResults
     {
+        struct Span
+        {
+            static Span _emptySpan;
+            public int Start { get; private set; }  // index first character in the substring
+            public int Length { get; private set; } // length of the substring
+            public int Extent { get { return Start + Length; } }
+            public bool IsEmpty { get { return Length == 0; } }
+            public static Span Empty { get { return _emptySpan; } }
+
+            static Span()
+            {
+                _emptySpan = new Span(0, 0);
+            }
+
+            public Span(string s)
+            {
+                Start = 0;
+                Length = s.Length;
+            }
+            public Span(int start, int len)
+            {
+                if (start < 0)
+                {
+                    throw new ArgumentException("start");
+                }
+                Start = start;
+                Length = len;
+            }
+            public Span Advance(int len)
+            {
+                if (len > Length)
+                {
+                    throw new ArgumentException("len");
+                }
+                return new Span(Start + len, Length - len);
+            }
+            public Span AdvanceTo(int pos)
+            {
+                if (Start > pos || pos > Start + Length)
+                {
+                    throw new ArgumentException("pos");
+                }
+                return new Span(pos, Length - (pos - Start));
+            }
+            public Span Prefix(int len)
+            {
+                if (len > Length)
+                {
+                    throw new ArgumentException("len");
+                }
+                return new Span(Start, len);
+            }
+            public string Extract(string theString)
+            {
+                if (Extent > theString.Length)
+                {
+                    throw new ArgumentException("theSpan");
+                }
+                return theString.Substring(Start, Length);
+            }
+            public int IndexOf(string theString, char c)
+            {
+                int i = theString.IndexOf(c, Start);
+                if (i < 0 || i >= Extent)
+                {
+                    return -1;
+                }
+                return i - Start;   // Span relative offset
+            }
+            public bool StartsWith(string theString, string pattern)
+            {
+                if (Length < pattern.Length)
+                {
+                    return false;
+                }
+                for (int i = 0; i < pattern.Length; ++i)
+                {
+                    if (theString[Start + i] != pattern[i])
+                    {
+                        return false;
+                    }
+                }
+                return true;
+            }
+        }
+
+        private string _resultString;
         private Logger Logger { get; set; }

         public MIResults(Logger logger)
@@ -609,8 +696,8 @@
         /// <param name="output"></param>
         public Results ParseCommandOutput(string output)
         {
-            output = output.Trim();
-            int comma = output.IndexOf(',');
+            _resultString = output.Trim();
+            int comma = _resultString.IndexOf(',');
             Results results;
             ResultClass resultClass = ResultClass.None;
             if (comma < 0)
@@ -621,23 +708,29 @@
             else
             {
                 resultClass = ParseResultClass(output.Substring(0, comma));
-                results = ParseResultList(output.Substring(comma + 1), resultClass);
+                Span wholeString = new Span(_resultString);
+                results = ParseResultList(wholeString.AdvanceTo(comma + 1), resultClass);
             }
             return results;
         }

         public Results ParseResultList(string listStr, ResultClass resultClass = ResultClass.None)
         {
-            listStr = listStr.Trim();
-            string rest;
-            var list = ParseResultList((string s, ref int i) =>
+            _resultString = listStr.Trim();
+            return ParseResultList(new Span(_resultString), resultClass);
+        }
+
+        private Results ParseResultList(Span listStr, ResultClass resultClass = ResultClass.None)
+        {
+            Span rest;
+            var list = ParseResultList((Span s, ref int i) =>
                 {
                     return true;
-                }, (string s, ref int i) =>
+                }, (Span s, ref int i) =>
                     {
-                        return i == s.Length;
+                        return i == s.Extent;
                     }, listStr, out rest);
-            if (rest != String.Empty)
+            if (!rest.IsEmpty)
             {
                 ParseError("trailing chars", rest);
                 return null;
@@ -661,24 +754,41 @@
             {
                 return input;
             }
-            string rest;
-            var s = ParseCString(cstr, out rest);
+            _resultString = cstr;
+            Span rest;
+            var s = ParseCString(new Span(cstr), out rest);
             return s == null ? string.Empty : s.AsString;
         }

+        private string ParseCString(Span input)
+        {
+            if (input.IsEmpty)
+            {
+                return string.Empty;
+            }
+
+            if (_resultString[input.Start] != '\"')   // not a Cstring, just return the string
+            {
+                return input.Extract(_resultString);
+            }
+            Span rest;
+            var s = ParseCString(input, out rest);
+            return s == null ? string.Empty : s.AsString;
+        }
+
         /// <summary>
         /// value ==>const | tuple | list
         /// </summary>
         /// <returns></returns>
-        private ResultValue ParseValue(string resultStr, out string rest)
+        private ResultValue ParseValue(Span resultStr, out Span rest)
         {
             ResultValue value = null;
-            rest = String.Empty;
-            if (string.IsNullOrEmpty(resultStr))
-            {
-                return null;
-            }
-            switch (resultStr[0])
+            rest = Span.Empty;
+            if (resultStr.IsEmpty)
+            {
+                return null;
+            }
+            switch (_resultString[resultStr.Start])
             {
                 case '\"':
                     value = ParseCString(resultStr, out rest);
@@ -704,15 +814,15 @@
         ///     value -- const | tuple | tuplelist | list
         /// </summary>
         /// <returns></returns>
-        private ResultValue ParseResultValue(string resultStr, out string rest)
+        private ResultValue ParseResultValue(Span resultStr, out Span rest)
         {
             ResultValue value = null;
-            rest = String.Empty;
-            if (string.IsNullOrEmpty(resultStr))
-            {
-                return null;
-            }
-            switch (resultStr[0])
+            rest = Span.Empty;
+            if (resultStr.IsEmpty)
+            {
+                return null;
+            }
+            switch (_resultString[resultStr.Start])
             {
                 case '\"':
                     value = ParseCString(resultStr, out rest);
@@ -743,17 +853,17 @@
         /// </summary>
         /// <param name="resultStr">trimmed input string</param>
         /// <param name="rest">trimmed remainder after result</param>
-        private NamedResultValue ParseResult(string resultStr, out string rest)
-        {
-            rest = String.Empty;
-            int equals = resultStr.IndexOf('=');
+        private NamedResultValue ParseResult(Span resultStr, out Span rest)
+        {
+            rest = Span.Empty;
+            int equals = resultStr.IndexOf(_resultString, '=');
             if (equals < 1)
             {
                 ParseError("variable not found", resultStr);
                 return null;
             }
-            string name = resultStr.Substring(0, equals);
-            ResultValue value = ParseResultValue(resultStr.Substring(equals + 1), out rest);
+            string name = resultStr.Prefix(equals).Extract(_resultString);
+            ResultValue value = ParseResultValue(resultStr.Advance(equals + 1), out rest);
             if (value == null)
             {
                 return null;
@@ -778,25 +888,25 @@
             }
         }

-        private ConstValue ParseCString(string input, out string rest)
+        private ConstValue ParseCString(Span input, out Span rest)
         {
             rest = input;
-            StringBuilder output = new StringBuilder(input.Length);
-            if (String.IsNullOrEmpty(input) || input[0] != '\"')
+            StringBuilder output = new StringBuilder();
+            if (input.IsEmpty || _resultString[input.Start] != '\"')
             {
                 ParseError("Cstring expected", input);
                 return null;
             }
-            int i = 1;
+            int i = input.Start + 1;
             bool endFound = false;
-            for (; i < input.Length; i++)
-            {
-                char c = input[i];
+            for (; i < input.Extent; i++)
+            {
+                char c = _resultString[i];
                 if (c == '\"')
                 {
                     // closing quote, so we are (probably) done
                     i++;
-                    if ((i < input.Length) && (input[i] == c))
+                    if ((i < input.Extent) && (_resultString[i] == c))
                     {
                         // double quotes mean we emit a single quote, and carry on
                         ;
@@ -810,7 +920,7 @@
                 else if (c == '\\')
                 {
                     // escaped character
-                    c = input[++i];
+                    c = _resultString[++i];
                     switch (c)
                     {
                         case 'n': c = '\n'; break;
@@ -826,17 +936,17 @@
                 ParseError("CString not terminated", input);
                 return null;
             }
-            rest = input.Substring(i);
+            rest = input.AdvanceTo(i);
             return new ConstValue(output.ToString());
         }

-        private delegate bool EdgeCondition(string s, ref int i);
-
-        private List<NamedResultValue> ParseResultList(EdgeCondition begin, EdgeCondition end, string input, out string rest)
-        {
-            rest = string.Empty;
+        private delegate bool EdgeCondition(Span s, ref int i);
+
+        private List<NamedResultValue> ParseResultList(EdgeCondition begin, EdgeCondition end, Span input, out Span rest)
+        {
+            rest = Span.Empty;
             List<NamedResultValue> list = new List<NamedResultValue>();
-            int i = 0;
+            int i = input.Start;
             if (!begin(input, ref i))
             {
                 ParseError("Unexpected opening character", input);
@@ -844,10 +954,10 @@
             }
             if (end(input, ref i))    // tuple is empty
             {
-                rest = input.Substring(i);  // eat through the closing brace
+                rest = input.AdvanceTo(i);  // eat through the closing brace
                 return list;
             }
-            input = input.Substring(i);
+            input = input.AdvanceTo(i);
             var item = ParseResult(input, out rest);
             if (item == null)
             {
@@ -856,9 +966,9 @@
             }
             list.Add(item);
             input = rest;
-            while (!string.IsNullOrEmpty(input) && input[0] == ',')
-            {
-                item = ParseResult(input.Substring(1), out rest);
+            while (!input.IsEmpty && _resultString[input.Start] == ',')
+            {
+                item = ParseResult(input.Advance(1), out rest);
                 if (item == null)
                 {
                     ParseError("Result expected", input);
@@ -868,30 +978,30 @@
                 input = rest;
             }

-            i = 0;
+            i = input.Start;
             if (!end(input, ref i))    // tuple is not closed
             {
                 ParseError("Unexpected list termination", input);
-                rest = string.Empty;
-                return null;
-            }
-            rest = input.Substring(i);
+                rest = Span.Empty;
+                return null;
+            }
+            rest = input.AdvanceTo(i);
             return list;
         }

-        private List<NamedResultValue> ParseResultList(char begin, char end, string input, out string rest)
-        {
-            return ParseResultList((string s, ref int i) =>
-            {
-                if (s[i] == begin)
+        private List<NamedResultValue> ParseResultList(char begin, char end, Span input, out Span rest)
+        {
+            return ParseResultList((Span s, ref int i) =>
+            {
+                if (_resultString[i] == begin)
                 {
                     i++;
                     return true;
                 }
                 return false;
-            }, (string s, ref int i) =>
-            {
-                if (i < s.Length && s[i] == end)
+            }, (Span s, ref int i) =>
+            {
+                if (i < s.Extent && _resultString[i] == end)
                 {
                     i++;
                     return true;
@@ -904,7 +1014,7 @@
         /// tuple ==> "{}" | "{" result ( "," result )* "}"
         /// </summary>
         /// <returns>if one tuple found a TupleValue, otherwise a ValueListValue of TupleValues</returns>
-        private ResultValue ParseResultTuple(string input, out string rest)
+        private ResultValue ParseResultTuple(Span input, out Span rest)
         {
             var list = ParseResultList('{', '}', input, out rest);
             if (list == null)
@@ -913,12 +1023,12 @@
             }
             var tlist = new List<ResultValue>();
             TupleValue v;
-            while (rest.StartsWith(",{", StringComparison.Ordinal))
+            while (rest.StartsWith(_resultString, ",{"))
             {
                 // a tuple list
                 v = new TupleValue(list);
                 tlist.Add(v);
-                list = ParseResultList('{', '}', rest.Substring(1), out rest);
+                list = ParseResultList('{', '}', rest.Advance(1), out rest);
             }
             v = new TupleValue(list);
             if (tlist.Count != 0)
@@ -932,7 +1042,7 @@
         /// <summary>
         /// tuple ==> "{}" | "{" result ( "," result )* "}"
         /// </summary>
-        private TupleValue ParseTuple(string input, out string rest)
+        private TupleValue ParseTuple(Span input, out Span rest)
         {
             var list = ParseResultList('{', '}', input, out rest);
             if (list == null)
@@ -945,20 +1055,20 @@
         /// <summary>
         /// list ==> "[]" | "[" value ( "," value )* "]" | "[" result ( "," result )* "]"
         /// </summary>
-        private ResultValue ParseList(string input, out string rest)
-        {
-            rest = string.Empty;
-            if (input[0] != '[')
+        private ResultValue ParseList(Span input, out Span rest)
+        {
+            rest = Span.Empty;
+            if (_resultString[input.Start] != '[')
             {
                 ParseError("List expected", input);
                 return null;
             }
-            if (input[1] == ']')    // list is empty
-            {
-                rest = input.Substring(2);  // eat through the closing brace
+            if (_resultString[input.Start + 1] == ']')    // list is empty
+            {
+                rest = input.Advance(2);  // eat through the closing brace
                 return new ValueListValue(new List<ResultValue>());
             }
-            if (IsValueChar(input[1]))
+            if (IsValueChar(_resultString[input.Start + 1]))
             {
                 return ParseValueList(input, out rest);
             }
@@ -971,16 +1081,16 @@
         /// <summary>
         /// list ==>  "[" value ( "," value )* "]"
         /// </summary>
-        private ValueListValue ParseValueList(string input, out string rest)
-        {
-            rest = string.Empty;
+        private ValueListValue ParseValueList(Span input, out Span rest)
+        {
+            rest = Span.Empty;
             List<ResultValue> list = new List<ResultValue>();
-            if (input[0] != '[')
+            if (_resultString[input.Start] != '[')
             {
                 ParseError("List expected", input);
                 return null;
             }
-            input = input.Substring(1);
+            input = input.Advance(1);
             var item = ParseValue(input, out rest);
             if (item == null)
             {
@@ -989,9 +1099,9 @@
             }
             list.Add(item);
             input = rest;
-            while (!string.IsNullOrEmpty(input) && input[0] == ',')
-            {
-                item = ParseValue(input.Substring(1), out rest);
+            while (!input.IsEmpty && _resultString[input.Start] == ',')
+            {
+                item = ParseValue(input.Advance(1), out rest);
                 if (item == null)
                 {
                     ParseError("Value expected", input);
@@ -1001,20 +1111,20 @@
                 input = rest;
             }

-            if (input.Length == 0 || input[0] != ']')    // list is not closed
+            if (input.IsEmpty || _resultString[input.Start] != ']')    // list is not closed
             {
                 ParseError("List not terminated", input);
-                rest = string.Empty;
-                return null;
-            }
-            rest = input.Substring(1);
+                rest = Span.Empty;
+                return null;
+            }
+            rest = input.Advance(1);
             return new ValueListValue(list);
         }

         /// <summary>
         /// list ==>  "[" result ( "," result )* "]"
         /// </summary>
-        private ResultListValue ParseResultList(string input, out string rest)
+        private ResultListValue ParseResultList(Span input, out Span rest)
         {
             var list = ParseResultList('[', ']', input, out rest);
             if (list == null)
@@ -1024,11 +1134,16 @@
             return new ResultListValue(list);
         }

-        private void ParseError(string message, string input)
-        {
-            Debug.Fail(message + ": " + input);
+        private void ParseError(string message, Span input)
+        {
+            if (input.Length > 1000)
+            {
+                input = new Span(input.Start, 1000);    // don't show more than 1000 chars
+            }
+            string result = input.Extract(_resultString);
+            Debug.Fail(message + ": " + result);
 #if DEBUG
-            Logger?.WriteLine(String.Format(CultureInfo.CurrentCulture, "MI parsing error: {0}: \"{1}\"", message, input));
+            Logger?.WriteLine(String.Format(CultureInfo.CurrentCulture, "MI parsing error: {0}: \"{1}\"", message, result));
 #endif
         }
     }


Fix build

Fix build

--- src/MethodTimeLogger.cs
+++ src/MethodTimeLogger.cs
@@ -1,5 +1,5 @@
 using System.Reflection;
-using Catel.Logging;
+//using Catel.Logging;
 using System;

 /// <summary>
@@ -15,26 +15,26 @@

     public static void Log(Type type, string methodName, long milliseconds, string message)
     {
-        if (type is null)
-        {
-            return;
-        }
+        // if (type is null)
+        // {
+            // return;
+        // }

-        if (milliseconds == 0)
-        {
-            // Don't log superfast methods
-            return;
-        }
+        // if (milliseconds == 0)
+        // {
+            // // Don't log superfast methods
+            // return;
+        // }

-        var finalMessage = $"[METHODTIMER] {type.Name}.{methodName} took '{milliseconds}' ms";
+        // var finalMessage = $"[METHODTIMER] {type.Name}.{methodName} took '{milliseconds}' ms";

-        if (!string.IsNullOrWhiteSpace(message))
-        {
-            finalMessage += $" | {message}";
-        }
+        // if (!string.IsNullOrWhiteSpace(message))
+        // {
+            // finalMessage += $" | {message}";
+        // }

-        var logger = LogManager.GetLogger(type);
-        logger.Debug(finalMessage);
+        // var logger = LogManager.GetLogger(type);
+        // logger.Debug(finalMessage);
     }
     #endregion
 }


Change Assembly name

Change Assembly name

--- Properties/AssemblyInfo.cs
+++ Properties/AssemblyInfo.cs
@@ -7,7 +7,7 @@
 // associated with an assembly.
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ModelPredicates")]
+[assembly: AssemblyProduct("Sitko.ModelSelector")]
 [assembly: AssemblyTrademark("")]

 // Setting ComVisible to false makes the types in this assembly not visible


- release 4.39.2704

- release 4.39.2704

--- Properties/AssemblyInfo.cs
+++ Properties/AssemblyInfo.cs
@@ -9,7 +9,7 @@
 //      Revision -.Net framework

 //---------------------------- WinForms Viewer -------------------------------------------------
-[assembly: AssemblyInformationalVersion("4.38.2704")]  //Should be equal to the same property of Patagames.Pdf assembly
+[assembly: AssemblyInformationalVersion("4.39.2704")]  //Should be equal to the same property of Patagames.Pdf assembly
 [assembly: AssemblyVersion("4.10.11." +
 #if DOTNET20
 "20"


Remove debug code

Remove debug code

--- SPICA.WinForms/FrmMain.cs
+++ SPICA.WinForms/FrmMain.cs
@@ -283,8 +283,6 @@
                 }
             }

-            H3D.Save("D:\\recreated.bch", Scene);
-
             //Allow app to process click from the Open dialog that goes into the Viewport
             //This avoid the model from moving after opening a file on the dialog
             //(Note: The problem only happens if the dialog is on top of the Viewport)


Refactor ObjectCreationAnalyzer

Refactor ObjectCreationAnalyzer

--- Gu.Analyzers/NodeAnalyzers/ObjectCreationAnalyzer.cs
+++ Gu.Analyzers/NodeAnalyzers/ObjectCreationAnalyzer.cs
@@ -31,38 +31,49 @@
                 return;
             }

-            if (context.Node is ObjectCreationExpressionSyntax objectCreation &&
-                objectCreation.ArgumentList is ArgumentListSyntax argumentList &&
-                argumentList.Arguments.Count > 0 &&
-                context.ContainingSymbol is IMethodSymbol method)
+            if (context.Node is ObjectCreationExpressionSyntax objectCreation)
             {
-                if (context.SemanticModel.TryGetSymbol(objectCreation, KnownSymbol.ArgumentException, context.CancellationToken, out var ctor) ||
-                    context.SemanticModel.TryGetSymbol(objectCreation, KnownSymbol.ArgumentNullException, context.CancellationToken, out ctor) ||
-                    context.SemanticModel.TryGetSymbol(objectCreation, KnownSymbol.ArgumentOutOfRangeException, context.CancellationToken, out ctor))
+                if (objectCreation.ArgumentList is ArgumentListSyntax argumentList &&
+                    argumentList.Arguments.Count > 0 &&
+                    context.ContainingSymbol is IMethodSymbol method &&
+                    TryGetExceptionCtor(objectCreation, context, out var ctor) &&
+                    ctor.TryFindParameter("paramName", out var nameParameter))
                 {
-                    if (ctor.TryFindParameter("paramName", out var nameParameter))
+                    if (objectCreation.TryFindArgument(nameParameter, out var nameArgument) &&
+                        objectCreation.Parent is ThrowExpressionSyntax throwExpression &&
+                        throwExpression.Parent is BinaryExpressionSyntax binary &&
+                        binary.IsKind(SyntaxKind.CoalesceExpression) &&
+                        nameArgument.TryGetStringValue(context.SemanticModel, context.CancellationToken, out var name) &&
+                        binary.Left is IdentifierNameSyntax identifierName &&
+                        identifierName.Identifier.ValueText != name)
                     {
-                        if (objectCreation.TryFindArgument(nameParameter, out var nameArgument) &&
-                            objectCreation.Parent is ThrowExpressionSyntax throwExpression &&
-                            throwExpression.Parent is BinaryExpressionSyntax binary &&
-                            binary.IsKind(SyntaxKind.CoalesceExpression) &&
-                            nameArgument.TryGetStringValue(context.SemanticModel, context.CancellationToken, out var name) &&
-                            binary.Left is IdentifierNameSyntax identifierName &&
-                            identifierName.Identifier.ValueText != name)
-                        {
-                            var properties = ImmutableDictionary.CreateRange(new[] { new KeyValuePair<string, string>("Name", identifierName.Identifier.ValueText) });
-                            context.ReportDiagnostic(Diagnostic.Create(GU0013CheckNameInThrow.Descriptor, nameArgument.GetLocation(), properties));
-                        }
+                        var properties = ImmutableDictionary.CreateRange(
+                            new[] { new KeyValuePair<string, string>("Name", identifierName.Identifier.ValueText) });
+                        context.ReportDiagnostic(
+                            Diagnostic.Create(
+                                GU0013CheckNameInThrow.Descriptor,
+                                nameArgument.GetLocation(),
+                                properties));
+                    }

-                        if (TryGetWithParameterName(argumentList, method.Parameters, out var argument) &&
-                            argument.NameColon == null &&
-                            objectCreation.ArgumentList.Arguments.IndexOf(argument) != ctor.Parameters.IndexOf(nameParameter))
-                        {
-                            context.ReportDiagnostic(Diagnostic.Create(GU0005ExceptionArgumentsPositions.Descriptor, argument.GetLocation()));
-                        }
+                    if (TryGetWithParameterName(argumentList, method.Parameters, out var argument) &&
+                        argument.NameColon == null &&
+                        objectCreation.ArgumentList.Arguments.IndexOf(argument) != ctor.Parameters.IndexOf(nameParameter))
+                    {
+                        context.ReportDiagnostic(
+                            Diagnostic.Create(
+                                GU0005ExceptionArgumentsPositions.Descriptor,
+                                argument.GetLocation()));
                     }
                 }
             }
+        }
+
+        private static bool TryGetExceptionCtor(ObjectCreationExpressionSyntax objectCreation, SyntaxNodeAnalysisContext context, out IMethodSymbol ctor)
+        {
+            return context.SemanticModel.TryGetSymbol(objectCreation, KnownSymbol.ArgumentException, context.CancellationToken, out ctor) ||
+                   context.SemanticModel.TryGetSymbol(objectCreation, KnownSymbol.ArgumentNullException, context.CancellationToken, out ctor) ||
+                   context.SemanticModel.TryGetSymbol(objectCreation, KnownSymbol.ArgumentOutOfRangeException, context.CancellationToken, out ctor);
         }

         private static bool TryGetWithParameterName(ArgumentListSyntax argumentList, ImmutableArray<IParameterSymbol> parameters, out ArgumentSyntax argument)


Space walk progress

Space walk progress

--- UnityProject/Assets/Scripts/PlayGroups/PlayerSync.cs
+++ UnityProject/Assets/Scripts/PlayGroups/PlayerSync.cs
@@ -13,10 +13,12 @@
 	{
 		public int MoveNumber;
 		public Vector3 Position;
+		//todo add speed
+		public Vector2 Impulse; //Direction of flying

 		public override string ToString()
 		{
-			return $"[Move: {MoveNumber}, Pos: {Position}]";
+			return $"{nameof( MoveNumber )}: {MoveNumber}, {nameof( Position )}: {Position}, {nameof( Impulse )}: {Impulse}";
 		}
 	}

@@ -36,7 +38,6 @@
 		//TODO: Remove the space damage coroutine when atmos is implemented
 		private bool isApplyingSpaceDmg;

-		private Vector2 lastDirection;//fixme: lastDirection is questionable, make a field for server?

 		private Matrix matrix => registerTile.Matrix;

@@ -58,19 +59,21 @@
 		private PushPull pushPull; //The pushpull component on this player
 		private RegisterTile registerTile;

-		//Client-only states, don't concern server
+		//Client-only fields, don't concern server
 		private PlayerState playerState;
 		private PlayerState predictedState;
 		private Queue<PlayerAction> pendingActions;
+		private Vector2 lastDirection;

-		//Server-only states, don't concern player in any way
+		//Server-only fields, don't concern clients in any way
 		private PlayerState serverTargetState;
 		private PlayerState serverState;
 		private Queue<PlayerAction> serverPendingActions;
-		[SyncVar][Obsolete] private PlayerState serverStateCache; 	//todo: get rid of it
+		[SyncVar][Obsolete] private PlayerState serverStateCache; 	//todo: get rid of it, it actually concerns clients
 		private readonly int maxServerQueue = 10;
 		private readonly int maxWarnings = 3;
 		private int playerWarnings;
+		private Vector2 serverLastDirection;

 		public override void OnStartServer()
 		{
@@ -79,12 +82,47 @@
 			base.OnStartServer();
 		}

+			Vector3 size1 = Vector3.one;
+			Vector3 size2 = new Vector3(0.9f,0.9f,0.9f);
+			Vector3 size3 = new Vector3(0.8f,0.8f,0.8f);
+			Vector3 size4 = new Vector3(0.7f,0.7f,0.7f);
+			Color color1 = Color.red;
+			Color color2 = hexToColor("fd7c6e");
+			Color color3 = hexToColor("4d9900");
+			Color color4 = hexToColor("a9ff3e");
+
+		public static Color hexToColor(string hex)
+		{
+			hex = hex.Replace ("0x", "");//in case the string is formatted 0xFFFFFF
+			hex = hex.Replace ("#", "");//in case the string is formatted #FFFFFF
+			byte a = 255;//assume fully visible unless specified in hex
+			byte r = byte.Parse(hex.Substring(0,2), System.Globalization.NumberStyles.HexNumber);
+			byte g = byte.Parse(hex.Substring(2,2), System.Globalization.NumberStyles.HexNumber);
+			byte b = byte.Parse(hex.Substring(4,2), System.Globalization.NumberStyles.HexNumber);
+			//Only use alpha if the string has enough characters
+			if(hex.Length == 8){
+				a = byte.Parse(hex.Substring(6,2), System.Globalization.NumberStyles.HexNumber);
+			}
+			return new Color32(r,g,b,a);
+		}
 		private void OnDrawGizmos()
 		{
-			Gizmos.color = Color.green;
-			Gizmos.DrawWireCube(serverState.Position - CustomNetTransform.deOffset, Vector3.one);
-			Gizmos.color = Color.red;
-			Gizmos.DrawWireCube(serverTargetState.Position - CustomNetTransform.deOffset, Vector3.one);
+			//server target state
+			Gizmos.color = color1;
+			Gizmos.DrawWireCube(serverTargetState.Position - CustomNetTransform.deOffset, size1);
+
+			//actual server state
+			Gizmos.color = color2;
+			Gizmos.DrawWireCube(serverState.Position - CustomNetTransform.deOffset, size2);
+
+			//client predicted state
+			Gizmos.color = color3;
+			Gizmos.DrawWireCube(predictedState.Position - CustomNetTransform.deOffset, size3);
+
+			//client actual state
+			Gizmos.color = color4;
+			Gizmos.DrawWireCube(playerState.Position - CustomNetTransform.deOffset, size4);
+
 		}

 		public override void OnStartClient()
@@ -271,10 +309,10 @@
 				//Check if we should still be displaying an ItemListTab and update it, if so.
 				ControlTabs.CheckItemListTab();

-				if (state.Position != transform.localPosition)
-				{
-					lastDirection = (state.Position - transform.localPosition).normalized;
-				}
+//				if (state.Position != transform.localPosition)
+//				{
+//					lastDirection = (state.Position - transform.localPosition).normalized;
+//				}

 				if (PullingObject != null)
 				{
@@ -341,8 +379,10 @@
 			var nextAction = serverPendingActions.Peek();
 			if ( !PointlessMove(serverTargetState, nextAction) )
 			{
-				serverTargetState = NextState(serverTargetState, serverPendingActions.Dequeue());
-				Debug.Log($"Server Updated target {serverTargetState}. {serverPendingActions.Count} pending");
+				PlayerState nextState = NextState(serverTargetState, serverPendingActions.Dequeue());
+				serverLastDirection = Vector2Int.RoundToInt(nextState.Position - serverTargetState.Position);
+				serverTargetState = nextState;
+//				Debug.Log($"Server Updated target {serverTargetState}. {serverPendingActions.Count} pending");
 			} else {
 				Debug.LogWarning($"Pointless move {serverTargetState}+{nextAction.keyCodes[0]} Rolling back to {serverState}");
 				RollbackPosition();
@@ -461,6 +501,8 @@
 					bool isReplay = predictedState.MoveNumber <= curPredictedMove;
 					tempState = NextState(tempState, action, isReplay);
 				}
+
+				lastDirection = Vector2Int.RoundToInt(tempState.Position - predictedState.Position);

 				predictedState = tempState;
 //				Debug.Log($"Redraw prediction: {playerState}->{predictedState}({pendingActions.Count} steps) ");
@@ -515,7 +557,7 @@
 		public void UpdateClientState(PlayerState state)
 		{
 			playerState = state;
-//			Debug.Log($"Got server update {playerState}");
+			Debug.Log($"Got server update {playerState}");
 			if (pendingActions != null)
 			{
 				//invalidate queue if serverstate was never predicted
@@ -524,6 +566,7 @@
 				if ( serverAhead || posMismatch ){
 					Debug.LogWarning($"serverAhead={serverAhead}, posMismatch={posMismatch}");
 					ResetClientQueue();
+					predictedState = playerState;
 				} else {
 					//removing actions already acknowledged by server from pending queue
 					while (pendingActions.Count > 0 && pendingActions.Count > predictedState.MoveNumber - playerState.MoveNumber)
@@ -558,7 +601,6 @@
 			return new Vector3(Mathf.Round(pos.x), Mathf.Round(pos.y), pos.z);
 		}

-		//FIXME: should be serverside
 		private void CheckSpaceWalk()
 		{
 			if (matrix == null)
@@ -568,10 +610,24 @@

 			if (isServer)
 			{
+				//moving server target further and letting serverState lerp to it
 				if (matrix.IsFloatingAt(Vector3Int.RoundToInt(serverTargetState.Position)))
 				{
-					serverTargetState.Position = Vector3Int.RoundToInt(serverTargetState.Position + (Vector3) lastDirection);
+					if ( !IsFloating() )
+					{
+						//initiate floating
+						serverTargetState.Impulse = serverLastDirection;
+						//notify players that we started floating
+						NotifyPlayers();
+					}
+					//continue floating
+					serverTargetState.Position = Vector3Int.RoundToInt(serverTargetState.Position + (Vector3) serverTargetState.Impulse);
 					ClearPendingServer();
+				}
+				else if ( IsFloating() )
+				{
+					//finish floating. players will be notified as soon as serverState catches up
+					serverTargetState.Impulse = Vector2.zero;
 				}
 			}
 			Vector3Int pos = Vector3Int.RoundToInt(transform.localPosition);
@@ -588,16 +644,23 @@
 //				}

 				Vector3Int newGoal = Vector3Int.RoundToInt(transform.localPosition + (Vector3) lastDirection);
-				playerState.Position = newGoal;
+//				playerState.Position = newGoal;
 				predictedState.Position = newGoal;
 			}
-			if (matrix.IsSpaceAt(pos) && !healthBehaviorScript.IsDead && CustomNetworkManager.Instance._isServer
-			    && !isApplyingSpaceDmg)
+			if (matrix.IsSpaceAt(pos) && !healthBehaviorScript.IsDead && isServer && !isApplyingSpaceDmg)
 			{
 				//Hurting people in space even if they are next to the wall
 				StartCoroutine(ApplyTempSpaceDamage());
 				isApplyingSpaceDmg = true;
 			}
+		}
+		public bool IsFloating()
+		{
+			if (isServer)
+			{
+				return serverState.Impulse != Vector2.zero;
+			}
+			return playerState.Impulse != Vector2.zero;
 		}

 		//TODO: Remove this when atmos is implemented


Changed the Exception catalog check to ignore missing file exceptions but still throw other exceptions. This is because the missing file is somewhat expected at the current time when the program is run without the exceptions.bin file.

--- src/lib/Microsoft.Fx.Portability.Offline/Data.cs
+++ src/lib/Microsoft.Fx.Portability.Offline/Data.cs
@@ -8,6 +8,7 @@
 using System.Globalization;
 using System.IO;
 using System.Linq;
+using System.Net;
 using System.Reflection;

 namespace Microsoft.Fx.Portability
@@ -32,10 +33,12 @@
                     catalog.Exceptions = stream.DecompressToObject<List<ApiExceptionStorage>>();
                 }
             }
+            catch (PortabilityAnalyzerException e) { }
             catch
             {
-                return null;
+                throw;
             }
+
             return catalog;
         }


Throw error now

Throw error now

--- HolyNoodle.Utility/HolyNoodle.Utility/DAL/AzureDB.cs
+++ HolyNoodle.Utility/HolyNoodle.Utility/DAL/AzureDB.cs
@@ -179,8 +179,7 @@
                 }
                 catch (Exception e)
                 {
-                    int i = 0;
-
+                    throw e;
                 }
             }


Added TODO for mono

Added TODO for mono

--- ILRepack.IntegrationTests/Peverify/PeverifyHelper.cs
+++ ILRepack.IntegrationTests/Peverify/PeverifyHelper.cs
@@ -20,6 +20,7 @@
         public static IObservable<string> Peverify(string workingDirectory, params string[] args)
         {
             // TODO better path finding ?
+            // TODO use pedump --verify code,metadata on Mono ?
             var verifierPath = @"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\peverify.exe";
             var arg = $"\"{verifierPath}\" /NOLOGO {String.Join(" ", args)}";
             var info = new ProcessStartInfo


Added place to output products

Added place to output products

--- VendingMachine/VendingMachine.Core/VendingMachine.cs
+++ VendingMachine/VendingMachine.Core/VendingMachine.cs
@@ -12,11 +12,14 @@
     {
         private readonly List<Coin> _coins = new List<Coin>();
         private readonly List<Coin> _returnTray = new List<Coin>();
+        private readonly List<string> _output = new List<string>();

         public IEnumerable<Coin> ReturnTray => _returnTray;
+        public IEnumerable<string> Output => _output;

-        public void Dispense(string soda)
+        public void Dispense(string sku)
         {
+            _output.Add(sku);
         }

         public void Accept(Coin coin)


Changed return type

Changed return type

--- WeatherApp/Controllers/ExternalSettingsController.cs
+++ WeatherApp/Controllers/ExternalSettingsController.cs
@@ -119,8 +119,8 @@
         /// <param name="tokenType"></param>
         /// <param name="scope"></param>
         /// <param name="refreshToken"></param>
-		[HttpPost]
-        public SendInfo RetrieveUserSettings(string accessToken, string expiresIn, string tokenType, string scope, string refreshToken)
+        [HttpPost]
+        public JsonResult RetrieveUserSettings(string accessToken, string expiresIn, string tokenType, string scope, string refreshToken)
         {
             TokenInfo tokenInfo = new TokenInfo()
             {
@@ -133,7 +133,7 @@

             SendInfo sendInfo = settingsService.GetUserSettings(tokenInfo);

-            return sendInfo;
+            return Json(sendInfo, JsonRequestBehavior.AllowGet);
         }
     }
 }


modified Plan Controller

modified Plan Controller

--- Web/Areas/EarlyWarning/Controllers/PlanController.cs
+++ Web/Areas/EarlyWarning/Controllers/PlanController.cs
@@ -81,6 +81,7 @@

                     try
                     {
+                        plan.EndDate = endDate;
                         plan.Status = (int) PlanStatus.Draft;
                         _planService.AddPlan(plan);
                         return RedirectToAction("Index");


Splitting escaped search terms causes QueryParser.Parse to throw at escape boundaries. Therefore we need to escape individual search terms separately

--- Website/Infrastructure/Lucene/LuceneSearchService.cs
+++ Website/Infrastructure/Lucene/LuceneSearchService.cs
@@ -90,8 +90,6 @@
             var fields = new Dictionary<string, float> { { "Id", 1.2f }, { "Title", 1.0f }, { "Tags", 0.8f }, { "Description", 0.1f },
                                                          { "Author", 1.0f } };
             var analyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion);
-            searchTerm = QueryParser.Escape(searchTerm).ToLowerInvariant();
-
             var queryParser = new MultiFieldQueryParser(LuceneCommon.LuceneVersion, fields.Keys.ToArray(), analyzer, fields);

             var conjuctionQuery = new BooleanQuery();
@@ -100,9 +98,12 @@
             disjunctionQuery.SetBoost(0.1f);
             var wildCardQuery = new BooleanQuery();
             wildCardQuery.SetBoost(0.5f);
-            var exactIdQuery = new TermQuery(new Term("Id-Exact", searchTerm));
+
+            // Escape the entire term we use for exact searches.
+            var escapedSearchTerm = Escape(searchTerm);
+            var exactIdQuery = new TermQuery(new Term("Id-Exact", escapedSearchTerm));
             exactIdQuery.SetBoost(2.5f);
-            var wildCardIdQuery = new WildcardQuery(new Term("Id-Exact", "*" + searchTerm + "*"));
+            var wildCardIdQuery = new WildcardQuery(new Term("Id-Exact", "*" + escapedSearchTerm + "*"));

             foreach(var term in GetSearchTerms(searchTerm))
             {
@@ -127,7 +128,13 @@
         {
             return searchTerm.Split(new[] { ' ', '.', '-' }, StringSplitOptions.RemoveEmptyEntries)
                              .Concat(new[] { searchTerm })
-                             .Distinct(StringComparer.OrdinalIgnoreCase);
+                             .Distinct(StringComparer.OrdinalIgnoreCase)
+                             .Select(Escape);
+        }
+
+        private static string Escape(string term)
+        {
+            return QueryParser.Escape(term).ToLowerInvariant();
         }
     }
 }


MapRender: fix loading bgm with uol link, #117

--- WzComparerR2.MapRender/FrmMapRender2.SceneManager.cs
+++ WzComparerR2.MapRender/FrmMapRender2.SceneManager.cs
@@ -128,6 +128,10 @@
                 var bgmNode = PluginManager.FindWz(string.Join("\\", path));
                 if (bgmNode != null)
                 {
+                    while (bgmNode.Value is Wz_Uol uol)
+                    {
+                        bgmNode = uol.HandleUol(bgmNode);
+                    }
                     var bgm = resLoader.Load<Music>(bgmNode);
                     bgm.IsLoop = true;
                     return bgm;


timeCache: allow resetting

timeCache: allow resetting

--- RabbitHarness/TimeCache.cs
+++ RabbitHarness/TimeCache.cs
@@ -6,15 +6,21 @@
 {
 	public class TimeCache
 	{
-		private static readonly Lazy<DateTime> Start;
+		private static Lazy<DateTime> _start;
 		private static readonly Stopwatch Stopwatch;

 		static TimeCache()
 		{
 			Stopwatch = new Stopwatch();
-			Start = new Lazy<DateTime>(() =>
+			Reset();
+		}
+
+		public static void Reset()
+		{
+			_start = new Lazy<DateTime>(() =>
 			{
 				var nt = new NetworkTime();
+
 				Stopwatch.Start();
 				return nt.GetNetworkTime();
 			});
@@ -22,7 +28,7 @@

 		public static AmqpTimestamp Now()
 		{
-			var now = Start.Value.AddMilliseconds(Stopwatch.ElapsedMilliseconds);
+			var now = _start.Value.AddMilliseconds(Stopwatch.ElapsedMilliseconds);

 			return new AmqpTimestamp((long)(now - NetworkTime.Epoch).TotalSeconds);
 		}


Add TUNNEL_CLIENT_ENDPOINT

Add TUNNEL_CLIENT_ENDPOINT

See : https://tools.ietf.org/html/rfc2868

--- Radius/Enum/RadiusEnums.cs
+++ Radius/Enum/RadiusEnums.cs
@@ -82,6 +82,7 @@
 		LOGIN_LAT_PORT = 63,
 		TUNNEL_TYPE = 64,
 		TUNNEL_MEDIUM_TYPE = 65,
+		TUNNEL_CLIENT_ENDPOINT = 66,
 		ARAP_PASSWORD = 70,
 		ARAP_FEATURES = 71,
 		ARAP_ZONE_ACCESS = 72,
@@ -220,4 +221,4 @@
 		BanyanVines,
 		E164_NSAP
 	}
-}+}


small format

small format

--- RepoStats/HtmlTemplates.cs
+++ RepoStats/HtmlTemplates.cs
@@ -283,7 +283,9 @@
               none;border-bottom:solid #BDD6EE 1.0pt;border-right:solid #BDD6EE 1.0pt;
               padding:0in 5.4pt 0in 5.4pt'>

{3}

+              normal'>
+                {3}
+

";


More Whois stuff

More Whois stuff

--- src/PowerPing/Helper.cs
+++ src/PowerPing/Helper.cs
@@ -39,8 +39,8 @@
     /// </summary>
     public static class Helper
     {
-        // Whois server to query addresses against
-        public const string WHOIS_SERVER = "whois.iana.org";
+        // Root Whois server to query addresses against
+        public const string ROOT_WHOIS_SERVER = "whois.iana.org";

         /// <summary>
         /// Gets location information about IP Address
@@ -68,7 +68,7 @@
                         foreach (XmlElement element in elements) {
                             Console.WriteLine(element.Name + ": " + (element.InnerText == "" ? "NA" : element.InnerText));
                         }
-                        Console.WriteLine(WhoisLookup("whois.verisign-grs.com", addr));
+                        Console.WriteLine(PerformWhoIsLookup("whois.verisign-grs.com", addr));
                     } else {
                         if (elements[2].InnerText != "") {
                             loc = "[" + elements[2].InnerText;
@@ -185,14 +185,24 @@
         }

         /// <summary>
-        /// Queries site information using a up a website on a whois server
+        ///
+        /// </summary>
+        /// <param name="address"></param>
+        /// <returns></returns>
+        public static string WhoIs(string address)
+        {
+
+        }
+
+        /// <summary>
+        /// Queries a whois server for information on a server
         /// (https://en.wikipedia.org/wiki/WHOIS)
         /// </summary>
         /// <param name="server">Address of whois server to use</param>
         /// <param name="query">Query string to send to server</param>
         /// <source>http://nathanenglert.com/2015/05/25/creating-an-app-to-find-that-domain-youve-always-wanted/</source>
         /// <returns></returns>
-        public static string WhoisLookup(string server, string query)
+        private static string PerformWhoIsLookup(string server, string query)
         {
             StringBuilder result = new StringBuilder();


Use more data from companion API.

Use more data from companion API.

--- ShipMonitor/ShipMonitor.cs
+++ ShipMonitor/ShipMonitor.cs
@@ -259,7 +259,14 @@
             // TODO Rationalise companion API data - munge the JSON according to the compartment information, removing anything tht is out-of-sync
             if (profile.Ship != null)
             {
-                GetShip(profile.Ship.LocalId).raw = profile.Ship.raw;
+                Ship ship = GetShip(profile.Ship.LocalId);
+                ship.raw = profile.Ship.raw;
+                if (ship.model == null)
+                {
+                    // We don't know this ship's model but can fill it from the info we have
+                    ship.model = profile.Ship.model;
+                    ship.Augment();
+                }
             }

             foreach (Ship profileShip in profile.Shipyard)
@@ -268,6 +275,12 @@
                 if (ship != null)
                 {
                     ship.raw = profileShip.raw;
+                    if (ship.model == null)
+                    {
+                        // We don't know this ship's model but can fill it from the info we have
+                        ship.model = profileShip.model;
+                        ship.Augment();
+                    }
                 }
             }


(TFS CS 4358)

(TFS CS 4358)

--- Signum.Web/Modification.cs
+++ Signum.Web/Modification.cs
@@ -361,7 +361,7 @@
             Fill(formValues, interval);
         }

-        private void Fill(SortedList<string, object> formValues, Interval<int> interval)
+        protected void Fill(SortedList<string, object> formValues, Interval<int> interval)
         {
             int propertyStart = ControlID.Length + TypeContext.Separator.Length;


Bug fix for mag

Bug fix for mag

Removed the check biome method

--- Source/DMMagBoomModule.cs
+++ Source/DMMagBoomModule.cs
@@ -164,16 +164,16 @@
             }
         }

-        public void BiomeCheck()
-        {
-            print(FlightGlobals.currentMainBody.BiomeMap.GetAtt(vessel.latitude * Mathf.Deg2Rad, vessel.longitude * Mathf.Deg2Rad).name + FlightGlobals.currentMainBody.GetComponentsInChildren<PQSCity>().ToString());
-        }
-
-        [KSPEvent(guiActive = true, guiName = "Check Biome", active = true)]
-        public void currentBiome()
-        {
-            BiomeCheck();
-        }
+        //public void BiomeCheck()
+        //{
+        //    print(FlightGlobals.currentMainBody.BiomeMap.GetAtt(vessel.latitude * Mathf.Deg2Rad, vessel.longitude * Mathf.Deg2Rad).name + FlightGlobals.currentMainBody.GetComponentsInChildren<PQSCity>().ToString());
+        //}
+
+        //[KSPEvent(guiActive = true, guiName = "Check Biome", active = true)]
+        //public void currentBiome()
+        //{
+        //    BiomeCheck();
+        //}

         //[KSPEvent(guiActive = true, guiName = "Check Position", active = true)]
         //public void CheckPosition()


Corrected bugs in SmartDate regarding constructor failures, and formatting issues.

--- csla20cs/Csla/SmartDate.cs
+++ csla20cs/Csla/SmartDate.cs
@@ -29,7 +29,7 @@
     public SmartDate(bool emptyIsMin)
     {
       _emptyIsMax = !emptyIsMin;
-      _format = String.Empty;
+      _format = null;
       _initialized = false;
       if (!_emptyIsMax)
         _date = DateTime.MinValue;
@@ -48,9 +48,10 @@
     public SmartDate(DateTime value)
     {
       _emptyIsMax = false;
-      _format = String.Empty;
+      _format = null;
       _initialized = false;
-      _date = value;
+      _date = DateTime.MinValue;
+      Date = value;
     }

     /// <summary>
@@ -61,9 +62,10 @@
     public SmartDate(DateTime value, bool emptyIsMin)
     {
       _emptyIsMax = !emptyIsMin;
-      _format = String.Empty;
+      _format = null;
       _initialized = false;
-      _date = value;
+      _date = DateTime.MinValue;
+      Date = value;
     }

     /// <summary>
@@ -77,7 +79,7 @@
     public SmartDate(string value)
     {
       _emptyIsMax = false;
-      _format = String.Empty;
+      _format = null;
       _initialized = true;
       _date = DateTime.MinValue;
       this.Text = value;
@@ -91,7 +93,7 @@
     public SmartDate(string value, bool emptyIsMin)
     {
       _emptyIsMax = !emptyIsMin;
-      _format = String.Empty;
+      _format = null;
       _initialized = true;
       _date = DateTime.MinValue;
       this.Text = value;
@@ -117,7 +119,7 @@
       get
       {
         if (_format == null)
-          _format = "Short date";
+          _format = "{0:d}";
         return _format;
       }
       set


omg got it working

omg got it working

--- Source/RotationAverager.cs
+++ Source/RotationAverager.cs
@@ -1,5 +1,6 @@
 using System.Collections.Generic;
-using System.Diagnostics;
+using System.Diagnostics;
+using System;

 namespace AverageBuddy
 {
@@ -41,14 +42,14 @@
 				float prevRotation = History[NextIndex];

 				//get the difference between that one and this one
-				if ((prevRotation - mostRecentValue) > 180.0f)
+				if ((prevRotation - mostRecentValue) > Math.PI)
 				{
 					//put in a valid range
-					mostRecentValue += 360.0f;
+					mostRecentValue += (float)(2.0 * Math.PI);
 				}
-				else if ((prevRotation - mostRecentValue) < -180.0f)
+				else if ((prevRotation - mostRecentValue) < -Math.PI)
 				{
-					mostRecentValue -= 360.0f;
+					mostRecentValue -= (float)(2.0 * Math.PI);
 				}
 			}


Update Courses.cs

Update Courses.cs

--- courses/Courses.cs
+++ courses/Courses.cs
@@ -22,39 +22,155 @@
 	/// <summary> "This method returns all available information for a given course" (Offical Documentation) </summary>
 	public class CourseInformation
 	{
-		public string course_id { get; set; }
-		public string subject { get; set; }
-		public string catalog_number { get; set; }
-		public string title { get; set; }
-		public double units { get; set; }
-		public string description { get; set; }
-		public List<string> instructions { get; set; }
-		public string prerequisites { get; set; }
-		public string antirequisites { get; set; }
-		public string corequisites { get; set; }
-		public object crosslistings { get; set; }
-		public List<string> terms_offered { get; set; }
-		public string notes { get; set; }
-		public Offerings offerings { get; set; }
-		public bool needs_department_consent { get; set; }
-		public bool needs_instructor_consent { get; set; }
-		public List<object> extra { get; set; }
-		public string calendar_year { get; set; }
-		public string url { get; set; }
-		public string academic_level { get; set; }
+		[JsonProperty("course_id")]
+		public string CourseId { get; set; }
+		public string Subject { get; set; }
+		[JsonProperty("catalog_number")]
+		public string CatalogNumber { get; set; }
+		public string Title { get; set; }
+		public double Units { get; set; }
+		public string Description { get; set; }
+		public List<string> Instructions { get; set; }
+		public string Prerequisites { get; set; }
+		public string Antirequisites { get; set; }
+		public string Corequisites { get; set; }
+		public object Crosslistings { get; set; }
+		[JsonProperty("terms_offered")]
+		public List<string> TermsOffered { get; set; }
+		public string Notes { get; set; }
+		public Offerings Offerings { get; set; }
+		[JsonProperty("needs_department_consent")]
+		public bool NeedsDepartmentConsent { get; set; }
+		[JsonProperty("needs_instructor_consent")]
+		public bool NeedsInstructorConsent { get; set; }
+		public List<object> Extra { get; set; }
+		[JsonProperty("calendar_year")]
+		public string CalendarYear { get; set; }
+		public string Url { get; set; }
+		[JsonProperty("academic_level")]
+		public string AcademicLevel { get; set; }
 	}

 	/// <summary> "Brief course description" (Offical Documentation) </summary>
 	public class Offerings
 	{
-		public bool online { get; set; }
-		public bool online_only { get; set; }
-		public bool st_jerome { get; set; }
-		public bool st_jerome_only { get; set; }
-		public bool renison { get; set; }
-		public bool renison_only { get; set; }
-		public bool conrad_grebel { get; set; }
-		public bool conrad_grebel_only { get; set; }
+		[JsonProperty("online")]
+		public bool Online { get; set; }
+		[JsonProperty("online_only")]
+		public bool OnlineOnly { get; set; }
+		[JsonProperty("st_jerome")]
+		public bool StJerome { get; set; }
+		[JsonProperty("st_jerome_only")]
+		public bool StJeromeOnly { get; set; }
+		[JsonProperty("renison")]
+		public bool Renison { get; set; }
+		[JsonProperty("renison_only")]
+		public bool RenisonOnly { get; set; }
+		[JsonProperty("conrad_grebel")]
+		public bool ConradGrebel { get; set; }
+		[JsonProperty("conrad_grebel_only")]
+		public bool ConradGrebelOnly { get; set; }
+	}
+
+	/// <summary> "This method returns the class schedule for a given course and term" (Offical Documentation) </summary>
+	public class CourseSchedule
+	{
+		public string Subject { get; set; }
+		[JsonProperty("catalog_number")]
+		public string CatalogNumber { get; set; }
+		public double Units { get; set; }
+		public string Title { get; set; }
+		public object Note { get; set; }
+		[JsonProperty("class_number")]
+		public int ClassNumber { get; set; }
+		public string Section { get; set; }
+		public string Campus { get; set; }
+		[JsonProperty("associated_class")]
+		public int AssociatedClass { get; set; }
+		[JsonProperty("related_component_1")]
+		public object RelatedComponent1 { get; set; }
+		[JsonProperty("related_component_2")]
+		public object RelatedComponent2 { get; set; }
+		[JsonProperty("enrollment_capacity")]
+		public int EnrollmentCapacity { get; set; }
+		[JsonProperty("enrollment_total")]
+		public int EnrollmentTotal { get; set; }
+		[JsonProperty("waiting_capacity")]
+		public int WaitingCapacity { get; set; }
+		[JsonProperty("waiting_total")]
+		public int WaitingTotal { get; set; }
+		public object Topic { get; set; }
+		public List<object> Reserves { get; set; }
+		public List<Class> Classes { get; set; }
+		[JsonProperty("held_with")]
+		public List<string> HeldWith { get; set; }
+		public int Term { get; set; }
+		[JsonProperty("academic_level")]
+		public string AcademicLevel { get; set; }
+		[JsonProperty("last_updated")]
+		public string LastUpdated { get; set; }
+	}
+
+	public class Dates
+	{
+		[JsonProperty("start_time")]
+		public string StartTime { get; set; }
+		[JsonProperty("end_time")]
+		public string EndTime { get; set; }
+		public string Weekdays { get; set; }
+		[JsonProperty("start_date")]
+		public object StartDate { get; set; }
+		[JsonProperty("end_date")]
+		public object EndDate { get; set; }
+		[JsonProperty("_tba")]
+		public bool IsTba { get; set; }
+		[JsonProperty("is_cancelled")]
+		public bool IsCancelled { get; set; }
+		[JsonProperty("is_closed")]
+		public bool IsClosed { get; set; }
+	}
+
+	public class Location
+	{
+		public string Building { get; set; }
+		public string Room { get; set; }
+	}
+
+	public class Class
+	{
+		public Dates Dates { get; set; }
+		public Location Location { get; set; }
+		public List<string> Instructors { get; set; }
+	}
+
+	public class CoursePrerequisites
+	{
+		public string Subject { get; set; }
+		[JsonProperty("catalog_number")]
+		public string CatalogNumber { get; set; }
+		public string Title { get; set; }
+		public string Prerequisites { get; set; }
+		[JsonProperty("prerequisites_parsed")]
+		public List<List<object>> PrerequisitesParsed { get; set; }
+	}
+
+	public class CourseSection
+	{
+		public string Section { get; set; }
+		public string Day { get; set; }
+		public string Date { get; set; }
+		[JsonProperty("start_time")]
+		public string StartTime { get; set; }
+		[JsonProperty("end_time")]
+		public string EndTime { get; set; }
+		public string Location { get; set; }
+		public string Notes { get; set; }
+	}
+
+	public class ExamSchedule
+	{
+		public string Course { get; set; }
+		public List<CourseSection> Sections { get; set; }
 	}

 	/// <summary>
@@ -75,19 +191,75 @@
 		/// <summary>
 		/// todo
 		/// </summary>
+		/// <param name="subject"></param>
 		/// <returns></returns>
 		public ApiRequest<CourseSubject> Subject(string subject)
 		{
-			return ApiRequest<CourseSubject>.CreateApiRequest(string.Concat("/courses", "/", subject), _apiKey);
-		}
-
-		/// <summary>
-		/// todo
-		/// </summary>
+			return ApiRequest<CourseSubject>.CreateApiRequest(string.Concat("/courses/", subject), _apiKey);
+		}
+
+		/// <summary>
+		/// todo
+		/// </summary>
+		/// <param name="courseId"></param>
 		/// <returns></returns>
 		public ApiRequest<CourseInformation> CourseInformation(string courseId)
 		{
-			return ApiRequest<CourseInformation>.CreateApiRequest(string.Concat("/courses", "/", courseId), _apiKey);
+			return ApiRequest<CourseInformation>.CreateApiRequest(string.Concat("/courses/", courseId), _apiKey);
+		}
+
+		/// <summary>
+		/// todo
+		/// </summary>
+		/// <param name="classNumber"></param>
+		/// <returns></returns>
+		public ApiRequest<List<CourseInformation>> CourseSchedule(string classNumber)
+		{
+			return ApiRequest<List<CourseInformation>>.CreateApiRequest(string.Concat("/courses/", classNumber, "/schedule"), _apiKey);
+		}
+
+		/// <summary>
+		/// todo
+		/// </summary>
+		/// <param name="subject"></param>
+		/// <param name="catalogNumber"></param>
+		/// <returns></returns>
+		public ApiRequest<CourseInformation> CourseInformation(string subject, string catalogNumber)
+		{
+			return ApiRequest<CourseInformation>.CreateApiRequest(string.Concat("/courses/", subject, "/", catalogNumber), _apiKey);
+		}
+
+		/// <summary>
+		/// todo
+		/// </summary>
+		/// <param name="subject"></param>
+		/// <param name="catalogNumber"></param>
+		/// <returns></returns>
+		public ApiRequest<List<CourseInformation>> CourseSchedule(string subject, string catalogNumber)
+		{
+			return ApiRequest<List<CourseInformation>>.CreateApiRequest(string.Concat("/courses/", subject, "/", catalogNumber, "/schedule"), _apiKey);
+		}
+
+		/// <summary>
+		/// todo
+		/// </summary>
+		/// <param name="subject"></param>
+		/// <param name="catalogNumber"></param>
+		/// <returns></returns>
+		public ApiRequest<CoursePrerequisites> CoursePrerequisites(string subject, string catalogNumber)
+		{
+			return ApiRequest<CoursePrerequisites>.CreateApiRequest(string.Concat("/courses/", subject, "/", catalogNumber, "/prerequisites"), _apiKey);
+		}
+
+		/// <summary>
+		/// todo
+		/// </summary>
+		/// <param name="subject"></param>
+		/// <param name="catalogNumber"></param>
+		/// <returns></returns>
+		public ApiRequest<CoursePrerequisites> ExamSchedule(string subject, string catalogNumber)
+		{
+			return ApiRequest<CoursePrerequisites>.CreateApiRequest(string.Concat("/courses/", subject, "/", catalogNumber, "/examschedule"), _apiKey);
 		}
 	}
 }


[Kms] Format KmsClient

[Kms] Format KmsClient

--- src/Amazon.Kms/KmsClient.cs
+++ src/Amazon.Kms/KmsClient.cs
@@ -1,7 +1,10 @@
 using System;
+using System.Net;
 using System.Net.Http;
 using System.Text.Json;
 using System.Threading.Tasks;
+
+using Amazon.Exceptions;

 namespace Amazon.Kms
 {
@@ -67,7 +70,9 @@

         #region Helpers

-        private static readonly JsonSerializerOptions jsoIgnoreNullValues = new JsonSerializerOptions { IgnoreNullValues = true };
+        private static readonly JsonSerializerOptions jsoIgnoreNullValues = new () {
+            IgnoreNullValues = true
+        };

         private async Task<TResult> SendAsync<TRequest, TResult>(string action, TRequest request)
             where TRequest  : KmsRequest
@@ -86,22 +91,37 @@
                 }
             };

-            string responseText = await SendAsync(httpRequest).ConfigureAwait(false);
+            await SignAsync(httpRequest).ConfigureAwait(false);

-            if (responseText.Length == 0) return null!;
+            using var response = await httpClient.SendAsync(httpRequest).ConfigureAwait(false);

-            return JsonSerializer.Deserialize<TResult>(responseText);
+            if (!response.IsSuccessStatusCode)
+            {
+                throw await GetExceptionFromResponseAsync(response).ConfigureAwait(false);
+            }
+
+            if (response.StatusCode == HttpStatusCode.NoContent || response.Content.Headers.ContentLength is 0)
+            {
+                return null!;
+            }
+
+            using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
+
+            var result = await JsonSerializer.DeserializeAsync<TResult>(responseStream).ConfigureAwait(false);
+
+            return result!;
         }

-        protected override async Task<Exception> GetExceptionAsync(HttpResponseMessage response)
+        private static async Task<Exception> GetExceptionFromResponseAsync(HttpResponseMessage response)
         {
             string responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

             if (responseText.Length > 0 && responseText[0] == '{')
             {
-                var error = JsonSerializer.Deserialize<KmsError>(responseText);
+                var error = JsonSerializer.Deserialize<KmsError>(responseText)!;

-                return error.Type switch {
+                return error.Type switch
+                {
                     "AccessDeniedException"       => new AccessDeniedException(error.Message),
                     "ServiceUnavailableException" => new ServiceUnavailableException(error.Message),
                     "KeyUnavailableException"     => new KeyUnavailableException(error.Message),
@@ -110,7 +130,7 @@
             }
             else
             {
-                throw new Exception(responseText);
+                throw new AwsException(responseText, response.StatusCode);
             }
         }


BZip2Exception fix typo in summary comment

--- src/BZip2/BZip2Exception.cs
+++ src/BZip2/BZip2Exception.cs
@@ -53,7 +53,7 @@
 		/// <summary>
 		/// Initialise a new instance of BZip2Exception with its message set to message.
 		/// </summary>
-		/// <param name="message">The messaage describing the error.</param>
+		/// <param name="message">The message describing the error.</param>
 		public BZip2Exception(string message) : base(message)
 		{
 		}


Initialize BiggyList in-memory only with default constructor

--- src/Biggy.Core/BiggyList.cs
+++ src/Biggy.Core/BiggyList.cs
@@ -6,6 +6,7 @@
   public class BiggyList<T> : ICollection<T> where T : new() {

     public BiggyList(IDataStore<T> store, bool inMemory = false) {
+      _items = new List<T>();
       this.InMemory = inMemory;
       _store = store;
       if (UpdateLiveDataAllowed) {
@@ -13,10 +14,19 @@
       }
     }

+    public BiggyList() {
+      this.InMemory = true;
+      _items = new List<T>();
+      _store = null;
+      if (UpdateLiveDataAllowed) {
+        _items = _store.TryLoadData();
+      }
+    }
+
     protected List<T> _items = null;
     protected IDataStore<T> _store;

-    public virtual bool InMemory { get; set; }
+    public virtual bool InMemory { get; protected set; }
     public IDataStore<T> Store { get { return _store; } }

     public event EventHandler ItemRemoved;


modified convert as to use a lower function

--- src/ConversionExtensions.cs
+++ src/ConversionExtensions.cs
@@ -428,7 +428,9 @@
         public static T? ConvertAs<T>(this object source) where T : struct
         {
             T? result = null;
-            source.CanConvertTo<T?>(out result);
+            try {
+                result = ConvertTo<T>(source);
+            } catch {}
             return result;
         }
     }


added ext method to publish events

added ext method to publish events

--- src/DomainBus/Extensions.cs
+++ src/DomainBus/Extensions.cs
@@ -102,7 +102,11 @@
             var res = new T();
             res.OperationId = msg.Id;
             constructor?.Invoke(res);
-            return res;
+            return res;
         }
+
+        public static void PublishWith(this IEvent[] events, IDispatchMessages bus)
+            => bus.Publish(events);
+
     }
 }


Update Line2.cs

Update Line2.cs

--- src/Draw2D.Spatial/Line2.cs
+++ src/Draw2D.Spatial/Line2.cs
@@ -51,15 +51,15 @@
         {
             double A0 = b0.Y - a0.Y;
             double B0 = a0.X - b0.X;
-            double C0 = A0 * a0.X + B0 * a0.Y;
+            double C0 = (A0 * a0.X) + (B0 * a0.Y);
             double A1 = b1.Y - a1.Y;
             double B1 = a1.X - b1.X;
-            double C1 = A1 * a1.X + B1 * a1.Y;
-            double det = A0 * B1 - A1 * B0;
+            double C1 = (A1 * a1.X) + (B1 * a1.Y);
+            double det = (A0 * B1) - (A1 * B0);
             if (det != 0.0)
             {
-                double x = (B1 * C0 - B0 * C1) / det;
-                double y = (A0 * C1 - A1 * C0) / det;
+                double x = ((B1 * C0) - (B0 * C1)) / det;
+                double y = ((A0 * C1) - (A1 * C0)) / det;
                 var point = new Point2(x, y);
                 if (point.IsOnLine(a0, b0) && point.IsOnLine(a1, b1))
                 {
@@ -85,8 +85,8 @@
             if (rect.Height < 0)
                 throw new ArgumentException("Rectangle Height must be positive value.");

-            double cx = rect.Left + rect.Width / 2.0;
-            double cy = rect.Top + rect.Height / 2.0;
+            double cx = rect.Left + (rect.Width / 2.0);
+            double cy = rect.Top + (rect.Height / 2.0);

             double p1X = a.X - cx;
             double p1Y = a.Y - cy;
@@ -96,13 +96,13 @@
             double rx = rect.Width / 2.0;
             double ry = rect.Height / 2.0;

-            double A = (p2X - p1X) * (p2X - p1X) / rx / rx + (p2Y - p1Y) * (p2Y - p1Y) / ry / ry;
-            double B = 2 * p1X * (p2X - p1X) / rx / rx + 2 * p1Y * (p2Y - p1Y) / ry / ry;
-            double C = p1X * p1X / rx / rx + p1Y * p1Y / ry / ry - 1;
+            double A = ((p2X - p1X) * (p2X - p1X) / rx / rx) + ((p2Y - p1Y) * (p2Y - p1Y) / ry / ry);
+            double B = (2 * p1X * (p2X - p1X) / rx / rx) + (2 * p1Y * (p2Y - p1Y) / ry / ry);
+            double C = (p1X * p1X / rx / rx) + (p1Y * p1Y / ry / ry) - 1;

             var solutions = new List<double>();

-            double discriminant = B * B - 4 * A * C;
+            double discriminant = (B * B) - (4 * A * C);
             if (discriminant == 0)
             {
                 solutions.Add(-B / 2 / A);
@@ -119,8 +119,8 @@
             {
                 if (!onlySegment || ((t >= 0f) && (t <= 1f)))
                 {
-                    double x = p1X + (p2X - p1X) * t + cx;
-                    double y = p1Y + (p2Y - p1Y) * t + cy;
+                    double x = p1X + ((p2X - p1X) * t) + cx;
+                    double y = p1Y + ((p2Y - p1Y) * t) + cy;
                     result.Add(new Point2(x, y));
                 }
             }
@@ -213,10 +213,10 @@
                 }
             }

-            x0clip = x0 + t0 * dx;
-            y0clip = y0 + t0 * dy;
-            x1clip = x0 + t1 * dx;
-            y1clip = y0 + t1 * dy;
+            x0clip = x0 + (t0 * dx);
+            y0clip = y0 + (t0 * dy);
+            x1clip = x0 + (t1 * dx);
+            y1clip = y0 + (t1 * dy);

             return true;
         }


Fixed comment on getting application name in MemoryErrorLog.

--- src/Elmah/MemoryErrorLog.cs
+++ src/Elmah/MemoryErrorLog.cs
@@ -123,8 +123,9 @@
                 }

                 //
-                // Set the application name as this implementation provides
-                // per-application isolation over a single store.
+                // Set the application name. This implementation does not
+                // and cannot provide per-app isolation.
+                // Fixes: https://code.google.com/p/elmah/issues/detail?id=291
                 //

                 var appName = config.Find("applicationName", string.Empty);