Add RealTimeDataServer to the tests setup

--- QDMSTest/QDMSServer/HistoricalDataServerTest.cs
+++ QDMSTest/QDMSServer/HistoricalDataServerTest.cs
@@ -7,9 +7,13 @@
 using System;
 using System.Collections.Generic;
 using System.Threading;
+
 using Moq;
+
 using NUnit.Framework;
+
 using QDMS;
+
 using QDMSServer;

 namespace QDMSTest
@@ -17,16 +21,22 @@
     [TestFixture]
     public class HistoricalDataServerTest
     {
+        private RealTimeDataServer _rtServer;
         private HistoricalDataServer _hdServer;
         private QDMSClient.QDMSClient _client;
-        private Mock<IHistoricalDataBroker> _brokerMock;
+        private Mock<IRealTimeDataBroker> _realTimeDataBrokerMock;
+        private Mock<IHistoricalDataBroker> _historicalDataBrokerMock;

         [SetUp]
         public void SetUp()
         {
-            _brokerMock = new Mock<IHistoricalDataBroker>();
-
-            _hdServer = new HistoricalDataServer(5557, _brokerMock.Object);
+            _realTimeDataBrokerMock = new Mock<IRealTimeDataBroker>();
+            _historicalDataBrokerMock = new Mock<IHistoricalDataBroker>();
+            // Also need the real time server to keep the "heartbeat" going
+            _rtServer = new RealTimeDataServer(5555, 5554, _realTimeDataBrokerMock.Object);
+            _rtServer.StartServer();
+
+            _hdServer = new HistoricalDataServer(5557, _historicalDataBrokerMock.Object);
             _hdServer.StartServer();

             _client = new QDMSClient.QDMSClient("testingclient", "127.0.0.1", 5554, 5555, 5556, 5557);
@@ -47,28 +57,29 @@
             {
                 ID = 1,
                 Symbol = "SPY",
-                Datasource = new Datasource { ID = 1, Name = "MockSource" }
+                Datasource = new Datasource {ID = 1, Name = "MockSource"},
+                Exchange = new Exchange
+                {
+                    ID = 1,
+                    Name = "Exchange",
+                    Timezone = "Eastern Standard Time"
+                }
             };
-
-            instrument.Exchange = new Exchange()
-            {
-                ID = 1,
-                Name = "Exchange",
-                Timezone = "Eastern Standard Time"
-            };
-
             var request = new HistoricalDataRequest(instrument, BarSize.OneDay, new DateTime(2012, 1, 1), new DateTime(2013, 1, 1));

             _client.RequestHistoricalData(request);

             Thread.Sleep(500);

-            _brokerMock.Verify(x => x.RequestHistoricalData(
-                It.Is<HistoricalDataRequest>(r =>
-                    r.Instrument.ID == 1 &&
-                    r.Frequency == BarSize.OneDay &&
-                    r.StartingDate == new DateTime(2012, 1, 1) &&
-                    r.EndingDate == new DateTime(2013, 1, 1))), Times.Once);
+            _historicalDataBrokerMock.Verify(
+                x => x.RequestHistoricalData(
+                    It.Is<HistoricalDataRequest>(
+                        r =>
+                            r.Instrument.ID == 1 &&
+                            r.Frequency == BarSize.OneDay &&
+                            r.StartingDate == new DateTime(2012, 1, 1) &&
+                            r.EndingDate == new DateTime(2013, 1, 1))),
+                Times.Once);
         }

         [Test]
@@ -91,26 +102,27 @@
             {
                 ID = 1,
                 Symbol = "SPY",
-                Datasource = new Datasource { ID = 1, Name = "MockSource" }
+                Datasource = new Datasource {ID = 1, Name = "MockSource"}
             };
-
             var data = new List<OHLCBar>
             {
-                new OHLCBar {Open = 1, High = 2, Low = 3, Close = 4, DT = new DateTime(2013, 1, 1) }
+                new OHLCBar {Open = 1, High = 2, Low = 3, Close = 4, DT = new DateTime(2013, 1, 1)}
             };
-
-            var req = new DataAdditionRequest(BarSize.OneDay, instrument, data, true);
+            var req = new DataAdditionRequest(BarSize.OneDay, instrument, data);

             _client.PushData(req);

             Thread.Sleep(50);

-            _brokerMock.Verify(x => x.AddData(
-                It.Is<DataAdditionRequest>(y =>
-                    y.Frequency == BarSize.OneDay &&
-                    y.Instrument.ID == 1 &&
-                    y.Data.Count == 1)
-                ), Times.Once);
+            _historicalDataBrokerMock.Verify(
+                x => x.AddData(
+                    It.Is<DataAdditionRequest>(
+                        y =>
+                            y.Frequency == BarSize.OneDay &&
+                            y.Instrument.ID == 1 &&
+                            y.Data.Count == 1)
+                    ),
+                Times.Once);
         }

         [Test]
@@ -120,43 +132,45 @@
             {
                 ID = 1,
                 Symbol = "SPY",
-                Datasource = new Datasource { ID = 1, Name = "MockSource" }
+                Datasource = new Datasource {ID = 1, Name = "MockSource"}
             };

             _client.GetLocallyAvailableDataInfo(instrument);

-            Thread.Sleep(50);
+            Thread.Sleep(1000);

