#115 #116 #117 Crashes in RDF/XML parser due to comments in containers/collectios + Added support for parsing nested resource descriptions in RDF/XML

--- RDFSharp/Model/Serializers/RDFXml.cs
+++ RDFSharp/Model/Serializers/RDFXml.cs
@@ -448,144 +448,9 @@
                         #endregion

                         #region elements
-                        //Parse resource elements, which are the childs of root node and represent the subjects
-                        if (rdfRDF.HasChildNodes)
-                        {
-                            var subjNodesEnum = rdfRDF.ChildNodes.GetEnumerator();
-                            while (subjNodesEnum != null && subjNodesEnum.MoveNext())
-                            {
-
-                                #region subj
-                                //Get the current resource node
-                                XmlNode subjNode = (XmlNode)subjNodesEnum.Current;
-
-                                //Skip comments
-                                if (subjNode.NodeType == XmlNodeType.Comment)
-                                {
-                                    continue;
-                                }
-
-                                //Assert resource as subject
-                                RDFResource subj = GetSubjectNode(subjNode, xmlBase, result);
-                                if (subj == null)
-                                {
-                                    continue;
-                                }
-                                #endregion
-
-                                #region predObjList
-                                //Parse pred elements, which are the childs of subj element
-                                if (subjNode.HasChildNodes)
-                                {
-                                    IEnumerator predNodesEnum = subjNode.ChildNodes.GetEnumerator();
-                                    while (predNodesEnum != null && predNodesEnum.MoveNext())
-                                    {
-
-                                        #region predicate
-                                        //Get the current pred node
-                                        RDFResource pred = null;
-                                        XmlNode predNode = (XmlNode)predNodesEnum.Current;
-
-                                        //Skip comments
-                                        if (predNode.NodeType == XmlNodeType.Comment)
-                                        {
-                                            continue;
-                                        }
-
-                                        //Get the predicate
-                                        if (predNode.NamespaceURI == String.Empty)
-                                        {
-                                            pred = new RDFResource(xmlBase + predNode.LocalName);
-                                        }
-                                        else
-                                        {
-                                            pred = (predNode.LocalName.StartsWith("autoNS") ?
-                                                                        new RDFResource(predNode.NamespaceURI) :
-                                                                        new RDFResource(predNode.NamespaceURI + predNode.LocalName));
-                                        }
-                                        #endregion
-
-                                        #region object
-                                        //Check if there is a "rdf:about" or a "rdf:resource" attribute
-                                        XmlAttribute rdfObject = (GetRdfAboutAttribute(predNode) ?? GetRdfResourceAttribute(predNode));
-                                        if (rdfObject != null)
-                                        {
-                                            //Attribute found, but we must check if it is "rdf:ID", "rdf:nodeID" or a relative Uri
-                                            String rdfObjectValue = ResolveRelativeNode(rdfObject, xmlBase);
-                                            RDFResource obj = new RDFResource(rdfObjectValue);
-                                            result.AddTriple(new RDFTriple(subj, pred, obj));
-                                            continue;
-                                        }
-                                        #endregion
-
-                                        #region typed literal
-                                        //Check if there is a "rdf:datatype" attribute
-                                        XmlAttribute rdfDatatype = GetRdfDatatypeAttribute(predNode);
-                                        if (rdfDatatype != null)
-                                        {
-                                            var dtype = RDFModelUtilities.GetDatatypeFromString(rdfDatatype.Value);
-                                            RDFTypedLiteral tLit = new RDFTypedLiteral(RDFModelUtilities.ASCII_To_Unicode(HttpUtility.HtmlDecode(predNode.InnerText)), dtype);
-                                            result.AddTriple(new RDFTriple(subj, pred, tLit));
-                                            continue;
-                                        }
-                                        //Check if there is a "rdf:parseType=Literal" attribute
-                                        XmlAttribute parseLiteral = GetParseTypeLiteralAttribute(predNode);
-                                        if (parseLiteral != null)
-                                        {
-                                            RDFTypedLiteral tLit = new RDFTypedLiteral(RDFModelUtilities.ASCII_To_Unicode(HttpUtility.HtmlDecode(predNode.InnerXml)), RDFModelEnums.RDFDatatypes.RDFS_LITERAL);
-                                            result.AddTriple(new RDFTriple(subj, pred, tLit));
-                                            continue;
-                                        }
-                                        #endregion
-
-                                        #region plain literal
-                                        //Check if there is a "xml:lang" attribute, or if a unique textual child
-                                        XmlAttribute xmlLang = GetXmlLangAttribute(predNode);
-                                        if (xmlLang != null || (predNode.HasChildNodes && predNode.ChildNodes.Count == 1 && predNode.ChildNodes[0].NodeType == XmlNodeType.Text))
-                                        {
-                                            RDFPlainLiteral pLit = new RDFPlainLiteral(RDFModelUtilities.ASCII_To_Unicode(HttpUtility.HtmlDecode(predNode.InnerText)), (xmlLang != null ? xmlLang.Value : String.Empty));
-                                            result.AddTriple(new RDFTriple(subj, pred, pLit));
-                                            continue;
-                                        }
-                                        #endregion
-
-                                        #region collection
-                                        //Check if there is a "rdf:parseType=Collection" attribute
-                                        XmlAttribute rdfCollect = GetParseTypeCollectionAttribute(predNode);
-                                        if (rdfCollect != null)
-                                        {
-                                            ParseCollectionElements(xmlBase, predNode, subj, pred, result);
-                                            continue;
-                                        }
-                                        #endregion
-
-                                        #region container
-                                        //Check if there is a "rdf:[Bag|Seq|Alt]" child node
-                                        XmlNode container = GetContainerNode(predNode);
-                                        if (container != null)
-                                        {
-                                            //Distinguish the right type of RDF container to build
-                                            if (container.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":Bag", StringComparison.Ordinal) || container.LocalName.Equals("Bag", StringComparison.Ordinal))
-                                            {
-                                                ParseContainerElements(RDFModelEnums.RDFContainerTypes.Bag, container, subj, pred, result);
-                                            }
-                                            else if (container.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":Seq", StringComparison.Ordinal) || container.LocalName.Equals("Seq", StringComparison.Ordinal))
-                                            {
-                                                ParseContainerElements(RDFModelEnums.RDFContainerTypes.Seq, container, subj, pred, result);
-                                            }
-                                            else if (container.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":Alt", StringComparison.Ordinal) || container.LocalName.Equals("Alt", StringComparison.Ordinal))
-                                            {
-                                                ParseContainerElements(RDFModelEnums.RDFContainerTypes.Alt, container, subj, pred, result);
-                                            }
-                                        }
-                                        #endregion
-
-                                    }
-                                }
-                                #endregion
-
-                            }
-                        }
+                        //Parse resource elements, which are the children of root node
+                        if (rdfRDF.HasChildNodes)
+                            ParseNodeList(rdfRDF.ChildNodes, result, xmlBase);
                         #endregion

                     }
@@ -603,6 +468,144 @@
         #endregion

         #region Utilities
+        /// <summary>
+        /// Parses the given list of nodes
+        /// </summary>
+        private static List<RDFResource> ParseNodeList(XmlNodeList nodeList, RDFGraph result, Uri xmlBase)
+        {
+            var subjects = new List<RDFResource>();
+            var subjNodesEnum = nodeList.GetEnumerator();
+            while (subjNodesEnum != null && subjNodesEnum.MoveNext())
+            {
+
+                #region subj
+                //Get the current resource node
+                XmlNode subjNode = (XmlNode)subjNodesEnum.Current;
+
+                //Skip comments
+                if (subjNode.NodeType == XmlNodeType.Comment)
+                    continue;
+
+                //Assert resource as subject
+                RDFResource subj = GetSubjectNode(subjNode, xmlBase, result);
+                if (subj == null)
+                    continue;
+                else
+                    subjects.Add(subj); //Collect the subject
+                #endregion
+
+                #region predObjList
+                //Parse pred elements, which are the childs of subj element
+                if (subjNode.HasChildNodes)
+                {
+                    IEnumerator predNodesEnum = subjNode.ChildNodes.GetEnumerator();
+                    while (predNodesEnum != null && predNodesEnum.MoveNext())
+                    {
+
+                        #region predicate
+                        //Get the current pred node
+                        RDFResource pred = null;
+                        XmlNode predNode = (XmlNode)predNodesEnum.Current;
+
+                        //Skip comments
+                        if (predNode.NodeType == XmlNodeType.Comment)
+                            continue;
+
+                        //Get the predicate
+                        if (predNode.NamespaceURI == String.Empty)
+                            pred = new RDFResource(xmlBase + predNode.LocalName);
+                        else
+                            pred = (predNode.LocalName.StartsWith("autoNS") ? new RDFResource(predNode.NamespaceURI)
+                                                                            : new RDFResource(predNode.NamespaceURI + predNode.LocalName));
+                        #endregion
+
+                        #region object
+                        //Check if there is a "rdf:about" or a "rdf:resource" attribute
+                        XmlAttribute rdfObject = (GetRdfAboutAttribute(predNode) ?? GetRdfResourceAttribute(predNode));
+                        if (rdfObject != null)
+                        {
+                            //Attribute found, but we must check if it is "rdf:ID", "rdf:nodeID" or a relative Uri
+                            String rdfObjectValue = ResolveRelativeNode(rdfObject, xmlBase);
+                            RDFResource obj = new RDFResource(rdfObjectValue);
+                            result.AddTriple(new RDFTriple(subj, pred, obj));
+                            continue;
+                        }
+                        #endregion
+
+                        #region typed literal
+                        //Check if there is a "rdf:datatype" attribute
+                        XmlAttribute rdfDatatype = GetRdfDatatypeAttribute(predNode);
+                        if (rdfDatatype != null)
+                        {
+                            var dtype = RDFModelUtilities.GetDatatypeFromString(rdfDatatype.Value);
+                            RDFTypedLiteral tLit = new RDFTypedLiteral(RDFModelUtilities.ASCII_To_Unicode(HttpUtility.HtmlDecode(predNode.InnerText)), dtype);
+                            result.AddTriple(new RDFTriple(subj, pred, tLit));
+                            continue;
+                        }
+                        //Check if there is a "rdf:parseType=Literal" attribute
+                        XmlAttribute parseLiteral = GetParseTypeLiteralAttribute(predNode);
+                        if (parseLiteral != null)
+                        {
+                            RDFTypedLiteral tLit = new RDFTypedLiteral(RDFModelUtilities.ASCII_To_Unicode(HttpUtility.HtmlDecode(predNode.InnerXml)), RDFModelEnums.RDFDatatypes.RDFS_LITERAL);
+                            result.AddTriple(new RDFTriple(subj, pred, tLit));
+                            continue;
+                        }
+                        #endregion
+
+                        #region plain literal
+                        //Check if there is a "xml:lang" attribute, or if a unique textual child
+                        XmlAttribute xmlLang = GetXmlLangAttribute(predNode);
+                        if (xmlLang != null || (predNode.HasChildNodes && predNode.ChildNodes.Count == 1 && predNode.ChildNodes[0].NodeType == XmlNodeType.Text))
+                        {
+                            RDFPlainLiteral pLit = new RDFPlainLiteral(RDFModelUtilities.ASCII_To_Unicode(HttpUtility.HtmlDecode(predNode.InnerText)), (xmlLang != null ? xmlLang.Value : String.Empty));
+                            result.AddTriple(new RDFTriple(subj, pred, pLit));
+                            continue;
+                        }
+                        #endregion
+
+                        #region collection
+                        //Check if there is a "rdf:parseType=Collection" attribute
+                        XmlAttribute rdfCollect = GetParseTypeCollectionAttribute(predNode);
+                        if (rdfCollect != null)
+                        {
+                            ParseCollectionElements(xmlBase, predNode, subj, pred, result);
+                            continue;
+                        }
+                        #endregion
+
+                        #region container
+                        //Check if there is a "rdf:[Bag|Seq|Alt]" child node
+                        XmlNode container = GetContainerNode(predNode);
+                        if (container != null)
+                        {
+                            //Distinguish the right type of RDF container to build
+                            if (container.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":Bag", StringComparison.Ordinal) || container.LocalName.Equals("Bag", StringComparison.Ordinal))
+                                ParseContainerElements(RDFModelEnums.RDFContainerTypes.Bag, container, subj, pred, result);
+                            else if (container.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":Seq", StringComparison.Ordinal) || container.LocalName.Equals("Seq", StringComparison.Ordinal))
+                                ParseContainerElements(RDFModelEnums.RDFContainerTypes.Seq, container, subj, pred, result);
+                            else if (container.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":Alt", StringComparison.Ordinal) || container.LocalName.Equals("Alt", StringComparison.Ordinal))
+                                ParseContainerElements(RDFModelEnums.RDFContainerTypes.Alt, container, subj, pred, result);
+                        }
+                        #endregion
+
+                        #region nested description
+                        //At last, check for nested resource descriptions
+                        if (predNode.HasChildNodes)
+                        {
+                            var nestedSubjects = ParseNodeList(predNode.ChildNodes, result, xmlBase);
+                            foreach (var nestedSubject in nestedSubjects)
+                                result.AddTriple(new RDFTriple(subj, pred, nestedSubject));
+                        }
+                        #endregion
+
+                    }
+                }
+                #endregion
+
+            }
+            return subjects;
+        }
+
         /// <summary>
         /// Gives the "rdf:RDF" root node of the document
         /// </summary>
