Change of pen usage when selecting an airplane

--- Airtraffic_Simulator/Painter.cs
+++ Airtraffic_Simulator/Painter.cs
@@ -41,14 +41,19 @@

         public void DrawAirplane(Graphics gr, Airplane airplaneToDraw, bool isSelected)
         {
-            Pen penToDraw = new Pen(Color.Transparent, 1);
+            //Pen penToDraw = new Pen(Color.Transparent, 1);
+            Pen transperentPen = new Pen(Color.Transparent, 1);
+            Pen redPen = new Pen(Color.Red, 1);
+
+
             if (airplaneToDraw.PlaneStatus != Status.LANDED)
             {
                 if (isSelected)
                 {
-                    penToDraw = new Pen(Color.Red, 1);
+                    //penToDraw = new Pen(Color.Red, 1);
+                    gr.DrawRectangle(redPen, airplaneToDraw.CoverArea);
                 }
-                gr.DrawRectangle(penToDraw, airplaneToDraw.CoverArea);
+                gr.DrawRectangle(transperentPen, airplaneToDraw.CoverArea);
                 gr.DrawImage(airplaneToDraw.Image, airplaneToDraw.CurrentLocation);
             }
         }


Enables Universe Selection Helpers in Python

--- Algorithm/QCAlgorithm.Python.cs
+++ Algorithm/QCAlgorithm.Python.cs
@@ -104,7 +104,14 @@
         public void AddUniverse(PyObject pycoarse)
         {
             var coarse = PythonUtil.ToFunc<IEnumerable<CoarseFundamental>, object[]>(pycoarse);
-            AddUniverse(c => coarse(c).Select(x => (Symbol)x));
+            if (coarse != null)
+            {
+                AddUniverse(c => coarse(c).Select(x => (Symbol)x));
+                return;
+            }
+
+            var type = (Type)pycoarse.GetPythonType().AsManagedObject(typeof(Type));
+            AddUniverse((dynamic)pycoarse.AsManagedObject(type));
         }

         /// <summary>


Add functions to handle object graph serialization of files.

--- src/SilDev/FileEx.cs
+++ src/SilDev/FileEx.cs
@@ -5,7 +5,7 @@
 // ==============================================
 //
 // Filename: FileEx.cs
-// Version:  2018-05-31 07:11
+// Version:  2018-06-04 09:46
 //
 // Copyright (c) 2018, Si13n7 Developments (r)
 // All rights reserved.
@@ -21,6 +21,7 @@
     using System.Diagnostics;
     using System.IO;
     using System.Linq;
+    using System.Runtime.Serialization.Formatters.Binary;
     using System.Text;

     /// <summary>
@@ -29,6 +30,128 @@
     /// </summary>
     public static class FileEx
     {
+        /// <summary>
+        ///     Creates a new file, writes the specified object graph into to the file, and then
+        ///     closes the file.
+        /// </summary>
+        /// <typeparam name="TSource">
+        ///     The type of the elements of source.
+        /// </typeparam>
+        /// <param name="path">
+        ///     The file to write to.
+        /// </param>
+        /// <param name="value">
+        ///     The object graph to write to the file.
+        /// </param>
+        /// <param name="overwrite">
+        ///     true to allow an existing file to be overwritten; otherwise, false.
+        /// </param>
+        public static bool Serialize<TSource>(string path, TSource value, bool overwrite = true)
+        {
+            try
+            {
+                var dest = PathEx.Combine(path);
+                using (var ms = new FileStream(dest, overwrite ? FileMode.Create : FileMode.CreateNew))
+                {
+                    var bf = new BinaryFormatter();
+                    bf.Serialize(ms, value);
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                Log.Write(ex);
+                return false;
+            }
+        }
+
+        /// <summary>
+        ///     Deserializes specified file into an object graph.
+        /// </summary>
+        /// <typeparam name="TResult">
+        ///     The type of the elements of result.
+        /// </typeparam>
+        /// <param name="defValue">
+        ///     The default value.
+        /// </param>
+        /// <param name="path">
+        ///     The file to deserialize.
+        /// </param>
+        public static TResult Deserialize<TResult>(TResult defValue, string path)
+        {
+            try
+            {
+                var src = PathEx.Combine(path);
+                TResult result;
+                using (var fs = new FileStream(src, FileMode.Open))
+                {
+                    var bf = new BinaryFormatter();
+                    result = (TResult)bf.Deserialize(fs);
+                }
+                return result;
+            }
+            catch (Exception ex)
+            {
+                Log.Write(ex);
+                return defValue;
+            }
+        }
+
+        /// <summary>
+        ///     Deserializes the first valid file of the specified files into an object graph.
+        /// </summary>
+        /// <typeparam name="TResult">
+        ///     The type of the elements of result.
+        /// </typeparam>
+        /// <param name="defValue">
+        ///     The default value.
+        /// </param>
+        /// <param name="paths">
+        ///     The files to deserialize.
+        /// </param>
+        public static TResult Deserialize<TResult>(TResult defValue, params string[] paths)
+        {
+            try
+            {
+                foreach (var path in paths)
+                {
+                    var result = Deserialize(defValue, path);
+                    if (result.Equals(defValue))
+                        continue;
+                    return result;
+                }
+            }
+            catch (Exception ex)
+            {
+                Log.Write(ex);
+            }
+            return defValue;
+        }
+
+        /// <summary>
+        ///     Deserializes specified file into an object graph.
+        /// </summary>
+        /// <typeparam name="TResult">
+        ///     The type of the elements of result.
+        /// </typeparam>
+        /// <param name="path">
+        ///     The file to deserialize.
+        /// </param>
+        public static TResult Deserialize<TResult>(string path) =>
+            Deserialize(default(TResult), path);
+
+        /// <summary>
+        ///     Deserializes the first valid file of the specified files into an object graph.
+        /// </summary>
+        /// <typeparam name="TResult">
+        ///     The type of the elements of result.
+        /// </typeparam>
+        /// <param name="paths">
+        ///     The files to deserialize.
+        /// </param>
+        public static TResult Deserialize<TResult>(params string[] paths) =>
+            Deserialize(default(TResult), paths);
+
         /// <summary>
         ///     Determines whether the specified file exists.
         /// </summary>


Fix #129 Exception when Parse.Ref occurs in Parse.Or

--- src/Sprache/Parse.cs
+++ src/Sprache/Parse.cs
@@ -388,7 +388,12 @@
                                p = reference();

                            if (i.Memos.ContainsKey(p))
-                               throw new ParseException(i.Memos[p].ToString());
+                           {
+                               var pResult = i.Memos[p] as IResult<T>;
+                               if (pResult.WasSuccessful)
+                                   return pResult;
+                               throw new ParseException(pResult.ToString());
+                           }

                            i.Memos[p] = Result.Failure<T>(i,
                                "Left recursion in the grammar.",


(DwqFormat): PACKBMP with mask has alpha channel.

--- ArcFormats/BlackCyc/ImageDWQ.cs
+++ ArcFormats/BlackCyc/ImageDWQ.cs
@@ -142,7 +142,7 @@
                 BaseType = Encoding.ASCII.GetString (header.Bytes, 0, 0x10).TrimEnd(),
                 PackedSize = packed_size,
                 PackType = header.PackType,
-                HasAlpha = header.AType || 7 == header.PackType,
+                HasAlpha = header.AType || 7 == header.PackType || 3 == header.PackType,
             };
         }


Fixed memory leak in BinarizeOtsuAdaptiveThreshold (Issue #149).

--- src/Tesseract/Pix.cs
+++ src/Tesseract/Pix.cs
@@ -306,7 +306,14 @@
         {
             IntPtr ppixth, ppixd;
             int result = Interop.LeptonicaApi.Native.pixOtsuAdaptiveThreshold(handle, sx, sy, smoothx, smoothy, scorefract, out ppixth, out ppixd);
+
+            if (ppixth != IntPtr.Zero) {
+                // free memory held by ppixth, an array of threshold values found for each tile
+                Interop.LeptonicaApi.Native.pixaDestroy(ref ppixth);
+            }
+
             if (result == 1) throw new TesseractException("Failed to binarize image.");
+
             return new Pix(ppixd);
         }


making SQL commands uppercase, fixing collation bug


Create DirectorySelector.cs

Create DirectorySelector.cs


uint64 too #91

uint64 too #91

--- src/SQLite.Net/Orm.cs
+++ src/SQLite.Net/Orm.cs
@@ -85,7 +85,8 @@
             }
             if (clrType == typeof(UInt32) || clrType == typeof(Int64) ||
                 interfaces.Contains(typeof(ISerializable<UInt32>)) ||
-                interfaces.Contains(typeof(ISerializable<Int64>)))
+                interfaces.Contains(typeof(ISerializable<Int64>)) ||
+                interfaces.Contains(typeof(ISerializable<UInt64>)))
             {
                 return "bigint";
             }


Working on object mapper.

Working on object mapper.

--- Main/src/Mapping/Mapper.cs
+++ Main/src/Mapping/Mapper.cs
@@ -38,6 +38,7 @@

 		///
 		/// Returns a mapper expression to map an object of TFrom type to an object of TTo type.
+		/// Returned expression is compatible to IQueriable.
 		///
 		/// <returns>Mapping expression.</returns>
 		[Pure]


Update Lux.cs

Update Lux.cs

--- MetaSmite/Champions/Lux.cs
+++ MetaSmite/Champions/Lux.cs
@@ -21,7 +21,7 @@
             Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true);

             //Events
-            Game.OnGameUpdate += OnGameUpdate;
+            Game.OnUpdate += OnGameUpdate;
         }

         private static void OnGameUpdate(EventArgs args)


turning blocks off and on for fullState

turning blocks off and on for fullState

turning off the drilling blocks when entering the container full state.
turning all blocks back on when leaving container full state