-            _brokerMock.Verify(x => x.GetAvailableDataInfo(
-                It.Is<Instrument>(y =>
-                    y.ID == 1 &&
-                    y.Symbol == "SPY")
-                    ), Times.Once);
+            _historicalDataBrokerMock.Verify(
+                x => x.GetAvailableDataInfo(
+                    It.Is<Instrument>(
+                        y =>
+                            y.ID == 1 &&
+                            y.Symbol == "SPY")
+                    ),
+                Times.Once);
         }

         [Test]
         public void SendsErrorMessageWhenExceptionIsRaisedByBrokerOnHistoricalDataRequest()
         {
-            bool errorRaised = false;
+            var errorRaised = false;
+
             _client.Error += (sender, e) => errorRaised = true;

             var instrument = new Instrument
             {
                 ID = 1,
                 Symbol = "SPY",
-                Datasource = new Datasource { ID = 1, Name = "MockSource" }
+                Datasource = new Datasource {ID = 1, Name = "MockSource"},
+                Exchange = new Exchange
+                {
+                    ID = 1,
+                    Name = "Exchange",
+                    Timezone = "Eastern Standard Time"
+                }
             };
-
-            instrument.Exchange = new Exchange()
-            {
-                ID = 1,
-                Name = "Exchange",
-                Timezone = "Eastern Standard Time"
-            };
-
             var request = new HistoricalDataRequest(instrument, BarSize.OneDay, new DateTime(2012, 1, 1), new DateTime(2013, 1, 1));

-            _brokerMock.Setup(x => x.RequestHistoricalData(It.IsAny<HistoricalDataRequest>())).Throws(new Exception("error message"));
+            _historicalDataBrokerMock.Setup(x => x.RequestHistoricalData(It.IsAny<HistoricalDataRequest>())).Throws(new Exception("error message"));

             _client.RequestHistoricalData(request);


Clarified comment

Clarified comment

--- RDFSharp/Semantics/OWL/RDFSemanticsUtilities.cs
+++ RDFSharp/Semantics/OWL/RDFSemanticsUtilities.cs
@@ -131,7 +131,7 @@
                     { nameof(RDFVocabulary.OWL.DIFFERENT_FROM), ontGraph.SelectTriplesByPredicate(RDFVocabulary.OWL.DIFFERENT_FROM) },
                     { nameof(RDFVocabulary.OWL.ALL_DIFFERENT), ontGraph.SelectTriplesByObject(RDFVocabulary.OWL.ALL_DIFFERENT).SelectTriplesByPredicate(RDFVocabulary.RDF.TYPE)}, //OWL2
                     { nameof(RDFVocabulary.OWL.MEMBERS), ontGraph.SelectTriplesByPredicate(RDFVocabulary.OWL.MEMBERS) },
-                    { nameof(RDFVocabulary.OWL.DISTINCT_MEMBERS), ontGraph.SelectTriplesByPredicate(RDFVocabulary.OWL.DISTINCT_MEMBERS) },
+                    { nameof(RDFVocabulary.OWL.DISTINCT_MEMBERS), ontGraph.SelectTriplesByPredicate(RDFVocabulary.OWL.DISTINCT_MEMBERS) }, //OWL2
                     { nameof(RDFVocabulary.OWL.NEGATIVE_PROPERTY_ASSERTION), ontGraph.SelectTriplesByObject(RDFVocabulary.OWL.NEGATIVE_PROPERTY_ASSERTION).SelectTriplesByPredicate(RDFVocabulary.RDF.TYPE)}, //OWL2
                     { nameof(RDFVocabulary.OWL.SOURCE_INDIVIDUAL), ontGraph.SelectTriplesByPredicate(RDFVocabulary.OWL.SOURCE_INDIVIDUAL) }, //OWL2
                     { nameof(RDFVocabulary.OWL.ASSERTION_PROPERTY), ontGraph.SelectTriplesByPredicate(RDFVocabulary.OWL.ASSERTION_PROPERTY) }, //OWL2


Document Handle properties

Document Handle properties

--- src/RdKafka/Handle.cs
+++ src/RdKafka/Handle.cs
@@ -11,10 +11,25 @@
     {
         internal SafeKafkaHandle handle;

+        /// <summary>
+        /// The name of the handle
+        /// </summary>
         public string Name => handle.GetName();

+        /// <summary>
+        /// The client's broker-assigned group member id
+        ///
+        /// Last assigned member id, or empty string if not currently
+        /// a group member.
+        /// </summary>
         public string MemberId => handle.MemberId();

+        /// <summary>
+        /// The current out queue length
+        ///
+        /// The out queue contains messages and requests waiting to be sent to,
+        /// or acknowledged by, the broker.
+        /// </summary>
         public long OutQueueLength => handle.GetOutQueueLength();

         /// <summary>


Added TRole : IdentityRole generic parameter to AddRavenDbIdentity.

--- RavenDB.Identity/ServiceCollectionExtensions.cs
+++ RavenDB.Identity/ServiceCollectionExtensions.cs
@@ -22,40 +22,55 @@
         public static IServiceCollection AddRavenDbIdentity<TUser>(this IServiceCollection services, Action<IdentityOptions> setupAction = null)
             where TUser : IdentityUser
         {
-            // Add the AspNet identity system to work with our RavenDB identity objects.
-            if (setupAction != null)
-            {
-                services.AddIdentity<TUser, IdentityRole>(setupAction)
-                    .AddDefaultTokenProviders();
-            }
-            else
-            {
-                services.AddIdentity<TUser, IdentityRole>()
-                    .AddDefaultTokenProviders();
-            }
-
-            services.AddScoped<Microsoft.AspNetCore.Identity.IUserStore<TUser>, UserStore<TUser>>();
-            services.AddScoped<Microsoft.AspNetCore.Identity.IRoleStore<IdentityRole>, RoleStore<IdentityRole>>();
-
-            return services;
+			return AddRavenDbIdentity<TUser>(services, setupAction);
         }

-        ///
-        /// Registers a RavenDB <see cref="IAsyncDocumentSession"/> to be created and disposed on each request.
-        ///
-        /// <example>
-        ///
-        ///         public void ConfigureServices(IServiceCollection services)
-        ///         {
-        ///             services.AddRavenDbAsyncSession(() => myRavenDocStore);
-        ///         }
-        ///
-        /// </example>
-        /// <param name="serviceCollection"> The <see cref="IServiceCollection" /> to add services to. </param>
-        /// <param name="dbGetter">The function that gets the database.</param>
-        /// <remarks>Based on code from https://github.com/maqduni/AspNetCore.Identity.RavenDb/blob/master/src/Maqduni.AspNetCore.Identity.RavenDb/RavenDbServiceCollectionExtensions.cs</remarks>
-        /// <returns>The same service collection so that multiple calls can be chained.</returns>
-        public static IServiceCollection AddRavenDbAsyncSession(this IServiceCollection serviceCollection, Func<IDocumentStore> dbGetter)
+		///
+		/// Registers a RavenDB as the user store.
+		///
+		/// <typeparam name="TUser">The type of user. This should be a class you created derived from <see cref="IdentityUser"/>.</typeparam>
+		/// <typeparam name="TRole">The type of role. This should be a class you created derived from <see cref="IdentityRole"/>.</typeparam>
+		/// <param name="services"></param>
+		/// <param name="setupAction">Identity options configuration.</param>
+		/// <returns>The same service collection so that multiple calls can be chained.</returns>
+		public static IServiceCollection AddRavenDbIdentity<TUser, TRole>(this IServiceCollection services, Action<IdentityOptions> setupAction = null)
+			where TUser : IdentityUser
+			where TRole : IdentityRole
+		{
+			// Add the AspNet identity system to work with our RavenDB identity objects.
+			if (setupAction != null)
+			{
+				services.AddIdentity<TUser, TRole>(setupAction)
+					.AddDefaultTokenProviders();
+			}
+			else
+			{
+				services.AddIdentity<TUser, TRole>()
+					.AddDefaultTokenProviders();
+			}
+
+			services.AddScoped<Microsoft.AspNetCore.Identity.IUserStore<TUser>, UserStore<TUser>>();
+			services.AddScoped<Microsoft.AspNetCore.Identity.IRoleStore<TRole>, RoleStore<TRole>>();
+
+			return services;
+		}
+
+		///
+		/// Registers a RavenDB <see cref="IAsyncDocumentSession"/> to be created and disposed on each request.
+		///
+		/// <example>
+		///
+		///         public void ConfigureServices(IServiceCollection services)
+		///         {
+		///             services.AddRavenDbAsyncSession(() => myRavenDocStore);
+		///         }
+		///
+		/// </example>
+		/// <param name="serviceCollection"> The <see cref="IServiceCollection" /> to add services to. </param>
+		/// <param name="dbGetter">The function that gets the database.</param>
+		/// <remarks>Based on code from https://github.com/maqduni/AspNetCore.Identity.RavenDb/blob/master/src/Maqduni.AspNetCore.Identity.RavenDb/RavenDbServiceCollectionExtensions.cs</remarks>
+		/// <returns>The same service collection so that multiple calls can be chained.</returns>
+		public static IServiceCollection AddRavenDbAsyncSession(this IServiceCollection serviceCollection, Func<IDocumentStore> dbGetter)
         {
             serviceCollection.Add(new ServiceDescriptor(typeof(IAsyncDocumentSession), p => dbGetter().OpenAsyncSession(), ServiceLifetime.Scoped));
             return serviceCollection;


Automatic code clean-up.

Automatic code clean-up.

--- Sandra.UI/AppTemplate/SingleInstanceMainForm.cs
+++ Sandra.UI/AppTemplate/SingleInstanceMainForm.cs
@@ -187,7 +187,7 @@
                     // Parse out the message.
                     string message = Encoding.UTF8.GetString(
                         encodedMessage,
-                        magicLength,
+                        magicLength,
                         encodedMessage.Length - magicLength);

                     ReceivedMessageFromAnotherInstance(message);


redid changes for TSI-180

redid changes for TSI-180

--- Sdl.Web.Templating/Templates/PublishMappings.cs
+++ Sdl.Web.Templating/Templates/PublishMappings.cs
@@ -1,13 +1,11 @@
-using Sdl.Web.Tridion.Common;
-using System;
+using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
-using System.Threading.Tasks;
 using System.Web.Helpers;
 using System.Xml;
 using System.Xml.Linq;
+using Sdl.Web.Tridion.Common;
 using Tridion;
 using Tridion.ContentManager;
 using Tridion.ContentManager.CommunicationManagement;
@@ -24,11 +22,13 @@
     public class PublishMappings : TemplateBase
     {
         private const string SchemasConfigName = "schemas";
-        private const string MappingsConfigName = "mappings";
+        //private const string MappingsConfigName = "mappings";
         private const string RegionConfigName = "regions";
         private const string VocabulariesConfigName = "vocabularies";
         private const string VocabulariesAppDataId = "http://www.sdl.com/tridion/SemanticMapping/vocabularies";
         private const string TypeOfAppDataId = "http://www.sdl.com/tridion/SemanticMapping/typeof";
+        private const string TypeOfAppDataStartElement = "<typeof>";
+        private const string TypeOfAppDataEndElement = "</typeof>";
         private const string DefaultVocabularyPrefix = "tsi";
         private const string DefaultVocabulary = "http://www.sdl.com/web/schemas/core";

@@ -43,21 +43,22 @@
                 {"mapping", "http://www.sdl.com/tridion/SemanticMapping"}
             };

-        private string _moduleRoot = string.Empty;
+        //private string _moduleRoot;

         public override void Transform(Engine engine, Package package)
         {
-            this.Initialize(engine, package);
+            Initialize(engine, package);
             //The core configuration component should be the one being processed by the template
-            var coreConfigComponent = this.GetComponent();
+            var coreConfigComponent = GetComponent();
             var sg = GetSystemStructureGroup("mappings");
-            _moduleRoot = GetModulesRoot(coreConfigComponent);
+            //_moduleRoot = GetModulesRoot(coreConfigComponent);
+
             //Get all the active modules
-            Dictionary<string, Component> moduleComponents = GetActiveModules(coreConfigComponent);
+            //Dictionary<string, Component> moduleComponents = GetActiveModules(coreConfigComponent);
             List<string> filesCreated = new List<string>();
             if (IsMasterWebPublication())
             {
-                filesCreated.AddRange(PublishJsonData(ReadMappingsData(), coreConfigComponent,"mapping", sg,true));
+                filesCreated.AddRange(PublishJsonData(ReadMappingsData(), coreConfigComponent,"mapping", sg, true));
             }
             //Publish the boostrap list, this is used by the web application to load in all other mapping files
             PublishBootstrapJson(filesCreated, coreConfigComponent, sg, "mapping-");
@@ -109,18 +110,18 @@

                     // multimedia schemas don't have a root element name, so lets use its title without any invalid characters
                     string rootElementName = schema.RootElementName;
-                    if (string.IsNullOrEmpty(rootElementName))
+                    if (String.IsNullOrEmpty(rootElementName))
                     {
                         rootElementName = Regex.Replace(schema.Title.Trim(), @"[^A-Za-z0-9.]+", "");
                     }
                     // add schema typeof using tridion standard implementation vocabulary prefix
-                    string typeOf = string.Format("{0}:{1}", DefaultVocabularyPrefix, rootElementName);
+                    string typeOf = String.Format("{0}:{1}", DefaultVocabularyPrefix, rootElementName);
                     StringBuilder schemaSemantics = new StringBuilder();
                     // append schema typeof from appdata
                     ApplicationData appData = schema.LoadApplicationData(TypeOfAppDataId);
                     if (appData != null)
                     {
-                        typeOf += "," + Encoding.Unicode.GetString(appData.Data);
+                        typeOf += "," + ExtractTypeOfAppData(appData);
                     }
                     schemaSemantics.Append(BuildSchemaSemanticsJson(typeOf));

@@ -136,7 +137,7 @@
                     string path = "/" + rootElementName;
                     fields.Append(BuildSchemaFieldsJson(schema, path, typeOf, nsmgr));

-                    res[SchemasConfigName].Add(string.Format("{{\"Id\":{0},\"RootElement\":{1},\"Fields\":[{2}],\"Semantics\":[{3}]}}", Json.Encode(schema.Id.ItemId), Json.Encode(rootElementName), fields, schemaSemantics));
+                    res[SchemasConfigName].Add(String.Format("{{\"Id\":{0},\"RootElement\":{1},\"Fields\":[{2}],\"Semantics\":[{3}]}}", Json.Encode(schema.Id.ItemId), Json.Encode(rootElementName), fields, schemaSemantics));

                 }
             }
@@ -161,7 +162,7 @@
                     }
                     allowedComponentTypes.Append(componentType);
                 }
-                res[RegionConfigName].Add(string.Format("{{\"Region\":{0},\"ComponentTypes\":[{1}]}}", Json.Encode(region.Key), allowedComponentTypes));
+                res[RegionConfigName].Add(String.Format("{{\"Region\":{0},\"ComponentTypes\":[{1}]}}", Json.Encode(region.Key), allowedComponentTypes));
             }

             return res;
@@ -227,10 +228,10 @@

             // loop over all field elements in schema
             bool first = true;
-            string xpath = string.Format("/xsd:schema/xsd:element[@name='{0}']/xsd:complexType/xsd:sequence/xsd:element", schema.RootElementName);
+            string xpath = String.Format("/xsd:schema/xsd:element[@name='{0}']/xsd:complexType/xsd:sequence/xsd:element", schema.RootElementName);
             if (embedded)
             {
-                xpath = string.Format("/xsd:schema/xsd:complexType[@name='{0}']/xsd:sequence/xsd:element", schema.RootElementName);
+                xpath = String.Format("/xsd:schema/xsd:complexType[@name='{0}']/xsd:sequence/xsd:element", schema.RootElementName);
             }
             foreach (XmlNode fieldNode in schema.Xsd.SelectNodes(xpath, nsmgr))
             {
@@ -295,7 +296,7 @@
             }

             // use field xml name as initial semantic mapping for field
-            string property = string.Format("{0}:{1}", DefaultVocabularyPrefix, fieldNode.Attributes["name"].Value);
+            string property = String.Format("{0}:{1}", DefaultVocabularyPrefix, fieldNode.Attributes["name"].Value);

             // read semantic mapping from field and append if available
             XmlNode propertyNode = fieldNode.SelectSingleNode("xsd:annotation/xsd:appinfo/tcm:ExtensionXml/mapping:property", nsmgr);