@@ -929,6 +932,10 @@
                 {
                     XmlNode elem = (XmlNode)elems.Current;

+                    //Skip comments
+                    if (elem.NodeType == XmlNodeType.Comment)
+                        continue;
+
                     //Try to get items as "rdf:about" attributes, or as "rdf:resource"
                     XmlAttribute elemUri =
                         (GetRdfAboutAttribute(elem) ??
@@ -994,9 +1001,7 @@
                 XmlNode containerNode = predNode.FirstChild;
                 Boolean isRdfContainer = CheckIfRdfContainerNode(containerNode);
                 if (isRdfContainer)
-                {
                     return containerNode;
-                }
             }

             return null;
@@ -1036,6 +1041,11 @@
                 while (elems != null && elems.MoveNext())
                 {
                     XmlNode elem = (XmlNode)elems.Current;
+
+                    //Skip comments
+                    if (elem.NodeType == XmlNodeType.Comment)
+                        continue;
+
                     XmlAttribute elemUri = GetRdfResourceAttribute(elem);

                     #region Container Resource Item


Abstract class should have a protected constructor, not public

svn path=/trunk/bitsharp/; revision=67062

--- src/MonoTorrent.Common/Peer.cs
+++ src/MonoTorrent.Common/Peer.cs
@@ -71,7 +71,7 @@
         }
         private int lastMessageRecieved;

-        public Peer(IPEndPoint peerEndpoint, string peerId)
+        protected Peer(IPEndPoint peerEndpoint, string peerId)
         {
             this.peerEndpoint = peerEndpoint;
             this.peerId = peerId;


Fixes #354

Fixes #354

--- src/Myra/Graphics2D/UI/Menu.cs
+++ src/Myra/Graphics2D/UI/Menu.cs
@@ -573,7 +573,7 @@
 				return;
 			}

-			if (menuItem.CanOpen && OpenMenuItem != menuItem)
+			if (Desktop.ContextMenu != this && menuItem.CanOpen && OpenMenuItem != menuItem)
 			{
 				SelectedIndex = HoverIndex;
 			}
@@ -582,7 +582,11 @@
 		private void ShowSubMenu(MenuItem menuItem)
 		{
 			var bounds = GetItemBounds(menuItem.Index);
-			Desktop.ShowContextMenu(menuItem.SubMenu, new Point(bounds.X, bounds.Bottom));
+
+			var pos = this is HorizontalMenu ? new Point(bounds.X, bounds.Bottom) : new Point(bounds.Right, bounds.Y);
+			pos = ToGlobal(pos);
+
+			Desktop.ShowContextMenu(menuItem.SubMenu, pos);
 			OpenMenuItem = menuItem;
 		}

@@ -593,7 +597,11 @@
 				try
 				{
 					_internalSetSelectedIndex = true;
-					Desktop.HideContextMenu();
+
+					if (Desktop.ContextMenu != this)
+					{
+						Desktop.HideContextMenu();
+					}
 				}
 				finally
 				{


(V1.0.0) Code cleanups;

(V1.0.0) Code cleanups;

--- RDFSharp/Model/Serializers/RDFXml.cs
+++ RDFSharp/Model/Serializers/RDFXml.cs
@@ -145,7 +145,6 @@
                             XmlAttribute subjNodeDesc      = null;
                             XmlText subjNodeDescText       = rdfDoc.CreateTextNode(group.Key.subj);
                             if (group.Key.subj.StartsWith("bnode:")) {
-                                subjNodeDescText.InnerText = subjNodeDescText.InnerText.Replace("bnode:", String.Empty);
                                 subjNodeDesc               = rdfDoc.CreateAttribute(RDFVocabulary.RDF.PREFIX + ":nodeID", RDFVocabulary.RDF.BASE_URI);
                             }
                             //<rdf:Description rdf:about="subjURI">
@@ -213,7 +212,6 @@
                                         XmlText predNodeDescText       = rdfDoc.CreateTextNode(objString);
                                         //  rdf:nodeID="blankID">
                                         if (objString.StartsWith("bnode:")) {
-                                            predNodeDescText.InnerText = predNodeDescText.InnerText.Replace("bnode:", String.Empty);
                                             predNodeDesc               = rdfDoc.CreateAttribute(RDFVocabulary.RDF.PREFIX + ":nodeID", RDFVocabulary.RDF.BASE_URI);
                                         }
                                         //  rdf:resource="objURI">
@@ -627,25 +625,23 @@
         /// </summary>
         internal static String ResolveRelativeNode(XmlAttribute attr, Uri xmlBase) {
             if (attr               != null && xmlBase != null) {
-                String attrValue    = attr.Value;
+                String attrValue   = attr.Value;

                 //"rdf:ID" relative Uri: must be resolved against the xmlBase namespace
-                if (attr.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":ID", StringComparison.Ordinal) ||
-                    attr.LocalName.Equals("ID", StringComparison.Ordinal)) {
-                    attrValue       = RDFModelUtilities.GetUriFromString(xmlBase + attrValue).ToString();
+                if (attr.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":ID", StringComparison.Ordinal) || attr.LocalName.Equals("ID", StringComparison.Ordinal)) {
+                    attrValue      = RDFModelUtilities.GetUriFromString(xmlBase + attrValue).ToString();
                 }

                 //"rdf:nodeID" relative Uri: must be resolved against the "bnode:" prefix
-                else if (attr.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":nodeID", StringComparison.Ordinal) ||
-                         attr.LocalName.Equals("nodeID", StringComparison.Ordinal)) {
+                else if (attr.LocalName.Equals(RDFVocabulary.RDF.PREFIX + ":nodeID", StringComparison.Ordinal) || attr.LocalName.Equals("nodeID", StringComparison.Ordinal)) {
                     if (!attrValue.StartsWith("bnode:")) {
-                         attrValue  = "bnode:" + attrValue;
+                         attrValue = "bnode:" + attrValue;
                     }
                 }

                 //"rdf:about" or "rdf:resource" relative Uri: must be resolved against the xmlBase namespace
                 else if (RDFModelUtilities.GetUriFromString(attrValue) == null) {
-                    attrValue       = RDFModelUtilities.GetUriFromString(xmlBase + attrValue).ToString();
+                    attrValue      = RDFModelUtilities.GetUriFromString(xmlBase + attrValue).ToString();
                 }

                 return attrValue;


Commented out the bit where "in ()" expression is generated - it doesn't work on most databases

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@1690

--- src/NHibernate.Test/FumTest.cs
+++ src/NHibernate.Test/FumTest.cs
@@ -82,14 +82,15 @@
 				Assert.IsTrue( b.MapComponent.Fummap.Count == 1 );
 				Assert.IsTrue( b.MapComponent.Stringmap.Count == 2 );

-				if( !( dialect is Dialect.MySQLDialect ) )
+				/* This is commented out in H2.1 - 'field in ()' doesn't work on a lot of databases
+				if( !( dialect is Dialect.MySQLDialect ) && !( dialect is Dialect.Oracle9Dialect ) )
 				{
-					// "in ()" doesn't work on MySQL
 					int none = s.CreateCriteria( typeof( Fum ) )
 						.Add( Expression.Expression.In( "FumString", new string[0] ) )
 						.List().Count;
 					Assert.AreEqual( 0, none );
 				}
+				*/
 				s.Delete( b );
 				s.Flush();
 			}


Fixing logger initialization dependency.

--- Radacode.PowerArm/PowerArmPackage.cs
+++ Radacode.PowerArm/PowerArmPackage.cs
@@ -119,7 +119,14 @@
             Logger logger = null;
             await System.Threading.Tasks.Task.Run(() =>
             {
-                logger = new Logger(_loggerLogin, _loggerPassword, _loggerLogin, _loggerAudienceId);
+                try
+                {
+                    logger = new Logger(_loggerLogin, _loggerPassword, _loggerLogin, _loggerAudienceId);
+                }
+                catch
+                {
+                    logger = null;
+                }
             });

             return logger;


interface doc

interface doc

--- ReadingList/Trello/IWebHookCaller.cs
+++ ReadingList/Trello/IWebHookCaller.cs
@@ -3,8 +3,18 @@

 namespace ReadingList
 {
+	/// <summary>
+	/// Web hook caller.
+	/// </summary>
 	public interface IWebHookCaller
 	{
+		/// <summary>
+		/// Sets up web hook, fire and forget style
+		/// </summary>
+		/// <returns>The up web hook.</returns>
+		/// <param name="webHook">Web hook.</param>
+		/// <param name="apiKey">API key.</param>
+		/// <param name="token">Token.</param>
 		Task SetUpWebHook(TrelloWebhook webHook, string apiKey, string token);
 	}
 }


Fix XML docs typo

Fix XML docs typo

--- src/Nancy/Json/JsonSettings.cs
+++ src/Nancy/Json/JsonSettings.cs
@@ -27,7 +27,7 @@

         /// <summary>
         /// Set to true to retain the casing used in the C# code in produced JSON.
-        /// Set to false to use camelCasig in the produced JSON.
+        /// Set to false to use camelCasing in the produced JSON.
         /// False by default.
         /// </summary>
         public static bool RetainCasing { get; set; }
@@ -50,4 +50,4 @@
             RetainCasing = false;
         }
     }
-}+}


adds an implicit convert from GeoPoint to string

--- src/Nest.Searchify/GeoPoint.cs
+++ src/Nest.Searchify/GeoPoint.cs
@@ -45,13 +45,18 @@
             throw new ArgumentNullException(nameof(value), "No GeoPoint value specified");
         }

