Improved color analysis performance by 400% (20ms -> 5ms)

Engine changes to get out as many frames as the serial port allows (~60fps)

--- HueLight+/Form1.cs
+++ HueLight+/Form1.cs
@@ -86,11 +86,8 @@
         const byte animationGroup = 0;
         const byte animationSpeed = 2;
         const int huePlusBaudRate = 256000;
-        const double latencyMarginStep = 0.1;
-        double latencyMargin = 11;
         byte delay = 0;
         byte fpsCounter = 0;
-        byte droppedFpsCounter = 0;
         double gamma = 1;
         int scanDepth = 100;
         int pixelsToSkipPerCoordinate = 100; // Every LED region has (scanDepth * ScreenBorderPixelsInRegion / pixelsToSkipPerCoordinate) = possible coordinates. E.g. (100 * 144 / 100) = 144 coordinates;
@@ -305,38 +302,34 @@

         private void AmbiEngine()
         {
+            frameTimer = new Stopwatch();
+            frameTimer.Start();
+
+            logger.Add("");
+            logger.Add("********************");
+            logger.Add("Starting new frame");
+
+            CalculateBuffers();
+
             while (isEngineEnabled)
             {
-                frameTimer = new Stopwatch();
-                frameTimer.Start();
-
-                while (isSendingFrame && (portWriteTimer.ElapsedMilliseconds <= latencyMargin)) ;
-
-                CalculateBuffers();
-
                 if(!isSendingFrame)
                 {
-                    logger.Add("");
-                    logger.Add("********************");
-                    logger.Add("Starting new frame");
-                    logger.Add("Calculated buffer in: " + sectionTimer.ElapsedMilliseconds);
-
                     SendBuffers();
-
-                    logger.Add("Handed off buffer to serial in: " + sectionTimer.ElapsedMilliseconds);

                     frameTimer.Stop();
                     logger.Add("Finished frame in: " + frameTimer.ElapsedMilliseconds);
                     logger.Add("********************");
                     logger.Add("");
-                }
-                else
-                {
-                    droppedFpsCounter++;
+
+                    frameTimer = new Stopwatch();
+                    frameTimer.Start();

                     logger.Add("");
-                    logger.Add("FRAME DROPPED");
-                    logger.Add("");
+                    logger.Add("********************");
+                    logger.Add("Starting new frame");
+
+                    CalculateBuffers();
                 }
             }
         }
@@ -356,6 +349,7 @@
             }

             sectionTimer.Stop();
+            logger.Add("Calculated buffer in: " + sectionTimer.ElapsedMilliseconds);
         }

         private void SendBuffers()
@@ -368,6 +362,7 @@
             SendBuffersToPort();

             sectionTimer.Stop();
+            logger.Add("Handed off buffer to serial in: " + sectionTimer.ElapsedMilliseconds);
         }

         private void EnableNextFrame()
@@ -558,25 +553,13 @@
         private void timer1_Tick_1(object sender, EventArgs e)
         {
             String fps = "FPS: " + fpsCounter.ToString();
-            String margin = "Margin: " + latencyMargin;
-            String dropped_fps = "DROP_FPS: " + droppedFpsCounter.ToString();
             String cpu = "CPU: " + (Math.Round(total_cpu.NextValue())).ToString() + " %";

             notifyIcon1.Text = "HueLight+ - " + fps + " - " + cpu;
-            label1.Text = fps + " " + dropped_fps + " " + margin;
+            label1.Text = fps;
             label2.Text = cpu;

-            if(droppedFpsCounter > 0)
-            {
-                latencyMargin += latencyMarginStep;
-            }
-            else
-            {
-                latencyMargin -= latencyMarginStep;
-            }
-
             fpsCounter = 0;
-            droppedFpsCounter = 0;
         }

         /*** FORM INTERACTION ***/


ClassRunner treats the array of methods as an IReadOnlyList<MethodInfo> where possible, as a step toward pivoting the test method OrderBy lambda to LINQ-style "key selector" semantics.

--- src/Fixie/Execution/ClassRunner.cs
+++ src/Fixie/Execution/ClassRunner.cs
@@ -132,7 +132,7 @@
             return summary;
         }

-        MethodInfo[] OrderedMethods(IReadOnlyList<MethodInfo> methods, ExecutionSummary summary)
+        IReadOnlyList<MethodInfo> OrderedMethods(IReadOnlyList<MethodInfo> methods, ExecutionSummary summary)
         {
             var orderedMethods = methods.ToArray();

@@ -156,7 +156,7 @@
             return orderedMethods;
         }

