update xjj

update xjj

--- Longgan/Longgan.Web/Views/Home/Index.cshtml
+++ Longgan/Longgan.Web/Views/Home/Index.cshtml
@@ -217,44 +217,19 @@

-

+

-
-                    <div class="tp-caption medium_bg_asbestos skewfromleft customout"
-                         data-x="left" data-hoffset="40"
-                         data-y="100"
-                         data-customout="x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;"
-                         data-speed="500"
-                         data-start="800"
-                         data-easing="Back.easeOut"
-                         data-endspeed="500"
-                         data-endeasing="Power4.easeIn"
-                         data-captionhidden="on"
-                         style="z-index: 4">
-                        HTML5 & CSS3
-

+
+

-

+

-
-                    <div class="tp-caption medium_bg_asbestos skewfromleft customout"
-                         data-x="left" data-hoffset="40"
-                         data-y="100"
-                         data-customout="x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;"
-                         data-speed="500"
-                         data-start="800"
-                         data-easing="Back.easeOut"
-                         data-endspeed="500"
-                         data-endeasing="Power4.easeIn"
-                         data-captionhidden="on"
-                         style="z-index: 4">
-                        HTML5 & CSS3
-

+


Correctly deserialize DateTime values in indexes

--- MarcelloDB/Serialization/BinaryFormatter.cs
+++ MarcelloDB/Serialization/BinaryFormatter.cs
@@ -275,7 +275,7 @@
         internal DateTime ReadDateTime()
         {
             ReadValidTypeID(TypeID.DateTime);
-            return new DateTime(this.Reader.ReadInt64());
+            return DateTime.FromBinary(this.Reader.ReadInt64());
         }

         internal BinaryFormatter WriteNullableDateTime(DateTime? value)


Update ComboTests.cs

Update ComboTests.cs

--- MetX/MetX.Console.Tests/Fiver/ComboTests.cs
+++ MetX/MetX.Console.Tests/Fiver/ComboTests.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using MetX.Five.Setup;
 using MetX.Standard.Primary.Scripts;
 using Microsoft.VisualStudio.TestTools.UnitTesting;


Changed casing of IpPhone property

Changed casing of IpPhone property

--- ESH/Utility/ActiveDirectory/ADUser.cs
+++ ESH/Utility/ActiveDirectory/ADUser.cs
@@ -162,7 +162,7 @@
         /// </summary>
         /// <returns>A string containing the value of the attribute or null if the attribute does not exist.</returns>
         [DirectoryProperty("ipPhone")]
-        public string IPPhone
+        public string IpPhone
         {
             get
             {


Refactor DrawArcHandle()

Refactor DrawArcHandle()

--- Editor/AnimationPathAnimatorEditor.cs
+++ Editor/AnimationPathAnimatorEditor.cs
@@ -289,7 +289,6 @@

         #region DRAWING METHODS

-        // TODO Refactor.
         private void DrawEaseHandles(Action<int, float> callback) {
             // Get path node positions.
             var nodePositions = script.AnimationPathBuilder.GetNodePositions();
@@ -300,33 +299,40 @@
                 easeCurveValues[i] = script.EaseCurve.keys[i].value;
             }

+            var arcValueMultiplier = 360/maxAnimationSpeed.floatValue;
+
             // For each path node..
             for (var i = 0; i < nodePositions.Length; i++) {
-                DrawEaseHandle(
+                DrawArcHandle(
                     easeCurveValues[i],
                     nodePositions[i],
+                    arcValueMultiplier,
+                    0,
+                    360,
+                    Color.red,
                     (value) => callback(i, value));
             }
         }

-        private void DrawEaseHandle(
+        private void DrawArcHandle(
             float easeCurveValue,
             Vector3 nodePosition,
+            float arcValueMultiplier,
+            int minDegrees,
+            int maxDegrees,
+            Color handleColor,
             Action<float> callback) {

-            var arcValueMultiplier = 360/maxAnimationSpeed.floatValue;
             var arcValue = easeCurveValue * arcValueMultiplier;
             var handleSize = HandleUtility.GetHandleSize(nodePosition);
             var arcRadius = handleSize*ArcHandleRadius;

             // TODO Create const.
-            Handles.color = Color.red;
+            Handles.color = handleColor;

             Handles.DrawWireArc(
                 nodePosition,
                 Vector3.up,
-                // Make the arc simetrical on the left and right side of
-                // the object.
                 Quaternion.AngleAxis(
                     0,
                     Vector3.up)*Vector3.forward,
@@ -334,7 +340,7 @@
                 arcRadius);

             // TODO Create const.
-            Handles.color = Color.red;
+            Handles.color = handleColor;

             // Set initial arc value to other than zero. If initial value
             // is zero, handle will always return zero.
@@ -352,8 +358,10 @@
                 1);

             // Limit handle value.
-            if (newArcValue > 360) newArcValue = 360;
-            if (newArcValue < 0) newArcValue = 0;
+            //if (newArcValue > 360) newArcValue = 360;
+            //if (newArcValue < 0) newArcValue = 0;
+            if (newArcValue > maxDegrees) newArcValue = maxDegrees;
+            if (newArcValue < minDegrees) newArcValue = minDegrees;

             // TODO Create float precision const.
             if (Math.Abs(newArcValue - arcValue) > 0.001f) {
@@ -442,73 +450,81 @@

         // TODO Extract methods. Do the same to ease curve drawing method.
         private void DrawTiltingHandles(Action<int, float> callback) {
-            // Get AnimationPathBuilder node positions.
+            // Get path node positions.
             var nodePositions = script.AnimationPathBuilder.GetNodePositions();

-            // Get rotation curve timestamps.
-            //var easeTimestamps = new float[script.EaseCurve.length];
-            //for (var i = 0; i < script.EaseCurve.length; i++) {
-            //    easeTimestamps[i] = script.EaseCurve.keys[i].time;
-            //}
-
-            // Get rotation curve values.
+            // Get tilting curve values.
             var tiltingCurveValues = new float[script.EaseCurve.length];
             for (var i = 0; i < script.TiltingCurve.length; i++) {
                 tiltingCurveValues[i] = script.TiltingCurve.keys[i].value;
             }

+            var arcValueMultiplier = 1;
+
             // For each path node..
             for (var i = 0; i < nodePositions.Length; i++) {
-                var rotationValue = tiltingCurveValues[i];
-                //var arcValue = rotationValue * 2;
-                var arcValue = rotationValue;
-                var handleSize = HandleUtility.GetHandleSize(nodePositions[i]);
-                var arcHandleSize = handleSize * ArcHandleRadius;
-
-                // TODO Create const.
-                Handles.color = tiltingHandleColor;
-
-                Handles.DrawWireArc(
+                DrawArcHandle(
+                    tiltingCurveValues[i],
                     nodePositions[i],
-                    Vector3.up,
-                    // Make the arc simetrical on the left and right side of
-                    // the object.
-                    Quaternion.AngleAxis(
-                    //-arcValue / 2,
-                        0,
-                        Vector3.up) * Vector3.forward,
-                    arcValue,
-                    arcHandleSize);
-
-                // TODO Create const.
-                Handles.color = tiltingHandleColor;
-
-                // TODO Create constant.
-                var scaleHandleSize = handleSize * 1.5f;
-
-                // Set initial arc value to other than zero. If initial value
-                // is zero, handle will always return zero.
-                arcValue = Math.Abs(arcValue) < 0.001f ? 15f : arcValue;
-
-                float newArcValue = Handles.ScaleValueHandle(
-                    arcValue,
-                    nodePositions[i] + Vector3.forward * arcHandleSize
-                        * 1.3f,
-                    Quaternion.identity,
-                    scaleHandleSize,
-                    Handles.ConeCap,
-                    1);
-
-                // Limit handle value.
-                if (newArcValue > 90) newArcValue = 90;
-                if (newArcValue < -90) newArcValue = -90;
-
-                // TODO Create float precision const.
-                if (Math.Abs(newArcValue - arcValue) > 0.001f) {
-                    // Execute callback.
-                    callback(i, newArcValue);
-                }
-            }
+                    arcValueMultiplier,
+                    -90,
+                    90,
+                    Color.green,
+                    (value) => callback(i, value));
+            }
+
+            //// For each path node..
+            //for (var i = 0; i < nodePositions.Length; i++) {
+            //    var rotationValue = tiltingCurveValues[i];
+            //    //var arcValue = rotationValue * 2;
+            //    var arcValue = rotationValue;
+            //    var handleSize = HandleUtility.GetHandleSize(nodePositions[i]);
+            //    var arcHandleSize = handleSize * ArcHandleRadius;
+
+            //    // TODO Create const.
+            //    Handles.color = tiltingHandleColor;
+
+            //    Handles.DrawWireArc(
+            //        nodePositions[i],
+            //        Vector3.up,
+            //        // Make the arc simetrical on the left and right side of
+            //        // the object.
+            //        Quaternion.AngleAxis(
+            //        //-arcValue / 2,
+            //            0,
+            //            Vector3.up) * Vector3.forward,
+            //        arcValue,
+            //        arcHandleSize);
+
+            //    // TODO Create const.
+            //    Handles.color = tiltingHandleColor;
+
+            //    // TODO Create constant.
+            //    var scaleHandleSize = handleSize * 1.5f;
+
+            //    // Set initial arc value to other than zero. If initial value
+            //    // is zero, handle will always return zero.
+            //    arcValue = Math.Abs(arcValue) < 0.001f ? 15f : arcValue;
+
+            //    float newArcValue = Handles.ScaleValueHandle(
+            //        arcValue,
+            //        nodePositions[i] + Vector3.forward * arcHandleSize
+            //            * 1.3f,
+            //        Quaternion.identity,
+            //        scaleHandleSize,
+            //        Handles.ConeCap,
+            //        1);
+
+            //    // Limit handle value.
+            //    if (newArcValue > 90) newArcValue = 90;
+            //    if (newArcValue < -90) newArcValue = -90;
+
+            //    // TODO Create float precision const.
+            //    if (Math.Abs(newArcValue - arcValue) > 0.001f) {
+            //        // Execute callback.
+            //        callback(i, newArcValue);
+            //    }
+            //}
         }
         #endregion DRAWING METHODS


fixed zh-cn suffix display

fixed zh-cn suffix display

--- MomentSharp/Globalization/Languages/ZhCn.cs
+++ MomentSharp/Globalization/Languages/ZhCn.cs
@@ -104,7 +104,7 @@
                     results = string.Format("{0} 年", number);
                     break;
             }
-            return !showSuffix ? results : string.Format(isFuture ? "{0} 内" : "{0} 前", results);
+            return !showSuffix ? results : string.Format(isFuture ? "{0}内" : "{0}前", results);
         }
     }
 }


Trace log brokerage setup handler steps

Trace log brokerage setup handler steps

This is a fairly large function and we don't get stack traces when
we run through mono, so this is pretty necessary when a general ex
is thrown and caught within this block

--- Engine/Setup/BrokerageSetupHandler.cs
+++ Engine/Setup/BrokerageSetupHandler.cs
@@ -224,6 +224,7 @@
                 algorithm.Transactions.SetOrderProcessor(transactionHandler);
                 algorithm.PostInitialize();

+                Log.Trace("BrokerageSetupHander.Setup(): Connecting to brokerage...");
                 try
                 {
                     // this can fail for various reasons, such as already being logged in somewhere else
@@ -244,6 +245,7 @@
                     return false;
                 }

+                Log.Trace("BrokerageSetupHander.Setup(): Fetching cash balance from brokerage...");
                 try
                 {
                     // set the algorithm's cash balance for each currency
@@ -261,6 +263,7 @@
                     return false;
                 }

+                Log.Trace("BrokerageSetupHander.Setup(): Fetching open orders from brokerage...");
                 try
                 {
                     // populate the algorithm with the account's outstanding orders
@@ -280,6 +283,7 @@
                     return false;
                 }

