Refactor RPCGen structure serialization and deserialization

--- src/Tools/RPCGen/Generator.cs
+++ src/Tools/RPCGen/Generator.cs
@@ -897,7 +897,7 @@
                     GenerateStructSerialize(param);
                     break;
                 case TType.Class:
-                    GenerateClassSerialize(param);
+                    GenerateStructSerialize(param);
                     break;
                 case TType.Array:
                     GenerateArraySerialize(param);
@@ -955,70 +955,48 @@
         }

         /// <summary>
-        /// Generates the code to serialize a class
-        /// </summary>
-        internal void GenerateClassSerialize(Parameter param)
-        {
-            var typeImpl = string.Format("_typeImpl{0}", GenericIndex++);
-            var typeBase = string.Format("_typeBase{0}", GenericIndex++);
-            var paramName = ToTitleCase(param.Name);
-            WriteLine("var {0} = System.Type.GetType({1}.GetType().Name + \"Impl\");", typeImpl, paramName);
-            WriteLine("var {0} = {1}.GetType();", typeBase, paramName);
-
-            WriteLine("var {0}Impl = Activator.CreateInstance({1}) as {2}Impl;", ToTitleCase(param.Name),
-                      typeImpl, param.ParameterType.Name);
-            var props = string.Format("_props{0}", GenericIndex++);
-            WriteLine("IEnumerable<PropertyInfo> {0} = {1}.GetAllProperties({2});", props, UtilsPathName, typeImpl);
-            var iter = string.Format("_iter{0}", GenericIndex++);
-            WriteLine("foreach (var {0} in {1})", iter, props);
-            WriteStartBraceIndent();
-
-            var propName = string.Format("_propName{0}", GenericIndex++);
-            var fInfo = string.Format("_fInfo{0}", GenericIndex++);
-            var pInfo = string.Format("_pInfo{0}", GenericIndex++);
-            WriteLine("var {0} = {1}.Name;", propName, iter);
-            WriteLine("var {0} = {1}.GetField({2}, {3});", fInfo, UtilsPathName, typeBase, propName);
-            WriteLine("var {0} = {1}.GetProperty({2}, {3});", pInfo, UtilsPathName, typeBase, propName);
-            WriteLine("if (!({0} != null ^ {1} != null))", fInfo, pInfo);
-            PushIndent();
-            WriteLine("continue;");
-            PopIndent();
-            var value = string.Format("_value{0}", GenericIndex++);
-            WriteLine("var {0} = ({1} != null) ? {1}.GetValue({3}) : {2}.GetValue({3});", value, fInfo, pInfo,
-                      paramName);
-            WriteLine("{0}.SetValue({1}Impl, {2});", iter, paramName, value);
-
-            WriteCloseBraceIndent();
-            WriteLine("{0}Impl.Write(oprot);", paramName);
-        }
-
-        /// <summary>
         /// Generates the code to serialize a field of type struct
         /// </summary>
         internal void GenerateStructSerialize(Parameter param)
         {
-            WriteLine("var {0}Impl = new {1}Impl()", ToTitleCase(param.Name),
-                param.ParameterType.Name);
-            WriteStartBraceIndent();
-
-            foreach (var field in GetAllFields(param.ParameterType))
+            var objName = ToTitleCase(param.Name);
+            GenerateStructSerialize(param.ParameterType, objName);
+        }
+
+        /// <summary>
+        /// Generates the code to serialize a field of type struct
+        /// </summary>
+        internal void GenerateStructSerialize(Type type, string varName)
+        {
+            var implObjName = varName + "Impl";
+            WriteLine("var {0} = new {1}Impl();", implObjName, type.Name);
+            GenerateStructInit(type, varName, implObjName, true);
+            WriteLine("{0}.Write(oprot);", implObjName);
+        }
+
+        /// <summary>
+        /// Generates the code to serialize a field of type struct
+        /// </summary>
+        internal void GenerateStructInit(Type type, string origObjName, string destObjName, bool destTitleCase = true)
+        {
+            foreach (var field in GetAllFields(type))
             {
                 if (!Metadata.HasId(field))
                     continue;

-                WriteLine("{1} = {0}.{1},", ToTitleCase(param.Name), field.Name);
-            }
-            foreach (var property in GetAllProperties(param.ParameterType))
+                var destName = (destTitleCase)? ToTitleCase(field.Name) : field.Name;
+                var origName = (!destTitleCase)? ToTitleCase(field.Name) : field.Name;
+                WriteLine("{0}.{1} = {2}.{3};", destObjName, destName, origObjName, origName);
+            }
+            foreach (var property in GetAllProperties(type))
             {
                 if (!Metadata.HasId(property))
                     continue;

-                WriteLine("{1} = {0}.{1},", ToTitleCase(param.Name), property.Name);
-            }
-
-            PopIndent();
-            WriteLine("};");
-            WriteLine("{0}Impl.Write(oprot);", ToTitleCase(param.Name));
+                var destName = (destTitleCase)? ToTitleCase(property.Name) : property.Name;
+                var origName = (!destTitleCase)? ToTitleCase(property.Name) : property.Name;
+                 WriteLine("{0}.{1} = {2}.{3};", destObjName, destName, origObjName, origName);
+            }
         }

         /// <summary>
@@ -1148,28 +1126,10 @@
                     throw new NotSupportedException();
                 case TType.Struct:
                 case TType.Exception:
-                    WriteLine("var {0} = new {1}Impl()", elemName, elemType.Name);
-                    WriteStartBraceIndent();
-                    foreach (var field in GetAllFields(elemType))
-                    {
-                        if (!Metadata.HasId(field))
-                            continue;
-
-                        WriteLine("{0} = {1}.{0},", field.Name, iterName);
-                    }
-                    foreach (var property in GetAllProperties(elemType))
-                    {
-                        if (!Metadata.HasId(property))
-                            continue;
-
-                        WriteLine("{0} = {1}.{0},", property.Name, iterName);
-                    }
-                    PopIndent();
-                    WriteLine("};");
-                    WriteLine("{0}.Write(oprot);", elemName);
+                    GenerateStructSerialize(elemType, elemName);
                     break;
                 case TType.Class:
-                    GenerateContainerClassElementSerialization(elemType, iterName);
+                    GenerateStructSerialize(elemType, elemName);
                     break;
                 case TType.Bool:
                 case TType.Byte:
@@ -1266,7 +1226,7 @@
                     GenerateStructDeserialize(param);
                     break;
                 case TType.Class:
-                    GenerateClassDeserialize(param);
+                    GenerateStructDeserialize(param);
                     break;
                 case TType.Array:
                     GenerateArrayDeserialize(param);
@@ -1404,80 +1364,19 @@
         /// </summary>
         internal void GenerateStructDeserialize(Parameter param)
         {
-            WriteLine("var {0}Impl = new {1}Impl();", ToTitleCase(param.Name),
-                param.ParameterType.Name);
-            WriteLine("{0}Impl.Read(iprot);", ToTitleCase(param.Name));
-
-            WriteLine("{0} = new {1}()", ToTitleCase(param.Name),
-                ConvertToTypeString(param.ParameterType));
-            WriteStartBraceIndent();
-
-            foreach (var field in GetAllFields(param.ParameterType))
-            {
-                if (!Metadata.HasId(field))
-                    continue;
-
-                WriteLine("{1} = {0}Impl.{1},", ToTitleCase(param.Name), field.Name);
-            }
-            foreach (var property in GetAllProperties(param.ParameterType))
-            {
-                if (!Metadata.HasId(property))
-                    continue;
-
-                WriteLine("{1} = {0}Impl.{1},", ToTitleCase(param.Name), property.Name);
-            }
-
-            PopIndent();
-            WriteLine("};");
-        }
-
-        /// <summary>
-        /// Generates the code to deserialize a class
-        /// </summary>
-        internal void GenerateClassDeserialize(Parameter param)
-        {
-            var typeImpl = string.Format("_typeImpl{0}", GenericIndex++);
-            var typeBase = string.Format("_typeBase{0}", GenericIndex++);
-            var paramName = ToTitleCase(param.Name);
-            WriteLine("var {0} = System.Type.GetType(field.ClassName + \"Impl\");", typeImpl);
-            WriteLine("var {0} = System.Type.GetType(field.ClassName);", typeBase);
-
-            WriteLine("var {0}Impl = Activator.CreateInstance({1}) as {2}Impl;", ToTitleCase(param.Name),
-                      typeImpl, param.ParameterType.Name);
-
-            WriteLine("{0}Impl.Read(iprot);", ToTitleCase(param.Name));
-
-            WriteLine("{0} = Activator.CreateInstance({1}) as {2};", ToTitleCase(param.Name),
-                       typeBase, param.ParameterType.FullName);
-
-            var props = string.Format("_props{0}", GenericIndex++);
-            WriteLine("IEnumerable<PropertyInfo> {0} = {1}.GetAllProperties({2});", props, UtilsPathName, typeImpl);
-            var iter = string.Format("_iter{0}", GenericIndex++);
-            WriteLine("foreach (var {0} in {1})", iter, props);
-            WriteStartBraceIndent();
-
-            var propName = string.Format("_propName{0}", GenericIndex++);
-            var fInfo = string.Format("_fInfo{0}", GenericIndex++);
-            var pInfo = string.Format("_pInfo{0}", GenericIndex++);
-            WriteLine("var {0} = {1}.Name;", propName, iter);
-            WriteLine("var {0} = {1}.GetField({2}, {3});", fInfo, UtilsPathName, typeBase, propName);
-            WriteLine("var {0} = {1}.GetProperty({2}, {3});", pInfo, UtilsPathName, typeBase, propName);
-            WriteLine("if (!({0} != null ^ {1} != null))", fInfo, pInfo);
-            PushIndent();
-            WriteLine("continue;");
-            PopIndent();
-            var value = string.Format("_value{0}", GenericIndex++);
-            WriteLine("var {0} = {1}.GetValue({2}Impl);", value, iter,
-                      paramName);
-            WriteLine("if ({0} != null)", fInfo);
-            PushIndent();
-            WriteLine("{0}.SetValue({1}, {2});", fInfo, paramName, value);
-            PopIndent();
-            WriteLine("else");
-            PushIndent();
-            WriteLine("{0}.SetValue({1}, {2});", pInfo, paramName, value);
-            PopIndent();
-            WriteCloseBraceIndent();
+            GenerateStructDeserialize(param.ParameterType, ToTitleCase(param.Name));
+        }
+
+        /// <summary>
+        /// Generates the code to deserialize a field of type struct
+        /// </summary>
+        internal void GenerateStructDeserialize(Type type, string varName)
+        {
+            var origObjName = varName+"Impl";
+            WriteLine("var {0} = new {1}Impl();", origObjName, type.Name);
+            WriteLine("{0}.Read(iprot);", origObjName);
+            WriteLine("{0} = new {1}();", varName, type.FullName);
+            GenerateStructInit(type, origObjName, varName, false);
         }

         /// <summary>
@@ -1695,29 +1594,10 @@
                 case TType.Struct:

                 case TType.Exception:
-                    WriteLine("var {0} = new {1}Impl();", elemNameImpl, elemType.Name);
-                    WriteLine("{0}.Read(iprot);", elemNameImpl);
-
-                    WriteLine("var {0} = new {1}()", elemName, elemType.FullName);
-                    WriteStartBraceIndent();
-                    foreach (var field in GetAllFields(elemType))
-                    {
-                        if (!Metadata.HasId(field))
-                            continue;
-                        WriteLine("{0} = {1}.{0},", field.Name, elemNameImpl);
-                    }
-                    foreach (var property in GetAllProperties(elemType))
-                    {
-                        if (!Metadata.HasId(property))
-                            continue;
-                        WriteLine("{0} = {1}.{0},", property.Name, elemNameImpl);
-                    }
-                    PopIndent();
-                    WriteLine("};");
-
+                    GenerateStructInit(elemType, elemName, elemNameImpl, false);
                     break;
                 case TType.Class:
-                    GenerateContainerClassElementDeserialization(elemType, elemName);
+                    GenerateStructInit(elemType, elemName, elemNameImpl, false);
                     break;
                 case TType.Bool:
                 case TType.Byte:


simplify/optimize CreateClientContext for forms auth

--- ACASLibraries.Security/AzSecurityManager.cs
+++ ACASLibraries.Security/AzSecurityManager.cs
@@ -29,19 +29,19 @@
 		/// <summary>
 		/// Internal reference for IAzApplication.  Instantiated from azStore.
 		/// </summary>
-		#if UseVersion1Types
+#if UseVersion1Types
 		private IAzApplication azApplication = null;
-		#else
+#else
 		private IAzApplication3 azApplication = null;
-		#endif
+#endif
 		/// <summary>
 		/// Internal reference for IAzClientContext.  Stores the last context or used client context.
 		/// </summary>
-		#if UseVersion1Types
+#if UseVersion1Types
 		private IAzClientContext clientContext = null;
-		#else
+#else
 		private IAzClientContext3 clientContext = null;
-		#endif
+#endif
 		/// <summary>
 		/// Internal reference for username last used when creating a context with username and domain
 		/// </summary>
@@ -54,10 +54,11 @@
 		/// Internal reference required for IDisposable implementation
 		/// </summary>
 		private bool disposed = false;
-
-		private bool traceEnabled = false;
+
+		private bool traceEnabled = false;
 		private TraceType traceType = TraceType.None;