--- MiningStationAutomation.cs
+++ MiningStationAutomation.cs
@@ -84,66 +84,12 @@
             {
                 var drillStationBlocks = (context as DrillStation).DrillStationBlocks;

-                //turn on all panels
-                drillStationBlocks.DebugPanels.ForEach(block =>
-                {
-                    block.GetActionWithName("OnOff_On").Apply(block);
-                });
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned on all panels");
-
-                //turn on the timer block and set the interval, also start the timer
-                drillStationBlocks.Timer.GetActionWithName("OnOff_On").Apply(drillStationBlocks.Timer);
+                //turn on all blocks
+                drillStationBlocks.TurnOnAllBlocks();
+
+                //set the timer wait and start it
                 drillStationBlocks.Timer.SetValueFloat("TriggerDelay", TRIGGER_DELAY);
                 drillStationBlocks.Timer.GetActionWithName("Start").Apply(drillStationBlocks.Timer);
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, string.Format("turned on the timer, set timer to {0} and started it.", TRIGGER_DELAY));
-
-                //turn on all antenna
-                drillStationBlocks.Antennas.ForEach(block =>
-                {
-                    block.GetActionWithName("OnOff_On").Apply(block);
-                });
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned on all antennas");
-
-                //turn on all drills
-                drillStationBlocks.Drills.ForEach(block =>
-                {
-                    block.GetActionWithName("OnOff_On").Apply(block);
-                });
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned on all drills");
-
-                //turn on all hPistons
-                drillStationBlocks.HorizontalPiston.ForEach(block =>
-                {
-                    block.GetActionWithName("OnOff_On").Apply(block);
-                });
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned on all horizontal pistons");
-
-                //turn on all refineries
-                drillStationBlocks.Refineries.ForEach(block =>
-                {
-                    block.GetActionWithName("OnOff_On").Apply(block);
-                });
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned on all horizontal pistons");
-
-                //turn on the rotor
-                drillStationBlocks.Rotor.GetActionWithName("OnOff_On").Apply(drillStationBlocks.Rotor);
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned on the rotor");
-
-                //turn on all vPistons
-                drillStationBlocks.VerticalPistons.ForEach(block =>
-                {
-                    block.GetActionWithName("OnOff_On").Apply(block);
-                });
-
-                BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned on all vertical pistons");
-

                 BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "Moving to start Position");
                 //move to the start position (pistons at 1m/s rotor at 1 rpm)
@@ -315,17 +261,58 @@
             {
                 var drillStationBlocks = (context as DrillStation).DrillStationBlocks;

-                //if container was emptied proceed to next state
-                if (!BlockUtils.ContainersCapacityReached(drillStationBlocks.CargoContainers, CONTAINER_LOWER_THRESHOLD))
-                {
-                    BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "Container was emptied");
-                    BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "returning to previous State");
-
-                    context.State = new DeepeningState();
-                    (context.State as DeepeningState).SetCurrentCircle(circle);
-                    (context.State as DeepeningState).SetVerticalOffset(depth);
-
-                    BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "Setting state on context: " + context.State.GetType().Name);
+                //move to the start position (pistons at 1m/s rotor at 1 rpm)
+                if (drillStationBlocks.ToPosition(drillStationBlocks.VerticalPistons, 0, 1, drillStationBlocks.HorizontalPiston, 0, 1, drillStationBlocks.Rotor, 0, 1))
+                {
+                    //if the containers are not emptied to below lower threshold turn off the blocks otherwise turn them on again and proceed wit deepeningState
+                    if (BlockUtils.ContainersCapacityReached(drillStationBlocks.CargoContainers, CONTAINER_LOWER_THRESHOLD))
+                    {
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "Container not emptied, turning off the drilling blocks");
+
+                        //turn off all drills
+                        drillStationBlocks.Drills.ForEach(block =>
+                        {
+                            block.GetActionWithName("OnOff_Off").Apply(block);
+                        });
+
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned of all drills");
+
+                        //turn off all hPistons
+                        drillStationBlocks.HorizontalPiston.ForEach(block =>
+                        {
+                            block.GetActionWithName("OnOff_Off").Apply(block);
+                        });
+
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned off all horizontal pistons");
+
+                        //turn off the rotor
+                        drillStationBlocks.Rotor.GetActionWithName("OnOff_Off").Apply(drillStationBlocks.Rotor);
+
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned off the rotor");
+
+                        //turn off all vPistons
+                        drillStationBlocks.VerticalPistons.ForEach(block =>
+                        {
+                            block.GetActionWithName("OnOff_Off").Apply(block);
+                        });
+
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "turned of all vertical pistons");
+                    }
+                    else
+                    {
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "Container was emptied, turning on the blocks");
+
+                        //turn on all blocks, just for good measure
+                        drillStationBlocks.TurnOnAllBlocks();
+
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "returning to deepening State");
+
+                        context.State = new DeepeningState();
+                        (context.State as DeepeningState).SetCurrentCircle(circle);
+                        (context.State as DeepeningState).SetVerticalOffset(depth);
+
+                        BlockUtils.AppendDebugOut(drillStationBlocks.DebugPanels, "Setting state on context: " + context.State.GetType().Name);
+                    }
                 }
             }

@@ -922,6 +909,67 @@
                     }
                 }
             }
+
+            public void TurnOnAllBlocks()
+            {
+                //turn on all panels
+                this.DebugPanels.ForEach(block =>
+                {
+                    block.GetActionWithName("OnOff_On").Apply(block);
+                });
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, "turned on all panels");
+
+                //turn on the timer block and set the interval, also start the timer
+                this.Timer.GetActionWithName("OnOff_On").Apply(this.Timer);
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, string.Format("turned on the timer, set timer to {0} and started it.", TRIGGER_DELAY));
+
+                //turn on all antenna
+                this.Antennas.ForEach(block =>
+                {
+                    block.GetActionWithName("OnOff_On").Apply(block);
+                });
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, "turned on all antennas");
+
+                //turn on all drills
+                this.Drills.ForEach(block =>
+                {
+                    block.GetActionWithName("OnOff_On").Apply(block);
+                });
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, "turned on all drills");
+
+                //turn on all hPistons
+                this.HorizontalPiston.ForEach(block =>
+                {
+                    block.GetActionWithName("OnOff_On").Apply(block);
+                });
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, "turned on all horizontal pistons");
+
+                //turn on all refineries
+                this.Refineries.ForEach(block =>
+                {
+                    block.GetActionWithName("OnOff_On").Apply(block);
+                });
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, "turned on all horizontal pistons");
+
+                //turn on the rotor
+                this.Rotor.GetActionWithName("OnOff_On").Apply(this.Rotor);
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, "turned on the rotor");
+
+                //turn on all vPistons
+                this.VerticalPistons.ForEach(block =>
+                {
+                    block.GetActionWithName("OnOff_On").Apply(block);
+                });
+
+                BlockUtils.AppendDebugOut(this.DebugPanels, "turned on all vertical pistons");
+            }
         }

         class BlockUtils


Added ArcadeFont.ColorChanged event - fired upon color cycle

--- FontEffectsLib/FontTypes/ArcadeFont.cs
+++ FontEffectsLib/FontTypes/ArcadeFont.cs
@@ -5,6 +5,7 @@
 using FontEffectsLib.CoreTypes;
 using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Graphics;
+using System.ComponentModel;

 namespace FontEffectsLib.FontTypes
 {
@@ -64,6 +65,30 @@
             //Pass-through constructor
         }

+        /// <summary>
+        /// Arguments for the event fired when the arcade font color is about to cycle.
+        /// </summary>
+        public class ColorChangedEventArgs : CancelEventArgs
+        {
+            /// <summary>
+            /// Gets the color which the ArcadeFont will change to.
+            /// </summary>
+            public Color NewColor { get; private set; }
+
+            /// <summary>
+            /// Creates instance of ColorChangedEventArgs class.
+            /// </summary>
+            /// <param name="newColor">The color about to be changed to.</param>
+            public ColorChangedEventArgs(Color newColor)
+            {
+                NewColor = newColor;
+            }
+        }
+
+        /// <summary>
+        /// Fires whenever the color of the arcade font is about to be cycled through.
+        /// </summary>
+        public event EventHandler<ColorChangedEventArgs> ColorChanged;

         /// <summary>
         /// Create a new instance of <see cref="ArcadeFont"/>.
@@ -118,8 +143,21 @@

             if (_elapsedTime >= _delayTime)
             {
-                currentColor = currentColor + 1 == _fontColors.Count ? 0 : currentColor + 1;
-                _tintColor = _fontColors[currentColor];
+                int newColor = currentColor + 1 == _fontColors.Count ? 0 : currentColor + 1;
+                Color newColorVal = _fontColors[newColor];
+
+                EventHandler<ColorChangedEventArgs> handler = ColorChanged;
+                ColorChangedEventArgs arguments = new ColorChangedEventArgs(newColorVal);
+                if (handler != null)
+                {
+                    handler(this, arguments);
+                }
+
+                if (!arguments.Cancel)
+                {
+                    currentColor = newColor;
+                    _tintColor = newColorVal;
+                }

                 _elapsedTime = TimeSpan.Zero;
             }


NH-3946: Linq where is base class doesn't get subclasses. Added failing test

--- src/NHibernate.Test/Linq/WhereTests.cs
+++ src/NHibernate.Test/Linq/WhereTests.cs
@@ -652,6 +652,16 @@
 			Assert.That(query.Count, Is.EqualTo(2));
 		}

