- Renamed WindowMonitor to WindowEventMonitor
  Wired up all event handling correctly

git-svn-id: ad71a101fa69fb252e58119732bf51384d5dbd95@1084 bb9bf1cf-960d-0410-9a3a-baeba60cf407

--- Projects/Axiom/Source/Engine/Core/WindowManager.cs
+++ Projects/Axiom/Source/Engine/Core/WindowManager.cs
@@ -39,185 +39,423 @@
 using System.Text;

 using Axiom.Graphics;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;

 #endregion Namespace Declarations

 namespace Axiom.Core
 {
-	public interface WindowEventListener
-	{
-		/// <summary>
-		/// Window has moved position
-		/// </summary>
-		/// <param name="rw">The RenderWindow which created this event</param>
-		void WindowMoved( RenderWindow rw );
-
-		/// <summary>
-		/// Window has resized
-		/// </summary>
-		/// <param name="rw">The RenderWindow which created this event</param>
-		void WindowResized( RenderWindow rw );
-
-		/// <summary>
-		/// Window has closed
-		/// </summary>
-		/// <param name="rw">The RenderWindow which created this event</param>
-		void WindowClosed( RenderWindow rw );
-
-		/// <summary>
-		/// Window lost/regained the focus
-		/// </summary>
-		/// <param name="rw">The RenderWindow which created this event</param>
-		void WindowFocusChange( RenderWindow rw );
-	}
-
-	public class WindowMonitor : IDisposable // Singleton<WindowMonitor>
-	{
-		private Dictionary<RenderWindow, List<WindowEventListener>> _listeners = new Dictionary<RenderWindow,List<WindowEventListener>>();
-		private List<RenderWindow> _windows = new List<RenderWindow>();
-
-		private WindowMonitor()
-		{
-		}
-
-		private static readonly WindowMonitor _instance = new WindowMonitor();
-		public static WindowMonitor Instance
-		{
-			get
-			{
-				return _instance;
-			}
-		}
-		/// <summary>
-		/// Add a listener to listen to renderwindow events (multiple listener's per renderwindow is fine)
-		/// The same listener can listen to multiple windows, as the Window Pointer is sent along with
-		/// any messages.
-		/// </summary>
-		/// <param name="window">The RenderWindow you are interested in monitoring</param>
-		/// <param name="listener">Your callback listener</param>
-		public void RegisterListener( RenderWindow window, WindowEventListener listener )
-		{
-			if ( !_listeners.ContainsKey( window ) )
-			{
-				_listeners.Add( window, new List<WindowEventListener>() );
-			}
-			_listeners[ window ].Add( listener );
-		}
-
-		/// <summary>
-		/// Remove previously added listener
-		/// </summary>
-		/// <param name="window">The RenderWindow you registered with</param>
-		/// <param name="listener">The listener registered</param>
-		public void UnregisterListener( RenderWindow window, WindowEventListener listener )
-		{
-			if ( _listeners.ContainsKey( window ) )
-			{
-				_listeners[ window ].Remove( listener );
-			}
-		}
-
-		/// <summary>
-		/// Called by RenderWindows upon creation for Ogre generated windows. You are free to add your
-		/// external windows here too if needed.
-		/// </summary>
-		/// <param name="window">The RenderWindow to monitor</param>
-		public void RegisterWindow( RenderWindow window )
-		{
-			_windows.Add( window );
-			_attachEventHandlers( window );
-		}
-
-		/// <summary>
-		/// Called by RenderWindows upon destruction for Ogre generated windows. You are free to remove your
-		/// external windows here too if needed.
-		/// </summary>
-		/// <param name="window">The RenderWindow to remove from list</param>
-		public void UnregisterWindow( RenderWindow window )
-		{
-			_windows.Remove( window );
-			_detachEventHandlers( window );
-		}
-
-		/// <summary>
-		/// Internal winProc (RenderWindow's use this when creating the Win32 Window)
-		/// </summary>
-		/// <param name="m"></param>
-		//public void WinProc( ref Message m )
-		//{
-		//}
-
-		public void MessagePump()
-		{
-		}
-
-		private void _attachEventHandlers( RenderWindow window )
-		{
-			System.Windows.Forms.Control ctrl = (System.Windows.Forms.Control)window[ "WINDOW" ];
-
-			ctrl.Resize += new EventHandler( _windowResize );
-			ctrl.Move += new EventHandler( _windowMove );
-			ctrl.ClientSizeChanged += new EventHandler( _windowResize );
-			ctrl.GotFocus += new EventHandler( _windowFocus );
-			ctrl.LostFocus += new EventHandler( _windowFocus );
-			ctrl.Disposed += new EventHandler( _windowClose );
-		}
-
-		private void _detachEventHandlers( RenderWindow window )
-		{
-			System.Windows.Forms.Control ctrl = (System.Windows.Forms.Control)window[ "WINDOW" ];
-
-			ctrl.Resize -= new EventHandler( _windowResize );
-			ctrl.Move -= new EventHandler( _windowMove );
-			ctrl.ClientSizeChanged -= new EventHandler( _windowResize );
-			ctrl.GotFocus -= new EventHandler( _windowFocus );
-			ctrl.LostFocus -= new EventHandler( _windowFocus );
-			ctrl.Disposed -= new EventHandler( _windowClose );
-		}
-
-		private void _windowFocus( object sender, EventArgs e )
-		{
-			//throw new Exception( "The method or operation is not implemented." );
-		}
-
-		private void _windowMove( object sender, EventArgs e )
-		{
-			//throw new Exception( "The method or operation is not implemented." );
-		}
-
-		private void _windowResize( object sender, EventArgs e )
-		{
-			foreach ( RenderWindow win in _windows )
-			{
-				if ( IntPtr.ReferenceEquals( win[ "WINDOW" ], sender ) )
-				{
-					win.WindowMovedOrResized();
-					return;
-				}
-			}
-
-			//throw new Exception( "The method or operation is not implemented." );
-		}
-
-		private void _windowClose( object sender, EventArgs e )
-		{
-			//throw new Exception( "The method or operation is not implemented." );
-		}
-
-		#region Singleton<WindowManager> Members
-
-		public void Dispose()
-		{
-			foreach ( List<WindowEventListener> list in _listeners.Values )
-			{
-				list.Clear();
-			}
-			_listeners.Clear();
-
-			_windows.Clear();
-
-			//base.Dispose();
-		}
-		#endregion
-	}
+    public interface WindowEventListener
+    {
+        /// <summary>
+        /// Window has moved position
+        /// </summary>
+        /// <param name="rw">The RenderWindow which created this event</param>
+        void WindowMoved( RenderWindow rw );
+
+        /// <summary>
+        /// Window has resized
+        /// </summary>
+        /// <param name="rw">The RenderWindow which created this event</param>
+        void WindowResized( RenderWindow rw );
+
+        /// <summary>
+        /// Window has closed
+        /// </summary>
+        /// <param name="rw">The RenderWindow which created this event</param>
+        void WindowClosed( RenderWindow rw );
+
+        /// <summary>
+        /// Window lost/regained the focus
+        /// </summary>
+        /// <param name="rw">The RenderWindow which created this event</param>
+        void WindowFocusChange( RenderWindow rw );
+    }
+
+    public class WindowEventMonitor : IDisposable // Singleton<WindowMonitor>
+    {
+        #region P/Invoke Declarations
+
+        enum WindowMessage
+        {
+            Create = 0x0001,
+            Destroy = 0x0002,
+            Move = 0x0003,
+            Size = 0x0005,
+            Activate = 0x0006,
+            Close = 0x0010,
+
+            GetMinMaxInfo = 0x0024,
+            SysKeyDown = 0x0104,
+            SysKeyUp = 0x0105,
+            EnterSizeMove = 0x0231,
+            ExitSizeMove = 0x0232
+        }
+
+        enum ActivateState
+        {
+            InActive = 0,
+            Active = 1,
+            ClickActive = 2
+        }
+
+        enum VirtualKeys
+        {
+            Shift = 0x10,
+            Control = 0x11,
+            Menu = 0x12
+        }
+
+        struct Msg
+        {
+            public int hWnd;
+            public int Message;
+            public int wParam;
+            public int lParam;
+            public int time;
+            public POINTAPI pt;
+        }
+
+        struct POINTAPI
+        {
+            public int x;
+            public int y;
+
+            // Just to get rid of Warning CS0649.
+            public POINTAPI( int x, int y )
+            {
+                this.x = x;
+                this.y = y;
+            }
+        }
+
+        /// <summary>
+        ///		PeekMessage option to remove the message from the queue after processing.
+        /// </summary>
+        const int PM_REMOVE = 0x0001;
+        const string USER_DLL = "user32.dll";
+
+        /// <summary>
+        ///		The PeekMessage function dispatches incoming sent messages, checks the thread message
+        ///		queue for a posted message, and retrieves the message (if any exist).
+        /// </summary>
+        /// <param name="msg">A <see cref="Msg"/> structure that receives message information.</param>
+        /// <param name="handle"></param>
+        /// <param name="msgFilterMin"></param>
+        /// <param name="msgFilterMax"></param>
+        /// <param name="removeMsg"></param>
+        [DllImport( USER_DLL )]
+        private static extern int PeekMessage( out Msg msg, IntPtr handle, int msgFilterMin, int msgFilterMax, int removeMsg );
+
+        /// <summary>
+        ///		The TranslateMessage function translates virtual-key messages into character messages.
+        /// </summary>
+        /// <param name="msg">
+        ///		an MSG structure that contains message information retrieved from the calling thread's message queue
+        ///		by using the GetMessage or <see cref="PeekMessage"/> function.
+        /// </param>
+        [DllImport( USER_DLL )]
+        private static extern void TranslateMessage( ref Msg msg );
+
+        /// <summary>
+        ///		The DispatchMessage function dispatches a message to a window procedure.
+        /// </summary>
+        /// <param name="msg">A <see cref="Msg"/> structure containing the message.</param>
+        [DllImport( USER_DLL )]
+        private static extern void DispatchMessage( ref Msg msg );
+
+        #endregion P/Invoke Declarations
+
+        private Dictionary<RenderWindow, List<WindowEventListener>> _listeners = new Dictionary<RenderWindow, List<WindowEventListener>>();
+        private List<RenderWindow> _windows = new List<RenderWindow>();
+
+        private WindowEventMonitor()
+        {
+        }
+
+        private static readonly WindowEventMonitor _instance = new WindowEventMonitor();
+        public static WindowEventMonitor Instance
+        {
+            get
+            {
+                return _instance;
+            }
+        }
+
+        /// <summary>
+        /// Add a listener to listen to renderwindow events (multiple listener's per renderwindow is fine)
+        /// The same listener can listen to multiple windows, as the Window Pointer is sent along with
+        /// any messages.
+        /// </summary>
+        /// <param name="window">The RenderWindow you are interested in monitoring</param>
+        /// <param name="listener">Your callback listener</param>
+        public void RegisterListener( RenderWindow window, WindowEventListener listener )
+        {
+            if ( !_listeners.ContainsKey( window ) )
+            {
+                _listeners.Add( window, new List<WindowEventListener>() );
+            }
+            _listeners[ window ].Add( listener );
+        }
+
+        /// <summary>
+        /// Remove previously added listener
+        /// </summary>
+        /// <param name="window">The RenderWindow you registered with</param>
+        /// <param name="listener">The listener registered</param>
+        public void UnregisterListener( RenderWindow window, WindowEventListener listener )
+        {
+            if ( _listeners.ContainsKey( window ) )
+            {
+                _listeners[ window ].Remove( listener );
+            }
+        }
+
+        /// <summary>
+        /// Called by RenderWindows upon creation for Ogre generated windows. You are free to add your
+        /// external windows here too if needed.
+        /// </summary>
+        /// <param name="window">The RenderWindow to monitor</param>
+        public void RegisterWindow( RenderWindow window )
+        {
+            _windows.Add( window );
+            _attachEventHandlers( window );
+        }
+
+        /// <summary>
+        /// Called by RenderWindows upon destruction for Ogre generated windows. You are free to remove your
+        /// external windows here too if needed.
+        /// </summary>
+        /// <param name="window">The RenderWindow to remove from list</param>
+        public void UnregisterWindow( RenderWindow window )
+        {
+            _windows.Remove( window );
+            _detachEventHandlers( window );
+        }
+
+        /// <summary>
+        /// Internal winProc (RenderWindow's use this when creating the Win32 Window)
+        /// </summary>
+        /// <param name="m"></param>
+        public bool WinProc( Form frm, RenderWindow win, ref Message m )
+        {
+            //Iterator of all listeners registered to this RenderWindow
+            List<WindowEventListener> winListeners = _listeners[ win ];
+
+            switch ( (WindowMessage)m.Msg )
+            {
+                case WindowMessage.Activate:
+                    {
+                        bool active = ( (ActivateState)m.WParam ) != ActivateState.InActive;
+                        win.IsActive = active;
+                        foreach ( WindowEventListener listener in winListeners )
+                        {
+                            listener.WindowFocusChange( win );
+                        }
+                        break;
+                    }
+                case WindowMessage.SysKeyDown:
+                    switch ( (VirtualKeys)m.WParam )
+                    {
+                        case VirtualKeys.Control:
+                        case VirtualKeys.Shift:
+                        case VirtualKeys.Menu: //ALT
+                            //return true to bypass defProc and signal we processed the message
+                            return true;
+                    }
+                    break;
+                case WindowMessage.SysKeyUp:
+                    switch ( (VirtualKeys)m.WParam )
+                    {
+                        case VirtualKeys.Control:
+                        case VirtualKeys.Shift:
+                        case VirtualKeys.Menu: //ALT
+                            //return true to bypass defProc and signal we processed the message
+                            return true;
+                    }
+                    break;
+                case WindowMessage.EnterSizeMove:
+                    //log->logMessage("WM_ENTERSIZEMOVE");
+                    break;
+                case WindowMessage.ExitSizeMove:
+                    //log->logMessage("WM_EXITSIZEMOVE");
+                    break;
+                case WindowMessage.Move:
+                    //log->logMessage("WM_MOVE");
+                    win.WindowMovedOrResized();
+                    foreach ( WindowEventListener listener in winListeners )
+                    {
+                        listener.WindowMoved( win );
+                    }
+                    break;
+                case WindowMessage.Size:
+                    //log->logMessage("WM_SIZE");
+                    win.WindowMovedOrResized();
+                    foreach ( WindowEventListener listener in winListeners )
+                    {
+                        listener.WindowResized( win );
+                    }
+                    break;
+                case WindowMessage.GetMinMaxInfo:
+                    // Prevent the window from going smaller than some minimum size
+                    //((MINMAXINFO*)lParam)->ptMinTrackSize.x = 100;
+                    //((MINMAXINFO*)lParam)->ptMinTrackSize.y = 100;
+                    break;
+                case WindowMessage.Close:
+                    //log->logMessage("WM_CLOSE");
+                    win.Dispose();
+                    foreach ( WindowEventListener listener in winListeners )
+                    {
+                        listener.WindowClosed( win );
+                    }
+                    return true;
+            }
+            return false;
+        }
+
+        public void MessagePump()
+        {
+            Msg msg;
+
+            // pump those events!
+            while ( !( PeekMessage( out msg, IntPtr.Zero, 0, 0, PM_REMOVE ) == 0 ) )
+            {
+                TranslateMessage( ref msg );
+                DispatchMessage( ref msg );
+            }
+        }
+
+        private void _attachEventHandlers( RenderWindow window )
+        {
+            System.Windows.Forms.Control ctrl = (System.Windows.Forms.Control)window[ "WINDOW" ];
+
+            ctrl.Resize += new EventHandler( _windowResize );
+            ctrl.Move += new EventHandler( _windowMove );
+            ctrl.ClientSizeChanged += new EventHandler( _windowResize );
+            ctrl.GotFocus += new EventHandler( _windowFocus );
+            ctrl.LostFocus += new EventHandler( _windowFocus );
+            ctrl.Disposed += new EventHandler( _windowClose );
+
+            _listeners.Add( window, new List<WindowEventListener>() );
+        }
+
+        private void _detachEventHandlers( RenderWindow window )
+        {
+            System.Windows.Forms.Control ctrl = (System.Windows.Forms.Control)window[ "WINDOW" ];
+
+            ctrl.Resize -= new EventHandler( _windowResize );
+            ctrl.Move -= new EventHandler( _windowMove );
+            ctrl.ClientSizeChanged -= new EventHandler( _windowResize );
+            ctrl.GotFocus -= new EventHandler( _windowFocus );
+            ctrl.LostFocus -= new EventHandler( _windowFocus );
+            ctrl.Disposed -= new EventHandler( _windowClose );
+
+            _listeners[ window ].Clear();
+            _listeners.Remove( window );
+        }
+
+        private void _windowFocus( object sender, EventArgs e )
+        {
+            foreach ( RenderWindow win in _windows )
+            {
+                if ( IntPtr.ReferenceEquals( win[ "WINDOW" ], sender ) )
+                {
+                    // Notify Window of focus change
+                    //bool active = ( (ActivateState)e.WParam ) != ActivateState.InActive;
+                    //win.IsActive = active;
+
+                    // Notify listeners of focus change
+                    foreach ( WindowEventListener listener in _listeners[ win ] )
+                    {
+                        listener.WindowFocusChange( win );
+                    }
+
+                    return;
+                }
+            }
+
+            //throw new Exception( "The method or operation is not implemented." );
+        }
+
+        private void _windowMove( object sender, EventArgs e )
+        {
+            foreach ( RenderWindow win in _windows )
+            {
+                if ( IntPtr.ReferenceEquals( win[ "WINDOW" ], sender ) )
+                {
+                    // Notify Window of Move or Resize
+                    win.WindowMovedOrResized();
+
+                    // Notify listeners of Resize
+                    foreach ( WindowEventListener listener in _listeners[ win ] )
+                    {
+                        listener.WindowMoved( win );
+                    }
+                    return;
+                }
+            }
+
+            //throw new Exception( "The method or operation is not implemented." );
+        }
+
+        private void _windowResize( object sender, EventArgs e )
+        {
+            foreach ( RenderWindow win in _windows )
+            {
+                if ( IntPtr.ReferenceEquals( win[ "WINDOW" ], sender ) )
+                {
+                    // Notify Window of Move or Resize
+                    win.WindowMovedOrResized();
+
+                    // Notify listeners of Resize
+                    foreach ( WindowEventListener listener in _listeners[ win ] )
+                    {
+                        listener.WindowResized( win );
+                    }
+                    return;
+                }
+            }
+
+
+            //throw new Exception( "The method or operation is not implemented." );
+        }
+
+        private void _windowClose( object sender, EventArgs e )
+        {
+            foreach ( RenderWindow win in _windows )
+            {
+                if ( IntPtr.ReferenceEquals( win[ "WINDOW" ], sender ) )
+                {
+                    // Notify Window of closure
+                    win.Dispose();
+
+                    // Notify listeners of close
+                    foreach ( WindowEventListener listener in _listeners[ win ] )
+                    {
+                        listener.WindowClosed( win );
+                    }
+                    return;
+                }
+            }
+
+            //throw new Exception( "The method or operation is not implemented." );
+        }
+
+        #region Singleton<WindowManager> Members
+
+        public void Dispose()
+        {
+            foreach ( List<WindowEventListener> list in _listeners.Values )
+            {
+                list.Clear();
+            }
+            _listeners.Clear();
+
+            _windows.Clear();
+
+            //base.Dispose();
+        }
+        #endregion
+    }
 }


