bug fixed - process doesn't exit

bug fixed - process doesn't exit

--- AccountChecker.cs
+++ AccountChecker.cs
@@ -45,6 +45,7 @@

         public void Stop()
         {
+            CheckNowEvent.Set();
             _stopEvent.Set();
             _workerThread.Join();
             _workerThread = null;
@@ -107,15 +108,15 @@
                     }
                 }

+                if (_stopEvent.WaitOne(0))
+                {
+                    break;
+                }
+
                 if (CheckNowEvent.WaitOne(TimeSpan.FromMilliseconds(60 * 1000)))
                 {
                     CheckNowEvent.Reset();
                     continue;
-                }
-
-                if (_stopEvent.WaitOne(0))
-                {
-                    break;
                 }
             }


fixing a typo and casing.

fixing a typo and casing.

--- Website/Views/Users/Account.cshtml
+++ Website/Views/Users/Account.cshtml
@@ -37,10 +37,10 @@

API Key

         Your API key provides you with a token that identifies you to the gallery.
-        Keep this a secret. You can always regenerate your key at any time (invaldating
+        Keep this a secret. You can always regenerate your key at any time (invalidating
         previous keys) if your token is accidentally revealed. The
         NuGet command-line utility allows you to
-        submit a nuget package to the gallery, and you would pass you token like this:
+        submit a NuGet package to the gallery, and you would pass you token like this:


Updated GetAuthenticationToken

Updated GetAuthenticationToken

--- src/Api/Authentication/RequestAuthenticator.cs
+++ src/Api/Authentication/RequestAuthenticator.cs
@@ -26,7 +26,7 @@
         {
             var timestamp = (request.Timestamp).ToString(System.Globalization.CultureInfo.InvariantCulture);
             var signature = ComputeSignature(request);
-            return new AuthenticationToken(_apiKey, signature, _passphrase, timestamp);
+            return new AuthenticationToken(_apiKey, _passphrase, signature, timestamp);
         }

         private string ComputeSignature(ApiRequest request)


don't redirect is not authenticated

don't redirect is not authenticated

--- src/Asafaharbor/Renderers/ErrorViewRenderer.cs
+++ src/Asafaharbor/Renderers/ErrorViewRenderer.cs
@@ -38,16 +38,7 @@
                 Page.ImageUrl = user.ImageUrl;
                 Page.FriendlyName = user.FriendlyName;
             }
-            else
-            {
-                Page.Notifications.Add(new NotificationModel
-                    {
-                        Message = "Please log in to access this page.",
-                        Type = NotificationType.Error
-                    });
-                Model.LoginModel = new LoginModel();
-                return RenderView(context, "Account/Login", Model);
-            }
+
             response.StatusCode = statusCode;

             switch (statusCode)


ThrowArgument

ThrowArgument

--- src/AspectCore.Lite/Internal/ProxyActivator.cs
+++ src/AspectCore.Lite/Internal/ProxyActivator.cs
@@ -1,10 +1,10 @@
-using AspectCore.Lite.Abstractions;
-using AspectCore.Lite.Generators;
+using AspectCore.Lite.Generators;
 using System;
 using Microsoft.Extensions.DependencyInjection;
 using AspectCore.Lite.DependencyInjection;
 using AspectCore.Lite.Internal;
 using System.Reflection;
+using AspectCore.Lite.Extensions;

 namespace AspectCore.Lite.Abstractions
 {
@@ -28,6 +28,7 @@
             ExceptionHelper.ThrowArgumentNull(serviceType , nameof(serviceType));
             ExceptionHelper.ThrowArgumentNull(instance , nameof(instance));
             ExceptionHelper.ThrowArgument(() => !serviceType.GetTypeInfo().IsAssignableFrom(instance.GetType()) , $"Can not assign an instance of the {instance.GetType()} to the {serviceType}.");
+            interfaceTypes?.ForEach(interfaceType => ExceptionHelper.ThrowArgument(() => !interfaceType.GetTypeInfo().IsAssignableFrom(instance.GetType()) , $"Can not assign an instance of the {instance.GetType()} to the {interfaceType}."));

             var proxyGenerator = new ClassProxyGenerator(serviceProvider , serviceType , interfaceTypes);
             var proxyType = proxyGenerator.GenerateProxyType();
@@ -39,6 +40,7 @@
             ExceptionHelper.ThrowArgumentNull(serviceType , nameof(serviceType));
             ExceptionHelper.ThrowArgumentNull(instance , nameof(instance));
             ExceptionHelper.ThrowArgument(() => !serviceType.GetTypeInfo().IsAssignableFrom(instance.GetType()) , $"Can not assign an instance of the {instance.GetType()} to the {serviceType}.");
+            interfaceTypes?.ForEach(interfaceType => ExceptionHelper.ThrowArgument(() => !interfaceType.GetTypeInfo().IsAssignableFrom(instance.GetType()) , $"Can not assign an instance of the {instance.GetType()} to the {interfaceType}."));

             var proxyGenerator = new InterfaceProxyGenerator(serviceProvider , serviceType , interfaceTypes);
             var proxyType = proxyGenerator.GenerateProxyType();


Tweak old Copyright and License dialog to be smaller (BL-11207)

--- src/BloomExe/Edit/BloomMetadataEditorDialog.cs
+++ src/BloomExe/Edit/BloomMetadataEditorDialog.cs
@@ -1,4 +1,6 @@
 using System;
+using System.Drawing;
+using System.Linq;
 using System.Windows.Forms;
 using SIL.Windows.Forms.ClearShare;
 using SIL.Windows.Forms.ClearShare.WinFormsUI;
@@ -31,12 +33,86 @@
 				topPanel.Controls.Add(_replaceCopyrightCheckbox);

 				this.Controls.Add(topPanel);
-				this.Size = new System.Drawing.Size(this.Width, this.Height + topPanel.Height);
+				// I don't know why we need to subtract 30 here but it avoids an undesirably larger gap above
+				// the OK and Cancel buttons.
+				this.Size = new System.Drawing.Size(this.Width, this.Height + topPanel.Height - 30);
 				MetadataControl.BringToFront();
 				topPanel.ResumeLayout(false);
 				topPanel.PerformLayout();
 				this.ResumeLayout(false);
 			}
+
+			// The tweaks here allow us to adjust the layout of the dialog so it fits better on smaller screens.
+			// For a long-term solution it would be better to fix the underlying implementation in LibPalaso.
+			// But this fix has a very short lifetime; it is already replaced with a new React implementation
+			// in 5.3. So this is easier than negotiating the redesign of a possibly shared dialog.
+
+			// The spec for BL-11207 says we can reduce the copyright holder field to one line, but this
+			// actually still has room for at least two, yet still gives us a good reduction. Also, we need the remaining
+			// height for some localizations (e.g., az) of "Copyright holder")
+			const int copyrightPanelReduction = 30;
+			// The actual copyright holder field is docked in such a way that all we have to do is shrink the
+			// containing panel (and move the lower controls up).
+			var copyrightPanel = MetadataControl.Controls.Cast<Control>().First(x => x is TableLayoutPanel);
+			copyrightPanel.Height -= copyrightPanelReduction;
+			foreach (Control c in MetadataControl.Controls)
+			{
+				if (c.Top > copyrightPanel.Bottom)
+					c.Top -= copyrightPanelReduction;
+			}
+
+			// We will also place the CC license picture over on the right, saving its height plus a little padding.
+			var ccLicenseBox = MetadataControl.Controls.Cast<Control>().First(x => x is BetterPictureBox);
+			int ccLicenseBoxReduction = ccLicenseBox.Height + 5;
+			foreach (Control c in MetadataControl.Controls)
+			{
+				if (c.Top > ccLicenseBox.Bottom)
+					c.Top -= ccLicenseBoxReduction;
+			}
+			ccLicenseBox.Top -= 165;
+			// What we want to do here is add 250 to its Left to move it over. We can't do that because
+			// the Libpalaso code uses the Left of this control to align the Left of the LicenseRights
+			// control when the CC image is hidden (i.e., when it contains Custom rights rather than
+			// Additional Requests). So, instead, we make it wider by twice that amount.
+			// Centering of the image puts it where we want.
+			ccLicenseBox.Width += 500;
+
+			// Even before these tweaks, this control sometimes lost part of its last letter to the label on its right.
+			var cc0Box = MetadataControl.Controls.Cast<Control>().First(x => x.Name == "_publicDomainCC0");
+			cc0Box.BringToFront();
+
+			// panel2 contains the "Allow commercial use..." heading and radio buttons.
+			// The heading may go the full width in some localizations, so we've arranged to place the image
+			// to the right of the "yes/no" radio buttons, which are unlikely to need to be too wide.
+			// But we can't just make the panel narrower; bad things happen if it needs to wrap the heading
+			// onto a second line. Nor does Windows.Forms support giving it a transparent background.
+			// So the only way to allow its first child to be wide and the picture to be seen below that
+			// and right of the radio buttons is to move the heading out of the panel, adjust the positions
+			// of the panel children, and make the panel less wide so it doesn't cover the picture.
+			// (We can't just promote ALL the children and get rid of the panel, because the behavior
+			// of the radio buttons is somehow tied to being grouped in this panel.)
+			var panel2 = MetadataControl.Controls.Cast<Control>().First(x => x.Name == "panel2");
+			var heading = panel2.Controls[0];
+			heading.Location = new Point(heading.Location.X + panel2.Location.X, heading.Location.Y + panel2.Location.Y);
+			MetadataControl.Controls.Add(heading);
+			const int headingHeight = 17;
+			foreach (Control c in panel2.Controls.Cast<Control>().ToArray())
+			{
+				c.Top -= headingHeight;
+			}
+			panel2.Height -= headingHeight;
+			panel2.Top += headingHeight;
+			panel2.Width = 250;
+
+			// This is just a tweak. It wasn't well aligned before, but now it's between two other boxes
+			// and closer to one of them, it is more noticeable, so we adjust it.
+			var moreInfoBox = MetadataControl.Controls.Cast<Control>().First(x => x.Name == "_linkToDefinitionOfNonCommercial");
+			moreInfoBox.Left -= 5;
+
+			// This is how much we get to shrink the main control and the whole dialog.
+			var totalReduction = copyrightPanelReduction + ccLicenseBoxReduction;
+			MetadataControl.Height -= totalReduction;
+			Height -= totalReduction; // OK and Cancel buttons move by being docked.
 		}

 		private void ReplaceCopyrightCheckboxChanged(Object sender, EventArgs e)


Fix bidirectional equality tests

Fix bidirectional equality tests

These duplicated statements were probably intended to validate that the equality implementation is commutative.

--- src/Build.UnitTests/Instance/TaskItem_Tests.cs
+++ src/Build.UnitTests/Instance/TaskItem_Tests.cs
@@ -59,22 +59,22 @@
             TaskItem right = new TaskItem("foo", "bar.proj");

             Assert.Equal(left, right);
+            Assert.Equal(right, left);
+        }
+
+        /// <summary>
+        /// Ensure two items with the same custom metadata are equivalent
+        /// </summary>
+        [Fact]
+        public void TestEquivalenceWithCustomMetadata()
+        {
+            TaskItem left = new TaskItem("foo", "bar.proj");
+            left.SetMetadata("a", "b");
+            TaskItem right = new TaskItem("foo", "bar.proj");
+            right.SetMetadata("a", "b");
+
             Assert.Equal(left, right);
-        }
-
-        /// <summary>
-        /// Ensure two items with the same custom metadata are equivalent
-        /// </summary>
-        [Fact]
-        public void TestEquivalenceWithCustomMetadata()
-        {
-            TaskItem left = new TaskItem("foo", "bar.proj");
-            left.SetMetadata("a", "b");
-            TaskItem right = new TaskItem("foo", "bar.proj");
-            right.SetMetadata("a", "b");
-
-            Assert.Equal(left, right);
-            Assert.Equal(left, right);
+            Assert.Equal(right, left);
         }

         /// <summary>
