Boleto e Remessa do CNAB 400 HSBC - Correções de erros

Boleto e Remessa do CNAB 400 HSBC - Correções de erros:
No banco HSBC o código do beneficiario deverá ser o número da conta
corrênte com dígito e a remessa não está preenchendo a linha de detalhe
com a especie. Revision 13504.

--- src/Boleto.Net/Banco/Banco_HSBC.cs
+++ src/Boleto.Net/Banco/Banco_HSBC.cs
@@ -894,6 +894,9 @@
                         break;
                     case "4": //DuplicataServico
                         _detalhe += "10";
+                        break;
+                    case "98":  //Cobrança com emissão total do bloqueto pelo cliente
+                        _detalhe += "98"; //Cobrança com emissão total do bloqueto pelo cliente
                         break;
                 }


Another

Another

--- src/Core/RequestifyTF2/Api/User.cs
+++ src/Core/RequestifyTF2/Api/User.cs
@@ -5,14 +5,15 @@
     [Flags]
     public enum Tag
     {
-        Undefined = 1,
-        Spectator = 2,
-        Team = 4,
-        Dead = 8
+        None = 0,
+        Spectator = 1 << 0,
+        Team = 1 << 1,
+        Dead = 1 << 2
     }
+
     public class User
     {
-        public Tag Tag = Tag.Undefined;
         public string Name = "";
+        public Tag Tag = Tag.None;
     }
 }


Eliminate private classes

Eliminate private classes

--- src/Cronofy/BatchRequestBuilder.cs
+++ src/Cronofy/BatchRequestBuilder.cs
@@ -40,7 +40,15 @@
         /// </returns>
         public BatchRequestBuilder UpsertEvent(string calendarId, IBuilder<UpsertEventRequest> eventBuilder)
         {
-            return this.WithEntry(new UpsertEventEntryBuilder(calendarId, eventBuilder));
+            Preconditions.NotEmpty("calendarId", calendarId);
+            Preconditions.NotNull("eventBuilder", eventBuilder);
+
+            return this.WithEntry(
+                new BatchRequest.EntryBuilder()
+                    .Method("POST")
+                    .RelativeUrlFormat("/v1/calendars/{0}/events", calendarId)
+                    .Data(eventBuilder)
+                );
         }

         /// <summary>
@@ -65,7 +73,7 @@
         {
             Preconditions.NotNull("eventRequest", eventRequest);

-            return this.WithEntry(new UpsertEventEntryBuilder(calendarId, Builder.Wrap(eventRequest)));
+            return this.UpsertEvent(calendarId, Builder.Wrap(eventRequest));
         }

         /// <summary>
@@ -81,55 +89,12 @@
         /// <returns></returns>
         public BatchRequestBuilder DeleteEvent(string calendarId, string eventId)
         {
-            return this.WithEntry(new DeleteEventEntryBuilder(calendarId, eventId));
-        }
-
-        private class UpsertEventEntryBuilder : IBuilder<BatchRequest.Entry>
-        {
-            private readonly string calendarId;
-            private readonly IBuilder<UpsertEventRequest> eventBuilder;
-
-            public UpsertEventEntryBuilder(string calendarId, IBuilder<UpsertEventRequest> eventBuilder)
-            {
-                Preconditions.NotEmpty("calendarId", calendarId);
-                Preconditions.NotNull("eventBuilder", eventBuilder);
-
-                this.calendarId = calendarId;
-                this.eventBuilder = eventBuilder;
-            }
-
-            public BatchRequest.Entry Build()
-            {
-                return new BatchRequest.EntryBuilder()
-                    .Method("POST")
-                    .RelativeUrlFormat("/v1/calendars/{0}/events", this.calendarId)
-                    .Data(this.eventBuilder)
-                    .Build();
-            }
-        }
-
-        private class DeleteEventEntryBuilder : IBuilder<BatchRequest.Entry>
-        {
-            private readonly string calendarId;
-            private readonly string eventId;
-
-            public DeleteEventEntryBuilder(string calendarId, string eventId)
-            {
-                Preconditions.NotEmpty("calendarId", calendarId);
-                Preconditions.NotEmpty("eventId", eventId);
-
-                this.calendarId = calendarId;
-                this.eventId = eventId;
-            }
-
-            public BatchRequest.Entry Build()
-            {
-                return new BatchRequest.EntryBuilder()
+            return this.WithEntry(
+                new BatchRequest.EntryBuilder()
                     .Method("DELETE")
-                    .RelativeUrlFormat("/v1/calendars/{0}/events", this.calendarId)
-                    .Data(new { event_id = this.eventId })
-                    .Build();
-            }
+                    .RelativeUrlFormat("/v1/calendars/{0}/events", calendarId)
+                    .Data(new { event_id = eventId })
+                );
         }

         /// <inheritdoc />


Make JSON SQL builders public

Make JSON SQL builders public

--- src/Dommel.Json/IJsonSqlBuilder.cs
+++ src/Dommel.Json/IJsonSqlBuilder.cs
@@ -1,7 +1,7 @@
 namespace Dommel.Json
 {
     /// <summary>
-    /// Extends the <see cref="DommelMapper.ISqlBuilder"/> with support for
+    /// Extends the <see cref="DommelMapper.ISqlBuilder"/> with support for
     /// creating JSON value expressions.
     /// </summary>
     public interface IJsonSqlBuilder : DommelMapper.ISqlBuilder
@@ -15,28 +15,48 @@
         string JsonValue(string column, string path);
     }

-    internal class SqlServerSqlBuilder : DommelMapper.SqlServerSqlBuilder, IJsonSqlBuilder
+    /// <summary>
+    /// JSON SQL builder for SQL server.
+    /// </summary>
+    public class SqlServerSqlBuilder : DommelMapper.SqlServerSqlBuilder, IJsonSqlBuilder
     {
+        /// <inheritdoc />
         public string JsonValue(string column, string path) => $"JSON_VALUE({column}, '$.{path}')";
     }

-    internal class MySqlSqlBuilder : DommelMapper.MySqlSqlBuilder, IJsonSqlBuilder
+    /// <summary>
+    /// JSON SQL builder for MySQL.
+    /// </summary>
+    public class MySqlSqlBuilder : DommelMapper.MySqlSqlBuilder, IJsonSqlBuilder
     {
+        /// <inheritdoc />
         public string JsonValue(string column, string path) => $"{column}->'$.{path}'";
     }

-    internal class PostgresSqlBuiler : DommelMapper.PostgresSqlBuilder, IJsonSqlBuilder
+    /// <summary>
+    /// JSON SQL builder for PostgreSQL.
+    /// </summary>
+    public class PostgresSqlBuiler : DommelMapper.PostgresSqlBuilder, IJsonSqlBuilder
     {
+        /// <inheritdoc />
         public string JsonValue(string column, string path) => $"{column}->>'{path}'";
     }

-    internal class SqliteSqlBuilder : DommelMapper.SqliteSqlBuilder, IJsonSqlBuilder
+    /// <summary>
+    /// JSON SQL builder for SQLite.
+    /// </summary>
+    public class SqliteSqlBuilder : DommelMapper.SqliteSqlBuilder, IJsonSqlBuilder
     {
+        /// <inheritdoc />
         public string JsonValue(string column, string path) => $"JSON_EXTRACT({column}, '$.{path}')";
     }

-    internal class SqlServerCeSqlBuilder : DommelMapper.SqlServerCeSqlBuilder, IJsonSqlBuilder
+    /// <summary>
+    /// JSON SQL builder for SQL Server CE.
+    /// </summary>
+    public class SqlServerCeSqlBuilder : DommelMapper.SqlServerCeSqlBuilder, IJsonSqlBuilder
     {
+        /// <inheritdoc />
         public string JsonValue(string column, string path) => $"JSON_VALUE({column}, '$.{path}')";
     }
 }


Removes redundant string.Format call in ModelModel.ValidateSharedDomains method.

