Added RecurringComponents enumerator for iCalendar Added generic Evaluate<T> method that evalulates only components of the given type Changed Create() method to internal Added commented versions of FlattenRecurrences and GetRecurrenceForRange methods for testing and evaluation purposes.

--- DDay.iCal/iCalendar.cs
+++ DDay.iCal/iCalendar.cs
@@ -243,6 +243,18 @@
             set { m_UniqueComponents = value; }
         }

+        public IEnumerable<RecurringComponent> RecurringComponents
+        {
+            get
+            {
+                foreach (UniqueComponent uc in UniqueComponents)
+                {
+                    if (uc is RecurringComponent)
+                        yield return (RecurringComponent)uc;
+                }
+            }
+        }
+
         /// <summary>
         /// A collection of <see cref="Event"/> components in the iCalendar.
         /// </summary>
@@ -510,10 +522,22 @@
         /// <param name="ToDate">The end date/time of the range to test.</param>
         public void Evaluate(Date_Time FromDate, Date_Time ToDate)
         {
-            foreach (UniqueComponent uc in UniqueComponents)
-            {
-                if (uc is RecurringComponent)
-                    ((RecurringComponent)uc).Evaluate(FromDate, ToDate);
+            Evaluate<object>(FromDate, ToDate);
+        }
+
+        /// <summary>
+        /// Evaluates component recurrences for the given range of time, for
+        /// the type of recurring component specified.
+        /// </summary>
+        /// <typeparam name="T">The type of component to be evaluated for recurrences.</typeparam>
+        /// <param name="FromDate">The beginning date/time of the range to test.</param>
+        /// <param name="ToDate">The end date/time of the range to test.</param>
+        public void Evaluate<T>(Date_Time FromDate, Date_Time ToDate)
+        {
+            foreach (RecurringComponent rc in RecurringComponents)
+            {
+                if (rc is T)
+                    rc.Evaluate(FromDate, ToDate);
             }
         }

@@ -522,33 +546,9 @@
         /// </summary>
         public void ClearEvaluation()
         {
-            foreach (UniqueComponent uc in UniqueComponents)
-            {
-                if (uc is RecurringComponent)
-                    ((RecurringComponent)uc).ClearEvaluation();
-            }
-        }
-
-        //public ArrayList GetTodos(string category)
-        //{
-        //    ArrayList t = new ArrayList();
-        //    foreach (Todo todo in Todos)
-        //    {
-        //        if (todo.Categories != null)
-        //        {
-        //            foreach (TextCollection cat in todo.Categories)
-        //            {
-        //                foreach (Text text in cat.Values)
-        //                {
-        //                    if (text.Value == category)
-        //                        t.Add(todo);
-        //                }
-        //            }
-        //        }
-        //    }
-
-        //    return t;
-        //}
+            foreach (RecurringComponent rc in RecurringComponents)
+                rc.ClearEvaluation();
+        }

         /// <summary>
         /// Merges the current <see cref="iCalendar"/> with another iCalendar.
@@ -563,8 +563,11 @@
         {
             if (iCal != null)
             {
+                // Merge all unique components
                 foreach (UniqueComponent uc in iCal.UniqueComponents)
                     this.AddChild(uc);
+
+                // Dispose of the calendar, since we just siphoned the components from it.
                 iCal.Dispose();
             }
         }
@@ -573,11 +576,14 @@
         /// Invokes the object creation of the selected ComponentBase class.  By default,
         /// this is the ComponentBase class itself; however, this can be changed to allow
         /// for custom objects to be created in lieu of Event, Todo, Journal, etc. components.
+        /// <note>
+        /// This method is used internally by the parsing engine to create iCalendar objects.
+        /// </note>
         /// </summary>
         /// <param name="parent">The parent of the object to create.</param>
         /// <param name="name">The name of the iCal object.</param>
-        /// <returns></returns>
-        public ComponentBase Create(iCalObject parent, string name)
+        /// <returns>A newly created object</returns>
+        internal ComponentBase Create(iCalObject parent, string name)
         {
             if (m_ComponentBaseCreate == null)
                 throw new ArgumentException("Create() cannot be called without a valid ComponentBase Create() method attached");
@@ -620,6 +626,68 @@
             else return default(T);
         }

+        ///// <summary>
+        ///// Returns a list of flattened recurrences for all recurring components
+        ///// in the iCalendar.
+        ///// </summary>
+        ///// <returns>A list of flattened recurrences for all recurring components</returns>
+        //public IEnumerable<RecurringComponent> FlattenRecurrences()
+        //{
+        //    foreach (RecurringComponent rc in RecurringComponents)
+        //        foreach (RecurringComponent instance in rc.FlattenRecurrences())
+        //            yield return instance;
+        //}
+
+        ///// <summary>
+        ///// Returns a list of flattened recurrences of type T.
+        ///// </summary>
+        ///// <typeparam name="T">The type for which to return flattened recurrences</typeparam>
+        ///// <returns>A list of flattened recurrences of type T</returns>
+        //public IEnumerable<T> FlattenRecurrences<T>()
+        //{
+        //    foreach (RecurringComponent rc in FlattenRecurrences())
+        //    {
+        //        if (rc is T)
+        //        {
+        //            object obj = rc;
+        //            yield return (T)obj;
+        //        }
+        //    }
+        //}
+
+        ///// <summary>
+        ///// Returns a list of flattened recurrence instances for the given date range.
+        ///// </summary>
+        ///// <param name="startDate">The starting date of the date range</param>
+        ///// <param name="endDate">The ending date of the date range</param>
+        ///// <returns>A list of flattened recurrences for the date range</returns>
+        //public IEnumerable<RecurringComponent> GetRecurrencesForRange(Date_Time startDate, Date_Time endDate)
+        //{
+        //    foreach (RecurringComponent rc in GetRecurrencesForRange<RecurringComponent>(startDate, endDate))
+        //        yield return rc;
+        //}
+
+        ///// <summary>
+        ///// Returns a list of flattened recurrence instances of type T for the given date range.
+        ///// </summary>
+        ///// <param name="startDate">The starting date of the date range</param>
+        ///// <param name="endDate">The ending date of the date range</param>
+        ///// <returns>A list of flattened recurrences of type T for the date range</returns>
+        //public IEnumerable<T> GetRecurrencesForRange<T>(Date_Time startDate, Date_Time endDate)
+        //{
+        //    Evaluate<T>(startDate, endDate);
+
+        //    foreach (T t in FlattenRecurrences<T>())
+        //    {
+        //        if (t is RecurringComponent)
+        //        {
+        //            RecurringComponent rc = (RecurringComponent)(object)t;
+        //            if (rc.Start >= startDate && rc.Start <= endDate)
+        //                yield return t;
+        //        }
+        //    }
+        //}
+
         #endregion

         #region IDisposable Members
@@ -631,6 +699,10 @@
             FreeBusy.Clear();
             Journals.Clear();
             Todos.Clear();
+            // FIXME: disposing of time zones currently causes problems when merging calendars.
+            // There are probably problems anyway when serializing, but for now...
+            //TimeZones.Clear();
+            //UniqueComponents.Clear();
         }

         #endregion


ToString returns QueryString

ToString returns QueryString

--- Cassandra/Statement.cs
+++ Cassandra/Statement.cs
@@ -23,12 +23,16 @@
     /// </summary>
     public abstract class Statement : Query
     {
-
         /// <summary>
         ///  Gets the query string for this statement.
         /// </summary>
         public abstract string QueryString { get; }

         protected Statement(QueryProtocolOptions queryProtocolOptions) : base(queryProtocolOptions) { }
+
+        public override string ToString()
+        {
+            return QueryString;
+        }
     }
 }


Add ability to write to PPU registers.

Add ability to write to PPU registers.

--- DaNES.Emulation/Ppu.cs
+++ DaNES.Emulation/Ppu.cs
@@ -1,4 +1,5 @@
-using System.Drawing;
+using System;
+using System.Drawing;

 namespace DanTup.DaNES.Emulation
 {
@@ -32,18 +33,19 @@
 		bool Sprite0Hit;
 		bool SpriteOverflow;

-		byte OamAddress { get; }
-		byte OamData { get; }
-		byte PpuScroll { get; }
-		byte PpuAddr { get; }
-		byte PpuData { get; }
-		byte OamDma { get; }
+		byte OamAddress;
+		byte OamData;
+		byte PpuScroll;
+		byte PpuAddr;
+		byte PpuData;
+		byte OamDma;

 		public Ppu(Memory ram, Bitmap screen)
 		{
 			Ram = ram;
 			Screen = screen;

+			// Initialise with a nice rainbow screen.
 			for (var x = 0; x < 256; x++)
 			{
 				for (var y = 0; y < 240; y++)
@@ -56,5 +58,59 @@
 		public void Step()
 		{
 		}
+
+		public void WriteRegister(ushort address, byte value)
+		{
+			// CPU addresses registers as 8 bytes from 0x2000.
+			// https://en.wikibooks.org/wiki/NES_Programming/Memory_Map
+			switch (address)
+			{
+				case 0x2000:
+					NmiEnable = (value & 0x80) != 0;
+					PpuMasterSlave = (value & 0x40) != 0;
+					SpriteHeight = (value & 0x20) != 0;
+					BackgroundTileSelect = (value & 0x10) != 0;
+					SpriteTileSelect = (value & 0x8) != 0;
+					IncrementMode = (value & 0x4) != 0;
+					NameTableSelect1 = (value & 0x2) != 0;
+					NameTableSelect0 = (value & 0x1) != 0;
+					break;
+				case 0x2001:
+					TintBlue = (value & 0x80) != 0;
+					TintGreen = (value & 0x40) != 0;
+					TintRed = (value & 0x20) != 0;
+					ShowSprites = (value & 0x10) != 0;
+					ShowBackground = (value & 0x8) != 0;
+					ShowLeftSprites = (value & 0x4) != 0;
+					ShowLeftBackground = (value & 0x2) != 0;
+					Greyscale = (value & 0x1) != 0;
+					break;
+				case 0x2002:
+					VBlank = (value & 0x80) != 0;
+					Sprite0Hit = (value & 0x40) != 0;
+					SpriteOverflow = (value & 0x20) != 0;
+					break;
+				case 0x2003:
+					OamAddress = value;
+					break;
+				case 0x2004:
+					OamData = value;
+					break;
+				case 0x2005:
+					PpuScroll = value;
+					break;
+				case 0x2006:
+					PpuAddr = value;
+					break;
+				case 0x2007:
+					PpuData = value;
+					break;
+				case 0x4014:
+					OamDma = value;
+					break;
+				default:
+					throw new InvalidOperationException(string.Format("Invalid attempt to write to PPU address {0:X2}", address));
+			}
+		}
 	}
 }


Replaced ProcessLauncher.WaitForExit() with .HandleExitCode()

--- src/Common/Native/ProcessLauncher.cs
+++ src/Common/Native/ProcessLauncher.cs
@@ -39,7 +39,10 @@

     /// <inheritdoc/>
     public void Run(params string[] arguments)
-        => WaitForExit(Start(arguments));
+    {
+        var process = Start(arguments);
+        HandleExitCode(process.StartInfo, process.WaitForExitCode());
+    }

     /// <inheritdoc/>
     public string RunAndCapture(Action<StreamWriter>? onStartup, params string[] arguments)
@@ -55,11 +58,16 @@
         var stdout = new StreamConsumer(process.StandardOutput);
         var stderr = new StreamConsumer(process.StandardError);

+        string? lastError = null;
+
         void ReadStderr()
         {
             string? line;
             while ((line = stderr.ReadLine()) != null)
+            {
+                lastError = line;
                 OnStderr(line, stdin);
+            }
         }

         onStartup?.Invoke(stdin);
@@ -68,7 +76,7 @@
         stderr.WaitForEnd();
         ReadStderr();

-        WaitForExit(process);
+        HandleExitCode(process.StartInfo, process.WaitForExitCode(), lastError);

         return stdout.ToString();
     }