+                Log.Trace("BrokerageSetupHander.Setup(): Fetching holdings from brokerage...");
                 try
                 {
                     // populate the algorithm with the account's current holdings
@@ -329,6 +333,8 @@
                     return false;
                 }

+                Log.Trace("BrokerageSetupHander.Setup(): Ensuring currency data feeds present...");
+
                 // call this after we've initialized everything from the brokerage since we may have added some holdings/currencies
                 algorithm.Portfolio.CashBook.EnsureCurrencyDataFeeds(algorithm.Securities, algorithm.SubscriptionManager, SecurityExchangeHoursProvider.FromDataFolder());


Fix typos in parameter names of built-in functions

--- NQuery.Language/Runtime/BuiltInFunctions.cs
+++ NQuery.Language/Runtime/BuiltInFunctions.cs
@@ -91,8 +91,8 @@
                 new FunctionSymbol<object, string, string>("FORMAT", "value", "format", Format),
                 new FunctionSymbol<string, int, string>("REPLICATE", "text", "count", Replicate),
                 new FunctionSymbol<string, string>("REVERSE", "text", Reverse),
-                new FunctionSymbol<string, int, string>("LEFT", "text", "numbeOfChar", Left),
-                new FunctionSymbol<string, int, string>("RIGHT", "text", "numbeOfChar", Right),
+                new FunctionSymbol<string, int, string>("LEFT", "text", "numberOfChars", Left),
+                new FunctionSymbol<string, int, string>("RIGHT", "text", "numberOfChars", Right),
                 new FunctionSymbol<int, string>("SPACE", "numberOfSpaces", Space),
                 new FunctionSymbol<string, int, string>("LPAD", "text", "totalWidth", LPad),
                 new FunctionSymbol<string, int, string>("RPAD", "text", "totalWidth", RPad),


Bump version to 2.4.0.0

Bump version to 2.4.0.0

--- Files/Packaging/GlobalAssemblyInfo.cs
+++ Files/Packaging/GlobalAssemblyInfo.cs
@@ -14,8 +14,8 @@
 // Find what: ((AssemblyVersion|AssemblyFileVersion)\s*\(\s*@?\")(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)\.(?<build>[0-9]+)(\"\s*\))
 // Replace with: $1$3.$4.$5.\%build.number%$7

-[assembly: AssemblyVersion("2.3.8.0")]
-[assembly: AssemblyFileVersion("2.3.8.0")]
+[assembly: AssemblyVersion("2.4.0.0")]
+[assembly: AssemblyFileVersion("2.4.0.0")]

 // TeamCity File Content Replacer: Add VCS hash
 // Look in: */Packaging/GlobalAssemblyInfo.cs


Bug fix for Insert method.

Bug fix for Insert method.

--- src/core/BrightstarDB/Storage/BPlusTreeStore/DirectLeafNode.cs
+++ src/core/BrightstarDB/Storage/BPlusTreeStore/DirectLeafNode.cs
@@ -178,6 +178,7 @@
                         Array.Copy(value, 0,
                             _nodeData, ValueOffset(insertIndex),
                             Math.Min(value.Length, _config.ValueSize));
+                        return;
                     }
                     throw new DuplicateKeyException();
                 }


Ignored tests until https://github.com/DbUp/DbUp/issues/309 is fixed

--- src/dbup-tests/ScriptProvider/FileSystemScriptProviderTests.cs
+++ src/dbup-tests/ScriptProvider/FileSystemScriptProviderTests.cs
@@ -160,7 +160,7 @@
                 }
             }

-            [Then]
+            [Then(Skip = "The script names should include the folder")]
             public void the_files_should_be_correctly_ordered_with_subdirectory_order()
             {
                 filesToExecute.ElementAt(0).Name.ShouldEndWith("Script20110301_1_Test1.sql");


Fix to avoid SA1602

Fix to avoid SA1602

--- Common/Constants.cs
+++ Common/Constants.cs
@@ -13,7 +13,14 @@
     /// </summary>
     public enum Revision
     {
+        /// <summary>
+        /// Revision 1.
+        /// </summary>
         Rev1 = 1,
+
+        /// <summary>
+        /// Revision 2.
+        /// </summary>
         Rev2
     }

@@ -22,13 +29,44 @@
     /// </summary>
     public enum ErrorCode
     {
+        /// <summary>
+        /// The function is not implemented.
+        /// </summary>
         NoFunction = -1,
+
+        /// <summary>
+        /// Finished successfully.
+        /// </summary>
         AllRight,
+
+        /// <summary>
+        /// The format is not supported.
+        /// </summary>
         NotSupport,
+
+        /// <summary>
+        /// An error occurred while reading a file.
+        /// </summary>
         FileReadError,
+
+        /// <summary>
+        /// An error occurred while writing a file.
+        /// </summary>
         FileWriteError,
+
+        /// <summary>
+        /// Could not allocate memory.
+        /// </summary>
         NoMemory,
+
+        /// <summary>
+        /// An unknown error occurred.
+        /// </summary>
         UnknownError,
+
+        /// <summary>
+        /// Cancelled in the edit/config dialog.
+        /// </summary>
         DialogCanceled
     }

@@ -37,8 +75,22 @@
     /// </summary>
     public enum TextAlign
     {
+        /// <summary>
+        /// Text is left-aligned.
+        /// <remarks>The value must be equal to <c>LCVFMT_LEFT</c> of Win32 API.</remarks>
+        /// </summary>
         Left = 0,
+
+        /// <summary>
+        /// Text is right-aligned.
+        /// <remarks>The value must be equal to <c>LCVFMT_RIGHT</c> of Win32 API.</remarks>
+        /// </summary>
         Right,
+
+        /// <summary>
+        /// Text is centered.
+        /// <remarks>The value must be equal to <c>LCVFMT_CENTER</c> of Win32 API.</remarks>
+        /// </summary>
         Center
     }

@@ -47,9 +99,24 @@
     /// </summary>
     public enum SortType
     {
+        /// <summary>
+        /// String sort.
+        /// </summary>
         String = 0,
+
+        /// <summary>
+        /// Integer sort.
+        /// </summary>
         Number,
+
+        /// <summary>
+        /// Floating point sort.
+        /// </summary>
         Float,
+
+        /// <summary>
+        /// Hexadecimal sort.
+        /// </summary>
         Hex
     }

@@ -58,14 +125,49 @@
     /// </summary>
     public enum SystemInfoType
     {
+        /// <summary>
+        /// Not any system information.
+        /// </summary>
         String = 0,
+
+        /// <summary>
+        /// The file path.
+        /// </summary>
         Path,
+
+        /// <summary>
+        /// The directory path.
+        /// </summary>
         Directory,
+
+        /// <summary>
+        /// The filename except the extension.
+        /// </summary>
         Title,
+
+        /// <summary>
+        /// The filename extension.
+        /// </summary>
         Extension,
+
+        /// <summary>
+        /// Create time of the file.
+        /// </summary>
         CreateTime,
+
+        /// <summary>
+        /// Last access time of the file.
+        /// </summary>
         LastAccessTime,
+
+        /// <summary>
+        /// Last write time of the file.
+        /// </summary>
         LastWriteTime,
+
+        /// <summary>
+        /// File size (in bytes).
+        /// </summary>
         FileSize
     }


Handled create/write of file persisted disk better

- Possible fix for #19 + #22

--- LocalStorage/LocalStorage.cs
+++ LocalStorage/LocalStorage.cs
@@ -171,10 +171,18 @@
             var serialized = JsonConvert.SerializeObject(Storage, Formatting.Indented);

             using (var fileStream = new FileStream(FileHelpers.GetLocalStoreFilePath(_config.Filename), FileMode.OpenOrCreate, FileAccess.Write))
+            var writemode = File.Exists(FileHelpers.GetLocalStoreFilePath(_config.Filename))
+                ? FileMode.Truncate
+                : FileMode.Create;
             {
-                using (var writer = new StreamWriter(fileStream))
+                using (var fileStream = new FileStream(FileHelpers.GetLocalStoreFilePath(_config.Filename),
+                    mode: writemode,
+                    access: FileAccess.Write))
                 {
-                    writer.Write(serialized);
+                    using (var writer = new StreamWriter(fileStream))
+                    {
+                        writer.Write(serialized);
+                    }
                 }
             }
         }


Change PGSQLUserProfilesData.UpdateUserPreferences() to directly pass the UUID to the uuid parameter instead of its ToString()

This may well be the cause behind "operator does not exist: uuid = character varying" pgsql errors.
If so, the other instances will also be changed.
Relates to http://opensimulator.org/mantis/view.php?id=7398

--- OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
+++ OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
@@ -943,7 +943,7 @@
                         cmd.Parameters.Add(m_database.CreateParameter("ImViaEmail", pref.IMViaEmail.ToString().ToLower ()));
                         cmd.Parameters.Add(m_database.CreateParameter("Visible", pref.Visible.ToString().ToLower ()));
                         cmd.Parameters.Add(m_database.CreateParameter("EMail", pref.EMail.ToString().ToLower ()));
-                        cmd.Parameters.Add(m_database.CreateParameter("uuid", pref.UserId.ToString()));
+                        cmd.Parameters.Add(m_database.CreateParameter("uuid", pref.UserId));

                         cmd.ExecuteNonQuery();
                     }


GridService - Region UUID can not be NULL

http://opensimulator.org/mantis/view.php?id=3426

--- OpenSim/Services/GridService/GridService.cs
+++ OpenSim/Services/GridService/GridService.cs
@@ -107,6 +107,8 @@
         public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
         {
             IConfig gridConfig = m_config.Configs["GridService"];
+            // First Check for invalidate NULL-UUID, if true fast quit
+            if (regionInfos.RegionID == UUID.Zero) return "Invalidate RegionID - can not be UUID-NULL";
             // This needs better sanity testing. What if regionInfo is registering in
             // overlapping coords?
             RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);


Added a raw route output.

Added a raw route output.

--- OsmSharp.Logistics.Routing/TSP/TSPRouter.cs
+++ OsmSharp.Logistics.Routing/TSP/TSPRouter.cs
@@ -175,6 +175,17 @@
         }

         /// <summary>
+        /// Gets the raw route representing the order of the locations.
+        /// </summary>
+        public OsmSharp.Logistics.Routes.IRoute RawRoute
+        {
+            get
+            {
+                return _route;
+            }
+        }
+
+        /// <summary>
         /// Builds the resulting route.
         /// </summary>
         /// <returns></returns>


Fixed Dispose of the ImageManager.

Fixed Dispose of the ImageManager.

--- MagickViewer/ImageManager.cs
+++ MagickViewer/ImageManager.cs
@@ -42,7 +42,7 @@

     private void ConstructImages()
     {
-      Dispose();
+      DisposeImages();

       _Images = new MagickImageCollection();
       _Index = 0;
@@ -64,6 +64,24 @@
       return filter;
     }