--- src/Dyna.Core/Models/ModelModel.cs
+++ src/Dyna.Core/Models/ModelModel.cs
@@ -221,7 +221,7 @@
             {
                 if (variable.Domain == null)
                 {
-                    this.errors.Add(string.Format("Missing domain"));
+                    this.errors.Add("Missing domain");
                     return false;
                 }


Comment / update BlockRef.Set

Comment / update BlockRef.Set

Now uses Option<T>.TryGet

--- src/EntitySystem/World/BlockRef.cs
+++ src/EntitySystem/World/BlockRef.cs
@@ -49,22 +49,33 @@
 					.Or(() => Chunk.Get<ChunkBlockStorage<T>>()
 						.Map((storage) => storage.Get(ChunkRelPos)));

-		public Option<T> Set<T>(Option<T> value) where T : IComponent
+		public Option<T> Set<T>(Option<T> valueOption) where T : IComponent
 		{
 			if (typeof(T) == typeof(Block)) throw new InvalidOperationException(
 				$"{ nameof(Block) } cannot be modified");
-			var handler = Chunks.Storage.Get<T>();
-			return (handler.HasValue
-				? (value.HasValue
-					? handler.Value
+
+			T value;
+			var hasValue = valueOption.TryGet(out value);
+
+			ChunkManager.StorageHandler<T> handler;
+			return ((Chunks.Storage.Get<T>().TryGet(out handler))
+				// If a storage handler was registered for this component type,
+				// the value will be stored in a chunk's block storage component.
+				? ((hasValue && !EqualityComparer<T>.Default.Equals(default(T), value))
+					// Block storage stores unset values as defaults, hence the additional check.
+					// If the value is being set (and not default), create a new chunk and block storage if needed.
+					? handler
 						.GetOrAdd(Chunks.GetOrCreateChunkEntity(Position))
 						.Set(ChunkRelPos, value)
+					// If the value is being unset, remove (internally, set to default)
+					// the component, if the chunk and block storage component exist.
 					: Chunks.GetChunkEntity(Position)
-						.Map((chunk) => handler.Value.Get(chunk))
+						.Map((chunk) => handler.Get(chunk))
 						.Map((storage) => storage.Remove(ChunkRelPos)))
-				: (value.HasValue
-					? Entities[GetOrCreateEntity()].Set(value)
-					: Entity.Map((block) => Entities[block].Set(value))));
+				// No storage handler means components are stored on a block entity.
+				: (hasValue
+					? Entities[GetOrCreateEntity()].Set(valueOption)
+					: Entity.Map((block) => Entities[block].Remove<T>())));
 		}


Delete ICoder.cs

Delete ICoder.cs

Deleting an unreferenced file.

--- magicsim/magicsim/ICoder.cs
+++ magicsim/magicsim/ICoder.cs
@@ -1,157 +0,0 @@
-// ICoder.h
-
-using System;
-
-namespace SevenZip
-{
-	/// <summary>
-	/// The exception that is thrown when an error in input stream occurs during decoding.
-	/// </summary>
-	class DataErrorException : ApplicationException
-	{
-		public DataErrorException(): base("Data Error") { }
-	}
-
-	/// <summary>
-	/// The exception that is thrown when the value of an argument is outside the allowable range.
-	/// </summary>
-	class InvalidParamException : ApplicationException
-	{
-		public InvalidParamException(): base("Invalid Parameter") { }
-	}
-
-	public interface ICodeProgress
-	{
-		/// <summary>
-		/// Callback progress.
-		/// </summary>
-		/// <param name="inSize">
-		/// input size. -1 if unknown.
-		/// </param>
-		/// <param name="outSize">
-		/// output size. -1 if unknown.
-		/// </param>
-		void SetProgress(Int64 inSize, Int64 outSize);
-	};
-
-	public interface ICoder
-	{
-		/// <summary>
-		/// Codes streams.
-		/// </summary>
-		/// <param name="inStream">
-		/// input Stream.
-		/// </param>
-		/// <param name="outStream">
-		/// output Stream.
-		/// </param>
-		/// <param name="inSize">
-		/// input Size. -1 if unknown.
-		/// </param>
-		/// <param name="outSize">
-		/// output Size. -1 if unknown.
-		/// </param>
-		/// <param name="progress">
-		/// callback progress reference.
-		/// </param>
-		/// <exception cref="SevenZip.DataErrorException">
-		/// if input stream is not valid
-		/// </exception>
-		void Code(System.IO.Stream inStream, System.IO.Stream outStream,
-			Int64 inSize, Int64 outSize, ICodeProgress progress);
-	};
-
-	/*
-	public interface ICoder2
-	{
-		 void Code(ISequentialInStream []inStreams,
-				const UInt64 []inSizes,
-				ISequentialOutStream []outStreams,
-				UInt64 []outSizes,
-				ICodeProgress progress);
-	};
-  */
-
-	/// <summary>
-	/// Provides the fields that represent properties idenitifiers for compressing.
-	/// </summary>
-	public enum CoderPropID
-	{
-		/// <summary>
-		/// Specifies default property.
-		/// </summary>
-		DefaultProp = 0,
-		/// <summary>
-		/// Specifies size of dictionary.
-		/// </summary>
-		DictionarySize,
-		/// <summary>
-		/// Specifies size of memory for PPM*.
-		/// </summary>
-		UsedMemorySize,
-		/// <summary>
-		/// Specifies order for PPM methods.
-		/// </summary>
-		Order,
-		/// <summary>
-		/// Specifies Block Size.
-		/// </summary>
-		BlockSize,
-		/// <summary>
-		/// Specifies number of postion state bits for LZMA (0 <= x <= 4).
-		/// </summary>
-		PosStateBits,
-		/// <summary>
-		/// Specifies number of literal context bits for LZMA (0 <= x <= 8).
-		/// </summary>
-		LitContextBits,
-		/// <summary>
-		/// Specifies number of literal position bits for LZMA (0 <= x <= 4).
-		/// </summary>
-		LitPosBits,
-		/// <summary>
-		/// Specifies number of fast bytes for LZ*.
-		/// </summary>
-		NumFastBytes,
-		/// <summary>
-		/// Specifies match finder. LZMA: "BT2", "BT4" or "BT4B".
-		/// </summary>
-		MatchFinder,
-		/// <summary>
-		/// Specifies the number of match finder cyckes.
-		/// </summary>
-		MatchFinderCycles,
-		/// <summary>
-		/// Specifies number of passes.
-		/// </summary>
-		NumPasses,
-		/// <summary>
-		/// Specifies number of algorithm.
-		/// </summary>
-		Algorithm,
-		/// <summary>
-		/// Specifies the number of threads.
-		/// </summary>
-		NumThreads,
-		/// <summary>
-		/// Specifies mode with end marker.
-		/// </summary>
-		EndMarker
-	};
-
-
-	public interface ISetCoderProperties
-	{
-		void SetCoderProperties(CoderPropID[] propIDs, object[] properties);
-	};
-
-	public interface IWriteCoderProperties
-	{
-		void WriteCoderProperties(System.IO.Stream outStream);
-	}
-
-	public interface ISetDecoderProperties
-	{
-		void SetDecoderProperties(byte[] properties);
-	}
-}


Make HtmlFormatter methods virtual

Make HtmlFormatter methods virtual

--- src/HtmlSanitizer/HtmlFormatter.cs
+++ src/HtmlSanitizer/HtmlFormatter.cs
@@ -24,7 +24,7 @@
         // disable XML comments warnings
         #pragma warning disable 1591

-        public string Attribute(IAttr attr)
+        public virtual string Attribute(IAttr attr)
         {
             var namespaceUri = attr.NamespaceUri;
             var localName = attr.LocalName;
@@ -75,22 +75,22 @@
             return name != NamespaceNames.XmlNsPrefix ? (NamespaceNames.XmlNsPrefix + ":") : name;
         }

-        public string CloseTag(IElement element, bool selfClosing)
+        public virtual string CloseTag(IElement element, bool selfClosing)
         {
             return HtmlMarkupFormatter.Instance.CloseTag(element, selfClosing);
         }

-        public string Comment(IComment comment)
+        public virtual string Comment(IComment comment)
         {
             return HtmlMarkupFormatter.Instance.Comment(comment);
         }

-        public string Doctype(IDocumentType doctype)
+        public virtual string Doctype(IDocumentType doctype)
         {
             return HtmlMarkupFormatter.Instance.Doctype(doctype);
         }

-        public string OpenTag(IElement element, bool selfClosing)
+        public virtual string OpenTag(IElement element, bool selfClosing)
         {
             var temp = new StringBuilder();

@@ -113,12 +113,12 @@
             return temp.ToString();
         }

-        public string Processing(IProcessingInstruction processing)
+        public virtual string Processing(IProcessingInstruction processing)
         {
             return HtmlMarkupFormatter.Instance.Processing(processing);
         }

-        public string Text(string text)
+        public virtual string Text(string text)
         {
             return HtmlMarkupFormatter.Instance.Text(text);
         }


Add using()s around internal usage of IHtmlDocument

--- src/HtmlSanitizer/HtmlSanitizer.cs
+++ src/HtmlSanitizer/HtmlSanitizer.cs
@@ -432,11 +432,12 @@
         /// <returns>The sanitized HTML body fragment.</returns>
         public string Sanitize(string html, string baseUrl = "", IMarkupFormatter outputFormatter = null)
         {
-            var dom = SanitizeDom(html, baseUrl);
-            var output = dom.Body.ChildNodes.ToHtml(outputFormatter ?? OutputFormatter);
-            return output;
-        }
-
+            using (var dom = SanitizeDom(html, baseUrl))
+            {
+                var output = dom.Body.ChildNodes.ToHtml(outputFormatter ?? OutputFormatter);
+                return output;
+            }
+        }

         /// <summary>
         /// Sanitizes the specified HTML body fragment. If a document is given, only the body part will be returned.
@@ -465,13 +466,15 @@
         public string SanitizeDocument(string html, string baseUrl = "", IMarkupFormatter outputFormatter = null)
         {
             var parser = HtmlParserFactory();
-            var dom = parser.Parse(html);
-
-            DoSanitize(dom, dom.DocumentElement, baseUrl);
-
-            var output = dom.ToHtml(outputFormatter ?? OutputFormatter);
-
-            return output;
+
+            using (var dom = parser.Parse(html))
+            {
+                DoSanitize(dom, dom.DocumentElement, baseUrl);
+
+                var output = dom.ToHtml(outputFormatter ?? OutputFormatter);
+
+                return output;
+            }
         }

         /// <summary>


Removed BufferSegment (#10982)

Removed BufferSegment (#10982)

- This was leftover from the old StreamPipeReader impl

--- src/Http/Http/src/BufferSegment.cs
+++ src/Http/Http/src/BufferSegment.cs
@@ -1,135 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Buffers;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-
-namespace System.IO.Pipelines
-{
-    internal sealed class BufferSegment : ReadOnlySequenceSegment<byte>
-    {
-        private object _memoryOwner;
-        private BufferSegment _next;
-        private int _end;
-
-        /// <summary>
-        /// The End represents the offset into AvailableMemory where the range of "active" bytes ends. At the point when the block is leased
-        /// the End is guaranteed to be equal to Start. The value of Start may be assigned anywhere between 0 and
-        /// Buffer.Length, and must be equal to or less than End.
-        /// </summary>
-        public int End
-        {
-            get => _end;
-            set
-            {
-                Debug.Assert(value <= AvailableMemory.Length);
-
-                _end = value;
-                Memory = AvailableMemory.Slice(0, _end);
-            }
-        }
-
-        /// <summary>
-        /// Reference to the next block of data when the overall "active" bytes spans multiple blocks. At the point when the block is
-        /// leased Next is guaranteed to be null. Start, End, and Next are used together in order to create a linked-list of discontiguous
-        /// working memory. The "active" memory is grown when bytes are copied in, End is increased, and Next is assigned. The "active"
-        /// memory is shrunk when bytes are consumed, Start is increased, and blocks are returned to the pool.
-        /// </summary>
-        public BufferSegment NextSegment
-        {
-            get => _next;
-            set
-            {
-                _next = value;
-                Next = value;
-            }
-        }
-
-        public void SetMemory(object memoryOwner)
-        {
-            if (memoryOwner is IMemoryOwner<byte> owner)
-            {
-                SetMemory(owner);
-            }
-            else if (memoryOwner is byte[] array)
-            {
-                SetMemory(array);
-            }
-            else
-            {
-                Debug.Fail("Unexpected memoryOwner");
-            }
-        }
-
-        public void SetMemory(IMemoryOwner<byte> memoryOwner)
-        {
-            _memoryOwner = memoryOwner;
-
-            SetUnownedMemory(memoryOwner.Memory);
-        }
-
-        public void SetMemory(byte[] arrayPoolBuffer)
-        {
-            _memoryOwner = arrayPoolBuffer;
-
-            SetUnownedMemory(arrayPoolBuffer);
-        }
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public void SetUnownedMemory(Memory<byte> memory)
-        {
-            AvailableMemory = memory;
-            RunningIndex = 0;
-            End = 0;
-            NextSegment = null;
-        }
-
-        public void ResetMemory()
-        {
-            if (_memoryOwner is IMemoryOwner<byte> owner)
-            {
-                owner.Dispose();
-            }
-            else if (_memoryOwner is byte[] array)
-            {
-                ArrayPool<byte>.Shared.Return(array);
-            }
-
-            _memoryOwner = null;
-            AvailableMemory = default;
-        }
-
-        // Exposed for testing
-        internal object MemoryOwner => _memoryOwner;
-
-        public Memory<byte> AvailableMemory { get; private set; }
-
-        public int Length => End;
-
-        /// <summary>
-        /// The amount of writable bytes in this segment. It is the amount of bytes between Length and End
-        /// </summary>
-        public int WritableBytes
-        {
-            [MethodImpl(MethodImplOptions.AggressiveInlining)]
-            get => AvailableMemory.Length - End;
-        }
-
-        public void SetNext(BufferSegment segment)
-        {
-            Debug.Assert(segment != null);
-            Debug.Assert(Next == null);
-
-            NextSegment = segment;
-
-            segment = this;
-
-            while (segment.Next != null)
-            {
-                segment.NextSegment.RunningIndex = segment.RunningIndex + segment.Length;
-                segment = segment.NextSegment;
-            }
-        }
-    }
-}


Add missing namespaced methods to Html.Document. And ImportNode.

--- src/Libraries/Web/Html/Document.cs
+++ src/Libraries/Web/Html/Document.cs
@@ -148,18 +148,53 @@
         public static void AttachEvent(string eventName, ElementEventHandler handler) {
         }

+        /// <summary>
+        /// Creates an Attr of the given name. Note that the Attr instance can then be set on an
+        /// Element using the setAttributeNode method. To create an attribute with a qualified name
+        /// and namespace URI, use the CreateAttributeNS method.
+        /// </summary>
+        /// <param name="name">The name of the attribute.</param>
+        /// <returns>A new Attr object with the nodeName attribute set to name, and localName, prefix,
+        /// and namespaceURI set to null. The value of the attribute is the empty string.</returns>
         public static ElementAttribute CreateAttribute(string name) {
             return null;
         }

+        /// <summary>
+        /// Creates an attribute of the given qualified name and namespace URI.
+        /// </summary>
+        /// <param name="namespaceURI">The namespace URI of the attribute to create.</param>
+        /// <param name="qualifiedName">The qualified name of the attribute to instantiate.</param>
+        /// <returns>A new Attr object with the given namespace and qualified name.</returns>
+        public static ElementAttribute CreateAttributeNS(string namespaceURI, string qualifiedName) {
+            return null;
+        }
+
         public static DocumentFragment CreateDocumentFragment() {
             return null;
         }

+        /// <summary>
+        /// Creates an element of the type specified.
+        /// To create an element with a qualified name and namespace URI, use the CreateElementNS method.
+        /// </summary>
+        /// <param name="tagName">The name of the element type to instantiate.</param>
+        /// <returns>A new Element object with the nodeName attribute set to tagName, and localName,
+        /// prefix, and namespaceURI set to null.</returns>
         public static Element CreateElement(string tagName) {
             return null;
         }

+        /// <summary>
+        /// Creates an element of the given qualified name and namespace URI.
+        /// </summary>
+        /// <param name="namespaceURI">The namespace URI of the element to create.</param>
+        /// <param name="qualifiedName">The qualified name of the element type to instantiate.</param>
+        /// <returns>A new Element object with the given namespace and qualified name.</returns>
+        public static Element CreateElementNS(string namespaceURI, string qualifiedName) {
+            return null;
+        }
+
         public static MutableEvent CreateEvent(string eventType) {
             return null;
         }
@@ -168,6 +203,10 @@
             return null;
         }

+        public static Element ImportNode(Element imporedNode, bool deep) {
+            return null;
+        }
+
         public static void DetachEvent(string eventName, ElementEventHandler handler) {
         }

@@ -203,6 +242,16 @@
         }

         public static ElementCollection GetElementsByTagName(string tagName) {
+            return null;
+        }
+
+        /// <summary>
+        /// Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree.
+        /// </summary>
+        /// <param name="namespaceURI">The namespace URI of the elements to match on. The special value "*" matches all namespaces.</param>
+        /// <param name="localName">The local name of the elements to match on. The special value "*" matches all local names.</param>
+        /// <returns>A new NodeList object containing all the matched Elements.</returns>
+        public static ElementCollection GetElementsByTagNameNS(string namespaceURI, string localName) {
             return null;
         }


Dont raise the FinishedReading message on upgrade connections until OnBytesRead this gives us an opportunity to grab the body data for the upgrade protocol.

--- src/Manos/Manos.Http/HttpEntity.cs
+++ src/Manos/Manos.Http/HttpEntity.cs
@@ -200,6 +200,9 @@
 			if (o == null && properties == null)
 				return;

+			if (properties == null)
+				properties = new Dictionary<string,object> ();
+
 			if (o == null) {
 				properties.Remove (name);
 				if (properties.Count == 0)
@@ -262,7 +265,9 @@

 		private int OnMessageComplete (HttpParser parser)
 		{
-			OnFinishedReading (parser);
+			// Upgrade connections will raise this event at the end of OnBytesRead
+			if (!parser.Upgrade)
+				OnFinishedReading (parser);
 			return 0;
 		}

@@ -395,6 +400,25 @@
 				Console.WriteLine ("Exception while parsing");
 				Console.WriteLine (e);
 			}
+
+			if (parser.Upgrade) {
+
+				//
+				// Well, this is a bit of a hack.  Ideally, maybe there should be a putback list
+				// on the socket so we can put these bytes back into the stream and the upgrade
+				// protocol handler can read them out as if they were just reading normally.
+				//
+
+				if (bytes.Position < bytes.Length) {
+					byte [] upgrade_head = new byte [bytes.Length - bytes.Position];
+					Array.Copy (bytes.Bytes, bytes.Position, upgrade_head, 0, upgrade_head.Length);
+
+					SetProperty ("UPGRADE_HEAD", upgrade_head);
+				}
+
+				// This is delayed until here with upgrade connnections.
+				OnFinishedReading (parser);
+			}
 		}

 		protected virtual void OnFinishedReading (HttpParser parser)