@@ -89,36 +89,36 @@
             right.SetMetadata("a", "c");

             Assert.NotEqual(left, right);
+            Assert.NotEqual(right, left);
+        }
+
+        /// <summary>
+        /// Ensure two items with different custom metadata keys are not equivalent
+        /// </summary>
+        [Fact]
+        public void TestInequivalenceWithDifferentCustomMetadataKeys()
+        {
+            TaskItem left = new TaskItem("foo", "bar.proj");
+            left.SetMetadata("a", "b");
+            TaskItem right = new TaskItem("foo", "bar.proj");
+            right.SetMetadata("b", "b");
+
             Assert.NotEqual(left, right);
-        }
-
-        /// <summary>
-        /// Ensure two items with different custom metadata keys are not equivalent
-        /// </summary>
-        [Fact]
-        public void TestInequivalenceWithDifferentCustomMetadataKeys()
-        {
-            TaskItem left = new TaskItem("foo", "bar.proj");
-            left.SetMetadata("a", "b");
-            TaskItem right = new TaskItem("foo", "bar.proj");
-            right.SetMetadata("b", "b");
+            Assert.NotEqual(right, left);
+        }
+
+        /// <summary>
+        /// Ensure two items with different numbers of custom metadata are not equivalent
+        /// </summary>
+        [Fact]
+        public void TestInequivalenceWithDifferentCustomMetadataCount()
+        {
+            TaskItem left = new TaskItem("foo", "bar.proj");
+            left.SetMetadata("a", "b");
+            TaskItem right = new TaskItem("foo", "bar.proj");

             Assert.NotEqual(left, right);
-            Assert.NotEqual(left, right);
-        }
-
-        /// <summary>
-        /// Ensure two items with different numbers of custom metadata are not equivalent
-        /// </summary>
-        [Fact]
-        public void TestInequivalenceWithDifferentCustomMetadataCount()
-        {
-            TaskItem left = new TaskItem("foo", "bar.proj");
-            left.SetMetadata("a", "b");
-            TaskItem right = new TaskItem("foo", "bar.proj");
-
-            Assert.NotEqual(left, right);
-            Assert.NotEqual(left, right);
+            Assert.NotEqual(right, left);
         }

         /// <summary>
@@ -134,7 +134,7 @@
             right.SetMetadata("c", "d");

             Assert.NotEqual(left, right);
-            Assert.NotEqual(left, right);
+            Assert.NotEqual(right, left);
         }

         /// <summary>
@@ -149,6 +149,7 @@

             TaskItem clone = parent.DeepClone();
             Assert.True(parent.Equals(clone)); // "The parent and the clone should be equal"
+            Assert.True(clone.Equals(parent)); // "The parent and the clone should be equal"
             Assert.False(object.ReferenceEquals(parent, clone)); // "The parent and the child should not be the same object"
         }


Unnecessary ligne...

Unnecessary ligne...

--- src/CK.Glouton.Lucene/LuceneSearcherManager.cs
+++ src/CK.Glouton.Lucene/LuceneSearcherManager.cs
@@ -48,7 +48,6 @@
             List<IndexReader> readers = new List<IndexReader>();
             foreach (string appName in appNames)
             {
-                bool coucou = System.IO.Directory.Exists(_configuration.Path + "\\" + appName);
                 if (!System.IO.Directory.Exists(_configuration.Path + "\\" + appName))
                     continue;
                 readers.Add(GetReader(appName));


EnumerableExtensions.ForEachAsync(): Improved error handling

--- src/Common/Collections/EnumerableExtensions.cs
+++ src/Common/Collections/EnumerableExtensions.cs
@@ -281,17 +281,21 @@
         [NotNull]
         public static async Task ForEachAsync<T>([NotNull] this IEnumerable<T> enumerable, [NotNull] Func<T, Task> taskFactory, int maxParallel = 0)
         {
-            var activeTasks = new List<Task>(maxParallel);
+            var tasks = new List<Task>(maxParallel);
+
             foreach (var task in enumerable.Select(taskFactory))
             {
-                activeTasks.Add(task);
-                if (activeTasks.Count == maxParallel)
-                {
-                    await Task.WhenAny(activeTasks.ToArray());
-                    activeTasks.RemoveAll(x => x.IsCompleted);
-                }
-            }
-            await Task.WhenAll(activeTasks.ToArray());
+                tasks.Add(task);
+
+                if (tasks.Count == maxParallel)
+                {
+                    var completedTask = await Task.WhenAny(tasks.ToArray());
+                    await completedTask; // observe exceptions
+                    tasks.Remove(completedTask);
+                }
+            }
+
+            await Task.WhenAll(tasks.ToArray());
         }
 #endif
     }


Introduced version 0.0.1.0

Introduced version 0.0.1.0

--- src/DatenMeisterWPF/Properties/AssemblyInfo.cs
+++ src/DatenMeisterWPF/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@
 // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
 // übernehmen, indem Sie "*" eingeben:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.0.0.5")]
-[assembly: AssemblyFileVersion("0.0.0.5")]
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]


Test coverage for the fact that when all of the tests in a test class fail during custom parameter generation, the test class should not really be executed and therefore the test class should never even be constructed (much like a test class in which all the tests are skipped).

--- src/Fixie.Tests/Lifecycle/ConstructionTests.cs
+++ src/Fixie.Tests/Lifecycle/ConstructionTests.cs
@@ -1,4 +1,6 @@
 using System;
+using System.Collections.Generic;
+using System.Reflection;
 using Should;

 namespace Fixie.Tests.Lifecycle
@@ -224,11 +226,82 @@
             output.ShouldHaveLifecycle();
         }

+        public void ShouldSkipConstructingPerCaseWhenAllCasesFailCustomParameterGeneration()
+        {
+            Convention.ClassExecution
+                      .CreateInstancePerCase();
+
+            Convention.Parameters(ParametersFromBuggySource);
+
+            var output = Run();
+
+            output.ShouldHaveResults(
+                "SampleTestClass.Pass failed: Exception thrown while attempting to yield input parameters for method: Pass",
+                "SampleTestClass.Fail failed: Exception thrown while attempting to yield input parameters for method: Fail");
+
+            output.ShouldHaveLifecycle();
+        }
+
+        public void ShouldSkipConstructingPerClassWhenAllCasesFailCustomParameterGeneration()
+        {
+            Convention.ClassExecution
+                      .CreateInstancePerClass();
+
+            Convention.Parameters(ParametersFromBuggySource);
+
+            var output = Run();
+
+            output.ShouldHaveResults(
+                "SampleTestClass.Pass failed: Exception thrown while attempting to yield input parameters for method: Pass",
+                "SampleTestClass.Fail failed: Exception thrown while attempting to yield input parameters for method: Fail");
+
+            output.ShouldHaveLifecycle();
+        }
+
+        public void ShouldSkipConstructingPerCaseUsingCustomFactoryWhenAllCasesFailCustomParameterGeneration()
+        {
+            Convention.ClassExecution
+                      .CreateInstancePerCase()
+                      .UsingFactory(Factory);
+
+            Convention.Parameters(ParametersFromBuggySource);
+
+            var output = Run();
+
+            output.ShouldHaveResults(
+                "SampleTestClass.Pass failed: Exception thrown while attempting to yield input parameters for method: Pass",
+                "SampleTestClass.Fail failed: Exception thrown while attempting to yield input parameters for method: Fail");
+
+            output.ShouldHaveLifecycle();
+        }
+
+        public void ShouldSkipConstructingPerClassUsingCustomFactoryWhenAllCasesFailCustomParameterGeneration()
+        {
+            Convention.ClassExecution
+                      .CreateInstancePerClass()
+                      .UsingFactory(Factory);
+
+            Convention.Parameters(ParametersFromBuggySource);
+
+            var output = Run();
+
+            output.ShouldHaveResults(
+                "SampleTestClass.Pass failed: Exception thrown while attempting to yield input parameters for method: Pass",
+                "SampleTestClass.Fail failed: Exception thrown while attempting to yield input parameters for method: Fail");
+
+            output.ShouldHaveLifecycle();
+        }
+
         static object Factory(Type testClass)
         {
             WhereAmI();
             testClass.ShouldEqual(typeof(SampleTestClass));
             return new SampleTestClass();
         }
+
+        static IEnumerable<object[]> ParametersFromBuggySource(MethodInfo method)
+        {
+            throw new Exception("Exception thrown while attempting to yield input parameters for method: " + method.Name);
+        }
     }
 }


update basecontroller

update basecontroller

--- BaseController.cs
+++ BaseController.cs
@@ -11,9 +11,25 @@
             AddAlert(AlertStyles.Success, message, dismissable);
         }