cleaning up column pref page

cleaning up column pref page

--- Purchasing.Web/Views/User/ColumnPreferences.cshtml
+++ Purchasing.Web/Views/User/ColumnPreferences.cshtml
@@ -16,8 +16,6 @@
 	@Html.AntiForgeryToken()
 	@Html.ValidationSummary(true)

-@* Legend is required if you have more than one widget/unit to help the user understand what is being asked of them.
-Example: Dinosaur 1  *@
 	ColumnPreferences

@@ -251,7 +249,7 @@

 						@Html.HiddenFor(model => model.Id)

-				@* For the clear and submit buttons an empty label is required. Example:   *@
+

 				<input class="button" type="submit" value="Edit" /> | @Html.ActionLink("Cancel", "Profile")


Fix a string concatenation pass bug

Fix a string concatenation pass bug

--- Flame.LLVM/Passes/StringConcatPass.cs
+++ Flame.LLVM/Passes/StringConcatPass.cs
@@ -66,13 +66,13 @@
                 return new StringExpression("");
             }

-            var result = Operands[0];
+            var result = Visit(Operands[0]);
             for (int i = 1; i < Operands.Count; i++)
             {
                 result = new InvocationExpression(
                     concatMethod.Value,
                     null,
-                    new IExpression[] { result, Operands[i] });
+                    new IExpression[] { result, Visit(Operands[i]) });
             }
             return result;
         }
@@ -94,7 +94,7 @@
             }
             else
             {
-                return concatExpr;
+                return concatExpr.Accept(this);
             }
         }


Fix type determination in array

Fix type determination in array

--- Freesia/Internal/SyntaxHighlighter.cs
+++ Freesia/Internal/SyntaxHighlighter.cs
@@ -138,17 +138,19 @@
                 }
                 return;
             }
-            if (node.Token.Type == TokenType.ArrayNode)
-            {
-                node.DeterminedType = typeof(object[]);
-                return;
-            }

             // process left node (and update ``node.Left.DeterminedType'' value)
             UpdateASTNodeType(node.Left, parentNodeType, lambdaEnv);
             // process right node
             UpdateASTNodeType(node.Right, node.Token.Type == TokenType.ArrayNode || node.Left == null || node.Left.Token.IsBooleanOperator ?
                 null : node.Left?.DeterminedType, lambdaEnv);
+
+            // override array node type
+            if (node.Token.Type == TokenType.ArrayNode)
+            {
+                node.DeterminedType = typeof(object[]);
+                return;
+            }

             // info is no Operator
             if (info.Type != SyntaxType.Operator)


Last fix from PR

Last fix from PR

rephrasing for clarity.  also saves a line.

--- Google.PowerShell/BigQuery/BqTable.cs
+++ Google.PowerShell/BigQuery/BqTable.cs
@@ -481,8 +481,7 @@
                 var tableResponse = new TablesResource.GetRequest(
                     Service, Project, DatasetId, Table).Execute();

