Use Marshal API for Coreclr GetExceptionForHR. Debugger team need the exception information.

[tfs-changeset: 1600435]

--- src/System.Private.Interop/src/Shared/McgMarshal.cs
+++ src/System.Private.Interop/src/Shared/McgMarshal.cs
@@ -1327,6 +1327,8 @@
         {
 #if ENABLE_WINRT
             return ExceptionHelpers.GetExceptionForHRInternalNoThrow(hr, isWinRTScenario, !isWinRTScenario);
+#elif CORECLR
+            return Marshal.GetExceptionForHR(hr);
 #else
             return new COMException(hr.ToString(),hr);
 #endif


fix a small bug where the IP wasn't displaying properly in the LogDebug

--- Plugins/Dialogic/Sip/ivrToolkit.Plugin.Dialogic.Sip/SipLine.cs
+++ Plugins/Dialogic/Sip/ivrToolkit.Plugin.Dialogic.Sip/SipLine.cs
@@ -1015,7 +1015,7 @@
                                 _logger.LogDebug("IPPARM_LOCAL: size = {0}", parmData.value_size);
                                 var ptr = parmDatap + 5;
                                 var ipAddr = Marshal.PtrToStructure<RTP_ADDR>(ptr);
-                                _logger.LogDebug("  IPPARM_LOCAL: address:{0}, port {1}", ipAddr.u_ipaddr.ipv4.ToString(),
+                                _logger.LogDebug("  IPPARM_LOCAL: address:{0}, port {1}", ipAddr.u_ipaddr.ipv4.ToIp(),
                                     ipAddr.port);
                                 break;
                             case gcip_defs_h.IPPARM_REMOTE:


Extract scatter files in .NET Core

Extract scatter files in .NET Core

This attribute of a managed assembly is evidently unimportant in .NET
Core-only scenarios, but it's possible to extract with S.R.M, and we
should be moving toward depending only on that.

--- src/Tasks/AssemblyDependency/AssemblyInformation.cs
+++ src/Tasks/AssemblyDependency/AssemblyInformation.cs
@@ -418,6 +418,17 @@
                             _frameworkName = new FrameworkName(arguments[0]);
                         }
                     }
+
+                    var assemblyFilesCollection = metadataReader.AssemblyFiles;
+
+                    List<string> assemblyFiles = new List<string>(assemblyFilesCollection.Count);
+
+                    foreach (var fileHandle in assemblyFilesCollection)
+                    {
+                        assemblyFiles.Add(metadataReader.GetString(metadataReader.GetAssemblyFile(fileHandle).Name));
+                    }
+
+                    _assemblyFiles = assemblyFiles.ToArray();
                 }

                 _metadataRead = true;
@@ -656,11 +667,6 @@
         /// <returns>The extra files of assembly dependencies.</returns>
         private string[] ImportFiles()
         {
-            if (!NativeMethodsShared.IsWindows)
-            {
-                return Array.Empty<string>();
-            }
-
 #if FEATURE_ASSEMBLY_LOADFROM
             var files = new List<string>();
             IntPtr fileEnum = IntPtr.Zero;
@@ -699,7 +705,8 @@

             return files.ToArray();
 #else
-            return Array.Empty<string>();
+            CorePopulateMetadata();
+            return _assemblyFiles;
 #endif
         }


Refactor SumcManager captcha stuff.

Refactor SumcManager captcha stuff.

--- src/TramlineFive/TramlineFive.Common/SumcManager.cs
+++ src/TramlineFive/TramlineFive.Common/SumcManager.cs
@@ -28,7 +28,7 @@
             httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(USER_AGENT);
         }

-        public static async Task<IEnumerable<Arrival>> GetByStopAsync(string query, ICaptchaDialog captchaDialog, string submitIndex = "")
+        public static async Task<IEnumerable<Arrival>> GetByStopAsync(string query, Type captchaType, string submitIndex = "")
         {
             int queryNum;
             if (String.IsNullOrEmpty(query) || !Int32.TryParse(query, out queryNum))
@@ -43,6 +43,7 @@

             if (RequiresCaptcha(doc))
             {
+                ICaptchaDialog captchaDialog = Activator.CreateInstance(captchaType) as ICaptchaDialog;
                 captchaDialog.SetUrl(captchaUrl);
                 await captchaDialog.ShowAsync();


Convert DataTablesResult ExecuteResult to using Utf8JsonWriter as well

--- src/TwentyTwenty.Mvc/DataTables/DataTablesResult.cs
+++ src/TwentyTwenty.Mvc/DataTables/DataTablesResult.cs
@@ -1,14 +1,10 @@
 using System.Collections.Generic;
 using System.Net;
-using System.Text;
 using System.Text.Json;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.WebUtilities;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Options;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
 using TwentyTwenty.Mvc.DataTables.Core;

 namespace TwentyTwenty.Mvc.DataTables
@@ -103,37 +99,30 @@
             response.ContentType = "application/json";
             response.StatusCode = (int)HttpStatusCode.OK;

-            using (var writer = new HttpResponseStreamWriter(response.Body, Encoding.UTF8))
-            using (var jsonWriter = new JsonTextWriter(writer))
+            using (var jsonWriter = new Utf8JsonWriter(context.HttpContext.Response.BodyWriter, new JsonWriterOptions { Indented = true }))
             {
-                jsonWriter.CloseOutput = false;
-
                 // Start json object.
                 jsonWriter.WriteStartObject();

                 // Draw
-                jsonWriter.WritePropertyName(ResponseNames.Draw, true);
-                jsonWriter.WriteValue(Draw);
+                jsonWriter.WriteNumber(ResponseNames.Draw, Draw);

                 if (IsSuccessResponse())
                 {
                     // TotalRecords
-                    jsonWriter.WritePropertyName(ResponseNames.TotalRecords, true);
-                    jsonWriter.WriteValue(TotalRecords);
+                    jsonWriter.WriteNumber(ResponseNames.TotalRecords, TotalRecords);

                     // TotalRecordsFiltered
-                    jsonWriter.WritePropertyName(ResponseNames.TotalRecordsFiltered, true);
-                    jsonWriter.WriteValue(TotalRecordsFiltered);
+                    jsonWriter.WriteNumber(ResponseNames.TotalRecordsFiltered, TotalRecordsFiltered);

                     // Data
-                    jsonWriter.WritePropertyName(ResponseNames.Data, true);
-                    SerializeData(jsonWriter, Data);
+                    jsonWriter.WritePropertyName(ResponseNames.Data);
+                    System.Text.Json.JsonSerializer.Serialize(jsonWriter, Data, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
                 }
                 else
                 {
                     // Error
-                    jsonWriter.WritePropertyName(ResponseNames.Error, true);
-                    jsonWriter.WriteValue(Error);
+                    jsonWriter.WriteString(ResponseNames.Error, Error);
                 }

                 // AdditionalParameters
@@ -141,8 +130,8 @@
                 {
                     foreach(var keypair in AdditionalParameters)
                     {
-                        jsonWriter.WritePropertyName(keypair.Key, true);
-                        jsonWriter.WriteValue(keypair.Value);
+                        jsonWriter.WritePropertyName(keypair.Key);
+                        System.Text.Json.JsonSerializer.Serialize(jsonWriter, keypair.Value, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
                     }
                 }

@@ -161,27 +150,6 @@
         private bool IsSuccessResponse()
         {
             return Data != null && string.IsNullOrWhiteSpace(Error);
-        }
-        /// <summary>
-        /// Transforms a data object into a json element using Json.Net library.
-        /// Can be overriten when needed.
-        ///
-        /// Data will be serialized with camelCase convention by default, since it's a JavaScript standard.
-        /// This should not interfere with DataTables' CamelCase X HungarianNotation issue.
-        /// </summary>
-        /// <param name="data">Data object to be transformed to json.</param>
-        /// <returns>A json representation of your data.</returns>
-        public virtual void SerializeData(JsonTextWriter writer, object data)
-        {
-            var settings = new JsonSerializerSettings()
-            {
-                ContractResolver = new CamelCasePropertyNamesContractResolver()
-            };
-
-            var serializer = Newtonsoft.Json.JsonSerializer.Create(settings);
-
-
-            serializer.Serialize(writer, data);
         }

         /// <summary>


WWT.Providers: have CatalogProvider use ServeStreamAsync

--- src/WWT.Providers/OtherProviders/CatalogProvider.cs
+++ src/WWT.Providers/OtherProviders/CatalogProvider.cs
@@ -28,77 +28,49 @@

         public override async Task RunAsync(IWwtContext context, CancellationToken token)
         {
-            string etag = context.Request.Headers["If-None-Match"];
-            string filename = "";
+            string query = "";
+            string extension = "";

             if (context.Request.Params["Q"] != null)
             {
-                string query = context.Request.Params["Q"];
-
-                query = query.Replace("..", "");
-                query = query.Replace("\\", "");
-                query = query.Replace("/", "");
-                filename = Path.Combine(query + ".txt");
+                query = context.Request.Params["Q"];
+                extension = "txt";
             }
             else if (context.Request.Params["X"] != null)
             {
-                string query = context.Request.Params["X"];
-
-                query = query.Replace("..", "");
-                query = query.Replace("\\", "");
-                query = query.Replace("/", "");
-                filename = $"{query}.xml";
+                query = context.Request.Params["X"];
+                extension = "xml";
             }
             else if (context.Request.Params["W"] != null)
             {
-                string query = context.Request.Params["W"];
-
-                query = query.Replace("..", "");
-                query = query.Replace("\\", "");
-                query = query.Replace("/", "");
-                filename = $"{query}.wtml";
-            }
-
-            if (!await GetEntry(context, etag, filename, token))
-            {
-                context.Response.StatusCode = 404;
-            }
-        }
-
-        private async Task<bool> GetEntry(IWwtContext context, string etag, string filename, CancellationToken token)
-        {
-            if (string.IsNullOrEmpty(filename))
-            {
-                return false;
-            }
-
-            var catalogEntry = await _catalog.GetCatalogEntryAsync(filename, token);
-
-            if (catalogEntry is null)
-            {
-                _logger.LogWarning("Requested catalog {Name} does not exist.", filename);
-                return false;
-            }
-
-            string newEtag = catalogEntry.LastModified.ToUniversalTime().ToString();
-
-            if (newEtag != etag)
-            {
-                context.Response.AddHeader("etag", newEtag);
-
-                using (var c = catalogEntry.Contents)
-                {
-                    await c.CopyToAsync(context.Response.OutputStream, token);
-                    context.Response.Flush();
-                    context.Response.End();
-                }
+                query = context.Request.Params["W"];
+                extension = "wtml";
             }
             else
             {
-                context.Response.StatusCode = 304;
+                context.Response.StatusCode = 400;
+                return;
             }

-            return true;
+            query = query.Replace("..", "").Replace("\\", "").Replace("/", "");
+            string filename = $"{query}.{extension}";
+
+            var catalogEntry = await _catalog.GetCatalogEntryAsync(filename, token);
+            if (catalogEntry is null)
+            {
+                string msg = $"Requested catalog item {filename} does not exist.";
+                _logger.LogWarning(msg);
+                await Report404Async(context, msg, token);
+                return;
+            }
+
+            string mtime = catalogEntry.LastModified.ToUniversalTime().ToString();
+            string etag = $"\"{mtime}\"";
+
+            using (var c = catalogEntry.Contents)
+            {
+                await context.Response.ServeStreamAsync(c, "text/plain", etag);
+            }
         }
     }
 }


Minor improvements to Mike's new commandlet. Welcome to the team Mike!

--- PowerShellIntegrations/Commandlets/Data/ExpandTokensCommand.cs
+++ PowerShellIntegrations/Commandlets/Data/ExpandTokensCommand.cs
@@ -8,13 +8,13 @@

 namespace Cognifide.PowerShell.PowerShellIntegrations.Commandlets.Data
 {
-    [Cmdlet("Expand", "Tokens", DefaultParameterSetName = "Item")]
+    [Cmdlet("Expand", "Token")]
     [OutputType(new[] { typeof(Item) })]
-    public class ExpandTokensCommand : BaseCommand
+    public class ExpandTokenCommand : BaseCommand
     {
         private static readonly MasterVariablesReplacer TokenReplacer = Factory.GetMasterVariablesReplacer();

-        [Parameter(Position = 0, Mandatory = true)]
+        [Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true)]
         public Item Item { get; set; }

         protected override void ProcessRecord()
@@ -31,8 +31,7 @@
                 throw ex;
             }

-            PSObject psobj = ItemShellExtensions.GetPsObject(SessionState, Item);
-            WriteObject(psobj, false);
+            WriteItem(Item);
         }
     }
 }


added toggle method

added toggle method

--- RestberryPiApi/RestberryPiApi/Controllers/GPIOPinController.cs
+++ RestberryPiApi/RestberryPiApi/Controllers/GPIOPinController.cs
@@ -24,10 +24,9 @@

         // GET: api/GPIO/5
         [HttpGet("{id}", Name = "Get")]
