TestBootstrapFail passing

TestBootstrapFail passing

--- TomP2P/TomP2P.Tests/P2P/BootstrapTest.cs
+++ TomP2P/TomP2P.Tests/P2P/BootstrapTest.cs
@@ -74,9 +74,15 @@
                     .SetInetAddress(IPAddress.Loopback)
                     .SetPorts(3000)
                     .StartAsync();
-                await taskBootstrap;
-
-                Assert.IsTrue(taskBootstrap.IsFaulted); // TODO correct?
+                try
+                {
+                    await taskBootstrap;
+                    Assert.Fail("The bootstrapping task should fail.");
+                }
+                catch (Exception)
+                {
+                    Assert.IsTrue(taskBootstrap.IsFaulted);
+                }
             }
             finally
             {


* fixed MEF imports

* fixed MEF imports

--- UI/UWP/RYB/Modules/Main/MainViewModel.cs
+++ UI/UWP/RYB/Modules/Main/MainViewModel.cs
@@ -1,5 +1,5 @@
 using System.Composition;
-using System.Windows.Input;
+using XElement.RedYellowBlue.UI.UWP.Model;

 namespace XElement.RedYellowBlue.UI.UWP
 {
@@ -7,27 +7,18 @@
     [Export]
     internal class MainViewModel
     {
-        public MainViewModel()
+        [ImportingConstructor]
+        public MainViewModel( NavigationModel navigationModel )
         {
-            //new DelegateCommand()
-            //new RoutedCommand()
-            //new RoutedUICommand()
-            this.NavigationCommand = null; // TODO
+            this.NavigationModel = navigationModel;
         }
-
-
-        public string Blubb { get; private set; }

         //[Import]
         //private Config Config { get; set; }

-        public ICommand NavigationCommand { get; private set; }
-
-        private void NavigationCommand_Execute( object obj )
-        {
-        }
+        public NavigationModel NavigationModel { get; private set; }

         [OnImportsSatisfied]
@@ -36,7 +27,6 @@
             //var login = new Login( this.Config.Uri, this.Config.Username );
             //login.Do( this.Config.Password );
             //var sid = login.Sid;
-            this.Blubb = "blubb.waogiherioguahegrhiarguraugigiauaurenvar0gmf,";// + "\t sid:" + sid;
         }
     }
 #endregion


Fixed issue where BoundObservableList.cache wasn't being initialised

--- UnityWeld/Binding/BoundObservableList.cs
+++ UnityWeld/Binding/BoundObservableList.cs
@@ -1,152 +1,154 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-
-namespace UnityWeld.Binding
-{
-    /// <summary>
-    /// An observable list that is bound to source list.
-    /// </summary>
-    public class BoundObservableList<DestT, SourceT> : ObservableList<DestT>, IDisposable
-    {
-        /// <summary>
-        /// The source list.
-        /// </summary>
-        private readonly ObservableList<SourceT> source;
-
-        /// <summary>
-        /// Function that maps source items to dest items.
-        /// </summary>
-        private readonly Func<SourceT, DestT> itemMap;
-
-        /// <summary>
-        /// Callback when new items are added.
-        /// </summary>
-        private readonly Action<DestT> added;
-
-        /// <summary>
-        /// Callback when items are removed.
-        /// </summary>
-        private readonly Action<DestT> removed;
-
-        /// <summary>
-        /// Callback invoked when the collection has changed.
-        /// </summary>
-        private readonly Action changed;
-
-        /// <summary>
-        /// Cache that mimics the contents of the bound list.
-        /// This is so we know the items that were cleared when the list is reset.
-        /// </summary>
-        private readonly List<DestT> cache;
-
-        public BoundObservableList(ObservableList<SourceT> source, Func<SourceT, DestT> itemMap) :
-            base(source.Select(itemMap))
-        {
-            this.itemMap = itemMap;
-            this.source = source;
-
-            source.CollectionChanged += source_CollectionChanged;
-            CollectionChanged += BoundObservableList_CollectionChanged;
-        }
-
-        public BoundObservableList(ObservableList<SourceT> source, Func<SourceT, DestT> itemMap, Action<DestT> added, Action<DestT> removed) :
-            base(source.Select(itemMap))
-        {
-            if (added == null)
-            {
-                throw new ArgumentNullException("added", "added must not be null.");
-            }
-            if (removed == null)
-            {
-                throw new ArgumentNullException("removed", "removed must not be null.");
-            }
-
-            this.itemMap = itemMap;
-            this.source = source;
-            this.added = added;
-            this.removed = removed;
-
-            foreach (var item in this)
-            {
-                added(item);
-            }
-
-            source.CollectionChanged += source_CollectionChanged;
-            CollectionChanged += BoundObservableList_CollectionChanged;
-            cache = new List<DestT>(this);
-        }
-
-        public BoundObservableList(ObservableList<SourceT> source, Func<SourceT, DestT> itemMap, Action<DestT> added, Action<DestT> removed, Action changed) :
-            base(source.Select(itemMap))
-        {
-            if (added == null)
-            {
-                throw new ArgumentNullException("added", "added must not be null.");
-            }
-            if (removed == null)
-            {
-                throw new ArgumentNullException("removed", "removed must not be null.");
-            }
-
-            this.itemMap = itemMap;
-            this.source = source;
-            this.added = added;
-            this.removed = removed;
-            this.changed = changed;
-
-            foreach (var item in this)
-            {
-                added(item);
-            }
-
-            source.CollectionChanged += source_CollectionChanged;
-            CollectionChanged += BoundObservableList_CollectionChanged;
-            cache = new List<DestT>(this);
-        }
-
-        /// <summary>
-        /// Event raised when the source collection has changed.
-        /// </summary>
-        private void source_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
-        {
-            switch (e.Action)
-            {
-                case NotifyCollectionChangedAction.Add:
-                    var insertAt = e.NewStartingIndex;
-
-                    foreach (var item in e.NewItems)
-                    {
-                        var generatedItem = itemMap((SourceT)item);
-
-                        Insert(insertAt, generatedItem);
-                        ++insertAt;
-                    }
-
-                    break;
-                case NotifyCollectionChangedAction.Remove:
-                    var removeAt = e.OldStartingIndex;
-
-                    for (var i = 0; i < e.OldItems.Count; i++)
-                    {
-                        RemoveAt(removeAt);
-                    }
-
-                    break;
-                case NotifyCollectionChangedAction.Reset:
-                    Clear();
-                    break;
-                default:
-                    throw new ArgumentOutOfRangeException();
-            }
-        }
-
-        /// <summary>
-        /// Event raised when items are added to the bound list.
-        /// </summary>
-        private void BoundObservableList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
-        {
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+
+namespace UnityWeld.Binding
+{
+    /// <summary>
+    /// An observable list that is bound to source list.
+    /// </summary>
+    public class BoundObservableList<DestT, SourceT> : ObservableList<DestT>, IDisposable
+    {
+        /// <summary>
+        /// The source list.
+        /// </summary>
+        private readonly ObservableList<SourceT> source;
+
+        /// <summary>
+        /// Function that maps source items to dest items.
+        /// </summary>
+        private readonly Func<SourceT, DestT> itemMap;
+
+        /// <summary>
+        /// Callback when new items are added.
+        /// </summary>
+        private readonly Action<DestT> added;
+
+        /// <summary>
+        /// Callback when items are removed.
+        /// </summary>
+        private readonly Action<DestT> removed;
+
+        /// <summary>
+        /// Callback invoked when the collection has changed.
+        /// </summary>
+        private readonly Action changed;
+
+        /// <summary>
+        /// Cache that mimics the contents of the bound list.
+        /// This is so we know the items that were cleared when the list is reset.
+        /// </summary>
+        private readonly List<DestT> cache;
+
+        public BoundObservableList(ObservableList<SourceT> source, Func<SourceT, DestT> itemMap) :
+            base(source.Select(itemMap))
+        {
+            this.itemMap = itemMap;
+            this.source = source;
+
+            source.CollectionChanged += source_CollectionChanged;
+            CollectionChanged += BoundObservableList_CollectionChanged;
+
+            cache = new List<DestT>(this);
+        }
+
+        public BoundObservableList(ObservableList<SourceT> source, Func<SourceT, DestT> itemMap, Action<DestT> added, Action<DestT> removed) :
+            base(source.Select(itemMap))
+        {
+            if (added == null)
+            {
+                throw new ArgumentNullException("added", "added must not be null.");
+            }
+            if (removed == null)
+            {
+                throw new ArgumentNullException("removed", "removed must not be null.");
+            }
+
+            this.itemMap = itemMap;
+            this.source = source;
+            this.added = added;
+            this.removed = removed;
+
+            foreach (var item in this)
+            {
+                added(item);
+            }
+
+            source.CollectionChanged += source_CollectionChanged;
+            CollectionChanged += BoundObservableList_CollectionChanged;
+            cache = new List<DestT>(this);
+        }
+
+        public BoundObservableList(ObservableList<SourceT> source, Func<SourceT, DestT> itemMap, Action<DestT> added, Action<DestT> removed, Action changed) :
+            base(source.Select(itemMap))
+        {
+            if (added == null)
+            {
+                throw new ArgumentNullException("added", "added must not be null.");
+            }
+            if (removed == null)
+            {
+                throw new ArgumentNullException("removed", "removed must not be null.");
+            }
+
+            this.itemMap = itemMap;
+            this.source = source;
+            this.added = added;
+            this.removed = removed;
+            this.changed = changed;
+
+            foreach (var item in this)
+            {
+                added(item);
+            }
+
+            source.CollectionChanged += source_CollectionChanged;
+            CollectionChanged += BoundObservableList_CollectionChanged;
+            cache = new List<DestT>(this);
+        }
+
+        /// <summary>
+        /// Event raised when the source collection has changed.
+        /// </summary>
+        private void source_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+            switch (e.Action)
+            {
+                case NotifyCollectionChangedAction.Add:
+                    var insertAt = e.NewStartingIndex;
+
+                    foreach (var item in e.NewItems)
+                    {
+                        var generatedItem = itemMap((SourceT)item);
+
+                        Insert(insertAt, generatedItem);
+                        ++insertAt;
+                    }
+
+                    break;
+                case NotifyCollectionChangedAction.Remove:
+                    var removeAt = e.OldStartingIndex;
+
+                    for (var i = 0; i < e.OldItems.Count; i++)
+                    {
+                        RemoveAt(removeAt);
+                    }
+
+                    break;
+                case NotifyCollectionChangedAction.Reset:
+                    Clear();
+                    break;
+                default:
+                    throw new ArgumentOutOfRangeException();
+            }
+        }
+
+        /// <summary>
+        /// Event raised when items are added to the bound list.
+        /// </summary>
+        private void BoundObservableList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
             switch (e.Action)
             {
                 case NotifyCollectionChangedAction.Add:
@@ -166,21 +168,21 @@
                     }
                     break;

-                case NotifyCollectionChangedAction.Remove:
-                    foreach (var item in e.OldItems)
-                    {
-                        var typedItem = (DestT)item;
-
-                        if (removed != null)
-                        {
-                            removed(typedItem);
-                        }
-
-                        cache.RemoveAt(e.OldStartingIndex); // Keep the cache updated as items are removed.
-                    }
-                    break;
-
-                case NotifyCollectionChangedAction.Reset:
+                case NotifyCollectionChangedAction.Remove:
+                    foreach (var item in e.OldItems)
+                    {
+                        var typedItem = (DestT)item;
+
+                        if (removed != null)
+                        {
+                            removed(typedItem);
+                        }
+
+                        cache.RemoveAt(e.OldStartingIndex); // Keep the cache updated as items are removed.
+                    }
+                    break;
+
+                case NotifyCollectionChangedAction.Reset:
                     if (removed != null)
                     {
                         foreach (var item in cache)
@@ -190,21 +192,21 @@
                     }
                     cache.Clear();
                     break;
-
-                default:
-                    throw new ArgumentOutOfRangeException();
-            }
-
-            if (changed != null)
-            {
-                changed.Invoke();
-            }
-        }
-
-        public void Dispose()
-        {
-            source.CollectionChanged -= source_CollectionChanged;
-            CollectionChanged -= BoundObservableList_CollectionChanged;
-        }
-    }
-}
+
+                default:
+                    throw new ArgumentOutOfRangeException();
+            }
+
+            if (changed != null)
+            {
+                changed.Invoke();
+            }
+        }
+
+        public void Dispose()
+        {
+            source.CollectionChanged -= source_CollectionChanged;
+            CollectionChanged -= BoundObservableList_CollectionChanged;
+        }
+    }
+}