+        public void Success(IEnumerable<string> messages, bool dismissable = false)
+        {
+            foreach (var item in messages)
+            {
+                Success(string.Format("
{0}
", item), dismissable);
+            }
+        }
+
         public void Information(string message, bool dismissable = false)
         {
             AddAlert(AlertStyles.Information, message, dismissable);
+        }
+
+        public void Information(IEnumerable<string> messages, bool dismissable = false)
+        {
+            foreach (var item in messages)
+            {
+                Information(string.Format("
{0}
", item), dismissable);
+            }
         }

         public void Warning(string message, bool dismissable = false)
@@ -21,9 +37,25 @@
             AddAlert(AlertStyles.Warning, message, dismissable);
         }

+        public void Warning(IEnumerable<string> messages, bool dismissable = false)
+        {
+            foreach (var item in messages)
+            {
+                Warning(string.Format("
{0}
", item), dismissable);
+            }
+        }
+
         public void Danger(string message, bool dismissable = false)
         {
             AddAlert(AlertStyles.Danger, message, dismissable);
+        }
+
+        public void Danger(IEnumerable<string> messages, bool dismissable = false)
+        {
+            foreach (var item in messages)
+            {
+                Danger(string.Format("
{0}
", item), dismissable);
+            }
         }

         private void AddAlert(string alertStyle, string message, bool dismissable)


Appear faster to close

Appear faster to close

--- Browse/frmMain.cs
+++ Browse/frmMain.cs
@@ -107,6 +107,8 @@

     private void SavePreferences()
     {
+      this.Hide();
+
       _prefs.Set("root", txtRoot.Text);
       _prefs.Set("pause", cbPause.Checked);
       _prefs.Set("pauseTime", udPause.Value);


Removed TV

Removed TV

--- Cameras/Camera.cs
+++ Cameras/Camera.cs
@@ -304,17 +304,6 @@
             }
         }
         #endif
-
-        #endregion
-
-        // ====================================================================
-
-        #region Events
-
-        /// <summary>
-        /// Subscribe to this event to handle changing of size of video output <see cref="OutputVideoSize"/>.
-        /// </summary>
-        public event EventHandler OutputVideoSizeChanged;

         #endregion

@@ -638,119 +627,7 @@

         #endregion

-        #region TV Mode
-
-        /// <summary>
-        /// Sets TV Mode for device.
-        /// </summary>
-        /// <param name="mode">TV Mode to set (analog video standard).</param>
-        public void SetTVMode(AnalogVideoStandard mode)
-        {
-            if (DX.CaptureFilter == null)
-                return;
-
-            IAMAnalogVideoDecoder pDecoder = DX.CaptureFilter as IAMAnalogVideoDecoder;
-
-            if (pDecoder == null)
-                return;
-
-            int hr = pDecoder.put_TVFormat(mode);
-            DsError.ThrowExceptionForHR(hr);
-
-            //Marshal.ReleaseComObject(pDecoder);
-        }
-
-        /// <summary>
-        /// Gets TV Mode of device.
-        /// </summary>
-        /// <returns>TV Mode of device (analog video standard)</returns>
-        public AnalogVideoStandard GetTVMode()
-        {
-            if (DX.CaptureFilter == null)
-                return AnalogVideoStandard.None;
-
-            IAMAnalogVideoDecoder pDecoder = DX.CaptureFilter as IAMAnalogVideoDecoder;
-
-            if (pDecoder == null)
-                return AnalogVideoStandard.None;
-
-            AnalogVideoStandard mode = AnalogVideoStandard.None;
-            int hr = pDecoder.get_TVFormat(out mode);
-            DsError.ThrowExceptionForHR(hr);
-
-            //Marshal.ReleaseComObject(pDecoder);
-
-            return mode;
-        }
-
-        #endregion
-
         #region Spanshot (screenshots) frame
-
-        /// <summary>
-        /// Make snapshot of output image. Slow, but includes all graph's effects.
-        /// </summary>
-        /// <returns>Snapshot as a Bitmap</returns>
-        /// <seealso cref="SnapshotSourceImage"/>
-        public Bitmap SnapshotOutputImage()
-        {
-            if (DX.WindowlessCtrl == null)
-                throw new Exception("WindowlessCtrl is not initialized.");
-
-            IntPtr currentImage = IntPtr.Zero;
-            Bitmap bitmap = null;
-            Bitmap bitmap_clone = null;
-
-            try
-            {
-                int hr = DX.WindowlessCtrl.GetCurrentImage(out currentImage);
-                DsError.ThrowExceptionForHR(hr);
-
-                if (currentImage != IntPtr.Zero)
-                {
-                    BitmapInfoHeader structure = new BitmapInfoHeader();
-                    Marshal.PtrToStructure(currentImage, structure);
-
-                    PixelFormat pixelFormat = PixelFormat.Format24bppRgb;
-                    switch (structure.BitCount)
-                    {
-                        case 24:
-                            pixelFormat = PixelFormat.Format24bppRgb;
-                            break;
-                        case 32:
-                            pixelFormat = PixelFormat.Format32bppRgb;
-                            break;
-                        case 48:
-                            pixelFormat = PixelFormat.Format48bppRgb;
-                            break;
-                        default:
-                            throw new Exception("Unsupported BitCount.");
-                    }
-
-                    bitmap = new Bitmap(structure.Width, structure.Height, (structure.BitCount / 8) * structure.Width, pixelFormat, new IntPtr(currentImage.ToInt64() + DIB_Image_HeaderSize));
-
-                    bitmap_clone = bitmap.Clone(new Rectangle(0, 0, structure.Width, structure.Height), PixelFormat.Format24bppRgb);
-
-                    bitmap_clone.RotateFlip(RotateFlipType.RotateNoneFlipY);
-                }
-            }
-            catch
-            {
-                if (bitmap != null)
-                {
-                    bitmap.Dispose();
-                    bitmap = null;
-                }
-
-                throw;
-            }
-            finally
-            {
-                Marshal.FreeCoTaskMem(currentImage);
-            }
-
-            return bitmap_clone;
-        }

         /// <summary>
         /// Make snapshot of source image. Much faster than SnapshotOutputImage.


work on facets list

work on facets list

--- src/GiveCRM.Web/Controllers/SetupController.cs
+++ src/GiveCRM.Web/Controllers/SetupController.cs
@@ -1,10 +1,10 @@
 using System.Web.Mvc;
 using GiveCRM.DataAccess;
 using GiveCRM.Models;
+using GiveCRM.Web.Models.Facets;

 namespace GiveCRM.Web.Controllers
 {
-    using System.Collections.Generic;

     public class SetupController : Controller
     {
@@ -37,10 +37,12 @@

         public ActionResult ShowFacets()
         {
-            IEnumerable<Facet> facets = _facetsDb.All();
+            var viewModel = new FacetListViewModel
+            {
+                Facets = _facetsDb.All()
+            };

-            return View(facets);
+            return View(viewModel);
         }
-
     }
 }


Remove page styling from Ajax search results.

--- src/GiveCRM.Web/Views/Member/AjaxSearch.cshtml
+++ src/GiveCRM.Web/Views/Member/AjaxSearch.cshtml
@@ -1,6 +1,8 @@
 @model IEnumerable<GiveCRM.Models.Member>
-
+@{
+    Layout = null;
+}
 @foreach (var member in Model)
 {
-    @member.FirstName @member.LastName @member.PostalCode

+
@member.FirstName @member.LastName @member.PostalCode

 }


advance version number to 0.5.7

advance version number to 0.5.7

--- src/LookingGlass.Framework/LookingGlassBase.cs
+++ src/LookingGlass.Framework/LookingGlassBase.cs
@@ -35,7 +35,7 @@
     // static things that are accessed very early (mostly by logger)
     private static string m_applicationName = "LookingGlass";
     public static string ApplicationName { get { return m_applicationName; } }
-    private static string m_applicationVersion = "V0.5.6";
+    private static string m_applicationVersion = "V0.5.7";
     public static string ApplicationVersion { get { return m_applicationVersion; } }

     ILog m_log = LogManager.GetLogger("LookingGlassBase");


Lucene.Net.Codecs.Memory.FSTTermsReader: Commented out dead Walk method

--- src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
+++ src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
@@ -1,8 +1,6 @@
 using Lucene.Net.Index;
-using Lucene.Net.Support;
 using Lucene.Net.Util.Fst;
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
@@ -28,7 +26,6 @@
      */

     using ArrayUtil = Util.ArrayUtil;
-    using IBits = Util.IBits;
     using ByteArrayDataInput = Store.ByteArrayDataInput;
     using ByteRunAutomaton = Util.Automaton.ByteRunAutomaton;
     using BytesRef = Util.BytesRef;
@@ -38,6 +35,7 @@
     using DocsEnum = Index.DocsEnum;
     using FieldInfo = Index.FieldInfo;
     using FieldInfos = Index.FieldInfos;
+    using IBits = Util.IBits;
     using IndexFileNames = Index.IndexFileNames;
     using IndexInput = Store.IndexInput;
     using IndexOptions = Index.IndexOptions;
@@ -809,39 +807,39 @@
             }
         }

-        internal static void Walk<T>(FST<T> fst) // LUCENENET NOTE: Not referenced
-        {
-            List<FST.Arc<T>> queue = new List<FST.Arc<T>>();
-            FST.BytesReader reader = fst.GetBytesReader();
-            FST.Arc<T> startArc = fst.GetFirstArc(new FST.Arc<T>());
-            queue.Add(startArc);
-            BitArray seen = new BitArray(queue.Count);
-            while (queue.Count > 0)
-            {
-                FST.Arc<T> arc = queue[0];
-                queue.RemoveAt(0);
-
-                long node = arc.Target;
-                //System.out.println(arc);
-                if (FST<T>.TargetHasArcs(arc) && !seen.SafeGet((int)node))
-                {
-                    seen.SafeSet((int)node, true);
-                    fst.ReadFirstRealTargetArc(node, arc, reader);
-                    while (true)
-                    {
-                        queue.Add((new FST.Arc<T>()).CopyFrom(arc));
-                        if (arc.IsLast)
-                        {
-                            break;
-                        }
-                        else
-                        {
-                            fst.ReadNextRealArc(arc, reader);
-                        }
-                    }
-                }
-            }
-        }
+        //internal static void Walk<T>(FST<T> fst) // LUCENENET NOTE: Not referenced
+        //{
+        //    List<FST.Arc<T>> queue = new List<FST.Arc<T>>();
+        //    FST.BytesReader reader = fst.GetBytesReader();
+        //    FST.Arc<T> startArc = fst.GetFirstArc(new FST.Arc<T>());
+        //    queue.Add(startArc);
+        //    BitSet seen = new BitSet(queue.Count);
+        //    while (queue.Count > 0)
+        //    {
+        //        FST.Arc<T> arc = queue[0];
+        //        queue.RemoveAt(0);
+
+        //        long node = arc.Target;
+        //        //System.out.println(arc);
+        //        if (FST<T>.TargetHasArcs(arc) && !seen.Get((int)node))
+        //        {
+        //            seen.Set((int)node);
+        //            fst.ReadFirstRealTargetArc(node, arc, reader);
+        //            while (true)
+        //            {
+        //                queue.Add((new FST.Arc<T>()).CopyFrom(arc));
+        //                if (arc.IsLast)
+        //                {
+        //                    break;
+        //                }
+        //                else
+        //                {
+        //                    fst.ReadNextRealArc(arc, reader);
+        //                }
+        //            }
+        //        }
+        //    }
+        //}

         public override long RamBytesUsed()
         {


deleted some tests that are duplicated from Weasel

--- src/Marten.Testing/Util/CommandBuilderTests.cs
+++ src/Marten.Testing/Util/CommandBuilderTests.cs
@@ -1,61 +0,0 @@
-using Baseline.Reflection;
-using Marten.Util;
-using Shouldly;
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Text;
-using Weasel.Postgresql;
-using Marten.Testing.Documents;
-using Npgsql;
-using Xunit;
-
-namespace Marten.Testing.Util
-{
-    public class CommandBuilderTests
-    {
-
-        [Fact]
-        public void append_parameters_with_one_at_the_end()
-        {
-            var builder = new CommandBuilder(new NpgsqlCommand());
-
-            builder.Append("select data from table where ");
-            builder.AppendWithParameters("foo = ?")
-                .Length.ShouldBe(1);
-
-            builder.ToString().ShouldBe("select data from table where foo = :p0");
-
-
-        }
-
-        [Fact]
-        public void append_parameters_with_multiples_at_end()
-        {
-            var builder = new CommandBuilder(new NpgsqlCommand());
-
-            builder.Append("select data from table where ");
-            builder.AppendWithParameters("foo = ? and bar = ?")
-                .Length.ShouldBe(2);
-
-            builder.ToString().ShouldBe("select data from table where foo = :p0 and bar = :p1");
-
-
-        }
-
-
-        [Fact]
-        public void append_parameters_with_multiples_in_the_middle()
-        {
-            var builder = new CommandBuilder(new NpgsqlCommand());
-
-            builder.Append("select data from table where ");
-            builder.AppendWithParameters("foo = ? and bar = ? order by baz")
-                .Length.ShouldBe(2);
-
-            builder.ToString().ShouldBe("select data from table where foo = :p0 and bar = :p1 order by baz");
-
-
-        }
-    }
-}


Add two small optimisations

Add two small optimisations

svn path=/trunk/bitsharp/; revision=125766

--- src/MonoTorrent/MonoTorrent.Common/BitField.cs
+++ src/MonoTorrent/MonoTorrent.Common/BitField.cs
@@ -113,9 +113,7 @@
         public BitField Clone()
         {
             BitField b = new BitField(this.length);
-            for (int i = 0; i < this.array.Length; i++)
-                b.array[i] = this.array[i];
-
+            Buffer.BlockCopy(array, 0, b.array, 0, array.Length * 4);
             b.trueCount = trueCount;
             return b;
         }
@@ -185,7 +183,7 @@
         {
             BitField bf = obj as BitField;

-            if (bf == null || this.array.Length != bf.array.Length)
+            if (bf == null || this.array.Length != bf.array.Length || TrueCount != bf.TrueCount)
                 return false;

             for (int i = 0; i < this.array.Length; i++)


Code cleanup

Code cleanup

--- src/NEventStore/Persistence/IPersistStreams.cs
+++ src/NEventStore/Persistence/IPersistStreams.cs
@@ -34,7 +34,7 @@
         IEnumerable<Commit> GetFrom(string bucketId, DateTime start);

         /// <summary>
-        /// Gets all commits after from the specified checkpoint.
+        ///     Gets all commits after from the specified checkpoint.
         /// </summary>
         /// <param name="checkpoint">The checkpoint.</param>
         /// <returns></returns>
@@ -79,7 +79,8 @@
         void Purge(string bucketId);

         /// <summary>
-        ///     Completely DESTROYS the contents and schema (if applicable) containting ANY and ALL streams that have been successfully persisted
+        ///     Completely DESTROYS the contents and schema (if applicable) containting ANY and ALL streams that have been
+        ///     successfully persisted
         ///     in the specified bucket.  Use with caution.
         /// </summary>
         void Drop();


Minor changes

Minor changes

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@2259

--- src/NHibernate.Test/FilterTest/FilterConfig.cs
+++ src/NHibernate.Test/FilterTest/FilterConfig.cs
@@ -5,69 +5,67 @@

 namespace NHibernate.Test.FilterTest
 {
-    [TestFixture]
-    public class FilterConfig
-    {
-        string mappingCfg = "NHibernate.Test.FilterTest.FilterMapping.hbm.xml";
+	[TestFixture]
+	public class FilterConfig
+	{
+		string mappingCfg = "NHibernate.Test.FilterTest.FilterMapping.hbm.xml";
+
+		[Test]
+		public void FilterDefinitionsLoadedCorrectly()
+		{
+			Configuration cfg = new Configuration();
+			cfg.AddResource(mappingCfg, this.GetType().Assembly);
+			Assert.AreEqual(cfg.FilterDefinitions.Count, 2);
+
+			Assert.IsTrue(cfg.FilterDefinitions.Contains("LiveFilter"));
+
+			FilterDefinition f = cfg.FilterDefinitions["LiveFilter"] as FilterDefinition;
+
+			Assert.AreEqual(f.ParameterTypes.Count, 1);
+
+			BooleanType t = f.ParameterTypes["LiveParam"] as BooleanType;
+
+			Assert.IsNotNull(t); //ensure that the parameter is the correct type.
+		}
+
+		[Test]
+		public void FiltersLoaded()
+		{
+			Configuration cfg = new Configuration();
+			cfg.AddResource(mappingCfg, this.GetType().Assembly);
+
+			ISessionFactory factory = cfg.BuildSessionFactory();
+
+			ISession session = factory.OpenSession();
+
+			IFilter filter = session.EnableFilter("LiveFilter");
+
+			Assert.AreEqual(filter.FilterDefinition.FilterName, "LiveFilter");
+
+			filter.SetParameter("LiveParam", true);
+
+			filter.Validate(); // make sure that everything is set up right.
+
+			IFilter filter2 = session.EnableFilter("LiveFilter2");
+
+			filter2.SetParameter("LiveParam2", "somename");
+
+			filter2.Validate();
+		}

-        [Test]
-        public void TestFilterDefinitionsLoadedCorrectly() {
-            Configuration cfg = new Configuration();
-            cfg.AddResource(mappingCfg, this.GetType().Assembly);
-            Assert.AreEqual(cfg.FilterDefinitions.Count, 2);
+		[Test]
+		[ExpectedException(typeof(HibernateException))]
+		public void TestFilterThrowsWithNoParameterSet()
+		{
+			Configuration cfg = new Configuration();
+			cfg.AddResource(mappingCfg, this.GetType().Assembly);

-            Assert.IsTrue(cfg.FilterDefinitions.Contains("LiveFilter"));
+			ISessionFactory factory = cfg.BuildSessionFactory();

-            FilterDefinition f = cfg.FilterDefinitions["LiveFilter"] as FilterDefinition;
-
-            Assert.AreEqual(f.ParameterTypes.Count,1);
-
-            BooleanType t = f.ParameterTypes["LiveParam"] as BooleanType;
-
-            Assert.IsNotNull(t); //ensure that the parameter is the correct type.
-
-        }
-
-
-        [Test]
-        public void TestFiltersLoaded() {
-            Configuration cfg = new Configuration();
-            cfg.AddResource(mappingCfg, this.GetType().Assembly);
-
-            ISessionFactory factory = cfg.BuildSessionFactory();
-
-            ISession session = factory.OpenSession();
-
-            IFilter filter = session.EnableFilter("LiveFilter");
-
-            Assert.AreEqual(filter.FilterDefinition.FilterName, "LiveFilter");
-
-            filter.SetParameter("LiveParam", true);
-
-            filter.Validate(); // make sure that everything is set up right.
-
-            IFilter filter2 = session.EnableFilter("LiveFilter2");
-
-            filter2.SetParameter("LiveParam2", "somename");
-
-            filter2.Validate();
-
-        }
-
-
-        [Test]
-        [ExpectedException(typeof(HibernateException))]
-        public void TestFilterThrowsWithNoParameterSet() {
-            Configuration cfg = new Configuration();
-            cfg.AddResource(mappingCfg, this.GetType().Assembly);
-
-            ISessionFactory factory = cfg.BuildSessionFactory();
-
-            ISession session = factory.OpenSession();
-            IFilter filter = session.EnableFilter("LiveFilter");
-            filter.Validate();
-        }
-
-    }
-}
+			ISession session = factory.OpenSession();
+			IFilter filter = session.EnableFilter("LiveFilter");
+			filter.Validate();
+		}
+	}
+}


Providers: disable native provider loader on portable builds #296

--- src/Numerics/Providers/NativeProviderLoader.cs
+++ src/Numerics/Providers/NativeProviderLoader.cs
@@ -34,6 +34,8 @@
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Security;
+
+#if NATIVEMKL

 namespace MathNet.Numerics.Providers
 {
@@ -180,3 +182,5 @@
         }
     }
 }
+
+#endif


Fixes #326, don't close stream when writing response

--- src/OmniSharp/Middleware/EndpointMiddleware.cs
+++ src/OmniSharp/Middleware/EndpointMiddleware.cs
@@ -103,14 +103,12 @@

         private void SerializeResponseObject(HttpResponse response, object value)
         {
-            using (var writer = new StreamWriter(response.Body))
+            using (var writer = new StreamWriter(response.Body, System.Text.Encoding.UTF8, 1024, true))
+            using (var jsonWriter = new JsonTextWriter(writer))
             {
-                using (var jsonWriter = new JsonTextWriter(writer))
-                {
-                    jsonWriter.CloseOutput = false;
-                    var jsonSerializer = JsonSerializer.Create(/*TODO: SerializerSettings*/);
-                    jsonSerializer.Serialize(jsonWriter, value);
-                }
+                jsonWriter.CloseOutput = false;
+                var jsonSerializer = JsonSerializer.Create(/*TODO: SerializerSettings*/);
+                jsonSerializer.Serialize(jsonWriter, value);
             }
         }
     }


Fixed comment typo.

Fixed comment typo.

--- src/Overflow/CompensatingOperationAttribute.cs
+++ src/Overflow/CompensatingOperationAttribute.cs
@@ -7,7 +7,7 @@
 namespace Overflow
 {
     /// <summary>
-    /// Applies the Compensating Operation beahvior. When errors occur during the execution
+    /// Applies the Compensating Operation behavior. When errors occur during the execution
     /// of the operation, an instance of the specified compensating operation type is created and executed.
     /// This operation gets behaviors applied as normal and can implement the IInputOperation
     /// interface. The IOutputOperation interface will be ignored.


pcre options

pcre options

- valid flags

--- src/Peachpie.Library/PerlRegex/RegexOptions.cs
+++ src/Peachpie.Library/PerlRegex/RegexOptions.cs
@@ -33,26 +33,26 @@
         PCRE_MULTILINE = Multiline,         // m
         PCRE_DOTALL = Singleline,           // s
         PCRE_EXTENDED = IgnorePatternWhitespace,      // x
-        PCRE_ANCHORED = 0xf010,             // A
-        PCRE_DOLLAR_ENDONLY = 0xf020,       // D
-        PCRE_UNGREEDY = 0xf040,             // U
-        PCRE_UTF8 = 0xf080,                 // u
-        PCRE_EXTRA = 0xf100,                // X
+        PCRE_ANCHORED = 0x0400,             // A
+        PCRE_DOLLAR_ENDONLY = 0x0800,       // D
+        PCRE_UNGREEDY = 0x1000,             // U
+        PCRE_UTF8 = 0x2000,                 // u
+        PCRE_EXTRA = 0x3000,                // X

         /// <summary>
         /// Spend more time studying the pattern - ignoring.
         /// </summary>
-        PCRE_S = 0xf200,                    // S
+        PCRE_S = 0x4000,                    // S

         ///// <summary>
         ///// Evaluate as PHP code.
         ///// Deprecated and removed.
         ///// </summary>
-        //PREG_REPLACE_EVAL = 0xf400,        // e
+        //PREG_REPLACE_EVAL = 0x8000,        // e

         /// <summary>
         /// An unknown option.
         /// </summary>
-        Unknown = 0xffff,
+        Unknown = 0x10000,
     }
 }


core: avoids string alloc in type table population

--- src/Peachpie.Runtime/Reflection/TypeMethods.cs
+++ src/Peachpie.Runtime/Reflection/TypeMethods.cs
@@ -90,17 +90,17 @@

                 var magic = MagicMethods.undefined;

-                if (IsSpecialName(overrides))
+                if (IsSpecialName(overrides)) // property getter/setter, or another generated method
                 {
                     // 'specialname' methods,
-                    // get_Item, set_Item
-                    if (!Enum.TryParse<MagicMethods>(m.Key.ToLowerInvariant(), out magic))
+                    // but remember get_Item, set_Item
+                    if (!Enum.TryParse<MagicMethods>(m.Key, true, out magic))
                     {
                         continue;
                     }
                 }

-                // TODO: negative {index} in case of non-user method
+                // CONSIDER: negative {index} in case of non-user method

                 var info = PhpMethodInfo.Create(++index, m.Key, overrides, type);

@@ -127,7 +127,7 @@

             if (name.StartsWith("__", StringComparison.Ordinal))
             {
-                Enum.TryParse<MagicMethods>(name.ToLowerInvariant(), out result);
+                Enum.TryParse<MagicMethods>(name, true, out result);
             }

             return result;


Clean output of exception.

Clean output of exception.

--- src/Projects/MyCouch.Net45/MyCouchException.cs
+++ src/Projects/MyCouch.Net45/MyCouchException.cs
@@ -16,7 +16,7 @@

         public MyCouchException(HttpMethod httpMethod, HttpStatusCode httpStatus, Uri uri, string error, string reason)
             : base(string.Format(
-                "MyCouch failed.{0}HttpMethod: {1}.{0}HttpStatus: {2}.{0}Uri:{3}.{0}Error: {4}.{0}Reason: {5}.{0}",
+                "MyCouch failed.{0}HttpMethod: {1}{0}HttpStatus: {2}{0}Uri:{3}{0}Error: {4}{0}Reason: {5}{0}",
                 Environment.NewLine,
                 httpMethod,
                 httpStatus,


Implemented section collection merge

Implemented section collection merge

--- src/SimpleSoft.IniParser/Impl/IniNormalizer.cs
+++ src/SimpleSoft.IniParser/Impl/IniNormalizer.cs
@@ -114,7 +114,44 @@
         /// <inheritdoc />
         public void NormalizeInto(IEnumerable<IniSection> source, ICollection<IniSection> destination)
         {
-            throw new NotImplementedException();
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (destination == null)
+                throw new ArgumentNullException(nameof(destination));
+
+            if (!Options.IncludeEmptySections)
+                source = source.Where(e => !e.IsEmpty);
+
+            var itemsToCopy = source.Select(Normalize);
+
+            var dictionary = new Dictionary<string, IniSection>();
+            if (Options.MergeOnDuplicatedSections)
+            {
+                foreach (var sectionGroup in itemsToCopy.GroupBy(e => e.Name))
+                {
+                    var mergedSection = new IniSection(sectionGroup.Key);
+                    foreach (var section in sectionGroup)
+                    {
+                        CopyComments(section.Comments, mergedSection.Comments);
+                        foreach (var property in section.Properties)
+                            mergedSection.Properties.Add(property);
+                    }
+                    dictionary[sectionGroup.Key] = Normalize(mergedSection);
+                }
+            }
+            else
+            {
+                foreach (var section in itemsToCopy)
+                {
+                    if (Options.ThrowExceptions &&
+                        dictionary.ContainsKey(section.Name))
+                        throw new DuplicatedSection(section.Name);
+                    dictionary[section.Name] = section;
+                }
+            }
+
+            foreach (var section in dictionary.Values)
+                destination.Add(section);
         }

         /// <inheritdoc />
@@ -131,7 +168,54 @@
         /// <inheritdoc />
         public bool TryNormalizeInto(IEnumerable<IniSection> source, ICollection<IniSection> destination)
         {
-            throw new NotImplementedException();
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (destination == null)
+                throw new ArgumentNullException(nameof(destination));
+
+            if (!Options.IncludeEmptySections)
+                source = source.Where(e => !e.IsEmpty);
+
+            var itemsToCopy = new List<IniSection>();
+            foreach (var section in source)
+            {
+                IniSection normalizedSection;
+                if(TryNormalize(section, out normalizedSection))
+                    itemsToCopy.Add(section);
+                return false;
+            }
+
+            var dictionary = new Dictionary<string, IniSection>();
+            if (Options.MergeOnDuplicatedSections)
+            {
+                foreach (var sectionGroup in itemsToCopy.GroupBy(e => e.Name))
+                {
+                    var mergedSection = new IniSection(sectionGroup.Key);
+                    foreach (var section in sectionGroup)
+                    {
+                        CopyComments(section.Comments, mergedSection.Comments);
+                        foreach (var property in section.Properties)
+                            mergedSection.Properties.Add(property);
+                    }
+
+                    if (TryNormalize(mergedSection, out mergedSection))
+                        dictionary[sectionGroup.Key] = mergedSection;
+                    return false;
+                }
+            }
+            else
+            {
+                foreach (var section in itemsToCopy)
+                {
+                    if (dictionary.ContainsKey(section.Name))
+                        return false;
+                    dictionary[section.Name] = section;
+                }
+            }
+
+            foreach (var section in dictionary.Values)
+                destination.Add(section);
+            return true;
         }

         /// <inheritdoc />


Make field 'cookies' readonly

Make field 'cookies' readonly

--- src/SocksSharp/Proxy/Request/RequestBuilder.cs
+++ src/SocksSharp/Proxy/Request/RequestBuilder.cs
@@ -15,7 +15,7 @@
         private readonly string newLine = "\r\n";

         private readonly HttpRequestMessage request;
-        private CookieContainer cookies;
+        private readonly CookieContainer cookies;

         public RequestBuilder(HttpRequestMessage request) : this(request, null)


apply review change

apply review change

--- osu.Framework/Configuration/BindableSize.cs
+++ osu.Framework/Configuration/BindableSize.cs
@@ -19,9 +19,6 @@
         {
             switch (input)
             {
-                case Size s:
-                    Value = s;
-                    break;
                 case string str:
                     if (!str.Contains("x"))
                         throw new ArgumentException($"Input string was in wrong format! (expected: '<width>x<height>', actual: '{str}')");
@@ -30,7 +27,8 @@
                     Value = new Size(int.Parse(split[0]), int.Parse(split[1]));
                     break;
                 default:
-                    throw new ArgumentException($"Could not parse provided {input.GetType()} ({input}) to {typeof(Size)}.");
+                    base.Parse(input);
+                    break;
             }
         }
     }


Fix potentially adding null skin sources

--- osu.Game/Skinning/SkinProvidingContainer.cs
+++ osu.Game/Skinning/SkinProvidingContainer.cs
@@ -51,10 +51,11 @@
         /// <summary>
         /// Constructs a new <see cref="SkinProvidingContainer"/> initialised with a single skin source.
         /// </summary>
-        public SkinProvidingContainer(ISkin skin)
+        public SkinProvidingContainer([CanBeNull] ISkin skin)
             : this()
         {
-            SkinSources.Add(skin);
+            if (skin != null)
+                SkinSources.Add(skin);
         }

         /// <summary>


Don't access UmbracoContext if there is none

--- src/Umbraco.Web/Templates/TemplateUtilities.cs
+++ src/Umbraco.Web/Templates/TemplateUtilities.cs
@@ -19,17 +19,24 @@
         internal static string ParseInternalLinks(string text, bool preview)
 	    {
             // save and set for url provider
-            var inPreviewMode = UmbracoContext.Current.InPreviewMode;
-            UmbracoContext.Current.InPreviewMode = preview;
+            if (UmbracoContext.Current != null)
+            {
+                var inPreviewMode = UmbracoContext.Current.InPreviewMode;
+                UmbracoContext.Current.InPreviewMode = preview;

-            try
+                try
+                {
+                    text = ParseInternalLinks(text);
+                }
+                finally
+                {
+                    // restore
+                    UmbracoContext.Current.InPreviewMode = inPreviewMode;
+                }
+            }
+            else
             {
                 text = ParseInternalLinks(text);
-            }
-            finally
-            {
-                // restore
-                UmbracoContext.Current.InPreviewMode = inPreviewMode;
             }

             return text;


1) Fixed a few command line interface bugs<F2>:wq

--- scallion/Program.cs
+++ scallion/Program.cs
@@ -68,7 +68,8 @@
 					value = new KeyValuePair<string, object>(((FieldInfo)field).Name, ((FieldInfo)field).GetValue(this));
 				else if (field as PropertyInfo != null)
 					value = new KeyValuePair<string, object>(((PropertyInfo)field).Name, ((PropertyInfo)field).GetValue(this, null));
-				if (value.Value.GetType() == typeof(uint))
+                if (value.Value == null) continue;
+                if (value.Value.GetType() == typeof(uint))
 					builder.AppendLine(string.Format("#define {0} {1}", value.Key, value.Value));
 				if (value.Value.GetType() == typeof(KernelType))
 					builder.AppendLine(string.Format("#define KT_{0}", value.Value));
@@ -109,8 +110,8 @@
 		}
 		public static void Help(OptionSet p)
 		{
-			Console.WriteLine("Usage: scallion [OPTIONS]+ prefix suffix");
-			Console.WriteLine("Searches for a tor hidden service address that starts with the provided prefix and ends with the provided suffix.");
+            Console.WriteLine("Usage: scallion [OPTIONS]+ regex [regex]+");
+            Console.WriteLine("Searches for a tor hidden service address that matches one of the provided regexs.");
 			Console.WriteLine();
 			Console.WriteLine("Options:");
 			p.WriteOptionDescriptions(Console.Out);
@@ -131,7 +132,7 @@
                 .Add<uint>("t|cputhreads=", "Specifies the number of CPU threads to use when creating work. (EXPERIMENTAL - OpenSSL not thread-safe)", (i) => parms.CpuThreads = i)
                 .Add<string>("p|save-kernel=", "Saves the generated kernel to this path.", (i) => parms.SaveGeneratedKernelPath = i)
 				.Add<string>("o|output=", "Saves the generated key(s) and address(es) to this path.", (i) => parms.KeyOutputPath = i)
-                .Add<bool>("c|continue", "When a key is found the program will continue to search for keys rather than exiting.", (i) => parms.ContinueGeneration = i)
+                .Add("c|continue", "When a key is found the program will continue to search for keys rather than exiting.", (i) => { if (!string.IsNullOrEmpty(i)) parms.ContinueGeneration = true; })
                 ;

 			List<string> extra = p.Parse(args);


correct media type parsing

correct media type parsing

--- Core/MediaType.cs
+++ Core/MediaType.cs
@@ -119,7 +119,10 @@
             }
             mediaType = mediaType.Trim();

-            MediaType type = new MediaType();
+            MediaType type = new MediaType()
+            {
+                Parameters = new Dictionary<string, string>()
+            };
             StringBuilder storage = new StringBuilder();
             PState state = PState.SuperType;

@@ -155,10 +158,8 @@
                     // subtype.
                     if (c == SubTypeSeparator)
                     {
-                        // Move past the separator character.
-                        i++;
                         // Set the section start variable.
-                        sectionStart = i;
+                        sectionStart = i + 1;
                         // It's possible that there will be a prefix before
                         // the subtype, so we need to switch to this state
                         // before the subtype state.
@@ -219,11 +220,11 @@
                         // If the length of the data in storage is longer
                         // than the longest prefix, it won't be a prefix
                         // we recognise.
-                        storage.Length < longestPrefix ||
+                        storage.Length > longestPrefix ||
                         // If the longest possible length is shorter than
                         // the shortest prefix, it, again, won't be a prefix
                         // that we recognise.
-                        (mediaType.Length - i) + storage.Length > shortestPrefix
+                        (mediaType.Length - i) + storage.Length < shortestPrefix
                         )
                     {
                         // We won't be recognising a prefix, so switch to the
@@ -261,14 +262,21 @@
                             storage.Clear();
                             // Set the MediaType's property.
                             type.Category = pfx;
-                            // Advance past the separator.
-                            i++;
                             // Set the new section start value.
-                            sectionStart = i;
+                            sectionStart = i + 1;
                         }

                         // Regardless of the above outcome, we need to
                         // switch to the subtype state.
+                        state = PState.SubType;
+                    }
+                    // If we find one of these characters, we probably aren't
+                    // in a prefix, and we may instead be in a subtype.
+                    else if (c == SuffixSeparator || c == ParameterSeparator)
+                    {
+                        // Cancel out the for-loop's increment.
+                        --i;
+                        // Switch to the subtype-parsing state.
                         state = PState.SubType;
                     }
                     // Otherwise, we need to check that the character is valid.
