add MeasureStringStatic to UG.Graphics. This isn't type-compatible with GDI+, but it's convenient.

--- SimpleScene/Util/GDIviaAGG.cs
+++ SimpleScene/Util/GDIviaAGG.cs
@@ -213,17 +213,29 @@
 			}

 			_InternalRender(s2, new RGBA_Bytes((uint)colorBrush.Color.ToArgb()) );
-		}
-
-		// TODO: adjust measure string to handle "StringFormat.GenericTypographic" differently than normal padding
-		public SizeF MeasureString(string text, Font font) {
+		}
+
+
+        // these are non-static to be compatible with GDI+
+        public SizeF MeasureString(string text, Font font)
+        {
+            return Graphics.MeasureStringStatic(text, font);
+        }
+        public SizeF MeasureString(string text, Font font, PointF origin, StringFormat format)
+        {
+            return Graphics.MeasureStringStatic(text, font, origin, format);
+        }
+
+        // TODO: These are not GDI+ compatible.. decide where to put them.
+		// TODO: adjust measure string to handle "StringFormat.GenericTypographic" differently than normal padding
+		public static SizeF MeasureStringStatic (string text, Font font) {
 			// TODO: teach agg-sharp to render windows fonts
 			var tfp = new TypeFacePrinter(text, font.SizeInPoints);
 			var bounds = tfp.LocalBounds;
 			return new SizeF((float)bounds.Width,(float)bounds.Height);
 		}

-		public SizeF MeasureString (string text, Font font, PointF origin, StringFormat format) {
+		public static SizeF MeasureStringStatic (string text, Font font, PointF origin, StringFormat format) {
 			var tfp = new TypeFacePrinter(text, font.SizeInPoints);
 			var bounds = tfp.LocalBounds;
 			return new SizeF((float)bounds.Width,(float)bounds.Height);


supplywindow

supplywindow

--- Snacks/Snacks/SupplyWindow.cs
+++ Snacks/Snacks/SupplyWindow.cs
@@ -32,7 +32,7 @@

 namespace Snacks
 {
-    [KSPAddon(KSPAddon.Startup.EveryScene, false)]
+    [KSPAddon(KSPAddon.Startup.Flight | KSPAddon.Startup.EveryScene, false)]
     class SupplyWindow : KSPPluginFramework.MonoBehaviourWindow
     {

@@ -47,7 +47,7 @@
         internal override void Awake()
         {
             WindowCaption = "Snack Supply";
-            WindowRect = new Rect(0, 0, 250, 300);
+            WindowRect = new Rect(0, 0, 300, 300);
             Visible = false;
             string textureName = "Snacks/Textures/snacks";
             texture = GameDatabase.Instance.GetTexture(textureName,false);
@@ -56,8 +56,13 @@

         private void SetupGUI()
         {
-            if(button == null)
-                button = ApplicationLauncher.Instance.AddModApplication(ShowGUI, HideGUI, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS,texture);
+            if (HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.SPACECENTER)
+            {
+                if (button == null)
+                    button = ApplicationLauncher.Instance.AddModApplication(ShowGUI, HideGUI, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, texture);
+            }
+            else if (button != null)
+                ApplicationLauncher.Instance.RemoveModApplication(button);
         }

@@ -73,8 +78,8 @@

         private void SetupStyles()
         {
+
             hedStyle = new GUIStyle(GUI.skin.label);
-            hedStyle.fontStyle = FontStyle.Bold;
             regStyle = new GUIStyle(GUI.skin.label);
             regStyle.margin = new RectOffset(25, 0, 0, 0);
             redStyle = new GUIStyle(regStyle);
@@ -89,7 +94,7 @@
                 SetupStyles();
             DragEnabled = true;
             TooltipsEnabled = true;
-            scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Height(300), GUILayout.Width(250));
+            scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Height(300), GUILayout.Width(300));

             var ships = from ProtoVessel v in HighLogic.CurrentGame.flightState.protoVessels
                         where v.GetVesselCrew().Count() > 0
@@ -98,7 +103,7 @@

             foreach (var s in ships)
             {
-                GUILayout.Label(s.Vessels.First().vesselRef.mainBody.name,hedStyle);
+                GUILayout.Label(s.Vessels.First().vesselRef.mainBody.name + ":");
                 foreach (var v in s.Vessels)
                 {
                     double snackAmount = 0;
@@ -130,12 +135,12 @@
             GUILayout.EndScrollView();

         }
-        /*private void onDestroy()
+        private void onDestroy()
         {
             Debug.Log("SupplyWindow destroyed");
             if (button != null)
                 ApplicationLauncher.Instance.RemoveModApplication(button);
-        }*/
+        }
     }


Code refactoring

Code refactoring

--- FaceDetector/Filter/ViolaJones.cs
+++ FaceDetector/Filter/ViolaJones.cs
@@ -1,66 +0,0 @@
-using System.Drawing;
-using System.Drawing.Imaging;
-
-namespace FaceDetector.Filter
-{
-    class ViolaJones
-    {
-
-        private ulong[ , ] ToIntegral (Bitmap image)
-        {
-            unsafe
-            {
-                var bitmapData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
-                    ImageLockMode.ReadWrite, image.PixelFormat);
-
-                var bytesPerPixel = Image.GetPixelFormatSize(image.PixelFormat) / 8;
-                var widthInBytes = bitmapData.Width * bytesPerPixel;
-                var ptrFirstPixel = (byte*)bitmapData.Scan0;
-
-                var result = new ulong[bitmapData.Height, bitmapData.Width];
-
-                for (var x = 0; x < bitmapData.Height; x++)
-                {
-                    var currentLine = ptrFirstPixel + (x * bitmapData.Stride);
-
-                    for (var c = 0; c < widthInBytes; c += bytesPerPixel)
-                    {
-                        var y = c / bytesPerPixel;
-
-                        /*
-                            Формула для пикселя интегрального изорбражения
-                            L(x,y) = I(x, y) - L(x - 1, y - 1) + L(x - 1, y) + L(x, y - 1),
-                            где I(x, y) - яркость пикселя исходного изображения
-                        */
-
-                        result[x, y] = GetPixelBright(currentLine[c + 2], currentLine[c + 1], currentLine[c]);
-
-                        if ((x - 1 >= 0) && (y - 1 >= 0))
-                        {
-                            result[x, y] -= result[x - 1, y - 1];
-                        }
-
-                        if (y - 1 >= 0)
-                        {
-                            result[x, y] += result[x, y - 1];
-                        }
-
-                        if (x - 1 >= 0)
-                        {
-                            result[x, y] += result[x - 1, y];
-                        }
-                    }
-                }
-
-                image.UnlockBits(bitmapData);
-                return result;
-            }
-        }
-
-        private byte GetPixelBright(int R, int G, int B)
-        {
-            //Значение яркости лежит в диапазоне от 0 до 255
-            return (byte) (0.3 * R + 0.59 * G + 0.11 * B);
-        }
-    }
-}


green: implemented top level task messages

--- src/Bau/Bau.cs
+++ src/Bau/Bau.cs
@@ -115,10 +115,24 @@
             }

             Log.Info(header);
+            var tasksText = this.topLevelTasks.Skip(1).Aggregate(
+                new ColorText("'", new ColorToken(this.topLevelTasks[0], Log.TaskColor), "'"),
+                (current, task) => current.Concat(new ColorText(", '", new ColorToken(task, Log.TaskColor), "'")));
+
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+            Log.Info(new ColorText("Running ").Concat(tasksText).Concat(" and dependencies..."));
             foreach (var task in this.topLevelTasks)
             {
                 this.Invoke(task);
             }
+
+            Log.Info(new ColorText("Completed ")
+                .Concat(tasksText)
+                .Concat(new ColorText(
+                    " and dependencies in ",
+                    new ColorToken(stopwatch.Elapsed.TotalMilliseconds.ToStringFromMilliseconds(), ConsoleColor.DarkYellow),
+                    ".")));
         }

         [Obsolete("Use Run() instead.")]


optimize Overlaps

optimize Overlaps

--- Source/RankedSet/RankedSet.cs
+++ Source/RankedSet/RankedSet.cs
@@ -517,26 +517,18 @@
             if (other == null)
                 throw new ArgumentNullException (nameof (other));

-            if (Count == 0)
-                return false;
-
-            if (other is RankedSet<T> oSet)
-            {
-                if (Comparer.Compare (oSet.Max, Min) < 0)
-                    return false;
-                if (Comparer.Compare (oSet.Min, Max) > 0)
-                    return false;
-
-                foreach (T key in oSet.GetBetween (Min, Max))
-                    if (Contains (key))
-                        return true;
-
-                return false;
-            }
-
-            foreach (T key in other)
-                if (Contains (key))
-                    return true;
+            if (Count != 0)
+                if (other is RankedSet<T> oSet)
+                {
+                    if (Comparer.Compare (oSet.Max, Min) >= 0 && Comparer.Compare (oSet.Min, Max) <= 0)
+                        foreach (T key in oSet.GetBetween (Min, Max))
+                            if (Contains (key))
+                                return true;
+                }
+                else
+                    foreach (T key in other)
+                        if (Contains (key))
+                            return true;

             return false;
         }


feat: support object value

feat: support object value

--- Source/Sagitta/PixivClient.cs
+++ Source/Sagitta/PixivClient.cs
@@ -75,7 +75,7 @@
             File = new FileClient(this);
         }

-        internal async Task<T> GetAsync<T>(string url, List<KeyValuePair<string, string>> parameters = null)
+        internal async Task<T> GetAsync<T>(string url, List<KeyValuePair<string, object>> parameters = null)
         {
             var obj = (await GetAsync(url, parameters).Stay()).ToObject<T>();
             if (obj is ICursorable cursorable)
@@ -83,27 +83,32 @@
             return obj;
         }

-        internal async Task<JObject> GetAsync(string url, List<KeyValuePair<string, string>> parameters = null)
+        internal async Task<JObject> GetAsync(string url, List<KeyValuePair<string, object>> parameters = null)
         {
             if (parameters != null && parameters.Count > 0)
-                url += "?" + string.Join("&", parameters.Select(w => $"{w.Key}={Uri.EscapeDataString(w.Value)}"));
+                url += "?" + string.Join("&", parameters.Select(w => $"{w.Key}={Uri.EscapeDataString(AsStringValue(w.Value))}"));
             var response = await _httpClient.GetAsync(url).Stay();
             HandleErrors(response);

             return JObject.Parse(await response.Content.ReadAsStringAsync().Stay());
         }

-        internal async Task<T> PostAsync<T>(string url, IEnumerable<KeyValuePair<string, string>> parameters)
+        internal async Task<T> PostAsync<T>(string url, IEnumerable<KeyValuePair<string, object>> parameters)
         {
             return (await PostAsync(url, parameters).Stay()).ToObject<T>();
         }