-        IEnumerable<Case> YieldCases(MethodInfo[] orderedMethods, ExecutionSummary summary)
+        IEnumerable<Case> YieldCases(IReadOnlyList<MethodInfo> orderedMethods, ExecutionSummary summary)
         {
             foreach (var method in orderedMethods)
             {


Allow DateTime in metadata.

Allow DateTime in metadata.

--- InfiniMap/Block.cs
+++ InfiniMap/Block.cs
@@ -23,7 +23,7 @@

         public override bool TrySetMember(SetMemberBinder binder, object value)
         {
-            if (value.GetType().IsPrimitive || value is string)
+            if (value.GetType().IsPrimitive || value is string || value is DateTime)
             {
                 _dictionary[binder.Name] = value;
                 return true;


Removed partial keyword since it is unneeded.

--- IronAHK/Program.cs
+++ IronAHK/Program.cs
@@ -7,7 +7,7 @@

 namespace IronAHK
 {
-    partial class Program
+    class Program
     {
         static int Main(string[] args)
         {


Added server deletion in favorites list

Added server deletion in favorites list

--- SAMP_Ex/SAMP_Ex/Forms/mainWindow.cs
+++ SAMP_Ex/SAMP_Ex/Forms/mainWindow.cs
@@ -135,5 +135,14 @@
             addServerWindow addServerForm = new addServerWindow();
             addServerForm.Show();
         }
+
+        private void toolStripBtn_deleteServer_Click(object sender, EventArgs e)
+        {
+            if (tabCtrl_serversLists.SelectedIndex == 0)
+            {
+                FavFile.DeleteServer(grid_serverList.GetSelectedServer());
+                FavFile.Save();
+            }
+        }
     }
 }


fixed unknown member bug

fixed unknown member bug

--- JSIL/CILSupport.cs
+++ JSIL/CILSupport.cs
@@ -147,14 +147,16 @@
             public readonly int HashCode;

             public readonly string Namespace;
+			public readonly string Module;
             public readonly string Name;
             public readonly string DeclaringTypeName;

             public Key (TypeReference tr) {
                 Namespace = tr.Namespace;
-                Name = tr.Name;
-
-                HashCode = Namespace.GetHashCode() ^ Name.GetHashCode();
+                Module = tr.Module.Name;
+				Name = tr.Name;
+
+				HashCode = Namespace.GetHashCode() ^ Name.GetHashCode() ^ Module.GetHashCode();

                 if (tr.DeclaringType != null) {
                     DeclaringTypeName = tr.DeclaringType.FullName;
@@ -165,9 +167,9 @@
             }

             public bool Equals (Key rhs) {
-                return (Namespace == rhs.Namespace) &&
-                    (DeclaringTypeName == rhs.DeclaringTypeName) &&
-                    (Name == rhs.Name);
+                return (Namespace == rhs.Namespace) && (Module == rhs.Module) &&
+					(DeclaringTypeName == rhs.DeclaringTypeName) &&
+					(Name == rhs.Name);
             }

             public override bool Equals (object obj) {


Descriptions & menu items text +1

Descriptions & menu items text +1

--- GhostGrid.cs
+++ GhostGrid.cs
@@ -7,11 +7,11 @@

 /// <summary>
-/// Lightweight grid component with auto snapping for the current transform and
-/// his children.
-/// Alt + A = Enable grid for selected transform
-/// Alt + S = Snap everything
-/// Alt + D = Disable all grids
+/// Lightweight grid component with auto snapping. Just add 'GhostGrid.cs' to any
+/// transform to activate the grid for him and his children.
+/// ALT + S = Snap all game objects in the grid for the selected transform
+/// ALT + A = Enable auto snap in the grid for the selected grid
+/// ALT + D = Disable all running grids
 /// </summary>
 [ExecuteInEditMode]
 public class GhostGrid : MonoBehaviour
@@ -84,10 +84,10 @@

 #if UNITY_EDITOR
     /// <summary>
-    /// Menu item to snap all game objects in the selected grid.
+    /// Menu item to snap all game objects in the grid for the selected transform.
     /// Shortcut: ALT + S
     /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Snap grid &s")]
+    [MenuItem("Jam Tools/GhostGrid/Snap Grid &s")]
     private static void SnapSelectedGrid()
     {
         GhostGrid grid = Selection.activeTransform.GetComponentInParent<GhostGrid>();
@@ -108,18 +108,19 @@
     /// <summary>
     /// Disable the previous menu item if no transform is selected.
     /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Snap grid &s", true)]
+    [MenuItem("Jam Tools/GhostGrid/Snap Grid &s", true)]
     private static bool ValidateSnapSelectedGrid()
     {
         return Selection.activeTransform != null;
     }
-
-
+
+
     /// <summary>
-    /// Menu item to enable auto snap for the selected grid.
+    /// Menu item to enable auto snap in the grid for the selected grid.
+    /// Shortcut: ALT + A
     /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Enable grid autosnap &a")]
-    private static void EnableGridAutosnap()
+    [MenuItem("Jam Tools/GhostGrid/Enable Grid Auto Snap &a")]
+    private static void EnableGridAutoSnap()
     {
         GhostGrid grid = Selection.activeTransform.GetComponentInParent<GhostGrid>();

@@ -140,8 +141,8 @@
     /// <summary>
     /// Disable the previous menu item if no transform is selected.
     /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Enable grid autosnap &a", true)]
-    private static bool ValidateEnableGridAutosnap()
+    [MenuItem("Jam Tools/GhostGrid/Enable Grid Auto Snap &a", true)]
+    private static bool ValidateEnableGridAutoSnap()
     {
         return Selection.activeTransform != null;
     }
@@ -149,9 +150,9 @@

     /// <summary>
     /// Menu item to disable all running grids.
-    /// Shortcut: Shift + D
+    /// Shortcut: ALT + D
     /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Disable all grids &d")]
+    [MenuItem("Jam Tools/GhostGrid/Disable All Grids &d")]
     private static void DisableAllGrids()
     {
         Debug.Log("GhostGrid :: All grids disabled.");


- added IrcConnection.SocketSendTimeout and IrcConnection.SocketReceiveTimeout

--- src/IrcConnection/IrcConnection.cs
+++ src/IrcConnection/IrcConnection.cs
@@ -60,6 +60,8 @@
         //private Encoding        _Encoding = Encoding.ASCII;
         //private Encoding        _Encoding = Encoding.GetEncoding(1252);
         //private Encoding        _Encoding = Encoding.UTF8;
+        private int             _SocketReceiveTimeout  = 600;
+        private int             _SocketSendTimeout = 600;

         /// <event cref="OnReadLine">
         /// Raised when a \r\n terminated line is read from the socket
@@ -244,6 +246,7 @@

         /// <summary>
         /// Encoding which is used for reading and writing to the socket
+        /// Default: ISO-8859-1
         /// </summary>
         public Encoding Encoding
         {
@@ -255,6 +258,34 @@
             }
         }

+        /// <summary>
+        /// Timeout in seconds for receiving data from the socket
+        /// Default: 600
+        /// </summary>
+        public int SocketReceiveTimeout
+        {
+            get {
+                return _SocketReceiveTimeout;
+            }
+            set {
+                _SocketReceiveTimeout = value*1000;
+            }
+        }
+
+        /// <summary>
+        /// Timeout in seconds for sending data to the socket
+        /// Default: 600
+        /// </summary>
+        public int SocketSendTimeout
+        {
+            get {
+                return _SocketSendTimeout;
+            }
+            set {
+                _SocketSendTimeout = value*1000;
+            }
+        }
+
         /// <summary>
         /// Initializes the message queues, read and write thread
         /// </summary>
@@ -313,8 +344,8 @@
                 _TcpClient = new IrcTcpClient();
                 _TcpClient.NoDelay = true;
                 // set timeout to 6 minutes, after this the connection will be aborted
-                _TcpClient.ReceiveTimeout = 360000;
-                _TcpClient.SendTimeout = 360000;
+                _TcpClient.ReceiveTimeout = _SocketReceiveTimeout;
+                _TcpClient.SendTimeout = _SocketSendTimeout;
                 _TcpClient.Connect(ip, port);
                 if (OnConnected != null) {
                     OnConnected(this, EventArgs.Empty);


Fix CloseOnClickBackground behavior

Fix CloseOnClickBackground behavior

LightBox is now close on click background area.

--- Lighty/LightBox.cs
+++ Lighty/LightBox.cs
@@ -224,6 +224,9 @@
                 var container = this.ContainerFromElement(dialog) as FrameworkElement;
                 container.Focus();

+                // CloseOnClickBackgroundが有効な場合に、lightbox内のMouseLeftButtonDownイベントがバブルアップしないようにする。
+                container.MouseLeftButtonDown += (s, e) => { e.Handled = true; };
+
                 var transform = new TransformGroup();
                 transform.Children.Add(new ScaleTransform());
                 transform.Children.Add(new SkewTransform());


UNITY_EDITOR code fixed to avoid a Unity serialized variables warning

--- GhostGrid.cs
+++ GhostGrid.cs
@@ -11,11 +11,12 @@
 // 07/01/2015 3:21 am

+using UnityEngine;
+using System.Collections.Generic;
+
 #if UNITY_EDITOR
-using UnityEngine;
 using UnityEditor;
-using System.Collections.Generic;
-
+#endif

 [ExecuteInEditMode]
 public class GhostGrid : MonoBehaviour
@@ -48,6 +49,7 @@
     private const string NOT_FOUND = "GhostGrid :: GhostGrid not found on selected GameObject (or parents).";

+#if UNITY_EDITOR
     void Update()
     {
         if (!doAutoSnap)
@@ -430,5 +432,5 @@
     {
         return Selection.activeTransform != null;
     }
+#endif
 }
-#endif


Fixed resource leak when resizing viewport

--- SRPRendering/ScriptRenderControl.cs
+++ SRPRendering/ScriptRenderControl.cs
@@ -473,6 +473,9 @@
 				// If there's no resource, or it's the wrong size, create a new one.
 				if (desc.renderTarget == null || desc.renderTarget.Width != width || desc.renderTarget.Width != width)
 				{
+					// Don't forget to release the old one.
+					desc.renderTarget?.Dispose();
+
 					desc.renderTarget = new RenderTarget(device, width, height);
 				}
 			}


完成PHP面板功能

完成PHP面板功能

--- SalamanderWnmp/UI/CodePanel.xaml.cs
+++ SalamanderWnmp/UI/CodePanel.xaml.cs
@@ -11,7 +11,7 @@
 namespace SalamanderWnmp.UI
 {
     /// <summary>
-    /// JSPanel.xaml 的交互逻辑
+    /// CodePanel.xaml 的交互逻辑
     /// </summary>
     public partial class CodePanel : Window
     {
@@ -60,6 +60,13 @@
             }
         }

+        /// <summary>
+        /// 执行代码委托
+        /// </summary>
+        /// <param name="code"></param>
+        /// <returns></returns>
+        private delegate string RunCode(string code);
+
         private void btn_Click(object sender, RoutedEventArgs e)
         {
             this.Close();
@@ -74,7 +81,20 @@
                 MessageBox.Show("请输入代码");
                 return;
             }
-            this.txtOutput.Text = RunNode(code);
+            RunCode runCode = null;
+            switch(selectedLan)
+            {
+                case ProgramLan.JavaScript:
+                    runCode = RunNode;
+                    break;
+                case ProgramLan.PHP:
+                    runCode = RunPHP;
+                    break;
+                default:
+                    runCode = DefaultRunCode;
+                    break;
+            }
+            this.txtOutput.Text = runCode(code);
         }

         /// <summary>
@@ -112,6 +132,47 @@

         }

+        /// <summary>
+        /// 运行PHP脚本
+        /// </summary>
+        /// <param name="code"></param>
+        private string RunPHP(string code)
+        {
+            Process scriptProc = new Process();
+            ProcessStartInfo info = new ProcessStartInfo();
+            info.FileName = Constants.APP_STARTUP_PATH + "/" + Common.Settings.PHPDirName.Value
+                + "/php.exe";
+            info.Arguments = "-r " + String.Format("\"{0}\"", code);
+            info.RedirectStandardError = true;
+            info.RedirectStandardOutput = true;
+            info.UseShellExecute = false;
+            info.CreateNoWindow = true;
+            scriptProc.StartInfo = info;
+            try
+            {
+                scriptProc.Start();
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("PHP目录不存在！");
+                return "";
+            }
+            string outStr = scriptProc.StandardOutput.ReadToEnd();
+            // 有错误，读取错误信息
+            if (String.IsNullOrEmpty(outStr))
+            {
+                outStr = scriptProc.StandardError.ReadToEnd();
+            }
+            scriptProc.Close();
+            return outStr;
+
+        }
+
+        public string DefaultRunCode(string code)
+        {
+            return "还未实现哦 \\(•◡•)/";
+        }
+
         private void txtCode_PreviewKeyDown(object sender, KeyEventArgs e)
         {
             if(e.Key == Key.Tab)
@@ -129,7 +190,7 @@

         private void btnClear_Click(object sender, RoutedEventArgs e)
         {
-
+            this.txtOutput.Text = "";
         }
     }
 }


修复用户成员中指定角色不存在导致的空引用错误。 :lemon:

修复用户成员中指定角色不存在导致的空引用错误。 :lemon:

--- src/Membership/MembershipHelper.cs
+++ src/Membership/MembershipHelper.cs
@@ -101,19 +101,17 @@
 				@namespace = role.Namespace;
 			}

-			//获取指定用户所属命名空间下的所有角色（注：禁止分页查询，并即时加载到数组中）
-			var roles = dataAccess.Select<IRole>(Condition.Equal(nameof(IRole.Namespace), @namespace), Paging.Disable).ToArray();
-
-			//获取指定用户所属命名空间下的所有角色成员定义（注：禁止分页查询，并即时加载到数组中）
-			var members = dataAccess.Select<Member>(Condition.In(nameof(Member.RoleId), roles.Select(p => p.RoleId)), Paging.Disable).ToArray();
+			//获取指定用户所属命名空间下的所有成员及其关联的角色对象（注：即时加载到内存中）
+			var members = dataAccess.Select<Member>(Condition.Equal("Role.Namespace", @namespace), "*, Role{*}")
+			                        .Where(m => m.Role != null)
+			                        .ToArray();

 			flats = new HashSet<IRole>();
 			hierarchies = new List<IEnumerable<IRole>>();

 			//从角色成员集合中查找出指定成员的父级角色
 			var parents = members.Where(m => m.MemberId == memberId && m.MemberType == memberType)
-			                     .Select(m => roles.FirstOrDefault(role => role.RoleId == m.RoleId))
-			                     .ToArray();
+			                     .Select(m => m.Role).ToArray();

 			//如果父级角色集不为空
 			while(parents.Any())
@@ -125,7 +123,7 @@

 				//从角色成员集合中查找出当前层级中所有角色的父级角色集合（并进行全局去重）
 				parents = members.Where(m => parents.Any(p => p.RoleId == m.MemberId) && m.MemberType == MemberType.Role)
-				                 .Select(m => roles.FirstOrDefault(role => role.RoleId == m.RoleId))
+				                 .Select(m => m.Role)
 				                 .Except(flats).ToArray();
 			}


Obsolete enum.

Obsolete enum.

--- src/Micro+/Query/CommandExecute.cs
+++ src/Micro+/Query/CommandExecute.cs
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace MicroORM.Query
-{
-    enum CommandExecute
-    {
-        ExecuteScalar
-    }
-}


Made tip text optional for label sliders

--- SensusUI/Inputs/LabelSliderInput.cs
+++ SensusUI/Inputs/LabelSliderInput.cs
@@ -25,6 +25,7 @@
         private double _maximum;
         private string _leftLabel;
         private string _rightLabel;
+        private string _tipText;
         private double _increment;
         private Slider _slider;
         private double _incrementalValue;
@@ -107,6 +108,19 @@
             }
         }

+        [EntryStringUiProperty("Tip text:", true, 3)]
+        public string TipText
+        {
+            get
+            {
+                return _tipText;
+            }
+            set
+            {
+                _tipText = value;
+            }
+        }
+
         public override bool Enabled
         {
             get
@@ -153,7 +167,6 @@

         public override View GetView(int index)
         {
-            string tipText = "  Please move the slider below.";

             if (base.GetView(index) == null && _maximum > _minimum)
             {
@@ -175,7 +188,7 @@
                 _incrementalValueHasChanged = false;

                 _sliderLabel = CreateLabel(index);
-                _sliderLabel.Text += tipText;
+                _sliderLabel.Text += _tipText;

                 _slider.ValueChanged += (o, e) =>
                     {


remove FUNCTIONS_EXTENSION_VERSION from app settings before assigning site to user, works around always setting is in Load() and Create()

--- SimpleWAWS/Code/ResourcesManager.cs
+++ SimpleWAWS/Code/ResourcesManager.cs
@@ -253,6 +253,11 @@
                     site.AppSettings["MONACO_EXTENSION_VERSION"] = SimpleSettings.MonacoExtensionVersion;
                     site.AppSettings["WEBSITE_TRY_MODE"] = "1";

+                    if (site.AppSettings.ContainsKey("FUNCTIONS_EXTENSION_VERSION"))
+                    {
+                        site.AppSettings.Remove("FUNCTIONS_EXTENSION_VERSION");
+                    }
+
                     if (template.Name.Equals("ASP.NET + Azure Search Site", StringComparison.OrdinalIgnoreCase))
                     {
                         site.AppSettings["SearchServiceName"] = SimpleSettings.SearchServiceName;


git-svn-id: 75210f800c74dac7ab89a5be233e5d30c702c3e4@317 a0bf3537-8e53-448f-ae4a-0b965e85af5e

--- Sinobyl/Sinobyl.Engine/ChessEval.cs
+++ Sinobyl/Sinobyl.Engine/ChessEval.cs
@@ -31,6 +31,8 @@
         public static readonly ChessEval Default = new ChessEval();

         public static int TotalEvalCount = 0;
+
+        public bool UseMobilityTargets { get; set; }

         public ChessEval()
             : this(ChessEvalSettings.Default())
@@ -213,7 +215,9 @@
         {
             int retval = 0;
             PhasedScore mobility = 0;
+            var him = me.PlayerOther();
             var myAttacks = info.Attacks[(int)me];
+            var hisAttacks = info.Attacks[(int)him];

             ChessBitboard myPieces = board[me];
             ChessBitboard pieceLocationsAll = board.PieceLocationsAll;
@@ -225,6 +229,11 @@
                | board[ChessPieceType.Rook]
                | board[ChessPieceType.Queen]);

+            ChessBitboard MobilityTargets = ~myPieces;// &~(hisAttacks.PawnEast | hisAttacks.PawnWest);
+            if (UseMobilityTargets)
+            {
+                MobilityTargets = ~myPieces & ~(hisAttacks.PawnEast | hisAttacks.PawnWest);
+            }

             while (slidersAndKnights != ChessBitboard.Empty) //foreach(ChessPosition pos in slidersAndKnights.ToPositions())
             {
@@ -247,7 +256,7 @@
                         break;
                     case ChessPieceType.Rook:
                         slidingAttacks = MagicBitboards.RookAttacks(pos, pieceLocationsAll);
-                        myAttacks.RookQueen |= slidingAttacks;
+                        myAttacks.Rook |= slidingAttacks;
                         if ((pos.GetFile().Bitboard() & pawns & myPieces) == ChessBitboard.Empty)
                         {
                             if ((pos.GetFile().Bitboard() & pawns) == ChessBitboard.Empty)
@@ -262,13 +271,12 @@
                         break;
                     case ChessPieceType.Queen:
                         slidingAttacks = MagicBitboards.QueenAttacks(pos, pieceLocationsAll);
-                        myAttacks.RookQueen |= slidingAttacks;
+                        myAttacks.Queen |= slidingAttacks;
                         break;
                 }
-                //
-                ChessBitboard slidingMoves = slidingAttacks & ~myPieces;
-                int moveCount = slidingMoves.BitCount();
-                mobility = mobility.Add(_mobilityPieceTypeCount[(int)pieceType][moveCount]);
+
+                int mobilityCount = (slidingAttacks & MobilityTargets).BitCount();
+                mobility = mobility.Add(_mobilityPieceTypeCount[(int)pieceType][mobilityCount]);
             }

             myAttacks.Mobility = mobility;
@@ -329,8 +337,8 @@
         public ChessBitboard Knight;
         public ChessBitboard Bishop;

-        public ChessBitboard RookQueen;
-
+        public ChessBitboard Rook;
+        public ChessBitboard Queen;
         public ChessBitboard King;

         public PhasedScore Mobility;
@@ -341,14 +349,15 @@
             PawnWest = ChessBitboard.Empty;
             Knight = ChessBitboard.Empty;
             Bishop = ChessBitboard.Empty;
-            RookQueen = ChessBitboard.Empty;
+            Rook = ChessBitboard.Empty;
+            Queen = ChessBitboard.Empty;
             King = ChessBitboard.Empty;
             Mobility = 0;
         }

         public ChessBitboard All()
         {
-            return PawnEast | PawnWest | Knight | Bishop | RookQueen | King;
+            return PawnEast | PawnWest | Knight | Bishop | Rook | Queen | King;
         }

         public ChessEvalAttackInfo Reverse()
@@ -359,7 +368,8 @@
                 PawnWest = PawnWest.Reverse(),
                 Knight = Knight.Reverse(),
                 Bishop = Bishop.Reverse(),
-                RookQueen = RookQueen.Reverse(),
+                Rook = Rook.Reverse(),
+                Queen = Queen.Reverse(),
                 King = King.Reverse()
             };
         }


Add better exception message when 0000-00-00 can't be converted #690

Signed-off-by: Roma Marusyk <fc0985c2e6920ac04b9293b401b535305076fabd@gmail.com>

--- src/MySqlConnector/Core/TextRow.cs
+++ src/MySqlConnector/Core/TextRow.cs
@@ -145,7 +145,7 @@
 					return DateTime.MinValue;
 				if (Connection.AllowZeroDateTime)
 					return new MySqlDateTime();
-				throw new InvalidCastException("Unable to convert MySQL date/time to System.DateTime.");
+				throw new InvalidCastException("Unable to convert MySQL date/time to System.DateTime, set AllowZeroDateTime=True or ConvertZeroDateTime=True in the connection string. See https://mysqlconnector.net/connection-options/");
 			}

 			int hour, minute, second, microseconds;


#54 Added the message box again but only show it if the application is not currently running

--- src/NAppUpdate.Updater/AppStart.cs
+++ src/NAppUpdate.Updater/AppStart.cs
@@ -20,6 +20,7 @@
 		private static NauIpc.NauDto _dto;
 		private static string _logFilePath = string.Empty;
 		private static string _workingDir = string.Empty;
+		private static bool _appRunning = true;

 		private static void Main()
 		{
@@ -33,6 +34,11 @@
 				Environment.ExitCode = Marshal.GetHRForException(ex);

 				Log(ex);
+
+				if (!_appRunning && !_args.Log && !_args.ShowConsole)
+				{
+					MessageBox.Show(ex.ToString());
+				}

 				EventLog.WriteEntry("NAppUpdate.Updater", ex.ToString(), EventLogEntryType.Error);
 			}
@@ -121,6 +127,7 @@
 				finally
 				{
 					Log("The application has terminated (as expected)");
+					_appRunning = false;
 				}
 			}

@@ -204,6 +211,7 @@
 				try
 				{
 					NauIpc.LaunchProcessAndSendDto(_dto, info, syncProcessName);
+					_appRunning = true;
 				}
 				catch (Exception ex)
 				{


#2319 Parent parameter references should be resolved before consolidating duplicates in operation parameters (#2334)

--- src/NSwag.Core/OpenApiOperation.cs
+++ src/NSwag.Core/OpenApiOperation.cs
@@ -114,13 +114,11 @@
             {
                 var parameters = Parameters.Select(p => p.ActualParameter);
                 var allParameters = Parent?.Parameters == null ? parameters :
-                    parameters.Concat(Parent.Parameters)
+                    parameters.Concat(Parent.Parameters.Select(p => p.ActualParameter))
                     .GroupBy(p => p.Name + "|" + p.Kind)
                     .Select(p => p.First());

-                return new ReadOnlyCollection<OpenApiParameter>(allParameters
-                    .Select(p => p.ActualParameter)
-                    .ToList());
+                return new ReadOnlyCollection<OpenApiParameter>(allParameters.ToList());
             }
         }


Hgit has requirements now too

Hgit has requirements now too

--- src/NadekoBot/Modules/Help/Help.cs
+++ src/NadekoBot/Modules/Help/Help.cs
@@ -136,7 +136,7 @@
                     helpstr.AppendLine("----------------|--------------|-------");
                     lastModule = com.Module.Name;
                 }