@@ -311,8 +319,6 @@
                     // have to switch to a new state.
                     if (c == SuffixSeparator || c == ParameterSeparator)
                     {
-                        // Advance past the separator.
-                        i++;
                         // Set the MediaType's subtype property.
                         type.SubType = storage.ToString().ToLower();
                         // Clear storage.
@@ -364,10 +370,8 @@
                     // parameter parsing.
                     if (c == ParameterSeparator)
                     {
-                        // Advance past separator.
-                        i++;
                         // Set the new section start value.
-                        sectionStart = i;
+                        sectionStart = i + 1;
                         // Set the MediaType's suffix value.
                         type.Suffix = storage.ToString().ToLower();
                         // Clear the storage.
@@ -388,8 +392,6 @@
                 }
                 else if (state == PState.Parameter)
                 {
-                    type.Parameters = new Dictionary<string, string>();
-
                     // Move past any leading whitespace.
                     while (Char.IsWhiteSpace(mediaType[i])) i++;
                     // Set new current character.
@@ -399,8 +401,8 @@
                     // Read up to the first equals sign, which signifies
                     // the end of the parameter's key.
                     while (
-                        mediaType[i] != EqualsSign &&
-                        i < mediaType.Length
+                        i < mediaType.Length &&
+                        mediaType[i] != EqualsSign
                         ) i++;

                     // There is no equals sign in the parameter. We'll still
@@ -429,20 +431,18 @@
                         // Read up until a semicolon, which separates
                         // parameters.
                         while (
-                            mediaType[i] == ParameterSeparator &&
-                            i < mediaType.Length
+                            i < mediaType.Length &&
+                            mediaType[i] != ParameterSeparator
                             ) i++;

-                        // There isn't a semicolon, which indicates that there
-                        // is only one key-value parameter.
-                        if (i >= mediaType.Length)
-                        {
-                            type.Parameters.Add(
-                                key,
-                                mediaType.Substring(paramStart)
-                                );
-                        }
-                        else
+                        string val = mediaType.Substring(
+                            paramStart, i - paramStart);
+                        type.Parameters.Add(
+                            key,
+                            val
+                            );
+
+                        if (i < mediaType.Length)
                         {
                             // Skip past the semicolon.
                             i++;


[削除]MapReaderOption.ChipList

[削除]MapReaderOption.ChipList

現在使用しておらず、使用方法も定まっていないため。

--- Data/MapReader.cs
+++ Data/MapReader.cs
@@ -9,7 +9,6 @@
     public class MapReaderOption
     {
         public IInput Input = NullInput.Instance;
-        public IList<TileChip> ChipList = null;
     }

     public static class MapReader


[packages,Python,3.5.1] Some type sizes are defined in a header on OSX

--- packages/Python-3.5.1/bam/Scripts/Python.cs
+++ packages/Python-3.5.1/bam/Scripts/Python.cs
@@ -118,19 +118,20 @@
                 if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.OSX))
                 {
                     writeFile.WriteLine("#define SIZEOF_WCHAR_T 4");
+                    // see Include/pymacconfig.h for some defines
                 }
                 else
                 {
                     writeFile.WriteLine("#define SIZEOF_WCHAR_T 2");
+                    writeFile.WriteLine("#define SIZEOF_LONG 8");
+                    writeFile.WriteLine("#define SIZEOF_SIZE_T 8");
+                    writeFile.WriteLine("#define SIZEOF_VOID_P 8");
+                    writeFile.WriteLine("#define VA_LIST_IS_ARRAY 1");
                 }
-                writeFile.WriteLine("#define SIZEOF_LONG 8");
                 writeFile.WriteLine("#define SIZEOF_LONG_LONG 8");
                 writeFile.WriteLine("#define SIZEOF_INT 4");
                 writeFile.WriteLine("#define SIZEOF_SHORT 2");
-                writeFile.WriteLine("#define SIZEOF_VOID_P 8");
-                writeFile.WriteLine("#define SIZEOF_SIZE_T 8");
                 writeFile.WriteLine("#define SIZEOF_OFF_T 8");
-                writeFile.WriteLine("#define VA_LIST_IS_ARRAY 1");
                 writeFile.WriteLine("#define HAVE_STDARG_PROTOTYPES");
                 writeFile.WriteLine("#define HAVE_UINTPTR_T");
                 writeFile.WriteLine("#define HAVE_WCHAR_H");


Fix null ref exception if 'Accept' header is not specified

--- prometheus-net/MetricServer.cs
+++ prometheus-net/MetricServer.cs
@@ -43,8 +43,9 @@
             const string text = "text/plain; version=0.0.4";

             string type = PROTO_HEADER;
-
-            if (!context.Request.Headers.Get("Accept").Replace(" ", "").Contains(ProtoHeaderNoSpace))
+
+            var acceptHeader = context.Request.Headers.Get("Accept");
+            if (acceptHeader == null || !acceptHeader.Replace(" ", "").Contains(ProtoHeaderNoSpace))
             {
                 type = text;
             }


Use indented format for XML output

Use indented format for XML output

--HG--
extra : convert_revision : charlie%40nunit.org-20101019003117-lk3f0zcj02u0jqj0

--- src/runner/ConsoleRunner.cs
+++ src/runner/ConsoleRunner.cs
@@ -105,6 +105,7 @@
                     Console.SetError(savedError);

                     XmlTextWriter resultWriter = new XmlTextWriter("TestResult.Xml", System.Text.Encoding.UTF8);
+					resultWriter.Formatting = Formatting.Indented;
                     resultNode.WriteTo(resultWriter);
                     resultWriter.Close();


* Corrected documentation comments

* Corrected documentation comments

--- projects/Core/Implementation/Invoker.cs
+++ projects/Core/Implementation/Invoker.cs
@@ -51,12 +51,12 @@
         /// <param name="fieldName">String with the name of the field to be invoked</param>
         /// <returns>
         /// An <see cref="IGetSetInvoker"/> that will establish the operation to
-        /// perform over the field specifyed by the <param name="fieldName">fieldName</param>
+        /// perform over the field specifyed by the fieldName parameter.
         /// </returns>
         public IGetSetInvoker Field(string fieldName)
         {
             if (OperationName != string.Empty)
-                throw new AlreadyDefinedOparationNameException();
+                throw new AlreadyDefinedOperationNameException();

             OperationName = fieldName;
             OperationType = EGetSetInvokerOperation.Field;
@@ -79,7 +79,7 @@
         public IMethodInvoker Method(string methodName)
         {
             if (OperationName != string.Empty)
-                throw new AlreadyDefinedOparationNameException();
+                throw new AlreadyDefinedOperationNameException();

             OperationName = methodName;

@@ -106,9 +106,10 @@

         /// <summary>
         /// Adds a parameter to the method call, passed with reference semantics
+        /// </summary>
         /// <param name="value">object to be passed as parameter</param>
         /// <returns>
-        /// A reference to the object which made this operation
+        /// A reference to the instance which called this operation.
         /// </returns>
         public IMethodInvoker AddRefParameter(object value)
         {
@@ -139,7 +140,7 @@
             object retValue;
             object[] args;

-            args = InnerParameterBuilder.AsArray;
+            args = InnerParameterBuilder.GetParametersAsArray();

             if (InnerParameterBuilder.Count <= 0)
             {
@@ -155,7 +156,7 @@
                 ParameterModifier refParams = new ParameterModifier(args.Length);
                 for (int i = 0; i < args.Length; ++i)
                 {
-                    refParams[i] = InnerParameterBuilder.ISReferenceParameter[i];
+                    refParams[i] = InnerParameterBuilder.GetReferenceParameterList()[i];
                 }

                 CommonLateBindingOperations.CallOperation(
@@ -213,12 +214,12 @@
         /// <param name="propertyName">String with the name of the property to be invoked</param>
         /// <returns>
         /// An <see cref="IGetSetInvoker"/> that will establish the operation to
-        /// perform over the property specifyed by the <param name="propertyName">property name</param>
+        /// perform over the property specifyed by the propertyName parameter.
         /// </returns>
         public IGetSetInvoker Property(string propertyName)
         {
             if (OperationName != string.Empty)
-                throw new AlreadyDefinedOparationNameException();
+                throw new AlreadyDefinedOperationNameException();

             OperationName = propertyName;
             OperationType = EGetSetInvokerOperation.Property;
@@ -257,7 +258,7 @@
             if (OperationType == EGetSetInvokerOperation.Index)
             {
                 op = EOperationType.PropertyGet;
-                args = new object[] { InnerParameterBuilder.AsArray[0] };
+                args = new object[] { InnerParameterBuilder.GetParametersAsArray()[0] };
             }
             else
             {
@@ -314,7 +315,7 @@
             if (OperationType == EGetSetInvokerOperation.Index)
             {
                 op = EOperationType.PropertySet;
-                args = new object[] {InnerParameterBuilder.AsArray[0], obj };
+                args = new object[] {InnerParameterBuilder.GetParametersAsArray()[0], obj };
             }
             else
             {
@@ -343,13 +344,14 @@
         /// Performs indexer access over a type.
         /// </summary>
         /// <param name="index">object used as indexer</param>
+        /// <returns>
         /// An <see cref="IGetSetInvoker"/> that will establish the operation to
         /// perform over the specifyed index.
         /// </returns>
         public IGetSetInvoker Index(object index)
         {
             if (OperationName != string.Empty)
-                throw new AlreadyDefinedOparationNameException();
+                throw new AlreadyDefinedOperationNameException();

             OperationName = "Item";
             OperationType = EGetSetInvokerOperation.Index;


update command descriptions

update command descriptions

--- dotnet-sourcelink/Program.cs
+++ dotnet-sourcelink/Program.cs
@@ -101,7 +101,7 @@

         static void PrintUrls(CommandLineApplication command)
         {
-            command.Description = "print the urls for each document too based on the source link json";
+            command.Description = "print the URLs for each document based on the Source Link JSON";
             var pdbOption = command.Option("-p|--pdb <PDB>", "set path to Porable PDB", CommandOptionType.SingleValue);
             command.HelpOption("-h|--help");

@@ -146,7 +146,7 @@

         static void TestUrls(CommandLineApplication command)
         {
-            command.Description = "print the urls for each document too based on the source link json";
+            command.Description = "test each URL and verify that the checksums from the Portable PDB match";
             var pdbOption = command.Option("-p|--pdb <PDB>", "set path to Porable PDB", CommandOptionType.SingleValue);
             command.HelpOption("-h|--help");


[Gen] Remove left-over ReadNative method generation.

--- generator/StructBase.cs
+++ generator/StructBase.cs
@@ -30,7 +30,6 @@
 	public abstract class StructBase : ClassBase, IManualMarshaler {

 		new ArrayList fields = new ArrayList ();
-		bool need_read_native = false;

 		protected StructBase (XmlElement ns, XmlElement elem) : base (ns, elem)
 		{
@@ -170,13 +169,10 @@
 			sw.WriteLine ("\t" + access + " struct " + Name + " {");
 			sw.WriteLine ();

-			need_read_native = false;
 			GenFields (gen_info);
 			sw.WriteLine ();
 			GenCtors (gen_info);
 			GenMethods (gen_info, null, this);
-			if (need_read_native)
-				GenReadNative (sw);

 			if (!need_close)
 				return;
@@ -218,22 +214,12 @@
 			base.GenCtors (gen_info);
 		}

-		void GenReadNative (StreamWriter sw)
-		{
-			sw.WriteLine ("\t\tstatic void ReadNative (IntPtr native, ref {0} target)", QualifiedName);
-			sw.WriteLine ("\t\t{");
-			sw.WriteLine ("\t\t\ttarget = New (native);");
-			sw.WriteLine ("\t\t}");
-			sw.WriteLine ();
-		}
-
 		public override void Prepare (StreamWriter sw, string indent)
 		{
 		}

 		public override void Finish (StreamWriter sw, string indent)
 		{
-			need_read_native = true;
 		}
 	}
 }


Autolaunch

Autolaunch

--- src/Address.cs
+++ src/Address.cs
@@ -227,49 +227,52 @@
 							// See function _dbus_daemon_publish_session_bus_address() inside the daemon.
 							result = GetSessionBusAddressFromSharedMemory ();
 							if (string.IsNullOrEmpty (result))
-								result = "autolaunch:";
-						}
-
-						for (int j=0; j<2; j++)
-						{
-							IntPtr mapping = OpenFileMapping (FileRights.Read, false, "DBusDaemonAddressInfo"+prefix);
-							if (mapping != IntPtr.Zero) {
-								IntPtr p = MapViewOfFile (mapping, FileRights.Read, 0, 0, 0);
-								if (p != IntPtr.Zero) {
-									result = Marshal.PtrToStringAnsi (p);
-									UnmapViewOfFile (p);
+								prefix = String.Empty;
+						}
+
+						if (string.IsNullOrEmpty (result))
+						{
+							for (int j=0; j<2; j++)
+							{
+								IntPtr mapping = OpenFileMapping (FileRights.Read, false, "DBusDaemonAddressInfo"+prefix);
+								if (mapping != IntPtr.Zero) {
+									IntPtr p = MapViewOfFile (mapping, FileRights.Read, 0, 0, 0);
+									if (p != IntPtr.Zero) {
+										result = Marshal.PtrToStringAnsi (p);
+										UnmapViewOfFile (p);
+									}
+									CloseHandle (mapping);
+									if (result != null)
+									{
+										break;
+									}
 								}
-								CloseHandle (mapping);
-								if (result != null)
+
+								if (!File.Exists (installPath + "bin" + Path.DirectorySeparatorChar + "dbus-launch.exe"))
 								{
 									break;
 								}
+
+								ProcessStartInfo info = new ProcessStartInfo ();
+								info.WorkingDirectory = installPath + "bin" + Path.DirectorySeparatorChar;
+								info.FileName = installPath + "bin" + Path.DirectorySeparatorChar + "dbus-launch.exe";
+								info.Arguments = "--session";
+								info.LoadUserProfile = false;
+								info.WindowStyle = ProcessWindowStyle.Hidden;
+								info.UseShellExecute = false;
+								info.CreateNoWindow = true;
+								info.RedirectStandardError = true;
+								info.RedirectStandardInput = true;
+								info.RedirectStandardOutput = true;
+								info.StandardErrorEncoding = Encoding.UTF8;
+								info.StandardOutputEncoding = Encoding.UTF8;
+
+								Process process = new Process ();
+								process.StartInfo = info;
+								process.Start ();
+								process.WaitForExit (5000);
+								Thread.Sleep(5000);
 							}
-
-							if (!File.Exists (installPath + "bin" + Path.DirectorySeparatorChar + "dbus-launch.exe"))
-							{
-								break;
-							}
-
-							ProcessStartInfo info = new ProcessStartInfo ();
-							info.WorkingDirectory = installPath + "bin" + Path.DirectorySeparatorChar;
-							info.FileName = installPath + "bin" + Path.DirectorySeparatorChar + "dbus-launch.exe";
-							info.Arguments = "--session";
-							info.LoadUserProfile = false;
-							info.WindowStyle = ProcessWindowStyle.Hidden;
-							info.UseShellExecute = false;
-							info.CreateNoWindow = true;
-							info.RedirectStandardError = true;
-							info.RedirectStandardInput = true;
-							info.RedirectStandardOutput = true;
-							info.StandardErrorEncoding = Encoding.UTF8;
-							info.StandardOutputEncoding = Encoding.UTF8;
-
-							Process process = new Process ();
-							process.StartInfo = info;
-							process.Start ();
-							process.WaitForExit (5000);
-							Thread.Sleep(5000);
 						}
 					}
 				}


green: change Bau  - add task name next to alias on inner log messages  - changed error message to reference specific tasks

--- src/Bau/Bau.cs
+++ src/Bau/Bau.cs
@@ -75,6 +75,17 @@
                     throw new ArgumentException(message.ToString(), "aliases");
                 }

+                var existingTaskWithAlias = this.tasks.Values.FirstOrDefault(task => task.Aliases.Contains(alias));
+                if (existingTaskWithAlias != null)
+                {
+                    var message = string.Format(
+                        "The 'nd' task alias cannot be used for '{0}' because it has already been used for '{1}'.",
+                        this.currentTask.Name,
+                        existingTaskWithAlias.Name);
+
+                    throw new ArgumentException(message, "aliases");
+                }
+
                 this.currentTask.Aliases.Add(alias);
             }

@@ -103,12 +114,18 @@
         {
             var taskRef = this.GetTask(task);

+            var taskTokens = GetTaskTokens(task, taskRef);
             var suffix = taskRef.Invoked ? null : " (first time)";
-            Log.Trace(new ColorText("Invoking '", new ColorToken(task, Log.TaskColor), "'", suffix, "."));
+            Log.Trace(new ColorText(
+                new ColorToken[] { "Invoking " }.Concat(taskTokens).Concat(new ColorToken[] { suffix, "." }).ToArray()));
+
             if (taskRef.Invoked)
             {
                 Log.Trace(new ColorText(
-                    "Already invoked '", new ColorToken(task, Log.TaskColor), "'. Ignoring invocation."));
+                    new ColorToken[] { "Already invoked " }
+                        .Concat(taskTokens)
+                        .Concat(new ColorToken[] { ". Ignoring invocation." })
+                        .ToArray()));

                 return;
             }
@@ -234,7 +251,9 @@
         {
             var stopwatch = new Stopwatch();
             stopwatch.Start();
-            Log.Info(new ColorText("Starting '", new ColorToken(task, Log.TaskColor), "'..."));
+            var taskTokens = GetTaskTokens(task, taskRef);
+            Log.Info(new ColorText(
+                new ColorToken[] { "Starting " }.Concat(taskTokens).Concat(new ColorToken[] { "..." }).ToArray()));

             try
             {
@@ -243,21 +262,44 @@
             catch (Exception ex)
             {
                 var message = new ColorText(
-                    "'",
-                    new ColorToken(task, Log.TaskColor),
-                    "' task failed. ",
-                    new ColorToken(ex.Message, ConsoleColor.DarkRed));
+                    taskTokens
+                        .Concat(new ColorToken[] { " task failed. ", new ColorToken(ex.Message, ConsoleColor.DarkRed) })
+                        .ToArray());

                 Log.Error(message);
                 throw new InvalidOperationException(message.ToString());
             }

             Log.Info(new ColorText(
-                "Finished '",
-                new ColorToken(task, Log.TaskColor),
-                "' after ",
-                new ColorToken(stopwatch.Elapsed.TotalMilliseconds.ToStringFromMilliseconds(), ConsoleColor.DarkYellow),
-                "."));
+                new ColorToken[] { "Finished " }
+                    .Concat(taskTokens)
+                    .Concat(new ColorToken[]
+                        {
+                            " after ",
+                            new ColorToken(stopwatch.Elapsed.TotalMilliseconds.ToStringFromMilliseconds(), ConsoleColor.DarkYellow),
+                            "."
+                        })
+                    .ToArray()));
+        }
+
+        private static ColorToken[] GetTaskTokens(string task, IBauTask taskRef)
+        {
+            return task == taskRef.Name
+                ? new ColorToken[]
+                    {
+                        "'",
+                        new ColorToken(task, Log.TaskColor),
+                        "'",
+                    }
+                : new ColorToken[]
+                    {
+                        "'",
+                        new ColorToken(task, Log.TaskColor),
+                        "'",
+                        " ('",
+                        new ColorToken(taskRef.Name, Log.TaskColor),
+                        "')",
+                    };
         }

         private void EnsureCurrentTask()
@@ -272,17 +314,7 @@
         {
             try
             {
-                var taskWithAlias = this.tasks.Values.SingleOrDefault(v => v.Aliases.Contains(task));
-                if (taskWithAlias != null)
-                {
-                    task = taskWithAlias.Name;
-
-                    Log.Info(new ColorText(
-                                 "Actual task name '",
-                                 new ColorToken(task, Log.TaskColor),
-                                 "'"));
-                }
-                return this.tasks[task];
+                return this.tasks.Values.FirstOrDefault(v => v.Aliases.Contains(task)) ?? this.tasks[task];
             }
             catch (KeyNotFoundException ex)
             {
@@ -294,16 +326,6 @@
                 Log.Error(message);
                 throw new InvalidOperationException(message.ToString(), ex);
             }
-            catch (InvalidOperationException ex)
-            {
-                var message = new ColorText(
-                    "'",
-                    new ColorToken(task, Log.TaskColor),
-                    "' alias was assigned for multiple tasks.");
-
-                Log.Error(message);
-                throw new InvalidOperationException(message.ToString(), ex);
-            }
         }
     }
 }


(maint) Corrected GitHub and AppVeyor details


Redirect standard error and throw exception if error occurs during creation of LocalDB instance.

--- src/Core/LocalDb.cs
+++ src/Core/LocalDb.cs
@@ -142,11 +142,13 @@
                 Arguments = "info",
                 FileName = "sqllocaldb.exe",
                 RedirectStandardOutput = true,
+                RedirectStandardError = true,
                 UseShellExecute = false,
                 WindowStyle = ProcessWindowStyle.Hidden
             };

             var standardOutput = new StringBuilder();
+            var standardError = new StringBuilder();

             using (var process = Process.Start(startInfo))
             {
@@ -154,17 +156,24 @@
                 while (!process.HasExited)
                 {
                     standardOutput.Append(process.StandardOutput.ReadToEnd());
+                    standardError.Append(process.StandardError.ReadToEnd());
                 }

                 // make sure not to miss out on any remaindings.
                 standardOutput.Append(process.StandardOutput.ReadToEnd());
-            }
+                standardError.Append(process.StandardError.ReadToEnd());
+            }
+
+            var error = standardError.ToString();
+            if (!string.IsNullOrEmpty(error))
+                throw new ApplicationException(error);

             var instances = standardOutput.ToString().Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

             if (!instances.Any(i => i.Trim().Equals(Version)))
             {
-                standardOutput = new StringBuilder();
+                standardOutput.Clear();
+                standardError.Clear();

                 startInfo.Arguments = string.Format("create \"{0}\" {1} -s", Version, Version.Replace("v", ""));

@@ -174,11 +183,17 @@
                     while (!process.HasExited)
                     {
                         standardOutput.Append(process.StandardOutput.ReadToEnd());
+                        standardError.Append(process.StandardError.ReadToEnd());
                     }

                     // make sure not to miss out on any remaindings.
                     standardOutput.Append(process.StandardOutput.ReadToEnd());
-                }
+                    standardError.Append(process.StandardError.ReadToEnd());
+                }
+
+                error = standardError.ToString();
+                if (!string.IsNullOrEmpty(error))
+                    throw new ApplicationException(error);

                 //Check if output says that instance is started
                 var expectedOutput = string.Format("LocalDB instance \"{0}\" started.", Version);