Pull in http minor fix from upstream http_parser.java

--- src/Manos/Manos.Http/HttpParser.cs
+++ src/Manos/Manos.Http/HttpParser.cs
@@ -308,7 +308,7 @@
 					/* major HTTP version or dot */
 				case State.res_http_major:
 					if (DOT == ch) {
-						state = State.res_http_minor;
+						state = State.res_first_http_minor;
 						break;
 					}
 					if (!isDigit (ch))


XmlLayout - Removed unnecessary double conversion to string (#3692)

--- src/NLog/Layouts/XmlElementBase.cs
+++ src/NLog/Layouts/XmlElementBase.cs
@@ -430,7 +430,7 @@
             if (objTypeCode != TypeCode.Object)
             {
                 string xmlValueString = XmlHelper.XmlConvertToString(convertibleValue, objTypeCode, true);
-                AppendXmlPropertyValue(propName, xmlValueString, sb, orgLength, false, ignorePropertiesElementName);
+                AppendXmlPropertyStringValue(propName, xmlValueString, sb, orgLength, false, ignorePropertiesElementName);
             }
             else
             {


Add disconnect stuff to chatclient

Add disconnect stuff to chatclient

--- src/NTwitch.Chat/API/ChatClient.cs
+++ src/NTwitch.Chat/API/ChatClient.cs
@@ -37,6 +37,12 @@
             _port = port;
         }

+        public async Task SendAsync(string message)
+        {
+            await _log.DebugAsync("Chat", message);
+            await _writer.WriteLineAsync(message);
+        }
+
         internal async Task ConnectAsync()
         {
             _client = new TcpClient();
@@ -66,10 +72,20 @@
             await SendAsync("CAP REQ :twitch.tv/tags");
         }

-        public async Task SendAsync(string message)
+        public async Task DisconnectAsync(bool disposing = false)
         {
-            await _log.DebugAsync("Chat", message);
-            await _writer.WriteLineAsync(message);
+            try { _cancelTokenSource.Cancel(false); } catch { }
+
+            if (!disposing)
+                await (_task ?? Task.Delay(0)).ConfigureAwait(false);
+
+            if (_client != null && _client.Connected)
+            {
+                _cancelTokenSource.Cancel(false);
+
+                try { _client.Dispose(); } catch { }
+                _client = null;
+            }
         }

         public async Task StartAsync(CancellationTokenSource cancelTokenSource)
@@ -95,24 +111,13 @@
                 await _messageReceivedEvent.InvokeAsync(msg);
             }
         }