-                helpstr.AppendLine($"`{com.Text}` {string.Join(" ", com.Aliases.Skip(1).Select(a=>"`"+a+"`"))} | {com.Remarks} | {com.Summary}");
+                helpstr.AppendLine($"`{com.Text}` {string.Join(" ", com.Aliases.Skip(1).Select(a=>"`"+a+"`"))} | {com.Remarks} | {com.Summary} {GetCommandRequirements(com)}");
             }
             helpstr = helpstr.Replace(NadekoBot.Client.GetCurrentUser().Username , "@BotName");
 #if DEBUG


cleanup

cleanup

--- src/Peachpie.Runtime/Comparison.cs
+++ src/Peachpie.Runtime/Comparison.cs
@@ -311,17 +311,13 @@
 		/// <remarks>Note that this comparison is not transitive (e.g. {"2","10","10a"} leads to a contradiction).</remarks>
         public static int Compare(string sx, string sy)
         {
-            long lx, ly;
-            double dx, dy;
-            Convert.NumberInfo info_x, info_y;
-
-            info_x = Convert.StringToNumber(sx, out lx, out dx);
+            var info_x = Convert.StringToNumber(sx, out var lx, out var dx);

             // an operand is not entirely convertable to numbers => string comparison is performed:
             if ((info_x & Convert.NumberInfo.IsNumber) == 0)
                 return string.CompareOrdinal(sx, sy);

-            info_y = Convert.StringToNumber(sy, out ly, out dy);
+            var info_y = Convert.StringToNumber(sy, out var ly, out var dy);

             // an operand is not entirely convertable to numbers => string comparison is performed:
             if ((info_y & Convert.NumberInfo.IsNumber) == 0)
@@ -340,10 +336,7 @@
         {
             Debug.Assert(sx != null);

-            double dx;
-            long lx;
-
-            switch (Convert.StringToNumber(sx, out lx, out dx) & Convert.NumberInfo.TypeMask)
+            switch (Convert.StringToNumber(sx, out var lx, out var dx) & Convert.NumberInfo.TypeMask)
             {
                 case Convert.NumberInfo.Double: return Compare(dx, (double)ly);
                 case Convert.NumberInfo.LongInteger: return Compare(lx, ly);
@@ -357,11 +350,8 @@
         public static int Compare(string/*!*/sx, double dy)
         {
             Debug.Assert(sx != null);
-
-            double dx;
-            long lx;
-
-            switch (Convert.StringToNumber(sx, out lx, out dx) & Convert.NumberInfo.TypeMask)
+
+            switch (Convert.StringToNumber(sx, out var lx, out var dx) & Convert.NumberInfo.TypeMask)
             {
                 case Convert.NumberInfo.Double: return Compare(dx, dy);
                 case Convert.NumberInfo.LongInteger: return Compare((double)lx, dy);
@@ -379,10 +369,7 @@
         {
             Debug.Assert(x != null);

-            double dx;
-            long lx;
-
-            switch (Convert.StringToNumber(x, out lx, out dx) & Convert.NumberInfo.TypeMask)
+            switch (Convert.StringToNumber(x, out var lx, out var dx) & Convert.NumberInfo.TypeMask)
             {
                 case Convert.NumberInfo.Double: return dx == ly;
                 case Convert.NumberInfo.LongInteger: return lx == ly;
@@ -400,10 +387,7 @@
         {
             Debug.Assert(x != null);

-            double dx;
-            long lx;
-
-            switch (Convert.StringToNumber(x, out lx, out dx) & Convert.NumberInfo.TypeMask)
+            switch (Convert.StringToNumber(x, out var lx, out var dx) & Convert.NumberInfo.TypeMask)
             {
                 case Convert.NumberInfo.Double: return dx == dy;
                 case Convert.NumberInfo.LongInteger: return lx == dy;
@@ -417,13 +401,13 @@
     /// </summary>
     public static class StrictComparison
     {
-        public static bool Ceq(bool bx, PhpValue y) => y.IsBoolean(out bool by) && bx == by;
-        public static bool Ceq(long lx, PhpValue y) => y.IsLong(out long ly) && lx == ly;
+        public static bool Ceq(bool bx, PhpValue y) => y.IsBoolean(out var by) && bx == by;
+        public static bool Ceq(long lx, PhpValue y) => y.IsLong(out var ly) && lx == ly;
         public static bool Ceq(long lx, PhpNumber y) => y.IsLong && lx == y.Long;
-        public static bool Ceq(double dx, PhpValue y) => y.IsDouble(out double dy) && dx == dy;
+        public static bool Ceq(double dx, PhpValue y) => y.IsDouble(out var dy) && dx == dy;
         public static bool Ceq(double dx, PhpNumber y) => y.IsDouble && dx == y.Double;

-        public static bool Ceq(PhpValue x, bool by) => x.IsBoolean(out bool bx) && bx == by;
+        public static bool Ceq(PhpValue x, bool by) => x.IsBoolean(out var bx) && bx == by;

         public static bool Ceq(PhpValue x, PhpValue y) => x.StrictEquals(y);


Controller input.

Controller input.

--- scripts/game/main.cs
+++ scripts/game/main.cs
@@ -9,6 +9,7 @@

 $pref::PSSM::smallestVisiblePixelSize = 10;
 $pref::Shadows::filterMode = "SoftShadowHighQuality";
+$enableDirectInput = true;

 //-----------------------------------------------------------------------------
 // Called when all datablocks have been transmitted.
@@ -48,6 +49,8 @@
 //-----------------------------------------------------------------------------
 function setupControls() {
    new ActionMap(MoveMap);
+   MoveMap.push();
+
    MoveMap.bind("keyboard", "w", forwards);
    MoveMap.bind("keyboard", "s", backwards);
    MoveMap.bind("keyboard", "a", left);
@@ -55,7 +58,12 @@
    MoveMap.bind("keyboard", "space", attack);
    MoveMap.bind("keyboard", "lcontrol", bubble);
    MoveMap.bind("keyboard", "lshift", creep);
-   MoveMap.push();
+
+   MoveMap.bind("gamepad", "btn_a", attack);
+   MoveMap.bind("gamepad", "btn_b", bubble);
+   MoveMap.bind("gamepad", "btn_x", creep);
+   MoveMap.bind("gamepad", "thumblx", "D", "-0.23 0.23", right);
+   MoveMap.bind("gamepad", "thumbly", "D", "-0.23 0.23", forwards);

    $MovementHz = 50;
    $MovementMillis = 1000 / $MovementHz;


Fix exclusion of pull requests from generated changelog

--- scripts/library.cake
+++ scripts/library.cake
@@ -162,9 +162,14 @@
     };

     var releases = await client.Repository.Release.GetAll(owner, project);
-    var issues = (await client.Issue.GetAllForRepository(owner, project, new RepositoryIssueRequest { State = ItemStateFilter.Closed }))
-        .Where(x => x.PullRequest == null && !x.Labels.Select(l => l.Name).Intersect(new[] { "duplicate", "invalid", "wontfix", "internal" }).Any());
-    var pullRequests = (await client.PullRequest.GetAllForRepository(owner, project, new PullRequestRequest { State = ItemStateFilter.Closed })).Where(x => x.Merged);
+    var allIssues = await client.Issue.GetAllForRepository(owner, project, new RepositoryIssueRequest { State = ItemStateFilter.Closed });
+    var excludedLabels = new[] { "duplicate", "invalid", "wontfix", "internal" };
+    var issues = allIssues.Where(x => x.PullRequest == null && !x.Labels.Select(l => l.Name).Intersect(excludedLabels).Any());
+    var pullRequestsLabels = allIssues
+        .Where(x => x.PullRequest != null)
+        .ToDictionary(x => x.Number, x => x.Labels.Select(l => l.Name));
+    var pullRequests = (await client.PullRequest.GetAllForRepository(owner, project, new PullRequestRequest { State = ItemStateFilter.Closed }))
+        .Where(x => x.Merged && !pullRequestsLabels[x.Number].Intersect(excludedLabels).Any());
     var links = releases.Zip(releases.Skip(1), (a, b) => $"[{a.Name}]: https://github.com/{owner}/{project}/compare/{b.TagName}...{a.TagName}").ToList();

     var builder = new StringBuilder();


Fixed rfc2047 tokenizer

Fixed rfc2047 tokenizer

--- MimeKit/Rfc2047.cs
+++ MimeKit/Rfc2047.cs
@@ -184,7 +184,7 @@
 					inptr++;

 				if (inptr > text)
-					lwsp = new Token ((int) (inptr - input), (int) (inptr - text));
+					lwsp = new Token ((int) (text - input), (int) (inptr - text));
 				else
 					lwsp = null;


Fix margins

Fix margins

--- src/RazorLight/RazorLightEngine.cs
+++ src/RazorLight/RazorLightEngine.cs
@@ -1,163 +1,162 @@
 using System;
 using System.Dynamic;
 using System.IO;
-using RazorLight.Caching;
 using RazorLight.Compilation;
 using RazorLight.Rendering;
 using RazorLight.Templating;

 namespace RazorLight
 {
-	public class RazorLightEngine
-	{
-		private readonly IEngineCore core;
-		private readonly IPageLookup pageLookup;
+    public class RazorLightEngine
+    {
+        private readonly IEngineCore core;
+        private readonly IPageLookup pageLookup;

-		public RazorLightEngine(IEngineCore core, IPageLookup pagelookup)
-		{
-			if (core == null)
-			{
-				throw new ArgumentNullException(nameof(core));
-			}
+        public RazorLightEngine(IEngineCore core, IPageLookup pagelookup)
+        {
+            if (core == null)
+            {
+                throw new ArgumentNullException(nameof(core));
+            }

-			if (pagelookup == null)
-			{
-				throw new ArgumentNullException();
-			}
+            if (pagelookup == null)
+            {
+                throw new ArgumentNullException();
+            }

-			this.core = core;
-			this.pageLookup = pagelookup;
-			this.Configuration = core.Configuration;
-		}
+            this.core = core;
+            this.pageLookup = pagelookup;
+            this.Configuration = core.Configuration;
+        }

-		public IEngineConfiguration Configuration { get; }
-
-		/// <summary>
-		/// Parses a template with a given <paramref name="key" />
-		/// </summary>
-		/// <typeparam name="T">Type of the Model</typeparam>
-		/// <param name="key">Key used to resolve a template</param>
-		/// <param name="model">Template model</param>
-		/// <returns>Returns parsed string</returns>
-		public string Parse<T>(string key, T model)
-		{
-			return Parse(key, model, typeof(T), viewBag: null);
-		}
+        public IEngineConfiguration Configuration { get; }

         /// <summary>
-		/// Parses a template with a given <paramref name="key" /> and viewBag
-		/// </summary>
-		/// <param name="key">Key used to resolve a template</param>
-		/// <param name="model">Template model</param>
-		/// <param name="viewBag">Dynamic ViewBag (can be null)</param>
-		/// <returns>Returns parsed string</returns>
-		/// <remarks>Result is stored in cache</remarks>
-	    public string Parse<T>(string key, T model, ExpandoObject viewBag)
-	    {
-	        return Parse(key, model, typeof(T), viewBag);
-	    }
+        /// Parses a template with a given <paramref name="key" />
+        /// </summary>
+        /// <typeparam name="T">Type of the Model</typeparam>
+        /// <param name="key">Key used to resolve a template</param>
+        /// <param name="model">Template model</param>
+        /// <returns>Returns parsed string</returns>
+        public string Parse<T>(string key, T model)
+        {
+            return Parse(key, model, typeof(T), viewBag: null);
+        }

-		/// <summary>
-		/// Parses a template with a given <paramref name="key" />
-		/// </summary>
-		/// <param name="key">Key used to resolve a template</param>
-		/// <param name="model">Template model</param>
-		/// <param name="modelType">Type of the model</param>
-		/// <param name="viewBag">Dynamic ViewBag (can be null)</param>
-		/// <returns>Returns parsed string</returns>
-		/// <remarks>Result is stored in cache</remarks>
-		public string Parse(string key, object model, Type modelType, ExpandoObject viewBag)
-		{
-			PageLookupResult result = pageLookup.GetPage(key);
+        /// <summary>
+        /// Parses a template with a given <paramref name="key" /> and viewBag
+        /// </summary>
+        /// <param name="key">Key used to resolve a template</param>
+        /// <param name="model">Template model</param>
+        /// <param name="viewBag">Dynamic ViewBag (can be null)</param>
+        /// <returns>Returns parsed string</returns>
+        /// <remarks>Result is stored in cache</remarks>
+        public string Parse<T>(string key, T model, ExpandoObject viewBag)
+        {
+            return Parse(key, model, typeof(T), viewBag);
+        }

-			if (!result.Success)
-			{
-				throw new RazorLightException($"Can't find a view with a specified key ({key})");
-			}
+        /// <summary>
+        /// Parses a template with a given <paramref name="key" />
+        /// </summary>
+        /// <param name="key">Key used to resolve a template</param>
+        /// <param name="model">Template model</param>
+        /// <param name="modelType">Type of the model</param>
+        /// <param name="viewBag">Dynamic ViewBag (can be null)</param>
+        /// <returns>Returns parsed string</returns>
+        /// <remarks>Result is stored in cache</remarks>
+        public string Parse(string key, object model, Type modelType, ExpandoObject viewBag)
+        {
+            PageLookupResult result = pageLookup.GetPage(key);

-			var pageContext = new PageContext(viewBag) { ModelTypeInfo = new ModelTypeInfo(modelType) };
-			foreach (var viewStartPage in result.ViewStartEntries)
-			{
-				pageContext.ViewStartPages.Add(viewStartPage.PageFactory());
-			}
+            if (!result.Success)
+            {
+                throw new RazorLightException($"Can't find a view with a specified key ({key})");
+            }

-			TemplatePage page = result.ViewEntry.PageFactory();
-			page.PageContext = pageContext;
+            var pageContext = new PageContext(viewBag) { ModelTypeInfo = new ModelTypeInfo(modelType) };
+            foreach (var viewStartPage in result.ViewStartEntries)
+            {
+                pageContext.ViewStartPages.Add(viewStartPage.PageFactory());
+            }

-			return RunTemplate(page, model);
-		}
+            TemplatePage page = result.ViewEntry.PageFactory();
+            page.PageContext = pageContext;

-		/// <summary>
-		/// Parses a string
-		/// </summary>
-		/// <typeparam name="T">Type of the model</typeparam>
-		/// <param name="content">Template to parse</param>
-		/// <param name="model">Template model</param>
-		/// <returns>Returns parsed string</returns>
-		/// <remarks>Result is not cached</remarks>
-		public string ParseString<T>(string content, T model)
-		{
-			return ParseString(content, model, typeof(T));
-		}
+            return RunTemplate(page, model);
+        }

-		/// <summary>
-		/// Parses a string
-		/// </summary>
-		/// <param name="content">Template to parse</param>
-		/// <param name="model">Template model</param>
-		/// <param name="modelType">Type of the model</param>
-		/// <returns></returns>
-		public string ParseString(string content, object model, Type modelType)
-		{
-			if (string.IsNullOrEmpty(content))
-			{
-				throw new ArgumentNullException(nameof(content));
-			}
+        /// <summary>
+        /// Parses a string
+        /// </summary>
+        /// <typeparam name="T">Type of the model</typeparam>
+        /// <param name="content">Template to parse</param>
+        /// <param name="model">Template model</param>
+        /// <returns>Returns parsed string</returns>
+        /// <remarks>Result is not cached</remarks>
+        public string ParseString<T>(string content, T model)
+        {
+            return ParseString(content, model, typeof(T));
+        }

-			ITemplateSource templateSource = new LoadedTemplateSource(content);
+        /// <summary>
+        /// Parses a string
+        /// </summary>
+        /// <param name="content">Template to parse</param>
+        /// <param name="model">Template model</param>
+        /// <param name="modelType">Type of the model</param>
+        /// <returns></returns>
+        public string ParseString(string content, object model, Type modelType)
+        {
+            if (string.IsNullOrEmpty(content))
+            {
+                throw new ArgumentNullException(nameof(content));
+            }

-			ModelTypeInfo modelTypeInfo = new ModelTypeInfo(modelType);
-			CompilationResult result = core.CompileSource(templateSource, modelTypeInfo);
-			result.EnsureSuccessful();
+            ITemplateSource templateSource = new LoadedTemplateSource(content);

-			TemplatePage page = Activate(result.CompiledType);
-			page.PageContext = new PageContext() { ModelTypeInfo = modelTypeInfo };
+            ModelTypeInfo modelTypeInfo = new ModelTypeInfo(modelType);
+            CompilationResult result = core.CompileSource(templateSource, modelTypeInfo);
+            result.EnsureSuccessful();

-			return RunTemplate(page, model);
-		}
+            TemplatePage page = Activate(result.CompiledType);
+            page.PageContext = new PageContext() { ModelTypeInfo = modelTypeInfo };

-		/// <summary>
-		/// Creates an instance of the compiled type and casts it to TemplatePage
-		/// </summary>
-		/// <param name="compiledType">Type to activate</param>
-		/// <returns>Template page</returns>
-		public TemplatePage Activate(Type compiledType)
-		{
-			return (TemplatePage)Configuration.Activator.CreateInstance(compiledType);
-		}
+            return RunTemplate(page, model);
+        }

-		/// <summary>
-		/// Runs a template, renders a Layout pages and sections.
-		/// </summary>
-		/// <param name="page">Page to run</param>
-		/// <param name="model">Mode of the page</param>
-		public string RunTemplate(TemplatePage page, object model)
-		{
-			object pageModel = page.PageContext.ModelTypeInfo.CreateTemplateModel(model);
-			page.SetModel(pageModel);
-			page.Path = page.PageContext.ExecutingFilePath;
+        /// <summary>
+        /// Creates an instance of the compiled type and casts it to TemplatePage
+        /// </summary>
+        /// <param name="compiledType">Type to activate</param>
+        /// <returns>Template page</returns>
+        public TemplatePage Activate(Type compiledType)
+        {
+            return (TemplatePage)Configuration.Activator.CreateInstance(compiledType);
+        }

-			using (var writer = new StringWriter())
-			{
-				page.PageContext.Writer = writer;
+        /// <summary>
+        /// Runs a template, renders a Layout pages and sections.
+        /// </summary>
+        /// <param name="page">Page to run</param>
+        /// <param name="model">Mode of the page</param>
+        public string RunTemplate(TemplatePage page, object model)
+        {
+            object pageModel = page.PageContext.ModelTypeInfo.CreateTemplateModel(model);
+            page.SetModel(pageModel);
+            page.Path = page.PageContext.ExecutingFilePath;

-				using (var renderer = new PageRenderer(page, pageLookup))
-				{
-					renderer.ViewStartPages.AddRange(page.PageContext.ViewStartPages);
-					renderer.RenderAsync(page.PageContext).Wait();
-					return writer.ToString();
-				}
-			}
-		}
-	}
+            using (var writer = new StringWriter())
+            {
+                page.PageContext.Writer = writer;
+
+                using (var renderer = new PageRenderer(page, pageLookup))
+                {
+                    renderer.ViewStartPages.AddRange(page.PageContext.ViewStartPages);
+                    renderer.RenderAsync(page.PageContext).Wait();
+                    return writer.ToString();
+                }
+            }
+        }
+    }
 }


No longer appends output to files that exist on disk

--- src/RouteDebug/DebugHttpHandler.cs
+++ src/RouteDebug/DebugHttpHandler.cs
@@ -1,23 +1,34 @@
 using System.Collections.Generic;
 using System.Reflection;
 using System.Web;
+using System.Web.Hosting;
 using System.Web.Routing;

 namespace RouteDebug {
     public class DebugHttpHandler : IHttpHandler {
-        public bool IsReusable {
-            get { return true; }
+        VirtualPathProvider _virtualPathProvider;
+
+        public DebugHttpHandler() : this(null) { }
+
+        public DebugHttpHandler(VirtualPathProvider virtualPathProvider) {
+            _virtualPathProvider = virtualPathProvider ?? HostingEnvironment.VirtualPathProvider;
         }

         public void ProcessRequest(HttpContext context) {
+            var request = context.Request;
+
+            if (!IsRoutedRequest(request)) {
+                return;
+            }
+
             string generatedUrlInfo = string.Empty;
-            var requestContext = HttpContext.Current.Request.RequestContext;
-
-            if (context.Request.QueryString.Count > 0) {
+            var requestContext = request.RequestContext;
+
+            if (request.QueryString.Count > 0) {
                 var rvalues = new RouteValueDictionary();
-                foreach (string key in context.Request.QueryString.Keys) {
+                foreach (string key in request.QueryString.Keys) {
                     if (key != null) {
-                        rvalues.Add(key, context.Request.QueryString[key]);
+                        rvalues.Add(key, request.QueryString[key]);
                     }
                 }

@@ -145,7 +156,7 @@
                 , routeDataRows
                 , matchedRouteUrl
                 , routes
-                , context.Request.AppRelativeCurrentExecutionFilePath
+                , request.AppRelativeCurrentExecutionFilePath
                 , dataTokensRows
                 , generatedUrlInfo));
         }
@@ -208,5 +219,17 @@
             if (boolean) return " style=\"color: #0c0\"";
             return " style=\"color: #c00\"";
         }
+
+        private bool IsRoutedRequest(HttpRequest request) {
+            string path = request.AppRelativeCurrentExecutionFilePath;
+            if (path != "~/" && (_virtualPathProvider.FileExists(path) || _virtualPathProvider.DirectoryExists(path))) {
+                return false;
+            }
+            return true;
+        }
+
+        public bool IsReusable {
+            get { return true; }
+        }
     }
 }


apply fix for null reference exception when propertyChanged is assigned but previousValues is null, closes pull request #5303

--- src/Serenity.Net.Entity/Row/Row.cs
+++ src/Serenity.Net.Entity/Row/Row.cs
@@ -146,13 +146,11 @@
             if (validationErrors != null)
                 RemoveValidationError(field.PropertyName ?? field.Name);

-            if (propertyChanged != null)
-            {
-                if (field.IndexCompare(previousValues, this) != 0)
-                {
-                    RaisePropertyChanged(field);
-                    field.Copy(this, previousValues);
-                }
+            if (propertyChanged != null &&
+                previousValues != null &&
+                field.IndexCompare(previousValues, this) != 0) {
+                RaisePropertyChanged(field);
+                field.Copy(this, previousValues);
             }
         }


rm unused ns

rm unused ns

--- src/Sir.Store/IO/PostingsReader.cs
+++ src/Sir.Store/IO/PostingsReader.cs
@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
-using System.Linq;
 using System.Runtime.InteropServices;

 namespace Sir.Store


Fix exception text for querying first item in set if no item is available.

--- src/StraightSql/QueryDispatcher.cs
+++ src/StraightSql/QueryDispatcher.cs
@@ -50,7 +50,7 @@
 			var result = await FirstOrDefaultAsync(query, reader);

 			if (result == null)
-				throw new InvalidOperationException("The sequence contained more than one element.");
+				throw new InvalidOperationException("The sequence contained no elements.");

 			return result;
 		}


Update VlcControl.cs

Update VlcControl.cs

Changes for stability:
- Add constructor for VlcControl
- Set backcolor of VlcControl to black for better visibility in design mode
- different changes for stability while myVclMediaPlayer is null in design mode
- hiding properties from VlcControl in designe mode
- Comment out "EndInit()" calls in VlcControl, because it will be called automatically during form design

--- src/Vlc.DotNet.Forms/VlcControl.cs
+++ src/Vlc.DotNet.Forms/VlcControl.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.ComponentModel;
 using System.Drawing.Design;
 using System.IO;
@@ -13,8 +13,23 @@
     {
         private VlcMediaPlayer myVlcMediaPlayer;

+        #region VlcControl Init
+
+        public VlcControl()
+        {
+            InitializeComponent();
+        }
+
+        private void InitializeComponent()
+        {
+            // Init Component behaviour
+            BackColor = System.Drawing.Color.Black;
+        }
+
+        [Category("Media Player")]
         public string[] VlcMediaplayerOptions { get; set; }

+        [Category("Media Player")]
         [Editor(typeof(DirectoryEditor), typeof(UITypeEditor))]
         public DirectoryInfo VlcLibDirectory { get; set; }

@@ -22,11 +37,22 @@
         [Browsable(false)]
         public bool IsPlaying
         {
-            get { return myVlcMediaPlayer.IsPlaying(); }
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.IsPlaying();
+                }
+                else
+                {
+                    return false;
+                }
+            }
         }

         public void BeginInit()
         {
+            // not used yet
         }

         public void EndInit()
@@ -58,14 +84,28 @@

         public event EventHandler<VlcLibDirectoryNeededEventArgs> VlcLibDirectoryNeeded;

+        bool disposed = false;
+
+        protected void Dispose()
+        {
+            if (!disposed)
+            {
+                Dispose(true);
+                disposed = true;
+            }
+        }
+
         protected override void Dispose(bool disposing)
         {
-            if (myVlcMediaPlayer != null)
-            {
-                UnregisterEvents();
-                if (IsPlaying)
-                    Stop();
-                myVlcMediaPlayer.Dispose();
+            if (disposing)
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    UnregisterEvents();
+                    if (IsPlaying)
+                        Stop();
+                    myVlcMediaPlayer.Dispose();
+                }
                 base.Dispose(disposing);
                 GC.SuppressFinalize(this);
             }
@@ -82,115 +122,254 @@
             }
             return null;
         }
+        #endregion
+
+        #region VlcControl Functions & Properties

         public void Play()
         {
-            EndInit();
-            myVlcMediaPlayer.Play();
+            //EndInit();
+            if (myVlcMediaPlayer != null)
+            {
+                myVlcMediaPlayer.Play();
+            }
         }

         public void Play(FileInfo file, params string[] options)
         {
-            EndInit();
+            //EndInit();
+            if (myVlcMediaPlayer != null)
+            {
+                myVlcMediaPlayer.SetMedia(file, options);
+                Play();
+            }
+        }
+
+        public void Play(Uri uri, params string[] options)
+        {
+            //EndInit();
+            if (myVlcMediaPlayer != null)
+            {
+                myVlcMediaPlayer.SetMedia(uri, options);
+                Play();
+            }
+        }
+
+        public void Pause()
+        {
+            //EndInit();
+            if (myVlcMediaPlayer != null)
+            {
+                myVlcMediaPlayer.Pause();
+            }
+        }
+
+        public void Stop()
+        {
+            //EndInit();
+            if (myVlcMediaPlayer != null)
+            {
+                myVlcMediaPlayer.Stop();
+            }
+
+        }
+
+        public VlcMedia GetCurrentMedia()
+        {
+            //EndInit();
+            if (myVlcMediaPlayer != null)
+            {
+                return myVlcMediaPlayer.GetMedia();
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Browsable(false)]
+        public float Position
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.Position;
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+            set
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    myVlcMediaPlayer.Position = value;
+                }
+
+            }
+        }
+
+        [Browsable(false)]
+        public IChapterManagement Chapter
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.Chapters;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Browsable(false)]
+        public float Rate
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.Rate;
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+            set
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    myVlcMediaPlayer.Rate = value;
+                }
+            }
+        }
+
+        [Browsable(false)]
+        public MediaStates State
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.State;
+                }
+                else
+                {
+                    return MediaStates.NothingSpecial;
+                }
+            }
+        }
+
+        [Browsable(false)]
+        public ISubTitlesManagement SubTitles
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.SubTitles;
+                }
+                else
+                {
+                    return null;
+                }
+
+            }
+        }
+
+        [Browsable(false)]
+        public IVideoManagement Video
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.Video;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+
+        [Browsable(false)]
+        public IAudioManagement Audio
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.Audio;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+
+        [Browsable(false)]
+        public long Length
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.Length;
+                }
+                else
+                {
+                    return -1;
+                }
+
+            }
+        }
+
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Browsable(false)]
+        public long Time
+        {
+            get
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    return myVlcMediaPlayer.Time;
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+            set
+            {
+                if (myVlcMediaPlayer != null)
+                {
+                    myVlcMediaPlayer.Time = value;
+                }
+            }
+        }
+
+
+        public void SetMedia(FileInfo file, params string[] options)
+        {
+            //EndInit();
             myVlcMediaPlayer.SetMedia(file, options);
-            Play();
-        }
-
-        public void Play(Uri uri, params string[] options)
-        {
-            EndInit();
-            myVlcMediaPlayer.SetMedia(uri, options);
-            Play();
-        }
-
-        public void Pause()
-        {
-            EndInit();
-            myVlcMediaPlayer.Pause();
-        }
-
-        public void Stop()
-        {
-            EndInit();
-            myVlcMediaPlayer.Stop();
-        }
-
-        public VlcMedia GetCurrentMedia()
-        {
-            EndInit();
-            return myVlcMediaPlayer.GetMedia();
-        }
-
-        public float Position
-        {
-            get { return myVlcMediaPlayer.Position; }
-            set { myVlcMediaPlayer.Position = value; }
-        }
-
-        public IChapterManagement Chapter
-        {
-            get
-            {
-                return myVlcMediaPlayer.Chapters;
-            }
-        }
-
-        public float Rate
-        {
-            get { return myVlcMediaPlayer.Rate; }
-            set { myVlcMediaPlayer.Rate = value; }
-        }
-
-        public MediaStates State
-        {
-            get { return myVlcMediaPlayer.State; }
-        }
-
-        public ISubTitlesManagement SubTitles
-        {
-            get
-            {
-                return myVlcMediaPlayer.SubTitles;
-            }
-        }
-
-        public IVideoManagement Video
-        {
-            get
-            {
-                return myVlcMediaPlayer.Video;
-            }
-        }
-
-        public IAudioManagement Audio
-        {
-            get
-            {
-                return myVlcMediaPlayer.Audio;
-            }
-        }
-
-        public long Length
-        {
-            get { return myVlcMediaPlayer.Length; }
-        }
-
-        public long Time
-        {
-            get { return myVlcMediaPlayer.Time; }
-            set { myVlcMediaPlayer.Time = value; }
-        }
-
-        public void SetMedia(FileInfo file, params string[] options)
-        {
-            EndInit();
+        }
+
+        public void SetMedia(Uri file, params string[] options)
+        {
+            //EndInit();
             myVlcMediaPlayer.SetMedia(file, options);
         }