-        public string Get(int id)
+        public GpioPin Get(int id)
         {
-            var pin = Pi.Gpio.Pins[id];
-            return $"pinId: {id}, wireingpin: {pin.WiringPiPinNumber} x: {string.Join(',', pin.Capabilities)}";
+            return Pi.Gpio.Pins[id];
         }

         // POST: api/GPIO
@@ -39,6 +38,15 @@
             pin1.Write(value);
         }

+        [HttpPost()]
+        public void Toggle(int id, [FromBody]bool value)
+        {
+            var pin1 = Pi.Gpio[id];
+            var currentvalue = pin1.Read();
+            pin1.PinMode = Unosquare.RaspberryIO.Gpio.GpioPinDriveMode.Output;
+            pin1.Write(!currentvalue);
+        }
+
         // PUT: api/GPIO/5
         [HttpPut("{id}")]
         public void Put(int id, [FromBody]int value)


Hopefully unstuck players right

Hopefully unstuck players right

--- Multiplayer.cs
+++ Multiplayer.cs
@@ -429,13 +429,11 @@
                 problemStarting = true;
             }
         }
-
-        private static bool didNewDay = false;
+
         public static bool prevFreezeControls = false;
         public static bool sentNextDayPacket = false;
         public static long prevLatestId;
-
-        private static int prevDuhu, prevHul, prevLul;
+
         public static void update()
         {
             // Really don't understand why it breaks without this
@@ -462,7 +460,6 @@

             if (Game1.newDay)
             {
-                didNewDay = true;
                 Game1.freezeControls = prevFreezeControls = true;
                 Game1.player.CanMove = false;
                 if ( !sentNextDayPacket )
@@ -517,6 +514,7 @@
                             Game1.freezeControls = prevFreezeControls = false;
                             Game1.newDay = false;
                             Game1.fadeToBlackAlpha = 0;
+                            Game1.player.CanMove = true;
                             client.stage = Client.NetStage.Playing;
                         }
                     }


Tests: Fixed test fixture teardown in cases where the test is ignored by test fixture setup.  Also standardized on the TestConfigurationHelper in more cases.

--- src/NHibernate.Test/TestCase.cs
+++ src/NHibernate.Test/TestCase.cs
@@ -1,393 +1,397 @@
-using System;
-using System.Collections;
-using System.Data;
-using System.Reflection;
-using log4net;
-using log4net.Config;
-using NHibernate.Cfg;
-using NHibernate.Connection;
-using NHibernate.Engine;
-using NHibernate.Mapping;
-using NHibernate.Tool.hbm2ddl;
-using NHibernate.Type;
-using NUnit.Framework;
-using NHibernate.Hql.Classic;
-using NHibernate.Hql.Ast.ANTLR;
-
-namespace NHibernate.Test
-{
-	public abstract class TestCase
-	{
-		private const bool OutputDdl = false;
-		protected Configuration cfg;
-		protected ISessionFactoryImplementor sessions;
-
-		private static readonly ILog log = LogManager.GetLogger(typeof(TestCase));
-
-		protected Dialect.Dialect Dialect
-		{
-			get { return NHibernate.Dialect.Dialect.GetDialect(cfg.Properties); }
-		}
-
-		protected TestDialect TestDialect
-		{
-			get { return TestDialect.GetTestDialect(Dialect); }
-		}
-
-		/// <summary>
-		/// To use in in-line test
-		/// </summary>
-		protected bool IsClassicParser
-		{
-			get
-			{
-				return sessions.Settings.QueryTranslatorFactory is ClassicQueryTranslatorFactory;
-			}
-		}
-
-		/// <summary>
-		/// To use in in-line test
-		/// </summary>
-		protected bool IsAntlrParser
-		{
-			get
-			{
-				return sessions.Settings.QueryTranslatorFactory is ASTQueryTranslatorFactory;
-			}
-		}
-
-		protected ISession lastOpenedSession;
-		private DebugConnectionProvider connectionProvider;
-
-		/// <summary>
-		/// Mapping files used in the TestCase
-		/// </summary>
-		protected abstract IList Mappings { get; }
-
-		/// <summary>
-		/// Assembly to load mapping files from (default is NHibernate.DomainModel).
-		/// </summary>
-		protected virtual string MappingsAssembly
-		{
-			get { return "NHibernate.DomainModel"; }
-		}
-
-		static TestCase()
-		{
-			// Configure log4net here since configuration through an attribute doesn't always work.
-			XmlConfigurator.Configure();
-		}
-
-		/// <summary>
-		/// Creates the tables used in this TestCase
-		/// </summary>
-		[TestFixtureSetUp]
-		public void TestFixtureSetUp()
-		{
-			try
-			{
-				Configure();
-				if (!AppliesTo(Dialect))
-				{
-					Assert.Ignore(GetType() + " does not apply to " + Dialect);
-				}
-
-				CreateSchema();
-				try
-				{
-					BuildSessionFactory();
-					if (!AppliesTo(sessions))
-					{
-						Assert.Ignore(GetType() + " does not apply with the current session-factory configuration");
-					}
-				}
-				catch
-				{
-					DropSchema();
-					throw;
-				}
-			}
-			catch (Exception e)
-			{
-				Cleanup();
-				log.Error("Error while setting up the test fixture", e);
-				throw;
-			}
-		}
-
-		/// <summary>
-		/// Removes the tables used in this TestCase.
-		/// </summary>
-		/// <remarks>
-		/// If the tables are not cleaned up sometimes SchemaExport runs into
-		/// Sql errors because it can't drop tables because of the FKs.  This
-		/// will occur if the TestCase does not have the same hbm.xml files
-		/// included as a previous one.
-		/// </remarks>
-		[TestFixtureTearDown]
-		public void TestFixtureTearDown()
-		{
-            if (!AppliesTo(Dialect))
-                return;
-
-            DropSchema();
-			Cleanup();
-		}
-
-		protected virtual void OnSetUp()
-		{
-		}
-
-		/// <summary>
-		/// Set up the test. This method is not overridable, but it calls
-		/// <see cref="OnSetUp" /> which is.
-		/// </summary>
-		[SetUp]
-		public void SetUp()
-		{
-			OnSetUp();
-		}
-
-		protected virtual void OnTearDown()
-		{
-		}
-
-		/// <summary>
-		/// Checks that the test case cleans up after itself. This method
-		/// is not overridable, but it calls <see cref="OnTearDown" /> which is.
-		/// </summary>
-		[TearDown]
-		public void TearDown()
-		{
-			OnTearDown();
-
-			bool wasClosed = CheckSessionWasClosed();
-			bool wasCleaned = CheckDatabaseWasCleaned();
-			bool wereConnectionsClosed = CheckConnectionsWereClosed();
-			bool fail = !wasClosed || !wasCleaned || !wereConnectionsClosed;
-
-			if (fail)
-			{
-                Assert.Fail("Test didn't clean up after itself. session closed: " + wasClosed + " database cleaned: "+ wasCleaned
-                    + " connection closed: " + wereConnectionsClosed);
-			}
-		}
-
-		private bool CheckSessionWasClosed()
-		{
-			if (lastOpenedSession != null && lastOpenedSession.IsOpen)
-			{
-				log.Error("Test case didn't close a session, closing");
-				lastOpenedSession.Close();
-				return false;
-			}
-
-			return true;
-		}
-
-		private bool CheckDatabaseWasCleaned()
-		{
-			if (sessions.GetAllClassMetadata().Count == 0)
-			{
-				// Return early in the case of no mappings, also avoiding
-				// a warning when executing the HQL below.
-				return true;
-			}
-
-			bool empty;
-			using (ISession s = sessions.OpenSession())
-			{
-				IList objects = s.CreateQuery("from System.Object o").List();
-				empty = objects.Count == 0;
-			}
-
-			if (!empty)
-			{
-				log.Error("Test case didn't clean up the database after itself, re-creating the schema");
-				DropSchema();
-				CreateSchema();
-			}
-
-			return empty;
-		}
-
-		private bool CheckConnectionsWereClosed()
-		{
-			if (connectionProvider == null || !connectionProvider.HasOpenConnections)
-			{
-				return true;
-			}
-
-			log.Error("Test case didn't close all open connections, closing");
-			connectionProvider.CloseAllConnections();
-			return false;
-		}
-
-		private void Configure()
-		{
-			cfg = new Configuration();
-			if (TestConfigurationHelper.hibernateConfigFile != null)
-				cfg.Configure(TestConfigurationHelper.hibernateConfigFile);
-
-			AddMappings(cfg);
-
-			Configure(cfg);
-
-			ApplyCacheSettings(cfg);
-		}
-
-		protected virtual void AddMappings(Configuration configuration)
-		{
-			Assembly assembly = Assembly.Load(MappingsAssembly);
-
-			foreach (string file in Mappings)
-			{
-				configuration.AddResource(MappingsAssembly + "." + file, assembly);
-			}
-		}
-
-		protected virtual void CreateSchema()
-		{
-			new SchemaExport(cfg).Create(OutputDdl, true);
-		}
-
-		private void DropSchema()
-		{
-			new SchemaExport(cfg).Drop(OutputDdl, true);
-		}
-
-		protected virtual void BuildSessionFactory()
-		{
-			sessions = (ISessionFactoryImplementor)cfg.BuildSessionFactory();
-			connectionProvider = sessions.ConnectionProvider as DebugConnectionProvider;
-		}
-
-		private void Cleanup()
-		{
-			if (sessions != null)
-			{
-				sessions.Close();
-			}
-			sessions = null;
-			connectionProvider = null;
-			lastOpenedSession = null;
-			cfg = null;
-		}
-
-		public int ExecuteStatement(string sql)
-		{
-			if (cfg == null)
-			{
-				cfg = new Configuration();
-			}
-
-			using (IConnectionProvider prov = ConnectionProviderFactory.NewConnectionProvider(cfg.Properties))
-			{
-				IDbConnection conn = prov.GetConnection();
-
-				try
-				{
-					using (IDbTransaction tran = conn.BeginTransaction())
-					using (IDbCommand comm = conn.CreateCommand())
-					{
-						comm.CommandText = sql;
-						comm.Transaction = tran;
-						comm.CommandType = CommandType.Text;
-						int result = comm.ExecuteNonQuery();
-						tran.Commit();
-						return result;
-					}
-				}
-				finally
-				{
-					prov.CloseConnection(conn);
-				}
-			}
-		}
-
-		public int ExecuteStatement(ISession session, ITransaction transaction, string sql)
-		{
-			using (IDbCommand cmd = session.Connection.CreateCommand())
-			{
-				cmd.CommandText = sql;
-				if (transaction != null)
-					transaction.Enlist(cmd);
-				return cmd.ExecuteNonQuery();
-			}
-		}
-
-		protected ISessionFactoryImplementor Sfi
-		{
-			get { return sessions; }
-		}
-
-		protected virtual ISession OpenSession()
-		{
-			lastOpenedSession = sessions.OpenSession();
-			return lastOpenedSession;
-		}
-
-		protected virtual ISession OpenSession(IInterceptor sessionLocalInterceptor)
-		{
-			lastOpenedSession = sessions.OpenSession(sessionLocalInterceptor);
-			return lastOpenedSession;
-		}
-
-		protected void ApplyCacheSettings(Configuration configuration)
-		{
-			if (CacheConcurrencyStrategy == null)
-			{
-				return;
-			}
-
-			foreach (PersistentClass clazz in configuration.ClassMappings)
-			{
-				bool hasLob = false;
-				foreach (Property prop in clazz.PropertyClosureIterator)
-				{
-					if (prop.Value.IsSimpleValue)
-					{
-						IType type = ((SimpleValue)prop.Value).Type;
-						if (type == NHibernateUtil.BinaryBlob)
-						{
-							hasLob = true;
-						}
-					}
-				}
-				if (!hasLob && !clazz.IsInherited)
-				{
-					configuration.SetCacheConcurrencyStrategy(clazz.EntityName, CacheConcurrencyStrategy);
-				}
-			}
-
-			foreach (Mapping.Collection coll in configuration.CollectionMappings)
-			{
-				configuration.SetCollectionCacheConcurrencyStrategy(coll.Role, CacheConcurrencyStrategy);
-			}
-		}
-
-		#region Properties overridable by subclasses
-
-		protected virtual bool AppliesTo(Dialect.Dialect dialect)
-		{
-			return true;
-		}
-
-		protected virtual bool AppliesTo(ISessionFactoryImplementor factory)
-		{
-			return true;
-		}
-
-		protected virtual void Configure(Configuration configuration)
-		{
-		}
-
-		protected virtual string CacheConcurrencyStrategy
-		{
-			get { return "nonstrict-read-write"; }
-			//get { return null; }
-		}
-
-		#endregion
-	}
-}
+using System;
+using System.Collections;
+using System.Data;
+using System.Reflection;
+using log4net;
+using log4net.Config;
+using NHibernate.Cfg;
+using NHibernate.Connection;
+using NHibernate.Engine;
+using NHibernate.Mapping;
+using NHibernate.Tool.hbm2ddl;
+using NHibernate.Type;
+using NUnit.Framework;
+using NHibernate.Hql.Classic;
+using NHibernate.Hql.Ast.ANTLR;
+
+namespace NHibernate.Test
+{
+	public abstract class TestCase
+	{
+		private const bool OutputDdl = false;
+		protected Configuration cfg;
+		protected ISessionFactoryImplementor sessions;
+
+		private static readonly ILog log = LogManager.GetLogger(typeof(TestCase));
+
+		protected Dialect.Dialect Dialect
+		{
+			get { return NHibernate.Dialect.Dialect.GetDialect(cfg.Properties); }
+		}
+
+		protected TestDialect TestDialect
+		{
+			get { return TestDialect.GetTestDialect(Dialect); }
+		}
+
+		/// <summary>
+		/// To use in in-line test
+		/// </summary>
+		protected bool IsClassicParser
+		{
+			get
+			{
+				return sessions.Settings.QueryTranslatorFactory is ClassicQueryTranslatorFactory;
+			}
+		}
+
+		/// <summary>
+		/// To use in in-line test
+		/// </summary>
+		protected bool IsAntlrParser
+		{
+			get
+			{
+				return sessions.Settings.QueryTranslatorFactory is ASTQueryTranslatorFactory;
+			}
+		}
+
+		protected ISession lastOpenedSession;
+		private DebugConnectionProvider connectionProvider;
+
+		/// <summary>
+		/// Mapping files used in the TestCase
+		/// </summary>
+		protected abstract IList Mappings { get; }
+
+		/// <summary>
+		/// Assembly to load mapping files from (default is NHibernate.DomainModel).
+		/// </summary>
+		protected virtual string MappingsAssembly
+		{
+			get { return "NHibernate.DomainModel"; }
+		}
+
+		static TestCase()
+		{
+			// Configure log4net here since configuration through an attribute doesn't always work.
+			XmlConfigurator.Configure();
+		}
+
+		/// <summary>
+		/// Creates the tables used in this TestCase
+		/// </summary>
+		[TestFixtureSetUp]
+		public void TestFixtureSetUp()
+		{
+			try
+			{
+				Configure();
+				if (!AppliesTo(Dialect))
+				{
+					Assert.Ignore(GetType() + " does not apply to " + Dialect);
+				}
+
+				CreateSchema();
+				try
+				{
+					BuildSessionFactory();
+					if (!AppliesTo(sessions))
+					{
+						Assert.Ignore(GetType() + " does not apply with the current session-factory configuration");
+					}
+				}
+				catch
+				{
+					DropSchema();
+					throw;
+				}
+			}
+			catch (Exception e)
+			{
+				Cleanup();
+				log.Error("Error while setting up the test fixture", e);
+				throw;
+			}
+		}
+
+		/// <summary>
+		/// Removes the tables used in this TestCase.
+		/// </summary>
+		/// <remarks>
+		/// If the tables are not cleaned up sometimes SchemaExport runs into
+		/// Sql errors because it can't drop tables because of the FKs.  This
+		/// will occur if the TestCase does not have the same hbm.xml files
+		/// included as a previous one.
+		/// </remarks>
+		[TestFixtureTearDown]
+		public void TestFixtureTearDown()
+		{
+			// If TestFixtureSetup fails due to an IgnoreException, it will still run the teardown.
+			// We don't want to try to clean up again since the setup would have already done so.
+			// If cfg is null already, that indicates it's already been cleaned up and we needn't.
+			if (cfg != null)
+			{
+				if (!AppliesTo(Dialect))
+					return;
+
+				DropSchema();
+				Cleanup();
+			}
+		}
+
+		protected virtual void OnSetUp()
+		{
+		}
+
+		/// <summary>
+		/// Set up the test. This method is not overridable, but it calls
+		/// <see cref="OnSetUp" /> which is.
+		/// </summary>
+		[SetUp]
+		public void SetUp()
+		{
+			OnSetUp();
+		}
+
+		protected virtual void OnTearDown()
+		{
+		}
+
+		/// <summary>
+		/// Checks that the test case cleans up after itself. This method
+		/// is not overridable, but it calls <see cref="OnTearDown" /> which is.
+		/// </summary>
+		[TearDown]
+		public void TearDown()
+		{
+			OnTearDown();
+
+			bool wasClosed = CheckSessionWasClosed();
+			bool wasCleaned = CheckDatabaseWasCleaned();
+			bool wereConnectionsClosed = CheckConnectionsWereClosed();
+			bool fail = !wasClosed || !wasCleaned || !wereConnectionsClosed;
+
+			if (fail)
+			{
+                Assert.Fail("Test didn't clean up after itself. session closed: " + wasClosed + " database cleaned: "+ wasCleaned
+                    + " connection closed: " + wereConnectionsClosed);
+			}
+		}
+
+		private bool CheckSessionWasClosed()
+		{
+			if (lastOpenedSession != null && lastOpenedSession.IsOpen)
+			{
+				log.Error("Test case didn't close a session, closing");
+				lastOpenedSession.Close();
+				return false;
+			}
+
+			return true;
+		}
+
+		private bool CheckDatabaseWasCleaned()
+		{
+			if (sessions.GetAllClassMetadata().Count == 0)
+			{
+				// Return early in the case of no mappings, also avoiding
+				// a warning when executing the HQL below.
+				return true;
+			}
+
+			bool empty;
+			using (ISession s = sessions.OpenSession())
+			{
+				IList objects = s.CreateQuery("from System.Object o").List();
+				empty = objects.Count == 0;
+			}
+
+			if (!empty)
+			{
+				log.Error("Test case didn't clean up the database after itself, re-creating the schema");
+				DropSchema();
+				CreateSchema();
+			}
+
+			return empty;
+		}
+
+		private bool CheckConnectionsWereClosed()
+		{
+			if (connectionProvider == null || !connectionProvider.HasOpenConnections)
+			{
+				return true;
+			}
+
+			log.Error("Test case didn't close all open connections, closing");
+			connectionProvider.CloseAllConnections();
+			return false;
+		}
+
+		private void Configure()
+		{
+			cfg = TestConfigurationHelper.GetDefaultConfiguration();
+
+			AddMappings(cfg);
+
+			Configure(cfg);
+
+			ApplyCacheSettings(cfg);
+		}
+
+		protected virtual void AddMappings(Configuration configuration)
+		{
+			Assembly assembly = Assembly.Load(MappingsAssembly);
+
+			foreach (string file in Mappings)
+			{
+				configuration.AddResource(MappingsAssembly + "." + file, assembly);
+			}
+		}
+
+		protected virtual void CreateSchema()
+		{
+			new SchemaExport(cfg).Create(OutputDdl, true);
+		}
+
+		private void DropSchema()
+		{
+			new SchemaExport(cfg).Drop(OutputDdl, true);
+		}
+
+		protected virtual void BuildSessionFactory()
+		{
+			sessions = (ISessionFactoryImplementor)cfg.BuildSessionFactory();
+			connectionProvider = sessions.ConnectionProvider as DebugConnectionProvider;
+		}
+
+		private void Cleanup()
+		{
+			if (sessions != null)
+			{
+				sessions.Close();
+			}
+			sessions = null;
+			connectionProvider = null;
+			lastOpenedSession = null;
+			cfg = null;
+		}
+
+		public int ExecuteStatement(string sql)
+		{
+			if (cfg == null)
+			{
+				cfg = TestConfigurationHelper.GetDefaultConfiguration();
+			}
+
+			using (IConnectionProvider prov = ConnectionProviderFactory.NewConnectionProvider(cfg.Properties))
+			{
+				IDbConnection conn = prov.GetConnection();
+
+				try
+				{
+					using (IDbTransaction tran = conn.BeginTransaction())
+					using (IDbCommand comm = conn.CreateCommand())
+					{
+						comm.CommandText = sql;
+						comm.Transaction = tran;
+						comm.CommandType = CommandType.Text;
+						int result = comm.ExecuteNonQuery();
+						tran.Commit();
+						return result;
+					}
+				}
+				finally
+				{
+					prov.CloseConnection(conn);
+				}
+			}
+		}
+
+		public int ExecuteStatement(ISession session, ITransaction transaction, string sql)
+		{
+			using (IDbCommand cmd = session.Connection.CreateCommand())
+			{
+				cmd.CommandText = sql;
+				if (transaction != null)
+					transaction.Enlist(cmd);
+				return cmd.ExecuteNonQuery();
+			}
+		}
+
+		protected ISessionFactoryImplementor Sfi
+		{
+			get { return sessions; }
+		}
+
+		protected virtual ISession OpenSession()
+		{
+			lastOpenedSession = sessions.OpenSession();
+			return lastOpenedSession;
+		}
+
+		protected virtual ISession OpenSession(IInterceptor sessionLocalInterceptor)
+		{
+			lastOpenedSession = sessions.OpenSession(sessionLocalInterceptor);
+			return lastOpenedSession;
+		}
+
+		protected void ApplyCacheSettings(Configuration configuration)
+		{
+			if (CacheConcurrencyStrategy == null)
+			{
+				return;
+			}
+
+			foreach (PersistentClass clazz in configuration.ClassMappings)
+			{
+				bool hasLob = false;
+				foreach (Property prop in clazz.PropertyClosureIterator)
+				{
+					if (prop.Value.IsSimpleValue)
+					{
+						IType type = ((SimpleValue)prop.Value).Type;
+						if (type == NHibernateUtil.BinaryBlob)
+						{
+							hasLob = true;
+						}
+					}
+				}
+				if (!hasLob && !clazz.IsInherited)
+				{
+					configuration.SetCacheConcurrencyStrategy(clazz.EntityName, CacheConcurrencyStrategy);
+				}
+			}
+
+			foreach (Mapping.Collection coll in configuration.CollectionMappings)
+			{
+				configuration.SetCollectionCacheConcurrencyStrategy(coll.Role, CacheConcurrencyStrategy);
+			}
+		}
+
+		#region Properties overridable by subclasses
+
+		protected virtual bool AppliesTo(Dialect.Dialect dialect)
+		{
+			return true;
+		}
+
+		protected virtual bool AppliesTo(ISessionFactoryImplementor factory)
+		{
+			return true;
+		}
+
+		protected virtual void Configure(Configuration configuration)
+		{
+		}
+
+		protected virtual string CacheConcurrencyStrategy
+		{
+			get { return "nonstrict-read-write"; }
+			//get { return null; }
+		}
+
+		#endregion
+	}
+}