@@ -92,10 +100,21 @@
     }

     /// <summary>
-    /// Hook for waiting for a process to exit and handle its exit code.
+    /// Hook for handling exit codes.
     /// </summary>
-    protected virtual void WaitForExit(Process process)
-        => process.WaitForSuccess();
+    /// <param name="startInfo">The start info used to launch the process that has now exited.</param>
+    /// <param name="exitCode">The <see cref="Process.ExitCode"/>.</param>
+    /// <param name="message">An optional error message.</param>
+    /// <exception cref="ExitCodeException"><paramref name="exitCode"/> had a non-zero value.</exception>
+    protected virtual void HandleExitCode(ProcessStartInfo startInfo, int exitCode, string? message = null)
+    {
+        if (exitCode == 0) return;
+
+        if (string.IsNullOrEmpty(message))
+            throw new ExitCodeException(startInfo, exitCode);
+        else
+            throw new ExitCodeException(message, exitCode);
+    }

     /// <summary>
     /// Hook for handling stderr messages from the process.


add title to find / replace dialog

add title to find / replace dialog

--- Ior/Forms/MainForm.cs
+++ Ior/Forms/MainForm.cs
@@ -536,7 +536,11 @@

             txtRequestBody.NativeInterface.SetUseTabs(false); //use spaces for tabs
             txtRequestBody.NativeInterface.SetTabWidth(4);