-
-        public Task StopAsync(CancellationTokenSource cancelTokenSource)
-        {
-            throw new NotImplementedException();
-        }
-
+
         protected virtual void Dispose(bool disposing)
         {
             if (!_disposed)
             {
                 if (disposing)
-                {
-                    _client.Dispose();
-                    _client = null;
-                }
-
-                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
-                // TODO: set large fields to null.
+                    DisconnectAsync(true).GetAwaiter().GetResult();

                 _disposed = true;
             }


Fixed a bug in hgit cmd

Fixed a bug in hgit cmd

--- src/NadekoBot/Modules/Help/Help.cs
+++ src/NadekoBot/Modules/Help/Help.cs
@@ -117,7 +117,7 @@
         {
             var helpstr = new StringBuilder();
             helpstr.AppendLine($"## {GetText("table_of_contents")}");
-            helpstr.AppendLine(string.Join("\n", _cmds.Modules.Where(m => string.Equals(m.GetTopLevelModule().Name, "help", StringComparison.OrdinalIgnoreCase))
+            helpstr.AppendLine(string.Join("\n", _cmds.Modules.Where(m => !string.Equals(m.GetTopLevelModule().Name, "help", StringComparison.OrdinalIgnoreCase))
                 .Select(m => m.GetTopLevelModule().Name)
                 .Distinct()
                 .OrderBy(m => m)


update ScriptDiedException

update ScriptDiedException

--- src/Peachpie.Runtime/Exceptions.cs
+++ src/Peachpie.Runtime/Exceptions.cs
@@ -39,7 +39,7 @@
     /// <summary>
     /// Thrown by exit/die language constructs to cause immediate termination of a script being executed.
     /// </summary>
-    [DebuggerDisplay("died(reason={_status,nq})")]
+    [DebuggerDisplay("died(reason={Status,nq})")]
     public sealed class ScriptDiedException : PhpErrorException
     {
         /// <summary>


Added some doc to UI button presses

Added some doc to UI button presses

--- src/Rs317.Library.Client/Client.cs
+++ src/Rs317.Library.Client/Client.cs
@@ -2565,6 +2565,7 @@
 					flag8 = promptUserForInput(rsInterface);
 				if(flag8)
 				{
+					//2458 means logout button was pressed.
 					stream.putOpcode(185);
 					stream.putShort(actionInformation1);
 				}


MediaPlayer fires PropertyChanged event using SynchronizationContext

--- src/Shared/Playback/MediaPlayer.cs
+++ src/Shared/Playback/MediaPlayer.cs
@@ -2,6 +2,7 @@
 using System;
 using System.ComponentModel;
 using System.IO;
+using System.Runtime.CompilerServices;
 using System.Threading;

 namespace ManagedBass
@@ -11,7 +12,7 @@
     /// <para><see cref="MediaPlayer"/> is perfect for UIs, as it implements <see cref="INotifyPropertyChanged"/>.</para>
     /// <para>Also, unlike normal, Properties/Effects/DSP set on a <see cref="MediaPlayer"/> persist through subsequent loads.</para>
     /// </summary>
-    public class MediaPlayer : INPC, IDisposable
+    public class MediaPlayer : INotifyPropertyChanged, IDisposable
     {
         #region Fields
         readonly SynchronizationContext _syncContext;
@@ -384,5 +385,25 @@
         }

         void OnStateChanged() => OnPropertyChanged(nameof(State));
+
+        /// <summary>
+        /// Fired when a property value changes.
+        /// </summary>
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        /// <summary>
+        /// Fires the <see cref="PropertyChanged"/> event.
+        /// </summary>
+        protected virtual void OnPropertyChanged([CallerMemberName] string PropertyName = null)
+        {
+            if (PropertyChanged == null)
+                return;
+
+            Action f = () => PropertyChanged.Invoke(this, new PropertyChangedEventArgs(PropertyName));
+
+            if (_syncContext == null)
+                f();
+            else _syncContext.Post(S => f(), null);
+        }
     }
 }


Don't use folder nodes in explorer tree

Don't use folder nodes in explorer tree

--- src/SqlNotebook/ExplorerControl.cs
+++ src/SqlNotebook/ExplorerControl.cs
@@ -1,6 +1,6 @@
 using System;
-using System.Collections.Generic;
-using System.Diagnostics;
+using System.Collections;
+using System.ComponentModel;
 using System.Drawing;
 using System.Linq;
 using System.Windows.Forms;
@@ -19,16 +19,11 @@
     private const int ICON_TABLE = 2;
     private const int ICON_VIEW = 3;
     private const int ICON_LINKED_TABLE = 4;
-    private const int ICON_FOLDER = 5;
-    private const int ICON_KEY = 6;
-    private const int ICON_COLUMN = 7;
+    private const int ICON_KEY = 5;
+    private const int ICON_COLUMN = 6;

     public event EventHandler NewPageButtonClicked;
     public event EventHandler NewScriptButtonClicked;
-
-    private readonly TreeNode _pagesNode;
-    private readonly TreeNode _scriptsNode;
-    private readonly TreeNode _tablesNode;

     public ExplorerControl(NotebookManager manager, IWin32Window mainForm) {
         InitializeComponent();
@@ -56,8 +51,6 @@
         imageList.Images.Add(Ui.GetScaledIcon(this, Resources.filter, Resources.filter32, dispose: false));
         // ICON_LINKED_TABLE
         imageList.Images.Add(Ui.GetScaledIcon(this, Resources.link, Resources.link32, dispose: false));
-        // ICON_FOLDER
-        imageList.Images.Add(Ui.GetScaledIcon(this, Resources.Folder, Resources.folder32, dispose: false));
         // ICON_KEY
         imageList.Images.Add(Ui.GetScaledIcon(this, Resources.key, Resources.key32, dispose: false));
         // ICON_COLUMN
@@ -69,28 +62,18 @@
             Dock = DockStyle.Fill,
             FullRowSelect = true,
             LabelEdit = true,
-            ShowRootLines = false,
+            ShowRootLines = true,
         };
+        _tree.ImageList = imageList;
+        _tree.TreeViewNodeSorter = new ExplorerNodeComparer();
         _tree.AfterLabelEdit += Tree_AfterLabelEdit;
-        _tree.BeforeCollapse += Tree_BeforeCollapse;
         _tree.BeforeExpand += Tree_BeforeExpand;
         _tree.BeforeLabelEdit += Tree_BeforeLabelEdit;
         _tree.KeyDown += Tree_KeyDown;
         _tree.NodeMouseClick += Tree_NodeMouseClick;
         _tree.NodeMouseDoubleClick += Tree_NodeMouseDoubleClick;
-        _tree.ImageList = imageList;
         _tree.EnableDoubleBuffering();
         _toolStripContainer.ContentPanel.Controls.Add(_tree);
-
-        _pagesNode = _tree.Nodes.Add("Pages");
-        _pagesNode.ImageIndex = ICON_FOLDER;
-        _pagesNode.SelectedImageIndex = ICON_FOLDER;
-        _scriptsNode = _tree.Nodes.Add("Scripts");
-        _scriptsNode.ImageIndex = ICON_FOLDER;
-        _scriptsNode.SelectedImageIndex = ICON_FOLDER;
-        _tablesNode = _tree.Nodes.Add("Tables");
-        _tablesNode.ImageIndex = ICON_FOLDER;
-        _tablesNode.SelectedImageIndex = ICON_FOLDER;

         Ui ui = new(this, false);
         Padding buttonPadding = new(this.Scaled(2));
@@ -107,50 +90,52 @@
         };
     }

+    private sealed class ExplorerNodeComparer : IComparer {
+        public int Compare(object x, object y) {
+            var xNode = (TreeNode)x;
+            var yNode = (TreeNode)y;
+            if (xNode.Parent is null && yNode.Parent is null) {
+                var xType = (NotebookItemType)xNode.Tag;
+                var yType = (NotebookItemType)yNode.Tag;
+                var result = GetOrder(xType).CompareTo(GetOrder(yType));
+                if (result != 0) {
+                    return result;
+                }
+            }
+            return xNode.Name.CompareTo(yNode.Name);
+        }
+
+        private static int GetOrder(NotebookItemType t) =>
+            t switch {
+                NotebookItemType.Page => 0,
+                NotebookItemType.Script => 1,
+                NotebookItemType.Table => 2,
+                NotebookItemType.View => 2,
+                _ => throw new NotImplementedException()
+            };
+    }
+
     public void TakeFocus() {
         _tree.Select();
     }
-
-    private TreeNode GetRootNode(NotebookItemType type) =>
-        type switch {
-            NotebookItemType.Page => _pagesNode,
-            NotebookItemType.Table => _tablesNode,
-            NotebookItemType.Script => _scriptsNode,
-            NotebookItemType.View => _tablesNode,
-            _ => throw new ArgumentOutOfRangeException(nameof(type))
-        };
-
-    private NotebookItemType GetItemTypeForRootNode(TreeNode root) =>
-        ReferenceEquals(root, _pagesNode) ? NotebookItemType.Page :
-        ReferenceEquals(root, _tablesNode) ? NotebookItemType.Table :
-        ReferenceEquals(root, _scriptsNode) ? NotebookItemType.Script :
-        throw new ArgumentOutOfRangeException(nameof(root));

     private void HandleNotebookChange(NotebookChangeEventArgs e) {
         if (e.RemovedItems.Any() || e.AddedItems.Any()) {
             BeginInvoke(new Action(() => {
                 _tree.BeginUpdate();
                 try {
-                    HashSet<NotebookItemType> addedItemTypes = new();
                     foreach (var item in e.RemovedItems) {
-                        var root = GetRootNode(item.Type);
-                        foreach (TreeNode child in root.Nodes) {
-                            if (child.Text == item.Name) {
-                                child.Remove();
+                        foreach (TreeNode node in _tree.Nodes) {
+                            if (node.Text == item.Name && (NotebookItemType)node.Tag == item.Type) {
+                                node.Remove();
                                 break;
                             }
                         }
                     }
                     foreach (var item in e.AddedItems) {
-                        addedItemTypes.Add(item.Type);
-                        var root = GetRootNode(item.Type);
-                        int index;
-                        for (index = 0; index < root.Nodes.Count; index++) {
-                            if (item.Name.CompareTo(root.Nodes[index].Name) < 0) {
-                                break;
-                            }
-                        }
-                        var child = root.Nodes.Insert(index, item.Name);
+                        TreeNode child = new(item.Name);
+                        child.Tag = item.Type;
+                        _tree.Nodes.Add(child);
                         if (item.IsVirtualTable) {
                             child.ImageIndex = ICON_LINKED_TABLE;
                         } else {
@@ -176,15 +161,6 @@
                 } finally {
                     _tree.EndUpdate();
                 }
-
-                _pagesNode.Expand();
-                _scriptsNode.Expand();
-                _tablesNode.Expand();
-
-                // Work around an issue where the root nodes suddenly collapse, and the above calls to Expand don't
-                // take effect until the user clicks on the tree.
-                _tree.Visible = false;
-                _tree.Visible = true;
             }));
         }
     }
@@ -194,12 +170,12 @@
     }

     private void DoDelete() {
-        if (_tree.SelectedNode == null || _tree.SelectedNode.Parent == null) {
+        if (_tree.SelectedNode == null || _tree.SelectedNode.Parent != null) {
             return;
         }
         var node = _tree.SelectedNode;
         var name = node.Text;
-        var type = GetItemTypeForRootNode(node.Parent);
+        var type = (NotebookItemType)node.Tag;

         var choice = Ui.ShowTaskDialog(
             _mainForm,
@@ -223,8 +199,8 @@
         _manager.Rescan(notebookItemsOnly: !isTableOrView);
     }

-    private void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
-        var isSelection = _tree.SelectedNode != null && _tree.SelectedNode.Parent != null;
+    private void ContextMenuStrip_Opening(object sender, CancelEventArgs e) {
+        var isSelection = _tree.SelectedNode != null && _tree.SelectedNode.Parent == null;
         _openMnu.Enabled = _deleteMnu.Enabled = _renameMnu.Enabled = isSelection;
     }

@@ -246,22 +222,15 @@
     }

     private void Tree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {
-        // Workaround: the double-click has already expanded or collapsed the node. Undo that.
-        if (_lastCollapseStopwatch.Elapsed < TimeSpan.FromMilliseconds(50)) {
-            e.Node.Expand();
-        } else if (_lastExpandStopwatch.Elapsed < TimeSpan.FromMilliseconds(50)) {
-            e.Node.Collapse();
-        }
-
         DoOpen(e.Node);
     }

     private void DoOpen(TreeNode node) {
         node ??= _tree.SelectedNode;
-        if (node == null || node.Parent == null) {
+        if (node == null || node.Parent != null) {
             return;
         }
-        var type = GetItemTypeForRootNode(node.Parent);
+        var type = (NotebookItemType)node.Tag;
         _manager.OpenItem(new NotebookItem(type, node.Text));
     }

@@ -280,8 +249,8 @@
     private void Tree_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) {
         e.CancelEdit = true; // if this is a successful edit, we will update the label ourselves
         var node = e.Node;
-        var type = GetItemTypeForRootNode(node.Parent);
-
+        var type = (NotebookItemType)node.Tag;
+
         if (e.Label == null) {
             return; // user did not change the name
         }
@@ -294,8 +263,8 @@
     }

     private void Tree_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e) {
-        // Don't allow renaming the root nodes.
-        if (e.Node.Parent == null) {
+        // Don't allow renaming the child nodes.
+        if (e.Node.Parent != null) {
             e.CancelEdit = true;
         }
     }
@@ -341,17 +310,10 @@
         }
     }

-    private readonly Stopwatch _lastExpandStopwatch = new();
-    private readonly Stopwatch _lastCollapseStopwatch = new();
-
     private void Tree_BeforeExpand(object sender, TreeViewCancelEventArgs e) {
-        _lastExpandStopwatch.Restart();
-
-        if (e.Node.Parent == null) {
-            return;
-        }
-
-        switch (GetItemTypeForRootNode(e.Node.Parent)) {
+        var type = (NotebookItemType)e.Node.Tag;
+
+        switch (type) {
             case NotebookItemType.Script:
                 PopulateScriptParameters(e.Node);
                 break;
@@ -361,16 +323,6 @@
                 PopulateTableColumns(e.Node);
                 break;
         }
-    }
-
-    private void Tree_BeforeCollapse(object sender, TreeViewCancelEventArgs e) {
-        // Cannot collapse the root nodes.
-        if (e.Node.Parent == null) {
-            e.Cancel = true;
-            return;
-        }
-
-        _lastCollapseStopwatch.Restart();
     }

     // Don't expand or collapse tree nodes on double-click. It interferes with double-click to open.


Add support for `PaymentMethodAutomaticallyUpdated` on `Event`

--- src/Stripe.net/Constants/Events.cs
+++ src/Stripe.net/Constants/Events.cs
@@ -315,9 +315,7 @@
         /// </summary>
         public const string InvoicePaymentFailed = "invoice.payment_failed";

-        /// <summary>
-        /// Occurs whenever an invoice payment attempt succeeds.
-        /// </summary>
+        [Obsolete("Use InvoicePaid instead.")]
         public const string InvoicePaymentSucceeded = "invoice.payment_succeeded";

         /// <summary>
@@ -500,8 +498,11 @@
         public const string PaymentMethodAttached = "payment_method.attached";

         /// <summary>
-        /// Occurs whenever a card payment method's details are automatically updated by CAU.
-        /// </summary>
+        /// Occurs whenever a payment method's details are automatically updated by the network.
+        /// </summary>
+        public const string PaymentMethodAutomaticallyUpdated = "payment_method.automatically_updated";
+
+        [Obsolete("Use PaymentMethodAutomaticallyUpdated instead.")]
         public const string PaymentMethodCardAutomaticallyUpdated = "payment_method.card_automatically_updated";

         /// <summary>


 Fix tooltip font color when an item grants damage resistance against multiple enemy types (#321)

Fix #265

--- src/TQVaultAE.Data/ItemProvider.cs
+++ src/TQVaultAE.Data/ItemProvider.cs
@@ -2273,6 +2273,12 @@
 							string s = $"{ItemStyle.Legendary.TQColor().ColorTag()}{d.Variable}";
 							line = string.Concat(line, s);
 						}
+						else
+						{
+							// There are multiple lines to the attribute so the color tag needs to be added.
+							string s = $"{ItemStyle.Epic.TQColor().ColorTag()}";
+							line = string.Concat(s, line);
+						}

 						if (isGlobal)
 							line = string.Concat(globalIndent, line);


Cluster bomb the cache for reserialize

Cluster bomb the cache for reserialize

Suppose you have a TpSync config.
You access an item via TpSync. Now it's in the item cache as its TpSync self.
Then you reserialize. Sitecore gives you the TpSync version from cache, essentially rewriting itself to disk.

By nuking all caches before reserializing we drop any TpSync items from cache.

Then we kill it again after because now the cache may have DATABASE items in it.

Whee!

--- src/Unicorn/SerializationHelper.cs
+++ src/Unicorn/SerializationHelper.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Threading;
 using Rainbow.Model;
+using Sitecore.Caching;
 using Sitecore.Configuration;
 using Sitecore.Pipelines;
 using Sitecore.SecurityModel;
@@ -79,7 +80,16 @@
 				var predicate = configuration.Resolve<IPredicate>();
 				var serializationStore = configuration.Resolve<ITargetDataStore>();

-				return DumpItemInternal(item, predicate, serializationStore).IsIncluded;
+				CacheManager.ClearAllCaches(); // BOOM! This clears all caches before we begin;
+											   // because for a TpSync configuration we could have TpSync items in the data cache which 'taint' the reserialize
+											   // from being purely database
+
+				var result = DumpItemInternal(item, predicate, serializationStore).IsIncluded;
+
+				CacheManager.ClearAllCaches(); // BOOM! And we clear everything again at the end, because now
+											   // for a TpSync configuration we might have DATABASE items in cache where we want TpSync.
+
+				return result;
 			}
 		}

@@ -121,6 +131,10 @@

 		protected virtual void DumpTreeInternal(IItemData root, IPredicate predicate, ITargetDataStore serializationStore, ISourceDataStore sourceDataStore, ILogger logger)
 		{
+			CacheManager.ClearAllCaches(); // BOOM! This clears all caches before we begin;
+										   // because for a TpSync configuration we could have TpSync items in the data cache which 'taint' the reserialize
+										   // from being purely database
+
 			// we throw items into this queue, and let a thread pool pick up anything available to process in parallel. only the children of queued items are processed, not the item itself
 			ConcurrentQueue<IItemData> processQueue = new ConcurrentQueue<IItemData>();

@@ -197,6 +211,9 @@
 			// ...and then wait for all the threads to finish
 			foreach (var thread in pool) thread.Join();

+			CacheManager.ClearAllCaches(); // BOOM! And we clear everything again at the end, because now
+										   // for a TpSync configuration we might have DATABASE items in cache where we want TpSync.
+
 			if (errors.Count > 0) throw new AggregateException(errors);
 		}


Added some missing events, a few updates

--- Source/DMAnomalyScanner.cs
+++ Source/DMAnomalyScanner.cs
@@ -91,6 +91,9 @@
                 cam = this.part.transform.FindChild("model").FindChild("anom scanner v4").FindChild("base").FindChild("camBaseArm0").FindChild("camBaseArm1").FindChild("camBaseArm2").FindChild("camBase");
                 GameEvents.onVesselSOIChanged.Add(ScanOnSOIChange);
                 pqsBuild();
+                Events["reviewPage"].active = anomalyData.Count > 0;
+                Events["resetExperiment"].active = anomalyData.Count > 0;
+                Events["resetExperimentEVA"].active = anomalyData.Count > 0;
                 if (IsDeployed)
                 {
                     deployDish(1f, 0f);
@@ -581,6 +584,42 @@
             ScienceData data = makeNewScience();
             anomalyData.Add(data);
             ReviewData();
+            Events["reviewPage"].active = anomalyData.Count > 0;
+            Events["resetExperiment"].active = anomalyData.Count > 0;
+            Events["resetExperimentEVA"].active = anomalyData.Count > 0;
+        }
+
+        [KSPEvent(guiActive = true, guiName = "Review Anomalous Data", active = false)]
+        public void reviewPage()
+        {
+            ReviewData();
+        }
+
+        [KSPAction("Review Anomalous Data")]
+        public void reviewPageItem(KSPActionParam param)
+        {
+            ReviewData();
+        }
+
+        [KSPEvent(guiActive = true, guiName = "Discard Anomalous Data", active = false)]
+        public void resetExperiment()
+        {
+            anomalyData.Clear();
+            Events["reviewPage"].active = anomalyData.Count > 0;
+            Events["resetExperiment"].active = anomalyData.Count > 0;
+            Events["resetExperimentEVA"].active = anomalyData.Count > 0;
+        }
+
+        [KSPAction("Discard Anomalous Data")]
+        public void resetExperimentAction(KSPActionParam param)
+        {
+            resetExperiment();
+        }
+
+        [KSPEvent(guiActiveUnfocused = true, externalToEVAOnly = true, guiName = "Discard Anomalous Data", active = false)]
+        public void resetExperimentEVA()
+        {
+            resetExperiment();
         }

         #endregion
@@ -668,10 +707,7 @@
                     {
                         if (!tran.IsBusy())         //Check for non-busy transmitters to use.
                         {
-                            List<ScienceData> tranData = new List<ScienceData>();
-                            tranData.Add(data);
-                            tran.TransmitData(tranData);
-                            anomalyData.Remove(data);
+                            transmission(data, tran);
                             break;
                         }
                         else
@@ -679,15 +715,25 @@
                             tranBusy = true;
                         }
                     }
-                }
-                if (tranBusy)               //If all transmitters are busy add data to queue for first transmitter.
-                {
-                    List<ScienceData> tranData = new List<ScienceData>();
-                    tranData.Add(data);
-                    tranList.First().TransmitData(tranData);
-                    anomalyData.Remove(data);
+                }
+                if (tranBusy)           //If all transmitters are busy assign data to the queue of a random transmitter
+                {
+                    System.Random randomTran = new System.Random();
+                    int i = randomTran.Next(0, tranList.Count);
+                    transmission(data, tranList[i]);
                 }
             }
+        }
+
+        public void transmission(ScienceData data, IScienceDataTransmitter tran)
+        {
+            List<ScienceData> tranData = new List<ScienceData>();
+            tranData.Add(data);
+            tran.TransmitData(tranData);
+            anomalyData.Remove(data);
+            Events["reviewPage"].active = anomalyData.Count > 0;
+            Events["resetExperiment"].active = anomalyData.Count > 0;
+            Events["resetExperimentEVA"].active = anomalyData.Count > 0;
         }

         private void onSendToLab(ScienceData data)