Добавлены тесты.

Добавлены тесты.

Signed-off-by: Сергѣй Батанов <1ce19e405e584ebf5908e053bddf51777ac0b008@dmpas.ru>

--- src/NUnitTests/CompilerTests.cs
+++ src/NUnitTests/CompilerTests.cs
@@ -7,6 +7,7 @@

 using System.IO;
 using NUnit.Framework;
+using ScriptEngine.Compiler;

 namespace NUnitTests
 {
@@ -71,5 +72,66 @@

 			var module = host.Engine.GetCompilerService().CreateModule(moduleSource);
 		}
+
+
+		[Test]
+		public void TestEndFunctionDoesNotEndIf()
+		{
+			var moduleSource = host.Engine.Loader.FromString(
+				@"Если Истина Тогда
+					Ф = 1
+				КонецФункции");
+
+			bool throwed = false;
+			try
+			{
+				var module = host.Engine.GetCompilerService().CreateModule(moduleSource);
+			}
+			catch (CompilerException)
+			{
+				throwed = true;
+			}
+			Assert.IsTrue(throwed, "КонецФункции закрыл Если!!!");
+		}
+
+		[Test]
+		public void TestEndDoDoesNotEndIf()
+		{
+			var moduleSource = host.Engine.Loader.FromString(
+				@"Если Истина Тогда
+					Ф = 1
+				КонецЦикла");
+
+			bool throwed = false;
+			try
+			{
+				var module = host.Engine.GetCompilerService().CreateModule(moduleSource);
+			}
+			catch (CompilerException)
+			{
+				throwed = true;
+			}
+			Assert.IsTrue(throwed, "КонецФункции закрыл Если!!!");
+		}
+
+		[Test]
+		public void TestEndIfDoesNotEndDo()
+		{
+			var moduleSource = host.Engine.Loader.FromString(
+				@"Пока Истина Цикл
+					Ф = 1
+				КонецЕсли");
+
+			bool throwed = false;
+			try
+			{
+				var module = host.Engine.GetCompilerService().CreateModule(moduleSource);
+			}
+			catch (CompilerException)
+			{
+				throwed = true;
+			}
+			Assert.IsTrue(throwed, "КонецФункции закрыл Если!!!");
+		}
 	}
 }


Added missing XML comment

Added missing XML comment

--- src/Nancy/ResponseExtensions.cs
+++ src/Nancy/ResponseExtensions.cs
@@ -7,7 +7,7 @@
     using Nancy.Responses;

     /// <summary>
-    ///
+    /// Containing extensions for the <see cref="Response"/> object.
     /// </summary>
     public static class ResponseExtensions
     {


(TFS CS 4306)

(TFS CS 4306)

--- Signum.Engine.Extensions/Authorization/EntityGroupAuthLogic.cs
+++ Signum.Engine.Extensions/Authorization/EntityGroupAuthLogic.cs
@@ -311,11 +311,11 @@
                 : base(query)
             { }

-            public override QueryResult ExecuteQuery(List<Filter> filters, List<Order> orders, int? limit)
+            public override QueryResult ExecuteQuery(List<Filter> filters, int? limit)
             {
                 using (EntityGroupAuthLogic.DisableQueries())
                 {
-                    return base.ExecuteQuery(filters, orders, limit);
+                    return base.ExecuteQuery(filters, limit);
                 }
             }


[Partial fix for bug #883332] Fixed bug with the argument processing code that could result in a blank document not being created if the "-psn_" parameter was the only argument.

--- Pinta/Main.cs
+++ Pinta/Main.cs
@@ -86,32 +86,33 @@

 			if (threads != -1)
 				Pinta.Core.PintaCore.System.RenderThreads = threads;
-
-			if (extra.Count > 0) {
-				// Not sure what this does for Mac, so I'm not touching it
-				if (PintaCore.System.OperatingSystem == OS.Mac) {
-					string arg = args[0];

-					if (args[0].StartsWith ("-psn_")) {
-						if (args.Length > 1)
-							arg = args[1];
-						else
-							arg = null;
-					}
-
-					if (!string.IsNullOrEmpty (arg)) {
-						PintaCore.Workspace.OpenFile (arg);
-					}
-				} else {
-					foreach (var file in extra)
-						PintaCore.Workspace.OpenFile (file);
-				}
-			} else {
+			OpenFilesFromCommandLine (extra);
+
+			Application.Run ();
+		}
+
+		private static void OpenFilesFromCommandLine (List<string> extra)
+		{
+			// Ignore the process serial number parameter on Mac OS X
+			if (PintaCore.System.OperatingSystem == OS.Mac && extra.Count > 0)
+			{
+				if (extra[0].StartsWith ("-psn_"))
+				{
+					extra.RemoveAt (0);
+				}
+			}
+
+			if (extra.Count > 0)
+			{
+				foreach (var file in extra)
+					PintaCore.Workspace.OpenFile (file);
+			}
+			else
+			{
 				// Create a blank document
 				PintaCore.Workspace.NewDocument (new Gdk.Size (800, 600), false);
 			}
-
-			Application.Run ();
 		}

 		private static void ExceptionManager_UnhandledException (GLib.UnhandledExceptionArgs args)


updated benchmarks

updated benchmarks


Fix alpha issue with UI elements from Spriter.

--- Xmas-Hell/Xmas-Hell-Core/Rendering/SpriteBatchManager.cs
+++ Xmas-Hell/Xmas-Hell-Core/Rendering/SpriteBatchManager.cs
@@ -156,7 +156,7 @@
         {
             _game.SpriteBatch.Begin(
                 samplerState: SamplerState.PointClamp,
-                blendState: BlendState.AlphaBlend,
+                blendState: BlendState.NonPremultiplied,
                 transformMatrix: _game.ViewportAdapter.GetScaleMatrix()
             );
         }


Fix ci error

Fix ci error

--- osu.Framework/Extensions/Color4Extensions/Color4Extensions.cs
+++ osu.Framework/Extensions/Color4Extensions/Color4Extensions.cs
@@ -211,7 +211,6 @@
         {
             float h;
             float s;
-            float v;
             float r = colour.R;
             float g = colour.G;
             float b = colour.B;
@@ -233,7 +232,7 @@
             else
                 s = (max - min) / max;

-            v = max;
+            var v = max;

             return (h, s, v);
         }


Add exception case for noise packets

Add exception case for noise packets

--- osu.Framework/Platform/Windows/WindowsRawInputMouseHandler.cs
+++ osu.Framework/Platform/Windows/WindowsRawInputMouseHandler.cs
@@ -95,6 +95,12 @@

                 Vector2 screenSize = new Vector2(screenRect.Width, screenRect.Height);

+                if (mouse.LastX == 0 && mouse.LastY == 0)
+                {
+                    // not sure if this is the case for all tablets, but on osu!tablet these can appear and are noise.
+                    return IntPtr.Zero;
+                }
+
                 // i am not sure what this 64 flag is, but it's set on the osu!tablet at very least.
                 // using it here as a method of determining where the coordinate space is incorrect.
                 if (((int)mouse.Flags & 64) == 0)


Null check for IsRefreshing function

Null check for IsRefreshing function

UWP sample app crashes on startup because IsRefreshing is called before Adapter is instantiated

--- Source/BLE.Client/BLE.Client/ViewModels/DeviceListViewModel.cs
+++ Source/BLE.Client/BLE.Client/ViewModels/DeviceListViewModel.cs
@@ -43,7 +43,7 @@
         public MvxCommand<DeviceListItemViewModel> ConnectDisposeCommand => new MvxCommand<DeviceListItemViewModel>(ConnectAndDisposeDevice);

         public ObservableCollection<DeviceListItemViewModel> Devices { get; set; } = new ObservableCollection<DeviceListItemViewModel>();
-        public bool IsRefreshing => Adapter.IsScanning;
+        public bool IsRefreshing => (Adapter != null) ? Adapter.IsScanning : false;
         public bool IsStateOn => _bluetoothLe.IsOn;
         public string StateText => GetStateText();
         public DeviceListItemViewModel SelectedDevice


Fix up + reduce complexity of HOCEventQueue

--- osu.Game/Screens/Edit/Compose/HitObjectContainerEventQueue.cs
+++ osu.Game/Screens/Edit/Compose/HitObjectContainerEventQueue.cs
@@ -3,7 +3,6 @@

 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Linq;
 using JetBrains.Annotations;
 using osu.Framework.Graphics;
@@ -53,43 +52,59 @@
             playfield.HitObjectUsageFinished += onHitObjectUsageFinished;
         }

-        private readonly Dictionary<HitObject, int> pendingUsagesBegan = new Dictionary<HitObject, int>();
-        private readonly Dictionary<HitObject, int> pendingUsagesFinished = new Dictionary<HitObject, int>();
+        private readonly Dictionary<HitObject, EventType> pendingEvents = new Dictionary<HitObject, EventType>();

-        private void onHitObjectUsageBegan(HitObject hitObject) => pendingUsagesBegan[hitObject] = pendingUsagesBegan.GetValueOrDefault(hitObject, 0) + 1;
+        private void onHitObjectUsageBegan(HitObject hitObject) => updateEvent(hitObject, EventType.Began);

-        private void onHitObjectUsageFinished(HitObject hitObject) => pendingUsagesFinished[hitObject] = pendingUsagesFinished.GetValueOrDefault(hitObject, 0) + 1;
+        private void onHitObjectUsageFinished(HitObject hitObject) => updateEvent(hitObject, EventType.Finished);
+
+        private void updateEvent(HitObject hitObject, EventType newEvent)
+        {
+            if (!pendingEvents.TryGetValue(hitObject, out EventType existingEvent))
+            {
+                pendingEvents[hitObject] = newEvent;
+                return;
+            }
+
+            switch (existingEvent, newEvent)
+            {
+                case (EventType.Transferred, EventType.Finished):
+                    pendingEvents[hitObject] = EventType.Finished;
+                    break;
+
+                case (EventType.Began, EventType.Finished):
+                case (EventType.Finished, EventType.Began):
+                    pendingEvents[hitObject] = EventType.Transferred;
+                    break;
+
+                default:
+                    throw new ArgumentOutOfRangeException($"Unexpected event update ({existingEvent} => {newEvent}).");
+            }
+        }

         protected override void Update()
         {
             base.Update();

-            foreach (var (hitObject, countBegan) in pendingUsagesBegan)
+            foreach (var (hitObject, e) in pendingEvents)
             {
-                if (pendingUsagesFinished.TryGetValue(hitObject, out int countFinished))
+                switch (e)
                 {
-                    Debug.Assert(countFinished > 0);
+                    case EventType.Began:
+                        HitObjectUsageBegan?.Invoke(hitObject);
+                        break;

-                    if (countBegan > countFinished)
-                    {
-                        // The hitobject is still in use, but transferred to a different HOC.
+                    case EventType.Transferred:
                         HitObjectUsageTransferred?.Invoke(hitObject, playfield.AllHitObjects.Single(d => d.HitObject == hitObject));
-                        pendingUsagesFinished.Remove(hitObject);
-                    }
-                }
-                else
-                {
-                    // This is a new usage of the hitobject.
-                    HitObjectUsageBegan?.Invoke(hitObject);
+                        break;
+
+                    case EventType.Finished:
+                        HitObjectUsageFinished?.Invoke(hitObject);
+                        break;
                 }
             }

-            // Go through any remaining pending finished usages.
-            foreach (var (hitObject, _) in pendingUsagesFinished)
-                HitObjectUsageFinished?.Invoke(hitObject);
-
-            pendingUsagesBegan.Clear();
-            pendingUsagesFinished.Clear();
+            pendingEvents.Clear();
         }

         protected override void Dispose(bool isDisposing)
@@ -99,5 +114,12 @@
             playfield.HitObjectUsageBegan -= onHitObjectUsageBegan;
             playfield.HitObjectUsageFinished -= onHitObjectUsageFinished;
         }
+
+        private enum EventType
+        {
+            Began,
+            Finished,
+            Transferred
+        }
     }
 }