-		/// <summary>
-		/// Represents a Latitude/Longitude as a 2 dimensional point.
-		/// </summary>
-		/// <param name="lat">Value between -90 and 90</param>
-		/// <param name="lon">Value between -180 and 180</param>
-		/// <exception cref="ArgumentOutOfRangeException">If <paramref name="lat"/> or <paramref name="lon"/> are invalid</exception>
-		public GeoPoint(double lat, double lon)
+        public static implicit operator string(GeoPoint value)
+        {
+            return value?.ToString();
+        }
+
+        /// <summary>
+        /// Represents a Latitude/Longitude as a 2 dimensional point.
+        /// </summary>
+        /// <param name="lat">Value between -90 and 90</param>
+        /// <param name="lon">Value between -180 and 180</param>
+        /// <exception cref="ArgumentOutOfRangeException">If <paramref name="lat"/> or <paramref name="lon"/> are invalid</exception>
+        public GeoPoint(double lat, double lon)
 		{
 			if (!IsValidLatitude(lat))
 				throw new ArgumentOutOfRangeException(string.Format(CultureInfo.InvariantCulture,


Delegating static file requests in warmup mode

--HG--
branch : dev

--- src/Orchard.Web/Global.asax.cs
+++ src/Orchard.Web/Global.asax.cs
@@ -61,7 +61,6 @@
                 var localCopy = HostingEnvironment.MapPath(virtualFileCopy);

                 if (File.Exists(localCopy)) {
-
                     // result should not be cached, even on proxies
                     Context.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
                     Context.Response.Cache.SetValidUntilExpires(false);
@@ -69,12 +68,10 @@
                     Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                     Context.Response.Cache.SetNoStore();

-                    Context.Response.ContentType = "text/html";
-
                     Context.Response.WriteFile(localCopy);
                     Context.Response.End();
                 }
-                else {
+                else if(!File.Exists(Request.PhysicalPath)) {
                     // there is no local copy and the host is not running
                     // wait for the host to initialize
                     _waitHandle.WaitOne();


Implemented turn highlighting

Implemented turn highlighting

--- Reversi/Assets/BoardEventsHandler.cs
+++ Reversi/Assets/BoardEventsHandler.cs
@@ -13,6 +13,10 @@
 	// Use this for initialization
 	void Start ()
 	{
+		this._mutableBoardModel = new MatrixBoard();
+		this._turnCalculator = new TurnCalculator();
+		this._boardModel = this._mutableBoardModel;
+
 //		UnityEngine.Debug.developerConsoleVisible = true;
 //		UnityEngine.Debug.LogError("----Start-----");
 //		UnityEngine.Debug.LogError ("Turn label : " + this._turnLabel.ToString());
@@ -25,7 +29,9 @@
 		populateCellsList ();
 		populateCellsMatrix ();
 		setSampleTurnText ();
-		doSampleTurn ();
+		// doSampleTurn ();
+
+		highlightAvailableTurnsSample();
 	}

 	// Update is called once per frame
@@ -66,7 +72,16 @@
 		}
 	}

-
+	private void highlightAvailableTurnsSample()
+	{
+		var turns = this._turnCalculator.GetValidTurnsForBoard(this._boardModel);
+		foreach (IReversiTurn singleTurn in turns)
+		{
+			ICellCoordinates turnCell = singleTurn.Position;
+			GameObject cellCube = this._cellsMatrix[turnCell.Row, turnCell.Column];
+			cellCube.GetComponent<Renderer>().material = this._highlightedCellMaterial;
+		}
+	}

 	private void populateCellsList()
 	{
@@ -107,19 +122,26 @@
 		{
 			var d4Pos = BoardCoordinatesConverter.CellNameToCoordinates("D4");
 			this._ballsMatrix[d4Pos.Row, d4Pos.Column] = this._ballD4;
+			this._mutableBoardModel.TryConsumeCellByBlackPlayer(d4Pos);

 			var d5Pos = BoardCoordinatesConverter.CellNameToCoordinates("D5");
 			this._ballsMatrix[d5Pos.Row, d5Pos.Column] = this._ballD5;
+			this._mutableBoardModel.TryConsumeCellByWhitePlayer(d5Pos);

 			var e4Pos = BoardCoordinatesConverter.CellNameToCoordinates("E4");
 			this._ballsMatrix[e4Pos.Row, e4Pos.Column] = this._ballE4;
+			this._mutableBoardModel.TryConsumeCellByWhitePlayer(e4Pos);

 			var e5Pos = BoardCoordinatesConverter.CellNameToCoordinates("E5");
 			this._ballsMatrix[e5Pos.Row, e5Pos.Column] = this._ballE5;
+			this._mutableBoardModel.TryConsumeCellByBlackPlayer(e5Pos);
+
+			this._mutableBoardModel.IsTurnOfBlackPlayer = true;
 		}
 	}
 	#endregion

+	#region GUI elements
 	public TextMesh _turnLabel;

 	private GameObject _root;
@@ -137,6 +159,16 @@
 	public GameObject _ballE5;
 	public GameObject _ballD4;
 	public GameObject _ballE4;
+	#endregion
+
+	#region Model
+
+	private IBoardState 	_boardModel	      ;
+	private ITurnCalculator _turnCalculator	  ;
+	private MatrixBoard 	_mutableBoardModel;
+
+	#endregion
+

 	private static int BOARD_SIZE = 8;
 }


fix an issue where crawl-delay parsin was depending on system culture's number styles

--- RobotsTxt/Entities/CrawlDelayRule.cs
+++ RobotsTxt/Entities/CrawlDelayRule.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Globalization;

 namespace RobotsTxt
 {
@@ -10,7 +11,7 @@
             : base(userAgent, order)
         {
             double delay = 0;
-            Double.TryParse(line.Value, out delay);
+            Double.TryParse(line.Value, NumberStyles.Float, CultureInfo.InvariantCulture, out delay);
             Delay = (long)(delay * 1000);
         }
     }


Minor changes to methods that implement finding wildcard or null in an ast in UseToExportFieldsInManifest.

--- Rules/UseToExportFieldsInManifest.cs
+++ Rules/UseToExportFieldsInManifest.cs
@@ -93,14 +93,7 @@
         private bool HasWildcardInExpression(Ast ast)
         {
             var strConstExprAst = ast as StringConstantExpressionAst;
-            if (strConstExprAst != null && WildcardPattern.ContainsWildcardCharacters(strConstExprAst.Value))
-            {
-                return true;
-            }
-            else
-            {
-                return false;
-            }
+            return strConstExprAst != null && WildcardPattern.ContainsWildcardCharacters(strConstExprAst.Value);
         }

         /// <summary>
@@ -111,16 +104,9 @@
         private bool HasNullInExpression(Ast ast)
         {
             var varExprAst = ast as VariableExpressionAst;
-            if (varExprAst != null
-                && varExprAst.VariablePath.IsUnqualified
-                && varExprAst.VariablePath.UserPath.Equals("null", StringComparison.OrdinalIgnoreCase))
-            {
-                return true;
-            }
-            else
-            {
-                return false;
-            }
+            return varExprAst != null
+                    && varExprAst.VariablePath.IsUnqualified
+                    && varExprAst.VariablePath.UserPath.Equals("null", StringComparison.OrdinalIgnoreCase);
         }

         /// <summary>


Windows 8.1 and 10 support

Windows 8.1 and 10 support

--- Server/Core/Helper/PlatformHelper.cs
+++ Server/Core/Helper/PlatformHelper.cs
@@ -2,7 +2,7 @@
 using System.Management;
 using System.Text.RegularExpressions;

-namespace xClient.Core.Helper
+namespace xServer.Core.Helper
 {
     public static class PlatformHelper
     {


Changes on slide gestures

Changes on slide gestures

--- SharpSenses/Gestures/GestureSlide.cs
+++ SharpSenses/Gestures/GestureSlide.cs
@@ -25,7 +25,7 @@

         private static void CreateSlideGesture(Hand hand, Direction direction, Action<GestureEventArgs> handler) {
             var swipe = new Gesture("hand" + hand.Side + "_" + direction);
-            swipe.AddStep(1000, Movement.CreateMovement(direction, hand, 11));
+            swipe.AddStep(300, Movement.CreateMovement(direction, hand, 12));
             swipe.Activate();
             swipe.GestureDetected += (s, a) => handler.Invoke(a);
         }


Added methods to get gold, silver and copper for buyprice and sellprice. Added ItemQuality.

--- SharprWowApi/Models/Item/ItemRoot.cs
+++ SharprWowApi/Models/Item/ItemRoot.cs
@@ -1,6 +1,6 @@
 using System;
 using System.Collections.Generic;
-
+using SharprWowApi.Utility.ExtensionMethods;
 namespace SharprWowApi.Models.Item
 {
     public class ItemRoot
@@ -23,7 +23,7 @@

         public IEnumerable<ItemSpell> ItemSpells { get; set; }

-        public int BuyPrice { get; set; }
+        public string BuyPrice { get; set; }

         public int ItemClass { get; set; }

@@ -52,7 +52,7 @@
         /// </summary>
         public int Quality { get; set; }

-        public int SellPrice { get; set; }
+        public string SellPrice { get; set; }

         public int RequiredSkill { get; set; }

@@ -90,6 +90,69 @@

         public ItemSetRoot ItemSet { get; set; }

+        public string BuyPriceGold
+        {
+            get
+            {
+                if (this.BuyPrice.Length > 4)
+                {
+                    return this.BuyPrice.RemoveTail(4);
+                }
+                else
+                {
+                    return string.Empty;
+                }
+            }
+        }
+
+        public string BuyPriceSilver
+        {
+            get
+            {
+                return this.BuyPrice.Tail(4).RemoveTail(2);
+            }
+        }
+
+        public string BuyPriceCopper
+        {
+            get
+            {
+                return this.BuyPrice.Tail(2);
+            }
+        }
+
+        public string SellPriceGold
+        {
+            get
+            {
+                if (this.SellPrice.Length > 4)
+                {
+                    return this.SellPrice.RemoveTail(4);
+                }
+                else
+                {
+                    return string.Empty;
+                }
+            }
+        }
+
+        public string SellPriceSilver
+        {
+            get
+            {
+                return this.SellPrice.Tail(4).RemoveTail(2);
+            }
+        }
+
+        public string SellPriceCopper
+        {
+            get
+            {
+                return this.SellPrice.Tail(2);
+            }
+        }
+
+
         /// <summary>
         /// Gets String value (from enum) of item quality
         /// </summary>


Refactor aspect instantiating code

Refactor aspect instantiating code

--- ShaspectBuilder/ShaspectBuildTask.cs
+++ ShaspectBuilder/ShaspectBuildTask.cs
@@ -13,6 +13,7 @@
 using Mono.Cecil.Mdb;
 using Mono.Cecil.Pdb;
 using Mono.Cecil.Rocks;
+using Mono.Collections.Generic;
 using FieldAttributes = Mono.Cecil.FieldAttributes;
 using ICustomAttributeProvider = Mono.Cecil.ICustomAttributeProvider;
 using MethodAttributes = Mono.Cecil.MethodAttributes;
@@ -107,7 +108,30 @@
         private void ProcessMethod (MethodDefinition method, IEnumerable<AspectDeclaration> externalAspects)
         {
             var aspects = GetAspects (method, method.Module).Union (externalAspects);
+
+            foreach (var aspect in aspects)
+            {
+                if ((aspect.Aspect.AttributeType.Resolve().Attributes & TypeAttributes.NestedPrivate) == TypeAttributes.NestedPrivate)
+                    throw new ApplicationException (String.Format ("Aspect {0} must be declared as public or internal.", aspect.Aspect.AttributeType));
+
+                var aspectField = BuildAspectInitCode(aspect);
+
+                method.Body.Instructions.Insert (0,
+                    Instruction.Create (OpCodes.Callvirt, method.Module.Import (typeof (BaseAspectAttribute).GetMethod ("OnEntry"))));
+                method.Body.Instructions.Insert (0, Instruction.Create (OpCodes.Ldsfld, aspectField));
+
+                ++emittedAspects;
+            }
+        }
+
+
+        private FieldDefinition BuildAspectInitCode (AspectDeclaration aspect)
+        {
             var ctor = colCtor.Body.Instructions;
+
+            var aspectField = new FieldDefinition ("Aspect_" + emittedAspects,
+                FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.InitOnly, aspect.Aspect.AttributeType);
+            colClass.Fields.Add (aspectField);

             // the IL code bellow is generated from:
 /*
@@ -124,80 +148,66 @@
             Aspect_0= (Test1Attribute)GetMethodAttrInstance (methodInfo, typeof (Test1Attribute));
 */

-            foreach (var aspect in aspects)
-            {
-                if ((aspect.Aspect.AttributeType.Resolve().Attributes & TypeAttributes.NestedPrivate) == TypeAttributes.NestedPrivate)
-                    throw new ApplicationException (String.Format ("Aspect {0} must be declared as public or internal.", aspect.Aspect.AttributeType));
-
-                var aspectField = new FieldDefinition ("Aspect_" + emittedAspects,
-                    FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.InitOnly, aspect.Aspect.AttributeType);
-                colClass.Fields.Add (aspectField);
-
-                ctor.Add (OpCodes.Ldtoken, aspect.Declarator.DeclaringType);
+            ctor.Add (OpCodes.Ldtoken, aspect.Declarator.DeclaringType);
+            ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetTypeFromHandle")));
+            ctor.Add (OpCodes.Ldstr, aspect.Declarator.Name);
+            ctor.Add (OpCodes.Ldc_I4,
+                (int) (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static));
+            ctor.Add (OpCodes.Ldnull);
+
+            if (aspect.Declarator is PropertyReference)
+            {
+                ctor.Add (OpCodes.Ldtoken, ((PropertyReference) aspect.Declarator).PropertyType);
                 ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetTypeFromHandle")));
-                ctor.Add (OpCodes.Ldstr, aspect.Declarator.Name);
-                ctor.Add (OpCodes.Ldc_I4, (int)(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static));
-                ctor.Add (OpCodes.Ldnull);
-
-                if (aspect.Declarator is PropertyReference)
+            }
+            else
+            {
+                ctor.Add (OpCodes.Ldc_I4, (int) CallingConventions.Any);
+            }
+
+            var memberParams = (aspect.Declarator is PropertyReference)
+                ? ((PropertyReference) aspect.Declarator).Parameters
+                : ((MethodReference) aspect.Declarator).Parameters;
+
+            ctor.Add (OpCodes.Ldc_I4, memberParams.Count);
+            ctor.Add (OpCodes.Newarr, mainModule.Import (typeof (Type)));
+            ctor.Add (OpCodes.Stloc_0);
+            ctor.Add (OpCodes.Ldloc_0);
+
+            for (int i = 0; i < memberParams.Count; ++i)
+            {
+                ctor.Add (OpCodes.Ldc_I4, i);
+                ctor.Add (OpCodes.Ldtoken, memberParams[i].ParameterType);
+                ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetTypeFromHandle")));
+                ctor.Add (OpCodes.Stelem_Ref);
+                ctor.Add (OpCodes.Ldloc_0);
+            }
+
+            ctor.Add (OpCodes.Ldnull);
+            if (aspect.Declarator is PropertyReference)
+            {
+                ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetProperty", new[]
                 {
-                    ctor.Add (OpCodes.Ldtoken, ((PropertyReference) aspect.Declarator).PropertyType);
-                    ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetTypeFromHandle")));
-                }
-                else
+                    typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type), typeof (Type[]),
+                    typeof (ParameterModifier[])
+                })));
+            }
+            else
+            {
+                ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetMethod", new[]
                 {
-                    ctor.Add (OpCodes.Ldc_I4, (int)CallingConventions.Any);
-                }
-
-                var memberParams = (aspect.Declarator is PropertyReference)
-                    ? ((PropertyReference) aspect.Declarator).Parameters
-                    : ((MethodReference) aspect.Declarator).Parameters;
-
-                ctor.Add (OpCodes.Ldc_I4, memberParams.Count);
-                ctor.Add (OpCodes.Newarr, mainModule.Import (typeof (Type)));
-                ctor.Add (OpCodes.Stloc_0);
-                ctor.Add (OpCodes.Ldloc_0);
-
-                for (int i = 0; i < memberParams.Count; ++i)
-                {
-                    ctor.Add (OpCodes.Ldc_I4, i);
-                    ctor.Add (OpCodes.Ldtoken, memberParams[i].ParameterType);
-                    ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetTypeFromHandle")));
-                    ctor.Add (OpCodes.Stelem_Ref);
-                    ctor.Add (OpCodes.Ldloc_0);
-                }
-
-                ctor.Add (OpCodes.Ldnull);
-                if (aspect.Declarator is PropertyReference)
-                {
-                    ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetProperty", new[]
-                    {
-                        typeof(string), typeof (BindingFlags), typeof(Binder), typeof (Type), typeof(Type[]), typeof (ParameterModifier[])
-                    })));
-                }
-                else
-                {
-                    ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetMethod", new[]
-                    {
-                        typeof(string), typeof (BindingFlags), typeof(Binder), typeof(CallingConventions), typeof(Type[]), typeof (ParameterModifier[])
-                    })));
-                }
-
-
-                ctor.Add (OpCodes.Ldtoken, aspect.Aspect.AttributeType);
-                ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetTypeFromHandle")));
-
-                ctor.Add (OpCodes.Call, getMemberAttrInstanceMethod);
-                ctor.Add (OpCodes.Castclass, aspect.Aspect.AttributeType);
-                ctor.Add (OpCodes.Stsfld, aspectField);
-
-
-                method.Body.Instructions.Insert (0,
-                    Instruction.Create (OpCodes.Callvirt, method.Module.Import (typeof (BaseAspectAttribute).GetMethod ("OnEntry"))));
-                method.Body.Instructions.Insert (0, Instruction.Create (OpCodes.Ldsfld, aspectField));
-
-                ++emittedAspects;
-            }
+                    typeof (string), typeof (BindingFlags), typeof (Binder), typeof (CallingConventions), typeof (Type[]),
+                    typeof (ParameterModifier[])
+                })));
+            }
+
+            ctor.Add (OpCodes.Ldtoken, aspect.Aspect.AttributeType);
+            ctor.Add (OpCodes.Call, mainModule.Import (typeof (Type).GetMethod ("GetTypeFromHandle")));
+
+            ctor.Add (OpCodes.Call, getMemberAttrInstanceMethod);
+            ctor.Add (OpCodes.Castclass, aspect.Aspect.AttributeType);
+            ctor.Add (OpCodes.Stsfld, aspectField);
+            return aspectField;
         }