add Ranking button and Ranking mode

add Ranking button and Ranking mode

--- Assets/Scripts/FlappyScript.cs
+++ Assets/Scripts/FlappyScript.cs
@@ -1,5 +1,7 @@
 using UnityEngine;
 using System.Collections;
+using Assets.Scripts.CloudBread;
+using UnityEngine.UI;

 /// <summary>
 /// Spritesheet for Flappy Bird found here: http://www.spriters-resource.com/mobile_phone/flappybird/sheet/59537/
@@ -10,11 +12,12 @@
     public AudioClip FlyAudioClip, DeathAudioClip, ScoredAudioClip;
     public Sprite GetReadySprite;
     public float RotateUpSpeed = 1, RotateDownSpeed = 1;
-    public GameObject IntroGUI, DeathGUI;
+    public GameObject IntroGUI, DeathGUI, RaingBoardGUI;
     public Collider2D restartButtonGameCollider;
     public Collider2D rankingButtonGameCollider;
     public float VelocityPerJump = 3;
     public float XSpeed = 1;
+    public Text RankingBoardText;

     // Use this for initialization
     void Start()
@@ -75,8 +78,37 @@
                 GameStateManager.GameState = GameState.Intro;
                 Application.LoadLevel(Application.loadedLevelName);
             }
-        }
-
+            else if(rankingButtonGameCollider == Physics2D.OverlapPoint(Camera.main.ScreenToWorldPoint(contactPoint))){
+                GameStateManager.GameState = GameState.Ranking;
+                RaingBoardGUI.SetActive(true);
+
+                CloudBread cb = new CloudBread();
+                cb.CBTopRanker(Callback_CBTopRanker);
+            }
+        }
+        else if(GameStateManager.GameState == GameState.Ranking)
+        {
+            Vector2 contactPoint = Vector2.zero;
+
+            if (Input.touchCount > 0)
+                contactPoint = Input.touches[0].position;
+            if (Input.GetMouseButtonDown(0))
+                contactPoint = Input.mousePosition;
+
+            //check if user wants to restart the game
+            if (restartButtonGameCollider == Physics2D.OverlapPoint
+                (Camera.main.ScreenToWorldPoint(contactPoint)))
+            {
+                GameStateManager.GameState = GameState.Intro;
+                Application.LoadLevel(Application.loadedLevelName);
+            }
+        }
+
+    }
+
+    public void Callback_CBTopRanker(string str, WWW www)
+    {
+        RankingBoardText.text = www.text;
     }


Removed duplicate poses in dance sequences and transitions

--- Assets/Scripts/GenerateMove.cs
+++ Assets/Scripts/GenerateMove.cs
@@ -13,6 +13,7 @@

 	int numPose = 3; float x; float y = (float)(1.9);
 	Pose currentPose;
+    int lastIndex = -1;

     void Start() {
         accessPose = GetComponent<Launch> ();
@@ -25,7 +26,14 @@
 	public void Generate() {
 		poseList.Clear ();
     	for(int i = 0; i < numPose ; i++) {
-			poseList.Add(poses[Random.Range(0, poses.Count)]);
+            int nextIndex;
+            do
+            {
+                nextIndex = Random.Range(0, poses.Count);
+            } while (nextIndex == lastIndex);
+
+			poseList.Add(poses[nextIndex]);
+            lastIndex = nextIndex;
 			if (listOfPoseGameObject.Count > 0) {
 				Destroy (listOfPoseGameObject [i]);
 			}


Add algorithm to prevent inaccessible paths

--- Assets/Scripts/MapGenerator.cs
+++ Assets/Scripts/MapGenerator.cs
@@ -7,8 +7,11 @@
   public Vector2 mapSize;
   [Range(0, 1)]
   public float outLinePercent;
+  [Range(0, 1)]
+  public float obstaclePercent;
   List<Coordinate> tileCoordinates;
   Queue<Coordinate> shuffledTileCoordinates;
+  Coordinate mapCenter;
   public int seed = 10;

   public struct Coordinate {
@@ -18,6 +21,14 @@
     public Coordinate(int xCoordinate, int yCoordinate) {
       x = xCoordinate;
       y = yCoordinate;
+    }
+
+    public static bool operator ==(Coordinate c1, Coordinate  c2) {
+      return c1.x == c2.x && c1.y == c2.y;
+    }
+
+    public static bool operator !=(Coordinate c1, Coordinate  c2) {
+      return c1.x != c2.x || c1.y != c2.y;
     }
   }

@@ -35,7 +46,9 @@
       }
     }

+    mapCenter = new Coordinate((int)mapSize.x / 2, (int)mapSize.y / 2);
     shuffledTileCoordinates = new Queue<Coordinate>(Utility.Shuffle(tileCoordinates.ToArray(), seed));
+
     // First, immediately destroy the container object if it already exists.
     if (transform.FindChild(containerName)) {
       DestroyImmediate(transform.FindChild(containerName).gameObject);
@@ -45,6 +58,7 @@
     Transform containerObject = new GameObject(containerName).transform;
     containerObject.parent = transform;

+    // Generate the tiles
     for (int x = 0; x < mapSize.x; x++) {
       for (int y = 0; y < mapSize.y; y++) {
         Vector3 tilePosition = CoordinateToPosition(x, y);
@@ -55,14 +69,62 @@
       }
     }

-    const int obstacleCount = 10;
-
+    bool[,] obstacleMap = new bool[(int)mapSize.x, (int)mapSize.y];
+    int obstacleCount = (int)(mapSize.x * mapSize.y * obstaclePercent);
+    int currentObstacleCount = 0;
+    // Generate the obstalces
     for (int i = 0; i < obstacleCount; i++) {
       Coordinate coordinate = GetRandomCoordinate();
+      obstacleMap[coordinate.x, coordinate.y] = true;
+      currentObstacleCount += 1;
+
+      if (coordinate == mapCenter || !IsMapCompletelyAccessible(obstacleMap, i)) {
+        currentObstacleCount -= 1;
+        obstacleMap[coordinate.x, coordinate.y] = false;
+        continue;
+      }
+
       Vector3 obstaclePosition = CoordinateToPosition(coordinate.x, coordinate.y);
       Transform obstacle = Instantiate(obstaclePrefab, obstaclePosition + Vector3.up * 0.5f, Quaternion.identity);
       obstacle.parent = containerObject;
     }
+  }
+
+  // This is an implementation of the Flood-fill 4 algorithm.
+  bool IsMapCompletelyAccessible(bool[,] obstacleMap, int obstacleCount) {
+    bool[,] mapFlags = new bool[obstacleMap.GetLength(0), obstacleMap.GetLength(1)];
+    Queue<Coordinate> queue = new Queue<Coordinate>();
+
+    queue.Enqueue(mapCenter);
+    mapFlags[mapCenter.x, mapCenter.y] = true;
+    int accessibleTileCount = 0;
+
+    while (queue.Count > 0) {
+      Coordinate tile = queue.Dequeue();
+
+      for (int x = -1; x < 2; x++) {
+        for (int y = -1; y < 2; y++) {
+          int neighborX = tile.x + x;
+          int neighborY = tile.y + y;
+
+          if (x == 0 || y == 0) {
+            if (neighborX >= 0 && neighborX < obstacleMap.GetLength(0) &&
+                neighborY >= 0 && neighborY < obstacleMap.GetLength(1)) {
+
+              if (!mapFlags[neighborX, neighborY] && !obstacleMap[neighborX, neighborY]) {
+                mapFlags[neighborX, neighborY] = true;
+                queue.Enqueue(new Coordinate(neighborX, neighborY));
+                accessibleTileCount += 1;
+              }
+            }
+          }
+        }
+      }
+    }
+
+    int expectedAccessibleTileCount = (int)(mapSize.x * mapSize.y - obstacleCount);
+
+    return expectedAccessibleTileCount == accessibleTileCount;
   }

   Vector3 CoordinateToPosition(int x, int y) {


Dont show bad tile

Dont show bad tile

--- Assets/Source/LandGenerator.cs
+++ Assets/Source/LandGenerator.cs
@@ -4,6 +4,7 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.IO;
+using System;

 public class LandGenerator : MonoBehaviour {

@@ -179,8 +180,6 @@
 				STile t = STile.FromBytes(www.bytes);
 				t.ToInstance(pos);
 				names.Add(index, t.GetName());
-				Destroy(loader);
-
 			}
 			catch (EndOfStreamException e)
 			{
@@ -190,6 +189,14 @@
 			{
 				Debug.Log("Invalid" + index + e.ToString());
 			}
+            		catch (Exception e)
+            		{
+                		Debug.Log("Exception found in " + index + e.ToString());
+            		}
+            		finally
+            		{
+                		Destroy(loader);
+            		}
 		}
 	}
 }