Auto-commit from successful build on CHRIS-32F02A9F1 by Administrator at 20:53:01.52 on Wed 08/11/2010

--- Source/Fluency.Tests/BuilderTests/DynamicFluentBuilderSpecs.cs
+++ Source/Fluency.Tests/BuilderTests/DynamicFluentBuilderSpecs.cs
@@ -159,6 +159,48 @@

 			It should_use_the_provided_builder_to_build_the_result = () => _result.ReferenceProperty.ShouldEqual( _expectedValue );
 		}
+
+
+		[ Subject( typeof ( DynamicFluentBuilder< > ) ) ]
+		public class When_building_the_object_after_specifying_dynamic_property_builder_using_For : Given_a_DynamicFluentBuilder_that_uses_default_value_conventions
+		{
+			static TestClass _result;
+			static TestClass _expectedValue;
+
+			Establish context = () =>
+			                    	{
+			                    		// Create a builder that will return the expected value.
+			                    		_expectedValue = new TestClass {FirstName = "Bob", LastName = "Smith"};
+			                    		FluentBuilder< TestClass > propertyBuilder = new DynamicFluentBuilder< TestClass >().AliasFor( _expectedValue );
+
+			                    		_builder.For( x => x.ReferenceProperty, propertyBuilder );
+			                    	};
+
+			Because of = () => _result = _builder.build();
+
+			It should_use_the_provided_builder_to_build_the_result = () => _result.ReferenceProperty.ShouldEqual( _expectedValue );
+		}
+
+
+		[ Subject( typeof ( DynamicFluentBuilder< > ) ) ]
+		public class When_building_the_object_after_specifying_dynamic_property_builder_using_Having : Given_a_DynamicFluentBuilder_that_uses_default_value_conventions
+		{
+			static TestClass _result;
+			static TestClass _expectedValue;
+
+			Establish context = () =>
+			                    	{
+			                    		// Create a builder that will return the expected value.
+			                    		_expectedValue = new TestClass {FirstName = "Bob", LastName = "Smith"};
+			                    		FluentBuilder< TestClass > propertyBuilder = new DynamicFluentBuilder< TestClass >().AliasFor( _expectedValue );
+
+			                    		_builder.Having( x => x.ReferenceProperty, propertyBuilder );
+			                    	};
+
+			Because of = () => _result = _builder.build();
+
+			It should_use_the_provided_builder_to_build_the_result = () => _result.ReferenceProperty.ShouldEqual( _expectedValue );
+		}
 	}
 }


fix schema version

fix schema version

--- src/OpenTl.Schema/SchemaInfo.cs
+++ src/OpenTl.Schema/SchemaInfo.cs
@@ -2,6 +2,6 @@
 {
     public static class SchemaInfo
     {
-        public static int SchemaVersion { get; } = 72;
+        public static int SchemaVersion { get; } = 73;
     }
 }


Unity.Common Use three slashes for file:/// prefix instead of two

Otherwise different drives can't be accessed correctly with WWW class.
See https://forum.unity3d.com/threads/c-class-www-with-file.214699/

--- Source/Slash.Unity.Common/Source/Streaming/ExternalResource.cs
+++ Source/Slash.Unity.Common/Source/Streaming/ExternalResource.cs
@@ -16,6 +16,8 @@
             FileSystem
         }

+        public const string FilePrefix = "file:///";
+
         public ResourceLocation Location;

         public string Path;