棋譜書き込みの拡張メソッド追加。

棋譜書き込みの拡張メソッド追加。

--- ShogiCore/Notation/NotationWriter.cs
+++ ShogiCore/Notation/NotationWriter.cs
@@ -1,70 +1,82 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace ShogiCore.Notation {
-    /// <summary>
-    /// 文字列な棋譜書き込みを行うクラス
-    /// </summary>
-    /// <exception cref="NotationException">エラーなど</exception>
-    public interface IStringNotationWriter {
-        string WriteToString(IEnumerable<Notation> notations);
-    }
-
-    /// <summary>
-    /// バイナリな棋譜書き込みを行うクラス
-    /// </summary>
-    /// <exception cref="NotationException">エラーなど</exception>
-    public interface IBinaryNotationWriter {
-        byte[] WriteToBinary(IEnumerable<Notation> notations);
-    }
-
-    public abstract class StringNotationWriter : IBinaryNotationWriter, IStringNotationWriter {
-        /// <summary>
-        /// Encoding
-        /// </summary>
-        Encoding encoding;
-
-        /// <summary>
-        /// Encoding
-        /// </summary>
-        public virtual Encoding Encoding {
-            get {
-                if (encoding == null) {
-                    encoding = Encoding.GetEncoding(932);
-                }
-                return encoding;
-            }
-            protected set { encoding = value; }
-        }
-
-        /// <summary>
-        /// WriteToBinary
-        /// </summary>
-        public byte[] WriteToBinary(Notation notation) {
-            return WriteToBinary(new[] { notation });
-        }
-
-        /// <summary>
-        /// WriteToString
-        /// </summary>
-        public string WriteToString(Notation notation) {
-            return WriteToString(new[] { notation });
-        }
-
-        #region IBinaryNotationWriter メンバ
-
-        public byte[] WriteToBinary(IEnumerable<Notation> notations) {
-            return Encoding.GetBytes(WriteToString(notations));
-        }
-
-        #endregion
-
-        #region IStringNotationWriter メンバ
-
-        public abstract string WriteToString(IEnumerable<Notation> notations);
-
-        #endregion
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace ShogiCore.Notation {
+    /// <summary>
+    /// 文字列な棋譜書き込みを行うクラス
+    /// </summary>
+    /// <exception cref="NotationException">エラーなど</exception>
+    public interface IStringNotationWriter {
+        string WriteToString(IEnumerable<Notation> notations);
+    }
+
+    /// <summary>
+    /// バイナリな棋譜書き込みを行うクラス
+    /// </summary>
+    /// <exception cref="NotationException">エラーなど</exception>
+    public interface IBinaryNotationWriter {
+        byte[] WriteToBinary(IEnumerable<Notation> notations);
+    }
+
+    /// <summary>
+    /// 1棋譜用インターフェース
+    /// </summary>
+    public static class NotationWriterExtensions {
+        public static string WriteToString(this IStringNotationWriter that, Notation notation) {
+            return that.WriteToString(Enumerable.Repeat(notation, 1));
+        }
+        public static byte[] WriteToBinary(this IBinaryNotationWriter that, Notation notation) {
+            return that.WriteToBinary(Enumerable.Repeat(notation, 1));
+        }
+    }
+
+    public abstract class StringNotationWriter : IBinaryNotationWriter, IStringNotationWriter {
+        /// <summary>
+        /// Encoding
+        /// </summary>
+        Encoding encoding;
+
+        /// <summary>
+        /// Encoding
+        /// </summary>
+        public virtual Encoding Encoding {
+            get {
+                if (encoding == null) {
+                    encoding = Encoding.GetEncoding(932);
+                }
+                return encoding;
+            }
+            protected set { encoding = value; }
+        }
+
+        /// <summary>
+        /// WriteToBinary
+        /// </summary>
+        public byte[] WriteToBinary(Notation notation) {
+            return WriteToBinary(new[] { notation });
+        }
+
+        /// <summary>
+        /// WriteToString
+        /// </summary>
+        public string WriteToString(Notation notation) {
+            return WriteToString(new[] { notation });
+        }
+
+        #region IBinaryNotationWriter メンバ
+
+        public byte[] WriteToBinary(IEnumerable<Notation> notations) {
+            return Encoding.GetBytes(WriteToString(notations));
+        }
+
+        #endregion
+
+        #region IStringNotationWriter メンバ
+
+        public abstract string WriteToString(IEnumerable<Notation> notations);
+
+        #endregion
+    }
+}


Fix Url formaating in JenkinsResource

Fix Url formaating in JenkinsResource

--- SimpleWAWS/Models/JenkinsResource.cs
+++ SimpleWAWS/Models/JenkinsResource.cs
@@ -2,8 +2,6 @@
 using System;
 using System.Collections.Generic;
 using System.Globalization;
-using System.Linq;
-using System.Web;

 namespace SimpleWAWS.Models
 {
@@ -30,12 +28,10 @@
         public string JenkinsResourceUrl
         {
             get { return string.IsNullOrEmpty(_ipAddress)? string.Empty: string.Format($"http://{_ipAddress}:8080"); }
-            set { }
         }
         public string JenkinsDnsUrl
         {
-            get { return string.IsNullOrEmpty(_hostName) ? string.Empty : string.Format($"{_hostName}:8080"); }
-            set { }
+            get { return string.IsNullOrEmpty(_hostName) ? string.Empty : string.Format($"http://{_hostName}:8080"); }
         }
         public string Location { get; set; }


SeederGenerator/Program.cs - the seeder now supports both xls and xlsx without hardcoding the filename for each county

--- src/SeederGenerator/Program.cs
+++ src/SeederGenerator/Program.cs
@@ -14,7 +14,7 @@
     {
         private static void Main(string[] args)
         {
-            var dir = @"d:\INS\Publicatie BSL Judete_ Excel_luna ian. 2018\";
+            var dir = @"d:\INS\Publicatie BSL Judete_ Excel_luna feb. 2018\";

             var fileMapping = new Dictionary<string, string>
                                   {
@@ -120,6 +120,10 @@
             if (!File.Exists(file))
                 file = file.Replace("-", " ");

+            // Sometimes INS provides xls, sometimes it provides xlsx; so let's check for xlsx, too
+            if (!File.Exists(file))
+                file = file.Replace(".xls", ".xlsx");
+
             using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
             {
                 excelFile = file.EndsWith(".xls") ? (IWorkbook)new HSSFWorkbook(fileStream) : (IWorkbook)new XSSFWorkbook(fileStream);


SeederGenerator/Program.cs - improve the algorithm for generating the seeder, due to the inconsistency of the xls files (sometimes the month abbreviation ends with a dot, other times it doesn't)

--- src/SeederGenerator/Program.cs
+++ src/SeederGenerator/Program.cs
@@ -16,7 +16,7 @@
     {
         private static void Main(string[] args)
         {
-            var dir = @"d:\INS\Publicatie BSL Judete_ Excel_luna feb. 2017\";
+            var dir = @"d:\INS\Publicatie BSL Judete_ Excel_luna mar. 2017\";

             var fileMapping = new Dictionary<string, string>
                                   {
@@ -79,7 +79,7 @@
                                      };

             var year = 2017;
-            var months = new [] { "ian.", "feb.", "mar.", "apr.", "mai", "iun.", "iul.", "aug.", "sep.", "oct.", "nov.", "dec." };
+            var months = new [] { "ian", "feb", "mar", "apr", "mai", "iun", "iul", "aug", "sep", "oct", "nov", "dec" };

             var res = new Dictionary<string, string>
                           {
@@ -157,14 +157,16 @@

             var numberOfMonths =
                 sheet.GetRow(chapterRowIndex + 1).Cells.Count(
-                    x => x.ColumnIndex >= columnYearStartIndex && months.Any(month => x.StringCellValue.Contains(month)));
+                    x => x.ColumnIndex >= columnYearStartIndex && months.Any(month => x.StringCellValue.StartsWith(month)));

             Debug.WriteLine("Current county: " + county + "; chapter: " + chapter);

-            var text =
-                sheet.GetRow(chapterRowIndex + rowNumber + 1).Cells.Where(
-                    x => x.ColumnIndex >= columnYearStartIndex && x.ColumnIndex < columnYearStartIndex + numberOfMonths).Select(
-                        x => x.CellType == CellType.String ? x.StringCellValue.Trim() : x.NumericCellValue.ToString(CultureInfo.InvariantCulture)).Aggregate((c, n) => c + " " + n);
+            var cellsContainingTheValuesForCurrentYear = sheet.GetRow(chapterRowIndex + rowNumber + 1).Cells.Where(x => x.ColumnIndex >= columnYearStartIndex && x.ColumnIndex < columnYearStartIndex + numberOfMonths);
+
+            if (!cellsContainingTheValuesForCurrentYear.Any())
+                return null;
+
+            var text = cellsContainingTheValuesForCurrentYear.Select(x => x.CellType == CellType.String ? x.StringCellValue.Trim() : x.NumericCellValue.ToString(CultureInfo.InvariantCulture)).Aggregate((c, n) => c + " " + n);

             return "\"" + year.ToString(CultureInfo.InvariantCulture) + " 1 " + county + " " + text + "\",";
         }


IOC: don't allow substitution with null instances

--- src/Solomobro.Instagram/Ioc.cs
+++ src/Solomobro.Instagram/Ioc.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;

 namespace Solomobro.Instagram
 {
@@ -17,8 +18,13 @@
         /// </summary>
         /// <typeparam name="T"></typeparam>
         /// <param name="mockInstance">the mock instance</param>
-        public static void Substitute<T>(T mockInstance)
+        public static void Substitute<T>(T mockInstance) where T: class
         {
+            if (mockInstance == null)
+            {
+                throw new InvalidOperationException("Not allowed to substitude with a null instance");
+            }
+
             _substitutes[Key<T>()] = mockInstance;
         }


Remove unused using statement

Remove unused using statement

--- osu.Framework/Graphics/Batches/QuadBatch.cs
+++ osu.Framework/Graphics/Batches/QuadBatch.cs
@@ -3,9 +3,8 @@

 using System;
 using osu.Framework.Graphics.OpenGL.Buffers;
+using osu.Framework.Graphics.OpenGL.Vertices;
 using osuTK.Graphics.ES30;
-using osu.Framework.Graphics.OpenGL.Vertices;
-using osu.Framework.Graphics.Primitives;

 namespace osu.Framework.Graphics.Batches
 {


Don't yield when game can't keep up

Don't yield when game can't keep up

--- osu.Framework/Timing/ThrottledFrameClock.cs
+++ osu.Framework/Timing/ThrottledFrameClock.cs
@@ -82,6 +82,11 @@

         private double sleepAndUpdateCurrent(double milliseconds)
         {
+            // By returning here, in cases where the game is not keeping up, we don't yield.
+            // Not 100% sure if we want to do this, but let's give it a try.
+            if (milliseconds <= 0)
+                return 0;
+
             double before = CurrentTime;

             TimeSpan timeSpan = TimeSpan.FromMilliseconds(milliseconds);


Fix score rounding issue

Fix score rounding issue

--- osu.Game/Rulesets/Scoring/ScoreProcessor.cs
+++ osu.Game/Rulesets/Scoring/ScoreProcessor.cs
@@ -341,13 +341,13 @@
                 case ScoringMode.Standardised:
                     double accuracyScore = accuracyPortion * accuracyRatio;
                     double comboScore = comboPortion * comboRatio;
-                    return (long)((max_score * (accuracyScore + comboScore) + bonusScore) * scoreMultiplier);
+                    return (long)Math.Round((max_score * (accuracyScore + comboScore) + bonusScore) * scoreMultiplier);

                 case ScoringMode.Classic:
                     // This gives a similar feeling to osu!stable scoring (ScoreV1) while keeping classic scoring as only a constant multiple of standardised scoring.
                     // The invariant is important to ensure that scores don't get re-ordered on leaderboards between the two scoring modes.
                     double scaledStandardised = ComputeScore(ScoringMode.Standardised, accuracyRatio, comboRatio, bonusScore, totalBasicHitObjects) / max_score;
-                    return (long)(Math.Pow(scaledStandardised * Math.Max(1, totalBasicHitObjects), 2) * ClassicScoreMultiplier);
+                    return (long)Math.Round(Math.Pow(scaledStandardised * Math.Max(1, totalBasicHitObjects), 2) * ClassicScoreMultiplier);
             }
         }


[packages,Publisher] Made the private utility interface for creating collated directories and symbolic links consistent with that for files

--- packages/Publisher/bam/Scripts/Collation.cs
+++ packages/Publisher/bam/Scripts/Collation.cs
@@ -112,6 +112,8 @@

         private CollatedDirectory
         CreateCollatedDirectory(
+            Bam.Core.Module sourceModule,
+            Bam.Core.TokenizedString sourcePath,
             CollatedFile reference,
             Bam.Core.TokenizedString subDirectory)
         {
@@ -127,7 +129,7 @@
                 {
                     if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows))
                     {
-                        module.Macros["CopyDir"] = module.CreateTokenizedString("@normalize(@dir($(0))/$(1)/@filename($(2))/)", reference.GeneratedPaths[CollatedObject.CopiedObjectKey], subDirectory, (module as CollatedDirectory).SourcePath);
+                        module.Macros["CopyDir"] = module.CreateTokenizedString("@normalize(@dir($(0))/$(1)/@filename($(2))/)", reference.GeneratedPaths[CollatedObject.CopiedObjectKey], subDirectory, sourcePath);
                     }
                     else
                     {
@@ -138,7 +140,7 @@
                 {
                     if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows))
                     {
-                        module.Macros["CopyDir"] = module.CreateTokenizedString("@normalize(@dir($(0))/@filename($(1))/)", reference.GeneratedPaths[CollatedObject.CopiedObjectKey], (module as CollatedDirectory).SourcePath);
+                        module.Macros["CopyDir"] = module.CreateTokenizedString("@normalize(@dir($(0))/@filename($(1))/)", reference.GeneratedPaths[CollatedObject.CopiedObjectKey], sourcePath);
                     }
                     else
                     {
@@ -147,6 +149,9 @@
                 }
             });
             this.Requires(copyDirectoryModule);
+
+            copyDirectoryModule.SourceModule = sourceModule;
+            copyDirectoryModule.SourcePath = sourcePath;
             copyDirectoryModule.Reference = reference;
             copyDirectoryModule.SubDirectory = subDirectory;
             return copyDirectoryModule;
@@ -154,6 +159,8 @@

         private CollatedSymbolicLink
         CreateCollatedSymbolicLink(
+            Bam.Core.Module sourceModule,
+            Bam.Core.TokenizedString sourcePath,
             CollatedFile reference,
             Bam.Core.TokenizedString subDirectory)
         {
@@ -174,6 +181,9 @@
                 }
             });
             this.Requires(copySymlinkModule);
+
+            copySymlinkModule.SourceModule = sourceModule;
+            copySymlinkModule.SourcePath = sourcePath;
             copySymlinkModule.Reference = reference;
             copySymlinkModule.SubDirectory = subDirectory;
             return copySymlinkModule;
@@ -207,9 +217,11 @@
             {
                 return;
             }
-            var copySymlink = this.CreateCollatedSymbolicLink(copyFileModule.Reference, copyFileModule.SubDirectory);
-            copySymlink.SourceModule = copyFileModule.SourceModule;
-            copySymlink.SourcePath = copyFileModule.SourceModule.Macros["SOName"];
+            var copySymlink = this.CreateCollatedSymbolicLink(
+                copyFileModule.SourceModule,
+                copyFileModule.SourceModule.Macros["SOName"],
+                copyFileModule.Reference,
+                copyFileModule.SubDirectory);
             copySymlink.LinkTarget(copySymlink.CreateTokenizedString("@filename($(0))", copyFileModule.SourcePath));
         }

@@ -373,8 +385,7 @@
             string subdir,
             CollatedFile reference)
         {
-            var copyDirectoryModule = this.CreateCollatedDirectory(reference, Bam.Core.TokenizedString.CreateVerbatim(subdir));
-            copyDirectoryModule.SourcePath = parameterizedPath;
+            this.CreateCollatedDirectory(null, parameterizedPath, reference, Bam.Core.TokenizedString.CreateVerbatim(subdir));
         }

         public void
@@ -404,9 +415,11 @@
             foreach (var dirData in framework.DirectoriesToPublish)
             {
                 var dir = dirData.SourcePath;
-                var copyDir = this.CreateCollatedDirectory(reference, this.CreateTokenizedString("$(0)/$(1)", subdirTS, dirData.DestinationPath != null ? dirData.DestinationPath : dir));
-                copyDir.SourceModule = dependent;
-                copyDir.SourcePath = this.CreateTokenizedString("$(0)/$(1)", frameworkPath, dir);
+                var copyDir = this.CreateCollatedDirectory(
+                    dependent,
+                    this.CreateTokenizedString("$(0)/$(1)", frameworkPath, dir),
+                    reference,
+                    this.CreateTokenizedString("$(0)/$(1)", subdirTS, dirData.DestinationPath != null ? dirData.DestinationPath : dir));
                 dirPublishedModules.Add(copyDir);
             }
             var filePublishedModules = new Bam.Core.Array<CollatedFile>();
@@ -450,9 +463,11 @@
                 foreach (var symlinkData in framework.SymlinksToPublish)
                 {
                     var symlink = symlinkData.SourcePath;
-                    var copySymlink = this.CreateCollatedSymbolicLink(reference, this.CreateTokenizedString("$(0)/@dir($(1))", subdirTS, symlink));
-                    copySymlink.SourceModule = dependent;
-                    copySymlink.SourcePath = this.CreateTokenizedString("$(0)/$(1)", frameworkPath, symlink);
+                    var copySymlink = this.CreateCollatedSymbolicLink(
+                        dependent,
+                        this.CreateTokenizedString("$(0)/$(1)", frameworkPath, symlink),
+                        reference,
+                        this.CreateTokenizedString("$(0)/@dir($(1))", subdirTS, symlink));
                     copySymlink.LinkTarget(symlinkData.DestinationPath);
                     foreach (var publishedDir in dirPublishedModules)
                     {


Avoid lock statement when incrementing completed tasks

--- SkyEditor.Core/Utilities/AsyncFor.cs
+++ SkyEditor.Core/Utilities/AsyncFor.cs
@@ -54,25 +54,18 @@
         /// The number of tasks that have been completed.
         /// </summary>
         /// <returns></returns>
-        private int CompletedTasks
+        public int CompletedTasks
         {
             get
             {
                 return _completedTasks;
             }
-            set
-            {
-                _completedTasks = value;
-                ProgressChanged?.Invoke(this, new ProgressReportedEventArgs() { Progress = Progress, IsIndeterminate = false });
-                if (CompletedTasks == TotalTasks)
-                {
-                    IsCompleted = true;
-                    Completed?.Invoke(this, new EventArgs());
-                }
+            private set
+            {
+                _completedTasks = value;
             }
         }
         int _completedTasks;
-        object _completedTasksLock = new object();

         public float Progress => CompletedTasks / TotalTasks;

@@ -83,6 +76,19 @@
         public bool IsCompleted { get; protected set; }

         #endregion
+
+        protected void IncrementCompletedTasks()
+        {
+            Interlocked.Increment(ref _completedTasks);
+
+            ProgressChanged?.Invoke(this, new ProgressReportedEventArgs() { Progress = Progress, IsIndeterminate = false });
+            if (CompletedTasks == TotalTasks)
+            {
+                IsCompleted = true;
+                Completed?.Invoke(this, new EventArgs());
+            }
+        }
+

         #region Core Functions

@@ -123,10 +129,7 @@
                     var tTask = Task.Run(async () =>
                     {
                         await delegateFunction(item);
-                        lock (_completedTasksLock)
-                        {
-                            CompletedTasks += 1;
-                        }
+                        IncrementCompletedTasks();
                     });

                     // Either wait for it or move on
@@ -224,10 +227,7 @@
                     var tTask = Task.Run(async () =>
                     {
                         await delegateFunction(item);
-                        lock (_completedTasksLock)
-                        {
-                            CompletedTasks += 1;
-                        }
+                        IncrementCompletedTasks();
                     });

                     // Increment for the next run


Refs #1600 - irrelevante NotImplementedException weggehaald

Vroeger kon het zijn dat van een lid de gelieerde persoon niet mee geladen was.
Vandaag doen we dit met lazy loading.

--- Solution/Chiro.Gap.Sync/LedenSync.cs
+++ Solution/Chiro.Gap.Sync/LedenSync.cs
@@ -159,31 +159,20 @@
         /// <remarks>Als geen persoonsgegevens meegeleverd zijn, dan zoeken we die wel even op in de database.</remarks>
         public void FunctiesUpdaten(Lid lid)
         {
-            Lid l;
-
-            if (lid.GelieerdePersoon == null || lid.GelieerdePersoon.Persoon == null)
-            {
-                throw new NotImplementedException();
-            }
-            else
-            {
-                l = lid;
-            }
-
-            Debug.Assert(l.GroepsWerkJaar != null);
-            Debug.Assert(l.GroepsWerkJaar.Groep != null);
+            Debug.Assert(lid.GroepsWerkJaar != null);
+            Debug.Assert(lid.GroepsWerkJaar.Groep != null);

             // TODO (#555): Dit gaat problemen geven met oud-leidingsploegen

-            var kipFunctieIDs = (from f in l.Functie
+            var kipFunctieIDs = (from f in lid.Functie
                                  where f.IsNationaal
                                  select _functieVertaling[(NationaleFunctie)f.ID]).ToList();

             ServiceHelper.CallService<ISyncPersoonService>(
                 svc => svc.FunctiesUpdaten(Mapper.Map<Persoon, Kip.ServiceContracts.DataContracts.Persoon>(
-                    l.GelieerdePersoon.Persoon),
-                                           l.GroepsWerkJaar.Groep.Code,
-                                           l.GroepsWerkJaar.WerkJaar,
+                    lid.GelieerdePersoon.Persoon),
+                                           lid.GroepsWerkJaar.Groep.Code,
+                                           lid.GroepsWerkJaar.WerkJaar,
                                            kipFunctieIDs));
         }


Catch null Player in SendFinalLogOffMessages (#3455)

* Catch null Player in SendFinalLogOffMessages

* Update Session.cs

--- Source/ACE.Server/Network/Session.cs
+++ Source/ACE.Server/Network/Session.cs
@@ -208,7 +208,7 @@
         private void SendFinalLogOffMessages()
         {
             // If we still exist on a landblock, we can't exit yet.
-            if (Player.CurrentLandblock != null)
+            if (Player?.CurrentLandblock != null)
                 return;

             logOffRequestTime = DateTime.MinValue;
@@ -217,8 +217,8 @@
             // This message can be received/processed by the server AFTER LogOfPlayer has been called.
             // What that means is, we could end up with Character changes after the Character has been saved from the initial LogOff request.
             // To make sure we commit these additional changes (if any), we check again here
-            if (Player.CharacterChangesDetected)
-                Player.SaveCharacterToDatabase();
+            if (Player?.CharacterChangesDetected ?? false)
+                Player?.SaveCharacterToDatabase();

             Player = null;


Allow subclasses of both types

Allow subclasses of both types

--- Source/QIRC/Plugins/PluginManager.cs
+++ Source/QIRC/Plugins/PluginManager.cs
@@ -59,7 +59,7 @@
                     IrcPlugin plugin = (IrcPlugin)Activator.CreateInstance(type);
                     plugins.Add(plugin);
                 }
-                else if (type.IsSubclassOf(typeof(IrcCommand)))
+                if (type.IsSubclassOf(typeof(IrcCommand)))
                 {
                     IrcCommand command = (IrcCommand)Activator.CreateInstance(type);
                     commands.Add(command);


Update modules mvids before rewriting an assembly

--- Source/Smocks/IL/AssemblyRewriter.cs
+++ Source/Smocks/IL/AssemblyRewriter.cs
@@ -122,6 +122,9 @@
                 WriteSymbols = hasSymbols
             };

+            foreach (var module in assembly.Modules)
+              module.Mvid = Guid.NewGuid();
+
             assembly.Write(outputPath, writerParameters);

             _rewrittenAssemblies.Add(outputPath);


Concurrency issue fix for multiple factory methods invoked simultaneusly creating same type twice, while second time fails due to multiple type with same name can't be created

--- Sources/Core.Proxy/MessageFactory.cs
+++ Sources/Core.Proxy/MessageFactory.cs
@@ -11,7 +11,7 @@
         private readonly string _namespace;
         private readonly ModuleBuilder _moduleBuilder;

-        private readonly ConcurrentDictionary<string, Type> _types = new ConcurrentDictionary<string, Type>();
+        private readonly ConcurrentDictionary<string, Lazy<Type>> _types = new ConcurrentDictionary<string, Lazy<Type>>();

         public MessageFactory(string ns)
         {
@@ -51,7 +51,9 @@

             ParameterInfo[] parameters = methodInfo.GetParameters();

-            return _types.GetOrAdd(name, n => CreateMessageType(n, parameters));
+            var lazy = _types.GetOrAdd(name, n => new Lazy<Type>(() => CreateMessageType(n, parameters)));
+
+            return lazy.Value;
         }

         public FieldInfo GetMessageFieldInfo(MethodInfo methodInfo, string fieldName)


Added GetInviteStatus consumption to Invite tests

--- Sp.Api.Customer.Acceptance/Invite.cs
+++ Sp.Api.Customer.Acceptance/Invite.cs
@@ -1,32 +1,67 @@
 namespace Sp.Api.Customer.Acceptance
 {
 	using Sp.Api.Shared;
-	using Sp.Api.Shared.Wrappers;
+	using Sp.Test.Helpers;
 	using System;
+	using System.Linq;
 	using System.Net;
 	using Xunit;
 	using Xunit.Extensions;

-	public class Invite
+	public static class Invite
 	{
-		[Theory, AutoSoftwarePotentialApiData]
-		public static void PostCustomerInviteShouldYieldAccepted( SpAuthApi api, RandomCustomerFromListFixture customer, string anonymousVendorName )
+		public static class PostCustomerInvite
 		{
-			var selectedCustomer = customer.Selected;
-			var customerInviteHref = selectedCustomer._links.inviteStatus.href;
-			var customerInvite = new SpCustomerApi.CustomerInvite
+			[Theory, AutoSoftwarePotentialApiData]
+			public static void ShouldYieldAccepted( SpAuthApi api, RandomCustomerFromListFixture customer, string anonymousVendorName )
 			{
-				Customer = selectedCustomer,
-				EmailTo = "test@inishtech.com",
-				VendorName = anonymousVendorName,
-				RequestId = Guid.NewGuid()
-			};
+				var selectedCustomer = customer.Selected;
+				var customerInviteHref = selectedCustomer._links.inviteStatus.href;
+				var customerInvite = new SpCustomerApi.CustomerInvite
+				{
+					Customer = selectedCustomer,
+					EmailTo = "test@inishtech.com",
+					VendorName = anonymousVendorName,
+					RequestId = Guid.NewGuid()
+				};

-			var apiResult = api.InviteCustomer( customerInviteHref, customerInvite );
+				var apiResult = api.InviteCustomer( customerInviteHref, customerInvite );
+				Assert.Equal( HttpStatusCode.Accepted, apiResult.StatusCode );
+			}

-			Assert.Equal( HttpStatusCode.Accepted, apiResult.StatusCode );
+			[Theory, AutoSoftwarePotentialApiData]
+			public static void ShouldTurnInviteStatusOpen( SpAuthApi api, RandomCustomerFromListFixture customer, string anonymousVendorName )
+			{
+				var selectedCustomer = customer.Selected;
+				var customerInviteHref = selectedCustomer._links.inviteStatus.href;
+				string emailToTemplate = "test@inishtech.com";
+				char charToChangeCaseOf = emailToTemplate.ToCharArray().Where( Char.IsLower ).ToArray().ElementAtRandom();
+				string emailToMutated = emailToTemplate.Replace( charToChangeCaseOf, Char.ToUpper( charToChangeCaseOf ) );
+				var customerInvite = new SpCustomerApi.CustomerInvite
+				{
+					Customer = selectedCustomer,
+					EmailTo = emailToMutated,
+					VendorName = anonymousVendorName,
+					RequestId = Guid.NewGuid()
+				};
+				var inviteResult = api.InviteCustomer( customerInviteHref, customerInvite );
+				Assert.Equal( HttpStatusCode.Accepted, inviteResult.StatusCode );
+
+				Verify.EventuallyWithBackOff( () =>
+				{
+					var statusResult = api.GetInviteStatus( customerInviteHref );
+					Assert.Equal( HttpStatusCode.OK, statusResult.StatusCode );
+					var result = statusResult.Data;
+					Assert.Equal( emailToMutated, result.LastInviteSentTo );
+					Assert.Equal( false, result.IsRegistered );
+					Assert.Equal( true, result.IsInviteOpen );
+					Assert.True( result.LastInviteSentDateTime.HasValue );
+					Assert.Equal( DateTime.UtcNow, result.LastInviteSentDateTime.Value, new DateTimeEqualityTolerantComparer( TimeSpan.FromMinutes( 3 ) ) );
+					Assert.True( DateTime.UtcNow < result.LastInviteExpiryDateTime );
+				} );
+			}
 		}
-
+
 		[Theory, AutoSoftwarePotentialApiData]
 		public static void DuplicatePostCustomerInviteShouldYieldConflict( SpAuthApi api, RandomCustomerFromListFixture customer, string anonymousVendorName )
 		{


CreateOrUpdatePart for Function3D fixed

CreateOrUpdatePart for Function3D fixed

Fixes #4

--- Suplanus.Sepla/Helper/PartUtility.cs
+++ Suplanus.Sepla/Helper/PartUtility.cs
@@ -71,7 +71,7 @@
       else
       {
         // Check if pro panel, because there is no update possible
-        bool isProPanel = articleReference.ParentObject is Component;
+        bool isProPanel = articleReference.ParentObject is Function3D;

         string partNrTemp = partNr;
         if (!isProPanel)


refactoring

refactoring

--- TcpSocketService/TcpSocketService.cs
+++ TcpSocketService/TcpSocketService.cs
@@ -116,27 +116,12 @@
         {
             if (operationMode != SocketServiceMode.SERVER)
                 throw new SocketServiceException("Mode not set properly.");
-
-            string listen = "";
+
             try
-            {
-                // finding an IP address to bind to
-                foreach (var item in Windows.Networking.Connectivity.NetworkInformation.GetHostNames())
-                {
-                    if (item.IPInformation != null)
-                    {
-                        if ((item.Type == Windows.Networking.HostNameType.Ipv6) && !useIpv6)
-                            continue;
-
-                        if (item.DisplayName.StartsWith("169.254") && !useAutoAddress)
-                            continue;
-
-                        listen = item.DisplayName;
-                        break;
-                    }
-                }
-
-                if (listen != "")
+            {
+                string listen = findAddress(useAutoAddress, useIpv6);
+
+                if (listen != null)
                 {
                     // start listening
                     socketListener = new StreamSocketListener();
@@ -157,6 +142,35 @@
             {
                 throw new SocketServiceException("Cannot start server.", e);
             }
+        }
+
+        /// <summary>
+        /// Automatic finding to what adddress bind to
+        /// </summary>
+        /// <param name="useAutoAddress">Allows using APIPA addresses (169.254.0.0/16)</param>
+        /// <param name="useIpv6">Allows using IPv6-family addresses</param>
+        /// <returns>IP address possible to bind to, or null</returns>
+        private static string findAddress(bool useAutoAddress, bool useIpv6)
+        {
+            string listen = null;
+
+            // finding an IP address to bind to
+            foreach (var item in Windows.Networking.Connectivity.NetworkInformation.GetHostNames())
+            {
+                if (item.IPInformation != null)
+                {
+                    if ((item.Type == Windows.Networking.HostNameType.Ipv6) && !useIpv6)
+                        continue;
+
+                    if (item.DisplayName.StartsWith("169.254") && !useAutoAddress)
+                        continue;
+
+                    listen = item.DisplayName;
+                    break;
+                }
+            }
+
+            return listen;
         }

         /// <summary>


TcpipAgentTesterがlocalhost以外に接続しないバグを修正

TcpipAgentTesterがlocalhost以外に接続しないバグを修正

--- TcpipAgentTester/TcpipAgentTester.cs
+++ TcpipAgentTester/TcpipAgentTester.cs
@@ -188,7 +188,7 @@
                     Console.Error.WriteLine("Error in creating instance of {0}.", args[1]);
                     Environment.Exit(0);
                 }
-                TcpipClient client = new TcpipClient("localhost", port, null);
+                TcpipClient client = new TcpipClient(host, port, null);
                 client.Completed += Client_Completed;
                 client.Connect(player);
                 are.WaitOne();


Adds test for rounding down by day

Adds test for rounding down by day

--- Tests/Common/Util/ExtensionsTests.cs
+++ Tests/Common/Util/ExtensionsTests.cs
@@ -13,6 +13,7 @@
  * limitations under the License.
 */

+using System;
 using NUnit.Framework;

 namespace QuantConnect.Tests.Common.Util
@@ -40,6 +41,14 @@
             Assert.IsTrue(typeof(Derived2).IsSubclassOfGeneric(typeof(Super<>)));
         }

+        [Test]
+        public void DateTimeRoundDownFullDayDoesntRoundDownByDay()
+        {
+            var date = new DateTime(2000, 01, 01);
+            var rounded = date.RoundDown(TimeSpan.FromDays(1));
+            Assert.AreEqual(date, rounded);
+        }
+
         private class Super<T>
         {
         }


Add subset test after dropping 'symbol' (#5966)

--- Tests/Python/PandasConverterTests.cs
+++ Tests/Python/PandasConverterTests.cs
@@ -324,6 +324,24 @@
                 Assert.Throws<PythonException>(() => test3(dataFrame));
                 Assert.DoesNotThrow(() => test4(dataFrame));

+            }
+        }
+
+        [TestCase(true)]
+        [TestCase(false)]
+        public void BackwardsCompatibilityDataFrame_Subset(bool cache)
+        {
+            if (cache) SymbolCache.Set("SPY", Symbols.SPY);
+
+            using (Py.GIL())
+            {
+                dynamic test = PythonEngine.ModuleFromString("testModule",
+                    $@"
+def Test(dataFrame, symbol):
+    data = dataFrame.droplevel('symbol')
+    data = data[['lastprice', 'quantity']][:-1]").GetAttr("Test");
+
+                Assert.DoesNotThrow(() => test(GetTestDataFrame(Symbols.SPY), Symbols.SPY));
             }
         }


Update GamePresenter.cs

Update GamePresenter.cs

--- TicTacToe/Presenter/GamePresenter.cs
+++ TicTacToe/Presenter/GamePresenter.cs
@@ -1,4 +1,4 @@
-using System.Drawing;
+using System.Drawing;
 using System.Windows.Forms;
 using TicTacToe.Model;

@@ -8,6 +8,7 @@
     {
         private readonly ITicTacToeForm view;
         private readonly IGridModel model;
+
         public GamePresenter(ITicTacToeForm view, IGridModel model)
         {
             this.view = view;


Default System.PreferGitFromPath to false (#2958)

Prior to the port to AgentKnobs, we used git
from the path always on Linux and Mac, but on
Windows we preferred the MinGit shipped with the
agent, unless the System.PreferGitFromPath variable
was present and true. The fact that this config
defaulted to false wasn't obvious because it
relied on Boolean.TryParse setting the output
variable to false on a failure parsing a non-existent
environment variable. The default has changed by
mistake in the port to knobs, causing checkouts to
fail on Windows systems with no git in the path.

--- src/Agent.Sdk/Knob/AgentKnobs.cs
+++ src/Agent.Sdk/Knob/AgentKnobs.cs
@@ -48,7 +48,7 @@
             "Determines which Git we will use on Windows. By default, we prefer the built-in portable git in the agent's externals folder, setting this to true makes the agent find git.exe from %PATH% if possible.",
             new RuntimeKnobSource("system.prefergitfrompath"),
             new EnvironmentKnobSource("system.prefergitfrompath"),
-            new BuiltInDefaultKnobSource("true"));
+            new BuiltInDefaultKnobSource("false"));

         public static readonly Knob DisableGitPrompt = new Knob(
             nameof(DisableGitPrompt),


Revert "Using switch expression"

Revert "Using switch expression"

This reverts commit 83e9e4bdddc6bad5eeba54b9dd3337e842be3086.

--- src/Benchmark/TestAdaptHelper.cs
+++ src/Benchmark/TestAdaptHelper.cs
@@ -72,13 +72,20 @@

         private static void SetupCompiler(MapsterCompilerType type)
         {
-            TypeAdapterConfig.GlobalSettings.Compiler = type switch
+            switch (type)
             {
-                MapsterCompilerType.Default => _defaultCompiler,
-                MapsterCompilerType.Roslyn => exp => exp.CompileWithDebugInfo(),
-                MapsterCompilerType.FEC => exp => exp.CompileFast(),
-                _ => throw new ArgumentOutOfRangeException(nameof(type)),
-            };
+                case MapsterCompilerType.Default:
+                    TypeAdapterConfig.GlobalSettings.Compiler = _defaultCompiler;
+                    break;
+                case MapsterCompilerType.Roslyn:
+                    TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileWithDebugInfo();
+                    break;
+                case MapsterCompilerType.FEC:
+                    TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileFast();
+                    break;
+                default:
+                    throw new ArgumentOutOfRangeException(nameof(type));
+            }
         }
         public static void ConfigureMapster(Foo fooInstance, MapsterCompilerType type)
         {


Fixed Yak issues

Fixed Yak issues

--- src/Biomorpher/BiomorpherInfo.cs
+++ src/Biomorpher/BiomorpherInfo.cs
@@ -23,7 +23,7 @@
         }
         public override string Version
         {
-            get { return Friends.VerionInfo(); }
+            get { return "0.7.1"; }
         }
         public override Guid Id
         {


Removed duplicated file version

Removed duplicated file version

--- src/Common/CommonAssemblyInfo.cs
+++ src/Common/CommonAssemblyInfo.cs
@@ -12,7 +12,6 @@
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 [assembly: AssemblyConfiguration("")]
-[assembly: AssemblyFileVersion("0.0.3")]
 [assembly: ComVisible(false)]
 [assembly: CLSCompliant(false)]


Fixed SendMessage overload

Fixed SendMessage overload

--- src/Discord.Net/DiscordClient.cs
+++ src/Discord.Net/DiscordClient.cs
@@ -756,7 +756,7 @@
 		public Task<Message[]> SendMessage(string channelId, string text)
 			=> SendMessage(channelId, text, new string[0]);
 		public Task<Message[]> SendMessage(Channel channel, string text, string[] mentions)
-			=> SendMessage(channel, text, mentions);
+			=> SendMessage(channel.Id, text, mentions);
         public async Task<Message[]> SendMessage(string channelId, string text, string[] mentions)
 		{
 			CheckReady();


Missing null check on CurrentRemote

Missing null check on CurrentRemote

--- src/GitHub.Api/Git/Repository.cs
+++ src/GitHub.Api/Git/Repository.cs
@@ -354,18 +354,18 @@
             new ActionTask(CancellationToken.None, () => {
                 if (!Nullable.Equals(CurrentConfigBranch, branch))
                 {
-                        var currentBranch = branch != null ? (GitBranch?)GetLocalGitBranch(branch.Value) : null;
-
-                        CurrentConfigBranch = branch;
-                        CurrentBranch = currentBranch;
-                        UpdateLocalBranches();
+                    var currentBranch = branch != null ? (GitBranch?)GetLocalGitBranch(branch.Value) : null;
+
+                    CurrentConfigBranch = branch;
+                    CurrentBranch = currentBranch;
+                    UpdateLocalBranches();
                 }

                 if (!Nullable.Equals(CurrentConfigRemote, remote))
                 {
-                        CurrentConfigRemote = remote;
-                        CurrentRemote = GetGitRemote(remote.Value);
-                        ClearRepositoryInfo();
+                    CurrentConfigRemote = remote;
+                    CurrentRemote = remote.HasValue ? (GitRemote?)GetGitRemote(remote.Value) : null;
+                    ClearRepositoryInfo();
                 }
             }) { Affinity = TaskAffinity.UI }.Start();
         }
@@ -412,12 +412,10 @@

         private void UpdateLocks()
         {
-            if (string.IsNullOrEmpty(CurrentRemote?.Url))
-            {
-                return;
-            }
-
-            repositoryManager?.UpdateLocks();
+            if (CurrentRemote.HasValue)
+            {
+                repositoryManager?.UpdateLocks();
+            }
         }

         private void UpdateLocalBranches()


build 7.1.16.0

build 7.1.16.0

--- src/Global/GlobalAssemblyInfo.cs
+++ src/Global/GlobalAssemblyInfo.cs
@@ -23,4 +23,4 @@
 // [assembly: AssemblyVersion("1.0.*")]

 // Keep in track with CA API version
-[ assembly : AssemblyVersion( "7.1.16.0" ) ]+[ assembly : AssemblyVersion( "7.1.17.0" ) ]


Allow visualtests to share config etc. with osu!.

--- osu.Desktop.VisualTests/Program.cs
+++ osu.Desktop.VisualTests/Program.cs
@@ -18,7 +18,7 @@
         [STAThread]
         public static void Main(string[] args)
         {
-            using (BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests"))
+            using (BasicGameHost host = Host.GetSuitableHost(@"osu"))
             {
                 Ruleset.Register(new OsuRuleset());
                 Ruleset.Register(new TaikoRuleset());


Fix texture being inverted

Fix texture being inverted

--- osu.Framework/Graphics/DrawNode.cs
+++ osu.Framework/Graphics/DrawNode.cs
@@ -274,7 +274,7 @@
             RectangleF textureRect = new RectangleF(0, frameBuffer.Texture.Height, frameBuffer.Texture.Width, -frameBuffer.Texture.Height);

             if (frameBuffer.Texture.TextureGL.Bind())
-                DrawQuad(frameBuffer.Texture, vertexQuad, drawColour, textureRect, vertexAction, inflationPercentage, blendRangeOverride);
+                DrawQuad(frameBuffer.Texture.TextureGL, vertexQuad, drawColour, textureRect, vertexAction, inflationPercentage, blendRangeOverride);
         }

         /// <summary>


fix new panels appearing too soon

fix new panels appearing too soon

--- osu.Game/Overlays/SocialOverlay.cs
+++ osu.Game/Overlays/SocialOverlay.cs
@@ -153,7 +153,7 @@
                 if(panels != null)
                     ScrollFlow.Remove(panels);

-                ScrollFlow.Add(panels = newPanels);
+                Scheduler.AddDelayed(() => ScrollFlow.Add(panels = newPanels), 200);
             });
         }


Change some defaults and always tween

Change some defaults and always tween

--- osu.Game/Rulesets/Mods/ModMuted.cs
+++ osu.Game/Rulesets/Mods/ModMuted.cs
@@ -37,7 +37,7 @@

         private AudioContainer metronomeContainer;

-        [SettingSource("Enable metronome", "Add a metronome to help you keep track of the rhythm.")]
+        [SettingSource("Enable metronome", "Add a metronome beat to help you keep track of the rhythm.")]
         public BindableBool EnableMetronome { get; } = new BindableBool
         {
             Default = true,
@@ -63,8 +63,8 @@
         [SettingSource("Mute hit sounds", "Hit sounds are also muted alongside the track.")]
         public BindableBool AffectsHitSounds { get; } = new BindableBool
         {
-            Default = false,
-            Value = false
+            Default = true,
+            Value = true
         };

         public void ApplyToTrack(ITrack track)
@@ -97,16 +97,8 @@
                 if (InverseMuting.Value)
                     dimFactor = 1 - dimFactor;

-                if (combo.NewValue < combo.OldValue)
-                {
-                    scoreProcessor.TransformBindableTo(metronomeVolumeAdjust, dimFactor, 200, Easing.OutQuint);
-                    scoreProcessor.TransformBindableTo(mainVolumeAdjust, 1 - dimFactor, 200, Easing.OutQuint);
-                }
-                else
-                {
-                    metronomeVolumeAdjust.Value = dimFactor;
-                    mainVolumeAdjust.Value = 1 - dimFactor;
-                }
+                scoreProcessor.TransformBindableTo(metronomeVolumeAdjust, dimFactor, 500, Easing.OutQuint);
+                scoreProcessor.TransformBindableTo(mainVolumeAdjust, 1 - dimFactor, 500, Easing.OutQuint);
             }, true);
         }


Fix attempt to change ruleset/beatmap bindables while screen is not active

--- osu.Game/Screens/Play/Spectator.cs
+++ osu.Game/Screens/Play/Spectator.cs
@@ -63,6 +63,11 @@

         private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;

+        /// <summary>
+        /// Becomes true if a new state is waiting to be loaded (while this screen was not active).
+        /// </summary>
+        private bool newStatePending;
+
         public Spectator([NotNull] User targetUser)
         {
             this.targetUser = targetUser ?? throw new ArgumentNullException(nameof(targetUser));
@@ -162,7 +167,21 @@

             this.state = state;

-            Schedule(attemptStart);
+            if (this.IsCurrentScreen())
+                Schedule(attemptStart);
+            else
+                newStatePending = true;
+        }
+
+        public override void OnResuming(IScreen last)
+        {
+            base.OnResuming(last);
+
+            if (newStatePending)
+            {
+                attemptStart();
+                newStatePending = false;
+            }
         }

         private void userFinishedPlaying(int userId, SpectatorState state)


Add a few icons for categories from Segoe MDL2 Assets font family

--- UniversalSoundBoard/MainPage.xaml.cs
+++ UniversalSoundBoard/MainPage.xaml.cs
@@ -292,20 +292,26 @@
             StackPanel stackPanel = new StackPanel();
             stackPanel.Orientation = Orientation.Vertical;

+            List<string> IconsList = createIconsList();
+
+            Random random = new Random();
+            int randomNumber = random.Next(IconsList.Count);
+
             NewCategoryTextBox = new TextBox { Width = 300 };
             NewCategoryTextBox.Text = "";

             IconSelectionComboBox = new ComboBox
             {
                 FontFamily = new FontFamily("Segoe MDL2 Assets"),
-                FontSize = 25
+                FontSize = 25,
+                Margin = new Thickness(15),
+                HorizontalAlignment = HorizontalAlignment.Center
             };
-            IconSelectionComboBox.Items.Add(new ComboBoxItem { Content = "\uE10F", FontFamily = new FontFamily("Segoe MDL2 Assets"), FontSize = 25 });
-            IconSelectionComboBox.Items.Add(new ComboBoxItem { Content = "\uE767", FontFamily = new FontFamily("Segoe MDL2 Assets"), FontSize = 25 });
-            IconSelectionComboBox.Items.Add(new ComboBoxItem { Content = "\uE768", FontFamily = new FontFamily("Segoe MDL2 Assets"), FontSize = 25 });
-            IconSelectionComboBox.Items.Add(new ComboBoxItem { Content = "\uE899", FontFamily = new FontFamily("Segoe MDL2 Assets"), FontSize = 25 });
-            IconSelectionComboBox.Items.Add(new ComboBoxItem { Content = "\uE8D7", FontFamily = new FontFamily("Segoe MDL2 Assets"), FontSize = 25 });
-            IconSelectionComboBox.Items.Add(new ComboBoxItem { Content = "\uE8C9", FontFamily = new FontFamily("Segoe MDL2 Assets"), FontSize = 25 });
+            foreach(string icon in IconsList)
+            {
+                IconSelectionComboBox.Items.Add(new ComboBoxItem { Content = icon, FontFamily = new FontFamily("Segoe MDL2 Assets"), FontSize = 25 });
+            }
+            IconSelectionComboBox.SelectedIndex = randomNumber;

             stackPanel.Children.Add(NewCategoryTextBox);
             stackPanel.Children.Add(IconSelectionComboBox);
@@ -367,5 +373,88 @@
             }
             SideBar.IsPaneOpen = false;
         }
+
+        private List<string> createIconsList()
+        {
+            List<string> Icons = new List<string>();
+            Icons.Add("\uE707");
+            Icons.Add("\uE70F");
+            Icons.Add("\uE710");
+            Icons.Add("\uE711");
+            Icons.Add("\uE713");
+            Icons.Add("\uE714");
+            Icons.Add("\uE715");
+            Icons.Add("\uE716");
+            Icons.Add("\uE717");
+            Icons.Add("\uE718");
+            Icons.Add("\uE719");
+            Icons.Add("\uE71B");
+            Icons.Add("\uE71C");
+            Icons.Add("\uE71E");
+            Icons.Add("\uE720");
+            Icons.Add("\uE722");
+            Icons.Add("\uE723");
+            Icons.Add("\uE72C");
+            Icons.Add("\uE72D");
+            Icons.Add("\uE730");
+            Icons.Add("\uE734");
+            Icons.Add("\uE735");
+            Icons.Add("\uE73A");
+            Icons.Add("\uE73E");
+            Icons.Add("\uE74D");
+            Icons.Add("\uE74E");
+            Icons.Add("\uE74F");
+            Icons.Add("\uE753");
+            Icons.Add("\uE765");
+            Icons.Add("\uE767");
+            Icons.Add("\uE768");
+            Icons.Add("\uE769");
+            Icons.Add("\uE76E");
+            Icons.Add("\uE774");
+            Icons.Add("\uE77A");
+            Icons.Add("\uE77B");
+            Icons.Add("\uE77F");
+            Icons.Add("\uE786");
+            Icons.Add("\uE7AD");
+            Icons.Add("\uE7C1");
+            Icons.Add("\uE7C3");
+            Icons.Add("\uE7EE");
+            Icons.Add("\uE7EF");
+            Icons.Add("\uE80F");
+            Icons.Add("\uE81D");
+            Icons.Add("\uE890");
+            Icons.Add("\uE894");
+            Icons.Add("\uE895");
+            Icons.Add("\uE896");
+            Icons.Add("\uE897");
+            Icons.Add("\uE899");
+            Icons.Add("\uE8AA");
+            Icons.Add("\uE8B1");
+            Icons.Add("\uE8B8");
+            Icons.Add("\uE8BD");
+            Icons.Add("\uE8C3");
+            Icons.Add("\uE8C6");
+            Icons.Add("\uE8C9");
+            Icons.Add("\uE8D6");
+            Icons.Add("\uE8D7");
+            Icons.Add("\uE8E1");
+            Icons.Add("\uE8E0");
+            Icons.Add("\uE8EA");
+            Icons.Add("\uE8EB");
+            Icons.Add("\uE8EC");
+            Icons.Add("\uE8EF");
+            Icons.Add("\uE8F0");
+            Icons.Add("\uE8F1");
+            Icons.Add("\uE8F3");
+            Icons.Add("\uE8FB");
+            Icons.Add("\uE909");
+            Icons.Add("\uE90A");
+            Icons.Add("\uE90B");
+            Icons.Add("\uE90F");
+            Icons.Add("\uE910");
+            Icons.Add("\uE913");
+
+            return Icons;
+        }
     }
 }


Fixed test

Fixed test

--- src/InstaSharp.Tests/Realtime.cs
+++ src/InstaSharp.Tests/Realtime.cs
@@ -82,7 +82,7 @@
         {
             var result = JsonConvert.DeserializeObject<SubscriptionsResponse>(SubscriptionCreateResponseREAL);
             Assert.AreEqual(200, result.Meta.Code);
-            Assert.AreEqual(9580368, result.Data.Id);
+            Assert.AreEqual("9580368", result.Data.Id);
         }

         [TestCategory("Subscribe.Create")]