+		[Test(Description = "NH-3946")]
+		public void PolymorphicSearchOnObjectTypeWithIsKeyword()
+		{
+			var query = (from o in session.Query<Animal>()
+						 where o is Mammal
+						 select o).ToList();
+
+			Assert.That(query.Count, Is.EqualTo(3));
+		}
+
 		[Test]
 		public void BitwiseQuery()
 		{


Fix debuff duplication

Fix debuff duplication

--- Assets/Scripts/Debuff/Debuff.cs
+++ Assets/Scripts/Debuff/Debuff.cs
@@ -6,6 +6,7 @@
 namespace Bunashibu.Kikan {
   public class Debuff {
     public Debuff(Transform parent) {
+      _id = parent.gameObject.GetInstanceID();
       _state = new ReactiveState<DebuffType>();
       _effect = new DebuffEffect(parent);
     }
@@ -16,9 +17,10 @@
     }

     public void DurationEnable(DebuffType type, float duration) {
-      _state.Enable(type);
+      if (_state.State[type] == false)
+        _state.Enable(type);

-      MonoUtility.Instance.DelaySec(duration, () => {
+      MonoUtility.Instance.OverwritableDelaySec(duration, "Debuff" + type + _id.ToString(), () => {
         _state.Disable(type);
       });
     }
@@ -33,6 +35,7 @@

     public IReadOnlyReactiveDictionary<DebuffType, bool> State => _state.State;

+    private int _id;
     private ReactiveState<DebuffType> _state;
     private DebuffEffect _effect;
   }


Improve error message for CanUsePosApp

Improve error message for CanUsePosApp

--- BTCPayServer.Tests/UnitTest1.cs
+++ BTCPayServer.Tests/UnitTest1.cs
@@ -2021,7 +2021,7 @@
                 //verify invoices where created
                 invoices = user.BitPay.GetInvoices();
                 Assert.Equal(2, invoices.Count(invoice => invoice.ItemCode.Equals("noninventoryitem")));
-                var inventoryItemInvoice = invoices.SingleOrDefault(invoice => invoice.ItemCode.Equals("inventoryitem"));
+                var inventoryItemInvoice = Assert.Single(invoices.Where(invoice => invoice.ItemCode.Equals("inventoryitem")));
                 Assert.NotNull(inventoryItemInvoice);

                 //let's mark the inventoryitem invoice as invalid, thsi should return the item to back in stock


POS: Test fixes

POS: Test fixes

--- BTCPayServer.Tests/UnitTest1.cs
+++ BTCPayServer.Tests/UnitTest1.cs
@@ -2312,9 +2312,11 @@
                 Assert.Equal("hello", vmpos.Title);

                 var publicApps = user.GetController<AppsPublicController>();
+                Assert.IsType<RedirectToActionResult>(publicApps.ViewPointOfSale(appId).Result);
+
                 var vmview =
                     Assert.IsType<ViewPointOfSaleViewModel>(Assert
-                        .IsType<ViewResult>(publicApps.ViewPointOfSale(appId).Result).Model);
+                        .IsType<ViewResult>(publicApps.ViewPointOfSale(appId, PosViewType.Cart).Result).Model);
                 Assert.Equal("hello", vmview.Title);
                 Assert.Equal(3, vmview.Items.Length);
                 Assert.Equal("good apple", vmview.Items[0].Title);
@@ -2326,7 +2328,7 @@
                 Assert.Equal("Wanna tip?", vmview.CustomTipText);
                 Assert.Equal("15,18,20", string.Join(',', vmview.CustomTipPercentages));
                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 0, null, null, null, null, "orange").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 0, null, null, null, null, "orange").Result);

                 //
                 var invoices = user.BitPay.GetInvoices();
@@ -2337,7 +2339,7 @@

                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 0, null, null, null, null, "apple").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 0, null, null, null, null, "apple").Result);

                 invoices = user.BitPay.GetInvoices();
                 var appleInvoice = invoices.SingleOrDefault(invoice => invoice.ItemCode.Equals("apple"));
@@ -2347,7 +2349,7 @@

                 // testing custom amount
                 var action = Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 6.6m, null, null, null, null, "donation").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 6.6m, null, null, null, null, "donation").Result);
                 Assert.Equal(nameof(InvoiceController.Checkout), action.ActionName);
                 invoices = user.BitPay.GetInvoices();
                 var donationInvoice = invoices.Single(i => i.Price == 6.6m);
@@ -2388,7 +2390,7 @@
                     Assert.IsType<RedirectToActionResult>(apps.UpdatePointOfSale(appId, vmpos).Result);
                     publicApps = user.GetController<AppsPublicController>();
                     vmview = Assert.IsType<ViewPointOfSaleViewModel>(Assert
-                        .IsType<ViewResult>(publicApps.ViewPointOfSale(appId).Result).Model);
+                        .IsType<ViewResult>(publicApps.ViewPointOfSale(appId, PosViewType.Cart).Result).Model);
                     Assert.Equal(test.Code, vmview.CurrencyCode);
                     Assert.Equal(test.ExpectedSymbol,
                         vmview.CurrencySymbol.Replace("￥", "¥")); // Hack so JPY test pass on linux as well);
@@ -2419,17 +2421,17 @@

                 //inventoryitem has 1 item available
                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 1, null, null, null, null, "inventoryitem").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 1, null, null, null, null, "inventoryitem").Result);
                 //we already bought all available stock so this should fail
                 await Task.Delay(100);
                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 1, null, null, null, null, "inventoryitem").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 1, null, null, null, null, "inventoryitem").Result);

                 //inventoryitem has unlimited items available
                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 1, null, null, null, null, "noninventoryitem").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 1, null, null, null, null, "noninventoryitem").Result);
                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 1, null, null, null, null, "noninventoryitem").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 1, null, null, null, null, "noninventoryitem").Result);

                 //verify invoices where created
                 invoices = user.BitPay.GetInvoices();
@@ -2469,9 +2471,9 @@
   price: 1.0";
                 Assert.IsType<RedirectToActionResult>(apps.UpdatePointOfSale(appId, vmpos).Result);
                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 1, null, null, null, null, "btconly").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 1, null, null, null, null, "btconly").Result);
                 Assert.IsType<RedirectToActionResult>(publicApps
-                    .ViewPointOfSale(appId, 1, null, null, null, null, "normal").Result);
+                    .ViewPointOfSale(appId, PosViewType.Cart, 1, null, null, null, null, "normal").Result);
                 invoices = user.BitPay.GetInvoices();
                 var normalInvoice = invoices.Single(invoice => invoice.ItemCode == "normal");
                 var btcOnlyInvoice = invoices.Single(invoice => invoice.ItemCode == "btconly");


Added method stubs

Added method stubs

--- BasicPomodoro/Model/Pomodoro.cs
+++ BasicPomodoro/Model/Pomodoro.cs
@@ -27,11 +27,10 @@
         //The default pomodoro settings
         public Pomodoro()
         {
-            _timer = new Timer();
             _workTime = 25;
             _shortBreakTime = 5;
             _longBreakTime = 15;
-            _timer.Interval = 60000 * _workTime;
+            initializeTimer();
         }

         //Custom pomodoro settings
@@ -76,25 +75,49 @@
             {
                 throw new ArgumentException("Long break time needs to be greater than short break time.");
             }
-
-            //okay we're good, make the timer
-
-            //Log for logging's sake!
-            Debug.Print("workTime is : " + _workTime);
-            Debug.Print("shortBreakTime is : " + _shortBreakTime);
-            Debug.Print("longBreakTime is : " + _longBreakTime);
+            initializeTimer();
         }

         public readonly Timer Timer() {
             return _timer;
         }

+        //Initialize the timer
+        private void initializeTimer()
+        {
+
+            //Log for logging's sake!
+            Debug.Print("workTime is : " + _workTime);
+            Debug.Print("shortBreakTime is : " + _shortBreakTime);
+            Debug.Print("longBreakTime is : " + _longBreakTime);
+
+            //okay we're good, make the timer
+            _timer = new Timer();
+
+            //use work time to start since this is state 0
+            _timer.Interval = 60000 * _workTime;
+            _timer.Elapsed += _timer_Elapsed;
+        }
+
         //start the timer
+        public void startTimer()
+        {
+
+            throw new NotImplementedException();
+        }

         //stop the timer
+        public void stopTimer()
+        {
+
+            throw new NotImplementedException();
+        }

         //respond to event
-
+        private void _timer_Elapsed(object sender, ElapsedEventArgs e)
+        {
+ 	        throw new NotImplementedException();
+        }
         //change state?

         //buzz!


Add OnServerDisconnected event Also code review and cleanup

--- src/kafka-net/KafkaTcpSocket.cs
+++ src/kafka-net/KafkaTcpSocket.cs
@@ -19,6 +19,7 @@
     /// </summary>
     public class KafkaTcpSocket : IKafkaTcpSocket
     {
+        public Action OnServerDisconnected;
         public Action<int> OnReconnectionAttempt;
         public Action<int> OnReadFromSocketAttempt;
         public Action<int> OnBytesReceived;
@@ -32,7 +33,7 @@
         private readonly AsyncCollection<SocketPayloadReadTask> _readTaskQueue = new AsyncCollection<SocketPayloadReadTask>();

         private readonly CancellationTokenSource _disposeToken = new CancellationTokenSource();
-        private CancellationTokenRegistration _disposeRegistration;
+        private readonly CancellationTokenRegistration _disposeRegistration;
         private readonly IKafkaLog _log;
         private readonly KafkaEndpoint _endpoint;
         private readonly TimeSpan _maximumReconnectionTimeout;
@@ -154,6 +155,7 @@

                     if (ex is ServerDisconnectedException)
                     {
+                        if (OnServerDisconnected != null) OnServerDisconnected();
                         _log.ErrorFormat(ex.Message);
                         continue;
                     }
@@ -184,8 +186,8 @@
                     .Where(x => x.IsFaulted && x.Exception != null)
                     .SelectMany(x => x.Exception.InnerExceptions)
                     .FirstOrDefault();
-                if (exception != null)
-                    throw exception;
+
+                if (exception != null) throw exception;

                 if (sendDataReady.IsCompleted) writeTask = ProcessSentTasksAsync(netStream, _sendTaskQueue.Pop());
                 if (readDataReady.IsCompleted) readTask = ProcessReadTaskAsync(netStream, _readTaskQueue.Pop());
@@ -268,6 +270,7 @@

             using (sendTask)
             {
+                var failed = false;
                 var sw = Stopwatch.StartNew();
                 try
                 {
@@ -278,15 +281,11 @@

                     await netStream.WriteAsync(sendTask.Payload.Buffer, 0, sendTask.Payload.Buffer.Length);

-                    StatisticsTracker.DecrementGauge(StatisticGauge.ActiveWriteOperation);
-                    StatisticsTracker.CompleteNetworkWrite(sendTask.Payload, sw.ElapsedMilliseconds, false);
                     sendTask.Tcp.TrySetResult(sendTask.Payload);
                 }
                 catch (Exception ex)
                 {
-                    StatisticsTracker.DecrementGauge(StatisticGauge.ActiveWriteOperation);
-                    StatisticsTracker.CompleteNetworkWrite(sendTask.Payload, sw.ElapsedMilliseconds, true);
-
+                    failed = true;
                     if (_disposeToken.IsCancellationRequested)
                     {
                         var exception = new ObjectDisposedException("Object is disposing.");
@@ -296,6 +295,11 @@

                     sendTask.Tcp.TrySetException(ex);
                     throw;
+                }
+                finally
+                {
+                    StatisticsTracker.DecrementGauge(StatisticGauge.ActiveWriteOperation);
+                    StatisticsTracker.CompleteNetworkWrite(sendTask.Payload, sw.ElapsedMilliseconds, failed);
                 }
             }
         }


Remove excess logging on `WebSocketNotificaitonsClient`

--- osu.Game/Online/Notifications/WebSocket/WebSocketNotificationsClient.cs
+++ osu.Game/Online/Notifications/WebSocket/WebSocketNotificationsClient.cs
@@ -72,7 +72,6 @@
                                     break;
                                 }

-                                Logger.Log($"{GetType().ReadableName()} handling event: {message.Event}");
                                 await onMessageReceivedAsync(message);
                             }