@@ -312,7 +313,7 @@
             {
                 string uri = embeddedSchemaNode.Attributes["href", "http://www.w3.org/1999/xlink"].Value;
                 Schema embeddedSchema = (Schema)Engine.GetObject(uri);
-                string embeddedTypeOf = string.Format("{0}:{1}", DefaultVocabularyPrefix, embeddedSchema.RootElementName);
+                string embeddedTypeOf = String.Format("{0}:{1}", DefaultVocabularyPrefix, embeddedSchema.RootElementName);

                 // append schema typeof from appdata for embedded schemas
                 ApplicationData appData = embeddedSchema.LoadApplicationData(TypeOfAppDataId);
@@ -349,14 +350,14 @@
             //    // if there is no type attribute, it is not a simple type so look for <xsd:complexType> inside the element
             //}

-            return string.Format("{{\"Name\":{0},\"Path\":{1},\"IsMultiValue\":{2},\"Semantics\":[{3}],\"Fields\":[{4}]}}", Json.Encode(name), Json.Encode(path), Json.Encode(isMultiValue), fieldSemantics, embeddedFields);
+            return String.Format("{{\"Name\":{0},\"Path\":{1},\"IsMultiValue\":{2},\"Semantics\":[{3}],\"Fields\":[{4}]}}", Json.Encode(name), Json.Encode(path), Json.Encode(isMultiValue), fieldSemantics, embeddedFields);
         }

         // schema semantics: {"Prefix":"s","Entity":"Article"}
         private static string BuildSchemaSemanticsJson(string input)
         {
             StringBuilder semantics = new StringBuilder();
-            if (!string.IsNullOrEmpty(input))
+            if (!String.IsNullOrEmpty(input))
             {
                 // input = "s:Article" but can also be "s:Article,x:Something"
                 string[] values = input.Split(',');
@@ -385,7 +386,7 @@
             Dictionary<string, string> entities = new Dictionary<string, string>();
             StringBuilder semantics = new StringBuilder();
             bool first = true;
-            if (!string.IsNullOrEmpty(input))
+            if (!String.IsNullOrEmpty(input))
             {
                 // entity = "s:Article" but can also be "s:Article,x:Something"
                 string[] values = entity.Split(',');
@@ -415,5 +416,18 @@

             return semantics.ToString();
         }
+
+        private static string ExtractTypeOfAppData(ApplicationData appData)
+        {
+            if (appData != null)
+            {
+                // appdata is supposed to be a unicode encoded string
+                string xmlData = Encoding.Unicode.GetString(appData.Data);
+
+                // remove start and end xml element from appdata string
+                return xmlData.Replace(TypeOfAppDataStartElement, String.Empty).Replace(TypeOfAppDataEndElement, String.Empty);
+            }
+            return null;
+        }
     }
 }


Test check in

Test check in

Test check in

--- Service/Test/AuthorisationManagerServiceTest.cs
+++ Service/Test/AuthorisationManagerServiceTest.cs
@@ -28,7 +28,7 @@

             roles = new List<Role>(new[] {role1, role2});

-            var user1 = new UserAuthorisation() {Id = 1, UserName = "jbloggs", DisplayName = "Joe Bloggs"};
+            var user1 = new UserAuthorisation() {Id = 1, UserName = "jbloggs", DisplayName = "Joe Blogger"};
             user1.Roles.Add(roles[0]);

             var user2 = new UserAuthorisation() {Id = 2, UserName = "jmasters", DisplayName = "Jane Masters"};


Removed redundant socket error detection code

--- SharpRemote.Windows/EndPoints/SocketEndPoint.cs
+++ SharpRemote.Windows/EndPoints/SocketEndPoint.cs
@@ -99,14 +99,14 @@
 				while (!token.IsCancellationRequested)
 				{
 					SocketError err;
-					if (!SynchronizedRead(socket, size, out err) || !HandleError(socket, err))
+					if (!SynchronizedRead(socket, size, out err))
 						break;

 					var length = BitConverter.ToInt32(size, 0);
 					if (length >= 8)
 					{
 						var buffer = new byte[length];
-						if (!SynchronizedRead(socket, buffer, out err) || !HandleError(socket, err))
+						if (!SynchronizedRead(socket, buffer, out err))
 							break;

 						var stream = new MemoryStream(buffer, false);
@@ -142,7 +142,7 @@
 				}

 				int written = socket.Send(data, 0, length, SocketFlags.None, out err);
-				if (written != length)
+				if (written != length || err != SocketError.Success || !socket.Connected)
 				{
 					Log.ErrorFormat("Error while writing to socket: {0} out of {1} written, socket status: {2}", written, data.Length, err);
 					return false;
@@ -174,54 +174,6 @@
 		}

 		#endregion
-
-		private static bool IsSocketConnected(Socket socket)
-		{
-			// let's find out of the socket was interrupted
-			try
-			{
-				socket.Poll(1, SelectMode.SelectRead);
-
-				if (!socket.Connected)
-					return false;
-
-				/*if ()
-					return false;*/
-
-				return true;
-			}
-			catch (SocketException)
-			{
-				return false;
-			}
-		}
-
-		private bool HandleError(Socket socket, SocketError err)
-		{
-			switch (err)
-			{
-				case SocketError.Success:
-					if (!IsSocketConnected(socket))
-					{
-						Log.InfoFormat("Socket '{0}' connection aborted", _name);
-						return false;
-					}
-
-					return true;
-
-				case SocketError.NotConnected:
-				case SocketError.Interrupted:
-					return false;
-
-				case SocketError.ConnectionAborted:
-					Log.InfoFormat("Socket '{0}' connection aborted", _name);
-					return false;
-
-				default:
-					Log.ErrorFormat("Unexpected socket error '{0}' - disconnecting from other endpoint", err);
-					return false;
-			}
-		}

 		private void OnIncomingConnection(IAsyncResult ar)
 		{
@@ -588,8 +540,7 @@
 						var data = response.GetBuffer();

 						SocketError err;
-						if (!SynchronizedWrite(socket, data, responseLength, out err) ||
-						    !HandleError(socket, err))
+						if (!SynchronizedWrite(socket, data, responseLength, out err))
 						{
 							Log.ErrorFormat("Disconnecting socket due to error while writing response!");
 							Disconnect();


fix Between (...)

fix Between (...)

--- Signum.Utilities/Extensions/StringExtensions.cs
+++ Signum.Utilities/Extensions/StringExtensions.cs
@@ -386,7 +386,7 @@
             start = start + firstSeparator.Length;

             int end = str.IndexOf(secondSeparator, start);
-            if (start == -1)
+            if (end == -1)
                 throw NotFound(str, secondSeparator);

             return str.Substring(start, end - start);
@@ -404,7 +404,7 @@
             start = start + 1;

             int end = str.IndexOf(secondSeparator, start);
-            if (start == -1)
+            if (end == -1)
                 throw NotFound(str, secondSeparator);

             return str.Substring(start, end - start);
@@ -422,7 +422,7 @@
             start = start + firstSeparator.Length;

             int end = str.IndexOf(secondSeparator ?? firstSeparator, start);
-            if (start == -1)
+            if (end == -1)
                 return null;

             return str.Substring(start, end - start);
@@ -440,7 +440,7 @@
             start = start + 1;

             int end = str.IndexOf(secondSeparator ?? firstSeparator, start);
-            if (start == -1)
+            if (end == -1)
                 return null;

             return str.Substring(start, end - start);


JSAPI: Append Content-Type

JSAPI: Append Content-Type

--- Snowflake/Extensions/HttpListenerContextExts.cs
+++ Snowflake/Extensions/HttpListenerContextExts.cs
@@ -15,6 +15,8 @@
             context.Response.AppendHeader("Access-Control-Allow-Origin", "*");
             context.Response.AppendHeader("Access-Control-Origin", "*");
             context.Response.AppendHeader("Access-Control-Allow-Headers", "X-Requested-With, Content-Type");
+            context.Response.AppendHeader("Content-Type", "application/json");
+
         }
     }
 }


prevent an unhandled exception caused by performance counter when stop instances

--- SocketEngine/ProcessPerformanceCounterHelper.cs
+++ SocketEngine/ProcessPerformanceCounterHelper.cs
@@ -83,7 +83,18 @@

                 using (var performanceCounter = new PerformanceCounter("Process", "ID Process", runnedInstance, true))
                 {
-                    if ((int)performanceCounter.RawValue == processId)
+                    var counterProcessId = 0;
+
+                    try
+                    {
+                        counterProcessId = (int)performanceCounter.RawValue;
+                    }
+                    catch //that process has been shutdown
+                    {
+                        continue;
+                    }
+
+                    if (counterProcessId == processId)
                     {
                         return runnedInstance;
                     }


Cleaning up an example

Cleaning up an example

--- Source/Examples/ExampleLibrary/Issues/Issues.cs
+++ Source/Examples/ExampleLibrary/Issues/Issues.cs
@@ -770,7 +770,7 @@
             createAxis(AxisPosition.Right);
             createAxis(AxisPosition.Top);

-            var textAnnotation = new TextAnnotation() { Text = "Hold mouse to increase angle", TextPosition = new DataPoint(0, 5), TextHorizontalAlignment = HorizontalAlignment.Left, TextVerticalAlignment = VerticalAlignment.Top };
+            var textAnnotation = new TextAnnotation() { Text = "Hold mouse button here to increase angle", TextPosition = new DataPoint(0, 6), TextHorizontalAlignment = HorizontalAlignment.Left, TextVerticalAlignment = VerticalAlignment.Top };
             plotModel1.Annotations.Add(textAnnotation);
             bool? stopTask = null;


Add test to reproduce #789

Add test to reproduce #789

--- src/Humanizer.Tests.Shared/InflectorTests.cs
+++ src/Humanizer.Tests.Shared/InflectorTests.cs
@@ -349,6 +349,9 @@
             yield return new object[] { "rookie", "rookies" };
             yield return new object[] { "roomie", "roomies" };
             yield return new object[] { "smoothie", "smoothies" };
+
+            //Issue #789
+            yield return new object[] { "cache", "caches" };
         }

         IEnumerator IEnumerable.GetEnumerator()


Bumped version for official 1.0 release of Web helpers.

--- SpecsFor.Helpers.Web/Properties/AssemblyInfo.cs
+++ SpecsFor.Helpers.Web/Properties/AssemblyInfo.cs
@@ -34,4 +34,4 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0")]
 [assembly: AssemblyFileVersion("1.0.0")]
-[assembly: AssemblyInformationalVersion("1.0.0-alpha07")]
+[assembly: AssemblyInformationalVersion("1.0.0")]


ASP.NET 4.1

ASP.NET 4.1

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


start implementing of command handlers

start implementing of command handlers

--- src/SlackConnector.cs
+++ src/SlackConnector.cs
@@ -98,25 +98,43 @@
             var user = users.Single(u => u.Id == message.User);
             var channel = channels.SingleOrDefault(c => c.Id == message.Channel);
             var instantMessage = instantMessages.SingleOrDefault(im => im.Id == message.Channel);
-            if (channel != null)
-            {
-                logger.LogDebug($"#{channel.Name} {user.Name}: {message.Text}");
-            }
-            else if (instantMessage != null)
-            {
-                logger.LogDebug($"{user.Name}: {message.Text}");
-            }

             if (user.Id != selfId)
             {
-                if (instantMessage != null)
+                if (channel != null && message.Text.StartsWith("tipbot"))
                 {
-                    await SendMessage(instantMessage.Id, "Got it!");
+                    await HandleTipBotCommand(message, user, channel);
                 }
-                else if (channel != null)
+                else if (instantMessage != null)
                 {
-                    await SendMessage(channel.Id, "Stop spamming!");
+                    await HandleIMMessage(message, user, instantMessage);
                 }
+            }
+        }
+
+        private Task HandleTipBotCommand(Message message, User user, Channel channel)
+        {
+            logger.LogDebug($"Tip command recieved from {user.Name} in {channel.Name}: {message.Text}");
+            return Task.CompletedTask;
+        }
+
+        private async Task HandleIMMessage(Message message, User user, InstantMessage instantMessage)
+        {
+            if (string.Equals(message.Text, "help", StringComparison.OrdinalIgnoreCase))
+            {
+                const string helpText =
+                @"*Direct Message Commands*
+_balance_ - Wallet balance
+_deposit_ - shows your deposit address
+_withdraw [nxt address] amount_ - withdraws amount (in NXT) to specified NXT address
+
+*Channel Commands*
+_tipbot tip [user or nxt address] amount_ - sends a tip to specified user or address";
+                await SendMessage(instantMessage.Id, helpText);
+            }
+            else
+            {
+                await SendMessage(instantMessage.Id, "huh? try typing *help* for a list of available commands.");
             }
         }