-
-        public void SetMedia(Uri file, params string[] options)
-        {
-            EndInit();
-            myVlcMediaPlayer.SetMedia(file, options);
-        }
+        #endregion
     }
-}+}


Attend button

Attend button

--- TeaSk.Web/Views/Home/Details.cshtml
+++ TeaSk.Web/Views/Home/Details.cshtml
@@ -27,17 +27,222 @@
                 @Model.Description

+            @if (Model.StartDate < DateTime.Now && Model.StartDate.AddMinutes(Model.Minutes) > DateTime.Now)
+            {
+
+

+
Click Me

+
Thank You

+

+
+            }

-
-
-
-
+

+
+
+
+
+
+


Update Constants.cs

Update Constants.cs

--- cscs/Constants.cs
+++ cscs/Constants.cs
@@ -219,7 +219,7 @@
         };
 #else
         public static List<string> FUNCT_WITH_SPACE = new List<string> {
-            CLASS, FUNCTION, COMPILED_FUNCTION, CSHARP_FUNCTION, HELP, NEW, NAMESPACE, SHOW, THREAD
+            CLASS, FUNCTION, COMPILED_FUNCTION, HELP, NEW, NAMESPACE, SHOW, THREAD
         };
 #endif
         // Functions that allow a space separator after them, on top of parentheses but