-        internal async Task<JObject> PostAsync(string url, IEnumerable<KeyValuePair<string, string>> parameters)
-        {
-            var content = new FormUrlEncodedContent(parameters);
+        internal async Task<JObject> PostAsync(string url, IEnumerable<KeyValuePair<string, object>> parameters)
+        {
+            var content = new FormUrlEncodedContent(parameters.Select(w => new KeyValuePair<string, string>(w.Key, AsStringValue(w.Value))));
             var response = await _httpClient.PostAsync(url, content).Stay();
             HandleErrors(response);
             return JObject.Parse(await response.Content.ReadAsStringAsync().Stay());
+        }
+
+        private static string AsStringValue<T>(T w)
+        {
+            return w is bool ? w.ToString().ToLower() : w.ToString();
         }

         private static void HandleErrors(HttpResponseMessage response)


Fix more focus regressions

Fix more focus regressions

Things were very wrong before. Stuff getting unfocused when it shouldn't, incorrect states.

--- osu.Framework/Input/InputManager.cs
+++ osu.Framework/Input/InputManager.cs
@@ -115,39 +115,49 @@
         /// then attempts to focus the given drawable if it is not null. If the given drawable is
         /// already focused, nothing happens and no events are fired.
         /// </summary>
-        /// <param name="focus">The drawable to become focused.</param>
+        /// <param name="potentialFocusTarget">The drawable to become focused.</param>
         /// <param name="state">The <see cref="InputState"/> associated with the focusing event.</param>
         /// <returns>True iff the given drawable is now focused.</returns>
-        protected bool ChangeFocus(Drawable focus, InputState state)
-        {
-            if (focus == FocusedDrawable) return FocusedDrawable != null;
+        protected bool ChangeFocus(Drawable potentialFocusTarget, InputState state)
+        {
+            if (potentialFocusTarget == FocusedDrawable)
+                return true;

             var previousFocus = FocusedDrawable;
             FocusedDrawable = null;

             if (previousFocus != null)
-            {
+                // temporarily remove focus from the current focus target.
                 previousFocus.HasFocus = false;
-                previousFocus.TriggerOnFocusLost(CurrentState);
-            }

             if (FocusedDrawable != null) throw new InvalidOperationException($"Focus cannot be changed inside {nameof(OnFocusLost)}");

-            if (focus?.IsPresent == true)
+            if (potentialFocusTarget?.IsPresent == true)
             {
                 // pre-emptively set the focused drawable before we do a focus check.
                 // this allows for correct behaviour if a subsequent ChangeFocus call occurs as a result of TriggerOnFocus below.
-                FocusedDrawable = focus;
+                FocusedDrawable = potentialFocusTarget;
                 FocusedDrawable.HasFocus = true;

-                if (!focus.TriggerOnFocus(CurrentState))
-                {
-                    focus.HasFocus = false;
-                    if (FocusedDrawable == focus) FocusedDrawable = null;
-                }
-            }
-
-            return FocusedDrawable != null;
+                if (!potentialFocusTarget.TriggerOnFocus(CurrentState))
+                {
+                    // focus failed, so let's reset the changes we made.
+                    potentialFocusTarget.HasFocus = false;
+                    if (FocusedDrawable == potentialFocusTarget)
+                        FocusedDrawable = previousFocus;
+                }
+            }
+
+            if (previousFocus != null)
+            {
+                //if nothing changed, then we should restore focus, else we should trigger OnFocusLost.
+                if (FocusedDrawable == previousFocus)
+                    previousFocus.HasFocus = true;
+                else
+                    previousFocus.TriggerOnFocusLost(state);
+            }
+
+            return FocusedDrawable == potentialFocusTarget;
         }

         internal override bool BuildKeyboardInputQueue(List<Drawable> queue) => false;
@@ -548,14 +558,12 @@
         {
             var intersectingQueue = mouseInputQueue.Intersect(mouseDownInputQueue);

-            var newFocus = intersectingQueue.FirstOrDefault(t => !t.HasFocus && ChangeFocus(t, state));
+            var newFocus = intersectingQueue.FirstOrDefault(t => ChangeFocus(t, state));
+            if (newFocus == null)
+                ChangeFocus(null, state);

             //extra check for IsAlive because we are using an outdated queue.
-            if (intersectingQueue.Any(t => t.IsHovered(state.Mouse.Position) && t.TriggerOnClick(state)))
-                return true;
-
-            ChangeFocus(newFocus);
-            return false;
+            return intersectingQueue.Any(t => t.IsHovered(state.Mouse.Position) && t.TriggerOnClick(state));
         }

         private bool handleMouseDoubleClick(InputState state)


Fix LastMousePosition not always being present when expected

Closes ppy/osu#2384

--- osu.Framework/Input/InputManager.cs
+++ osu.Framework/Input/InputManager.cs
@@ -437,6 +437,7 @@

             mouse.LastPosition = last.Position;
             mouse.LastWheel = last.Wheel;
+            mouse.PositionMouseDown = last.PositionMouseDown;

             if (mouse.Position != last.Position)
             {
@@ -463,8 +464,6 @@

             if (mouse.HasAnyButtonPressed)
             {
-                mouse.PositionMouseDown = last.PositionMouseDown;
-
                 if (!last.HasAnyButtonPressed)
                 {
                     //stuff which only happens once after the mousedown state


Remove unused feature of FramedClock

Remove unused feature of FramedClock

This was used for pausing but honestly there's better ways of doing this. Adding extra complexity to FramedClock is not necessary.

--- osu.Framework/Timing/FramedClock.cs
+++ osu.Framework/Timing/FramedClock.cs
@@ -52,17 +52,11 @@
         private double timeSinceLastCalculation;
         private int framesSinceLastCalculation;

-        /// <summary>
-        /// Whether we should run <see cref="ProcessFrame"/> on the underlying <see cref="Source"/> (in the case it is an <see cref="IFrameBasedClock"/>).
-        /// </summary>
-        public bool ProcessSourceClockFrames = true;
-
         private const int fps_calculation_interval = 250;

         public virtual void ProcessFrame()
         {
-            if (ProcessSourceClockFrames)
-                (Source as IFrameBasedClock)?.ProcessFrame();
+            (Source as IFrameBasedClock)?.ProcessFrame();

             if (timeUntilNextCalculation <= 0)
             {


Adjust velocity calculation.

Adjust velocity calculation.

--- osu.Game.Mode.Osu/Objects/Slider.cs
+++ osu.Game.Mode.Osu/Objects/Slider.cs
@@ -11,7 +11,7 @@
     {
         public override double EndTime => StartTime + (RepeatCount + 1) * Curve.Length / VelocityAt(StartTime);

-        public double VelocityAt(double time) => 10000 / Beatmap.BeatLengthAt(time, true) * Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;
+        public double VelocityAt(double time) => 100 / Beatmap.BeatLengthAt(time, true) * Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;

         public int RepeatCount;


Add a way to retrieve new WorkingBeatmap instances

--- osu.Game/Beatmaps/BeatmapManager.cs
+++ osu.Game/Beatmaps/BeatmapManager.cs
@@ -281,8 +281,9 @@
         /// </summary>
         /// <param name="beatmapInfo">The beatmap to lookup.</param>
         /// <param name="previous">The currently loaded <see cref="WorkingBeatmap"/>. Allows for optimisation where elements are shared with the new beatmap. May be returned if beatmapInfo requested matches</param>
+        /// <param name="bypassCache">Whether to bypass the cache and return a new <see cref="WorkingBeatmap"/> instance.</param>
         /// <returns>A <see cref="WorkingBeatmap"/> instance correlating to the provided <see cref="BeatmapInfo"/>.</returns>
-        public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
+        public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool bypassCache = false)
         {
             if (beatmapInfo?.ID > 0 && previous != null && previous.BeatmapInfo?.ID == beatmapInfo.ID)
                 return previous;
@@ -301,9 +302,14 @@

             lock (workingCache)
             {
-                var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
-                if (working != null)
-                    return working;
+                BeatmapManagerWorkingBeatmap working;
+
+                if (!bypassCache)
+                {
+                    working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
+                    if (working != null)
+                        return working;
+                }

                 beatmapInfo.Metadata ??= beatmapInfo.BeatmapSet.Metadata;


Revert "Attempt using TreePath instead of Key"

This reverts commit 2848e04b480e02bfd3666f382d8c3b53faaa7ec9.

--- Srclib.Nuget/Models/Output.cs
+++ Srclib.Nuget/Models/Output.cs
@@ -212,7 +212,7 @@

       return new Ref
       {
-        DefPath = key.Path
+        DefPath = key.Key
       };
     }

@@ -228,7 +228,7 @@
     {
       return new Ref
       {
-        DefPath = def.TreePath,
+        DefPath = def.DefKey,
         File = def.File,
         Start = def.DefStart,
         End = def.DefEnd,


Lock during validity checks

Lock during validity checks

--- osu.Game/Beatmaps/WorkingBeatmap.cs
+++ osu.Game/Beatmaps/WorkingBeatmap.cs
@@ -121,6 +121,8 @@
             private readonly Func<T> valueFactory;
             private readonly Func<T, bool> stillValidFunction;

+            private readonly object initLock = new object();
+
             public AsyncLazy(Func<T> valueFactory, Func<T, bool> stillValidFunction = null)
             {
                 this.valueFactory = valueFactory;
@@ -134,7 +136,6 @@
                 if (!IsValueCreated) return;

                 (lazy.Value.Result as IDisposable)?.Dispose();
-
                 init();
             }

@@ -158,9 +159,11 @@

             private void ensureValid()
             {
-                if (!lazy.IsValueCreated || (stillValidFunction?.Invoke(lazy.Value.Result) ?? true)) return;
-
-                init();
+                lock (initLock)
+                {
+                    if (!lazy.IsValueCreated || (stillValidFunction?.Invoke(lazy.Value.Result) ?? true)) return;
+                    init();
+                }
             }

             private void init()


Remove unnecessary clone operations

Remove unnecessary clone operations

--- osu.Game/Beatmaps/WorkingBeatmap.cs
+++ osu.Game/Beatmaps/WorkingBeatmap.cs
@@ -119,9 +119,6 @@
                 // Apply difficulty mods
                 if (mods.Any(m => m is IApplicableToDifficulty))
                 {
-                    converted.BeatmapInfo = converted.BeatmapInfo.Clone();
-                    converted.Difficulty = converted.Difficulty.Clone();
-
                     foreach (var mod in mods.OfType<IApplicableToDifficulty>())
                     {
                         if (cancellationSource.IsCancellationRequested)


Reuse "select/deselect all" localisable string on column toggle

--- osu.Game/Overlays/Mods/ModColumn.cs
+++ osu.Game/Overlays/Mods/ModColumn.cs
@@ -5,6 +5,7 @@

 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
@@ -22,6 +23,7 @@
 using osu.Game.Graphics;
 using osu.Game.Graphics.Containers;
 using osu.Game.Graphics.UserInterface;
+using osu.Game.Localisation;
 using osu.Game.Rulesets.Mods;
 using osu.Game.Utils;
 using osuTK;
@@ -220,7 +222,6 @@
                     Origin = Anchor.CentreLeft,
                     Scale = new Vector2(0.8f),
                     RelativeSizeAxes = Axes.X,
-                    LabelText = "Enable All",
                     Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0)
                 });
                 panelFlow.Padding = new MarginPadding
@@ -263,6 +264,19 @@

             contentContainer.BorderColour = ColourInfo.GradientVertical(colourProvider.Background4, colourProvider.Background3);
             contentBackground.Colour = colourProvider.Background4;
+        }
+
+        protected override void LoadComplete()
+        {
+            base.LoadComplete();
+
+            toggleAllCheckbox?.Current.BindValueChanged(_ => updateToggleAllText(), true);
+        }
+
+        private void updateToggleAllText()
+        {
+            Debug.Assert(toggleAllCheckbox != null);
+            toggleAllCheckbox.LabelText = toggleAllCheckbox.Current.Value ? CommonStrings.DeselectAll : CommonStrings.SelectAll;
         }

         private void updateLocalAvailableMods()


Added a test for indexer with an invalid index

--- unit-tests/Tests.cs
+++ unit-tests/Tests.cs
@@ -56,7 +56,7 @@
         {
             Assert.That(_lateBindingFacade.Field("myField").Get<Int32>(), Is.EqualTo(27));

-            _lateBindingFacade.Field("myField").Set(-55);
+            _lateBindingFacade.Field("myField").Set(-50);

             Assert.That(_lateBindingFacade.Field("myField").Get<Int32>(), Is.EqualTo(-50));
         }
@@ -128,39 +128,43 @@
             Assert.That(_lateBindingFacade.Property("MyProp").Get<Int32>(), Is.EqualTo(69));
         }

-        [Test,ExpectedException(typeof(Exception))]
-        public void TestIndexerAccess()
+        [Test, ExpectedException(typeof(OperationCallFailedException))]
+        public void TestBadIndexerAccess()
         {
-            Assert.That(_lateBindingFacade.Index(5).Get(), Is.EqualTo("default"));
-
-            _lateBindingFacade.Index(5).Set("[myValue]");
-
-            Assert.That(_lateBindingFacade.Index(5).Get(), Is.EqualTo(("value:" + "[myValue]")));
+            _lateBindingFacade.Index(5).Get<string>();
         }

         [Test]
+        public void TestIndexerAccess()
+        {
+            _lateBindingFacade.Index(5).Set("[myValue]");
+
+            Assert.That(_lateBindingFacade.Index(5).Get<string>(), Is.EqualTo(("[myValue]")));
+        }
+
+        [Test,Ignore]
         public void WordAutomationTest_NotReallyATestUnit()
         {
             IOperationInvoker wordApp = BindingFactory.CreateAutomationBinding("Word.Application");

             //Get Word objects to interop operations
-            IOperationInvoker document = wordApp.Property("Documents").Get<IOperationInvoker>();
+            IOperationInvoker document = wordApp.Property("Documents").Get();

             document
                 .Method("Add")
                 .Invoke();
-            IOperationInvoker selection = wordApp.Property("Selection").Get<IOperationInvoker>();
+            IOperationInvoker selection = wordApp.Property("Selection").Get();

             string str = "Hello World!";

-            //Make workd visible
+            //Make Word visible
             wordApp.Property("Visible").Set(true);

             //Activate bold
             selection.Method("BoldRun").Invoke();

             //Change font size
-            selection.Property("Font").Get<IOperationInvoker>().Property("Size").Set(20);
+            selection.Property("Font").Get().Property("Size").Set(20);

             foreach (char c in str)
             {
@@ -169,7 +173,7 @@
             }

             //We need to get the type of the enumeration, that breaks the Late Binding approach as we need
-            //a way to know a specific type, and it's aseembly
+            //a way to know a specific type, and it's assembly
             //Type enumType = Assembly
             //      .LoadWithPartialName("Microsoft.Office.Interop.Word")
             //      .GetType("Microsoft.Office.Interop.Word.WdSaveOptions", false);


Added command name in sample.

Added command name in sample.

--- sample/Program.cs
+++ sample/Program.cs
@@ -14,6 +14,7 @@
             {
                 config.AddProxy<EfSettings>("ef", ef =>
                 {
+                    ef.SetDescription("Fake EF Core .NET Command Line Tools");
                     ef.AddProxy<EfDatabaseSettings>("database", database =>
                     {
                         database.AddCommand<EfUpdateCommand>("update");


Updating the constructors to now allow only setting of the serialiser settings and the request behavior. Since it is a JSON result the content type and content encoding are manually/statically set in code.

--- trunk/WebExtras.Mvc/Core/JsonNetResult.cs
+++ trunk/WebExtras.Mvc/Core/JsonNetResult.cs
@@ -38,35 +38,22 @@
     /// Constructor
     /// </summary>
     /// <param name="data">Data to be returned</param>
-    /// <param name="settings">JSON serialiser settings</param>
-    public JsonNetResult(object data, JsonSerializerSettings settings = null)
-      : this(data, "application/json", Encoding.UTF8, settings)
+    /// <param name="behavior">[Optional] JSON request behavior</param>
+    public JsonNetResult(object data, JsonRequestBehavior behavior)
+      : this(data, null, behavior)
     { }

     /// <summary>
     /// Constructor
     /// </summary>
     /// <param name="data">Data to be returned</param>
-    /// <param name="contentType">Content type</param>
-    /// <param name="settings">JSON serialiser settings</param>
-    public JsonNetResult(object data, string contentType, JsonSerializerSettings settings = null)
-      : this(data, contentType, Encoding.UTF8, settings)
-    { }
-
-    /// <summary>
-    /// Constructor
-    /// </summary>
-    /// <param name="data">Data to be returned</param>
-    /// <param name="contentType">Content type</param>
-    /// <param name="contentEncoding">Content encoding</param>
-    /// <param name="settings">JSON serialiser settings</param>
-    public JsonNetResult(object data, string contentType, Encoding contentEncoding, JsonSerializerSettings settings = null)
+    /// <param name="settings">[Optional] JSON serialiser settings</param>
+    /// <param name="behavior">[Optional] JSON request behavior</param>
+    public JsonNetResult(object data, JsonSerializerSettings settings = null, JsonRequestBehavior behavior = JsonRequestBehavior.DenyGet)
     {
       Data = data;
-      ContentType = contentType;
-      ContentEncoding = contentEncoding;
       SerialiserSettings = settings ?? new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
-      JsonRequestBehavior = JsonRequestBehavior.DenyGet;
+      JsonRequestBehavior = behavior;
     }

     /// <summary>
@@ -83,8 +70,8 @@

       HttpResponseBase response = context.HttpContext.Response;

-      response.ContentType = ContentType;
-      response.ContentEncoding = ContentEncoding;
+      response.ContentType = "application/json";
+      response.ContentEncoding = Encoding.UTF8;

       if (Data != null)
       {


+ comments

+ comments

--- Freya.WFEngine/XmlConfigurator.cs
+++ Freya.WFEngine/XmlConfigurator.cs
@@ -28,20 +28,36 @@
             this.configurations.Add(workflowConfiguration);
         }

+        /// <summary>
+        /// Adds activity type definition.
+        /// </summary>
+        /// <param name="activityNodeName">name of the xml element.</param>
+        /// <param name="activityType">activity type</param>
         public void AddActivityDefinition(string activityNodeName, Type activityType) {
             AddTypeDefinition(activityNodeName, activityType, this.activityTypes);
         }

+        /// <summary>
+        /// Adds activity guard type definition.
+        /// </summary>
+        /// <param name="guardNodeName">name of the xml element</param>
+        /// <param name="guardType">activity guard type</param>
         public void AddGuardDefinition(string guardNodeName, Type guardType) {
             AddTypeDefinition(guardNodeName, guardType, this.guardTypes);
         }

+        /// <summary>
+        /// Adds workflow configuration from xml string.
+        /// </summary>
         public void AddXml(string xml) {
             XmlDocument xmlDoc = new XmlDocument();
             xmlDoc.LoadXml(xml);
             this.Add(xmlDoc.DocumentElement);
         }

+        /// <summary>
+        /// Updates the specified workflow according to configuration.
+        /// </summary>
         public void Configure<TItem>(Workflow<TItem> workflow) {
             foreach (var workflowConfiguration in configurations) {
                 this.LoadActivityDefinitions(workflowConfiguration.SelectSingleNode(SR.ActivitiesElementName));


Little binding tweak

Little binding tweak

--- SOVND.Client/MainWindow.xaml.cs
+++ SOVND.Client/MainWindow.xaml.cs
@@ -42,6 +42,12 @@
             App.client.Run();
             App.client.SubscribedChannel.Subscribe();
             App.client.RegisterChannel("ambient", "Ambient music :)", "");
+            BindToPlaylist();
+        }
+
+        private void BindToPlaylist()
+        {
+            lbPlaylist.ItemsSource = App.client.SubscribedChannel.Playlist.InOrder();
         }

         private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
@@ -63,7 +69,7 @@
             }
             else
             {
-                lbPlaylist.ItemsSource = App.client.SubscribedChannel.Playlist.InOrder();
+                BindToPlaylist();
             }
         }


fixed a compiling issue

fixed a compiling issue

--- Samples/CommandAssembly/ECHO.cs
+++ Samples/CommandAssembly/ECHO.cs
@@ -16,7 +16,7 @@
     {
         public override void ExecuteCommand(WebSocketSession session, SubRequestInfo requestInfo)
         {
-            session.SendResponse(requestInfo.Data);
+            session.Send(requestInfo.Body);
         }
     }
 }


delete wrong dir

delete wrong dir

--- Scripts/Assets/GooglePlayIds.cs
+++ Scripts/Assets/GooglePlayIds.cs
@@ -1,30 +0,0 @@
-// <copyright file="GPGSIds.cs" company="Google Inc.">
-// Copyright (C) 2015 Google Inc. All Rights Reserved.
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//  http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//    limitations under the License.
-// </copyright>
-
-///
-/// This file is automatically generated DO NOT EDIT!
-///
-/// These are the constants defined in the Play Games Console for Game Services
-/// Resources.
-///
-
-
-public static class GooglePlayIds
-{
-        public const string leaderboard_high_scores = "CgkI19aihIAQEAIQAA"; // <GPGSID>
-
-}
-


Code refactoring

Code refactoring

--- Selenium/Internal/ProcessExt.cs
+++ Selenium/Internal/ProcessExt.cs
@@ -57,17 +57,15 @@
             Marshal.WriteInt32(buffer, bufferSize);
             var entryPtr = (NativeMethods.WinProcessEntry*)buffer;
             try {
-                if (NativeMethods.Process32First(snapshot, buffer)) {
-                    do {
-                        NativeMethods.WinProcessEntry entry = *entryPtr;
-                        items.Add(new ProcessInfo {
-                            Id = entry.th32ProcessID,
-                            ParentId = entry.th32ParentProcessID
-                        });
-                    } while (NativeMethods.Process32Next(snapshot, buffer));
-                } else {
+                if (!NativeMethods.Process32First(snapshot, buffer))
                     throw new Win32Exception();
-                }
+                do {
+                    NativeMethods.WinProcessEntry entry = *entryPtr;
+                    items.Add(new ProcessInfo {
+                        Id = entry.th32ProcessID,
+                        ParentId = entry.th32ParentProcessID
+                    });
+                } while (NativeMethods.Process32Next(snapshot, buffer));
             } finally {
                 Marshal.FreeHGlobal(buffer);
                 NativeMethods.CloseHandle(snapshot);


remove a few c.wls that snuck in

remove a few c.wls that snuck in

svn path=/trunk/gtk-sharp/; revision=38628

--- parser/gapi-fixup.cs
+++ parser/gapi-fixup.cs
@@ -132,15 +132,12 @@
 			}

 			if (symbol_doc != null) {
-				Console.WriteLine ("adding symbols to api file");
 				XPathNavigator symbol_nav = symbol_doc.CreateNavigator ();
 				XPathNodeIterator iter = symbol_nav.Select ("/api/*");
 				while (iter.MoveNext ()) {
-					Console.WriteLine ("adding symbol");
 					XmlNode sym_node = ((IHasXmlNode)iter.Current).GetNode ();
 					XPathNodeIterator parent_iter = api_nav.Select ("/api");
 					if (parent_iter.MoveNext ()) {
-						Console.WriteLine ("to parent node");
 						XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode ();
 						parent_node.AppendChild (api_doc.ImportNode (sym_node, true));
 					}


Fixed some ns for the allocation heavy guys

--- Gu.Reactive.Tests/Purrformance.cs
+++ Gu.Reactive.Tests/Purrformance.cs
@@ -27,6 +27,7 @@
         [Test]
         public void ToObservableNested()
         {
+            int n = 1000;
             var observables = new IObservable<EventPattern<PropertyChangedEventArgs>>[n];
             var fake = new FakeInpc { Prop1 = false, Prop2 = true, Next = new Level { Name = "" } };
             var stopwatch = Stopwatch.StartNew();
@@ -54,6 +55,7 @@
         [Test]
         public void ToObservableAndSubscribeNested()
         {
+            const int n = 1000;
             var observables = new IDisposable[n];
             var fake = new FakeInpc { Prop1 = false, Prop2 = true, Next = new Level { Name = "" } };
             var stopwatch = Stopwatch.StartNew();
@@ -78,6 +80,23 @@
             Console.WriteLine("Reacting to {0} events took {1} ms ({2:F2} ms each)", n, stopwatch.ElapsedMilliseconds, (double)stopwatch.ElapsedMilliseconds / n);
             Assert.AreEqual(n, count);
         }
+
+
+        [Test]
+        public void ReactNested()
+        {
+            int count = 0;
+            var fake = new FakeInpc { Next = new Level()};
+            var stopwatch = Stopwatch.StartNew();
+            var observable = fake.ToObservable(x => x.Next.Value, false).Subscribe(x => count++);
+            for (int i = 0; i < n; i++)
+            {
+                fake.Next.Value = !fake.Next.Value;
+            }
+            Console.WriteLine("Reacting to {0} events took {1} ms ({2:F2} ms each)", n, stopwatch.ElapsedMilliseconds, (double)stopwatch.ElapsedMilliseconds / n);
+            Assert.AreEqual(n, count);
+        }
+

         [Test]
         public void BaselineVanillaEvent()


Set reasonable WaitOne timeout

Set reasonable WaitOne timeout

--- GuiAutomation/AutomationRunner.cs
+++ GuiAutomation/AutomationRunner.cs
@@ -1089,8 +1089,8 @@
 				Task.Delay(testTimeout),
 				Task.Run(() =>
 				{
-					// Wait until the first system window draw before running the test method
-					resetEvent.WaitOne();
+					// Wait until the first system window draw before running the test method, up to the timeout
+					resetEvent.WaitOne(testTimeout);

 					return testMethod(testRunner);
 				}));


Minor changes

Minor changes

--- Hermod/HTTP/Server/JSONWrapper.cs
+++ Hermod/HTTP/Server/JSONWrapper.cs
@@ -34,11 +34,44 @@
 namespace org.GraphDefined.Vanaheimr.Hermod.HTTP
 {

+    /// <summary>
+    /// A JSON object (wrapper).
+    /// </summary>
     public class JSONWrapper
     {

+        #region Data
+
         private readonly IDictionary<String, Object> Internal;

+        #endregion
+
+        #region Properties
+
+        #region HasProperties
+
+        /// <summary>
+        /// The JSOB Object has
+        /// </summary>
+        public Boolean HasProperties
+        {
+            get
+            {
+                return Internal.Any();
+            }
+        }
+
+        #endregion
+
+        #endregion
+
+        #region Constructor(s)
+
+        #region JSONWrapper()
+
+        /// <summary>
+        /// Create an empty JSON object.
+        /// </summary>
         public JSONWrapper()
         {

@@ -46,6 +79,14 @@

         }

+        #endregion
+
+        #region JSONWrapper(Text)
+
+        /// <summary>
+        /// Parse the given text as JSON object.
+        /// </summary>
+        /// <param name="Text">A text.</param>
         public JSONWrapper(String Text)
         {

@@ -55,6 +96,14 @@

         }

+        #endregion
+
+        #region JSONWrapper(JSON)
+
+        /// <summary>
+        /// Create the JSON based on the given JObject.
+        /// </summary>
+        /// <param name="JSON">A JSON object.</param>
         public JSONWrapper(JObject JSON)
         {

@@ -64,6 +113,10 @@

         }

+        #endregion
+
+        #endregion
+

         public Object this[String Key]
         {
@@ -77,6 +130,48 @@
         {

             return Internal.TryGetValue(Key, out Object);
+
+        }
+
+        public Boolean ContainsKey(String Key)
+        {
+
+            return Internal.ContainsKey(Key);
+
+        }
+
+        public String GetString(String Key)
+        {
+
+            Object Value = null;
+
+            if (TryGetValue(Key, out Value))
+            {
+
+                var ReturnValue = Value as String;
+
+                if (ReturnValue != null)
+                    return ReturnValue;
+
+                return Value.ToString();
+
+            }
+
+            return String.Empty;
+
+        }
+
+
+        public JSONWrapper SetProperty(String Key, Object Value)
+        {
+
+            if (!Internal.ContainsKey(Key))
+                Internal.Add(Key, Value);
+
+            else
+                Internal[Key] = Value;
+
+            return this;

         }


AssemblyInfo.cs updated

AssemblyInfo.cs updated

--- Hermod/Properties/AssemblyInfo.cs
+++ Hermod/Properties/AssemblyInfo.cs
@@ -6,11 +6,11 @@
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 [assembly: AssemblyTitle("Hermod")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("A .NET HTTP library for REST and hypermedia transfer")]
 [assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("ahzf.de")]
 [assembly: AssemblyProduct("Hermod")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyCopyright("Copyright © Achim Friedland 2010")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.1.0.0")]
+[assembly: AssemblyFileVersion("0.1.0.0")]


SafeConsole.SetConsoleCtrlHandler

SafeConsole.SetConsoleCtrlHandler

--- Signum.Utilities/SafeConsole.cs
+++ Signum.Utilities/SafeConsole.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;

 namespace Signum.Utilities
@@ -118,5 +119,19 @@
                 } while (true);
             }
         }
+
+        [DllImport("Kernel32")]
+        public static extern bool SetConsoleCtrlHandler(ConsoleCtrlHandler handler, bool add);
+
+        public delegate bool ConsoleCtrlHandler(CtrlType sig);
+
+        public enum CtrlType
+        {
+            CTRL_C_EVENT = 0,
+            CTRL_BREAK_EVENT = 1,
+            CTRL_CLOSE_EVENT = 2,
+            CTRL_LOGOFF_EVENT = 5,
+            CTRL_SHUTDOWN_EVENT = 6
+        }
     }
 }


поправил код, убрал двойной цикл

поправил код, убрал двойной цикл

--- Site/Modules/EIR/Search.aspx.cs
+++ Site/Modules/EIR/Search.aspx.cs
@@ -53,7 +53,10 @@
         private void ShowData(ArrayList data)
         {

-            for (int i = 0; i < data.Count; i++)
+
+
+
+            foreach (Dictionary<string, object> item in data)
             {
                 var irLink = new LinkButton();
                 var mainDiv = new HtmlGenericControl("div");
@@ -65,44 +68,18 @@
                 var AcademicDegree = new HtmlGenericControl("h5");
                 var AcademicStatus = new HtmlGenericControl("p");
                 mainDiv.Attributes.Add("id", "employee");
-                foreach (var e in (Dictionary<string, object>)data[i])
-                {

-                    if (e.Key.ToString() == "eEmployees1Id")
-                    {
-                        irLink.PostBackUrl = Request.Url.AbsolutePath;
-                        irLink.Attributes.Add("class", "irLink list-item list-item-info");
-                        irLink.Attributes.Add("Id", e.Value.ToString());
-                    }
-                    else if (e.Key.ToString() == "Surname")
-                    {
-                        surname.InnerText = e.Value.ToString();
-                    }
-                    else if (e.Key.ToString() == "Name")
-                    {
-                        name.InnerText = e.Value.ToString();
-                    }
-                    else if (e.Key.ToString() == "Patronymic")
-                    {
-                        patronymic.InnerText = e.Value.ToString();
-                    }
-                    else if (e.Key.ToString() == "DutieName")
-                    {
-                        Dutie.InnerText = e.Value.ToString();
-                    }
-                    else if (e.Key.ToString() == "SubdivisionName")
-                    {
-                        Subdiv.InnerText = e.Value.ToString();
-                    }
-                    else if (e.Key.ToString() == "AcademicDegreeName")
-                    {
-                        AcademicDegree.InnerText = e.Value.ToString();
-                    }
-                    else if (e.Key.ToString() == "AcademicStatusName")
-                    {
-                        AcademicStatus.InnerText = e.Value.ToString();
-                    }
-                }
+                irLink.PostBackUrl = Request.Url.AbsolutePath;
+                irLink.Attributes.Add("class", "irLink list-item list-item-info");
+                irLink.Attributes.Add("Id", item["eEmployees1Id"].ToString());
+                surname.InnerText = item["Surname"].ToString();
+                name.InnerText = item["Name"].ToString();
+                patronymic.InnerText = item["Patronymic"].ToString();
+                Dutie.InnerText = item["DutieName"].ToString();
+                Subdiv.InnerText = item["SubdivisionName"].ToString();
+                AcademicDegree.InnerText = item["AcademicDegreeName"].ToString();
+                AcademicStatus.InnerText = item["AcademicStatusName"].ToString();
+
                 mainDiv.Controls.Add(surname);
                 mainDiv.Controls.Add(name);
                 mainDiv.Controls.Add(patronymic);


Use the htdocs_location variable instead of the hardcoded /trac_common/ path.

git-svn-id: f68c6b3b1dcd5d00a2560c384475aaef3bc99487@83 af82e41b-90c4-0310-8c96-b1721e28e2e2

--- templates/header.cs
+++ templates/header.cs
@@ -12,7 +12,7 @@

     <title>Edgewall Trac | <?cs var:title ?></title>
-    <link rel="stylesheet" type="text/css" href="/trac_common/trac.css" />
+    <link rel="stylesheet" type="text/css" href="<?cs var:htdocs_location?>trac.css" />

@@ -30,7 +30,7 @@
 	 <a href="<?cs var:trac.href.logout ?>"
             class="navbar-link-right"> logout
       <?cs /if ?>
-      <a href="<?cs var:trac.href.wiki ?>/TracGuide"
+      <a href="<?cs var:trac.href.wiki ?>TracGuide"
 	 class="navbar-link-right"> Help/Guide  |
       <a href="<?cs var:trac.href.about ?>"
 	 class="navbar-link-right"> About Trac


Fix for [[html(¶)]] appearing at the start of comment headings.

git-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@3374 af82e41b-90c4-0310-8c96-b1721e28e2e2

--- templates/ticket.cs
+++ templates/ticket.cs
@@ -101,11 +101,12 @@
        call:commentref('↓', reply) ?><?cs
       /each ?><?cs
      /if ?>)<?cs
-    /if ?>
-     <a href="#comment:<?cs var:change.cnum ?>" class="anchor"
-        title="Permalink to comment:<?cs var:change.cnum ?>">¶<?cs
-   /if ?><?cs
-   var:change.date ?> changed by <?cs var:change.author ?>
+    /if ?><?cs
+   /if ?><?cs
+   var:change.date ?> changed by <?cs var:change.author ?><?cs
+   if:change.cnum ?> <a href="#comment:<?cs var:change.cnum ?>" class="anchor"
+      title="Permalink to comment:<?cs var:change.cnum ?>">¶<?cs
+   /if ?>

<?cs
   if:change.cnum ?>
    <form method="get" action="<?cs var:ticket.href ?>#comment">


Added two more tests to the parser unit tests, which check whether the parser handles allowed name collisions correctly.

--- test/ParserTests.cs
+++ test/ParserTests.cs
@@ -461,7 +461,11 @@
         public void TestNestedCommands()
         {
             // Sets up the parser
-            Parser parser = new Parser();
+            Parser parser = new Parser(new ParserOptions
+            {
+                ArgumentPrefix = "--",
+                ArgumentAliasPrefix = "-"
+            });
             Parser subParser = parser.AddCommand("add");
             subParser.AddCommand("package");

@@ -479,6 +483,57 @@
             Assert.False(thirdParsingResults.SubResults.SubResults.HasSubResults);
         }

+        /// <summary>
+        /// Tests how the parser handles situations where arguments have the same names or aliases as commands.
+        /// </summary>
+        [Fact]
+        public void TestArgumentCommandNameCollision()
+        {
+            // Sets up the parser
+            Parser parser = new Parser();
+            parser.AddNamedArgument<string>("test", "t");
+            parser.AddCommand("test", "t", string.Empty);
+
+            // Parses the command line arguments
+            ParsingResults firstParsingResults = parser.Parse(new string[] { "test.exe", "--test", "test", "test" });
+            ParsingResults secondParsingResults = parser.Parse(new string[] { "test.exe", "-t", "t", "t" });
+
+            // Validates that the parsed values are correct
+            Assert.Equal("test", firstParsingResults.GetParsedValue<string>("Test"));
+            Assert.True(firstParsingResults.HasSubResults);
+            Assert.Equal("test", firstParsingResults.SubResults.Command);
+            Assert.Equal("t", secondParsingResults.GetParsedValue<string>("Test"));
+            Assert.True(secondParsingResults.HasSubResults);
+            Assert.Equal("test", secondParsingResults.SubResults.Command);
+        }
+
+        /// <summary>
+        /// Tests how the parser handles name collisions in a parser and a sub parser.
+        /// </summary>
+        [Fact]
+        public void TestArgumentNameCollisionInCommands()
+        {
+            // Sets up the parser
+            Parser parser = new Parser();
+            parser.AddNamedArgument<DayOfWeek>("day-of-week", "d");
+            Parser subParser = parser.AddCommand("test", "t", string.Empty);
+            subParser.AddNamedArgument<DayOfWeek>("day-of-week", "d");
+
+            // Parses the command line arguments
+            ParsingResults firstParsingResults = parser.Parse(new string[] { "test.exe", "--day-of-week", "thursday", "test", "--day-of-week", "wednesday" });
+            ParsingResults secondParsingResults = parser.Parse(new string[] { "test.exe", "-d", "Tuesday", "t", "-d", "Saturday" });
+
+            // Validates that the parsed values are correct
+            Assert.Equal(DayOfWeek.Thursday, firstParsingResults.GetParsedValue<DayOfWeek>("DayOfWeek"));
+            Assert.True(firstParsingResults.HasSubResults);
+            Assert.Equal("test", firstParsingResults.SubResults.Command);
+            Assert.Equal(DayOfWeek.Wednesday, firstParsingResults.SubResults.GetParsedValue<DayOfWeek>("DayOfWeek"));
+            Assert.Equal(DayOfWeek.Tuesday, secondParsingResults.GetParsedValue<DayOfWeek>("DayOfWeek"));
+            Assert.True(secondParsingResults.HasSubResults);
+            Assert.Equal("test", secondParsingResults.SubResults.Command);
+            Assert.Equal(DayOfWeek.Saturday, secondParsingResults.SubResults.GetParsedValue<DayOfWeek>("DayOfWeek"));
+        }
+
         #endregion
     }
 }


git-svn-id: https://jumony.svn.codeplex.com/svn/trunk@68783 2327b42d-5241-43d6-9e2a-de5ac946f064

--- Ivony.Html.Parser/JumonyReader.cs
+++ Ivony.Html.Parser/JumonyReader.cs
@@ -7,15 +7,26 @@

 namespace Ivony.Html.Parser
 {
+
+  /// <summary>
+  /// Jumony 提供的HTML文档读取器的一个实现
+  /// </summary>
   public class JumonyReader : IHtmlReader
   {

     private static readonly string tagPattern = string.Format( @"(?<beginTag>{0})|(?<endTag>{1})|(?<comment>{2})|(?<special>{3})", Regulars.beginTagPattern, Regulars.endTagPattern, Regulars.commentPattern, Regulars.specialTagPattern );

+    /// <summary>
+    /// 用于匹配 HTML 标签的正则表达式对象
+    /// </summary>
     protected static readonly Regex tagRegex = new Regex( tagPattern, RegexOptions.Compiled | RegexOptions.CultureInvariant );

+    /// <summary>
+    /// 创建一个 JumonyReader对象
+    /// </summary>
+    /// <param name="htmlText"></param>
     public JumonyReader( string htmlText )
     {
       if ( htmlText == null )
@@ -27,6 +38,9 @@

     }

+    /// <summary>
+    /// 要分析的 HTML 文本
+    /// </summary>
     public string HtmlText
     {
       get;
@@ -34,6 +48,9 @@
     }

+    /// <summary>
+    /// 若当前处于 CData 元素内部，此属性指示元素名
+    /// </summary>
     protected string CDataElement
     {
       get;
@@ -48,6 +65,9 @@

+    /// <summary>
+    /// 当前所读取的位置
+    /// </summary>
     protected int Index
     {
       get;
@@ -60,6 +80,11 @@
     private object _sync = new object();

+    /// <summary>
+    /// 获取匹配指定结束标签的正则表达式对象
+    /// </summary>
+    /// <param name="tagName">标签名</param>
+    /// <returns>匹配指定结束标签的正则表达式对象</returns>
     protected Regex GetEndTagRegex( string tagName )
     {
       tagName = tagName.ToLowerInvariant();
@@ -76,6 +101,11 @@
     }

+
+    /// <summary>
+    /// 枚举读取到的每一个内容元素
+    /// </summary>
+    /// <returns>枚举结果</returns>
     public IEnumerable<HtmlContentFragment> EnumerateContent()
     {

@@ -148,6 +178,12 @@
       }
     }

+
+    /// <summary>
+    /// 创建开始标签内容对象
+    /// </summary>
+    /// <param name="match">开始标签的匹配</param>
+    /// <returns>开始标签内容对象</returns>
     protected virtual HtmlBeginTag CreateBeginTag( Match match )
     {
       string tagName = match.Groups["tagName"].Value;


Add non-functional UI for saving size/selection

Signed-off-by: Aaron Borden <577a4f5aa5af1fcc9f4ea53b0eef51ec378436bd@live.com>

--- Tomboy/NoteWindow.cs
+++ Tomboy/NoteWindow.cs
@@ -554,19 +554,47 @@

 		private Gtk.Box MakeTemplateBar ()
 		{
+			// TODO: Move these to static area
+			Tag template_tag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag);
+			Tag template_save_size_tag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag + ":save-size");
+			Tag template_save_selection_tag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag + ":save-selection");
+
 			var bar = new Gtk.VBox ();
-			Tag template_tag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag);
+
 			var infoLabel  = new Gtk.Label (Catalog.GetString ("This note is a template note. It determines " +
 			                                                   "the default content of regular notes, and will " +
 			                                                   "not show up in the note menu or search window."));
 			infoLabel.Wrap = true;
+
 			var untemplateButton = new Gtk.Button ();
 			untemplateButton.Label = Catalog.GetString ("Convert to regular note");
 			untemplateButton.Clicked += (o, e) => {
 				note.RemoveTag (template_tag);
 			};
+
+			var saveSizeCheckbutton = new Gtk.CheckButton (Catalog.GetString ("Save Si_ze"));
+			saveSizeCheckbutton.Active = note.ContainsTag (template_save_size_tag);
+			saveSizeCheckbutton.Toggled += (o, e) => {
+				if (saveSizeCheckbutton.Active)
+					note.AddTag (template_save_size_tag);
+				else
+					note.RemoveTag (template_save_size_tag);
+			};
+
+			var saveSelectionCheckbutton = new Gtk.CheckButton (Catalog.GetString ("Save Se_lection"));
+			saveSelectionCheckbutton.Active = note.ContainsTag (template_save_selection_tag);
+			saveSizeCheckbutton.Toggled += (o, e) => {
+				if (saveSelectionCheckbutton.Active)
+					note.AddTag (template_save_selection_tag);
+				else
+					note.RemoveTag (template_save_selection_tag);
+			};
+
 			bar.PackStart (infoLabel);
 			bar.PackStart (untemplateButton);
+			bar.PackStart (saveSizeCheckbutton);
+			bar.PackStart (saveSelectionCheckbutton);
+
 			if (note.ContainsTag (template_tag))
 				bar.ShowAll ();


This isn't supposed to be overridden!

This isn't supposed to be overridden!

--- UltraBot/BotState.cs
+++ UltraBot/BotState.cs
@@ -12,7 +12,7 @@
         private IEnumerator<string> _iterator = null;
         private bool _finished = false;
         protected string _reason = "";
-        public virtual string Process(Bot bot)
+        public string Process(Bot bot)
         {
             if(_iterator == null)
                 _iterator = Run(bot);


Purge supports copied files now

Purge supports copied files now

--- VersionrCore/Area.cs
+++ VersionrCore/Area.cs
@@ -1939,8 +1939,13 @@
 				{
 					System.IO.File.Delete(System.IO.Path.Combine(Root.FullName, x.CanonicalName));
 					Printer.PrintMessage("Purging unversioned file {0}", x.CanonicalName);
-				}
-			}
+                }
+                else if (x.Code == StatusCode.Copied)
+                {
+                    System.IO.File.Delete(System.IO.Path.Combine(Root.FullName, x.CanonicalName));
+                    Printer.PrintMessage("Purging copied file {0}", x.CanonicalName);
+                }
+            }
 		}

 		public bool ExportRecord(string cannonicalPath, Guid? versionId, string outputPath)


[mscorlib] Mono friendly Binder

[mscorlib] Mono friendly Binder

--- mscorlib/system/defaultbinder.cs
+++ mscorlib/system/defaultbinder.cs
@@ -19,7 +19,7 @@
     using CultureInfo = System.Globalization.CultureInfo;
     //Marked serializable even though it has no state.
     [Serializable]
-    internal class DefaultBinder : Binder
+    internal partial class DefaultBinder : Binder
     {
         // This method is passed a set of methods and must choose the best
         // fit.  The methods all have the same number of arguments and the object
@@ -1097,7 +1097,7 @@

             return methWithDeepestHierarchy;
         }
-
+#if !MONO
         // CanConvertPrimitive
         // This will determine if the source can be converted to the target type
         [System.Security.SecurityCritical]  // auto-generated
@@ -1112,7 +1112,7 @@
         [ResourceExposure(ResourceScope.None)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         static internal extern bool CanConvertPrimitiveObjectToType(Object source,RuntimeType type);
-
+#endif
         // This method will sort the vars array into the mapping order stored
         //  in the paramOrder array.
         private static void ReorderParams(int[] paramOrder,Object[] vars)


changed HOCT EEPROM format to what it was previously

--- WasatchNET/EEPROM.cs
+++ WasatchNET/EEPROM.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Runtime.InteropServices;
 using System.Collections.Generic;
+using System.Text;

 namespace WasatchNET
 {
@@ -979,10 +980,12 @@
             else if (spectrometer is HOCTSpectrometer)
             {
                 byte[] buffer = new byte[32];
-                if (!ParseData.writeFloat(wavecalCoeffs[0], buffer, 0)) return false;
-                if (!ParseData.writeFloat(wavecalCoeffs[1], buffer, 4)) return false;
-                if (!ParseData.writeFloat(wavecalCoeffs[2], buffer, 8)) return false;
-                if (!ParseData.writeFloat(wavecalCoeffs[3], buffer, 12)) return false;
+
+                if (!ParseData.writeString(serialNumber, buffer, 0, 16)) return false;
+                if (!ParseData.writeFloat(wavecalCoeffs[0], buffer, 16)) return false;
+                if (!ParseData.writeFloat(wavecalCoeffs[1], buffer, 20)) return false;
+                if (!ParseData.writeFloat(wavecalCoeffs[2], buffer, 24)) return false;
+                if (!ParseData.writeFloat(wavecalCoeffs[3], buffer, 28)) return false;

                 bool writeOK = HOCTSpectrometer.OctUsb.WriteCalibration(0, buffer);
                 return writeOK;
@@ -1568,10 +1571,12 @@

                 if (!readOk)
                 {
-                    wavecalCoeffs[0] = ParseData.toFloat(buffer, 0);
-                    wavecalCoeffs[1] = ParseData.toFloat(buffer, 4);
-                    wavecalCoeffs[2] = ParseData.toFloat(buffer, 8);
-                    wavecalCoeffs[3] = ParseData.toFloat(buffer, 12);
+                    serialNumber = Encoding.UTF8.GetString(buffer, 0, 16);
+
+                    wavecalCoeffs[0] = ParseData.toFloat(buffer, 16);
+                    wavecalCoeffs[1] = ParseData.toFloat(buffer, 20);
+                    wavecalCoeffs[2] = ParseData.toFloat(buffer, 24);
+                    wavecalCoeffs[3] = ParseData.toFloat(buffer, 28);
                 }

                 int errorReader = 0;


Set textbox padding on form load, not in constructor

It was being overriden by something, somewhere. This is better.
Also reduced the left padding from 14px - which felt a little
unnatural - to 10px.

--- betterpad/Form1.cs
+++ betterpad/Form1.cs
@@ -73,6 +73,9 @@

         private void InitializeHandlers()
         {
+            Load += (s, e) => {
+                text.Padding = new Padding(10, 10, 12, 10);
+            };
         }

         private void SelectionChangedFindHandler(object sender, EventArgs e)
@@ -187,7 +190,6 @@
                 _processPath = process.MainModule.FileName;
             }
             Icon = Icon.ExtractAssociatedIcon(_processPath);
-            text.Padding = new Padding(14, 10, 12, 10);
             text_SelectionChanged(null, null);
             text_TextChanged(null, null);
             statusBarToolStripMenuItem.PerformClick();


work in progress

work in progress

--- XibParser/NSColor.cs
+++ XibParser/NSColor.cs
@@ -364,7 +364,680 @@
             return (NSColor)color;
         }

+        public static NSColor BlackColor
+        {
+            get { return ColorWithCalibratedWhite(NSBlack, 1.0f); }
+        }
+
+        public static NSColor BlueColor
+        {
+            get { return ColorWithCalibratedRed(0.0f, 0.0f, 1.0f, 1.0f); }
+        }
+
+        public static NSColor BrownColor
+        {
+            get { return ColorWithCalibratedRed(0.6f, 0.4f, 0.2f, 1.0f); }
+        }
+
+        /**
Returns a NSColor in a NSCalibratedWhiteColorSpace space name.
+        with white and alpha values set as 0.0 and 1.0 respectively.

+
See Also : +colorWithCalibratedWhite:alpha:

+        */
+        public static NSColor ClearColor
+        {
+            get { return ColorWithCalibratedWhite(0.0f, 0.0f); }
+        }
+#if TEMP2
+
+/**
Returns a NSColor in a NSCalibratedRGBColorSpace space name.
+  with red, green, blue and alpha values set as 0.0, 1.0, 1.0 and 1.0
+  respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) cyanColor
+{
+  return [self colorWithCalibratedRed: 0.0
+			        green: 1.0
+				 blue: 1.0
+			        alpha: 1.0];
+}
+
+/**
Returns a NSColor in a NSCalibratedWhiteColorSpace space name.
+  with white and alpha values set as NSDarkGray and 1.0 respectively.

+
See Also : +colorWithCalibratedWhite:alpha:

+*/
++ (NSColor*) darkGrayColor
+{
+  return [self colorWithCalibratedWhite: NSDarkGray alpha: 1.0];
+}
+
+/**
Returns a NSColor in a NSCalibratedWhiteColorSpace space name.
+  with white and alpha values set as NSGray and 1.0 respectively.

+
See Also: +colorWithCalibratedWhite:alpha:

+*/
++ (NSColor*) grayColor
+{
+  return [self colorWithCalibratedWhite: NSGray alpha: 1.0];
+}
+
+/**
Returns a NSColor in a  NSCalibratedRGBColorSpace space name.
+  with red, green, blue and alpha values set as 0.0, 1.0, 0.0 and 1.0
+  respectively

See Also: +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) greenColor
+{
+  return [self colorWithCalibratedRed: 0.0
+			        green: 1.0
+				 blue: 0.0
+			        alpha: 1.0];
+}
+
+/**
Returns a NSColor in a NSCalibratedWhiteColorSpace space name.
+  with white and alpha values set as NSLightGray and 1.0 respectively

+
See Also : +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) lightGrayColor
+{
+  return [self colorWithCalibratedWhite: NSLightGray alpha: 1];
+}
+
+/**
Returns a NSColor in a NSCalibratedRGBColorSpace space name.
+  with red, green, blue and alpha values set as 1.0, 0.0, 1.0 and 1.0
+  respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) magentaColor
+{
+  return [self colorWithCalibratedRed: 1.0
+			        green: 0.0
+				 blue: 1.0
+			        alpha: 1.0];
+}
+
+
+/**
Returns a NSColor in a NSCalibratedRGBColorSpace space name.
+  with red, green, blue and alpha values set as 1.0, 0.5, 0.0 and 1.0
+  respectively.

See Also: +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) orangeColor
+{
+  return [self colorWithCalibratedRed: 1.0
+			        green: 0.5
+				 blue: 0.0
+			        alpha: 1.0];
+}
+
+
+/**
Returns a NSColor in a NSCalibratedRGBColorSpace space name.
+  with red, green, blue and alpha values set as 0.5, 0.0, 0.5 and 1.0
+  respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) purpleColor
+{
+  return [self colorWithCalibratedRed: 0.5
+			        green: 0.0
+				 blue: 0.5
+			        alpha: 1.0];
+}
+
+
+/**
Returns a NSColor in a NSCalibratedRGBColorSpace space name.
+  with red, green, blue and alpha values set as 1.0, 0.0, 0.0 and 1.0
+  respectively

See Also: +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) redColor
+{
+  return [self colorWithCalibratedRed: 1.0
+			        green: 0.0
+				 blue: 0.0
+			        alpha: 1.0];
+}
+
+/**
Returns a NSColor in a NSCalibratedWhiteColorSpace space name.
+  with white and alpha values set as NSWhite and 1.0 respectively.

+
See Also : +colorWithCalibratedWhite:alpha:

+*/
++ (NSColor*) whiteColor
+{
+  return [self colorWithCalibratedWhite: NSWhite alpha: 1.0];
+}
+
+
+/**
Returns a NSColor in a NSCalibratedRGBColorSpace space name.
+  with red, green, blue and alpha values set as 1.0, 0.0, 0.0 and 1.0
+  respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

+*/
++ (NSColor*) yellowColor
+{
+  return [self colorWithCalibratedRed: 1.0
+			        green: 1.0
+				 blue: 0.0
+			        alpha: 1.0];
+}
+
+
+/** Returns whether TODO
+ *
See Also: +setIgnoresAlpha:

+ */
++ (BOOL) ignoresAlpha
+{
+  return gnustep_gui_ignores_alpha;
+}
+
+/** TODO
+ *
See Also: +ignoresAlpha

+ */
++ (void) setIgnoresAlpha: (BOOL)flag
+{
+  gnustep_gui_ignores_alpha = flag;
+}
+
+/**
Returns the NSColor on the NSPasteboard pasteBoard
+   or nil if it does not exists.

See Also: -writeToPasteboard:

+ */
++ (NSColor*) colorFromPasteboard: (NSPasteboard *)pasteBoard
+{
+  NSData *colorData = [pasteBoard dataForType: NSColorPboardType];
+
+  // FIXME: This should better use the description format
+  if (colorData != nil)
+    return [NSUnarchiver unarchiveObjectWithData: colorData];
+
+  return nil;
+}
+
+//
+// System colors stuff.
+//
++ (NSColor*) alternateSelectedControlColor
+{
+  return systemColorWithName(@"alternateSelectedControlColor");
+}
+
++ (NSColor*) alternateSelectedControlTextColor
+{
+  return systemColorWithName(@"alternateSelectedControlTextColor");
+}
+
++ (NSColor*) controlBackgroundColor
+{
+  return systemColorWithName(@"controlBackgroundColor");
+}
+
++ (NSColor*) controlColor
+{
+  return systemColorWithName(@"controlColor");
+}
+
++ (NSColor*) controlHighlightColor
+{
+  return systemColorWithName(@"controlHighlightColor");
+}
+
++ (NSColor*) controlLightHighlightColor
+{
+  return systemColorWithName(@"controlLightHighlightColor");
+}
+
++ (NSColor*) controlShadowColor
+{
+  return systemColorWithName(@"controlShadowColor");
+}
+
++ (NSColor*) controlDarkShadowColor
+{
+  return systemColorWithName(@"controlDarkShadowColor");
+}
+
++ (NSColor*) controlTextColor
+{
+  return systemColorWithName(@"controlTextColor");
+}
+
++ (NSColor*) disabledControlTextColor
+{
+  return systemColorWithName(@"disabledControlTextColor");
+}
+
++ (NSColor*) gridColor
+{
+  return systemColorWithName(@"gridColor");
+}
+
++ (NSColor*) headerColor
+{
+  return systemColorWithName(@"headerColor");
+}
+
++ (NSColor*) headerTextColor
+{
+  return systemColorWithName(@"headerTextColor");
+}
+
++ (NSColor*) highlightColor
+{
+  return systemColorWithName(@"highlightColor");
+}
+
++ (NSColor*) keyboardFocusIndicatorColor
+{
+  return systemColorWithName(@"keyboardFocusIndicatorColor");
+}
+
++ (NSColor*) knobColor
+{
+  return systemColorWithName(@"knobColor");
+}
+
++ (NSColor*) scrollBarColor
+{
+  return systemColorWithName(@"scrollBarColor");
+}
+
++ (NSColor*) secondarySelectedControlColor
+{
+  return systemColorWithName(@"secondarySelectedControlColor");
+}
+
++ (NSColor*) selectedControlColor
+{
+  return systemColorWithName(@"selectedControlColor");
+}
+
++ (NSColor*) selectedControlTextColor
+{
+  return systemColorWithName(@"selectedControlTextColor");
+}
+
++ (NSColor*) selectedKnobColor
+{
+  return systemColorWithName(@"selectedKnobColor");
+}
+
++ (NSColor*) selectedMenuItemColor
+{
+  return systemColorWithName(@"selectedMenuItemColor");
+}
+
++ (NSColor*) selectedMenuItemTextColor
+{
+  return systemColorWithName(@"selectedMenuItemTextColor");
+}
+
++ (NSColor*) selectedTextBackgroundColor
+{
+  return systemColorWithName(@"selectedTextBackgroundColor");
+}
+
++ (NSColor*) selectedTextColor
+{
+  return systemColorWithName(@"selectedTextColor");
+}
+
++ (NSColor*) shadowColor
+{
+  return systemColorWithName(@"shadowColor");
+}
+
++ (NSColor*) textBackgroundColor
+{
+  return systemColorWithName(@"textBackgroundColor");
+}
+
++ (NSColor*) textColor
+{
+  return systemColorWithName(@"textColor");
+}
+
++ (NSColor *)windowBackgroundColor
+{
+  return systemColorWithName(@"windowBackgroundColor");
+}
+
++ (NSColor*) windowFrameColor
+{
+  return systemColorWithName(@"windowFrameColor");
+}
+
++ (NSColor*) windowFrameTextColor
+{
+  return systemColorWithName(@"windowFrameTextColor");
+}
+
++ (NSArray*) controlAlternatingRowBackgroundColors
+{
+  return [NSArray arrayWithObjects: systemColorWithName(@"rowBackgroundColor"),
+		  systemColorWithName(@"alternateRowBackgroundColor"), nil];
+}
+
+////////////////////////////////////////////////////////////
+//
+// Instance methods
+//
+
+- (id) copyWithZone: (NSZone*)aZone
+{
+  if (NSShouldRetainWithZone(self, aZone))
+    {
+      return RETAIN(self);
+    }
+  else
+    {
+      return NSCopyObject(self, 0, aZone);
+    }
+}
+
+- (NSString*) description
+{
+  [self subclassResponsibility: _cmd];
+  return nil;
+}
+
+/**
Gets the cyan, magenta, yellow,black and alpha values from the NSColor.
+ Raises a NSInternalInconsistencyException if the NSColor is not a CYMK color
+

+ */
+- (void) getCyan: (CGFloat*)cyan
+	 magenta: (CGFloat*)magenta
+	  yellow: (CGFloat*)yellow
+	   black: (CGFloat*)black
+	   alpha: (CGFloat*)alpha
+{
+  [NSException raise: NSInternalInconsistencyException
+    format: @"Called getCyan:magenta:yellow:black:alpha: on non-CMYK colour"];
+}
+
+/**
Gets the hue, saturation, brightness and alpha values from the NSColor.
+ Raises a NSInternalInconsistencyException if the NSColor is not a RGB color
+

+ */
+- (void) getHue: (CGFloat*)hue
+     saturation: (CGFloat*)saturation
+     brightness: (CGFloat*)brightness
+	  alpha: (CGFloat*)alpha
+{
+  [NSException raise: NSInternalInconsistencyException
+    format: @"Called getHue:saturation:brightness:alpha: on non-RGB colour"];
+}
+
+/**
Gets the red, green, blue and alpha values from the NSColor.
+ Raises a NSInternalInconsistencyException if the NSColor is not a RGB color
+

+ */
+-(void) getRed: (CGFloat*)red
+	  green: (CGFloat*)green
+	   blue: (CGFloat*)blue
+	  alpha: (CGFloat*)alpha
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called getRed:green:blue:alpha: on non-RGB colour"];
+}
+
+/**
Gets the white alpha values from the NSColor.
+ Raises a NSInternalInconsistencyException if the NSColor is not a
+ greyscale color

+ */
+- (void) getWhite: (CGFloat*)white
+	    alpha: (CGFloat*)alpha
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called getWhite:alpha: on non-grayscale colour"];
+}
+
+- (BOOL) isEqual: (id)other
+{
+  if (other == self)
+    return YES;
+  if ([other isKindOfClass: NSColorClass] == NO)
+    return NO;
+  else
+    {
+      [self subclassResponsibility: _cmd];
+      return NO;
+    }
+}
+
+/**
Returns the alpha component.

+ */
+- (CGFloat) alphaComponent
+{
+  return 1.0;
+}
+
+/**
Returns the black component. Raises a NSInternalInconsistencyException
+    if NSColor is not a CMYK color.

+ */
+- (CGFloat) blackComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called blackComponent on non-CMYK colour"];
+  return 0.0;
+}
+
+/**
Returns the blue component. Raises a NSInternalInconsistencyException
+    if NSColor is not a RGB color.

+ */
+- (CGFloat) blueComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called blueComponent on non-RGB colour"];
+  return 0.0;
+}
+
+/**
Returns the brightness component. Raises a
+    NSInternalInconsistencyException if NSColor space is not a RGB color

+*/
+- (CGFloat) brightnessComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called brightnessComponent on non-RGB colour"];
+  return 0.0;
+}
+
+- (NSString *) catalogNameComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called catalogNameComponent on colour with name"];
+  return nil;
+}
+
+- (NSString *) colorNameComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called colorNameComponent on colour with name"];
+  return nil;
+}
+
+/**
Returns the cyan component. Raises a  NSInternalInconsistencyException
+    if NSColor is not a CYMK color

+*/
+- (CGFloat) cyanComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called cyanComponent on non-CMYK colour"];
+  return 0.0;
+}
+
+/**
Returns the green component. Raises a  NSInternalInconsistencyException
+    if NSColor is not a RGB color

+*/
+- (CGFloat) greenComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called greenComponent on non-RGB colour"];
+  return 0.0;
+}
+
+/**
Returns the hue component. Raises a  NSInternalInconsistencyException
+    if NSColor is not a RGB color

+*/
+- (CGFloat) hueComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called hueComponent on non-RGB colour"];
+  return 0.0;
+}
+
+- (NSString *) localizedCatalogNameComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+    format: @"Called localizedCatalogNameComponent on colour with name"];
+  return nil;
+}
+
+- (NSString *) localizedColorNameComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+    format: @"Called localizedColorNameComponent on colour with name"];
+  return nil;
+}
+
+/**
Returns the magenta component. Raises a
+    NSInternalInconsistencyException  if NSColor is not a CMYK color

+*/
+- (CGFloat) magentaComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called magentaComponent on non-CMYK colour"];
+  return 0.0;
+}
+
+/**
Returns the red component. Raises a NSInternalInconsistencyException
+    if NSColor is not a RGB color

+*/
+- (CGFloat) redComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called redComponent on non-RGB colour"];
+  return 0.0;
+}
+
+/**
Returns the saturation component. Raises a
+    NSInternalInconsistencyException if NSColor is not a RGB color

+*/
+- (CGFloat) saturationComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called saturationComponent on non-RGB colour"];
+  return 0.0;
+}
+
+/**
Returns the white component. Raises a NSInternalInconsistencyException
+    if NSColor is not a grayscale color

+*/
+- (CGFloat) whiteComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called whiteComponent on non-grayscale colour"];
+  return 0.0;
+}
+
+- (NSImage*) patternImage
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called patternImage on non-pattern colour"];
+  return nil;
+}
+
+/**
Returns the yellow component. Raises a NSInternalInconsistencyException
+    if NSColor is not a RGB color

+*/
+- (CGFloat) yellowComponent
+{
+  [NSException raise: NSInternalInconsistencyException
+	      format: @"Called yellowComponent on non-CMYK colour"];
+  return 0.0;
+}
+
+//
+// Converting to Another Color Space
+//
+- (NSString *) colorSpaceName
+{
+  [self subclassResponsibility: _cmd];
+  return nil;
+}
+
+- (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace
+{
+  return [self colorUsingColorSpaceName: colorSpace
+				 device: nil];
+}
+
+- (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace
+			       device: (NSDictionary *)deviceDescription
+{
+  if (colorSpace == nil)
+    {
+      if (deviceDescription != nil)
+	colorSpace = [deviceDescription objectForKey: NSDeviceColorSpaceName];
+      if (colorSpace == nil)
+        colorSpace = NSDeviceRGBColorSpace;
+    }
+  if ([colorSpace isEqualToString: [self colorSpaceName]])
+    {
+      return self;
+    }
+
+  if ([colorSpace isEqualToString: NSNamedColorSpace])
+    {
+      // FIXME: We cannot convert to named color space.
+      return nil;
+    }
+
+  [self subclassResponsibility: _cmd];
+
+  return nil;
+}
+
++ (NSColor *) colorWithColorSpace: (NSColorSpace *)space
+                       components: (const CGFloat *)comp
+                            count: (NSInteger)number
+{
+  // FIXME
+  if (space == [NSColorSpace genericRGBColorSpace] && (number == 4))
+    {
+      return [self colorWithCalibratedRed: comp[0]
+                   green: comp[1]
+                   blue: comp[2]
+                   alpha: comp[3]];
+    }
+  if (space == [NSColorSpace deviceRGBColorSpace] && (number == 4))
+    {
+      return [self colorWithDeviceRed: comp[0]
+                   green: comp[1]
+                   blue: comp[2]
+                   alpha: comp[3]];
+    }
+  if (space == [NSColorSpace genericGrayColorSpace] && (number == 2))
+    {
+      return [NSColor colorWithCalibratedWhite: comp[0] alpha: comp[1]];
+    }
+  if (space == [NSColorSpace deviceGrayColorSpace] && (number == 2))
+    {
+      return [NSColor colorWithDeviceWhite: comp[0] alpha: comp[1]];
+    }
+  if (space == [NSColorSpace genericCMYKColorSpace] && (number == 5))
+    {
+      return [NSColor colorWithDeviceCyan: comp[0]
+                      magenta: comp[1]
+                      yellow: comp[2]
+                      black: comp[3]
+                      alpha: comp[4]];
+    }
+  if (space == [NSColorSpace deviceCMYKColorSpace] && (number == 5))
+    {
+      return [NSColor colorWithDeviceCyan: comp[0]
+                      magenta: comp[1]
+                      yellow: comp[2]
+                      black: comp[3]
+                      alpha: comp[4]];
+    }
+
+  return nil;
+}
+#endif //TEMP2
+
 #endif
+
         public static NSColor ColorWithCalibratedRed(float red, float green, float blue, float alpha)
         {
             return null;


SwipeCell: remove abstract OnDelete(), PanLock is not needed.

--- Ross/Views/SwipableTimeEntryTableViewCell.cs
+++ Ross/Views/SwipableTimeEntryTableViewCell.cs
@@ -32,10 +32,7 @@
             continueActionButton.SetTitle ("SwipeTimeEntryContinue".Tr (), UIControlState.Normal);
             deleteActionButton.SetTitle ("SwipeTimeEntryDelete".Tr (), UIControlState.Normal);

-
             BackgroundView = new UIView ();
-
-

             SelectedBackgroundView = new UIView ().Apply (Style.CellSelectedBackground);
             ContentView.AddSubviews (
@@ -50,14 +47,6 @@
         }

         protected abstract void OnContinue ();
-
-        protected abstract void OnDelete ();
-
-        enum PanLock {
-            None,
-            Left,
-            Right
-        }

         private CGPoint panStart;
         private nfloat panDeltaX;


Tweak class visibility

Tweak class visibility

Just in case anyone wants to directly call the handler locators.

--- RouteHandlerHttpModule/FileHandlerLocator.cs
+++ RouteHandlerHttpModule/FileHandlerLocator.cs
@@ -3,7 +3,7 @@

 namespace RouteHandlerHttpModule
 {
-    internal static class FileHandlerLocator
+    public static class FileHandlerLocator
     {
         public static string Locate(HttpContext context)
         {


Uploading of videos working

Uploading of videos working

--- RunApproachStatistics/Modules/VaultModule.cs
+++ RunApproachStatistics/Modules/VaultModule.cs
@@ -335,7 +335,7 @@

                         // Upload the file to the server.
                         WebClient myWebClient = new WebClient();
-                        NetworkCredential myCredentials = new NetworkCredential("", "");
+                        NetworkCredential myCredentials = new NetworkCredential("snijhof", "MKD7529s09");
                         myWebClient.Credentials = myCredentials;
                         byte[] responseArray = myWebClient.UploadFile("ftp://student.aii.avans.nl/GRP/42IN11EWd/Videos/" + fileName, filePath);


added comment in listener for validation

--- unity/unityproject/Assets/appvalidator.cs
+++ unity/unityproject/Assets/appvalidator.cs
@@ -41,6 +41,7 @@
         void validated()
         {
             // WRITE YORU VALIDATED CODE HERE
+	    // REMEMBER IT!

         }
     }


copy a table to eliminate indices

copy a table to eliminate indices

--- primitives.cs
+++ primitives.cs
@@ -1550,6 +1550,28 @@

             }
             return z;
+        }
+
+        public A<JTable> copyTable(A<JTable> y) {
+            var yt = y.First();
+            var zt = new JTable {
+                Columns = yt.Columns.Select(x => x).ToArray(),
+                Rows = new Box[yt.Columns.Length]
+            };
+
+            for (var i = 0; i < zt.Columns.Length; i++) {
+                if (yt.indices != null) {
+                    zt.Rows[i].val = yt.Rows[i].val.FromIndices(yt.indices);
+                }
+                else {
+                    zt.Rows[i].val = yt.Rows[i].val;
+                }
+
+            }
+            return zt.WrapA();
+
+
+
         }
         public AType Call2(AType method, AType x, AType y) {
             var verb = ((A<Verb>)method).Ravel[0];
@@ -1907,8 +1929,14 @@
                     return notequals((A<JString>)x, (A<JString>)y);
                 else return InvokeExpression("notequals", x, y, 2);
             }
-            else if (op == "#") {
-                return InvokeExpression("copy", x.ConvertLong(), y, 1);
+            else if (op == "#") {
+                if (y.GetType() != typeof(A<JTable>)) {
+                    return InvokeExpression("copy", x.ConvertLong(), y, 1);
+                }
+                else {
+                    return copyTable(y as A<JTable>);
+                }
+
             }
             else if (op == "i.") {
                 return InvokeExpression("indexof", x, y, 1);


Fixed TestCaseName.Arguments to be truly read-only.

--- test/TestResultsWiki/TestCaseName.cs
+++ test/TestResultsWiki/TestCaseName.cs
@@ -31,6 +31,7 @@

     using System;
     using System.Collections.Generic;
+    using System.Collections.ObjectModel;
     using System.Linq;

     #endregion
@@ -42,7 +43,7 @@
     [ Serializable ]
     internal sealed class TestCaseName
     {
-        private static readonly string[] zeroArguments = new string[0];
+        private static readonly IList<string> zeroArguments = new string[0];

         /// <param name="name">
         /// String like <c>"Distinct_ComparerArg_NonDistinctValues_ReturnsOnlyDistinctValues"</c>.</param>
@@ -58,10 +59,11 @@

             Arguments = parts.Count < 3
                       ? zeroArguments
-                      : parts.Dequeue()
-                             .Split(new[] {"Arg"}, StringSplitOptions.RemoveEmptyEntries)
-                             .TakeWhile(s => s.Length > 0)
-                             .ToArray();
+                      : new ReadOnlyCollection<string>(
+                            parts.Dequeue()
+                                 .Split(new[] {"Arg"}, StringSplitOptions.RemoveEmptyEntries)
+                                 .TakeWhile(s => s.Length > 0)
+                                 .ToArray());

             StateUnderTest = parts.Count > 1
                            ? CamelCase.FormatSentence(parts.Dequeue())


:art: Delete constructor

:art: Delete constructor

--- Kip/ImmutableElementCollection.cs
+++ Kip/ImmutableElementCollection.cs
@@ -15,14 +15,8 @@
         private readonly ImmutableDictionary<XName, T> _elements;

         internal ImmutableNamedElementCollection(Func<T, XName> nameOf)
-            : this(ImmutableDictionary.Create<XName, T>(), nameOf)
+            : this(nameOf, ImmutableDictionary.Create<XName, T>())
         { }
-
-        private ImmutableNamedElementCollection(IDictionary<XName, T> elements, Func<T, XName> nameOf)
-        {
-            _elements = elements.ToImmutableDictionary();
-            _nameOf = nameOf;
-        }

         private ImmutableNamedElementCollection(Func<T, XName> nameOf, ImmutableDictionary<XName, T> elements)
         {
@@ -48,7 +42,7 @@
             }
             var newElement = _elements.Add(name, element);

-            return new ImmutableNamedElementCollection<T>(newElement, _nameOf);
+            return new ImmutableNamedElementCollection<T>(_nameOf, newElement);
         }

         public IEnumerator<T> GetEnumerator()


ScadaComm: protect InvalidateCurData

ScadaComm: protect InvalidateCurData

--- ScadaComm/ScadaCommCommon/Devices/KPLogic.cs
+++ ScadaComm/ScadaCommCommon/Devices/KPLogic.cs
@@ -938,6 +938,11 @@
         {
             lock (curData)
             {
+                if (tagIndex < 0)
+                    tagIndex = 0;
+                if (tagIndex >= curData.Length - tagCount)
+                    tagCount = curData.Length - tagIndex;
+
                 SrezTableLight.CnlData newData = SrezTableLight.CnlData.Empty;
                 for (int i = 0; i < tagCount; i++)
                 {


FT2-467_When xpm is enabled, load the file if it has been modified since last application start

--- Sdl.Web.Tridion/Statics/BinaryFileManager.cs
+++ Sdl.Web.Tridion/Statics/BinaryFileManager.cs
@@ -102,9 +102,12 @@
                     {
                         if (localization.LastRefresh.CompareTo(lastPublishedDate) < 0)
                         {
-                            //File has been modified since last application start but we don't care
-                            Log.Debug("Binary with URL '{0}' is modified, but only since last application restart, so no action required", urlPath);
-                            return localFilePath;
+                            if (!localization.IsXpmEnabled)
+                            {
+                                //File has been modified since last application start but we don't care
+                                Log.Debug("Binary with URL '{0}' is modified, but only since last application restart, so no action required",urlPath);
+                                return localFilePath;
+                            }
                         }
                         FileInfo fi = new FileInfo(localFilePath);
                         if (fi.Length > 0)


fix SaveProtectedCache

fix SaveProtectedCache

--- Signum.Windows/Operations/OperationClient.cs
+++ Signum.Windows/Operations/OperationClient.cs
@@ -29,9 +29,9 @@
         {
             if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
             {
+                Manager = operationManager;
+
                 Navigator.AddSetting(new EntitySettings<OperationLogDN>(EntityType.System) { View = e => new OperationLog() });
-
-                Manager = operationManager;

                 NormalWindow.GetButtonBarElement += Manager.ButtonBar_GetButtonBarElement;

@@ -300,7 +300,7 @@
         }

-        static HashSet<Type> SaveProtectedCache = new HashSet<Type>();
+        static HashSet<Type> SaveProtectedCache;
         protected internal virtual bool SaveProtected(Type type)
         {
             if (!type.IsIIdentifiable())


disabling window-switching test on Internet Explorer (IE won't open a new window)

--- SizSelCsZzz.Test/Can_switch_to_new_window.cs
+++ SizSelCsZzz.Test/Can_switch_to_new_window.cs
@@ -11,6 +11,8 @@
     {
         public override void SpecifyForBrowser(IWebDriver browser)
         {
+            ignoreIfInternetExplorer("For some reason Internet Explorer won't open a new window from this test.");
+
             given("a webpage that opens another window", delegate()
             {
                 var server = beforeAll(() => new StaticServer()
@@ -29,11 +31,15 @@
                 {
                     arrange(() => browser.FindElement(By.TagName("a")).Click());

-                    then("the new window can be switch to", delegate()
+                    arrange(delegate()
                     {
                         browser.SwitchTo().Window(existingWindows.GetNewWindowName());

                         expect(() => browser.ContainsText("new window here"));
+                    });
+
+                    then("the new window can be switch to", delegate()
+                    {
                     });

                     then("the original window can be switched back to", delegate()


Removed small warning

Removed small warning

--- SoraBot/SoraBot.Bot/Modules/ProfileModule.cs
+++ SoraBot/SoraBot.Bot/Modules/ProfileModule.cs
@@ -174,7 +174,6 @@
             {
                 await ReplyFailureEmbed("Failed to generate image. Something went wrong sorry :/");
                 _log.LogError(e, $"Failed to generate image for {user.Id.ToString()}");
-                return;
             }
             finally
             {


[ci skip] Updating ServerBuildInfo_Dynamic.cs

1.19.3810.20210116213409-master-02914b9

--- Source/ACE.Server/ServerBuildInfo_Dynamic.cs
+++ Source/ACE.Server/ServerBuildInfo_Dynamic.cs
@@ -4,17 +4,17 @@
     public static partial class ServerBuildInfo
     {
         public static string Branch = "master";
-        public static string Commit = "533b0374884f8e1f7077cdbd49eaf1437399a1d5";
+        public static string Commit = "02914b948c441bc19ee832aacfd95da38683109f";

         public static string Version = "1.19";
-        public static string Build   = "3809";
+        public static string Build   = "3810";

         public static int BuildYear   = 2021;
         public static int BuildMonth  = 01;
         public static int BuildDay    = 16;
         public static int BuildHour   = 21;
-        public static int BuildMinute = 24;
-        public static int BuildSecond = 55;
+        public static int BuildMinute = 34;
+        public static int BuildSecond = 09;
     }
 }


Fix handling main menu utility

Fix handling main menu utility

--- Source/BetterManeuvering/ManeuverMainMenu.cs
+++ Source/BetterManeuvering/ManeuverMainMenu.cs
@@ -25,6 +25,7 @@
 */
 #endregion

+using System;
 using System.Collections;
 using UnityEngine;
 using UnityEngine.Events;
@@ -37,7 +38,6 @@
 	public class ManeuverMainMenu : MonoBehaviour
 	{
 		private MainMenu menu;
-		private Callback newGameTap;

 		private void Start()
 		{
@@ -46,15 +46,11 @@
 			if (menu == null)
 				return;

-			newGameTap = menu.newGameBtn.onTap;
-
-			menu.newGameBtn.onTap = new Callback(onTap);
+			menu.newGameBtn.onTap = (Callback)Delegate.Combine(menu.newGameBtn.onTap, new Callback(onTap));
 		}

 		private void onTap()
 		{
-			newGameTap.Invoke();
-
 			StartCoroutine(AddListener());
 		}

@@ -64,20 +60,10 @@

 			var buttons = GameObject.FindObjectsOfType<Button>();

-			for (int i = buttons.Length - 1; i >= 0; i--)
+			if (buttons.Length > 0)
 			{
-				Button button = buttons[i];
+				var button = buttons[buttons.Length - 1];

-				if (button == null)
-					continue;
-
-				TextMeshProUGUI tmp = button.GetComponentInChildren<TextMeshProUGUI>();
-
-				if (tmp == null)
-					continue;
-
-				if (tmp.text != "Start!")
-					continue;

 				button.onClick.AddListener(new UnityAction(onSettingsApply));
 			}


Fix WhenAny result

Fix WhenAny result

--- Source/SpicyPixel.Threading/Fiber.WhenAny.cs
+++ Source/SpicyPixel.Threading/Fiber.WhenAny.cs
@@ -125,7 +125,7 @@
                 if ((millisecondsTimeout != Timeout.Infinite
                     && (DateTime.Now - startWait).TotalMilliseconds >= millisecondsTimeout) ||
                     cancellationToken.IsCancellationRequested) {
-                    yield return new FiberResult(false);
+                    yield return new FiberResult(null);
                 }

                 var fiber = fibers.FirstOrDefault(f => f.IsCompleted);


Add extension methods

Add extension methods

Add TakeLast and SkipLast extension methods for IEnumerable<T>.

--- Linx/Extension/IEnumerableUtil.cs
+++ Linx/Extension/IEnumerableUtil.cs
@@ -157,5 +157,21 @@
                 }
             }
         }
+
+        public static IEnumerable<TSource> TakeLast<TSource>(
+            this IEnumerable<TSource> source,
+            Int32 count
+        )
+        {
+            return source.Skip(source.Count() - count);
+        }
+
+        public static IEnumerable<TSource> SkipLast<TSource>(
+            this IEnumerable<TSource> source,
+            Int32 count
+        )
+        {
+            return source.Take(source.Count() - count);
+        }
     }
 }