_Fields - convience method for _GetMembers().Names()

--- src/Reflection/ReflectionExtensions.cs
+++ src/Reflection/ReflectionExtensions.cs
@@ -264,6 +264,13 @@
             return _AsDictionary(source, members.Names());
         }

+        /// <summary>
+        /// Converts the object to key-value pairs. If the object is a dictionary, a subset of the
+        /// dictionary will be returned
+        /// </summary>
+        /// <param name="source"></param>
+        /// <param name="fieldNames"></param>
+        /// <returns></returns>
         public static Dictionary<string, object> _AsDictionary(this object source, IEnumerable<string> fieldNames)
         {
             // Fake polymorphism here
@@ -278,6 +285,19 @@
             foreach (var field in fieldNames)
                 res.Add(field, source.GetFieldValue(field));
             return res;
+        }
+
+        /// <summary>
+        /// Get the names of the fields of the object, or the keys if it's a dictionary
+        /// </summary>
+        /// <param name="source"></param>
+        /// <returns></returns>
+        public static IEnumerable<string> _Fields(this object source)
+        {
+            if (source is Dictionary<string, object>)
+                return (source as Dictionary<string, object>).Keys;
+
+            return source._GetMembers().Names();
         }

         public static T _ToObject<T>(this Dictionary<string, object> dict, ObjectReader reader = null)


proper casing for fieldNames

proper casing for fieldNames

--- src/Reflection/ReflectionExtensions.cs
+++ src/Reflection/ReflectionExtensions.cs
@@ -350,28 +350,28 @@
         /// (if the second object defines more fields than the first, they will be ignored)
         /// </summary>
         public static bool _IsIdenticalOnFields(this object source, object other,
-            IEnumerable<string> fieldnames = null)
-        {
-            if (fieldnames == null) fieldnames = source._GetMembers().Names();
-            return source._AsDictionary(true).IsSameAs(other._AsDictionary(true), fieldnames);
+            IEnumerable<string> fieldNames = null)
+        {
+            if (fieldNames == null) fieldNames = source._GetMembers().Names();
+            return source._AsDictionary(true).IsSameAs(other._AsDictionary(true), fieldNames);
         }

         /// <summary>
         /// Are the two objects identical when compared over the supplied fields
         /// </summary>
-        public static bool _IsIdenticalOnFields(this object source, object other, params string[] fieldnames)
-        {
-            return _IsIdenticalOnFields(source, other, fieldnames as IEnumerable<string>);
-        }
-        public static string _Inspect(this object source, params string[] fieldnames)
-        {
-            return _Inspect(source, fieldnames as IEnumerable<string>);
-        }
-        public static string _Inspect(this object source, IEnumerable<string> fieldnames = null)
-        {
-            if (fieldnames == null)
-                fieldnames = source._GetMembers().Names();
-            var dict = source._AsDictionary(fieldnames);
+        public static bool _IsIdenticalOnFields(this object source, object other, params string[] fieldNames)
+        {
+            return _IsIdenticalOnFields(source, other, fieldNames as IEnumerable<string>);
+        }
+        public static string _Inspect(this object source, params string[] fieldNames)
+        {
+            return _Inspect(source, fieldNames as IEnumerable<string>);
+        }
+        public static string _Inspect(this object source, IEnumerable<string> fieldNames = null)
+        {
+            if (fieldNames == null)
+                fieldNames = source._GetMembers().Names();
+            var dict = source._AsDictionary(fieldNames);
             return dict.Print();
         }


add cast to func test

add cast to func test

--- src/LinqStatisticsTests/LeastSquaresTests.cs
+++ src/LinqStatisticsTests/LeastSquaresTests.cs
@@ -11,6 +11,23 @@
     [TestClass]
     public class LeastSquaresTests
     {
+        [TestMethod]
+        public void CastToFunc()
+        {
+            var data = new List<Tuple<int, int>>()
+            {
+                new Tuple<int, int>(1, 1),
+                new Tuple<int, int>(2, 2),
+                new Tuple<int, int>(3, 3)
+            };
+
+            var ls = data.LeastSquares();
+            Func<double, double> func = ls;
+
+            var result = func(2);
+            Assert.AreEqual(2, result);
+        }
+
         [TestMethod]
         public void SingularMatrixReturnEmpty()
         {


Fix to handle paragraph encompassed with carriage returns

--- src/ReverseMarkdown/Converters/Text.cs
+++ src/ReverseMarkdown/Converters/Text.cs
@@ -25,15 +25,23 @@
         private string TreatText(HtmlNode node)
         {
             var content = DecodeHtml(node.InnerText);
-            content = content.Replace("\r\n", "
");
-            content = content.Replace("\n", "
");

             //strip leading spaces and tabs for text within list item
             var parent = node.ParentNode;
-            if (parent.Name == "ol" || parent.Name == "ul")
+
+            switch (parent.Name)
             {
-                content = content.Trim();
+                case "ol":
+                case "ul":
+                    content = content.Trim();
+                    break;
+                case "p":
+                    content = content.TrimStart('\r', '\n').TrimEnd('\r', '\n');
+                    break;
             }
+
+            content = content.Replace("\r\n", "
");
+            content = content.Replace("\n", "
");

             content =  EscapeKeyChars(content);


Update

Update

--- src/StaticCommons/Validation/String.cs
+++ src/StaticCommons/Validation/String.cs
@@ -7,7 +7,20 @@
 {
     public static class String
     {
-        public static bool IsTextMatches(string text, string data, string source)
+        public static bool IsTextMatches(string text, string data)
+        {
+            var result = false;
+            foreach (var s in text.Slugfy().Split(new[] { "-" }, StringSplitOptions.None))
+            {
+                if (Regex.Matches(s, data).Any())
+                {
+                    result = true;
+                }
+            }
+            return result;
+        }
+
+        public static bool ContainsTextMatches(this string text, string data)
         {
             var result = false;
             foreach (var s in text.Slugfy().Split(new[] { "-" }, StringSplitOptions.None))


Fetch username after adding comment in CommentService

--- src/Stories/Services/CommentService.cs
+++ src/Stories/Services/CommentService.cs
@@ -30,7 +30,7 @@
             if (comment == null)
                 return null;

-            return MapCommentToCommentViewModel(comment);
+            return await MapCommentToCommentViewModel(comment);
         }

         public async Task<CommentViewModel> Add(AddCommentViewModel model)
@@ -42,15 +42,14 @@
                 ContentMarkdown = model.CommentMarkdown,
                 Content = CommonMarkConverter.Convert(model.CommentMarkdown),
                 StoryId = hashIds.Decode(model.StoryHashId).First(),
-                UserId = model.UserId,
-
+                UserId = model.UserId
             });

             await StoriesDbContext.SaveChangesAsync();

             VoteQueueService.QueueCommentVote(comment.Entity.Id);

-            return MapCommentToCommentViewModel(comment.Entity);
+            return await MapCommentToCommentViewModel(comment.Entity);
         }

         public async Task<bool> Delete(DeleteCommentModel model)
@@ -72,9 +71,10 @@
             return new CommentViewModel();
         }

-        private CommentViewModel MapCommentToCommentViewModel(Comment comment)
+        private async Task<CommentViewModel> MapCommentToCommentViewModel(Comment comment)
         {
             var hashIds = new Hashids(minHashLength: 5);
+            var username = await StoriesDbContext.Users.Where(u => u.Id == comment.UserId).Select(u => u.Username).FirstOrDefaultAsync();

             return new CommentViewModel
             {
@@ -82,7 +82,7 @@
                 HashId = hashIds.Encode(comment.Id),
                 StoryHashId = hashIds.Encode(comment.StoryId),
                 SubmittedDate = comment.CreatedDate.ToString("o"),
-                Username = comment.User.Username,
+                Username = username,
                 Upvotes = comment.Upvotes,
                 IsEdited = comment.IsEdited
             };


Fixed  BigInteger .NET MF support.

Fixed  BigInteger .NET MF support.


Create or update a release directory

Create or update a release directory

--- src/Update/Program.cs
+++ src/Update/Program.cs
@@ -31,8 +31,10 @@

             bool silentInstall = false;
             var updateAction = default(UpdateAction);
+
             string target = default(string);
             string releaseDir = default(string);
+            string packagesDir = default(string);

             opts = new OptionSet() {
                 "Usage: Update.exe command [OPTS]",
@@ -48,6 +50,7 @@
                 "Options:",
                 { "h|?|help", "Display Help and exit", _ => ShowHelp() },
                 { "r=|releaseDir=", "Path to a release directory to use with releasify", v => releaseDir = v},
+                { "p=|packagesDir=", "Path to the NuGet Packages directory for C# apps", v => packagesDir = v},
                 { "s|silent", "Silent install", _ => silentInstall = true},
             };

@@ -134,6 +137,46 @@
                 await mgr.FullUninstall();
                 mgr.RemoveUninstallerRegistryEntry();
             }
+        }
+
+        public static void Releasify(string package, string targetDir = null, string packagesDir = null)
+        {
+            targetDir = targetDir ?? ".\\Releases";
+            if (!Directory.Exists(targetDir)) {
+                Directory.CreateDirectory(targetDir);
+            }
+
+            var di = new DirectoryInfo(targetDir);
+            File.Copy(package, Path.Combine(di.FullName, Path.GetFileName(package)));
+
+            var allNuGetFiles = di.EnumerateFiles()
+                .Where(x => x.Name.EndsWith(".nupkg", StringComparison.OrdinalIgnoreCase));
+
+            var toProcess = allNuGetFiles.Where(x => !x.Name.Contains("-delta") && !x.Name.Contains("-full"));
+
+            var releaseFilePath = Path.Combine(di.FullName, "RELEASES");
+            var previousReleases = Enumerable.Empty<ReleaseEntry>();
+            if (File.Exists(releaseFilePath)) {
+                previousReleases = ReleaseEntry.ParseReleaseFile(File.ReadAllText(releaseFilePath, Encoding.UTF8));
+            }
+
+            foreach (var file in toProcess) {
+                var rp = new ReleasePackage(file.FullName);
+                rp.CreateReleasePackage(rp.SuggestedReleaseFileName, packagesDir);
+
+                var prev = ReleaseEntry.GetPreviousRelease(previousReleases, rp, targetDir);
+                if (prev != null) {
+                    var deltaBuilder = new DeltaPackageBuilder();
+
+                    deltaBuilder.CreateDeltaPackage(prev, rp,
+                        Path.Combine(di.FullName, rp.SuggestedReleaseFileName.Replace("full", "delta")));
+                }
+            }
+
+            foreach (var file in toProcess) { File.Delete(file.FullName); }
+
+            var releaseEntries = allNuGetFiles.Select(x => ReleaseEntry.GenerateFromFile(x.FullName));
+            ReleaseEntry.WriteReleaseFile(releaseEntries, releaseFilePath);
         }

         public static void ShowHelp()


Fixed a bug in the program

Fixed a bug in the program

(from the refactoring - oops!)

--- src/UmbracoArchiveProcessor/Program.cs
+++ src/UmbracoArchiveProcessor/Program.cs
@@ -61,7 +61,7 @@

             GetUmbracoAssemblyVersions(target_dir, umbraco_filename);

-            GenerateDiffPatches(target_dir, umbraco_version);
+            GenerateDiffPatches(target_path, umbraco_version);

             MoveToVersionDirectory(umbraco_version, target_dir, umbraco_filename);

@@ -291,13 +291,13 @@
             }
         }

-        static void GenerateDiffPatches(DirectoryInfo target_dir, string umbraco_version)
-        {
-            var path = Path.Combine(target_dir.FullName, "..", "data", "releases.json");
+        static void GenerateDiffPatches(string target_path, string umbraco_version)
+        {
+            var path = Path.Combine(target_path, "..", "data", "releases.json");
             var model = GetUmbracoArchiveModel(path);
             var releases = model.Releases;

-            var diffs_dir = Path.Combine(target_dir.FullName, "..", "archive", "diffs");
+            var diffs_dir = Path.Combine(target_path, "..", "archive", "diffs");
             if (Directory.Exists(diffs_dir) == false)
                 Directory.CreateDirectory(diffs_dir);

@@ -317,18 +317,18 @@

             var previous = releases[index - 1];

-            if (File.Exists(Path.Combine(target_dir.FullName, previous.FileName)) == false)
+            if (File.Exists(Path.Combine(target_path, previous.FileName)) == false)
             {
                 Console.WriteLine("Could not find '{0}' on disk; downloading.", previous.Version);
-                DownloadUmbracoReleaseArchive(previous.Version, target_dir.FullName);
+                DownloadUmbracoReleaseArchive(target_path, string.Format("UmbracoCms.{0}.zip", previous.Version));
             }

             var current = releases[index];

             Console.WriteLine("Comparing the differences between: {0} - {1}", previous.Version, current.Version);

-            var file1 = new FileInfo(Path.Combine(target_dir.FullName, previous.FileName));
-            var file2 = new FileInfo(Path.Combine(target_dir.FullName, current.FileName));
+            var file1 = new FileInfo(Path.Combine(target_path, previous.FileName));
+            var file2 = new FileInfo(Path.Combine(target_path, current.FileName));

             var calc = new DifferenceCalculator(file1, file2)
             {
@@ -350,7 +350,7 @@

             Console.WriteLine(diffs);

-            File.Delete(Path.Combine(target_dir.FullName, previous.FileName));
+            File.Delete(Path.Combine(target_path, previous.FileName));

             Console.WriteLine("Finished generating diff patches.");
         }


3.0.2

--- src/Unicorn/Properties/AssemblyInfo.cs
+++ src/Unicorn/Properties/AssemblyInfo.cs
@@ -16,8 +16,8 @@
 // The following GUID is for the ID of the typelib if this project is exposed to COM
 [assembly: Guid("c7d93d67-1319-4d3c-b2f8-f74fdff6fb07")]

-[assembly: AssemblyVersion("3.0.1.1")]
-[assembly: AssemblyFileVersion("3.0.1.1")]
-[assembly: AssemblyInformationalVersion("3.0.1.1")]
+[assembly: AssemblyVersion("3.0.2.0")]
+[assembly: AssemblyFileVersion("3.0.2.0")]
+[assembly: AssemblyInformationalVersion("3.0.2")]

 [assembly: InternalsVisibleTo("Unicorn.Tests")]


pass the correct info so we get the correct decoder

--- src/Web/Engine/Services/FileStorage.cs
+++ src/Web/Engine/Services/FileStorage.cs
@@ -65,7 +65,7 @@
             Stream streamCreeator() => _encryptor.Decrypt(File.OpenRead(path), key, iv);
             var contentType = MimeTypes.MimeTypeMap.GetMimeType(extension);

-            return new FileMeta(streamCreeator, contentType, _fileDecoder.Get(path));
+            return new FileMeta(streamCreeator, contentType, _fileDecoder.Get(extension));
         }

         public async Task<FileMeta> Open(int id)


Changed safe cast to hard cast

Changed safe cast to hard cast

--- src/Xablu.WebApiClient/WebApiClient.cs
+++ src/Xablu.WebApiClient/WebApiClient.cs
@@ -147,9 +147,9 @@
             }

             var model = typeof(TModel);
-            var jObj = result?.Data as JObject;
-
-            var jToken = jObj.Properties().Select(p => p.Value).FirstOrDefault();
+            var jObj = (JObject)result?.Data;
+
+            var jToken = jObj.Properties().Select(p => p.Value).First();
             var resultData = jToken.ToObject(model) as TModel;

             if (resultData == null)
@@ -195,9 +195,9 @@
             }

             var model = typeof(TModel);
-            var jObj = result?.Data as JObject;
-
-            var jToken = jObj.Properties().Select(p => p.Value).FirstOrDefault();
+            var jObj = (JObject)result?.Data;
+
+            var jToken = jObj.Properties().Select(p => p.Value).First();
             var resultData = jToken.ToObject(model) as TModel;

             if (resultData == null)


refactor: remove namespace

refactor: remove namespace

--- src/Yaapii.Atoms/Bytes/BytesAsInput.cs
+++ src/Yaapii.Atoms/Bytes/BytesAsInput.cs
@@ -22,6 +22,7 @@

 using System;
 using System.IO;
+using Yaapii.Atoms.IO;

 namespace Yaapii.Atoms.Bytes
 {


Apply exclusion of analytics in draft pages.

--- Talagozis.Website/Views/Layout/Global/Js.cshtml
+++ Talagozis.Website/Views/Layout/Global/Js.cshtml
@@ -14,7 +14,9 @@
 </environment>

 <environment include="Production">
-    @if (Context.Request.Headers["X-Logger-Tracking"] != "28E245EC432A4049BB62942920CA1DBB")
+    @if (Context.Request.Headers["X-Logger-Tracking"] != "28E245EC432A4049BB62942920CA1DBB"
+        && !Context.Request.Query.Any(a => string.Equals(a.Key, "draft", StringComparison.OrdinalIgnoreCase) && string.Equals(a.Value, "true", StringComparison.OrdinalIgnoreCase))
+        )
     {
         <!-- Global site tag (gtag.js) - Google Analytics -->
         <script async src="https://www.googletagmanager.com/gtag/js?id=UA-48776471-2"></script>


Use bigquerydatatransfer instead of bigquery_data_transfer in region tags

We are treating BigQuery Data Transfer Service as its own product in the samples tracker.

--- bigquery/data-transfer/api/QuickStart/QuickStart.cs
+++ bigquery/data-transfer/api/QuickStart/QuickStart.cs
@@ -13,7 +13,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-// [START bigquery_data_transfer_quickstart]
+// [START bigquerydatatransfer_quickstart]

 using System;
 using Google.Api.Gax;
@@ -43,4 +43,4 @@
         }
     }
 }
-// [END bigquery_data_transfer_quickstart]
+// [END bigquerydatatransfer_quickstart]


Lucene.Net.Core.Util.SPIClassIterator: Changed generic closing type from S to T to prevent collision with enclosing generic type

--- src/Lucene.Net.Core/Util/SPIClassIterator.cs
+++ src/Lucene.Net.Core/Util/SPIClassIterator.cs
@@ -136,9 +136,9 @@
             }
         }

