FIX: All controls bar the ColorWheel showed either Black or White if the Lightness was 0% or 100% no matter what hue was selected in the wheel

Also refactored the control

--- Cyotek.Windows.Forms.ColorPicker/ColorEditorManager.cs
+++ Cyotek.Windows.Forms.ColorPicker/ColorEditorManager.cs
@@ -41,15 +41,17 @@

     private ColorEditor _colorEditor;

-    private ColorGrid _grid;
+    private ColorGrid _colorGrid;
+
+    private ColorWheel _colorWheel;

     private HslColor _hslColor;

     private LightnessColorSlider _lightnessColorSlider;

+    private bool _lockUpdates;
+
     private ScreenColorPicker _screenColorPicker;
-
-    private ColorWheel _wheel;

     #endregion Private Fields

@@ -58,43 +60,43 @@
     [Category("Property Changed")]
     public event EventHandler ColorChanged
     {
-      add { this.Events.AddHandler(_eventColorChanged, value); }
-      remove { this.Events.RemoveHandler(_eventColorChanged, value); }
+      add => this.Events.AddHandler(_eventColorChanged, value);
+      remove => this.Events.RemoveHandler(_eventColorChanged, value);
     }

     [Category("Property Changed")]
     public event EventHandler ColorEditorChanged
     {
-      add { this.Events.AddHandler(_eventColorEditorChanged, value); }
-      remove { this.Events.RemoveHandler(_eventColorEditorChanged, value); }
+      add => this.Events.AddHandler(_eventColorEditorChanged, value);
+      remove => this.Events.RemoveHandler(_eventColorEditorChanged, value);
     }

     [Category("Property Changed")]
     public event EventHandler ColorGridChanged
     {
-      add { this.Events.AddHandler(_eventColorGridChanged, value); }
-      remove { this.Events.RemoveHandler(_eventColorGridChanged, value); }
+      add => this.Events.AddHandler(_eventColorGridChanged, value);
+      remove => this.Events.RemoveHandler(_eventColorGridChanged, value);
     }

     [Category("Property Changed")]
     public event EventHandler ColorWheelChanged
     {
-      add { this.Events.AddHandler(_eventColorWheelChanged, value); }
-      remove { this.Events.RemoveHandler(_eventColorWheelChanged, value); }
+      add => this.Events.AddHandler(_eventColorWheelChanged, value);
+      remove => this.Events.RemoveHandler(_eventColorWheelChanged, value);
     }

     [Category("Property Changed")]
     public event EventHandler LightnessColorSliderChanged
     {
-      add { this.Events.AddHandler(_eventLightnessColorSliderChanged, value); }
-      remove { this.Events.RemoveHandler(_eventLightnessColorSliderChanged, value); }
+      add => this.Events.AddHandler(_eventLightnessColorSliderChanged, value);
+      remove => this.Events.RemoveHandler(_eventLightnessColorSliderChanged, value);
     }

     [Category("Property Changed")]
     public event EventHandler ScreenColorPickerChanged
     {
-      add { this.Events.AddHandler(_eventScreenColorPickerChanged, value); }
-      remove { this.Events.RemoveHandler(_eventScreenColorPickerChanged, value); }
+      add => this.Events.AddHandler(_eventScreenColorPickerChanged, value);
+      remove => this.Events.RemoveHandler(_eventScreenColorPickerChanged, value);
     }

     #endregion Public Events
@@ -107,9 +109,9 @@
     /// <value>The component color.</value>
     [Browsable(false)]
     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-    public virtual Color Color