Minor refactoring

Minor refactoring

--- AsyncCollections/AsyncQueue.cs
+++ AsyncCollections/AsyncQueue.cs
@@ -277,14 +277,16 @@
 			/// <param name="tailReference">Either <see cref="AsyncQueue{T}._itemTail"/> or <see cref="AsyncQueue{T}._awaiterTail"/>, whichever we're working on right now.</param>
 			private void HandleLastSlotCapture( int slot, bool wonSlot, ref Segment tailReference )
 			{
-				if ( IsLastSlot( slot ) )
-				{
-					Segment nextSegment = wonSlot ? GrowSegment() : SpinUntilNextSegmentIsReady();
-					Volatile.Write( ref tailReference, nextSegment );
-
-					if ( !wonSlot )
-						Volatile.Write( ref _queue._head, nextSegment );
-				}
+				if ( !IsLastSlot( slot ) )
+					return;
+
+				Segment nextSegment = wonSlot ? GrowSegment() : SpinUntilNextSegmentIsReady();
+				Volatile.Write( ref tailReference, nextSegment );
+
+				if ( wonSlot )
+					return;
+
+				Volatile.Write( ref _queue._head, nextSegment );
 			}

 			private static bool IsLastSlot( int slot ) => slot == SegmentSize - 1;


[SharpDX.MathUtil]Two simple gauss methods.

--- Source/SharpDX/MathUtil.cs
+++ Source/SharpDX/MathUtil.cs
@@ -320,6 +320,60 @@

             return (float)(value - (rangeSize * Math.Floor(value / rangeSize)) + min);
         }
+
+        /// <summary>
+        /// Gauss function.
+        /// </summary>
+        /// <param name="amplitude">Curve amplitude.</param>
+        /// <param name="x">Position X.</param>
+        /// <param name="y">Position Y</param>
+        /// <param name="radX">Radius X.</param>
+        /// <param name="radY">Radius Y.</param>
+        /// <param name="sigmaX">Curve sigma X.</param>
+        /// <param name="sigmaY">Curve sigma Y.</param>
+        /// <returns>The result of gaussian function.</returns>
+        public static float Gauss(float amplitude,float x,float y,float radX,float radY,float sigmaX,float sigmaY)
+        {
+            float AExp = (amplitude*2.718281828f);
+
+            return (float)
+            (
+                AExp -
+                (
+                    Math.Pow(x - radX / 2, 2) / (2 * (float)Math.Pow(sigmaX, 2))
+                    +
+                    Math.Pow(y - radY / 2, 2) / (2 * (float)Math.Pow(sigmaY, 2))
+                )
+            );
+        }
+
+        /// <summary>
+        /// Gauss function.
+        /// </summary>
+        /// <param name="amplitude">Curve amplitude.</param>
+        /// <param name="x">Position X.</param>
+        /// <param name="y">Position Y</param>
+        /// <param name="radX">Radius X.</param>
+        /// <param name="radY">Radius Y.</param>
+        /// <param name="sigmaX">Curve sigma X.</param>
+        /// <param name="sigmaY">Curve sigma Y.</param>
+        /// <returns>The result of gaussian function.</returns>
+        public static double Gauss(double amplitude, double x, double y, double radX, double radY, double sigmaX, double sigmaY)
+        {
+            double AExp = (amplitude * 2.718281828);
+
+            return
+            (
+                AExp -
+                (
+                    Math.Pow(x - radX / 2, 2) / (2 * Math.Pow(sigmaX, 2))
+                    +
+                    Math.Pow(y - radY / 2, 2) / (2 * Math.Pow(sigmaY, 2))
+                )
+            );
+        }
+
+
 #if NET35Plus
         /// <summary>
         /// Extension - Get random <c>float</c> number within range.


(GH-62) Fix order of task execution

(GH-62) Fix order of task execution

Don't attempt to read issues until everything has been completed.

--- Cake.Recipe/Content/build.cake
+++ Cake.Recipe/Content/build.cake
@@ -470,8 +470,8 @@

 BuildParameters.Tasks.ContinuousIntegrationTask = Task("ContinuousIntegration")
     // Run issues task from Cake.Issues.Recipe by default.
+    .IsDependentOn("Upload-Artifacts")
     .IsDependentOn("Issues")
-    .IsDependentOn("Upload-Artifacts")
     .IsDependentOn("Publish-PreRelease-Packages")
     .IsDependentOn("Publish-Release-Packages")
     .IsDependentOn("Publish-GitHub-Release")


Fixed #13

Fixed #13

--- SublimeOverlay/MainForm.cs
+++ SublimeOverlay/MainForm.cs
@@ -32,12 +32,9 @@
             Region = RoundRegion(Width, Height, radius);
             settingsWindow = new Settings(this);
             this.GotFocus += MainForm_GotFocus;
-        }
-
-        void MainForm_ChildMinimized()
-        {
-            throw new NotImplementedException();
-        }
+            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
+        }
+
         private bool isWindowActive(IntPtr hWnd)
         {
             return NativeMethods.GetForegroundWindow() == hWnd;


Setting Discord IDs now auto filters some artifacts

--- TGServiceInterface/Chat.cs
+++ TGServiceInterface/Chat.cs
@@ -330,6 +330,7 @@
 		}
 		protected override string SanitizeChannelName(string working)
 		{
+			working = working.Replace("<", "").Replace(">", "").Replace("&", "");	//filter out some stuff that can come in the copypasta
 			try
 			{
 				Convert.ToUInt64(working);


improve consistency with regard to delimiter

--- CmcLibNet.Export/DataReader.cs
+++ CmcLibNet.Export/DataReader.cs
@@ -322,7 +322,7 @@
                     string[] buffer;
                     if (cd.IsConnection)
                     {
-                        if (string.IsNullOrEmpty(rawdata[i][j].Trim()))
+                        if (string.IsNullOrEmpty(rawdata[i][j].Trim())) // should we trim?
                         {
                             cv = new CommenceValue(cd); // always create a CommenceValue for consistency
                         }
@@ -330,71 +330,54 @@
                         {
                             if (!settings.SplitConnectedItems)
                             {
-                                buffer = new string[] { rawdata[i][j] };
-                            }
-                            // We assume here that connected values are newline separated,
-                            // depending on the type of cursor, they may not be!
-                            // They will be if the cursor:
-                            // - is of type View
-                            // - has connected fields set using the SetRelatedColumn method
-                            //
-                            // they will be comma-separated when they were requested as direct fields on a Category-type cursor
-                            // in that case, there is no meaningful way of splitting them,
-                            // because there is no way to distinguish between commas in the field and separator
-                            // That is just one of the quirks of Commence.
-                            // If a user just dumps a cursor obtained by GetCursor(<category>, <flag All>),
-                            // he will get weird results.
-                            // We include a check for this
-                            else if (cursor.CursorType == CmcCursorType.Category && !cursor._relatedColumnsWereSet)
-                            {
-                                // there *is* a situation when we do want to split on commas:
-                                // when the cursor contains thids in the requested related column.
-                                // It would actually be very useful in the special case of 'complex' exports.
-                                // We *could* isolate that particular situation,
-                                // and then split anyway, but then the (rest of the) row of CommenceValue
-                                // would contain inconsistent arrays for field ConnectedFieldValues.
-                                // So we are not going to do that.
-                                buffer = new string[] { rawdata[i][j] };
+                                buffer = new string[] { rawdata[i][j] }; // just return as-is
+                                cv = new CommenceValue(buffer, cd);
                             }
                             else
                             {
-                                switch (cd.CommenceFieldDefinition.Type)
+                                if (cd.Delimiter == "\n")
                                 {
-                                    case CommenceFieldType.Text:
-                                    case CommenceFieldType.URL:
-                                        // any non-Name text field in Commence will accept a \n
-                                        // we use a regex to split values at "\n" *but not* "\r\n"
-                                        // this is not 100% fail-safe as a fieldvalue *can* contain just \n if it is a large text field.
-                                        // in that case, your only option is to suppress the splitting in ExportSettings
-                                        // what we *should* do is change every instance of a single \n to '\r\n' first
-                                        // that would be safer, but we cannot distinguish between them.
-                                        buffer = regex.Split(rawdata[i][j]); // this may result in Commence values being split if they contain embedded delimiters
-                                        break;
-                                    default:
-                                        buffer = rawdata[i][j].Split(new string[] { cd.Delimiter }, StringSplitOptions.None);
-                                        break;
-                                } // switch
-
+                                    switch (cd.CommenceFieldDefinition.Type)
+                                    {
+                                        case CommenceFieldType.Text:
+                                        case CommenceFieldType.URL:
+                                            // any non-Name text field in Commence will accept a \n
+                                            // we use a regex to split values at "\n" *but not* "\r\n"
+                                            // this is not 100% fail-safe as a fieldvalue *can* contain just \n if it is a large text field.
+                                            // in that case, your only option is to suppress the splitting in ExportSettings
+                                            // what we *should* do is change every instance of a single \n to '\r\n' first
+                                            // that would be safer, but we cannot distinguish between them.
+                                            buffer = regex.Split(rawdata[i][j]); // this may result in Commence values being split if they contain embedded delimiters
+                                            break;
+                                        default:
+                                            buffer = rawdata[i][j].Split(new string[] { cd.Delimiter }, StringSplitOptions.None);
+                                            break;
+                                    } // switch
+                                }
+                                else
+                                {
+                                    buffer = rawdata[i][j].Split(new string[] { cd.Delimiter }, StringSplitOptions.None);
+                                }
                                 // buffer now contains the connected values as array, do any formatting transformation
-                                buffer = FormatValues(buffer, cd);
+                                buffer = FormatValues(buffer, cd);
+                                cv = new CommenceValue(buffer, cd);
                             }
-                            cv = new CommenceValue(buffer, cd);
-                        } // if !String.IsNullOrEmpty
+                        }
                     } // if IsConnection
-                    else // single value
+                    else //a direct value
                     {
                         buffer = new string[] { rawdata[i][j] };
                         buffer = FormatValues(buffer, cd);
                         cv = new CommenceValue(buffer[0], cd);
-                    } // else IsConnection
-                    if (cv != null) { rowdata.Add(cv); }
+                    }
+                    rowdata.Add(cv);
                 } // for j
                 retval.Add(rowdata);
             } // for i
             return retval;
         }