-        internal static bool IsInvokableSubclassOf<S>(Type type)
-        {
-            return typeof(S).IsAssignableFrom(type) && !type.GetTypeInfo().IsAbstract && !type.GetTypeInfo().IsInterface;
+        internal static bool IsInvokableSubclassOf<T>(Type type)
+        {
+            return typeof(T).IsAssignableFrom(type) && !type.GetTypeInfo().IsAbstract && !type.GetTypeInfo().IsInterface;
         }

         public static SPIClassIterator<S> Get()


Only loading non-Microsoft Assemblies to search for public types

--- src/Lucene.Net.Core/Util/SPIClassIterator.cs
+++ src/Lucene.Net.Core/Util/SPIClassIterator.cs
@@ -1,6 +1,9 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
 using System.Reflection;
+using System.Text;

 namespace Lucene.Net.Util
 {
@@ -44,12 +47,35 @@
             // hoping would be loaded hasn't been loaded yet into the app domain,
             // it is unavailable. So we go to the next level on each and check each referenced
             // assembly.
-
-            foreach (var loadedAssembly in AppDomain.CurrentDomain.GetAssemblies())
+            var assembliesLoaded = AppDomain.CurrentDomain.GetAssemblies().Where(x => !DotNetFrameworkFilter.IsFrameworkAssembly(x));
+            var referencedAssemblies = assembliesLoaded
+                .SelectMany(assembly =>
+                {
+                    return assembly
+                        .GetReferencedAssemblies()
+                        .Where(reference => !DotNetFrameworkFilter.IsFrameworkAssembly(reference))
+                        .Select(assemblyName => {
+                            try
+                            {
+                                return Assembly.Load(assemblyName);
+                            }
+                            catch
+                            {
+                                // swallow
+                                return null;
+                            }
+                        });
+                })
+                .Where(x => x != null)
+                .Distinct();
+
+            var assembliesToExamine = assembliesLoaded.Concat(referencedAssemblies).Distinct();
+
+            foreach (var assembly in assembliesToExamine)
             {
                 try
                 {
-                    foreach (var type in loadedAssembly.GetTypes())
+                    foreach (var type in assembly.GetTypes().Where(x => x.IsPublic))
                     {
                         try
                         {
@@ -114,6 +140,61 @@
         {
             return GetEnumerator();
         }
+
+        /// <summary>
+        /// Assembly filter logic from:
+        /// https://raw.githubusercontent.com/Microsoft/dotnet-apiport/master/src/Microsoft.Fx.Portability/Analyzer/DotNetFrameworkFilter.cs
+        /// </summary>
+        private static class DotNetFrameworkFilter
+        {
+            /// <summary>
+            /// These keys are a collection of public key tokens derived from all the reference assemblies in
+            /// "%ProgramFiles%\Reference Assemblies\Microsoft" on a Windows 10 machine with VS 2015 installed
+            /// </summary>
+            private static readonly ICollection<string> s_microsoftKeys = new HashSet<string>(new[]
+            {
+                "b77a5c561934e089", // ECMA
+                "b03f5f7f11d50a3a", // DEVDIV
+                "7cec85d7bea7798e", // SLPLAT
+                "31bf3856ad364e35", // Windows
+                "24eec0d8c86cda1e", // Phone
+                "0738eb9f132ed756", // Mono
+                "ddd0da4d3e678217", // Component model
+                "84e04ff9cfb79065", // Mono Android
+                "842cf8be1de50553"  // Xamarin.iOS
+            }, StringComparer.OrdinalIgnoreCase);
+
+            private static readonly IEnumerable<string> s_frameworkAssemblyNamePrefixes = new[]
+            {
+                "System.",
+                "Microsoft.",
+                "Mono."
+            };
+
+            /// <summary>
+            /// Gets a best guess as to whether this assembly is a .NET Framework assembly or not.
+            /// </summary>
+            public static bool IsFrameworkAssembly(Assembly assembly)
+            {
+                return assembly != null && IsFrameworkAssembly(assembly.GetName());
+            }
+
+            /// <summary>
+            /// Gets a best guess as to whether this assembly is a .NET Framework assembly or not.
+            /// </summary>
+            public static bool IsFrameworkAssembly(AssemblyName assembly)
+            {
+                if (assembly == null)
+                {
+                    return false;
+                }
+
+                var publicKeyToken = string.Concat(assembly.GetPublicKeyToken().Select(i => i.ToString("x2")));
+
+                return s_microsoftKeys.Contains(publicKeyToken)
+                    || s_frameworkAssemblyNamePrefixes.Any(p => assembly.Name.StartsWith(p, StringComparison.OrdinalIgnoreCase));
+            }
+        }
     }

     /* Being Re-written


Fix performance on load, by better save. AND fix performance on save. Thanks @dktapps.

--- src/MiNET/MiNET/Worlds/AnvilWorldProvider.cs
+++ src/MiNET/MiNET/Worlds/AnvilWorldProvider.cs
@@ -763,22 +763,23 @@
 			levelTag.Add(new NbtInt("zPos", chunk.z));
 			levelTag.Add(new NbtByteArray("Biomes", chunk.biomeId));

-			NbtList sectionsTag = new NbtList("Sections");
+			NbtList sectionsTag = new NbtList("Sections", NbtTagType.Compound);
 			levelTag.Add(sectionsTag);

 			for (int i = 0; i < 16; i++)
 			{
+				var section = chunk.chunks[i];
+				if (section.IsAllAir()) continue;
+
 				NbtCompound sectionTag = new NbtCompound();
 				sectionsTag.Add(sectionTag);
 				sectionTag.Add(new NbtByte("Y", (byte) i));

-				var section = chunk.chunks[i];
 				byte[] blocks = new byte[4096];
 				byte[] data = new byte[2048];
 				byte[] blockLight = new byte[2048];
 				byte[] skyLight = new byte[2048];

-				if (!section.IsAllAir())
 				{
 					for (int x = 0; x < 16; x++)
 					{
@@ -796,11 +797,6 @@
 						}
 					}
 				}
-				else
-				{
-					ChunkColumn.Fill<byte>(skyLight, 0xff);
-				}
-
 				sectionTag.Add(new NbtByteArray("Blocks", blocks));
 				sectionTag.Add(new NbtByteArray("Data", data));
 				sectionTag.Add(new NbtByteArray("BlockLight", blockLight));


Show an overlay message if headphones are connected/disconnected.

--- src/Neptunium/ViewModel/AppShellViewModel.cs
+++ src/Neptunium/ViewModel/AppShellViewModel.cs
@@ -15,6 +15,7 @@
 using Windows.Services.Store;
 using Windows.Foundation;
 using Windows.UI.Xaml;
+using Neptunium.Core.Media.Audio;

 namespace Neptunium.ViewModel
 {
@@ -77,12 +78,29 @@
             NepApp.SongManager.PreSongChanged += SongManager_PreSongChanged;
             NepApp.SongManager.SongChanged += SongManager_SongChanged;
             NepApp.SongManager.StationRadioProgramStarted += SongManager_StationRadioProgramStarted;
+            NepApp.MediaPlayer.Audio.HeadsetDetector.IsHeadsetPluggedInChanged += HeadsetDetector_IsHeadsetPluggedInChanged;
+
+            if (NepApp.MediaPlayer.Audio.HeadsetDetector.IsHeadsetPluggedIn)
+            {
+                ShowOverlayForHeadphonesStatus(true);
+            }

             if (UserProfilePersonalizationSettings.IsSupported())
             {
                 NepApp.SongManager.SongArtworkAvailable += SongManager_SongArtworkAvailable;
                 NepApp.SongManager.NoSongArtworkAvailable += SongManager_NoSongArtworkAvailable;
             }
+        }
+
+        private void HeadsetDetector_IsHeadsetPluggedInChanged(object sender, EventArgs e)
+        {
+            bool isPluggedIn = ((IHeadsetDetector)sender).IsHeadsetPluggedIn;
+            ShowOverlayForHeadphonesStatus(isPluggedIn);
+        }
+
+        private static void ShowOverlayForHeadphonesStatus(bool isPluggedIn)
+        {
+            NepApp.UI.Overlay.ShowSnackBarMessageAsync(isPluggedIn ? "Headphones connected." : "Headphones disconnected.");
         }

         private async void SongManager_NoSongArtworkAvailable(object sender, Media.Songs.NepAppSongMetadataArtworkEventArgs e)


NTFS: Fix reading of compressed streams containing uncompressed blocks.

--- src/Ntfs/NonResidentAttributeExtentStream.cs
+++ src/Ntfs/NonResidentAttributeExtentStream.cs
@@ -366,13 +366,13 @@
                 if ((header & SubBlockIsCompressedFlag) == 0)
                 {
                     // not compressed
-                    if ((header & SubBlockSizeMask) != SubBlockSize)
+                    if ((header & SubBlockSizeMask) + 1 != SubBlockSize)
                     {
                         throw new IOException("Found short non-compressed sub-block");
                     }
-                    Array.Copy(compBuffer, sourceIdx, resultBuffer, destIdx, (header & SubBlockSizeMask));
-                    sourceIdx += (header & SubBlockSizeMask);
-                    destIdx += (header & SubBlockSizeMask);
+                    Array.Copy(compBuffer, sourceIdx, resultBuffer, destIdx, SubBlockSize);
+                    sourceIdx += SubBlockSize;
+                    destIdx += SubBlockSize;
                 }
                 else
                 {


fixed lower triangle bug

fixed lower triangle bug

--- src/Numerics/LinearAlgebra/Generic/Matrix.cs
+++ src/Numerics/LinearAlgebra/Generic/Matrix.cs
@@ -473,7 +473,7 @@

             for (var row = 0; row < RowCount; row++)
             {
-                for (var column = 0; column <= row; column++)
+                for (var column = 0; column <= ColumnCount; column++)
                 {
                     ret.At(row, column, At(row, column));
                 }


PERF: Code hashcode value.

PERF: Code hashcode value.

--- src/Server/FileSystemNames/FileSystemName.cs
+++ src/Server/FileSystemNames/FileSystemName.cs
@@ -28,6 +28,11 @@
   ///       Parent = null
   /// </summary>
   public abstract class FileSystemName : IComparable<FileSystemName>, IEquatable<FileSystemName> {
+    /// <summary>
+    /// HashCode cache.
+    /// </summary>
+    private int _hashCode;
+
     /// <summary>
     /// Returns the parent directory, or null if <see cref="IsAbsoluteName"/> is true.
     /// </summary>
@@ -85,7 +90,9 @@
     }

     public override int GetHashCode() {
-      return FileSystemNameComparer.Instance.GetHashCode(this);
+      if (_hashCode == 0)
+         _hashCode = FileSystemNameComparer.Instance.GetHashCode(this);
+      return _hashCode;
     }

     public override bool Equals(object other) {


Implemented new Highlight method

Implemented new Highlight method

--- src/Skybrud.SyntaxHighlighter/Highlighter.cs
+++ src/Skybrud.SyntaxHighlighter/Highlighter.cs
@@ -10,6 +10,46 @@
 namespace Skybrud.SyntaxHighlighter {

     public class Highlighter {
+
+        ///
+        /// Highlights the specified <paramref name="source"/>.
+        ///
+        /// <param name="source">The source / code to be highlighted.</param>
+        /// <param name="language">The language to be used.</param>
+        /// <returns>The highlighted source.</returns>
+        public static string Highlight(string source, Language language) {
+
+            try {
+
+                switch (language) {
+
+                    case Language.CSharp:
+                        return HighlightCSharp(source);
+
+                    case Language.Json:
+                        return HighlightJson(source);
+
+                    case Language.JavaScript:
+                        return HighlightJavaScript(source);
+
+                    case Language.Html:
+                        return HighlightHtml(source);
+
+                    case Language.Xml:
+                        return HighlightXml(source);
+
+                    default:
+                        return "

" + source + "

";
+
+                }
+
+            } catch (Exception) {
+
+                return "

" + source + "

";
+
+            }
+
+        }

         public static string HighlightCSharp(string source) {
             return new CSharpHighlighter().Highlight(source);


Added XPChanger

Added XPChanger

--- PlayerLevel.cs
+++ PlayerLevel.cs
@@ -8,31 +8,44 @@
 	 * This script keeps track of the player's experience level and total experience
 	 */

-	public int CurrentLevel, TotalExperience;
-	XPLevels LevelSystem;
+	public int CurrentLevel, TotalExperience, XPDifference;
+	private XPLevels LevelSystem;
 	private int MaxExperience;
+    private AudioSource XPCounterBeep;

-	void Start ()
+    void Start ()
 	{
 		LevelSystem = GameObject.Find("LevelManager").GetComponent<XPLevels>();
-	}
+        XPCounterBeep = gameObject.GetComponent<AudioSource>();
+    }

 	void Update () {
-		int temp = LevelSystem.Levels[0];

-		if (MaxExperience == 0)
+        XPChanger();
+
+        //calculate the maximum experience possible
+        int temp = LevelSystem.Levels[0];
+        if (MaxExperience == 0)
+        {
+            for (int i = 0; i < 64; i++)
+            {
+                MaxExperience += LevelSystem.Levels[i];
+            }
+        }
+        //limits the XP to between 0 and the maximum value
+        if (TotalExperience < 0)
+        {
+            TotalExperience = 0;
+            CurrentLevel = 0;
+            XPDifference = 0;
+        }
+        else if (TotalExperience > MaxExperience)
 		{
-			for (int i = 0; i < 64; i++)
-			{
-				MaxExperience += LevelSystem.Levels[i]; //calculate the maximum experience possible
-			}
+			TotalExperience = MaxExperience;
+            XPDifference = 0;
 		}

-		if (TotalExperience > MaxExperience)
-		{
-			TotalExperience = MaxExperience;
-		}
-
+        //sets the correct experience level
 		if (TotalExperience == MaxExperience)
 		{
 			CurrentLevel = 64;
@@ -53,4 +66,33 @@
 			}
 		}
 	}
+    void XPChanger()
+    {
+        /*
+		 * instead of instantly changing the money amount to the required value,
+		 * this system animates the counter.
+		 */
+        int TempIncreaser = XPDifference / 10;
+        if (TempIncreaser == 0)
+        {
+            if (XPDifference < 0)
+            {
+                XPCounterBeep.Play();
+                TotalExperience--;
+                XPDifference++;
+            }
+            else if (XPDifference > 0)
+            {
+                XPCounterBeep.Play();
+                TotalExperience++;
+                XPDifference--;
+            }
+        }
+        if (XPDifference != 0)
+        {
+            XPCounterBeep.Play();
+            TotalExperience += TempIncreaser;
+            XPDifference -= TempIncreaser;
+        }
+    }
 }


Reduce PreviewDirectoryChanged logging to trace

This can happen a *lot*, and the only cost is that of the logging

--- src/SyncTrayzor/Services/DirectoryWatcher.cs
+++ src/SyncTrayzor/Services/DirectoryWatcher.cs
@@ -183,7 +183,7 @@
             {
                 var ea = new PreviewDirectoryChangedEventArgs(this.directory, subPath);
                 handler(this, ea);
-                logger.Debug("PreviewDirectoryChanged with path {0}. Cancelled: {1}", Path.Combine(this.directory, subPath), ea.Cancel);
+                logger.Trace("PreviewDirectoryChanged with path {0}. Cancelled: {1}", Path.Combine(this.directory, subPath), ea.Cancel);
                 return ea.Cancel;
             }
             return false;


Fix Guid tests using netfx (#17792)

Fix Guid tests using netfx (#17792)

--- src/System.Runtime/tests/System/GuidTests.cs
+++ src/System.Runtime/tests/System/GuidTests.cs
@@ -36,11 +36,17 @@
         }

         [Fact]
-        public static void Ctor_ByteArray_Invalid()
-        {
-            Assert.Throws<ArgumentNullException>("b", () => new Guid((byte[])null)); // Byte array is null
-            Assert.Throws<ArgumentException>("b", () => new Guid(new byte[15])); // Byte array is not 16 bytes long
-            Assert.Throws<ArgumentException>("b", () => new Guid(new byte[17])); // Byte array is not 16 bytes long
+        public static void Ctor_NullByteArray_ThrowsArgumentNullException()
+        {
+            Assert.Throws<ArgumentNullException>("b", () => new Guid((byte[])null));
+        }
+
+        [Theory]
+        [InlineData(15)]
+        [InlineData(17)]
+        public static void Ctor_InvalidLengthByteArray_ThrowsArgumentException(int length)
+        {
+            AssertExtensions.Throws<ArgumentException>("b", null, () => new Guid(new byte[length]));
         }

         [Theory]
@@ -52,6 +58,7 @@

         [Theory]
         [MemberData(nameof(GuidStrings_Invalid_TestData))]
+        [MemberData(nameof(GuidStrings_TryParseThrows_TestData))]
         public static void Ctor_String_Invalid(string value, Type exceptionType)
         {
             Assert.Throws(exceptionType, () => new Guid(value));
@@ -73,11 +80,16 @@
         }

         [Fact]
-        public static void Ctor_Int_Short_Short_ByteArray_Invalid()
-        {
-            Assert.Throws<ArgumentNullException>("d", () => new Guid(0, 0, 0, null)); // Byte array is null
-            Assert.Throws<ArgumentException>("d", () => new Guid(0, 0, 0, new byte[7])); // Byte array is not 8 bytes long
-            Assert.Throws<ArgumentException>("d", () => new Guid(0, 0, 0, new byte[9])); // Byte array is not 8 bytes long
+        public static void Ctor_Int_Short_Short_ByteArray_NullByteArray_ThrowsArgumentNullException()
+        {
+            Assert.Throws<ArgumentNullException>("d", () => new Guid(0, 0, 0, null));
+        }
+
+        [Fact]
+        public static void Ctor_Int_Short_Short_ByteArray_InvalidLengthByteArray_ThrowsArgumentException()
+        {
+            AssertExtensions.Throws<ArgumentException>("d", null, () => new Guid(0, 0, 0, new byte[7]));
+            AssertExtensions.Throws<ArgumentException>("d", null, () => new Guid(0, 0, 0, new byte[9]));
         }

         [Fact]
@@ -146,6 +158,25 @@
             Guid result3;
             Assert.True(Guid.TryParseExact(input, format.ToLowerInvariant(), out result3)); // Format should be case insensitive
             Assert.Equal(expected, result3);
+        }
+
+        [Theory]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp, "The coreclr fixed a bug where Guid.TryParse throws a format or overflow exception (https://github.com/dotnet/corefx/issues/6316)")]
+        [MemberData(nameof(GuidStrings_TryParseThrows_TestData))]
+        public static void Parse_Invalid_Netfx(string input, Type exceptionType)
+        {
+            Guid result = default(Guid);
+            Assert.Throws(exceptionType, () => Guid.TryParse(input, out result));
+            Assert.Equal(default(Guid), result);
+
+            Assert.Throws(exceptionType, () => Guid.Parse(input));
+        }
+
+        [Theory]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The full .NET framework has a bug where Guid.TryParse throws a format or overflow exception")]
+        public static void Parse_Invalid_NetcoreApp(string input, Type exceptionType)
+        {
+            Parse_Invalid(input, exceptionType);
         }

         [Theory]
@@ -267,7 +298,7 @@
         public static void CompareTo_ValueNotGuid_ThrowsArgumentException()
         {
             IComparable comparable = s_testGuid;
-            Assert.Throws<ArgumentException>("value", () => comparable.CompareTo("a8a110d5-fc49-43c5-bf46-802db8f843ff")); // Value is not a guid
+            AssertExtensions.Throws<ArgumentException>("value", null, () => comparable.CompareTo("a8a110d5-fc49-43c5-bf46-802db8f843ff"));
         }

         public static IEnumerable<object[]> Equals_TestData()
@@ -447,7 +478,6 @@
             yield return new object[] { "{dddddddd-dddd-dddd-dddd-dddddddd)", typeof(FormatException) }; // 8-4-4-4-8 with trailing parenthesis and leading brace

             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) }; // 8-4-4-{2-2-2-2-2-2-2-2} - missing group
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) }; // 8-4-4-{2-2-2-2-2-2-2-2} - extra group

             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd", typeof(FormatException) }; // 8-4-4-{2-2-2-2-2-2-2-2} without a trailing brace
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}", typeof(FormatException) }; // 8-4-4-{2-2-2-2-2-2-2-2} without a trailing brace
@@ -502,54 +532,40 @@
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xddddd,{0xdd,0xddd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             // Invalid length of 4th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xddddddddd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdddddddd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xddd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             // Invalid length of 5th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xddddddddd,0xdd,0xddd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdddddddd,0xdd,0xddd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xddd,0xdd,0xddd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             // Invalid length of 6th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xddddddddd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdddddddd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xddd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             // Invalid length of 7th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xddddddddd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdddddddd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xddd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             // Invalid length of 8th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xddddddddd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdddddddd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xddd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             // Invalid length of 9th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xddddddddd,0xdd,0xdd}}", typeof(OverflowException) };
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd0xdddddddd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xddd,0xdd,0xdd}}", typeof(FormatException) };

             // Invalid length of 10th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xddddddddd,0xdd}}", typeof(OverflowException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdddddddd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xddd,0xdd}}", typeof(FormatException) };

             // Invalid length of 11th argument
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xddddddddd}}", typeof(OverflowException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdddddddd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xddd}}", typeof(FormatException) };

             // Missing a comma
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd0xdd}}", typeof(FormatException) };