@@ -234,13 +234,13 @@
         // use in calculation of a result.
         public static List<string> CONTROL_FLOW = new List<string>
         {
-            BREAK, CATCH, CLASS, COMPILED_FUNCTION, CSHARP_FUNCTION, CONTINUE, ELSE, ELSE_IF, ELSE, FOR, FUNCTION, IF, INCLUDE, NEW,
+            BREAK, CATCH, CLASS, COMPILED_FUNCTION, CONTINUE, ELSE, ELSE_IF, ELSE, FOR, FUNCTION, IF, INCLUDE, NEW,
             RETURN, THROW, TRY, WHILE
         };

         public static List<string> RESERVED = new List<string>
         {
-            BREAK, CONTINUE, CLASS, NEW, FUNCTION, COMPILED_FUNCTION, CSHARP_FUNCTION, IF, ELSE, ELSE_IF, INCLUDE, FOR, WHILE,
+            BREAK, CONTINUE, CLASS, NEW, FUNCTION, COMPILED_FUNCTION, IF, ELSE, ELSE_IF, INCLUDE, FOR, WHILE,
             RETURN, THROW, TRY, CATCH, COMMENT, TRUE, FALSE, TYPE,
             ASSIGNMENT, AND, OR, EQUAL, NOT_EQUAL, LESS, LESS_EQ, GREATER, GREATER_EQ,
             ADD_ASSIGN, SUBT_ASSIGN, MULT_ASSIGN, DIV_ASSIGN,


Fixed line endings.

Fixed line endings.

--- numpy/NumpyDotNet/ndarray.cs
+++ numpy/NumpyDotNet/ndarray.cs
@@ -506,9 +506,9 @@
             return NpyCoreApi.GenericBinaryOp(a, b, f);
         }

