Fixes off-by-one bug in ExponentialMovingAverage.IsReady

--- Indicators/ExponentialMovingAverage.cs
+++ Indicators/ExponentialMovingAverage.cs
@@ -72,7 +72,7 @@
         /// </summary>
         public override bool IsReady
         {
-            get { return Samples > _period; }
+            get { return Samples >= _period; }
         }

         /// <summary>


Another few corrections (?)

Another few corrections (?)

--- APproject/AST/Node.cs
+++ APproject/AST/Node.cs
@@ -6,8 +6,8 @@
     /**
      * All possible node labels: both reserved keywords and primitive operators.
      **/
-	public enum Statement {If,While,Return,Ass,Dec,AssDec,Print,Read,Async,
-							Plus,Mul,Minus,Div,Gt,Gte,Lt,Lte,Eq};
+	public enum Statement {Main, FunDecl, Fun, If, While, Return, Assig, Decl, AssigDecl, Print,
+                            For, Read, Async, Afun, Plus, Mul, Minus, Div, Gt, Gte, Lt, Lte, Eq};

 	public class Node
 	{


Specify type so it still works when casting to IList (when doing a build for older .NET versions)

--- Navigation.Test/NavigationDataTest.cs
+++ Navigation.Test/NavigationDataTest.cs
@@ -165,8 +165,8 @@
 				Assert.AreEqual(((IList)ListNavigationData[item.Key])[1], ((IList)item.Value)[1]);
 				i++;
 			}
-			Assert.AreEqual(StateContext.Bag.List_float[0], 3);
-			Assert.AreEqual(StateContext.Bag.List_double[1], 5);
+			Assert.AreEqual(StateContext.Bag.List_float[0], 3f);
+			Assert.AreEqual(StateContext.Bag.List_double[1], 5d);
 			Assert.AreEqual(15, i);
 		}


Add functionality.

Add functionality.

--- src/Beerendonk.Time/Period.cs
+++ src/Beerendonk.Time/Period.cs
@@ -9,6 +9,7 @@
 // You must not remove this notice, or any other, from this software.

 using System;
+using System.Collections.Generic;
 using System.Globalization;

 namespace Beerendonk.Time
@@ -16,7 +17,7 @@
     /// <summary>
     /// Defines a Time Period.
     /// </summary>
-    public struct Period
+    public struct Period : IEquatable<Period>
     {
         private readonly DateTime from;

@@ -25,8 +26,8 @@
         /// <summary>
         /// Initializes a new instance of the <see cref="T:Period" /> structure.
         /// </summary>
-        /// <param name="from">The moment the period starts.</param>
-        /// <param name="to">The moment the period ends.</param>
+        /// <param name="from">The moment the period starts (included).</param>
+        /// <param name="to">The moment the period ends (excluded).</param>
         public Period(DateTime from, DateTime to)
         {
             this.from = from;
@@ -36,7 +37,7 @@
         /// <summary>
         /// Initializes a new instance of the <see cref="T:Period" /> structure.
         /// </summary>
-        /// <param name="from">The moment the period starts.</param>
+        /// <param name="from">The moment the period starts (included).</param>
         /// <param name="duration">The duration of the period.</param>
         public Period(DateTime from, TimeSpan duration)
         {
@@ -48,7 +49,7 @@
         /// Initializes a new instance of the <see cref="T:Period" /> structure.
         /// </summary>
         /// <param name="duration">The duration of the period.</param>
-        /// <param name="to">The moment the period ends.</param>
+        /// <param name="to">The moment the period ends (excluded).</param>
         public Period(TimeSpan duration, DateTime to)
         {
             this.from = to - duration;
@@ -56,7 +57,18 @@
         }

         /// <summary>
-        /// Defines the moment the period starts.
+        /// Gets the duration of the period.
+        /// </summary>
+        public TimeSpan Duration
+        {
+            get
+            {
+                return from - to;
+            }
+        }
+
+        /// <summary>
+        /// Gets the moment the period starts (included).
         /// </summary>
         public DateTime From
         {
@@ -67,7 +79,7 @@
         }

         /// <summary>
-        /// Defines the moment the period ends.
+        /// Gets the moment the period ends (excluded).
         /// </summary>
         public DateTime To
         {
@@ -92,7 +104,7 @@
         /// </summary>
         /// <returns>
         /// A string representation of value of the current <see cref="T:System.Period" /> object
-        /// with <see cref="T:System.DateTime" />s as specified by <paramref name="provider" />.
+        /// with <see cref="T:System.DateTime" />s as specified by <paramref name="format" />.
         /// </returns>
         /// <param name="format">A standard or custom date and time format string (see Remarks).</param>
         /// <exception cref="T:System.FormatException">
@@ -109,8 +121,9 @@
             return ToString(format, DateTimeFormatInfo.CurrentInfo);
         }

-        /// <summary>Converts the value of the current <see cref="T:Period" /> object to its
-        /// equivalent string representation using the specified culture-specific format information.
+        /// <summary>
+        /// Converts the value of the current <see cref="T:Period" /> object to its equivalent
+        /// string representation using the specified culture-specific format information.
         /// </summary>
         /// <returns>
         /// A string representation of value of the current <see cref="T:System.Period" /> object
@@ -150,5 +163,128 @@
         {
             return String.Format("{0} - {1}", To.ToString(format, provider), From.ToString(format, provider));
         }
+
+        /// <summary>
+        /// Returns a value indicating whether this instance is equal to a specified object.
+        /// </summary>
+        /// <returns><c>true</c> if <paramref name="obj" /> is an instance of <see cref="T:Period" />
+        /// and equals the value of this instance; otherwise, <c>false</c>.
+        /// </returns>
+        /// <param name="obj">The object to compare to this instance. </param>
+        public override bool Equals(object obj)
+        {
+            return obj is DateTime && Equals((DateTime)obj);
+        }
+
+        /// <summary>
+        /// Returns a value indicating whether the value of this instance is equal to the
+        /// value of the specified <see cref="T:Period" /> instance.
+        /// </summary>
+        /// <returns>
+        /// <c>true</c> if the <paramref name="other" /> parameter equals the value of this
+        /// instance; otherwise, <c>false</c>.
+        /// </returns>
+        /// <param name="other">The object to compare to this instance. </param>
+        public bool Equals(Period other)
+        {
+            return Equals(this, other);
+        }
+
+        /// <summary>
+        /// Returns a value indicating whether two <see cref="T:Period" /> instances have
+        /// the same date and time value.
+        /// </summary>
+        /// <returns>
+        /// <c>true</c> if the two values are equal; otherwise, <c>false</c>.
+        /// </returns>
+        /// <param name="p1">The first object to compare.</param>
+        /// <param name="p2">The second object to compare.</param>
+        public static bool Equals(Period p1, Period p2)
+        {
+            return p1.from == p2.from && p1.to == p2.to;
+        }
+
+        /// <summary>
+        /// Returns the hash code for this instance.
+        /// </summary>
+        /// <returns>A 32-bit signed integer hash code.</returns>
+        public override int GetHashCode()
+        {
+            return to.GetHashCode() + from.GetHashCode();
+        }
+
+        /// <summary>
+        /// Gets the current day.
+        /// </summary>
+        /// <returns>
+        /// An object that is set to today, with the included start time set to 00:00:00 today
+        /// and the exluded end time set to 00:00:00 the next day.
+        /// </returns>
+        public static Period Today
+        {
+            get
+            {
+                // Prevent asking Now twice and potentially get two dates.
+                var now = DateTime.Now;
+                return new Period(now.Date, now.Date.AddDays(1));
+            }
+        }
+
+        /// <summary>
+        /// Returns a value indicating whether two <see cref="T:Period" /> instances have equal.
+        /// </summary>
+        /// <returns>
+        /// <c>true</c> if the two values are equal; otherwise, <c>false</c>.
+        /// </returns>
+        /// <param name="p1">The first object to compare.</param>
+        /// <param name="p2">The second object to compare.</param>
+        public static bool operator ==(Period p1, Period p2)
+        {
+            return Equals(p1, p2);
+        }
+
+        /// <summary>
+        /// Returns a value indicating whether two <see cref="T:Period" /> instances are different.
+        /// </summary>
+        /// <returns>
+        /// <c>true</c> if the two values are equal; otherwise, <c>false</c>.
+        /// </returns>
+        /// <param name="p1">The first object to compare.</param>
+        /// <param name="p2">The second object to compare.</param>
+        public static bool operator !=(Period p1, Period p2)
+        {
+            return !Equals(p1, p2);
+        }
+
+        public static IEnumerable<Period> operator +(Period p1, Period p2)
+        {
+            if (p1.to < p2.from || p1.from > p2.to)
+            {
+                yield return p1;
+                yield return p2;
+                yield break;
+            }
+
+            yield return new Period(
+                new DateTime(Math.Min(p1.from.Ticks, p2.from.Ticks)),
+                new DateTime(Math.Max(p1.to.Ticks, p2.to.Ticks)));
+        }
+
+        public static IEnumerable<Period> operator -(Period p1, Period p2)
+        {
+            if (p1.from < p2.from)
+            {
+                yield return new Period(
+                    p1.from,
+                    new DateTime(Math.Min(p1.to.Ticks, p2.from.Ticks)));
+            }
+
+            if (p1.to > p2.to)
+            {
+                yield return new Period(
+                    new DateTime(Math.Max(p1.from.Ticks, p2.to.Ticks)),
+                    p1.to);
+            }
+        }
     }
 }


Use native docker client when running under WSL

--- src/Cake.Docker/DockerTool.cs
+++ src/Cake.Docker/DockerTool.cs
@@ -49,7 +49,11 @@
         /// <returns>The tool executable name.</returns>
         protected override IEnumerable<string> GetToolExecutableNames()
         {
-            return new[] { "docker.exe", "docker" };
+            // In WSL (Windows Subsystem for Linux), both 'docker' and
+            // 'docker.exe' are available. The linux version of docker
+            // must have precedence over the windows version so that
+            // the native (i.e. linux) version of docker is used under WSL.
+            return new[] { "docker", "docker.exe" };
         }

         /// <summary>


Fix doc comment encoding

Fix doc comment encoding

--- src/Cassette.Views/Bundles.cs
+++ src/Cassette.Views/Bundles.cs
@@ -39,9 +39,9 @@
         /// <param name="pageLocation">The optional page location of the script. This controls where it will be rendered.</param>
         /// <code lang="CS">
         /// @{
-        ///   Bundles.AddInlineScript(@<text>
+        ///   Bundles.AddInlineScript(@<text>
         ///     var foo = "Hello World";
-        ///     alert( foo );</text>);
+        ///     alert( foo );</text>);
         /// }
         /// </code>
         public static void AddInlineScript(Func<object, object> scriptContent, string pageLocation = null)


增强StringExtension类中的Slice<T>(...)方法。 :straight_ruler:

--- src/Common/StringExtension.cs
+++ src/Common/StringExtension.cs
@@ -227,7 +227,7 @@
 			if(separator == null)
 				throw new ArgumentNullException(nameof(separator));

-			if(parser == null)
+			if(parser == null && typeof(T) != typeof(string))
 				throw new ArgumentNullException(nameof(parser));

 			if(string.IsNullOrEmpty(text))
@@ -244,8 +244,16 @@
 					part = text.Substring(++index, i - index);
 					index = i;

-					if(part.Length > 0 && parser(part, out value))
-						yield return value;
+					//if(part.Length > 0 && parser(part, out value))
+					//	yield return value;
+
+					if(part.Length > 0)
+					{
+						if(parser == null)
+							yield return (T)(object)part;
+						else if(parser(part, out value))
+							yield return value;
+					}
 				}
 			}