Update ApplicationController.cs

Update ApplicationController.cs

Load TranslationMap before load hardware tabpage

--- MatterControlLib/ApplicationView/ApplicationController.cs
+++ MatterControlLib/ApplicationView/ApplicationController.cs
@@ -3208,13 +3208,14 @@
 					try
 					{
 						ReportStartupProgress(0.15, "MatterControlApplication.Initialize");
+
+						ApplicationController.LoadTranslationMap();
+
 						var mainView = await Initialize(systemWindow, (progress0To1, status) =>
 						{
 							ReportStartupProgress(0.2 + progress0To1 * 0.7, status);
 						});
-
-						ApplicationController.LoadTranslationMap();
-
+
 						ReportStartupProgress(0.9, "AddChild->MainView");
 						systemWindow.AddChild(mainView, 0);

@@ -3427,4 +3428,4 @@
 		{
 		}
 	}
-}+}


Get correct OSVersion when running on Windows 8.1

fixes #114

--- Mindscape.Raygun4Net/Messages/RaygunEnvironmentMessage.cs
+++ Mindscape.Raygun4Net/Messages/RaygunEnvironmentMessage.cs
@@ -30,7 +30,7 @@
       DateTime now = DateTime.Now;
       UtcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(now).TotalHours;

-      OSVersion = info.OSVersion;
+      OSVersion = GetOSVersion();

       bool mediumTrust = RaygunSettings.Settings.MediumTrust || !HasUnrestrictedFeatureSet;

@@ -70,6 +70,25 @@
         }
       }
       return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");
+    }
+
+    private string GetOSVersion()
+    {
+      ManagementClass wmiManagementOperatingSystemClass = new ManagementClass("Win32_OperatingSystem");
+      ManagementObjectCollection wmiOperatingSystemCollection = wmiManagementOperatingSystemClass.GetInstances();
+
+      foreach (ManagementObject wmiOperatingSystemObject in wmiOperatingSystemCollection)
+      {
+        try
+        {
+          var version = wmiOperatingSystemObject.Properties["Version"].Value.ToString();
+          return version;
+        }
+        catch (ManagementException)
+        {
+        }
+      }
+      return Environment.OSVersion.Version.ToString(3);
     }

     private void GetDiskSpace()
@@ -156,4 +175,4 @@

     public string Locale { get; private set; }
   }
-}+}


Update to NuGet 2.8.5

Update to NuGet 2.8.5

--- src/VersionUtility.cs
+++ src/VersionUtility.cs
@@ -19,6 +19,12 @@
         private const string PortableFrameworkIdentifier = ".NETPortable";
         private const string AspNetFrameworkIdentifier = "ASP.Net";
         private const string AspNetCoreFrameworkIdentifier = "ASP.NetCore";
+        private const string DnxFrameworkIdentifier = "DNX";
+        private const string DnxFrameworkShortName = "dnx";
+        private const string DnxCoreFrameworkIdentifier = "DNXCore";
+        private const string DnxCoreFrameworkShortName = "dnxcore";
+        private const string CoreFrameworkIdentifier = "Core";
+        private const string CoreFrameworkShortName = "core";
         private const string LessThanOrEqualTo = "\u2264";
         private const string GreaterThanOrEqualTo = "\u2265";

@@ -78,11 +84,18 @@
             { "Windows", "Windows" },
             { "win", "Windows" },

-            // ASP.Net
+            // ASP.Net (TODO: Remove these eventually)
             { "aspnet", AspNetFrameworkIdentifier },
             { "aspnetcore", AspNetCoreFrameworkIdentifier },
             { "asp.net", AspNetFrameworkIdentifier },
             { "asp.netcore", AspNetCoreFrameworkIdentifier },
+
+            // DNX
+            { DnxFrameworkShortName, DnxFrameworkIdentifier },
+            { DnxCoreFrameworkShortName, DnxCoreFrameworkIdentifier },
+
+            // Core
+            { CoreFrameworkShortName, CoreFrameworkIdentifier },

             // Native
             { "native", "native"},