@@ -28,16 +30,16 @@
                 switch (this.Location)
                 {
                     case ResourceLocation.StreamingAssets:
-                        fullPath = UnityEngine.Application.streamingAssetsPath + "/" + this.Path;
+                        fullPath = Application.streamingAssetsPath + "/" + this.Path;
 #if UNITY_EDITOR || UNITY_STANDALONE
-                        fullPath = "file://" + fullPath;
+                        fullPath = FilePrefix + fullPath;
 #endif
                         break;
                     case ResourceLocation.PersistentDataFolder:
-                        fullPath = "file://" + UnityEngine.Application.persistentDataPath + "/" + this.Path;
+                        fullPath = FilePrefix + Application.persistentDataPath + "/" + this.Path;
                         break;
                     case ResourceLocation.FileSystem:
-                        fullPath = "file://" + this.Path;
+                        fullPath = FilePrefix + this.Path;
                         break;
                     default:
                         throw new ArgumentOutOfRangeException("Invalid location", (Exception) null);


Rendering arrays initialized regardless the fade effect option.

--- Sources/RimWorldRealFoW/SectionLayers/SectionLayer_FoVLayer.cs
+++ Sources/RimWorldRealFoW/SectionLayers/SectionLayer_FoVLayer.cs
@@ -13,6 +13,7 @@
 //   limitations under the License.
 using RimWorld;
 using RimWorldRealFoW.Utils;
+using System;
 using System.Collections.Generic;
 using UnityEngine;
 using Verse;
@@ -118,6 +119,10 @@
 		}

 		public override void Regenerate() {
+			if (Current.ProgramState != ProgramState.Playing) {
+				return;
+			}
+
 			if (pawnFog == null) {
 				pawnFog = base.Map.getMapComponentSeenFog();
 			}
@@ -132,13 +137,9 @@

 					MakeBaseGeometry(this.section, subMesh, AltitudeLayer.FogOfWar);

-					//subMesh.colors = new List<Color32>(subMesh.mesh.vertexCount);
-
-					if (prefEnableFade) {
-						targetAlphas = new byte[subMesh.mesh.vertexCount];
-						alphaChangeTick = new long[subMesh.mesh.vertexCount];
-						meshColors = new Color32[subMesh.mesh.vertexCount];
-					}
+					targetAlphas = new byte[subMesh.mesh.vertexCount];
+					alphaChangeTick = new long[subMesh.mesh.vertexCount];
+					meshColors = new Color32[subMesh.mesh.vertexCount];
 				} else {
 					firstGeneration = false;
 				}
@@ -158,10 +159,10 @@
 				CellRect cellRect = this.section.CellRect;
 				int mapHeight = base.Map.Size.z - 1;
 				int mapWidth = mapSizeX - 1;
-
-
+
+
 				bool hasFoggedVerts = false;
-				long fogTransitionTick = (long) (Find.TickManager.TicksGame * prefFadeSpeedMult);
+				long fogTransitionTick = (long)(Find.TickManager.TicksGame * prefFadeSpeedMult);

 				int cellIdx;
 				int cellIdxN;
@@ -317,7 +318,7 @@
 								}

 								hasFoggedVerts = true;
-							} else {
+							} else {
 								alpha = 0;
 							}


clean up

clean up

--- src/Net3dBool/Object3D.cs
+++ src/Net3dBool/Object3D.cs
@@ -408,7 +408,6 @@
             Vertex vertex1 = AddVertex(newPos1, Status.BOUNDARY);
             Vertex vertex2 = AddVertex(newPos2, Status.BOUNDARY);

-            double cont = 0;
             if (linedVertex == 1)
             {
                 AddFace(face.V2, face.V3, vertex1);


Update KeyType.cs

Update KeyType.cs

--- OpenCKMS/KeyType.cs
+++ OpenCKMS/KeyType.cs
@@ -13,7 +13,7 @@
 // limitations under the License.

 namespace OpenCKMS
-{
+{
     /// <summary>
     ///   <para>
     ///     <font size="3">There are several different types of cryptographic keys, each used for a different purpose. In addition, there is other information that is
@@ -196,4 +196,4 @@
         /// </summary>
         PublicAuthorization
     }
-}+}


Use Array.Copy to improve performance. Simplify Insert (single) and Add methods

--- BList/BList.cs
+++ BList/BList.cs
@@ -1,4 +1,5 @@
 using System.Linq;
+using System.Runtime.CompilerServices;

 namespace System.Collections.Generic
 {
@@ -46,14 +47,9 @@
                 var newOffset = (newCapacity/2) - (newSize/2) - padLeft;
                 var newItems = new T[newCapacity];

-                for (int i = 0; i < insertIndex; i++)
-                    newItems[newOffset + i] = _items[_offset + i];
-
-                for (int i = insertIndex; i < _size; i++)
-                    newItems[newOffset + i + insertCount] = _items[_offset + i];
-
-                for (int i = 0; i < insertCount; i++)
-                    newItems[newOffset + insertIndex + i] = insertItems[i];
+                Array.Copy(_items, _offset, newItems, newOffset, insertIndex);
+                Array.Copy(_items, _offset, newItems, newOffset + 1, _size - insertIndex);
+                Array.Copy(insertItems, 0, newItems, newOffset + insertIndex, insertCount);

                 _items = newItems;
                 _offset = newOffset;
@@ -63,27 +59,89 @@
             else
             {
                 if (insertIndex == 0)
-                    _offset = _offset - insertCount;
-                else
-                    for (int i = _size - 1; i >= insertIndex; i--)
-                        _items[_offset + i + insertCount] = _items[_offset + i];
-
-
-                for (int i = 0; i < insertCount; i++)
-                    _items[_offset + insertIndex + i] = insertItems[i];
+                    _offset = _offset - 1;
+                else if (insertIndex < _size)
+                    Array.Copy(_items, _offset + insertIndex, _items, _offset + insertIndex + 1, _size - insertIndex);
+
+                Array.Copy(insertItems, 0, _items, _offset + insertIndex, insertCount);

                 _size = _size + insertCount;
             }
         }
-
+
         public void Insert(int insertIndex, T item)
         {
-            Insert(insertIndex, new[] { item });
+            if (insertIndex < 0)
+                throw new ArgumentOutOfRangeException(nameof(insertIndex));
+
+            var padRight = Math.Max(0, (insertIndex == 0)
+                ? -_size
+                : (insertIndex + 1) - _size);
+
+            var padLeft = insertIndex == 0
+                ? 1
+                : 0;
+
+            var requiresResize = _offset - padLeft <= 0 ||
+                                 _offset + _size + padRight >= _capacity;
+            if (requiresResize)
+            {
+                var newSize = _size + 1;
+                var newCapacity = Math.Max(newSize, _capacity * 2);
+                var newOffset = (newCapacity / 2) - (newSize / 2) - padLeft;
+                var newItems = new T[newCapacity];
+
+                Array.Copy(_items, _offset, newItems, newOffset, insertIndex);
+                Array.Copy(_items, _offset, newItems, newOffset + 1, _size - insertIndex);
+
+                newItems[newOffset + insertIndex] = item;
+
+                _items = newItems;
+                _offset = newOffset;
+                _size = newSize;
+                _capacity = newCapacity;
+            }
+            else
+            {
+                if (insertIndex == 0)
+                    _offset = _offset - 1;
+                else if (insertIndex < _size)
+                    Array.Copy(_items, _offset + insertIndex, _items, _offset + insertIndex + 1, _size - insertIndex);
+
+                _items[_offset + insertIndex] = item;
+
+                _size = _size + 1;
+            }
         }

         public void Add(T item)
         {
-            Insert(Count, new[] { item });
+            var padRight = 1;
+
+            var requiresResize = _offset + _size + padRight >= _capacity;
+
+            if (requiresResize)
+            {
+                var newSize = _size + 1;
+                var newCapacity = Math.Max(newSize, _capacity * 2);
+                var newOffset = (newCapacity/2) - (newSize/2);
+                var newItems = new T[newCapacity];
+
+                Array.Copy(_items, _offset, newItems, newOffset, _size);
+
+                newItems[newOffset + _size] = item;
+
+                _items = newItems;
+                _offset = newOffset;
+                _size = newSize;
+                _capacity = newCapacity;
+            }
+            else
+            {
+                _items[_offset + _size] = item;
+
+                _size += 1;
+            }
         }

         public int Count => _size;


Pluginnames can now contain spaces

Pluginnames can now contain spaces

--- PegBot/BotPlugin.cs
+++ PegBot/BotPlugin.cs
@@ -22,9 +22,6 @@
         {
             this.irc = irc;
             this.PluginName = PluginName;
-            if (PluginName.Contains(' '))
-                throw new ArgumentException("PluginName can't contain any spaces");
-
             SubscribedCommands = new List<BotCommandFunction>();
             irc.OnQueryMessage += OnSubscribedQuery;
             irc.OnChannelMessage += OnSubscribedChannel;


Modified title on Scalar view to prevent crashing on large strings

--- MVC/NakedObjects.Mvc.App/Views/Shared/ScalarView.cshtml
+++ MVC/NakedObjects.Mvc.App/Views/Shared/ScalarView.cshtml
@@ -3,16 +3,13 @@

 @{
     Layout = "~/Views/Shared/_NofLayout.cshtml";
-    ViewBag.Title = Html.ObjectTitle(Model);
+    ViewBag.Title = Html.ObjectTitle("Scalar");
 }

         @Html.TabbedHistory()
-

-
-        @Html.UserMessages()
-
+        @Html.UserMessages()

@Html.ScalarView(Model)


ミニマップのビュー描画がはみ出していたのを修正

ミニマップのビュー描画がはみ出していたのを修正

--- src/PitchPitch/map/Map.cs
+++ src/PitchPitch/map/Map.cs
@@ -350,9 +350,10 @@
             double cdh = _miniMapRect.Height / (double)_rowNum;

             Point lt = new Point((int)(_xFirstIdx * cdw) + _miniMapRect.X, (int)(_yFirstIdx * cdh) + _miniMapRect.Y);
-            Point rb = new Point((int)(_xLastIdx * cdw) + _miniMapRect.X, (int)(_yLastIdx * cdh) + _miniMapRect.Y);
+            Point rb = new Point((int)(_xLastIdx * cdw) + _miniMapRect.X, (int)((_yLastIdx - 1) * cdh) + _miniMapRect.Y);
             lt.Offset(r.Location);
             rb.Offset(r.Location);
+            if (rb.Y - lt.Y > r.Height) rb.Y = lt.Y + r.Height;

             SdlDotNet.Graphics.Primitives.Box viewBox = new SdlDotNet.Graphics.Primitives.Box(lt, rb);
             SdlDotNet.Graphics.Primitives.Box viewBoxIn = new SdlDotNet.Graphics.Primitives.Box(new Point(lt.X + 1, lt.Y + 1), new Point(rb.X - 1, rb.Y - 1));


Fixed rare issue when instantiating prefabs inside ZenectUnitTestFixture (issue #506)

--- UnityProject/Assets/Plugins/Zenject/Source/Main/DiContainer.cs
+++ UnityProject/Assets/Plugins/Zenject/Source/Main/DiContainer.cs
@@ -45,7 +45,8 @@
         readonly List<IValidatable> _validationQueue = new List<IValidatable>();

 #if !NOT_UNITY3D
-        Context _context;
+        Transform _contextTransform;
+        bool _hasLookedUpContextTransform;
 #endif

         ZenjectSettings _settings;
@@ -217,17 +218,24 @@
         }

 #if !NOT_UNITY3D
-        Context Context
+        // This might be null in some rare cases like when used in ZenjectUnitTestFixture
+        Transform ContextTransform
         {
             get
             {
-                if (_context == null)
-                {
-                    _context = Resolve<Context>();
-                    Assert.IsNotNull(_context);
-                }
-
-                return _context;
+                if (!_hasLookedUpContextTransform)
+                {
+                    _hasLookedUpContextTransform = true;
+
+                    var context = TryResolve<Context>();
+
+                    if (context != null)
+                    {
+                        _contextTransform = context.transform;
+                    }
+                }
+
+                return _contextTransform;
             }
         }
 #endif
@@ -1572,7 +1580,7 @@
             else
             {
                 // This ensures it gets added to the right scene instead of just the active scene
-                initialParent = Context.transform;
+                initialParent = ContextTransform;
             }

             GameObject gameObj;
@@ -1608,7 +1616,7 @@

                 if(parent == null)
                 {
-                    gameObj.transform.SetParent(Context.transform, false);
+                    gameObj.transform.SetParent(ContextTransform, false);
                 }
             }
 #endif
@@ -1645,7 +1653,7 @@
             if (parent == null)
             {
                 // This ensures it gets added to the right scene instead of just the active scene
-                gameObj.transform.SetParent(Context.transform, false);
+                gameObj.transform.SetParent(ContextTransform, false);
                 gameObj.transform.SetParent(null, false);
             }
             else
@@ -1722,7 +1730,7 @@
         GameObject CreateTransformGroup(string groupName)
         {
             var gameObj = new GameObject(groupName);
-            gameObj.transform.SetParent(Context.transform, false);
+            gameObj.transform.SetParent(ContextTransform, false);
             gameObj.transform.SetParent(null, false);
             return gameObj;
         }