@@ -253,7 +261,12 @@
 			{
 				part = text.Substring(++index);

-				if(parser(part, out value))
+				//if(parser(part, out value))
+				//	yield return value;
+
+				if(parser == null)
+					yield return (T)(object)part;
+				else if(parser(part, out value))
 					yield return value;
 			}
 		}


added some disposed exceptions to the connection. hopefully this will help diagnose if his problem occurs in the future. issue #40

--- src/Connections/Connection.cs
+++ src/Connections/Connection.cs
@@ -96,6 +96,8 @@
 		/// </summary>
 		public void Open()
 		{
+			CheckWasDisposed();
+
 			if (IsOpen)
 				return;

@@ -108,6 +110,8 @@
 		/// </summary>
 		public void Close()
 		{
+			CheckWasDisposed();
+
 			if (!IsOpen)
 				return;

@@ -138,7 +142,11 @@
 		/// </summary>
 		public Cassandra.Client Client
 		{
-			get { return _client; }
+			get
+			{
+				CheckWasDisposed();
+				return _client;
+			}
 		}

 		/// <summary>
@@ -150,6 +158,15 @@
 		}

 		#region IDisposable Members
+
+		/// <summary>
+		///
+		/// </summary>
+		private void CheckWasDisposed()
+		{
+			if (WasDisposed)
+				throw new ObjectDisposedException("connection has been disposed of");
+		}

 		/// <summary>
 		///


Fixed scheme data bug

Fixed scheme data bug

--- AngleSharp/DOM/Primitives/Location.cs
+++ AngleSharp/DOM/Primitives/Location.cs
@@ -60,6 +60,15 @@
         #region Properties

         /// <summary>
+        /// Gets if the stored location is relative and requires
+        /// a base URL.
+        /// </summary>
+        public Boolean IsRelative
+        {
+            get { return String.IsNullOrEmpty(_scheme) || String.IsNullOrEmpty(_host); }
+        }
+
+        /// <summary>
         /// Gets or sets the hash, e.g.  "#myhash".
         /// </summary>
         [DOM("hash")]
@@ -224,16 +233,6 @@
                 return String.Empty;

             return String.Concat(prefix ?? String.Empty, check, postfix ?? String.Empty);
-        }
-
-        static String Tolerate(String value, String prefix = null, String postfix = null)
-        {
-            if (prefix != null && value.StartsWith(prefix))
-                return value.Substring(prefix.Length);
-            else if (postfix != null && value.EndsWith(postfix))
-                return value.Substring(0, value.Length - postfix.Length);
-
-            return value;
         }

         /// <summary>
@@ -321,18 +320,21 @@

         Boolean ParseSchemeData(String input, Int32 index)
         {
-            var c = input[index];
-
-            if (c == Specification.QuestionMark)
-                return ParseQuery(input, index + 1);
-            else if (c == Specification.Num)
-                return ParseFragment(input, index + 1);
+            if (index < input.Length)
+            {
+                var c = input[index];
+
+                if (c == Specification.QuestionMark)
+                    return ParseQuery(input, index + 1);
+                else if (c == Specification.Num)
+                    return ParseFragment(input, index + 1);
+            }

             var buffer = Pool.NewStringBuilder();

             while (++index < input.Length)
             {
-                c = input[index];
+                var c = input[index];

                 if (c == Specification.Percent && index + 2 < input.Length && input[index + 1].IsHex() && input[index + 2].IsHex())
                 {


small improvements

small improvements

--- trunk/Solutions/CslaGenFork/Metadata/SerializableDictionary.cs
+++ trunk/Solutions/CslaGenFork/Metadata/SerializableDictionary.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Runtime.Serialization;
 using System.Xml.Serialization;

 namespace CslaGenerator.Metadata
@@ -6,9 +7,47 @@
     //http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx

     [XmlRoot("dictionary")]
-    public class SerializableDictionary<TKey, TValue>
-        : Dictionary<TKey, TValue>, IXmlSerializable
+    public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, IXmlSerializable
     {
+        #region Constructors
+
+        public SerializableDictionary()
+            : base()
+        {
+        }
+
+        public SerializableDictionary(IDictionary<TKey, TValue> dictionary)
+            : base(dictionary)
+        {
+        }
+
+        public SerializableDictionary(IEqualityComparer<TKey> comparer)
+            : base(comparer)
+        {
+        }
+
+        public SerializableDictionary(int capacity)
+            : base(capacity)
+        {
+        }
+
+        public SerializableDictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer)
+            : base(dictionary, comparer)
+        {
+        }
+
+        public SerializableDictionary(int capacity, IEqualityComparer<TKey> comparer)
+            : base(capacity, comparer)
+        {
+        }
+
+        protected SerializableDictionary(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+        {
+        }
+
+        #endregion
+
         #region IXmlSerializable Members

         public System.Xml.Schema.XmlSchema GetSchema()


Refactor

Refactor

--- KataBowling/KataBowling/BowlingGame.cs
+++ KataBowling/KataBowling/BowlingGame.cs
@@ -25,7 +25,7 @@
             {
                 var currentRoll = rolls[rollIndex];

-                if (pointingRollsCounter.IsPointingRoll(currentRoll))
+                if (pointingRollsCounter.IsPointing(currentRoll))
                 {
                     result = SumPointsWithBonuses(result, rolls, rollIndex, currentRoll.BonusRollCount);
                 }
@@ -56,7 +56,7 @@
         {
             private int pointingRollsCount = 20;

-            public bool IsPointingRoll(Roll roll)
+            public bool IsPointing(Roll roll)
             {
                 bool result = pointingRollsCount > 0;


Completed search for elements by template and search for by category.

--- LazyPI/LazyPI/LazyObjects/AFElement.cs
+++ LazyPI/LazyPI/LazyObjects/AFElement.cs
@@ -175,16 +175,30 @@
 			return _ElementLoader.Delete(ElementID);
 		}

-		//TODO: Implement Find Element By Category
-		public static IEnumerable<AFElement> FindByCategory(string CategoryName)
-		{
-			throw new NotImplementedException();
-		}
-
-		//TODO: Implement Find Element By Template
-		public static IEnumerable<AFElement> FindByTemplate(string TemplateName)
-		{
-			throw new NotImplementedException();
+		/// <summary>
+		/// Find all of the child elements with a specific category.
+		/// </summary>
+		/// <param name="CategoryName">Name of the category to be searched for.</param>
+		/// <param name="MaxCount">Max number of elements that should be searched for.</param>
+		/// <returns>A list of elements that have a specific category.</returns>
+		public IEnumerable<AFElement> FindByCategory(string CategoryName, int MaxCount = 1000)
+		{
+			var baseList = _ElementLoader.GetElements(this._ID, "*", CategoryName, "*", ElementType.Any, false, "Name", "Ascending", 0, MaxCount);
+
+			return ElementFactory.CreateList(baseList);
+		}
+
+		/// <summary>
+		/// Find all of the child elements with a specific template.
+		/// </summary>
+		/// <param name="TemplateName">Name of the template to be searched for.</param>
+		/// <param name="MaxCount">Max number of elements that should be searched for.</param>
+		/// <returns>A list of elements that have a specific template.</returns>
+		public IEnumerable<AFElement> FindByTemplate(string TemplateName, int MaxCount = 1000)
+		{
+			var baseList = _ElementLoader.GetElements(this._ID, "*", "*", TemplateName, ElementType.Any, false, "Name", "Ascending", 0, MaxCount);
+
+			return ElementFactory.CreateList(baseList);
 		}
 		#endregion


Finish updating list node tests

Finish updating list node tests

--- Leaf/Leaf.Tests/Nodes/ListNodeTests.cs
+++ Leaf/Leaf.Tests/Nodes/ListNodeTests.cs
@@ -22,7 +22,7 @@
         [Test(Description = "Check that the version is the expected value.")]
         public void VersionTest()
         {
-            var node = GenerateListNode();
+            var node = new ListNode(NodeType.String);
             Assert.That(node.Version, Is.EqualTo(1));
         }

@@ -199,292 +199,300 @@
         }

         [Test(Description = "Check that removing a node works as expected.")]
-        public void RemoveTest()
-        {
-            var list     = GenerateListNode();
-            var node     = list[1];
-            var expected = NodeSet.ToList();
-            expected.RemoveAt(1);
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var toRemove   = elements[randomizer.Next(elements.Length)];
+            var listNode   = new ListNode(elementType, elements);
+            var expected   = elements.ToList();
+            expected.Remove(toRemove);
             Assert.Multiple(() =>
             {
-                Assert.That(list.Remove(node), Is.True);
-                Assert.That(list, Does.Not.Contain(node));
-                Assert.That(list, Is.EqualTo(expected));
+                Assert.That(listNode.Remove(toRemove), Is.True);
+                Assert.That(listNode, Does.Not.Contain(toRemove));
+                Assert.That(listNode, Is.EqualTo(expected));
             });
         }

         [Test(Description = "Check that nothing happens when attempting to remove a non-existent node.")]
-        public void RemoveNonExistentTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("remove");
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveNonExistentTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var node       = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
             Assert.Multiple(() =>
             {
-                Assert.That(list.Remove(node), Is.False);
-                Assert.That(list, Is.EqualTo(NodeSet));
+                Assert.That(listNode.Remove(node), Is.False);
+                Assert.That(listNode, Is.EqualTo(elements));
             });
         }

         [Test(Description = "Check that an exception is thrown when attempting to remove null.")]
-        public void RemoveNullTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(() => { list.Remove(null); }, Throws.ArgumentNullException);
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveNullTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.Remove(null); }, Throws.ArgumentNullException);
         }

         [Test(Description = "Check that the count property returns the correct amount.")]
-        public void CountTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(list, Has.Count.EqualTo(NodeSet.Length));
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void CountTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(listNode, Has.Count.EqualTo(elements.Length));
         }

         [Test(Description = "Check that the read-only property returns the expected value.")]
         public void IsReadOnlyTest()
         {
-            var list = GenerateListNode();
-            Assert.That(list.IsReadOnly, Is.False);
+            var listNode = new ListNode(NodeType.String);
+            Assert.That(listNode.IsReadOnly, Is.False);
         }

         [Test(Description = "Check that an item can be found in the list.")]
-        public void IndexOfTest()
-        {
-            const int index = 1;
-            var list = GenerateListNode();
-            var node = list[index];
-            Assert.That(list.IndexOf(node), Is.EqualTo(index));
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void IndexOfTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var index      = randomizer.Next(elements.Length);
+            var node       = elements[index];
+            var listNode   = new ListNode(elementType, elements);
+            Assert.That(listNode.IndexOf(node), Is.EqualTo(index));
         }

         [Test(Description = "Check that a negative index is returned for an item that can't be found in the list.")]
-        public void IndexOfNonExistentTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("indexOf");
-            Assert.That(list.IndexOf(node), Is.EqualTo(-1));
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void IndexOfNonExistentTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var node       = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            Assert.That(listNode.IndexOf(node), Is.EqualTo(-1));
         }

         [Test(Description = "Check that an exception is thrown when looking for null.")]