@@ -121,6 +134,9 @@
         private static readonly Dictionary<string, string> _identifierToFrameworkFolder = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) {
             { NetFrameworkIdentifier, "net" },
             { ".NETMicroFramework", "netmf" },
+            { DnxFrameworkIdentifier, DnxFrameworkShortName },
+            { DnxCoreFrameworkIdentifier, DnxCoreFrameworkShortName },
+            { CoreFrameworkIdentifier, CoreFrameworkShortName },
             { AspNetFrameworkIdentifier, "aspnet" },
             { AspNetCoreFrameworkIdentifier, "aspnetcore" },
             { "Silverlight", "sl" },
@@ -180,7 +196,17 @@
         private static readonly Version MaxVersion = new Version(Int32.MaxValue, Int32.MaxValue, Int32.MaxValue, Int32.MaxValue);
         private static readonly Dictionary<string, FrameworkName> _equivalentProjectFrameworks = new Dictionary<string, FrameworkName>()
         {
-            { AspNetFrameworkIdentifier, new FrameworkName(".NETFramework", MaxVersion) },
+            // Allow a core package to be installed in a dnxcore project
+            // { DnxCoreFrameworkIdentifier, new FrameworkName(CoreFrameworkIdentifier, MaxVersion) },
+
+            // Allow an aspnetcore package to be installed in a dnxcore project
+            { DnxCoreFrameworkIdentifier, new FrameworkName(AspNetCoreFrameworkIdentifier, MaxVersion) },
+
+            // Allow an aspnet package to be installed in a dnx project
+            { DnxFrameworkIdentifier, new FrameworkName(AspNetFrameworkIdentifier, MaxVersion) },
+
+            // Allow a net package to be installed in an aspnet (or dnx, transitively by above) project
+            { AspNetFrameworkIdentifier, new FrameworkName(NetFrameworkIdentifier, MaxVersion) }
         };

         public static Version DefaultTargetFrameworkVersion
@@ -847,6 +873,8 @@
             packageTargetFrameworkName = NormalizeFrameworkName(packageTargetFrameworkName);
             projectFrameworkName = NormalizeFrameworkName(projectFrameworkName);

+        check:
+
             if (!projectFrameworkName.Identifier.Equals(packageTargetFrameworkName.Identifier, StringComparison.OrdinalIgnoreCase))
             {
                 // Try to convert the project framework into an equivalent target framework
@@ -856,11 +884,10 @@
                 //  If the Project Targets ASP.Net, Version=5.0. It can accept Packages targetting .NETFramework, Version=4.5.1
                 //  so since the identifiers don't match, we need to "translate" the project target framework to .NETFramework
                 //  however, we still want direct ASP.Net == ASP.Net matches, so we do this ONLY if the identifiers don't already match
-                FrameworkName equivalentFramework;
-                if (_equivalentProjectFrameworks.TryGetValue(projectFrameworkName.Identifier, out equivalentFramework) &&
-                    equivalentFramework.Identifier.Equals(packageTargetFrameworkName.Identifier, StringComparison.OrdinalIgnoreCase))
-                {
-                    projectFrameworkName = equivalentFramework;
+                if (_equivalentProjectFrameworks.TryGetValue(projectFrameworkName.Identifier, out projectFrameworkName))
+                {
+                    // Goto might be evil but it's so nice to use here
+                    goto check;
                 }
                 else
                 {
@@ -1073,7 +1100,7 @@
             foreach (var optionalProjectFramework in projectFrameworkProfile.OptionalFrameworks)
             {
                 var compatiblePackageTargetFramework = packageTargetFrameworkProfile.SupportedFrameworks.FirstOrDefault(f => IsCompatible(f, optionalProjectFramework));
-                if(compatiblePackageTargetFramework == null || compatiblePackageTargetFramework.Version > optionalProjectFramework.Version)
+                if (compatiblePackageTargetFramework == null || compatiblePackageTargetFramework.Version > optionalProjectFramework.Version)
                 {
                     inCompatibleOptionalFrameworkCount++;
                 }


Remove unnecessary reference to IScheduledEvent

--- Modules/AppBrix.Events.Schedule/Impl/PriorityQueueItem.cs
+++ Modules/AppBrix.Events.Schedule/Impl/PriorityQueueItem.cs
@@ -8,15 +8,8 @@
 {
     internal abstract class PriorityQueueItem
     {
-        #region Construction
-        public PriorityQueueItem(object scheduledEvent)
-        {
-            this.ScheduledEvent = scheduledEvent;
-        }
-        #endregion
-
         #region Properties
-        public object ScheduledEvent { get; }
+        public abstract object ScheduledEvent { get; }

         public DateTime Occurrence { get; protected set; }
         #endregion
@@ -32,13 +25,16 @@
     {
         #region Construction
         public PriorityQueueItem(IApp app, IScheduledEvent<T> scheduledEvent)
-            : base(scheduledEvent)
         {
             this.app = app;
             this.scheduledEvent = scheduledEvent;
         }
         #endregion

+        #region Properties
+        public override object ScheduledEvent => this.scheduledEvent;
+        #endregion
+
         #region Public and overriden methods
         public override void Execute()
         {
@@ -53,7 +49,7 @@

         public override void MoveToNextOccurrence(DateTime now)
         {
-            this.Occurrence = ((IScheduledEvent<T>)this.ScheduledEvent).GetNextOccurrence(now);
+            this.Occurrence = this.scheduledEvent.GetNextOccurrence(now);
         }
         #endregion


Address quirks that caused the device count statusbar label not to show

--- MultiMiner.Win/MainForm.cs
+++ MultiMiner.Win/MainForm.cs
@@ -89,6 +89,8 @@
             if (applicationConfiguration.DetectDisownedMiners)
                 CheckForDisownedMiners();

+            SetupStatusBarLabelLayouts();
+
             CheckAndDownloadMiners();

             SetupAutoUpdates();
@@ -1574,7 +1576,7 @@
             //Mh not mh, mh is milli
             scryptRateLabel.Text = totalScryptRate == 0 ? String.Empty : String.Format("Scrypt: {0}", totalScryptRate.ToHashrateString());
             //spacing used to pad out the status bar item
-            sha256RateLabel.Text = totalSha256Rate == 0 ? String.Empty : String.Format("SHA-2: {0}   ", totalSha256Rate.ToHashrateString());
+            sha256RateLabel.Text = totalSha256Rate == 0 ? String.Empty : String.Format("SHA-2: {0}", totalSha256Rate.ToHashrateString());

             scryptRateLabel.AutoSize = true;
             sha256RateLabel.AutoSize = true;
@@ -3167,6 +3169,18 @@
             applicationConfiguration.SaveApplicationConfiguration();
         }

+        private void SetupStatusBarLabelLayouts()
+        {
+            sha256RateLabel.AutoSize = true;
+            sha256RateLabel.Spring = true;
+
+            scryptRateLabel.AutoSize = true;
+            scryptRateLabel.Padding = new Padding(12, 0, 0, 0);
+
+            deviceTotalLabel.AutoSize = true;
+            deviceTotalLabel.Padding = new Padding(12, 0, 0, 0);
+        }
+
         private void largeIconsToolStripMenuItem_Click(object sender, EventArgs e)
         {
             SetListViewStyle(View.LargeIcon);


TestSupportClass: a small correction

TestSupportClass: a small correction

git-svn-id: 6c68d65edd5507bf6b37474e0d155329cbeeff2a@836237 13f79535-47bb-0310-9956-ffa450edef68

--- C#/src/Test/TestSupportClass.cs
+++ C#/src/Test/TestSupportClass.cs
@@ -56,7 +56,7 @@
                 }
             }

-            Assert.Fail("Lucene.Net TestCases:" + countSupport + " Others TestCases:" + countOther);
+            Assert.Fail("Lucene.Net TestCases:" + countSupport + "     Other TestCases:" + countOther);
         }
     }


Fix repository update issue

Fix repository update issue

When updating repositories, properly purgue referenced
repos that are not used anymore.

--- Mono.Addins.Setup/Mono.Addins.Setup/RepositoryRegistry.cs
+++ Mono.Addins.Setup/Mono.Addins.Setup/RepositoryRegistry.cs
@@ -174,34 +174,41 @@
 			RepositoryRecord rep = FindRepositoryRecord (url);
 			if (rep == null)
 				return; // Nothing to do
-
-			foreach (RepositoryRecord rr in service.Configuration.Repositories) {
-				if (rr == rep) continue;
-				Repository newRep = rr.GetCachedRepository ();
-				if (newRep == null) continue;
-				foreach (ReferenceRepositoryEntry re in newRep.Repositories) {
-					if (re.Url == url) {
-						// The repository can't be removed because there is another
-						// repository depending on it. Just mark it as a reference.
-						rep.IsReference = true;
-						return;
+
+			rep.IsReference = true;
+			PurgeUnusedRepositories ();
+			service.SaveConfiguration ();
+			repoList = null;
+		}
+
+		void PurgeUnusedRepositories ()
+		{
+			bool changed;
+
+			do {
+				changed = false;
+
+				HashSet<string> referencedRepos = new HashSet<string> ();
+
+				// Get all referenced repos
+				foreach (RepositoryRecord rr in service.Configuration.Repositories) {
+					Repository repInfo = rr.GetCachedRepository ();
+					if (repInfo == null)
+						continue;
+
+					foreach (ReferenceRepositoryEntry re in repInfo.Repositories)
+						referencedRepos.Add (new Uri (new Uri (repInfo.Url), re.Url).ToString ());
+				}
+
+				foreach (RepositoryRecord rr in service.Configuration.Repositories.ToArray ()) {
+					if (rr.IsReference && !referencedRepos.Contains (rr.Url)) {
+						changed = true;
+						service.Configuration.Repositories.Remove (rr);
+						rr.ClearCachedRepository ();
 					}
 				}
 			}
-
-			// There are no other repositories referencing this one, so we can safely delete
-
-			Repository delRep = rep.GetCachedRepository ();
-			service.Configuration.Repositories.Remove (rep);
-			rep.ClearCachedRepository ();
-
-			if (delRep != null) {
-				foreach (ReferenceRepositoryEntry re in delRep.Repositories)
-					RemoveRepository (new Uri (new Uri (url), re.Url).ToString ());
-			}
-
-			service.SaveConfiguration ();
-			repoList = null;
+			while (changed);
 		}

 		/// <summary>
@@ -311,6 +318,8 @@
 			} finally {
 				monitor.EndTask ();
 			}
+
+			PurgeUnusedRepositories ();
 			service.SaveConfiguration ();
 		}


Fix bugs flagging a ViewModel with HasChanges

--- MultiMiner.Win/MainForm.cs
+++ MultiMiner.Win/MainForm.cs
@@ -491,8 +491,7 @@
             localViewModel.ApplyDeviceConfigurationModels(engineConfiguration.DeviceConfigurations,
                 engineConfiguration.CoinConfigurations);

-            if (this.selectedRemoteInstance == null)
-                UpdateChangesButtons(false);
+            SetHasChangesLocally(false);

             Application.DoEvents();

@@ -526,28 +525,60 @@

             RefreshListViewFromViewModel();

+            SetHasChangesLocally(false);
+            AutoSizeListViewColumns();
+        }
+        #endregion
+
+        #region View population
+        private void SetHasChanges(bool hasChanges)
+        {
             if (this.selectedRemoteInstance == null)
-                UpdateChangesButtons(false);
-            AutoSizeListViewColumns();
-        }
-        #endregion
-
-        #region View population
-        private void UpdateChangesButtons(bool hasChanges)
-        {
+            {
+                SetHasChangesLocally(hasChanges);
+            }
+            else
+            {
+                SetHasChangesRemotely(hasChanges);
+            }
+        }
+
+        private void SetHasChangesLocally(bool hasChanges)
+        {
+            this.localViewModel.HasChanges = hasChanges;
+
             if (this.selectedRemoteInstance == null)
-                this.localViewModel.HasChanges = hasChanges;
-
-            saveButton.Visible = hasChanges;
-            cancelButton.Visible = hasChanges;
-            saveSeparator.Visible = hasChanges;
-
-            saveButton.Enabled = hasChanges;
-            cancelButton.Enabled = hasChanges;
-
-            //accessible menu
-            saveToolStripMenuItem.Enabled = hasChanges;
-            cancelToolStripMenuItem.Enabled = hasChanges;
+            {
+                saveButton.Visible = hasChanges;
+                cancelButton.Visible = hasChanges;
+                saveSeparator.Visible = hasChanges;
+
+                saveButton.Enabled = hasChanges;
+                cancelButton.Enabled = hasChanges;
+
+                //accessible menu
+                saveToolStripMenuItem.Enabled = hasChanges;
+                cancelToolStripMenuItem.Enabled = hasChanges;
+            }
+        }
+
+        private void SetHasChangesRemotely(bool hasChanges)
+        {
+            this.remoteViewModel.HasChanges = hasChanges;
+
+            if (this.selectedRemoteInstance != null)
+            {
+                saveButton.Visible = hasChanges;
+                cancelButton.Visible = hasChanges;
+                saveSeparator.Visible = hasChanges;
+
+                saveButton.Enabled = hasChanges;
+                cancelButton.Enabled = hasChanges;
+
+                //accessible menu
+                saveToolStripMenuItem.Enabled = hasChanges;
+                cancelToolStripMenuItem.Enabled = hasChanges;
+            }
         }

         private void RefreshDetailsAreaIfVisible()
@@ -1675,8 +1706,7 @@

             AutoSizeListViewColumns();

-            if (this.selectedRemoteInstance == null)
-                UpdateChangesButtons(true);
+            SetHasChangesLocally(true);
         }

         private void saveButton_Click(object sender, EventArgs e)
@@ -2181,8 +2211,7 @@
                     viewModel.Enabled = enabled;
             }

-            if (!updatingListView)
-                UpdateChangesButtons(true);
+            SetHasChangesLocally(true);

             RefreshListViewFromViewModel();
         }
@@ -2595,7 +2624,7 @@
                 return;

             GetRemoteApplicationModels(this.selectedRemoteInstance);
-            UpdateChangesButtons(this.remoteViewModel.HasChanges);
+            SetHasChanges(this.remoteViewModel.HasChanges);

             updatingListView = true;
             try
@@ -3086,7 +3115,7 @@
             RefreshIncomeSummary();
             UpdateMiningButtons();
             RefreshCoinPopupMenu();
-            UpdateChangesButtons(GetViewModelToView().HasChanges);
+            SetHasChanges(GetViewModelToView().HasChanges);
             RefreshStatusBarFromViewModel();
         }

@@ -4450,7 +4479,7 @@
             logLaunchArgsBindingSource.DataSource = logLaunchEntries;
             logProcessCloseArgsBindingSource.DataSource = logCloseEntries;

-            UpdateChangesButtons(false);
+            SetHasChangesLocally(false);

             //check for disowned miners before refreshing devices
             if (applicationConfiguration.DetectDisownedMiners)
@@ -4464,7 +4493,7 @@

             SetupAutoUpdates();

-            UpdateChangesButtons(false);
+            SetHasChangesLocally(false);

             ScanHardwareLocally();
             //after refreshing devices


Added Global flag for New-NtSymbolicLink.

--- NtObjectManager/Cmdlets/Object/NewNtSymbolicLinkCmdlet.cs
+++ NtObjectManager/Cmdlets/Object/NewNtSymbolicLinkCmdlet.cs
@@ -62,6 +62,12 @@
         public string TargetPath { get; set; }

         /// <summary>
+        /// <para type="description">Specify to create a global symbolic link. You need SeTcbPrivilege for this call to succeed.</para>
+        /// </summary>
+        [Parameter]
+        public SwitchParameter Global { get; set; }
+
+        /// <summary>
         /// Method to create an object from a set of object attributes.
         /// </summary>
         /// <param name="obj_attributes">The object attributes to create/open from.</param>
@@ -73,6 +79,15 @@
                 throw new ArgumentNullException("TargetPath");
             }

+            if (Global)
+            {
+                using (var link = NtSymbolicLink.Create(obj_attributes, Access | SymbolicLinkAccessRights.Set, TargetPath))
+                {
+                    link.SetGlobalLink();
+                    return link.Duplicate();
+                }
+            }
+
             return NtSymbolicLink.Create(obj_attributes, Access, TargetPath);
         }
     }


send a full object update out to avatars when a media texture is initially set

this allows other avatars to see it, but still only after they've clicked on the face
still not handling navigation yet

--- OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -208,12 +208,8 @@

             m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);

-            // I know this has to end with the last avatar to edit and the version code shouldn't always be 16.  Just trying
-            // to minimally satisfy for now to get something working
-            //resp.Version = "x-mv:0000000016/" + UUID.Random();
-
-            // TODO: schedule full object update for all other avatars.  This will trigger them to send an
-            // ObjectMediaRequest once they see that the MediaUrl is different.
+            // Arguably we don't need to send a full update to the avatar that just changed the texture.
+            part.ScheduleFullUpdate();

             return string.Empty;
         }