-        #endregion
-
-
+        #endregion
+
+
         #region python methods from methods.c

         public object all(object axis = null, ndarray output = null) {


update GraphicTest kernel with Default font

--- Tests/Kernels/GraphicTest/Kernel.cs
+++ Tests/Kernels/GraphicTest/Kernel.cs
@@ -116,7 +116,7 @@

             /* Create a PC Screen Font */
             pen = new Pen(Color.White);
-            Font font = new PCScreenFont();
+            Font font = PCScreenFont.Default;

             /* Draw text */
             aCanvas.DrawString("Hello Cosmos World!", font, pen, 0, 16 * 5);


Added options to clear hotbar and entire inventory to the /trash command.

--- TrueCraft/Commands/DebugCommands.cs
+++ TrueCraft/Commands/DebugCommands.cs
@@ -280,27 +280,50 @@

         public override string Description
         {
-            get { return "Discards selected item."; }
-        }
-
-        public override string[] Aliases
-        {
-            get { return new string[0]; }
-        }
-
-        public override void Handle(IRemoteClient client, string alias, string[] arguments)
-        {
-            if (arguments.Length != 0)
-            {
-                Help(client, alias, arguments);
-                return;
-            }
-            client.Inventory[client.SelectedSlot] = ItemStack.EmptyStack;
-        }
-
-        public override void Help(IRemoteClient client, string alias, string[] arguments)
-        {
-            client.SendMessage("/trash: Discards selected item.");
+            get { return "Discards selected item, hotbar, or entire inventory."; }
+        }
+
+        public override string[] Aliases
+        {
+            get { return new string[0]; }
+        }
+
+        public override void Handle(IRemoteClient client, string alias, string[] arguments)
+        {
+            if (arguments.Length != 0)
+            {
+                if (arguments[0] == "hotbar")
+                {
+                    // Discard hotbar items
+                    for (short i = 36; i <= 44; i++)
+                    {
+                        client.Inventory[i] = ItemStack.EmptyStack;
+                    }
+                }
+                else if (arguments[0] == "all")
+                {
+                    // Discard all inventory items, including armor and crafting area contents
+                    for (short i = 0; i <= 44; i++)
+                    {
+                        client.Inventory[i] = ItemStack.EmptyStack;
+                    }
+                }
+                else
+                {
+                    Help(client, alias, arguments);
+                    return;
+                }
+            }
+            else
+            {
+                // Discards selected item.
+                client.Inventory[client.SelectedSlot] = ItemStack.EmptyStack;
+            }
+        }
+
+        public override void Help(IRemoteClient client, string alias, string[] arguments)
+        {
+            client.SendMessage("Correct usage is /trash <hotbar/all> or leave blank to clear\nselected slot.");
         }
     }


gaminglive connection

gaminglive connection

--- Ubiquitous2/Model/GamingLiveChat.cs
+++ Ubiquitous2/Model/GamingLiveChat.cs
@@ -610,7 +610,7 @@
             webSocket.Path = String.Format("/chat/{0}?nick={1}&authToken={2}", ChannelName.Replace("#",""), nickName, authToken );
             webSocket.ConnectHandler = () =>
             {
-                secondWebSocket.Send("{}");
+                webSocket.Send("{}");
             };

             webSocket.DisconnectHandler = () =>
@@ -625,7 +625,7 @@
             secondWebSocket.Origin = webSocket.Origin;
             secondWebSocket.Path = webSocket.Path;

-            secondWebSocket.Connect();
+            //secondWebSocket.Connect();
             webSocket.Connect();

             secondWebSocket.Connect();


Fix compiling errors

Fix compiling errors

--- UnityQuoridor/Assets/Agent/Agent.cs
+++ UnityQuoridor/Assets/Agent/Agent.cs
@@ -14,7 +14,7 @@
         const int PLAYER1 = 0;
         const int PLAYER2 = 1;
         Node root;
-        private int MAX_DEPTH = 12;
+		private static int MAX_DEPTH = 1;
         static int current_depth = 0;
         static Board board;
 		static int player_num;
@@ -34,7 +34,7 @@
                 {
                     current_depth++;
                     bestAction = AlphaBeta.Search(board, root);
-				} while (w.ElapsedMilliseconds / 1000 < 5 && current_depth < MAX_DEPTH);
+				} while (sw.ElapsedMilliseconds / 1000 < 5 && current_depth < MAX_DEPTH);
 				sw.Stop();
                 sw.Reset();
                 current_depth = 0;
@@ -66,6 +66,7 @@
         {
             if (board.playerStatus[PLAYER1].CheckWin() ||
                 board.playerStatus[PLAYER2].CheckWin() ||
+                depth == MAX_DEPTH ||
                 depth == current_depth)
                 return true;
             return false;


Removed GamerServices

Removed GamerServices

--- Verdenwelt.Client/VerdenweltGame.cs
+++ Verdenwelt.Client/VerdenweltGame.cs
@@ -6,7 +6,6 @@
 using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Storage;
-using Microsoft.Xna.Framework.GamerServices;
 #endregion

 namespace Verdenwelt.Client


Uncommitted changes in MainWindow.xaml.cs

--- Voronoi/VoroTest/MainWindow.xaml.cs
+++ Voronoi/VoroTest/MainWindow.xaml.cs
@@ -39,10 +39,10 @@

             var cells = new Dictionary<FortuneVoronoi.Common.Point, VoronoiCell>();

-            const int internalSitesCnt = 800;
+            const int internalSitesCnt = 1600;
             const int horBorderSitesCnt = 50;
             const int vertBorderSitesCnt = 50;
-            const int resolution = 24;
+            const int resolution = 16;
             const double realWidth = 1000.0;
             const double realHeight = 700.0;
             var dx = realWidth/horBorderSitesCnt/resolution;


updated assembly version

updated assembly version

--- WebSocket4Net/GlobalAssemblyInfo.cs
+++ WebSocket4Net/GlobalAssemblyInfo.cs
@@ -8,5 +8,5 @@
 [assembly: AssemblyCopyright("Copyright © websocket4net.codeplex.com 2012")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("0.5.0.0")]
-[assembly: AssemblyFileVersion("0.5.0.0")]
+[assembly: AssemblyVersion("0.6.0.0")]
+[assembly: AssemblyFileVersion("0.6.0.0")]


simplified WmsSample.cs

simplified WmsSample.cs

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS01]$/SharpMap/Trunk;C32910