-        public void IndexOfNullTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(() => { list.IndexOf(null); }, Throws.ArgumentNullException);
-        }
-
-        [Test(Description = "Check that the insert method adds an item.")]
-        public void InsertTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("insert");
-            list.Insert(1, node);
-            Assert.That(list, Contains.Item(node));
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void IndexOfNullTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.IndexOf(null); }, Throws.ArgumentNullException);
         }

         [Test(Description = "Check that the insert method works for non-end indices.")]
-        public void InsertMiddleTest()
-        {
-            var list     = GenerateListNode();
-            var node     = new StringNode("insert");
-            var expected = NodeSet.ToList();
-            expected.Insert(1, node);
-            list.Insert(1, node);
-            Assert.That(list, Is.EqualTo(expected));
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void InsertTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            listNode.Insert(1, newNode);
+            Assert.That(listNode, Contains.Item(newNode));
         }

         [Test(Description = "Check that inserting an item at the start of the list works as expected.")]
-        public void InsertFirstTest()
-        {
-            var list     = GenerateListNode();
-            var node     = new StringNode("insert");
-            var expected = NodeSet.ToList();
-            expected.Insert(0, node);
-            list.Insert(0, node);
-            Assert.That(list, Is.EqualTo(expected));
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void InsertFirstTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            listNode.Insert(0, newNode);
+            Assert.That(listNode, Contains.Item(newNode));
         }

         [Test(Description = "Check that inserting an item at the end of the list works as expected.")]
-        public void InsertLastTest()
-        {
-            var list     = GenerateListNode();
-            var node     = new StringNode("insert");
-            var expected = NodeSet.ToList();
-            expected.Insert(NodeSet.Length, node);
-            list.Insert(list.Count, node);
-            Assert.That(list, Is.EqualTo(expected));
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void InsertLastTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            listNode.Insert(elements.Length, newNode);
+            Assert.That(listNode, Contains.Item(newNode));
         }

         [Test(Description = "Check that an exception is thrown when attempting to insert null.")]
-        public void InsertNullTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(() => { list.Insert(1, null); }, Throws.ArgumentNullException);
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void InsertNullTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.Insert(1, null); }, Throws.ArgumentNullException);
         }

         [Test(Description = "Check that an exception is thrown when attempting to use a negative index.")]
-        public void InsertNegativeIndexTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("insert");
-            Assert.That(() => { list.Insert(-1, node); }, Throws.InstanceOf<ArgumentOutOfRangeException>());
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void InsertNegativeIndexTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.Insert(-1, newNode); }, Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description =
             "Check that an exception is thrown when attempting to use an index outside the bounds of the list.")]
-        public void InsertIndexTooLargeTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("insert");
-            Assert.That(() => { list.Insert(list.Count + 1, node); }, Throws.InstanceOf<ArgumentOutOfRangeException>());
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void InsertIndexTooLargeTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.Insert(listNode.Count + 1, newNode); },
+                Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description = "Check that an exception is thrown when attempting to insert a node of a different type.")]
-        public void InsertTypeMismatchTest()
-        {
-            var list = GenerateListNode();
-            var node = new Int32Node(12345);
-            Assert.That(() => { list.Insert(1, node); }, Throws.InstanceOf<ArrayTypeMismatchException>());
-        }
-
-        [Test(Description = "Check that removing an item at an index works as expected.")]
-        public void RemoveAtTest()
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void InsertTypeMismatchTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var mixedType  = randomizer.NextNonNestableNodeType();
+            while (mixedType == elementType)
+                mixedType = randomizer.NextNonNestableNodeType();
+            var mixedNode = randomizer.NextNodeOfType(mixedType);
+            var listNode  = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.Insert(1, mixedNode); }, Throws.InstanceOf<ArrayTypeMismatchException>());
+        }
+
+        [Test(Description = "Check that removing an item at a middle index works as expected.")]
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveAtTest(NodeType elementType, Node[] elements)
         {
             const int index = 1;
-            var list = GenerateListNode();
-            list.RemoveAt(index);
-            Assert.That(list, Does.Not.Contain(NodeSet[index]));
-        }
-
-        [Test(Description = "Check that removing an item at a middle index works as expected.")]
-        public void RemoveAtMiddleTest()
-        {
-            var list = GenerateListNode();
-            var expected = NodeSet.ToList();
-            expected.RemoveAt(1);
-            list.RemoveAt(1);
-            Assert.That(list, Is.EqualTo(expected));
+            var listNode    = new ListNode(elementType, elements);
+            var expected    = elements.ToList();
+            expected.RemoveAt(index);
+            listNode.RemoveAt(index);
+            Assert.That(listNode, Is.EqualTo(expected));
         }

         [Test(Description = "Check that removing the first item in the list works as expected.")]
-        public void RemoveAtFirstTest()
-        {
-            var list = GenerateListNode();
-            var expected = NodeSet.ToList();
-            expected.RemoveAt(0);
-            list.RemoveAt(0);
-            Assert.That(list, Is.EqualTo(expected));
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveAtFirstTest(NodeType elementType, Node[] elements)
+        {
+            const int index = 0;
+            var listNode    = new ListNode(elementType, elements);
+            var expected    = elements.ToList();
+            expected.RemoveAt(index);
+            listNode.RemoveAt(index);
+            Assert.That(listNode, Is.EqualTo(expected));
         }

         [Test(Description = "Check that removing the last item in the list works as expected.")]
-        public void RemoveAtLastTest()
-        {
-            var list = GenerateListNode();
-            var expected = NodeSet.ToList();
-            expected.RemoveAt(NodeSet.Length - 1);
-            list.RemoveAt(list.Count - 1);
-            Assert.That(list, Is.EqualTo(expected));
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveAtLastTest(NodeType elementType, Node[] elements)
+        {
+            var index    = elements.Length - 1;
+            var listNode = new ListNode(elementType, elements);
+            var expected = elements.ToList();
+            expected.RemoveAt(index);
+            listNode.RemoveAt(index);
+            Assert.That(listNode, Is.EqualTo(expected));
         }

         [Test(Description = "Check that an exception is thrown when attempting to use a negative index.")]
-        public void RemoveAtNegativeIndexTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(() => { list.RemoveAt(-1); }, Throws.InstanceOf<ArgumentOutOfRangeException>());
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveAtNegativeIndexTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.RemoveAt(-1); }, Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description =
             "Check that an exception is thrown when attempting to use an index outside the bounds of the list.")]
-        public void RemoveAtIndexTooLargeTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(() => { list.RemoveAt(list.Count + 1); }, Throws.InstanceOf<ArgumentOutOfRangeException>());
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void RemoveAtIndexTooLargeTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(() => { listNode.RemoveAt(elements.Length + 1); }, Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description = "Check that the getter works as expected.")]
-        public void GetterTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(list[0], Is.EqualTo(NodeSet[0]));
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void GetterTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(listNode[0], Is.EqualTo(elements[0]));
         }

         [Test(Description = "Check that an exception is thrown when attempting to use a negative index.")]
-        public void GetterNegativeIndexTest()
-        {
-            var list = GenerateListNode();
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void GetterNegativeIndexTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
             Assert.That(() =>
             {
-                var _ = list[-1];
+                var _ = listNode[-1];
             }, Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description =
             "Check that an exception is thrown when attempting to use an index outside the bounds of the list.")]
-        public void GetterIndexTooLargeTest()
-        {
-            var list = GenerateListNode();
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void GetterIndexTooLargeTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
             Assert.That(() =>
             {
-                var _ = list[list.Count + 1];
+                var _ = listNode[elements.Length + 1];
             }, Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description = "Check that the setter works as expected.")]
-        public void SetterTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("setter");
-            list[1]  = node;
-            Assert.That(list[1], Is.EqualTo(node));
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void SetterTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var listNode   = new ListNode(elementType, elements);
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            listNode[1]    = newNode;
+            Assert.That(listNode[1], Is.EqualTo(newNode));
         }

         [Test(Description = "Check that an exception is thrown when attempting to set an element to null.")]
-        public void SetterNullTest()
-        {
-            var list = GenerateListNode();
-            Assert.That(() => { list[1] = null; }, Throws.ArgumentNullException);
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void SetterNullTest(NodeType elementType, Node[] elements)
+        {
+            var listNode = new ListNode(elementType, elements);
+            Assert.That(() => { listNode[1] = null; }, Throws.ArgumentNullException);
         }

         [Test(Description = "Check that an exception is thrown when attempting to use a negative index.")]
-        public void SetterNegativeIndexTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("setter");
-            Assert.That(() => { list[-1] = node; }, Throws.InstanceOf<ArgumentOutOfRangeException>());
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void SetterNegativeIndexTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            Assert.That(() => { listNode[-1] = newNode; }, Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description =
             "Check that an exception is thrown when attempting to use an index outside the bounds of the list.")]
-        public void SetterIndexTooLargeTest()
-        {
-            var list = GenerateListNode();
-            var node = new StringNode("setter");
-            Assert.That(() => { list[list.Count + 1] = node; }, Throws.InstanceOf<ArgumentOutOfRangeException>());
+        [TestCaseSource(nameof(RandomNodeCollections))]
+        public void SetterIndexTooLargeTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var newNode    = randomizer.NextNodeOfType(elementType);
+            var listNode   = new ListNode(elementType, elements);
+            Assert.That(() => { listNode[elements.Length + 1] = newNode; }, Throws.InstanceOf<ArgumentOutOfRangeException>());
         }

         [Test(Description =
             "Check that an exception is thrown when attempting to set an element to a different node type.")]