-		private enum TraceType {
+		private enum TraceType
+		{
 			HttpContext,
 			SystemDiagnostics,
 			None
@@ -78,11 +79,11 @@
 		/// <summary>
 		/// Get thes active IAzApplication instance for the SecurityManager
 		/// </summary>
-		#if UseVersion1Types
+#if UseVersion1Types
 		public IAzApplication AzApplication
-		#else
+#else
 		public IAzApplication3 AzApplication
-		#endif
+#endif
 		{
 			get
 			{
@@ -92,15 +93,15 @@
 		/// <summary>
 		/// Get thes active IAzClientContext instance for the SecurityManager
 		/// </summary>
-		#if UseVersion1Types
+#if UseVersion1Types
 		public IAzClientContext AzClientContext
-		#else
+#else
 		public IAzClientContext3 AzClientContext
-		#endif
+#endif
 		{
 			get
 			{
-				if(clientContext == null)
+				if (clientContext == null)
 				{
 					CreateClientContext();
 				}
@@ -117,11 +118,14 @@
 		{

 			traceEnabled = ((HttpContext.Current != null && HttpContext.Current.Trace.IsEnabled) || (System.Diagnostics.Trace.Listeners.Count > 0));
-			if(traceEnabled) {
-				if(HttpContext.Current != null && HttpContext.Current.Trace.IsEnabled) {
+			if (traceEnabled)
+			{
+				if (HttpContext.Current != null && HttpContext.Current.Trace.IsEnabled)
+				{
 					traceType = TraceType.HttpContext;
 				}
-				else if(System.Diagnostics.Trace.Listeners.Count > 0) {
+				else if (System.Diagnostics.Trace.Listeners.Count > 0)
+				{
 					traceType = TraceType.SystemDiagnostics;
 				}
 			}
@@ -129,13 +133,15 @@

 			string azApplicationName = ConfigurationManager.AppSettings["AzManApplication"];
 			string azPolicyStore = ConfigurationManager.AppSettings["AzManPolicyStore"];
-			if(string.IsNullOrEmpty(azPolicyStore)) {
-				if(ConfigurationManager.ConnectionStrings["AzManPolicyStore"] != null) {
+			if (string.IsNullOrEmpty(azPolicyStore))
+			{
+				if (ConfigurationManager.ConnectionStrings["AzManPolicyStore"] != null)
+				{
 					azPolicyStore = ConfigurationManager.ConnectionStrings["AzManPolicyStore"].ConnectionString;
 				}
 			}

-			if(azPolicyStore != null && azApplicationName != null)
+			if (azPolicyStore != null && azApplicationName != null)
 			{
 				OpenApplication(azPolicyStore, azApplicationName);
 			}
@@ -144,7 +150,7 @@
 		{
 			//try
 			//{
-				OpenApplication(PolicyStoreUri, Application);
+			OpenApplication(PolicyStoreUri, Application);
 			//}
 			//catch(exception oException)
 			//{
@@ -181,20 +187,20 @@
 		/// <param name="policyStoreUri">The uri of the policy store.</param>
 		public void OpenPolicyStore(string policyStoreUri)
 		{
-			if(!policyStoreUri.ToLower().StartsWith("msxml:") && !policyStoreUri.ToLower().StartsWith("msldap:") && policyStoreUri.ToLower().EndsWith("xml"))
+			if (!policyStoreUri.ToLower().StartsWith("msxml:") && !policyStoreUri.ToLower().StartsWith("msldap:") && policyStoreUri.ToLower().EndsWith("xml"))
 			{
 				//auto-prefix xml file store path to application root
-				if(HttpContext.Current != null)
+				if (HttpContext.Current != null)
 				{
 					policyStoreUri = String.Concat("msxml://", HttpContext.Current.Request.PhysicalApplicationPath, policyStoreUri);
 				}
-				else if(System.Windows.Forms.Application.ExecutablePath != null)
+				else if (System.Windows.Forms.Application.ExecutablePath != null)
 				{
 					policyStoreUri = String.Concat("msxml://", System.Windows.Forms.Application.StartupPath, @"\", policyStoreUri);
 				}
 			}

-			TraceWrite("AzSecurityManager.OpenApplication()", "Opening policy store at \""+policyStoreUri+"\"");
+			TraceWrite("AzSecurityManager.OpenApplication()", "Opening policy store at \"" + policyStoreUri + "\"");

 			azStore = new AzAuthorizationStoreClass();
 			azStore.Initialize(0, policyStoreUri, null);
@@ -224,32 +230,32 @@
 		/// <param name="applicationName">The name of the application to open in the policy store</param>
 		public void OpenApplication(string policyStoreUri, string applicationName)
 		{
-			if(!policyStoreUri.ToLower().StartsWith("msxml:") && !policyStoreUri.ToLower().StartsWith("msldap:") && policyStoreUri.ToLower().EndsWith("xml"))
+			if (!policyStoreUri.ToLower().StartsWith("msxml:") && !policyStoreUri.ToLower().StartsWith("msldap:") && policyStoreUri.ToLower().EndsWith("xml"))
 			{
 				//auto-prefix xml file store path to application root
-				if(HttpContext.Current != null)
+				if (HttpContext.Current != null)
 				{
 					policyStoreUri = String.Concat("msxml://", HttpContext.Current.Request.PhysicalApplicationPath, policyStoreUri);
 				}
-				else if(System.Windows.Forms.Application.ExecutablePath != null)
+				else if (System.Windows.Forms.Application.ExecutablePath != null)
 				{
 					policyStoreUri = String.Concat("msxml://", System.Windows.Forms.Application.StartupPath, @"\", policyStoreUri);
 				}
 			}

-			TraceWrite("AzSecurityManager.OpenApplication()", "Opening policy store at \""+policyStoreUri+"\" and application \""+applicationName+"\"");
+			TraceWrite("AzSecurityManager.OpenApplication()", "Opening policy store at \"" + policyStoreUri + "\" and application \"" + applicationName + "\"");

 			azStore = new AzAuthorizationStoreClass();
 			azStore.Initialize(0, policyStoreUri, null);
-			#if UseVersion1Types
+#if UseVersion1Types
 			azApplication = azStore.OpenApplication(applicationName, null);
-			#else
+#else
 			azApplication = (IAzApplication3)azStore.OpenApplication2(applicationName, null);
-			#endif
+#endif
 		}
 		public void OpenApplication(string applicationName)
 		{
-			TraceWrite("AzSecurityManager.OpenApplication()", "Opening application \""+applicationName+"\"");
+			TraceWrite("AzSecurityManager.OpenApplication()", "Opening application \"" + applicationName + "\"");
 			azApplication = (IAzApplication3)azStore.OpenApplication(applicationName, null);
 		}
 		#endregion
@@ -261,69 +267,59 @@
 		/// </summary>
 		public void CreateClientContext()
 		{
-			if(azApplication != null)
-			{
-				WindowsIdentity identity = null;
-				if(HttpContext.Current != null && HttpContext.Current.User.Identity is WindowsIdentity)
-				{
-					//this happens when we use WindowsAuthentication
-					identity = (WindowsIdentity)HttpContext.Current.User.Identity;
-				}
-				else if (HttpContext.Current != null)
-				{
-					//We're probably using FormsAuthentication. Lookup the account and get a corresponding WindowsIdentity
-					//assumes the FormsIdentity is in the format DOMAIN\username
-					using (PrincipalContext context = new PrincipalContext(System.DirectoryServices.AccountManagement.ContextType.Domain, HttpContext.Current.User.Identity.Name.Split('\\')[0]))
+			if (azApplication != null)
+			{
+				IIdentity identity = null;
+				if (HttpContext.Current != null)
+				{
+					identity = HttpContext.Current.User.Identity;
+				}
+				else
+				{
+					identity = WindowsIdentity.GetCurrent();
+				}
+
+				try
+				{
+					if (identity is WindowsIdentity)
 					{
-						using (UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, HttpContext.Current.User.Identity.Name))
-						{
-							identity = new WindowsIdentity(user.UserPrincipalName);
-						}
-					}
-				}
-				else
-				{
-					identity = WindowsIdentity.GetCurrent();
-				}
-				bool contextCreated = false;
-				try
-				{
-					#if UseVersion1Types
-					clientContext = azApplication.InitializeClientContextFromToken((uint)identity.Token, null);
-					#else
-					clientContext = (IAzClientContext3)azApplication.InitializeClientContextFromToken2((uint)identity.Token, (uint)0, null);
-					#endif
-					contextCreated = true;
-				}
-				catch(Exception ex)
-				{
-					TraceWarn("AzSecurityManager.CreateClientContext();", ex.Message, ex);
-				}
-				if(!contextCreated)
-				{
-					string[] saName = identity.Name.Split("\\".ToCharArray());
-					if(saName.Length == 2)
-					{
-						//username format is DOMAIN\username
 						#if UseVersion1Types
-						clientContext = azApplication.InitializeClientContextFromName(saName[1], saName[0], null);
+						clientContext = azApplication.InitializeClientContextFromToken((uint)((WindowsIdentity)identity).Token, null);
 						#else
-						clientContext = (IAzClientContext3)azApplication.InitializeClientContextFromName(saName[1], saName[0], null);
-						#endif
+						clientContext = (IAzClientContext3)azApplication.InitializeClientContextFromToken2((uint)((WindowsIdentity)identity).Token, (uint)0, null);
+						#endif
+
 					}
 					else
 					{
-						saName = identity.Name.Split("@".ToCharArray());
-						if(saName.Length == 2)
-						{
-							//username format is username@DOMAIN
+						string[] saName = identity.Name.Split("\\".ToCharArray());
+						if (saName.Length == 2)
+						{
+							//username format is DOMAIN\username
 							#if UseVersion1Types
-							clientContext = azApplication.InitializeClientContextFromName(saName[0], saName[1], null);
+							clientContext = azApplication.InitializeClientContextFromName(saName[1], saName[0], null);
 							#else
-							clientContext = (IAzClientContext3)azApplication.InitializeClientContextFromName(saName[0], saName[1], null);
+							clientContext = (IAzClientContext3)azApplication.InitializeClientContextFromName(saName[1], saName[0], null);
 							#endif
 						}
+						else
+						{
+							saName = identity.Name.Split("@".ToCharArray());
+							if (saName.Length == 2)
+							{
+								//username format is username@DOMAIN
+								#if UseVersion1Types
+								clientContext = azApplication.InitializeClientContextFromName(saName[0], saName[1], null);
+								#else
+								clientContext = (IAzClientContext3)azApplication.InitializeClientContextFromName(saName[0], saName[1], null);
+								#endif
+							}
+						}
 					}
+				}
+				catch (Exception ex)
+				{
+					TraceWarn("AzSecurityManager.CreateClientContext();", ex.Message, ex);
 				}
 			}
 			else
@@ -367,14 +363,16 @@
 		#endregion

 		#region CreateOperation();
-		public void CreateOperation(string operationName, int operationID, string operationDescription) {
-			#if UseVersion1Types
+		public void CreateOperation(string operationName, int operationID, string operationDescription)
+		{
+#if UseVersion1Types
 			IAzOperation operation = azApplication.CreateOperation(operationName);
-			#else
+#else
 			IAzOperation2 operation = (IAzOperation2)azApplication.CreateOperation(operationName);
-			#endif
+#endif
 			operation.OperationID = operationID;
-			if(!string.IsNullOrEmpty(operationDescription)) {
+			if (!string.IsNullOrEmpty(operationDescription))
+			{
 				operation.Description = operationDescription;
 			}
 			operation.Submit();
@@ -382,23 +380,25 @@
 		#endregion

 		#region GetOperations();
-		#if UseVersion1Types
+#if UseVersion1Types
 		public IAzOperation[] GetOperations() {
-		#else
-		public IAzOperation2[] GetOperations() {
-		#endif
-			#if UseVersion1Types
+#else
+		public IAzOperation2[] GetOperations()
+		{
+#endif
+#if UseVersion1Types
 			IAzOperation[] operations = new IAzOperation[azApplication.Operations.Count];
-			#else
+#else
 			IAzOperation2[] operations = new IAzOperation2[azApplication.Operations.Count];
-			#endif
+#endif
 			int x = 0;
-			foreach(var operation in azApplication.Operations) {
-				#if UseVersion1Types
+			foreach (var operation in azApplication.Operations)
+			{
+#if UseVersion1Types
 				operations[x] = (IAzOperation)operation;
-				#else
+#else
 				operations[x] = (IAzOperation2)operation;
-				#endif
+#endif
 			}
 			return operations;
 		}
@@ -424,20 +424,20 @@
 		{
 			bool result = false;

-			TraceWrite("AzSecurityManager.VerifyOperation", "Verifying \""+operation.ToString()+"\" operation for scope \""+scope+"\"");
-
-			if(clientContext == null)
+			TraceWrite("AzSecurityManager.VerifyOperation", "Verifying \"" + operation.ToString() + "\" operation for scope \"" + scope + "\"");
+
+			if (clientContext == null)
 			{
 				CreateClientContext();
 			}
-			if(clientContext != null)
-			{
-				#if UseVersion1Types
+			if (clientContext != null)
+			{
+#if UseVersion1Types
 				object[] accessCheckResult = (object[])clientContext.AccessCheck(defaultAccessCheckObjectName, new object[1] { (scope!=null?scope:"") }, new object[1] { operation }, null, null, null, null, null);
 				if(accessCheckResult != null && (int)accessCheckResult[accessCheckResult.Length-1] == 0)
-				#else
-				if(clientContext.AccessCheck2(defaultAccessCheckObjectName, (scope!=null?scope:""), operation) == 0)
-				#endif
+#else
+				if (clientContext.AccessCheck2(defaultAccessCheckObjectName, (scope != null ? scope : ""), operation) == 0)
+#endif
 				{
 					result = true;
 				}
@@ -447,7 +447,7 @@
 				TraceWrite("AzSecurityManager.VerifyOperation", "Client context not available for access verification");
 			}

-			if(result)
+			if (result)
 			{
 				TraceWrite("AzSecurityManager.VerifyOperation", "operation granted");
 			}
@@ -484,16 +484,16 @@
 		{
 			bool result = false;

-			TraceWrite("AzSecurityManager.VerifyOperation", "Verifying \""+operation.ToString()+"\" operation scope \""+scope+"\"");
-
-			if(azApplication != null)
-			{
-				if(!(clientContext != null && this.username == username && this.domain == domain))
+			TraceWrite("AzSecurityManager.VerifyOperation", "Verifying \"" + operation.ToString() + "\" operation scope \"" + scope + "\"");
+
+			if (azApplication != null)
+			{
+				if (!(clientContext != null && this.username == username && this.domain == domain))
 				{
 					//init client context if doesn't exist or username/domain have changed
 					CreateClientContext(username, domain);
 				}
-				if(clientContext != null)
+				if (clientContext != null)
 				{
 					result = VerifyOperation(operation, scope);
 				}
@@ -512,13 +512,15 @@
 		#endregion

 		#region CreateScope();
-		public void CreateScope(string scopeName, string scopeDescription) {
-			#if UseVersion1Types
+		public void CreateScope(string scopeName, string scopeDescription)
+		{
+#if UseVersion1Types
 			IAzScope scope = azApplication.CreateScope(scopeName);
-			#else
+#else
 			IAzScope2 scope = (IAzScope2)azApplication.CreateScope(scopeName);
-			#endif
-			if(!string.IsNullOrEmpty(scopeDescription)) {
+#endif
+			if (!string.IsNullOrEmpty(scopeDescription))
+			{
 				scope.Description = scopeDescription;
 			}
 			scope.Submit();
@@ -535,11 +537,11 @@
 			string[] scopes = new string[azApplication.Scopes.Count];

 			int x = 0;
-			#if UseVersion1Types
+#if UseVersion1Types
 			foreach(IAzScope scope in azApplication.Scopes)
-			#else
-			foreach(IAzScope2 scope in azApplication.Scopes)
-			#endif
+#else
+			foreach (IAzScope2 scope in azApplication.Scopes)
+#endif
 			{
 				scopes[x] = scope.Name;
 				x++;
@@ -550,9 +552,11 @@
 		#endregion

 		#region CreateRole();
-		public void CreateRole(string roleName, string roleDescription) {
+		public void CreateRole(string roleName, string roleDescription)
+		{
 			IAzRole role = azApplication.CreateRole(roleName);
-			if(!string.IsNullOrEmpty(roleDescription)) {
+			if (!string.IsNullOrEmpty(roleDescription))
+			{
 				role.Description = roleDescription;
 			}
 			role.Submit();
@@ -567,7 +571,7 @@
 		public string[] GetRoleNames()
 		{
 			string[] roles = new string[azApplication.Roles.Count];
-			for(int x=0;x<azApplication.Roles.Count;x++)
+			for (int x = 0; x < azApplication.Roles.Count; x++)
 			{
 				roles[x] = ((IAzRole)azApplication.Roles[x]).Name;
 			}
@@ -580,13 +584,13 @@
 		/// <returns>A string array of all role names within the specified scope</returns>
 		public string[] GetRoleNames(string scopeName)
 		{
-			#if UseVersion1Types
+#if UseVersion1Types
 			IAzScope scope = azApplication.OpenScope(scopeName,null);
-			#else
+#else
 			IAzScope2 scope = azApplication.OpenScope2(scopeName);
-			#endif
+#endif
 			string[] roles = new string[scope.Roles.Count];
-			for(int x=0;x<scope.Roles.Count;x++)
+			for (int x = 0; x < scope.Roles.Count; x++)
 			{
 				roles[x] = ((IAzRole)scope.Roles[x]).Name;
 			}
@@ -594,7 +598,7 @@
 			return roles;
 		}
 		#endregion
-
+
 		#region GetRoleMemberNames();
 		/// <summary>
 		/// Retrieves the names of all NT accounts which are members of the specified role
@@ -607,7 +611,7 @@
 			object[] members = ((object[])azRole.MembersName);

 			string[] memberNames = new string[members.Length];
-			for(int x=0;x<members.Length;x++)
+			for (int x = 0; x < members.Length; x++)
 			{
 				memberNames[x] = (string)members[x];
 			}
@@ -640,10 +644,10 @@
 		/// <param name="roleName">The name of the role</param>
 		public void AddRoleMembers(string[] userOrGroupDomainNames, string roleName)
 		{
-			if(userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
+			if (userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
 			{
 				IAzRole azRole = azApplication.OpenRole(roleName, null);
-				for(int x=0; x<=userOrGroupDomainNames.Length; x++)
+				for (int x = 0; x <= userOrGroupDomainNames.Length; x++)
 				{
 					azRole.AddMemberName(userOrGroupDomainNames[x], null);
 				}
@@ -674,10 +678,10 @@
 		/// <param name="roleName">The name of the role</param>
 		public void DeleteRoleMembers(string[] userOrGroupDomainNames, string roleName)
 		{
-			if(userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
+			if (userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
 			{
 				IAzRole azRole = azApplication.OpenRole(roleName, null);
-				for(int x=0; x<=userOrGroupDomainNames.Length; x++)
+				for (int x = 0; x <= userOrGroupDomainNames.Length; x++)
 				{
 					azRole.DeleteMemberName(userOrGroupDomainNames[x], null);
 				}
@@ -695,13 +699,13 @@
 		public string[] GetGroupNames()
 		{
 			string[] groups = new string[azApplication.ApplicationGroups.Count];
-			for(int x=0; x<azApplication.ApplicationGroups.Count; x++)
-			{
-				#if UseVersion1Types
+			for (int x = 0; x < azApplication.ApplicationGroups.Count; x++)
+			{
+#if UseVersion1Types
 				groups[x] = ((IAzApplicationGroup)azApplication.ApplicationGroups[x]).Name;
-				#else
+#else
 				groups[x] = ((IAzApplicationGroup2)azApplication.ApplicationGroups[x]).Name;
-				#endif
+#endif
 			}
 			return groups;
 		}
@@ -712,19 +716,19 @@
 		/// <returns>A string array of all group names within the scope</returns>
 		public string[] GetGroupNames(string scopeName)
 		{
-			#if UseVersion1Types
+#if UseVersion1Types
 			IAzScope scope = azApplication.OpenScope(scopeName, null);
-			#else
+#else
 			IAzScope2 scope = azApplication.OpenScope2(scopeName);
-			#endif
+#endif
 			string[] groups = new string[scope.ApplicationGroups.Count];
-			for(int x=0; x<scope.ApplicationGroups.Count; x++)
-			{
-				#if UseVersion1Types
+			for (int x = 0; x < scope.ApplicationGroups.Count; x++)
+			{
+#if UseVersion1Types
 				groups[x] = ((IAzApplicationGroup)scope.ApplicationGroups[x]).Name;
-				#else
+#else
 				groups[x] = ((IAzApplicationGroup2)scope.ApplicationGroups[x]).Name;
-				#endif
+#endif
 			}
 			scope = null;
 			return groups;
@@ -739,15 +743,15 @@
 		/// <returns>A string array of all member account names</returns>
 		public string[] GetGroupMemberNames(string groupName)
 		{
-			#if UseVersion1Types
+#if UseVersion1Types
 			IAzApplicationGroup azGroup = azApplication.OpenApplicationGroup(groupName, null);
-			#else
+#else
 			IAzApplicationGroup2 azGroup = (IAzApplicationGroup2)azApplication.OpenApplicationGroup(groupName, null);
-			#endif
+#endif
 			object[] members = (object[])azGroup.MembersName;

 			string[] memberNames = new string[members.Length];
-			for(int x=0; x<members.Length; x++)
+			for (int x = 0; x < members.Length; x++)
 			{
 				memberNames[x] = (string)members[x];
 			}
@@ -767,11 +771,11 @@
 		/// <param name="groupName">The name of the Group</param>
 		public void AddGroupMember(string userOrGroupDomainName, string groupName)
 		{
-			#if UseVersion1Types
+#if UseVersion1Types
 			IAzApplicationGroup oGroup = azApplication.OpenApplicationGroup(groupName, null);
-			#else
+#else
 			IAzApplicationGroup2 oGroup = (IAzApplicationGroup2)azApplication.OpenApplicationGroup(groupName, null);
-			#endif
+#endif
 			oGroup.AddMemberName(userOrGroupDomainName, null);
 			oGroup.Submit(0, null);
 			oGroup = null;
@@ -784,14 +788,14 @@
 		/// <param name="groupName">The name of the Group</param>
 		public void AddGroupMembers(string[] userOrGroupDomainNames, string groupName)
 		{
-			if(userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
-			{
-				#if UseVersion1Types
+			if (userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
+			{
+#if UseVersion1Types
 				IAzApplicationGroup oGroup = azApplication.OpenApplicationGroup(groupName, null);
-				#else
+#else
 				IAzApplicationGroup2 oGroup = (IAzApplicationGroup2)azApplication.OpenApplicationGroup(groupName, null);
-				#endif
-				for(int x=0; x<=userOrGroupDomainNames.Length; x++)
+#endif
+				for (int x = 0; x <= userOrGroupDomainNames.Length; x++)
 				{
 					oGroup.AddMemberName(userOrGroupDomainNames[x], null);
 				}
@@ -809,11 +813,11 @@
 		/// <param name="groupName">The name of the Group</param>
 		public void DeleteGroupMember(string userOrGroupDomainName, string groupName)
 		{
-			#if UseVersion1Types
+#if UseVersion1Types
 			IAzApplicationGroup oGroup = azApplication.OpenApplicationGroup(groupName, null);
-			#else
+#else
 			IAzApplicationGroup2 oGroup = (IAzApplicationGroup2)azApplication.OpenApplicationGroup(groupName, null);
-			#endif
+#endif
 			oGroup.DeleteMemberName(userOrGroupDomainName, null);
 			oGroup.Submit(0, null);
 			oGroup = null;
@@ -826,14 +830,14 @@
 		/// <param name="groupName">The name of the Group</param>
 		public void DeleteGroupMembers(string[] userOrGroupDomainNames, string groupName)
 		{
-			if(userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
-			{
-				#if UseVersion1Types
+			if (userOrGroupDomainNames != null && userOrGroupDomainNames.Length > 0)
+			{
+#if UseVersion1Types
 				IAzApplicationGroup oGroup = azApplication.OpenApplicationGroup(groupName, null);
-				#else
+#else
 				IAzApplicationGroup2 oGroup = (IAzApplicationGroup2)azApplication.OpenApplicationGroup(groupName, null);
-				#endif
-				for(int x=0; x<=userOrGroupDomainNames.Length; x++)
+#endif
+				for (int x = 0; x <= userOrGroupDomainNames.Length; x++)
 				{
 					oGroup.DeleteMemberName(userOrGroupDomainNames[x], null);
 				}
@@ -858,7 +862,7 @@
 		/// <param name="disposing">Flag if the method is disposing</param>
 		private void Dispose(bool disposing)
 		{
-			if(!this.disposed)
+			if (!this.disposed)
 			{
 				clientContext = null;
 				azApplication = null;
@@ -879,10 +883,12 @@
 		#region TraceWrite(); TraceWarn();
 		private void TraceWrite(string category, string message)
 		{
-			if(traceEnabled) {
-				switch(traceType) {
+			if (traceEnabled)
+			{
+				switch (traceType)
+				{
 					case TraceType.HttpContext:
-						if(category != null)
+						if (category != null)
 						{
 							HttpContext.Current.Trace.Write(category, message);
 						}
@@ -892,7 +898,7 @@
 						}
 						break;
 					case TraceType.SystemDiagnostics:
-						if(category != null)
+						if (category != null)
 						{
 							System.Diagnostics.Trace.WriteLine(category, message);
 						}
@@ -906,15 +912,16 @@
 		}
 		private void TraceWarn(string category, string message, Exception exception)
 		{
-			if(traceEnabled)
-			{
-				switch(traceType) {
+			if (traceEnabled)
+			{
+				switch (traceType)
+				{
 					case TraceType.HttpContext:
-						if(category != null && exception != null)
+						if (category != null && exception != null)
 						{
 							HttpContext.Current.Trace.Warn(category, message, exception);
 						}
-						else if(category != null)
+						else if (category != null)
 						{
 							HttpContext.Current.Trace.Warn(category, message);
 						}
@@ -924,13 +931,13 @@
 						}
 						break;
 					case TraceType.SystemDiagnostics:
-						if(category != null && exception != null)
-						{
-							System.Diagnostics.Trace.TraceError("{0}.{1}: {2}",category, message, (message==exception.Message?exception.StackTrace:exception.Message));
-						}
-						else if(category != null)
-						{
-							System.Diagnostics.Trace.TraceError("{0}.{1}",category, message);
+						if (category != null && exception != null)
+						{
+							System.Diagnostics.Trace.TraceError("{0}.{1}: {2}", category, message, (message == exception.Message ? exception.StackTrace : exception.Message));
+						}
+						else if (category != null)
+						{
+							System.Diagnostics.Trace.TraceError("{0}.{1}", category, message);
 						}
 						else
 						{


GitHubSync update

GitHubSync update

--- deployment/cake/issuetrackers.cake
+++ deployment/cake/issuetrackers.cake
@@ -28,7 +28,14 @@

         foreach (var issueTracker in _issueTrackers)
         {
-            await issueTracker.CreateAndReleaseVersionAsync();
+            try
+            {
+                await issueTracker.CreateAndReleaseVersionAsync();
+            }
+            catch (Exception ex)
+            {
+                BuildContext.CakeContext.Warning(ex.Message);
+            }
         }
     }
 }


Improve logging

Improve logging

--- CalDavSynchronizer/ComponentContainer.cs
+++ CalDavSynchronizer/ComponentContainer.cs
@@ -121,6 +121,8 @@
       if (comWrapperFactory == null) throw new ArgumentNullException(nameof(comWrapperFactory));

       s_logger.Info ("Startup...");
+      s_logger.Info ($"Version: {Assembly.GetExecutingAssembly().GetName().Version}");
+      s_logger.Info ($"Operating system: {Environment.OSVersion}");

       _profileTypeRegistry = ProfileTypeRegistry.Instance;


Now forwarding the request method in the proxy handler

--- Ceen.Httpd/Handler/SimpleProxyHandler.cs
+++ Ceen.Httpd/Handler/SimpleProxyHandler.cs
@@ -59,6 +59,7 @@
             foreach (var item in context.Request.Headers)
                 wr.Headers.Add(item.Key, item.Value);

+            wr.Method = context.Request.Method;
             if (context.Request.ContentLength > 0)
                 using(var rs = await wr.GetRequestStreamAsync())
                     await context.Request.Body.CopyToAsync(rs);


Update test after un-skipping

Update test after un-skipping

--- test/Microsoft.AspNetCore.Localization.FunctionalTests/LocalizationTest.cs
+++ test/Microsoft.AspNetCore.Localization.FunctionalTests/LocalizationTest.cs
@@ -84,7 +84,7 @@
                 "http://localhost:5074",
                 "ResourcesInFolder",
                 "fr-FR",
-                "Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
+                "Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder");
         }

         [ConditionalFact]


Fixed compatibility checker

Fixed compatibility checker

--- Client/Utilities/CompatibilityChecker.cs
+++ Client/Utilities/CompatibilityChecker.cs
@@ -54,8 +54,8 @@
         public static bool IsCompatible()
         {
             const int compatibleMajor = 1;
-            const int compatibleMinor = 3;
-            const int compatibleRevision = 1;
+            const int compatibleMinor = 4;
+            const int compatibleRevision = 0;
             return (Versioning.version_major == compatibleMajor) && (Versioning.version_minor == compatibleMinor) && (Versioning.Revision == compatibleRevision);

             /*-----------------------------------------------*\
@@ -69,7 +69,7 @@
             |    BEGIN IMPLEMENTATION-SPECIFIC EDITS HERE.    |
             \*-----------------------------------------------*/

-            return Application.unityVersion == "5.4.0p4";
+            return Application.unityVersion == "2017.1.3p1";

             /*-----------------------------------------------*\
             | IMPLEMENTERS SHOULD NOT EDIT BEYOND THIS POINT! |


Update generator

Update generator

--- tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs
+++ tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs
@@ -80,11 +80,12 @@
             using (var fileStream = File.Create($"Generated\\{name}.trie.cs"))
             using (var writer = new StreamWriter(fileStream))
             {
+                writer.WriteLine("using System;");
                 writer.WriteLine("namespace Avalonia.Media.TextFormatting.Unicode");
                 writer.WriteLine("{");
                 writer.WriteLine($"   internal static class {name}Trie");
                 writer.WriteLine("    {");
-                writer.WriteLine("        public static readonly byte[] Data =");
+                writer.WriteLine("        public static ReadOnlySpan<byte> Data => new byte[]");
                 writer.WriteLine("        {");

                 stream.Position = 0;


Added index operator

Added index operator

--- ComputerAlgebra/Expression/Expression.cs
+++ ComputerAlgebra/Expression/Expression.cs
@@ -109,7 +109,10 @@
         public static LazyExpression operator <=(Expression L, Expression R) { return new LazyExpression(Binary.LessEqual(L, R)); }
         public static LazyExpression operator >(Expression L, Expression R) { return new LazyExpression(Binary.Greater(L, R)); }
         public static LazyExpression operator >=(Expression L, Expression R) { return new LazyExpression(Binary.GreaterEqual(L, R)); }
-
+
+        public LazyExpression this[params Expression[] i] { get { return new LazyExpression(Index.New(this, i)); } }
+
+        // Conversions.
         public static implicit operator Expression(Real x) { return Constant.New(x); }
         public static implicit operator Expression(BigRational x) { return Constant.New(x); }
         public static implicit operator Expression(decimal x) { return Constant.New(x); }


Add `UString.IsNull` property

Add `UString.IsNull` property

--- Core/Loyc.Interfaces/Concrete/UString.cs
+++ Core/Loyc.Interfaces/Concrete/UString.cs
@@ -16,7 +16,8 @@
 	/// <remarks>
 	/// UString is a slice type: it represents either an entire string, or a region
 	/// of code units in a string. .NET strings are converted implicitly to UString.
-	/// (it's like Memory{char}, but predates it by a few years.)
+	/// UString is similar to .NET Core's Memory{char}, but predates it by a few
+	/// years.
 	/// <para/>
 	/// It has been suggested that Java and .NET's reliance on 16-bit "unicode"
 	/// characters was a mistake, because it turned out that 16 bits was not enough
@@ -114,10 +115,19 @@
 		public int InternalStart { get { return _start; } }
 		public int InternalStop { get { return _start + _count; } }

+		/// Gets the length of the string in code units (which may be
+		/// greater than the number of actual characters or code points).
 		public int Length => _count;
 		[EditorBrowsable(EditorBrowsableState.Never)]
 		public int Count => _count;
+		/// Returns true if and only if Count == 0.
 		public bool IsEmpty => _count == 0;
+		/// Returns true if the internal string is a null reference.
+		/// Caution: an "empty" UString is "equal" to a "null" UString because the
+		/// list of characters is the same. If you want to know if the internal string
+		/// reference is null, you must use this property instead of comparing with
+		/// null.
+		public bool IsNull => _str == null;
 		public uchar First => DecodeAt(0);
 		public uchar Last
 		{


fixed wrong spelling

fixed wrong spelling

--- Core/System/Numerics/BigInteger.net35.cs
+++ Core/System/Numerics/BigInteger.net35.cs
@@ -2186,8 +2186,8 @@
                     // 1.mantissa * 2**exp
                     int exponent = Exponent(bytes);
                     mantissa |= 0x10000000000000ul;
-                    BigInteger mantisaAsBigInteger = mantissa;
-                    BigInteger result = exponent > Bias ? mantisaAsBigInteger << (exponent - Bias) : mantisaAsBigInteger >> (Bias - exponent);
+                    BigInteger mantissaAsBigInteger = mantissa;
+                    BigInteger result = exponent > Bias ? mantissaAsBigInteger << (exponent - Bias) : mantissaAsBigInteger >> (Bias - exponent);
                     _sign = (short)(Negative(bytes) ? -1 : 1);
                     _data = result._data;
                 }


Fixed some missing cases of CopyTo

Fixed some missing cases of CopyTo

--- Core/Theraot/Collections/Extensions._.cs
+++ Core/Theraot/Collections/Extensions._.cs
@@ -18,7 +18,7 @@
             {
                 throw new ArgumentNullException("array");
             }
-            if (count >= array.Length)
+            if (count > array.Length)
             {
                 throw new ArgumentException("array", "The array can not contain the number of elements.");
             }
@@ -46,7 +46,7 @@
             {
                 throw new ArgumentNullException("array");
             }
-            if (count >= array.Length)
+            if (count > array.Length)
             {
                 throw new ArgumentException("array", "The array can not contain the number of elements.");
             }


Fixed cleanup of test

Fixed cleanup of test

--- Dapper.MicroCRUD.Tests/DataWiperTests.cs
+++ Dapper.MicroCRUD.Tests/DataWiperTests.cs
@@ -99,6 +99,9 @@

                 // Assert
                 act.ShouldThrow<Exception>();
+
+                // Cleanup
+                this.database.DeleteAll<SimpleForeignKey>();
             }

             [Fact]


Added minimum & maximum splitter properties

--- DarkUI/Docking/Items/DarkDockSplitter.cs
+++ DarkUI/Docking/Items/DarkDockSplitter.cs
@@ -72,16 +72,36 @@
             switch (_splitterType)
             {
                 case DarkSplitterType.Left:
-                    bounds.Location = new Point(bounds.Location.X - difference.X, bounds.Location.Y);
+                    var leftX = Math.Max(bounds.Location.X - difference.X, _minimum);
+
+                    if (_maximum != 0 && leftX > _maximum)
+                        leftX = _maximum;
+
+                    bounds.Location = new Point(leftX, bounds.Location.Y);
                     break;
                 case DarkSplitterType.Right:
-                    bounds.Location = new Point(bounds.Location.X - difference.X, bounds.Location.Y);
+                    var rightX = Math.Max(bounds.Location.X - difference.X, _minimum);
+
+                    if (_maximum != 0 && rightX > _maximum)
+                        rightX = _maximum;
+
+                    bounds.Location = new Point(rightX, bounds.Location.Y);
                     break;
                 case DarkSplitterType.Top:
-                    bounds.Location = new Point(bounds.Location.X, bounds.Location.Y - difference.Y);
+                    var topY = Math.Max(bounds.Location.Y - difference.Y, _minimum);
+
+                    if (_maximum != 0 && topY > _maximum)
+                        topY = _maximum;
+
+                    bounds.Location = new Point(bounds.Location.X, topY);
                     break;
                 case DarkSplitterType.Bottom:
-                    bounds.Location = new Point(bounds.Location.X, bounds.Location.Y - difference.Y);
+                    var bottomY = Math.Max(bounds.Location.Y - difference.Y, _minimum);
+
+                    if (_maximum != 0 && bottomY > _maximum)
+                        topY = _maximum;
+
+                    bounds.Location = new Point(bounds.Location.X, bottomY);
                     break;
             }

@@ -117,15 +137,19 @@
             {
                 case DarkSplitterType.Left:
                     Bounds = new Rectangle(bounds.Left - 2, bounds.Top, 5, bounds.Height);
+                    _maximum = bounds.Right - 2 - _control.MinimumSize.Width;
                     break;
                 case DarkSplitterType.Right:
-                    Bounds = new Rectangle(bounds.Right - 3, bounds.Top, 5, bounds.Height);
+                    Bounds = new Rectangle(bounds.Right - 2, bounds.Top, 5, bounds.Height);
+                    _minimum = bounds.Left - 2 + _control.MinimumSize.Width;
                     break;
                 case DarkSplitterType.Top:
                     Bounds = new Rectangle(bounds.Left, bounds.Top - 2, bounds.Width, 5);
+                    _maximum = bounds.Bottom - 2 - _control.MinimumSize.Height;
                     break;
                 case DarkSplitterType.Bottom:
-                    Bounds = new Rectangle(bounds.Left, bounds.Bottom - 5, bounds.Width, 5);
+                    Bounds = new Rectangle(bounds.Left, bounds.Bottom - 2, bounds.Width, 5);
+                    _minimum = bounds.Top - 2 + _control.MinimumSize.Height;
                     break;
             }
         }


update

update

--- Demos/Lighting.ShadowMapping/FormMain.cs
+++ Demos/Lighting.ShadowMapping/FormMain.cs
@@ -106,33 +106,29 @@
                 }
             }
             {
-                var hanoiTower = new GroupNode();
-				ObjItem[] items = HanoiTower.GetDataSource();
-				int i = 0;
-				foreach (var item in items)
-				{
-				i++; if (i < 5) { continue; } //if (i > 2) { break; }
-					var objFormat = item.model;
-					var filename = item.GetType().Name;
-					objFormat.DumpObjFile(filename, filename);
-					var parser = new ObjVNFParser(false);
-					ObjVNFResult result = parser.Parse(filename);
-					if (result.Error != null)
-					{
-						Console.WriteLine("Error: {0}", result.Error);
-					}
-					else
-					{
-						ObjVNFMesh mesh = result.Mesh;
-						var model = new ObjVNF(mesh);
-						var node = ShadowMappingNode.Create(model, ObjVNF.strPosition, ObjVNF.strNormal, model.GetSize());
-						node.WorldPosition = item.position;
-						node.Color = item.color;
-						node.Name = filename;
-						hanoiTower.Children.Add(node);
-					}
-				}
-				group.Children.Add(hanoiTower);
+                var list = new List<IObjFormat>();
+                list.Add(new AnnulusModel(1.5f + 0.4f, 0.7f, 37, 37));
+                list.Add(new CylinderModel(0.5f, 6, 37));
+                foreach (var item in list)
+                {
+                    item.DumpObjFile("tmp.obj", "tmp");
+                    var parser = new ObjVNFParser(false);
+                    ObjVNFResult result = parser.Parse("tmp.obj");
+                    if (result.Error != null)
+                    {
+                        Console.WriteLine("Error: {0}", result.Error);
+                    }
+                    else
+                    {
+                        ObjVNFMesh mesh = result.Mesh;
+                        var model = new ObjVNF(mesh);
+                        var node = ShadowMappingNode.Create(model, ObjVNF.strPosition, ObjVNF.strNormal, model.GetSize());
+                        node.WorldPosition = new vec3(0, 2, 0);
+                        node.Color = new vec3(1, 1, 1);
+                        node.Name = item.GetType().Name;
+                        group.Children.Add(node);
+                    }
+                }
             }

             return group;


Do not update Path bounds and removed source update

--- Dependencies/Renderer.Wpf/WpfRenderer.cs
+++ Dependencies/Renderer.Wpf/WpfRenderer.cs
@@ -38,7 +38,7 @@
         private IDictionary<XQBezier, PathGeometry> _qbezierCache;
         private IDictionary<XText, Tuple<string, FormattedText, ShapeStyle>> _textCache;
         private IDictionary<Uri, BitmapImage> _biCache;
-        private IDictionary<XPath, Tuple<string, XPathGeometry, StreamGeometry, ShapeStyle>> _pathCache;
+        private IDictionary<XPath, Tuple<XPathGeometry, StreamGeometry, ShapeStyle>> _pathCache;
         private RendererState _state = new RendererState();

         /// <summary>
@@ -448,7 +448,7 @@
                 }
                 _biCache = new Dictionary<Uri, BitmapImage>();

-                _pathCache = new Dictionary<XPath, Tuple<string, XPathGeometry, StreamGeometry, ShapeStyle>>();
+                _pathCache = new Dictionary<XPath, Tuple<XPathGeometry, StreamGeometry, ShapeStyle>>();
             }
         }

@@ -1288,7 +1288,7 @@
         /// <param name="r"></param>
         public void Draw(object dc, XPath path, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
         {
-            if (path.Source == null && path.Geometry == null)
+            if (path.Geometry == null)
                 return;

             var _dc = dc as DrawingContext;
@@ -1317,41 +1317,24 @@
                     _styleCache.Add(style, Tuple.Create(fill, stroke));
             }

-            Tuple<string, XPathGeometry, StreamGeometry, ShapeStyle> pcache = null;
+            Tuple<XPathGeometry, StreamGeometry, ShapeStyle> pcache = null;
             StreamGeometry sg;

             if (_enablePathCache
                 && _pathCache.TryGetValue(path, out pcache)
-                && string.Compare(pcache.Item1, path.Source) == 0
-                && pcache.Item2 == path.Geometry
-                && pcache.Item4 == style)
-            {
-                sg = pcache.Item3;
+                && pcache.Item1 == path.Geometry
+                && pcache.Item3 == style)
+            {
+                sg = pcache.Item2;
                 _dc.DrawGeometry(path.IsFilled ? fill : null, path.IsStroked ? stroke : null, sg);
             }
             else
             {
-                if (path.Geometry == null && !string.IsNullOrEmpty(path.Source))
-                {
-                    var xpg = path.Source.ToXPathGeometry();
-                    path.Geometry = xpg;
-                }
-
-                // TODO: When (path.Source != null) ToSource call only needed to enable PathHelper to work.
-                if (path.Geometry != null /* && string.IsNullOrEmpty(path.Source) */)
-                {
-                    path.Source = path.Geometry.ToSource();
-                }
-
                 sg = path.Geometry.ToStreamGeometry();
-                path.Geometry.Bounds.X = sg.Bounds.X;
-                path.Geometry.Bounds.Y = sg.Bounds.Y;
-                path.Geometry.Bounds.Width = sg.Bounds.Width;
-                path.Geometry.Bounds.Height = sg.Bounds.Height;

                 if (_enablePathCache)
                 {
-                    var tuple = Tuple.Create(path.Source, path.Geometry, sg, style);
+                    var tuple = Tuple.Create(path.Geometry, sg, style);
                     if (_pathCache.ContainsKey(path))
                     {
                         _pathCache[path] = tuple;


Fix CLR missing modules not being shown in dependency tree

--- DependenciesGui/DependencyWindow.xaml.cs
+++ DependenciesGui/DependencyWindow.xaml.cs
@@ -513,7 +513,29 @@
                         // Process CLR referenced assemblies
                         foreach (var assembly in module.AssemblyReferences)
                         {
-                            AssemblyDefinition definition = resolver.Resolve(assembly);
+                            AssemblyDefinition definition;
+                            try
+                            {
+                                definition = resolver.Resolve(assembly);
+                            }
+                            catch (AssemblyResolutionException)
+                            {
+                                ImportContext AppInitImportModule = new ImportContext();
+                                AppInitImportModule.PeFilePath = null;
+                                AppInitImportModule.PeProperties = null;
+                                AppInitImportModule.ModuleName = Path.GetFileName(assembly.Name);
+                                AppInitImportModule.ApiSetModuleName = null;
+                                AppInitImportModule.Flags = ModuleFlag.ClrReference;
+                                AppInitImportModule.ModuleLocation = ModuleSearchStrategy.ClrAssembly;
+                                AppInitImportModule.Flags |= ModuleFlag.NotFound;
+
+                                if (!NewTreeContexts.ContainsKey(AppInitImportModule.ModuleName))
+                                {
+                                    NewTreeContexts.Add(AppInitImportModule.ModuleName, AppInitImportModule);
+                                }
+
+                                continue;
+                            }

                             foreach (var AssemblyModule in definition.Modules)
                             {


Clear previous score items on SetUp

Clear previous score items on SetUp

--- osu.Game.Tests/Visual/Gameplay/TestSceneInGameLeaderboard.cs
+++ osu.Game.Tests/Visual/Gameplay/TestSceneInGameLeaderboard.cs
@@ -40,6 +40,9 @@
             AddSliderStep("set player score", 50, 5000000, 1222333, v => playerScore.Value = v);
         }

+        [SetUp]
+        public void SetUp() => leaderboard.ClearScores();
+
         [Test]
         public void TestPlayerScore()
         {
@@ -66,6 +69,8 @@

         private class TestInGameLeaderboard : InGameLeaderboard
         {
+            public void ClearScores() => ScoresContainer.RemoveAll(s => s.User.Username != PlayerUser.Username);
+
             public bool CheckPositionByUsername(string username, int? estimatedPosition)
             {
                 var scoreItem = ScoresContainer.Where(i => i.User.Username == username).FirstOrDefault();


Add tests for time display

Add tests for time display

--- osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs
+++ osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs
@@ -1,6 +1,8 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

+using System;
+using NUnit.Framework;
 using osu.Framework.Allocation;
 using osu.Framework.Graphics;
 using osu.Game.Tournament.Components;
@@ -16,5 +18,23 @@
             Add(new TourneyVideo("main") { RelativeSizeAxes = Axes.Both });
             Add(new ScheduleScreen());
         }
+
+        [Test]
+        public void TestCurrentMatchTime()
+        {
+            setMatchDate(TimeSpan.FromDays(-1));
+            setMatchDate(TimeSpan.FromSeconds(5));
+            setMatchDate(TimeSpan.FromMinutes(4));
+            setMatchDate(TimeSpan.FromHours(3));
+        }
+
+        private void setMatchDate(TimeSpan relativeTime)
+            // Humanizer cannot handle negative timespans.
+            => AddStep($"start time is {relativeTime}", () =>
+            {
+                var match = CreateSampleMatch();
+                match.Date.Value = DateTimeOffset.Now + relativeTime;
+                Ladder.CurrentMatch.Value = match;
+            });
     }
 }


inital

inital

--- GUI508/GUI.cs
+++ GUI508/GUI.cs
@@ -21,15 +21,15 @@
         public GUI()
         {
             this.InitializeComponent();
-            mnuExport.Enabled = false;
-            GuideLineMessages messages = new GuideLineMessages();
-            Scanner scanner = new Scanner();
-            scanner.DirectorySearch(@"C:\TFS\MarineNet\MarineNet\Source\MarineNetCode-2013\Dev\MarineNet 5.0\MarineNet\");
+            //mnuExport.Enabled = false;
+            //GuideLineMessages messages = new GuideLineMessages();
+            //Scanner scanner = new Scanner();
+            //scanner.DirectorySearch(@"C:\TFS\MarineNet\MarineNet\Source\MarineNetCode-2013\Dev\MarineNet 5.0\MarineNet\");
             ////scanner.DirectorySearch(@"C:\508TestPages\");
-            scanner.ASPXScan();
-            this.FillGridViewControl();
-            this.FillGridViewPage();
-            mnuExport.Enabled = true;
+            //scanner.ASPXScan();
+            //this.FillGridViewControl();
+            //this.FillGridViewPage();
+            //mnuExport.Enabled = true;
         }

         /// <summary>


clean up

clean up

--- Migrations.cs
+++ Migrations.cs
@@ -1,23 +1,11 @@
 using System;
 using CSM.ParkingData.Models;
-using Orchard.Data;
 using Orchard.Data.Migration;

-namespace CSM.ParkingData.Data
+namespace CSM.ParkingData
 {
     public class Migrations : DataMigrationImpl
     {
-        private readonly IRepository<SensorEvent> _sensorEventsRepository;
-        private readonly IRepository<MeteredSpace> _meteredSpacesRepository;
-
-        public Migrations(
-            IRepository<SensorEvent> sensorEventsRepository,
-            IRepository<MeteredSpace> meteredSpacesRepository)
-        {
-            _sensorEventsRepository = sensorEventsRepository;
-            _meteredSpacesRepository = meteredSpacesRepository;
-        }
-
         public int Create()
         {
             SchemaBuilder.CreateTable(


support area is relative to the extruder size.

--- NewSupport.cs
+++ NewSupport.cs
@@ -232,6 +232,9 @@
 		{
 			int numLayers = inputPolys.Count;

+			long nozzleSize = config.extrusionWidth_um;
+			long areaToTryAndBe = 20 * 20 * nozzleSize * nozzleSize; // 10 x 10 mm approximately (assuming .5 nozzle)
+
 			List<Polygons> allDownOutlines = CreateEmptyPolygons(numLayers);
 			for (int layerIndex = numLayers - 2; layerIndex >= 0; layerIndex--)
 			{
@@ -244,7 +247,8 @@
 				for (int i = accumulatedAbove.Count - 1; i >= 0; i--)
 				{
 					Polygon polygon = accumulatedAbove[i];
-					if (polygon.Area() > 10 * 1000 * 10 * 1000)
+					double polyArea = polygon.Area();
+                    if (polyArea > areaToTryAndBe)
 					{
 						Polygons offsetPolygons = new Polygons() { polygon }.Offset(-config.extrusionWidth_um / 2);
 						accumulatedAbove.RemoveAt(i);
@@ -253,6 +257,15 @@
 							accumulatedAbove.Insert(i, polyToAdd);
 						}
 					}
+					else if(polyArea < areaToTryAndBe * .9)
+					{
+						Polygons offsetPolygons = new Polygons() { polygon }.Offset(config.extrusionWidth_um / 2);
+						accumulatedAbove.RemoveAt(i);
+						foreach (Polygon polyToAdd in offsetPolygons)
+						{
+							accumulatedAbove.Insert(i, polyToAdd);
+						}
+					}
 				}

 				// add in the support on this level


improved support removal

improved support removal

--- NewSupport.cs
+++ NewSupport.cs
@@ -41,8 +41,6 @@

             // create starting support outlines
             CreateAllPossibleSupport(numLayers, config, storage);
-            // remove any portion that will be sitting on existing parts
-            RemoveExistingIntersection(numLayers, storage);
             // clip to xy distance from all parts
             // change top layers into interface layers
             // expand interface layers to be grabable outside the mesh
@@ -57,6 +55,8 @@

         private void CreateAllPossibleSupport(int numLayers, ConfigSettings config, SliceVolumeStorage storage)
         {
+            int selfSupportDistance = config.outsideExtrusionWidth_um / 2;
+
             Polygons accumulatedBottoms = new Polygons();

             // calculate all the non-supported areas
@@ -73,6 +73,19 @@
                         SliceLayerPart belowPart = belowLayer.parts[0];
                         Polygons belowLayerPolys = belowPart.TotalOutline.Offset(-config.outsideExtrusionWidth_um / 2);
                         Polygons activeLayerPolys = curLayerPolys.CreateDifference(belowLayerPolys);
+
+                        // remove anything that is less than the selfSupportDistance
+                        {
+                            Polygons noSelfSupportPolys = activeLayerPolys.Offset(-selfSupportDistance);
+                            // expand it back out
+                            activeLayerPolys = noSelfSupportPolys.Offset(selfSupportDistance);
+                        }
+
+                        // remove any portion that will be sitting on existing parts
+                        {
+                            accumulatedBottoms = accumulatedBottoms.CreateDifference(curLayerPolys);
+                            accumulatedBottoms = Clipper.CleanPolygons(accumulatedBottoms, cleanDistance_um);
+                        }

                         accumulatedBottoms = accumulatedBottoms.CreateUnion(activeLayerPolys);
                         accumulatedBottoms = Clipper.CleanPolygons(accumulatedBottoms, cleanDistance_um);


0: fix to obfuscar attributes processing

git-svn-id: 24262d25620f8b54ed72f9442578276bad91cd22@18 e1a71446-c95e-11de-b31f-89c4ba9e53d3

--- Obfuscator.cs
+++ Obfuscator.cs
@@ -207,7 +207,7 @@
 							} else

 							// skip filtered fields
-							if ( info.ShouldSkip( fieldKey ) )
+                                if (info.ShouldSkip(fieldKey) || !ShouldObfuscate(field, type))
 							{
 								map.UpdateField( fieldKey, ObfuscationStatus.Skipped, "filtered" );
 								nameGroup.Add( fieldKey.Name );


change: additional level in ValueSyntax: StatementSyntax, used to get better link to binary tree

--- src/reni2/Struct/CompoundSyntax.cs
+++ src/reni2/Struct/CompoundSyntax.cs
@@ -45,7 +45,7 @@
         [DisableDump]
         public IEnumerable<FunctionSyntax> ConverterFunctions
             => Statements
-                .Where(data => data.Content.Declarer.IsConverterSyntax)
+                .Where(data => data.Content.Declarer?.IsConverterSyntax??false)
                 .Select(data => (FunctionSyntax)data.Content.Value);

         [DisableDump]


Revert test condition to c# 7.3 version

Revert test condition to c# 7.3 version

--- src/redmine-net-api/RedmineManager.cs
+++ src/redmine-net-api/RedmineManager.cs
@@ -857,11 +857,8 @@
             webClient.Timeout = Timeout;
             if (!uploadFile)
             {
-                webClient.Headers.Add(HttpRequestHeader.ContentType, MimeFormat switch
-                {
-                    MimeFormat.Xml => "application/xml",
-                    _ => "application/json"
-                });
+                webClient.Headers.Add(HttpRequestHeader.ContentType,
+                    MimeFormat is MimeFormat.Xml ? "application/xml" : "application/json");
                 webClient.Encoding = Encoding.UTF8;
             }
             else


Getting a snapshot should use the same revision parameter as getting a stream (where a requested revision of 0 = latest)

--- src/proj/EventStore.Core/OptimisticEventStore.cs
+++ src/proj/EventStore.Core/OptimisticEventStore.cs
@@ -70,6 +70,7 @@

 		public virtual Snapshot GetSnapshot(Guid streamId, int maxRevision)
 		{
+			maxRevision = maxRevision <= 0 ? int.MaxValue : maxRevision;
 			return this.persistence.GetSnapshot(streamId, maxRevision); // TODO: add to some kind of cache
 		}
 		public virtual bool AddSnapshot(Snapshot snapshot)


am 3bc7430: am 6190dfe: AI 147615: remove sdk version in parentheses fro

Merge commit '3bc74303857538055b906d1f01077d77e6776248'

* commit '3bc74303857538055b906d1f01077d77e6776248':
  AI 147615: remove sdk version in parentheses from page title

--- tools/droiddoc/templates/head_tag.cs
+++ tools/droiddoc/templates/head_tag.cs
@@ -3,10 +3,7 @@
 <link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>favicon.ico" />
 <title><?cs
   if:page.title ?><?cs
-    var:page.title ?><?cs
-    if:sdk.version ?> (<?cs
-      var:sdk.version ?>)<?cs
-    /if ?> | <?cs
+    var:page.title ?> | <?cs
   /if ?>Android Developers</title><?cs
 if:guide||sdk ?>
 <link href="<?cs var:toroot ?>assets/android-developer-docs-devguide.css" rel="stylesheet" type="text/css" /><?cs


Set SendOptions on token when re-sending (of no consequence currently)

--- RemotePeer.cs
+++ RemotePeer.cs
@@ -211,7 +211,7 @@
             while (queue.Count > 0)
             {
                 SocketAsyncEventArgs args = queue.Dequeue();
-                SendToken token = (SendToken)args.UserToken; // NOTE: may be null if only ACKs (which will always be on None channel)
+                SendToken token = (SendToken)args.UserToken;

                 if (channel.IsReliable)
                 {
@@ -266,8 +266,6 @@
                 SendDatagram(args);

             } // while
-
-            channel.ResetCount();
         }

         private void Pong()
@@ -288,6 +286,7 @@

             SendToken token = tokenPool.Borrow();
             token.IsReSend = true;
+            token.SendOptions = detail.ChannelType;

             args.UserToken = token;

@@ -366,7 +365,7 @@
 #if DEBUG
                             localPeer.Log(LogLevel.Info, String.Format("Packet to: {0}, type: {1}, channel: {2}, seq {3}, payload size: {4} re-sent as not ACKnowledged in time.",
                                 PeerName,
-                                type,
+                                type,
                                 opts,
                                 seq,
                                 payloadSize));
@@ -384,8 +383,8 @@
                 {
                     if (ellapasedSecondsSinceLastRealiablePacket >= localPeer.KeepAliveIfNoKeepAliveReceivedSeconds)
                     {
-                        // This remote peer has not sent a KeepAlive for too long, send a KeepAlive to
-                        // them to see if they are alive!
+                        // This remote peer has not sent a reliable message for too long, send a
+                        // KeepAlive to probe them and they are alive!

                         reliableSendChannel.EnqueueSend(PacketType.KeepAlive, null);
                         ellapasedSecondsSinceLastRealiablePacket = 0.0f;
@@ -499,13 +498,13 @@
         {
             try
             {
-                if (noneSendChannel.Count > 0)
+                if (noneSendChannel.HasDataToSend)
                     FlushSendChannel(noneSendChannel);
-                if (inOrderSendChannel.Count > 0)
+                if (inOrderSendChannel.HasDataToSend)
                     FlushSendChannel(inOrderSendChannel);
-                if (reliableSendChannel.Count > 0)
+                if (reliableSendChannel.HasDataToSend)
                     FlushSendChannel(reliableSendChannel);
-                if (reliableInOrderSendChannel.Count > 0)
+                if (reliableInOrderSendChannel.HasDataToSend)
                     FlushSendChannel(reliableInOrderSendChannel);

                 // send any outstanding ACKs
@@ -539,7 +538,6 @@
         {
             // If we are not the keep alive master, i.e. this remote peer is, and this packet was
             // sent reliably reset ellpasedMilliseondsAtLastRealiablePacket[Received].
-
             if (IsKeepAliveMaster && opts.HasFlag(SendOptions.Reliable))
             {
                 ellapasedSecondsSinceLastRealiablePacket = 0.0f;
@@ -630,7 +628,7 @@

                         if (detail == null)
                         {
-                            // Possible reasons in order of likelyhood:
+                            // Possible reasons:
                             // 1) ACK has arrived too late and the packet must have already been removed.
                             // 2) ACK duplicated and has already been processed
                             // 3) ACK was unsolicited (i.e. malicious or buggy peer)


readability

readability

--- Resin/Trie.cs
+++ Resin/Trie.cs
@@ -22,6 +22,7 @@

         public Trie()
         {
+            Root = true;
             Children = new Dictionary<char, Trie>();
         }

@@ -34,7 +35,7 @@

             foreach (var word in words)
             {
-                InsertOrAppend(word);
+                AppendToDescendants(word);
             }
         }

@@ -54,7 +55,7 @@
                 var overflow = text.Substring(1);
                 if (overflow.Length > 0)
                 {
-                    InsertOrAppend(overflow);
+                    AppendToDescendants(overflow);
                 }
             }
             else
@@ -101,26 +102,6 @@
         {
             if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("text");

-            InsertOrAppend(text);
-        }
-
-        public void Append(string text)
-        {
-            if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("text");
-            if (text[0] != Value) throw new ArgumentOutOfRangeException("text");
-            if (Root) throw new InvalidOperationException("Use AppendToDescendants instead, if you are appending to the tree from the root.");
-
-            var overflow = text.Substring(1);
-            if (overflow.Length > 0)
-            {
-                InsertOrAppend(overflow);
-            }
-        }
-
-        private void InsertOrAppend(string text)
-        {
-            if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("text");
-
             Trie child;
             if (!Children.TryGetValue(text[0], out child))
             {
@@ -130,6 +111,19 @@
             else
             {
                 child.Append(text);
+            }
+        }
+
+        public void Append(string text)
+        {
+            if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("text");
+            if (text[0] != Value) throw new ArgumentOutOfRangeException("text");
+            if (Root) throw new InvalidOperationException("When appending from the root, use AppendToDescendants.");
+
+            var overflow = text.Substring(1);
+            if (overflow.Length > 0)
+            {
+                AppendToDescendants(overflow);
             }
         }


Fix ambiguous reference

Fix ambiguous reference

--- osu.Game/Online/RealtimeMultiplayer/StatefulMultiplayerClient.cs
+++ osu.Game/Online/RealtimeMultiplayer/StatefulMultiplayerClient.cs
@@ -117,7 +117,7 @@
         /// Change the current <see cref="MultiplayerRoom"/> settings.
         /// </summary>
         /// <remarks>
-        /// A room must have been joined via <see cref="JoinRoom"/> for this to have any effect.
+        /// A room must be joined for this to have any effect.
         /// </remarks>
         /// <param name="name">The new room name, if any.</param>
         /// <param name="item">The new room playlist item, if any.</param>


Fixed null string implicit conversion

Fixed null string implicit conversion

--- SimpleJSON.cs
+++ SimpleJSON.cs
@@ -363,7 +363,7 @@

         public static implicit operator JSONNode(string s)
         {
-            return new JSONString(s);
+            return (s is null) ? (JSONNode) JSONNull.CreateOrGet() : new JSONString(s);
         }
         public static implicit operator string(JSONNode d)
         {


Second pass of fixes after some use.

Second pass of fixes after some use.

--- SimplePool.cs
+++ SimplePool.cs
@@ -8,12 +8,18 @@
 public static class SimplePool
 {
     public static Dictionary<string, GameObject[]>      pools;
-    public static int                                   poolSize    = 50;
-    public static int                                   poolMargin  = 10;
+    public static int                                   poolSize        = 1000;
+    public static int                                   poolIncreasSize = 100;
+    public static int                                   poolMargin      = 50;
     public static Dictionary<string, int>               poolCounts;
     public static Dictionary<string, HashSet<int>>      activeObjs;

     public static GameObject Catch (GameObject go, Transform t)
+    {
+        return Catch(go, t.position, t.rotation);
+    }
+
+    public static GameObject Catch (GameObject go, Vector3 pos, Quaternion rot)
     {
         if (!PoolExists(go.name)) { CreatePool(go);       }
         if (PoolIsFull(go.name))  { IncreasePoolSize(go); }
@@ -28,8 +34,8 @@
             activeObjs[go.name].Add(hc);
             Transform  pT  = pools[go.name][i].GetComponent<Transform>();

-            pT.position = t.position;
-            pT.rotation = t.rotation;
+            pT.position = pos;
+            pT.rotation = rot;

             pools[go.name][i].SetActive(true);

@@ -64,15 +70,15 @@
             activeObjs = new Dictionary<string, HashSet<int>>();
         }

-        pools[go.name] = CreateObjs(go);
+        pools[go.name] = CreateObjs(go, poolSize);
         activeObjs[go.name] = new HashSet<int>();
     }

     public static void IncreasePoolSize (GameObject go)
     {
         int          currLen = pools[go.name].Length;
-        GameObject[] nPool   = new GameObject[currLen + poolSize];
-        GameObject[] newObjs = CreateObjs(go);
+        GameObject[] nPool   = new GameObject[currLen + poolIncreasSize];
+        GameObject[] newObjs = CreateObjs(go, poolIncreasSize);

         Array.Copy(pools[go.name], 0, nPool, 0, currLen);
         Array.Copy(newObjs, 0, nPool, currLen, newObjs.Length);
@@ -80,11 +86,11 @@
         pools[go.name] = nPool;
     }

-    public static GameObject[] CreateObjs (GameObject go)
+    public static GameObject[] CreateObjs (GameObject go, int num)
     {
-        GameObject[] gos = new GameObject[poolSize];
+        GameObject[] gos = new GameObject[num];

-        for (int i = 0; i < poolSize; i++)
+        for (int i = 0; i < num; i++)
         {
             GameObject goInst = (GameObject) GameObject.Instantiate(
                 go,


Update compatibility checks for user language permissions

--- uSync.Core/uSyncCapabilityChecker.cs
+++ uSync.Core/uSyncCapabilityChecker.cs
@@ -38,6 +38,12 @@
         public bool HasRuntimeMode
             => _version.Version.Major > 10 ||
             _version.Version.Major == 10 && _version.Version.Minor > 1;
+
+
+        /// <summary>
+        ///  User groups has Language Permissions - introduced in Umbraco 10.2.0
+        /// </summary>
+        public bool HasGroupLanguagePermissions => _version.Version >= new Version(10, 2, 0);
     }

 }


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/Net/CookieCollection.cs
+++ websocket-sharp/Net/CookieCollection.cs
@@ -262,49 +262,74 @@
         if (pair.Length == 0)
           continue;

-        if (pair.IndexOf ("$version", compType) == 0) {
-          ver = Int32.Parse (pair.GetValue ('=', true));
-          continue;
-        }
-
-        if (pair.IndexOf ("$path", compType) == 0) {
-          if (cookie != null)
-            cookie.Path = pair.GetValue ('=');
-
-          continue;
-        }
-
-        if (pair.IndexOf ("$domain", compType) == 0) {
-          if (cookie != null)
-            cookie.Domain = pair.GetValue ('=');
-
-          continue;
-        }
-
-        if (pair.IndexOf ("$port", compType) == 0) {
+        var idx = pair.IndexOf ('=');
+        if (idx == -1) {
+          if (cookie == null)
+            continue;
+
+          if (pair.Equals ("$port", compType)) {
+            cookie.Port = "\"\"";
+            continue;
+          }
+
+          continue;
+        }
+
+        if (idx == 0) {
           if (cookie != null) {
-            cookie.Port = !pair.Equals ("$port", compType)
-                          ? pair.GetValue ('=')
-                          : "\"\"";
+            ret.Add (cookie);
+            cookie = null;
           }

           continue;
         }

-        if (cookie != null) {
+        var name = pair.Substring (0, idx).TrimEnd (' ');
+        var val = idx < pair.Length - 1
+                  ? pair.Substring (idx + 1).TrimStart (' ')
+                  : String.Empty;
+
+        if (name.Equals ("$version", compType)) {
+          ver = val.Length > 0 ? Int32.Parse (val.Unquote ()) : 0;
+          continue;
+        }
+
+        if (name.Equals ("$path", compType)) {
+          if (cookie == null)
+            continue;
+
+          if (val.Length == 0)
+            continue;
+
+          cookie.Path = val;
+          continue;
+        }
+
+        if (name.Equals ("$domain", compType)) {
+          if (cookie == null)
+            continue;
+
+          if (val.Length == 0)
+            continue;
+
+          cookie.Domain = val;
+          continue;
+        }
+
+        if (name.Equals ("$port", compType)) {
+          if (cookie == null)
+            continue;
+
+          if (val.Length == 0)
+            continue;
+
+          cookie.Port = val;
+          continue;
+        }
+
+        if (cookie != null)
           ret.Add (cookie);
-          cookie = null;
-        }
-
-        var idx = pair.IndexOf ('=');
-        if (idx == -1)
-          continue;
-
-        if (idx == pair.Length - 1)
-          continue;
-
-        var name = pair.Substring (0, idx).TrimEnd (' ');
-        var val = pair.Substring (idx + 1).TrimStart (' ');
+
         cookie = new Cookie (name, val);

         if (ver != 0)


Add FallBackIntent

Add FallBackIntent

--- Alexa.NET/Request/Type/BuiltInIntents.cs
+++ Alexa.NET/Request/Type/BuiltInIntents.cs
@@ -128,6 +128,11 @@
         /// </summary>
         public const string StartOver = "AMAZON.StartOverIntent";

+        /// <summary>
+		/// Purpose
+		/// - Triggered when the user's spoken input does not match any of the other intents in the skill
+        /// </summary>
+		public const string Fallback = "AMAZON.FallbackIntent";
     }

 }


removed new line

removed new line

--- BrumWithMe/Web/BrumWithMe.MVC/Startup.cs
+++ BrumWithMe/Web/BrumWithMe.MVC/Startup.cs
@@ -12,7 +12,6 @@
             // TODO: NInject
             var identityConfig = new IdentityConfig();
             identityConfig.ConfigureAuth(app);
-
             app.MapSignalR();
         }
     }


NCBC-228: Frequent pooled socket errors during rebalance

It appears that there are concurrency issues when the server
is sending frequent config updates, as is the case during
a rebalance.  Config updates trigger the client to destroy its
socket pool after first creating a new one.

This change briefly delays the destruction of the old pool
so that any in progress operations may complete.

--- Enyim.Caching/Memcached/MemcachedNode.cs
+++ Enyim.Caching/Memcached/MemcachedNode.cs
@@ -479,24 +479,26 @@
 				// if someone uses a pooled item then 99% that an exception will be thrown
 				// somewhere. But since the dispose is mostly used when everyone else is finished
 				// this should not kill any kittens
-				if (!this.isDisposed)
-				{
-					this.isAlive = false;
-					this.isDisposed = true;
-
-					PooledSocket ps;
-
-					while (this.freeItems.TryPop(out ps))
-					{
-						try { ps.Destroy(); }
-						catch { }
-					}
-
-					this.ownerNode = null;
-					this.semaphore.Close();
-					this.semaphore = null;
-					this.freeItems = null;
-				}
+				new Timer((s) => {
+					if (!this.isDisposed)
+					{
+						this.isAlive = false;
+						this.isDisposed = true;
+
+						PooledSocket ps;
+
+						while (this.freeItems.TryPop(out ps))
+						{
+							try { ps.Destroy(); }
+							catch { }
+						}
+
+						this.ownerNode = null;
+						this.semaphore.Close();
+						this.semaphore = null;
+						this.freeItems = null;
+					}
+				}, null, 1000, Timeout.Infinite);
 			}

 			void IDisposable.Dispose()


Satisfy xUnit 2.3.1 restriction (no overloads for test methods).

--- ExpressionToCodeTest/ToValuedCodeTest.cs
+++ ExpressionToCodeTest/ToValuedCodeTest.cs
@@ -42,14 +42,14 @@
         }

         [Fact]
-        public void TheMethod()
+        public void MethodCall()
         {
             var actual = ExpressionToCode.ToValuedCode(() => TheMethod(1, "2"));
             Assert.Equal("TheMethod(1, \"2\") = TheMethod 1 2", actual);
         }

         [Fact]
-        public void TheGenericMethod()
+        public void GenericMethodCall()
         {
             var actual = ExpressionToCode.ToValuedCode(() => TheGenericMethod<int>(2));
             Assert.Equal("TheGenericMethod<int>(2) = Return value is 4", actual);


better usage

better usage

--- Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Program.cs
+++ Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Program.cs
@@ -225,8 +225,8 @@

                 var htmlContent = sbHtmlContent.ToString();
                 var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
-                var response = await client.SendEmailAsync(msg);
-                mailResponse = response;
+                mailResponse = await client.SendEmailAsync(msg);
+

             }
         }


Fix to PageHeader domain model

Fix to PageHeader domain model

--- Core/OfficeDevPnP.Core/Framework/Provisioning/Model/ClientSidePageHeader.cs
+++ Core/OfficeDevPnP.Core/Framework/Provisioning/Model/ClientSidePageHeader.cs
@@ -93,13 +93,13 @@
     public enum ClientSidePageHeaderType
     {
         /// <summary>
+        /// The client side page does not hava any header
+        /// </summary>
+        None,
+        /// <summary>
         /// Default client side page header
         /// </summary>
         Default,
-        /// <summary>
-        /// The client side page does not hava any header
-        /// </summary>
-        None,
         /// <summary>
         /// The client side page has a custom header
         /// </summary>


Update Index.cshtml

Update Index.cshtml

--- Dinero.Tools.Difference/Dinero.Tools.Difference.Web/Views/Home/Index.cshtml
+++ Dinero.Tools.Difference/Dinero.Tools.Difference.Web/Views/Home/Index.cshtml
@@ -1,5 +1,5 @@
 @{
-    ViewBag.Title = "Dinero Tools - Her skruer vi Dinero.dk op på 11!";
+    ViewBag.Title = "Dinero.dk Værktøj - Find differencen og de manglende bilag i Dinero.dk ved bankafstemning.";
 }

 <!-- Header -->


Updated news on frontpage

Updated news on frontpage

--- Dinero.Tools.Difference/Dinero.Tools.Difference.Web/Views/Home/Index.cshtml
+++ Dinero.Tools.Difference/Dinero.Tools.Difference.Web/Views/Home/Index.cshtml
@@ -114,6 +114,15 @@

+

+

+

+                01-01-2017
+

+                    Mindre ændring på fejl siden, sådan at alt relevant information står i den grå boks.
+

+

+


Added functionality to download with a normal session when started from background.

--- DownloadManager/Plugin.DownloadManager.iOS/DownloadManagerImplementation.cs
+++ DownloadManager/Plugin.DownloadManager.iOS/DownloadManagerImplementation.cs
@@ -15,6 +15,8 @@
     {
         private string _identifier => NSBundle.MainBundle.BundleIdentifier + ".BackgroundTransferSession";

+        private readonly NSUrlSession _backgroundSession;
+
         private readonly NSUrlSession _session;

         public event NotifyCollectionChangedEventHandler CollectionChanged;
@@ -35,10 +37,12 @@
         {
             _queue = new List<IDownloadFile> ();

-            _session = InitBackgroundSession (sessionDownloadDelegate);
+            _session = InitDefaultSession(sessionDownloadDelegate);
+
+            _backgroundSession = InitBackgroundSession(sessionDownloadDelegate);

             // Reinitialize tasks that were started before the app was terminated or suspended
-            _session.GetTasks2((NSUrlSessionTask[] dataTasks, NSUrlSessionTask[] uploadTasks, NSUrlSessionTask[] downloadTasks) => {
+            _backgroundSession.GetTasks2((dataTasks, uploadTasks, downloadTasks) => {
                 foreach (var task in downloadTasks) {
                     AddFile(new DownloadFileImplementation(task));
                 }
@@ -55,12 +59,27 @@
             return new DownloadFileImplementation (url, headers);
         }

-        public void Start (IDownloadFile i, bool mobileNetworkAllowed = true)
+        public void Start(IDownloadFile i, bool mobileNetworkAllowed = true)
         {
             var file = (DownloadFileImplementation)i;

-            file.StartDownload (_session, mobileNetworkAllowed);
             AddFile(file);
+
+            NSOperationQueue.MainQueue.BeginInvokeOnMainThread(() =>
+            {
+                NSUrlSession session;
+
+                if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Background)
+                {
+                    session = _session;
+                }
+                else
+                {
+                    session = _backgroundSession;
+                }
+
+                file.StartDownload(session, mobileNetworkAllowed);
+            });
         }

         public void Abort (IDownloadFile i)
@@ -85,20 +104,38 @@
          * - nil as queue: The method, called on events could end up on any thread
          * - Only one connection per host
          */
-        NSUrlSession InitBackgroundSession (UrlSessionDownloadDelegate sessionDownloadDelegate)
+        NSUrlSession InitBackgroundSession(UrlSessionDownloadDelegate sessionDownloadDelegate)
         {
             sessionDownloadDelegate.Controller = this;

             NSUrlSessionConfiguration configuration;

-            if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) {
-                using (configuration = NSUrlSessionConfiguration.CreateBackgroundSessionConfiguration(_identifier)) {
-                    return createSession(configuration, sessionDownloadDelegate);
-                }
-            } else {
-                using(configuration = NSUrlSessionConfiguration.BackgroundSessionConfiguration(_identifier)) {
-                    return createSession(configuration, sessionDownloadDelegate);
-                };
+            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
+            {
+                configuration = NSUrlSessionConfiguration.CreateBackgroundSessionConfiguration(_identifier);
+            }
+            else
+            {
+                configuration = NSUrlSessionConfiguration.BackgroundSessionConfiguration(_identifier);
+            }
+
+            return InitSession(sessionDownloadDelegate, configuration);
+        }
+
+
+        NSUrlSession InitDefaultSession(UrlSessionDownloadDelegate sessionDownloadDelegate)
+        {
+            return InitSession(sessionDownloadDelegate, NSUrlSessionConfiguration.DefaultSessionConfiguration);
+        }
+
+        NSUrlSession InitSession(UrlSessionDownloadDelegate sessionDownloadDelegate,
+            NSUrlSessionConfiguration configuration)
+        {
+            sessionDownloadDelegate.Controller = this;
+
+            using (configuration)
+            {
+                return createSession(configuration, sessionDownloadDelegate);
             }
         }


Fixed button highlight.

Fixed button highlight.

--- Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/Button.cs
+++ Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/Button.cs
@@ -92,7 +92,8 @@
                 // cursor got its input from a touch screen then the cursor really isn't
                 // over anything. Therefore, we only show the highlighted state if the cursor
                 // is a physical on-screen cursor
-                else if (cursor.LastInputDevice != InputDevice.TouchScreen)
+                else if (GetIfIsOnThisOrChildVisual(cursor) &&
+                    cursor.LastInputDevice != InputDevice.TouchScreen)
                 {
                     Visual.SetProperty("ButtonCategoryState", "HighlightedFocused");
                 }


Fixed derived entities not using their gum objects as collisiion when the gum object is declared in base but initialized in derived.

--- FRBDK/Glue/GumPlugin/GumPlugin/CodeGeneration/GumCollidableCodeGenerator.cs
+++ FRBDK/Glue/GumPlugin/GumPlugin/CodeGeneration/GumCollidableCodeGenerator.cs
@@ -1,5 +1,6 @@
 using FlatRedBall.Glue.CodeGeneration;
 using FlatRedBall.Glue.CodeGeneration.CodeBuilder;
+using FlatRedBall.Glue.Elements;
 using FlatRedBall.Glue.SaveClasses;
 using GumPlugin.Managers;
 using GumPluginCore.Managers;
@@ -34,7 +35,7 @@

         public static void GenerateAddCollision(StringBuilder stringBuilder, IElement element, NamedObjectSave nos)
         {
-            if(IsIGumCollidable(element))
+            if(IsIGumCollidable(element) || InheritsFromIGumCollidable(element))
             {
                 stringBuilder.AppendLine($"GumCoreShared.FlatRedBall.Embedded.GumCollidableExtensions.AddCollision(this, wrapperForAttachment);");
                 stringBuilder.AppendLine($"GumCoreShared.FlatRedBall.Embedded.GumCollidableExtensions.UpdateShapePositionsFromGum(this);");
@@ -50,6 +51,14 @@
             return base.GenerateActivity(codeBlock, element);
         }

-        public static bool IsIGumCollidable(IElement element) => element is EntitySave entitySave && entitySave.Properties.GetValue<bool>(GumCollidableManager.ImplementsIGumCollidable);
+        public static bool IsIGumCollidable(IElement element) =>
+            element is EntitySave entitySave &&
+            entitySave.Properties.GetValue<bool>(GumCollidableManager.ImplementsIGumCollidable);
+
+        public static bool InheritsFromIGumCollidable(IElement element)
+        {
+            return ObjectFinder.Self.GetAllBaseElementsRecursively(element).Any(item =>
+                item.Properties.GetValue<bool>(GumCollidableManager.ImplementsIGumCollidable));
+        }
     }
 }