-   private string[] FormatValues(string[] values, ColumnDefinition cd)
+        private string[] FormatValues(string[] values, ColumnDefinition cd)
         {
             string[] retval = values;
             if (settings.Canonical)


added fields

added fields

--- Tests/StringFilterTests.cs
+++ Tests/StringFilterTests.cs
@@ -42,14 +42,7 @@

         #endregion

-        [Test]
-        public void StringFilter_DoesNotContain() {
-            string[] strings = { "bar", "foo", "foobar", "barfoo" };
-            string[] expected = { "bar" };
-            var result = new StringFilter(strings).DoesNotContain("foo");
-            Assert.IsTrue(result.SequenceEqual(expected));
-        }
-
+        #region Starts With

         [Test]
         public void StringFilter_StartsWith_OneArg() {
@@ -83,13 +76,9 @@
             Assert.IsTrue(result.SequenceEqual(expected));
         }

-        [Test]
-        public void StringFilter_DoesNotStartWith() {
-            string[] strings = { "bar", "foo", "foobar", "barfoo" };
-            string[] expected = { "bar", "barfoo" };
-            var result = new StringFilter(strings).DoesNotStartWith("foo");
-            Assert.IsTrue(result.SequenceEqual(expected));
-        }
+        #endregion
+
+        #region ByLength

         [Test]
         public void StringFilter_ByLength() {
@@ -110,5 +99,23 @@
             string[] strings = { "bar", "foo", "foobar", "barfoo" };
             Assert.Throws<ArgumentOutOfRangeException>(() => new StringFilter(strings).ByLength(-1));
         }
+
+        #endregion
+
+        [Test]
+        public void StringFilter_DoesNotStartWith() {
+            string[] strings = { "bar", "foo", "foobar", "barfoo" };
+            string[] expected = { "bar", "barfoo" };
+            var result = new StringFilter(strings).DoesNotStartWith("foo");
+            Assert.IsTrue(result.SequenceEqual(expected));
+        }
+
+        [Test]
+        public void StringFilter_DoesNotContain() {
+            string[] strings = { "bar", "foo", "foobar", "barfoo" };
+            string[] expected = { "bar" };
+            var result = new StringFilter(strings).DoesNotContain("foo");
+            Assert.IsTrue(result.SequenceEqual(expected));
+        }
     }
 }


Oops, revert bug which breaks paths, added in last commit

--- TypeGap/GapApiGenerator.cs
+++ TypeGap/GapApiGenerator.cs
@@ -303,9 +303,7 @@
                 url.Append(String.Join("&", finalGetParameters.Select(p => $"{p.ParameterName}=\" + encodeURIComponent({p.ParameterName} as any) + \"")));
             }

-            var tmp = "\"" + _rewriter(url.ToString().TrimStart('/'));
-            tmp = tmp.Substring(0, tmp.Length - 4);
-            return tmp;
+            return "\"" + _rewriter(url.ToString().TrimStart('/'));
         }
     }
 }


Implemented a read-only wrapper for WeightedList, and Priority getters and setters.

--- URandomGen/WeightedList.cs
+++ URandomGen/WeightedList.cs
@@ -31,6 +31,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Diagnostics;
 using System.Runtime.InteropServices;

@@ -249,6 +250,34 @@
         }

         /// <summary>
+        /// Gets the priority of the value at the specified index.
+        /// </summary>
+        /// <param name="index">The index of the value to get.</param>
+        /// <returns>The priority of the value at <paramref name="index"/>.</returns>
+        /// <exception cref="ArgumentOutOfRangeException">
+        /// <paramref name="index"/> is less than 0 or is greater than or equal to <see cref="Count"/>.
+        /// </exception>
+        public double GetPriorityAt(int index)
+        {
+            return this[index].Priority;
+        }
+
+        /// <summary>
+        /// Sets the priority of the value at the specified index.
+        /// </summary>
+        /// <param name="index">The index of the value to set.</param>
+        /// <param name="priority">The priority of the value to set.</param>
+        /// <exception cref="ArgumentOutOfRangeException">
+        /// <paramref name="index"/> is less than 0 or is greater than or equal to <see cref="Count"/>.
+        /// </exception>
+        public void SetPriorityAt(int index, double priority)
+        {
+            var node = this[index];
+            node.Priority = priority;
+            this[index] = node;
+        }
+
+        /// <summary>
         /// Determines if the specified node exists in the list.
         /// </summary>
         /// <param name="node">The node to search for in the list.</param>
@@ -272,7 +301,7 @@
         }

         /// <summary>
-        /// Determines if the specified node exists in the list.
+        /// Determines if the specified value exists in the list.
         /// </summary>
         /// <param name="value">The value to search for in the list.</param>
         /// <returns><see langword="true"/> if a node with the same value as <paramref name="value"/>
@@ -316,7 +345,7 @@
         }

         /// <summary>
-        /// Returns the index of the specified node.
+        /// Returns the index of the specified value.
         /// </summary>
         /// <param name="value">The value to search for in the list.</param>
         /// <returns>The index of the first occurrence of a node with the same value as <paramref name="value"/>
@@ -386,6 +415,15 @@
         public PriorityNode<T>[] ToArray()
         {
             return _list.ToArray();
+        }
+
+        /// <summary>
+        /// Returns a read-only wrapper for the current list.
+        /// </summary>
+        /// <returns>A read-only wrapper for the current list.</returns>
+        public ReadOnly AsReadOnly()
+        {
+            return new ReadOnly(this);
         }

         /// <summary>
@@ -527,6 +565,119 @@
             [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
             public PriorityNode<T>[] Items { get { return _list.ToArray(); } }
         }
+
+        /// <summary>
+        /// A read-only wrapper for a <see cref="WeightedList{T}"/>.
+        /// </summary>
+        public class ReadOnly : ReadOnlyCollection<PriorityNode<T>>
+        {
+            private readonly WeightedList<T> _list;
+            /// <summary>
+            /// Creates a new instance using the specified list.
+            /// </summary>
+            /// <param name="list">The list to wrap.</param>
+            /// <exception cref="ArgumentNullException">
+            /// <paramref name="list"/> is <see langword="null"/>.
+            /// </exception>
+            public ReadOnly(WeightedList<T> list)
+                : base(list)
+            {
+                _list = list;
+            }
+
+            /// <summary>
+            /// Gets the priority of the value at the specified index.
+            /// </summary>
+            /// <param name="index">The index of the value to get.</param>
+            /// <returns>The priority of the value at <paramref name="index"/>.</returns>
+            /// <exception cref="ArgumentOutOfRangeException">
+            /// <paramref name="index"/> is less than 0 or is greater than or equal to <see cref="Count"/>.
+            /// </exception>
+            public double GetPriorityAt(int index)
+            {
+                return _list._list[index].Priority;
+            }
+
+            /// <summary>
+            /// Determines if the specified value exists in the list with the specified priority.
+            /// </summary>
+            /// <param name="value">The value to search for in the list.</param>
+            /// <param name="priority">The priority of the node to search for in the list.</param>
+            /// <returns><see langword="true"/> if a node with the same value and priority as <paramref name="value"/> and <paramref name="priority"/>
+            /// was found; <see langword="false"/> otherwise.</returns>
+            public bool Contains(T value, double priority)
+            {
+                return _list.Contains(value, priority);
+            }
+
+            /// <summary>
+            /// Determines if the specified value exists in the list.
+            /// </summary>
+            /// <param name="value">The value to search for in the list.</param>
+            /// <returns><see langword="true"/> if a node with the same value as <paramref name="value"/>
+            /// was found; <see langword="false"/> otherwise.</returns>
+            public bool Contains(T value)
+            {
+                return _list.Contains(value);
+            }
+
+            /// <summary>
+            /// Returns the index of the specified node.
+            /// </summary>
+            /// <param name="value">The value to search for in the list.</param>
+            /// <param name="priority">The priority of the value to search for in the list.</param>
+            /// <returns>The index of the first occurrence of a node with the same value and weight as <paramref name="value"/> and <paramref name="priority"/>
+            /// within the list, if found; otherwise, -1.</returns>
+            public int IndexOf(T value, double priority)
+            {
+                return _list.IndexOf(value, priority);
+            }
+
+            /// <summary>
+            /// Returns the index of the specified value.
+            /// </summary>
+            /// <param name="value">The value to search for in the list.</param>
+            /// <returns>The index of the first occurrence of a node with the same value as <paramref name="value"/>
+            /// within the list, if found; otherwise, -1.</returns>
+            public int IndexOf(T value)
+            {
+                return _list.IndexOf(value);
+            }
+
+            /// <summary>
+            /// Returns a random index from the current instance. Elements with a higher <see cref="PriorityNode{T}.Priority"/> value
+            /// will have a higher probability; elements with a <see cref="PriorityNode{T}.Priority"/> less than or equal to 0 will be ignored.
+            /// </summary>
+            /// <param name="generator">The random number generator to use.</param>
+            /// <returns>The index of a random element in the current list.</returns>
+            /// <exception cref="ArgumentNullException">
+            /// <paramref name="generator"/> is <see langword="null"/>.
+            /// </exception>
+            /// <exception cref="InvalidOperationException">
+            /// The current list does not contain any elements with a <see cref="PriorityNode{T}.Priority"/> value greater than 0.
+            /// </exception>
+            public int GetRandomIndex(Random generator)
+            {
+                return _list.GetRandomIndex(generator);
+            }
+
+            /// <summary>
+            /// Returns a random value from the current instance. Elements with a higher <see cref="PriorityNode{T}.Priority"/> value
+            /// will have a higher probability; elements with a <see cref="PriorityNode{T}.Priority"/> less than or equal to 0 will be ignored.
+            /// </summary>
+            /// <param name="generator">The random number generator to use.</param>
+            /// <returns>A random value in the current list.</returns>
+            /// <exception cref="ArgumentNullException">
+            /// <paramref name="generator"/> is <see langword="null"/>.
+            /// </exception>
+            /// <exception cref="InvalidOperationException">
+            /// The current list does not contain any elements with a <see cref="PriorityNode{T}.Priority"/> value greater than 0.
+            /// </exception>
+            public T GetRandomValue(Random generator)
+            {
+                return _list.GetRandomValue(generator);
+            }
+        }
     }

     /// <summary>


Clone now defaults to -u

Clone now defaults to -u

--- Versionr/Commands/Clone.cs
+++ Versionr/Commands/Clone.cs
@@ -32,7 +32,7 @@
         [Option('f', "fullmeta", HelpText = "Clones entire vault metadata table.")]
         public bool? Full { get; set; }

-        [Option('u', "update", HelpText = "Runs pull and checkout after cloning.")]
+        [Option('u', "update", DefaultValue = true, HelpText = "Runs pull and checkout after cloning.")]
         public bool Update { get; set; }

         [Option('b', "branch", HelpText = "Selects a branch to pull and checkout after cloning, requires #b#--update##")]


make log property a string not an object

--- WebHook/WebHookFunction.cs
+++ WebHook/WebHookFunction.cs
@@ -61,7 +61,7 @@
                     CloneUrl = $"https://github.com/{hook.repository.full_name}",
                 });

-                logger.LogInformation("ProcessPush: Added OpenPrMessage for {Owner}/{RepoName}", hook.repository.owner, hook.repository.name);
+                logger.LogInformation("ProcessPush: Added OpenPrMessage for {Owner}/{RepoName}", hook.repository.owner.login, hook.repository.name);

                 return "imgbot push";
             }


Version bump for WebSearches

Version bump for WebSearches

--- WebSearches/WebSearches.cs
+++ WebSearches/WebSearches.cs
@@ -16,7 +16,7 @@
     }
     public string Version
     {
-        get { return "0.22"; }
+        get { return "0.30"; }
     }

     public Dictionary<string,string> Help


Fix for issue #49 - Implementation of PING/PONG unable to detect connection failures.