+            // Extra characters at the end
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}abc", typeof(FormatException) };

             // Missing all components (ordered)
@@ -632,38 +648,71 @@
             yield return new object[] { "{0xdddddddd,0xdddd,0xGddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdGdd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xddddddd,0xdddd,0x-dddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xddddddd,0xdddd,0xdddd,{0x-dd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0x-dd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0x-dd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0x-dd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0x-dd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0x-dd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0x-dd,0xdd}}", typeof(FormatException) };
+
+            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0x-dd}}", typeof(FormatException) };
+        }
+
+        public static IEnumerable<object[]> GuidStrings_TryParseThrows_TestData()
+        {
+            // 8-4-4-{2-2-2-2-2-2-2-2} - extra group
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+
+            // Missing a comma
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd0xdddddddd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd0xdd,0xdd,0xdd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd0xdd,0xdd}}", typeof(FormatException) };

             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xGd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdG,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xddddddd,0xdddd,0xdddd,{0x-dd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xGd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdG,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0x-dd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xGd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdG,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0x-dd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xGd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdG,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0x-dd,0xdd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xGd,0xdd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdG,0xdd,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0x-dd,0xdd,0xdd,0xdd}}", typeof(FormatException) };

             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xGd,0xdd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdG,0xdd,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0x-dd,0xdd,0xdd}}", typeof(FormatException) };

             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xGd,0xdd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdG,0xdd}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0x-dd,0xdd}}", typeof(FormatException) };