factor out common code for updating the media url

--- OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -124,19 +124,7 @@
                 part.Shape.Media = new List<MediaEntry>(part.GetNumberOfSides());

             part.Shape.Media[face] = me;
-
-            if (null == part.MediaUrl)
-            {
-                // TODO: We can't set the last changer until we start tracking which cap we give to which agent id
-                part.MediaUrl = "x-mv:0000000000/" + UUID.Zero;
-            }
-            else
-            {
-                string rawVersion = part.MediaUrl.Substring(5, 10);
-                int version = int.Parse(rawVersion);
-                part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
-            }
-
+            UpdateMediaUrl(part);
             part.ScheduleFullUpdate();
         }

@@ -223,23 +211,11 @@
                 return string.Empty;
             }

-            m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
+            m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);

             part.Shape.Media = new List<MediaEntry>(omu.FaceMedia);

-            if (null == part.MediaUrl)
-            {
-                // TODO: We can't set the last changer until we start tracking which cap we give to which agent id
-                part.MediaUrl = "x-mv:0000000000/" + UUID.Zero;
-            }
-            else
-            {
-                string rawVersion = part.MediaUrl.Substring(5, 10);
-                int version = int.Parse(rawVersion);
-                part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
-            }
-
-            m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
+            UpdateMediaUrl(part);

             // Arguably, we could avoid sending a full update to the avatar that just changed the texture.
             part.ScheduleFullUpdate();
@@ -267,7 +243,7 @@

             UUID primId = omn.PrimID;

-            SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
+            SceneObjectPart part = m_scene.GetSceneObjectPart(primId);

             if (null == part)
             {
@@ -284,20 +260,9 @@
             MediaEntry me = part.Shape.Media[omn.Face];
             me.CurrentURL = omn.URL;

-            string oldMediaUrl = part.MediaUrl;
-
-            // TODO: refactor into common method
-            string rawVersion = oldMediaUrl.Substring(5, 10);
-            int version = int.Parse(rawVersion);
-            part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
-
-            m_log.DebugFormat(
-                "[MOAP]: Updating media url in prim {0} {1} from [{2}] to [{3}]",
-                part.Name, part.UUID, oldMediaUrl, part.MediaUrl);
-
-            part.ScheduleFullUpdate();
-
-            // TODO: Persist in database
+            UpdateMediaUrl(part);
+
+            part.ScheduleFullUpdate();

             return string.Empty;
         }
@@ -317,5 +282,26 @@
                 throw new ArgumentException(
                     string.Format("Face argument was {0} but max is {1}", face, maxFaces));
         }
+
+        /// <summary>
+        /// Update the media url of the given part
+        /// </summary>
+        /// <param name="part"></param>
+        protected void UpdateMediaUrl(SceneObjectPart part)
+        {
+            if (null == part.MediaUrl)
+            {
+                // TODO: We can't set the last changer until we start tracking which cap we give to which agent id
+                part.MediaUrl = "x-mv:0000000000/" + UUID.Zero;
+            }
+            else
+            {
+                string rawVersion = part.MediaUrl.Substring(5, 10);
+                int version = int.Parse(rawVersion);
+                part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
+            }
+
+            m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
+        }
     }
 }


If we can't find a baud rate then start with 250000.

--- PrinterCommunication/PrinterConnectionAndCommunication.cs
+++ PrinterCommunication/PrinterConnectionAndCommunication.cs
@@ -1446,12 +1446,15 @@
         {
             get
             {
-                int baudRate = 0;
+                int baudRate = 250000;
                 if (this.ActivePrinter != null)
                 {
                     try
                     {
-                        baudRate = Convert.ToInt32(this.ActivePrinter.BaudRate);
+						if (this.ActivePrinter.BaudRate != null)
+						{
+							baudRate = Convert.ToInt32(this.ActivePrinter.BaudRate);
+						}
                     }
                     catch
                     {


Sync voorkeuren on current user change

Sync voorkeuren on current user change

--- ProjectOpendeurdag/ProjectOpendeurdag/Helpers/Settings.cs
+++ ProjectOpendeurdag/ProjectOpendeurdag/Helpers/Settings.cs
@@ -35,6 +35,9 @@
         public static void SetCurrentGebruiker(Gebruiker gebruiker)
         {
             _CurrentGebruiker = gebruiker;
+
+            SyncVoorkeurCampussen();
+            SyncVoorkeurOpleidingen();
         }

         public static Gebruiker GetCurrentGebruiker()
@@ -54,48 +57,56 @@

         public static List<Campus> GetVoorkeurCampussen()
         {
-            if (_CurrentGebruiker != null)
-            {
-                Container.Values[VoorkeurCampussen] = JsonConvert.SerializeObject(_CurrentGebruiker.VoorkeurCampussen);
-            }
-
             return JsonConvert.DeserializeObject<List<Campus>>(Container.Values[VoorkeurCampussen].ToString());
         }

-        public static async void SetVoorkeurCampussen(ICollection<Campus> campussen)
+        public static void SetVoorkeurCampussen(ICollection<Campus> campussen)
+        {
+            Container.Values[VoorkeurCampussen] = JsonConvert.SerializeObject(campussen);
+            SyncVoorkeurCampussen();
+        }
+
+        private static async void SyncVoorkeurCampussen()
         {
             if (_CurrentGebruiker != null)
             {
-                _CurrentGebruiker.VoorkeurCampussen.Clear();
-                _CurrentGebruiker.VoorkeurCampussen.AddRange(campussen);
+                var voorkeurCampussen = GetVoorkeurCampussen();

-                await Api.PutAsync<Gebruiker>(_CurrentGebruiker.GebruikerId, _CurrentGebruiker);
+                if (!_CurrentGebruiker.VoorkeurCampussen.SequenceEqual(voorkeurCampussen))
+                {
+                    _CurrentGebruiker.VoorkeurCampussen.Clear();
+                    _CurrentGebruiker.VoorkeurCampussen.AddRange(voorkeurCampussen);
+
+                    await Api.PutAsync<Gebruiker>(_CurrentGebruiker.GebruikerId, _CurrentGebruiker);
+                }
             }
+        }

-            Container.Values[VoorkeurCampussen] = JsonConvert.SerializeObject(campussen);
+        private static async void SyncVoorkeurOpleidingen()
+        {
+            if (_CurrentGebruiker != null)
+            {
+                var voorkeurOpleidingen = GetVoorkeurOpleidingen();
+
+                if (!_CurrentGebruiker.VoorkeurOpleidingen.SequenceEqual(voorkeurOpleidingen))
+                {
+                    _CurrentGebruiker.VoorkeurOpleidingen.Clear();
+                    _CurrentGebruiker.VoorkeurOpleidingen.AddRange(voorkeurOpleidingen);
+
+                    await Api.PutAsync<Gebruiker>(_CurrentGebruiker.GebruikerId, _CurrentGebruiker);
+                }
+            }
         }

         public static List<Opleiding> GetVoorkeurOpleidingen()
         {
-            if (_CurrentGebruiker != null)
-            {
-                Container.Values[VoorkeurOpleidingen] = JsonConvert.SerializeObject(_CurrentGebruiker.VoorkeurOpleidingen);
-            }
-
             return JsonConvert.DeserializeObject<List<Opleiding>>(Container.Values[VoorkeurOpleidingen].ToString());
         }

-        public static async void SetVoorkeurOpleidingen(ICollection<Opleiding> opleidingen)
+        public static void SetVoorkeurOpleidingen(ICollection<Opleiding> opleidingen)
         {
-            if (_CurrentGebruiker != null)
-            {
-                _CurrentGebruiker.VoorkeurOpleidingen.Clear();
-                _CurrentGebruiker.VoorkeurOpleidingen.AddRange(opleidingen);
-
-                await Api.PutAsync<Gebruiker>(_CurrentGebruiker.GebruikerId, _CurrentGebruiker);
-            }
-
             Container.Values[VoorkeurOpleidingen] = JsonConvert.SerializeObject(opleidingen);
+            SyncVoorkeurOpleidingen();
         }
     }
 }


Fixes a missing call to OnExit.

Fixes a missing call to OnExit.

--- Python/Product/Analysis/Interpreter/PythonTypeDatabase.cs
+++ Python/Product/Analysis/Interpreter/PythonTypeDatabase.cs
@@ -374,11 +374,21 @@
         public const int AlreadyGeneratingExitCode = -3;

         /// <summary>
+        /// The exit code returned when a database cannot be created for the
+        /// interpreter factory.
+        /// </summary>
+        public const int NotSupportedExitCode = -4;
+
+        /// <summary>
         /// Invokes Analyzer.exe for the specified factory.
         /// </summary>
         public static void Generate(PythonTypeDatabaseCreationRequest request) {
             var fact = request.Factory;
+            var evt = request.OnExit;
             if (fact == null || !Directory.Exists(fact.Configuration.LibraryPath)) {
+                if (evt != null) {
+                    evt(NotSupportedExitCode);
+                }
                 return;
             }
             var outPath = request.OutputPath;
@@ -425,7 +435,6 @@
                         }
                     }

-                    var evt = request.OnExit;
                     if (evt != null) {
                         evt(output.ExitCode ?? InvalidOperationExitCode);
                     }


Clarify the "createTable" parameter in XLCell.InsertData

--- ClosedXML/Excel/Cells/XLCell.cs
+++ ClosedXML/Excel/Cells/XLCell.cs
@@ -858,8 +858,11 @@
                     maxCo - 1);

                 if (createTable)
+                    // Create a table and save it in the file
                     return tableName == null ? range.CreateTable() : range.CreateTable(tableName);
-                return tableName == null ? range.AsTable() : range.AsTable(tableName);
+                else
+                    // Create a table, but keep it in memory. Saved file will contain only "raw" data and column headers
+                    return tableName == null ? range.AsTable() : range.AsTable(tableName);
             }

             return null;
@@ -905,9 +908,12 @@
                 ro,
                 co - 1);

-            if (createTable) return tableName == null ? range.CreateTable() : range.CreateTable(tableName);
-
-            return tableName == null ? range.AsTable() : range.AsTable(tableName);
+            if (createTable)
+                // Create a table and save it in the file
+                return tableName == null ? range.CreateTable() : range.CreateTable(tableName);
+            else
+                // Create a table, but keep it in memory. Saved file will contain only "raw" data and column headers
+                return tableName == null ? range.AsTable() : range.AsTable(tableName);
         }

         public XLTableCellType TableCellType()