Clearer member naming in PPU

Clearer member naming in PPU

--- elbgb.gameboy/Display/PPU.cs
+++ elbgb.gameboy/Display/PPU.cs
@@ -26,12 +26,11 @@
 		private byte[] _vram;
 		private byte[] _oam;

-		private byte _scy;
-		private byte _scx;
+		private byte _scrollY, _scrollX;

 		private uint _scanlineClocks; // counter of clock cycles elapsed in the current scanline

-		private byte _ly; // current scanline value
+		private byte _currentScanline;

 		public PPU(GameBoy gameBoy)
 			: base(gameBoy)
@@ -47,13 +46,13 @@
 			switch (address)
 			{
 				case Registers.SCY:
-					return _scy;
+					return _scrollY;

 				case Registers.SCX:
-					return _scx;
+					return _scrollX;

 				case Registers.LY:
-					return _ly;
+					return _currentScanline;
 			}

 			throw new ArgumentOutOfRangeException("address");
@@ -76,10 +75,10 @@
 				switch (address)
 				{
 					case Registers.SCY:
-						_scy = value; break;
+						_scrollY = value; break;

 					case Registers.SCX:
-						_scx = value; break;
+						_scrollX = value; break;

 					default:
 						throw new ArgumentOutOfRangeException("address");
@@ -96,11 +95,11 @@
 			if (_scanlineClocks >= 456)
 			{
 				_scanlineClocks -= 456;
-				_ly++;
+				_currentScanline++;

-				if (_ly > 153)
+				if (_currentScanline > 153)
 				{
-					_ly = 0;
+					_currentScanline = 0;
 				}
 			}
 		}