-                return (tableResponse.NumRows == 0) ? true :
-                    ShouldContinue(
+                return (tableResponse.NumRows == 0) || ShouldContinue(
                     GetConfirmationMessage(Table, tableResponse.NumRows),
                     "Confirm Deletion", ref yesToAll, ref noToAll);
             }


- ColorEx
 * Fixed Clone() Implementation
 * As ColorEx is a struct, is Clone() really needed?

git-svn-id: 53f2a8ff3606f182ef4420064c1f4a5cdcbe6bb1@1872 bb9bf1cf-960d-0410-9a3a-baeba60cf407

--- Projects/Axiom/Engine/Core/ColorEx.cs
+++ Projects/Axiom/Engine/Core/ColorEx.cs
@@ -128,20 +128,6 @@
 		#region Methods

 		/// <summary>
-		///		Returns a copy of this ColorEx instance.
-		/// </summary>
-		/// <returns></returns>
-		public ColorEx Clone()
-		{
-            ColorEx retVal;
-            retVal.a = this.a;
-            retVal.r = this.r;
-            retVal.g = this.g;
-            retVal.b = this.g;
-            return retVal;
-		}
-
-		/// <summary>
 		///		Converts this instance to a <see cref="System.Drawing.Color"/> structure.
 		/// </summary>
 		/// <returns></returns>
@@ -2602,7 +2588,7 @@
 			return this.ToARGB();
 		}

-        public override bool Equals( object obj )
+	    public override bool Equals( object obj )
         {
             if ( typeof( object ) is ColorEx )
                 return this == (ColorEx)obj;
@@ -2641,5 +2627,26 @@
 		}

 		#endregion
-	}
+
+        #region ICloneable Implementation
+
+        /// <summary>
+        /// Creates a new object that is a copy of the current instance.
+        /// </summary>
+        /// <returns>
+        /// A new object that is a copy of this instance.
+        /// </returns>
+        /// <filterpriority>2</filterpriority>
+        public ColorEx Clone()
+        {
+            ColorEx clone;
+            clone.a = this.a;
+            clone.r = this.r;
+            clone.g = this.g;
+            clone.b = this.b;
+            return clone;
+        }
+
+        #endregion IClonable Implementation
+    }
 }


remove-bqtable cmdlet & tests

remove-bqtable cmdlet & tests

--- Google.PowerShell/BigQuery/BqTable.cs
+++ Google.PowerShell/BigQuery/BqTable.cs
@@ -348,10 +348,10 @@
     ///   PS C:\> $table = Get-BqTable -Dataset "my_dataset" -Table "my_table"
     ///   PS C:\> $table | Remove-BqTable
     ///   <para>This will remove "my_table" if it is empty, and will prompt for user confirmation
-    ///   if it is not. All data in "my_table" will be deleted if the user accepts</para>
+    ///   if it is not. All data in "my_table" will be deleted if the user accepts.</para>
     /// </example>
     /// <example>
-    ///   PS C:\> Remove-BqTable -Dataset "my_dataset" -Table "my_table" -Force
+    ///   PS C:\> Remove-BqTable -DatasetId "my_dataset" -Table "my_table" -Force
     ///   <para>This will remove "my_table" and all of its data.</para>
     /// </example>
     /// <para type="link" uri="(https://cloud.google.com/bigquery/docs/reference/rest/v2/tables)">
@@ -419,7 +419,7 @@

         ///
         /// <para type="description">
-        /// Forces deletion of tables inside a non-empty Table.
+        /// Forces deletion of non-empty tables and the data contained in them.
         /// </para>
         ///
         [Parameter(Mandatory = false)]
@@ -429,8 +429,8 @@
         {
             switch (ParameterSetName)
             {
-                // No processing needed for ByValue parameter sets.
                 case ParameterSetNames.ByValue:
+                    // No processing needed for ByValue parameter sets.
                     break;
                 case ParameterSetNames.ByObject:
                     Project = InputObject.ProjectId;


Ensures messages that fail to serialize still queue correctly.

--- Python/Product/Ipc.Json/Connection.cs
+++ Python/Product/Ipc.Json/Connection.cs
@@ -18,6 +18,7 @@
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
+using System.Runtime.ExceptionServices;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
@@ -555,11 +556,20 @@
         /// Base protocol defined at https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#base-protocol
         /// </remarks>
         private async Task SendMessage(ProtocolMessage packet, CancellationToken cancel) {
-            var str = JsonConvert.SerializeObject(packet);
+            string str = null;
+            ExceptionDispatchInfo edi = null;
+            try {
+                str = JsonConvert.SerializeObject(packet);
+            } catch (Exception ex) {
+                edi = ExceptionDispatchInfo.Capture(ex);
+                LogToDisk(ex);
+            }
             int seq = packet.seq, sentSeq = -1;

             int retries = 1000;
-            LogToDisk(str);
+            if (!string.IsNullOrEmpty(str)) {
+                LogToDisk(str);
+            }
             try {
                 while (true) {
                     try {
@@ -572,6 +582,7 @@
                     try {
                         sentSeq = Interlocked.CompareExchange(ref _sentSeq, seq, seq - 1);
                         if (sentSeq == seq - 1) {
+                            edi?.Throw();
                             cancel.ThrowIfCancellationRequested();

                             // The content part is encoded using the charset provided in the Content-Type field.
@@ -618,6 +629,8 @@
                         Interlocked.Increment(ref _sentSeq);
                     }
                 }
+
+                edi?.Throw();
             } catch (Exception ex) {
                 LogToDisk(ex);
                 throw;


（もともと使っていない引数の）parameterを使わないように修正

（もともと使っていない引数の）parameterを使わないように修正

--- Ragnarok.Forms/Converter/EnumToBooleanConverter.cs
+++ Ragnarok.Forms/Converter/EnumToBooleanConverter.cs
@@ -28,9 +28,27 @@
         }

         /// <summary>
+        /// コンストラクタ
+        /// </summary>
+        public EnumToBooleanConverter(Type enumType, object targetValue)
+        {
+            EnumType = enumType;
+            TargetValue = targetValue;
+        }
+
+        /// <summary>
         /// 対象となる列挙型を取得または設定します。
         /// </summary>
         public Type EnumType
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        /// 比較対象となる列挙値を取得または設定します。
+        /// </summary>
+        public object TargetValue
         {
             get;
             set;
@@ -42,7 +60,7 @@
         /// </summary>
         public object Convert(object value, Type targetType, object parameter)
         {
-            var tmpString = parameter as string;
+            var tmpString = TargetValue as string;
             if (tmpString != null)
             {
                 if (string.IsNullOrEmpty(tmpString))
@@ -66,7 +84,7 @@
                 // 失敗するので、直接キャストして成功するか判断しています。
                 //
                 // すごく重いので、判定はメソッドの最後で行います。
-                return ((int)value == (int)parameter);
+                return ((int)value == (int)TargetValue);
             }
             catch (InvalidCastException)
             {
@@ -86,7 +104,7 @@
                 return FormsValue.UnsetValue;
             }

-            var tmpString = parameter as string;
+            var tmpString = TargetValue as string;
             if (tmpString != null)
             {
                 if (string.IsNullOrEmpty(tmpString))
@@ -103,7 +121,7 @@
                 // 失敗するので、直接キャストして成功するか判断しています。
                 //
                 // すごく重いので、判定はメソッドの最後で行います。
-                return (int)parameter;
+                return (int)TargetValue;
             }
             catch (InvalidCastException)
             {


Improved test logs: added H3Control files versions

--- H3Control.Tests/H3LauncherForTests.cs
+++ H3Control.Tests/H3LauncherForTests.cs
@@ -35,6 +35,7 @@
                     .GetFiles(directoryName)
                     .Select(x => Path.GetFileName(x))
                     .OrderBy(x => Path.GetFileNameWithoutExtension(x))
+                    .Select(x => x + TryGetVer(x))
                     .ToList();

                 var sep = Environment.NewLine + "  * ";
@@ -70,6 +71,19 @@
             NiceTrace.Message("Launch result (during {0}): {1}{2}", swLaunch.Elapsed, isOk ? "SUCCESS" : "FAIL", Environment.NewLine);
         }

+        static string TryGetVer(string file)
+        {
+            try
+            {
+                FileVersionInfo fi = FileVersionInfo.GetVersionInfo(file);
+                return "  " + fi.FileVersion;
+            }
+            catch (Exception ex)
+            {
+                return "";
+            }
+        }
+
         static bool FastCheck(string url)
         {
             try


Style stuff I overlooked before

Style stuff I overlooked before

--- Refit/RequestBuilderImplementation.cs
+++ Refit/RequestBuilderImplementation.cs
@@ -120,7 +120,7 @@
             };
         }

-        private void setHeader(HttpRequestMessage request, string name, object value) {
+        void setHeader(HttpRequestMessage request, string name, object value) {
             // Clear any existing version of this header we may have set, because
             // we want to allow removal/redefinition of headers.
             request.Headers.Remove(name);
@@ -438,7 +438,7 @@
             return Tuple.Create(ret.BodyAttribute.SerializationMethod, parameterList.IndexOf(ret.Parameter));
         }

-        private Dictionary<string, string> parseHeaders(MethodInfo methodInfo) {
+        Dictionary<string, string> parseHeaders(MethodInfo methodInfo) {
             var ret = new Dictionary<string, string>();

             var declaringTypeAttributes = methodInfo.DeclaringType != null
@@ -464,7 +464,7 @@
             return ret;
         }

-        private Dictionary<int, string> buildHeaderParameterMap(List<ParameterInfo> parameterList) {
+        Dictionary<int, string> buildHeaderParameterMap(List<ParameterInfo> parameterList) {
             var ret = new Dictionary<int, string>();

             for (int i = 0; i < parameterList.Count; i++) {


Adding polygon with label sample #275

Adding polygon with label sample #275

--- Samples/Mapsui.Samples.Common/Maps/LabelsSample.cs
+++ Samples/Mapsui.Samples.Common/Maps/LabelsSample.cs
@@ -34,7 +34,6 @@
             });
             memoryProvider.Features.Add(featureWithRightAlignedStyle);

-
             var featureWithBottomAlignedStyle = new Feature { Geometry = new Point(0, -4000000) };
             featureWithBottomAlignedStyle.Styles.Add(new LabelStyle
             {
@@ -43,7 +42,15 @@
                 VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Bottom
             });
             memoryProvider.Features.Add(featureWithBottomAlignedStyle);
-
+
+            var polygon = new Feature { Geometry = Geometry.GeomFromText("POLYGON((-1000000 -10000000, 1000000 -10000000, 1000000 -8000000, -1000000 -8000000, -1000000 -10000000))") };
+            polygon.Styles.Add(new LabelStyle
+            {
+                Text = "Polygon",
+                BackColor = new Brush(Color.Gray),
+                HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center
+            });
+            memoryProvider.Features.Add(polygon);

             var featureWithColors = new Feature {Geometry = new Point(0, -6000000)};
             featureWithColors.Styles.Add(CreateColoredLabelStyle());


allow to export json for neutral language

--- ResXManager.Model/WebFilesExporter.cs
+++ ResXManager.Model/WebFilesExporter.cs
@@ -81,7 +81,7 @@
                 File.WriteAllText(typeScriptFilePath, typescript.ToString());

                 var specificLanguages = _resourceManager.ResourceEntities
-                    .SelectMany(entity => entity.Languages.Skip(1))
+                    .SelectMany(entity => entity.Languages.Skip(config.ExportNeutralJson ? 0 : 1))
                     .GroupBy(lang => lang.CultureKey);

                 foreach (var languages in specificLanguages)
@@ -117,6 +117,8 @@
             public string TypeScriptFileDir { get; set; }
             [JsonProperty("jsonFileDir")]
             public string JsonFileDir { get; set; }
+            [JsonProperty("exportNeutralJson")]
+            public bool ExportNeutralJson { get; set; }
         }
     }
 }


Was ignoring subscription configuration on non-generic extension methods.

--- Source/EasyNetQ/NonGeneric/NonGenericExtensions.cs
+++ Source/EasyNetQ/NonGeneric/NonGenericExtensions.cs
@@ -59,7 +59,7 @@
             }

             var subscribeMethod = subscribeMethodOpen.MakeGenericMethod(messageType);
-            return (IDisposable)subscribeMethod.Invoke(bus, new object[] { subscriptionId, onMessage });
+            return (IDisposable)subscribeMethod.Invoke(bus, new object[] { subscriptionId, onMessage, configure });
         }

         private static bool HasCorrectParameters(MethodInfo methodInfo)
@@ -67,9 +67,10 @@
             var parameters = methodInfo.GetParameters();

             return
-                (parameters.Length == 2) &&
+                (parameters.Length == 3) &&
                 (parameters[0].ParameterType == typeof(string) &&
-                parameters[1].ParameterType.Name == "Func`2");
+                parameters[1].ParameterType.Name == "Func`2") &&
+                parameters[2].ParameterType == typeof(Action<ISubscriptionConfiguration>);
         }
     }
 }