@@ -959,7 +965,6 @@
                     else
                         rowNumber++;
                 }
-

                 void resetRecordPosition()
                 {


Kill auto user insertion in non-debug

Kill auto user insertion in non-debug

--- RightpointLabs.Pourcast.Web/Controllers/HomeController.cs
+++ RightpointLabs.Pourcast.Web/Controllers/HomeController.cs
@@ -23,6 +23,7 @@
             // Replace this with a Mock so it doesn't blow up the app
             //_tapOrchestrator.PourBeerFromTap("534a14b1aed2bf2a00045509", .01);

+#if DEBUG
             // TODO : remove this so users aren't added to admin automatically!
             var roleName = "Administrators";
             var username = Request.LogonUserIdentity.Name;
@@ -34,17 +35,17 @@

             if (!_identityOrchestrator.RoleExists(roleName))
             {
-                _identityOrchestrator.CreateRole(roleName);
+                _identityOrchestrator.CreateRole(roleName);
             }

             if (!_identityOrchestrator.IsUserInRole(username, roleName))
             {
                 _identityOrchestrator.AddUserToRole(username, roleName);
             }
-
+#endif

             return View();
         }

-	}
+    }
 }


Syncing to TFS

Syncing to TFS

TFS Changeset 1917448

--- Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs
+++ Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs
@@ -22,6 +22,7 @@
 using System.Diagnostics;
 using System.Dynamic.Utils;
 using System.Reflection;