-    {
-      get { return _color; }
+    public Color Color
+    {
+      get => _color;
       set
       {
         if (_color != value)
@@ -127,9 +129,9 @@
     /// </summary>
     [Category("Behavior")]
     [DefaultValue(typeof(ColorEditor), null)]
-    public virtual ColorEditor ColorEditor
-    {
-      get { return _colorEditor; }
+    public ColorEditor ColorEditor
+    {
+      get => _colorEditor;
       set
       {
         if (!object.ReferenceEquals(_colorEditor, value))
@@ -151,19 +153,19 @@
     /// </summary>
     [Category("Behavior")]
     [DefaultValue(typeof(ColorGrid), null)]
-    public virtual ColorGrid ColorGrid
-    {
-      get { return _grid; }
-      set
-      {
-        if (!object.ReferenceEquals(_grid, value))
-        {
-          if (_grid != null)
-          {
-            this.UnbindEvents(_grid);
-          }
-
-          _grid = value;
+    public ColorGrid ColorGrid
+    {
+      get => _colorGrid;
+      set
+      {
+        if (!object.ReferenceEquals(_colorGrid, value))
+        {
+          if (_colorGrid != null)
+          {
+            this.UnbindEvents(_colorGrid);
+          }
+
+          _colorGrid = value;

           this.OnColorGridChanged(EventArgs.Empty);
         }
@@ -175,19 +177,19 @@
     /// </summary>
     [Category("Behavior")]
     [DefaultValue(typeof(ColorWheel), null)]
-    public virtual ColorWheel ColorWheel
-    {
-      get { return _wheel; }
-      set
-      {
-        if (!object.ReferenceEquals(_wheel, value))
-        {
-          if (_wheel != null)
-          {
-            this.UnbindEvents(_wheel);
-          }
-
-          _wheel = value;
+    public ColorWheel ColorWheel
+    {
+      get => _colorWheel;
+      set
+      {
+        if (!object.ReferenceEquals(_colorWheel, value))
+        {
+          if (_colorWheel != null)
+          {
+            this.UnbindEvents(_colorWheel);
+          }
+
+          _colorWheel = value;

           this.OnColorWheelChanged(EventArgs.Empty);
         }
@@ -200,9 +202,9 @@
     /// <value>The component color.</value>
     [Browsable(false)]
     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-    public virtual HslColor HslColor
-    {
-      get { return _hslColor; }
+    public HslColor HslColor
+    {
+      get => _hslColor;
       set
       {
         if (this.HslColor != value)
@@ -220,9 +222,9 @@
     /// </summary>
     [Category("Behavior")]
     [DefaultValue(typeof(LightnessColorSlider), null)]
-    public virtual LightnessColorSlider LightnessColorSlider
-    {
-      get { return _lightnessColorSlider; }
+    public LightnessColorSlider LightnessColorSlider
+    {
+      get => _lightnessColorSlider;
       set
       {
         if (!object.ReferenceEquals(_lightnessColorSlider, value))
@@ -244,9 +246,9 @@
     /// </summary>
     [Category("Behavior")]
     [DefaultValue(typeof(ScreenColorPicker), null)]
-    public virtual ScreenColorPicker ScreenColorPicker
-    {
-      get { return _screenColorPicker; }
+    public ScreenColorPicker ScreenColorPicker
+    {
+      get => _screenColorPicker;
       set
       {
         if (!object.ReferenceEquals(_screenColorPicker, value))
@@ -271,7 +273,11 @@
     /// Gets or sets a value indicating whether updating of linked components is disabled.
     /// </summary>
     /// <value><c>true</c> if updated of linked components is disabled; otherwise, <c>false</c>.</value>
-    protected bool LockUpdates { get; set; }
+    protected bool LockUpdates
+    {
+      get => _lockUpdates;
+      set => _lockUpdates = value;
+    }

     #endregion Protected Properties

@@ -283,11 +289,39 @@
     /// <param name="control">The <see cref="IColorEditor"/> to bind to.</param>
     protected virtual void BindEvents(IColorEditor control)
     {
-      control.ColorChanged += this.ColorChangedHandler;
-
-      if (control is LightnessColorSlider lightnessColorSlider)
-      {
-        lightnessColorSlider.ValueChanged += this.ColorChangedHandler;
+      switch (control)
+      {
+        case ColorWheel colorWheel:
+          colorWheel.HslColorChanged += this.HslColorChangedHandler;
+          break;
+        case LightnessColorSlider lightnessColorSlider:
+          lightnessColorSlider.ValueChanged += this.ColorChangedHandler;
+          break;
+        default:
+          control.ColorChanged += this.ColorChangedHandler;
+          break;
+      }
+    }
+
+    private void HslColorChangedHandler(object sender, EventArgs e)
+    {
+      if (!_lockUpdates)
+      {
+        HslColor color;
+
+        if (sender is ColorWheel colorWheel)
+        {
+          color = colorWheel.HslColor;
+        }
+        else
+        {
+          color = HslColor.Empty;
+        }
+
+        _lockUpdates = true;
+        this.HslColor = color;
+        _lockUpdates = false;
+        this.Synchronize((IColorEditor)sender);
       }
     }

@@ -332,9 +366,9 @@
     {
       EventHandler handler;

-      if (this.ColorGrid != null)
-      {
-        this.BindEvents(this.ColorGrid);
+      if (_colorGrid != null)
+      {
+        this.BindEvents(_colorGrid);
       }

       handler = (EventHandler)this.Events[_eventColorGridChanged];
@@ -350,9 +384,9 @@
     {
       EventHandler handler;

-      if (this.ColorWheel != null)
-      {
-        this.BindEvents(this.ColorWheel);
+      if (_colorWheel != null)
+      {
+        this.BindEvents(_colorWheel);
       }

       handler = (EventHandler)this.Events[_eventColorWheelChanged];
@@ -368,9 +402,9 @@
     {
       EventHandler handler;

-      if (this.LightnessColorSlider != null)
-      {
-        this.BindEvents(this.LightnessColorSlider);
+      if (_lightnessColorSlider != null)
+      {
+        this.BindEvents(_lightnessColorSlider);
       }

       handler = (EventHandler)this.Events[_eventLightnessColorSliderChanged];
@@ -386,9 +420,9 @@
     {
       EventHandler handler;

-      if (this.ScreenColorPicker != null)
-      {
-        this.BindEvents(this.ScreenColorPicker);
+      if (_screenColorPicker != null)
+      {
+        this.BindEvents(_screenColorPicker);
       }

       handler = (EventHandler)this.Events[_eventScreenColorPickerChanged];
@@ -403,9 +437,24 @@
     /// <param name="sender">The <see cref="IColorEditor"/> triggering the update.</param>
     protected virtual void SetColor(IColorEditor control, IColorEditor sender)
     {
-      if (control != null && control != sender)
-      {
-        control.Color = sender.Color;
+      // Interface is fairly useless as it only allows for RGB
+      // which completely breaks for colours with 0% or 100%
+      // lightness
+
+      if (control != null && !object.ReferenceEquals(control, sender))
+      {
+        if (control is ColorEditor colorEditor)
+        {
+          colorEditor.HslColor = _hslColor;
+        }
+        else if (control is ColorWheel colorWheel)
+        {
+          colorWheel.HslColor = _hslColor;
+        }
+        else
+        {
+          control.Color = sender.Color;
+        }
       }
     }

@@ -415,26 +464,26 @@
     /// <param name="sender">The <see cref="IColorEditor"/> triggering the update.</param>
     protected virtual void Synchronize(IColorEditor sender)
     {
-      if (!this.LockUpdates)
+      if (!_lockUpdates)
       {
         try
         {
-          this.LockUpdates = true;
+          _lockUpdates = true;

           if (object.ReferenceEquals(sender, this))
           {
-            if (_wheel != null)
+            if (_colorWheel != null)
             {
-              _wheel.Lightness = _hslColor.L;
-              _wheel.Alpha = _color.A * _rgbMultiplier;
+              _colorWheel.Lightness = _hslColor.L;
+              _colorWheel.Alpha = _color.A * _rgbMultiplier;
             }
           }
           else if (object.ReferenceEquals(sender, _colorEditor))
           {
-            if (_wheel != null)
+            if (_colorWheel != null)
             {
-              _wheel.Lightness = _colorEditor.HslColor.L;
-              _wheel.Alpha = _colorEditor.Color.A * _rgbMultiplier;
+              _colorWheel.Lightness = _colorEditor.HslColor.L;
+              _colorWheel.Alpha = _colorEditor.Color.A * _rgbMultiplier;
             }

             if (_lightnessColorSlider != null)
@@ -444,9 +493,9 @@
           }
           else if (object.ReferenceEquals(sender, _lightnessColorSlider))
           {
-            if (_wheel != null)
+            if (_colorWheel != null)
             {
-              _wheel.Lightness = _lightnessColorSlider.Value / 100D;
+              _colorWheel.Lightness = _lightnessColorSlider.Value / 100D;
             }

             if (_colorEditor != null)
@@ -459,30 +508,36 @@
             }
           }

-          this.SetColor(this.ColorGrid, sender);
-          this.SetColor(this.ColorWheel, sender);
-          this.SetColor(this.ScreenColorPicker, sender);
+          this.SetColor(_colorGrid, sender);
+          this.SetColor(_colorWheel, sender);
+          this.SetColor(_screenColorPicker, sender);
           if (!object.ReferenceEquals(sender, _lightnessColorSlider))
           {
             this.SetColor(this.ColorEditor, sender);
           }

-          this.SetColor(this.LightnessColorSlider, sender);
+          this.SetColor(_lightnessColorSlider, sender);
         }
         finally
         {
-          this.LockUpdates = false;
+          _lockUpdates = false;
         }
       }
     }

     protected virtual void UnbindEvents(IColorEditor control)
     {
-      control.ColorChanged -= this.ColorChangedHandler;
-
-      if (control is LightnessColorSlider lightnessColorSlider)
-      {
-        lightnessColorSlider.ValueChanged -= this.ColorChangedHandler;
+      switch (control)
+      {
+        case ColorWheel colorWheel:
+          colorWheel.HslColorChanged -= this.HslColorChangedHandler;
+          break;
+        case LightnessColorSlider lightnessColorSlider:
+          lightnessColorSlider.ValueChanged -= this.ColorChangedHandler;
+          break;
+        default:
+          control.ColorChanged -= this.ColorChangedHandler;
+          break;
       }
     }

@@ -497,15 +552,15 @@
     /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
     private void ColorChangedHandler(object sender, EventArgs e)
     {
-      if (!this.LockUpdates)
+      if (!_lockUpdates)
       {
         IColorEditor source;

         source = (IColorEditor)sender;

-        this.LockUpdates = true;
+        _lockUpdates = true;
         this.Color = source.Color;
-        this.LockUpdates = false;
+        _lockUpdates = false;
         this.Synchronize(source);
       }
     }


bugfix polygon containspoint

bugfix polygon containspoint

--- src/Polygon.cs
+++ src/Polygon.cs
@@ -197,32 +197,60 @@
         /// states if the given polygon contains the test point ( z not considered )
         /// https://en.wikipedia.org/wiki/Point_in_polygon
         /// By default check the point contained in the polygon perimeter.
+        /// Optionally duplicate points are zapped in comparing.
         /// </summary>
         /// <param name="excludePerimeter">Exclude check point contained in the perimeter</param>
-        public static bool ContainsPoint(this IReadOnlyList<Vector3D> pts, double tol, Vector3D pt, bool excludePerimeter = false)
-        {
+        public static bool ContainsPoint(this IReadOnlyList<Vector3D> pts, double tol, Vector3D pt, bool zapDuplicates = false)
+        {
+            var ptHs = new HashSet<Vector3D>(new Vector3DEqualityComparer(tol));
+            var ptsFiltered = pts;
+
+            if (zapDuplicates)
+            {
+                var tmp = new List<Vector3D>();
+                foreach (var p in pts)
+                {
+                    if (!ptHs.Contains(p))
+                    {
+                        ptHs.Add(p);
+                        tmp.Add(p);
+                    }
+                }
+                ptsFiltered = tmp;
+            }
+            var segs = ptsFiltered.PolygonSegments(tol);
+
             var ray = new Line3D(pt, Vector3D.XAxis, Line3DConstructMode.PointAndVector);
-
-            var segs = pts.PolygonSegments(tol);
+            var conflictVertex = false;
+            do
+            {
+                conflictVertex = false;
+                foreach (var pp in ptsFiltered)
+                {
+                    if (ray.LineContainsPoint(tol, pp))
+                    {
+                        conflictVertex = true;
+                        // ray intersect vertex, change it
+                        ray = new Line3D(pt, pp + Vector3D.YAxis * tol * 1.1);
+                        break;
+                    }
+                }
+            }
+            while (conflictVertex);

             var intCnt = 0;

             foreach (var seg in segs)
             {
-                if (seg.SegmentContainsPoint(tol, pt))
-                {
-                    if (excludePerimeter) return false;
-                    return true;
-                }
+                if (seg.SegmentContainsPoint(tol, pt)) return true;

                 Vector3D ip = null;
-                var segMinY = Min(seg.From.Y, seg.To.Y);
-                var segMaxY = Max(seg.From.Y, seg.To.Y);
-                if (pt.Y.GreatThanOrEqualsTol(tol, segMinY) && pt.Y.LessThanOrEqualsTol(tol, segMaxY)) ip = ray.Intersect(tol, seg);
-                if (ip != null)
-                {
-                    if (pts.Any(r => r.EqualsTol(tol, ip))) ++intCnt;
-                    if (pt.X.GreatThanOrEqualsTol(tol, ip.X) && seg.SegmentContainsPoint(tol, ip)) ++intCnt;
+
+                ip = ray.Intersect(tol, seg);
+                if (ip != null && seg.SegmentContainsPoint(tol, ip))
+                {
+                    if (pt.X.GreatThanOrEqualsTol(tol, ip.X))
+                        ++intCnt;
                 }
             }

@@ -360,14 +388,14 @@
             }

             yield break;
-        }
+        }

         /// <summary>
         /// build 2d dxf polyline.
         /// note: use RepeatFirstAtEnd extension to build a closed polyline
         /// </summary>
         public static netDxf.Entities.LwPolyline ToLwPolyline(this IEnumerable<Vector3D> pts)
-        {
+        {
             return new netDxf.Entities.LwPolyline(pts.Select(r => r.ToVector2()).ToList(), true);
         }

@@ -379,7 +407,7 @@
         {
             return new netDxf.Entities.Polyline(pts.Select(r => (Vector3)r).ToList(), true);
         }
-
+
         /// <summary>
         /// can generate a Int64MapExceptionRange exception if double values can't fit into a In64 representation.
         /// In that case try with tolerances not too small.
@@ -402,7 +430,9 @@
             var sol = new List<List<IntPoint>>();
             clipper.Execute(type, sol);

-            return sol.Select(s => s.Select(si => new Vector3D(intmap.FromInt64(si.X), intmap.FromInt64(si.Y), 0)));
+            var res = sol.Select(s => s.Select(si => new Vector3D(intmap.FromInt64(si.X), intmap.FromInt64(si.Y), 0)));
+
+            return res;
         }

     }


remove unused using

remove unused using

--- src/Program.cs
+++ src/Program.cs
@@ -7,7 +7,6 @@
 using DxSharp.Utility;
 using System;
 using System.Drawing;
-using System.Linq;
 using System.Windows.Forms;

 namespace CrystalResonanceDesktop


fixed attacking

fixed attacking

--- src/Program.cs
+++ src/Program.cs
@@ -254,6 +254,7 @@

                     if (AttackTry.Item1)
                     {
+                        dmg = AttackTry.Item2;
                         attackDone = true;
                     }
                     else


try new texture

try new texture

--- Demos/RaycastVolumeRendering/RaycastNode.Initialize.cs
+++ Demos/RaycastVolumeRendering/RaycastNode.Initialize.cs
@@ -111,12 +111,20 @@
         private Texture InitVolume3DTexture(byte[] data, int width, int height, int depth)
         {
             var storage = new TexImage3D(TexImage3D.Target.Texture3D, GL.GL_RED, width, height, depth, GL.GL_RED, GL.GL_UNSIGNED_BYTE, new ArrayDataProvider<byte>(data));
-            var texture = new Texture(storage,
-                new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_REPEAT),
-                new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_REPEAT),
-                new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_REPEAT),
-                new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR),
-                new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR));
+            //var texture = new Texture(storage,
+            //    new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_REPEAT),
+            //    new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_REPEAT),
+            //    new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_REPEAT),
+            //    new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR),
+            //    new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR));
+            var texture = new Texture(storage, new MipmapBuilder(),
+                new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_CLAMP),
+                new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_CLAMP),
+                new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_CLAMP),
+                new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR_MIPMAP_LINEAR),
+                new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR),
+                new TexParameteri(TexParameter.PropertyName.TextrueBaseLevel, 0),
+                new TexParameteri(TexParameter.PropertyName.TextureMaxLevel, 4));
             texture.Initialize();

             return texture;


MainClass#CreateCategoryStringメソッドを追加

MainClass#CreateCategoryStringメソッドを追加

--- src/Program.cs
+++ src/Program.cs
@@ -28,6 +28,7 @@

 using System;
 using System.IO;
+using System.Text;
 using System.Linq;

 namespace Lury.Lexgen
@@ -44,6 +45,46 @@
         }

         #region -- Private Static Methods --
+
+        /// <summary>
+        /// カテゴリスケルトンを使ってコードを自動生成します。
+        /// </summary>
+        /// <returns>自動生成コードを表す文字列。</returns>
+        /// <param name="options">プログラムのオプションを表す <see cref="Lury.Lexgen.ProgramOptions"/> オブジェクト。</param>
+        /// <param name="lexRoot"><see cref="Lury.Lexgen.LexRoot"/> オブジェクト。</param>
+        private static string CreateCategoryString(ProgramOptions options, LexRoot lexRoot)
+        {
+            string entryString = ReadSkeletonFile(options.EntrySkeletonPath);
+            string categoryString = ReadSkeletonFile(options.CategorySkeletonPath);
+            StringBuilder entriesString = new StringBuilder();
+            StringBuilder categoriesString = new StringBuilder();
+
+            // categoriesString.Clear();
+
+            foreach (var category in lexRoot.Category)
+            {
+                entriesString.Clear();
+
+                foreach (var entry in category.Entry)
+                {
+                    entriesString.AppendFormat(entryString,
+                                               entry.Name,
+                                               entry.Regex,
+                                               CreateRegexOptionsString(entry.Option),
+                                               entry.Token,
+                                               entry.Option.IgnoreAfterSpace.ToString().ToLower(),
+                                               CreateStringArrayString(entry.ContextSwitchOn),
+                                               CreateStringArrayString(entry.ContextSwitchOff),
+                                               CreateStringArrayString(entry.Context));
+                }
+
+                categoriesString.AppendFormat(categoryString,
+                                              category.Name,
+                                              entriesString.ToString());
+            }
+
+            return categoriesString.ToString();
+        }

         /// <summary>
         /// 指定されたスケルトンファイルを読み込み、文字列として取得します。


Attempt at making a leaner version of getting the previous file's information

--- Duplicati/Library/Main/Database/LocalBackupDatabase.cs
+++ Duplicati/Library/Main/Database/LocalBackupDatabase.cs
@@ -185,7 +185,32 @@
                 @"    AND ""Metadataset"".""ID"" = ""File"".""MetadataID"" AND ""MetaBlockset"".""ID"" = ""Metadataset"".""BlocksetID"" " +
                 @"  ORDER BY ""Fileset"".""Timestamp"" DESC " +
                 @"  LIMIT 1 ";
-            m_findfileCommand.AddParameters(1);
+
+            // The above command finds the most recent entry of the file in question,
+            // but it requires some large joins to extract the required information.
+            // To speed it up, we use a slightly simpler approach that only looks at the
+            // previous fileset, and uses information here.
+            // If there is a case where a file is sometimes there and sometimes not
+            // (i.e. filter file, remove filter) we will not find the file.
+            // However, this case is unlikely, so we favor the faster approach.
+            // If anyone requests it, we can add a switch to enable the previous query
+
+            var getLastFileEntryForPath =
+                @"SELECT ""A"".""ID"", ""B"".""LastModified"", ""A"".""BlocksetID"", ""A"".""MetadataID"" " +
+                @"  FROM (SELECT ""ID"", ""BlocksetID"", ""MetadataID"" FROM ""File"" WHERE ""Path"" = ?) ""A"" " +
+                @"  CROSS JOIN ""FilesetEntry"" ""B"" " +
+                @"  WHERE ""A"".""ID"" = ""B"".""FileID"" " +
+                @"    AND ""B"".""FilesetID"" = ? ";
+
+            m_findfileCommand.CommandText = string.Format(
+                @"SELECT ""C"".""ID"" AS ""FileID"", ""C"".""LastModified"", ""D"".""Length"", ""E"".""FullHash"" as ""Metahash"", ""E"".""Length"" AS ""Metasize"" " +
+                @"  FROM " +
+                @"  ({0}) AS ""C"", ""Blockset"" AS ""D"", ""Blockset"" AS ""E"", ""Metadataset"" ""F"" "+
+                @" WHERE ""C"".""BlocksetID"" == ""D"".""ID"" AND ""C"".""MetadataID"" == ""F"".""ID"" AND ""F"".""BlocksetID"" = ""E"".""ID"" ",
+                getLastFileEntryForPath
+            );
+
+            m_findfileCommand.AddParameters(2);

             m_selectfileHashCommand.CommandText = @"SELECT ""Blockset"".""Fullhash"" FROM ""Blockset"", ""File"" WHERE ""Blockset"".""ID"" = ""File"".""BlocksetID"" AND ""File"".""ID"" = ?  ";
             m_selectfileHashCommand.AddParameters(1);
@@ -626,6 +651,7 @@
             else
             {
                 m_findfileCommand.SetParameterValue(0, path);
+                m_findfileCommand.SetParameterValue(1, filesetid);
                 m_findfileCommand.Transaction = transaction;
                 using(var rd = m_findfileCommand.ExecuteReader(m_logQueries, null))
                     if (rd.Read())


Fixed possible null reference issue. Silly mistake in last commit.

--- EventStreams.Core/Core/Domain/MethodInvocationCache.cs
+++ EventStreams.Core/Core/Domain/MethodInvocationCache.cs
@@ -21,11 +21,10 @@
             var handledTypes = GetMethods().Select(mi => mi.GetParameters().First().ParameterType);
             foreach (var handledType in handledTypes) {
                 var mi = GetMethodFor(handledType);
-                var handleMethod = mi != null
-                    ? CreateOpenInstanceDelegate<HandleMethod>(mi)
-                    : null;
-
-                _cache.Add(handledType, handleMethod);
+                if (mi != null) {
+                    var handleMethod = CreateOpenInstanceDelegate<HandleMethod>(mi);
+                    _cache.Add(handledType, handleMethod);
+                }
             }
         }


BUG: Call to get the metric definition fails.

--- src/Insights/OnetimeGenerated/Insights/MetricDefinitionOperations.cs
+++ src/Insights/OnetimeGenerated/Insights/MetricDefinitionOperations.cs
@@ -108,7 +108,7 @@
             string url = "";
             url = url + "/";
             url = url + resourceUri;
-            url = url + "/metricDefinitions";
+            url = url + "/metricDefinitions?";
             List<string> queryParameters = new List<string>();
             queryParameters.Add("api-version=2014-04-01");
             List<string> odataFilter = new List<string>();


fix issue https://github.com/dotnet/docfx/issues/165

--- src/Microsoft.DocAsCode.EntityModel/Visitors/SymbolVisitorAdapter.cs
+++ src/Microsoft.DocAsCode.EntityModel/Visitors/SymbolVisitorAdapter.cs
@@ -10,7 +10,7 @@
     using System.Text.RegularExpressions;

     using Microsoft.CodeAnalysis;
-
+    using Common;
     public class SymbolVisitorAdapter
         : SymbolVisitor<MetadataItem>
     {
@@ -114,8 +114,14 @@
             };
             item.Type = MemberType.Assembly;
             _references = new Dictionary<string, ReferenceItem>();
+            var namespaces = symbol.GlobalNamespace.GetNamespaceMembers().ToList();
+            if (namespaces.Count == 0)
+            {
+                Logger.LogWarning($"No namespace is found in assembly {symbol.MetadataName}. DocFX currently only supports generating metadata with namespace defined.");
+            }
+
             item.Items = VisitDescendants(
-                symbol.GlobalNamespace.GetNamespaceMembers(),
+                namespaces,
                 ns => ns.GetMembers().OfType<INamespaceSymbol>(),
                 ns => ns.GetMembers().OfType<INamedTypeSymbol>().Any(t => VisitorHelper.CanVisit(t)));
             item.References = _references;


Contribution by wmild to fix bug #17119.

--HG--
branch : contributions

--- src/Orchard.Web/Modules/Orchard.Media/Controllers/AdminController.cs
+++ src/Orchard.Web/Modules/Orchard.Media/Controllers/AdminController.cs
@@ -41,6 +41,8 @@
                 foreach (string key in input.Keys) {
                     if (key.StartsWith("Checkbox.") && input[key] == "true") {
                         string folderName = key.Substring("Checkbox.".Length);
+                        if (!Services.Authorizer.Authorize(Permissions.ManageMedia, T("Couldn't delete media folder")))
+                            return new HttpUnauthorizedResult();
                         _mediaService.DeleteFolder(folderName);
                     }
                 }


Fix casing

Fix casing

--- ExpressionUtils/Evaluating/CachedExpressionCompiler.cs
+++ ExpressionUtils/Evaluating/CachedExpressionCompiler.cs
@@ -65,12 +65,12 @@
 		private LambdaExpression getClosureFreeKeyForCaching(ConstantExtractor.ExtractionResult extractionResult, IReadOnlyCollection<ParameterExpression> parameterExpressions) {
 			var e = SimpleParameterSubstituter.SubstituteParameter(extractionResult.ConstantfreeExpression,
 				extractionResult.ConstantfreeExpression.Parameters.Select(
-						p => (Expression) Expression.Constant(GetDefaultValue(p.Type), p.Type)));
+						p => (Expression) Expression.Constant(getDefaultValue(p.Type), p.Type)));

 			return Expression.Lambda(e, parameterExpressions);
 		}

-		private object GetDefaultValue(Type t) {
+		private static object getDefaultValue(Type t) {
 			if (t.IsValueType) {
 				return Activator.CreateInstance(t);
 			}


coding style spacing fixed

coding style spacing fixed

--- src/Selenium.WebDriver.Extensions.JQuery/Models/ChainJQueryHelper.cs
+++ src/Selenium.WebDriver.Extensions.JQuery/Models/ChainJQueryHelper.cs
@@ -1340,7 +1340,7 @@
                 throw new ArgumentException("Opacity cannot be bigger than 1");
             }

-            this.Set("fadeTo(" + duration +", " + opacity + ")");
+            this.Set("fadeTo(" + duration + ", " + opacity + ")");
             return this;
         }


Correct visibility for Result.Collect().

--- src/Narvalo.Fx/Result.cs
+++ src/Narvalo.Fx/Result.cs
@@ -166,7 +166,7 @@
     // Provides extension methods for IEnumerable<Result<TError>>.
     public static partial class Result
     {
-        internal static Result<IEnumerable<TError>> Collect<TError>(this IEnumerable<Result<TError>> @this)
+        public static Result<IEnumerable<TError>> Collect<TError>(this IEnumerable<Result<TError>> @this)
             => Result.FromError(CollectAnyIterator(@this));

         public static IEnumerable<TError> CollectAny<TError>(this IEnumerable<Result<TError>> @this)


Ignore datetimeoffsets which are equal to MaxValue as like as what we did for MinValue in DefaultTimeZoneManager. This closes #1155

--- src/Server/Bit.Server.Owin/Implementations/DefaultTimeZoneManager.cs
+++ src/Server/Bit.Server.Owin/Implementations/DefaultTimeZoneManager.cs
@@ -59,7 +59,7 @@
             if (_currentTimeZoneName == null || _desiredTimeZoneName == null)
                 return dateTimeOffset;

-            if (dateTimeOffset == DateTimeOffset.MinValue)
+            if (dateTimeOffset == DateTimeOffset.MinValue || dateTimeOffset == DateTimeOffset.MaxValue)
                 return dateTimeOffset;

             if (_currentTimeZoneName == _desiredTimeZoneName)
@@ -82,7 +82,7 @@
             if (_currentTimeZoneName == null || _desiredTimeZoneName == null)
                 return dateTimeOffset;

-            if (dateTimeOffset == DateTimeOffset.MinValue)
+            if (dateTimeOffset == DateTimeOffset.MinValue || dateTimeOffset == DateTimeOffset.MaxValue)
                 return dateTimeOffset;

             if (_currentTimeZoneName == _desiredTimeZoneName)


use current time zone as desired time zone, if desired time zone is not provided

--- src/Server/Bit.Server.Owin/Implementations/DefaultTimeZoneManager.cs
+++ src/Server/Bit.Server.Owin/Implementations/DefaultTimeZoneManager.cs
@@ -21,7 +21,7 @@
                 if (_currentTimeZoneName == "British Summer Time")
                     _currentTimeZoneName = "GMT Daylight Time";

-                _desiredTimeZoneName = value.DesiredTimeZone;
+                _desiredTimeZoneName = value.DesiredTimeZone ?? _currentTimeZoneName;
                 if (_desiredTimeZoneName == "British Summer Time")
                     _desiredTimeZoneName = "GMT Daylight Time";
             }


Concurrency test

Concurrency test

--- src/SevenDigital.Messaging.Integration.Tests/Api/ConcurrencyLimit.cs
+++ src/SevenDigital.Messaging.Integration.Tests/Api/ConcurrencyLimit.cs
@@ -1,4 +1,6 @@
-using NUnit.Framework;
+using System.Threading;
+using NUnit.Framework;
+using SevenDigital.Messaging.Integration.Tests.Messages;

 namespace SevenDigital.Messaging.Integration.Tests
 {
@@ -14,7 +16,41 @@

 			Assert.Pass();
 		}
-
+
+		[Test]
+		public void concurrency_limit_is_obeyed_in_default_mode ()
+		{
+			MessagingSystem.Configure.WithDefaults().SetIntegrationTestMode();
+			MessagingSystem.Control.SetConcurrentHandlers(1);
+
+			CountingHandler.MaxCount = 0;
+			CountingHandler.Count = 0;
+			MessagingSystem.Receiver().Listen().Register(
+				with => with.Handle<IMessage>().With<CountingHandler>());
+
+			for (int i = 0; i < 20; i++)
+			{
+				MessagingSystem.Sender().SendMessage(new GreenMessage());
+			}
+
+			Thread.Sleep(1500);
+			MessagingSystem.Control.Shutdown();
+			Assert.That(CountingHandler.MaxCount, Is.EqualTo(1));
+		}
+
+		public class CountingHandler:IHandle<IMessage>
+		{
+			public static volatile int Count, MaxCount;
+
+			public void Handle(IMessage message)
+			{
+				Interlocked.Increment(ref Count);
+				Thread.Sleep(200);
+				if (Count > MaxCount) MaxCount = Count;
+				Interlocked.Decrement(ref Count);
+			}
+		}
+
 		[Test]
 		public void can_set_concurreny_limit_in_loopback_mode ()
 		{


Sync shared code from runtime (#21866)

Sync shared code from runtime (#21866)

Co-authored-by: github-actions[bot] <17973dcf2e10b67f63417c88ca4c460b2c9439f2@users.noreply.github.com>

--- src/Shared/runtime/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs
+++ src/Shared/runtime/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs
@@ -142,8 +142,6 @@
             // - Otherwise, dial this in to reflect actual minimum requirements and add some sort of platform
             //   error code mapping when creating exceptions.

-            OperatingSystem ver = Environment.OSVersion;
-
             // TODO: try to initialize TLS 1.3 in SslStream.

             try


The "GetTypedGrid" and "GetGridModel" methods should return an empty model as fallback

--- src/Skybrud.Umbraco.GridData/Extensions/TypedGridExtensionMethods.cs
+++ src/Skybrud.Umbraco.GridData/Extensions/TypedGridExtensionMethods.cs
@@ -33,7 +33,7 @@
         /// </summary>
         /// <param name="content">The parent content item.</param>
         public static GridDataModel GetTypedGrid(this IPublishedContent content) {
-            return content.GetPropertyValue<GridDataModel>(DefaultPropertyAlias);
+            return content.GetPropertyValue<GridDataModel>(DefaultPropertyAlias) ?? GridDataModel.GetEmptyModel();
         }

         /// <summary>
@@ -42,7 +42,7 @@
         /// <param name="content">The parent content item.</param>
         /// <param name="propertyAlias">The alias of the property.</param>
         public static GridDataModel GetTypedGrid(this IPublishedContent content, string propertyAlias) {
-            return content.GetPropertyValue<GridDataModel>(propertyAlias);
+            return content.GetPropertyValue<GridDataModel>(propertyAlias) ?? GridDataModel.GetEmptyModel();
         }

         /// <summary>
@@ -50,7 +50,7 @@
         /// </summary>
         /// <param name="content">The parent content item.</param>
         public static GridDataModel GetGridModel(this IPublishedContent content) {
-            return content.GetPropertyValue<GridDataModel>(DefaultPropertyAlias);
+            return content.GetPropertyValue<GridDataModel>(DefaultPropertyAlias) ?? GridDataModel.GetEmptyModel();
         }

         /// <summary>
@@ -59,7 +59,7 @@
         /// <param name="content">The parent content item.</param>
         /// <param name="propertyAlias">The alias of the property.</param>
         public static GridDataModel GetGridModel(this IPublishedContent content, string propertyAlias) {
-            return content.GetPropertyValue<GridDataModel>(propertyAlias);
+            return content.GetPropertyValue<GridDataModel>(propertyAlias) ?? GridDataModel.GetEmptyModel();
         }

         /// <summary>


Move some magic numbers to consts

Move some magic numbers to consts

--- src/Tgstation.Server.Host/Components/Watchdog/NetworkPromptReaper.cs
+++ src/Tgstation.Server.Host/Components/Watchdog/NetworkPromptReaper.cs
@@ -15,6 +15,16 @@
 	/// <inheritdoc />
 	sealed class NetworkPromptReaper : IHostedService, INetworkPromptReaper, IDisposable
 	{
+		/// <summary>
+		/// Number of times to send the button click message. Should be at least 2 or it may fail to focus the window
+		/// </summary>
+		const int SendMessageCount = 5;
+
+		/// <summary>
+		/// Check for prompts each time this amount of milliseconds pass
+		/// </summary>
+		const int RecheckDelayMs = 250;
+
 		/// <summary>
 		/// The <see cref="ILogger"/> for the <see cref="NetworkPromptReaper"/>
 		/// </summary>
@@ -90,8 +100,7 @@
 			{
 				while(!cancellationToken.IsCancellationRequested)
 				{
-					//check every quarter second
-					await Task.Delay(TimeSpan.FromMilliseconds(250), cancellationToken).ConfigureAwait(false);
+					await Task.Delay(TimeSpan.FromMilliseconds(RecheckDelayMs), cancellationToken).ConfigureAwait(false);

 					IntPtr window;
 					int processId;
@@ -128,9 +137,8 @@
 						if (windowText == "Yes")
 						{
 							//smash_button_meme.jpg
-							//yes send it five times for good measure
 							logger.LogTrace("Sending \"Yes\" button clicks...");
-							for (var J = 0; J < 5; ++J)
+							for (var J = 0; J < SendMessageCount; ++J)
 							{
 								const int BM_CLICK = 0x00F5;
 								var result = NativeMethods.SendMessage(I, BM_CLICK, IntPtr.Zero, IntPtr.Zero);


benchmark all days at once

benchmark all days at once

--- 2021/Answers/Program.cs
+++ 2021/Answers/Program.cs
@@ -2,6 +2,7 @@
 using System.Diagnostics;
 using System.Globalization;
 using System.Text;
+using System.Threading.Tasks;
 using AdventOfCode2021;

 Console.OutputEncoding = Encoding.UTF8;
@@ -12,6 +13,12 @@

 if (args.Length > 0)
 {
+	if (args[0] == "combined")
+	{
+		await BenchmarkAllDays();
+		return 0;
+	}
+
 	if (args[0] != "today" && !int.TryParse(args[0], out day))
 	{
 		Console.Error.WriteLine("Usage: [day [runs]]");
@@ -119,3 +126,53 @@
 }

 return 0;
+
+static async Task BenchmarkAllDays()
+{
+	double combined = 0d;
+
+	Console.WriteLine($"{"Day",-10} {"Runs",-10} Time");
+
+	for (var day = 1; day < 17; day++)
+	{
+		var runs = day == 12 || day == 15 ? 100 : 5000;
+
+		Console.Write($"{day,-10} {runs,-10} ");
+
+		var data = await Solver.LoadData(day);
+		var type = Solver.GetSolutionType(day);
+		var stopWatch = new Stopwatch();
+		double total = 0d;
+
+		for (var i = 1; i < runs; i++)
+		{
+			stopWatch.Restart();
+			Solver.Solve(type, data);
+			stopWatch.Stop();
+
+			var elapsed = stopWatch.Elapsed.TotalMilliseconds;
+			total += elapsed;
+		}
+
+		var time = total / runs;
+		combined += time;
+
+		if (time >= 1.0d)
+		{
+			Console.ForegroundColor = ConsoleColor.Red;
+		}
+		else if (time <= 0.1d)
+		{
+			Console.ForegroundColor = ConsoleColor.Green;
+		}
+
+		Console.WriteLine($"{time:N6}");
+		Console.ResetColor();
+	}
+
+	Console.Write($"{"Total",-10} {"-",-10} ");
+	Console.ForegroundColor = ConsoleColor.Blue;
+	Console.Write($"{combined:N6}");
+	Console.ResetColor();
+	Console.WriteLine("ms");
+}


Default to 25kB/sec, not 25b/Sec

Default to 25kB/sec, not 25b/Sec

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

--- src/SampleClient/main.cs
+++ src/SampleClient/main.cs
@@ -75,7 +75,7 @@
             // 50 open connections - should never really need to be changed
             // Unlimited download speed - valid range from 0 -> int.Max
             // Unlimited upload speed - valid range from 0 -> int.Max
-            TorrentSettings torrentDefaults = new TorrentSettings(4, 150, 0, 25);
+            TorrentSettings torrentDefaults = new TorrentSettings(4, 150, 0, 25 * 1024);

             // Create an instance of the engine.
             engine = new ClientEngine(engineSettings);


Added output to show how many active connections are up.

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

--- src/SampleClient/main.cs
+++ src/SampleClient/main.cs
@@ -185,7 +185,9 @@
                         sb.Append("Number of leechs: "); sb.Append(manager.Peers.Leechs);
                         sb.Append(Environment.NewLine);
                         sb.Append("Total available:  "); sb.Append(manager.Peers.Available);
-                        sb.Append(Environment.NewLine);
+                        sb.AppendLine();
+                        sb.Append("Actively connected to: "); sb.Append(manager.OpenConnections);
+                        sb.AppendLine();
                         sb.Append("Downloaded:       "); sb.AppendFormat("{0:0.00}", manager.Monitor.DataBytesDownloaded / (1024.0));
                         sb.Append(" MB");
                         sb.Append(Environment.NewLine);


If no battleTag set, show "No BattleTag Set"

--- HeroesMatchData.Core/ViewModels/MainWindowViewModel.cs
+++ HeroesMatchData.Core/ViewModels/MainWindowViewModel.cs
@@ -65,7 +65,13 @@

         public string UserBattleTag
         {
-            get => UserProfile.BattleTagName;
+            get
+            {
+                if (!string.IsNullOrEmpty(UserProfile.BattleTagName))
+                    return UserProfile.BattleTagName;
+                else
+                    return "No BattleTag Set";
+            }
             set
             {
                 RaisePropertyChanged();


* tentative completion of Gzip/DEFLATE support (#20)

--- Archives/GzipArchive.cs
+++ Archives/GzipArchive.cs
@@ -144,9 +144,14 @@
             // the OS identifier.
             HEADER_LEN_MIN  = 0x0A,
             HEADER_OFFSET   = 0x00,
-
-            FLG_OFFSET      = 0x04,
-
+            // The length of the trailer. Also serves as
+            // the offset of the trailer from the end of
+            // the archive's bytes.
+            TRAILER_LENGTH  = 0x08,
+            // The offset of the ISIZE field within the
+            // archive's trailer.
+            ISIZE_OFFSET    = 0x04,
+
             // The gzip magic number bytes. These are the first
             // two bytes within any gzip archive file.
             ID_1            = 0x1f,
@@ -154,18 +159,22 @@
             ID_2            = 0x8b,
             ID_2_OFFSET     = 0x01,

+            // The flags byte
+            FLG_OFFSET      = 0x04,
             // Compression method identifier
             CM_OFFSET       = 0x02,
             // Modification time
             MTIME_OFFSET    = 0x03,
-            // Optional extra flags
+            // Extra flags
             XFL_OFFSET      = 0x08,
             // Operating system identifier
             OS_OFFSET       = 0x09,
             // Optional extra length field position
             XLEN_OFFSET     = 0x0A,
             // The number of bytes comprising the XLEN field
-            XLEN_LENGTH     = 0x02
+            XLEN_LENGTH     = 0x02,
+            // The length of the header checksum
+            HDRCHKSUM_LEN   = 0x02
             ;
         private const string ISO_ENCODING = "ISO-8859-1";
         /// <summary>
@@ -178,9 +187,17 @@
             IsoEncoding = Encoding.GetEncoding(ISO_ENCODING);
         }

+        // The original file name, if present. Otherwise,
+        // the hex representation of the archive's CRC-32.
         private string _name;
+        // The length of the uncompressed data.
+        private uint _isize;
+        // The uncompressed data.
         private byte[] _dcData;
+        // Any archive flags.
         private GzipFlags _flags;
+        // Extra archive flags
+        private GzipExtra _xfl;

         /// <summary>
         /// Creates a new GzipArchive.
@@ -233,6 +250,7 @@
                     );

             _flags = (GzipFlags)headerBuf[FLG_OFFSET];
+            _xfl = (GzipExtra)headerBuf[XFL_OFFSET];

             // Our current offset from the Gzip headers.
             long offset = 0;
@@ -251,13 +269,13 @@
                 // to know how long it is so we can read/skip any
                 // other fields correctly.
                 offset = ((((ushort)xlenBuf[1]) << 8) | xlenBuf[0]) + XLEN_LENGTH;
+                stream.Position = HEADER_LEN_MIN + offset;
             }

             // The archive contains the original file name of the stored
             // file. We do want to use this.
             if ((_flags & GzipFlags.OriginalName) == GzipFlags.OriginalName)
             {
-                stream.Position = HEADER_LEN_MIN + offset;
                 List<byte> ofnBytes = new List<byte>();

                 stream.ReadUntilFound(new[] { ASCII_NUL }, ofnBytes.Add);
@@ -266,6 +284,70 @@

                 offset = stream.Position;
             }
+            else _name = null;
+
+            // Some archives will contain a comment. We don't need or
+            // want it, but we still need to skip past it.
+            if ((_flags & GzipFlags.Comment) == GzipFlags.Comment)
+            {
+                stream.ReadUntilFound(new[] { ASCII_NUL }, b => { });
+                offset = stream.Position;
+            }
+
+            // We won't be doing any integrity checks.
+            if ((_flags & GzipFlags.Checksum) == GzipFlags.Checksum)
+            {
+                offset += HDRCHKSUM_LEN;
+                stream.Seek(HDRCHKSUM_LEN, SeekOrigin.Current);
+            }
+
+            // The remaining data, minus the file's trailer, should be
+            // the compressed blocks. Its length is the length of
+            // the stream, minus the length of the headers and the length
+            // of the trailer.
+            byte[] cDataBuf = new byte[stream.Length - offset - TRAILER_LENGTH];
+            stream.Read(cDataBuf, 0, cDataBuf.Length);
+            byte[] trailerBuf = new byte[TRAILER_LENGTH];
+            stream.Read(trailerBuf, 0, TRAILER_LENGTH);
+
+            if (BitConverter.IsLittleEndian)
+                _isize = BitConverter.ToUInt32(trailerBuf, ISIZE_OFFSET);
+            else
+                _isize = BitConverter.ToUInt32(
+                    trailerBuf.Skip(ISIZE_OFFSET).Reverse().ToArray(),
+                    0
+                    );
+
+            using (var ms = new MemoryStream(cDataBuf))
+            using (var ds = new DeflateStream(ms, CompressionMode.Decompress))
+            {
+                _dcData = new byte[_isize];
+
+                // The stream's Read method only accepts an Int32 for length,
+                // which can have a value of up to 2^31. Gzip, however, supports
+                // files up to 2^32 in length.
+                //
+                // To allow >2GiB files to be used, we need to read in two goes
+                // rather than one when they are present.
+                if (_isize > Int32.MaxValue)
+                {
+                    ds.Read(_dcData, 0, Int32.MaxValue);
+                    ds.Read(_dcData, Int32.MaxValue, (int)(_isize - Int32.MaxValue));
+                }
+                else
+                {
+
+                    ds.Read(_dcData, 0, (int)_isize);
+                }
+            }
+
+            // If the archive doesn't contain the original file name,
+            // set the file name to the file's CRC-32 as a hex string.
+            if (_name == null)
+                _name = trailerBuf
+                    .Take(4)
+                    .Aggregate(new StringBuilder(), (sb, b) => sb.Append(b.ToString("x")))
+                    .ToString();
         }

         /// <summary>


Set result.ReferencedAssemblies when -r switch is on

--- AssemblyInfo/Program.cs
+++ AssemblyInfo/Program.cs
@@ -124,6 +124,8 @@
                 {
                     System.Console.WriteLine("\nReferenced Assemblies");
                     var referencedAssemblies = asm.GetReferencedAssemblies().OrderBy(n => n.Name);
+                    result.ReferencedAssemblies = types.Select(t => t.Name).ToList();
+
                     foreach (var a in referencedAssemblies)
                     {
                         System.Console.WriteLine("  " + a.Name);


introduce path param from Get2

introduce path param from Get2

--- test/ProductFacts.cs
+++ test/ProductFacts.cs
@@ -20,7 +20,7 @@
         [Fact]
         public void ShouldReturnAllProducts()
         {
-            Get2();
+            Get2("api/products");

             var products = Body(new []
             {
@@ -35,9 +35,9 @@
             Assert.Equal("Subway", products[0].Name);
         }

-        private void Get2()
+        private void Get2(string path)
         {
-            var httpResponseMessage1 = Server.CreateRequest("api/products").GetAsync().Result;
+            var httpResponseMessage1 = Server.CreateRequest(path).GetAsync().Result;
             httpResponseMessage = httpResponseMessage1;
         }


Go back to 3 months

Go back to 3 months

--- src/Cash-Flow-Projection/Controllers/HomeController.cs
+++ src/Cash-Flow-Projection/Controllers/HomeController.cs
@@ -25,7 +25,7 @@

         public IActionResult Index(DateTime? thru)
         {
-            return View(new Dashboard(db.Entries.SinceBalance(thru ?? DateTime.Today.AddMonths(6))));
+            return View(new Dashboard(db.Entries.SinceBalance(thru ?? DateTime.Today.AddMonths(3))));
         }

         [Route("~/Add")]


Bugfix: interfaces are not instances

Bugfix: interfaces are not instances

No matter how much we want to believe

--- src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
+++ src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
@@ -1516,7 +1516,7 @@
             // @MattWindsor91 (Concept-C# 2017)
             // Only allow concepts and instances with the feature turned on.
             if (classOrStructOrInterface.Kind == SyntaxKind.ConceptKeyword
-                || classOrStructOrInterface.Kind == SyntaxKind.InterfaceKeyword)
+                || classOrStructOrInterface.Kind == SyntaxKind.InstanceKeyword)
             {
                 classOrStructOrInterface = CheckFeatureAvailability(classOrStructOrInterface, MessageID.IDS_FeatureConcepts);
             }


Draw text string

Draw text string

--- src/Core2D.Avalonia/Renderers/AvaloniaShapeRenderer.cs
+++ src/Core2D.Avalonia/Renderers/AvaloniaShapeRenderer.cs
@@ -263,6 +263,36 @@
             return cache;
         }

+        private void GetTextCache(TextShape text, Rect rect, out FormattedText formattedText, out Point origin)
+        {
+            var constraint = new Size(rect.Width, rect.Height);
+
+            formattedText = new FormattedText()
+            {
+                Text = text.Text.Value,
+                Constraint = constraint,
+                TextAlignment = TextAlignment.Center,
+                Wrapping = TextWrapping.NoWrap,
+                Typeface = new Typeface("Arial", 11)
+            };
+
+            var size = formattedText.Measure();
+
+            var top = new Point(
+                rect.X,
+                rect.Y);
+
+            var center = new Point(
+                rect.X,
+                rect.Y + rect.Height / 2 - size.Height / 2);
+
+            var bottom = new Point(
+                rect.X,
+                rect.Y + rect.Height - size.Height);
+
+            origin = center;
+        }
+
         public override void InvalidateCache(ShapeStyle style)
         {
             if (style != null)
@@ -323,6 +353,11 @@
                         }
                     }
                     break;
+                case TextShape text:
+                    {
+                        // TODO:
+                    }
+                    break;
             }
         }

@@ -397,17 +432,21 @@
             var cache = GetBrushCache(style);
             var _dc = dc as DrawingContext;
             var rect = ToRect(text.TopLeft, text.BottomRight, dx, dy);
-            if (style.IsFilled)
-            {
-                _dc.FillRectangle(cache?.Fill, rect);
-            }
-            if (style.IsStroked)
-            {
-                _dc.DrawRectangle(cache?.StrokePen, rect);
-            }
+
+            //if (style.IsFilled)
+            //{
+            //    _dc.FillRectangle(cache?.Fill, rect);
+            //}
+
+            //if (style.IsStroked)
+            //{
+            //    _dc.DrawRectangle(cache?.StrokePen, rect);
+            //}
+
             if (text.Text != null)
             {
-                // TODO: Draw text Value string.
+                GetTextCache(text, rect, out FormattedText formattedText, out Point origin);
+                _dc.DrawText(cache?.Stroke, origin, formattedText);
             }
         }
     }


Allow EmbedFieldBuilder to take object values

--- src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs
+++ src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs
@@ -123,7 +123,7 @@
         private EmbedField _field;

         public string Name { get { return _field.Name; } set { _field.Name = value; } }
-        public string Value { get { return _field.Value; } set { _field.Value = value; } }
+        public object Value { get { return _field.Value; } set { _field.Value = value.ToString(); } }
         public bool IsInline { get { return _field.Inline; } set { _field.Inline = value; } }

         public EmbedFieldBuilder()
@@ -136,7 +136,7 @@
             Name = name;
             return this;
         }
-        public EmbedFieldBuilder WithValue(string value)
+        public EmbedFieldBuilder WithValue(object value)
         {
             Value = value;
             return this;


RA 1946 Reset spacing

RA 1946 Reset spacing

--- src/Esfa.Vacancy.Manage.Api/App_Start/SwaggerConfig.cs
+++ src/Esfa.Vacancy.Manage.Api/App_Start/SwaggerConfig.cs
@@ -27,7 +27,7 @@
                         // the docs is taken as the default. If your API supports multiple schemes and you want to be explicit
                         // about them, you can use the "Schemes" option as shown below.
                         //
-                        c.Schemes(new[] { "https"});
+                        c.Schemes(new[] { "https" });

                         // Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to
                         // hold additional metadata for an API. Version and title are required but you can also provide


Added PixelPerfectTest and LargePixelPerfectTest

--- zxing.test/Pdf417Tests.cs
+++ zxing.test/Pdf417Tests.cs
@@ -4,10 +4,40 @@
 using System.Text;
 using System.Threading.Tasks;
 using Xunit;
+using ZXing;

 namespace zxing.test
 {
     public class Pdf417Tests
     {
+        private BarcodeReader barcodereader;
+
+        public Pdf417Tests()
+        {
+            barcodereader = new BarcodeReader();
+            barcodereader.Options.PossibleFormats = new[] { BarcodeFormat.PDF_417 };
+        }
+
+        [Fact]
+        public void PixelPerfectTest()
+        {
+            var image = Support.Image("Pdf417/pixelperfect.png");
+            var expected = "Simple PDF417 Barcode";
+
+            string decoded = barcodereader.Decode(image)?.Text;
+
+            Assert.Equal(expected, decoded);
+        }
+
+        [Fact]
+        public void LargePixelPerfectTest()
+        {
+            var image = Support.Image("Pdf417/verylargepixelperfect.png");
+            var expected = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas imperdiet neque arcu, ac dictum ex commodo quis. Sed iaculis, nibh quis dignissim dictum, turpis ex mattis velit, vel consequat sapien orci et felis. Mauris quis massa convallis, consequat sem feugiat, suscipit purus. Suspendisse at rhoncus turpis, in maximus sapien. Nunc ultricies, nunc sit amet tempus pellentesque, augue magna rutrum ligula, non pharetra sem sapien in ex. Duis ultrices ligula at justo consequat, id fermentum libero rhoncus. Sed in egestas magna, vitae consequat dolor. Mauris sem ligula, posuere ac velit eget, aliquet molestie velit. Nunc tincidunt sem nunc, vel mattis tellus hendrerit id. Vestibulum ut dolor sit amet nisi vehicula sodales a fringilla odio. Cum sociis natoque penatibus et magnis dis parturient montes.";
+
+            string decoded = barcodereader.Decode(image)?.Text;
+
+            Assert.Equal(expected, decoded);
+        }
     }
 }


fixes burst mechanic

fixes burst mechanic

--- Assets/Scripts/Burst.cs
+++ Assets/Scripts/Burst.cs
@@ -8,25 +8,29 @@
 		public float spread;
 		public int cooldown;

-		public Burst(int newSize, float newSpread = 45f) {
+		public Burst(int newSize = 1, float newSpread = 45f) {
 			shots = MakeSpread(newSize, newSpread);
-			cooldown = newSize;
+			cooldown = newSize * 5;
 		}

-		public ChangeAngle(int index, float newAngle) {
+		public void ChangeAngle(int index, float newAngle) {
 			if (Mathf.Abs(newAngle) > (spread / 2)) {
 				throw new System.ArgumentException("Angle exceeds maximum spread");
 			}
-			shots[i] = newAngle;
+			shots[index] = newAngle;
 		}

 		private List<float> MakeSpread(int newSize, float newSpread) {
-			List<float> newShots = List<float>(newSize);
+			List<float> newShots = new List<float>(newSize);
+			if (newSize == 1) {
+				newShots.Add(0);
+				return newShots;
+			}
 			float midway = newSpread / 2;
 			float spacing = newSpread / (newSize - 1);
 			float currSpread = newSpread;
 			for (int i = 0; i < newSize; i++) {
-				newShots[i] = currSpread - (i * spacing) - midway
+				newShots.Add(currSpread - (i * spacing) - midway);
 			}
 			return newShots;
 		}


Fixed the scaling animation code to be more resilient

--- Bork/MainWindow.xaml.cs
+++ Bork/MainWindow.xaml.cs
@@ -32,10 +32,10 @@
             aruImage.setSource(Bork.Properties.Resources.DummyImg1);

             var rng = new Random();
-            for (int i=0; i<1000; i++)
+            for (int i=0; i<3; i++)
             {
                 var iter = new RichImage();
-                iter.setSource(Bork.Properties.Resources.DummyImg1);
+                iter.setSource(Bork.Properties.Resources.DummyImg2);
                 iter.setPosition(rng.Next((int)(Width / -2), (int)(Width/2)),
                                  rng.Next((int)(Height / -2), (int)(Height/2)));
                 iter.setSize(iter.Source.Width / 10, iter.Source.Height / 10);
@@ -49,6 +49,8 @@
                 {
                     var now = DateTime.Now;
                     double dt = (double)((now - timeKeeper).Milliseconds) / 1000;
+                    if (dt > 0.017)
+                        System.Console.Out.WriteLine(dt);
                     Update(dt);
                     Thread.Sleep(1000/60);
                     timeKeeper = now;
@@ -64,7 +66,6 @@
         double dScale = 0.1;
         private void aruAnimation(double dt)
         {
-            System.Console.Out.WriteLine(dt);
             Dispatcher.Invoke(() =>
             {
                 foreach (var ctrl in grid.Children)
@@ -76,7 +77,8 @@
                     ri.setRotation(rot + 5);

                     var aruScale = aruImage.getScale().X;
-                    if (aruScale > 5 || aruScale < 1)
+                    if ((aruScale > 5 && dScale > 0) ||
+                        (aruScale < 1 && dScale < 0))
                         dScale *= -1;
                     var scale = ri.getScale();
                     scale += dScale;


Removed leftover settings from UnitTestsRunnerSettings

--HG--
branch : feature/ui-refresh

--- Assets/UnityTestTools/UnitTesting/Editor/UnitTestsRunnerSettings.cs
+++ Assets/UnityTestTools/UnitTesting/Editor/UnitTestsRunnerSettings.cs
@@ -7,19 +7,10 @@

     public class UnitTestsRunnerSettings : ProjectSettingsBase
     {
-        public bool optionsFoldout;
-        public bool filtersFoldout;
         public bool runOnRecompilation;
         public bool horizontalSplit = true;
         public bool autoSaveSceneBeforeRun;
         public bool runTestOnANewScene;
-
-        public int categoriesMask;
-        public string testFilter = "";
-        public bool showFailed = true;
-        public bool showIgnored = true;
-        public bool showNotRun = true;
-        public bool showSucceeded = true;

         public void ToggleRunTestOnANewScene() {
             runTestOnANewScene = !runTestOnANewScene;


more fxcop warnings resolved

more fxcop warnings resolved

--- AutoRest/Generators/Azure.Common/Azure.Common/AzureCodeGenerator.cs
+++ AutoRest/Generators/Azure.Common/Azure.Common/AzureCodeGenerator.cs
@@ -68,6 +68,11 @@
         /// <param name="serviceClient">Service client</param>
         public static void UpdateHeadMethods(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             foreach (var method in serviceClient.Methods.Where(m => m.HttpMethod == HttpMethod.Head)
                                                              .Where(m => m.ReturnType == null))
             {
@@ -92,6 +97,11 @@
         /// <param name="serviceClient"></param>
         public static void SetDefaultResponses(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             // Create CloudError if not already defined
             CompositeType cloudError = serviceClient.ModelTypes.FirstOrDefault(c =>
                 c.Name.Equals("cloudError", StringComparison.OrdinalIgnoreCase));
@@ -120,6 +130,11 @@
         /// <param name="serviceClient"></param>
         public static void RemoveCommonPropertiesFromMethods(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             foreach (var method in serviceClient.Methods)
             {
                 method.Parameters.RemoveAll(
@@ -139,6 +154,11 @@
         /// <param name="serviceClient">Service client</param>
         public static void ParseODataExtension(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(ODataExtension)))
             {
                 string odataModelPath = (string) method.Extensions[ODataExtension];
@@ -180,6 +200,11 @@
         /// <param name="serviceClient"></param>
         public static void AddLongRunningOperations(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             for (int i = 0; i < serviceClient.Methods.Count; i++)
             {
                 var method = serviceClient.Methods[i];
@@ -204,6 +229,11 @@
         /// <param name="serviceClient"></param>
         public static void AddAzureProperties(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             serviceClient.Properties.Add(new Property
             {
                 Name = "ApiVersion",
@@ -237,6 +267,11 @@
         /// <param name="serviceClient"></param>
         public static void FlattenResourceProperties(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             HashSet<string> typesToDelete = new HashSet<string>();
             foreach (var compositeType in serviceClient.ModelTypes.ToArray())
             {
@@ -292,6 +327,11 @@

         public static bool IsDerivedFromExternalResource(CompositeType compositeType)
         {
+            if (compositeType == null)
+            {
+                return false;
+            }
+
             return compositeType.BaseModelType != null &&
                    (compositeType.BaseModelType.Name.Equals(ResourceType, StringComparison.OrdinalIgnoreCase) ||
                     compositeType.BaseModelType.Name.Equals(SubResourceType, StringComparison.OrdinalIgnoreCase)) &&
@@ -307,6 +347,11 @@
         /// <returns>True if it is an external resource, false otherwise</returns>
         public static bool IsExternalResource(CompositeType compositeType)
         {
+            if (compositeType == null)
+            {
+                return false;
+            }
+
             return (compositeType.Extensions.ContainsKey(ExternalExtension) &&
                                 (bool)compositeType.Extensions[ExternalExtension] &&
                                 compositeType.Name.Equals(ResourceType));
@@ -318,6 +363,11 @@
         /// <param name="serviceClient"></param>
         public static void AddPageableMethod(ServiceClient serviceClient)
         {
+            if (serviceClient == null)
+            {
+                throw new ArgumentNullException("serviceClient");
+            }
+
             foreach (var method in serviceClient.Methods.ToArray())
             {
                 if (method.Extensions.ContainsKey(PageableExtension))


Update registration view and registration model to include additional fields. Tested with connection string to RDS. [#135473125]

--- ClientManagement.UI/ClientManagement.UI.MVC/Views/Home/Index.cshtml
+++ ClientManagement.UI/ClientManagement.UI.MVC/Views/Home/Index.cshtml
@@ -3,7 +3,7 @@
 }

-
ASP.NET

+
Client Manager

ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.

Learn more »


Rename argument name

Rename argument name

--- Core/R-ceptor.Core/ServiceProxy/Provider/IRequestContextProvider.cs
+++ Core/R-ceptor.Core/ServiceProxy/Provider/IRequestContextProvider.cs
@@ -5,6 +5,6 @@
 {
     public interface IRequestContextProvider
     {
-        RestRequestContext GetRequestContext(object[] arguments, MethodInfo invokeMethod = null);
+        RestRequestContext GetRequestContext(object[] callArguments, MethodInfo invokeMethod = null);
     }
 }


Improved Getting Started

Improved Getting Started

--- jVUNDemo/Views/Home/GettingStarted.cshtml
+++ jVUNDemo/Views/Home/GettingStarted.cshtml
@@ -12,13 +12,17 @@
   </appSettings>

-
Include jQuery Validation Unobtrusive Native into your project (available on @Html.ActionLink("Nuget", "Download") or on GitHub). With this in place you should be able to switch from using the existing TextBoxFor / DropDownListFor HtmlHelper statements in your views and to jQuery Validation Unobtrusive Native's equivalent by passing true to the useNativeUnobtrusiveAttributes parameter. (By convention this is the first parameter after the Expression<Func<TModel, TProperty>> expression parameter.

+
Include jQuery Validation Unobtrusive Native into your project (available on @Html.ActionLink("Nuget", "Download") or on GitHub). With this in place you should be able to switch from using the existing TextBoxFor / DropDownListFor / CheckBoxFor / TextAreaFor / RadioButtonFor / ListBoxFor / PasswordFor HtmlHelper statements in your views and to jQuery Validation Unobtrusive Native's equivalent by passing true to the useNativeUnobtrusiveAttributes parameter. (By convention this is the first parameter after the Expression<Func<TModel, TProperty>> expression parameter in each helper.

-
Ensure that you have the latest version of jquery.validate.js, you can find it here.  Oh, and remember that you no longer need to serve up the jquery.validate.unobtrusive.js on a screen where you are using jQuery Validation Unobtrusive Native.  All you need is jquery.validate.js (and of course jQuery).

+
Ensure that you have the latest version of jquery.validate.js included, you can find it here (minimum version supported is 1.11.0).  Oh, and remember that you no longer need to serve up the jquery.validate.unobtrusive.js on a screen where you are using jQuery Validation Unobtrusive Native.  All you need is jquery.validate.js (and of course jQuery).  However, if you were using jquery.validate.unobtrusive.js to trigger your screen validation on page load then remember that you will now need to do this yourself like this:

-
P.S. If you're using the source code from GitHub in Visual Studio, make sure you have the Package Manager option "Allow NuGet to download missing packages during build" set to true.  This will ensure that the required packages are downloaded from NuGet.

+

+  <script>
+      $("form").validate();
+  </<script>
+

-
Simple examples

+
Using the jQuery Validation Unobtrusive Native HTML Helper overloads

Where you would previously have written:

@@ -35,7 +39,8 @@

Or, where you would have written:

-    @@Html.DropDownListFor(x => x.WeAreDropDown, new List<SelectListItem> {
+    @@Html.DropDownListFor(x => x.WeAreDropDown,
+      new List<SelectListItem> {
         new SelectListItem{ Text = "Please select", Value = "" },
         new SelectListItem{ Text = "An option", Value = "An option"}
     })
@@ -44,13 +49,14 @@

Now you would put:

-    @@Html.DropDownListFor(x => x.WeAreDropDown, true, new List<SelectListItem> {
+    @@Html.DropDownListFor(x => x.WeAreDropDown, true,
+      new List<SelectListItem> {
         new SelectListItem{ Text = "Please select", Value = "" },
         new SelectListItem{ Text = "An option", Value = "An option"}
     })

-
The only differences above are the extra true parameters being passed.  If you had passed false instead jQuery Validation Unobtrusive Native internally calls the inbuilt MVC implementation.

+
The only differences above are the extra true arguments being passed.  If you passed false instead jQuery Validation Unobtrusive Native would internally call the inbuilt MVC implementation.

If you're a heavy user of the htmlAttributes parameter (and indeed others) available using the MVC HTML Helpers and you're worried that jQuery Validation Unobtrusive Native will stop you using it then fear not!  The same overloads should remain available to you as with the out-of-the-box HTML Helpers.  So doing something like this:

@@ -68,6 +74,15 @@

+
Take a look at the @Html.ActionLink("demos", "Index", "Demo") to see more detailed examples.

+
+
Using jQuery Validation Unobtrusive Native alongside jquery.validate.unobtrusive.js

+
+
When it comes to using jQuery Validation Unobtrusive Native side by side with jquery.validate.unobtrusive.js in the same project, you can.  As you see, it takes very little effort to migrate from one approach to the other. And it's *your* choice. If you want to have one screen that uses jQuery Validation Unobtrusive Native and one screen that uses jquery.validation.unobtrusive.js then you can! Including jQuery Validation Unobtrusive Native in your project gives you the option to use it. It doesn't force you to, you can do so as you need to and when you want to. It's down to you.

+
+@*

By the way, I have considered keeping jQuery Validation Unobtrusive Native's HtmlHelpers entirely separate from the inbuilt MVC ones and instead implementing TextBoxNativeFor / DropDownListNativeFor methods which share the same signatures as the inbuilt MVC ones.  I'm still in 2 minds about the best approach and I'm happy to be swayed in this direction if people feel strongly enough - if you've an opinion then drop me a line with your rationale.

+*@

-
Take a look at the @Html.ActionLink("demos", "Index", "Demo") to see more detailed examples.
+
P.S. If you're using the source code from GitHub in Visual Studio, make sure you have the Package Manager option "Allow NuGet to download missing packages during build" set to true.  This will ensure that the required packages are downloaded from NuGet.

+


Fix misspelling

Fix misspelling

--- input/recipes/blog/pipelines.cshtml
+++ input/recipes/blog/pipelines.cshtml
@@ -1,6 +1,6 @@
 Order: 4
 Description: The pipelines involved in the recipe and what they do.
 ---
-
The following pipelines are defined for this recipe and are executed in the order below. You can extend or adjust the recipe by modiying these pipelines and/or by creating new pipelines.

+
The following pipelines are defined for this recipe and are executed in the order below. You can extend or adjust the recipe by modifying these pipelines and/or by creating new pipelines.

-@Html.Partial("_RecipePipelines", "Wyam.Blog.Blog")+@Html.Partial("_RecipePipelines", "Wyam.Blog.Blog")


Tweaks after reviewing existing ACH generation code

--- CertiPay.ACH/ACHFile.cs
+++ CertiPay.ACH/ACHFile.cs
@@ -109,9 +109,7 @@

         public static String GetFillerRecord()
         {
-            var nines = Enumerable.Range(1, CHARACTERS_PER_LINE).Select(_ => "9");
-
-            return String.Join(String.Empty, nines);
+            return new String('9', CHARACTERS_PER_LINE);
         }
     }

@@ -154,7 +152,7 @@

         public int PriorityCode = 1;

-        public String ImmediateDestination = String.Empty;
+        public String ImmediateDestination = String.Empty; // ACHBankRoutingNumber

         public String ImmediateOrigin = String.Empty;

@@ -168,9 +166,9 @@

         public readonly int BlockingFactor = 10;

-        public int FormatCode = 1;
-
-        public String ImmediateDestinationName = String.Empty;
+        public readonly int FormatCode = 1;
+
+        public String ImmediateDestinationName = String.Empty; // ACHFileBankName

         public String ImmediateOriginName = String.Empty;

@@ -184,7 +182,7 @@

             sb.Append(PriorityCode.ToString().TrimAndPadLeft(2, '0'));

-            sb.Append(ImmediateDestination.TrimAndPadRight(10));
+            sb.Append(ImmediateDestination.TrimAndPadLeft(10));

             sb.Append(ImmediateOrigin.TrimAndPadRight(10));

@@ -236,9 +234,9 @@
             this.EntryHash = CalculateEntryHash(file);
         }

-        public readonly int RecordType = 1;
-
-        public int BatchCount;
+        public readonly int RecordType = 9;
+
+        public int BatchCount = 0;

         public Decimal BlockCount = 0;

@@ -270,7 +268,7 @@

             sb.Append((TotalCredits * 100).ToString().TrimAndPadLeft(12, '0')); // 123.45 => 000000012345

-            sb.Append(Reserved);
+            sb.Append(Reserved.TrimAndPadRight(39));

             sb.AppendLine();

@@ -363,25 +361,25 @@

         public ServiceClassCode ServiceClass = ServiceClassCode.Mixed_Debits_And_Credits;

-        public String CompanyName = String.Empty;
+        public String CompanyName = String.Empty; // control name?

         public String CompanyDiscreationaryData = String.Empty;

-        public String CompanyId = String.Empty;
-
-        public String StandardEntryClassCode = String.Empty;
-
-        public String EntryDescription = String.Empty;
-
-        public String CompanyDescriptiveDate = String.Empty;
+        public String CompanyId = String.Empty; // ACH-EIN-Prefix + ControlEIN
+
+        public String StandardEntryClassCode = "PPD";
+
+        public String EntryDescription = "PAYROLL";
+
+        public DateTime CompanyDescriptiveDate = DateTime.Today; // CheckDate

         public DateTime EffectiveEntryDate = DateTime.Today;

-        public int SettlementDate;
-
-        public char OriginatorStatusCode;
-
-        public String OriginatingDFIIdentification = String.Empty;
+        public String SettlementDate = String.Empty;
+
+        public char OriginatorStatusCode = '1';
+
+        public String OriginatingDFIIdentification = String.Empty; // ACHBankRoutingNumber

         public int BatchNumber = 1;

@@ -403,11 +401,11 @@

             sb.Append(EntryDescription.TrimAndPadRight(10));

-            sb.Append(CompanyDescriptiveDate.TrimAndPadRight(6));
+            sb.Append(CompanyDescriptiveDate.ToString("yyMMdd"));

             sb.Append(EffectiveEntryDate.ToString("yyMMdd"));

-            sb.Append(SettlementDate.ToString().TrimAndPadLeft(3, '0'));
+            sb.Append(SettlementDate.TrimAndPadLeft(3, ' '));

             sb.Append(OriginatorStatusCode);

@@ -467,9 +465,9 @@

         public readonly int RecordType = 8;

-        public ServiceClassCode ServiceClass = ServiceClassCode.Debits_Only;
-
-        public String CompanyId = String.Empty;
+        public ServiceClassCode ServiceClass = ServiceClassCode.Mixed_Debits_And_Credits;
+
+        public String CompanyId = String.Empty; // group name or ACHEINPrefix + EIN

         public int EntryCount = 0;

@@ -568,11 +566,11 @@

         public TransactionCode Transaction_Code = TransactionCode.Checking_Credit;

-        public String ReceivingDFIIdentification = String.Empty;
-
-        public int CheckDigit;
-
-        public String DFIAccountNumber = String.Empty;
+        public String ReceivingDFIIdentification = String.Empty; // Routing # first 8
+
+        public int CheckDigit; // Routing # last 1
+
+        public String DFIAccountNumber = String.Empty; // Bank Account #

         public Decimal Amount = Decimal.Zero;

@@ -584,7 +582,7 @@

         public int AddendaRecordIndicator = 0;

-        public int TraceNumber = 0;
+        public int TraceNumber = 0; // Routing # + company record count

         public override string ToString()
         {


Cleaned up

Cleaned up

--- Cheers/Cheers/Cheers.cs
+++ Cheers/Cheers/Cheers.cs
@@ -1,8 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Text.RegularExpressions;

 namespace Cheers
@@ -11,28 +7,20 @@
     {
         static void Main(string[] args)
         {
-            System.Console.WriteLine("Hello there! What's your name?");
-            string name = System.Console.ReadLine();
+            Console.WriteLine("Hello there! What's your name?");
+            string name = Console.ReadLine();
             Console.WriteLine("What's your birthday? MM/DD");
-            string birthday = System.Console.ReadLine();
+            string birthday = Console.ReadLine();
             ValidateDate(birthday);
             foreach(char letter in name)
             {
                 Output(letter);
-                string input = System.Console.ReadLine();
-                char givenLetter = input[0];
-                if (System.Char.ToUpper(givenLetter) != System.Char.ToUpper(letter) || input == "")
-                {
-                    System.Console.WriteLine("Let's try that again");
-                    Output(letter);
-                    input = System.Console.ReadLine();
-                    givenLetter = input[0];
-                }
+                ValidateLetterInput(System.Console.ReadLine(), letter);
             }
-            System.Console.WriteLine(Capitalize(name) + " is the best!!!!");
-            calculateDays(date);
-            System.Console.WriteLine("Press any key to exit");
-            System.Console.ReadKey();
+            Console.WriteLine(Capitalize(name) + " is GRAND!!!!");
+            CalculateDays(date);
+            Console.WriteLine("Press any key to exit");
+            Console.ReadKey();
         }

         static void ValidateDate(string birthday)
@@ -51,7 +39,7 @@

         }

-        static void calculateDays(DateTime birthday)
+        static void CalculateDays(DateTime birthday)
         {
             DateTime currentDate = DateTime.Today;
             DateTime next = new DateTime(currentDate.Year, birthday.Month, birthday.Day);
@@ -70,6 +58,17 @@
                 Console.WriteLine("Your birthday is in " + (next - currentDate).Days + " days!!!! Happy Birthday in advance!");
             }

+        }
+
+        static void ValidateLetterInput(string input, char letter)
+        {
+            char givenLetter = input[0];
+            if (System.Char.ToUpper(givenLetter) != System.Char.ToUpper(letter) || input == "")
+            {
+                System.Console.WriteLine("Let's try that again");
+                Output(letter);
+                ValidateLetter(System.Console.ReadLine(), letter);
+            }
         }

         static string Capitalize(string name)
@@ -97,4 +96,4 @@

         static DateTime date;
     }
-}
+}


Adds options zip entry name format to LeanData

--- Common/Util/LeanData.cs
+++ Common/Util/LeanData.cs
@@ -144,10 +144,72 @@
         }

         /// <summary>
+        /// Generate's the zip entry name to hold the specified data.
+        /// </summary>
+        public static string GenerateZipEntryName(Symbol symbol, DateTime date, Resolution resolution, TickType tickType)
+        {
+            var formattedDate = date.ToString(DateFormat.EightCharacter);
+            var isHourOrDaily = resolution == Resolution.Hour || resolution == Resolution.Daily;
+
+            switch (symbol.ID.SecurityType)
+            {
+                case SecurityType.Base:
+                case SecurityType.Equity:
+                case SecurityType.Forex:
+                case SecurityType.Cfd:
+                    if (isHourOrDaily)
+                    {
+                        return string.Format("{0}.csv", symbol.Value.ToLower());
+                    }
+
+                    return string.Format("{0}_{1}_{2}_{3}.csv",
+                        formattedDate,
+                        symbol.Value.ToLower(),
+                        resolution.ToString().ToLower(),
+                        tickType.ToString().ToLower()
+                        );
+
+                case SecurityType.Option:
+                    if (isHourOrDaily)
+                    {
+                        return string.Format("{0}_{1}_{2}_{3}_{4}_{5}.csv",
+                            symbol.Value.ToLower(),
+                            symbol.ID.OptionStyle,
+                            symbol.ID.OptionRight,
+                            symbol.ID.StrikePrice * 10000, // in deci-cents
+                            symbol.ID.Date,
+                            tickType.ToString().ToLower()
+                            );
+                    }
+
+                    return string.Format("{0}_{1}_{2}_{3}_{4}_{5:yyyyMMdd}_{6}_{7}.csv",
+                        formattedDate,
+                        symbol.Value.ToLower(),
+                        symbol.ID.OptionStyle,
+                        symbol.ID.OptionRight,
+                        symbol.ID.StrikePrice*10000, // in deci-cents
+                        symbol.ID.Date,
+                        resolution.ToString().ToLower(),
+                        tickType.ToString().ToLower()
+                        );
+
+                case SecurityType.Commodity:
+                case SecurityType.Future:
+                default:
+                    throw new ArgumentOutOfRangeException();
+            }
+        }
+
+        /// <summary>
         /// Creates the entry name for a QC zip data file
         /// </summary>
         public static string GenerateZipEntryName(string symbol, SecurityType securityType, DateTime date, Resolution resolution, TickType dataType = TickType.Trade)
         {
+            if (securityType != SecurityType.Base && securityType != SecurityType.Equity && securityType != SecurityType.Forex)
+            {
+                throw new NotImplementedException("This method only implements base, equity, and forex security type.");
+            }
+
             symbol = symbol.ToLower();

             if (resolution == Resolution.Hour || resolution == Resolution.Daily)
@@ -187,7 +249,7 @@
         /// </summary>
         private static int Scale(decimal value)
         {
-            return Convert.ToInt32(value * 10000);
+            return Convert.ToInt32(value*10000);
         }
     }
 }


Be able to add additional values to the default configuration

--- ConfigurationManager.cs
+++ ConfigurationManager.cs
@@ -1,5 +1,6 @@
 using Microsoft.Extensions.Configuration;
 using System;
+using System.Collections.Generic;

 namespace RockLib.Configuration
 {
@@ -108,10 +109,12 @@
         /// the <see cref="ConfigurationRoot"/> property has been accessed (i.e. when <see cref="IsLocked"/> is true) will
         /// result in an <see cref="InvalidOperationException"/> being thrown.</para>
         /// </summary>
+        /// <param name="additionalValues">When specified, these key/value pairs are applied to the resulting
+        /// instance of <see cref="IConfigurationRoot"/>.</param>
         /// <exception cref="InvalidOperationException">If the <see cref="IsLocked"/> property is true.</exception>
-        public static void ResetConfigurationRoot()
+        public static void ResetConfigurationRoot(IEnumerable<KeyValuePair<string, string>> additionalValues = null)
         {
-            SetConfigurationRoot(GetDefaultConfigurationRoot, true);
+            SetConfigurationRoot(() => GetDefaultConfigurationRoot(additionalValues), additionalValues == null);
         }

         private static void SetConfigurationRoot(Func<IConfigurationRoot> getConfigurationRoot, bool isDefault)
@@ -134,13 +137,16 @@
             throw new InvalidOperationException($"{nameof(ConfigurationManager)}.{nameof(ConfigurationRoot)} has been locked. Its value cannot be changed after its value has been read.");
         }

-        private static IConfigurationRoot GetDefaultConfigurationRoot()
+        private static IConfigurationRoot GetDefaultConfigurationRoot(IEnumerable<KeyValuePair<string, string>> additionalValues)
         {
-            var configurationRoot = new ConfigurationBuilder()
-                .AddRockLib()
-                .AddEnvironmentVariables()
-                .Build();
+            var builder = new ConfigurationBuilder().AddRockLib();

+            if (additionalValues != null)
+                builder = builder.AddInMemoryCollection(additionalValues);
+
+            builder = builder.AddEnvironmentVariables();
+
+            var configurationRoot = builder.Build();
             return configurationRoot;
         }
     }


try to fix exception

try to fix exception

--- Devices/Gateways/GatewayService/Gateway/Utils/Queue/GatewayQueue.cs
+++ Devices/Gateways/GatewayService/Gateway/Utils/Queue/GatewayQueue.cs
@@ -19,15 +19,14 @@
         {
             try
             {
-                OperationStatus<T> result = await Task.Factory.StartNew(() =>
+                OperationStatus<T> result = await Task.Run(() =>
                 {
                     T returnedItem;
                     bool isReturned = _Queue.TryDequeue(out returnedItem);
                     if (isReturned)
                         return OperationStatusFactory.CreateSuccess<T>(returnedItem);
                     return OperationStatusFactory.CreateError<T>(ErrorCode.NoDataReceived);
-                },
-                CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
+                });

                 return result;
             }


Whitespace fix

Whitespace fix

--- Duplicati/Library/Backend/AlternativeFTP/Properties/AssemblyInfo.cs
+++ Duplicati/Library/Backend/AlternativeFTP/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
-#region Disclaimer / License
+#region Disclaimer / License
 // Copyright (C) 2015, The Duplicati Team
 // http://www.duplicati.com, info@duplicati.com
 //


Added FileIO property

Added FileIO property

--- Core2D/Editor/Editor.cs
+++ Core2D/Editor/Editor.cs
@@ -14,6 +14,7 @@
     public class Editor : ObservableObject, IDisposable
     {
         private ILog _log;
+        private IFileSystem _fileIO;
         private Project _project;
         private string _projectPath;
         private bool _isProjectDirty;
@@ -50,6 +51,15 @@
         }

         /// <summary>
+        /// Gets or sets current file system.
+        /// </summary>
+        public IFileSystem FileIO
+        {
+            get { return _fileIO; }
+            set { Update(ref _fileIO, value); }
+        }
+
+        /// <summary>
         /// Gets or sets current project.
         /// </summary>
         public Project Project


Updated SSL certificate data for common mail servers

--- MailKit/MailService.cs
+++ MailKit/MailService.cs
@@ -341,21 +341,21 @@

 			switch (cn) {
 			case "imap.gmail.com":
-				return issuer == GMailCertificateIssuer && serial == "15E3ABFBE021A3890500000000859178" && fingerprint == "E37ADB0D16CF5EB8F9FC6401B915F59D7BE79BE9"; // Expires 3/30/2021 8:11:15 AM
+				return issuer == GMailCertificateIssuer && serial == "00A15434C2695FB1880300000000CBF786" && fingerprint == "F351BCB631771F19AF41DFF22EB0A0839092DA51"; // Expires 7/6/2021 6:15:47 AM
 			case "pop.gmail.com":
-				return issuer == GMailCertificateIssuer && serial == "00D47573DD756091B10300000000C7CDA5" && fingerprint == "AF29AA51E75C3F2C74518087E9F3B257344664F0"; // Expires 3/30/2021 8:11:16 AM
+				return issuer == GMailCertificateIssuer && serial == "00ADE0870C95CFCB30050000000087BC0D" && fingerprint == "D1E6036A1C9307CED83914B9DDFC4C84F0E9A702"; // Expires 7/6/2021 6:15:50 AM
 			case "smtp.gmail.com":
-				return issuer == GMailCertificateIssuer && serial == "00E44401FC458A1C58050000000085917D" && fingerprint == "217BC6DA8C393C1CB2FF0250DD46D656E0A6D282"; // Expires 3/30/2021 8:11:23 AM
+				return issuer == GMailCertificateIssuer && serial == "5645821E254664EF0300000000CBF788" && fingerprint == "B24907A7684FDE6875D43278B3EE880DD107ACBE"; // Expires 7/6/2021 6:15:54 AM
 			case "outlook.com":
-				return issuer == OutlookCertificateIssuer && serial == "07C8ACB7CCF0C64CEE3B1CE0CD1E9901" && fingerprint == "FEBBA28254D315A82080C6BE4B23CBC8F1E471AE"; // Expires 1/10/2022 6:59:59 PM
+				return issuer == OutlookCertificateIssuer && serial == "0CCAC32B0EF281026392B8852AB15642" && fingerprint == "CBAA1582F1E49AD1D108193B5D38B966BE4993C6"; // Expires 1/21/2022 6:59:59 PM
 			case "imap.mail.me.com":
 				return issuer == AppleCertificateIssuer && serial == "7693E9D2C3B5564F4F9A487D15A54116" && fingerprint == "FACBDEB692021F6404BE8B88A563767B282F98EE"; // Expires 10/3/2021 5:51:43 PM
 			case "smtp.mail.me.com":
 				return issuer == AppleCertificateIssuer && serial == "0A3048DECAB5CAA796E163E011CAE82E" && fingerprint == "B14CE4D4FF15FBC3C16C4848F1C632552184BD79"; // Expires 10/3/2021 6:12:03 PM
 			case "*.imap.mail.yahoo.com":
-				return issuer == YahooCertificateIssuer && serial == "0644DDCE32898E80C7B9FDD42C516396" && fingerprint == "1EC290720506325E9F48D258BD2E51E5779E85EA"; // Expires 5/25/2021 7:59:59 PM
+				return issuer == YahooCertificateIssuer && serial == "090883C7E8D9B60E60ABA19D508BD988" && fingerprint == "4018766D324ED3CC37A05D5997405E5B33A7CAEF"; // Expires 10/20/2021 7:59:59 PM
 			case "legacy.pop.mail.yahoo.com":
-				return issuer == YahooCertificateIssuer && serial == "058035C3D2AC58483DD14D3E2F9145B8" && fingerprint == "167AF555D510FACCA7B0B48EE0D10C360B512960"; // Expires 3/3/2021 7:00:00 AM
+				return issuer == YahooCertificateIssuer && serial == "0867B5394892A22A820DDFC97B22DFC4" && fingerprint == "A97792FD0708311430AD5D0431B69BA1B49B6B92"; // Expires 7/27/2021 7:59:59 PM
 			case "smtp.mail.yahoo.com":
 				return issuer == YahooCertificateIssuer && serial == "0D6261AF405FAF9B39510CBD9E630676" && fingerprint == "14CBE3DAD16D7CA9A841AEA29C5EAB535DD49701"; // Expires 6/22/2021 7:59:59 PM
 			case "mout.gmx.com":
@@ -363,7 +363,7 @@
 			case "mail.gmx.com":
 				return issuer == GmxDotComCertificateIssuer && serial == "0719A4D33A18B550133DDA3253AF6C96" && fingerprint == "948B0C3FA22BC12C91EEE5B1631A6C41B4A01B9C"; // Expires 7/12/2022 8:00:00 AM
 			case "mail.gmx.net":
-				return issuer == GmxDotNetCertificateIssuer && serial == "218296213149726650EB233346353EEA" && fingerprint == "67DED57393303E005937D5EDECB6A29C136024CA"; // Expires 5/13/2021 7:59:59 PM
+				return issuer == GmxDotNetCertificateIssuer && serial == "070E7CD59BB7AFD73E8A206219C4F011" && fingerprint == "E66DC8FE17C9A7718D17441CBE347D1D6F7BF3D2"; // Expires 5/3/2022 7:59:59 PM
 			default:
 				return false;
 			}


log message

log message

--- DbShell.Excel/Create.cs
+++ DbShell.Excel/Create.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
 using DbShell.Common;
@@ -19,6 +20,7 @@
         protected override void DoRun(IShellContext context)
         {
             string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
+            context.OutputMessage("Writing file " + Path.GetFullPath(file));
             context.SetVariable(GetExcelVariableName(context), ExcelModel.CreateFile(file));
         }
     }


Small changes.

Small changes.

--- Messages/Extensions.cs
+++ Messages/Extensions.cs
@@ -1786,12 +1786,8 @@
 			if (adapter == null)
 				throw new ArgumentNullException(nameof(adapter));

-			adapter.RemoveSupportedMessage(MessageTypes.SecurityLookup);
-			adapter.RemoveSupportedMessage(MessageTypes.PortfolioLookup);
-			adapter.RemoveSupportedMessage(MessageTypes.OrderStatus);
-			adapter.RemoveSupportedMessage(MessageTypes.Portfolio);
-			adapter.RemoveSupportedMessage(MessageTypes.BoardLookup);
-			adapter.RemoveSupportedMessage(MessageTypes.TimeFrameLookup);
+			foreach (var type in _lookupResults.Keys)
+				adapter.RemoveSupportedMessage(type);
 		}

 		/// <summary>


TypeScanner: Do not report abstract types.

Not only interfaces, but abstract classes should not be reported
as well. This is especially important in case of generated
serializer, when we have less generation and get rid of quirks
like the abstract Array type.

--- Migrant/TypeScanner.cs
+++ Migrant/TypeScanner.cs
@@ -93,7 +93,7 @@
             {
                 ScanRecursiveWithStack(typeSet, type, typeStack);
             }
-            if(!IsSerializable(typeToScan) || !typeSet.Add(typeToScan))
+            if(!IsImplementation(typeToScan) || !typeSet.Add(typeToScan))
             {
                 return;
             }
@@ -106,7 +106,7 @@
                 return;
             }
             var fields = typeToScan.GetAllFields(false).Where(Helpers.IsNotTransient);
-            var typesToAdd = fields.Select(x => x.FieldType).Where(x => !x.IsInterface)
+            var typesToAdd = fields.Select(x => x.FieldType).Where(x => IsImplementation(x))
                 .Distinct();
             foreach(var type in typesToAdd)
             {
@@ -138,9 +138,9 @@
             return type.IsPrimitive || type.IsEnum;
         }

-        private static bool IsSerializable(Type type)
+        private static bool IsImplementation(Type type)
         {
-            return !type.IsInterface; //no double checks
+            return !type.IsInterface && !type.IsAbstract;
         }

         private static bool ShouldFieldsBeScanned(Type type)