Fixed mapping of Name from AR, så if displayname is empty (as it often is) then we use the name instead

--- src/Helsenorge.Registries/AddressRegistry.cs
+++ src/Helsenorge.Registries/AddressRegistry.cs
@@ -197,7 +197,7 @@
         {
             var details = new CommunicationPartyDetails
             {
-                Name = communicationParty.DisplayName,
+                Name = !string.IsNullOrEmpty(communicationParty.DisplayName) ? communicationParty.DisplayName : communicationParty.Name,
                 HerId = communicationParty.HerId,
             };


feat(document-base): add meta property

feat(document-base): add meta property

--- src/JsonApiDotNetCore/Models/DocumentBase.cs
+++ src/JsonApiDotNetCore/Models/DocumentBase.cs
@@ -7,5 +7,6 @@
     {
         [JsonProperty("included")]
         public List<DocumentData> Included { get; set; }
+        public Dictionary<string, object> Meta { get; set; }
     }
 }


Use PrintColor property from TablaturePrintDocumentSettings.

--- Printing/TablaturePrintDocument.cs
+++ Printing/TablaturePrintDocument.cs
@@ -136,7 +136,7 @@
         {
             var title = string.Format("{0} - {1} ({2})", _tab.Artist, _tab.Title, _tab.Type.ToFriendlyString());

-            e.Graphics.DrawString(title, _font, Brushes.Black, _realPageBounds, new StringFormat
+            e.Graphics.DrawString(title, _font, _settings.PrintColor, _realPageBounds, new StringFormat
                                                                                {
                                                                                Alignment = StringAlignment.Near,
                                                                                LineAlignment = StringAlignment.Near
@@ -151,7 +151,7 @@
             int linesPerPage;

             e.Graphics.MeasureString(_printContents, _font, printBounds.Size, StringFormat.GenericTypographic, out charactersOnPage, out linesPerPage);
-            e.Graphics.DrawString(_printContents, _font, Brushes.Black, printBounds, StringFormat.GenericTypographic);
+            e.Graphics.DrawString(_printContents, _font, _settings.PrintColor, printBounds, StringFormat.GenericTypographic);

             _printContents = _printContents.Substring(charactersOnPage);

@@ -160,7 +160,7 @@

         protected virtual void OnDrawPageNumbers(TablaturePrintPageEventArgs e)
         {
-            e.Graphics.DrawString(string.Format("Page {0} of {1}", e.CurrentPage, TotalPages), _font, Brushes.Black, _realPageBounds, new StringFormat
+            e.Graphics.DrawString(string.Format("Page {0} of {1}", e.CurrentPage, TotalPages), _font, _settings.PrintColor, _realPageBounds, new StringFormat
                                                                                {
                                                                                Alignment = StringAlignment.Far,
                                                                                LineAlignment = StringAlignment.Near
@@ -169,7 +169,7 @@

         protected virtual void OnDrawPrintTime(PrintPageEventArgs e)
         {
-            e.Graphics.DrawString(DateTime.Now.ToString(), _font, Brushes.Black, _realPageBounds, new StringFormat
+            e.Graphics.DrawString(DateTime.Now.ToString(), _font, _settings.PrintColor, _realPageBounds, new StringFormat
                                                                                {
                                                                                Alignment = StringAlignment.Far,
                                                                                LineAlignment = StringAlignment.Far


Update

Update

--- ProGenTracer/Rendering/Renderer.cs
+++ ProGenTracer/Rendering/Renderer.cs
@@ -37,7 +37,7 @@

         public void RenderScene()
         {
-            Camera SceneCamera = Camera.Create(new Vector3(0, 0, 0), new Vector3(0, 0, 0));
+            Camera SceneCamera = Camera.Create(new Vector3(0, 0, -2), new Vector3(0, 1, 0));

             //Scene newScene = new Scene();
             //GenerateScene(newScene);
@@ -51,14 +51,16 @@
             Utilities.Color pixelColor = new Utilities.Color();

             Ray newRay = new Ray();
-            newRay.Origin = new Vector3(0,0,-5);
+            newRay.Origin = SceneCamera.position;
+
+            Matrix4x4 CameraToWorld = Matrix4x4.identity;

             for (int y = 0; y < rs.ImageHeight; y++)
             {
                 for (int x = 0; x < rs.ImageWidth; x++)
                 {
                     //generate ray
-                    double px = (2 * (x + 0.5) / (double)rs.ImageWidth - 1) * imageAspectRatio * scale;
+                    double px = (2 * (x+ 0.5) / (double)rs.ImageWidth - 1) * imageAspectRatio * scale;
                     double py = (1 - 2 * (y + 0.5) / (double)rs.ImageHeight) * scale;
                     newRay.Direction = Vector3.Normalize(new Vector3(px, py, 1));
                     newRay.Distance = double.PositiveInfinity;
@@ -71,16 +73,17 @@
                     //superRay.Distance = double.PositiveInfinity;
                     //pixelColor = CastRay(superRay, CurrentScene, ref depth);

-                    //Vector3 dir = new Vector3();
-                    //dir = Matrix4x4.MultiplyVector(newRay.Direction, cameraToWorld);
-                    //dir = Vector3.Normalize(dir);
-                    //Ray superRay = new Ray();
-                    //superRay.Origin = newRay.Origin;
-                    //superRay.Direction = dir;
-                    //superRay.Distance = double.PositiveInfinity;
-                    //pixelColor = CastRay(superRay, CurrentScene, ref depth);
-
-                    pixelColor = CastRay(newRay, CurrentScene, ref depth);
+                    Vector3 dir = new Vector3();
+                    //dir = Matrix4x4.MultiplyVector(newRay.Direction, CameraToWorld);
+                    dir = Matrix4x4.MultiplyVector(new Vector3(px, py, 1), CameraToWorld);
+                    dir = Vector3.Normalize(dir);
+                    Ray superRay = new Ray();
+                    superRay.Origin = newRay.Origin;
+                    superRay.Direction = dir;
+                    superRay.Distance = double.PositiveInfinity;
+                    pixelColor = CastRay(superRay, CurrentScene, ref depth);
+
+                    //pixelColor = CastRay(newRay, CurrentScene, ref depth);

                     RenderImage.SetPixel(x, y, pixelColor.ToDrawingColor());
                     if (x == 0) RenderBox.Refresh();


added "with all charges" implicits, fixed lvl 0 base mana

--- WPFSKillTree/SkillTreeFiles/SkillTree.cs
+++ WPFSKillTree/SkillTreeFiles/SkillTree.cs
@@ -51,7 +51,7 @@

         public static readonly Dictionary<string, float> BaseAttributes = new Dictionary<string, float>
         {
-            {"+# to maximum Mana", 36},
+            {"+# to maximum Mana", 34},
             {"+# to maximum Life", 38},
             {"Evasion Rating: #", 53},
             {"+# to Maximum Endurance Charges", 3},
@@ -1036,6 +1036,46 @@
             dex = (float)Math.Round(dex / DexPerEvas, 0, MidpointRounding.AwayFromZero) * DexPerEvas;
             retval["#% increased Evasion Rating"] = new List<float> { dex / DexPerEvas };

+            int endurancecharges, frenzycharges, powercharges;
+            endurancecharges = frenzycharges = powercharges = 0;
+            if (attribs.ContainsKey("+# to Maximum Endurance Charges"))
+                endurancecharges = (int)(attribs["+# to Maximum Endurance Charges"][0]);
+            if (attribs.ContainsKey("+# to Maximum Frenzy Charges"))
+                frenzycharges = (int)(attribs["+# to Maximum Frenzy Charges"][0]);
+            if (attribs.ContainsKey("+# to Maximum Power Charges"))
+                powercharges = (int)(attribs["+# to Maximum Power Charges"][0]);
+            string newkey;
+            foreach (string key in attribs.Keys)
+            {
+                if (key.Contains("per Endurance Charge") && endurancecharges > 0)
+                {
+                    newkey = key.Replace("per Endurance Charge", "with all Endurance Charges");
+                    retval.Add(newkey, new List<float>());
+                    foreach (float f in attribs[key])
+                    {
+                        retval[newkey].Add(f * endurancecharges);
+                    }
+                }
+                if (key.Contains("per Frenzy Charge") && endurancecharges > 0)
+                {
+                    newkey = key.Replace("per Frenzy Charge", "with all Frenzy Charges");
+                    retval.Add(newkey, new List<float>());
+                    foreach (float f in attribs[key])
+                    {
+                        retval[newkey].Add(f * frenzycharges);
+                    }
+                }
+                if (key.Contains("per Power Charge") && endurancecharges > 0)
+                {
+                    newkey = key.Replace("per Power Charge", "with all Power Charges");
+                    retval.Add(newkey, new List<float>());
+                    foreach (float f in attribs[key])
+                    {
+                        retval[newkey].Add(f * powercharges);
+                    }
+                }
+            }
+
             return retval;
         }


Support byte[] parameter values.

Support byte[] parameter values.

This implementation uses an inefficient hexadecimal encoding, instead of a binary string.

--- src/MySql.Data/MySqlClient/MySqlParameter.cs
+++ src/MySql.Data/MySqlClient/MySqlParameter.cs
@@ -84,6 +84,14 @@
 			{
 				output.AppendFormat(CultureInfo.InvariantCulture, "{0}", Value);
 			}
+			else if (Value is byte[])
+			{
+				// TODO: use a _binary'...' string for more efficient data transmission
+				output.Append("X'");
+				foreach (var by in (byte[]) Value)
+					output.AppendFormat(CultureInfo.InvariantCulture, "{0:X2}", by);
+				output.Append("'");
+			}
 			else
 			{
 				throw new NotSupportedException(Invariant($"Parameter type {Value.GetType().Name} (DbType: {DbType}) not currently supported. Value: {Value}"));


Response now terminated if of incorrect type

--- src/NServiceKit/ContentTypeCheckerFeature.cs
+++ src/NServiceKit/ContentTypeCheckerFeature.cs
@@ -21,8 +21,9 @@
             appHost.RequestFilters.Add( (request, response, dto) => {
               if (!AcceptedRequests.Contains(request.ContentType, StringComparer.OrdinalIgnoreCase)) {
                   response.StatusCode = 406;
+                  response.Close();
               }
             });
         }
     }
-}+}


Set assembly culture to neutral

Set assembly culture to neutral

--- src/ProviderModel/Properties/AssemblyInfo.cs
+++ src/ProviderModel/Properties/AssemblyInfo.cs
@@ -8,9 +8,9 @@
 [assembly: AssemblyProduct("ProviderModel")]
 [assembly: AssemblyCopyright("Copyright ©  2014")]
 [assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("en-US")]
+[assembly: AssemblyCulture("")]
 [assembly: ComVisible(false)]
 [assembly: Guid("9d02304c-cda1-4d3b-afbc-725731a794b5")]
-[assembly: AssemblyVersion("1.0.0")]
-[assembly: AssemblyFileVersion("1.0.0")]
-[assembly: AssemblyInformationalVersion("1.0.0")]
+[assembly: AssemblyVersion("1.0.1")]
+[assembly: AssemblyFileVersion("1.0.1")]
+[assembly: AssemblyInformationalVersion("1.0.1")]


Bugfixes #FIX: Removed accidentally commited debug outputs.

--- WinForms/PropertyEditing/PropertyGrid.cs
+++ WinForms/PropertyEditing/PropertyGrid.cs
@@ -536,7 +536,6 @@
 			base.OnPaint(e);
 			e.Graphics.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);

-			Console.WriteLine(e.ClipRectangle);
 			GraphicsState originalState = e.Graphics.Save();
 			if (this.mainEditor != null)
 			{


Set the dropped content as ActiveContent, just like Visual Studio do

--- WinFormsUI/Docking/DockContentHandler.cs
+++ WinFormsUI/Docking/DockContentHandler.cs
@@ -1226,6 +1226,8 @@

                 paneFrom.DockState = pane.DockState;
             }
+
+            Pane.ActiveContent = Content;
         }

         public void DockTo(DockPanel panel, DockStyle dockStyle)


[Windows] Correct enter/esc keypress behaviors for MessageDialog (#292)

--- Xamarin.Forms.Platform.WinRT/Platform.cs
+++ Xamarin.Forms.Platform.WinRT/Platform.cs
@@ -738,13 +738,13 @@
 			if (options.Accept != null)
 			{
 				dialog.Commands.Add(new UICommand(options.Accept));
-				dialog.DefaultCommandIndex = (uint)dialog.Commands.Count - 1;
+				dialog.DefaultCommandIndex = 0;
 			}

 			if (options.Cancel != null)
 			{
 				dialog.Commands.Add(new UICommand(options.Cancel));
-				dialog.CancelCommandIndex = 0;
+				dialog.CancelCommandIndex = (uint)dialog.Commands.Count - 1;
 			}

 			IUICommand command = await dialog.ShowAsync();


Consider min/max values for integer data type

--- XmlSchemaClassGenerator/CodeUtilities.cs
+++ XmlSchemaClassGenerator/CodeUtilities.cs
@@ -62,6 +62,61 @@
             var xmlTypeCode = type.TypeCode;

             Type result = null;
+
+            var maxInclusive = restrictions.OfType<MaxInclusiveRestrictionModel>().SingleOrDefault();
+            var minInclusive = restrictions.OfType<MinInclusiveRestrictionModel>().SingleOrDefault();
+
+            decimal? maxInclusiveValue = null;
+            if (maxInclusive is null && xmlTypeCode == XmlTypeCode.NegativeInteger)
+            {
+                maxInclusiveValue = -1;
+            }
+            else if (maxInclusive is null && xmlTypeCode == XmlTypeCode.NonPositiveInteger)
+            {
+                maxInclusiveValue = 0;
+            }
+            else if (maxInclusive != null && decimal.TryParse(maxInclusive.Value, out decimal value))
+            {
+                maxInclusiveValue = value;
+            }
+
+            decimal? minInclusiveValue = null;
+            if (minInclusive is null && xmlTypeCode == XmlTypeCode.PositiveInteger)
+            {
+                minInclusiveValue = 1;
+            }
+            else if (minInclusive is null && xmlTypeCode == XmlTypeCode.NonNegativeInteger)
+            {
+                minInclusiveValue = 0;
+            }
+            else if (minInclusive != null && decimal.TryParse(minInclusive.Value, out decimal value))
+            {
+                minInclusiveValue = value;
+            }
+
+            // If either value is null, then that value is either unbounded or too large to fit in any numeric type.
+            if (minInclusiveValue != null && maxInclusiveValue != null) {
+                if (minInclusiveValue >= byte.MinValue && maxInclusiveValue <= byte.MaxValue)
+                    result = typeof(byte);
+                else if (minInclusiveValue >= sbyte.MinValue && maxInclusiveValue <= sbyte.MaxValue)
+                    result = typeof(sbyte);
+                else if (minInclusiveValue >= ushort.MinValue && maxInclusiveValue <= ushort.MaxValue)
+                    result = typeof(ushort);
+                else if (minInclusiveValue >= short.MinValue && maxInclusiveValue <= short.MaxValue)
+                    result = typeof(short);
+                else if (minInclusiveValue >= uint.MinValue && maxInclusiveValue <= uint.MaxValue)
+                    result = typeof(uint);
+                else if (minInclusiveValue >= int.MinValue && maxInclusiveValue <= int.MaxValue)
+                    result = typeof(int);
+                else if (minInclusiveValue >= ulong.MinValue && maxInclusiveValue <= ulong.MaxValue)
+                    result = typeof(ulong);
+                else if (minInclusiveValue >= long.MinValue && maxInclusiveValue <= long.MaxValue)
+                    result = typeof(long);
+                else // If it didn't fit in a decimal, we could not have gotten here.
+                    result = typeof(decimal);
+
+                return result;
+            }

             if (!(restrictions.SingleOrDefault(r => r is TotalDigitsRestrictionModel) is TotalDigitsRestrictionModel totalDigits)
                 || ((xmlTypeCode == XmlTypeCode.PositiveInteger


Remove MessageBroadcast event IMessagingChannel.

- Is an implementation detail, and not of any relevance in the interface
itself.

--- Primer/IMessagingChannel.cs
+++ Primer/IMessagingChannel.cs
@@ -10,11 +10,6 @@
     /// </summary>
     public interface IMessagingChannel
     {
-        /// <summary>
-        /// Occurs when a message has been broadcast on this channel.
-        /// </summary>
-        event Action<IMessage> MessageBroadcast;
-
         /// <summary>
         /// Broadcasts a message to anyone who is listening to the channel.
         /// </summary>


[location] Example usage of a location to find a source file

--- testpackages/Test13/dev/Test13.cs
+++ testpackages/Test13/dev/Test13.cs
@@ -23,7 +23,8 @@
         {
             public SourceFiles()
             {
-                this.Include(this, "source", "*.cpp");
+                var sourceDir = new Opus.Core.LocationDirectory(this.Locations["PackageDir"], "source");
+                this.Include(sourceDir, "*.cpp");

                 this.UpdateOptions += new Opus.Core.UpdateOptionCollectionDelegate(SourceFiles_UpdateOptions);
             }


[client][managed][offline] added a test to assert querying on special chars work

--- sdk/Managed/test/Microsoft.WindowsAzure.MobileServices.SQLiteStore.Test/UnitTests/SQLiteStoreTests.Integration.cs
+++ sdk/Managed/test/Microsoft.WindowsAzure.MobileServices.SQLiteStore.Test/UnitTests/SQLiteStoreTests.Integration.cs
@@ -164,6 +164,30 @@
             string expectedRequestContent = @"{""id"":""123"",""String"":""def""}";
             // version should not be sent with insert request
             Assert.AreEqual(hijack.RequestContents[0], expectedRequestContent);
+        }
+
+        [AsyncTestMethod]
+        public async Task ReadAsync_StringCompare_WithSpecialChars()
+        {
+            ResetDatabase("stringId_test_table");
+
+            var store = new MobileServiceSQLiteStore(TestDbName);
+            store.DefineTable<ToDoWithSystemPropertiesType>();
+
+            IMobileServiceClient service = await CreateClient(new TestHttpHandler(), store);
+            var table = service.GetSyncTable<ToDoWithSystemPropertiesType>();
+
+            var inserted = new ToDoWithSystemPropertiesType()
+            {
+                Id = "123",
+                Version = "abc",
+                String = "test@contoso.com"
+            };
+            await table.InsertAsync(inserted);
+
+            ToDoWithSystemPropertiesType rehydrated = (await table.Where(t => t.String == "test@contoso.com").ToListAsync()).FirstOrDefault();
+
+            Assert.AreEqual(rehydrated.String, "test@contoso.com");
         }

         [AsyncTestMethod]


Removed unused using

Removed unused using

--- src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/Rules/Naming/NamePropertyWithAnAffirmativePhraseAnalyzer.cs
+++ src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/Rules/Naming/NamePropertyWithAnAffirmativePhraseAnalyzer.cs
@@ -1,4 +1,3 @@
-using System;
 using System.Collections.Immutable;
 using CSharpGuidelinesAnalyzer.Extensions;
 using JetBrains.Annotations;


cleanup

cleanup

--- BrightWire.Source/Helper/VectorDistanceHelper.cs
+++ BrightWire.Source/Helper/VectorDistanceHelper.cs
@@ -42,6 +42,11 @@
 		public IReadOnlyList<IVector> CompareTo => _comparison;

 		/// <summary>
+		/// Distance metric
+		/// </summary>
+		public DistanceMetric Metric => _distanceMetric;
+
+		/// <summary>
 		/// Adds a comparison vector (will be owned and disposed by the helper class)
 		/// </summary>
 		/// <param name="comparison">Vector to compare against</param>
@@ -80,11 +85,11 @@
 		/// </summary>
 		public IReadOnlyList<int> GetClosest()
 		{
-			var distance = _lap.CalculateDistances(_data, _comparison, _distanceMetric);
-			return Enumerable.Range(0, _data.Count)
-				.Select(i => _GetMinimum(distance, i).Index)
-				.ToList()
-			;
+			using (var distance = _lap.CalculateDistances(_data, _comparison, _distanceMetric)) {
+				return Enumerable.Range(0, _data.Count)
+					.Select(i => _GetMinimum(distance, i).Index)
+					.ToList();
+			}
 		}

 		/// <summary>
@@ -93,10 +98,11 @@
 		/// <param name="indices">Indices of the data vectors to use in the averaged vector</param>
 		public IVector GetAverageFromData(IReadOnlyList<int> indices)
 		{
-			var data = _lap.CreateMatrixFromColumns(indices.Select(i => _data[i]).ToList());
-			var result = data.RowSums();
-			result.Multiply(1f / indices.Count);
-			return result;
+			using (var data = _lap.CreateMatrixFromColumns(indices.Select(i => _data[i]).ToList())) {
+				var result = data.RowSums();
+				result.Multiply(1f / indices.Count);
+				return result;
+			}
 		}

 		(int Index, float Value) _GetMinimum(IMatrix data, int columnIndex)
@@ -129,6 +135,5 @@
 			}
 			return (bestIndex, min);
 		}
-
 	}
 }


Delete target folder before running unittest to allow multiple runs with the same data

--- Duplicati/UnitTest/CommandLineOperationsTests.cs
+++ Duplicati/UnitTest/CommandLineOperationsTests.cs
@@ -51,12 +51,16 @@
         [Test]
         public void RunCommands()
         {
+            if (Directory.Exists(DATAFOLDER))
+                PrepareSourceData();
             DoRunCommands(TARGETFOLDER);
         }

         [Test]
         public void RunCommandsWithoutSize()
         {
+            if (Directory.Exists(DATAFOLDER))
+                PrepareSourceData();
             DoRunCommands(new SizeOmittingBackend().ProtocolKey + "://" + TARGETFOLDER);
         }


rename fields

rename fields

--- HarshPoint/Provisioning/HarshFieldProvisioner.cs
+++ HarshPoint/Provisioning/HarshFieldProvisioner.cs
@@ -183,8 +183,8 @@

         private sealed class NonNullAttributeSetter : HarshFieldSchemaXmlTransformer
         {
-            private readonly XName _name;
-            private readonly Func<Object> _valueAccessor;
+            private readonly XName Name;
+            private readonly Func<Object> ValueAccessor;

             public NonNullAttributeSetter(Expression<Func<Object>> valueAccessorExpr, XName name = null, Boolean onFieldAddOnly = false)
             {
@@ -195,14 +195,14 @@

                 if (name == null)
                 {
-                    _name = valueAccessorExpr.GetMemberName();
+                    Name = valueAccessorExpr.GetMemberName();
                 }
                 else
                 {
-                    _name = name;
-                }
-
-                _valueAccessor = valueAccessorExpr.Compile();
+                    Name = name;
+                }
+
+                ValueAccessor = valueAccessorExpr.Compile();
                 OnFieldAddOnly = onFieldAddOnly;
             }

@@ -213,11 +213,11 @@
                     throw Error.ArgumentNull("element");
                 }

-                var value = _valueAccessor();
+                var value = ValueAccessor();

                 if (value != null)
                 {
-                    element.SetAttributeValue(_name, value);
+                    element.SetAttributeValue(Name, value);
                 }

                 return element;


Final changes for the game.

Final changes for the game.

--- InfoAndInitialisation/InitialisationOfTheGame.cs
+++ InfoAndInitialisation/InitialisationOfTheGame.cs
@@ -17,7 +17,7 @@
         {
             Console.BackgroundColor = ConsoleColor.Black;
             Console.CursorVisible = false;
-            Console.Title = "Falling Rocks";
+            Console.Title = "School Strikes Back !";
             Console.BufferHeight = Console.WindowHeight;
             Console.BufferWidth = Console.WindowWidth = 50;
             scores = 0;


Fixed accessibility changed at changeset c7a01f409c75.

--- R.NET/SymbolicExpression.cs
+++ R.NET/SymbolicExpression.cs
@@ -64,7 +64,7 @@
 		/// </summary>
 		/// <param name="engine">The engine.</param>
 		/// <param name="pointer">The pointer.</param>
-		public SymbolicExpression(REngine engine, IntPtr pointer)
+		internal protected SymbolicExpression(REngine engine, IntPtr pointer)
 			: base(IntPtr.Zero, true)
 		{
 			this.engine = engine;


Update CatelContainerAdapter.cs

Update CatelContainerAdapter.cs

Fixed issue #24

--- IocPerformance/Adapters/CatelContainerAdapter.cs
+++ IocPerformance/Adapters/CatelContainerAdapter.cs
@@ -24,7 +24,7 @@

         public override string Url
         {
-            get { return "http://catel.codeplex.com"; }
+            get { return "http://www.catelproject.com"; }
         }

         public override bool SupportGeneric
@@ -112,4 +112,4 @@
             this.container.RegisterType<ImportMultiple, ImportMultiple>(RegistrationType.Transient);
         }
     }
-}+}


Made tab transition look smoother

Made tab transition look smoother

--- LiveSplit/LiveSplit.View/View/RunEditorDialog.cs
+++ LiveSplit/LiveSplit.View/View/RunEditorDialog.cs
@@ -1166,8 +1166,11 @@

         private void TabSelected(object sender, TabControlEventArgs e)
         {
+            var margin = this.tabControl.Margin;
             if (IsGridTab)
             {
+                margin.Bottom = 0;
+                this.tabControl.Margin = margin;
                 UpdateSegmentList();
                 this.tableLayoutPanel1.SetRowSpan(this.tabControl, 1);
                 runGrid.Visible = true;
@@ -1178,10 +1181,9 @@
                 runGrid.Visible = false;
                 this.tableLayoutPanel1.SetRowSpan(this.tabControl, 9);
                 metadataControl.RefreshInformation();
-            }
-            var margin = this.tabControl.Margin;
-            margin.Bottom = IsGridTab ? 0 : 10;
-            this.tabControl.Margin = margin;
+                margin.Bottom = 10;
+                this.tabControl.Margin = margin;
+            }
         }

         protected void RefreshAutoSplittingUI()


Fix warnings

Fix warnings

--- MatterControlLib/Utilities/AuthenticationData.cs
+++ MatterControlLib/Utilities/AuthenticationData.cs
@@ -1,28 +1,21 @@
-using MatterHackers.Agg;
-using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.MatterControl.SettingsManagement;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Formatters.Binary;
+using System.IO;
+using System.Text.RegularExpressions;
+using MatterHackers.Agg;
 using MatterHackers.Localizations;
-using System.Text.RegularExpressions;
 using Newtonsoft.Json;
-using MatterHackers.Agg.UI;

 namespace MatterHackers.MatterControl
 {
 	public class AuthenticationData
 	{
 		public RootedObjectEventHandler AuthSessionChanged = new RootedObjectEventHandler();
-		static int failedRequestCount = int.MaxValue;
+		private static int failedRequestCount = int.MaxValue;

 		public bool IsConnected
 		{
 			get
 			{
-				if(failedRequestCount > 5)
+				if (failedRequestCount > 5)
 				{
 					return false;
 				}
@@ -61,7 +54,7 @@

 		public void SessionRefresh()
 		{
-			//Called after completing a purchase (for example)
+			// Called after completing a purchase (for example)
 			AuthSessionChanged.CallEvents(null, null);
 		}

@@ -97,12 +90,10 @@
 		}

 		private string activeSessionKey;
+
 		public string ActiveSessionKey
 		{
-			get
-			{
-				return activeSessionKey;
-			}
+			get => activeSessionKey;
 			private set
 			{
 				activeSessionKey = value;
@@ -111,13 +102,11 @@
 		}

 		private string activeSessionUsername;
+
 		public string ActiveSessionUsername
 		{
-			get
-			{
-				// Only return the ActiveSessionUserName if the ActiveSessionKey field is not empty
-				return string.IsNullOrEmpty(ActiveSessionKey) ? null : activeSessionUsername;
-			}
+			// Only return the ActiveSessionUserName if the ActiveSessionKey field is not empty
+			get => string.IsNullOrEmpty(ActiveSessionKey) ? null : activeSessionUsername;
 			private set
 			{
 				activeSessionUsername = value;
@@ -126,12 +115,10 @@
 		}

 		private string activeSessionEmail;
+
 		public string ActiveSessionEmail
 		{
-			get
-			{
-				return activeSessionEmail;
-			}
+			get => activeSessionEmail;
 			private set
 			{
 				activeSessionEmail = value;
@@ -141,23 +128,15 @@

 		public string ActiveClientToken
 		{
-			get
-			{
-				return ApplicationSettings.Instance.get($"{ApplicationController.EnvironmentName}ActiveClientToken");
-			}
-			private set
-			{
-				ApplicationSettings.Instance.set($"{ApplicationController.EnvironmentName}ActiveClientToken", value);
-			}
+			get => ApplicationSettings.Instance.get($"{ApplicationController.EnvironmentName}ActiveClientToken");
+			private set => ApplicationSettings.Instance.set($"{ApplicationController.EnvironmentName}ActiveClientToken", value);
 		}

 		private string lastSessionUsername;
+
 		public string LastSessionUsername
 		{
-			get
-			{
-				return lastSessionUsername;
-			}
+			get => lastSessionUsername;
 			set
 			{
 				lastSessionUsername = value;


Refactored the UsersMvcController

Refactored the UsersMvcController

--- OneBitTask.Web/Controllers/UsersMvcController.cs
+++ OneBitTask.Web/Controllers/UsersMvcController.cs
@@ -5,10 +5,16 @@

     using Data.Repositories;
     using ViewModels;
+    using Models;

     public class UsersMvcController : Controller
     {
-        private UsersRepository data = new UsersRepository();
+        private IRepository<User> data;
+
+        public UsersMvcController(IRepository<User> data)
+        {
+            this.data = data;
+        }

         public ActionResult Index()
         {


Corrected bad reference from merge.

Corrected bad reference from merge.

--- PatientManagement.ViewModel/SaveFileViewModel.cs
+++ PatientManagement.ViewModel/SaveFileViewModel.cs
@@ -1,6 +1,5 @@
 using Common.Common;
 using EFC.BL;
-using EFC.BL.Utility;
 using PatientManagement.ViewModel.Services;
 using System.Windows.Input;

@@ -14,7 +13,6 @@
         }
         private static void Save(object obj)
         {
-            FormatBillId.BillIdFormatter();
             SendMessages();
             var edi = new UpdatedEdi();
             var save = new SaveToFile();


add extension methods

add extension methods

--- SolidworksAddinFramework/MathVectorExtensions.cs
+++ SolidworksAddinFramework/MathVectorExtensions.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Linq;
 using SolidWorks.Interop.sldworks;

 namespace SolidworksAddinFramework
@@ -39,12 +40,18 @@
             return (MathVector) v.MultiplyTransform(t);
         }

+        public static double LengthOfProjectionXY(this double[] vector)
+        {
+            return Math.Sqrt(vector.Take(2).Sum(c => Math.Pow(c, 2)));
+        }

-        public static double AngleBetweenVectors(this IMathVector v0, IMathVector v1)
+        public static double AngleBetweenVectorsSigned(this IMathVector v0, IMathVector v1)
         {
             if (((double[])v0.ArrayData).Length==((double[])v1.ArrayData).Length)
             {
-                return Math.Acos(v0.Dot(v1)/(v0.GetLength()*v1.GetLength()));
+                var sign = Math.Sign(((IMathVector) (v0.Cross(v1))).ArrayData.CastArray<double>()[2]);
+                var ret =  Math.Acos(v0.Dot(v1)/(v0.GetLength()*v1.GetLength()));
+                return sign*ret;
             }
             throw new Exception("Vectors must have the same dimension!");
         }


Compatibility with Infernal Robotics -Checks the path between the two candidate parts for hinges

--- ReCoupler/ReCouplerUtils.cs
+++ ReCoupler/ReCouplerUtils.cs
@@ -236,6 +236,11 @@
                     if (part.FindModulesImplementing<ModuleCargoBay>().Any(cargoBay => cargoBay.nodeInnerForeID == part.attachNodes[i].id || cargoBay.nodeInnerAftID == part.attachNodes[i].id))
                         doNotJoin = true;

+                    if (part.Modules.Contains("ModuleIRServo"))
+                        doNotJoin = true;
+                    if (part.Modules.Contains("MuMechToggle"))
+                        doNotJoin = true;
+
                     if (doNotJoin)
                         continue;
                 }
@@ -290,12 +295,141 @@
                 if (dist <= closestDist && Math.Abs(angleBtwn - 180) <= angle)
                 // but at least closer than the min radius because of the initialization of closestDist
                 {
+                    if (TreeHasKinks(checkNodes[j].owner, node.owner))
+                        continue;
+
                     log.debug(node.owner.name + "/" + checkNodes[j].owner.name + ": " + dist + "m, at " + angleBtwn + " deg.");
                     closestNode = checkNodes[j];
                 }
             }

             return closestNode;
+        }
+
+        public static bool TreeHasKinks(Part part1, Part part2)
+        {
+            try
+            {
+                int partsBetween = 0;
+                Part branchPart = FindCommonAncestor(part1, part2, out partsBetween);
+
+                // Populate Parts list
+                List<Part> partsToCheck = new List<Part>(partsBetween);
+                Part addPart;
+                if (branchPart != part1)
+                {
+                    addPart = part1;
+                    do
+                    {
+                        addPart = addPart.parent;
+                        partsToCheck.Add(addPart);
+                    } while (addPart != branchPart);
+                }
+                if (branchPart != part2)
+                {
+                    addPart = part2;
+                    do
+                    {
+                        addPart = addPart.parent;
+                        partsToCheck.Add(addPart);
+                    } while (addPart != branchPart);
+                }
+                partsToCheck.Remove(branchPart);
+
+                for (int i = partsToCheck.Count - 1; i >= 0; i--)
+                {
+                    if (PartIsInvalidForPath(partsToCheck[i]))
+                    {
+                        log.debug("Part: " + partsToCheck[i].name + " had an ineligible module.");
+                        return true;
+                    }
+                }
+
+                return false;
+            }
+            catch (Exception ex)
+            {
+                log.error("Encountered " + ex);
+                return true;
+            }
+        }
+
+        public static Part FindCommonAncestor(Part part1, Part part2, out int partsBetween)
+        {
+            Part rootPart1, rootPart2;
+            int lvlPart1 = FindPartLevel(part1, out rootPart1);
+            int lvlPart2 = FindPartLevel(part2, out rootPart2);
+            partsBetween = 0;
+            if (rootPart1 != rootPart2)
+            {
+                log.error("Parts are not part of the same tree.");
+                return null;
+            }
+
+            Part lowerPart, higherPart;
+            int lowerLvl, higherLvl;
+            if (lvlPart1 <= lvlPart2)
+            {
+                lowerPart = part2;
+                higherPart = part1;
+                lowerLvl = lvlPart2;
+                higherLvl = lvlPart1;
+            }
+            else
+            {
+                lowerPart = part1;
+                higherPart = part2;
+                lowerLvl = lvlPart1;
+                higherLvl = lvlPart2;
+            }
+            for (int lvl = lowerLvl; lvl > higherLvl; lvl--)
+            {
+                lowerPart = lowerPart.parent;
+                partsBetween += 1;
+            }
+            while (lowerPart != higherPart)
+            {
+                lowerPart = lowerPart.parent;
+                higherPart = higherPart.parent;
+                partsBetween += 2;
+            }
+            return lowerPart;
+        }
+
+        public static int FindPartLevel(Part part)
+        {
+            int lvl = 0;
+            Part checkPart = part;
+            while (checkPart.parent != null)
+            {
+                lvl += 1;
+                checkPart = checkPart.parent;
+            }
+            return lvl;
+        }
+
+        public static int FindPartLevel(Part part, out Part rootPart)
+        {
+            int lvl = 0;
+            Part checkPart = part;
+            while (checkPart.parent != null)
+            {
+                lvl += 1;
+                checkPart = checkPart.parent;
+            }
+            rootPart = checkPart;
+            return lvl;
+        }
+
+        public static bool PartIsInvalidForPath(Part part)
+        {
+            if (part.Modules.Contains("ModuleIRServo"))
+                return true;
+            if (part.Modules.Contains("MuMechToggle"))
+                return true;
+            if (part.Modules.Contains("ModuleGrappleNode"))
+                return true;
+            return false;
         }

         // Adapted from KASv1 by IgorZ


Fixed possible sql injection

Fixed possible sql injection

--- Services/DatabaseService.cs
+++ Services/DatabaseService.cs
@@ -177,10 +177,12 @@
                 using (var connection = new MySqlConnection(_connection))
                 {
                     var command = new MySqlCommand(
-                        $"INSERT INTO users SET username='{user.Username}', userid='{user.Id}', discriminator='{user.DiscriminatorValue}'," +
+                        $"INSERT INTO users SET username=@Username, userid='{user.Id}', discriminator='{user.DiscriminatorValue}'," +
                         $"avatar='{user.AvatarId}', " +
                         $"avatarURL='{user.GetAvatarUrl()}'," +
-                        $"bot='{(user.IsBot ? 1 : 0)}', status='{user.Status}', joinDate='{DateTime.Now:yyyy-MM-dd HH:mm:ss}'", connection);
+                        $"bot='{(user.IsBot ? 1 : 0)}', status=@Status, joinDate='{DateTime.Now:yyyy-MM-dd HH:mm:ss}'", connection);
+                    command.Parameters.AddWithValue("@Username", user.Username);
+                    command.Parameters.AddWithValue("@Status", user.Status);
                     connection.Open();
                     command.ExecuteNonQuery();
                     await _logging.LogAction($"User {user.Username}#{user.DiscriminatorValue} succesfully added to the databse.", true,
@@ -218,7 +220,8 @@
             {
                 using (var connection = new MySqlConnection(_connection))
                 {
-                    var command = new MySqlCommand($"UPDATE users SET {attribute}={value} WHERE userid='{id}'", connection);
+                    var command = new MySqlCommand($"UPDATE users SET {attribute}=@Value WHERE userid='{id}'", connection);
+                    command.Parameters.AddWithValue("@Value", value);
                     connection.Open();
                     command.ExecuteNonQuery();
                 }
@@ -237,7 +240,8 @@
                 value = MySqlHelper.EscapeString(value);
                 using (var connection = new MySqlConnection(_connection))
                 {
-                    var command = new MySqlCommand($"UPDATE users SET {attribute}={value} WHERE userid='{id}'", connection);
+                    var command = new MySqlCommand($"UPDATE users SET {attribute}=@Value WHERE userid='{id}'", connection);
+                    command.Parameters.AddWithValue("@Value", value);
                     connection.Open();
                     command.ExecuteNonQuery();
                 }


Expose underlying connection from ClientAgent.

--- SignalR/Hubs/ClientAgent.cs
+++ SignalR/Hubs/ClientAgent.cs
@@ -19,6 +19,14 @@
             get
             {
                 return new SignalAgent(_connection, key, _hubName);
+            }
+        }
+
+        public IConnection Connection
+        {
+            get
+            {
+                return _connection;
             }
         }


error

error

(TFS CS 6458)

--- Signum.Engine/Exceptions.cs
+++ Signum.Engine/Exceptions.cs
@@ -54,23 +54,48 @@
     {
         public string TableName { get; private set; }
         public string Field { get; private set; }
-        public Type RelatedType { get; private set; }
+        public Type TableType { get; private set; }

-        static Regex indexRegex = new Regex(@"""FK_(?<table>[^_]+)_(?<field>[^_""]+)""");
+        public string ReferedTableName { get; private set; }
+        public Type ReferedTableType { get; private set; }
+
+        public bool IsInsert { get; private set; }
+
+        static Regex indexRegex = new Regex(@"""FK_(?<table>[^_]+)_(?<field>[^_""]+)""");
+
+        static Regex referedTable = new Regex(@"table ""(?<referedTable>.+?)""");

         protected ForeignKeyException(SerializationInfo info, StreamingContext context) : base(info, context) { }

         public ForeignKeyException(SqlException inner) : base(null, inner)
         {
             Match m = indexRegex.Match(inner.Message);
-            if (m != null)
+
+            if (m.Success)
             {
                 TableName = m.Groups["table"].Value;
                 Field = m.Groups["field"].Value;
-                RelatedType = Schema.Current.Tables
+                TableType = Schema.Current.Tables
                     .Where(kvp => kvp.Value.Name == TableName)
                     .Select(p => p.Key)
                     .SingleOrDefault();
+            }
+
+            if(inner.Message.Contains("INSERT"))
+            {
+                IsInsert = true;
+
+                Match m2 = referedTable.Match(inner.Message);
+                if (m2.Success)
+                {
+                    ReferedTableName = m2.Groups["referedTable"].Value.Split('.').Last();
+                    ReferedTableType = Schema.Current.Tables
+                                    .Where(kvp => kvp.Value.Name == ReferedTableName)
+                                    .Select(p => p.Key)
+                                    .SingleOrDefault();
+
+                    ReferedTableType = Reflector.ExtractEnumProxy(ReferedTableType) ?? ReferedTableType;
+                }
             }
         }

@@ -81,9 +106,14 @@
                 if (TableName == null)
                     return InnerException.Message;

-                return (RelatedType == null) ?
-                    Resources.ThereAreRecordsIn0PointingToThisTableByColumn1.Formato(TableName, Field) :
-                    Resources.ThereAre0ThatReferThisEntity.Formato(RelatedType.NicePluralName());
+                if (IsInsert)
+                    return (TableType == null || ReferedTableType == null) ?
+                        "The column {0} on table {1} does not reference {2}".Formato(Field, TableName, ReferedTableName) :
+                        "The column {0} of the {1} does not refer to a valid {2}".Formato(Field, TableType.NiceName(), ReferedTableType.NiceName());
+                else
+                    return (TableType == null) ?
+                        Resources.ThereAreRecordsIn0PointingToThisTableByColumn1.Formato(TableName, Field) :
+                        Resources.ThereAre0ThatReferThisEntity.Formato(TableType.NicePluralName());
             }
         }
     }


ReadHttpHeaders extension method, and testing Http listener.

--- Source/Core/HttpListener.cs
+++ Source/Core/HttpListener.cs
@@ -5,6 +5,7 @@
 using System.Threading.Tasks;
 using System.IO;
 using System.Collections.Generic;
+using System.Text;

 namespace SharpFlare
 {
@@ -54,20 +55,67 @@
 			}
 		}

-		static char[] _SplitString = new char[1]{' '};
+		public static async Task<int> ReadHttpHeaders(this SocketStream self, byte[] buff, int pos, int length)
+		{
+			int at = 0;
+			int lf_count = 0;
+
+			return await self.ReadUntil(buff, pos, length, delegate(byte[] peekbuff, int offset, int peeklength)
+			{
+				for(; at < peeklength; at++)
+				{
+					if(peekbuff[offset + at] == '\n')
+					{
+						lf_count++;
+						if(lf_count == 2)
+							return at;
+					}
+					else if(peekbuff[offset + at] != '\r')
+						lf_count = 0;
+				}
+				return -1;
+			});
+		}

 		private static async void _HandleSocketTask(Socket socket)
 		{
 			SocketStream str = new SocketStream(socket);
 			byte[] buff = new byte[4096];

-			while(str.Connected)
+
+			string html =
+@"
+
+		<title>SharpFlare test!</title>
+
+
+
Hello, world!

+
+";
+			string response =
+@"HTTP/1.1 200 Okay
+Connection: keep-alive
+Content-Type: text/html
+Content-Length: " + html.Length.ToString() + @"
+
+" + html;
+
+			try
 			{
-				// read headers
-				while(true)
+				while(str.Connected)
 				{
-					Console.WriteLine(await str.ReadLine());
+					int len = await str.ReadHttpHeaders(buff, 0, buff.Length);
+					string[] lines = Encoding.UTF8.GetString(buff, 0, len).Split('\n');
+
+					Console.WriteLine(lines[0]);
+
+					await str.Write(response);
+
+					Console.WriteLine("wrote {0} bytes", response.Length);
 				}
+			}
+			catch(SocketException s)
+			{
 			}
 		}
 	}


Make ToolTip/Image/Shortcut non-virtual.  If setting these values in a constructor, then the behaviour is undefined.

--- Source/Eto/Forms/Command.cs
+++ Source/Eto/Forms/Command.cs
@@ -126,13 +126,13 @@

 		public string ToolBarText { get; set; }

-		public virtual string ToolTip { get; set; }
+		public string ToolTip { get; set; }

 		public bool ShowLabel { get; set; }

-		public virtual Image Image { get; set; }
+		public Image Image { get; set; }

-		public virtual Keys Shortcut { get; set; }
+		public Keys Shortcut { get; set; }

 		#endregion


Renamed methodInfo to reflect the fact that it's now a MethodBase.

--- Src/Idioms/MethodContext.cs
+++ Src/Idioms/MethodContext.cs
@@ -11,21 +11,21 @@
     public class MethodContext : IVerifiableBoundary
     {
         private readonly ISpecimenBuilderComposer composer;
-        private readonly MethodBase methodInfo;
+        private readonly MethodBase methodBase;

-        public MethodContext(ISpecimenBuilderComposer composer, MethodBase methodInfo)
+        public MethodContext(ISpecimenBuilderComposer composer, MethodBase methodBase)
         {
             if (composer == null)
             {
                 throw new ArgumentNullException("composer");
             }
-            if (methodInfo == null)
+            if (methodBase == null)
             {
-                throw new ArgumentNullException("methodInfo");
+                throw new ArgumentNullException("methodBase");
             }

             this.composer = composer;
-            this.methodInfo = methodInfo;
+            this.methodBase = methodBase;
         }

         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -37,7 +37,7 @@
         [EditorBrowsable(EditorBrowsableState.Never)]
         public MethodBase MethodBase
         {
-            get { return this.methodInfo; }
+            get { return this.methodBase; }
         }

         #region IVerifiableBoundary Members


Removed warning for .sentry files.

Removed warning for .sentry files.

--- SteamSentryTool/MainForm.cs
+++ SteamSentryTool/MainForm.cs
@@ -17,13 +17,13 @@
             UsernameBox.Select();
         }

-        private void SelectorButton_Click(object sender, System.EventArgs e)
+        private void SelectorButton_Click(object sender, EventArgs e)
         {
             OpenFileDialog selector = new OpenFileDialog();

             if (selector.ShowDialog() != DialogResult.OK)
                 return;
-            if (selector.SafeFileName.Contains(".") && !selector.SafeFileName.EndsWith(".ssfn") && !selector.SafeFileName.EndsWith(".bin"))
+            if (selector.SafeFileName.Contains(".") && !selector.SafeFileName.EndsWith(".ssfn") && !selector.SafeFileName.EndsWith(".bin") && !selector.SafeFileName.EndsWith(".sentry"))
                 if (MessageBox.Show("This does not appear to be a sentry file. Continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                     return;


delete TryPaginatePartial

delete TryPaginatePartial

--- Signum.Engine/DynamicQuery/DynamicQuery.cs
+++ Signum.Engine/DynamicQuery/DynamicQuery.cs
@@ -216,7 +216,7 @@
                 .Where(request.Filters)
                 .OrderBy(request.Orders)
                 .Select(request.Columns)
-                .TryPaginatePartial(request.Pagination.MaxElementIndex);
+                .TryPaginate(request.Pagination);
         }

         #endregion
@@ -533,33 +533,6 @@
         }
         #endregion

-        #region TryPaginatePartial
-        public static DEnumerableCount<T> TryPaginatePartial<T>(this DQueryable<T> query, int? maxElementIndex)
-        {
-            if (maxElementIndex.HasValue)
-            {
-                List<object> list = query.Query.Take(maxElementIndex.Value).ToList();
-                int count = list.Count < maxElementIndex.Value ? list.Count : query.Query.Count();
-
-                return new DEnumerableCount<T>(list, query.Context, count);
-            }
-            else
-            {
-                List<object> list = query.Query.ToList();
-                return new DEnumerableCount<T>(list, query.Context, list.Count);
-            }
-        }
-
-        public static DEnumerableCount<T> TryPaginatePartial<T>(this DEnumerable<T> collection, int? maxElementIndex)
-        {
-            int count = collection.Collection.Count();
-
-            if (maxElementIndex.HasValue)
-                return new DEnumerableCount<T>(collection.Collection.Take(maxElementIndex.Value), collection.Context, count);
-
-            return new DEnumerableCount<T>(collection.Collection, collection.Context, count);
-        }
-        #endregion

         #region TryPaginate


Fix fuel consumption

Fix fuel consumption

--- SimShift/SimShift/Models/Ets2Drivetrain.cs
+++ SimShift/SimShift/Models/Ets2Drivetrain.cs
@@ -130,7 +130,7 @@
                             + 0.027293*throttle
                             + 0.0019368;

-            var fuel = amplitude* linearity;
+            var fuel = amplitude* linearity*1.22;
             fuel -= 0.25;
             if (fuel < 0) fuel = 0;
             return fuel;


Changed view of messagebox

Changed view of messagebox

--- SimpleCiphers/ViewModels/ShellViewModel.cs
+++ SimpleCiphers/ViewModels/ShellViewModel.cs
@@ -2,10 +2,7 @@
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
-using System.Reflection;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Interop;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using Caliburn.Micro;
@@ -260,7 +257,15 @@

         public static void ShowError(string error)
         {
-            MessageBox.Show(error, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            var mbox = new Xceed.Wpf.Toolkit.MessageBox
+            {
+                Caption = "Ошибка",
+                Text = error,
+                FontSize = 15,
+                WindowBackground = new SolidColorBrush(Colors.DarkRed),
+                CaptionForeground = new SolidColorBrush(Colors.White)
+            };
+            mbox.ShowDialog();
         }

         // Доступность кнопок


Fixed wrong ordering when removing junk

Fixed wrong ordering when removing junk

--- source/BulkCrapUninstaller/Functions/AppUninstaller.cs
+++ source/BulkCrapUninstaller/Functions/AppUninstaller.cs
@@ -392,9 +392,9 @@

                     var sortedJunk = from item in selectedJunk
                                      // Run commands before deleting any files or reg keys to avoid missing files
-                                     orderby item is RunProcessJunk descending
+                                     orderby item is RunProcessJunk descending,
                                      // Need to stop and unregister service before deleting its exe
-                                     orderby item is StartupJunkNode descending
+                                             item is StartupJunkNode descending
                                      select item;

                     foreach (var junkNode in sortedJunk)


unit tests for Reply.NoError(value)

unit tests for Reply.NoError(value)

--- source/MlIB.Reply.Tests.Unit/Features/Reply_NoError.cs
+++ source/MlIB.Reply.Tests.Unit/Features/Reply_NoError.cs
@@ -9,20 +9,41 @@

         //public static Reply<T> NoError<T>(T value)

-        //I:valid
-        //O:
+        //I:null value
+        //O:has no error
+        //O:null as value
+        [TestMethod]
+        public void Reply_NoError_value_null()
+        {
+            var result = M.Reply.NoError<string>(null);

-        //I:valid exception
-        //O:
+            Assert.IsFalse(result.HasError, "WHY HAS ERROR??");
+            Assert.AreEqual(null, result.Value, "WHY NOT EXPECTED VALUE??");
+        }

-        //I:null
-        //O:
+        //I:valid value
+        //O:has no error
+        //O:expected valid value
+        [TestMethod]
+        public void Reply_NoError_value_valid()
+        {
+            var result = M.Reply.NoError(Stubs.Common.VAL_anyValue);

-        //[TestMethod]
-        //public void TestMethod1()
-        //{
+            Assert.IsFalse(result.HasError, "WHY HAS ERROR??");
+            Assert.AreEqual(Stubs.Common.VAL_anyValue, result.Value, "WHY NOT EXPECTED VALUE??");
+        }

-        //}
+        //I:valid exception value
+        //O:has no error
+        //O:exception as value
+        [TestMethod]
+        public void Reply_NoError_value_exception()
+        {
+            var result = M.Reply.NoError(Stubs.Common.EXCEPTION);
+
+            Assert.IsFalse(result.HasError, "WHY HAS ERROR??");
+            Assert.AreEqual(Stubs.Common.EXCEPTION, result.Value, "WHY NOT EXPECTED VALUE??");
+        }

     }
 }


removes uneccessary methods

removes uneccessary methods

--- SmartSavingContract/SmartSavingContract.cs
+++ SmartSavingContract/SmartSavingContract.cs
@@ -251,28 +251,9 @@
                 );
         }

-
-        //Get the sender's public key
-        private static byte[] GetSender()
-        {
-            Runtime.Log("Fetching transaction");
-            Transaction tx = (Transaction) ExecutionEngine.ScriptContainer;
-            Runtime.Log("Fetched transaction");
-            TransactionOutput[] reference = tx.GetReferences();
-            Runtime.Log("reference");
-            TransactionOutput firstReference = reference[0];
-            Runtime.Log("first reference");
-            return firstReference.ScriptHash;
-        }
-
         private static ulong GetNeoContributionValue()
         {
             return GetAssetContribution(NEO);
-        }
-
-        private static ulong GetNeoGasContributionValue()
-        {
-            return GetAssetContribution(NEO_GAS);
         }

         private static ulong GetAssetContribution(byte[] assetId)


Font CopyData Bugfix #FIX: Fixed not re-generating the kerning lookup data structure in the target after copying Font data.

--- Source/Core/Duality/Resources/Font/Font.cs
+++ Source/Core/Duality/Resources/Font/Font.cs
@@ -645,6 +645,7 @@
 			c.GenerateCharLookup();
 			c.GenerateTexture();
 			c.GenerateMaterial();
+			c.GenerateKerningLookup();
 		}
 	}
 }


Fixed some style tests

Fixed some style tests

--- Source/GameFifteen.GridTests/StyleTests.cs
+++ Source/GameFifteen.GridTests/StyleTests.cs
@@ -19,8 +19,8 @@

         private readonly BorderStyleType[] styleTypes = new BorderStyleType[]
         {
-            BorderStyleType.Dotted, BorderStyleType.Double, BorderStyleType.Fat, BorderStyleType.MiddleFat,
-            BorderStyleType.Default,  BorderStyleType.Solid, BorderStyleType.Asteriks
+            BorderStyleType.Dotted, BorderStyleType.Double, BorderStyleType.Fat, BorderStyleType.Middlefat,
+            BorderStyleType.Default,  BorderStyleType.Solid, BorderStyleType.Asterisk
         };

         private GridBorderStyle gridStyle;
@@ -42,7 +42,7 @@
             string allBorders = this.gridStyle.Bottom + this.gridStyle.Top + this.gridStyle.Left + this.gridStyle.Right;
             bool result = allBorders.All(ch => ch == '*' || ch == ' ');
             Assert.AreEqual(true, result);
-            Assert.AreEqual(BorderStyleType.Asteriks, this.gridStyle.Type);
+            Assert.AreEqual(BorderStyleType.Asterisk, this.gridStyle.Type);
         }

         [TestMethod]
@@ -92,7 +92,7 @@
             string allBorders = this.gridStyle.Bottom + this.gridStyle.Top + this.gridStyle.Left + this.gridStyle.Right;
             bool result = allBorders.All(ch => "▄▀▐▌ ".Contains(ch));
             Assert.AreEqual(true, result);
-            Assert.AreEqual(BorderStyleType.MiddleFat, this.gridStyle.Type);
+            Assert.AreEqual(BorderStyleType.Middlefat, this.gridStyle.Type);
         }

         [TestMethod]


(maint) Extracted aquiral of tagged release to own method

This change is necessary to get rid
of duplication reported by InspectCode.

--- Source/GitReleaseManager/GitHubProvider.cs
+++ Source/GitReleaseManager/GitHubProvider.cs
@@ -78,8 +78,7 @@

         public async Task<Release> GetSpecificRelease(string tagName, string user, string repository)
         {
-            var allReleases = await _gitHubClient.Repository.Release.GetAll(user, repository).ConfigureAwait(false);
-            return _mapper.Map<Release>(allReleases.FirstOrDefault(r => r.TagName == tagName));
+            return _mapper.Map<Release>(await GetReleaseFromTagNameAsync(user, repository, tagName).ConfigureAwait(false));
         }

         public ReadOnlyCollection<Milestone> GetReadOnlyMilestones(string user, string repository)
@@ -131,7 +130,7 @@

         public async Task<Release> CreateReleaseFromMilestone(string owner, string repository, string milestone, string releaseName, string targetCommitish, IList<string> assets, bool prerelease)
         {
-            var release = await GetRelease(owner, repository, milestone).ConfigureAwait(false);
+            var release = await GetReleaseFromTagNameAsync(owner, repository, milestone).ConfigureAwait(false);
             var releaseNotesBuilder = new ReleaseNotesBuilder(this, owner, repository, milestone, _configuration);
             var result = await releaseNotesBuilder.BuildReleaseNotes().ConfigureAwait(false);

@@ -178,8 +177,7 @@

         public async Task DiscardRelease(string owner, string repository, string name)
         {
-            var allReleases = await _gitHubClient.Repository.Release.GetAll(owner, repository).ConfigureAwait(false);
-            var release = allReleases.FirstOrDefault(r => r.TagName == name);
+            var release = await GetReleaseFromTagNameAsync(owner, repository, name).ConfigureAwait(false);

             if (release == null)
             {
@@ -197,7 +195,7 @@

         public async Task AddAssets(string owner, string repository, string tagName, IList<string> assets)
         {
-            var release = await GetRelease(owner, repository, tagName).ConfigureAwait(false);
+            var release = await GetReleaseFromTagNameAsync(owner, repository, tagName).ConfigureAwait(false);

             if (release == null)
             {
@@ -291,7 +289,7 @@

         public async Task PublishRelease(string owner, string repository, string tagName)
         {
-            var release = await GetRelease(owner, repository, tagName).ConfigureAwait(false);
+            var release = await GetReleaseFromTagNameAsync(owner, repository, tagName).ConfigureAwait(false);

             if (release == null)
             {
@@ -368,9 +366,10 @@
             }
         }

-        private async Task<Octokit.Release> GetRelease(string owner, string repository, string tagName)
+        private async Task<Octokit.Release> GetReleaseFromTagNameAsync(string owner, string repository, string tagName)
         {
             var releases = await _gitHubClient.Repository.Release.GetAll(owner, repository).ConfigureAwait(false);
+
             var release = releases.FirstOrDefault(r => r.TagName == tagName);
             return release;
         }


Added a damage calculation function

Added a damage calculation function

--- SpaceAceWPF/SpaceAceWPF/MainWindow.xaml.cs
+++ SpaceAceWPF/SpaceAceWPF/MainWindow.xaml.cs
@@ -121,6 +121,8 @@
                 p2_ship.bitmap.EndInit();
                 this.Player2.Source = p2_ship.bitmap;
             }
+
+            this.WindowState = System.Windows.WindowState.Maximized;
         }

         private void countdown()
@@ -134,14 +136,14 @@
                         player1Loc.Left = Left_Margin;
                         if (TwoPlayer)
                         {
-                            player1Loc.Top = (Bottom_Margin - Top_Margin + this.Player1_Label_View.ActualHeight)/3;
+                            player1Loc.Top = (Bottom_Margin + Top_Margin)/3;
                             Thickness player2Loc = this.Player2.Margin;
                             player2Loc.Top = 2*player1Loc.Top;
                             player2Loc.Left = Left_Margin;
                             this.Player2.Margin = player2Loc;
                         }
                         else
-                            player1Loc.Top = (Bottom_Margin - Top_Margin + this.Player1_Label_View.ActualHeight) / 2;
+                            player1Loc.Top = (Bottom_Margin + Top_Margin) / 2;
                         this.Player1.Margin = player1Loc;

                         this.count.Visibility = Visibility.Visible;
@@ -525,14 +527,14 @@
                 collision = false;
                 if (checkCollision(p1_ship, asteroids[i]))
                 {
-                    p1_ship.shield -= 10;
+                    calculateDamage(p1_ship, asteroids[i]);
                     this.Shield1.Text = "SHIELDS: " + p1_ship.shield.ToString() + "%";
                     collision = true;
                 }

                 if(TwoPlayer && checkCollision(p2_ship, asteroids[i]))
                 {
-                    p2_ship.shield -= 10;
+                    calculateDamage(p2_ship, asteroids[i]);
                     this.Shield2.Text = "SHIELDS: " + p2_ship.shield.ToString() + "%";
                     collision = true;
                 }
@@ -668,6 +670,14 @@
             return pixels;
         }

+        private void calculateDamage(Spaceship ship, Projectile asteroid)
+        {
+            double speed = ship.speed.X + asteroid.speed.X;
+            double sizeRatio = (asteroid.image.ActualHeight * asteroid.image.ActualWidth) / (ship.image.ActualHeight * ship.image.ActualWidth);
+
+            ship.shield = Math.Max(0, ship.shield - Math.Max(1, ((int)(speed * sizeRatio)/4)));
+        }
+
         private void pause_inputEvent(InputType inType, Key key)
         {
             if (App.menuDelay != 0)


Breytu bætt við í HomeController

Breytu bætt við í HomeController

--- verklegt/Controllers/HomeController.cs
+++ verklegt/Controllers/HomeController.cs
@@ -32,6 +32,7 @@
         public ActionResult About()
         {
             ViewBag.Message = "Jhehehehen";
+			string x = "10";

             return View();
         }


added MinusOne to match System.Numerics

added MinusOne to match System.Numerics

--- Src/Microsoft.Dynamic/Math/BigIntegerV2.cs
+++ Src/Microsoft.Dynamic/Math/BigIntegerV2.cs
@@ -41,6 +41,8 @@
         public static readonly BigInteger Zero = new BigInteger(0, new uint[0]);
         [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
         public static readonly BigInteger One = new BigInteger(+1, new uint[] { 1 });
+        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
+        public static readonly BigInteger MinusOne = new BigInteger(-1, new uint[] { 1 });
         private const int bias = 1075;

         [CLSCompliant(false)]


Update MetricsCollection.cs (#2470)

Update MetricsCollection.cs (#2470)

--- BASE/src/Microsoft.ApplicationInsights/Metrics/MetricsCollection.cs
+++ BASE/src/Microsoft.ApplicationInsights/Metrics/MetricsCollection.cs
@@ -37,7 +37,7 @@
         /// <summary>Gets the specified metric, or creates one if no such metric exists.</summary>
         /// <param name="metricIdentifier">The identity of the metric.</param>
         /// <param name="metricConfiguration">@The configutration of the metric.</param>
-        /// <returns>A metric witht he specified identify and configuration.</returns>
+        /// <returns>A metric with the specified identify and configuration.</returns>
         /// <exception cref="ArgumentException">If a metric with the specified identify exists,
         /// but its configuration does not match the specified configuration.
         /// You may not change a metric configurations once a metric was created for the first time.
@@ -192,4 +192,4 @@
                                                      + " To add a new metric, use the GetOrCreate(..) method.");
         }
     }
-}+}


Implemented Command Line arguments for the DemoConsoleServer console application

For 1 argument: you can either add the port or the directory.
For 2 arguments you can supply both port and directory in any order

--- DemoConsoleServer/ConsoleServer.cs
+++ DemoConsoleServer/ConsoleServer.cs
@@ -9,7 +9,34 @@
             Console.WriteLine("This is a VERY basic Embark server.");
             Console.WriteLine("No fancy logging/feedback or UI.. yet!\r\n");

-            var server = new Embark.Server(@"C:\MyTemp\Embark\Server");
+            var port = 8030;
+            var dir = @"C:\MyTemp\Embark\Server";
+
+
+            if (args.Length == 1)
+            {
+                int p;
+                if (int.TryParse(args[0], out p))
+                    port = p;
+                else
+                    dir = args[0].ToString();
+            }
+            else if (args.Length > 1)
+            {
+                int p;
+                if (int.TryParse(args[0], out p))
+                {
+                    port = p;
+                    dir = args[1].ToString();
+                }
+                else if (int.TryParse(args[1], out p))
+                {
+                    port = p;
+                    dir = args[0].ToString();
+                }
+            }
+
+            var server = new Embark.Server(dir, port);
             try
             {
                 server.Start();


last of the LabController tests

last of the LabController tests

--- Test/TestsController/LabControllerTests.cs
+++ Test/TestsController/LabControllerTests.cs
@@ -1958,18 +1958,37 @@

         #endregion Search

-        [Fact(Skip = "Reminder to test the rest")]
-        public void TestTheRestReminder()
+        #region JsonDetails
+
+        [Fact]
+        public async Task TestJsonDetailsReturnsNotFound()
         {
             // Arrange

             // Act
-
-
-            // Assert
-        }
+            var controllerResult = await Controller.JsonDetails(9);
+
+            // Assert
+            Assert.IsType<NotFoundResult>(controllerResult);
+        }
+
+        [Fact]
+        public async Task TestJsonDetailsReturnsView()
+        {
+            // Arrange
+
+
+            // Act
+            var controllerResult = await Controller.JsonDetails(2);
+
+            // Assert
+            var jsonResult = Assert.IsType<JsonResult>(controllerResult);
+            var details = Assert.IsType<OrderDetails>(jsonResult.Value);
+            details.ClientInfo.ClientId.ShouldBe("ClientId2");
+        }
+        #endregion JsonDetails
     }

     [Trait("Category", "Controller Reflection")]


Update JournalMissionCompleted.cs

Update JournalMissionCompleted.cs

--- EDDiscovery/EliteDangerous/JournalEvents/JournalMissionCompleted.cs
+++ EDDiscovery/EliteDangerous/JournalEvents/JournalMissionCompleted.cs
@@ -28,7 +28,7 @@
             TargetType = JSONHelper.GetStringDef(evt["TargetType"]);
             TargetFaction = JSONHelper.GetStringDef(evt["TargetFaction"]);
             Reward = JSONHelper.GetLongNull(evt["Reward"]) ?? 0;
-            Donation = JSONHelper.GetLongNull(evt["Donation"]);
+            Donation = JSONHelper.GetLongNull(evt["Donation"]) ?? 0;
             MissionId = JSONHelper.GetInt(evt["MissionID"]);

             if (!JSONHelper.IsNullOrEmptyT(evt["PermitsAwarded"]))
@@ -84,7 +84,7 @@

         public void Ledger(EDDiscovery2.DB.MaterialCommoditiesLedger mcl, DB.SQLiteConnectionUser conn)
         {
-            mcl.AddEvent(Id, EventTimeUTC, EventTypeID, Name, Reward , 0);
+            mcl.AddEvent(Id, EventTimeUTC, EventTypeID, Name, (Reward - Donation) , 0);
         }

     }


Make sure the mod collection is updated on the main thread

--- Libraries/ModInstallation/Implementations/DefaultLocalModManager.cs
+++ Libraries/ModInstallation/Implementations/DefaultLocalModManager.cs
@@ -6,6 +6,7 @@
 using System.ComponentModel.Composition;
 using System.IO;
 using System.Linq;
+using System.Reactive.Linq;
 using System.Threading.Tasks;
 using ModInstallation.Annotations;
 using ModInstallation.Implementations.DataClasses;
@@ -71,6 +72,7 @@
         {
             get { return _wrappedModification.LogoUri; }
         }
+
         public IPostInstallActions PostInstallActions
         {
             get { return _wrappedModification.PostInstallActions; }
@@ -81,14 +83,14 @@
             get { return _installPath; }
         }

+        #region Implementation of IEquatable<IModification>
+
+        public bool Equals(IModification other)
+        {
+            return _wrappedModification.Equals(other);
+        }
+
         #endregion
-
-        #region Implementation of IEquatable<IModification>
-
-        public bool Equals(IModification other)
-        {
-            return _wrappedModification.Equals(other);
-        }

         #endregion
     }
@@ -124,10 +126,10 @@
                 string content;
                 using (var reader = File.OpenText(packageFile))
                 {
-                    content = await reader.ReadToEndAsync();
-                }
-
-                modData = await Task.Run(() => JsonConvert.DeserializeObject<Modification>(content));
+                    content = await reader.ReadToEndAsync().ConfigureAwait(false);
+                }
+
+                modData = await Task.Run(() => JsonConvert.DeserializeObject<Modification>(content)).ConfigureAwait(false);

                 if (modData.packages.Any(p => p.name == package.Name))
                 {
@@ -148,7 +150,7 @@
                 {
                     NullValueHandling = NullValueHandling.Ignore,
                     Formatting = Formatting.Indented
-                }));
+                })).ConfigureAwait(false);

             var directoryName = Path.GetDirectoryName(packageFile);
             if (directoryName != null && !Directory.Exists(directoryName))