--- WinFormSamples/Samples/WmsSample.cs
+++ WinFormSamples/Samples/WmsSample.cs
@@ -7,40 +7,23 @@
   {
     public static Map InitializeMap()
     {
-      //Initialize a new map of size 'imagesize'
+      string wmsUrl = "http://www2.demis.nl/mapserver/request.asp";
+
       SharpMap.Map map = new SharpMap.Map();
-      SharpMap.Layers.WmsLayer layWms = GetWmsLayer();
-      //Set up the countries layer
-      SharpMap.Layers.VectorLayer layCountries = new SharpMap.Layers.VectorLayer("Countries");
-      //Set the datasource to a shapefile in the App_data folder
-      layCountries.DataSource = new SharpMap.Data.Providers.ShapeFile("GeoData/World/countries.shp", true);
-      //Set fill-style to green
-      layCountries.Style.Fill = new SolidBrush(Color.Green);
-      //Set the polygons to have a black outline
-      layCountries.Style.Outline = System.Drawing.Pens.Yellow;
-      layCountries.Style.EnableOutline = true;
-      layCountries.SRID = 4326;

-      //Set up a country label layer
-      SharpMap.Layers.LabelLayer layLabel = new SharpMap.Layers.LabelLayer("Country labels");
-      layLabel.DataSource = layCountries.DataSource;
-      layLabel.Enabled = true;
-      layLabel.LabelColumn = "Name";
-      layLabel.Style = new SharpMap.Styles.LabelStyle();
-      layLabel.Style.ForeColor = Color.White;
-      layLabel.Style.Font = new Font(FontFamily.GenericSerif, 8);
-      layLabel.Style.BackColor = new System.Drawing.SolidBrush(Color.FromArgb(128, 255, 0, 0));
-      layLabel.MaxVisible = 90;
-      layLabel.MinVisible = 30;
-      layLabel.Style.HorizontalAlignment = SharpMap.Styles.LabelStyle.HorizontalAlignmentEnum.Center;
-      layLabel.SRID = 4326;
+      SharpMap.Layers.WmsLayer layWms = new SharpMap.Layers.WmsLayer("Demis Map", wmsUrl);
+      layWms.SpatialReferenceSystem = "EPSG:4326";

-      //Add the layers to the map object.
-      //The order we add them in are the order they are drawn, so we add the rivers last to put them on top
+      layWms.AddLayer("Bathymetry");
+      layWms.AddLayer("Topography");
+      layWms.AddLayer("Hillshading");
+
+      layWms.SetImageFormat(layWms.OutputFormats[0]);
+      layWms.ContinueOnError = true; //Skip rendering the WMS Map if the server couldn't be requested (if set to false such an event would crash the app)
+      layWms.TimeOut = 5000; //Set timeout to 5 seconds
+      layWms.SRID = 4326;
       map.Layers.Add(layWms);
-      map.Layers.Add(layCountries);
-      map.Layers.Add(layLabel);
-
+
       //limit the zoom to 360 degrees width
       map.MaximumZoom = 360;
       map.BackColor = Color.LightBlue;
@@ -50,19 +33,5 @@

       return map;
     }
-
-    private static SharpMap.Layers.WmsLayer GetWmsLayer()
-    {
-      string wmsUrl = "http://www2.demis.nl/mapserver/request.asp";
-      SharpMap.Layers.WmsLayer layWms = new SharpMap.Layers.WmsLayer("Demis Map", wmsUrl);
-      layWms.SpatialReferenceSystem = "EPSG:4326";
-      layWms.AddLayer("Bathymetry");
-      layWms.AddLayer("Ocean features");
-      layWms.SetImageFormat(layWms.OutputFormats[0]);
-      layWms.ContinueOnError = true; //Skip rendering the WMS Map if the server couldn't be requested (if set to false such an event would crash the app)
-      layWms.TimeOut = 5000; //Set timeout to 5 seconds
-      layWms.SRID = 4326;
-      return layWms;
-    }
   }
 }


SImplified ToInt32.

SImplified ToInt32.

--- WmcSoft.Core/Text/RomanConverter.cs
+++ WmcSoft.Core/Text/RomanConverter.cs
@@ -59,13 +59,12 @@
         public static int ToInt32(string text)
         {
             var result = 0;
-            var i = 0;
             var index = 0;
-            while (index < text.Length) {
-                while (string.CompareOrdinal(Numerals[i].roman, 0, text, index, Numerals[i].roman.Length) != 0)
-                    i++;
-                result += Numerals[i].numeral;
-                index += Numerals[i].roman.Length;
+            foreach (var (value, letters) in Numerals) {
+                while (string.CompareOrdinal(letters, 0, text, index, letters.Length) == 0) {
+                    result += value;
+                    index += letters.Length;
+                }
             }
             return result;
         }


Replacing one TO DO comment with another...

--- WorldModel/WorldModel/WorldModel.cs
+++ WorldModel/WorldModel/WorldModel.cs
@@ -909,6 +909,8 @@
             return result;
         }

+        // TO DO: This could actually be removed now, as we can dynamically load stylesheets. Core.aslx InitInterface
+        // should simply be able to use the SetWebFontName function to load game.defaultwebfont
         public IEnumerable<string> GetExternalStylesheets()
         {
             if (Version < WorldModelVersion.v530) return null;
@@ -920,9 +922,6 @@
                 webFontsInUse.Add(defaultWebFont);
             }

-            // TO DO: When a command is added to change the current web font, will need to
-            // scan for all of those and add to the list of web fonts in use.
-
             var result = webFontsInUse.Select(f => "http://fonts.googleapis.com/css?family=" + f.Replace(' ', '+'));

             return result;


Fixed bug in query type checking

Fixed bug in query type checking

--- ParaServiceRead.cs
+++ ParaServiceRead.cs
@@ -152,7 +152,7 @@
         public ParaEntityList<TEntity> GetList<TEntity>(ParaEntityQuery query)
             where TEntity : ParaEntity, new()
         {
-            if (!(query.QueryTargetType is TEntity))
+            if (!(query.QueryTargetType == typeof(TEntity)))
             {
                 throw new ArgumentException("Invalid query type for the requested entity result type", "query");
             }
@@ -233,7 +233,7 @@
             where TEntity : ParaEntityBaseProperties, new()
             where TParentEntity : ParaEntity
         {
-            if (!(query.QueryTargetType is TEntity))
+            if (!(query.QueryTargetType == typeof(TEntity)))
             {
                 throw new ArgumentException("Inavlid query type for the requested entity result type", "query");
             }


Add replication methods

Add replication methods

--- KDatabase.cs
+++ KDatabase.cs
@@ -20,6 +20,100 @@
             string sql = string.Format("SELECT 1 FROM sys.databases WHERE is_distributor = 1 AND name = '{0}'", d.Name);
             DataSet ds = d.ExecuteWithResults(sql);
             return (ds.Tables[0].Rows.Count == 1);
+        }
+
+        /// <summary>
+        /// Get replication details (command delivered/undelivered) by publication, subscriber
+        /// Must be executed on distribution db
+        /// </summary>
+        /// <param name="d">Your smo database (distribution)</param>
+        /// <returns>a datatable</returns>
+        public static DataTable GetReplicationDetails(this smo.Database d)
+        {
+            DataTable dt = new DataTable();
+            if (d.IsDistributor())
+            {
+                string sql = @"SELECT SUM(ds.UndelivCmdsInDistDB) AS [Undelivered]
+    , SUM(ds.DelivCmdsInDistDB) AS [Delivered]
+    , ss.name AS [Subscriber]
+    , sp.name AS [Publisher]
+    , da.publication AS [Publication]
+    , da.publisher_db AS [Database]
+    , da.name AS [Agent]
+FROM dbo.MSdistribution_agents da WITH (READUNCOMMITTED)
+    INNER JOIN sys.servers sp WITH (READUNCOMMITTED)
+        ON sp.server_id = da.publisher_id
+    INNER JOIN sys.servers ss WITH (READUNCOMMITTED)
+        ON ss.server_id = da.subscriber_id
+    INNER JOIN dbo.MSdistribution_status ds WITH (READUNCOMMITTED)
+        ON ds.agent_id = da.id
+GROUP BY
+    sp.name
+    , ss.name
+    , da.name
+    , da.id
+    , da.publication
+    , da.publisher_db
+ORDER BY undelivered DESC
+	, delivered DESC";
+                dt = d.ExecuteWithResults(sql).Tables[0];
+            }
+            return dt;
+        }
+
+        /// <summary>
+        /// Get average latency/rate history from distribution database, group by 10 minutes
+        /// </summary>
+        /// <param name="d">Your smo database (distribution)</param>
+        /// <param name="startDate">Start DateTime</param>
+        /// <param name="endDate">End DateTime</param>
+        /// <returns>a datatable</returns>
+        public static DataTable GetReplicationLatencyStats(this smo.Database d, DateTime startDate, DateTime endDate)
+        {
+            DataTable dt = new DataTable();
+            if (d.IsDistributor())
+            {
+                string sql = string.Format(@"IF EXISTS(SELECT * FROM sys.objects WHERE name = 'MSdistribution_history')
+BEGIN
+    SELECT CONVERT(CHAR(15), time, 121) + '0:00' dt
+        , ROUND(AVG(current_delivery_latency), 0) AS [Average Delivery Latency]
+        , ROUND(AVG(current_delivery_rate), 0) [Average Delivery Rate]
+        , db_name() as [Database]
+    FROM dbo.MSdistribution_history WITH (READUNCOMMITTED)
+    WHERE current_delivery_latency > 0
+        AND time BETWEEN '{0}' AND '{1}'
+    GROUP BY CONVERT(CHAR(15), time, 121) + '0:00'
+    ORDER BY dt DESC
+END", startDate.ToString("yyyyMMdd hh:mm:ss"), endDate.ToString("yyyyMMdd hh:mm:ss"));
+                dt = d.ExecuteWithResults(sql).Tables[0];
+            }
+            return dt;
+        }
+
+        /// <summary>
+        /// get error from distribution
+        /// </summary>
+        /// <param name="d">your smo distribution database</param>
+        /// <param name="startDate"></param>
+        /// <returns>a datatable</returns>
+        public static DataTable GetReplicationErrorLog(this smo.Database d, DateTime startDate)
+        {
+            DataTable dt = new DataTable();
+            if (d.IsDistributor())
+            {
+                string sql = string.Format(@"IF EXISTS(SELECT * FROM sys.objects WHERE name = 'MSrepl_errors')
+BEGIN
+    SELECT TOP 10000 DB_NAME() [Database]
+	    ,  [time]
+	    , source_name AS [Source Name]
+	    , error_text AS [Error Text]
+    FROM dbo.MSrepl_errors WITH (READUNCOMMITTED)
+    WHERE [time] >= '{0}'
+    order by time desc
+END", startDate.ToString("yyyyMMdd hh:mm:ss"));
+                dt = d.ExecuteWithResults(sql).Tables[0];
+            }
+            return dt;
         }
         #endregion

@@ -389,6 +483,7 @@
         }
         #endregion

+        #region Indexes
         /// <summary>
         /// Get expensive indexes : when index writes are greater than reads
         /// </summary>
@@ -453,6 +548,7 @@
 ORDER BY [Index_Advantage] DESC";
             return d.ExecuteWithResults(sql).Tables[0];
         }
+        #endregion

     }
 }


Add statistics properties and configuration queries

--- KDatabase.cs
+++ KDatabase.cs
@@ -757,6 +757,117 @@
             return d.ExecuteWithResults(sql).Tables[0];
         }

