Added back in GetType but kept commented out in case someone wants to debug later

--- Assets/HoloToolkit/Input/Scripts/Focus/FocusManager.cs
+++ Assets/HoloToolkit/Input/Scripts/Focus/FocusManager.cs
@@ -552,8 +552,9 @@
             RayStep rayStep = default(RayStep);
             RaycastHit physicsHit = default(RaycastHit);

-            Debug.Assert(pointer.PointingSource.Rays != null, "No valid rays for pointer");
-            Debug.Assert(pointer.PointingSource.Rays.Length > 0, "No valid rays for pointer");
+            // Comment back in GetType() only when debugging for a specific pointer.
+            Debug.Assert(pointer.PointingSource.Rays != null, "No valid rays for pointer "/* + pointer.GetType()*/);
+            Debug.Assert(pointer.PointingSource.Rays.Length > 0, "No valid rays for pointer "/* + pointer.GetType()*/);

             // Check raycast for each step in the pointing source
             for (int i = 0; i < pointer.PointingSource.Rays.Length; i++)
@@ -614,8 +615,9 @@
             RayStep rayStep = default(RayStep);
             int rayStepIndex = 0;

-            Debug.Assert(pointer.PointingSource.Rays != null, "No valid rays for pointer");
-            Debug.Assert(pointer.PointingSource.Rays.Length > 0, "No valid rays for pointer");
+            // Comment back in GetType() only when debugging for a specific pointer.
+            Debug.Assert(pointer.PointingSource.Rays != null, "No valid rays for pointer "/* + pointer.GetType()*/);
+            Debug.Assert(pointer.PointingSource.Rays.Length > 0, "No valid rays for pointer "/* + pointer.GetType()*/);

             // Cast rays for every step until we score a hit
             for (int i = 0; i < pointer.PointingSource.Rays.Length; i++)


Convert to using an array instead of a dictionary for local management

--- Assets/MRTK/Core/Providers/Hands/BaseHandVisualizer.cs
+++ Assets/MRTK/Core/Providers/Hands/BaseHandVisualizer.cs
@@ -17,7 +17,10 @@

         public IMixedRealityController Controller { get; set; }

+        [System.Obsolete("This has been replaced with jointsArray with TrackedHandJoint as the int index.", true)]
         protected readonly Dictionary<TrackedHandJoint, Transform> joints = new Dictionary<TrackedHandJoint, Transform>();
+
+        protected readonly Transform[] jointsArray = new Transform[ArticulatedHandPose.JointCount];
         protected MeshFilter handMeshFilter;

         // This member stores the last count of hand mesh vertices, to avoid using
@@ -48,9 +51,12 @@

         private void OnDestroy()
         {
-            foreach (var joint in joints)
-            {
-                Destroy(joint.Value.gameObject);
+            foreach (Transform joint in jointsArray)
+            {
+                if (joint != null)
+                {
+                    Destroy(joint.gameObject);
+                }
             }

             if (handMeshFilter != null)
@@ -62,19 +68,14 @@

         public bool TryGetJointTransform(TrackedHandJoint joint, out Transform jointTransform)
         {
-            if (joints == null)
+            if (jointsArray == null)
             {
                 jointTransform = null;
                 return false;
             }

-            if (joints.TryGetValue(joint, out jointTransform))
-            {
-                return true;
-            }
-
-            jointTransform = null;
-            return false;
+            jointTransform = jointsArray[(int)joint];
+            return jointTransform != null;
         }

         void IMixedRealitySourceStateHandler.OnSourceDetected(SourceStateEventData eventData) { }
@@ -104,12 +105,14 @@
                 if (handTrackingProfile != null && !handTrackingProfile.EnableHandJointVisualization)
                 {
                     // clear existing joint GameObjects / meshes
-                    foreach (var joint in joints)
-                    {
-                        Destroy(joint.Value.gameObject);
-                    }
-
-                    joints.Clear();
+                    foreach (Transform joint in jointsArray)
+                    {
+                        if (joint != null)
+                        {
+                            Destroy(joint.gameObject);
+                        }
+                    }
+
                     return;
                 }

@@ -120,8 +123,9 @@
                     if (handJoint == TrackedHandJoint.None) { continue; }

                     MixedRealityPose handJointPose = eventData.InputData[handJoint];
-
-                    if (joints.TryGetValue(handJoint, out Transform jointTransform))
+                    Transform jointTransform = jointsArray[i];
+
+                    if (jointTransform != null)
                     {
                         jointTransform.position = handJointPose.Position;
                         jointTransform.rotation = handJointPose.Rotation;
@@ -162,7 +166,7 @@
                         jointObject.transform.rotation = handJointPose.Rotation;
                         jointObject.transform.parent = transform;

-                        joints.Add(handJoint, jointObject.transform);
+                        jointsArray[i] = jointObject.transform;
                     }
                 }
             }


fix typo in networkmanager logs

fix typo in networkmanager logs

--- Assets/Scripts/HarryPotterUnity/Game/NetworkManager.cs
+++ Assets/Scripts/HarryPotterUnity/Game/NetworkManager.cs
@@ -233,7 +233,7 @@
                 return;
             }

-            Log.Write("Player {0} Plays {1} from hand", card.Player.NetworkId, card.CardName);
+            Log.Write("Player {0} Plays {1} from hand", card.Player.NetworkId + 1, card.CardName);
             card.MouseUpAction();
             card.Player.OnCardPlayed(card);
         }
@@ -256,7 +256,7 @@
                 return;
             }

-            Log.Write("Player {0} Activates {1}'s effect", card.Player.NetworkId, card.CardName);
+            Log.Write("Player {0} Activates {1}'s effect", card.Player.NetworkId + 1, card.CardName);
             persistentCard.OnSelectedAction();
         }

@@ -278,7 +278,7 @@
             var selectedCards = selectedCardIds.Select(cardId => GameManager.AllCards.Find(c => c.NetworkId == cardId)).ToList();

             Log.Write("Player {0} plays card {1} targeting {2}",
-                card.Player.NetworkId,
+                card.Player.NetworkId + 1,
                 card.CardName,
                 string.Join(",", selectedCards.Select(c => c.CardName).ToArray()));


Less code

Less code

--- King.Service.ServiceBus/BusQueuePoller.cs
+++ King.Service.ServiceBus/BusQueuePoller.cs
@@ -17,47 +17,22 @@
         /// <summary>
         /// Reciever
         /// </summary>
-        protected readonly IBusMessageReciever queue = null;
-
-        /// <summary>
-        /// Wait Time
-        /// </summary>
-        protected readonly TimeSpan waitTime = DefaultWaitTime;
-
-        /// <summary>
-        /// Default Wait Time
-        /// </summary>
-        public static readonly TimeSpan DefaultWaitTime = TimeSpan.FromSeconds(15);
+        protected readonly IBusMessageReciever reciever = null;
         #endregion

         #region Constructors
         /// <summary>
         /// Constructor
         /// </summary>
-        /// <param name="queue">Queue</param>
-        /// <param name="waitTime">Wait Time</param>
-        public BusQueuePoller(IBusMessageReciever queue, TimeSpan waitTime)
+        /// <param name="reciever">Reciever</param>
+        public BusQueuePoller(IBusMessageReciever reciever)
         {
-            if (null == queue)
+            if (null == reciever)
             {
-                throw new ArgumentNullException("queue");
+                throw new ArgumentNullException("reciever");
             }

-            this.queue = queue;
-            this.waitTime = waitTime <= TimeSpan.Zero ? DefaultWaitTime : waitTime;
-        }
-        #endregion
-
-        #region Properties
-        /// <summary>
-        /// Wait Time
-        /// </summary>
-        public TimeSpan WaitTime
-        {
-            get
-            {
-                return this.waitTime;
-            }
+            this.reciever = reciever;
         }
         #endregion

@@ -68,7 +43,7 @@
         /// <returns>Queued Item</returns>
         public virtual async Task<IQueued<T>> Poll()
         {
-            var msg = await this.queue.Get(this.waitTime);
+            var msg = await this.reciever.Get(this.reciever.ServerWaitTime);
             return null == msg ? null : new Queued<T>(msg);
         }

@@ -79,7 +54,7 @@
         /// <returns>Queued Messages</returns>
         public virtual async Task<IEnumerable<IQueued<T>>> PollMany(int messageCount = 5)
         {
-            var msgs = await this.queue.GetMany(this.waitTime, messageCount);
+            var msgs = await this.reciever.GetMany(this.reciever.ServerWaitTime, messageCount);
             return null == msgs || !msgs.Any() ? null : msgs.Select(m => new Queued<T>(m));
         }
         #endregion


Fix typo

Fix typo

--- Battery-Commander.Web/Models/MilitaryEducationLevel.cs
+++ Battery-Commander.Web/Models/MilitaryEducationLevel.cs
@@ -32,7 +32,7 @@
         [Display(Name = "(CCC) Captains Career Course", ShortName = "CCC")]
         CCC = 11,

-        [Display(Name = "(CST) Cadet Summer Training", ShortName = = "CST")]
+        [Display(Name = "(CST) Cadet Summer Training", ShortName = "CST")]
         CST = 12
     }


Issue-1471 Added code comments to WorktreeLock