--- WebSocket4Net/WebSocket.cs
+++ WebSocket4Net/WebSocket.cs
@@ -388,21 +388,24 @@

         private void OnPingTimerCallback(object state)
         {
-            if (!string.IsNullOrEmpty(m_LastPingRequest) && !m_LastPingRequest.Equals(LastPongResponse))
-            {
+            var protocolProcessor = state as IProtocolProcessor;
+            if (!string.IsNullOrEmpty(m_LastPingRequest) && !m_LastPingRequest.Equals(LastPongResponse)) {
                 //have not got last response
-                return;
-            }
-
-            var protocolProcessor = state as IProtocolProcessor;
+                // Verify that the remote endpoint is still responsive
+                // by sending an un-solicited PONG frame:
+                try {
+                    protocolProcessor.SendPong(this, "");
+                } catch (Exception e) {
+                    OnError(e);
+                    return;
+                }
+            }
+
             m_LastPingRequest = DateTime.Now.ToString();

-            try
-            {
+            try {
                 protocolProcessor.SendPing(this, m_LastPingRequest);
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 OnError(e);
             }
         }


handled the case closing the client if the websocket haven't ever been opened

--- WebSocket4Net/WebSocket.cs
+++ WebSocket4Net/WebSocket.cs
@@ -239,6 +239,14 @@

         public override void Close()
         {
+            //The websocket never be opened
+            if (State == WebSocketState.None)
+            {
+                State = WebSocketState.Closed;
+                base.OnClosed();
+                return;
+            }
+
             Close(string.Empty);
         }


Fixed Maybe?

Fixed Maybe?

--- Website/Packaging/Nupkg.cs
+++ Website/Packaging/Nupkg.cs
@@ -92,7 +92,7 @@
                 }

                 Debug.Assert(part[0] == '/');
-                yield return part.Substring(1);
+                yield return part.Substring(1).Replace('/', Path.DirectorySeparatorChar);
             }
         }


CanTalk flag added

CanTalk flag added

--- Diplomata/DiplomataTalkable.cs
+++ Diplomata/DiplomataTalkable.cs
@@ -18,6 +18,7 @@
   {
     public string talkableName;
     protected Talkable _talkable;
+    public bool CanTalk = true;

     public Talkable talkable
     {
@@ -99,6 +100,9 @@
         Debug.LogWarning("This talk cannot start, because the player is already in one.");
         return;
       }
+
+      if (!CanTalk)
+        return;

       if (talkable != null)
       {


Stop sync on the TravelHistoryControl EDSMSync

EDDiscoveryForm._edsmSync is not used.  Remove it, and
stop the sync on travelHistoryControl1.sync instead.

--- EDDiscovery/EDDiscoveryForm.cs
+++ EDDiscovery/EDDiscoveryForm.cs
@@ -43,7 +43,6 @@
             return message.Result;
         }

-        private EDSMSync _edsmSync;
         public EDDTheme theme;

         public AutoCompleteStringCollection SystemNames;
@@ -99,7 +98,6 @@
                 Trace.WriteLine($"Unable to create the folder '{logpath}'");
                 Trace.WriteLine($"Exception: {ex.Message}");
             }
-            _edsmSync = new EDSMSync(this);

             ToolStripManager.Renderer = theme.toolstripRenderer;
             theme.LoadThemes();                                         // default themes and ones on disk loaded
@@ -785,7 +783,10 @@
         private void EDDiscoveryForm_FormClosing(object sender, FormClosingEventArgs e)
         {
             travelHistoryControl1.netlog.StopMonitor();
-            _edsmSync.StopSync();
+            if (travelHistoryControl1.sync != null)
+            {
+                travelHistoryControl1.sync.StopSync();
+            }
             SaveSettings();
         }


Oops - don't overwrite uncommitted System Notes!

--- EDDiscovery/EDDiscoveryForm.cs
+++ EDDiscovery/EDDiscoveryForm.cs
@@ -936,7 +936,10 @@
                 // Also notify various "quick" listeners
                 if (he.UpdateSystemNote(txt, send))
                 {
-                    _uncommittedNoteHistoryEntry = he;
+                    if (_uncommittedNoteHistoryEntry == null)
+                    {
+                        _uncommittedNoteHistoryEntry = he;
+                    }
                     travelHistoryControl1.UpdateNoteJID(he.Journalid, txt);
                     PopOuts.UpdateNoteJID(he.Journalid, txt);
                     // MKW TODO: Update the Note editor SPanel.


Fixed a crash in the UTF8 string parser

Fixed a crash in the UTF8 string parser

git-svn-id: c32cf1ecefca26b8770d7b0740bc0c5c174087e4@865 c754d5e9-d413-0410-bcdf-9574c9dba6b7

--- libsecondlife-cs/Helpers.cs
+++ libsecondlife-cs/Helpers.cs
@@ -194,7 +194,7 @@
         /// <returns>A UTF8 string</returns>
         public static string FieldToUTF8String(byte[] bytes)
         {
-            if (bytes[bytes.Length - 1] == 0x00)
+            if (bytes.Length > 0 && bytes[bytes.Length - 1] == 0x00)
                 return UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1);
             else
                 return UTF8Encoding.UTF8.GetString(bytes);


[CleanUp] Removed unused enum

[CleanUp] Removed unused enum

--- src/XrmFramework/Utils/SdkEnums.cs
+++ src/XrmFramework/Utils/SdkEnums.cs
@@ -146,13 +146,6 @@
         DateOnly = 1,
         TimeZoneIndependent = 2
     }
-
-    public enum PluginRegistrationType
-    {
-        Plugin,
-        Workflow,
-        CustomApi
-    }

     public enum RegistrationState
     {


Fix web request and modify exception handling code.

--- FSActiveFires/MODISHotspots.cs
+++ FSActiveFires/MODISHotspots.cs
@@ -52,10 +52,11 @@

         public void LoadData(string datasetFormatString) {
             try {
+                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                 LoadShapefileHotspots(DownloadShapefileData(datasetFormatString));
             }
-            catch (Exception ex) {
-                log.Warning(string.Format("Unable to download or load SHP; attempting to use CSV.\r\nType: {0}\r\nMessage: {1}\r\nStack trace:\r\n{2}", ex.GetType(), ex.Message, ex.StackTrace));
+            catch (System.Data.OleDb.OleDbException ex) {
+                log.Warning(string.Format("Unable to parse shapefile; attempting to use CSV.\r\n{0}", ex.ToString()));
                 LoadCsvHotspots(DownloadCsvData(datasetFormatString));
             }
         }


write-debug-mesh utility (don't I have this somewhere else?)

--- util/DebugUtil.cs
+++ util/DebugUtil.cs
@@ -250,6 +250,16 @@
         }

+
+
+        public static void WriteDebugMesh(IMesh mesh, string sPath)
+        {
+            WriteOptions options = WriteOptions.Defaults;
+            options.bWriteGroups = true;
+            StandardMeshWriter.WriteFile(sPath, new List<WriteMesh>() { new WriteMesh(mesh) }, options);
+        }
+
+
     }
 }


Added missing using statement

Added missing using statement

--- FluentImageResizing/Resizer.cs
+++ FluentImageResizing/Resizer.cs
@@ -13,19 +13,20 @@
             using (var memoryStream = new MemoryStream(bytes))
             using (var image = Image.FromStream(memoryStream))
             {
-                var temporaryBitmap = new Bitmap(image.Width, image.Height);
+                using (var temporaryBitmap = new Bitmap(image.Width, image.Height))
+                {
+                    using (var graphics = Graphics.FromImage(temporaryBitmap))
+                    {
+                        graphics.DrawImage(image, new Rectangle(0, 0, temporaryBitmap.Width, temporaryBitmap.Height),
+                            0, 0, temporaryBitmap.Width, temporaryBitmap.Height, GraphicsUnit.Pixel);
+                    }

-                using (var graphics = Graphics.FromImage(temporaryBitmap))
-                {
-                    graphics.DrawImage(image, new Rectangle(0, 0, temporaryBitmap.Width, temporaryBitmap.Height),
-                        0, 0, temporaryBitmap.Width, temporaryBitmap.Height, GraphicsUnit.Pixel);
+                    using (var saveStream = new MemoryStream())
+                    {
+                        temporaryBitmap.Save(saveStream, format);
+                        nonIndexedImageBytes = saveStream.ToArray();
+                    }
                 }
-
-                using (var saveStream = new MemoryStream())
-                {
-                    temporaryBitmap.Save(saveStream, format);
-                    nonIndexedImageBytes = saveStream.ToArray();
-                }
             }

             return new ImageResult(nonIndexedImageBytes, format);


InitData lambda improvements

InitData lambda improvements

--- Framework/Entities/InitData.cs
+++ Framework/Entities/InitData.cs
@@ -297,12 +297,15 @@
                 {
                     try
                     {
+                        if (assign.Expression is UnaryExpression convert && convert.NodeType == ExpressionType.Convert)
+                            return new Primitive(convert.Operand.GetConstantValue());
                         return new Primitive(assign.Expression.GetConstantValue());
                     }
                     catch (ArgumentException e) { throw new ArgumentException($"Invalid member assignment for {b.Member.Name}", e); }
                 }
                 else if (b is MemberListBinding bind)
                 {
+                    throw new NotImplementedException();
                     // TODO
                 }
                 throw new ArgumentException("All member bindings must be assignments");
@@ -324,6 +327,12 @@
         {
             base.Set(name, value);
             return this;
+        }
+        public InitData<T> Set<U>(Expression<Func<T,U>> lambda, U value)
+        {
+            if (!(lambda.Body is MemberExpression member))
+                throw new InvalidOperationException("Must be member expression");
+            return Set(member.Member.Name, value);
         }
         new public InitData<T> Unset(string name)
         {


* Heh forgot the test.

 * Heh forgot the test.

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

--- Gablarski.Tests/ServerTests.cs
+++ Gablarski.Tests/ServerTests.cs
@@ -51,5 +51,16 @@
 			Assert.IsNotNull (msg);
 			Assert.AreEqual (ConnectionRejectedReason.IncompatibleVersion, msg.Reason);
 		}
+
+		[TestMethod]
+		public void TestRequestChannelList ()
+		{
+			MockServerConnection connection = provider.EstablishConnection ();
+			connection.Client.Send (new RequestChannelListMessage ());
+
+			var msg = (connection.Client.DequeueMessage () as ChannelListMessage);
+			Assert.IsNotNull (msg);
+			Assert.IsTrue (msg.Channels.Count () > 0);
+		}
 	}
 }


Removed redundant fields passed to ModifyInfoBar

--- Hell-Quiz/MainGame/MainGame.cs
+++ Hell-Quiz/MainGame/MainGame.cs
@@ -52,7 +52,7 @@

     static void StartGame(string question, string answer, int consoleWidth, int consoleHeight)
     {
-        ModifyInfoBar(question, answer, consoleWidth, consoleHeight);
+        ModifyInfoBar(question, answer);
         var randomGenerator = new Random();

         Player player = new Player(consoleWidth / 2, consoleHeight - 4);
@@ -339,7 +339,7 @@
         Console.ForegroundColor = ConsoleColor.White;
     }

-    private static void ModifyInfoBar(string question, string answer, int consoleWidth, int consoleHeight)
+    private static void ModifyInfoBar(string question, string answer)
     {
         char heart = '♥';


Added a GetStyleValue access that accepts a StyleProperty.

--- HtmlConsole/Dom/ElementNode.cs
+++ HtmlConsole/Dom/ElementNode.cs
@@ -58,7 +58,7 @@
             if(Styles == null) throw new InvalidOperationException("Styles are not computed yet (call ComputeStyles on the Document first).");

             Renderer renderer;
-            switch (GetStyleValue<EnumStyleValue<Display>>("display")?.EnumValue)
+            switch (GetStyleValue<EnumStyleValue<Display>>(StyleProperties.Display)?.EnumValue)
             {
                 // TODO: Replaced content renderer
                 case Display.Block:
@@ -93,6 +93,11 @@
             return GetStyleValue(name) as T;
         }

+        public T GetStyleValue<T>(StyleProperty property) where T: StyleValue
+        {
+            return GetStyleValue<T>(property.PropertyName);
+        }
+
         public bool Equals(INode other)
         {
             if (other == null) return false;