+using System.Runtime.CompilerServices;

 namespace System.Dynamic {
     /// <summary>
@@ -243,7 +244,7 @@

             public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value) {
                 if (IsOverridden("TrySetMember")) {
-                    return CallMethodReturnLast("TrySetMember", binder, GetArgs(value), (e) => binder.FallbackSetMember(this, value, e));
+                    return CallMethodReturnLast("TrySetMember", binder, NoArgs, value.Expression, (e) => binder.FallbackSetMember(this, value, e));
                 }

                 return base.BindSetMember(binder, value);
@@ -286,7 +287,7 @@
                 var call = BuildCallMethodWithResult(
                     "TryInvokeMember",
                     binder,
-                    GetArgArray(args),
+                    DynamicMetaObject.GetExpressions(args),
                     BuildCallMethodWithResult(
                         "TryGetMember",
                         new GetBinderAdapter(binder),
@@ -303,7 +304,7 @@

             public override DynamicMetaObject BindCreateInstance(CreateInstanceBinder binder, DynamicMetaObject[] args) {
                 if (IsOverridden("TryCreateInstance")) {
-                    return CallMethodWithResult("TryCreateInstance", binder, GetArgArray(args), (e) => binder.FallbackCreateInstance(this, args, e));
+                    return CallMethodWithResult("TryCreateInstance", binder, DynamicMetaObject.GetExpressions(args), (e) => binder.FallbackCreateInstance(this, args, e));
                 }

                 return base.BindCreateInstance(binder, args);
@@ -311,7 +312,7 @@

             public override DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args) {
                 if (IsOverridden("TryInvoke")) {
-                    return CallMethodWithResult("TryInvoke", binder, GetArgArray(args), (e) => binder.FallbackInvoke(this, args, e));
+                    return CallMethodWithResult("TryInvoke", binder, DynamicMetaObject.GetExpressions(args), (e) => binder.FallbackInvoke(this, args, e));
                 }

                 return base.BindInvoke(binder, args);
@@ -319,7 +320,7 @@

             public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) {
                 if (IsOverridden("TryBinaryOperation")) {
-                    return CallMethodWithResult("TryBinaryOperation", binder, GetArgs(arg), (e) => binder.FallbackBinaryOperation(this, arg, e));
+                    return CallMethodWithResult("TryBinaryOperation", binder, DynamicMetaObject.GetExpressions(new DynamicMetaObject[] {arg}), (e) => binder.FallbackBinaryOperation(this, arg, e));
                 }

                 return base.BindBinaryOperation(binder, arg);
@@ -335,7 +336,7 @@

             public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes) {
                 if (IsOverridden("TryGetIndex")) {
-                    return CallMethodWithResult("TryGetIndex", binder, GetArgArray(indexes), (e) => binder.FallbackGetIndex(this, indexes, e));
+                    return CallMethodWithResult("TryGetIndex", binder, DynamicMetaObject.GetExpressions(indexes), (e) => binder.FallbackGetIndex(this, indexes, e));
                 }

                 return base.BindGetIndex(binder, indexes);
@@ -343,7 +344,7 @@

             public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value) {
                 if (IsOverridden("TrySetIndex")) {
-                    return CallMethodReturnLast("TrySetIndex", binder, GetArgArray(indexes, value), (e) => binder.FallbackSetIndex(this, indexes, value, e));
+                    return CallMethodReturnLast("TrySetIndex", binder, DynamicMetaObject.GetExpressions(indexes), value.Expression, (e) => binder.FallbackSetIndex(this, indexes, value, e));
                 }

                 return base.BindSetIndex(binder, indexes, value);
@@ -351,7 +352,7 @@

             public override DynamicMetaObject BindDeleteIndex(DeleteIndexBinder binder, DynamicMetaObject[] indexes) {
                 if (IsOverridden("TryDeleteIndex")) {
-                    return CallMethodNoResult("TryDeleteIndex", binder, GetArgArray(indexes), (e) => binder.FallbackDeleteIndex(this, indexes, e));
+                    return CallMethodNoResult("TryDeleteIndex", binder, DynamicMetaObject.GetExpressions(indexes), (e) => binder.FallbackDeleteIndex(this, indexes, e));
                 }

                 return base.BindDeleteIndex(binder, indexes);
@@ -361,25 +362,61 @@

             private readonly static Expression[] NoArgs = new Expression[0];

-            private static Expression[] GetArgs(params DynamicMetaObject[] args) {
-                Expression[] paramArgs = DynamicMetaObject.GetExpressions(args);
-
-                for (int i = 0; i < paramArgs.Length; i++) {
-                    paramArgs[i] = Expression.Convert(args[i].Expression, typeof(object));
-                }
-
-                return paramArgs;
-            }
-
-            private static Expression[] GetArgArray(DynamicMetaObject[] args) {
-                return new[] { Expression.NewArrayInit(typeof(object), GetArgs(args)) };
-            }
-
-            private static Expression[] GetArgArray(DynamicMetaObject[] args, DynamicMetaObject value) {
-                return new Expression[] {
-                    Expression.NewArrayInit(typeof(object), GetArgs(args)),
-                    Expression.Convert(value.Expression, typeof(object))
-                };
+            private static Expression[] GetConvertedArgs(params Expression[] args) {
+                ReadOnlyCollectionBuilder<Expression> paramArgs = new ReadOnlyCollectionBuilder<Expression>(args.Length);
+
+                for (int i = 0; i < args.Length; i++) {
+                    paramArgs.Add(Expression.Convert(args[i], typeof(object)));
+                }
+
+                return paramArgs.ToArray();
+            }
+
+            /// <summary>
+            /// Helper method for generating expressions that assign byRef call
+            /// parameters back to their original variables
+            /// </summary>
+            private static Expression ReferenceArgAssign(Expression callArgs, Expression[] args) {
+                ReadOnlyCollectionBuilder<Expression> block = null;
+
+                for (int i = 0; i < args.Length; i++) {
+                    ContractUtils.Requires(args[i] is ParameterExpression);
+                    if (((ParameterExpression)args[i]).IsByRef) {
+                        if (block == null)
+                            block = new ReadOnlyCollectionBuilder<Expression>();
+
+                        block.Add(
+                            Expression.Assign(
+                                args[i],
+                                Expression.Convert(
+                                    Expression.ArrayIndex(
+                                        callArgs,
+                                        Expression.Constant(i)
+                                    ),
+                                    args[i].Type
+                                )
+                            )
+                        );
+                    }
+                }
+
+                if (block != null)
+                    return Expression.Block(block);
+                else
+                    return Expression.Empty();
+            }
+
+            /// <summary>
+            /// Helper method for generating arguments for calling methods
+            /// on DynamicObject.  parameters is either a list of ParameterExpressions
+            /// to be passed to the method as an object[], or NoArgs to signify that
+            /// the target method takes no object[] parameter.
+            /// </summary>
+            private static Expression[] BuildCallArgs(DynamicMetaObjectBinder binder, Expression[] parameters, Expression arg0, Expression arg1) {
+                if (!object.ReferenceEquals(parameters, NoArgs))
+                    return arg1 != null ? new Expression[] { Constant(binder), arg0, arg1 } : new Expression[] { Constant(binder), arg0 };
+                else
+                    return arg1 != null ? new Expression[] { Constant(binder), arg1 } : new Expression[] { Constant(binder) };
             }

             private static ConstantExpression Constant(DynamicMetaObjectBinder binder) {
@@ -422,6 +459,14 @@
                 return fallback(callDynamic);
             }

+            /// <summary>
+            /// Helper method for generating a MetaObject which calls a
+            /// specific method on DynamicObject that returns a result.
+            ///
+            /// args is either an array of arguments to be passed
+            /// to the method as an object[] or NoArgs to signify that
+            /// the target method takes no parameters.
+            /// </summary>
             private DynamicMetaObject BuildCallMethodWithResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, DynamicMetaObject fallbackResult, Fallback fallbackInvoke) {
                 if (!IsOverridden(methodName)) {
                     return fallbackResult;
@@ -435,11 +480,8 @@
                 // }
                 //
                 var result = Expression.Parameter(typeof(object), null);
-
-                var callArgs = new Expression[args.Length + 2];
-                Array.Copy(args, 0, callArgs, 1, args.Length);
-                callArgs[0] = Constant(binder);
-                callArgs[callArgs.Length - 1] = result;
+                ParameterExpression callArgs = methodName != "TryBinaryOperation" ? Expression.Parameter(typeof(object[]), null) : Expression.Parameter(typeof(object), null);
+                var callArgsValue = GetConvertedArgs(args);

                 var resultMO = new DynamicMetaObject(result, BindingRestrictions.Empty);

@@ -492,14 +534,23 @@

                 var callDynamic = new DynamicMetaObject(
                     Expression.Block(
-                        new[] { result },
+                        new[] { result, callArgs },
+                        methodName != "TryBinaryOperation" ? Expression.Assign(callArgs, Expression.NewArrayInit(typeof(object), callArgsValue)) : Expression.Assign(callArgs, callArgsValue[0]),
                         Expression.Condition(
                             Expression.Call(
                                 GetLimitedSelf(),
                                 typeof(DynamicObject).GetMethod(methodName),
-                                callArgs
+                                BuildCallArgs(
+                                    binder,
+                                    args,
+                                    callArgs,
+                                    result
+                                )
                             ),
-                            resultMO.Expression,
+                            Expression.Block(
+                                methodName != "TryBinaryOperation" ? ReferenceArgAssign(callArgs, args) : Expression.Empty(),
+                                resultMO.Expression
+                            ),
                             fallbackResult.Expression,
                             binder.ReturnType
                         )
@@ -514,8 +565,12 @@
             /// Helper method for generating a MetaObject which calls a
             /// specific method on Dynamic, but uses one of the arguments for
             /// the result.
-            /// </summary>
-            private DynamicMetaObject CallMethodReturnLast(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback) {
+            ///
+            /// args is either an array of arguments to be passed
+            /// to the method as an object[] or NoArgs to signify that
+            /// the target method takes no parameters.
+            /// </summary>
+            private DynamicMetaObject CallMethodReturnLast(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Expression value, Fallback fallback) {
                 //
                 // First, call fallback to do default binding
                 // This produces either an error or a call to a .NET member
@@ -531,19 +586,28 @@
                 //

                 var result = Expression.Parameter(typeof(object), null);
-                var callArgs = args.AddFirst(Constant(binder));
-                callArgs[args.Length] = Expression.Assign(result, callArgs[args.Length]);
+                var callArgs = Expression.Parameter(typeof(object[]), null);
+                var callArgsValue = GetConvertedArgs(args);

                 var callDynamic = new DynamicMetaObject(
                     Expression.Block(
-                        new[] { result },
+                        new[] { result, callArgs },
+                        Expression.Assign(callArgs, Expression.NewArrayInit(typeof(object), callArgsValue)),
                         Expression.Condition(
                             Expression.Call(
                                 GetLimitedSelf(),
                                 typeof(DynamicObject).GetMethod(methodName),
-                                callArgs
+                                BuildCallArgs(
+                                    binder,
+                                    args,
+                                    callArgs,
+                                    Expression.Assign(result, Expression.Convert(value, typeof(object)))
+                                )
                             ),
-                            result,
+                            Expression.Block(
+                                ReferenceArgAssign(callArgs, args),
+                                result
+                            ),
                             fallbackResult.Expression,
                             typeof(object)
                         )
@@ -567,6 +631,10 @@
             /// Helper method for generating a MetaObject which calls a
             /// specific method on Dynamic, but uses one of the arguments for
             /// the result.
+            ///
+            /// args is either an array of arguments to be passed
+            /// to the method as an object[] or NoArgs to signify that
+            /// the target method takes no parameters.
             /// </summary>
             private DynamicMetaObject CallMethodNoResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback) {
                 //
@@ -574,21 +642,35 @@
                 // This produces either an error or a call to a .NET member
                 //
                 DynamicMetaObject fallbackResult = fallback(null);
+                var callArgs = Expression.Parameter(typeof(object[]), null);
+                var callArgsValue = GetConvertedArgs(args);

                 //
                 // Build a new expression like:
                 //   if (TryDeleteMember(payload)) { } else { fallbackResult }
                 //
                 var callDynamic = new DynamicMetaObject(
-                    Expression.Condition(
-                        Expression.Call(
-                            GetLimitedSelf(),
-                            typeof(DynamicObject).GetMethod(methodName),
-                            args.AddFirst(Constant(binder))
-                        ),
-                        Expression.Empty(),
-                        fallbackResult.Expression,
-                        typeof(void)
+                    Expression.Block(
+                        new[] { callArgs },
+                        Expression.Assign(callArgs, Expression.NewArrayInit(typeof(object), callArgsValue)),
+                        Expression.Condition(
+                            Expression.Call(
+                                GetLimitedSelf(),
+                                typeof(DynamicObject).GetMethod(methodName),
+                                BuildCallArgs(
+                                    binder,
+                                    args,
+                                    callArgs,
+                                    null
+                                )
+                            ),
+                            Expression.Block(
+                                ReferenceArgAssign(callArgs, args),
+                                Expression.Empty()
+                            ),
+                            fallbackResult.Expression,
+                            typeof(void)
+                        )
                     ),
                     GetRestrictions().Merge(fallbackResult.Restrictions)
                 );


Fixed no resize in both directions

Fixed no resize in both directions

--- Sharpex.GameLibrary/Framework/Surface/WindowController.cs
+++ Sharpex.GameLibrary/Framework/Surface/WindowController.cs
@@ -170,6 +170,7 @@
             MethodInvoker br = delegate
             {
                 _surface.MaximumSize = _surface.Size;
+                _surface.MinimumSize = _surface.Size;
             };
             _surface.Invoke(br);
         }
@@ -181,6 +182,7 @@
             MethodInvoker br = delegate
             {
                 _surface.MaximumSize = new Size(0, 0);
+                _surface.MinimumSize = new Size(0, 0);
             };
             _surface.Invoke(br);
         }


WinForms: Include padding in desired size of a dock container

--- Source/Eto.Platform.Windows/Forms/WindowsDockContainer.cs
+++ Source/Eto.Platform.Windows/Forms/WindowsDockContainer.cs
@@ -52,15 +52,29 @@
 		{
 			get
 			{
-				if (UseContentDesiredSize)
+				var desiredSize = base.DesiredSize;
+
+				var handler = content.GetWindowsHandler();
+				if (handler != null)
 				{
-					var handler = content.GetWindowsHandler();
-					if (handler != null)
+					var desiredContentSize = handler.DesiredSize;
+					if (!handler.XScale)
 					{
-						return Size.Max(base.DesiredSize, handler.DesiredSize);
+						if (desiredSize.Width > 0)
+							desiredSize.Width = Math.Max(desiredSize.Width, desiredContentSize.Width);
+						else
+							desiredSize.Width = desiredContentSize.Width;
+					}
+
+					if (!handler.YScale)
+					{
+						if (desiredSize.Height > 0)
+							desiredSize.Height = Math.Max(desiredSize.Height, desiredContentSize.Height);
+						else
+							desiredSize.Height = desiredContentSize.Height;
 					}
 				}
-				return base.DesiredSize;
+				return desiredSize + Padding.Size;
 			}
 		}


Used PasswordVault for token storage

Used PasswordVault for token storage

--- CodeHub/Services/AuthService.cs
+++ CodeHub/Services/AuthService.cs
@@ -7,6 +7,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using Windows.Security.Authentication.Web;
+using Windows.Security.Credentials;
 using Windows.Storage;

 namespace CodeHub.Services
@@ -16,7 +17,6 @@
         #region App Creds
         GitHubClient client = new GitHubClient(new ProductHeaderValue("CodeHub"));
         Uri endUri = new Uri("http://example.com/path");
-        static string TOKEN_FILE_NAME = "CodeHubToken93dc7.dat";
         #endregion

         /// <summary>
@@ -87,7 +87,7 @@
                 if (token != null)
                 {
                     client.Credentials = new Credentials(token.AccessToken);
-                    await SaveToken(token.AccessToken);
+                    SaveToken(token.AccessToken, clientId);
                 }
                 return true;
             }
@@ -99,28 +99,20 @@

         }
-
+
         /// <summary>
         /// Saves access token in device
         /// </summary>
-        /// <param name="token">Access token</param>
-        /// <returns></returns>
-        private async Task<bool> SaveToken(string token)
-        {
-            try
-            {
-                StorageFile savedFile = await ApplicationData.Current.LocalFolder.
-                  CreateFileAsync(TOKEN_FILE_NAME, CreationCollisionOption.ReplaceExisting);
-
-                using (Stream writeStream = await savedFile.OpenStreamForWriteAsync())
-                {
-                    DataContractSerializer serializer =
-                        new DataContractSerializer(typeof(string));
-
-                    serializer.WriteObject(writeStream, token);
-                    await writeStream.FlushAsync();
-                    writeStream.Dispose();
-                }
+        /// <param name="token"></param>
+        /// <param name="clientId">Client Id is used as resource string for PasswordCredential</param>
+        /// <returns></returns>
+        private bool SaveToken(string token, string clientId)
+        {
+            try
+            {
+                var vault = new PasswordVault();
+                vault.Add(new PasswordCredential(
+                   clientId, clientId, token));

                 return true;
             }
@@ -138,17 +130,20 @@
         {
             try
             {
-                var readStream =
-                await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync(TOKEN_FILE_NAME);
-                if (readStream == null)
+                string clientId = await AppCredentials.getAppKey();
+                var vault = new PasswordVault();
+
+                var credentialList = vault.FindAllByResource(clientId);
+
+                if (credentialList.Count > 0)
+                {
+                    credentialList[0].RetrievePassword();
+                    return credentialList[0].Password;
+                }
+                else
                 {
                     return null;
                 }
-                DataContractSerializer serializer =
-                    new DataContractSerializer(typeof(string));
-
-                var token = serializer.ReadObject(readStream).ToString();
-                return token;
             }
             catch
             {
@@ -185,13 +180,16 @@
         {
             try
             {
-                StorageFile savedFile = await ApplicationData.Current.LocalFolder.GetFileAsync(TOKEN_FILE_NAME);
-
-                if (savedFile != null)
-                {
-                    await savedFile.DeleteAsync();
-                    return true;
-                }
+                string clientId = await AppCredentials.getAppKey();
+                var vault = new PasswordVault();
+
+                var credentialList = vault.FindAllByResource(clientId);
+
+                if (credentialList.Count > 0)
+                {
+                    vault.Remove(credentialList[0]);
+                }
+
                 return true;
             }
             catch


Fixed incorrect implementation of Force parameter

--- Commands/Admin/NewTenantSite.cs
+++ Commands/Admin/NewTenantSite.cs
@@ -85,9 +85,12 @@
             {
                 Uri uri = BaseUri;
                 Url = $"{uri.ToString().TrimEnd('/')}/{Url.TrimStart('/')}";
-                shouldContinue = ShouldContinue(string.Format(Resources.CreateSiteWithUrl0, Url), Resources.Confirm);
+                if (!Force)
+                {
+                    shouldContinue = ShouldContinue(string.Format(Resources.CreateSiteWithUrl0, Url), Resources.Confirm);
+                }
             }
-            if (Force || shouldContinue)
+            if (shouldContinue)
             {
 #if ONPREMISES
                 var entity = new SiteEntity();