+    private void DisposeImages()
+    {
+      if (_Images == null)
+        return;
+
+      _Images.Dispose();
+      _Images = null;
+    }
+
+    private void DisposeWatcher()
+    {
+      if (_Watcher != null)
+      {
+        _Watcher.Dispose();
+        _Watcher = null;
+      }
+    }
+
     private void Initialize()
     {
       _ImageIterator = new ImageIterator();
@@ -231,17 +249,8 @@

     public void Dispose()
     {
-      if (_Images != null)
-      {
-        _Images.Dispose();
-        _Images = null;
-      }
-
-      if (_Watcher != null)
-      {
-        _Watcher.Dispose();
-        _Watcher = null;
-      }
+      DisposeImages();
+      DisposeWatcher();
     }

     public static bool IsSupported(string fileName)


FileServer: Rewrite gc logic on change

FileServer: Rewrite gc logic on change

--- fsserver/Server.cs
+++ fsserver/Server.cs
@@ -5,6 +5,8 @@
 using System.Timers;
 using NMaier.sdlna.Server;
 using System.Threading.Tasks;
+using System.Text.RegularExpressions;
+using System.Runtime.CompilerServices;

 namespace NMaier.sdlna.FileMediaServer
 {
@@ -107,17 +109,30 @@
     private void DoRoot()
     {
       // Collect some garbage
-      var newPaths = new Dictionary<string, string>();
-      var newIds = new Dictionary<string, IMediaItem>();
-      foreach (var i in ids) {
-        if (i.Value is Files.BaseFile && !(i.Value as Files.BaseFile).Item.Exists) {
-          continue;
-        }
-        newIds.Add(i.Key, i.Value);
-        newPaths.Add((i.Value as IFileServerMediaItem).Path, i.Key);
-      }
-      paths = newPaths;
-      ids = newIds;
+      lock (ids) {
+        lock (paths) {
+          var newPaths = new Dictionary<string, string>();
+          var newIds = new Dictionary<string, IMediaItem>();
+          foreach (var i in ids) {
+            if (i.Value is Files.BaseFile && !(i.Value as Files.BaseFile).Item.Exists) {
+              continue;
+            }
+            try {
+              newIds.Add(i.Key, i.Value);
+              var path = (i.Value as IFileServerMediaItem).Path;
+              newPaths.Add(path, i.Key);
+            }
+            catch (Exception ex) {
+              Error(i.Key);
+              Error((i.Value as IFileServerMediaItem).Path);
+              Error(ex);
+              throw;
+            }
+          }
+          paths = newPaths;
+          ids = newIds;
+        }
+      }

       var newRoot = new Folders.PlainRootFolder(this, types, directory);
       foreach (var t in transformations) {
@@ -125,7 +140,9 @@
       }
       newRoot.Cleanup();
       newRoot.Sort(comparer, descending);
-      ids["0"] = root = newRoot;
+      lock (ids) {
+        ids["0"] = root = newRoot;
+      }
 #if DUMP_TREE
       using (var s = new FileStream("tree.dump", FileMode.Create, FileAccess.Write)) {
         using (var w = new StreamWriter(s)) {
@@ -191,10 +208,20 @@

     private void Rescan()
     {
-      DoRoot();
-
-      if (Changed != null) {
-        Changed(this, null);
+      lock (this) {
+        try {
+          InfoFormat("Rescanning...");
+          DoRoot();
+          InfoFormat("Done rescanning...");
+
+          if (Changed != null) {
+            InfoFormat("Notifying...");
+            Changed(this, null);
+          }
+        }
+        catch (Exception ex) {
+          Error(ex);
+        }
       }
     }


Fixed bug in SymbolStyle.Equals in comparing BitmapId

--- Mapsui/Styles/SymbolStyle.cs
+++ Mapsui/Styles/SymbolStyle.cs
@@ -101,8 +101,7 @@
                 return false;
             }

-
-            if (BitmapId == symbolStyle.BitmapId)
+            if (BitmapId != symbolStyle.BitmapId)
             {
                 return false;
             }


Missed a TextFixture attribute.

Missed a TextFixture attribute.

--- MemcachedTest/VBucketTest.cs
+++ MemcachedTest/VBucketTest.cs
@@ -9,6 +9,7 @@

 namespace MemcachedTest
 {
+	[TestFixture]
 	class VBucketTest
 	{
 		// copied from libvbucket


re-indent

re-indent

--- Mod_Lang_CHT/Mod_Lang_CHT.cs
+++ Mod_Lang_CHT/Mod_Lang_CHT.cs
@@ -55,7 +55,7 @@
                     Stream st = asm.GetManifestResourceStream(asm.GetName().Name+"."+locale_name+".locale");

 #if (DEBUG)
-                        DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("File size: {0}", st.Length));
+                    DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("File size: {0}", st.Length));
 #endif
                     String dst_path = "";
 #if (DEBUG)
@@ -95,18 +95,18 @@
                     for (int i = 0; i < locales.Length; i++)
                     {
 #if (DEBUG)
-                            DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("Locale index: {0}, ID: {1}", i, locales[i]));
+                        DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("Locale index: {0}, ID: {1}", i, locales[i]));
 #endif
                         if (locales[i].Equals(locale_name))
                         {
 #if (DEBUG)
-                                DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("Find locale {0} at index: {1}", locale_name, i));
+                            DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("Find locale {0} at index: {1}", locale_name, i));
 #endif
                             ColossalFramework.Globalization.LocaleManager.instance.LoadLocaleByIndex(i);
                         }
                     }
 #if (DEBUG)
-                        DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("Post Setting Language: {0}", ColossalFramework.Globalization.LocaleManager.defaultLanguage));
+                    DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("Post Setting Language: {0}", ColossalFramework.Globalization.LocaleManager.defaultLanguage));
 #endif
                 }
                 catch (Exception e)


public gameover

public gameover

--- PlanetProject/Assets/Scripts/GameManager.cs
+++ PlanetProject/Assets/Scripts/GameManager.cs
@@ -25,7 +25,7 @@
     public int Ressources {
         set {
             ressources = value;
-
+
             if(RessourcesChanged != null)
 				RessourcesChanged.Invoke();
         }
@@ -112,7 +112,7 @@
         }
 	}

-	private void RaiseGameOver() {
+	public void RaiseGameOver() {
 		if(GameOver != null) {
             GameOver.Invoke();
         }


StyledStringElement: don't crash if the cell doesn't have an image view. Fixes #5314.

--- MonoTouch.Dialog/Elements.cs
+++ MonoTouch.Dialog/Elements.cs
@@ -834,14 +834,16 @@
 			} else {
 				var imgView = cell.ImageView;
 				UIImage img;
-
-				if (extraInfo.Uri != null)
-					img = ImageLoader.DefaultRequestImage (extraInfo.Uri, this);
-				else if (extraInfo.Image != null)
-					img = extraInfo.Image;
-				else
-					img = null;
-				imgView.Image = img;
+
+				if (imgView != null) {
+					if (extraInfo.Uri != null)
+						img = ImageLoader.DefaultRequestImage (extraInfo.Uri, this);
+					else if (extraInfo.Image != null)
+						img = extraInfo.Image;
+					else
+						img = null;
+					imgView.Image = img;
+				}

 				if (cell.DetailTextLabel != null)
 					cell.DetailTextLabel.TextColor = extraInfo.DetailColor ?? UIColor.Gray;


Reuse MoreEnumerable.From in Acquire tests

--- MoreLinq.Test/AcquireTest.cs
+++ MoreLinq.Test/AcquireTest.cs
@@ -31,9 +31,9 @@
             Disposable b = null;
             Disposable c = null;

-            var allocators = Futures(() => a = new Disposable(),
-                                     () => b = new Disposable(),
-                                     () => c = new Disposable());
+            var allocators = MoreEnumerable.From(() => a = new Disposable(),
+                                                 () => b = new Disposable(),
+                                                 () => c = new Disposable());

             var disposables = allocators.Acquire();

@@ -53,10 +53,10 @@
             Disposable b = null;
             Disposable c = null;

-            var allocators = Futures(() => a = new Disposable(),
-                                     () => b = new Disposable(),
-                                     () => throw new ApplicationException(),
-                                     () => c = new Disposable());
+            var allocators = MoreEnumerable.From(() => a = new Disposable(),
+                                                 () => b = new Disposable(),
+                                                 () => throw new ApplicationException(),
+                                                 () => c = new Disposable());

             Assert.Throws<ApplicationException>(() => allocators.Acquire());

@@ -65,13 +65,6 @@
             Assert.That(b, Is.Not.Null);
             Assert.That(b.Disposed, Is.True);
             Assert.That(c, Is.Null);
-        }
-
-        static IEnumerable<T> Futures<T>(params Func<T>[] allocators)
-            where T : IDisposable
-        {
-            foreach (var allocator in allocators)
-                yield return allocator();
         }

         class Disposable : IDisposable


ticket:156
Axiom.Core.ObjectCreator.DynamicLoader.Find() now uses full type name of Axiom.Core.IPlugin
when scanning for plugins insteaf of just 'IPlugin' to avoid instantiating classes that
implement an 'IPlugin' other than Axiom.Core.IPlugin. Objects could cooincidentally define an
interface with the same "IPlugin" short type name, which is likely to happen if a client
application uses it's own plugin system.

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

--- Projects/Axiom/Engine/Core/ObjectCreator.cs
+++ Projects/Axiom/Engine/Core/ObjectCreator.cs
@@ -194,7 +194,7 @@
                 foreach ( Type type in assemblyTypes )
                 {
 #if !(XBOX || XBOX360 || SILVERLIGHT)
-                    if ( ( baseType.IsInterface && type.GetInterface( baseType.Name ) != null ) ||
+                    if ( ( baseType.IsInterface && type.GetInterface( baseType.FullName ) != null ) ||
                          ( !baseType.IsInterface && type.BaseType == baseType ) )
                     {
                         types.Add( new ObjectCreator( assembly, type ) );


Close #20: Use "Show more" button as a default control for pagination

--- R7.News.Stream/Components/StreamSettings.cs
+++ R7.News.Stream/Components/StreamSettings.cs
@@ -88,16 +88,14 @@
         [ModuleSetting (Prefix = SettingPrefix)]
         public int MaxStructuralWeight { get; set; }

-        #region Tab-specific module settings
+        [TabModuleSetting (Prefix = SettingPrefix)]
+        public bool UseShowMore { get; set; } = true;

         [TabModuleSetting (Prefix = SettingPrefix)]
-        public bool UseShowMore { get; set; } = false;
+        public bool ShowTopPager { get; set; } = false;

         [TabModuleSetting (Prefix = SettingPrefix)]
-        public bool ShowTopPager { get; set; } = true;
-
-        [TabModuleSetting (Prefix = SettingPrefix)]
-        public bool ShowBottomPager { get; set; } = true;
+        public bool ShowBottomPager { get; set; } = false;

         [TabModuleSetting (Prefix = SettingPrefix)]
         public int PageSize { get; set; } = 3;
@@ -107,8 +105,6 @@

         [TabModuleSetting (Prefix = SettingPrefix)]
         public int ThumbnailWidth { get; set; }
-
-        #endregion
     }
 }


Fix SocketReadLine  from previouse checkin

--- Renci.SshClient/Renci.SshNet/Session.NET.cs
+++ Renci.SshClient/Renci.SshNet/Session.NET.cs
@@ -17,7 +17,7 @@
     {
         private TraceSource _log =
 #if DEBUG
-            new TraceSource("SshNet.Logging", SourceLevels.All);
+ new TraceSource("SshNet.Logging", SourceLevels.All);
 #else
             new TraceSource("SshNet.Logging");
 #endif
@@ -53,7 +53,7 @@
             var encoding = new Renci.SshNet.Common.ASCIIEncoding();

             var line = new StringBuilder();
-            //  Read data 2 bytes at a time to find end of line and leave any unhandled information in the buffer to be processed later
+            //  Read data one byte at a time to find end of line and leave any unhandled information in the buffer to be processed later
             var buffer = new List<byte>();

             var data = new byte[1];
@@ -62,10 +62,14 @@
                 this._socket.Receive(data);

                 buffer.Add(data[0]);
+                Debug.WriteLine(data[0]);
             }
-            while (!(buffer.Count > 2 && buffer[buffer.Count - 1] == 0x0A && buffer[buffer.Count - 2] == 0x0D));
-
-            response = encoding.GetString(buffer.Take(buffer.Count - 2).ToArray());
+            while (!(buffer.Count > 2 && buffer[buffer.Count - 1] == 0x0A));
+
+            if (buffer[buffer.Count - 2] == 0x0D)
+                response = encoding.GetString(buffer.Take(buffer.Count - 2).ToArray());
+            else
+                response = encoding.GetString(buffer.Take(buffer.Count - 1).ToArray());
         }

         partial void SocketRead(int length, ref byte[] buffer)


minor: Add method doc to SynchronousRestObjectRequester.MakeRequest() methods

--- OpenSim/Framework/WebUtil.cs
+++ OpenSim/Framework/WebUtil.cs
@@ -1085,21 +1085,43 @@
         /// </summary>
         /// <param name="verb"></param>
         /// <param name="requestUrl"></param>
-        /// <param name="obj"> </param>
-        /// <returns></returns>
-        ///
-        /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
-        /// the request.  You'll want to make sure you deal with this as they're not uncommon</exception>
+        /// <param name="obj"></param>
+        /// <returns>
+        /// The response.  If there was an internal exception, then the default(TResponse) is returned.
+        /// </returns>
         public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
         {
             return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
         }

+        /// <summary>
+        /// Perform a synchronous REST request.
+        /// </summary>
+        /// <param name="verb"></param>
+        /// <param name="requestUrl"></param>
+        /// <param name="obj"></param>
+        /// <param name="pTimeout">Request timeout in milliseconds.</param>
+        /// <returns>
+        /// The response.  If there was an internal exception or the request timed out,
+        /// then the default(TResponse) is returned.
+        /// </returns>
         public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
         {
             return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0);
         }