--- LibGit2Sharp/WorktreeLock.cs
+++ LibGit2Sharp/WorktreeLock.cs
@@ -6,20 +6,38 @@

 namespace LibGit2Sharp
 {
+    /// <summary>
+    ///     Represents the lock state of a Worktree
+    /// </summary>
     [DebuggerDisplay("{DebuggerDisplay,nq}")]
     public class WorktreeLock
     {
+        /// <summary>
+        ///     Creates a new instance of <see cref="WorktreeLock"/> with default, unlocked, state
+        /// </summary>
         public WorktreeLock() : this(false, null)
         {

         }

+        /// <summary>
+        ///     Creates a new instance of <see cref="WorktreeLock"/>
+        /// </summary>
+        /// <param name="isLocked">the locked state</param>
+        /// <param name="reason">the reason given for the lock</param>
         public WorktreeLock(bool isLocked, string reason)
         {
             IsLocked = isLocked;
             Reason = reason;
         }
+        /// <summary>
+        ///     Gets a flag indicating if the worktree is locked
+        /// </summary>
         public virtual bool IsLocked { get; }
+
+        /// <summary>
+        ///     Gets the reason, if set, for the lock
+        /// </summary>
         public virtual string Reason { get; }

         private string DebuggerDisplay


Fixed failure of creating base uri.

Fixed failure of creating base uri.

--- Kudu.Services/Infrastructure/UriHelper.cs
+++ Kudu.Services/Infrastructure/UriHelper.cs
@@ -3,6 +3,7 @@
 using System.Globalization;
 using System.Linq;
 using System.Net.Http;
+using Kudu.Core.Helpers;

 namespace Kudu.Services.Infrastructure
 {
@@ -15,9 +16,12 @@
             // Azure will always pass this header to Kudu, and it always carry the right host name.
             // when running Kudu on mono in a container, container is bound to a local ip
             // so we cannot rely on "request.RequestUri", which will be "127.0.0.1:xxxx".
-            if (request.Headers.TryGetValues("DISGUISED-HOST", out disguisedHostValues) && disguisedHostValues.Count() > 0)
+            if (!OSDetector.IsOnWindows()
+                && request.Headers.TryGetValues("DISGUISED-HOST", out disguisedHostValues)
+                && disguisedHostValues.Count() > 0)
             {
-                return new UriBuilder("https", disguisedHostValues.First()).Uri;
+                // host value can be "{site name}.scm.azurewebsites.net:443" or "{site name}.scm.azurewebsites.net"
+                return new Uri(string.Format(CultureInfo.InvariantCulture, "https://{0}", disguisedHostValues.First()));
             }

             return new Uri(request.RequestUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped));


implemented DAF1 archives.

implemented DAF1 archives.

--- ArcFormats/DenSDK/ArcDAF.cs
+++ ArcFormats/DenSDK/ArcDAF.cs
@@ -33,18 +33,67 @@
 namespace GameRes.Formats.DenSdk
 {
     [Export(typeof(ArchiveFormat))]
-    public class DatOpener : ArchiveFormat
+    public class Daf1Opener : ArchiveFormat
     {
-        public override string         Tag { get { return "DAT/DenSDK"; } }
+        public override string         Tag { get { return "DAF1"; } }
+        public override string Description { get { return "DenSDK resource archive"; } }
+        public override uint     Signature { get { return 0x31464144; } } // 'DAF1'
+        public override bool  IsHierarchic { get { return true; } }
+        public override bool     CanCreate { get { return false; } }
+
+        public Daf1Opener ()
+        {
+            Extensions = new string[] { "dat" };
+        }
+
+        public override ArcFile TryOpen (ArcView file)
+        {
+            uint index_offset = file.View.ReadUInt32 (4);
+            int count = file.View.ReadInt32 (8);
+            if (!IsSaneCount (count) || index_offset >= file.MaxOffset)
+                return null;
+            uint data_offset = file.View.ReadUInt32 (0x10);
+            if (data_offset <= index_offset || data_offset > file.MaxOffset)
+                return null;
+            file.View.Reserve (index_offset, data_offset-index_offset);
+            var dir = new List<Entry> (count);
+            for (int i = 0; i < count; ++i)
+            {
+                uint entry_size = file.View.ReadUInt32 (index_offset);
+                if (entry_size <= 0x18)
+                    return null;
+                var name = file.View.ReadString (index_offset+0x18, entry_size-0x18);
+                var entry = FormatCatalog.Instance.Create<PackedEntry> (name);
+                entry.Offset        = file.View.ReadUInt32(index_offset+4);
+                entry.Size          = file.View.ReadUInt32(index_offset+8);
+                entry.UnpackedSize  = file.View.ReadUInt32 (index_offset+0xC);
+                entry.IsPacked      = file.View.ReadInt32(index_offset+0x14) != 0;
+                if (!entry.CheckPlacement (file.MaxOffset))
+                    return null;
+                dir.Add (entry);
+                index_offset += entry_size;
+            }
+            return new ArcFile (file, this, dir);
+        }
+
+        public override Stream OpenEntry (ArcFile arc, Entry entry)
+        {
+            var input = arc.File.CreateStream (entry.Offset, entry.Size);
+            var pent = entry as PackedEntry;
+            if (null == pent || !pent.IsPacked)
+                return input;
+            return new ZLibStream (input, CompressionMode.Decompress);
+        }
+    }
+
+    [Export(typeof(ArchiveFormat))]
+    public class Daf2Opener : Daf1Opener
+    {
+        public override string         Tag { get { return "DAF2"; } }
         public override string Description { get { return "DenSDK resource archive"; } }
         public override uint     Signature { get { return 0x32464144; } } // 'DAF2'
         public override bool  IsHierarchic { get { return true; } }
         public override bool     CanCreate { get { return false; } }
-
-        public DatOpener ()
-        {
-            Extensions = new string[] { "dat" };
-        }

         public override ArcFile TryOpen (ArcView file)
         {
@@ -80,9 +129,9 @@
                     return null;
                 var name = Binary.GetCString (index, index_offset+0x34, entry_size-0x34);
                 var entry = FormatCatalog.Instance.Create<PackedEntry> (name);
-                entry.Offset        = base_offset + (LittleEndian.ToUInt32 (index, index_offset+4) ^ (uint)key);
-                entry.Size          = LittleEndian.ToUInt32 (index, index_offset+8) ^ (uint)key;
-                entry.UnpackedSize  = LittleEndian.ToUInt32 (index, index_offset+0xC) ^ (uint)key;
+                entry.Offset        = base_offset + (LittleEndian.ToUInt32 (index, index_offset+4) ^ key);
+                entry.Size          = LittleEndian.ToUInt32 (index, index_offset+8) ^ key;
+                entry.UnpackedSize  = LittleEndian.ToUInt32 (index, index_offset+0xC) ^ key;
                 entry.IsPacked      = LittleEndian.ToInt32 (index, index_offset+0x30) != 0;
                 if (!entry.CheckPlacement (file.MaxOffset))
                     return null;
@@ -91,14 +140,5 @@
             }
             return new ArcFile (file, this, dir);
         }
-
-        public override Stream OpenEntry (ArcFile arc, Entry entry)
-        {
-            var input = arc.File.CreateStream (entry.Offset, entry.Size);
-            var pent = entry as PackedEntry;
-            if (null == pent || !pent.IsPacked)
-                return input;
-            return new ZLibStream (input, CompressionMode.Decompress);
-        }
     }
 }


Better formatting of stale data

Better formatting of stale data

--- FluentFTP/Client/BaseClient/ReadStaleData.cs
+++ FluentFTP/Client/BaseClient/ReadStaleData.cs
@@ -1,4 +1,6 @@
-using System.Text;
+using System;
+using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading;
 using System.Threading.Tasks;

@@ -19,10 +21,13 @@

 			if (m_stream != null) {

-				while (m_stream.SocketDataAvailable > 0) {
+				if (m_stream.SocketDataAvailable > 0) {
 					if (logData) {
 						LogWithPrefix(FtpTraceLevel.Info, "Socket has stale data - " + logFrom);
 					}
+				}
+
+				while (m_stream.SocketDataAvailable > 0) {
 					byte[] buf = new byte[m_stream.SocketDataAvailable];
 					if (m_stream.IsEncrypted) {
 						m_stream.Read(buf, 0, buf.Length);
@@ -30,14 +35,22 @@
 					else {
 						m_stream.RawSocketRead(buf);
 					}
-					staleData = Encoding.GetString(buf).TrimEnd('\0', '\r', '\n');
-					if (logData) {
-						LogWithPrefix(FtpTraceLevel.Verbose, "The stale data was: " + staleData);
-					}
+					staleData += Encoding.GetString(buf).TrimEnd('\0', '\r', '\n') + Environment.NewLine;
 				}

 				if (string.IsNullOrEmpty(staleData)) {
 					closeStream = false;
+				}
+				else {
+					if (logData) {
+						LogWithPrefix(FtpTraceLevel.Verbose, "The stale data was: ");
+						string[] staleLines = Regex.Split(staleData, Environment.NewLine);
+						foreach (string staleLine in staleLines) {
+							if (!string.IsNullOrWhiteSpace(staleLine)) {
+								Log(FtpTraceLevel.Verbose, "Stale:    " + staleLine);
+							}
+						}
+					}
 				}

 				if (closeStream) {
@@ -58,15 +71,18 @@
 		/// <param name="closeStream">close the connection?</param>
 		/// <param name="logData">copy stale data information to logs?</param>
 		/// <param name="token">The token that can be used to cancel the entire process</param>
-		protected async Task<string> ReadStaleDataAsync(bool closeStream, bool traceData, string logFrom, CancellationToken token) {
+		protected async Task<string> ReadStaleDataAsync(bool closeStream, bool logData, string logFrom, CancellationToken token) {
 			string staleData = null;

 			if (m_stream != null) {

-				while (m_stream.SocketDataAvailable > 0) {
-					if (traceData) {
+				if (m_stream.SocketDataAvailable > 0) {
+					if (logData) {
 						LogWithPrefix(FtpTraceLevel.Info, "Socket has stale data - " + logFrom);
 					}
+				}
+
+				while (m_stream.SocketDataAvailable > 0) {
 					byte[] buf = new byte[m_stream.SocketDataAvailable];
 					if (m_stream.IsEncrypted) {
 						await m_stream.ReadAsync(buf, 0, buf.Length, token);
@@ -74,14 +90,22 @@
 					else {
 						await m_stream.RawSocketReadAsync(buf, token);
 					}
-					staleData = Encoding.GetString(buf).TrimEnd('\0', '\r', '\n');
-					if (traceData) {
-						LogWithPrefix(FtpTraceLevel.Verbose, "The stale data was: " + staleData);
-					}
+					staleData += Encoding.GetString(buf).TrimEnd('\0', '\r', '\n') + Environment.NewLine;
 				}

 				if (string.IsNullOrEmpty(staleData)) {
 					closeStream = false;
+				}
+				else {
+					if (logData) {
+						LogWithPrefix(FtpTraceLevel.Verbose, "The stale data was: ");
+						string[] staleLines = Regex.Split(staleData, Environment.NewLine);
+						foreach (string staleLine in staleLines) {
+							if (!string.IsNullOrWhiteSpace(staleLine)) {
+								Log(FtpTraceLevel.Verbose, "Stale:    " + staleLine);
+							}
+						}
+					}
 				}

 				if (closeStream) {


further optimize

further optimize

--- Assets/Editor/ConeEditor.cs
+++ Assets/Editor/ConeEditor.cs
@@ -26,17 +26,27 @@
 			return;
 		}

+		EditorGUILayout.BeginHorizontal();
+
 		// Rebuild mesh when user click the Rebuild button
 		if (GUILayout.Button("Rebuild")) {
-			// set value
-			if (cone.CheckValue()) {
+			// check parameter
+			if (cone.CheckParam()) {
+				// update parameter
+				cone.UpdateParam(false);
 				// build mesh
 				cone.BuildMesh();
 			}
 		}
+
+		// Reset to last successul build parameter
+		if (GUILayout.Button("Reset")) {
+			cone.UpdateParam(true);
+		}
+
+		EditorGUILayout.EndHorizontal();
 	}
 }
-

 public class Cone : MonoBehaviour
 {
@@ -45,7 +55,13 @@
 	public float bottom_radius = 1.0f;
 	public int sections = 30;

-	public bool CheckValue() {
+	private float _height = 2.0f;
+	private float _top_radius = 0.0f;
+	private float _bottom_radius = 1.0f;
+	private int _sections = 30;
+
+
+	public bool CheckParam() {
 		// check some condition
 		if (sections < 3) {
 			Debug.LogError("sections must be 3 or more!");
@@ -69,8 +85,27 @@
 			top_radius = bottom_radius;
 			bottom_radius = tmp;
 		}
-
+		if (height == _height && top_radius == _top_radius &&
+		    bottom_radius == _bottom_radius && sections == _sections) {
+			Debug.Log("Nothing changed...");
+			return false;
+		}
 		return true;
+	}
+
+	public void UpdateParam(bool isReset) {
+		// update parameter
+		if (isReset) {
+			height = _height;
+			top_radius = _top_radius;
+			bottom_radius = _bottom_radius;
+			sections = _sections;
+		} else {
+			_height = height;
+			_top_radius = top_radius;
+			_bottom_radius = bottom_radius;
+			_sections = sections;
+		}
 	}

 	public void BuildMesh() {
@@ -92,85 +127,85 @@
 		Vector3[] vertices;
 		int[] triangles;

-		if (top_radius == 0.0f) {
+		if (_top_radius == 0.0f) {
 			// it's a full circular cone

 			// start calculate verticles
-			vertices = new Vector3[sections + 2]; // a circle, circle center and an apex
+			vertices = new Vector3[_sections + 2]; // a circle, circle center and an apex

 			// circle
-			float step = 2 * Mathf.PI / sections;
+			float step = 2 * Mathf.PI / _sections;
 			float angle = 0;

-			for (int i = 0; i < sections; i++) {
-				float circle_x = Mathf.Sin(angle) * bottom_radius;
-				float circle_z = Mathf.Cos(angle) * bottom_radius;
+			for (int i = 0; i < _sections; i++) {
+				float circle_x = Mathf.Sin(angle) * _bottom_radius;
+				float circle_z = Mathf.Cos(angle) * _bottom_radius;
 				angle += step; // increase angle

 				vertices[i] = new Vector3(circle_x, 0, circle_z);
 			}
-			vertices[sections] = new Vector3(0, height, 0); // apex
-			vertices[sections + 1] = new Vector3(0, 0, 0); // circle center
+			vertices[_sections] = new Vector3(0, _height, 0); // apex
+			vertices[_sections + 1] = new Vector3(0, 0, 0); // circle center

 			// start calculate triangles
-			triangles = new int[sections * 2 * 3];
+			triangles = new int[_sections * 2 * 3];

 			int index_triangles = 0;

-			for (int i = 1; i < sections; i++) {
+			for (int i = 1; i < _sections; i++) {
 				// side faces
-				triangles[index_triangles] = sections; // apex
+				triangles[index_triangles] = _sections; // apex
 				triangles[index_triangles + 1] = i - 1;
 				triangles[index_triangles + 2] = i;
 				index_triangles += 3;
 				// base face
-				triangles[index_triangles] = sections + 1; // circle center
+				triangles[index_triangles] = _sections + 1; // circle center
 				triangles[index_triangles + 1] = i;
 				triangles[index_triangles + 2] = i - 1;
 				index_triangles += 3;
 			}
 			// side faces
-			triangles[index_triangles] = sections; // apex
-			triangles[index_triangles + 1] = sections - 1;
+			triangles[index_triangles] = _sections; // apex
+			triangles[index_triangles + 1] = _sections - 1;
 			triangles[index_triangles + 2] = 0;
 			index_triangles += 3;
 			// base face
-			triangles[index_triangles] = sections + 1; // circle center
+			triangles[index_triangles] = _sections + 1; // circle center
 			triangles[index_triangles + 1] = 0;
-			triangles[index_triangles + 2] = sections - 1;
+			triangles[index_triangles + 2] = _sections - 1;
 			//index_triangles += 3;

 		} else {
 			// it's a truncated circular cone

 			// start calculate verticles
-			vertices = new Vector3[sections * 2 + 2]; // two circles and two circle center point
+			vertices = new Vector3[_sections * 2 + 2]; // two circles and two circle center point

 			// circle
-			float step = 2 * Mathf.PI / sections;
+			float step = 2 * Mathf.PI / _sections;
 			float top_angle = 0;
 			float bottom_angle = step / 2;

-			for (int i = 0; i < sections * 2; i += 2) {
-				float top_circle_x = Mathf.Sin(top_angle) * top_radius;
-				float top_circle_z = Mathf.Cos(top_angle) * top_radius;
-				float bottom_circle_x = Mathf.Sin(bottom_angle) * bottom_radius;
-				float bottom_circle_z = Mathf.Cos(bottom_angle) * bottom_radius;
+			for (int i = 0; i < _sections * 2; i += 2) {
+				float top_circle_x = Mathf.Sin(top_angle) * _top_radius;
+				float top_circle_z = Mathf.Cos(top_angle) * _top_radius;
+				float bottom_circle_x = Mathf.Sin(bottom_angle) * _bottom_radius;
+				float bottom_circle_z = Mathf.Cos(bottom_angle) * _bottom_radius;
 				top_angle += step; // increase angle
 				bottom_angle += step;

-				vertices[i] = new Vector3(top_circle_x, height, top_circle_z);
+				vertices[i] = new Vector3(top_circle_x, _height, top_circle_z);
 				vertices[i + 1] = new Vector3(bottom_circle_x, 0, bottom_circle_z);
 			}
-			vertices[sections * 2] = new Vector3(0, height, 0); // top circle center
-			vertices[sections * 2 + 1] = new Vector3(0, 0, 0); // bottom circle center
+			vertices[_sections * 2] = new Vector3(0, _height, 0); // top circle center
+			vertices[_sections * 2 + 1] = new Vector3(0, 0, 0); // bottom circle center

 			// start calculate triangles
-			triangles = new int[sections * 4 * 3];
+			triangles = new int[_sections * 4 * 3];

 			int index_triangles = 0;

-			for (int i = 2; i < sections * 2; i += 2) {
+			for (int i = 2; i < _sections * 2; i += 2) {
 				// side faces
 				triangles[index_triangles] = i - 2;
 				triangles[index_triangles + 1] = i - 1;
@@ -181,32 +216,32 @@
 				triangles[index_triangles + 2] = i + 1;
 				index_triangles += 3;
 				// base face
-				triangles[index_triangles] = sections * 2; // top circle center
+				triangles[index_triangles] = _sections * 2; // top circle center
 				triangles[index_triangles + 1] = i - 2;
 				triangles[index_triangles + 2] = i;
 				index_triangles += 3;
-				triangles[index_triangles] = sections * 2 + 1; // bottom circle center
+				triangles[index_triangles] = _sections * 2 + 1; // bottom circle center
 				triangles[index_triangles + 1] = i + 1;
 				triangles[index_triangles + 2] = i - 1;
 				index_triangles += 3;
 			}
 			// side faces
-			triangles[index_triangles] = sections * 2 - 2;
-			triangles[index_triangles + 1] = sections * 2 - 1;
+			triangles[index_triangles] = _sections * 2 - 2;
+			triangles[index_triangles + 1] = _sections * 2 - 1;
 			triangles[index_triangles + 2] = 0;
 			index_triangles += 3;
 			triangles[index_triangles] = 0;
-			triangles[index_triangles + 1] = sections * 2 - 1;
+			triangles[index_triangles + 1] = _sections * 2 - 1;
 			triangles[index_triangles + 2] = 1;
 			index_triangles += 3;
 			// base face
-			triangles[index_triangles] = sections * 2; // top circle center
-			triangles[index_triangles + 1] = sections * 2 - 2;
+			triangles[index_triangles] = _sections * 2; // top circle center
+			triangles[index_triangles + 1] = _sections * 2 - 2;
 			triangles[index_triangles + 2] = 0;
 			index_triangles += 3;
-			triangles[index_triangles] = sections * 2 + 1; // bottom circle center
+			triangles[index_triangles] = _sections * 2 + 1; // bottom circle center
 			triangles[index_triangles + 1] = 1;
-			triangles[index_triangles + 2] = sections * 2 - 1;
+			triangles[index_triangles + 2] = _sections * 2 - 1;
 			//index_triangles += 3;
 		}


Fixed bux with zero division

Fixed bux with zero division

--- Assets/Scripts/Movement1.cs
+++ Assets/Scripts/Movement1.cs
@@ -152,7 +152,7 @@
     private void reset()
     {
         audioSource.loop = false;
-        uiManager.endGame(nearBonus + spawningEnemies.calculateScore() + (int)((totalDistance - lastDistance) / numberOfClicks));
+        uiManager.endGame(nearBonus + spawningEnemies.calculateScore() + (int)((totalDistance - lastDistance) / (numberOfClicks+1)));
         gameRunning = false;
         nearBonus = 0;
         GameObject[] lasers;


Write non-overlapping middle section to target

--- Aurio/Aurio/Features/OLA.cs
+++ Aurio/Aurio/Features/OLA.cs
@@ -105,6 +105,7 @@
             // Write nonoverlapped middle section, if existing
             if (nonoverlapInBytes > 0) {
                 Buffer.BlockCopy(frame, overlapInBytes, buffer, 0, nonoverlapInBytes);
+                stream.Write(buffer, 0, nonoverlapInBytes);
             }

             // Write the second overlap part to the buffer for addition with next frame


Added startup up error countdown timer

Added startup up error countdown timer

--- HeroesParserData/Views/StartupWindow.xaml.cs
+++ HeroesParserData/Views/StartupWindow.xaml.cs
@@ -43,7 +43,6 @@

                 await Message("Performing database migration");
                 await InitializeDatabase();
-
                 // must be last
                 await Message("Initializing Heroes Parser Data");
                 MainWindow mainWindow = new MainWindow();
@@ -59,9 +58,13 @@
             }
             catch (Exception ex)
             {
-                await Message("An error was encountered. Check the error logs for details");
+                StatusLabel.Content = "An error was encountered. Check the error logs for details";
                 StartupLogFile.Log(LogLevel.Error, ex);
-                await Task.Delay(8000);
+                for (int i = 6; i >= 0; i--)
+                {
+                    CurrentStatusLabel.Content = $"Shutting down in ({i})...";
+                    await Task.Delay(1000);
+                }
                 Application.Current.Shutdown();
             }
         }


removing filtering on mouse events for better or for worse

--- SelfHostedYoloScreenCapture/SelectionDrawer.cs
+++ SelfHostedYoloScreenCapture/SelectionDrawer.cs
@@ -50,11 +50,6 @@

         private void OnMouseMove(object sender, MouseEventArgs e)
         {
-            if ((_moveCounter++)%30 != 0)
-            {
-                return;
-            }
-
             if (_selecting)
             {
                 Clear(Selection);


Do not use Dictionary.ContainsValue

Do not use Dictionary.ContainsValue

--- CalDavSynchronizer/Utilities/ColorHelper.cs
+++ CalDavSynchronizer/Utilities/ColorHelper.cs
@@ -129,7 +129,7 @@

     public static string FindMatchingCategoryByHtmlColor(string htmlColor)
     {
-      if (HtmlColorByCategoryColor.ContainsValue (htmlColor))
+      if (HtmlColorNames.Contains (htmlColor))
         return htmlColor;

       var color = ColorTranslator.FromHtml (htmlColor);


Group indices updated after adding/removing items instead of a full sort. (Fixed Issue 129)

--- ImageListView/ImageListViewItemCollection.cs
+++ ImageListView/ImageListViewItemCollection.cs
@@ -616,7 +616,7 @@

                     // Update groups
                     if (mImageListView.showGroups)
-                        Sort();
+                        AddRemoveGroupItem(item.Index, true);

                     // Raise the add event
                     mImageListView.OnItemCollectionChanged(new ItemCollectionChangedEventArgs(CollectionChangeAction.Add, item));
@@ -637,7 +637,7 @@
             /// <param name="removeFromCache">true to remove item image from cache; otherwise false.</param>
             internal bool RemoveInternal(ImageListViewItem item, bool removeFromCache)
             {
-                for (int i = item.mIndex; i < mItems.Count; i++)
+                for (int i = item.mIndex + 1; i < mItems.Count; i++)
                     mItems[i].mIndex--;
                 if (item == mFocused) mFocused = null;
                 if (removeFromCache && mImageListView != null)
@@ -655,7 +655,7 @@
                     mImageListView.OnItemCollectionChanged(new ItemCollectionChangedEventArgs(CollectionChangeAction.Remove, item));

                     if (mImageListView.showGroups)
-                        Sort();
+                        AddRemoveGroupItem(item.Index, false);
                 }

                 return ret;
@@ -729,6 +729,69 @@
                 mImageListView.Cursor = cursor;
                 collectionModified = true;
             }
+            /// <summary>
+            /// Updates groups after adding or removing an item. This just updates
+            /// the count of items in groups, it DOES NOT re-sort the items.
+            /// </summary>
+            /// <param name="index">The index of the new or removed item.</param>
+            /// <param name="add">true to add an item; false to remove a item.</param>
+            private void AddRemoveGroupItem(int index, bool add)
+            {
+                if (mImageListView == null || !mImageListView.showGroups)
+                    return;
+                if (mImageListView.groups.Count == 0)
+                {
+                    Sort();
+                    return;
+                }
+
+                // Special case of adding an item to the end
+                ImageListView.ImageListViewGroup lastGroup = mImageListView.groups[mImageListView.groups.Count - 1];
+                if (add && index == lastGroup.LastItemIndex + 1)
+                {
+                    lastGroup.LastItemIndex++;
+                    return;
+                }
+
+                // Insert into a group
+                List<ImageListView.ImageListViewGroup> emptyGroups = new List<ImageListViewGroup>();
+                foreach (ImageListView.ImageListViewGroup group in mImageListView.groups)
+                {
+                    if (group.LastItemIndex < index)
+                        continue;
+                    else if (group.FirstItemIndex <= index && group.LastItemIndex >= index)
+                    {
+                        if (add)
+                        {
+                            group.LastItemIndex++;
+                        }
+                        else
+                        {
+                            group.LastItemIndex--;
+                        }
+                    }
+                    else // if (group.FirstItemIndex > index)
+                    {
+                        if (add)
+                        {
+                            group.FirstItemIndex++;
+                            group.LastItemIndex++;
+                        }
+                        else
+                        {
+                            group.FirstItemIndex--;
+                            group.LastItemIndex--;
+                        }
+                    }
+
+                    if (group.ItemCount == 0)
+                        emptyGroups.Add(group);
+                }
+
+                // Purge empty groups
+                foreach (ImageListView.ImageListViewGroup group in emptyGroups)
+                    mImageListView.groups.Remove(group);
+            }
             #endregion

             #region ImageListViewItemComparer


성경 구절 쿼리 잘못 사용한 것 수정

성경 구절 쿼리 잘못 사용한 것 수정

--- Bible2PPT/MainForm.Build.cs
+++ Bible2PPT/MainForm.Build.cs
@@ -664,12 +664,12 @@
                                 work = builder.BeginBuild(output);
                             }

-                            var startVerseNo = mainChapter.Number == query.StartChapterNumber ? query.StartVerseNumber : 1;
-                        //if (mainChapter.Number == query.EndChapterNumber && query.EndVerseNumber != null)
+                            var startVerseNo = (mainChapter.Number == query.StartChapterNumber) ? query.StartVerseNumber : 1;
+                            var endVerseNo = (mainChapter.Number == query.EndChapterNumber) ? query.EndVerseNumber : null;
                         GET_VERSES:
                             try
                             {
-                                work.AppendChapter(targetEachChapter, startVerseNo, query.EndVerseNumber, cts.Token);
+                                work.AppendChapter(targetEachChapter, startVerseNo, endVerseNo, cts.Token);
                             }
                             catch (OperationCanceledException) when (!cts.IsCancellationRequested)
                             {


バージョンアップ。

バージョンアップ。

--- Implem.Pleasanter/Properties/AssemblyInfo.cs
+++ Implem.Pleasanter/Properties/AssemblyInfo.cs
@@ -10,4 +10,4 @@
 [assembly: AssemblyCulture("")]
 [assembly: ComVisible(false)]
 [assembly: Guid("ec0d3d5b-8879-462b-835f-ff1737a01543")]
-[assembly: AssemblyVersion("0.48.135.*")]+[assembly: AssemblyVersion("0.49.1.*")]


Fixed loading files with repeating number format ids

--- ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Load.cs
+++ ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Load.cs
@@ -863,9 +863,9 @@
                     s.NumberingFormats.Any(nf => ((NumberingFormat) nf).NumberFormatId.Value == numberFormatId))
                 {
                     xlCell.Style.NumberFormat.Format =
-                        ((NumberingFormat)
-                         s.NumberingFormats.Where(nf => ((NumberingFormat) nf).NumberFormatId.Value == numberFormatId).
-                             Single()).FormatCode.Value;
+                        (   (NumberingFormat)s.NumberingFormats
+                            .First(nf => ((NumberingFormat) nf).NumberFormatId.Value == numberFormatId)
+                            ).FormatCode.Value;
                 }
                 else
                     xlCell.Style.NumberFormat.NumberFormatId = Int32.Parse(numberFormatId);


even more dynamic work; invoking members works again

--- Jil/DeserializeDynamic/JsonObject.Dynamic.cs
+++ Jil/DeserializeDynamic/JsonObject.Dynamic.cs
@@ -196,6 +196,77 @@

                 return new DynamicMetaObject(retBlock, restrictions);
             }
+
+            public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
+            {
+                /*
+                 * Effectively returns the following code:
+                 * {
+                 *      var thisEvaled = (JsonObject)<Expression>;
+                 *      object res;
+                 *      ReturnType finalResult;
+                 *      object[] argsRef = new [] { <args 0>, <args 1>, ... };
+                 *      if(!Value.InnerTryInvokeMember(<MemberName>, argsRef, out res))
+                 *      {
+                 *          throw new InvalidCastException("Unable to invoke dynamic member <MemberName> with args ("+string.Join(", ", argsRef)+") on ["+thisRef+"]");
+                 *      }
+                 *      finalResult = (ReturnType)res;
+                 * }
+                 */
+
+                var argsExprs =
+                    args.Select(
+                        exp =>
+                        {
+                            var ret = exp.Expression;
+
+                            if (ret.Type.IsValueType)
+                            {
+                                return Expression.Convert(ret, typeof(object));
+                            }
+
+                            return ret;
+                        }
+                    );
+
+                var thisRef = Expression.Type != typeof(JsonObject) ? Expression.Convert(Expression, typeof(JsonObject)) : Expression;
+                var thisEvaled = Expression.Variable(typeof(JsonObject));
+                var thisAssigned = Expression.Assign(thisEvaled, thisRef);
+                var finalResult = Expression.Variable(binder.ReturnType);
+                var argsRef = Expression.Variable(typeof(object[]));
+                var argsAssigned = Expression.Assign(argsRef, Expression.NewArrayInit(typeof(object), argsExprs.ToArray()));
+                var res = Expression.Variable(typeof(object));
+                var tryInvokeMemberCall = Expression.Call(thisEvaled, InnerTryInvokeMemberMtd, Expression.Constant(binder.Name), argsRef, res);
+                var throwExc =
+                    Expression.Throw(
+                        Expression.New(
+                            InvalidCastExceptionCons,
+                            Expression.Call(
+                                StringConcatArray,
+                                Expression.NewArrayInit(
+                                    typeof(object),
+                                    Expression.Constant("Unable to invoke dynamic member [" + binder.Name + "] with args ("),
+                                    Expression.Call(StringJoin, Expression.Constant(", "), argsRef),
+                                    Expression.Constant(") on ["),
+                                    thisEvaled,
+                                    Expression.Constant("]")
+                                )
+                            )
+                        )
+                    );
+
+                var notIf =
+                    Expression.IfThen(
+                        Expression.Not(tryInvokeMemberCall),
+                        throwExc
+                    );
+                var finalAssign = Expression.Assign(finalResult, Expression.Convert(res, binder.ReturnType));
+
+                var retBlock = Expression.Block(new[] { thisEvaled, finalResult, res, argsRef }, thisAssigned, argsAssigned, notIf, finalAssign);
+                var restrictions = BindingRestrictions.GetTypeRestriction(Expression, LimitType);
+
+                return new DynamicMetaObject(retBlock, restrictions);
+            }
         }

         private static MethodInfo InnerTryGetIndexMtd = typeof(JsonObject).GetMethod("InnerTryGetIndex", BindingFlags.Instance | BindingFlags.NonPublic);
@@ -256,8 +327,8 @@
             return false;
         }

-        /*static readonly IEnumerable<string> ArrayMembers = new[] { "Length", "Count" };
-        public override IEnumerable<string> GetDynamicMemberNames()
+        static readonly IEnumerable<string> ArrayMembers = new[] { "Length", "Count" };
+        /*public override IEnumerable<string> GetDynamicMemberNames()
         {
             System.Diagnostics.Debug.WriteLine(DateTime.UtcNow + ": GetDynamicMemberNames");

@@ -664,24 +735,18 @@
         }

-        /*public bool TryConvert(System.Dynamic.ConvertBinder binder, out object result)
+        private static MethodInfo InnerTryInvokeMemberMtd = typeof(JsonObject).GetMethod("InnerTryInvokeMember", BindingFlags.NonPublic | BindingFlags.Instance);
+        bool InnerTryInvokeMember(string name, object[] args, out object result)
         {
-            return this.InnerTryConvert(binder.ReturnType, out result);
-        }
-
-        public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result)
-        {
-            System.Diagnostics.Debug.WriteLine(DateTime.UtcNow + ": TryInvokeMember(" + ToString(binder) + ", " + ToString(args) + ", out)");
-
             if (Type == JsonObjectType.Object)
             {
-                if (binder.Name == "GetEnumerator" && args.Length == 0)
+                if (name == "GetEnumerator" && args.Length == 0)
                 {
                     result = ObjectMembers.GetEnumerator();
                     return true;
                 }

-                if(binder.Name == "ContainsKey" && args.Length == 1)
+                if(name == "ContainsKey" && args.Length == 1)
                 {
                     var key = args[0] as string;
                     if(key == null)
@@ -700,7 +765,7 @@

             if (Type == JsonObjectType.Array)
             {
-                if (binder.Name == "GetEnumerator" && args.Length == 0)
+                if (name == "GetEnumerator" && args.Length == 0)
                 {
                     result = ArrayMembers.GetEnumerator();
                     return true;
@@ -712,6 +777,6 @@

             result = null;
             return false;
-        }*/
+        }
     }
-}
+}


should fix null exceptions

should fix null exceptions

--- SoraBot-v2/SoraBot-v2/Services/AudioService.cs
+++ SoraBot-v2/SoraBot-v2/Services/AudioService.cs
@@ -277,7 +277,10 @@
                 ? await _lavaNode.GetTracksAsync(query)
                 : await _lavaNode.SearchYouTubeAsync(query);

-            if (search.LoadResultType == LoadResultType.NoMatches || search.LoadResultType == LoadResultType.LoadFailed)
+            if (search.LoadResultType == LoadResultType.NoMatches
+                || search.LoadResultType == LoadResultType.LoadFailed
+                || search.Tracks == null
+                || !search.Tracks.Any())
             {
                 return (null, false, null, 0);
             }


SagePay had a wrong casing for txAuthNo and vendorTxCode in the callback

--- Source/TeaCommerce.PaymentProviders/SagePay.cs
+++ Source/TeaCommerce.PaymentProviders/SagePay.cs
@@ -228,9 +228,9 @@
             callbackInfo = new CallbackInfo( order.TotalPrice.WithVat, transaction, request.Form[ "TxType" ] != "PAYMENT" ? PaymentState.Authorized : PaymentState.Captured, cardType, last4Digits );

             if ( status == "OK" ) {
-              order.Properties.AddOrUpdate( new CustomProperty( "TxAuthNo", txAuthNo ) { ServerSideOnly = true } );
+              order.Properties.AddOrUpdate( new CustomProperty( "txAuthNo", txAuthNo ) { ServerSideOnly = true } );
             }
-            order.Properties.AddOrUpdate( new CustomProperty( "VendorTxCode", vendorTxCode ) { ServerSideOnly = true } );
+            order.Properties.AddOrUpdate( new CustomProperty( "vendorTxCode", vendorTxCode ) { ServerSideOnly = true } );
             order.Save();

             inputFields[ "Status" ] = "OK";
@@ -294,7 +294,7 @@

           apiInfo = new ApiInfo( responseFields[ "VPSTxId" ], PaymentState.Captured );
         } else {
-          LoggingService.Instance.Log( "Quickpay(" + order.OrderNumber + ") - Error making API request: " + responseFields[ "StatusDetail" ] );
+          LoggingService.Instance.Log( "Sage pay(" + order.OrderNumber + ") - Error making API request: " + responseFields[ "StatusDetail" ] );
         }
       } catch ( Exception exp ) {
         LoggingService.Instance.Log( exp, "Sage pay(" + order.OrderNumber + ") - Cancel payment" );
@@ -337,13 +337,13 @@
         IDictionary<string, string> responseFields = GetFields( MakePostRequest( GetMethodUrl( "REFUND", settings ), inputFields ) );

         if ( responseFields[ "Status" ] == "OK" ) {
-          order.Properties.AddOrUpdate( new CustomProperty( "VendorTxCode", vendorTxCode.ToString() ) { ServerSideOnly = true } );
-          order.Properties.AddOrUpdate( new CustomProperty( "TxAuthNo", responseFields[ "TxAuthNo" ] ) { ServerSideOnly = true } );
+          order.Properties.AddOrUpdate( new CustomProperty( "vendorTxCode", vendorTxCode.ToString() ) { ServerSideOnly = true } );
+          order.Properties.AddOrUpdate( new CustomProperty( "txAuthNo", responseFields[ "TxAuthNo" ] ) { ServerSideOnly = true } );
           order.Save();

           apiInfo = new ApiInfo( responseFields[ "VPSTxId" ], PaymentState.Refunded );
         } else {
-          LoggingService.Instance.Log( "Quickpay(" + order.OrderNumber + ") - Error making API request: " + responseFields[ "StatusDetail" ] );
+          LoggingService.Instance.Log( "Sage pay(" + order.OrderNumber + ") - Error making API request: " + responseFields[ "StatusDetail" ] );
         }
       } catch ( Exception exp ) {
         LoggingService.Instance.Log( exp, "Sage pay(" + order.OrderNumber + ") - Refund payment" );
@@ -374,7 +374,7 @@
         if ( responseFields[ "Status" ] == "OK" ) {
           apiInfo = new ApiInfo( order.TransactionInformation.TransactionId, PaymentState.Cancelled );
         } else {
-          LoggingService.Instance.Log( "Quickpay(" + order.OrderNumber + ") - Error making API request: " + responseFields[ "StatusDetail" ] );
+          LoggingService.Instance.Log( "Sage pay(" + order.OrderNumber + ") - Error making API request: " + responseFields[ "StatusDetail" ] );
         }
       } catch ( Exception exp ) {
         LoggingService.Instance.Log( exp, "Sage pay(" + order.OrderNumber + ") - Cancel payment" );


Minimum subarray sum

Minimum subarray sum

--- LeetCode/remote/minimum_size_subarray_sum.cs
+++ LeetCode/remote/minimum_size_subarray_sum.cs
@@ -47,3 +47,36 @@
         Console.WriteLine(s.MinSubArrayLen(7, new [] { 2,3,1,2,4,3 }));
     }
 }
+
+//  https://leetcode.com/submissions/detail/58672848/
+//
+//  Submission Details
+//  14 / 14 test cases passed.
+//      Status: Accepted
+//      Runtime: 152 ms
+//
+//          Submitted: 0 minutes ago
+//  You are here!
+//  Your runtime beats 80.43% of csharpsubmissions.
+public class Solution {
+    public int MinSubArrayLen(int s, int[] nums) {
+        var sum = 0;
+        var left = 0;
+        var minLength = int.MaxValue;
+        for (var right = 0; right < nums.Length; right++)
+        {
+            sum += nums[right];
+            while (sum >= s && left <= right)
+            {
+                minLength = right - left + 1 < minLength ?
+                                right - left + 1 :
+                                minLength;
+
+                sum -= nums[left];
+                left++;
+            }
+        }
+
+        return minLength == int.MaxValue ? 0 : minLength;
+    }
+}


Add new product types

Add new product types

--- LegoSharp/ProductSearch/ProductTypeFilter.cs
+++ LegoSharp/ProductSearch/ProductTypeFilter.cs
@@ -18,10 +18,12 @@
         }

         public static readonly ProductType Accessories = new ProductType("de583581-4dd0-4f6b-981b-8b31b9a0fb48", "Accessories");
+        public static readonly ProductType Accessories2021 = new ProductType("dd68422b-55a5-435d-9cf0-0f8d92e0438f", "Accessories");
         public static readonly ProductType AllOccasions = new ProductType("46b31f0e-4ecc-468e-a798-c763a617de1f", "All Occasions");
         public static readonly ProductType BackpacksAndLunchBoxes = new ProductType("0583fca4-8422-489d-a46d-c4bdcb294fd3", "Backpacks & Lunch Boxes");
         public static readonly ProductType Birthday = new ProductType("50cc97a5-c9c8-4e2e-90b6-df8e4ec8e359", "Birthday");
         public static readonly ProductType Books = new ProductType("d20ecc4f-1dd8-4f1d-8158-fe2c59bdbbbe", "Books");
+        public static readonly ProductType Bottoms = new ProductType("839a7260-9a8a-43fb-a867-ac96ec23b007", "Bottoms");
         public static readonly ProductType BrickAccessories = new ProductType("59d5df5c-543e-4b5b-9299-d41b7b480afa", "Brick accessories");
         public static readonly ProductType ChineseNewYear = new ProductType("6c7eae27-1b84-46dc-93b0-a8718f099a30", "Chinese New Year");
         public static readonly ProductType Classic = new ProductType("975369b1-17a2-42e6-a39f-0386b85def5b", "Classic");
@@ -36,11 +38,15 @@
         public static readonly ProductType Minifigures = new ProductType("a46f1ffd-db4d-4813-89d1-5d19f8737ef5", "Minifigures");
         public static readonly ProductType Mugs = new ProductType("de52c0e8-5ae5-4ae6-a32c-7749360e1fba", "Mugs");
         public static readonly ProductType Ornaments = new ProductType("40ddce98-5599-40bf-a674-23388ae4632c", "Ornaments");
+        public static readonly ProductType Pets = new ProductType("0a223b30-5191-4939-821a-3f5c33e68cbc", "Pets");
         public static readonly ProductType Polybag = new ProductType("c9f9b650-5988-4828-acd8-194a83668100", "Polybag");
         public static readonly ProductType PowerFunctions = new ProductType("a6013c1e-72dd-4e0b-a506-c13c0a0dc44b", "Power Functions");
         public static readonly ProductType RolePlayAndCostumes = new ProductType("5dc73b3a-0138-4e0b-afd2-01a6b30fb94e", "Role Play & Costumes");
         public static readonly ProductType Sets = new ProductType("12ba8640-7fb5-4281-991d-ac55c65d8001", "Sets");
+        public static readonly ProductType Sneakers = new ProductType("698ef177-5804-4186-9b36-5b78cc89eecd", "Sneakers");
         public static readonly ProductType Stationery = new ProductType("275e987f-0cc8-44fb-9afe-a2ee0791da78", "Stationery");
+        public static readonly ProductType Sweatshirts = new ProductType("dcf8f875-2414-40cb-b7c4-c532797e34fc", "Sweatshirts");
+        public static readonly ProductType TShirts = new ProductType("c55e4054-c667-4a86-80a7-b1fc56726132", "T-Shirts");
         public static readonly ProductType VideoGames = new ProductType("db541156-1955-4ad9-a45d-679742692c78", "Video Games");
         public static readonly ProductType WatchesAndClocks = new ProductType("aa9810a1-cf06-450f-a39f-f3a27100b2aa", "Watches & Clocks");
         public static readonly ProductType Wedding = new ProductType("dd2c1d83-bd9b-4cc8-b7a9-02cbc8520531", "Wedding");


Refactor

Refactor

--- LifeDISA/LifeDISA/Program.cs
+++ LifeDISA/LifeDISA/Program.cs
@@ -47,13 +47,8 @@
 					.Where(x => x.Contains(":"))
 					.Select(x =>  x.Split(':')))
 				{
-					namesByIndex.Add(int.Parse(item[0].TrimStart('@')), "\"" + item[1] + "\"");
+					namesByIndex.Add(int.Parse(item[0].TrimStart('@')), item[1]);
 				}
-			}
-			else
-			{
-				Console.WriteLine("A folder named {0} is required", string.Join(" / ", validFolderNames));
-				return -1;
 			}

 			if(File.Exists(@"GAMEDATA\OBJETS.ITD"))
@@ -65,30 +60,19 @@
 				for(int s = 0 ; s < count ; s++)
 				{
 					int n = s * 52 + 2;
-					int name = allBytes.ReadShort(n+10);
-					if(name != -1 && name != 0)
+					int index = allBytes.ReadShort(n+10);
+					if(index != -1 && index != 0)
 					{
-						objectsByIndex.Add(i, GetObjectName(namesByIndex[name], i));
+						string name = namesByIndex[index].ToLowerInvariant();
+						name = string.Join("_", name.Split(' ').Where(x => x != "an" && x != "a").ToArray());
+						objectsByIndex.Add(i, name);
 					}

 					i++;
 				}
 			}
-			else
-			{
-				Console.WriteLine("OBJETS.ITD is required");
-				return -1;
-			}
-
-			objectsByIndex[-1] = "-1";
-		    objectsByIndex[1] = "PLAYER";
-		    for(int i = 0 ; i < 1000 ; i++)
-		    {
-		    	if(!objectsByIndex.ContainsKey(i)) objectsByIndex[i] = "OBJ" + i;
-		    }
-
+
 		    isCDROMVersion = AskForCDROMVersion();
-			Console.WriteLine();

 			using (TextWriter writer = new StreamWriter("output.txt"))
 			{
@@ -129,7 +113,6 @@

 			while(pos < allBytes.Length)
 			{
-
 				while (indentation.Contains(pos))
 				{
 					indentation.RemoveAt(indentation.IndexOf(pos));
@@ -179,7 +162,7 @@
 				string lifeString = life.ToString();
 				if(lifeString.StartsWith("IF")) lifeString = "IF";
 				else if(lifeString == "MULTI_CASE") lifeString = "CASE";
-				if(actor != -1) lifeString = objectsByIndex[actor] + "." + lifeString;
+				if(actor != -1) lifeString = GetObject(actor) + "." + lifeString;

 				if(consecutiveIfs)
 				{
@@ -206,8 +189,9 @@
 						string paramB = Evalvar();

 						string paramAShort = paramA.Split('.').Last();
-						if(IsTargetingObject(paramAShort))
-							paramB = objectsByIndex[int.Parse(paramB)];
+
+						if(paramAShort == "INHAND" || paramAShort == "COL_BY" || paramAShort == "HIT_BY" || paramAShort == "HIT" || paramAShort == "ACTOR_COLLIDER")
+							paramB = GetObject(int.Parse(paramB));

 						if(paramAShort == "ANIM")
 							paramB = vars.GetText("ANIMS", paramB);
@@ -405,14 +389,14 @@
 					case LifeEnum.FOUND:
 						curr = allBytes.ReadShort(pos);
 						pos +=2;
-						writer.Write("{0}", objectsByIndex[curr]);
+						writer.Write("{0}", GetObject(curr));
 						break;

 					case LifeEnum.FOUND_NAME:
 					case LifeEnum.MESSAGE:
 						curr = allBytes.ReadShort(pos);
 						pos +=2;
-						writer.Write("{0}", namesByIndex[curr]);
+						writer.Write("{0}", GetName(curr));
 						break;

 					case LifeEnum.FOUND_FLAG:
@@ -486,23 +470,24 @@
 					case LifeEnum.PUT_AT:
 						curr = allBytes.ReadShort(pos);
 						pos +=2;
-						writer.Write("{0} ", objectsByIndex[curr]);
-						curr = allBytes.ReadShort(pos);
-						pos +=2;
-						writer.Write("{0}", objectsByIndex[curr]);
+						writer.Write("{0} ", GetObject(curr));
+						curr = allBytes.ReadShort(pos);
+						pos +=2;
+						writer.Write("{0}", GetObject(curr));
 						break;

 					case LifeEnum.TRACKMODE:
 						curr = allBytes.ReadShort(pos);
 						pos +=2;
-						writer.Write("{0} ", trackModes[curr]);
+						writer.Write("{0} ", GetTrackMode(curr));
+
 						int trackmode = curr;
 						curr = allBytes.ReadShort(pos);
 						pos +=2;
 						switch(trackmode)
 						{
 							case 2: //follow
-								writer.Write("{0}", objectsByIndex[curr]);
+								writer.Write("{0}", GetObject(curr));
 								break;
 							case 3: //track
 								writer.Write("{0}", vars.GetText("TRACKS", curr));
@@ -536,20 +521,8 @@
 						pos +=2;

 						string lastSwitchVar = switchEvalVar[pos-4].Split('.').Last();
-						if(IsTargetingObject(lastSwitchVar))
-							writer.Write("{0}", objectsByIndex[curr]);
-						else if (IsTargetingAction(lastSwitchVar))
-							writer.Write("{0}", GetActionName(curr));
-						else if (lastSwitchVar == "ANIM")
-							writer.Write("{0}", vars.GetText("ANIMS", curr));
-						else if (lastSwitchVar == "BODY")
-							writer.Write("{0}", vars.GetText("BODYS", curr));
-						else if (lastSwitchVar == "KEYBOARD_INPUT")
-								writer.Write("{0}", vars.GetText("KEYBOARD INPUT", curr));
-						else if(lastSwitchVar.StartsWith("POSREL"))
-							writer.Write("{0}", vars.GetText("POSREL", curr));
-						else
-							writer.Write("{0}", curr);
+
+						writer.Write("{0}", GetSwitchCaseName(curr, lastSwitchVar));

 						curr = allBytes.ReadShort(pos);
 						pos +=2;
@@ -565,22 +538,9 @@
 						for(int n = 0; n < numcases; n++) {
 							curr = allBytes.ReadShort(pos);
 							pos += 2;
-
-							if(IsTargetingObject(lastSwitchVarb))
-								writer.Write("{0}", objectsByIndex[curr]);
-							else if (IsTargetingAction(lastSwitchVarb))
-								writer.Write("{0}", GetActionName(curr));
-							else if (lastSwitchVarb == "ANIM")
-								writer.Write("{0}", vars.GetText("ANIMS", curr));
-							else if (lastSwitchVarb == "BODY")
-								writer.Write("{0}", vars.GetText("BODYS", curr));
-							else if (lastSwitchVarb == "KEYBOARD_INPUT")
-								writer.Write("{0}", vars.GetText("KEYBOARD INPUT", curr));
-							else if(lastSwitchVarb.StartsWith("POSREL"))
-								writer.Write("{0}", vars.GetText("POSREL", curr));
-							else
-								writer.Write("{0}", curr);

+							writer.Write("{0}", GetSwitchCaseName(curr, lastSwitchVarb));
+
 							if(n > 0) writer.Write(" ");
 							else writer.Write(", ");
 						}
@@ -679,7 +639,7 @@
 						}

 						curr = allBytes.ReadShort(pos);
-						writer.Write("{0} ", objectsByIndex[curr]);
+						writer.Write("{0} ", GetObject(curr));
 						pos += 2;

 						for(int i = 0 ; i < 2 ; i++)
@@ -732,11 +692,11 @@
 						int obj;
 						if(int.TryParse(ev, out obj))
 						{
-							ev = objectsByIndex[obj];
+							ev = GetObject(obj);
 						}
 						writer.Write("{0} ", ev);
 						curr = allBytes.ReadShort(pos);
-						writer.Write("{0} ", objectsByIndex[curr]);
+						writer.Write("{0} ", GetObject(curr));
 						pos += 2;
 						break;

@@ -795,18 +755,75 @@
 			}
 		}

-		static string GetObjectName(string name, int index)
+		static string GetSwitchCaseName(int value, string lastSwitchVar)
 		{
-			string objectName = name.TrimStart('"').TrimEnd('"').ToLowerInvariant();
-			objectName = string.Join("_", objectName.Split(' ').Where(x => x != "AN" && x != "A").ToArray());
-			return objectName + "_" + index;
+			if(lastSwitchVar.StartsWith("POSREL"))
+			{
+				return vars.GetText("POSREL", value);
+			}
+
+			switch (lastSwitchVar)
+			{
+				case "INHAND":
+				case "COL_BY":
+				case "HIT_BY":
+				case "HIT":
+				case "ACTOR_COLLIDER":
+					return GetObject(value);
+
+				case "ACTION":
+				case "player_current_action":
+					return vars.GetText("ACTIONS", value);
+
+				case "ANIM":
+					return vars.GetText("ANIMS", value);
+
+				case "BODY":
+					return vars.GetText("BODYS", value);
+
+				case "KEYBOARD_INPUT":
+					return vars.GetText("KEYBOARD INPUT", value);
+
+				default:
+					return value.ToString();
+			}
 		}

-		static string GetActionName(int value)
+		static string GetObject(int index)
 		{
-			return vars.GetText("ACTIONS", value);
+			if (index == -1)
+			{
+				return "-1";
+			}
+
+			if (index == 1)
+			{
+				return "PLAYER";
+			}
+
+			string text;
+			if (objectsByIndex.TryGetValue(index, out text))
+			{
+				return text + "_" + index;
+			}
+			return "OBJ" + index;
 		}

+		static string GetName(int index)
+		{
+			string text;
+			if (namesByIndex.TryGetValue(index, out text))
+			{
+				return "\"" + text + "\"";
+			}
+			return "MSG" + index;
+		}
+
+		static string GetTrackMode(int index)
+		{
+			return trackModes[index];
+		}
+
 		static void WriteLine(TextWriter writer, int indentation, string text)
 		{
 			writer.Write("{0}{1}",  new String('\t', indentation), text);
@@ -816,23 +833,8 @@
 		{
 			int actor;
 			string eval = EvalvarImpl(out actor);
-			if(actor != -1) eval = objectsByIndex[actor] + "." + eval;
+			if(actor != -1) eval = GetObject(actor) + "." + eval;
 			return eval;
-		}
-
-		static bool IsTargetingAction(string varName)
-		{
-			return varName == "ACTION"
-				|| varName == "player_current_action";
-		}
-
-		static bool IsTargetingObject(string varName)
-		{
-			return varName == "INHAND"
-				|| varName == "COL_BY"
-				|| varName == "HIT_BY"
-				|| varName == "HIT"
-				|| varName == "ACTOR_COLLIDER";
 		}

 		static bool AskForCDROMVersion()
@@ -912,22 +914,22 @@
 				case 0xE:
 					curr = allBytes.ReadShort(pos);
 					pos += 2;
-					return "DIST("+objectsByIndex[curr]+")";
+					return "DIST("+GetObject(curr)+")";
 				case 0xF:
 					return "COL_BY";
 				case 0x10:
 					string eval = Evalvar();
 					int objectIndex;
 					if(int.TryParse(eval, out objectIndex))
-						return "ISFOUND("+objectsByIndex[objectIndex]+")";
-					else
-						return "ISFOUND("+eval+")";
+						return "ISFOUND("+GetObject(objectIndex)+")";
+
+					return "ISFOUND("+eval+")";
 				case 0x11:
 					return "ACTION";
 				case 0x12:
 					curr = allBytes.ReadShort(pos);
 					pos += 2;
-					return "POSREL("+objectsByIndex[curr]+")";
+					return "POSREL("+GetObject(curr)+")";
 				case 0x13:
 					return "KEYBOARD_INPUT";
 				case 0x14:
@@ -959,7 +961,7 @@
 				case 0x20:
 					curr = allBytes.ReadShort(pos);
 					pos += 2;
-					return "OBJECT("+objectsByIndex[curr]+")";
+					return "OBJECT("+GetObject(curr)+")";
 				case 0x21:
 					return "ROOMY";
 				case 0x22:
@@ -967,7 +969,7 @@
 					pos += 2;
 					int curr2 = allBytes.ReadShort(pos);
 					pos += 2;
-					return "TEST_ZV_END_ANIM (" + curr + " " + curr + ")";
+					return "TEST_ZV_END_ANIM(" + curr + " " + curr + ")";
 				case 0x23:
 					return "MUSIC";
 				case 0x24:
@@ -979,7 +981,7 @@
 				case 0x26:
 					curr = allBytes.ReadShort(pos);
 					pos += 2;
-					return "THROW("+objectsByIndex[curr]+")";
+					return "THROW("+GetObject(curr)+")";
 				default:
 					throw new NotImplementedException(curr.ToString());
 			}


Changed WorldToScreenPoint and ScreenToWorldPoint so Z is positive when in front of camera.

--- Source/XenkoToolkit/Engine/CameraExtensions.cs
+++ Source/XenkoToolkit/Engine/CameraExtensions.cs
@@ -137,15 +137,12 @@

             Vector3.TransformCoordinate(ref position, ref cameraComponent.ViewMatrix, out var viewSpace);

-
-            var screenSpace = new Vector3
+            result = new Vector3
             {
                 X = (clipSpace.X + 1f) / 2f,
                 Y = 1f - (clipSpace.Y + 1f) / 2f,
-                Z = viewSpace.Z,
+                Z = -viewSpace.Z,
             };
-
-            result = screenSpace;
         }

         /// <summary>
@@ -247,7 +244,7 @@

             Vector3.TransformCoordinate(ref clipSpace, ref inverseProjection, out var near);

-            near.Z = position.Z;
+            near.Z = -position.Z;

             Vector3.TransformCoordinate(ref near, ref inverseView, out result);


Add ToBsonArray extensions method to IEnumerable

--- LiteDB/Document/BsonArray.cs
+++ LiteDB/Document/BsonArray.cs
@@ -5,6 +5,17 @@

 namespace LiteDB
 {
+    public static class BsonArrayExtensions
+    {
+        /// <summary>
+        /// Convert an IEnumerable of BsonValues into a single BsonArray with all elements
+        /// </summary>
+        public static BsonArray ToBsonArray(this IEnumerable<BsonValue> values)
+        {
+            return new BsonArray(values);
+        }
+    }
+
     public class BsonArray : BsonValue, IList<BsonValue>
     {
         public BsonArray()


Circuit compilation occurs in a worker thread

--- LiveSPICE/Simulation.xaml.cs
+++ LiveSPICE/Simulation.xaml.cs
@@ -104,12 +104,9 @@

             schematic.Schematic = new SimulationSchematic(clone);

-            ContentRendered += (o, e) =>
-            {
-                waveIo = new AudioIo.WaveIo(ProcessSamples, (int)sampleRate, 1, bitsPerSample, (double)latency);
-
-                Build();
-            };
+            waveIo = new AudioIo.WaveIo(ProcessSamples, (int)sampleRate, 1, bitsPerSample, (double)latency);
+
+            Build();
         }

         private void OnElementAdded(object sender, Circuit.ElementEventArgs e)
@@ -155,13 +152,17 @@
                         oscilloscope.RemoveSignal(i);
             }
         }
-
+
+        private BackgroundWorker builder;
         protected void Build()
         {
+            simulation = null;
             try
             {
                 Circuit.Circuit circuit = schematic.Schematic.Schematic.Build(log);
-                simulation = new Circuit.Simulation(circuit, sampleRate, Oversample, log);
+                builder = new BackgroundWorker();
+                builder.DoWork += (o, e) => simulation = new Circuit.Simulation(circuit, sampleRate, Oversample, log);
+                builder.RunWorkerAsync();
             }
             catch (System.Exception ex)
             {


Delete 20160517051234_PostCodeChanges.cs

--- AllReadyApp/Web-App/AllReady/Migrations/20160517051234_PostCodeChanges.cs
+++ AllReadyApp/Web-App/AllReady/Migrations/20160517051234_PostCodeChanges.cs
@@ -1,305 +0,0 @@
-using Microsoft.Data.Entity.Migrations;
-
-namespace AllReady.Migrations
-{
-    public partial class PostCodeChanges : Migration
-    {
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DropForeignKey(name: "FK_Campaign_Organization_ManagingOrganizationId", table: "Campaign");
-            migrationBuilder.DropForeignKey(name: "FK_CampaignContact_Campaign_CampaignId", table: "CampaignContact");
-            migrationBuilder.DropForeignKey(name: "FK_CampaignContact_Contact_ContactId", table: "CampaignContact");
-            migrationBuilder.DropForeignKey(name: "FK_Event_Campaign_CampaignId", table: "Event");
-            migrationBuilder.DropForeignKey(name: "FK_EventSkill_Event_EventId", table: "EventSkill");
-            migrationBuilder.DropForeignKey(name: "FK_EventSkill_Skill_SkillId", table: "EventSkill");
-            migrationBuilder.DropForeignKey(name: "FK_Location_PostalCodeGeo_PostalCodePostalCode", table: "Location");
-            migrationBuilder.DropForeignKey(name: "FK_OrganizationContact_Contact_ContactId", table: "OrganizationContact");
-            migrationBuilder.DropForeignKey(name: "FK_OrganizationContact_Organization_OrganizationId", table: "OrganizationContact");
-            migrationBuilder.DropForeignKey(name: "FK_TaskSkill_Skill_SkillId", table: "TaskSkill");
-            migrationBuilder.DropForeignKey(name: "FK_TaskSkill_AllReadyTask_TaskId", table: "TaskSkill");
-            migrationBuilder.DropForeignKey(name: "FK_UserSkill_Skill_SkillId", table: "UserSkill");
-            migrationBuilder.DropForeignKey(name: "FK_UserSkill_ApplicationUser_UserId", table: "UserSkill");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
-            migrationBuilder.DropColumn(name: "PostalCodePostalCode", table: "Location");
-            migrationBuilder.AddColumn<string>(
-                name: "PostalCode",
-                table: "Location",
-                nullable: true);
-            migrationBuilder.AddForeignKey(
-                name: "FK_Campaign_Organization_ManagingOrganizationId",
-                table: "Campaign",
-                column: "ManagingOrganizationId",
-                principalTable: "Organization",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_CampaignContact_Campaign_CampaignId",
-                table: "CampaignContact",
-                column: "CampaignId",
-                principalTable: "Campaign",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_CampaignContact_Contact_ContactId",
-                table: "CampaignContact",
-                column: "ContactId",
-                principalTable: "Contact",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_Event_Campaign_CampaignId",
-                table: "Event",
-                column: "CampaignId",
-                principalTable: "Campaign",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_EventSkill_Event_EventId",
-                table: "EventSkill",
-                column: "EventId",
-                principalTable: "Event",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_EventSkill_Skill_SkillId",
-                table: "EventSkill",
-                column: "SkillId",
-                principalTable: "Skill",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_OrganizationContact_Contact_ContactId",
-                table: "OrganizationContact",
-                column: "ContactId",
-                principalTable: "Contact",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_OrganizationContact_Organization_OrganizationId",
-                table: "OrganizationContact",
-                column: "OrganizationId",
-                principalTable: "Organization",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_TaskSkill_Skill_SkillId",
-                table: "TaskSkill",
-                column: "SkillId",
-                principalTable: "Skill",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_TaskSkill_AllReadyTask_TaskId",
-                table: "TaskSkill",
-                column: "TaskId",
-                principalTable: "AllReadyTask",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_UserSkill_Skill_SkillId",
-                table: "UserSkill",
-                column: "SkillId",
-                principalTable: "Skill",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_UserSkill_ApplicationUser_UserId",
-                table: "UserSkill",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
-                table: "AspNetRoleClaims",
-                column: "RoleId",
-                principalTable: "AspNetRoles",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
-                table: "AspNetUserClaims",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
-                table: "AspNetUserLogins",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
-                table: "AspNetUserRoles",
-                column: "RoleId",
-                principalTable: "AspNetRoles",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
-                table: "AspNetUserRoles",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Cascade);
-        }
-
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DropForeignKey(name: "FK_Campaign_Organization_ManagingOrganizationId", table: "Campaign");
-            migrationBuilder.DropForeignKey(name: "FK_CampaignContact_Campaign_CampaignId", table: "CampaignContact");
-            migrationBuilder.DropForeignKey(name: "FK_CampaignContact_Contact_ContactId", table: "CampaignContact");
-            migrationBuilder.DropForeignKey(name: "FK_Event_Campaign_CampaignId", table: "Event");
-            migrationBuilder.DropForeignKey(name: "FK_EventSkill_Event_EventId", table: "EventSkill");
-            migrationBuilder.DropForeignKey(name: "FK_EventSkill_Skill_SkillId", table: "EventSkill");
-            migrationBuilder.DropForeignKey(name: "FK_OrganizationContact_Contact_ContactId", table: "OrganizationContact");
-            migrationBuilder.DropForeignKey(name: "FK_OrganizationContact_Organization_OrganizationId", table: "OrganizationContact");
-            migrationBuilder.DropForeignKey(name: "FK_TaskSkill_Skill_SkillId", table: "TaskSkill");
-            migrationBuilder.DropForeignKey(name: "FK_TaskSkill_AllReadyTask_TaskId", table: "TaskSkill");
-            migrationBuilder.DropForeignKey(name: "FK_UserSkill_Skill_SkillId", table: "UserSkill");
-            migrationBuilder.DropForeignKey(name: "FK_UserSkill_ApplicationUser_UserId", table: "UserSkill");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
-            migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
-            migrationBuilder.DropColumn(name: "PostalCode", table: "Location");
-            migrationBuilder.AddColumn<string>(
-                name: "PostalCodePostalCode",
-                table: "Location",
-                nullable: true);
-            migrationBuilder.AddForeignKey(
-                name: "FK_Campaign_Organization_ManagingOrganizationId",
-                table: "Campaign",
-                column: "ManagingOrganizationId",
-                principalTable: "Organization",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_CampaignContact_Campaign_CampaignId",
-                table: "CampaignContact",
-                column: "CampaignId",
-                principalTable: "Campaign",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_CampaignContact_Contact_ContactId",
-                table: "CampaignContact",
-                column: "ContactId",
-                principalTable: "Contact",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_Event_Campaign_CampaignId",
-                table: "Event",
-                column: "CampaignId",
-                principalTable: "Campaign",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_EventSkill_Event_EventId",
-                table: "EventSkill",
-                column: "EventId",
-                principalTable: "Event",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_EventSkill_Skill_SkillId",
-                table: "EventSkill",
-                column: "SkillId",
-                principalTable: "Skill",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_Location_PostalCodeGeo_PostalCodePostalCode",
-                table: "Location",
-                column: "PostalCodePostalCode",
-                principalTable: "PostalCodeGeo",
-                principalColumn: "PostalCode",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_OrganizationContact_Contact_ContactId",
-                table: "OrganizationContact",
-                column: "ContactId",
-                principalTable: "Contact",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_OrganizationContact_Organization_OrganizationId",
-                table: "OrganizationContact",
-                column: "OrganizationId",
-                principalTable: "Organization",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_TaskSkill_Skill_SkillId",
-                table: "TaskSkill",
-                column: "SkillId",
-                principalTable: "Skill",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_TaskSkill_AllReadyTask_TaskId",
-                table: "TaskSkill",
-                column: "TaskId",
-                principalTable: "AllReadyTask",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_UserSkill_Skill_SkillId",
-                table: "UserSkill",
-                column: "SkillId",
-                principalTable: "Skill",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_UserSkill_ApplicationUser_UserId",
-                table: "UserSkill",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
-                table: "AspNetRoleClaims",
-                column: "RoleId",
-                principalTable: "AspNetRoles",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
-                table: "AspNetUserClaims",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
-                table: "AspNetUserLogins",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
-                table: "AspNetUserRoles",
-                column: "RoleId",
-                principalTable: "AspNetRoles",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-            migrationBuilder.AddForeignKey(
-                name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
-                table: "AspNetUserRoles",
-                column: "UserId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id",
-                onDelete: ReferentialAction.Restrict);
-        }
-    }
-}


Set parent to null after OnUnLoad so that the children can use the parent for unregistering events, etc.

--- Source/Eto/Forms/Container.cs
+++ Source/Eto/Forms/Container.cs
@@ -175,12 +175,11 @@
 				if (!ReferenceEquals(child.Parent, this))
 					throw new EtoException("The child control is not a child of this container. Ensure you only remove children that you own.");
 #endif
-				var parent = child.Parent;
+				if (child.Loaded)
+				{
+					child.OnUnLoad(EventArgs.Empty);
+				}
 				child.Parent = null;
-				if (child.Loaded)
-				{
-					child.OnUnLoad(EventArgs.Empty);
-				}
 				child.OnDataContextChanged(EventArgs.Empty);
 			}
 		}


Removed a comment in assemblyinfo that was messing with powershell replace script

--- LinqToQuerystring/Properties/AssemblyInfo.cs
+++ LinqToQuerystring/Properties/AssemblyInfo.cs
@@ -31,6 +31,5 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("0.6.5.*")]
 [assembly: AssemblyFileVersion("0.6.5.0")]


Fixes #46

Fixes #46

Checks if the the user has Unchecked the option of 'Music Widget Enabled' in the settings.
If is unchecked then stops the Floating Notification Service and loads the Notification Fragment again.
(This is a dirty fix, the ideal scenario would be to also check if the Floating Notification Serice is running in the first place, so I won't make unnecesary calls and try to stop something that's already stopped, same goes for loading the NotificationFragment, if it's already loaded, don't load it again.)

--- LiveDisplay/Activities/LockScreenActivity.cs
+++ LiveDisplay/Activities/LockScreenActivity.cs
@@ -154,6 +154,8 @@

         private void WatchdogInterval_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
         {
+
+            //it works correctly, but I want to refactor this. (Regression)
             if (currentActivityState== ActivityStates.Resumed)
             Awake.TurnOffScreen();
         }
@@ -326,17 +328,25 @@
             watchDog.Stop();
             watchDog.Start();
             OnActivityStateChanged?.Invoke(null, new LockScreenLifecycleEventArgs { State = ActivityStates.Resumed });
-            if (Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch)
-            {
-                MusicController.MusicPlaying += MusicController_MusicPlaying;
-                MusicController.MusicPaused += MusicController_MusicPaused;
+            if (configurationManager.RetrieveAValue(ConfigurationParameters.MusicWidgetEnabled))
+            {
+                if (Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch)
+                {
+                    MusicController.MusicPlaying += MusicController_MusicPlaying;
+                    MusicController.MusicPaused += MusicController_MusicPaused;
+                }
+                else
+                {
+                    MusicControllerKitkat.MusicPlaying += MusicControllerKitkat_MusicPlaying;
+                    MusicControllerKitkat.MusicPaused += MusicControllerKitkat_MusicPaused;
+                }
             }
             else
             {
-                MusicControllerKitkat.MusicPlaying += MusicControllerKitkat_MusicPlaying;
-                MusicControllerKitkat.MusicPaused += MusicControllerKitkat_MusicPaused;
-            }
-            if (isMusicWidgetPresent) //It'll always be true(?)
+                StopMusicController();
+                StopFloatingNotificationService();
+            }
+            if (isMusicWidgetPresent) //It'll always be true(?) (What's this field for)? //Regression test!
             {
                 CheckIfMusicIsStillPaused();
             }


Fix interface list. refs #42

Fix interface list. refs #42

--- Source/Orleankka/StreamRef.cs
+++ Source/Orleankka/StreamRef.cs
@@ -10,7 +10,7 @@
 {
     [Serializable]
     [DebuggerDisplay("s->{ToString()}")]
-    public class StreamRef : IAsyncObservable<object>
+    public class StreamRef : IAsyncObservable<object>, IEquatable<StreamRef>, IEquatable<StreamPath>, ISerializable
     {
         public static StreamRef Deserialize(StreamPath path)
         {


Remove synchronous GetResponse method (it deadlocks the request thread). Remove GetResponseString method because it may deadklock the thread and it is only a convenience method for debugging.

--- LtiLibrary.Core/Extensions/HttpExtensions.cs
+++ LtiLibrary.Core/Extensions/HttpExtensions.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
 using System.Net.Http;
 using System.Threading.Tasks;

@@ -17,14 +18,10 @@
             }
         }

+        [Obsolete("Use GetResponseAsync instead.")]
         public static HttpResponseMessage GetResponse(this HttpRequestMessage message, bool allowAutoRedirect = false)
         {
             return GetResponseAsync(message, allowAutoRedirect).Result;
-        }
-
-        public static Stream GetRequestStream(this HttpRequestMessage message)
-        {
-            return message.Content.ReadAsStreamAsync().Result;
         }

         public static Stream GetResponseStream(this HttpResponseMessage message)


Adds negative scenario tests for FrozenAttribute.

--- Src/AutoFixture.xUnit.net.UnitTest/Scenario.cs
+++ Src/AutoFixture.xUnit.net.UnitTest/Scenario.cs
@@ -164,6 +164,14 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByExactTypeShouldNotAssignSameInstanceToSecondParameterOfDifferentType(
+            [Frozen(Matching.ExactType)]ConcreteType p1,
+            object p2)
+        {
+            Assert.NotEqual(p1, p2);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByDirectBaseTypeShouldAssignSameInstanceToSecondParameter(
             [Frozen(Matching.DirectBaseType)]ConcreteType p1,
             AbstractType p2)
@@ -172,6 +180,14 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByDirectBaseTypeShouldNotAssignSameInstanceToSecondParameterOfIndirectBaseType(
+            [Frozen(Matching.DirectBaseType)]ConcreteType p1,
+            object p2)
+        {
+            Assert.NotEqual(p1, p2);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByInterfaceShouldAssignSameInstanceToSecondParameter(
             [Frozen(Matching.ImplementedInterfaces)]NoopInterfaceImplementer p1,
             IInterface p2)
@@ -180,6 +196,14 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByInterfaceShouldNotAssignSameInstanceToSecondParameterOfNonInterfaceType(
+            [Frozen(Matching.ImplementedInterfaces)]NoopInterfaceImplementer p1,
+            object p2)
+        {
+            Assert.NotEqual(p1, p2);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByParameterWithSameNameShouldAssignSameInstanceToSecondParameter(
             [Frozen(Matching.ParameterName)]string parameter,
             SingleParameterType<object> p2)
@@ -188,6 +212,14 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByParameterWithDifferentNameShouldNotAssignSameInstanceToSecondParameter(
+            [Frozen(Matching.ParameterName)]string p1,
+            SingleParameterType<object> p2)
+        {
+            Assert.NotEqual(p1, p2.Parameter);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByPropertyWithSameNameShouldAssignSameInstanceToSecondParameter(
             [Frozen(Matching.PropertyName)]string property,
             PropertyHolder<object> p2)
@@ -196,6 +228,14 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByPropertyWithDifferentNameShouldNotAssignSameInstanceToSecondParameter(
+            [Frozen(Matching.PropertyName)]string p1,
+            PropertyHolder<object> p2)
+        {
+            Assert.NotEqual(p1, p2.Property);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByFieldWithSameNameShouldAssignSameInstanceToSecondParameter(
             [Frozen(Matching.FieldName)]string field,
             FieldHolder<object> p2)
@@ -204,6 +244,14 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByFieldWithDifferentNameShouldNotAssignSameInstanceToSecondParameter(
+            [Frozen(Matching.FieldName)]string p1,
+            FieldHolder<object> p2)
+        {
+            Assert.NotEqual(p1, p2.Field);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByMemberWithSameNameShouldAssignSameInstanceToMatchingParameter(
             [Frozen(Matching.MemberName)]string parameter,
             SingleParameterType<object> p2)
@@ -212,6 +260,14 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByMemberWithDifferentNameShouldNotAssignSameInstanceToParameter(
+            [Frozen(Matching.MemberName)]string p1,
+            SingleParameterType<object> p2)
+        {
+            Assert.NotEqual(p1, p2.Parameter);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByMemberWithSameNameShouldAssignSameInstanceToMatchingProperty(
             [Frozen(Matching.MemberName)]string property,
             PropertyHolder<object> p2)
@@ -220,11 +276,27 @@
         }

         [Theory, AutoData]
+        public void FreezeFirstParameterByMemberWithDifferentNameShouldNotAssignSameInstanceToProperty(
+            [Frozen(Matching.MemberName)]string p1,
+            PropertyHolder<object> p2)
+        {
+            Assert.NotEqual(p1, p2.Property);
+        }
+
+        [Theory, AutoData]
         public void FreezeFirstParameterByMemberWithSameNameShouldAssignSameInstanceToMatchingField(
             [Frozen(Matching.MemberName)]string field,
             FieldHolder<object> p2)
         {
             Assert.Equal(field, p2.Field);
         }
+
+        [Theory, AutoData]
+        public void FreezeFirstParameterByMemberWithDifferentNameShouldNotAssignSameInstanceToField(
+            [Frozen(Matching.MemberName)]string p1,
+            FieldHolder<object> p2)
+        {
+            Assert.NotEqual(p1, p2.Field);
+        }
     }
 }


Fixed parsing unit tests

Fixed parsing unit tests

--- LuaParserUnitTests/Parsers/TokenizerTests.cs
+++ LuaParserUnitTests/Parsers/TokenizerTests.cs
@@ -25,8 +25,8 @@
         {
             var reader = Tokenizer.Parse(new StringReader(code));
             var tokens = new List<string>();
-            while (reader.HasNext)
-                tokens.Add(reader.GetAndMoveNext());
+            while (reader.MoveNext())
+                tokens.Add(reader.Current.Value);
             return tokens.ToArray();
         }
     }


ChatMessage shouldn't return null for any properties.

--- StreamChatSharp/StreamChatSharp/ChatMessage.cs
+++ StreamChatSharp/StreamChatSharp/ChatMessage.cs
@@ -21,6 +21,13 @@
     /// </summary>
     public class ChatMessage
     {
+
+        private string source;
+        private string target;
+        private string channelName;
+        private string command;
+        private string message;
+
         /// <summary>
         /// Creates a message.
         /// </summary>
@@ -36,7 +43,7 @@
         public ChatMessage(string command)
             : this()
         {
-            this.Command = command;
+            this.command = command;
         }

         /// <summary>
@@ -47,7 +54,7 @@
         public ChatMessage(string command, string message)
             : this(command)
         {
-            this.Message = message;
+            this.message = message;
         }

         /// <summary>
@@ -59,7 +66,7 @@
         public ChatMessage(string command, string message, string channelName)
             : this(command, message)
         {
-            this.ChannelName = channelName;
+            this.channelName = channelName;
         }

         /// <summary>
@@ -72,7 +79,7 @@
         public ChatMessage(string command, string message, string channelName, string source)
             : this(command, message, channelName)
         {
-            this.Source = source;
+            this.source = source;
         }

         /// <summary>
@@ -86,32 +93,87 @@
         public ChatMessage(string command, string message, string channelName, string source, string target)
             : this(command, message, channelName, source)
         {
-            this.Target = target;
+            this.target = target;
         }

         /// <summary>
         /// The sender of the message.
         /// </summary>
-        public string Source { get; set; }
+        public string Source
+        {
+            get
+            {
+                return this.source ?? "";
+
+            }
+            set
+            {
+                this.source = value;
+            }
+        }

         /// <summary>
         /// The target of a command.
         /// </summary>
-        public string Target { get; set; }
+        public string Target
+        {
+            get
+            {
+                return this.target ?? "";
+
+            }
+            set
+            {
+                this.target = value;
+            }
+        }

         /// <summary>
         /// The name of channel the message is for.
         /// </summary>
-        public string ChannelName { get; set; }
+        public string ChannelName
+        {
+            get
+            {
+                return this.channelName ?? "";
+
+            }
+            set
+            {
+                this.channelName = value;
+            }
+        }

         /// <summary>
         /// The IRC command being issued.
         /// </summary>
-        public string Command { get; set; }
+        public string Command
+        {
+            get
+            {
+                return this.command ?? "";
+
+            }
+            set
+            {
+                this.command = value;
+            }
+        }

         /// <summary>
         /// The message that was sent.
         /// </summary>
-        public string Message { get; set; }
+        public string Message
+        {
+            get
+            {
+                return this.message ?? "";
+
+            }
+            set
+            {
+                this.message = value;
+            }
+        }
     }
 }


Erroneous data from the api causes keynotfound

--- SurveyMonkey/SurveyMonkeyApi.DataProcessing.cs
+++ SurveyMonkey/SurveyMonkeyApi.DataProcessing.cs
@@ -308,7 +308,7 @@
                 }
                 else
                 {
-                    if (question.Answers.ItemLookup.ContainsKey(responseAnswer.ChoiceId.Value) && question.Answers.ItemLookup.ContainsKey(responseAnswer.RowId.Value))
+                    if (question.Answers.ItemLookup.ContainsKey(responseAnswer.ChoiceId.Value) && question.Answers.ItemLookup.ContainsKey(responseAnswer.RowId.Value) && !reply.Ranking.ContainsKey(Int32.Parse(question.Answers.ItemLookup[responseAnswer.ChoiceId.Value])))
                     {
                         reply.Ranking.Add(Int32.Parse(question.Answers.ItemLookup[responseAnswer.ChoiceId.Value]), question.Answers.ItemLookup[responseAnswer.RowId.Value]);
                     }


Capitalise

Capitalise

--- SurveyMonkey/SurveyMonkeyApi.Infrastructure.cs
+++ SurveyMonkey/SurveyMonkeyApi.Infrastructure.cs
@@ -98,7 +98,7 @@
             var url = "https://api.surveymonkey.net/v3" + endpoint;
             _webClient.Headers.Add("Content-Type", "application/json");
             _webClient.Headers.Add("Authorization", "bearer " + _accessToken);
-            if (!string.IsNullOrEmpty(_apiKey))
+            if (!String.IsNullOrEmpty(_apiKey))
             {
                 _webClient.QueryString.Add("api_key", _apiKey);
             }