-
+
+            txtRequestBody.FindReplace.Window.FormBorderStyle = FormBorderStyle.FixedDialog; //so we can actually see the text title
+            txtRequestBody.FindReplace.Window.Text = "Find / Replace - Request Body";
+
+
             //note: style 32 is default style

             /*ns.StyleSetFore(1, ScintillaNET.Utilities.ColorToRgb(Color.Black));


fix Compare Guids

fix Compare Guids

--- Signum.Engine/Linq/ExpressionVisitor/SmartEqualizer.cs
+++ Signum.Engine/Linq/ExpressionVisitor/SmartEqualizer.cs
@@ -9,6 +9,7 @@
 using Signum.Engine.Maps;
 using Signum.Utilities.ExpressionTrees;
 using Signum.Entities.Reflection;
+using System.Reflection;

 namespace Signum.Engine.Linq
 {
@@ -126,11 +127,58 @@
                 var left = UnwrapPrimaryKey(b.Left);
                 var right = UnwrapPrimaryKey(b.Right);

-                return Expression.MakeBinary(b.NodeType, left.Nullify(), right.Nullify());
+
+                if (left.Type.UnNullify() == typeof(Guid))
+                {
+                    return Expression.MakeBinary(b.NodeType, left.Nullify(), right.Nullify(), true, GuidComparer.GetMethod(b.NodeType));
+                }
+                else
+                {
+                    return Expression.MakeBinary(b.NodeType, left.Nullify(), right.Nullify());
+                }
             }

             return b;
         }
+
+        static class GuidComparer
+        {
+            static bool GreaterThan(Guid a, Guid b)
+            {
+                return a.CompareTo(b) > 0;
+            }
+
+            static bool GreaterThanOrEqual(Guid a, Guid b)
+            {
+                return a.CompareTo(b) >= 0;
+            }
+
+            static bool LessThan(Guid a, Guid b)
+            {
+                return a.CompareTo(b) < 0;
+            }
+
+            static bool LessThanOrEqual(Guid a, Guid b)
+            {
+                return a.CompareTo(b) <= 0;
+            }
+
+            public static MethodInfo GetMethod(ExpressionType type)
+            {
+                switch (type)
+                {
+                    case ExpressionType.GreaterThan: return ReflectionTools.GetMethodInfo(() => GreaterThan(Guid.Empty, Guid.Empty));
+                    case ExpressionType.GreaterThanOrEqual: return ReflectionTools.GetMethodInfo(() => GreaterThanOrEqual(Guid.Empty, Guid.Empty));
+                    case ExpressionType.LessThan: return ReflectionTools.GetMethodInfo(() => LessThan(Guid.Empty, Guid.Empty));
+                    case ExpressionType.LessThanOrEqual: return ReflectionTools.GetMethodInfo(() => LessThanOrEqual(Guid.Empty, Guid.Empty));
+                    case ExpressionType.Equal: return null;
+                    case ExpressionType.NotEqual: return null;
+                    default: throw new InvalidOperationException("GuidComparer.GetMethod unexpected ExpressionType " + type);
+                }
+            }
+        }
+
+

         public static Expression UnwrapPrimaryKey(Expression unary)
         {


Fix broken test

Fix broken test

--- SkyEditor.Core/IO/OpenableFromGenericFileFileOpener.cs
+++ SkyEditor.Core/IO/OpenableFromGenericFileFileOpener.cs
@@ -48,7 +48,7 @@

         public bool SupportsType(TypeInfo fileType)
         {
-            return ReflectionHelpers.IsOfType(fileType, typeof(IOpenableFile).GetTypeInfo());
+            return ReflectionHelpers.IsOfType(fileType, typeof(IOpenableFromGenericFile).GetTypeInfo());
         }

         public int GetUsagePriority(TypeInfo fileType)


added ShouldGetSolutionFolder

added ShouldGetSolutionFolder

--- SonghayCore.MSTest/Extensions/TestContextExtensions.cs
+++ SonghayCore.MSTest/Extensions/TestContextExtensions.cs
@@ -150,6 +150,19 @@
         /// <param name="namespaceArrayModifier">The namespace array modifier.</param>
         /// <returns></returns>
         /// <exception cref="System.ArgumentException">The expected number of Namespace parts is not here.</exception>
+        /// <remarks>
+        /// A Projects Folder for this method is not the default Solution (*.sln) in its own folder.
+        /// This is the unconventional layout:
+        ///
+        /// SourceFolder\
+        ///     .vs\
+        ///     Foo.Solution1.sln
+        ///     Foo.Solution2.sln
+        ///     Foo.Solution.Project1\
+        ///     Foo.Solution.Project2\
+        ///     Foo.Solution.Project3\
+        ///
+        /// </remarks>
         public static string ShouldGetProjectsFolder(this TestContext context, Type typeInAssembly, Func<string[], string[]> namespaceArrayModifier)
         {
             var path = context.ShouldGetAssemblyDirectory(typeInAssembly);
@@ -168,6 +181,46 @@
         }

         ///
+        /// Test context extensions: should get projects folder.
+        ///
+        /// <param name="context">The context.</param>
+        /// <param name="typeInAssembly">The type in assembly.</param>
+        public static string ShouldGetSolutionFolder(this TestContext context, Type typeInAssembly)
+        {
+            return context.ShouldGetSolutionFolder(typeInAssembly, namespaceArrayModifier: null);
+        }
+
+        ///
+        /// Test context extensions: should get projects folder.
+        ///
+        /// <param name="context">The context.</param>
+        /// <param name="typeInAssembly">The type in assembly.</param>
+        /// <param name="namespaceArrayModifier">The namespace array modifier.</param>
+        /// <returns></returns>
+        /// <remarks>
+        /// This method is designed for the conventional Solution file in a folder with its projects:
+        /// This is the conventional layout:
+        ///
+        /// SourceFolder\
+        ///     Foo.Solution1\
+        ///         .vs\
+        ///         Foo.Solution1.sln
+        ///         Foo.Solution.Project1\
+        ///         Foo.Solution.Project2\
+        ///         Foo.Solution.Project3\
+        ///
+        /// </remarks>
+        public static string ShouldGetSolutionFolder(this TestContext context, Type typeInAssembly, Func<string[], string[]> namespaceArrayModifier)
+        {
+            var path = context.ShouldGetProjectsFolder(typeInAssembly, namespaceArrayModifier);
+            path = Path.Combine(path, string.Join(".", typeInAssembly.Namespace.Split('.').Take(2)), typeInAssembly.Namespace);
+            context.ShouldFindFolder(path);
+
+            return path;
+        }
+
+
+        ///
         /// Test context extensions: should load list of strings.
         ///
         /// <param name="context">The context.</param>


Add correct interval nodes

Add correct interval nodes

--- Source/ContractsWindow.Unity/Unity/CW_IntervalTypes.cs
+++ Source/ContractsWindow.Unity/Unity/CW_IntervalTypes.cs
@@ -51,7 +51,7 @@
 				if (node == null)
 					continue;

-				node.gameObject.SetActive(isOn && intervalInterface.NodeInterval - 1 >= i);
+				node.gameObject.SetActive(isOn && intervalInterface.NodeInterval >= i - 1);
 			}
 		}

@@ -60,7 +60,7 @@
 			if (node == null)
 				return;

-			for (int i = 0; i < node.Intervals; i++)
+			for (int i = 1; i <= node.Intervals; i++)
 			{
 				CreateIntervalNode(node, i);
 			}
@@ -89,13 +89,5 @@

 			nodeObject.gameObject.SetActive(false);
 		}
-
-		//public void AddIntervalNode(IIntervalNode node)
-		//{
-		//	if (node == null)
-		//		return;
-
-		//	CreateIntervalNode(node);
-		//}
 	}
 }


I just modified the SvnClient.ToolName property so that it determines the tool path the following way:

1. Consults the registry for the install location. If error then...
2. Sees if it is at "C:\\Program Files\\Subversion\\bin\\svn.exe", if not then...
3. just returns "svn.exe" (This is what it did before).

git-svn-id: dcafdc6390f06cd4b2e634dc7bbf20f0ade3e1f6@155 299a232d-b705-0410-b782-f21f2f1e606a

--- Source/MSBuild.Community.Tasks/Subversion/SvnClient.cs
+++ Source/MSBuild.Community.Tasks/Subversion/SvnClient.cs
@@ -34,6 +34,7 @@
 using System.Text.RegularExpressions;
 using Microsoft.Build.Utilities;
 using Microsoft.Build.Framework;
+using Microsoft.Win32;

 // $Id$

@@ -387,7 +388,30 @@
 		/// <returns>The name of the executable file to run.</returns>
 		protected override string ToolName
 		{
-			get { return "svn.exe"; }
+            get
+            {
+                RegistryKey hklm = Registry.CurrentUser;
+                RegistryKey key = hklm.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\svn.exe", false);
+                if (key != null)
+                {
+                    object obj = key.GetValue(null);	// Default value
+                    return (string)obj;
+                }
+                else
+                {
+                    // Not in the registry
+                    const string defaultPath = "C:\\Program Files\\Subversion\\bin\\svn.exe";
+                    if (File.Exists(defaultPath))
+                    {
+                        return defaultPath;
+                    }
+                    else
+                    {
+                        // Let's hope it's in the path
+                        return "svn.exe";
+                    }
+                }
+            }
 		}

 		#endregion Task Overrides


- add MessageFile patch

- add MessageFile patch

git-svn-id: dcafdc6390f06cd4b2e634dc7bbf20f0ade3e1f6@422 299a232d-b705-0410-b782-f21f2f1e606a

--- Source/MSBuild.Community.Tasks/Subversion/SvnClient.cs
+++ Source/MSBuild.Community.Tasks/Subversion/SvnClient.cs
@@ -152,6 +152,22 @@
             set { _message = value; }
         }

+        private string _messageFile;
+
+        /// <summary>
+        /// Gets or sets the message file.
+        /// </summary>
+        /// <value>The message file.</value>
+        /// <remarks>
+        /// Uses the contents of the named file for the specified
+        /// subcommand, though different subcommands do different
+        /// things with this content.</remarks>
+        public string MessageFile
+        {
+            get { return _messageFile; }
+            set { _messageFile = value; }
+        }
+
         private string _repositoryPath;

         /// <summary>
@@ -271,6 +287,9 @@
             if (!string.IsNullOrEmpty(_password))
                 builder.AppendFormat(_switchValueFormat, "password", _password);

+            if (!string.IsNullOrEmpty(_messageFile) && File.Exists(_messageFile))
+                builder.AppendFormat(_switchStringFormat, "file", _messageFile);
+
             if (!string.IsNullOrEmpty(_message))
                 builder.AppendFormat(_switchStringFormat, "message", _message);


Removed useless output when VS 2017 is not installed.

Signed-off-by: Dimitar Dobrev <ca751a5c976abad79158718440750fc638d19ebc@protonmail.com>

--- src/Core/Toolchains/MSVCToolchain.cs
+++ src/Core/Toolchains/MSVCToolchain.cs
@@ -683,9 +683,9 @@
                 }
                 while (fetched > 0);
             }
+            // a COM exception means the VS 2017 COM API (therefore VS itself) is not installed, ignore
             catch (COMException ex) when (ex.HResult == REGDB_E_CLASSNOTREG)
             {
-                Console.WriteLine("The query API is not registered. Assuming no instances are installed.");
             }
             catch (Exception ex)
             {
@@ -726,9 +726,9 @@
                 }
                 while (fetched > 0);
             }
+            // a COM exception means the VS 2017 COM API (therefore VS itself) is not installed, ignore
             catch (COMException ex) when (ex.HResult == REGDB_E_CLASSNOTREG)
             {
-                Console.WriteLine("The query API is not registered. Assuming no instances are installed.");
                 return false;
             }
             catch (Exception ex)


Formatting and ReSharper hints

Formatting and ReSharper hints

--- FileHelpers.Tests/Tests/Common/DynamicClassExtra.cs
+++ FileHelpers.Tests/Tests/Common/DynamicClassExtra.cs
@@ -9,43 +9,45 @@
     [TestFixture]
     public class DynamicClassesExtra
     {
-        [Test]
-		[Category("Dynamic")]
-		public void ReadAsDataTable1()
+        [Test]
+        [Category("Dynamic")]
+        public void ReadAsDataTable1()
         {
-            var cb = new DelimitedClassBuilder("ImportContact", ",");
-            cb.IgnoreEmptyLines = true;
-            cb.GenerateProperties = true;
+            var cb = new DelimitedClassBuilder("ImportContact", ",")
+            {
+                IgnoreEmptyLines = true,
+                GenerateProperties = true
+            };

-            cb.AddField("FirstName", typeof (string));
+            cb.AddField("FirstName", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("LastName", typeof (string));
+            cb.AddField("LastName", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("StreetNumber", typeof (string));
+            cb.AddField("StreetNumber", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("StreetAddress", typeof (string));
+            cb.AddField("StreetAddress", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("Unit", typeof (string));
+            cb.AddField("Unit", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("City", typeof (string));
+            cb.AddField("City", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("State", typeof (string));
+            cb.AddField("State", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("Zip", typeof (string));
+            cb.AddField("Zip", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

@@ -62,48 +64,47 @@

             Assert.AreEqual("Alex & Jen", contactData.Rows[0][0].ToString());
             Assert.AreEqual("Mark & Lisa K", contactData.Rows[1][0].ToString());
-
-            // new DelimitedClassBuilder("", ",");
         }

+        [Test]
+        [Category("Dynamic")]
+        public void ReadAsDataTable2()
+        {
+            var cb = new DelimitedClassBuilder("ImportContact", ",")
+            {
+                IgnoreEmptyLines = true,
+                GenerateProperties = true
+            };

-        [Test]
-		[Category("Dynamic")]
-		public void ReadAsDataTable2()
-        {
-            var cb = new DelimitedClassBuilder("ImportContact", ",");
-            cb.IgnoreEmptyLines = true;
-            cb.GenerateProperties = true;
-
-            cb.AddField("FirstName", typeof (string));
+            cb.AddField("FirstName", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("LastName", typeof (string));
+            cb.AddField("LastName", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("StreetNumber", typeof (string));
+            cb.AddField("StreetNumber", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("StreetAddress", typeof (string));
+            cb.AddField("StreetAddress", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("Unit", typeof (string));
+            cb.AddField("Unit", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("City", typeof (string));
+            cb.AddField("City", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("State", typeof (string));
+            cb.AddField("State", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

-            cb.AddField("Zip", typeof (string));
+            cb.AddField("Zip", typeof(string));
             cb.LastField.TrimMode = TrimMode.Both;
             cb.LastField.FieldQuoted = false;

@@ -116,10 +117,7 @@

             Assert.AreEqual("Alex & Jen", contactData.Rows[0][0].ToString());
             Assert.AreEqual("Mark & Lisa K", contactData.Rows[1][0].ToString());
-
-            // new DelimitedClassBuilder("", ",");
         }
-

         [Test]
         public void RunTimeNullableFields()
@@ -127,12 +125,11 @@
             var cb = new DelimitedClassBuilder("ImportContact", ",");

             cb.AddField("Field1", "int?");
-            cb.AddField("Field2", typeof (int?));
+            cb.AddField("Field2", typeof(int?));
             cb.AddField("Field3", "Nullable<int>");
-            cb.AddField("Field4", typeof (Nullable<int>));
+            cb.AddField("Field4", typeof(int?));
             cb.CreateRecordClass();
         }
-

         [Test]
         public void RunTimeMultimpleInstances()
@@ -142,24 +139,22 @@
             cb.AddField("Field1", "int?");
             cb.AddField("Field2", typeof(int?));
             cb.AddField("Field3", "Nullable<int>");
-            cb.AddField("Field4", typeof(Nullable<int>));
+            cb.AddField("Field4", typeof(int?));

             cb.CreateRecordClass();
             cb.CreateRecordClass();
         }
-
-

         [Test]
         public void RunTimeGenerics()
         {
             var cb = new DelimitedClassBuilder("ImportContact", ",");

-            cb.AddField("Field2", typeof (Dictionary<int, List<string>>));
+            cb.AddField("Field2", typeof(Dictionary<int, List<string>>));
             cb.AddField("Field1", "System.Collections.Generic.List<int>");
-            cb.AddField("Field7", typeof (List<int>));
+            cb.AddField("Field7", typeof(List<int>));
             cb.AddField("Field3", "Nullable<int>");
-            cb.AddField("Field4", typeof (Nullable<int>));
+            cb.AddField("Field4", typeof(int?));

             cb.CreateRecordClass();
         }


Advanced creation of strategies.

Advanced creation of strategies.

--- Framework/Cqrs/Repositories/Queries/QueryBuilder.cs
+++ Framework/Cqrs/Repositories/Queries/QueryBuilder.cs
@@ -290,7 +290,14 @@
 		/// </summary>
 		protected virtual TQueryStrategy GetNullQueryStrategy()
 		{
-			return Activator.CreateInstance<TQueryStrategy>();
+			try
+			{
+				return Activator.CreateInstance<TQueryStrategy>();
+			}
+			catch (MissingMethodException)
+			{
+				return DependencyResolver.Current.Resolve<TQueryStrategy>();
+			}
 		}

 		/// <summary>


Added some annotations

Added some annotations

--- FubarDev.WebDavServer/Properties/EntryProperties.cs
+++ FubarDev.WebDavServer/Properties/EntryProperties.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
@@ -9,18 +10,25 @@
 using FubarDev.WebDavServer.Properties.Live;
 using FubarDev.WebDavServer.Properties.Store;

+using JetBrains.Annotations;
+
 namespace FubarDev.WebDavServer.Properties
 {
     public class EntryProperties : IAsyncEnumerable<IUntypedReadableProperty>
     {
+        [NotNull]
         private readonly IEntry _entry;

+        [NotNull, ItemNotNull]
         private readonly IEnumerable<ILiveProperty> _liveProperties;
+
+        [NotNull, ItemNotNull]
         private readonly IEnumerable<IDeadProperty> _predefinedDeadProperties;

+        [CanBeNull]
         private readonly IPropertyStore _propertyStore;

-        public EntryProperties(IEntry entry, IEnumerable<ILiveProperty> liveProperties, IEnumerable<IDeadProperty> predefinedDeadProperties, IPropertyStore propertyStore)
+        public EntryProperties([NotNull] IEntry entry, [NotNull, ItemNotNull] IEnumerable<ILiveProperty> liveProperties, [NotNull, ItemNotNull] IEnumerable<IDeadProperty> predefinedDeadProperties, [CanBeNull] IPropertyStore propertyStore)
         {
             _entry = entry;
             _liveProperties = liveProperties;
@@ -35,19 +43,23 @@

         private class PropertiesEnumerator : IAsyncEnumerator<IUntypedReadableProperty>
         {
+            [NotNull]
             private readonly IEntry _entry;

+            [CanBeNull]
             private readonly IPropertyStore _propertyStore;

+            [NotNull]
             private readonly IEnumerator<IUntypedReadableProperty> _predefinedPropertiesEnumerator;

             private readonly Dictionary<XName, IUntypedReadableProperty> _emittedProperties = new Dictionary<XName, IUntypedReadableProperty>();

             private bool _predefinedPropertiesFinished;

+            [CanBeNull]
             private IEnumerator<IDeadProperty> _deadPropertiesEnumerator;

-            public PropertiesEnumerator(IEntry entry, IEnumerable<ILiveProperty> liveProperties, IEnumerable<IDeadProperty> predefinedDeadProperties, IPropertyStore propertyStore)
+            public PropertiesEnumerator([NotNull] IEntry entry, [NotNull, ItemNotNull] IEnumerable<ILiveProperty> liveProperties, [NotNull, ItemNotNull] IEnumerable<IDeadProperty> predefinedDeadProperties, [CanBeNull] IPropertyStore propertyStore)
             {
                 _entry = entry;
                 _propertyStore = propertyStore;
@@ -85,7 +97,7 @@

             public void Dispose()
             {
-                _predefinedPropertiesEnumerator?.Dispose();
+                _predefinedPropertiesEnumerator.Dispose();
                 _deadPropertiesEnumerator?.Dispose();
             }

@@ -110,6 +122,7 @@
                 if (_propertyStore == null)
                     return null;

+                Debug.Assert(_deadPropertiesEnumerator != null, "_deadPropertiesEnumerator != null");
                 if (!_deadPropertiesEnumerator.MoveNext())
                     return null;

@@ -117,4 +130,4 @@
             }
         }
     }
-}+}


 * Fixed another small issue with new source request

git-svn-id: e2945e6dc2723cb01f425b5a7c3c201ce5019a89@302 080cfd25-d5d9-4c59-82ea-70d02a200d8b

--- Gablarski/Server/GablarskiServer.MessageHandling.cs
+++ Gablarski/Server/GablarskiServer.MessageHandling.cs
@@ -263,10 +263,11 @@
 			AudioSource source = null;
 			try
 			{
-				int sourceId;
+				int sourceId = 1;
 				lock (sourceLock)
 				{
-					sourceId = this.sources.Max (s => s.Id) + 1;
+					if (this.sources.Count > 0)
+						sourceId = this.sources.Max (s => s.Id) + 1;
 				}

 				if (result == SourceResult.FailedUnknown)


[RustLegacy] Remove old default group migration

--- Games/Unity/Oxide.Game.RustLegacy/RustLegacyCore.cs
+++ Games/Unity/Oxide.Game.RustLegacy/RustLegacyCore.cs
@@ -206,14 +206,6 @@
                 return true;
             }

-            // Migrate user from 'player' group to 'default'
-            if (permission.UserHasGroup(id, "player"))
-            {
-                permission.AddUserGroup(id, "default");
-                permission.RemoveUserGroup(id, "player");
-                Interface.Oxide.LogWarning($"Migrated '{id}' to the new 'default' group");
-            }
-
             return Interface.Call("OnUserApprove", connection, approval, acceptor) ?? Interface.Call("OnUserApproved", connection.UserName, id, ip);
         }


Fix perfomance issue when creating commit view models

--- GitMind/RepositoryViews/Private/ViewModelService.cs
+++ GitMind/RepositoryViews/Private/ViewModelService.cs
@@ -6,6 +6,7 @@
 using System.Windows.Media;
 using GitMind.Common.Brushes;
 using GitMind.Features.Branches;
+using GitMind.Features.Commits;
 using GitMind.Git;
 using GitMind.GitModel;
 using GitMind.Utils;
@@ -22,8 +23,11 @@
 	{
 		private static readonly int CommitHeight = Converters.ToY(1);

+		private readonly IBranchService branchService;
+		private readonly ICommitsService commitsService;
 		private readonly IBrushService brushService;
 		private readonly IRepositoryMgr repositoryMgr;
+		private readonly IRepositoryCommands repositoryCommands;
 		private readonly Func<CommitViewModel> commitViewModelProvider;
 		private readonly Func<BranchViewModel> branchViewModelProvider;
 		private readonly Command<Branch> deleteBranchCommand;
@@ -32,13 +36,18 @@

 		public ViewModelService(
 			IBranchService branchService,
+			ICommitsService commitsService,
 			IBrushService brushService,
 			IRepositoryMgr repositoryMgr,
+			IRepositoryCommands repositoryCommands,
 			Func<CommitViewModel> commitViewModelProvider,
 			Func<BranchViewModel> branchViewModelProvider)
 		{
+			this.branchService = branchService;
+			this.commitsService = commitsService;
 			this.brushService = brushService;
 			this.repositoryMgr = repositoryMgr;
+			this.repositoryCommands = repositoryCommands;
 			this.commitViewModelProvider = commitViewModelProvider;
 			this.branchViewModelProvider = branchViewModelProvider;

@@ -490,7 +499,10 @@
 			List<CommitViewModel> commits = repositoryViewModel.Commits;
 			var commitsById = repositoryViewModel.CommitsById;

-			SetNumberOfItems(commits, sourceCommits.Count, i => commitViewModelProvider());
+			SetNumberOfItems(
+				commits,
+				sourceCommits.Count,
+				i => new CommitViewModel(branchService, repositoryCommands, commitsService));

 			commitsById.Clear();
 			int graphWidth = repositoryViewModel.GraphWidth;


and this one

and this one

--- RelhaxModpack/RelhaxModpack/Windows/ModSelectionList.xaml.cs
+++ RelhaxModpack/RelhaxModpack/Windows/ModSelectionList.xaml.cs
@@ -2508,7 +2508,7 @@
             if (!string.IsNullOrEmpty(propertyValue))
             {
                 //add the property value
-                if (!DatabaseUtils.SetObjectProperty(package, property, propertyValue))
+                if (!CommonUtils.SetObjectProperty(package, property, propertyValue))
                 {
                     Logging.Error("Unable to set property '{0}' value from SelectablePackage object, skipping!", propertyName);
                     return;


Before Other Bastards

Before Other Bastards

--- HPR321Project/DataAccess/FileHandler/FileHandler.cs
+++ HPR321Project/DataAccess/FileHandler/FileHandler.cs
@@ -50,23 +50,45 @@

         #region Append

+        public void Append(string[] Data, bool CreateNewFile = false)
+        {
+
+        }
+
         #endregion

         #region Overwrite

+        public void Overwrite(string[] Data, bool CreateNewFile = false)
+        {
+
+        }
+
         #endregion
+
+        private void WriteData(string[] Data, StreamWriter internalWriter)
+        {
+            for (int i = 0; i < Data.Length; i++)
+            {
+                internalWriter.WriteLine(Data[i]);
+            }
+            internalWriter.Close();
+        }

         #endregion

         #region Clear File

+        public void ClearContents(string FilePathParam)
+        {

+        }

         #endregion

         #region Creation

-        private void CreateFile()
+        private void CreateFile(string FilePathParam)
         {

         }


improve log message handling

improve log message handling

--- RelhaxModpack/RelhaxModpack/Windows/ModSelectionList.xaml.cs
+++ RelhaxModpack/RelhaxModpack/Windows/ModSelectionList.xaml.cs
@@ -531,8 +531,12 @@
                 else
                 {
                     //the file entry is up to date in the database, but it may be out of date with the modpack database
-                    if (!package.CRC.Equals(md5DatabaseManager.GetMd5HashFileEntry(package.ZipFile, File.GetLastWriteTime(zipFile))))
+                    string hashInDb = md5DatabaseManager.GetMd5HashFileEntry(package.ZipFile, File.GetLastWriteTime(zipFile));
+                    if (!package.CRC.Equals(hashInDb))
+                    {
+                        Logging.Info("Zip file {0} reports up to date by filetime, but local hash {1} does not match online hash {2}. Flag for re-download", package.ZipFile, hashInDb, package.CRC);
                         package.DownloadFlag = true;
+                    }
                 }

             }


Have the train listen to all messages, not just @ mentions

--- Hatman/Triggers/Train.cs
+++ Hatman/Triggers/Train.cs
@@ -12,12 +12,12 @@

         public void AttachEvents(ChatEventRouter router)
         {
-            router.RegisterTriggerEvent(EventType.UserMentioned, this);
+            router.RegisterTriggerEvent(EventType.MessagePosted, this);
         }

         public bool HandleEvent(object sender, ChatEventArgs e)
         {
-            if (e.Type == EventType.UserMentioned)
+            if (e.Type == EventType.MessagePosted)
             {
                 ProcessMessage(e);
             }


Optimize menu

Optimize menu

Remove bootstrap toggle logic

--- Src/Nager.Date.WebsiteCore/Views/Shared/_Layout.cshtml
+++ Src/Nager.Date.WebsiteCore/Views/Shared/_Layout.cshtml
@@ -25,13 +25,13 @@
         </environment>*@

-
+

-            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
+            <button @@click="show" class="navbar-toggler" type="button" aria-label="Toggle navigation">

             </button>
             Nager.Date
-

+

@Html.ActionLink("Countries", "Countries", "Home", null, new { @class = "nav-link" })

@Html.ActionLink("API", "Index", "Api", null, new { @class = "nav-link" })

@@ -46,7 +46,7 @@

-
 Help to improve the project

+
 Help to improve this project

                     github.com/tinohager/Nager.Date

@@ -87,6 +87,19 @@
                 "position": "top"
             })
         });
+
+        new Vue({
+            el: '#Navigation',
+            data: {
+                hideNavigation: true,
+            },
+            methods: {
+                show: function () {
+                    this.hideNavigation = !this.hideNavigation;
+                }
+            }
+        })
+
     </script>

     @if (HttpContextAccessor.HttpContext.Request.Cookies.ContainsKey("cookieconsent_status"))


Wait for the database to finish processing before teardown.

--- Tests/Test.cs
+++ Tests/Test.cs
@@ -45,6 +45,10 @@
             }

             RunAsync (async delegate {
+                // Use an empty transaction to ensure that the SQLiteDataStore has completed all scheduled jobs:
+                await DataStore.ExecuteInTransactionAsync ((ctx) => {
+                });
+
                 ServiceContainer.Clear ();

                 if (databasePath != null) {


Logging the version details accordingly

Logging the version details accordingly

--- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs
+++ src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs
@@ -150,10 +150,19 @@

                 if (!result.IsValid)
                 {
-                    Logger.Warning("Software versions do not meet minimums Git:{0} GitLfs:{1}", result.GitVersionTask, result.GitLfsVersionTask);
+                    Logger.Warning("Software versions do not meet minimums Git:{0} (Minimum:{1}) GitLfs:{2} (Minimum:{3})",
+                        result.GitVersionTask,
+                        Constants.MinimumGitVersion,
+                        result.GitLfsVersionTask,
+                        Constants.MinimumGitLfsVersion);
+
                     isBusy = false;
                     return;
                 }
+
+                Logger.Trace("Software versions meet minimums Git:{0} GitLfs:{1}",
+                    result.GitVersionTask,
+                    result.GitLfsVersionTask);

                 Manager.SystemSettings.Set(Constants.GitInstallPathKey, value);
                 Environment.GitExecutablePath = value.ToNPath();


Begin refactoring of general spaghetti code. Simplify tile prefabs.

--- Tiles/Tile.cs
+++ Tiles/Tile.cs
@@ -3,13 +3,16 @@

 public class Tile : BaseBehaviour
 {
+    // TileType is used to block enemy AI from walking off into space, etc
+    public enum TileType { Decorative, Solid, OneWay };
+    public TileType tileType = TileType.Decorative;
     private Shader shader1;
     private MeshRenderer meshRenderer;

+    void Start() {

-    void Start() {
+        shader1                        = Shader.Find("Sprites/Diffuse");
         meshRenderer                   = transform.parent.GetComponent<MeshRenderer>();
-        shader1                        = Shader.Find("Sprites/Diffuse");
         meshRenderer.material.shader   = shader1;
         meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
         meshRenderer.receiveShadows    = false;


Code cleanup

Code cleanup

--- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs
+++ src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs
@@ -53,7 +53,6 @@
         }

         public TreeNode ActiveNode { get { return activeNode; } }
-

         public void Load(IEnumerable<ITreeData> data, string title)
         {
@@ -153,10 +152,6 @@

         public Rect Render(Rect rect, Vector2 scroll, Action<TreeNode> singleClick = null, Action<TreeNode> doubleClick = null, Action<TreeNode> rightClick = null)
         {
-            Profiler.BeginSample("TreeControl");
-            var visible = true;
-            var availableHeight = rect.y + rect.height;
-
             RequiresRepaint = false;
             rect = new Rect(0f, rect.y, rect.width, ItemHeight);

@@ -187,16 +182,12 @@
                 {
                     Indent();
                 }
-
-                if (visible)
-                {
-                    var changed = node.Render(rect, Styles.TreeIndentation, selectedNode == node, FolderStyle, TreeNodeStyle, ActiveTreeNodeStyle);
-
-                    if (node.IsFolder && changed)
-                    {
-                        // toggle visibility for all the nodes under this one
-                        ToggleNodeVisibility(i, node);
-                    }
+                var changed = node.Render(rect, Styles.TreeIndentation, selectedNode == node, FolderStyle, TreeNodeStyle, ActiveTreeNodeStyle);
+
+                if (node.IsFolder && changed)
+                {
+                    // toggle visibility for all the nodes under this one
+                    ToggleNodeVisibility(i, node);
                 }

                 if (node.Level < level)
@@ -210,17 +201,13 @@

                 if (!node.IsHidden)
                 {
-                    if (visible)
-                    {
-                        RequiresRepaint = HandleInput(rect, node, i, singleClick, doubleClick, rightClick);
-                    }
+                    RequiresRepaint = HandleInput(rect, node, i, singleClick, doubleClick, rightClick);
                     rect.y += ItemHeight + ItemSpacing;
                 }
             }

             Unindent();

-            Profiler.EndSample();
             return rect;
         }

@@ -256,13 +243,13 @@

         private int ToggleNodeVisibility(int idx, TreeNode rootNode)
         {
-            var rootNodeLevel = rootNode.Level;
-            rootNode.IsCollapsed = !rootNode.IsCollapsed;
+            var nodeLevel = node.Level;
+            node.IsCollapsed = !node.IsCollapsed;
             idx++;
-            for (; idx < nodes.Count && nodes[idx].Level > rootNodeLevel; idx++)
-            {
-                nodes[idx].IsHidden = rootNode.IsCollapsed;
-                if (nodes[idx].IsFolder && !rootNode.IsCollapsed && nodes[idx].IsCollapsed)
+            for (; idx < nodes.Count && nodes[idx].Level > nodeLevel; idx++)
+            {
+                nodes[idx].IsHidden = node.IsCollapsed;
+                if (nodes[idx].IsFolder && !node.IsCollapsed && nodes[idx].IsCollapsed)
                 {
                     var level = nodes[idx].Level;
                     for (idx++; idx < nodes.Count && nodes[idx].Level > level; idx++) { }
@@ -271,7 +258,7 @@
             }
             if (SelectedNode != null && SelectedNode.IsHidden)
             {
-                SelectedNode = rootNode;
+                SelectedNode = node;
             }
             return idx;
         }


1. Fixed register duplicate Jquery styles. <link rel="Stylesheet" href="/Kooboo-WebResource/Index/jQuery-Styles/20130227" type="text/css" />

2. DONOT register the module script/theme URL when the module do not have any script/theme files.

--- Kooboo.CMS/Kooboo.CMS.Sites/View/FrontHtmlHelper.cs
+++ Kooboo.CMS/Kooboo.CMS.Sites/View/FrontHtmlHelper.cs
@@ -641,14 +641,15 @@
                         var moduleRequestContext = (ModuleRequestContext)actionInvoked.ControllerContext.RequestContext;
                         if (moduleRequestContext.ModuleContext.FrontEndContext.EnableScript)
                         {
+                            var scripts = ServiceFactory.ModuleManager.AllScripts(moduleRequestContext.ModuleContext.ModuleName);
                             if (site.Mode == ReleaseMode.Debug)
                             {
-                                foreach (var script in ServiceFactory.ModuleManager.AllScripts(moduleRequestContext.ModuleContext.ModuleName))
+                                foreach (var script in scripts)
                                 {
                                     yield return this.Html.Script(UrlUtility.ToHttpAbsolute(baseUri, script.VirtualPath));
                                 }
                             }
-                            else
+                            else if (scripts.Count() > 0)
                             {
                                 yield return this.Html.Script(this.PageContext.FrontUrl.ModuleScriptsUrl(moduleRequestContext.ModuleContext.ModuleName, baseUri, compressed).ToString());
                             }
@@ -705,10 +706,17 @@
                   .Concat(this.IncludeStyleEditingStyles(baseUri))
                   .Distinct(new IHtmlStringComparer());

+
+                if (this.PageContext.PageRequestContext.Site.EnableJquery)
+                {
+                    styles = styles.Concat(new[] { Kooboo.Web.Mvc.WebResourceLoader.MvcExtensions.ExternalResources(this.Html, null, "jQuery-Styles", null, baseUri) });
+                }
+                styles = styles.Concat(this.PageContext.Styles);
                 Html.ViewContext.HttpContext.Items[key] = new object();
             }
-            styles = styles.Concat(this.IncludeThemeStyles(themeName, baseUri))
-                .Concat(this.PageContext.Styles);
+
+            styles = styles.Concat(this.IncludeThemeStyles(themeName, baseUri));
+
             return new AggregateHtmlString(styles);
         }

@@ -748,10 +756,6 @@
         private IEnumerable<IHtmlString> IncludeThemeStyles(Site site, string themeName, string baseUri = null)
         {
             List<IHtmlString> htmlStrings = new List<IHtmlString>();
-            if (this.PageContext.PageRequestContext.Site.EnableJquery)
-            {
-                htmlStrings.Add(Kooboo.Web.Mvc.WebResourceLoader.MvcExtensions.ExternalResources(this.Html, null, "jQuery-Styles", null, baseUri));
-            }

             string themeRuleBody;

@@ -813,7 +817,7 @@
                                     yield return this.Html.Stylesheet(UrlUtility.ToHttpAbsolute(baseUri, style.VirtualPath));
                                 }
                             }
-                            else
+                            else if (styles.Count() > 0)
                             {
                                 yield return this.Html.Stylesheet(this.PageContext.FrontUrl.
                                     ModuleThemeUrl(moduleRequestContext.ModuleContext.ModuleName, moduleRequestContext.ModuleContext.FrontEndContext.ModuleSettings.ThemeName, baseUri)


Modified templates to be visitors.

Modified templates to be visitors.

--- src/Generator/Generators/Template.cs
+++ src/Generator/Generators/Template.cs
@@ -1,9 +1,10 @@
+using System;
 using System.Collections.Generic;
 using CppSharp.AST;

 namespace CppSharp.Generators
 {
-    public abstract class Template : BlockGenerator
+    public abstract class Template : BlockGenerator, IDeclVisitor<bool>
     {
         public BindingContext Context { get; private set; }

@@ -35,5 +36,139 @@

             return base.Generate();
         }
+
+        #region Visitor methods
+
+        public bool VisitDeclaration(Declaration decl)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitClassDecl(Class @class)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitFieldDecl(Field field)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitFunctionDecl(Function function)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitMethodDecl(Method method)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitParameterDecl(Parameter parameter)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitTypedefDecl(TypedefDecl typedef)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitTypeAliasDecl(TypeAlias typeAlias)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitEnumDecl(Enumeration @enum)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitEnumItemDecl(Enumeration.Item item)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitVariableDecl(Variable variable)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitMacroDefinition(MacroDefinition macro)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitNamespace(Namespace @namespace)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitEvent(Event @event)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitProperty(Property property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitFriend(Friend friend)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitClassTemplateDecl(ClassTemplate template)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitClassTemplateSpecializationDecl(ClassTemplateSpecialization specialization)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitFunctionTemplateDecl(FunctionTemplate template)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitFunctionTemplateSpecializationDecl(FunctionTemplateSpecialization specialization)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitVarTemplateDecl(VarTemplate template)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitVarTemplateSpecializationDecl(VarTemplateSpecialization template)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitTemplateTemplateParameterDecl(TemplateTemplateParameter templateTemplateParameter)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitTemplateParameterDecl(TypeTemplateParameter templateParameter)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitNonTypeTemplateParameterDecl(NonTypeTemplateParameter nonTypeTemplateParameter)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual bool VisitTypeAliasTemplateDecl(TypeAliasTemplate typeAliasTemplate)
+        {
+            throw new NotImplementedException();
+        }
+
+        #endregion
     }
 }


- tweak

- tweak

--- src/JsonFx.Json/Json/JsonAnalyzer.cs
+++ src/JsonFx.Json/Json/JsonAnalyzer.cs
@@ -164,11 +164,13 @@
 					throw new ArgumentNullException("tokens");
 				}

+				Type resultType = typeof(TResult);
+
 				IEnumerator<Token<JsonTokenType>> tokenizer = tokens.GetEnumerator();
 				while (tokenizer.MoveNext())
 				{
 					// cast each of the values accordingly
-					yield return (TResult)this.ConsumeValue(tokenizer, typeof(TResult));
+					yield return (TResult)this.ConsumeValue(tokenizer, resultType);
 				}
 			}


Up the timeout so that large parameters / result data don't cause exceptions

--- Dx.Runtime/Storage/Dht.cs
+++ Dx.Runtime/Storage/Dht.cs
@@ -25,7 +25,12 @@
         private object p_YieldingLock = new object();
         private bool m_Stopping = false;

-        public const int TIMEOUT = 5;
+        // TODO: This is 60 seconds for the moment to account for large parameters or
+        // result data.  When the data is being sent or received, this counts towards
+        // the timeout, even though in reality we should be aware that we've started
+        // to receive a response from a node and therefore just have to wait until it
+        // completes.
+        public const int TIMEOUT = 60;

         public event EventHandler<MessageEventArgs> OnReceived;
         public event EventHandler<EntriesRequestedEventArgs> OnEntriesRequested;


(GH-92) PowerShell - handle spaces in module path

--- src/chocolatey/infrastructure.app/services/PowershellService.cs
+++ src/chocolatey/infrastructure.app/services/PowershellService.cs
@@ -76,11 +76,11 @@
             return run_action(configuration, packageResult, CommandNameType.uninstall);
         }

-        public string wrap_command_with_module(string command)
+        public string wrap_script_with_module(string script)
         {
             var installerModules = _fileSystem.get_files(ApplicationParameters.InstallLocation, "chocolateyInstaller.psm1", SearchOption.AllDirectories);
             var installerModule = installerModules.FirstOrDefault();
-            return "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name '{0}';$ErrorActionPreference = 'Stop'; {1}".format_with(installerModule, command);
+            return "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name '{0}';$ErrorActionPreference = 'Stop'; & '{1}'".format_with(installerModule, script);
         }

         public bool run_action(ChocolateyConfiguration configuration, PackageResult packageResult, CommandNameType command)
@@ -178,7 +178,7 @@
                 {
                     installerRun = true;
                     var exitCode = PowershellExecutor.execute(
-                        wrap_command_with_module(chocoPowerShellScript),
+                        wrap_script_with_module(chocoPowerShellScript),
                         _fileSystem,
                         configuration.CommandExecutionTimeoutSeconds,
                         (s, e) =>


Remove unusued using

Remove unusued using

--- ServerStuff/EllApp_server/Network/Handlers/MessageHandler.cs
+++ ServerStuff/EllApp_server/Network/Handlers/MessageHandler.cs
@@ -1,10 +1,8 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using System.Linq;
 using Alchemy.Classes;
 using EllApp_server.Classes;
 using EllApp_server.definitions;
-using Newtonsoft.Json;
 using NLog;

 namespace EllApp_server.Network.Handlers


Correcting assembly loading

Correcting assembly loading

--- Shell/Source/Tralus.Shell.Module/Utility/ReflectionHelper.cs
+++ Shell/Source/Tralus.Shell.Module/Utility/ReflectionHelper.cs
@@ -39,30 +39,34 @@

         private static void LoadModule(string moduleInfosStr, List<Type> tempImprtedModule, List<Type> tempDbContext)
         {
-            Assembly moduleCustomAssembly;
             var moduleFullPath = moduleInfosStr + ".Module";
             var moduleAssembly = Assembly.Load(moduleFullPath);
             var dataFullPath = moduleInfosStr + ".Data";
             var dataAssembly = Assembly.Load(dataFullPath);

+            var modules = moduleAssembly.GetTypes().Where(t => t.IsSubclassOf(typeof(TralusModule)));
+
             // ToDo: This should remove from here and move to a web related place. This project should not have any reference to web.
-            if (System.Web.HttpRuntime.AppDomainAppId != null)
-            {
-                var moduleWwebFullPath = moduleInfosStr + ".Module.Web";
-                moduleCustomAssembly = Assembly.Load(moduleWwebFullPath);
-            }
-            else
-            {
-                var moduleWinFullPath = moduleInfosStr + ".Module.Win";
-                moduleCustomAssembly = Assembly.Load(moduleWinFullPath);
-            }

+            //if (moduleInfosStr != "Tralus.Framework")
+            //{
+                Assembly moduleCustomAssembly;
+                if (System.Web.HttpRuntime.AppDomainAppId != null)
+                {
+                    var moduleWwebFullPath = moduleInfosStr + ".Module.Web";
+                    moduleCustomAssembly = Assembly.Load(moduleWwebFullPath);
+                }
+                else
+                {
+                    var moduleWinFullPath = moduleInfosStr + ".Module.Win";
+                    moduleCustomAssembly = Assembly.Load(moduleWinFullPath);
+                }

-            var modules = moduleAssembly.GetTypes().Where(t => t.IsSubclassOf(typeof(TralusModule)));
-            var modulesSpecific = moduleCustomAssembly.GetTypes().Where(
-                t => t.IsSubclassOf(typeof(TralusModule)) && !t.FullName.Contains("TralusWinModule") && !t.FullName.Contains("TralusWebModule"));
+                var modulesSpecific = moduleCustomAssembly.GetTypes().Where(
+                    t => t.IsSubclassOf(typeof(TralusModule)) && !t.FullName.Contains("TralusWinModule") && !t.FullName.Contains("TralusWebModule"));

-            tempImprtedModule.AddRange(modules.Concat(modulesSpecific));
+                tempImprtedModule.AddRange(modules.Concat(modulesSpecific));
+            //}

             tempDbContext.AddRange(dataAssembly.GetTypes().Where(
                 t => t.IsSubclassOf(typeof(DbContextBase)) && !t.IsAbstract && !t.FullName.Contains("DbContextBase"))


Fix #48 (#50)

Fix #48 (#50)

* Add string interpolation step (#49). Fix #48

* Fix #49

* Revert "Fix #49"

This reverts commit 38ea7127d80bad0981217c37ed544df90196ebfd.

* Revert "Add string interpolation step (#49). Fix #48"

This reverts commit 29a86b3b17c877c048e8ee1fe7d200922262e834.

* Fix #48

--- Koans/AboutStrings.cs
+++ Koans/AboutStrings.cs
@@ -224,7 +224,7 @@
             //String.Format and StringBuilder will be more efficent that concatenation. Prefer them.
         }

-        [Step(22)]
+        [Step(23)]
         public void StringBuilderCanUseFormatAsWell()
         {
             var strBuilder = new System.Text.StringBuilder();
@@ -235,28 +235,28 @@
             Assert.Equal(FILL_ME_IN, str);
         }

-        [Step(23)]
+        [Step(24)]
         public void LiteralStringsInterpretsEscapeCharacters()
         {
             var str = "\n";
             Assert.Equal(FILL_ME_IN, str.Length);
         }

-        [Step(24)]
+        [Step(25)]
         public void VerbatimStringsDoNotInterpretEscapeCharacters()
         {
             var str = @"\n";
             Assert.Equal(FILL_ME_IN, str.Length);
         }

-        [Step(25)]
+        [Step(26)]
         public void VerbatimStringsStillDoNotInterpretEscapeCharacters()
         {
             var str = @"\\\";
             Assert.Equal(FILL_ME_IN, str.Length);
         }

-        [Step(28)]
+        [Step(27)]
         public void YouCanGetASubstringFromAString()
         {
             var str = "Bacon, lettuce and tomato";
@@ -264,14 +264,14 @@
             Assert.Equal(FILL_ME_IN, str.Substring(7, 3));
         }

-        [Step(29)]
+        [Step(28)]
         public void YouCanGetASingleCharacterFromAString()
         {
             var str = "Bacon, lettuce and tomato";
             Assert.Equal(FILL_ME_IN, str[0]);
         }

-        [Step(30)]
+        [Step(29)]
         public void SingleCharactersAreRepresentedByIntegers()
         {
             Assert.Equal(97, 'a');
@@ -279,7 +279,7 @@
             Assert.Equal(FILL_ME_IN, 'b' == ('a' + 1));
         }

-        [Step(31)]
+        [Step(30)]
         public void StringsCanBeSplit()
         {
             var str = "Sausage Egg Cheese";
@@ -287,7 +287,7 @@
             Assert.Equal(new[] { FILL_ME_IN }, words);
         }

-        [Step(32)]
+        [Step(31)]
         public void StringsCanBeSplitUsingCharacters()
         {
             var str = "the:rain:in:spain";
@@ -295,7 +295,7 @@
             Assert.Equal(new[] { FILL_ME_IN }, words);
         }

-        [Step(33)]
+        [Step(32)]
         public void StringsCanBeSplitUsingRegularExpressions()
         {
             var str = "the:rain:in:spain";
@@ -308,7 +308,7 @@
             //is highly recommended to be on your bookshelf
         }

-        [Step(34)]
+        [Step(33)]
         public void YouCanInterpolateVariablesIntoAString()
         {
             var name = "John Doe";


Update LanguageInfo.cs

Update LanguageInfo.cs

more spelling errors

--- Config/LanguageInfo.cs
+++ Config/LanguageInfo.cs
@@ -78,7 +78,7 @@
         public string optionGb4 = "Launcher Settings";
         public string optionMsbForget = "Do you really want to forget auto login credentials?";
         public string optionUser = "Default Username";
-        public string optionDeck = "Defualt Deck";
+        public string optionDeck = "Default Deck";
         public string optionBtnAutoLogin = "Forget Auto Login";
         public string optionAntialias = "Antialias";
         public string optionCbSound = "Enable Sound";


Fix wonky mana on Missile weapons in LootGen (#1801)

--- Source/ACE.Server/Factories/LootGenerationFactory_Missile.cs
+++ Source/ACE.Server/Factories/LootGenerationFactory_Missile.cs
@@ -99,9 +99,10 @@
                 int lowSpellTier = GetLowSpellTier(tier);
                 int highSpellTier = GetHighSpellTier(tier);
                 int itemSkillLevelLimit = 0;
-
-                wo.SetProperty(PropertyInt.ItemMaxMana, GetMaxMana(numSpells, tier));
-                wo.SetProperty(PropertyInt.ItemCurMana, GetMaxMana(numSpells, tier));
+                int maxMana = GetMaxMana(numSpells, tier);
+
+                wo.SetProperty(PropertyInt.ItemMaxMana, maxMana);
+                wo.SetProperty(PropertyInt.ItemCurMana, maxMana);
                 wo.SetProperty(PropertyInt.ItemSpellcraft, spellCraft);
                 wo.SetProperty(PropertyInt.ItemDifficulty, GetDifficulty(tier, spellCraft));
                 wo.SetProperty(PropertyInt.ItemSkillLevelLimit, itemSkillLevelLimit);


Added Processing for all 4 CapBank Analytic Result Files

--- Source/Applications/openXDA/openXDA/CapBankAnalyticEngine.cs
+++ Source/Applications/openXDA/openXDA/CapBankAnalyticEngine.cs
@@ -205,7 +205,8 @@
                 Log.Info($"Processing Capacitor Switching Analytic File");
                 ReadSwitchingAnalytic(switchingAnalysis, eventMapping);
                 ReadPreInsertionAnalytic(preInsertionAnalytics, eventMapping);
-
+                ReadRestrikeAnalytic(restrikeAnalysis, eventMapping);
+                ReadCapBankAnalytic(capBankAnalytics, eventMapping);
             }
             else
             {
@@ -380,6 +381,222 @@
                 }
             }
         }
+
+        private void ReadRestrikeAnalytic(string filename, Dictionary<string, Event> eventMapping)
+        {
+            List<string> lines = new List<string>();
+
+            // Open the file and read each line
+            using (StreamReader fileReader = new StreamReader(File.OpenRead(filename)))
+            {
+                while (!fileReader.EndOfStream)
+                {
+                    lines.Add(fileReader.ReadLine().Trim());
+                }
+            }
+
+
+            string fileName = "";
+
+
+            using (AdoDataConnection connection = new AdoDataConnection("systemSettings"))
+            {
+
+                foreach (string line in lines.Skip(2))
+                {
+                    List<string> fields = line.Split(',').ToList();
+
+                    if (!string.IsNullOrEmpty(fields[0].Trim()))
+                        fileName = fields[0].Trim();
+
+                    string evtLabel = fields[1].Trim();
+
+                    CBRestrikeResult row = new CBRestrikeResult();
+                    int PhaseID = 0;
+
+                    if (evtLabel.EndsWith("a", StringComparison.OrdinalIgnoreCase))
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'AN'");
+                    else if (evtLabel.EndsWith("b", StringComparison.OrdinalIgnoreCase))
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'BN'");
+                    else if (evtLabel.EndsWith("c", StringComparison.OrdinalIgnoreCase))
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'CN'");
+                    else
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'None'");
+
+                    row.CBRestrikeTypeID = ConvertToInt(fields[3]) ?? -1;
+                    row.Text = ConvertToDouble(fields[6]) ?? double.NaN;
+                    row.Trest = ConvertToDouble(fields[7]) ?? double.NaN;
+                    row.Text2 = ConvertToDouble(fields[8]) ?? double.NaN;
+                    row.Drest = ConvertToDouble(fields[9]) ?? double.NaN;
+                    row.Imax = ConvertToDouble(fields[10]) ?? double.NaN;
+                    row.Vmax = ConvertToDouble(fields[11]) ?? double.NaN;
+
+                    if (row.CBRestrikeTypeID < 0)
+                        continue;
+
+                    Event evt = null;
+                    if (eventMapping.TryGetValue(fileName, out evt))
+                    {
+                        if (new TableOperations<CBAnalyticResult>(connection).QueryRecordCountWhere("PhaseID = {0} AND EventID = {1}", PhaseID, evt.ID) != 1)
+                            continue;
+
+                        row.CBResultID = new TableOperations<CBAnalyticResult>(connection).QueryRecordWhere("PhaseID = {0} AND EventID = {1}", PhaseID, evt.ID).ID;
+
+                        new TableOperations<CBRestrikeResult>(connection).AddNewRecord(row);
+                    }
+
+                }
+            }
+        }
+
+        private void ReadCapBankAnalytic(string filename, Dictionary<string, Event> eventMapping)
+        {
+            List<string> lines = new List<string>();
+
+            // Open the file and read each line
+            using (StreamReader fileReader = new StreamReader(File.OpenRead(filename)))
+            {
+                while (!fileReader.EndOfStream)
+                {
+                    lines.Add(fileReader.ReadLine().Trim());
+                }
+            }
+
+
+            string fileName = "";
+
+
+            using (AdoDataConnection connection = new AdoDataConnection("systemSettings"))
+            {
+
+                foreach (string line in lines.Skip(2))
+                {
+                    List<string> fields = line.Split(',').ToList();
+
+                    if (!string.IsNullOrEmpty(fields[0].Trim()))
+                        fileName = fields[0].Trim();
+
+                    string evtLabel = fields[1].Trim();
+
+                    CBCapBankResult row = new CBCapBankResult();
+                    int PhaseID = 0;
+
+                    if (evtLabel.EndsWith("a", StringComparison.OrdinalIgnoreCase))
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'AN'");
+                    else if (evtLabel.EndsWith("b", StringComparison.OrdinalIgnoreCase))
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'BN'");
+                    else if (evtLabel.EndsWith("c", StringComparison.OrdinalIgnoreCase))
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'CN'");
+                    else
+                        PhaseID = connection.ExecuteScalar<int>("SELECT ID FROM Phase WHERE Name = 'None'");
+
+                    Event evt = null;
+                    if (eventMapping.TryGetValue(fileName, out evt))
+                    {
+                        if (new TableOperations<CBAnalyticResult>(connection).QueryRecordCountWhere("PhaseID = {0} AND EventID = {1}", PhaseID, evt.ID) != 1)
+                            continue;
+
+                        row.CBResultID = new TableOperations<CBAnalyticResult>(connection).QueryRecordWhere("PhaseID = {0} AND EventID = {1}", PhaseID, evt.ID).ID;
+                    }
+                    if (evt == null)
+                        continue;
+
+                    CapBank capBank = new TableOperations<CapBank>(connection).QueryRecordWhere("Id = {0}", evt.AssetID);
+                    int offset = 3;
+                    CBAnalyticResult result = new TableOperations<CBAnalyticResult>(connection).QueryRecordWhere("Id = {0}", row.CBResultID);
+
+                    row.CBBankHealthID = ConvertToInt(fields[offset]) ?? -1;
+                    offset++;
+                    row.CBOperationID = ConvertToInt(fields[offset]) ?? -1;
+                    offset++;
+
+                    if (capBank.Compensated && !capBank.Fused)
+                    {
+                        row.Kfactor = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.dV = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.XLV = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.X = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.XVmiss = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.VUIEC = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.VUIEEE = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                    }
+                    else if (!capBank.Fused && !capBank.Compensated)
+                    {
+                        row.Vrelay = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.Ineutral = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.V0 = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.Z0 = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.XLV = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.X = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.VUIEC = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.VUIEEE = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                    }
+                    else
+                    {
+                        row.Kfactor = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.dV = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.XUG = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.XLG = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.X = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.XVmiss = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.VUIEC = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                        offset = offset + capBank.NumberOfBanks;
+
+                        row.VUIEEE = ConvertToDouble(fields[offset + (int)result.InServiceBank]) ?? double.NaN;
+                    }
+
+
+
+                    if (row.CBOperationID < 0)
+                        continue;
+
+                    row.BankInService = (int)result.InServiceBank;
+
+                    new TableOperations<CBCapBankResult>(connection).AddNewRecord(row);
+
+                }
+            }
+        }
+
+

         private int? ConvertToInt(string value)
         {


Fixed an issue with a logger.

Fixed an issue with a logger.

--- Source/Core/Plugins/EventUpgrader/Default/V2_EventUpgrade.cs
+++ Source/Core/Plugins/EventUpgrader/Default/V2_EventUpgrade.cs
@@ -123,7 +123,7 @@
                 return;

             if (json.Length > 200000) {
-                _logger.Error().Project(projectId).Property("EventId", id).Message("__ExceptionInfo is Too Big: {1}", json.Length).Write();
+                _logger.Error().Project(projectId).Property("EventId", id).Message("__ExceptionInfo is Too Big: {0}", json.Length).Write();
                 return;
             }


Update DrawLoop to run in PCL

Update DrawLoop to run in PCL

--- Source/Eto.Test/Eto.Test/Sections/Drawing/DrawLoopSection.cs
+++ Source/Eto.Test/Eto.Test/Sections/Drawing/DrawLoopSection.cs
@@ -1,10 +1,10 @@
-#if !PCL
 using System;
 using System.Collections.Generic;
 using Eto.Drawing;
 using Eto.Forms;
 using System.Threading;
 using System.Diagnostics;
+using System.Threading.Tasks;

 namespace Eto.Test.Sections.Drawing
 {
@@ -14,7 +14,6 @@
 		readonly DirectDrawingRenderer renderer;
 		readonly Panel content;
 		bool useCreateGraphics;
-		Thread thread;
 		Action drawFrame;
 		Status status = new Status();

@@ -39,7 +38,7 @@
 			this.Content = layout;
 		}

-		void DrawLoop(object data)
+		async void DrawLoop(object data)
 		{
 			var currentStatus = (Status)data;
 			renderer.RestartFPS();
@@ -48,7 +47,7 @@
 				var draw = drawFrame;
 				if (draw != null)
 					Application.Instance.Invoke(draw);
-				Thread.Sleep(0);
+				await Task.Delay(0);
 			}
 		}

@@ -76,8 +75,7 @@
 			}
 			content.Content = drawable;
 			status = new Status();
-			thread = new Thread(DrawLoop);
-			thread.Start(status);
+			Task.Run(() => DrawLoop(status));
 		}

 		protected override void OnUnLoad(EventArgs e)
@@ -313,7 +311,8 @@
 				var fps = TotalFrames / Watch.Elapsed.TotalSeconds;
 				// The frames per second as determined by the last frame. Measuring a single frame
 				// must include EndDraw, since that is when the pipeline is flushed to the device.
-				var lastFrameFps = Stopwatch.Frequency / (Watch.ElapsedTicks - PreviousFrameStartTicks);
+				var frameTicks = Watch.ElapsedTicks - PreviousFrameStartTicks;
+				var lastFrameFps = Stopwatch.Frequency / Math.Max(frameTicks, 1);
 				PreviousFrameStartTicks = Watch.ElapsedTicks;
 				var fpsText = string.Format("Frames per second since start: {0:0.00}, last: {1:0.00}", fps, lastFrameFps);
 				var start = Watch.ElapsedTicks;
@@ -335,4 +334,3 @@
 		}
 	}
 }
-#endif


Add 0.1 threshold to spinningSpeed. Remove unnecessary Math.Abs on LengthSquared.

--- Source/HelixToolkit.Wpf.SharpDX/Controls/CameraController.cs
+++ Source/HelixToolkit.Wpf.SharpDX/Controls/CameraController.cs
@@ -2268,7 +2268,7 @@
             var factor = this.IsInertiaEnabled ? Math.Pow(this.InertiaFactor, time / 0.012) : 0;
             factor = this.Clamp(factor, 0.2, 1);

-            if (this.isSpinning && this.spinningSpeed.LengthSquared > 0)
+            if (this.isSpinning && this.spinningSpeed.LengthSquared > 0.1)
             {
                 this.rotateHandler.Rotate(
                     this.spinningPosition, this.spinningPosition + (this.spinningSpeed * time), this.spinningPoint3D);
@@ -2286,13 +2286,13 @@
                 this.rotationSpeed *= factor;
             }

-            if (Math.Abs(this.panSpeed.LengthSquared) > 0.0001)
+            if (this.panSpeed.LengthSquared > 0.0001)
             {
                 this.panHandler.Pan(this.panSpeed * time);
                 this.panSpeed *= factor;
             }

-            if (Math.Abs(this.moveSpeed.LengthSquared) > 0.0001)
+            if (this.moveSpeed.LengthSquared > 0.0001)
             {
                 this.zoomHandler.MoveCameraPosition(this.moveSpeed * time);
                 this.moveSpeed *= factor;


GSF.Core: Updated ChildProcessManager to gracefully operate on non-Windows environments.

--- Source/Libraries/GSF.Core/Diagnostics/ChildProcessManager.cs
+++ Source/Libraries/GSF.Core/Diagnostics/ChildProcessManager.cs
@@ -115,8 +115,18 @@
             }
         }

+        // Events
+
+        /// <summary>
+        /// Raised when there is an exception while attempting to terminate child process.
+        /// </summary>
+        /// <remarks>
+        /// This is currently only raised on non-Windows operating systems.
+        /// </remarks>
+        public event EventHandler<EventArgs<Exception>> TerminationException;
+
         // Fields
-        private List<WeakReference<Process>> m_childProcesses;
+        private readonly List<WeakReference<Process>> m_childProcesses;
         private SafeJobHandle m_jobHandle;
         private bool m_disposed;

@@ -136,6 +146,13 @@
             }
             else
             {
+                // Let safe handle manage terminations on Windows
+                GC.SuppressFinalize(this);
+
+                // On Windows we add child processes to a job object such that when the job
+                // is terminated, so are the child processes. Since safe handle ensures proper
+                // closing of job handle, child processes will be terminated even if parent
+                // process is abnormally terminated
                 m_jobHandle = new SafeJobHandle(CreateJobObject(IntPtr.Zero, null));

                 JOBOBJECT_BASIC_LIMIT_INFORMATION info = new JOBOBJECT_BASIC_LIMIT_INFORMATION
@@ -158,6 +175,14 @@
             }
         }

+        /// <summary>
+        /// Make sure child processes get disposed.
+        /// </summary>
+        ~ChildProcessManager()
+        {
+            Dispose();
+        }
+
         #endregion

         #region [ Methods ]
@@ -172,8 +197,30 @@

             try
             {
-                m_jobHandle.Dispose();
-                m_jobHandle = null;
+                if (Common.IsPosixEnvironment)
+                {
+                    foreach (WeakReference<Process> childProcessReference in m_childProcesses)
+                    {
+                        Process childProcess;
+
+                        if (!childProcessReference.TryGetTarget(out childProcess))
+                            continue;
+
+                        try
+                        {
+                            childProcess.Kill();
+                        }
+                        catch (Exception ex)
+                        {
+                            TerminationException?.Invoke(this, new EventArgs<Exception>(ex));
+                        }
+                    }
+                }
+                else
+                {
+                    m_jobHandle?.Dispose();
+                    m_jobHandle = null;
+                }
             }
             finally
             {
@@ -186,18 +233,31 @@
         /// </summary>
         /// <param name="process">The <see cref="Process"/> to associate.</param>
         /// <remarks>
-        /// The <paramref name="process"/> will be assigned as an associated job of this <see cref="ChildProcessManager"/> instance.
-        /// When this <see cref="ChildProcessManager"/> instance is disposed and/or garbage collected, the children processes will
-        /// be terminated. Creating an instance of this class with lifetime scope of the executing application will causes any child
-        /// processes to be terminated when the parent process dies, even when parent process termination is abnormal.
+        /// <para>
+        /// The <paramref name="process"/> will be managed as an associated process of this <see cref="ChildProcessManager"/>
+        /// instance. When this <see cref="ChildProcessManager"/> instance is disposed or garbage collected, the children
+        /// processes will be terminated.
+        /// </para>
+        /// <para>
+        /// Creating an instance of this class with lifetime scope of the executing application will cause any child processes
+        /// to be terminated when the parent process shuts down, on Windows environments this will happen even when the parent
+        /// process termination is abnormal.
+        /// </para>
         /// </remarks>
         public void AddProcess(Process process)
         {
             if (m_disposed)
                 throw new ObjectDisposedException(nameof(ChildProcessManager));

-            if (!AssignProcessToJobObject(m_jobHandle, process.SafeHandle))
-                throw new InvalidOperationException($"Unable to add process to ChildProcessManager job. Error: {Marshal.GetLastWin32Error()}");
+            if (Common.IsPosixEnvironment)
+            {
+                m_childProcesses.Add(new WeakReference<Process>(process));
+            }
+            else
+            {
+                if (!AssignProcessToJobObject(m_jobHandle, process.SafeHandle))
+                    throw new InvalidOperationException($"Unable to add process to ChildProcessManager job. Error: {Marshal.GetLastWin32Error()}");
+            }
         }

         #endregion


GSF.PhasorProtocols.UI: Fixed default data type for new BaseKV field in Phasor data model.

--- Source/Libraries/GSF.PhasorProtocols/UI/DataModels/Phasor.cs
+++ Source/Libraries/GSF.PhasorProtocols/UI/DataModels/Phasor.cs
@@ -167,7 +167,7 @@
         /// <summary>
         /// Gets or sets nominal voltage level of line/bus associated with phasor.
         /// </summary>
-        [DefaultValue("0")]
+        [DefaultValue(0)]
         public int BaseKV
         {
             get


remove duplicate code

remove duplicate code

removed duplicate by checking text-diff

--- src/NLog/Targets/WebServiceTarget.cs
+++ src/NLog/Targets/WebServiceTarget.cs
@@ -235,55 +235,47 @@
             }
         }

-        private byte[] PrepareSoap11Request(HttpWebRequest request, object[] parameters)
+        private byte[] PrepareSoap11Request(HttpWebRequest request, object[] parameterValues)
+        {
+            string soapAction;
+            if (this.Namespace.EndsWith("/", StringComparison.Ordinal))
+            {
+                soapAction = this.Namespace + this.MethodName;
+            }
+            else
+            {
+                soapAction = this.Namespace + "/" + this.MethodName;
+            }
+            request.Headers["SOAPAction"] = soapAction;
+
+            return PrepareSoapRequestPost(request, parameterValues, SoapEnvelopeNamespace, "soap");
+
+        }
+
+        private byte[] PrepareSoap12Request(HttpWebRequest request, object[] parameterValues)
+        {
+            return PrepareSoapRequestPost(request, parameterValues, Soap12EnvelopeNamespace, "soap12");
+        }
+
+        /// <summary>
+        /// Helper for creating soap POST-XML request
+        /// </summary>
+        /// <param name="request"></param>
+        /// <param name="parameterValues"></param>
+        /// <param name="soapEnvelopeNamespace"></param>
+        /// <param name="soapname"></param>
+        /// <returns></returns>
+        private byte[] PrepareSoapRequestPost(WebRequest request, object[] parameterValues, string soapEnvelopeNamespace, string soapname)
         {
             request.Method = "POST";
             request.ContentType = "text/xml; charset=" + this.Encoding.WebName;

-            if (this.Namespace.EndsWith("/", StringComparison.Ordinal))
-            {
-                request.Headers["SOAPAction"] = this.Namespace + this.MethodName;
-            }
-            else
-            {
-                request.Headers["SOAPAction"] = this.Namespace + "/" + this.MethodName;
-            }
-
             using (var ms = new MemoryStream())
             {
                 XmlWriter xtw = XmlWriter.Create(ms, new XmlWriterSettings { Encoding = this.GetEncoding() });

-                xtw.WriteStartElement("soap", "Envelope", SoapEnvelopeNamespace);
-                xtw.WriteStartElement("Body", SoapEnvelopeNamespace);
-                xtw.WriteStartElement(this.MethodName, this.Namespace);
-                int i = 0;
-
-                foreach (MethodCallParameter par in this.Parameters)
-                {
-                    xtw.WriteElementString(par.Name, Convert.ToString(parameters[i], CultureInfo.InvariantCulture));
-                    i++;
-                }
-
-                xtw.WriteEndElement(); // methodname
-                xtw.WriteEndElement(); // Body
-                xtw.WriteEndElement(); // soap:Envelope
-                xtw.Flush();
-
-                return ms.ToArray();
-            }
-        }
-
-        private byte[] PrepareSoap12Request(HttpWebRequest request, object[] parameterValues)
-        {
-            request.Method = "POST";
-            request.ContentType = "text/xml; charset=" + this.Encoding.WebName;
-
-            using (var ms = new MemoryStream())
-            {
-                XmlWriter xtw = XmlWriter.Create(ms, new XmlWriterSettings { Encoding = this.GetEncoding() });
-
-                xtw.WriteStartElement("soap12", "Envelope", Soap12EnvelopeNamespace);
-                xtw.WriteStartElement("Body", Soap12EnvelopeNamespace);
+                xtw.WriteStartElement(soapname, "Envelope", soapEnvelopeNamespace);
+                xtw.WriteStartElement("Body", soapEnvelopeNamespace);
                 xtw.WriteStartElement(this.MethodName, this.Namespace);
                 int i = 0;
                 foreach (MethodCallParameter par in this.Parameters)
@@ -292,9 +284,9 @@
                     i++;
                 }

-                xtw.WriteEndElement();
-                xtw.WriteEndElement();
-                xtw.WriteEndElement();
+                xtw.WriteEndElement(); // methodname
+                xtw.WriteEndElement(); // Body
+                xtw.WriteEndElement(); // soap:Envelope
                 xtw.Flush();

                 return ms.ToArray();


Fix indentation

Fix indentation

--- src/NUnitFramework/framework/Does.cs
+++ src/NUnitFramework/framework/Does.cs
@@ -77,15 +77,15 @@
         public static ContainsConstraint Contain(string expected) =>
             new ContainsConstraint(expected);

-    #endregion
+        #endregion

-    #region DictionaryContain
-    /// <summary>
-    /// Returns a new DictionaryContainsKeyConstraint checking for the
-    /// presence of a particular key in the Dictionary key collection.
-    /// </summary>
-    /// <param name="expected">The key to be matched in the Dictionary key collection</param>
-    public static DictionaryContainsKeyConstraint ContainKey(object expected)
+        #region DictionaryContain
+        /// <summary>
+        /// Returns a new DictionaryContainsKeyConstraint checking for the
+        /// presence of a particular key in the Dictionary key collection.
+        /// </summary>
+        /// <param name="expected">The key to be matched in the Dictionary key collection</param>
+        public static DictionaryContainsKeyConstraint ContainKey(object expected)
         {
             return Contains.Key(expected);
         }


LA: Vector.Map consistent with Matrix.Map, automatic fallback to inplace

--- src/Numerics/LinearAlgebra/Vector.cs
+++ src/Numerics/LinearAlgebra/Vector.cs
@@ -371,12 +371,17 @@
         /// If forceMapZero is not set to true, zero values may or may not be skipped depending
         /// on the actual data storage implementation (relevant mostly for sparse vectors).
         /// </summary>
-        public void Map<TU>(Func<T, TU> f, Vector<TU> result, Zeros zeros = Zeros.AllowSkip)
-            where TU : struct, IEquatable<TU>, IFormattable
-        {
-            // TODO: in v4 update this method to replace TU with T (consistent with Matrix, see MapConvert)
-            //       then automatically do in-place if possible.
-            Storage.MapTo(result.Storage, f, zeros, zeros == Zeros.Include ? ExistingData.AssumeZeros : ExistingData.Clear);
+        public void Map(Func<T, T> f, Vector<T> result, Zeros zeros = Zeros.AllowSkip)
+        {
+            if (ReferenceEquals(this, result))
+            {
+                // TODO: actual in-place
+                Storage.MapToUnchecked(Storage, f, zeros, ExistingData.AssumeZeros);
+            }
+            else
+            {
+                Storage.MapTo(result.Storage, f, zeros, zeros == Zeros.Include ? ExistingData.AssumeZeros : ExistingData.Clear);
+            }
         }

         /// <summary>
@@ -385,12 +390,17 @@
         /// If forceMapZero is not set to true, zero values may or may not be skipped depending
         /// on the actual data storage implementation (relevant mostly for sparse vectors).
         /// </summary>
-        public void MapIndexed<TU>(Func<int, T, TU> f, Vector<TU> result, Zeros zeros = Zeros.AllowSkip)
-            where TU : struct, IEquatable<TU>, IFormattable
-        {
-            // TODO: in v4 update this method to replace TU with T (consistent with Matrix, see MapIndexedConvert)
-            //       then automatically do in-place if possible.
-            Storage.MapIndexedTo(result.Storage, f, zeros, zeros == Zeros.Include ? ExistingData.AssumeZeros : ExistingData.Clear);
+        public void MapIndexed(Func<int, T, T> f, Vector<T> result, Zeros zeros = Zeros.AllowSkip)
+        {
+            if (ReferenceEquals(this, result))
+            {
+                // TODO: actual in-place
+                Storage.MapIndexedToUnchecked(Storage, f, zeros, ExistingData.AssumeZeros);
+            }
+            else
+            {
+                Storage.MapIndexedTo(result.Storage, f, zeros, zeros == Zeros.Include ? ExistingData.AssumeZeros : ExistingData.Clear);
+            }
         }

         /// <summary>


Add tests for new usage behavior

Add tests for new usage behavior

--- src/OptionParser.Tests/BasisTests.cs
+++ src/OptionParser.Tests/BasisTests.cs
@@ -20,6 +20,25 @@
     [TestClass]
     public class BasisTests
     {
+        [TestMethod]
+        public void TestThatUsesSwitchIsParsed()
+        {
+            var options = new BasicOptionParser();
+
+            options.Parse("--required-option");
+            Assert.IsFalse(options.Usage.IsDefined);
+
+            options.Parse("--required-option", "--help");
+            Assert.IsTrue(options.Usage.IsDefined);
+        }
+        [TestMethod]
+        public void TestThatUsesSwitchBypassesOptionValidation()
+        {
+            var options = new BasicOptionParser();
+
+            options.Parse("--help");
+            Assert.IsTrue(options.Usage.IsDefined);
+        }
         [TestMethod]
         public void TestThatUsageContainsNameDescriptionLongNameAndShortName()
         {


Fixing bug #17506 Deleting Media in Azure throws (Contribution by Travis Pettijohn)

--HG--
branch : contributions

--- src/Orchard.Azure/AzureFileSystem.cs
+++ src/Orchard.Azure/AzureFileSystem.cs
@@ -223,8 +223,8 @@
             EnsurePathIsRelative(path);

             using ( new HttpContextWeaver() ) {
-                Container.EnsureBlobExists(path);
-                var blob = Container.GetBlockBlobReference(String.Concat(_root, path));
+                Container.EnsureBlobExists(Combine(_root, path));
+                var blob = Container.GetBlockBlobReference(Combine(_root, path));
                 blob.Delete();
             }
         }