-        public void SetterTypeMismatchTest()
-        {
-            var list = GenerateListNode();
-            var node = new Int32Node(12345);
-            Assert.That(() => { list[1] = node; }, Throws.InstanceOf<ArrayTypeMismatchException>());
-        }
-
-        private static readonly Node[] NodeSet =
-        {
-            new StringNode("foo"),
-            new StringNode("bar"),
-            new StringNode("baz")
-        };
-
-        private static readonly Node[] NullNodeSet =
-        {
-            new Int32Node(12345),
-            null,
-            new Int32Node(54321)
-        };
-
-        private static ListNode GenerateListNode()
-        {
-            return new ListNode(NodeSet[0].Type, NodeSet);
+        [TestCaseSource(nameof(AllTypesNodeCollections))]
+        public void SetterTypeMismatchTest(NodeType elementType, Node[] elements)
+        {
+            var randomizer = TestContext.CurrentContext.Random;
+            var mixedType  = randomizer.NextNonNestableNodeType();
+            while (mixedType == elementType)
+                mixedType = randomizer.NextNonNestableNodeType();
+            var mixedNode = randomizer.NextNodeOfType(mixedType);
+            var listNode  = new ListNode(elementType, elements);
+            Assert.That(() => { listNode[1] = mixedNode; }, Throws.InstanceOf<ArrayTypeMismatchException>());
         }

         private static IEnumerable AllTypesNodeCollections()


[v5.0.0] Lib.Web.Mvc

[v5.0.0] Lib.Web.Mvc

--- Lib.Web.Mvc/Properties/AssemblyInfo.cs
+++ Lib.Web.Mvc/Properties/AssemblyInfo.cs
@@ -32,5 +32,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("4.4.0.0")]
-[assembly: AssemblyFileVersion("4.4.0.0")]
+[assembly: AssemblyVersion("5.0.0.0")]
+[assembly: AssemblyFileVersion("5.0.0.0")]


Change BuildWithEditor approach to use .NET 2.0 rather than the Unity subset.

--- Assets/Editor/Scripts/AssetBundler.cs
+++ Assets/Editor/Scripts/AssetBundler.cs
@@ -231,15 +231,47 @@

         managedReferences.Add("Library/UnityAssemblies/UnityEngine");

-        var compilerOutput = EditorUtility.CompileCSharp(
-            scriptAssetPaths.ToArray(),
-            managedReferences.ToArray(),
-            allDefines.Split(';'),
-            outputFilename);
-
-        foreach (var log in compilerOutput)
-        {
-            Debug.LogFormat("Compiler: {0}", log);
+        //Next we need to grab some type references and use reflection to build things the way Unity does.
+        //Note that EditorUtility.CompileCSharp will do *almost* exactly the same thing, but it unfortunately
+        //defaults to "unity" rather than "2.0" when selecting the .NET support for the classlib_profile.
+
+        string[] scriptArray = scriptAssetPaths.ToArray();
+        string[] referenceArray = managedReferences.ToArray();
+        string[] defineArray = allDefines.Split(';');
+
+        //MonoIsland to compile
+        string classlib_profile = "2.0";
+        Assembly assembly = Assembly.GetAssembly(typeof(MonoScript));
+        var monoIslandType = assembly.GetType("UnityEditor.Scripting.MonoIsland");
+        object monoIsland = Activator.CreateInstance(monoIslandType, BuildTarget.StandaloneWindows, classlib_profile, scriptArray, referenceArray, defineArray, outputFilename);
+
+        //MonoCompiler itself
+        var monoCompilerType = assembly.GetType("UnityEditor.Scripting.Compilers.MonoCSharpCompiler");
+        object monoCompiler = Activator.CreateInstance(monoCompilerType, monoIsland, false);
+
+        MethodInfo beginCompilingMethod = monoCompilerType.GetMethod("BeginCompiling");
+        MethodInfo pollMethod = monoCompilerType.GetMethod("Poll");
+        MethodInfo getMessagesMethod = monoCompilerType.GetMethod("GetCompilerMessages");
+
+        //CompilerMessage
+        var compilerMessageType = assembly.GetType("UnityEditor.Scripting.Compilers.CompilerMessage");
+        FieldInfo messageField = compilerMessageType.GetField("message");
+
+        //Start compiling
+        beginCompilingMethod.Invoke(monoCompiler, null);
+        while (!(bool)pollMethod.Invoke(monoCompiler, null))
+        {
+            System.Threading.Thread.Sleep(50);
+        }
+
+        //Now check and output any messages returned by the compiler
+        object returnedObj = getMessagesMethod.Invoke(monoCompiler, null);
+        object[] cmArray = ((Array)returnedObj).Cast<object>().ToArray();
+
+        foreach (object cm in cmArray)
+        {
+            string str = (string)messageField.GetValue(cm);
+            Debug.LogFormat("Compiler: {0}", str);
         }

         if (!File.Exists(outputFilename))


Cleanup

Cleanup

--- Windows/UploadProgress.cs
+++ Windows/UploadProgress.cs
@@ -7,16 +7,6 @@
     public partial class UploadProgress : Form
     {
         protected override bool ShowWithoutActivation => true;
-
-        protected override CreateParams CreateParams
-        {
-            get
-            {
-                var param = base.CreateParams;
-                param.ExStyle |= 8; // WS_EX_TOPMOST
-                return param;
-            }
-        }

         public int Progress
         {


Fix compilation error

Fix compilation error

--- Assets/Scripts/SuperRotationSystem.cs
+++ Assets/Scripts/SuperRotationSystem.cs
@@ -50,7 +50,7 @@

 	private static Vector2[] GetTestOffsets(float fromAngleInDegrees, float toAngleInDegrees, Dictionary<string, Vector2[]> data)
 	{
-		string dictionaryKey = GetRotationStateForAngle(from) + "->" + GetRotationStateForAngle(to);
+		string dictionaryKey = GetRotationStateForAngle(fromAngleInDegrees) + "->" + GetRotationStateForAngle(toAngleInDegrees);
 		Vector2[] testPositions;
 		if (data.TryGetValue(dictionaryKey, out testPositions))
 			return testPositions;


compute s

compute s

--- Assets/Scripts/Truss/TrussAnalyzer.cs
+++ Assets/Scripts/Truss/TrussAnalyzer.cs
@@ -114,18 +114,18 @@
     }

-    public void memberToArray(List<GameObject> members)
+    public void memberToArray(List<TrussMemberProperty> members,List<TrussNodeProperty> nodes)
     {
         float[][] array = new float[members.Count][];
         Matrix2D[] matrixs = new Matrix2D[members.Count];
-        foreach(GameObject member in members)
+        foreach(TrussMemberProperty member in members)
         {
-            TrussMemberProperty memProp = member.GetComponent<TrussMemberProperty>();
-            TrussNodeProperty node1 = memProp.node1;
-            TrussNodeProperty node2 = memProp.node2;

-            float cos = calAngle(node1.x, node2.x, memProp.lenght());
-            float sin = calAngle(node1.y, node2.y, memProp.lenght());
+            TrussNodeProperty node1 = member.node1;
+            TrussNodeProperty node2 = member.node2;
+
+            float cos = calAngle(node1.x, node2.x, member.lenght());
+            float sin = calAngle(node1.y, node2.y, member.lenght());
             float cos2 = Mathf.Pow(cos, 2);
             float sin2 = Mathf.Pow(sin, 2);
             float cossin = cos * sin;
@@ -136,13 +136,47 @@
                     {-cossin,-sin2,cossin,sin2}
                 });

-            float EAL = memProp.GetE() * memProp.GetI() / memProp.lenght();
+            float EAL = member.GetE() * member.GetI() / member.lenght();

             matrix = matrix * EAL;

         }
+        List<TrussNodeProperty> dnode = getNode(nodes);
+        float[,] sArray = new float[dnode.Count, dnode.Count];
+        for (int i = 0; i < dnode.Count; i++)
+            for (int j = 0; j < dnode.Count; j++)
+                for (int k = 0; k < members.Count; k++)
+                {
+                    if ((members[k].node1.Equals(dnode[i])&& members[k].node1.Equals(dnode[j]))||
+                        (members[k].node2.Equals(dnode[i]) && members[k].node2.Equals(dnode[j])))
+                    {
+                        sArray[i * 2, j * 2] += matrixs[k].array[0, 0];
+                        sArray[i * 2+1, j * 2] += matrixs[k].array[1, 0];
+                        sArray[i * 2, j * 2+1] += matrixs[k].array[0, 1];
+                        sArray[i * 2+1, j * 2+1] += matrixs[k].array[1, 1];
+                    }
+                    if ((members[k].node2.Equals(dnode[i])&& members[k].node1.Equals(dnode[j]))||
+                        (members[k].node1.Equals(dnode[i]) && members[k].node2.Equals(dnode[j])))
+                    {
+                        sArray[i * 2, j * 2] += matrixs[k].array[2, 0];
+                        sArray[i * 2 + 1, j * 2] += matrixs[k].array[3, 0];
+                        sArray[i * 2, j * 2 + 1] += matrixs[k].array[2, 3];
+                        sArray[i * 2 + 1, j * 2 + 1] += matrixs[k].array[3, 3];
+                    }

+                }
+    }
+
+    public List<TrussNodeProperty> getNode(List<TrussNodeProperty> nodes)
+    {
+        List<TrussNodeProperty> newList = new List<TrussNodeProperty>();
+        foreach(TrussNodeProperty node in nodes)
+        {
+            if(node.dx==1)
+                newList.Add(node)
+        }
+        return newList;
     }

     private float calAngle(float x1,float x2,float lenght)


Return invalid keys on GET BGR query

Return invalid keys on GET BGR query

--- ArchiSteamFarm/Bot.cs
+++ ArchiSteamFarm/Bot.cs
@@ -1229,7 +1229,7 @@
 						}

 						string[] parsedArgs = line.Split(DefaultBackgroundKeysRedeemerSeparator, StringSplitOptions.RemoveEmptyEntries);
-						if (parsedArgs.Length < 4) {
+						if (parsedArgs.Length < 3) {
 							ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorIsInvalid, line));
 							continue;
 						}


Remove unused usings

Remove unused usings

--- AzureFunctions/Trace/TracingEvents.cs
+++ AzureFunctions/Trace/TracingEvents.cs
@@ -1,10 +1,4 @@
-using Serilog.Events;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-
-namespace AzureFunctions.Trace
+namespace AzureFunctions.Trace
 {
     public static class TracingEvents
     {


Update UserRepositoryExtensions.cs

Update UserRepositoryExtensions.cs

--- yafsrc/YAF.Core/Model/UserRepositoryExtensions.cs
+++ yafsrc/YAF.Core/Model/UserRepositoryExtensions.cs
@@ -581,7 +581,8 @@
                         NumPosts = 0,
                         TimeZone = TimeZoneInfo.Local.Id,
                         Flags = approvedFlag,
-                        ProviderUserKey = providerUserKey
+                        ProviderUserKey = providerUserKey,
+                        PageSize = 5
                     });
             }