@@ -160,7 +162,7 @@
             {
                 using (var writer = new StreamWriter(stream))
                 {
-                    await writer.WriteAsync(json);
+                    await writer.WriteAsync(json).ConfigureAwait(false);
                 }
             }

@@ -171,12 +173,12 @@
                 return;
             }

-            AddModification(newData);
+            await AddModification(newData).ConfigureAwait(false);
         }

         public async Task ParseLocalModDataAsync()
         {
-            _modifications.Clear();
+            await Observable.Start(() => _modifications.Clear(), RxApp.MainThreadScheduler);

             if (PackageDirectory == null)
             {
@@ -199,33 +201,38 @@
                         continue;
                     }

-                    await ProcessModFile(modFile);
+                    await ProcessModFile(modFile).ConfigureAwait(false);
                 }
             }
         }

         #endregion

-        private void AddModification([NotNull] IModification newData)
-        {
-            int currentIndex;
-            for (currentIndex = 0; currentIndex < _modifications.Count; ++currentIndex)
-            {
-                if (_modifications[currentIndex].Id == newData.Id)
-                {
-                    break;
-                }
-            }
-
-            var installedMod = new InstalledMod(newData, GetInstallationDirectory(newData));
-            if (currentIndex >= 0 && currentIndex < _modifications.Count)
-            {
-                _modifications[currentIndex] = installedMod;
-            }
-            else
-            {
-                _modifications.Add(installedMod);
-            }
+        private async Task AddModification([NotNull] IModification newData)
+        {
+            // Always execute this on the UI thread
+            await Observable.Start(() =>
+            {
+                int currentIndex;
+                for (currentIndex = 0; currentIndex < _modifications.Count; ++currentIndex)
+                {
+                    if (_modifications[currentIndex].Id == newData.Id)
+                    {
+                        break;
+                    }
+                }
+
+                var installedMod = new InstalledMod(newData, GetInstallationDirectory(newData));
+                if (currentIndex >= 0 && currentIndex < _modifications.Count)
+                {
+                    _modifications[currentIndex] = installedMod;
+                }
+                else
+                {
+                    _modifications.Add(installedMod);
+                }
+            },
+                RxApp.MainThreadScheduler);
         }

         [NotNull]
@@ -238,7 +245,7 @@
                 {
                     using (var reader = new StreamReader(stream))
                     {
-                        content = await reader.ReadToEndAsync();
+                        content = await reader.ReadToEndAsync().ConfigureAwait(false);
                     }
                 }
             }