Log the url in the file cacher log messages

--- Funnier/FileCacher.cs
+++ Funnier/FileCacher.cs
@@ -59,7 +59,8 @@
         private static NSData FetchUrl(string path, string url)
         {

-            Debug.WriteLine("FromUrl on thread {0}:{1}",
+            Debug.WriteLine("FromUrl: {0} on thread {1}:{2}",
+                          url,
                           System.Threading.Thread.CurrentThread.ManagedThreadId, System.Threading.Thread.CurrentThread.Name);
             try {
                 UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;


Instantiating ToolbarWindow in Awake of the ToolbarManager. Fixed #18

--- GUI/TooltipManager.cs
+++ GUI/TooltipManager.cs
@@ -10,10 +10,11 @@

 namespace AT_Utils
 {
-    [KSPAddon(KSPAddon.Startup.AllGameScenes, false)]
+    [KSPAddon(KSPAddon.Startup.AllGameScenes, true)]
     public class TooltipManager : MonoBehaviour
     {
-        static readonly TooltipWindow tooltipWindow = new TooltipWindow();
+        private static TooltipManager instance;
+        private static TooltipWindow tooltipWindow;

         private static string tooltip = "";
         private static readonly int max_width = Math.Max(Screen.width / 6, 200);
@@ -91,6 +92,13 @@

         void Awake()
         {
+            if(instance != null)
+            {
+                Destroy(this);
+                return;
+            }
+            instance = this;
+            tooltipWindow = new TooltipWindow();
             tooltipWindow.Show(this);
         }


remove unnecessary dot at end of full version string

--- GlobalAssemblyInfo.cs
+++ GlobalAssemblyInfo.cs
@@ -20,7 +20,7 @@
     public const string Label = ReleaseLabel.Dev;
     public const string AdditionalReleaseInformation = "";
     public const string Current = Major + "." + Minor + "." + Patch;
-    public const string FullCurrent = Current + "-" + Label + "." + AdditionalReleaseInformation;
+    public const string FullCurrent = Current + "-" + Label + AdditionalReleaseInformation;
 }

 class ReleaseLabel


Version 1.2.0.4

Version 1.2.0.4

Version bump to version 1.2.0.4

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


Add a stop-gap to prevent crashes while splitting the vernacular based on the reference text

This should be considered temporary as Tom is already working on a real fix for the only
remaining known issue which has to do with partial verse segments.

--- Glyssen/BookScript.cs
+++ Glyssen/BookScript.cs
@@ -605,7 +605,15 @@
 						return false;
 				}
 			}
-			SplitBlock(vernBlock, verseString, kSplitAtEndOfVerse, false);
+			try
+			{
+				SplitBlock(vernBlock, verseString, kSplitAtEndOfVerse, false);
+			}
+			catch (ArgumentException)
+			{
+				// This is a stop-gap until we can get the issues resolved with splitting for reference texts
+				return false;
+			}
 			return true;
 		}


Parameters are being taken from parameters object.

--- SharpGenetics/SharpGenetics/Predictor/NeuralNetworkPredictor.cs
+++ SharpGenetics/SharpGenetics/Predictor/NeuralNetworkPredictor.cs
@@ -20,17 +20,17 @@
             Outputs = new List<double>();
         }

-        public InputOutputPair(List<double> In, List<double> Out, double MinVal, double MinOutput, double MaxVal, double MaxOutputVal)
+        public InputOutputPair(List<double> In, List<double> Out, List<double> MinVal, List<double> MinOutput, List<double> MaxVal, List<double> MaxOutputVal)
         {
             Inputs = new List<double>(In);
             Outputs = new List<double>(Out);
             for (int i = 0; i < Inputs.Count; i++)
             {
-                Inputs[i] = (Inputs[i] - MinVal) / (MaxVal - MinVal);
+                Inputs[i] = (Inputs[i] - MinVal[i]) / (MaxVal[i] - MinVal[i]);
             }
             for (int i = 0; i < Outputs.Count; i++)
             {
-                Outputs[i] = Math.Min(1, (Outputs[i] - MinOutput) / (MaxOutputVal - MinOutput));
+                Outputs[i] = Math.Min(1, (Outputs[i] - MinOutput[i]) / (MaxOutputVal[i] - MinOutput[i]));
             }
         }

@@ -59,14 +59,14 @@
         public int MinTrainingData = 100;

         [DataMember]
-        public double MaxVal = 20000;
-        [DataMember]
-        public double MinVal = 0;
-
-        [DataMember]
-        public double MaxOutputVal = 20000;
-        [DataMember]
-        public double MinOutputVal = 0;
+        public List<double> MaxVal = new List<double>();
+        [DataMember]
+        public List<double> MinVal = new List<double>();
+
+        [DataMember]
+        public List<double> MaxOutputVal = new List<double>();
+        [DataMember]
+        public List<double> MinOutputVal = new List<double>();

         [DataMember]
         double DiffPerSample = -1;
@@ -139,14 +139,34 @@

         public NeuralNetworkPredictor(RunParameters Parameters, int RandomSeed)
         {
-            //TODO
-            InputLayer = (int)(double)Parameters.GetParameter("extra_Predictor_InputLayerCount"); //change to vector length
+            int InputLayerSize = 0;
+            MinVal.Clear();
+            MaxVal.Clear();
+            MinOutputVal.Clear(); //TODO make these dynamic based on first few generations
+            MaxOutputVal.Clear();
+            foreach(var P in Parameters.JsonParams.parameters)
+            {
+                if(P.enabled.Value)
+                {
+                    InputLayerSize++;
+                    MinVal.Add(P.rangeMin.Value);
+                    MaxVal.Add(P.rangeMax.Value);
+                }
+            }
+            InputLayer = InputLayerSize;
+
+            int OutputLayerSize = 0;
+            foreach(var E in Parameters.JsonParams.evaluators)
+            {
+                if(E.enabled.Value)
+                {
+                    OutputLayerSize++;
+                    MinOutputVal.Add(0);
+                }
+            }
+            OutputLayer = OutputLayerSize;
+
             HiddenLayer = (int)(double)Parameters.GetParameter("extra_Predictor_HiddenLayerCount");
-            OutputLayer = (int)(double)Parameters.GetParameter("extra_Predictor_OutputLayerCount"); //change to evaluator count
-            this.MinVal = (int)(double)Parameters.GetParameter("extra_Predictor_MinInputVal"); //change to the ones in the params
-            this.MaxVal = (int)(double)Parameters.GetParameter("extra_Predictor_MaxInputVal"); //as above
-            this.MinOutputVal = (int)(double)Parameters.GetParameter("extra_Predictor_MinOutputVal"); //as above
-            this.MaxOutputVal = (int)(double)Parameters.GetParameter("extra_Predictor_MaxOutputVal"); //as above
             this.MaxTrainingData = (int)(double)Parameters.GetParameter("extra_Predictor_MaxTrainingData");
             this.MinTrainingData = (int)(double)Parameters.GetParameter("extra_Predictor_MinTrainingData");
             this.TrainingEpochsPerGeneration = (int)(double)Parameters.GetParameter("extra_Predictor_TrainingEpochs");
@@ -210,13 +230,13 @@
                 List<double> NewInput = new List<double>(Input);
                 for (int i = 0; i < NewInput.Count; i++)
                 {
-                    NewInput[i] = (NewInput[i] - MinVal) / (MaxVal - MinVal);
+                    NewInput[i] = (NewInput[i] - MinVal[i]) / (MaxVal[i] - MinVal[i]);
                 }
                 Result = Network.Compute(NewInput.ToArray()).ToList();
             }
             for (int i = 0; i < Result.Count; i++)
             {
-                Result[i] = Result[i] * (MaxOutputVal - MinOutputVal) + MinOutputVal;
+                Result[i] = Result[i] * (MaxOutputVal[i] - MinOutputVal[i]) + MinOutputVal[i];
             }
             return Result;
         }
@@ -361,7 +381,7 @@

             DiffPerSample = Math.Max(Diff / (ValidationSet.Count * OutputLayer), DiffOnTraining / (NetworkTrainingData.Count * OutputLayer));

-            DiffPerSampleNotNormalised = DiffPerSample * (MaxOutputVal - MinOutputVal) + MinOutputVal;
+            DiffPerSampleNotNormalised = DiffPerSample * (MaxOutputVal[0] - MinOutputVal[0]) + MinOutputVal[0]; //TODO: change to per objective

             //NetworkAccuracy = 1.0d - (DiffPerSampleNotNormalised / MaxThresholdVal);
             //NetworkAccuracy = 1.0d - (Diff / (MaxTrainingData * 3 / 5) * 10); // /300 * 20000 / 2000 (divided by 100 samples and 3 vals per sample, multiplied by maxval, divided by what I want the base error to be)


Google: Changed order of parameters for normalization throughout framework (BREAKING CHANGE)

--- Skybrud.Social/Skybrud.Social/Google/OAuth/GoogleOAuthClient.cs
+++ Skybrud.Social/Skybrud.Social/Google/OAuth/GoogleOAuthClient.cs
@@ -47,10 +47,10 @@
         /// <summary>
         /// Gets the authorization URL at accounts.google.com for your application.
         /// </summary>
+        /// <param name="state">The state of the application.</param>
         /// <param name="scope">The scope of the application.</param>
-        /// <param name="state">The state of the application.</param>
         /// <param name="offline">Whether the application should be enabled for offline access. Default is false.</param>