+        /// <summary>
+        /// Perform a synchronous REST request.
+        /// </summary>
+        /// <param name="verb"></param>
+        /// <param name="requestUrl"></param>
+        /// <param name="obj"></param>
+        /// <param name="pTimeout">Request timeout in milliseconds.</param>
+        /// <param name="maxConnections"></param>
+        /// <returns>
+        /// The response.  If there was an internal exception or the request timed out,
+        /// then the default(TResponse) is returned.
+        /// </returns>
         public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
         {
             int reqnum = WebUtil.RequestNumber++;


disable g2p on mac

disable g2p on mac

--- OpenUtau.Core/Api/G2pPack.cs
+++ OpenUtau.Core/Api/G2pPack.cs
@@ -73,7 +73,10 @@
                     prepGrapheme(parts[0]),
                     parts[1].Split().Select(symbol => prepPhoneme(symbol))));
             var dict = builder.Build();
-            var session = new InferenceSession(g2pData);
+            InferenceSession session = null;
+            if (!OS.IsMacOS()) {
+                session = new InferenceSession(g2pData);
+            }
             return Tuple.Create((IG2p)dict, session);
         }

@@ -113,7 +116,7 @@

         protected string[] Predict(string grapheme) {
             Tensor<int> src = EncodeWord(grapheme);
-            if (src.Length == 0) {
+            if (src.Length == 0 || Session == null) {
                 return new string[0];
             }
             Tensor<int> tgt = new int[,] { { 2 } }.ToTensor();


Created a WalletManager to manage the user's wallets. Replace Create/Recover and Load methods to use it.

--- ControllersTests.cs
+++ ControllersTests.cs
@@ -6,6 +6,7 @@
 using Breeze.Wallet.Wrappers;
 using Breeze.Wallet;
 using Breeze.Wallet.Controllers;
+using Breeze.Wallet.Errors;
 using Breeze.Wallet.Models;

 namespace Breeze.Api.Tests
@@ -122,7 +123,7 @@

             // Assert
             mockWalletWrapper.VerifyAll();
-            var viewResult = Assert.IsType<ObjectResult>(result);
+            var viewResult = Assert.IsType<ErrorResult>(result);
             Assert.NotNull(viewResult);
             Assert.Equal(404, viewResult.StatusCode);
         }


added common method. it returns JObjects for partially deserialising Json to objects. it is used for addcheckin becouse of Foursquare API changes

--- Core/SharpSquare.cs
+++ Core/SharpSquare.cs
@@ -7,6 +7,7 @@
 using System.IO;
 using FourSquare.SharpSquare.Entities;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;

 namespace FourSquare.SharpSquare.Core
 {
@@ -196,6 +197,18 @@
             return fourSquareResponse;
         }

+		private JObject PostJObject(string endpoint, Dictionary<string, string> parameters)
+        {
+            string serializedParameters = "";
+            if (parameters != null)
+            {
+                serializedParameters = "&" + SerializeDictionary(parameters);
+            }
+
+			string json = Request(string.Format("{0}{1}?oauth_token={2}{3}&v={4}", apiUrl, endpoint, accessToken, serializedParameters, apiVersion), HttpMethod.POST);
+			return JObject.Parse(json);
+        }
+
         public string GetAuthenticateUrl(string redirectUri)
         {
             return string.Format("{0}?client_id={1}&response_type=code&redirect_uri={2}", authenticateUrl, clientId, redirectUri);
@@ -610,7 +623,8 @@
         /// </summary>
         public Checkin AddCheckin(Dictionary<string, string> parameters)
         {
-            return Post<Checkin>("/checkins/add", parameters).response["checkin"];
+	        JObject jObject = PostJObject("/checkins/add", parameters);
+	        return JsonConvert.DeserializeObject<Checkin>(jObject["response"]["checkin"].ToString());
         }

         /// <summary>


added a test for minifying, aggregating and saving css

--- RequestReduce.Facts/Reducer/ReducerFacts.cs
+++ RequestReduce.Facts/Reducer/ReducerFacts.cs
@@ -63,6 +63,18 @@
                 testable.Mock<IWebClientWrapper>().Verify(x => x.DownloadString("http://host/css2.css"), Times.Once());
             }

+            [Fact]
+            public void WillSaveMinifiedAggregatedCSS()
+            {
+                var testable = new TestableReducer();
+                testable.Mock<IWebClientWrapper>().Setup(x => x.DownloadString("http://host/css1.css")).Returns("css1");
+                testable.Mock<IWebClientWrapper>().Setup(x => x.DownloadString("http://host/css2.css")).Returns("css2");
+                testable.Mock<IMinifier>().Setup(x => x.Minify("css1css2")).Returns("min");
+
+                var result = testable.ClassUnderTest.Process("http://host/css1.css::http://host/css2.css");
+
+                testable.Mock<IFileWrapper>().Verify(x => x.Save("min", It.IsAny<string>()), Times.Once());
+            }

         }
     }


Fixing typo

Fixing typo

--- Rhino.Etl.Cmd/RhinoEtlCommandLineOptions.cs
+++ Rhino.Etl.Cmd/RhinoEtlCommandLineOptions.cs
@@ -10,7 +10,7 @@
         public string File;
         [Option("Process name", ShortForm = "p", MinOccurs = 0, MaxOccurs = 1)]
         public string Process;
-        [Option("Verbse logging", ShortForm = "v", MaxOccurs = 1)]
+        [Option("Verbose logging", ShortForm = "v", MaxOccurs = 1)]
         public bool Verbose = false;
     }
 }


Fin de l enigme avec corrections

Fin de l enigme avec corrections

--- EnigmaReferencer.cs
+++ EnigmaReferencer.cs
@@ -30,12 +30,12 @@

             enigmas.Add(new Enigma(new AppuieReponseEnigmaPanel(), "Appuie sur la réponse"));
             enigmas.Add(new Enigma(new BeatThemAllEnigmaPanel(), "Beat them all"));
-            enigmas.Add(new Enigma(new CombienDeSEnigmaPanel(), "Combien de s ?"));
             enigmas.Add(new Enigma(new BusEnigmaPanel(), "Sens du bus"));
             enigmas.Add(new Enigma(new CaseVideEnigmaPanel(), "Et ben non"));
             enigmas.Add(new Enigma(new CharadeEnigmaPanel(), "Charade"));
             enigmas.Add(new Enigma(new ClicRapideEnigmaPanel(), "Clic-rapide"));
             enigmas.Add(new Enigma(new CodeBarreEnigmaPanel(), "Le code barre"));
+            enigmas.Add(new Enigma(new CombienDeSEnigmaPanel(), "Combien de s ?"));
             enigmas.Add(new Enigma(new CoucheCouleurEnigmaPanel(), "Couche Couleur"));
             enigmas.Add(new Enigma(new DingbatEnigmaPanel(), "Jeu de mot"));
             enigmas.Add(new Enigma(new FruitsEnigmaPanel(), "Calcul"));


sqrt1

--- Eval/EvalProgram.cs
+++ Eval/EvalProgram.cs
@@ -88,5 +88,10 @@
         {
             Assert.AreEqual("Infinity", EvalExpression("1.0/0"));
         }
+        [Test]
+        public void Sqrt_Test()
+        {
+            Assert.AreEqual("1", EvalExpression("sqrt(1)"));
+        }
     }
 }


Added Android support, moved the touch handling into the canvas.