@@ -251,7 +258,7 @@
             Modification mod;
             try
             {
-                mod = await Task.Run(() => JsonConvert.DeserializeObject<Modification>(content));
+                mod = await Task.Run(() => JsonConvert.DeserializeObject<Modification>(content)).ConfigureAwait(false);
             }
             catch (Exception e)
             {
@@ -266,7 +273,7 @@
                 return;
             }

-            AddModification(modInstance);
+            await AddModification(modInstance).ConfigureAwait(false);
         }

         [NotNull]


more simple

more simple

--- Chap32/ジェネリックのパターンマッチング/ジェネリックのパターンマッチング/Program.cs
+++ Chap32/ジェネリックのパターンマッチング/ジェネリックのパターンマッチング/Program.cs
@@ -1,10 +1,6 @@
 using System;

-public class A
-{
-}
-
-public class B : A
+public class B
 {
     public void sub() => Console.WriteLine("in sub");
 }
@@ -12,7 +8,7 @@
 class Program
 {
     private static void anyTypeSampleMethod<T>(T para)
-        where T : A
+
     {
         if (para is B b1) b1.sub();


In case a new data file was created or there are no transactions trying to deserialize the data returned 'null'. Introduced dedicated check to ensure we have some data to parse.

--- src/Accountant.Web/Models/FileTransactionRepository.cs
+++ src/Accountant.Web/Models/FileTransactionRepository.cs
@@ -26,9 +26,14 @@
             {
                 File.Create(_filePath).Dispose();
             }
-
-            JsonSerializer serializer = new JsonSerializer();
-            _transactions = JsonConvert.DeserializeObject<IList<Transaction>>(File.ReadAllText(_filePath));
+
+            var rawData = File.ReadAllText(_filePath);
+
+            if (!string.IsNullOrWhiteSpace(rawData))
+            {
+                JsonSerializer serializer = new JsonSerializer();
+                _transactions = JsonConvert.DeserializeObject<IList<Transaction>>(rawData);
+            }
         }

         public Transaction GetById(int id)


Add Script as a shortcut type

Add Script as a shortcut type

--- src/Assets/Plugins/Editor/Shortcuter/Util/TypeUtils.cs
+++ src/Assets/Plugins/Editor/Shortcuter/Util/TypeUtils.cs
@@ -17,6 +17,7 @@
 			var types = new Dictionary<string, System.Type>();
 			types.Add("Scene", null);
 			types.Add("Prefab", typeof(UnityEngine.Object));
+			types.Add("Script", typeof(UnityEngine.Object));
 			types.Add("AnimatorController", typeof(AnimatorController));
 			types.Add("Animation", typeof(Animation));
 			types.Add("Material", typeof(Material));


Marked as [Serializable] to fix: System.Runtime.Serialization.SerializationException

--- src/Beethoven/Beethoven.Plugins/Security/Capability.cs
+++ src/Beethoven/Beethoven.Plugins/Security/Capability.cs
@@ -33,6 +33,7 @@
 namespace Beethoven.Plugins.Security
 {
     [DataContract]
+    [Serializable]
     public class Capability
     {
         [DataMember]


layout

layout

--- src/BizTalk.Unit/Component/PipelineComponentFixture.cs
+++ src/BizTalk.Unit/Component/PipelineComponentFixture.cs
@@ -1,6 +1,6 @@
 #region Copyright & License

-// Copyright © 2012 - 2013 François Chabot, Yves Dierick
+// Copyright © 2012 - 2015 François Chabot, Yves Dierick
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -40,10 +40,6 @@
 	/// </typeparam>
 	public abstract class PipelineComponentFixture<T> where T : PipelineComponent, new()
 	{
-		protected Be.Stateless.BizTalk.Unit.Message.Mock<IBaseMessage> MessageMock { get; set; }
-
-		protected Mock<IPipelineContext> PipelineContextMock { get; set; }
-
 		protected virtual IEnumerable<PropertyInfo> BrowsableProperties
 		{
 			get
@@ -59,6 +55,10 @@
 			}
 		}

+		protected Message.Mock<IBaseMessage> MessageMock { get; set; }
+
+		protected Mock<IPipelineContext> PipelineContextMock { get; set; }
+
 		protected T CreatePipelineComponent()
 		{
 			return new T();
@@ -76,7 +76,7 @@
 		[SetUp]
 		public void SetUp()
 		{
-			MessageMock = new Be.Stateless.BizTalk.Unit.Message.Mock<IBaseMessage> { DefaultValue = DefaultValue.Mock };
+			MessageMock = new Message.Mock<IBaseMessage> { DefaultValue = DefaultValue.Mock };
 			PipelineContextMock = new Mock<IPipelineContext> { DefaultValue = DefaultValue.Mock };
 			// default behaviour analogous to actual IPipelineContext implementation
 			PipelineContextMock
@@ -164,8 +164,7 @@
 		public void AllPropertiesConvertToStringAndBack()
 		{
 			var sut = CreatePipelineComponent();
-			BrowsableProperties.Each(
-				p => new BaggableProperty(p, GetValueForProperty).EnsureConvertToStringAndBack(p.GetValue(sut, null)));
+			BrowsableProperties.Each(p => new BaggableProperty(p, GetValueForProperty).EnsureConvertToStringAndBack(p.GetValue(sut, null)));
 		}

 		[Test]


refactor

refactor

--- src/Cap.Consistency/Internal/ConsumerInvokerFactory.cs
+++ src/Cap.Consistency/Internal/ConsumerInvokerFactory.cs
@@ -11,24 +11,20 @@
     {
         private readonly ILogger _logger;
         private readonly IServiceProvider _serviceProvider;
-        private readonly ObjectMethodExecutor _executor;

         public ConsumerInvokerFactory(
-            ILoggerFactory loggerFactory,
-            IServiceProvider serviceProvider,
-            ObjectMethodExecutor executor) {
+            ILoggerFactory loggerFactory,
+            IServiceProvider serviceProvider) {

             _logger = loggerFactory.CreateLogger<ConsumerInvokerFactory>();
             _serviceProvider = serviceProvider;
-            _executor = executor;
         }

         public IConsumerInvoker CreateInvoker(ConsumerContext consumerContext) {

             var context = new ConsumerInvokerContext(consumerContext);

-            context.Result = new ConsumerInvoker(_logger, _serviceProvider,
-                consumerContext, _executor);
+            context.Result = new ConsumerInvoker(_logger, _serviceProvider, consumerContext);

             return context.Result;
         }


Fix build error

Fix build error

--- src/Exceptionless.Core/Repositories/EventRepository.cs
+++ src/Exceptionless.Core/Repositories/EventRepository.cs
@@ -62,7 +62,7 @@
                 query = query.Projects(projectIds);

             if (stackIds?.Length > 0)
-                query = query.Stack(stackIds);
+                query = query.Stacks(stackIds);

             if (eventIds?.Length > 0)
                 query = query.Id(eventIds);


Backed out merge changeset: 1b64e5906a1c

Backed out merge revision to its first parent (dd159699d9ea)

--- EditorControls/FileControl.xaml.cs
+++ EditorControls/FileControl.xaml.cs
@@ -130,11 +130,7 @@

         private IEnumerable<string> GetAvailableLibraries()
         {
-            yield return "";
-            foreach (string result in m_helper.Controller.GetAvailableLibraries())
-            {
-                yield return result;
-            }
+            return m_helper.Controller.GetAvailableLibraries();
         }

         private IEnumerable<string> GetFilesInGamePath()


Clean up

Clean up

--- src/Features/Core/Portable/CodeFixes/CodeFixService.cs
+++ src/Features/Core/Portable/CodeFixes/CodeFixService.cs
@@ -209,17 +209,10 @@
         private static SortedDictionary<TextSpan, List<DiagnosticData>> ConvertToMap(
             ImmutableArray<DiagnosticData> diagnostics)
         {
-            // REVIEW: this is the first and simplest design. basically, when ctrl+. is pressed, it asks diagnostic
-            // service to give back current diagnostics for the given span, and it will use that to get fixes.
-            // internally diagnostic service will either return cached information (if it is up-to-date) or
-            // synchronously do the work at the spot.
+            // group diagnostics by their diagnostics span
             //
-            // this design's weakness is that each side don't have enough information to narrow down works to do. it
-            // will most likely always do more works than needed. sometimes way more than it is needed. (compilation)
-
-            // group diagnostics by their diagnostics span
-            // invariant: later code gathers & runs CodeFixProviders for diagnostics with one identical diagnostics span (that gets set later as CodeFixCollection's TextSpan)
-            // order diagnostics by span.
+            // invariant: later code gathers & runs CodeFixProviders for diagnostics with one identical diagnostics span
+            // (that gets set later as CodeFixCollection's TextSpan) order diagnostics by span.
             var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>();
             foreach (var diagnostic in diagnostics)
             {


now using depth as path cost base

now using depth as path cost base

--- EightPuzzle/EightPuzzle/Program.cs
+++ EightPuzzle/EightPuzzle/Program.cs
@@ -110,6 +110,18 @@
                 var visitedNodeId = visitedNodes.Count - 1;

                 // add to hash for quick look-up
+                Action known;
+                if (visitedNodesHash.TryGetValue(action, out known))
+                {
+                    if (known.Cost > action.Cost)
+                    {
+                        visitedNodesHash.Remove(known);
+                    }
+                    else
+                    {
+                        continue;
+                    }
+                }
                 visitedNodesHash.Add(action, action);

 #if DumpIntermediateStates
@@ -126,7 +138,7 @@
                 }

                 // expand next-generation states and add them to the fringe.
-                var actions = DeterminePossibleActions(visitedNodeId, action.Depth, action.State, puzzleWidth, costAlgorithm, action.Cost);
+                var actions = DeterminePossibleActions(visitedNodeId, action.Depth, action.State, puzzleWidth, costAlgorithm, action.Depth);

                 // we add the new states to the fringe, but take out
                 // all actions that result in the same states we already tested.
@@ -206,7 +218,6 @@
                 {
                     // this is a short-cut, so allow it
                     // take care of collisions in the dictionary though
-                    Debugger.Break();
                     return false;
                 }
                 return true;