Rental work

Rental work

--- examples/TestRental.cs
+++ examples/TestRental.cs
@@ -41,18 +41,16 @@

 			ICodeProvider idcp = bus.GetObject<ICodeProvider> (bus_name, cppath);

-			DMethodInfo dmi = idcp.GetMethod("DemoProx", "SayRepeatedly");
-
-			DynamicMethod dm = new DynamicMethod (dmi.Name, typeof(void), new Type[] { typeof(object), typeof(int), typeof(string) }, typeof(DemoBase));
-			ILGenerator ilg = dm.GetILGenerator();
-
-			dmi.DeclareLocals(ilg);
-
-			for (int i = 0 ; i != dmi.Code.Length ; i++)
-				dmi.Code[i].Emit(ilg);
-
-			SayRepeatedlyHandler cb = (SayRepeatedlyHandler)dm.CreateDelegate(typeof(SayRepeatedlyHandler), demo);
-			cb(12, "Works!");
+			DMethodInfo dmi = idcp.GetMethod ("DemoProx", "SayRepeatedly");
+
+			//DynamicMethod dm = new DynamicMethod (dmi.Name, typeof(void), new Type[] { typeof(object), typeof(int), typeof(string) }, typeof(DemoBase));
+			//ILGenerator ilg = dm.GetILGenerator ();
+			//dmi.Implement (ilg);
+
+			DynamicMethod dm = dmi.GetDM ();
+
+			SayRepeatedlyHandler cb = (SayRepeatedlyHandler)dm.CreateDelegate (typeof (SayRepeatedlyHandler), demo);
+			cb (12, "Works!");

 			/*
 			for (int i = 0 ; i != dmi.Code.Length ; i++) {
@@ -138,10 +136,8 @@
 	DMethodInfo GetMethod (string iface, string name);
 }

-public struct DMethodInfo
-{
-	public string Name;
-	//public byte[] Code;
+public struct DMethodBody
+{
 	public string[] Locals;
 	public ILReader2.ILOp[] Code;

@@ -156,8 +152,85 @@
 	}
 }

+public struct DMethodInfo
+{
+	public string Name;
+	//public DTypeInfo DeclaringType;
+	public DTypeInfo[] Parameters;
+	//public DArgumentInfo[] Arguments;
+	public DTypeInfo ReturnType;
+	public DMethodBody Body;
+
+	public void Implement(ILGenerator ilg)
+	{
+		DMethodBody body = Body;
+
+		body.DeclareLocals(ilg);
+
+		for (int i = 0 ; i != body.Code.Length ; i++) {
+			if (!body.Code[i].Emit(ilg))
+				throw new Exception(String.Format("Code gen failure at i={0} {1}", i, body.Code[i].opCode));
+		}
+	}
+
+	public DynamicMethod GetDM ()
+	{
+		List<Type> parms = new List<Type>();
+		parms.Add(typeof(object));
+		foreach (DTypeInfo dti in Parameters)
+			parms.Add(dti.ToType());
+
+		DynamicMethod dm = new DynamicMethod (Name, ReturnType.ToType(), parms.ToArray(), typeof(DemoBase));
+
+		ILGenerator ilg = dm.GetILGenerator();
+		Implement(ilg);
+		return dm;
+	}
+}
+
+public enum DArgumentDirection
+{
+	In,
+	Out,
+}
+
+public struct DArgumentInfo
+{
+	public DArgumentInfo(DTypeInfo argType) : this(String.Empty, argType)
+	{
+	}
+
+	public DArgumentInfo(string name, DTypeInfo argType) : this(name, argType, DArgumentDirection.In)
+	{
+	}
+
+	public DArgumentInfo(string name, DTypeInfo argType, DArgumentDirection direction)
+	{
+		this.Name = name;
+		this.ArgType = argType;
+		this.Direction = direction;
+	}
+
+	public string Name;
+	public DTypeInfo ArgType;
+	public DArgumentDirection Direction;
+}
+
 public struct DTypeInfo
 {
+	public DTypeInfo(string name)
+	{
+		this.Name = name;
+	}
+
+	public Type ToType()
+	{
+		Type t;
+		if (!ILReader2.TryGetType(Name, out t))
+			return null;
+		return t;
+	}
+
 	public string Name;
 	//public DMethodInfo[] Methods;
 }
@@ -178,10 +251,17 @@
 		MethodBody body = mi.GetMethodBody ();
 		foreach (LocalVariableInfo lvar in body.LocalVariables)
 			locals.Add(lvar.LocalType.FullName);
-		dmi.Locals = locals.ToArray();
+		dmi.Body.Locals = locals.ToArray();
+
+		List<DTypeInfo> parms = new List<DTypeInfo>();
+		foreach (ParameterInfo parm in mi.GetParameters())
+			parms.Add(new DTypeInfo(parm.ParameterType.FullName));
+		dmi.Parameters = parms.ToArray();
+
+		dmi.ReturnType = new DTypeInfo(mi.ReturnType.FullName);

 		ILReader2 ilr = new ILReader2(mi);
-		dmi.Code = ilr.Iterate();
+		dmi.Body.Code = ilr.Iterate();

 		return dmi;
 	}


Add XML doc to BobTheEmptySprite field of CharacterCustomization.cs

--- UnityProject/Assets/Scripts/UI/Lobby/CharacterCustomization.cs
+++ UnityProject/Assets/Scripts/UI/Lobby/CharacterCustomization.cs
@@ -55,6 +55,11 @@

 		public Action onCloseAction;

+		/// <summary>
+		/// Empty, blank sprite texture used for selecting null customizations
+		/// (e.g. selecting or scrolling to "None" for hair, facial hair, underwear,
+		/// or socks).
+		/// </summary>
 		public SpriteDataSO BobTheEmptySprite;

 		void OnEnable()


Associations - many-to-many, and self-referencing

--- Week_06/AssocSelf/AssocSelf/Controllers/EmployeesController.cs
+++ Week_06/AssocSelf/AssocSelf/Controllers/EmployeesController.cs
@@ -52,7 +52,7 @@
             else
             {
                 // Create a form, based on the fetched matching object
-                var form = AutoMapper.Mapper.Map<EmployeeEditSupervisorForm>(o);
+                var form = m.mapper.Map<EmployeeEditSupervisorForm>(o);

                 // Fetch the employees into a temporary collection
                 // Logically, an employee cannot select "self" as the supervisor
@@ -138,7 +138,7 @@
             else
             {
                 // Create a form, based on the fetched matching object
-                var form = AutoMapper.Mapper.Map<EmployeeEditDirectReportsForm>(o);
+                var form = m.mapper.Map<EmployeeEditDirectReportsForm>(o);

                 // Fetch the employees into a temporary collection
                 // Logically, an employee cannot select "self" as a direct report


implemented events invokes

implemented events invokes

--- WhenItsDone/Clients/WhenItsDone.WebFormsClient/Details.aspx.cs
+++ WhenItsDone/Clients/WhenItsDone.WebFormsClient/Details.aspx.cs
@@ -28,12 +28,22 @@

         public void OnLikeLinkButtonClick(object sender, EventArgs e)
         {
-
+            var detailsRatingVoteEventArgs = this.CreateDetailsRatingVoteEventArgs();
+            this.OnLikeVote?.Invoke(null, detailsRatingVoteEventArgs);
         }

         public void OnDislikeLinkButtonClick(object sender, EventArgs e)
         {
+            var detailsRatingVoteEventArgs = this.CreateDetailsRatingVoteEventArgs();
+            this.OnDislikeVote?.Invoke(null, detailsRatingVoteEventArgs);
+        }

+        private DetailsRatingVoteEventArgs CreateDetailsRatingVoteEventArgs()
+        {
+            var dishId = this.Model.DishDetails.Id;
+            var detailsRatingVoteEventArgs = new DetailsRatingVoteEventArgs(dishId);
+
+            return detailsRatingVoteEventArgs;
         }
     }
 }


Revert "Update"

Revert "Update"

This reverts commit 482906e4b8b6c5a06c75ff4da03cf5d74c056040.

--- YourFood.Services/Controllers/OData/ShoppingListsController.cs
+++ YourFood.Services/Controllers/OData/ShoppingListsController.cs
@@ -25,13 +25,9 @@

         // GET: api/ShoppingLists
         [EnableQuery]
-        public SingleResult<ShoppingList> GetShoppingLists()
+        public IQueryable<ShoppingList> GetShoppingLists()
         {
-            var list = this.Data.ShoppingLists
-                .All()
-                .Where(sl => sl.UserId == this.userInfoProvider.GetUserId() && !sl.IsFinished);
-
-            return SingleResult.Create(list);
+            return this.Data.ShoppingLists.All();
         }

         // GET: api/ShoppingLists(5)
@@ -85,11 +81,8 @@
         }

         // POST: api/ShoppingLists
-        public IHttpActionResult Post()
+        public IHttpActionResult Post(ShoppingList shoppingList)
         {
-            ShoppingList shoppingList = new ShoppingList();
-            shoppingList.DateCreated = DateTime.Now;
-            shoppingList.IsFinished = false;
             shoppingList.UserId = this.userInfoProvider.GetUserId();

             if (!this.ModelState.IsValid)


Update GdalSystem.cs

Update GdalSystem.cs

--- src/RasterIO.Gdal/GdalSystem.cs
+++ src/RasterIO.Gdal/GdalSystem.cs
@@ -1,14 +1,3 @@
-// Copyright 2010 Green Code LLC
-// All rights reserved.
-//
-// The copyright holders license this file under the New (3-clause) BSD
-// License (the "License").  You may not use this file except in
-// compliance with the License.  A copy of the License is available at
-//
-//   http://www.opensource.org/licenses/BSD-3-Clause
-//
-// and is included in the NOTICE.txt file distributed with this work.
-//
 // Contributors:
 //   James Domingo, Green Code LLC


Working Central Server

Working Central Server

--- central-server/Program.cs
+++ central-server/Program.cs
@@ -119,17 +119,17 @@
 						int newPeerCnt = peerList.Count()-1;

 						peerList[newPeerCnt].peerIP = newPeer.peerIP;
-						//peerList[newPeerCnt].peerHostname = newPeer.peerHostname;
+
 						peerList[newPeerCnt].peerPort = newPeer.peerPort;

 						//create peer variable to send back to client
 						peerInstance peerMsgToClient = new peerInstance();

 						peerMsgToClient.peerIP = peerList[peerNumber].peerIP;
-						//peerMsgToClient.peerHostname = peerList[peerNumber].peerHostname;
+
 						peerMsgToClient.peerPort = peerList[peerNumber].peerPort;
 						Console.WriteLine("----------------New Connection-------------");
-						Console.WriteLine(peerList[peerNumber].peerIP + ", " + peerList[peerNumber].peerPort);
+						Console.WriteLine(peerList[newPeerCnt].peerIP + ", Server Port: " + peerList[newPeerCnt].peerPort);
 						Console.WriteLine("-------------------------------------------");

 						addressBytes = peerList[peerNumber].peerIP.GetAddressBytes();
@@ -172,8 +172,8 @@
 						else
 						{
 							peerNumber = i;
-							addressBytes = BitConverter.GetBytes(0);  //peerList[peerNumber].peerIP.GetAddressBytes();
-							portBytes = BitConverter.GetBytes(0); //BitConverter.GetBytes(peerList[peerNumber].peerPort);
+							addressBytes = peerList[peerNumber].peerIP.GetAddressBytes();
+							portBytes = BitConverter.GetBytes(peerList[peerNumber].peerPort);
 							response = 0;
 							cmdBytes = BitConverter.GetBytes(response);

@@ -192,7 +192,7 @@
 							clientStream.Flush();

 							Console.WriteLine("----------------Removed Connection-------------");
-							Console.WriteLine(peerList[peerNumber].peerIP + ", " + peerList[peerNumber].peerPort);
+							Console.WriteLine(peerList[peerNumber].peerIP + ", Server Port: " + peerList[peerNumber].peerPort);
 							Console.WriteLine("-------------------------------------------");
 							peerList.RemoveAt(peerNumber);


cai-util-u3d: Fixed improper aggregation of meshes that contain more than one sub-mesh.  (See issue 16)

--- util/u3d/geom/MeshUtil.cs
+++ util/u3d/geom/MeshUtil.cs
@@ -45,8 +45,8 @@
         /// the provided GameObjects (including children).
         /// </summary>
         /// <remarks>
-        /// <para>The output parameters will be null if the method return value is
-        /// FALSE.</para>
+        /// <para>The output parameters will be null if the method return value
+        /// is FALSE.</para>
         /// <para>Vertices will be in world space coordinates.</para>
         /// </remarks>
         /// <param name="sources">An array of GameObjects cointaining the
@@ -134,8 +134,23 @@
                                 && mesh.triangles.Length > 0)
                             {
                                 filterList.Add(filter);
-                                vertexCount += mesh.vertexCount;
-                                triangleCount += mesh.triangles.Length;
+
+                                for (int iSubMesh = 0
+                                    ; iSubMesh < mesh.subMeshCount
+                                    ; ++iSubMesh )
+                                {
+                                    /*
+                                     * Note: The vertex sizing method is not
+                                     * particularly good.  There is no
+                                     * easy method of detecting sub-mesh
+                                     * vertex count. So the vertext count will
+                                     * be overestimated for meshes with
+                                     * sub-meshes.
+                                     */
+                                    vertexCount += mesh.vertexCount;
+                                    triangleCount +=
+                                        mesh.GetTriangles(iSubMesh).Length;
+                                }
                             }
                         }
                     }