-        public string GetAuthorizationUrl(string scope, string state, bool offline = false) {
+        public string GetAuthorizationUrl(string state, string scope, bool offline = false) {
             return GenerateUrl("https://accounts.google.com/o/oauth2/auth", new NameValueCollection {
                 {"response_type", "code"},
                 {"client_id", ClientId + ".apps.googleusercontent.com"},


work on extended player logic

work on extended player logic

--- Source/AI/TexasHoldem.AI.TuringExtended/TuringExtendedPlayer.cs
+++ Source/AI/TexasHoldem.AI.TuringExtended/TuringExtendedPlayer.cs
@@ -11,10 +11,12 @@
     public class TuringExtendedPlayer : BasePlayer
     {
         private int counter = 0;
-        public override string Name
-        {
-            get;
-        } = "TuringExtendedPlayer_" + Guid.NewGuid();
+        private int raisesOnPreFlop = 0;
+        private int raisesOnFlop = 0;
+        private int raisesOnTurn = 0;
+        private int raisesOnRiver = 0;
+
+        public override string Name { get; } = "TuringExtendedPlayer_" + Guid.NewGuid();

         public override PlayerAction GetTurn(GetTurnContext context)
         {
@@ -51,6 +53,7 @@
                 {
                     return PlayerAction.CheckOrCall();
                 }
+
                 return PlayerAction.Fold();
             }

@@ -62,6 +65,7 @@
                 {
                     return PlayerAction.CheckOrCall();
                 }
+
                 if (context.IsAllIn)
                 {
                     return PlayerAction.Fold();
@@ -89,10 +93,12 @@

                 if (context.MoneyLeft < context.SmallBlind * 10)
                 {
-                    return PlayerAction.Raise(10000);
-                }
-
-                var smallBlindsTimes = RandomProvider.Next(3, 5);
+                    if (this.raisesOnPreFlop < 1)
+                    {
+                        this.raisesOnPreFlop += 1;
+                        return PlayerAction.Raise(context.SmallBlind * 2);
+                    }
+                }

                 if (context.MoneyToCall <= context.MoneyLeft / 5)
                 {
@@ -104,8 +110,11 @@

             if (playHand == CardValuationType.StronglyRecommended)
             {
-                var smallBlindsTimes = RandomProvider.Next(5, 8);
-                return PlayerAction.Raise(context.SmallBlind * 5);
+                if (this.raisesOnPreFlop < 1)
+                {
+                    this.raisesOnPreFlop += 1;
+                    return PlayerAction.Raise(context.SmallBlind * 2);
+                }
             }

             return PlayerAction.CheckOrCall();
@@ -114,10 +123,6 @@
         private PlayerAction GetActionForFlop(GetTurnContext context)
         {
             var playHand = HandStrengthValuation.Flop(this.FirstCard, this.SecondCard, this.CommunityCards);
-            if (playHand == CardValuationType.PlayItAllIn)
-            {
-                return PlayerAction.Raise(10000000);
-            }

             if (playHand == CardValuationType.Unplayable)
             {
@@ -134,41 +139,43 @@

             if (playHand == CardValuationType.Risky)
             {
-                var smallBlindsTimes = RandomProvider.Next(1, 8);
-                if (context.CanCheck)
-                {
-                    return PlayerAction.CheckOrCall();
-                }
-
-                return PlayerAction.Fold();
-            }
-
-            if (playHand == CardValuationType.Recommended)
-            {
-                var smallBlindsTimes = RandomProvider.Next(6, 14);
+                if (context.CanCheck)
+                {
+                    return PlayerAction.CheckOrCall();
+                }
+
+                return PlayerAction.Fold();
+            }
+
+            if (playHand == CardValuationType.Recommended)
+            {
+                var smallBlindsTimes = RandomProvider.Next(1, 14);
                 if (context.CanCheck)
                 {
                     if (context.MoneyToCall <= context.MoneyLeft / 10)
                     {
                         return PlayerAction.CheckOrCall();
                     }
-                    return PlayerAction.Fold();
-                }
-
-                // this one is not working but it is an idea :)
-                if (context.PreviousRoundActions.ToArray()
-                        .Any(s => s.Action.Type == PlayerActionType.Raise && s.PlayerName != this.Name))
-                {
-                    return PlayerAction.Raise(100000);
-                }
-
-                return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes);
-            }
-
-            if (playHand == CardValuationType.StronglyRecommended)
-            {
-                var smallBlindsTimes = RandomProvider.Next(14, 28);
-                return PlayerAction.Raise(context.SmallBlind * 30);
+
+                    return PlayerAction.Fold();
+                }
+
+                if (this.raisesOnFlop < 2)
+                {
+                    this.raisesOnPreFlop += 1;
+                    return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes);
+                }
+
+                return PlayerAction.CheckOrCall();
+            }
+
+            if (playHand == CardValuationType.StronglyRecommended)
+            {
+                if (this.raisesOnFlop < 1)
+                {
+                    this.raisesOnPreFlop += 1;
+                    return PlayerAction.Raise(context.SmallBlind * 4);
+                }
             }

             return PlayerAction.CheckOrCall();
@@ -177,10 +184,6 @@
         private PlayerAction GetActionForTurn(GetTurnContext context)
         {
             var playHand = HandStrengthValuation.Turn(this.FirstCard, this.SecondCard, this.CommunityCards);
-            if (playHand == CardValuationType.PlayItAllIn)
-            {
-                return PlayerAction.Raise(10000000);
-            }

             if (playHand == CardValuationType.Unplayable)
             {
@@ -201,6 +204,7 @@
                 {
                     return PlayerAction.CheckOrCall();
                 }
+
                 if (context.MoneyToCall <= context.MoneyLeft / 20)
                 {
                     return PlayerAction.CheckOrCall();
@@ -211,62 +215,79 @@

             if (playHand == CardValuationType.Recommended)
             {
+                if (this.raisesOnTurn < 2)
+                {
+                    this.raisesOnTurn += 1;
+                    return PlayerAction.Raise(context.SmallBlind * 4);
+                }
+            }
+
+            if (playHand == CardValuationType.StronglyRecommended)
+            {
+                if (this.raisesOnTurn < 2)
+                {
+                    this.raisesOnTurn += 1;
+                    var smallBlindsTimes = RandomProvider.Next(8, 18);
+
+                    return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes);
+                }
+
+                return PlayerAction.Raise(context.SmallBlind * 2);
+            }
+
+            return PlayerAction.CheckOrCall();
+        }
+
+        private PlayerAction GetActionForRiver(GetTurnContext context)
+        {
+            var playHand = HandStrengthValuation.River(this.FirstCard, this.SecondCard, this.CommunityCards);
+            if (playHand == CardValuationType.Unplayable)
+            {
+                if (context.CanCheck)
+                {
+                    return PlayerAction.CheckOrCall();
+                }
+                else
+                {
+                    return PlayerAction.Fold();
+                }
+            }
+
+            if (playHand == CardValuationType.Risky)
+            {
+                if (context.CanCheck)
+                {
+                    return PlayerAction.CheckOrCall();
+                }
+
+                if (context.MoneyToCall <= context.MoneyLeft / 20)
+                {
+                    return PlayerAction.CheckOrCall();
+                }
+
+                return PlayerAction.Fold();
+            }
+
+            if (playHand == CardValuationType.Recommended)
+            {
                 var smallBlindsTimes = RandomProvider.Next(6, 14);

-                return PlayerAction.Raise(context.SmallBlind * 20);
-            }
-
-            if (playHand == CardValuationType.StronglyRecommended)
-            {
-                var smallBlindsTimes = RandomProvider.Next(14, 28);
-                return PlayerAction.Raise(context.SmallBlind * 30);
-            }
-
-            return PlayerAction.CheckOrCall();
-        }
-
-        private PlayerAction GetActionForRiver(GetTurnContext context)
-        {
-            var playHand = HandStrengthValuation.River(this.FirstCard, this.SecondCard, this.CommunityCards);
-            if (playHand == CardValuationType.Unplayable)
-            {
-                if (context.CanCheck)
-                {
-                    return PlayerAction.CheckOrCall();
-                }
-                else
-                {
-                    return PlayerAction.Fold();
-                }
-            }
-
-            if (playHand == CardValuationType.Risky)
-            {
-                if (context.CanCheck)
-                {
-                    return PlayerAction.CheckOrCall();
-                }
-
-                if (context.MoneyToCall <= context.MoneyLeft / 20)
-                {
-                    return PlayerAction.CheckOrCall();
-                }
-
-
-                return PlayerAction.Fold();
-            }
-
-            if (playHand == CardValuationType.Recommended)
-            {
-                var smallBlindsTimes = RandomProvider.Next(6, 14);
-
-                return PlayerAction.Raise(context.SmallBlind * 20);
-            }
-
-            if (playHand == CardValuationType.StronglyRecommended)
-            {
-                var smallBlindsTimes = RandomProvider.Next(14, 28);
-                return PlayerAction.Raise(context.SmallBlind * 1000);
+                if (this.raisesOnRiver < 3)
+                {
+                    this.raisesOnRiver += 1;
+                    return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes);
+                }
+            }
+
+            if (playHand == CardValuationType.StronglyRecommended)
+            {
+                if (this.raisesOnRiver >= 1)
+                {
+                    this.raisesOnRiver++;
+                    return PlayerAction.Raise(500);
+                }
+
+                return PlayerAction.CheckOrCall();
             }

             return PlayerAction.CheckOrCall();


remove spaces from email logging

remove spaces from email logging

--- Source/Actions/Microsoft.Deployment.Common/Controller/Logger.cs
+++ Source/Actions/Microsoft.Deployment.Common/Controller/Logger.cs
@@ -180,9 +180,9 @@
         public void LogEmailSubscription(string emailAddress, string nameFirst, string nameLast)
         {
             Dictionary<string, string> emailSubscription = new Dictionary<string, string>();
-            emailSubscription.Add("Email Address", emailAddress);
-            emailSubscription.Add("First Name", nameFirst);
-            emailSubscription.Add("Last Name", nameLast);
+            emailSubscription.Add("EmailAddress", emailAddress);
+            emailSubscription.Add("FirstName", nameFirst);
+            emailSubscription.Add("LastName", nameLast);
             this.LogEvent("Email-Subscription", emailSubscription);
         }


Making EndpointName serializable.

Making EndpointName serializable.

--- Source/Extensions/Machine.MassTransitExtensions/EndpointName.cs
+++ Source/Extensions/Machine.MassTransitExtensions/EndpointName.cs
@@ -3,6 +3,7 @@

 namespace Machine.MassTransitExtensions
 {
+  [Serializable]
   public class EndpointName
   {
     private readonly string _address;


GSF.TimeSeries: Fixed method names in GatewayStatistics.cs.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/gsf/Main;C83326

--- Source/Libraries/GSF.TimeSeries/Statistics/GatewayStatistics.cs
+++ Source/Libraries/GSF.TimeSeries/Statistics/GatewayStatistics.cs
@@ -98,7 +98,7 @@
             return statistic;
         }

-        private static double GetSubscriberStatistc_LifetimeMeasurements(object source, string arguments)
+        private static double GetSubscriberStatistic_LifetimeMeasurements(object source, string arguments)
         {
             double statistic = 0.0D;
             DataSubscriber subscriber = source as DataSubscriber;
@@ -109,7 +109,7 @@
             return statistic;
         }

-        private static double GetSubscriberStatistic_MinimumMeasurementRate(object source, string arguments)
+        private static double GetSubscriberStatistic_MinimumMeasurementsPerSecond(object source, string arguments)
         {
             double statistic = 0.0D;
             DataSubscriber subscriber = source as DataSubscriber;
@@ -120,7 +120,7 @@
             return statistic;
         }

-        private static double GetSubscriberStatistic_MaximumMeasurementRate(object source, string arguments)
+        private static double GetSubscriberStatistic_MaximumMeasurementsPerSecond(object source, string arguments)
         {
             double statistic = 0.0D;
             DataSubscriber subscriber = source as DataSubscriber;
@@ -131,7 +131,7 @@
             return statistic;
         }

-        private static double GetSubscriberStatistic_AverageMeasurementRate(object source, string arguments)
+        private static double GetSubscriberStatistic_AverageMeasurementsPerSecond(object source, string arguments)
         {
             double statistic = 0.0D;
             DataSubscriber subscriber = source as DataSubscriber;


The provider was not checking its argument for null.

--- SubtextSolution/Subtext.Installation/SqlInstallationProvider.cs
+++ SubtextSolution/Subtext.Installation/SqlInstallationProvider.cs
@@ -97,6 +97,9 @@
 		/// </returns>
 		public override bool IsInstallationException(Exception exception)
 		{
+			if (exception == null)
+				throw new ArgumentNullException("exception", "It's not an installation exception if it's null.");
+
 			Regex tableRegex = new Regex("Invalid object name '.*?'", RegexOptions.IgnoreCase | RegexOptions.Compiled);
 			bool isSqlException = exception is SqlException;


__construct may return

__construct may return

--- src/Compiler/PhpCodeAnalysis/CodeGen/MethodGenerator.cs
+++ src/Compiler/PhpCodeAnalysis/CodeGen/MethodGenerator.cs
@@ -216,6 +216,7 @@
                 {
                     Debug.Assert(!realctor.IsStatic);
                     var ps = realctor.Parameters;
+                    bool returnsValue = !realctor.ReturnsVoid;

                     // call realctor
                     il.EmitLoadArgumentOpcode(0);    // this
@@ -249,8 +250,11 @@
                         }
                     }

-                    il.EmitOpCode(ILOpCode.Call, -1 - ps.Length);   // - this - ps
+                    il.EmitOpCode(ILOpCode.Call, -1 - ps.Length + (returnsValue ? 1 : 0));   // - this - ps
                     il.EmitToken(realctor, null, diagnostics);
+
+                    if (returnsValue)
+                        il.EmitOpCode(ILOpCode.Pop);
                 }

                 // return


[StreamTagger] Recognize webm as video (bgo#633841)

--- src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
+++ src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
@@ -40,7 +40,7 @@
         // This is a short list of video types that TagLib# might not support but that
         // we want to make sure are recognized as videos
         private static readonly ExtensionSet VideoExtensions = new ExtensionSet (
-            "avi", "divx", "dv", "f4p", "f4v", "flv", "m4v", "mkv", "mov", "ogv", "qt", "ts");
+            "avi", "divx", "dv", "f4p", "f4v", "flv", "m4v", "mkv", "mov", "ogv", "qt", "ts", "webm");

         public static TagLib.File ProcessUri (SafeUri uri)
         {


fix error

fix error

--- Web/Areas/Logistics/Controllers/DispatchAllocationController.cs
+++ Web/Areas/Logistics/Controllers/DispatchAllocationController.cs
@@ -13,9 +13,9 @@
 using Cats.ViewModelBinder;
 using Kendo.Mvc.Extensions;
 using Kendo.Mvc.UI;
-using Microsoft.AspNet.SignalR;
+
 using log4net;
-using Cats.Helpers;
+
 namespace Cats.Areas.Logistics.Controllers
 {
     public class DispatchAllocationController : Controller


Nullability.

Nullability.

--- src/ExRam.Gremlinq.Core.AspNet/GremlinqConfiguration.cs
+++ src/ExRam.Gremlinq.Core.AspNet/GremlinqConfiguration.cs
@@ -28,10 +28,10 @@
             return _baseConfiguration.GetSection(key);
         }

-        public string this[string key]
+        public string? this[string key]
         {
             get => _baseConfiguration[key];
             set => _baseConfiguration[key] = value;
         }
     }
-}+}


Explicit empty route for RoleController

Explicit empty route for RoleController

--- src/Folke.Identity.Server/Controllers/RoleController.cs
+++ src/Folke.Identity.Server/Controllers/RoleController.cs
@@ -1,101 +1,101 @@
-using Folke.Identity.Server.Services;
-using Folke.Mvc.Extensions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Identity;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Folke.Identity.Server.Controllers
-{
-    [Route("api/role")]
-    public class RoleController<TRole, TRoleView, TKey, TUser> : TypedControllerBase
-        where TRole : class
-        where TUser : class
-    {
-        private readonly IRoleService<TRole, TRoleView> roleService;
-        private readonly RoleManager<TRole> roleManager;
-        private readonly UserManager<TUser> userManager;
-
-        public RoleController(IRoleService<TRole, TRoleView> roleService, RoleManager<TRole> roleManager, UserManager<TUser> userManager)
-        {
-            this.roleService = roleService;
-            this.roleManager = roleManager;
-            this.userManager = userManager;
-        }
-
-        [Authorize("Role")]
-        [HttpGet("{id}", Name = "GetRole")]
-        public async Task<IHttpActionResult<TRoleView>> Get(string id)
-        {
-            return Ok(roleService.MapToRoleView(await roleManager.FindByIdAsync(id)));
-        }
-
-        [Authorize("Role")]
-        [HttpGet]
-        public IHttpActionResult<IEnumerable<TRoleView>> GetAll()
-        {
-            return Ok(roleManager.Roles.ToList().Select(x => roleService.MapToRoleView(x)));
-        }
-
-        [Authorize("Role")]
-        [HttpPost]
-        public async Task<IHttpActionResult<TRoleView>> Create([FromBody]string name)
-        {
-            var role = roleService.CreateNewRole(name);
-            var result = await roleManager.CreateAsync(role);
-            if (!result.Succeeded)
-            {
-                AddErrors(result);
-                return BadRequest<TRoleView>(ModelState);
-            }
-            return Created("GetRole", Convert.ChangeType(await roleManager.GetRoleIdAsync(role), typeof(TKey)), roleService.MapToRoleView(role));
-        }
-
-        [Authorize("Role")]
-        [HttpDelete("{id}")]
-        public async Task<IActionResult> Delete(string id)
-        {
-            var role = await roleManager.FindByIdAsync(id);
-            await roleManager.DeleteAsync(role);
-            return Ok();
-        }
-
-        [Authorize("Role")]
-        [HttpPost("~/api/user/{userId}/role")]
-        public async Task<IActionResult> AddUser([FromBody]string roleName,string userId)
-        {
-            var user = await userManager.FindByIdAsync(userId);
-            await userManager.AddToRoleAsync(user, roleName);
-            return Ok();
-        }
-
-        [Authorize("Role")]
-        [HttpDelete("~/api/user/{userId}/role")]
-        public async Task<IActionResult> DeleteUser([FromBody]string roleName, string userId)
-        {
-            var user = await userManager.FindByIdAsync(userId);
-            await userManager.RemoveFromRoleAsync(user, roleName);
-            return Ok();
-        }
-
-        [Authorize("Role")]
-        [HttpGet("~/api/user/{userId}/role")]
-        public async Task<IHttpActionResult<IList<string>>> GetForUser(string userId)
-        {
-            var user = await userManager.FindByIdAsync(userId);
-            var roles = await userManager.GetRolesAsync(user);
-            return Ok(roles);
-        }
-
-        private void AddErrors(IdentityResult result)
-        {
-            foreach (var error in result.Errors)
-            {
-                ModelState.AddModelError("", error.Description);
-            }
-        }
-    }
-}
+using Folke.Identity.Server.Services;
+using Folke.Mvc.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Folke.Identity.Server.Controllers
+{
+    [Route("api/role")]
+    public class RoleController<TRole, TRoleView, TKey, TUser> : TypedControllerBase
+        where TRole : class
+        where TUser : class
+    {
+        private readonly IRoleService<TRole, TRoleView> roleService;
+        private readonly RoleManager<TRole> roleManager;
+        private readonly UserManager<TUser> userManager;
+
+        public RoleController(IRoleService<TRole, TRoleView> roleService, RoleManager<TRole> roleManager, UserManager<TUser> userManager)
+        {
+            this.roleService = roleService;
+            this.roleManager = roleManager;
+            this.userManager = userManager;
+        }
+
+        [Authorize("Role")]
+        [HttpGet("{id}", Name = "GetRole")]
+        public async Task<IHttpActionResult<TRoleView>> Get(string id)
+        {
+            return Ok(roleService.MapToRoleView(await roleManager.FindByIdAsync(id)));
+        }
+
+        [Authorize("Role")]
+        [HttpGet("")]
+        public IHttpActionResult<IEnumerable<TRoleView>> GetAll()
+        {
+            return Ok(roleManager.Roles.ToList().Select(x => roleService.MapToRoleView(x)));
+        }
+
+        [Authorize("Role")]
+        [HttpPost("")]
+        public async Task<IHttpActionResult<TRoleView>> Create([FromBody]string name)
+        {
+            var role = roleService.CreateNewRole(name);
+            var result = await roleManager.CreateAsync(role);
+            if (!result.Succeeded)
+            {
+                AddErrors(result);
+                return BadRequest<TRoleView>(ModelState);
+            }
+            return Created("GetRole", Convert.ChangeType(await roleManager.GetRoleIdAsync(role), typeof(TKey)), roleService.MapToRoleView(role));
+        }
+
+        [Authorize("Role")]
+        [HttpDelete("{id}")]
+        public async Task<IActionResult> Delete(string id)
+        {
+            var role = await roleManager.FindByIdAsync(id);
+            await roleManager.DeleteAsync(role);
+            return Ok();
+        }
+
+        [Authorize("Role")]
+        [HttpPost("~/api/user/{userId}/role")]
+        public async Task<IActionResult> AddUser([FromBody]string roleName,string userId)
+        {
+            var user = await userManager.FindByIdAsync(userId);
+            await userManager.AddToRoleAsync(user, roleName);
+            return Ok();
+        }
+
+        [Authorize("Role")]
+        [HttpDelete("~/api/user/{userId}/role")]
+        public async Task<IActionResult> DeleteUser([FromBody]string roleName, string userId)
+        {
+            var user = await userManager.FindByIdAsync(userId);
+            await userManager.RemoveFromRoleAsync(user, roleName);
+            return Ok();
+        }
+
+        [Authorize("Role")]
+        [HttpGet("~/api/user/{userId}/role")]
+        public async Task<IHttpActionResult<IList<string>>> GetForUser(string userId)
+        {
+            var user = await userManager.FindByIdAsync(userId);
+            var roles = await userManager.GetRolesAsync(user);
+            return Ok(roles);
+        }
+
+        private void AddErrors(IdentityResult result)
+        {
+            foreach (var error in result.Errors)
+            {
+                ModelState.AddModelError("", error.Description);
+            }
+        }
+    }
+}


HttpFileServer now defaults to index.html if root path is specified.

--- src/Framework/Hadouken.Framework/Http/HttpFileServer.cs
+++ src/Framework/Hadouken.Framework/Http/HttpFileServer.cs
@@ -72,8 +72,12 @@

         private void ProcessContext(HttpListenerContext context)
         {
+            var requestedPath = context.Request.Url.AbsolutePath == "/"
+                ? "/index.html"
+                : context.Request.Url.AbsolutePath;
+
             var path = _baseDirectory +
-                       context.Request.Url.AbsolutePath.Substring(_uriPrefix.EndsWith("/")
+                       requestedPath.Substring(_uriPrefix.EndsWith("/")
                            ? _uriPrefix.Length - 1
                            : _uriPrefix.Length);


Settings Cache

Settings Cache

--- src/FujiyBlog.Core/EntityFramework/SettingRepository.cs
+++ src/FujiyBlog.Core/EntityFramework/SettingRepository.cs
@@ -1,52 +1,55 @@
 using System;
-using System.Data.Entity;
+using System.Collections.Generic;
+using System.Linq;
+using FujiyBlog.Core.Caching;

 namespace FujiyBlog.Core.EntityFramework
 {
     public class SettingRepository
     {
         private readonly FujiyBlogDatabase database;
+        private readonly Dictionary<int, string> settings;

         public SettingRepository(FujiyBlogDatabase database)
         {
             this.database = database;
-            database.Settings.Load();
+            settings = CacheHelper.FromCacheOrExecute(() => database.Settings.ToDictionary(x => x.Id, x => x.Value), "FujiyBlog.Core.EntityFramework.SettingRepository.settings");
         }

         public int  MinRequiredPasswordLength
         {
-            get { return int.Parse(database.Settings.Find((int)SettingNames.MinRequiredPasswordLength).Value); }
-            set { SaveSettings(SettingNames.MinRequiredPasswordLength, value.ToString()); }
+            get { return int.Parse(LoadSetting(SettingNames.MinRequiredPasswordLength)); }
+            set { SaveSetting(SettingNames.MinRequiredPasswordLength, value.ToString()); }
         }

         public int PostsPerPage
         {
-            get { return int.Parse(database.Settings.Find((int)SettingNames.PostsPerPage).Value); }
-            set { SaveSettings(SettingNames.PostsPerPage, value.ToString()); }
+            get { return int.Parse(LoadSetting(SettingNames.PostsPerPage)); }
+            set { SaveSetting(SettingNames.PostsPerPage, value.ToString()); }
         }

         public string BlogName
         {
-            get { return database.Settings.Find((int)SettingNames.BlogName).Value; }
-            set { SaveSettings(SettingNames.BlogName, value); }
+            get { return LoadSetting(SettingNames.BlogName); }
+            set { SaveSetting(SettingNames.BlogName, value); }
         }

         public string BlogDescription
         {
-            get { return database.Settings.Find((int)SettingNames.BlogDescription).Value; }
-            set { SaveSettings(SettingNames.BlogDescription, value); }
+            get { return LoadSetting(SettingNames.BlogDescription); }
+            set { SaveSetting(SettingNames.BlogDescription, value); }
         }

         public string Theme
         {
-            get { return database.Settings.Find((int)SettingNames.Theme).Value; }
-            set { SaveSettings(SettingNames.Theme, value); }
+            get { return LoadSetting(SettingNames.Theme); }
+            set { SaveSetting(SettingNames.Theme, value); }
         }

         public TimeZoneInfo TimeZone
         {
-            get { return TimeZoneInfo.FindSystemTimeZoneById(database.Settings.Find((int)SettingNames.TimeZone).Value); }
-            set { SaveSettings(SettingNames.TimeZone, value.Id); }
+            get { return TimeZoneInfo.FindSystemTimeZoneById(LoadSetting(SettingNames.TimeZone)); }
+            set { SaveSetting(SettingNames.TimeZone, value.Id); }
         }

@@ -54,44 +57,44 @@

         public string EmailTo
         {
-            get { return database.Settings.Find((int)SettingNames.EmailTo).Value; }
-            set { SaveSettings(SettingNames.EmailTo, value); }
+            get { return LoadSetting(SettingNames.EmailTo); }
+            set { SaveSetting(SettingNames.EmailTo, value); }
         }

         public string EmailSubjectPrefix
         {
-            get { return database.Settings.Find((int)SettingNames.EmailSubjectPrefix).Value; }
-            set { SaveSettings(SettingNames.EmailSubjectPrefix, value); }
+            get { return LoadSetting(SettingNames.EmailSubjectPrefix); }
+            set { SaveSetting(SettingNames.EmailSubjectPrefix, value); }
         }

         public string SmtpAddress
         {
-            get { return database.Settings.Find((int)SettingNames.SmtpAddress).Value; }
-            set { SaveSettings(SettingNames.SmtpAddress, value); }
+            get { return LoadSetting(SettingNames.SmtpAddress); }
+            set { SaveSetting(SettingNames.SmtpAddress, value); }
         }

         public int SmtpPort
         {
-            get { return int.Parse(database.Settings.Find((int)SettingNames.SmtpPort).Value); }
-            set { SaveSettings(SettingNames.SmtpPort, value.ToString()); }
+            get { return int.Parse(LoadSetting(SettingNames.SmtpPort)); }
+            set { SaveSetting(SettingNames.SmtpPort, value.ToString()); }
         }

         public string SmtpUserName
         {
-            get { return database.Settings.Find((int)SettingNames.SmtpUserName).Value; }
-            set { SaveSettings(SettingNames.SmtpUserName, value); }
+            get { return LoadSetting(SettingNames.SmtpUserName); }
+            set { SaveSetting(SettingNames.SmtpUserName, value); }
         }

         public string SmtpPassword
         {
-            get { return database.Settings.Find((int)SettingNames.SmtpPassword).Value; }
-            set { SaveSettings(SettingNames.SmtpPassword, value); }
+            get { return LoadSetting(SettingNames.SmtpPassword); }
+            set { SaveSetting(SettingNames.SmtpPassword, value); }
         }

         public bool SmtpSsl
         {
-            get { return bool.Parse(database.Settings.Find((int)SettingNames.SmtpSsl).Value); }
-            set { SaveSettings(SettingNames.SmtpSsl, value.ToString()); }
+            get { return bool.Parse(LoadSetting(SettingNames.SmtpSsl)); }
+            set { SaveSetting(SettingNames.SmtpSsl, value.ToString()); }
         }

@@ -99,50 +102,50 @@

         public bool EnableComments
         {
-            get { return bool.Parse(database.Settings.Find((int)SettingNames.EnableComments).Value); }
-            set { SaveSettings(SettingNames.EnableComments, value.ToString()); }
+            get { return bool.Parse(LoadSetting(SettingNames.EnableComments)); }
+            set { SaveSetting(SettingNames.EnableComments, value.ToString()); }
         }

         public bool ModerateComments
         {
-            get { return bool.Parse(database.Settings.Find((int)SettingNames.ModerateComments).Value); }
-            set { SaveSettings(SettingNames.ModerateComments, value.ToString()); }
+            get { return bool.Parse(LoadSetting(SettingNames.ModerateComments)); }
+            set { SaveSetting(SettingNames.ModerateComments, value.ToString()); }
         }

         public bool EnableNestedComments
         {
-            get { return bool.Parse(database.Settings.Find((int)SettingNames.EnableNestedComments).Value); }
-            set { SaveSettings(SettingNames.EnableNestedComments, value.ToString()); }
+            get { return bool.Parse(LoadSetting(SettingNames.EnableNestedComments)); }
+            set { SaveSetting(SettingNames.EnableNestedComments, value.ToString()); }
         }

         public int? CloseCommentsAfterDays
         {
             get
             {
-                string value = database.Settings.Find((int)SettingNames.CloseCommentsAfterDays).Value;
+                string value = LoadSetting(SettingNames.CloseCommentsAfterDays);
                 if (value == null)
                     return null;
                 return int.Parse(value);
             }
-            set { SaveSettings(SettingNames.CloseCommentsAfterDays, value.HasValue ? value.ToString() : null); }
+            set { SaveSetting(SettingNames.CloseCommentsAfterDays, value.HasValue ? value.ToString() : null); }
         }

         public int CommentsPerPage
         {
-            get { return int.Parse(database.Settings.Find((int)SettingNames.CommentsPerPage).Value); }
-            set { SaveSettings(SettingNames.CommentsPerPage, value.ToString()); }
+            get { return int.Parse(LoadSetting(SettingNames.CommentsPerPage)); }
+            set { SaveSetting(SettingNames.CommentsPerPage, value.ToString()); }
         }

         public string CommentsAvatar
         {
-            get { return database.Settings.Find((int)SettingNames.CommentsAvatar).Value; }
-            set { SaveSettings(SettingNames.CommentsAvatar, value); }
+            get { return LoadSetting(SettingNames.CommentsAvatar); }
+            set { SaveSetting(SettingNames.CommentsAvatar, value); }
         }

         public string Culture
         {
-            get { return database.Settings.Find((int)SettingNames.Culture).Value; }
-            set { SaveSettings(SettingNames.Culture, value); }
+            get { return LoadSetting(SettingNames.Culture); }
+            set { SaveSetting(SettingNames.Culture, value); }
         }

@@ -150,33 +153,38 @@

         public bool EnableFacebookLikePosts
         {
-            get { return bool.Parse(database.Settings.Find((int)SettingNames.EnableFacebookLikePosts).Value); }
-            set { SaveSettings(SettingNames.EnableFacebookLikePosts, value.ToString()); }
+            get { return bool.Parse(LoadSetting(SettingNames.EnableFacebookLikePosts)); }
+            set { SaveSetting(SettingNames.EnableFacebookLikePosts, value.ToString()); }
         }

         public bool EnableGooglePlusOnePosts
         {
-            get { return bool.Parse(database.Settings.Find((int)SettingNames.EnableGooglePlusOnePosts).Value); }
-            set { SaveSettings(SettingNames.EnableGooglePlusOnePosts, value.ToString()); }
+            get { return bool.Parse(LoadSetting(SettingNames.EnableGooglePlusOnePosts)); }
+            set { SaveSetting(SettingNames.EnableGooglePlusOnePosts, value.ToString()); }
         }

         public bool EnableTwitterSharePosts
         {
-            get { return bool.Parse(database.Settings.Find((int)SettingNames.EnableTwitterSharePosts).Value); }
-            set { SaveSettings(SettingNames.EnableTwitterSharePosts, value.ToString()); }
-        }
-
-
-
-        public long LastDatabaseChange
-        {
-            get { return long.Parse(database.Settings.Find((int)SettingNames.LastDatabaseChange).Value); }
-            set { SaveSettings(SettingNames.LastDatabaseChange, value.ToString()); }
-        }
-
-        private void SaveSettings(SettingNames settings, string value)
-        {
-            database.Settings.Find((int) settings).Value = value;
+            get { return bool.Parse(LoadSetting(SettingNames.EnableTwitterSharePosts)); }
+            set { SaveSetting(SettingNames.EnableTwitterSharePosts, value.ToString()); }
+        }
+
+
+
+        //public long LastDatabaseChange
+        //{
+        //    get { return long.Parse(LoadSetting(SettingNames.LastDatabaseChange)); }
+        //    set { SaveSetting(SettingNames.LastDatabaseChange, value.ToString()); }
+        //}
+
+        private string LoadSetting(SettingNames setting)
+        {
+            return settings[(int) setting];
+        }
+
+        private void SaveSetting(SettingNames setting, string value)
+        {
+            database.Settings.Find((int) setting).Value = value;
             database.SaveChanges();
         }


Fixed a null reference issue.

Fixed a null reference issue.

--- src/Georadix.WebApi/Filters/CustomAuthorizeAttribute.cs
+++ src/Georadix.WebApi/Filters/CustomAuthorizeAttribute.cs
@@ -29,7 +29,7 @@

             var principal = actionContext.RequestContext.Principal;

-            if (!principal.Identity.IsAuthenticated)
+            if (principal == null || !principal.Identity.IsAuthenticated)
             {
                 base.HandleUnauthorizedRequest(actionContext);
             }


Add configuration to IOC

Add configuration to IOC


User LoggerPhaseScope for better info in log (#1368)

--- src/Microsoft.DocAsCode.Build.Engine/DocumentBuilder.cs
+++ src/Microsoft.DocAsCode.Build.Engine/DocumentBuilder.cs
@@ -150,7 +150,7 @@
                 manifests.Add(BuildCore(parameter, markdownServiceProvider));
             }

-            using (new PerformanceScope("Postprocess"))
+            using (new LoggerPhaseScope("Postprocess", LogLevel.Verbose))
             {
                 var generatedManifest = ManifestUtility.MergeManifest(manifests);
                 ManifestUtility.RemoveDuplicateOutputFiles(generatedManifest.Files);


Added better opcode handling failure logging


Added: Press Any Key Style logic to loading the game content

--- src/MysticChronicles.Engine/GameStates/LoadGameState.cs
+++ src/MysticChronicles.Engine/GameStates/LoadGameState.cs
@@ -1,4 +1,6 @@
-using Microsoft.Xna.Framework.Input;
+using System.Linq;
+
+using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Input.Touch;

 using MysticChronicles.Engine.Managers;
@@ -14,7 +16,12 @@

         public override void HandleInput(GamePadState gamePadState, KeyboardState keyboardState, TouchCollection touchCollection)
         {
-
+            if (!keyboardState.GetPressedKeys().Any() && touchCollection.All(a => a.State != TouchLocationState.Pressed))
+            {
+                return;
+            }
+
+            RequestStateChange(new InBattleState(GsContainer));
         }

         public override async void LoadContent()


Fixed Base Class Constructor Calls

Fixed Base Class Constructor Calls

Constructor calls were all going to the base constructor.

--- src/NLog/LogReceiverService/WcfLogReceiverClientBase.cs
+++ src/NLog/LogReceiverService/WcfLogReceiverClientBase.cs
@@ -54,6 +54,7 @@
         /// Initializes a new instance of the <see cref="WcfLogReceiverClientBase{TService}"/> class.
         /// </summary>
         internal WcfLogReceiverClientBase()
+            : base()
         {
         }

@@ -62,6 +63,7 @@
         /// </summary>
         /// <param name="endpointConfigurationName">Name of the endpoint configuration.</param>
         internal WcfLogReceiverClientBase(string endpointConfigurationName)
+            : base(endpointConfigurationName)
         {
         }

@@ -71,6 +73,7 @@
         /// <param name="endpointConfigurationName">Name of the endpoint configuration.</param>
         /// <param name="remoteAddress">The remote address.</param>
         internal WcfLogReceiverClientBase(string endpointConfigurationName, string remoteAddress)
+            : base(endpointConfigurationName, remoteAddress)
         {
         }

@@ -80,6 +83,7 @@
         /// <param name="endpointConfigurationName">Name of the endpoint configuration.</param>
         /// <param name="remoteAddress">The remote address.</param>
         internal WcfLogReceiverClientBase(string endpointConfigurationName, EndpointAddress remoteAddress)
+            : base(endpointConfigurationName, remoteAddress)
         {
         }

@@ -89,6 +93,7 @@
         /// <param name="binding">The binding.</param>
         /// <param name="remoteAddress">The remote address.</param>
         internal WcfLogReceiverClientBase(Binding binding, EndpointAddress remoteAddress)
+            : base(binding, remoteAddress)
         {
         }


Changed exception name

Changed exception name


xkcd latest fixed

xkcd latest fixed

--- src/NadekoBot/Modules/Searches/Commands/XkcdCommands.cs
+++ src/NadekoBot/Modules/Searches/Commands/XkcdCommands.cs
@@ -26,12 +26,17 @@
                     {
                         var res = await http.GetStringAsync($"{_xkcdUrl}/info.0.json").ConfigureAwait(false);
                         var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
-                        var sent = await Context.Channel.SendMessageAsync($"{Context.User.Mention} " + comic)
+                        var embed = new EmbedBuilder().WithColor(NadekoBot.OkColor)
+                                                  .WithImageUrl(comic.ImageLink)
+                                                  .WithAuthor(eab => eab.WithName(comic.Title).WithUrl($"{_xkcdUrl}/{comic.Num}").WithIconUrl("http://xkcd.com/s/919f27.ico"))
+                                                  .AddField(efb => efb.WithName(GetText("comic_number")).WithValue(comic.Num.ToString()).WithIsInline(true))
+                                                  .AddField(efb => efb.WithName(GetText("date")).WithValue($"{comic.Month}/{comic.Year}").WithIsInline(true));
+                        var sent = await Context.Channel.EmbedAsync(embed)
                                      .ConfigureAwait(false);

                         await Task.Delay(10000).ConfigureAwait(false);

-                        await sent.ModifyAsync(m => m.Content = sent.Content + $"\n`Alt:` {comic.Alt}");
+                        await sent.ModifyAsync(m => m.Embed = embed.AddField(efb => efb.WithName("Alt").WithValue(comic.Alt.ToString()).WithIsInline(false)).Build());
                     }
                     return;
                 }


Added test for "base URL segments case-sensitive comparison" bug-fix.

--- src/Nancy.Hosting.Self.Tests/MakeAppLocalPathFixture.cs
+++ src/Nancy.Hosting.Self.Tests/MakeAppLocalPathFixture.cs
@@ -83,5 +83,18 @@
             // Then
             result.ShouldEqual("/");
 		}
+
+        [Fact]
+        public void Should_return_path_with_case_insensitive_base_uri_comparison()
+        {
+            // Given
+            var uri = new Uri("http://host/base/");
+
+            // When
+            var result = uri.MakeAppLocalPath(new Uri("http://host/Base/rel"));
+
+            // Then
+            result.ShouldEqual("/rel");
+        }
 	}
 }


SemanticVersionExtensions: Move usings inside the namespace to make it consistent with the rest of the code base

--- src/NerdBank.GitVersioning/SemanticVersionExtensions.cs
+++ src/NerdBank.GitVersioning/SemanticVersionExtensions.cs
@@ -1,7 +1,7 @@
-using System;
+namespace Nerdbank.GitVersioning
+{
+    using System;

-namespace Nerdbank.GitVersioning
-{
     /// <summary>
     /// Extension methods for <see cref="SemanticVersion"/>
     /// </summary>


Add TouchingWall condition to BodyCollider.

--- Actor/BodyCollider.cs
+++ Actor/BodyCollider.cs
@@ -39,6 +39,11 @@
 		{
 		    Messenger.Broadcast<string, Collider2D>("player dead", "Drowned", coll);
 		}
+
+		if (coll.tag == "Wall" && !alreadyCollided)
+		{
+		    Debug.Log("Hit Wall!!");
+		}
 	}

 	void GetColliderComponents(Collider2D coll)


Improve code documentation in the OpenchainController class

--- src/Openchain.Server/Controllers/OpenchainController.cs
+++ src/Openchain.Server/Controllers/OpenchainController.cs
@@ -175,6 +175,10 @@
             });
         }

+        /// <summary>
+        /// Gets information about the Openchain instance.
+        /// </summary>
+        /// <returns>The task object representing the asynchronous operation.</returns>
         [HttpGet("info")]
         public ActionResult GetChainInfo()
         {


Removing unused code

Removing unused code

--- Src/BlockchainSharp/Core/BlockChain.cs
+++ Src/BlockchainSharp/Core/BlockChain.cs
@@ -28,12 +28,6 @@

         public bool TryToAdd(Block block)
         {
-            if (this.blockinfos.Count == 0)
-            {
-                this.blockinfos.Add(new BlockInfo(block, null));
-                return true;
-            }
-
             if (!block.HasParent(this.blockinfos.Last().Block))
                 return false;


Fixed 'region' syntax error

Fixed 'region' syntax error

--- web/App_Code/LcMessaging.cs
+++ web/App_Code/LcMessaging.cs
@@ -1234,6 +1234,7 @@
         }
     }
     #endregion
+    #endregion

     #region Send Mail wrapper function
     private static bool LogSuccessSendMail


Debugging is a bit nicer now

Debugging is a bit nicer now

--- HoloXPLOR/Views/HoloTable/Ship.cshtml
+++ HoloXPLOR/Views/HoloTable/Ship.cshtml
@@ -354,32 +354,49 @@
                     $port = temp;
                 }

-                var itemSize = Number.parseInt($item.data('item-size'));
-                var minSize = Number.parseInt($port.data('port-min-size'));
-                var maxSize = Number.parseInt($port.data('port-max-size'));
-
-                if (itemSize < minSize || itemSize > maxSize)
-                    return debug;
-
-                var requiredPortTags = ($item.data('item-required-port-tags') || '').split(' ');
-                var portTags = ($port.data('port-tags') || '').split(' ');
-                var shipPortTags = ($port.data('ship-port-tags') || '').split(' ');
-
-                if ($(requiredPortTags).not(portTags).not(shipPortTags).length > 0)
-                    return debug;
-
-                var type = $item.data('item-type');
-                var subType = $item.data('item-sub-type');
-                subType = (subType == "") ? type : (type + ":" + subType);
-
-                var accepted = ($port.data('port-types') || '').split(',');
-
-                for (var i = 0, j = accepted.length; i < j; i++) {
-                    if (accepted[i] == type || accepted[i] == subType)
-                        return true;
-                }
-
-                return debug;
+                if (!debug)
+                { /* Check item sizes */
+                    var itemSize = Number.parseInt($item.data('item-size'));
+                    var minSize = Number.parseInt($port.data('port-min-size'));
+                    var maxSize = Number.parseInt($port.data('port-max-size'));
+
+                    if (itemSize < minSize || itemSize > maxSize)
+                        return false;
+                }
+
+                if (!debug)
+                { /* Normally, ship-specific tags */
+                    var requiredPortTags = ($item.data('item-required-port-tags') || '').split(' ');
+                    var portTags = ($port.data('port-tags') || '').split(' ');
+                    var shipPortTags = ($port.data('ship-port-tags') || '').split(' ');
+
+                    if ($(requiredPortTags).not(portTags).not(shipPortTags).not(['']).length > 0)
+                        return false;
+                }
+
+                if (!debug)
+                { /* Normally, equipment-specific tags */
+                    var requiredItemTags = ($port.data('port-required-tags') || '').split(' ');
+                    var itemTags = ($item.data('item-tags') || '').split(' ');
+
+                    if ($(requiredItemTags).not(itemTags).not(['']).length > 0)
+                        return false;
+                }
+
+                { /* Item types */
+                    var type = $item.data('item-type');
+                    var subType = $item.data('item-sub-type');
+                    subType = (subType == "") ? type : (type + ":" + subType);
+
+                    var accepted = ($port.data('port-types') || '').split(',');
+
+                    for (var i = 0, j = accepted.length; i < j; i++) {
+                        if (accepted[i] == type || accepted[i] == subType)
+                            return true;
+                    }
+                }
+
+                return false;
             }

             var bindAll = function (parent) {