-
+        #region Statistics
+        /// <summary>
+        /// Get the statistics options for the database
+        /// </summary>
+        public static DataTable StatisticsConfiguration(this smo.Database d)
+        {
+            string sql = @"DECLARE @SQL NVARCHAR(4000)
+SET @SQL = 'SELECT {0} AS is_auto_update_stats_on
+    , {1} AS is_auto_update_stats_async_on
+    , {2} AS is_auto_create_stats_on
+    , {3} AS is_auto_create_stats_incremental_on
+FROM sys.databases
+WHERE database_id = DB_ID()'
+
+IF EXISTS(SELECT *
+FROM sys.all_columns c
+WHERE c.name = 'is_auto_update_stats_on'
+
+    AND OBJECT_NAME(c.object_id) = 'databases')
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{0}', 'is_auto_update_stats_on')
+END
+ELSE
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{0}', '''N/A''')
+END
+
+IF EXISTS(SELECT *
+FROM sys.all_columns c
+WHERE c.name = 'is_auto_update_stats_async_on'
+
+    AND OBJECT_NAME(c.object_id) = 'databases')
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{1}', 'is_auto_update_stats_async_on')
+END
+ELSE
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{1}', '''N/A''')
+END
+
+IF EXISTS(SELECT *
+FROM sys.all_columns c
+WHERE c.name = 'is_auto_create_stats_on'
+
+    AND OBJECT_NAME(c.object_id) = 'databases')
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{2}', 'is_auto_create_stats_on')
+END
+ELSE
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{2}', '''N/A''')
+END
+
+IF EXISTS(SELECT *
+FROM sys.all_columns c
+WHERE c.name = 'is_auto_create_stats_incremental_on'
+
+    AND OBJECT_NAME(c.object_id) = 'databases')
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{3}', 'is_auto_create_stats_incremental_on')
+END
+ELSE
+BEGIN
+    SET @SQL = REPLACE(@SQL, '{3}', '''N/A''')
+END
+
+EXECUTE sys.sp_executesql @SQL";
+            return d.ExecuteWithResults(sql).Tables[0];
+        }
+
+        /// <summary>
+        /// Get informations for each statistics in the database
+        /// </summary>
+        public static DataTable StatisticsProperties(this smo.Database d)
+        {
+            string sql = @"SELECT sch.name + '.' + o.name AS [Table]
+	, s.name AS StatName
+	, STUFF((
+			SELECT
+				', ' + COL_NAME(sic.object_id, sic.column_id) AS [Name]
+			FROM sys.stats st
+				INNER JOIN sys.stats_columns sic ON sic.stats_id=st.stats_id
+					AND sic.object_id=st.object_id
+			WHERE st.stats_id = s.stats_id
+				AND st.object_id = s.object_id
+			FOR XML PATH(''), TYPE
+		).value('.', 'NVARCHAR(MAX)'), 1, 2, '') AS [Columns]
+	, sp.last_updated AS [Last Updated]
+	, sp.rows AS [Rows]
+	, sp.rows_sampled AS [Rows Sampled]
+	, sp.modification_counter AS [Modification Counter]
+	, sp.unfiltered_rows AS [Unfiltered Rows]
+	, sp.steps AS [Steps]
+	, s.auto_created AS [Auto Created]
+	, s.user_created AS [User Created]
+	, s.has_filter AS [Has Filter]
+	, s.is_incremental AS [Is Incremental]
+	, s.is_temporary AS [Is Temporary]
+	, s.no_recompute AS [No Recompute]
+FROM sys.stats s
+	CROSS APPLY sys.dm_db_stats_properties(s.object_id, s.stats_id) sp
+	INNER JOIN sys.objects o ON s.object_id = o.object_id
+	INNER JOIN sys.schemas sch ON o.schema_id = sch.schema_id
+WHERE OBJECTPROPERTY(o.object_id, 'IsUserTable') = 1
+ORDER BY modification_counter DESC
+    , [Table]
+    , StatName
+";
+            return d.ExecuteWithResults(sql).Tables[0];
+        }
+
+        #endregion
     }
 }


fix error message

fix error message

--- csv/Rename.cs
+++ csv/Rename.cs
@@ -17,7 +17,7 @@
                 DataSequence input = Args.GetDataSequence(args);

                 if (args.Count % 2 != 0)
-                    throw new Exception("You must supply at pairs of paremters: column value [column value...]");
+                    throw new Exception("You must supply at pairs of paremters: old new [old new...]");

                 var changes = Changes(args);


Detect iOS and Android

Detect iOS and Android

--- osu.Framework/RuntimeInfo.cs
+++ osu.Framework/RuntimeInfo.cs
@@ -23,16 +23,20 @@
         public static bool Is32Bit { get; }
         public static bool Is64Bit { get; }
         public static Platform OS { get; }
-        public static bool IsUnix => OS == Platform.Linux || OS == Platform.MacOsx;
+        public static bool IsUnix => OS == Platform.Linux || OS == Platform.MacOsx || OS == Platform.iOS;
         public static bool IsWine { get; }

         static RuntimeInfo()
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 OS = Platform.Windows;
-            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+            if (osuTK.Configuration.RunningOnIOS)
+                OS = OS == 0 ? Platform.iOS : throw new InvalidOperationException($"Tried to set OS Platform to {nameof(Platform.iOS)}, but is already {Enum.GetName(typeof(Platform), OS)}");
+            if (osuTK.Configuration.RunningOnAndroid)
+                OS = OS == 0 ? Platform.Android : throw new InvalidOperationException($"Tried to set OS Platform to {nameof(Platform.Android)}, but is already {Enum.GetName(typeof(Platform), OS)}");
+            if (OS != Platform.iOS && RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                 OS = OS == 0 ? Platform.MacOsx : throw new InvalidOperationException($"Tried to set OS Platform to {nameof(Platform.MacOsx)}, but is already {Enum.GetName(typeof(Platform), OS)}");
-            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            if (OS != Platform.Android && RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                 OS = OS == 0 ? Platform.Linux : throw new InvalidOperationException($"Tried to set OS Platform to {nameof(Platform.Linux)}, but is already {Enum.GetName(typeof(Platform), OS)}");

             if (OS == 0)
@@ -59,6 +63,8 @@
             Windows = 1,
             Linux = 2,
             MacOsx = 3,
+            iOS = 4,
+            Android = 5
         }
     }
 }


Added Utils.Log2File method.

Added Utils.Log2File method.

--- MiscUtils.cs
+++ MiscUtils.cs
@@ -217,11 +217,10 @@
 			}
 		}

-		static readonly Regex log_re = new Regex("[Ll]og");
-		public static void Log(string msg, params object[] args)
-		{
+		static string prepare_message(string msg)
+		{
 			var mod_name = "AT_Utils";
-			var stack = new StackTrace(1);
+			var stack = new StackTrace(2);
 			foreach(var f in stack.GetFrames())
 			{
 				var method = f.GetMethod();
@@ -229,16 +228,36 @@
 				mod_name = method.DeclaringType.Assembly.GetName().Name;
 				break;
 			}
-			msg = string.Format("[{0}: {1:HH:mm:ss.fff}] {2}", mod_name, DateTime.Now, msg);
-			if(args.Length > 0)
-			{
-				convert_args(args);
-				UnityEngine.Debug.Log(Format(msg, args));
-			}
-			else UnityEngine.Debug.Log(msg);
 			#if DEBUG
 			UnityEngine.Debug.Log(stack);
 			#endif
+			return string.Format("[{0}: {1:HH:mm:ss.fff}] {2}", mod_name, DateTime.Now, msg);
+		}
+
+		static readonly Regex log_re = new Regex("[Ll]og");
+		public static void Log(string msg, params object[] args)
+		{
+			msg = prepare_message(msg);
+			if(args.Length > 0)
+			{
+				convert_args(args);
+				UnityEngine.Debug.Log(Format(msg, args));
+			}
+			else UnityEngine.Debug.Log(msg);
+		}
+
+		public static void Log2File(string filename, string msg, params object[] args)
+		{
+			using(var f = new StreamWriter(filename, true))
+			{
+				msg = prepare_message(msg);
+				if(args.Length > 0)
+				{
+					convert_args(args);
+					f.WriteLine(Format(msg, args));
+				}
+				else f.WriteLine(msg);
+			}
 		}

 		//from http://stackoverflow.com/questions/716399/c-sharp-how-do-you-get-a-variables-name-as-it-was-physically-typed-in-its-dec


fix short options parsing

fix short options parsing

--- NOpt/NOpt.cs
+++ NOpt/NOpt.cs
@@ -274,7 +274,7 @@
                     if (f.FieldType != typeof(bool))
                         return $"Option -{shortName} should have a value";

-                    return AssignValueTo(opt, f, value);
+                    return AssignValueTo(opt, f, true);
                 }
                 else if(memberInfo is PropertyInfo)
                 {
@@ -283,7 +283,7 @@
                     if (p.PropertyType != typeof(bool))
                         return $"Option -{shortName} should have a value";

-                    return AssignValueTo(opt, p, value);
+                    return AssignValueTo(opt, p, true);
                 }
                 else
                 {


A small fix for RTLSDR plugin

A small fix for RTLSDR plugin

git-svn-id: 6b7e1e5d0861e268462ba7828ef63c1bcab52a9b@353 d3cde5d6-82b8-4669-8b62-43054d6781d8

--- RTLSDR/RTLSDRIO.cs
+++ RTLSDR/RTLSDRIO.cs
@@ -243,9 +243,10 @@
             }
             var instance = (RtlSdrIO) gcHandle.Target;

-            if (instance._iqBuffer == null || instance._iqBuffer.Length != len)
-            {
-                instance._iqBuffer = UnsafeBuffer.Create((int) len / 2, sizeof (Complex));
+            var sampleCount = (int) len / 2;
+            if (instance._iqBuffer == null || instance._iqBuffer.Length != sampleCount)
+            {
+                instance._iqBuffer = UnsafeBuffer.Create(sampleCount, sizeof(Complex));
                 instance._iqPtr = (Complex*) instance._iqBuffer;
             }


another output example

another output example

partial array hashing

--- Runners/Program.cs
+++ Runners/Program.cs
@@ -45,6 +45,7 @@
                 };

                 Run(name: "Guid x 8", dataLength: SampleData.LongLength, hasher: a => a.ComputeHash(SampleData), steps: guidSteps);
+                Run(name: "Guid x 8 Partial", dataLength: SampleData.LongLength - 3, hasher: a => a.ComputeHash(SampleData, 3, (int)(SampleData.LongLength - 3)), steps: guidSteps);

                 // random data tests
                 var randomSteps = new Dictionary<string, Tuple<HashAlgorithm, int>>


Use unused private HttpSpec members

Use unused private HttpSpec members

--- src/Core/HttpSpec.cs
+++ src/Core/HttpSpec.cs
@@ -25,15 +25,8 @@
     public sealed class HttpSpec
     {
         NameValueCollection _headers;
-
         bool HasHeaders => _headers?.Count > 0;
-
-        NameValueCollection Headers
-        {
-            get { return _headers ?? (_headers = new NameValueCollection()); }
-            set { _headers = value; }
-        }
-
+        NameValueCollection Headers => _headers ?? (_headers = new NameValueCollection());

         public HttpSpec UserAgent(string value) { return Header("User-Agent", value); }

@@ -45,7 +38,7 @@

         public Query<HttpFetch<HttpContent>> Get(Uri url) =>
             Query.Create(context => QueryResult.Create(context, context.Eval((HttpService http) =>
-                http.Get(url, new HttpOptions { Headers = new HttpHeaderCollection(Headers) }))));
+                http.Get(url, Options()))));

         public Query<HttpFetch<HttpContent>> Post(Uri url, NameValueCollection data) =>
             Post(url, new FormUrlEncodedContent(from i in Enumerable.Range(0, data.Count)
@@ -54,7 +47,14 @@

         public Query<HttpFetch<HttpContent>> Post(Uri url, HttpContent content) =>
             Query.Create(context => QueryResult.Create(context, context.Eval((HttpService http) =>
-                http.Post(url, content, new HttpOptions { Headers = new HttpHeaderCollection(Headers) }))));
+                http.Post(url, content, Options()))));
+
+        HttpOptions Options() => new HttpOptions
+        {
+            Headers = HasHeaders
+                    ? new HttpHeaderCollection(Headers)
+                    : HttpHeaderCollection.Empty
+        };
     }

     static class SysNetHttpExtensions


Fix not being able to load a page with invalid src tag

--- Scrappy/WebPage.cs
+++ Scrappy/WebPage.cs
@@ -37,16 +37,19 @@
                 }
             });

-
         }

         public HttpResponseMessage Response {get; set;}

         private void AddWebResource(string resourceUrl, IDomObject item)
         {
-            var resource = new WebResource(ConstructUri(resourceUrl), browser, this, item.NodeName);
+            try
+            {
+                var resource = new WebResource(ConstructUri(resourceUrl), browser, this, item.NodeName);

-            ResourceDictionary.Add(item, resource);
+                ResourceDictionary.Add(item, resource);
+            }
+            catch { }
         }

         public Form GetForm(string selector)