@@ -163,13 +178,15 @@
             if (filters.Length == 0)
                 return;

-            CombineInstance[] combine;
+
             int iStart = 0;
             Mesh mesh = new Mesh();
             int iVertOffset = 0;
             int pTriOffset = 0;
             while (iStart < filters.Length)
             {
+                CombineInstance[] combine;
+
                 iStart = GetFilterBatch(filters, iStart, out combine);

                 mesh.CombineMeshes(combine, true, true);
@@ -198,16 +215,17 @@
         }

         /// <summary>
-        /// Returns an array of CombineInstance structures suitable for combining.
-        /// (Vertex count will not exceed the maximum allowed for a Mesh object.)
+        /// Returns an array of CombineInstance structures suitable for
+        /// combining. (Vertex count will not exceed the maximum allowed for a
+        /// Mesh object.)
         /// </summary>
         /// <param name="filters">The list of MeshFilters to use. (All filters
         /// must have meshes attached.)</param>
         /// <param name="startIndex">The index of the filter to start the
         /// batching process at. (The filter's mesh will be included in the
         /// result.)</param>
-        /// <param name="combinedInstances">An array of CombineInstance structures
-        /// batched from the filters.</param>
+        /// <param name="combinedInstances">An array of CombineInstance
+        /// structures batched from the filters.</param>
         /// <returns>The next index value higher than the last filter included
         /// in the batch.</returns>
         private static int GetFilterBatch(MeshFilter[] filters
@@ -215,6 +233,7 @@
             , out CombineInstance[] combinedInstances)
         {
             int meshCount = 1;
+            int subMeshCount = filters[startIndex].sharedMesh.subMeshCount;
             int vertCount = filters[startIndex].sharedMesh.vertexCount;
             for (int i = startIndex + 1; i < filters.Length; i++)
             {
@@ -223,14 +242,30 @@
                     break;
                 vertCount += count;
                 meshCount++;
-            }
-
-            combinedInstances = new CombineInstance[meshCount];
-            for (int i = 0; i < meshCount; i++)
-            {
-                combinedInstances[i].mesh = filters[startIndex + i].sharedMesh;
-                combinedInstances[i].transform
-                    = filters[startIndex + i].transform.localToWorldMatrix;
+                subMeshCount += filters[i].sharedMesh.subMeshCount;
+            }
+
+            combinedInstances = new CombineInstance[subMeshCount];
+
+            for (int filterOffset = 0, iCombinedInstance = 0
+                ; filterOffset < meshCount
+                ; filterOffset++)
+            {
+                MeshFilter filter = filters[startIndex + filterOffset];
+                Mesh sharedMesh = filter.sharedMesh;
+
+                for (int iSubMesh = 0
+                    ; iSubMesh < sharedMesh.subMeshCount
+                    ; ++iSubMesh)
+                {
+                    combinedInstances[iCombinedInstance].mesh = sharedMesh;
+                    combinedInstances[iCombinedInstance].subMeshIndex =
+                        iSubMesh;
+                    combinedInstances[iCombinedInstance].transform =
+                        filter.transform.localToWorldMatrix;
+
+                    iCombinedInstance++;
+                }
             }

             return startIndex + meshCount;


Fix Max() and MaxValue()

Fix Max() and MaxValue()

--- DataTanker/Core/AccessMethods/BPlusTree/BPlusTree.cs
+++ DataTanker/Core/AccessMethods/BPlusTree/BPlusTree.cs
@@ -150,7 +150,7 @@
             long index = GetMaxValueNodeIndex();
             var node = FetchNode(index);

-            return !node.Entries.Any() ? node.Entries.Last().Key : default(TKey);
+            return node.Entries.Any() ? node.Entries.Last().Key : default(TKey);
         }

         /// <summary>
@@ -254,7 +254,7 @@
             long index = GetMaxValueNodeIndex();
             var node = FetchNode(index);

-            return !node.Entries.Any()
+            return node.Entries.Any()
                 ? _valueStorage.Fetch(node.Entries.Last().Value)
                 : default(TValue);
         }


Added [STAThread] to WinForms sample

Added [STAThread] to WinForms sample

--- src/Samples/WinForms/Program.cs
+++ src/Samples/WinForms/Program.cs
@@ -1,8 +1,16 @@
 // Copyright Bastian Eicher
 // Licensed under the MIT License

-using NanoByte.Common.Samples.WinForms;
+namespace NanoByte.Common.Samples.WinForms;

-Application.EnableVisualStyles();
-Application.SetCompatibleTextRenderingDefault(false);
-Application.Run(new MainForm());
+public static class Program
+{
+    [STAThread]
+    public static void Main()
+    {
+        Application.EnableVisualStyles();
+        Application.SetCompatibleTextRenderingDefault(false);
+        Application.Run(new MainForm());
+    }
+}
+


Fix for XHTML.

Fix for XHTML.

--- yafsrc/YetAnotherForum.NET/App_Code/YAF/ForumEditor.cs
+++ yafsrc/YetAnotherForum.NET/App_Code/YAF/ForumEditor.cs
@@ -176,7 +176,7 @@
 		private void RenderButton( HtmlTextWriter writer, string id, string cmd, string title, string image )
 		{
 			//writer.WriteLine("			 	",ResolveUrl(image),SafeID,title,cmd,id);
-			writer.WriteLine( @"", ResolveUrl( image ), SafeID, title, cmd, id );
+			writer.WriteLine( @"", ResolveUrl( image ), SafeID, title, cmd, id );
 		}

 		protected override void Render( HtmlTextWriter writer )


logging

logging

--- src/ResinCore/Searcher.cs
+++ src/ResinCore/Searcher.cs
@@ -90,7 +90,7 @@

             if (Log.IsDebugEnabled)
             {
-                Log.DebugFormat("searched {0} in {1}", query.ToQueryString(), searchTime.Elapsed);
+                Log.DebugFormat("total search time for query {0} in {1}", query.ToQueryString(), searchTime.Elapsed);
             }

             return result;