-
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xGd}}", typeof(FormatException) };
             yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdG}}", typeof(FormatException) };
-            yield return new object[] { "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0x-dd}}", typeof(FormatException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xddddddddd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xddddddddd,0xdd,0xddd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xddddddddd,0xdd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
+
+            // Invalid length of 7th element
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xddddddddd,0xdd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
+
+            // Invalid length of 8th element
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xddddddddd,0xdd,0xdd,0xdd}}", typeof(OverflowException) };
+
+            // Invalid length of 9th element
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xddddddddd,0xdd,0xdd}}", typeof(OverflowException) };
+
+            // Invalid length of 10th element
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xddddddddd,0xdd}}", typeof(OverflowException) };
+
+            // Invalid length of 11th element
+            yield return new object[] { "{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xddddddddd}}", typeof(OverflowException) };
         }

         public static IEnumerable<object[]> GuidStrings_Format_Invalid_TestData()


Fixed gaze vector settings parsing

Fixed gaze vector settings parsing

--- QTMSettings.cs
+++ QTMSettings.cs
@@ -170,12 +170,19 @@
         public List<ImageCamera> cameraList;
     }

-    /// Gaze vector Settings from QTM
+    ///  Gaze vector name from QTM.
+    public class GazeVectorName
+    {
+        [XmlElement("Name")]
+        public string name;
+    }
+
+    ///  Gaze vector Settings from QTM.
     [XmlRoot("Gaze_Vector")]
     public class SettingsGazeVector
     {
-        [XmlElement("Name")]
-        public string Name;
+        [XmlElement("Vector")]
+        public List<GazeVectorName> gazeVectorList;
     }

     /// General settings for Camera System


fix logged in player validation in match controller (only needs one of the match players to be the currently logged on user)

--- src/TournamentTracker/Api/MatchController.cs
+++ src/TournamentTracker/Api/MatchController.cs
@@ -79,7 +79,7 @@
         public async Task<IActionResult> Post([FromBody]MatchModel model)
         {
             var currentUserId = _userManager.GetUserId(User);
-            if (model == null || (model.PlayerOneId != currentUserId||model.PlayerTwoId != currentUserId))
+            if (model == null || (model.PlayerOneId != currentUserId && model.PlayerTwoId != currentUserId))
                 return BadRequest();

             var match = new Match()


Refactoring the code.

Refactoring the code.

--- TreeEdit/Spg.TreeEdit.Mapping/GumTreeMapping.cs
+++ TreeEdit/Spg.TreeEdit.Mapping/GumTreeMapping.cs
@@ -69,7 +69,6 @@
                             }
                         }
                     }
-                    int i = 0;
                     foreach (var item1 in h1)
                     {
                         foreach (var item2 in h2)
@@ -140,11 +139,17 @@
             return M;
         }