--- FN2D/FN2DControl.cs
+++ FN2D/FN2DControl.cs
@@ -1,6 +1,6 @@
 /*******************************************************************************
 *
-* Copyright (C) 2013 Frozen North Computing
+* Copyright (C) 2013-2014 Frozen North Computing
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
@@ -30,8 +30,12 @@
 #elif FN2D_IOS
 using MonoTouch.UIKit;
 using OpenTK.Graphics.ES11;
+using FN2DBitmap = MonoTouch.UIKit.UIImage;
 using MatrixMode = OpenTK.Graphics.ES11.All;
-using FN2DBitmap = MonoTouch.UIKit.UIImage;
+#elif FN2D_AND
+using OpenTK.Graphics.ES11;
+using FN2DBitmap = Android.Graphics.Bitmap;
+using MatrixMode = OpenTK.Graphics.ES11.All;
 #endif

 namespace FrozenNorth.OpenGL.FN2D
@@ -48,10 +52,9 @@
 		protected FN2DCanvas canvas;
 		protected FN2DControl parent = null;
 		protected Rectangle frame;
-		protected FN2DControlList controls = new FN2DControlList();
+		private FN2DControlList controls;
 		protected FN2DRectangle background = new FN2DRectangle();
 		protected FN2DImage backgroundImage = null;
-		protected FN2DMirroring mirroring = FN2DMirroring.None;
 		protected float zoom = 1;
 		protected float minZoom = 0.1f;
 		protected float maxZoom = 10;
@@ -78,6 +81,7 @@
 			{
 				throw new ArgumentNullException("FN2DControl: The canvas cannot be null.");
 			}
+			controls = new FN2DControlList(this);
 			this.canvas = canvas;
 			background.CornerRadius = cornerRadius;
 			background.TopColor = topColor;
@@ -205,17 +209,6 @@
 			PointF zoomBR = new PointF(bounds.Width + zoomOffset.Width, bounds.Height + zoomOffset.Height);
 			PointF panTL = new PointF(zoomTL.X - pan.Width, zoomTL.Y - pan.Height);
 			PointF panBR = new PointF(zoomBR.X - pan.Width, zoomBR.Y - pan.Height);
-
-			if ((Mirroring & FN2DMirroring.LeftRight) == FN2DMirroring.LeftRight)
-			{
-			}
-			if ((Mirroring & FN2DMirroring.UpDown) == FN2DMirroring.UpDown)
-			{
-			}
-			if (bounds.Width == 1024)
-			{
-				//Console.WriteLine("DrawBegin: " + bounds + " * " + zoom + "(" + zoomOffset + ") = " + zoomTL + "," + zoomBR + " + " + pan + " = " + panTL + "," + panBR);
-			}

 			// set the orthographic projection for the control
 			GL.Ortho(panTL.X, panBR.X, panBR.Y, panTL.Y, -1, 1);
@@ -312,6 +305,14 @@
 		}

 		/// <summary>
+		/// Gets the list of sub-controls.
+		/// </summary>
+		public FN2DControlList Controls
+		{
+			get { return controls; }
+		}
+
+		/// <summary>
 		/// Gets or sets the corner radius.
 		/// </summary>
 		public virtual int CornerRadius
@@ -397,19 +398,6 @@
 		public virtual FN2DImage BackgroundImageControl
 		{
 			get { return backgroundImage; }
-		}
-
-		/// <summary>
-		/// Gets or sets the mirroring.
-		/// </summary>
-		public virtual FN2DMirroring Mirroring
-		{
-			get { return mirroring; }
-			set
-			{
-				mirroring = value;
-				Refresh();
-			}
 		}

 		/// <summary>
@@ -775,7 +763,7 @@
 		public virtual bool Touching
 		{
 			get { return touching; }
-			internal set
+			set
 			{
 				touching = value;
 				canvas.TouchControl = touching ? this : null;
@@ -809,6 +797,7 @@
 		/// </summary>
 		public virtual void AfterMove()
 		{
+			canvas.IsDirty = true;
 		}

 		/// <summary>
@@ -832,11 +821,12 @@
 		}

 		/// <summary>
-		/// Gets the control that contains this control.
+		/// Gets or sets the control that contains this control.
 		/// </summary>
 		public virtual FN2DControl Parent
 		{
-			get { return parent;}
+			get { return parent; }
+			set { parent = value; }
 		}

 		/// <summary>
@@ -845,7 +835,6 @@
 		/// <param name="control">Control to be added.</param>
 		public virtual void Add(FN2DControl control)
 		{
-			control.parent = this;
 			controls.Add(control);
 		}

@@ -856,7 +845,6 @@
 		/// <param name="control">Control to be inserted.</param>
 		public virtual void Insert(int index, FN2DControl control)
 		{
-			control.parent = this;
 			controls.Insert(index, control);
 		}

@@ -865,16 +853,11 @@
 		/// </summary>
 		public virtual bool Remove(FN2DControl control)
 		{
-			bool result = controls.Remove(control);
-			if (result)
-			{
-				control.parent = null;
-			}
-			return result;
-		}
-
-		/// <summary>
-		/// Determines if a control is a sub-control if this control.
+			return controls.Remove(control);
+		}
+
+		/// <summary>
+		/// Determines if a control is a sub-control of this control.
 		/// </summary>
 		/// <param name="control">Control to look for in this control.</param>
 		/// <returns>True if found, false if not</returns>
@@ -891,92 +874,65 @@
 		}

 		/// <summary>
-		/// Called when a finger goes down on the control.
+		/// Gets the topmost sub-control that contains a specific location.
+		/// </summary>
+		/// <param name="location">Location to test.</param>
+		/// <returns>Topmost control if the location is within this control, null if not.</returns>
+		public virtual FN2DControl HitTest(Point location)
+		{
+			if (Visible && Enabled && TouchEnabled && Frame.Contains(location))
+			{
+				Point controlLocation = new Point(location.X - Frame.X, location.Y - Frame.Y);
+				for (int i = controls.Count - 1; i >= 0; i--)
+				{
+					FN2DControl hitControl = controls[i].HitTest(controlLocation);
+					if (hitControl != null)
+					{
+						location.X = controlLocation.X;
+						location.Y = controlLocation.Y;
+						return hitControl;
+					}
+				}
+				return this;
+			}
+			return null;
+		}
+
+		/// <summary>
+		/// Called when a touch down event occurs on the control.
 		/// </summary>
 		/// <param name="e">Touch event arguments.</param>
 		public virtual void TouchDown(FN2DTouchEventArgs e)
 		{
-			//Console.WriteLine("TouchDown: " + enabled + "   " + touchEnabled + "   " + e.Location + "   " + frame);
-			if (visible && enabled && touchEnabled)
-			{
-				for (int i = controls.Count - 1; i >= 0; i--)
-				{
-					FN2DControl control = controls[i];
-					if (control.Visible && control.Enabled && control.TouchEnabled && control.Frame.Contains(e.Location))
-					{
-						Point location = new Point(e.Location.X - control.Frame.X, e.Location.Y - control.Frame.Y);
-						control.TouchDown(new FN2DTouchEventArgs(location, e.Buttons));
-						break;
-					}
-				}
-			}
-		}
-
-		/// <summary>
-		/// Called when a finger moves over the control.
+		}
+
+		/// <summary>
+		/// Called when a touch move event occurs when this is the current touch control.
 		/// </summary>
 		/// <param name="e">Touch event arguments.</param>
 		public virtual void TouchMove(FN2DTouchEventArgs e)
 		{
-			//Console.WriteLine("TouchMove: " + enabled + "   " + touchEnabled + "   " + e.Location + "   " + frame);
-			if (canvas.TouchControl == null)
-			{
-				return;
-			}
-			foreach (FN2DControl control in controls)
-			{
-				if (control == canvas.TouchControl || control.Contains(canvas.TouchControl))
-				{
-					Point location = new Point(e.Location.X - control.Frame.X, e.Location.Y - control.Frame.Y);
-					control.TouchMove(new FN2DTouchEventArgs(location, e.Buttons));
-					break;
-				}
-			}
-		}
-
-		/// <summary>
-		/// Called when a finger goes up on the control.
+		}
+
+		/// <summary>
+		/// Called when a touch up event occurs when this is the current touch control.
 		/// </summary>
 		/// <param name="e">Touch event arguments.</param>
 		public virtual void TouchUp(FN2DTouchEventArgs e)
 		{
-			//Console.WriteLine("TouchUp: " + enabled + "   " + touchEnabled + "   " + e.Location + "   " + frame);
-			if (canvas.TouchControl == null)
-			{
-				return;
-			}
-			foreach (FN2DControl control in controls)
-			{
-				bool isTouchControl = control == canvas.TouchControl;
-				if (isTouchControl || control.Contains(canvas.TouchControl))
-				{
-					if (isTouchControl)
-					{
-						control.Touching = false;
-					}
-					Point location = new Point(e.Location.X - control.Frame.X, e.Location.Y - control.Frame.Y);
-					control.TouchUp(new FN2DTouchEventArgs(location, e.Buttons));
-					if (isTouchControl && control.Frame.Contains(e.Location) && control.Tapped != null)
-					{
-						control.Tapped(this, EventArgs.Empty);
-					}
-					break;
-				}
-			}
-		}
-
-		/// <summary>
-		/// Cancels any touch tracking that is in progress.
+			if (Tapped != null && Touching && e.Location.X >= 0 && e.Location.X < Frame.Width &&
+				e.Location.Y >= 0 && e.Location.Y < Frame.Height)
+			{
+				Tapped(this, EventArgs.Empty);
+			}
+		}
+
+		/// <summary>
+		/// Called when a touch cancel event occurs when this is the current touch control.
 		/// </summary>
 		/// <param name="e">Touch event arguments.</param>
 		public virtual void TouchCancel(FN2DTouchEventArgs e)
 		{
-			//Console.WriteLine("TouchCancel: " + touchEnabled + "   " + frame);
-			foreach (FN2DControl control in controls)
-			{
-				control.TouchCancel(e);
-			}
-			Touching = false;
 		}
 	}

@@ -985,6 +941,98 @@
 	/// </summary>
 	public class FN2DControlList : List<FN2DControl>
 	{
+		private FN2DControl owner;
+
+		public FN2DControlList(FN2DControl owner = null)
+		{
+			this.owner = owner;
+		}
+
+		public new void Add(FN2DControl control)
+		{
+			if (control != null && owner != null)
+			{
+				control.Parent = owner;
+			}
+			base.Add(control);
+		}
+
+		public new void AddRange(IEnumerable<FN2DControl> collection)
+		{
+			if (owner != null)
+			{
+				foreach (FN2DControl control in collection)
+				{
+					if (control != null)
+					{
+						control.Parent = owner;
+					}
+				}
+			}
+			base.AddRange(collection);
+		}
+
+		public new void Insert(int index, FN2DControl control)
+		{
+			if (control != null && owner != null)
+			{
+				control.Parent = owner;
+			}
+			base.Insert(index, control);
+		}
+
+		public new void InsertRange(int index, IEnumerable<FN2DControl> collection)
+		{
+			if (owner != null)
+			{
+				foreach (FN2DControl control in collection)
+				{
+					if (control != null)
+					{
+						control.Parent = owner;
+					}
+				}
+			}
+			base.InsertRange(index, collection);
+		}
+
+		public new bool Remove(FN2DControl control)
+		{
+			if (control != null)
+			{
+				control.Parent = null;
+			}
+			return base.Remove(control);
+		}
+
+		public new void RemoveAt(int index)
+		{
+			if (index >= 0 && index < Count)
+			{
+				this[index].Parent = null;
+			}
+			base.RemoveAt(index);
+		}
+
+		public new void RemoveRange(int index, int count)
+		{
+			int n = 0;
+			for (int i = index; i < Count && n < count; i++, n++)
+			{
+				this[i].Parent = null;
+			}
+			base.RemoveRange(index, count);
+		}
+
+		public new int RemoveAll(Predicate<FN2DControl> match)
+		{
+			foreach (FN2DControl control in this)
+			{
+				control.Parent = null;
+			}
+			return base.RemoveAll(match);
+		}
+
 		public virtual void BringToFront(FN2DControl control)
 		{
 			int i = IndexOf(control);
@@ -1004,40 +1052,31 @@
 				Insert(0, control);
 			}
 		}
-	}
-
-	[Flags]
-	public enum FN2DMirroring
-	{
-		None = 0x0000,
-		UpDown = 0x0001,
-		LeftRight = 0x0002,
-	}
-
-	[Flags]
-	public enum FN2DTouchButtons
-	{
-		None = 0x0000,
-		Left = 0x0001,
-		Middle = 0x0002,
-		Right = 0x0004
 	}

 	public class FN2DTouchEventArgs : EventArgs
 	{
 		public Point Location;
-		public FN2DTouchButtons Buttons;
-		public int NumFingers;
-
-		public FN2DTouchEventArgs(Point location, FN2DTouchButtons buttons)
-		{
-			Location = location;
-			Buttons = buttons;
+
+		public FN2DTouchEventArgs(int x, int y)
+		{
+			Location.X = x;
+			Location.Y = y;
+		}
+
+		public FN2DTouchEventArgs(Point location)
+			: this(location.X, location.Y)
+		{
+		}
+
+		public FN2DTouchEventArgs(PointF location)
+			: this((int)location.X, (int)location.Y)
+		{
 		}

 		public new static FN2DTouchEventArgs Empty
 		{
-			get { return new FN2DTouchEventArgs(Point.Empty, FN2DTouchButtons.None); }
+			get { return new FN2DTouchEventArgs(Point.Empty); }
 		}
 	}
 }


Change UsePSCredentialType rule source encoding to UTF-8

--- Rules/UsePSCredentialType.cs
+++ Rules/UsePSCredentialType.cs
@@ -1,373 +1,186 @@
-//
-
-// Copyright (c) Microsoft Corporation.
-
-//
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-
-// THE SOFTWARE.
-
-//
-
-
-
-using System;
-
-using System.Reflection;
-
-using System.Linq;
-
-using System.Collections.Generic;
-
-using System.Management.Automation;
-
-using System.Management.Automation.Language;
-
-using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
-
-#if !CORECLR
-
-using System.ComponentModel.Composition;
-
-#endif
-
-using System.Globalization;
-
-
-
-namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
-
-{
-
-
-
-    /// <summary>
-
-    /// UsePSCredentialType: Checks if a parameter named Credential is of type PSCredential. Also checks if there is a credential transformation attribute defined after the PSCredential type attribute. The order between credential transformation attribute and PSCredential type attribute is applicable only to Poweshell 4.0 and earlier.
-
-    /// </summary>
-
-#if !CORECLR
-
-[Export(typeof(IScriptRule))]
-
-#endif
-
-    public class UsePSCredentialType : IScriptRule
-
-    {
-
-        /// <summary>
-
-        /// AnalyzeScript: Analyzes the ast to check if a parameter named Credential is of type PSCredential. Also checks if there is a credential transformation attribute defined after the PSCredential type attribute. The order between the credential transformation attribute and PSCredential type attribute is applicable only to Poweshell 4.0 and earlier.
-
-        /// </summary>
-
-        /// <param name="ast">The script's ast</param>
-
-        /// <param name="fileName">The script's file name</param>
-
-        /// <returns>A List of diagnostic results of this rule</returns>
-
-        public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
-
-        {
-
-            if (ast == null) throw new ArgumentNullException(Strings.NullAstErrorMessage);
-
-
-
-            var sbAst = ast as ScriptBlockAst;
-
-            if (sbAst != null
-
-                    && sbAst.ScriptRequirements != null
-
-                    && sbAst.ScriptRequirements.RequiredPSVersion != null
-
-                    && sbAst.ScriptRequirements.RequiredPSVersion.Major == 5)
-
-            {
-
-                    yield break;
-
-            }
-
-
-
-            IEnumerable<Ast> funcDefAsts = ast.FindAll(testAst => testAst is FunctionDefinitionAst, true);
-
-            IEnumerable<Ast> scriptBlockAsts = ast.FindAll(testAst => testAst is ScriptBlockAst, true);
-
-
-
-            string funcName;
-
-
-
-            foreach (FunctionDefinitionAst funcDefAst in funcDefAsts)
-
-            {
-
-                funcName = funcDefAst.Name;
-
-
-
-                if (funcDefAst.Parameters != null)
-
-                {
-
-                    foreach (ParameterAst parameter in funcDefAst.Parameters)
-
-                    {
-
-                        if (WrongCredentialUsage(parameter))
-
-                        {
-
-                            yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeError, funcName), funcDefAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
-
-                        }
-
-                    }
-
-                }
-
-
-
-                if (funcDefAst.Body.ParamBlock != null)
-
-                {
-
-                    foreach (ParameterAst parameter in funcDefAst.Body.ParamBlock.Parameters)
-
-                    {
-
-                        if (WrongCredentialUsage(parameter))
-
-                        {
-
-                            yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeError, funcName), funcDefAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
-
-                        }
-
-                    }
-
-                }
-
-            }
-
-
-
-            foreach (ScriptBlockAst scriptBlockAst in scriptBlockAsts)
-
-            {
-
-                // check for the case where it's parent is function, in that case we already processed above
-
-                if (scriptBlockAst.Parent != null && scriptBlockAst.Parent is FunctionDefinitionAst)
-
-                {
-
-                    continue;
-
-                }
-
-
-
-                if (scriptBlockAst.ParamBlock != null && scriptBlockAst.ParamBlock.Parameters != null)
-
-                {
-
-                    foreach (ParameterAst parameter in scriptBlockAst.ParamBlock.Parameters)
-
-                    {
-
-                        if (WrongCredentialUsage(parameter))
-
-                        {
-
-                            yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeErrorSB), scriptBlockAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
-
-                        }
-
-                    }
-
-                }
-
-            }
-
-        }
-
-
-
-        private bool WrongCredentialUsage(ParameterAst parameter)
-
-        {
-
-            if (parameter.Name.VariablePath.UserPath.Equals("Credential", StringComparison.OrdinalIgnoreCase))
-
-            {
-
-                var psCredentialType = parameter.Attributes.FirstOrDefault(paramAttribute => (paramAttribute.TypeName.IsArray && (paramAttribute.TypeName as ArrayTypeName).ElementType.GetReflectionType() == typeof(PSCredential))
-
-                    || paramAttribute.TypeName.GetReflectionType() == typeof(PSCredential));
-
-
-
-                var credentialAttribute = parameter.Attributes.FirstOrDefault(paramAttribute => paramAttribute.TypeName.GetReflectionType() == typeof(CredentialAttribute));
-
-
-
-                // check that both exists and pscredentialtype comes before credential attribute
-
-                if (psCredentialType != null && credentialAttribute != null && psCredentialType.Extent.EndOffset < credentialAttribute.Extent.StartOffset)
-
-                {
-
-                    return false;
-
-                }
-
-
-
-                return true;
-
-            }
-
-
-
-            return false;
-
-        }
-
-
-
-        /// <summary>
-
-        /// GetName: Retrieves the name of this rule.
-
-        /// </summary>
-
-        /// <returns>The name of this rule</returns>
-
-        public string GetName()
-
-        {
-
-            return string.Format(CultureInfo.CurrentCulture, Strings.NameSpaceFormat, GetSourceName(), Strings.UsePSCredentialTypeName);
-
-        }
-
-
-
-        /// <summary>
-
-        /// GetCommonName: Retrieves the common name of this rule.
-
-        /// </summary>
-
-        /// <returns>The common name of this rule</returns>
-
-        public string GetCommonName()
-
-        {
-
-            return string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeCommonName);
-
-        }
-
-
-
-        /// <summary>
-
-        /// GetDescription: Retrieves the description of this rule.
-
-        /// </summary>
-
-        /// <returns>The description of this rule</returns>
-
-        public string GetDescription()
-
-        {
-
-            return string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeDescription);
-
-        }
-
-
-
-        /// <summary>
-
-        /// GetSourceType: Retrieves the type of the rule: builtin, managed or module.
-
-        /// </summary>
-
-        public SourceType GetSourceType()
-
-        {
-
-            return SourceType.Builtin;
-
-        }
-
-
-
-        /// <summary>
-
-        /// GetSeverity: Retrieves the severity of the rule: error, warning of information.
-
-        /// </summary>
-
-        /// <returns></returns>
-
-        public RuleSeverity GetSeverity()
-
-        {
-
-            return RuleSeverity.Warning;
-
-        }
-
-
-
-        /// <summary>
-
-        /// GetSourceName: Retrieves the module/assembly name the rule is from.
-
-        /// </summary>
-
-        public string GetSourceName()
-
-        {
-
-            return string.Format(CultureInfo.CurrentCulture, Strings.SourceName);
-
-        }
-
-    }
-
-
-
-}
-
-
-
-
-
-
-
-
-
-+//
+// Copyright (c) Microsoft Corporation.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Linq;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Management.Automation.Language;
+using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
+#if !CORECLR
+using System.ComponentModel.Composition;
+#endif
+using System.Globalization;
+
+namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
+{
+
+    /// <summary>
+    /// UsePSCredentialType: Checks if a parameter named Credential is of type PSCredential. Also checks if there is a credential transformation attribute defined after the PSCredential type attribute. The order between credential transformation attribute and PSCredential type attribute is applicable only to Poweshell 4.0 and earlier.
+    /// </summary>
+#if !CORECLR
+[Export(typeof(IScriptRule))]
+#endif
+    public class UsePSCredentialType : IScriptRule
+    {
+        /// <summary>
+        /// AnalyzeScript: Analyzes the ast to check if a parameter named Credential is of type PSCredential. Also checks if there is a credential transformation attribute defined after the PSCredential type attribute. The order between the credential transformation attribute and PSCredential type attribute is applicable only to Poweshell 4.0 and earlier.
+        /// </summary>
+        /// <param name="ast">The script's ast</param>
+        /// <param name="fileName">The script's file name</param>
+        /// <returns>A List of diagnostic results of this rule</returns>
+        public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
+        {
+            if (ast == null) throw new ArgumentNullException(Strings.NullAstErrorMessage);
+
+            var sbAst = ast as ScriptBlockAst;
+            if (sbAst != null
+                    && sbAst.ScriptRequirements != null
+                    && sbAst.ScriptRequirements.RequiredPSVersion != null
+                    && sbAst.ScriptRequirements.RequiredPSVersion.Major == 5)
+            {
+                    yield break;
+            }
+
+            IEnumerable<Ast> funcDefAsts = ast.FindAll(testAst => testAst is FunctionDefinitionAst, true);
+            IEnumerable<Ast> scriptBlockAsts = ast.FindAll(testAst => testAst is ScriptBlockAst, true);
+
+            string funcName;
+
+            foreach (FunctionDefinitionAst funcDefAst in funcDefAsts)
+            {
+                funcName = funcDefAst.Name;
+
+                if (funcDefAst.Parameters != null)
+                {
+                    foreach (ParameterAst parameter in funcDefAst.Parameters)
+                    {
+                        if (WrongCredentialUsage(parameter))
+                        {
+                            yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeError, funcName), funcDefAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
+                        }
+                    }
+                }
+
+                if (funcDefAst.Body.ParamBlock != null)
+                {
+                    foreach (ParameterAst parameter in funcDefAst.Body.ParamBlock.Parameters)
+                    {
+                        if (WrongCredentialUsage(parameter))
+                        {
+                            yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeError, funcName), funcDefAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
+                        }
+                    }
+                }
+            }
+
+            foreach (ScriptBlockAst scriptBlockAst in scriptBlockAsts)
+            {
+                // check for the case where it's parent is function, in that case we already processed above
+                if (scriptBlockAst.Parent != null && scriptBlockAst.Parent is FunctionDefinitionAst)
+                {
+                    continue;
+                }
+
+                if (scriptBlockAst.ParamBlock != null && scriptBlockAst.ParamBlock.Parameters != null)
+                {
+                    foreach (ParameterAst parameter in scriptBlockAst.ParamBlock.Parameters)
+                    {
+                        if (WrongCredentialUsage(parameter))
+                        {
+                            yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeErrorSB), scriptBlockAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
+                        }
+                    }
+                }
+            }
+        }
+
+        private bool WrongCredentialUsage(ParameterAst parameter)
+        {
+            if (parameter.Name.VariablePath.UserPath.Equals("Credential", StringComparison.OrdinalIgnoreCase))
+            {
+                var psCredentialType = parameter.Attributes.FirstOrDefault(paramAttribute => (paramAttribute.TypeName.IsArray && (paramAttribute.TypeName as ArrayTypeName).ElementType.GetReflectionType() == typeof(PSCredential))
+                    || paramAttribute.TypeName.GetReflectionType() == typeof(PSCredential));
+
+                var credentialAttribute = parameter.Attributes.FirstOrDefault(paramAttribute => paramAttribute.TypeName.GetReflectionType() == typeof(CredentialAttribute));
+
+                // check that both exists and pscredentialtype comes before credential attribute
+                if (psCredentialType != null && credentialAttribute != null && psCredentialType.Extent.EndOffset < credentialAttribute.Extent.StartOffset)
+                {
+                    return false;
+                }
+
+                return true;
+            }
+
+            return false;
+        }
+
+        /// <summary>
+        /// GetName: Retrieves the name of this rule.
+        /// </summary>
+        /// <returns>The name of this rule</returns>
+        public string GetName()
+        {
+            return string.Format(CultureInfo.CurrentCulture, Strings.NameSpaceFormat, GetSourceName(), Strings.UsePSCredentialTypeName);
+        }
+
+        /// <summary>
+        /// GetCommonName: Retrieves the common name of this rule.
+        /// </summary>
+        /// <returns>The common name of this rule</returns>
+        public string GetCommonName()
+        {
+            return string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeCommonName);
+        }
+
+        /// <summary>
+        /// GetDescription: Retrieves the description of this rule.
+        /// </summary>
+        /// <returns>The description of this rule</returns>
+        public string GetDescription()
+        {
+            return string.Format(CultureInfo.CurrentCulture, Strings.UsePSCredentialTypeDescription);
+        }
+
+        /// <summary>
+        /// GetSourceType: Retrieves the type of the rule: builtin, managed or module.
+        /// </summary>
+        public SourceType GetSourceType()
+        {
+            return SourceType.Builtin;
+        }
+
+        /// <summary>
+        /// GetSeverity: Retrieves the severity of the rule: error, warning of information.
+        /// </summary>
+        /// <returns></returns>
+        public RuleSeverity GetSeverity()
+        {
+            return RuleSeverity.Warning;
+        }
+
+        /// <summary>
+        /// GetSourceName: Retrieves the module/assembly name the rule is from.
+        /// </summary>
+        public string GetSourceName()
+        {
+            return string.Format(CultureInfo.CurrentCulture, Strings.SourceName);
+        }
+    }
+
+}
+
+
+
+


Fix test case comment to reflect the actual test (#19531)

--- tests/src/JIT/Regression/JitBlue/GitHub_19454/Github_19454.cs
+++ tests/src/JIT/Regression/JitBlue/GitHub_19454/Github_19454.cs
@@ -2,9 +2,8 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 //
-// This test was extracted from the corefx System.Numerics.Vectors tests,
-// and was failing with minOpts because a SIMD12 was being spilled using
-// a 16-byte load, but only a 12-byte location had been allocated.
+// GitHub19454: a zero length span was tripping up the jit when trying
+// to analyze a bounds check.

 using System;


Fixed problem with the "More" menu item not updating when the UI locale changed

--- Glyssen/MainForm.cs
+++ Glyssen/MainForm.cs
@@ -68,12 +68,10 @@

 			Project.UpgradingProjectToNewParserVersion += UpgradingProjectToNewParserVersion;
 			Project.GetBadLdmlRecoveryAction += GetBadLdmlFileRecoveryAction;
-
-			SetupUiLanguageMenu();
+
 			Logger.WriteEvent($"Initial UI language: {Settings.Default.UserInterfaceLanguage}");

 			m_toolStrip.Renderer = new NoBorderToolStripRenderer();
-			m_uiLanguageMenu.ToolTipText = LocalizationManager.GetString("MainForm.UILanguage", "User-interface Language");

 			HandleStringsLocalized();
 			Program.RegisterLocalizable(this);
@@ -250,6 +248,7 @@
 			UpdateLocalizedText();
 			m_project?.ProjectCharacterVerseData.HandleStringsLocalized();
 			ControlCharacterVerseData.Singleton.HandleStringsLocalized();
+			SetupUiLanguageMenu();
 		}

 		private void RememberButtonFormats()
@@ -1010,8 +1009,8 @@
 			menu.Click += ((a, b) =>
 			{
 				Program.PrimaryLocalizationManager.ShowLocalizationDialogBox(false);
-				SetupUiLanguageMenu();
 			});
+			m_uiLanguageMenu.ToolTipText = LocalizationManager.GetString("MainForm.UILanguage", "User-interface Language");
 		}

 		private void Assign_Click(object sender, EventArgs e)


Spelling

Spelling

--- H3Control/H3Main.cs
+++ H3Control/H3Main.cs
@@ -101,19 +101,19 @@

             string baseUrl = "http://" + binding;

-            StringBuilder cfg = new StringBuilder("Configuration by command line:").AppendLine();
-            cfg.AppendLine("   * Url is " + baseUrl);
+            StringBuilder cfgInfo = new StringBuilder("Configuration by command line:").AppendLine();
+            cfgInfo.AppendLine("   * Url is " + baseUrl);

             if (H3WhiteListConfig.HasWhiteList)
-                cfg.AppendFormat("   * WHITE-list restriction(s) are activated: {0}", string.Join("; ", H3WhiteListConfig.WhiteList)).AppendLine();
+                cfgInfo.AppendFormat("   * WHITE-list restriction(s) are activated: {0}", string.Join("; ", H3WhiteListConfig.WhiteList)).AppendLine();
             else
-                cfg.AppendLine("   * Warning: white-list isn't specified, so ip restrictions are absent");
+                cfgInfo.AppendLine("   * WHITE-list isn't specified, so ip restrictions are absent");

             if (H3PasswordConfig.IsStricted)
-                cfg.AppendLine("   * Access to change a frequency IS RESTRICTED by a password");
+                cfgInfo.AppendLine("   * Access to change a frequency IS RESTRICTED by a password");

             if (DebugTraceListener.LogFolder != null)
-                cfg.AppendLine("   * Logs are located in " + DebugTraceListener.LogFolder);
+                cfgInfo.AppendLine("   * Logs are located in " + DebugTraceListener.LogFolder);

             DrunkActionExtentions.TryAndForget(() =>
             {
@@ -124,27 +124,27 @@
                 if (needAll)
                 {
                     if (!hasAny)
-                        cfg.AppendLine(notFoundMessage);
+                        cfgInfo.AppendLine(notFoundMessage);
                     else
                     {
-                        cfg.AppendLine("   * h3control http-server is binding to all these network adapters:");
+                        cfgInfo.AppendLine("   * h3control http-server is binding to all these network adapters:");
                         foreach (var k in info.Keys.OrderBy(x => x))
                         {
-                            cfg.AppendFormat("      - network '{0}': {1}", k, string.Join(", ", info[k]));
-                            cfg.AppendLine();
+                            cfgInfo.AppendFormat("      - network '{0}': {1}", k, string.Join(", ", info[k]));
+                            cfgInfo.AppendLine();
                         }
                     }
                 }
                 else
                 {
                     if (!hasAny)
-                        cfg.AppendLine(notFoundMessage);
+                        cfgInfo.AppendLine(notFoundMessage);
                 }
             });

-            Console.WriteLine(cfg);
-            NiceTrace.Message(cfg);
+            Console.WriteLine(cfgInfo);
+            NiceTrace.Message(cfgInfo);

             try
             {


Delete Select.outside.of.Profile.cs

Delete Select.outside.of.Profile.cs

--- Select.outside.of.Profile.cs
+++ Select.outside.of.Profile.cs
@@ -1,66 +0,0 @@
-//Synchronous template
-//-----------------------------------------------------------------------------------
-// PCB-Investigator Automation Script
-// Created on 14.10.2015
-// Autor Fabio Gruber
-//
-// Select all elements outside the board contour, e.g. to delete them.
-//-----------------------------------------------------------------------------------
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using PCBI.Plugin;
-using PCBI.Plugin.Interfaces;
-using System.Windows.Forms;
-using System.Drawing;
-using PCBI.Automation;
-using System.IO;
-using System.Drawing.Drawing2D;
-using PCBI.MathUtils;
-
-namespace PCBIScript
-{
-   public class PScript : IPCBIScript
-	{
-		public PScript()
-		{
-		}
-
- 		public void Execute(IPCBIWindow Parent)
-        {
-            IStep step = Parent.GetCurrentStep();
-            IMatrix matrix = Parent.GetMatrix();
-            if (step == null) return;
-            IODBObject profile = step.GetPCBOutlineAsODBObject();
-
-            foreach (string layerName in step.GetAllLayerNames())
-            {
-                if (matrix.GetMatrixLayerType(layerName) == MatrixLayerType.Component)
-                    continue; //no component layer
-
-                ILayer Layer = step.GetLayer(layerName);
-                if (Layer is IODBLayer)
-                {
-                    bool foundOne = false;
-                    IODBLayer layer = (IODBLayer)Layer;
-                    foreach (IODBObject obj in layer.GetAllLayerObjects())
-                    {
-                        if (profile.IsPointOfSecondObjectIncluded(obj))
-                        {
-                            //inside not relevant
-                        }
-                        else
-                        {
-                            obj.Select(true);
-                            foundOne = true;
-                        }
-                    }
-                    if (foundOne) Layer.EnableLayer(true);
-                }
-            }
-            Parent.UpdateSelection();
-            Parent.UpdateView();
-        }
-    }
-}


修正 StyleSetting 测试文件路径错误

修正 StyleSetting 测试文件路径错误

--- SelectorTest/CssStyleTest.cs
+++ SelectorTest/CssStyleTest.cs
@@ -13,7 +13,7 @@
     public void StyleSettingParseTest()
     {

-      var document = new JumonyParser().LoadDocument( Path.Combine( Environment.CurrentDirectory, "SelectorTest1.html" ) );
+      var document = new JumonyParser().LoadDocument( Path.Combine( Environment.CurrentDirectory, "CssStyleSettingTest1.html" ) );

       Assert.AreEqual( document.FindSingle( "div" ).Style().GetValue( "display" ), "none", "无法正确解析丢失分号的属性值" );


Some method name changes

Some method name changes

--- SharprWowApi/GetDataAsync.cs
+++ SharprWowApi/GetDataAsync.cs
@@ -15,6 +15,7 @@
 using System.Threading.Tasks;
 using System.Linq;
 using System.Collections.Generic;
+using System;

 namespace SharprWowApi
 {
@@ -228,7 +229,7 @@
         public async Task<CharacterRoot> GetCharacterAsync(string name, CharacterOptions characterOptions, string realm)
         {
             var character = new CharacterRoot();
-
+
             var url = string.Format(@"{0}/wow/character/{1}/{2}?locale={3}{4}&apikey={5}",
                 _Host,
                 realm,
@@ -255,7 +256,7 @@
         /// <param name="levelThreshold">Take only members above or equal to this integer</param>
         /// <param name="membersToTake">How many members should be returned (mind the 100 calls per second cap)</param>
         /// <returns>List filled with characterRoot</returns>
-        public async Task<List<CharacterRoot>> GetAllCharactersInGuildAsync(IEnumerable<GuildMember> guildMembers,
+        public async Task<List<CharacterRoot>> GetCharactersInGuildAsync(IEnumerable<GuildMember> guildMembers,
             CharacterOptions characterOptions,
             int levelThreshold, int membersToTake)
         {
@@ -291,32 +292,23 @@
             return characterList;
         }

-        public async Task<HashSet<CharacterRoot>> GetAllCharactersInGuildAsync(string[] guildMembers,
+        /// <summary>
+        /// Creates a list with CharacterRoot for every member in given guild using an array with the names of those members.
+        /// </summary>
+        /// <param name="guildMembers">string array with guildmembers</param>
+        /// <param name="characterOptions"></param>
+        /// <returns>HashSet filled with characterRoot objects</returns>
+        public async Task<HashSet<CharacterRoot>> GetCharactersInGuildAsync(string[] guildMembers,
          CharacterOptions characterOptions)
         {
             var memberHash = new HashSet<string>(guildMembers);
             var characterHash = new HashSet<CharacterRoot>();
-            //Task<CharacterRoot> character;

             var downloadTasks = new HashSet<Task<CharacterRoot>>();
-

             for (int i = 0; i < memberHash.Count; i++)
             {
-                if (i.Equals(95))
-                    await Task.Delay(System.TimeSpan.FromMilliseconds(500));
-
-                if (i.Equals(180))
-                    await Task.Delay(System.TimeSpan.FromMilliseconds(500));
-
-                if (i.Equals(275))
-                    await Task.Delay(System.TimeSpan.FromMilliseconds(500));
-
-                if (i.Equals(370))
-                    await Task.Delay(System.TimeSpan.FromMilliseconds(500));
-
                 downloadTasks.Add(GetCharacterAsync(memberHash.ElementAt(i), characterOptions, _Realm));
-
             }

             while (downloadTasks.Count > 0)
@@ -332,6 +324,7 @@
         #endregion

         #region guild
+
         /// <summary>
         /// Gets realm from client
         /// </summary>
@@ -380,6 +373,7 @@

             return memberString;
         }
+
         #endregion

         #region items


Remove slash from start of mount name if entered

--- ShockCast/AddStreamWindow.cs
+++ ShockCast/AddStreamWindow.cs
@@ -95,7 +95,8 @@
             {
                 if (((ServerType)typeComboBox.SelectedItem).UsesMounts)
                 {
-                    return mountTextBox.Text;
+
+                    return mountTextBox.Text.StartsWith("/") ? mountTextBox.Text.Substring(1) : mountTextBox.Text;
                 }
                 else
                 {


Working version with 7z

Working version with 7z

--- SignNuGetBinaries/Program.cs
+++ SignNuGetBinaries/Program.cs
@@ -104,7 +104,6 @@
                         var signedPackageFile = Path.Combine(outputPath, packageName);
                         //ZipFile giving a strange bug - shell out to 7z for now
                         //ZipFile.CreateFromDirectory(target, signedPackageFile);
-                        ZipArchive
                         // Hack in 7z call
                         Process zip = new Process();
                         zip.StartInfo.WorkingDirectory = target;
@@ -131,6 +130,23 @@

             return 0;
         }
+
+
+        private static void CreateZip(string targetDirectory, string signedPackageFile)
+        {
+            using (var stream = File.Create(signedPackageFile))
+            using (var zip = new ZipArchive(stream, ZipArchiveMode.Create, leaveOpen: false))
+            {
+                foreach (var file in Directory.GetFiles(targetDirectory, "*", SearchOption.AllDirectories))
+                {
+                    // Remove the target directory to get the entry name
+                    var entryName = file.Substring(targetDirectory.Length).Replace('\\', '/');
+
+                    zip.CreateEntryFromFile(file, entryName, CompressionLevel.Optimal);
+                }
+            }
+        }
+
     }

     interface ICodeSignService


add EntityCache.GetAll

add EntityCache.GetAll

--- Signum.Engine/EntityCache.cs
+++ Signum.Engine/EntityCache.cs
@@ -19,19 +19,17 @@
     {
         internal class RealEntityCache
         {
-            readonly Dictionary<(Type type, PrimaryKey id), Entity> dic = new Dictionary<(Type type, PrimaryKey id), Entity>();
+            readonly Dictionary<Type, Dictionary<PrimaryKey, Entity>> dic = new Dictionary<Type, Dictionary<PrimaryKey, Entity>>();

             public void Add(Entity e)
             {
                 if (e == null)
                     throw new ArgumentNullException("ie");
-
-                var tuple = (e.GetType(), e.Id);
-
-                Entity ident = dic.TryGetC(tuple);
+
+                Entity ident = dic.TryGetC(e.GetType())?.TryGetC(e.Id);

                 if (ident == null)
-                    dic.Add(tuple, e);
+                    dic.GetOrCreate(e.GetType()).GetOrCreate(e.Id, e);
                 else if (ident != e)
                 {
                     //Odd but allowed
@@ -41,12 +39,17 @@

             public bool Contains(Type type, PrimaryKey id)
             {
-                return dic.ContainsKey((type, id));
+                return dic.TryGetC(type)?.ContainsKey(id) ?? false;
             }

             public Entity Get(Type type, PrimaryKey id)
             {
-                return dic.TryGetC((type, id));
+                return dic.TryGetC(type)?.TryGetC(id);
+            }
+
+            public IEnumerable<Entity> GetAll(Type type)
+            {
+                return (dic.TryGetC(type)?.Values).EmptyIfNull();
             }

             public void AddFullGraph(ModifiableEntity ie)
@@ -88,10 +91,17 @@

             internal bool TryGetValue((Type type, PrimaryKey id) tuple, out Entity result)
             {
-                return dic.TryGetValue(tuple, out result);
+                var d = dic.TryGetC(tuple.type);
+                if (d == null)
+                {
+                    result = null;
+                    return false;
+                }
+                return d.TryGetValue(tuple.id, out result);
             }

             public bool IsSealed { get; private set; }
+
         }

@@ -180,6 +190,12 @@
         public static Entity Get(Type type, PrimaryKey id)
         {
             return Current.Get(type, id);
+        }
+
+        public static IEnumerable<T> GetAll<T>()
+            where T : Entity
+        {
+            return Current.GetAll(typeof(T)).Cast<T>();
         }

         public static IRetriever NewRetriever()
@@ -207,6 +223,8 @@
                 }
             }
         }
+
+
     }

     public enum EntityCacheType


MemoryCache: improve sanoty checking and renew method

--- SimpleHelpers/MemoryCache.cs
+++ SimpleHelpers/MemoryCache.cs
@@ -151,9 +151,12 @@
         /// <returns>Stored value for the key or default value if not found</returns>
         public static T Get (string key)
         {
-            CachedItem item;
-            if (m_cacheMap.TryGetValue (key, out item))
-                return item.Data;
+            if (key != null)
+            {
+                CachedItem item;
+                if (m_cacheMap.TryGetValue (key, out item))
+                    return item.Data;
+            }
             return null;
         }

@@ -164,10 +167,12 @@
         /// <param name="data">Stored value.</param>
         public static void Set (string key, T data)
         {
-            if (key == null | key.Length == 0)
+            if (key == null || key.Length == 0 || data == null)
+            {
+                if (m_ignoreNullValues)
+                    return;
                 throw new System.ArgumentNullException ("key");
-            if (m_ignoreNullValues && data == null)
-                return;
+            }
             // add or update item
             m_cacheMap[key] = new CachedItem
             {
@@ -179,6 +184,19 @@
         }

         /// <summary>
+        /// Renews the expiration due time for the specified cached item.
+        /// </summary>
+        /// <param name="key">The cached item key.</param>
+        public static void Renew (string key)
+        {
+            if (key == null)
+                return;
+            CachedItem item;
+            if (m_cacheMap.TryGetValue (key, out item))
+                item.Updated = DateTime.UtcNow;
+        }
+
+        /// <summary>
         /// Removes and returns the value associated with the specified key.
         /// Return the default value if not found.
         /// </summary>
@@ -186,9 +204,12 @@
         /// <returns>Stored value for the key or default value if not found</returns>
         public static T Remove (string key)
         {
-            CachedItem item;
-            if (m_cacheMap.TryRemove (key, out item))
-                return item.Data;
+            if (key != null)
+            {
+                CachedItem item;
+                if (m_cacheMap.TryRemove (key, out item))
+                    return item.Data;
+            }
             return default (T);
         }

@@ -199,6 +220,8 @@
         /// <param name="comparison">The comparison method.</param>
         public static void ClearByPrefix (string prefix, StringComparison comparison = StringComparison.Ordinal)
         {
+            if (prefix == null)
+                return;
             CachedItem item;
             foreach (var i in m_cacheMap)
                 if (i.Key.StartsWith (prefix, comparison))
@@ -222,6 +245,8 @@
         /// <returns>Stored value for the key or default value if not found</returns>
         public static T GetOrAdd (string key, Func<string, T> valueFactory)
         {
+            if (key == null)
+                return default (T);
             CachedItem item;
             if (!m_cacheMap.TryGetValue (key, out item))
             {
@@ -231,7 +256,8 @@
                 T data = valueFactory (key);
                 // add or update cache
                 Set (key, data);
-                return data;
+                // get again to ensure we have the correct item
+                return Get (key);
             }
             else
             {
@@ -268,6 +294,8 @@
         /// <returns>Stored value for the key or default value if not found</returns>
         public static T GetOrSyncAdd (string key, Func<string, T> valueFactory, int waitTimeoutMilliseconds)
         {
+            if (key == null)
+                return default (T);
             CachedItem item;
             if (!m_cacheMap.TryGetValue (key, out item))
             {


Update CardIds for 17.0.2.45932

Update CardIds for 17.0.2.45932

--- HearthDb/CardIds.cs
+++ HearthDb/CardIds.cs
@@ -7809,7 +7809,9 @@
             public class Priest
             {
                 public const string GenerousSpirit = "BCON_015";
+                public const string HolySmite_HolySmite = "CS1_130_Puzzle";
                 public const string LesserHeal = "CS1h_001";
+                public const string PowerWordShield_PowerWordShield = "CS2_004_Puzzle";
                 public const string PowerWordShield_PowerWordShieldEnchantment = "CS2_004e";
                 public const string DivineSpirit_DivineSpiritEnchantment = "CS2_236e";
                 public const string ShatteredSunCleric_ClericsBlessingEnchantment = "EX1_019e";


Fixed base Actor PostStop to dispose the LUA script system only if it has ben initialized.

--- src/Actors/Actor.cs
+++ src/Actors/Actor.cs
@@ -61,8 +61,11 @@

         protected override void PostStop()
         {
-            scriptSystem.Dispose();
-            scriptSystem = null;
+            if (scriptSystem != null)
+            {
+                scriptSystem.Dispose();
+                scriptSystem = null;
+            }

             base.PostStop();
         }


Increase `upperToleranceSeconds` to 0.5 in `ExtendedSearchContext_MissingAll_Timeout_Safely` test

--- test/Atata.WebDriverExtras.Tests/ExtendedSearchContextTests.cs
+++ test/Atata.WebDriverExtras.Tests/ExtendedSearchContextTests.cs
@@ -232,7 +232,7 @@

         bool result;

-        using (StopwatchAsserter.WithinSeconds(5, .3))
+        using (StopwatchAsserter.WithinSeconds(5, .5))
             result = Driver.Try().MissingAll(_existingElementBy.Safely(), _anotherMissingElementBy.Safely());

         Assert.That(result, Is.False);


update version to 1.5.0.4

update version to 1.5.0.4

--- Source/SharedAssemblyInfo.cs
+++ Source/SharedAssemblyInfo.cs
@@ -26,4 +26,4 @@

 // Version information for an assembly consists of the following four values:

-[assembly: AssemblyVersion("1.5.0.3")]+[assembly: AssemblyVersion("1.5.0.4")]


8.2.2-RC02

--- Source/SharedAssemblyInfo.cs
+++ Source/SharedAssemblyInfo.cs
@@ -7,5 +7,5 @@
 [assembly: ComVisible(false)]
 [assembly: AssemblyVersion("8.2.1.0")]
 [assembly: AssemblyFileVersion("8.2.2.0")]
-[assembly: AssemblyInformationalVersion("8.2.2-RC01")]
+[assembly: AssemblyInformationalVersion("8.2.2-RC02")]
 [assembly: CLSCompliant(false)]


format code

format code

--- HtmZetaOne/Utils.cs
+++ HtmZetaOne/Utils.cs
@@ -52,7 +52,6 @@
             return probabilities.Where(p => Math.Abs(p) > 1e-300).Sum(p => -p * Math.Log(p, 2));
         }

-
         public static double Entropy<T>(this IEnumerable<T> stream)
         {
             var array = stream.ToArray();


Fixed last tariff test found in the official documentation

--- Illias/Time/Time.cs
+++ Illias/Time/Time.cs
@@ -68,12 +68,12 @@

         #region Second

-        private readonly Byte _Second;
+        private readonly Byte? _Second;

         /// <summary>
         /// The second.
         /// </summary>
-        public Byte Second
+        public Byte? Second
         {
             get
             {
@@ -93,9 +93,9 @@
         /// <param name="Hour">The hour.</param>
         /// <param name="Minute">The minute.</param>
         /// <param name="Second">The second.</param>
-        private Time(Byte  Hour,
-                     Byte  Minute  = 0,
-                     Byte  Second  = 0)
+        private Time(Byte   Hour,
+                     Byte   Minute  = 0,
+                     Byte?  Second  = null)
         {

             #region Initial checks
@@ -264,9 +264,9 @@
             var Minutes  = Time1.Minute - Time2.Minute;
             var Seconds  = Time1.Second - Time2.Second;

-            return new TimeSpan(Hours   >= 0 ? Hours   : 0,
-                                Minutes >= 0 ? Minutes : 0,
-                                Seconds >= 0 ? Seconds : 0);
+            return new TimeSpan(Hours   >= 0 ? Hours         : 0,
+                                Minutes >= 0 ? Minutes       : 0,
+                                Seconds >= 0 ? Seconds.Value : 0);

         }

@@ -282,13 +282,31 @@
         public static TimeSpan operator +  (Time Time1, Time Time2)
         {

+            var Days    = 0;
             var Hours   = Time1.Hour   + Time2.Hour;
             var Minutes = Time1.Minute + Time2.Minute;
             var Seconds = Time1.Second + Time2.Second;

-            return new TimeSpan(Time1.Hour   + Time2.Hour,
-                                Time1.Minute + Time2.Minute,
-                                Time1.Second + Time2.Second);
+            if (Seconds > 59)
+            {
+                Seconds -= 59;
+                Minutes++;
+            }
+
+            if (Minutes > 59)
+            {
+                Minutes -= 59;
+                Hours++;
+            }
+
+            if (Hours > 23)
+            {
+                Hours -= 23;
+                Days++;
+            }
+
+            return new TimeSpan(Hours, Minutes, Seconds.Value).
+                       Add(TimeSpan.FromDays(Days));

         }

@@ -411,7 +429,12 @@
         /// </summary>
         public override String ToString()
         {
-            return String.Concat(_Hour.ToString(), ":", _Minute.ToString(), ":", _Second.ToString());
+
+            if (_Second.HasValue)
+                return String.Concat(_Hour.ToString("D2"), ":", _Minute.ToString("D2"), ":", _Second.Value.ToString("D2"));
+
+            return String.Concat(_Hour.ToString("D2"), ":", _Minute.ToString("D2"));
+
         }

         #endregion