@@ -1168,7 +1169,8 @@
             [CanBeNull] string culture,
             [CanBeNull] string themeFile,
             [NotNull] bool hideUser,
-            [NotNull] bool activity)
+            [NotNull] bool activity,
+            [NotNull] int pageSize)
         {
             CodeContracts.VerifyNotNull(repository);

@@ -1188,7 +1190,8 @@
                     LanguageFile = languageFile,
                     ThemeFile = themeFile,
                     Culture = culture,
-                    Flags = flags.BitValue
+                    Flags = flags.BitValue,
+                    PageSize = pageSize
                 },
                 u => u.ID == userId);
         }


Remove top padding

Remove top padding

--- NuGetFeed/Views/Shared/_Layout.cshtml
+++ NuGetFeed/Views/Shared/_Layout.cshtml
@@ -31,7 +31,7 @@

-

+

         @RenderBody()


Catch more IPC I/O exceptions

Catch more IPC I/O exceptions

--- ArchiSteamFarm/IPC.cs
+++ ArchiSteamFarm/IPC.cs
@@ -763,7 +763,7 @@

 				response.ContentLength64 = content.Length;
 				await response.OutputStream.WriteAsync(content, 0, content.Length).ConfigureAwait(false);
-			} catch (ObjectDisposedException e) {
+			} catch (InvalidOperationException e) {
 				ASF.ArchiLogger.LogGenericDebuggingException(e);
 			}
 		}
@@ -781,7 +781,7 @@
 				await ResponseBase(request, response, content).ConfigureAwait(false);
 			} catch (FileNotFoundException) {
 				await ResponseStatusCode(request, response, HttpStatusCode.NotFound).ConfigureAwait(false);
-			} catch (ObjectDisposedException e) {
+			} catch (InvalidOperationException e) {
 				ASF.ArchiLogger.LogGenericDebuggingException(e);
 			} catch (Exception e) {
 				ASF.ArchiLogger.LogGenericException(e);
@@ -832,7 +832,7 @@

 				byte[] content = response.ContentEncoding.GetBytes(text + Environment.NewLine);
 				await ResponseBase(request, response, content, statusCode).ConfigureAwait(false);
-			} catch (ObjectDisposedException e) {
+			} catch (InvalidOperationException e) {
 				ASF.ArchiLogger.LogGenericDebuggingException(e);
 			}
 		}


Wrap more plugin loading logic in try catch to not crash fatally

--- BTCPayServer/Plugins/PluginManager.cs
+++ BTCPayServer/Plugins/PluginManager.cs
@@ -76,8 +76,8 @@
             }

             var disabledPlugins = GetDisabledPlugins(pluginsFolder);
-
-
+
+

             foreach (var dir in orderedDirs)
             {
@@ -94,24 +94,34 @@
                     continue;
                 }

-                var plugin = PluginLoader.CreateFromAssemblyFile(
-                    pluginFilePath, // create a plugin from for the .dll file
-                    config =>
-                    {
-
-                        // this ensures that the version of MVC is shared between this app and the plugin
-                        config.PreferSharedTypes = true;
-                        config.IsUnloadable = true;
-                    });
-
-                mvcBuilder.AddPluginLoader(plugin);
-                var pluginAssembly = plugin.LoadDefaultAssembly();
-                _pluginAssemblies.Add(pluginAssembly);
-                _plugins.Add(plugin);
-                var fileProvider = CreateEmbeddedFileProviderForAssembly(pluginAssembly);
-                loadedPlugins.Add((plugin, pluginAssembly, fileProvider));
-                plugins.AddRange(GetAllPluginTypesFromAssembly(pluginAssembly)
-                    .Select(GetPluginInstanceFromType));
+                try
+                {
+
+                    var plugin = PluginLoader.CreateFromAssemblyFile(
+                        pluginFilePath, // create a plugin from for the .dll file
+                        config =>
+                        {
+
+                            // this ensures that the version of MVC is shared between this app and the plugin
+                            config.PreferSharedTypes = true;
+                            config.IsUnloadable = true;
+                        });
+
+                    mvcBuilder.AddPluginLoader(plugin);
+                    var pluginAssembly = plugin.LoadDefaultAssembly();
+                    _pluginAssemblies.Add(pluginAssembly);
+                    _plugins.Add(plugin);
+                    var fileProvider = CreateEmbeddedFileProviderForAssembly(pluginAssembly);
+                    loadedPlugins.Add((plugin, pluginAssembly, fileProvider));
+                    plugins.AddRange(GetAllPluginTypesFromAssembly(pluginAssembly)
+                        .Select(GetPluginInstanceFromType));
+
+                }
+                catch (Exception e)
+                {
+                    _logger.LogError(e,
+                        $"Error when loading plugin {pluginName}");
+                }
             }

             foreach (var plugin in plugins)


Update comment about Duplicate Suppression

--- Nvents/Services/CombinationService.cs
+++ Nvents/Services/CombinationService.cs
@@ -31,7 +31,7 @@
         /// <summary>
         /// Setting to All causes all duplicate events to be filtered.
         /// Setting to None will cause duplicate events to be handled again.
-        /// Setting to UniqueOnly will suppress events that implement IUniqueNvent.
+        /// Setting to UseEquals will suppress events that already been processed based on the Equals method.
         /// </summary>
         public DuplicateSuppressionOption DuplicateSuppression { get; set; }


Make !rejoinchat follow <Bots> syntax

Make !rejoinchat follow <Bots> syntax

--- ArchiSteamFarm/Bot.cs
+++ ArchiSteamFarm/Bot.cs
@@ -705,6 +705,8 @@
 					}

 					return await ResponseRedeem(steamID, args[1], ERedeemFlags.ForceForwarding | ERedeemFlags.SkipInitial).ConfigureAwait(false);
+				case "!REJOINCHAT":
+					return await ResponseRejoinChat(steamID, args[1]).ConfigureAwait(false);
 				case "!RESUME":
 					return await ResponseResume(steamID, args[1]).ConfigureAwait(false);
 				case "!START":
@@ -2814,21 +2816,49 @@
 			return responses.Count > 0 ? string.Join("", responses) : null;
 		}

-		private static string ResponseRejoinChat(ulong steamID) {
+		private string ResponseRejoinChat(ulong steamID) {
 			if (steamID == 0) {
-				ASF.ArchiLogger.LogNullError(nameof(steamID));
-				return null;
-			}
-
-			if (!IsOwner(steamID)) {
-				return null;
-			}
-
-			foreach (Bot bot in Bots.Values) {
-				bot.JoinMasterChat();
-			}
-
+				ArchiLogger.LogNullError(nameof(steamID));
+				return null;
+			}
+
+			if (!IsMaster(steamID)) {
+				return null;
+			}
+
+			JoinMasterChat();
 			return FormatStaticResponse(Strings.Done);
+		}
+
+		private static async Task<string> ResponseRejoinChat(ulong steamID, string botNames) {
+			if ((steamID == 0) || string.IsNullOrEmpty(botNames)) {
+				ASF.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(botNames));
+				return null;
+			}
+
+			HashSet<Bot> bots = GetBots(botNames);
+			if ((bots == null) || (bots.Count == 0)) {
+				return IsOwner(steamID) ? FormatStaticResponse(string.Format(Strings.BotNotFound, botNames)) : null;
+			}
+
+			ICollection<string> results;
+			IEnumerable<Task<string>> tasks = bots.Select(bot => Task.Run(() => bot.ResponseRejoinChat(steamID)));
+
+			switch (Program.GlobalConfig.OptimizationMode) {
+				case GlobalConfig.EOptimizationMode.MinMemoryUsage:
+					results = new List<string>(bots.Count);
+					foreach (Task<string> task in tasks) {
+						results.Add(await task.ConfigureAwait(false));
+					}
+
+					break;
+				default:
+					results = await Task.WhenAll(tasks).ConfigureAwait(false);
+					break;
+			}
+
+			List<string> responses = new List<string>(results.Where(result => !string.IsNullOrEmpty(result)));
+			return responses.Count > 0 ? string.Join("", responses) : null;
 		}

 		private static string ResponseRestart(ulong steamID) {


Use actual request uri for callback, pass state

--- OAuthCallbackHttpTrigger/endpoint.csx
+++ OAuthCallbackHttpTrigger/endpoint.csx
@@ -4,16 +4,11 @@
 using System.Net.Http.Headers;
 using System.Text;

-private static HttpResponseMessage GetResponse(string jsonString)
+private static HttpResponseMessage GetResponse(string jsonString, string state = "")
 {
     var response = new HttpResponseMessage();

-    StringBuilder sb = new StringBuilder();
-    sb.Append("");
-    sb.Append(jsonString);
-    sb.Append("");
-
-    response.Content = new StringContent(sb.ToString());
+    response.Content = new StringContent(jsonString + Environment.NewLine + state);
     response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");

     return response;
@@ -27,16 +22,11 @@
 }

 // Make a request starting here:
-// https://disqus.com/api/oauth/2.0/authorize/?client_id=YOUR_API_KEY&scope=read,write,email&response_type=code
+// https://disqus.com/api/oauth/2.0/authorize/?client_id=YOUR_API_KEY&scope=read,write,email&response_type=code&state=ANYTHING
 public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
 {
     string disqusApiKey = ConfigurationManager.AppSettings["DISQUS_API_KEY"];
     string disqusApiSecret = ConfigurationManager.AppSettings["DISQUS_API_SECRET"];
-
-    log.Info("Processing OAuth callback...");
-    log.Info("Request URI: " + req.RequestUri.OriginalString);
-    log.Info("API Key: " + disqusApiKey);
-    log.Info("Secret Key: " + disqusApiSecret);

     // Parse query parameters
     var queryParams = req.GetQueryNameValuePairs();
@@ -58,24 +48,26 @@
     }

     string code = GetParam(queryParams, "code");
-
-    if (String.IsNullOrEmpty(code))
+    string state = GetParam(queryParams, "state");
+    if (String.IsNullOrEmpty(code) || String.IsNullOrEmpty(state))
         return GetResponse("{}");

     using (var client = new HttpClient())
     {
+        var reqUri = req.RequestUri;
+        string redirectUri = String.Format("{0}://{1}{2}", reqUri.Scheme, reqUri.Host, reqUri.AbsolutePath);
         var content = new FormUrlEncodedContent(new []
         {
             new KeyValuePair<string, string>("grant_type", "authorization_code"),
             new KeyValuePair<string, string>("client_id", disqusApiKey),
             new KeyValuePair<string, string>("client_secret", disqusApiSecret),
-            new KeyValuePair<string, string>("redirect_uri", "https://dsqoauthexample.azurewebsites.net/api/OAuthCallbackHttpTrigger/"),
+            new KeyValuePair<string, string>("redirect_uri", redirectUri),
             new KeyValuePair<string, string>("code", code)
         });
         var response = await client.PostAsync("https://disqus.com/api/oauth/2.0/access_token/", content);

         string jsonContent = await response.Content.ReadAsStringAsync();

-        return GetResponse(jsonContent);
+        return GetResponse(jsonContent, state);
     }
 }