rename private method variable

rename private method variable

--- src/Command.cs
+++ src/Command.cs
@@ -21,7 +21,7 @@
         private static Regex nonCapturingPattern = new Regex(@"\(\?(?:[^<=]|<=|<!).*?\)", RegexOptions.Compiled);
         public static Regex PickupPattern = new Regex(@"\$\{(.+?)\}", RegexOptions.Compiled);
         private Pickup _pickup = new Pickup();
-        private String[] parts;
+        private String[] _parts;

         public enum CommandType {
             Pickup,
@@ -54,14 +54,14 @@
                     Style = CommandType.Anchored;
                 }

-                parts = rawcommand.Split(delim.ToCharArray(), 4);
-                SubjectString = RemoveEnclosingQuotesIfPresent(parts[0].Trim());
+                _parts = rawcommand.Split(delim.ToCharArray(), 4);
+                SubjectString = RemoveEnclosingQuotesIfPresent(_parts[0].Trim());
                 SubjectString = _pickup.ReplaceShorthandPatternWithFormalRegex(SubjectString);
                 SubjectRegex = new Regex(SubjectString, RegexOptions.Compiled);
-                if (parts.Length == 2)
-                    ReplacementString = RemoveEnclosingQuotesIfPresent(parts[1].Trim());
+                if (_parts.Length == 2)
+                    ReplacementString = RemoveEnclosingQuotesIfPresent(_parts[1].Trim());
                 SetType();