ParseNotecardToList() returned data past end of notecard text (mantis #6881).

--- OpenSim/Framework/SLUtil.cs
+++ OpenSim/Framework/SLUtil.cs
@@ -247,11 +247,17 @@
         /// <returns></returns>
         public static List<string> ParseNotecardToList(string rawInput)
         {
-            string[] input = rawInput.Replace("\r", "").Split('\n');
+            string[] input;
             int idx = 0;
             int level = 0;
             List<string> output = new List<string>();
             string[] words;
+
+            //The Linden format always ends with a } after the input data.
+            //Strip off trailing } so there is nothing after the input data.
+            int i = rawInput.LastIndexOf("}");
+            rawInput = rawInput.Remove(i, rawInput.Length-i);
+            input = rawInput.Replace("\r", "").Split('\n');

             while (idx < input.Length)
             {
@@ -287,24 +293,18 @@
                         break;
                     if (words[0] == "Text")
                     {
-                        int len = int.Parse(words[2]);
-                        idx++;
-
-                        int count = -1;
-
-                        while (count < len && idx < input.Length)
+                        idx++;  //Now points to first line of notecard text
+
+                        //Number of lines in notecard.
+                        int lines = input.Length - idx;
+                        int line = 0;
+
+                        while (line < lines)
                         {
-                            // int l = input[idx].Length;
-                            string ln = input[idx];
-
-                            int need = len-count-1;
-                            if (ln.Length > need)
-                                ln = ln.Substring(0, need);
-
-//                            m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln);
-                            output.Add(ln);
-                            count += ln.Length + 1;
+//                            m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", input[idx]);
+                            output.Add(input[idx]);
                             idx++;
+                            line++;
                         }

                         return output;


Added a test on "logfile" (#445)

Added a test on "logfile" (#445)

And split up tests

--- NuKeeper.Tests/Configuration/FileSettingsReaderTests.cs
+++ NuKeeper.Tests/Configuration/FileSettingsReaderTests.cs
@@ -53,10 +53,7 @@
             Assert.That(data.Change, Is.Null);
         }

-        [Test]
-        public void PopulatedConfigReturnsAllSettings()
-        {
-            const string configData = @"{
+        private const string FullFileData = @"{
                ""age"":""3d"",
                ""api"":""http://api.com"",
                ""include"":""fred"",
@@ -64,13 +61,18 @@
                ""includeRepos"":""repoIn"",
                ""excludeRepos"":""repoOut"",
                ""label"": [ ""foo"", ""bar"" ],
+               ""logFile"":""somefile.log"",
                ""maxpr"": 42,
                ""maxRepo"": 12,
                ""verbosity"": ""Detailed"",
                ""Change"": ""Minor""
 }";

-            var path = MakeTestFile(configData);
+        [Test]
+        public void PopulatedConfigReturnsAllStringSettings()
+        {
+
+            var path = MakeTestFile(FullFileData);

             var fsr = new FileSettingsReader(Substitute.For<INuKeeperLogger>());

@@ -83,13 +85,48 @@
             Assert.That(data.Exclude, Is.EqualTo("fish"));
             Assert.That(data.IncludeRepos, Is.EqualTo("repoIn"));
             Assert.That(data.ExcludeRepos, Is.EqualTo("repoOut"));
+            Assert.That(data.LogFile, Is.EqualTo("somefile.log"));
+        }
+
+        [Test]
+        public void PopulatedConfigReturnsLabels()
+        {
+
+            var path = MakeTestFile(FullFileData);
+
+            var fsr = new FileSettingsReader(Substitute.For<INuKeeperLogger>());
+
+            var data = fsr.Read(path);

             Assert.That(data.Label.Length, Is.EqualTo(2));
             Assert.That(data.Label, Does.Contain("foo"));
             Assert.That(data.Label, Does.Contain("bar"));
+        }
+
+        [Test]
+        public void PopulatedConfigReturnsNumericSettings()
+        {
+
+            var path = MakeTestFile(FullFileData);
+
+            var fsr = new FileSettingsReader(Substitute.For<INuKeeperLogger>());
+
+            var data = fsr.Read(path);

             Assert.That(data.MaxPr, Is.EqualTo(42));
             Assert.That(data.MaxRepo, Is.EqualTo(12));
+        }
+
+        [Test]
+        public void PopulatedConfigReturnsEnumSettings()
+        {
+
+            var path = MakeTestFile(FullFileData);
+
+            var fsr = new FileSettingsReader(Substitute.For<INuKeeperLogger>());
+
+            var data = fsr.Read(path);
+
             Assert.That(data.Verbosity, Is.EqualTo(LogLevel.Detailed));
             Assert.That(data.Change, Is.EqualTo(VersionChange.Minor));
         }


Update Rules/AvoidAlias.cs

Update Rules/AvoidAlias.cs

Co-Authored-By: Christoph Bergmeister [MVP] <3b61a740f09ea69938414d60ad3b7f099f3c6c6c@gmail.com>

--- Rules/AvoidAlias.cs
+++ Rules/AvoidAlias.cs
@@ -136,7 +136,7 @@
                 }

                 var commdNameWithGetPrefix = $"Get-{commandName}";
-                var cmdletNameIfCommandWasMissingGetPrefix = Helper.Instance.GetCommandInfo($"Get-{commandName}");
+                var cmdletNameIfCommandWasMissingGetPrefix = Helper.Instance.GetCommandInfo(commdNameWithGetPrefix);
                 if (cmdletNameIfCommandWasMissingGetPrefix != null)
                 {
                     yield return new DiagnosticRecord(


Enhanced FFT display

Enhanced FFT display

git-svn-id: 6b7e1e5d0861e268462ba7828ef63c1bcab52a9b@120 d3cde5d6-82b8-4669-8b62-43054d6781d8

--- PanView/SpectrumAnalyzer.cs
+++ PanView/SpectrumAnalyzer.cs
@@ -460,7 +460,7 @@
                 _buffer = new Bitmap(Width, Height);
                 _graphics = Graphics.FromImage(_buffer);
                 _bkgBuffer = new Bitmap(Width, Height);
-                var length = 2 * (Width - 2 * AxisMargin);
+                var length = Width - 2 * AxisMargin;
                 _spectrum = new double[length];
                 for (var i = 0; i < _spectrum.Length; i++)
                 {


Code cleanup

Code cleanup

--- SharpLayout/Span.cs
+++ SharpLayout/Span.cs
@@ -124,7 +124,7 @@
 	            var table = new Table(line);
 	            var c = table.AddColumn(section.PageSettings.PageWidthWithoutMargins);
 	            var r = table.AddRow();
-	            r[c].Add(paragraph);
+	            r[c, line, filePath].Add(paragraph);
 	            return table;
 	        });
             return this;


Adds comments to system

Adds comments to system

--- SimpleECS/System.cs
+++ SimpleECS/System.cs
@@ -3,17 +3,49 @@

 namespace SimpleECS
 {
+	/// <summary>
+	/// All systems should implement this class, and added to a world.
+	/// It's your responsibility to add an Update method and invoke it
+	/// yourself. A system only provides you the world & entity fetching
+	/// mechanizm along side an initialize & uninitialize methods.
+	/// </summary>
     public abstract class System
     {
+		/// <summary>
+		/// The world that this system is working on. You have add this system
+		/// to a world using World.AddSystem(system) for this value to be set.
+		/// Otherwise, it is null. You can add a system to a world only once.
+		/// You have to remove it from its world to add it to another world.
+		/// GetEntities method uses this world to fetch entities.
+		/// </summary>
+		/// <value>The world.</value>
         public World world
         {
             get;
             private set;
         }

+		/// <summary>
+		/// Override this method to do your initialization. For example
+		/// event queue subscriptions, other events & initing your
+		/// predicates. It is invoked after you add the system to a world.
+		/// Inside this method, "world" reference is already set.
+		/// </summary>
 		protected virtual void Initialize() { }
+		/// <summary>
+		/// Override this method to undo everything you do in your Initialize
+		/// implementation & do clean-up. "world" reference is still set inside
+		/// this method.
+		/// </summary>
 		protected virtual void Uninitialize() { }

+		/// <summary>
+		/// Pass in a predicate to query & fetch entities from the world
+		/// the system is added to. You can also do it manually by calling
+		/// GetEntity method of World. This is a convenience method.
+		/// </summary>
+		/// <returns>The entities.</returns>
+		/// <param name="predicate">Predicate.</param>
 		public List<Entity> GetEntities(IPredicate<Entity> predicate)
         {
             if (world == null)


failing test

failing test

--- src/UnitTests/ReverseMapping.cs
+++ src/UnitTests/ReverseMapping.cs
@@ -94,6 +94,46 @@
         }
     }

+    public class ReverseDefaultFlattening : AutoMapperSpecBase
+    {
+        public class Order
+        {
+            public CustomerHolder Customerholder { get; set; }
+        }
+
+        public class CustomerHolder
+        {
+            public Customer Customer { get; set; }
+        }
+
+        public class Customer
+        {
+            public string Name { get; set; }
+            public decimal Total { get; set; }
+        }
+
+        public class OrderDto
+        {
+            public string CustomerholderCustomerName { get; set; }
+            public decimal CustomerholderCustomerTotal { get; set; }
+        }
+
+        protected override MapperConfiguration Configuration => new MapperConfiguration(cfg =>
+        {
+            cfg.CreateMap<Order, OrderDto>()
+                .ReverseMap(ReverseOptions.MapFroms);
+        });
+
+        [Fact]
+        public void Should_unflatten()
+        {
+            var dto = new OrderDto { CustomerholderCustomerName = "George Costanza", CustomerholderCustomerTotal = 74.85m };
+            var model = Mapper.Map<Order>(dto);
+            model.Customerholder.Customer.Name.ShouldEqual("George Costanza");
+            model.Customerholder.Customer.Total.ShouldEqual(74.85m);
+        }
+    }
+
     public class ReverseMapConventions : AutoMapperSpecBase
     {
         Rotator_Ad_Run _destination;


Advanced the library's version to 0.86

Advanced the library's version to 0.86

--- src/SharedAssemblyInfo.cs
+++ src/SharedAssemblyInfo.cs
@@ -1,7 +1,7 @@
 using System.Reflection;

 [assembly: AssemblyProduct("LANDIS Spatial Modeling Library")]
-[assembly: AssemblyVersion("0.85.*")]
+[assembly: AssemblyVersion("0.86.*")]

 #if DEBUG
 [assembly: AssemblyConfiguration("Debug")]


- Code refactoring

- Code refactoring

--- PS.Build.Tasks/Tasks/PreBuildAdaptationExecutionTask.cs
+++ PS.Build.Tasks/Tasks/PreBuildAdaptationExecutionTask.cs
@@ -11,6 +11,8 @@
 using PS.Build.Types;
 using Logger = PS.Build.Tasks.Services.Logger;

+// ReSharper disable UnusedAutoPropertyAccessor.Local
+
 namespace PS.Build.Tasks
 {
     public class PreBuildAdaptationExecutionTask : Task


Removed legacy CSS file from article page.

--- DoctrineShips.Web/Views/KnowledgeBase/Article.cshtml
+++ DoctrineShips.Web/Views/KnowledgeBase/Article.cshtml
@@ -6,7 +6,6 @@

 @{
     ViewBag.Title = "Knowledge Base Article";
-    ViewBag.PageCss = Url.Content("~/Content/styles/knowledgebasearticle.css");
 }

 <div id="ds-main" role="main">


Implemented the aggregate model async function

--- EventSourcingCQRS/Application/InventoryItemEvents.cs
+++ EventSourcingCQRS/Application/InventoryItemEvents.cs
@@ -2,6 +2,7 @@
 using System.Threading.Tasks;

 using Common.EventSourcing;
+using DomainCore;

 using Infrastructure.Data.Interfaces;

@@ -17,9 +18,21 @@
         {
         }

-        public override Task<ModelAggregate<Guid>> ModelAsync()
+        public override async Task<ModelAggregate<Guid>> ModelAsync()
         {
-            throw new NotImplementedException();
+            InventoryItemAggregate iia = new InventoryItemAggregate()
+            {
+                AggregateId = _aggregateId,
+                EventModelRow = 1
+            };
+
+            foreach (AInventoryItemEvent eventItem in await _eventStore.EventsAsync(_aggregateId))
+            {
+                iia.EventModelRow++;
+                eventItem.ApplyEventData(iia);
+            }
+
+            return iia;
         }
 	}
 }


correct title for chinese client

correct title for chinese client

--- FFXIVAPP.Plugin.Radar/Helpers/WidgetTopMostHelper.cs
+++ FFXIVAPP.Plugin.Radar/Helpers/WidgetTopMostHelper.cs
@@ -92,7 +92,7 @@
                 var activeTitle = WinAPI.GetActiveWindowTitle();

                 var stayOnTop = Application.Current.Windows.OfType<Window>()
-                                           .Any(w => w.Title == activeTitle) || Regex.IsMatch(activeTitle.ToUpper(), @"^(FINAL FANTASY XIV)", SharedRegEx.DefaultOptions);
+                                           .Any(w => w.Title == activeTitle) || Regex.IsMatch(activeTitle.ToUpper(), @"^(FINAL FANTASY |最终幻想)XIV", SharedRegEx.DefaultOptions);

                 // If any of the windows are focused, don't try to hide any of them, or it'll prevent us from moving/closing them
                 if (handle == RadarWidgetInteropHelper.Handle)


Support ToolTask.UseCommandProcessor on non-Windows

--- src/Utilities/ToolTask.cs
+++ src/Utilities/ToolTask.cs
@@ -1362,6 +1362,8 @@
                         File.AppendAllText(_temporaryBatchFile, "#!/bin/sh\n"); // first line for UNIX is ANSI
                         // This is a hack..!
                         File.AppendAllText(_temporaryBatchFile, AdjustCommandsForOperatingSystem(commandLineCommands), EncodingUtilities.CurrentSystemOemEncoding);
+
+                        commandLineCommands = $"\"{_temporaryBatchFile}\"";
                     }
                     else
                     {


fix #69

fix #69

--- AIMS_DB_IATI.WebAPI/Controllers/IATIImportController.cs
+++ AIMS_DB_IATI.WebAPI/Controllers/IATIImportController.cs
@@ -187,9 +187,9 @@
             var iOrgs = new List<participatingorg>();
             foreach (var activity in Sessions.activitiesContainer?.RelevantActivities)
             {
-                var participatingOrgs = activity.ImplementingOrgs ?? new List<participatingorg>();
-
-                iOrgs.AddRange(participatingOrgs);
+                if (activity.ImplementingOrgs != null)
+                    iOrgs.AddRange(activity.ImplementingOrgs);
+

             }

@@ -238,9 +238,11 @@

             foreach (var iOrg in _iOrgs)
             {
-                projectsImpOrgs.FindAll(f => (iOrg.@ref != null && f.@ref == iOrg.@ref)
-                                              || (!string.IsNullOrWhiteSpace(iOrg.Name) && f.Name == iOrg.Name))
-                               .ForEach(e =>
+                var pOrgs = projectsImpOrgs.FindAll(f => (!string.IsNullOrWhiteSpace(iOrg.Name) && f.Name == iOrg.Name));
+
+                if (pOrgs.Count == 0) projectsImpOrgs.FindAll(f => (iOrg.@ref != null && f.@ref == iOrg.@ref));
+
+                pOrgs.ForEach(e =>
                                {
                                    e.AllID = iOrg.AllID;
                                    var aimsName = exAgencies.FirstOrDefault(f => f.AllID != Sessions.DP.AllID && f.AllID == iOrg.AllID)?.Name;
@@ -248,10 +250,11 @@
                                });
             }

+            //set managing DP
             relevantActivities?.ForEach(e =>
             {
-                if (string.IsNullOrWhiteSpace(e.AllID) || !Sessions.iOrgs.FundSources.Exists(d => d.AllID == e.AllID)) e.AllID = Sessions.DP.AllID;
-
+                if (string.IsNullOrWhiteSpace(e.AllID) || !Sessions.iOrgs.FundSources.Exists(d => d.AllID == e.AllID))
+                    e.AllID = Sessions.DP.AllID;
             });

             Sessions.CurrentStage = Stage.FilterDP;


List with 1000 items

List with 1000 items

--- AdvancedNetToolsSolution/AntWeb/Infrastructure/Utils.cs
+++ AdvancedNetToolsSolution/AntWeb/Infrastructure/Utils.cs
@@ -17,12 +17,28 @@
 {
     public static class Utils
     {
+
         static Utils()
         {
+            RandomNumberGenerator = new Random();
+
             //TopSitesGlobal = Зареди тук сайтовете от файла Misc\TopSites като ги парснеш по подходящ начин.
             // накрая в TopSitesGlobal трябва да има 1000 сайта
-
-            RandomNumberGenerator = new Random();
+            TopSitesGlobal = new List<string>();
+
+            using (System.IO.StreamReader sr = new System.IO.StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Misc/TopSites.txt")))
+            {
+                while (!sr.EndOfStream)
+                {
+                    string splitMe = sr.ReadLine();
+                    string[] rowsSplits = splitMe.Split(new char[] { ',' });
+                    if (rowsSplits.Length == 2)
+                    {
+                        TopSitesGlobal.Add(rowsSplits[1]);
+                    }
+                }
+            }
+
             GetDeployedServicesUrlAddresses = new List<string>()
             {
                 "http://ants-ea.cloudapp.net", // "40.83.125.9",
@@ -67,37 +83,9 @@
             };
         }

-        public static List<string> TopSitesGlobal = new List<string>()
-        {
-            "Google.com",
-"Youtube.com",
-"Facebook.com",
-"Baidu.com",
-"Yahoo.com",
-"Amazon.com",
-"Wikipedia.org",
-"Qq.com",
-"Google.co.in",
-"Twitter.com",
-"Taobao.com",
-"Live.com",
-"Sina.com.cn",
-"Google.co.jp",
-"Msn.com",
-"Bing.com",
-"Yahoo.co.jp",
-"Weibo.com",
-"Linkedin.com",
-"Vk.com",
-"Yandex.ru",
-"Hao123.com",
-"Instagram.com",
-"Google.de",
-"Ebay.com",
-        };
+        public static List<string> TopSitesGlobal { get; set; }

         public static List<string> GetDeployedServicesUrlAddresses { get; set; }
-

         public static Dictionary<string, string> HotstNameToIp { get; set; }

@@ -409,7 +397,6 @@
                 var result = radius * 2 * Math.Asin(Math.Min(1, Math.Sqrt((Math.Pow(Math.Sin((DiffRadian(lat1, lat2)) / 2.0), 2.0) + Math.Cos(ToRadian(lat1)) * Math.Cos(ToRadian(lat2)) * Math.Pow(Math.Sin((DiffRadian(lng1, lng2)) / 2.0), 2.0)))));
                 return result;
             }
-

         }


Trivial - reformat simple method

Trivial - reformat simple method

--- Agiil.Bootstrap/Data/SqliteDatabaseMaintenanceModule.cs
+++ Agiil.Bootstrap/Data/SqliteDatabaseMaintenanceModule.cs
@@ -13,10 +13,6 @@
     protected override string Namespace => NamespaceMarkerType.Namespace;

     protected override IEnumerable<Assembly> GetSearchAssemblies()
-    {
-      return new [] {
-        NamespaceMarkerType.Assembly
-      };
-    }
+      => new[] { NamespaceMarkerType.Assembly };
   }
 }