Dispose Files, Fix memory leak

Dispose Files, Fix memory leak

--- BarbaTunnel/BarbaCommLib/BarbaComm.cs
+++ BarbaTunnel/BarbaCommLib/BarbaComm.cs
@@ -270,10 +270,12 @@
         {
             try
             {
-                var fs = File.Open(NotifyFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
-                var logReader = new StreamReader(fs, Encoding.UTF8);
-                title = logReader.ReadLine();
-                return logReader.ReadToEnd();
+                using (var fs = File.Open(NotifyFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+                using (var logReader = new StreamReader(fs, Encoding.UTF8))
+                {
+                    title = logReader.ReadLine();
+                    return logReader.ReadToEnd();
+                }
             }
             catch
             {
@@ -286,9 +288,11 @@
         {
             try
             {
-                var fs = File.Open(LogFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
-                var logReader = new StreamReader(fs, Encoding.UTF8);
-                return logReader.ReadToEnd();
+                using (var fs = File.Open(LogFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+                using (var logReader = new StreamReader(fs, Encoding.UTF8))
+                {
+                    return logReader.ReadToEnd();
+                }
             }
             catch
             {


Closes #2292

Closes #2292

--- ArchiSteamFarm/Bot.cs
+++ ArchiSteamFarm/Bot.cs
@@ -3258,7 +3258,7 @@
 						}
 					}

-					ArchiLogger.LogGenericDebug(string.Format(CultureInfo.CurrentCulture, Strings.BotRedeem, key, result.Result + "/" + result.PurchaseResultDetail));
+					ArchiLogger.LogGenericDebug(result.Items?.Count > 0 ? string.Format(CultureInfo.CurrentCulture, Strings.BotRedeemWithItems, key, result.Result + "/" + result.PurchaseResultDetail, string.Join(", ", result.Items)) : string.Format(CultureInfo.CurrentCulture, Strings.BotRedeem, key, result.Result + "/" + result.PurchaseResultDetail));

 					bool rateLimited = false;
 					bool redeemed = false;


remove generics where not used

remove generics where not used

--- OBeautifulCode.Math/HashCodeHelper.cs
+++ OBeautifulCode.Math/HashCodeHelper.cs
@@ -10,6 +10,7 @@
 namespace OBeautifulCode.Math.Recipes
 {
     using System;
+    using System.Collections;
     using System.Collections.Generic;
     using System.Linq;

@@ -101,11 +102,10 @@
         /// <summary>
         /// Adds the hash value for the given value to the current hash and returns the new value.
         /// </summary>
-        /// <typeparam name="T">The type of the value being hashed.</typeparam>
         /// <param name="value">The value to hash.</param>
         /// <returns>The new hash code.</returns>
-        public HashCodeHelper Hash<T>(
-            T value)
+        public HashCodeHelper Hash(
+            object value)
         {
             unchecked
             {
@@ -141,18 +141,17 @@
         }

         /// <summary>
-        /// Adds the hash value for all elements of the specified <see cref="IEnumerable{T}"/> to the current hash and returns the new value.
-        /// </summary>
-        /// <typeparam name="T">The type of objects to enumerate and hash.</typeparam>
+        /// Adds the hash value for all elements of the specified <see cref="IEnumerable"/> to the current hash and returns the new value.
+        /// </summary>
         /// <param name="values">The enumerable to hash.</param>
         /// <returns>The new hash code.</returns>
-        public HashCodeHelper HashElements<T>(
-            IEnumerable<T> values)
+        public HashCodeHelper HashElements(
+            IEnumerable values)
         {
             HashCodeHelper helper = this;
             if (values == null)
             {
-                helper = helper.Hash((IEnumerable<T>)null);
+                helper = helper.Hash(null);
             }
             else
             {
@@ -181,7 +180,7 @@
             HashCodeHelper helper = this;
             if (values == null)
             {
-                helper = helper.Hash((IEnumerable<T>)null);
+                helper = helper.Hash(null);
             }
             else
             {


catch platformnotsupported

catch platformnotsupported

--- BotVentic/BotVentic/MessageHandler.cs
+++ BotVentic/BotVentic/MessageHandler.cs
@@ -310,7 +310,7 @@
                     {
                         reply = $"Connected via `{client.GatewaySocket.Host}`\nConnected to {client.Servers.Count()} servers.\nMemory Usage is {Math.Ceiling(System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / 1024.0)} KB";
                     }
-                    catch (Exception ex) when (ex is ArgumentNullException || ex is OverflowException)
+                    catch (Exception ex) when (ex is ArgumentNullException || ex is OverflowException || ex is PlatformNotSupportedException)
                     {
                         reply = $"Error: {ex.Message}";
                         Console.WriteLine(ex.ToString());


Resolve line too long message on build server

--- AssemblyInfoCommon.cs
+++ AssemblyInfoCommon.cs
@@ -22,6 +22,8 @@
 [assembly: AssemblyCopyright("Copyright © Adrian John Dunstan 2016")]

 // Version is generated on the build server.
+#pragma warning disable MEN002 // Line is too long
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 [assembly: AssemblyInformationalVersion("0.1.0.0")]
+#pragma warning restore MEN002 // Line is too long


use getUniqueIndex()

use getUniqueIndex()

--- Assets/InventoryCS.cs
+++ Assets/InventoryCS.cs
@@ -47,6 +47,7 @@
 		T_caseNo.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_caseNo);
 		T_row.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_row);
 		T_column.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_column);
+		IF_uniqueID.text = getUniqueIndex (T_caseNo.text, T_row.text, T_column.text);
 		IF_name.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_name);
 		T_about.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_about);
 		T_datasheetURL.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_dataSheetURL);


Update CoinCounter.cs

Update CoinCounter.cs


rainbow function

rainbow function

--- Assets/Scripts/yml.cs
+++ Assets/Scripts/yml.cs
@@ -137,7 +137,7 @@
      *    `string` to be formatted.
      **/
     public static string md(this string s) {
-        return new Buffer(Markdown.Transform(s))
+        return new Buffer(Markdown.Transform(s).rainbow())
             .Replace("","")
             .Replace("","")
             .Replace("
","")
@@ -181,6 +181,39 @@
             .ToString();
     }

+    public static string rainbow(this string s) {
+        var buffer = new Buffer();
+        var tag = new Regex(@"<rainbow>");
+        var end = "</rainbow>";
+        var i = 0;
+        var color = "</color>";
+        var colors = new string[] {
+            "<color=#f26a6a>",
+            "<color=#f6a72e>",
+            "<color=#fff16b>",
+            "<color=#73d279>",
+            "<color=#73aed2>",
+            "<color=#b695ea>",
+            "<color=#d495ea>"};
+        var list = tag.Split(s);
+        foreach (string line in list) {
+            Debug.Log(line);
+            if (line.EndsWith(end))
+                Debug.Log("asdv");
+
+        }
+
+        foreach (char letter in s) {
+            buffer.Append(colors[i%colors.Length]);
+            buffer.Append(letter);
+            buffer.Append(color);
+            i++;
+        } return buffer.ToString();
+    }
+
+
+
+

     /** `Replace()` : **`string`**
      *


Change TypeAttributes elem type to uint

Change TypeAttributes elem type to uint

--- dot10/dotNET/Types/TypeAttributes.cs
+++ dot10/dotNET/Types/TypeAttributes.cs
@@ -5,7 +5,7 @@
 	/// TypeDef and ExportedType flags. See CorHdr.h/CorTypeAttr
 	///
 	[Flags]
-	public enum TypeAttributes {
+	public enum TypeAttributes : uint {
 		/// Use this mask to retrieve the type visibility information.
 		VisibilityMask			= 0x00000007,
 		/// Class is not public scope.


add null checking

add null checking

--- YARTE/YARTE/HtmlEditor.cs
+++ YARTE/YARTE/HtmlEditor.cs
@@ -233,8 +233,7 @@
                 {
                     Console.WriteLine(textWebBrowser.Document.GetElementsByTagName("input")[0].GetAttribute("checked"));
                 }
-
-                return doc.body.innerHTML;
+
                 /* this previously returned textWebBrowser.DocumentText, so the following HTML is now omitted:
                    < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

@@ -242,6 +241,14 @@
                    < META name = GENERATOR content = "MSHTML 11.00.10570.1001" >

                 */
+                if (doc != null)
+                {
+                    return doc.body.innerHTML;
+                }
+                else
+                {
+                    return "";
+                }
             }
             set
             {


fix serializing dates and bools to RDF

fix serializing dates and bools to RDF

--- src/JsonLD/Core/RDFDataset.cs
+++ src/JsonLD/Core/RDFDataset.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Globalization;
 using JsonLD.Core;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;

 namespace JsonLD.Core
@@ -733,7 +734,8 @@
                     // convert to XSD datatype
                     if (value.Type == JTokenType.Boolean)
                     {
-                        return new RDFDataset.Literal(value.ToString(), datatype.IsNull() ? JSONLDConsts.XsdBoolean
+                        var serializeObject = JsonConvert.SerializeObject(value, Formatting.None).Trim('"');
+                        return new RDFDataset.Literal(serializeObject, datatype.IsNull() ? JSONLDConsts.XsdBoolean
                              : (string)datatype, null);
                     }
                     else
@@ -766,7 +768,8 @@
                     }
                     else
                     {
-                        return new RDFDataset.Literal((string)value, datatype.IsNull() ? JSONLDConsts.XsdString
+                        var serializeObject = JsonConvert.SerializeObject(value, Formatting.None).Trim('"');
+                        return new RDFDataset.Literal(serializeObject, datatype.IsNull() ? JSONLDConsts.XsdString
                              : (string)datatype, null);
                     }
                 }


kraken v5

kraken v5

--- BotVentic2/Program.cs
+++ BotVentic2/Program.cs
@@ -49,7 +49,7 @@
                 if (includeClientId)
                 {
                     client.DefaultRequestHeaders.Add("Client-ID", "4wck2d3bifbikv779pnez14jujeyash");
-                    client.DefaultRequestHeaders.Accept.ParseAdd("application/vnd.twitchtv.v4+json");
+                    client.DefaultRequestHeaders.Accept.ParseAdd("application/vnd.twitchtv.v5+json");
                 }
                 client.Timeout = TimeSpan.FromSeconds(60);
                 result = await client.GetStringAsync(uri);
@@ -61,4 +61,4 @@
         }
         return result;
     }
-}+}


Add new sample app command for GetCandlesticksAsync

--- samples/BinanceConsoleApp/Program.cs
+++ samples/BinanceConsoleApp/Program.cs
@@ -124,40 +124,41 @@
                 Console.WriteLine("Commands:");
                 Console.WriteLine();
                 Console.WriteLine(" Connectivity:");
-                Console.WriteLine("  ping                                       test connection to server.");
-                Console.WriteLine("  time                                       get current server time (UTC).");
+                Console.WriteLine("  ping                                                 test connection to server.");
+                Console.WriteLine("  time                                                 display the current server time (UTC).");
                 Console.WriteLine();
                 Console.WriteLine(" Market Data:");
-                Console.WriteLine("  stats <symbol>                             display 24h stats for symbol.");
-                Console.WriteLine("  depth|book <symbol> [limit]                display symbol order book, where limit: [1-100].");
-                Console.WriteLine("  trades <symbol> [limit]                    display latest trades, where limit: [1-500].");
-                Console.WriteLine("  tradesIn <symbol> <start> <end>            display trades within a time range (inclusive).");
-                Console.WriteLine("  tradesFrom <symbol> <tradeId> [limit]      display trades beginning with trade ID.");
-                Console.WriteLine("  candles|klines <symbol> <interval>         display candlestick bars for a symbol.");
-                Console.WriteLine("  symbols                                    display all symbols.");
-                Console.WriteLine("  prices                                     display current price for all symbols.");
-                Console.WriteLine("  tops                                       display order book top price and quantity for all symbols.");
-                Console.WriteLine("  live depth <symbol>                        enable order book live feed for a symbol.");
-                Console.WriteLine("  live kline <symbol> <interval>             enable kline live feed for a symbol and interval.");
-                Console.WriteLine("  live trades <symbol>                       enable trades live feed for a symbol.");
-                Console.WriteLine("  live account|user                          enable user data live feed (api key required).");
-                Console.WriteLine("  live off                                   disable the websocket live feed (there can be only one).");
+                Console.WriteLine("  stats <symbol>                                       display 24h stats for symbol.");
+                Console.WriteLine("  depth|book <symbol> [limit]                          display symbol order book, where limit: [1-100].");
+                Console.WriteLine("  trades <symbol> [limit]                              display latest trades, where limit: [1-500].");
+                Console.WriteLine("  tradesIn <symbol> <start> <end>                      display trades within a time range (inclusive).");
+                Console.WriteLine("  tradesFrom <symbol> <tradeId> [limit]                display trades beginning with trade ID.");
+                Console.WriteLine("  candles|klines <symbol> <interval> [limit]           display candlestick bars for a symbol.");
+                Console.WriteLine("  candlesIn|klinesIn <symbol> <interval> <start> <end> display candlestick bars for a symbol in time range.");
+                Console.WriteLine("  symbols                                              display all symbols.");
+                Console.WriteLine("  prices                                               display current price for all symbols.");
+                Console.WriteLine("  tops                                                 display order book top price and quantity for all symbols.");
+                Console.WriteLine("  live depth <symbol>                                  enable order book live feed for a symbol.");
+                Console.WriteLine("  live kline <symbol> <interval>                       enable kline live feed for a symbol and interval.");
+                Console.WriteLine("  live trades <symbol>                                 enable trades live feed for a symbol.");
+                Console.WriteLine("  live account|user                                    enable user data live feed (api key required).");
+                Console.WriteLine("  live off                                             disable the websocket live feed (there can be only one).");
                 Console.WriteLine();
                 Console.WriteLine(" Account (authentication required):");
-                Console.WriteLine("  limit <side> <symbol> <qty> <price>        create a limit order.");
-                Console.WriteLine("  market <side> <symbol> <qty>               create a market order.");
-                Console.WriteLine("  orders <symbol> [limit]                    display orders for a symbol, where limit: [1-500].");
-                Console.WriteLine("  orders <symbol> open                       display all open orders for a symbol.");
-                Console.WriteLine("  order <symbol> <ID>                        display an order by ID.");
-                Console.WriteLine("  order <symbol> <ID> cancel                 cancel an order by ID.");
-                Console.WriteLine("  account|balances|positions                 display user account information (including balances).");
-                Console.WriteLine("  myTrades <symbol> [limit]                  display user trades of a symbol.");
-                Console.WriteLine("  deposits [asset]                           display user deposits of an asset or all deposits.");
-                Console.WriteLine("  withdrawals [asset]                        display user withdrawals of an asset or all withdrawals.");
-                Console.WriteLine("  withdraw <asset> <address> <amount>        submit a withdraw request (NOTE: 'test only' does NOT apply).");
-                Console.WriteLine("  test <on|off>                              determines if orders are test only (default: on).");
-                Console.WriteLine();
-                Console.WriteLine("  quit | exit                                terminate the application.");
+                Console.WriteLine("  limit <side> <symbol> <qty> <price>                  create a limit order.");
+                Console.WriteLine("  market <side> <symbol> <qty>                         create a market order.");
+                Console.WriteLine("  orders <symbol> [limit]                              display orders for a symbol, where limit: [1-500].");
+                Console.WriteLine("  orders <symbol> open                                 display all open orders for a symbol.");
+                Console.WriteLine("  order <symbol> <ID>                                  display an order by ID.");
+                Console.WriteLine("  order <symbol> <ID> cancel                           cancel an order by ID.");
+                Console.WriteLine("  account|balances|positions                           display user account information (including balances).");
+                Console.WriteLine("  myTrades <symbol> [limit]                            display user trades of a symbol.");
+                Console.WriteLine("  deposits [asset]                                     display user deposits of an asset or all deposits.");
+                Console.WriteLine("  withdrawals [asset]                                  display user withdrawals of an asset or all withdrawals.");
+                Console.WriteLine("  withdraw <asset> <address> <amount>                  submit a withdraw request (NOTE: 'test only' does NOT apply).");
+                Console.WriteLine("  test <on|off>                                        determines if orders are test only (default: on).");
+                Console.WriteLine();
+                Console.WriteLine("  quit | exit                                          terminate the application.");
                 Console.WriteLine();
                 Console.WriteLine(" * default symbol: BTCUSDT");
                 Console.WriteLine(" * default limit: 10");
@@ -344,13 +345,7 @@
                             long.TryParse(args[3], out endTime);
                         }

-                        int limit = 10;
-                        if (args.Length > 4)
-                        {
-                            int.TryParse(args[4], out limit);
-                        }
-
-                        var trades = await _api.GetAggregateTradesAsync(symbol, startTime: startTime, endTime: endTime, limit: limit, token: token);
+                        var trades = await _api.GetAggregateTradesAsync(symbol, startTime: startTime, endTime: endTime, token: token);

                         lock (_consoleSync)
                         {
@@ -387,6 +382,48 @@
                             foreach (var trade in trades)
                             {
                                 Display(trade);
+                            }
+                            Console.WriteLine();
+                        }
+                    }
+                    // Candlesticks within time range
+                    else if (stdin.StartsWith("candlesIn", StringComparison.OrdinalIgnoreCase)
+                          || stdin.StartsWith("klinesIn", StringComparison.OrdinalIgnoreCase))
+                    {
+                        var args = stdin.Split(' ');
+
+                        string symbol = Symbol.BTC_USDT;
+                        if (args.Length > 1)
+                        {
+                            symbol = args[1];
+                        }
+
+                        var interval = KlineInterval.Hour;
+                        if (args.Length > 2)
+                        {
+                            interval = args[2].ToKlineInterval();
+                        }
+
+                        long startTime = 0;
+                        if (args.Length > 3)
+                        {
+                            long.TryParse(args[3], out startTime);
+                        }
+
+                        long endTime = 0;
+                        if (args.Length > 4)
+                        {
+                            long.TryParse(args[4], out endTime);
+                        }
+
+                        var candlesticks = await _api.GetCandlesticksAsync(symbol, interval, startTime: startTime, endTime: endTime, token: token);
+
+                        lock (_consoleSync)
+                        {
+                            Console.WriteLine();
+                            foreach (var candlestick in candlesticks)
+                            {
+                                Display(candlestick);
                             }
                             Console.WriteLine();
                         }
@@ -422,7 +459,7 @@
                             Console.WriteLine();
                             foreach (var candlestick in candlesticks)
                             {
-                                Console.WriteLine($"   O: {candlestick.Open.ToString("0.00000000")} | H: {candlestick.High.ToString("0.00000000")} | L: {candlestick.Low.ToString("0.00000000")} | C: {candlestick.Close.ToString("0.00000000")} | V: {candlestick.Volume.ToString("0.")}");
+                                Display(candlestick);
                             }
                             Console.WriteLine();
                         }
@@ -1184,6 +1221,14 @@
             }
         }

+        private static void Display(Candlestick candlestick)
+        {
+            lock (_consoleSync)
+            {
+                Console.WriteLine($"   O: {candlestick.Open.ToString("0.00000000")} | H: {candlestick.High.ToString("0.00000000")} | L: {candlestick.Low.ToString("0.00000000")} | C: {candlestick.Close.ToString("0.00000000")} | V: {candlestick.Volume.ToString("0.")}  -  {candlestick.OpenTime}");
+            }
+        }
+
         private static void Display(Order order)
         {
             lock (_consoleSync)


Fix AccountInfo display

Fix AccountInfo display

--- samples/BinanceConsoleApp/Program.cs
+++ samples/BinanceConsoleApp/Program.cs
@@ -450,10 +450,10 @@
         {
             lock (ConsoleSync)
             {
-                Console.WriteLine($"    Maker Commission:  {account.Commissions.Maker.ToString().PadLeft(3)} %");
-                Console.WriteLine($"    Taker Commission:  {account.Commissions.Taker.ToString().PadLeft(3)} %");
-                Console.WriteLine($"    Buyer Commission:  {account.Commissions.Buyer.ToString().PadLeft(3)} %");
-                Console.WriteLine($"    Seller Commission: {account.Commissions.Seller.ToString().PadLeft(3)} %");
+                Console.WriteLine($"    Maker Commission:  {account.Commissions.Maker.ToString().PadLeft(3)} bips  ({account.Commissions.Maker / 100.0m}%)");
+                Console.WriteLine($"    Taker Commission:  {account.Commissions.Taker.ToString().PadLeft(3)} bips  ({account.Commissions.Taker / 100.0m}%)");
+                Console.WriteLine($"    Buyer Commission:  {account.Commissions.Buyer.ToString().PadLeft(3)} bips  ({account.Commissions.Buyer / 100.0m}%)");
+                Console.WriteLine($"    Seller Commission: {account.Commissions.Seller.ToString().PadLeft(3)} bips  ({account.Commissions.Seller / 100.0m}%)");
                 Console.WriteLine($"    Can Trade:    {(account.Status.CanTrade ? "Yes" : "No").PadLeft(3)}");
                 Console.WriteLine($"    Can Withdraw: {(account.Status.CanWithdraw ? "Yes" : "No").PadLeft(3)}");
                 Console.WriteLine($"    Can Deposit:  {(account.Status.CanDeposit ? "Yes" : "No").PadLeft(3)}");


fix infographic vertical text alignment of wild level

--- ARKBreedingStats/library/CreatureInfoGraphic.cs
+++ ARKBreedingStats/library/CreatureInfoGraphic.cs
@@ -73,6 +73,7 @@
             using (var fontBrush = new SolidBrush(foreColor))
             using (var borderAroundColors = new Pen(Utils.ForeColor(backColor), 1))
             using (var stringFormatRight = new StringFormat { Alignment = StringAlignment.Far })
+            using (var stringFormatRightUp = new StringFormat { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Far })
             {
                 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                 int currentYPosition = frameThickness * 3;
@@ -288,7 +289,7 @@
                 if (cc != null && displayMaxWildLevel)
                 {
                     g.DrawString($"{Loc.S("max wild level")}: {cc.maxWildLevel}",
-                        fontSmall, fontBrush, width - 2 * frameThickness, height - fontSizeSmall - 4 * frameThickness, stringFormatRight);
+                        fontSmall, fontBrush, width - 2 * frameThickness, height - frameThickness, stringFormatRightUp);
                 }

                 // frame


--- CSharp/String/ConcatXStringBuilder.cs
+++ CSharp/String/ConcatXStringBuilder.cs
@@ -4,7 +4,7 @@
 using System.Text;

 public class Program {
-    const int Limit = 100_000;
+    const int Limit = 100000;
 	static int[] dataInt = new int[Limit];
 	static string[] dataString = new string[Limit];

@@ -45,24 +45,16 @@
 		for (int i = 0; i < Limit; i++) {
 			tmp += dataString[i];
 		}
-		return tmp.Length;
+		return tmp.Length;
     }

-    static int ConcatenationInt() {
-		return string.Concat(dataInt).Length;
-    }
+    static int ConcatenationInt() => string.Concat(dataInt).Length;

-    static int ConcatenationString() {
-		return string.Concat(dataString).Length;
-    }
+    static int ConcatenationString() => string.Concat(dataString).Length;

-    static int JunctionInt() {
-		return string.Join("", dataInt).Length;
-    }
+    static int JunctionInt() => string.Join("", dataInt).Length;

-    static int JunctionString() {
-		return string.Join("", dataString).Length;
-    }
+    static int JunctionString() => string.Join("", dataString).Length;

     static int BuilderInt() {
 		var tmp = new StringBuilder();


Added missing finalization in ImageBrush

--- Brushes/ImageBrush.cs
+++ Brushes/ImageBrush.cs
@@ -76,7 +76,7 @@
             x = Math.Max(0, Math.Min(x, Image.Width - 1));
             y = Math.Max(0, Math.Min(y, Image.Height - 1));

-            return Image.GetPixel(x, y);
+            return FinalizeColor(Image.GetPixel(x, y));
         }

         #endregion


Delete OperatorAnd.cs

Delete OperatorAnd.cs

--- CSharp/OperatorAnd.cs
+++ CSharp/OperatorAnd.cs
@@ -1,32 +0,0 @@
-using static System.Console;
-
-public class Program {
-	public static void Main() {
-		var x = 1;
-		var y = 2;
-		var a = x & y;
-		var b = x == 1;
-		var c = y == 2;
-		var d = x & y;
-		var e = (x & y) == 0;
-		WriteLine(a);
-		WriteLine(d); //note que é um inteiro
-		WriteLine(e);
-		//if (x & y) WriteLine("ok"); //não funciona porque if espera um bool e o resultado é int
-		if (b & c) WriteLine("ok"); else WriteLine(" não ok");
-		if (Teste(x) & Teste(y)) WriteLine("&  - ok"); else WriteLine("&");
-		if (Teste(x) && Teste(y)) WriteLine("&& - ok"); else WriteLine("&&");
-		if (Teste(x) | Teste(y)) WriteLine("|  - ok"); else WriteLine("|");
-		if (Teste(x) || Teste(y)) WriteLine("|| - ok"); else WriteLine("||");
-		if (Teste(y) & Teste(x)) WriteLine("&  - ok"); else WriteLine("&");
-		if (Teste(y) && Teste(x)) WriteLine("&& - ok"); else WriteLine("&&");
-		if (Teste(y) | Teste(x)) WriteLine("|  - ok"); else WriteLine("|");
-		if (Teste(y) || Teste(x)) WriteLine("|| - ok"); else WriteLine("||");
-	}
-	public static bool Teste(int x) {
-		WriteLine($"Executou {x}");
-		return x == 2;
-	}
-}
-
-//http://pt.stackoverflow.com/q/190579/101


Fix exception if the connection is aborted while awaiting Hello

--- ByteNom/Connection.cs
+++ ByteNom/Connection.cs
@@ -126,10 +126,6 @@
             while (this.Connected)
             {
                 var dataMsg = this.ProtoGet<DataMessage>();
-
-                // If we received 0 bytes, the connection is closed
-                if (dataMsg == null) break;
-
                 Message msg = MessageSerializer.Deserialize(dataMsg);
                 this.OnMessageReceived(msg);
             }
@@ -173,9 +169,13 @@
             this.Client.Close();
         }

-        internal T ProtoGet<T>()
-        {
-            return Serializer.DeserializeWithLengthPrefix<T>(this.Stream, PrefixStyle.Base128);
+        internal T ProtoGet<T>() where T : class
+        {
+            var value = Serializer.DeserializeWithLengthPrefix<T>(this.Stream, PrefixStyle.Base128);
+            if (value == null)
+                throw new IOException("The connection was closed.");
+
+            return value;
         }

         internal void ProtoSend<T>(T messageObj)


Home page rearranged (Jenkins check)

Home page rearranged (Jenkins check)

--- AquaWorld/AquaWorld.Web/Views/Home/Index.cshtml
+++ AquaWorld/AquaWorld.Web/Views/Home/Index.cshtml
@@ -3,29 +3,7 @@
 }

-
ASP.NET

-
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.

-
Learn more »

-

-
-

-

-
Getting started

-

-            ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
-            enables a clean separation of concerns and gives you full control over markup
-            for enjoyable, agile development.
-

-
Learn more »

-

-

-
Get more libraries

-
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

-
Learn more »

-

-

-
Web Hosting

-
You can easily find a web hosting company that offers the right mix of features and price for your applications.

-
Learn more »

-

+
Aqua World

+    Order rare creatures online.
+
Catalogue »


sorting fix

sorting fix

--- CameraFieldBuilder.cs
+++ CameraFieldBuilder.cs
@@ -204,9 +204,9 @@
         List<ICuttableEdge> res = new List<ICuttableEdge>();
         res.Add( edge1 );

-        for ( int i = 0; i < 5; ++i )
-        {
-            res.Add( new LineEdge( new LineSegment { p0 = circle_edge.Eval( 1.0f * i / 5 ).pt, p1 = circle_edge.Eval( 1.0f * ( i + 1 ) / 5 ).pt }, true ) );
+        for ( int i = 0; i < 3; ++i )
+        {
+            res.Add( new LineEdge( new LineSegment { p0 = circle_edge.Eval( 1.0f * i / 3 ).pt, p1 = circle_edge.Eval( 1.0f * ( i + 1 ) / 3 ).pt }, true ) );
         }
         res.Add( edge2 );

@@ -260,11 +260,22 @@
         for ( int i = 0; i < field.Loops.Count; ++i )
             used_loops.Add( false );

+        List<List<ICuttableEdge>> new_loops = new List<List<ICuttableEdge>>();
+
         if ( intersections.Count == 0 )
         {
             // test point on tool loop, if in field, add it to the field
-            if ( field.IsPointInside( edges2cut[0].Eval( 0 ).pt ) );
-            return field;
+            if ( field.IsPointInside( edges2cut[0].Eval( 0 ).pt ) )
+            {
+                new_loops.Add( edges2cut );
+                foreach ( var loop in field.Loops )
+                    new_loops.Add( loop );
+                return new CameraField( new_loops );
+            }
+            else
+            {
+                return field;
+            }
         }

         BopMap bop_map = new BopMap();
@@ -274,7 +285,6 @@
             bop_map.tool_edges = edges2cut;
         };

-        List<List<ICuttableEdge>> new_loops = new List<List<ICuttableEdge>>();
         // find valid intersection and start from it
         bool unprocessed_found = false;

@@ -520,6 +530,16 @@
         }
     }

+    private class TopologyIntersectionComparer_ByTarget : IComparer<TopologyIntersection>
+    {
+        public int Compare ( TopologyIntersection x, TopologyIntersection y )
+        {
+            if ( x.Geom.face_edge_param == y.Geom.face_edge_param )
+                return 0;
+            return x.Geom.face_edge_param < y.Geom.face_edge_param ? -1 : 1;
+        }
+    }
+
     private Dictionary<ICuttableEdge, IList<TopologyIntersection>> MakeIntersectionMap( IEnumerable<TopologyIntersection> intersections, IList<List<ICuttableEdge>> face_loops, IList<ICuttableEdge> tool )
     {
         var res = new Dictionary<ICuttableEdge, IList<TopologyIntersection>>();
@@ -558,6 +578,7 @@
             var loop = field.Loops[loop_idx];
             for ( int edge_idx = 0; edge_idx < loop.Count; ++edge_idx )
             {
+                List<TopologyIntersection> sorted_is = new List<TopologyIntersection>();
                 for ( int tool_edge_idx = 0; tool_edge_idx < edges2cut.Count; ++tool_edge_idx )
                 {
                     var intersections = intersector.Intersect( loop[edge_idx], edges2cut[tool_edge_idx] );
@@ -566,9 +587,12 @@
                         TopologyIntersection res = new TopologyIntersection(
                             loop_idx, edge_idx, tool_edge_idx, intersection );

-                        res_list.Add( res );
+                        sorted_is.Add( res );
                     }
                 }
+
+                sorted_is.Sort( new TopologyIntersectionComparer_ByTarget() );
+                res_list.AddRange( sorted_is );
             }
         }