-                if (parts.Length == 1)
+                if (_parts.Length == 1)
                     Style = CommandType.Pickup;
             } catch (Exception e) {
                 Console.WriteLine("Regex error Command, from '{0}'  to '{1}'  AnchorString '{2}'", SubjectString,
@@ -98,7 +98,7 @@
                 logger.Debug("Subjectstring cannot be empty - command ignored\nanchor:{0} replacementString:{1}", AnchorString, ReplacementString);
                 return false;
             }
-            if (parts.Length > 2)
+            if (_parts.Length > 2)
                 return false;
             return true;
         }


Remove debug code.

Remove debug code.

--- src/Dbus/Encoder.cs
+++ src/Dbus/Encoder.cs
@@ -171,7 +171,6 @@

         public static void AddVariant(List<byte> buffer, ref int index, IDictionary<string, object> value)
         {
-            System.Console.WriteLine("Encoding Dictionary");
             Add(buffer, ref index, (Signature)"a{sv}");
             AddArray(buffer, ref index, (List<byte> buffer_e, ref int index_e) =>
             {


Removed support for not supported instructions in NumCIL as that is now a fatal error

--- bridge/NumCIL/NumCIL.cphVB/cphVBAccessor.cs
+++ bridge/NumCIL/NumCIL.cphVB/cphVBAccessor.cs
@@ -850,92 +850,9 @@
             //Reclaim everything in gen 0
             GC.Collect(0);

-            List<PendingOperation<T>> worklist = null;
-            while (instructions.Count > 0)
-            {
-                try
-                {
-                    VEM.Execute(instructions);
-                    instructions.Clear();
-                    return;
-                }
-                catch (cphVBNotSupportedInstruction cex)
-                {
-                    //If we get here, some arrays may be deallocated by the GC,
-                    // we need to postpone the cleanups until all instructions in the current list are completed
-                    VEM.PreventCleanup = true;
-                    //Remove any instructions that are reported as not being supported
-                    foreach (var n in (from x in OpcodeMap where x.Value == cex.OpCode select x.Key).ToArray())
-                        if (OpcodeMap.Remove(n))
-                            Console.WriteLine(string.Format("Instruction was not supported by the VE: {0} -> {1}", n.FullName, cex.OpCode));
-
-                    //We need to work on this more than once, so we convert it to a list right away
-                    if (worklist == null)
-                        worklist = work.Skip((int)(instructionIndex)).ToList();
-
-                    //Extract the target instruction for inspection
-                    PendingOperation<T> pt = worklist[(int)cex.InstructionNo];
-
-                    //TODO: If the operation in question is found multiple times,
-                    // we could avoid the costly exception for each invocation
-
-                    //Remove executed operations from each operand to prevent double flushing
-                    foreach (var op in pt.Operands)
-                    {
-                        if (op.DataAccessor is LazyAccessor<T>)
-                        {
-                            ILazyAccessor<T> lzt = (ILazyAccessor<T>)op.DataAccessor;
-                            if (lzt.PendingOperations.Count > 0)
-                            {
-                                if (lzt.PendingOperations[lzt.PendingOperations.Count - 1].Clock < pt.Clock)
-                                {
-                                    lzt.PendignOperationOffset += lzt.PendingOperations.Count;
-                                    lzt.PendingOperations.Clear();
-
-                                }
-                                else
-                                {
-                                    while (lzt.PendingOperations.Count > 0 && lzt.PendingOperations[0].Clock < pt.Clock)
-                                    {
-                                        lzt.PendignOperationOffset++;
-                                        lzt.PendingOperations.RemoveAt(0);
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    //The unsupported instruction is now executed by the CIL
-                    base.ExecuteOperations(new PendingOperation<T>[] { pt });
-
-                    //Then remove all the instructions that have been executed
-                    instructions.RemoveRange(0, (int)cex.InstructionNo + 1);
-                    worklist.RemoveRange(0, (int)cex.InstructionNo + 1);
-                    instructionIndex += cex.InstructionNo + 1;
-
-                    //Make sure we manually set the data pointer to all operands that refer to the
-                    // NdArray that was the target of the instruction that was excuted locally
-                    NdArray<T> target = pt.Operands[0];
-                    if (instructions.Count > 0)
-                    {
-                        int i = 0;
-                        foreach (PendingOperation<T> pop in worklist)
-                        {
-                            if (pop.Operands.Any(x => x.DataAccessor == target.DataAccessor))
-                            {
-                                instructions[i] = VEM.ReCreateInstruction<T>(CPHVB_TYPE, instructions[i], pop.Operands);
-
-                            }
-
-                            i++;
-                        }
-                    }
-                }
-            }
-
-            //If we have blocked cleanups, it is now safe to flush them
-            if (VEM.PreventCleanup)
-                VEM.PreventCleanup = false;
+            VEM.Execute(instructions);
+            instructions.Clear();
+            return;
         }

         /// <summary>


Exclude Content-Length header

Exclude Content-Length header

--- HttpMock/Proxy.cs
+++ HttpMock/Proxy.cs
@@ -11,6 +11,15 @@
     public static class Proxy
     {
         private static readonly HttpClient _httpClient = new HttpClient();
+
+        private static readonly string[] _excludedRequestHeaders = new string[] {
+            // Only applies to request between client and proxy
+            "Proxy-Connection",
+
+            // Only allowed to be set on HttpContent (not HttpRequestMessage).  However, StreamContent appears to set
+            // this automatically based on the content stream, so it seems fine to just exclude.
+            "Content-Length"
+        };

         public static async Task<UpstreamResponse> SendUpstreamRequest(HttpRequest request)
         {
@@ -31,7 +40,7 @@

             using (var upstreamRequest = new HttpRequestMessage(new HttpMethod(request.Method), upstreamUri))
             {
-                foreach (var header in request.Headers.Where(h => h.Key != "Proxy-Connection"))
+                foreach (var header in request.Headers.Where(h => !_excludedRequestHeaders.Contains(h.Key)))
                 {
                     upstreamRequest.Headers.Add(header.Key, values: header.Value);
                 }


内蔵LUTの更新機能を追加

内蔵LUTの更新機能を追加

--- ImageLUTLoader.cs
+++ ImageLUTLoader.cs
@@ -7,14 +7,14 @@
 	[ExecuteInEditMode]
     public class ImageLUTLoader : LUTGenerator {
 		[SerializeField]
-		public Texture2D alternativeImage;
+		protected Texture2D alternativeImage;
 		[SerializeField]
-		public ImageLoader loader;
+		protected ImageLoader loader;

 		#region Unity
 		protected override void Awake() {
 			base.Awake();
-			loader.Changed += UpdateLUT;
+			loader.Changed += ListenLoaderOnChanged;
 		}
 		protected void Update() {
 			loader.Validate();
@@ -23,12 +23,28 @@
 			loader.Dispose();
 			base.OnDestroy();
         }
-        #endregion
+		#endregion

-		protected void UpdateLUT (Texture2D tex) {
+		#region public
+		public virtual Texture2D AlternativeImage {
+			get { return alternativeImage; }
+			set {
+				if (alternativeImage != value) {
+					alternativeImage = value;
+					UpdateLUT();
+				}
+			}
+		}
+		#endregion
+
+		protected void ListenLoaderOnChanged(Texture2D tex) {
+			UpdateLUT();
+		}
+		protected void UpdateLUT () {
 			if (lut != null) {
 				var buf = new StringBuilder("UpdateLUT : ");
-				if (tex != null) {
+				if (loader != null && loader.Target != null) {
+					var tex = loader.Target;
 					lut.Convert(tex);
 					buf.AppendFormat(tex.name);
 				} else if (alternativeImage != null) {


add reconnect feature

add reconnect feature

--- csharp/mappingrpc/RpcClient.cs
+++ csharp/mappingrpc/RpcClient.cs
@@ -18,6 +18,7 @@
 		MetaHolder metaHolder = new MetaHolder ();
 		AsyncSocketConnector connector;
 		IoSession ioSession;
+		volatile int connecting = 0;

 		public RpcClient (string host, short port)
 		{
@@ -27,6 +28,22 @@

 		public void start ()
 		{
+			makeConnectionInCallerThread (1);
+		}
+
+		private void makeConnectionInCallerThread(int waitInMs) {
+			if (ioSession != null) {
+				if (ioSession.Connected) {
+					return;
+				}
+			}
+			if (connecting == 1) {
+				return;
+			}
+			int orgValue = Interlocked.CompareExchange (ref connecting, 1, 0);
+			if (orgValue == 1) {
+				return;
+			}
 			connector = new AsyncSocketConnector ();
 			connector.FilterChain.AddLast ("codec", new ProtocolCodecFilter (new CustomPackageFactory ()));
 			connector.FilterChain.AddLast ("logger", new LoggingFilter ());
@@ -38,8 +55,11 @@
 			Console.WriteLine ("connecting...");
 			var addresses = System.Net.Dns.GetHostAddresses(host);
 			var endPoint = new IPEndPoint(addresses[0], port);
-			connector.Connect (endPoint);
-			Thread.Sleep (800);
+			try{
+				connector.Connect (endPoint).Await (waitInMs);
+			}finally{
+				connecting = 0;
+			}
 		}

 		public void onMessageReceived (object sender, IoSessionMessageEventArgs eventArgs)
@@ -59,7 +79,7 @@
 				}
 				return;
 			}
-			if (commandType == MsgTypeConstant.error) {
+			if (commandType == MsgTypeConstant.error) {// TODO
 				long requestId = jsonArray [2].ToObject<int> ();
 				CallResultFuture future = (CallResultFuture)metaHolder.requestPool [requestId];
 				future.done = true;
@@ -72,8 +92,12 @@
 			// TODO 需要改为线程池处理
 		}

-		public T invoke<T> (string mappingUrl, params object[] paramList)
+		public T invoke<T> (int timeoutInMs, string mappingUrl, params object[] paramList)
 		{
+			makeConnectionInCallerThread (15000);
+			if (ioSession == null || !ioSession.Connected) {
+				return default(T);
+			}
 			CallCommand callCmd = new CallCommand ();
 			callCmd.procedureUri = mappingUrl;
 			callCmd.args = paramList;
@@ -82,17 +106,18 @@
 			asyncResult.resultType = typeof(T);
 			ioSession.Write (callCmd);
 			lock (asyncResult.monitorLock) {
-				Monitor.Wait (asyncResult.monitorLock, 1000);
+				Monitor.Wait (asyncResult.monitorLock, timeoutInMs);
 			}
 			if (!asyncResult.done) {
-				return default(T);
+				throw new TimeoutException("{timeoutInMs:" + timeoutInMs +'}');
 			}
 			if (!asyncResult.isExceptionResult) {
 				return (T)asyncResult.result;
 			}
 			if (asyncResult.isExceptionResult) {
-
+				throw new Exception ((string)asyncResult.result);
 			}
+			return default(T);
 		}
 	}
 }