+        /// <summary>
+        /// GumTree bottom up approach
+        /// </summary>
+        /// <param name="t1">First tree</param>
+        /// <param name="t2">Second tree</param>
+        /// <param name="M">Previous mapping</param>
+        /// <returns></returns>
         public Dictionary<ITreeNode<T>, ITreeNode<T>> BottomUp(ITreeNode<T> t1, ITreeNode<T> t2, Dictionary<ITreeNode<T>, ITreeNode<T>> M)
         {
             var traversal = new TreeTraversal<T>();
             var t1Nodes = traversal.PostOrderTraversal(t1);
-            var MT = new Dictionary<ITreeNode<T>, ITreeNode<T>>();
             foreach (var t1Node in t1Nodes)
             {
                 if (!M.ContainsKey(t1Node) && HasMatchedChildren(t1Node, M))
@@ -170,51 +175,51 @@
             return M;
         }

+        /// <summary>
+        /// Remove previous mapped nodes.
+        /// </summary>
+        /// <param name="t">Tree</param>
+        /// <param name="M">Mapping</param>
         private void RemoveFromM(ITreeNode<T> t, Dictionary<ITreeNode<T>, ITreeNode<T>> M)
         {
             var traversal = new TreeTraversal<T>();
             var elements = traversal.PostOrderTraversal(t);

-            foreach(var i in elements)
-            {
-                if (M.ContainsKey(i))
-                {
-                    M.Remove(i);
-                }
-            }
-        }
-
+            foreach (var snode in elements.Where(M.ContainsKey))
+            {
+                M.Remove(snode);
+            }
+        }
+
+        /// <summary>
+        /// Mapping between nodes without move operation
+        /// </summary>
+        /// <param name="t1">T1 tree</param>
+        /// <param name="t2">T2 tree</param>
+        /// <returns></returns>
         private Dictionary<ITreeNode<T>, ITreeNode<T>> Opt(ITreeNode<T> t1, ITreeNode<T> t2)
         {
             var zss = new CSharpZss<T>(t1, t2);
-
             var result = zss.Compute();
             var script = result.Item2;
-
             var dict = new Dictionary<ITreeNode<T>, ITreeNode<T>>();

-            foreach (var editOperation in script)
-            {
-                if(editOperation.Item1 != null && editOperation.Item2 != null)
+            foreach (var editOperation in script.Where(editOperation => editOperation.Item1 != null && editOperation.Item2 != null))
+            {
+                dict.Add(editOperation.Item1.InternalNode, editOperation.Item2.InternalNode);
+                var isomorphicPairs = IsomorphicManager<T>.AllPairOfIsomorphic(editOperation.Item1.InternalNode, editOperation.Item2.InternalNode);
+
+                if (IsomorphicManager<T>.IsIsomorphic(editOperation.Item1.InternalNode,
+                    editOperation.Item2.InternalNode))
                 {
                     dict.Add(editOperation.Item1.InternalNode, editOperation.Item2.InternalNode);
-                    var isomorphicPairs = IsomorphicManager<T>.AllPairOfIsomorphic(editOperation.Item1.InternalNode, editOperation.Item2.InternalNode);
-                    if (IsomorphicManager<T>.IsIsomorphic(editOperation.Item1.InternalNode,
-                        editOperation.Item2.InternalNode))
-                    {
-                        dict.Add(editOperation.Item1.InternalNode, editOperation.Item2.InternalNode);
-                    }
-
-                    foreach(var pair in isomorphicPairs)
-                    {
-                        if(!dict.ContainsKey(pair.Item1) && !dict.ContainsValue(pair.Item2))
-                        {
-                            dict.Add(pair.Item1, pair.Item2);
-                        }
-                    }
-                }
-            }
-
+                }
+
+                foreach (var pair in isomorphicPairs.Where(pair => !dict.ContainsKey(pair.Item1) && !dict.ContainsValue(pair.Item2)))
+                {
+                    dict.Add(pair.Item1, pair.Item2);
+                }
+            }
             return dict;
         }

@@ -225,9 +230,9 @@
         /// <param name="t">Tree t to be analyzed</param>
         /// <param name="M">Computed mapping</param>
         /// <returns>Tree t2 with the disired characteristic.</returns>
-        private bool HasMatchedChildren(ITreeNode<T> t, Dictionary<ITreeNode<T>, ITreeNode<T>> M)
-        {
-            return t.DescendantNodes().Any(ch => M.ContainsKey(ch));
+        private static bool HasMatchedChildren(ITreeNode<T> t, Dictionary<ITreeNode<T>, ITreeNode<T>> M)
+        {
+            return t.DescendantNodes().Any(M.ContainsKey);
         }

         private ITreeNode<T> Candidate(ITreeNode<T> t1, ITreeNode<T> t2, Dictionary<ITreeNode<T>, ITreeNode<T>> M)
@@ -254,7 +259,14 @@
             return smax;
         }

-        private double Dice(ITreeNode<T> t1, ITreeNode<T> t2, Dictionary<ITreeNode<T>, ITreeNode<T>> M)
+        /// <summary>
+        /// Compute the dice function between two trees.
+        /// </summary>
+        /// <param name="t1">First tree</param>
+        /// <param name="t2">Second tree</param>
+        /// <param name="M">Mapping</param>
+        /// <returns></returns>
+        private static double Dice(ITreeNode<T> t1, ITreeNode<T> t2, Dictionary<ITreeNode<T>, ITreeNode<T>> M)
         {
             if (t2 == null) return 0.0;

@@ -269,13 +281,19 @@

             double den = t1.DescendantNodes().Count + t2.DescendantNodes().Count();

-            double dice = (2.0 * count) / den;
+            double dice = 2.0 * count / den;
             return dice;
         }

+        /// <summary>
+        /// Compute the mapping between two trees.
+        /// </summary>
+        /// <param name="t1">First tree.</param>
+        /// <param name="t2">Second tree</param>
+        /// <returns>Mapping between two trees.</returns>
         public Dictionary<ITreeNode<T>, ITreeNode<T>> Mapping(ITreeNode<T> t1, ITreeNode<T> t2)
         {
-            Dictionary<ITreeNode<T>, ITreeNode<T>> M = TopDown(t1, t2);
+            var M = TopDown(t1, t2);
             M = BottomUp(t1, t2, M);
             return M;
         }


comments

comments

--- Assets/MRTK/Examples/Demos/EyeTracking/General/Scripts/TargetBehaviors/OnLoadStartScene.cs
+++ Assets/MRTK/Examples/Demos/EyeTracking/General/Scripts/TargetBehaviors/OnLoadStartScene.cs
@@ -1,5 +1,5 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See LICENSE in the project root for license information.
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.

 using UnityEngine;
 using UnityEngine.SceneManagement;


cleaning usings.

cleaning usings.

--- src/Umbraco.Web/Editors/ContentController.cs
+++ src/Umbraco.Web/Editors/ContentController.cs
@@ -4,11 +4,9 @@
 using System.Linq;
 using System.Net;
 using System.Net.Http;
-using System.Net.Http.Formatting;
 using System.Text;
 using System.Web.Http;
 using System.Web.Http.ModelBinding;
-using System.Web.Http.ModelBinding.Binders;
 using AutoMapper;
 using Umbraco.Core;
 using Umbraco.Core.Logging;
@@ -17,24 +15,15 @@
 using Umbraco.Core.Persistence.DatabaseModelDefinitions;
 using Umbraco.Core.Publishing;
 using Umbraco.Core.Services;
-using Umbraco.Web.Models;
 using Umbraco.Web.Models.ContentEditing;
 using Umbraco.Web.Models.Mapping;
 using Umbraco.Web.Mvc;
-using Umbraco.Web.Security;
 using Umbraco.Web.WebApi;
 using Umbraco.Web.WebApi.Binders;
 using Umbraco.Web.WebApi.Filters;
-using umbraco;
-using Umbraco.Core.Models;
-using Umbraco.Core.Dynamics;
-using umbraco.BusinessLogic.Actions;
 using umbraco.cms.businesslogic.web;
 using umbraco.presentation.preview;
-using Umbraco.Core.PropertyEditors;
-using Umbraco.Web.UI;
 using Constants = Umbraco.Core.Constants;
-using Notification = Umbraco.Web.Models.ContentEditing.Notification;

 namespace Umbraco.Web.Editors
 {


Update ParseResponse

Update ParseResponse

--- src/ZmopSharp.Certification/Certification.cs
+++ src/ZmopSharp.Certification/Certification.cs
@@ -61,15 +61,9 @@
             });
         }

-        public object ParseResponse(string response, string signature)
+        public JObject ParseResponse(string response, string signature)
         {
-            var result = _client.ParseResponse(response, signature);
-
-            return new
-            {
-                passed = result.Value<bool>("passed"),
-                failed_reason = result.Value<string>("failed_reason"),
-            };
+            return _client.ParseResponse(response, signature);
         }
     }
 }


Build(Dictionary) は上書き動作になるよう修正

Build(Dictionary) は上書き動作になるよう修正

要は Build の動作は既存と同じままになります。

--- Sdx.Web/Url.cs
+++ Sdx.Web/Url.cs
@@ -80,7 +80,10 @@
       var tmpList = new List<Dictionary<string, string>>() { add };
       string path = this.BuildPath();
       string query = this.BuildQueryString(
-        this.ParamList.Concat(tmpList).ToList()
+        this.ParamList
+          .Where(dic => add.ContainsKey(dic.First().Key) == false)
+          .Concat(tmpList)
+          .ToList()
       );
       return path + query;
     }


色々途中ですが、リモートに記録を残してはおきたいので一旦コミット

色々途中ですが、リモートに記録を残してはおきたいので一旦コミット

--- Sdx.Web/Url.cs
+++ Sdx.Web/Url.cs
@@ -52,16 +52,41 @@
       this.param_data[key] = value;
     }

-    private string BuildQueryString(Dictionary<string,string> param)
+    private string BuildQueryString(object param)
     {
-      List<string> param_list = new List<string>();
-      foreach (KeyValuePair<string, string> pair in param)
+      if(param is Dictionary<string, string>)
       {
-        var tmp = string.Format("{0}={1}", pair.Key, pair.Value);
-        param_list.Add(tmp);
+        //キャストしないとコンパイルエラーになる。。。微妙なので違う方法を探す
+        var superparam = (Dictionary<string, string>)param;
+        List<string> param_list = new List<string>();
+        foreach (KeyValuePair<string, string> pair in superparam)
+        {
+          var tmp = string.Format("{0}={1}", pair.Key, pair.Value);
+          param_list.Add(tmp);
+        }
+        var query = "?" + string.Join("&", param_list);
+        return query;
       }
-      var query = "?" + string.Join("&", param_list);
-      return query;
+
+      if(param is List<string>)
+      {
+        //クエリから取り除いて返す。LINQを使った処理がうまくいかないので
+        //とりあえず後回し
+        /*public string Build(List<string> param)
+        {
+          string path = this.BuildPath();
+          var param_list = new Dictionary<string, string>();
+          if (this.param_data.Count > 0)
+          {
+            var result = this.param_data.Where(item => item.Key != "sample");
+          }
+
+        }*/
+      }
+
+      //とりあえず適当な文字列を返しておく。テストでエラーになるのは認識済み。
+      var str = "hoge";
+      return str;
     }

     private string BuildPath()
@@ -106,5 +131,8 @@
       string query = this.BuildQueryString(param_list);
       return path + query;
     }
+
+
+
   }
 }