PK-35 - Removed old input measurement fields from PowerCalculation model class. Updated code for saving to database to use new phasor properties instead of direct measurement access.

--- Source/PowerCalculations.UI/DataModels/PowerCalculation.cs
+++ Source/PowerCalculations.UI/DataModels/PowerCalculation.cs
@@ -54,58 +54,6 @@
 				if (m_circuitDescription == value) return;
 				m_circuitDescription = value;
 				OnPropertyChanged("CircuitDescription");
-			}
-		}
-
-		private Measurement m_voltageAngleMeasurement;
-		[Required(ErrorMessage = "Voltage angle signal ID is a required field. Please provide a value.")]
-		public Measurement VoltageAngleMeasurement
-		{
-			get { return m_voltageAngleMeasurement; }
-			set
-			{
-				if (m_voltageAngleMeasurement == value) return;
-				m_voltageAngleMeasurement = value;
-				OnPropertyChanged("VoltageAngleMeasurement");
-			}
-		}
-
-		private Measurement m_voltageMagnitudeMeasurement;
-		[Required(ErrorMessage = "Voltage magnitude signal ID is a required field. Please provide a value.")]
-		public Measurement VoltageMagnitudeMeasurement
-		{
-			get { return m_voltageMagnitudeMeasurement; }
-			set
-			{
-				if (m_voltageMagnitudeMeasurement == value) return;
-				m_voltageMagnitudeMeasurement = value;
-				OnPropertyChanged("VoltageMagnitudeMeasurement");
-			}
-		}
-
-		private Measurement m_currentAngleMeasurement;
-		[Required(ErrorMessage = "Current angle signal ID is a required field. Please provide a value.")]
-		public Measurement CurrentAngleMeasurement
-		{
-			get { return m_currentAngleMeasurement; }
-			set
-			{
-				if (m_currentAngleMeasurement == value) return;
-				m_currentAngleMeasurement = value;
-				OnPropertyChanged("CurrentAngleMeasurement");
-			}
-		}
-
-		private Measurement m_currentMagnitudeMeasurement;
-		[Required(ErrorMessage = "Current magnitude signal ID is a required field. Please provide a value.")]
-		public Measurement CurrentMagnitudeMeasurement
-		{
-			get { return m_currentMagnitudeMeasurement; }
-			set
-			{
-				if (m_currentMagnitudeMeasurement == value) return;
-				m_currentMagnitudeMeasurement = value;
-				OnPropertyChanged("CurrentMagnitudeMeasurement");
 			}
 		}

@@ -294,6 +242,19 @@
 							PowerCalculationEnabled = row.Field<bool>("CalculationEnabled"),
 							NodeId = database.Guid(row, "NodeId")
 						};
+
+						foreach (var phasor in phasors)
+						{
+							if (phasor.Id == currentPhasorId)
+							{
+								calculationList[keys.IndexOf(id)].CurrentPhasor = phasor;
+							}
+							else if (phasor.Id == voltagePhasorId)
+							{
+								calculationList[keys.IndexOf(id)].VoltagePhasor = phasor;
+							}
+						}
+
 						var mkeys = new List<Guid> { voltageAngle, voltageMagnitude, currentAngle, currentMagnitude };
 						if (realPower != null) { mkeys.Add(realPower.Value); }
 						if (reactivePower != null) { mkeys.Add(reactivePower.Value); }
@@ -303,19 +264,19 @@
 						{
 							if (measurement.SignalID == voltageAngle)
 							{
-								calculationList[keys.IndexOf(id)].VoltageAngleMeasurement = measurement;
+								calculationList[keys.IndexOf(id)].VoltagePhasor.AngleMeasurement = measurement;
 							}
 							else if (measurement.SignalID == voltageMagnitude)
 							{
-								calculationList[keys.IndexOf(id)].VoltageMagnitudeMeasurement = measurement;
+								calculationList[keys.IndexOf(id)].VoltagePhasor.MagnitudeMeasurement = measurement;
 							}
 							else if (measurement.SignalID == currentAngle)
 							{
-								calculationList[keys.IndexOf(id)].CurrentAngleMeasurement = measurement;
+								calculationList[keys.IndexOf(id)].CurrentPhasor.AngleMeasurement = measurement;
 							}
 							else if (measurement.SignalID == currentMagnitude)
 							{
-								calculationList[keys.IndexOf(id)].CurrentMagnitudeMeasurement = measurement;
+								calculationList[keys.IndexOf(id)].CurrentPhasor.MagnitudeMeasurement = measurement;
 							}
 							else if (measurement.SignalID == realPower)
 							{
@@ -328,18 +289,6 @@
 							else if (measurement.SignalID == activePower)
 							{
 								calculationList[keys.IndexOf(id)].ActivePowerOutputMeasurement = measurement;
-							}
-						}
-
-						foreach (var phasor in phasors)
-						{
-							if (phasor.Id == currentPhasorId)
-							{
-								calculationList[keys.IndexOf(id)].CurrentPhasor = phasor;
-							}
-							else if (phasor.Id == voltagePhasorId)
-							{
-								calculationList[keys.IndexOf(id)].VoltagePhasor = phasor;
 							}
 						}
 					}
@@ -404,8 +353,8 @@
 					query = database.ParameterizedQueryString("INSERT INTO PowerCalculation (CircuitDescription, VoltageAngleSignalId, VoltageMagSignalId, CurrentAngleSignalId, CurrentMagSignalId, RealPowerOutputSignalId, ReactivePowerOutputSignalId, ActivePowerOutputSignalId, CalculationEnabled, NodeId) " +
 						"VALUES ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9})", "circuitDescription", "voltageAngle", "voltageMag", "currentAngle", "currentMag", "realPowerOutput", "reactivePowerOutput", "activePowerOutput", "calculationEnabled", "nodeId");

-					database.Connection.ExecuteNonQuery(query, DefaultTimeout, powerCalculation.CircuitDescription, database.Guid(powerCalculation.VoltageAngleMeasurement.SignalID),
-						database.Guid(powerCalculation.VoltageMagnitudeMeasurement.SignalID), database.Guid(powerCalculation.CurrentAngleMeasurement.SignalID), database.Guid(powerCalculation.CurrentMagnitudeMeasurement.SignalID),
+					database.Connection.ExecuteNonQuery(query, DefaultTimeout, powerCalculation.CircuitDescription, database.Guid(powerCalculation.VoltagePhasor.AngleMeasurement.SignalID),
+						database.Guid(powerCalculation.VoltagePhasor.MagnitudeMeasurement.SignalID), database.Guid(powerCalculation.CurrentPhasor.AngleMeasurement.SignalID), database.Guid(powerCalculation.CurrentPhasor.MagnitudeMeasurement.SignalID),
 						database.Guid(powerCalculation.RealPowerOutputMeasurement.SignalID), database.Guid(powerCalculation.ReactivePowerOutputMeasurement.SignalID), database.Guid(powerCalculation.ActivePowerOutputMeasurement.SignalID),
 						powerCalculation.PowerCalculationEnabled, database.CurrentNodeID());
 				}
@@ -415,7 +364,7 @@
 						"RealPowerOutputSignalId = {5}, ReactivePowerOutputSignalId = {6}, ActivePowerOutputSignalId = {7}, CalculationEnabled = {8} WHERE PowerCalculationId = {9}", "circuitDescription", "voltageAngle", "voltageMag", "currentAngle", "currentMag", "realPowerOutput", "reactivePowerOutput", "activePowerOutput", "calculationEnabled", "powerCalculationId");

 					database.Connection.ExecuteNonQuery(query, DefaultTimeout, powerCalculation.CircuitDescription,
-						database.Guid(powerCalculation.VoltageAngleMeasurement.SignalID), database.Guid(powerCalculation.VoltageMagnitudeMeasurement.SignalID), database.Guid(powerCalculation.CurrentAngleMeasurement.SignalID), database.Guid(powerCalculation.CurrentMagnitudeMeasurement.SignalID),
+						database.Guid(powerCalculation.VoltagePhasor.AngleMeasurement.SignalID), database.Guid(powerCalculation.VoltagePhasor.MagnitudeMeasurement.SignalID), database.Guid(powerCalculation.CurrentPhasor.AngleMeasurement.SignalID), database.Guid(powerCalculation.CurrentPhasor.MagnitudeMeasurement.SignalID),
 						database.Guid(powerCalculation.RealPowerOutputMeasurement.SignalID), database.Guid(powerCalculation.ReactivePowerOutputMeasurement.SignalID), database.Guid(powerCalculation.ActivePowerOutputMeasurement.SignalID), powerCalculation.PowerCalculationEnabled, powerCalculation.PowerCalculationId);
 				}


Change the help message to point to copying OpenSimDefaults.ini.example. Provide a mostly empty OpenSim.ini.example

--- OpenSim/Region/Application/ConfigurationLoader.cs
+++ OpenSim/Region/Application/ConfigurationLoader.cs
@@ -172,7 +172,7 @@
             if (sources.Count == 0)
             {
                 m_log.FatalFormat("[CONFIG]: Could not load any configuration");
-                m_log.FatalFormat("[CONFIG]: Did you copy the OpenSim.ini.example file to OpenSim.ini?");
+                m_log.FatalFormat("[CONFIG]: Did you copy the OpenSimDefaults.ini.example file to OpenSimDefaults.ini?");
                 Environment.Exit(1);
             }


Shuffle where hooks are called from in BootstrapperBase slightly

--- Stylet/BootstrapperBase.cs
+++ Stylet/BootstrapperBase.cs
@@ -66,8 +66,11 @@
             };

             // Fetch this logger when needed. If we fetch it now, then no-one will have been given the change to enable the LogManager, and we'll get a NullLogger
-            this.Application.DispatcherUnhandledException += (o, e) => LogManager.GetLogger(typeof(BootstrapperBase)).Error(e.Exception, "Unhandled exception");
-            this.Application.DispatcherUnhandledException += (o, e) => this.OnUnhandledExecption(e);
+            this.Application.DispatcherUnhandledException += (o, e) =>
+            {
+                LogManager.GetLogger(typeof(BootstrapperBase)).Error(e.Exception, "Unhandled exception");
+                this.OnUnhandledExecption(e);
+            };
         }

         /// <summary>
@@ -84,6 +87,7 @@
             View.ViewManager = (IViewManager)this.GetInstance(typeof(IViewManager));

             this.Launch();
+            this.OnStartup();
         }

         /// <summary>
@@ -93,7 +97,6 @@
         {
             var windowManager = (IWindowManager)this.GetInstance(typeof(IWindowManager));
             windowManager.ShowWindow(this.RootViewModel);
-            this.OnStartup();
         }

         /// <summary>
@@ -114,7 +117,7 @@
         protected virtual void OnStartup() { }

         /// <summary>
-        /// Hook used internall by the Bootstrapper to do things like dispose the IoC container
+        /// Hook used internally by the Bootstrapper to do things like dispose the IoC container
         /// </summary>
         /// <param name="e">The exit event data</param>
         protected virtual void OnExitInternal(ExitEventArgs e) { }


remove dead code

remove dead code

--- SwCSharpAddinMF/SwAddin.cs
+++ SwCSharpAddinMF/SwAddin.cs
@@ -185,34 +185,6 @@
         public void CreateCube()
         {
             SampleMacroFeature.AddMacroFeature(SwApp);
-            return;
-
-            //make sure we have a part open
-            string partTemplate = ISwApp.GetUserPreferenceStringValue((int)swUserPreferenceStringValue_e.swDefaultTemplatePart);
-            if ((partTemplate != null) && (partTemplate != ""))
-            {
-                IModelDoc2 modDoc = (IModelDoc2)ISwApp.NewDocument(partTemplate, (int)swDwgPaperSizes_e.swDwgPaperA2size, 0.0, 0.0);
-
-                modDoc.InsertSketch2(true);
-                modDoc.SketchRectangle(0, 0, 0, .1, .1, .1, false);
-                //Extrude the sketch
-                IFeatureManager featMan = modDoc.FeatureManager;
-                featMan.FeatureExtrusion(true,
-                    false, false,
-                    (int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind,
-                    0.1, 0.0,
-                    false, false,
-                    false, false,
-                    0.0, 0.0,
-                    false, false,
-                    false, false,
-                    true,
-                    false, false);
-            }
-            else
-            {
-                System.Windows.Forms.MessageBox.Show("There is no part template available. Please check your options and make sure there is a part template selected, or select a new part template.");
-            }
         }


check existence of empty constructor before activation attempt

--- TIKSN.Core/DependencyInjection/CompositionRootSetupBase.cs
+++ TIKSN.Core/DependencyInjection/CompositionRootSetupBase.cs
@@ -16,23 +16,6 @@
 		protected CompositionRootSetupBase()
 		{
 			services = new Lazy<IServiceCollection>(CreateServiceCollection, false);
-		}
-
-		protected IServiceCollection CreateServiceCollection()
-		{
-			var services = new ServiceCollection();
-			DependencyRegistration.Register(services);
-
-			ConfigureServices(services);
-
-			var configuration = GetConfigurationRoot();
-
-			ConfigureOptions(services, configuration);
-
-			services.AddSingleton(configuration);
-			services.AddSingleton<IConfiguration>(configuration);
-
-			return services;
 		}

 		public IServiceProvider CreateServiceProvider()
@@ -75,6 +58,23 @@
 		}

 		protected abstract void ConfigureServices(IServiceCollection services);
+
+		protected IServiceCollection CreateServiceCollection()
+		{
+			var services = new ServiceCollection();
+			DependencyRegistration.Register(services);
+
+			ConfigureServices(services);
+
+			var configuration = GetConfigurationRoot();
+
+			ConfigureOptions(services, configuration);
+
+			services.AddSingleton(configuration);
+			services.AddSingleton<IConfiguration>(configuration);
+
+			return services;
+		}

 		protected virtual IServiceProvider CreateServiceProviderInternal()
 		{
@@ -126,7 +126,7 @@

 						if (pInfo.PropertyType == typeof(string))
 							isNotSpecified = string.IsNullOrEmpty(pInfo.GetValue(options.Value)?.ToString());
-						else if (pInfo.GetValue(options.Value) == Activator.CreateInstance(pInfo.PropertyType) && pInfo.PropertyType.GetConstructor(Type.EmptyTypes) != null)
+						else if (pInfo.PropertyType.GetConstructor(Type.EmptyTypes) != null && pInfo.GetValue(options.Value) == Activator.CreateInstance(pInfo.PropertyType))
 							isNotSpecified = true;
 						else
 							logger.LogDebug(2016759580, $"{pInfo.Name} property of {optionType.FullName} object is type of {pInfo.PropertyType}.");


try fix next song not working.

try fix next song not working.

--- src/Wukong/Services/Channel.cs
+++ src/Wukong/Services/Channel.cs
@@ -223,7 +223,12 @@

         public bool ReportFinish(string userId, ClientSong song, bool force = false)
         {
-            if (song == null || CurrentSong == null || song.SiteId != CurrentSong.SiteId || song.SongId != CurrentSong.SongId)
+            if (CurrentSong == null)
+            {
+                ShouldForwardNow();
+                return true;
+            }
+            if (song == null || song.SiteId != CurrentSong.SiteId || song.SongId != CurrentSong.SongId)
                 return false;
             if (force)
                 DownvoteUsers.Add(userId);


Reuse Call overload from FunctionExpectation.cs

--- Telerik.JustMock/Expectations/Local/FunctionExpectation.cs
+++ Telerik.JustMock/Expectations/Local/FunctionExpectation.cs
@@ -100,7 +100,8 @@
 		{
 			return ProfilerInterceptor.GuardInternal(() =>
 			{
-				var resObject = this.Call(target, methodName, localFunctionName, args);
+				Type[] emptyParamTypes = new Type[] { };
+				var resObject = this.Call(target, methodName, emptyParamTypes, localFunctionName, args);
 				T res = (T)resObject;
 				return res;
 			});


rates identifier

rates identifier

--- Terradue.Tep/Terradue/Tep/WebServer/Accounting/WebRates.cs
+++ Terradue.Tep/Terradue/Tep/WebServer/Accounting/WebRates.cs
@@ -36,7 +36,8 @@

         public WebRates() {}

-        public WebRates(Rates entity) : base(entity){
+        public WebRates(Rates entity) : base(entity){
+            this.Identifier = entity.Identifier;
             this.Unit = entity.Unit;
             this.Cost = entity.Cost;
         }


add identifier on wps service create

add identifier on wps service create

--- Terradue.Tep/Terradue/Tep/WebServer/Service/Wps.Service.cs
+++ Terradue.Tep/Terradue/Tep/WebServer/Service/Wps.Service.cs
@@ -536,6 +536,7 @@
                 //Create WPS provider
                 WpsProvider wpsProvider = new WpsProvider(context);
                 wpsProvider.BaseUrl = request.Url;
+                wpsProvider.Identifier = request.Identifier;
                 wpsProvider.Name = request.Name;
                 wpsProvider.Store();

@@ -546,7 +547,6 @@
                 wps.Description = request.Description;
                 wps.Url = request.Url;
                 wps.Provider = wpsProvider;
-                wps.ProcessIdentifier = "None";
                 wps.Store();

                 result = new WebWpsService(wps);


Reading tortoiseproc location from registry not working on windows 10 64-bit machine #63

--- TSVN/Helpers/FileHelper.cs
+++ TSVN/Helpers/FileHelper.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
 using EnvDTE;
 using EnvDTE80;
 using Microsoft.Win32;
@@ -8,14 +9,15 @@
     public static class FileHelper
     {
         public static DTE2 Dte;
+        private const string DEFAULT_PROC_PATH = @"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe";

         public static string GetTortoiseSvnProc()
         {
-            var path = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\TortoiseSVN", "ProcPath", @"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe");
+            var path = GetRegKeyValue();

             if (string.IsNullOrEmpty(path))
             {
-                path = @"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe";
+                path = DEFAULT_PROC_PATH;
             }

             return path;
@@ -62,5 +64,16 @@
             // Context menu in the Code Editor
             return Dte.ActiveDocument.FullName;
         }
+
+        private static string GetRegKeyValue()
+        {
+            var localMachineKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine,
+                Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32);
+
+            return localMachineKey
+                .OpenSubKey(@"SOFTWARE\TortoiseSVN")
+                .GetValue("ProcPath", DEFAULT_PROC_PATH)
+                .ToString();
+        }
     }
 }


Fix nullable.

Fix nullable.

--- CK.AspNet.Auth/UserLoginResult.cs
+++ CK.AspNet.Auth/UserLoginResult.cs
@@ -25,7 +25,7 @@
         /// corrected by registering the user for the provider.
         /// This can be true only on failure otherwise an argument exception is thrown.
         /// </param>
-        public UserLoginResult( IUserInfo info, int failureCode, string failureReason, bool unregisteredUser )
+        public UserLoginResult( IUserInfo? info, int failureCode, string failureReason, bool unregisteredUser )
         {
             if( info == null || info.UserId == 0 )
             {


Adapted the camera settings test application to reflect the new functionality for the image settings.

--- Test/CameraSettingsTest.cs
+++ Test/CameraSettingsTest.cs
@@ -54,14 +54,8 @@
                 Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Battery level: {0}", await camera.GetBatteryLevelAsync()));
                 Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Owner name: {0}", await camera.GetOwnerNameAsync()));

-                // Gets all information available about the ISO speed of the camera
-                CameraSetting cameraSetting = camera.Settings.FirstOrDefault(setting => setting.Name == CameraSettings.IsoSpeed);
-                Console.WriteLine(cameraSetting.Name);
-                Console.WriteLine(await cameraSetting.GetTypeAsync());
-                Console.WriteLine(await cameraSetting.GetLabelAsync());
-                Console.WriteLine(await cameraSetting.GetValueAsync());
-                foreach (string choice in await cameraSetting.GetChoicesAsync())
-                    Console.WriteLine(choice);
+                // Gets some information about the image settings of the camera and prints it out
+                Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "ISO speed: {0}", await camera.GetIsoSpeedAsync()));
 			}
 			catch (CameraException exception)
 			{


Only force to ghost if mind belong to the body.

--- UnityProject/Assets/Scripts/Player/PlayerNetworkActions.cs
+++ UnityProject/Assets/Scripts/Player/PlayerNetworkActions.cs
@@ -24,7 +24,6 @@
 	private PlayerMove playerMove;
 	private PlayerScript playerScript;
 	private ItemStorage itemStorage;
-
 	private void Awake()
 	{
 		playerMove = GetComponent<PlayerMove>();
@@ -415,7 +414,9 @@
 	[Server]
 	public void ServerSpawnPlayerGhost()
 	{
-		if (GetComponent<LivingHealthBehaviour>().IsDead && !playerScript.IsDeadOrGhost)
+		//Only force to ghost if the mind belongs in to that body
+		var currentMobID = GetComponent<LivingHealthBehaviour>().mobID;
+		if (GetComponent<LivingHealthBehaviour>().IsDead && !playerScript.IsGhost && playerScript.mind.bodyMobID == currentMobID)
 		{
 			PlayerSpawn.ServerSpawnGhost(playerScript.mind);
 		}


The CodeAnalysisReference reference in DiagnosticVerifier.Helper was a misnamed duplicate - now removed

--- ProductiveRage.Immutable.Analyser/Analyser.Test/Helpers/DiagnosticVerifier.Helper.cs
+++ ProductiveRage.Immutable.Analyser/Analyser.Test/Helpers/DiagnosticVerifier.Helper.cs
@@ -23,7 +23,6 @@
 		private static readonly MetadataReference CorlibReference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location);
 		private static readonly MetadataReference SystemCoreReference = MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location);
 		private static readonly MetadataReference CSharpSymbolsReference = MetadataReference.CreateFromFile(typeof(CSharpCompilation).Assembly.Location);
-		private static readonly MetadataReference CodeAnalysisReference = MetadataReference.CreateFromFile(typeof(ProductiveRage.Immutable.ImmutabilityHelpers).Assembly.Location);
 		private static readonly MetadataReference CSharpProductiveRageImmutableReference = MetadataReference.CreateFromFile(typeof(ImmutabilityHelpers).Assembly.Location);
 		private static readonly MetadataReference MockBridgeReference = MetadataReference.CreateFromFile(typeof(Bridge.Script).Assembly.Location);

@@ -159,7 +158,6 @@
 				.AddMetadataReference(projectId, CorlibReference)
 				.AddMetadataReference(projectId, SystemCoreReference)
 				.AddMetadataReference(projectId, CSharpSymbolsReference)
-				.AddMetadataReference(projectId, CodeAnalysisReference)
 				.AddMetadataReference(projectId, CSharpProductiveRageImmutableReference)
 				.AddMetadataReference(projectId, MockBridgeReference);


Don't store extInfo past parsing

Don't store extInfo past parsing

--- PathfinderAPI/Replacements/ExtensionInfoLoader.cs
+++ PathfinderAPI/Replacements/ExtensionInfoLoader.cs
@@ -69,7 +69,7 @@

         private static readonly EventExecutor executor = new EventExecutor();

-        private static ExtensionInfo extInfo;
+        private static ExtensionInfo extInfo = null;

         static ExtensionInfoLoader()
         {
@@ -169,8 +169,10 @@

             if (!executor.TryParse(out var ex))
                 throw new FormatException($"An exception occurred while trying to parse '{filepath}'", ex);
-
-            return extInfo;
+
+            var ret = extInfo;
+            extInfo = null;
+            return ret;
         }
     }
 }


[ConsolidatedManagedProperty] Reversed the list of managed properties so the latest definitions are treated last.

--- Source/GSoft.Dynamite.Common.Core/Configuration/ConsolidatedManagedPropertyConfig.cs
+++ Source/GSoft.Dynamite.Common.Core/Configuration/ConsolidatedManagedPropertyConfig.cs
@@ -35,6 +35,10 @@
                     managedProperties.AddRange(configuration.ManagedProperties);
                 }

+                // Reverse the order of the managed properties so that
+                // the latest definitions are treated last (overrides the base definitions).
+                managedProperties.Reverse();
+
                 return managedProperties;
             }
         }


Main area - implemented confirmation for deleting and removing pictures.

--- Source/PhotoContest.App/Views/Shared/DisplayTemplates/DetailsPictureViewModel.cshtml
+++ Source/PhotoContest.App/Views/Shared/DisplayTemplates/DetailsPictureViewModel.cshtml
@@ -8,8 +8,11 @@

             @if ((Model.IsAuthor || this.User.IsInRole("Administrator")))
             {
-                @Html.ActionLink("Delete", "Delete", "Pictures", new { id = Model.Id }, new { @class = "btn btn-danger" })
-                @Html.ActionLink("Remove", "Remove", "Pictures", new { id = Model.Id, contestId = Model.ContestId }, new { @class = "btn btn-warning" })
+                <button class="btn btn-danger" role="button" data-toggle="modal" data-target="#confirm-delete-@Model.Id">Delete</button>
+                if (Model.ContestId != null)
+                {
+                    <button class="btn btn-warning" role="button" data-toggle="modal" data-target="#confirm-remove-@Model.Id">Remove</button>
+                }
             }
             @if (Model.HasVoted && !Model.IsAuthor)
             {
@@ -31,6 +34,43 @@
         Author: @Html.ActionLink(@Model.AuthorUsername, "Index", "Users", new { username = Model.AuthorUsername }, null)

         Posted on: @Html.DisplayFor(m => m.PostedOn)

         Total participations: @Model.ContestsCount

-        Total votes: @Model.VotesCount

+        Total votes: @Model.VotesCount

+
+

+

+

+

+                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+
Delete picture confirmation

+

+

+
You are about to delete picture FROM SITE AT ALL! Are you sure?

+

+

+                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+                        @Html.ActionLink("Delete", "Delete", "Pictures", new { id = Model.Id }, new { @class = "btn btn-danger" })
+

+

+

+

+
+

+

+

+

+                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+
Remove picture confirmation

+

+

+
You are about to remove picture from this contest! Are you sure?

+

+

+                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+                        @Html.ActionLink("Remove", "Remove", "Pictures", new { id = Model.Id, contestId = Model.ContestId }, new { @class = "btn btn-warning" })
+

+

+

+

+


Force fix for new databases

Force fix for new databases

Forces the new databases to generate the schema. This will be reversed
in the next commit such that databases can successfully migrate.

--- VotingApplication/VotingApplication.Web.Api/Global.asax.cs
+++ VotingApplication/VotingApplication.Web.Api/Global.asax.cs
@@ -29,8 +29,8 @@
             GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

             //Enable automatic migrations
-            Database.SetInitializer(new MigrateDatabaseToLatestVersion<VotingContext, Configuration>());
-            new VotingContext().Database.Initialize(false);
+            //Database.SetInitializer(new MigrateDatabaseToLatestVersion<VotingContext, Configuration>());
+            //new VotingContext().Database.Initialize(false);
         }
     }
 }


Escape + Shield

Escape + Shield

--- Tibbuhs/Tibbuhs/Program.cs
+++ Tibbuhs/Tibbuhs/Program.cs
@@ -17,6 +17,8 @@
         private static Spell E;
         private static Spell R;
         private static SpellSlot Flash;
+        private static SpellSlot Ignite; //not used
+        private static SpellSlot Exhaust; //not used
         private static PredictionInput FlashTibbers_pi;
         private static PredictionOutput FlashTibbers_po;
         private static Menu menu;
@@ -40,6 +42,8 @@
             R = new Spell(SpellSlot.R, 600);
             R.SetSkillshot(250, 200, float.MaxValue, false, SkillshotType.SkillshotCircle);
             Flash = ObjectManager.Player.GetSpellSlot("SummonerFlash", true);
+            Ignite = ObjectManager.Player.GetSpellSlot("SummonerDot", true);
+            Ignite = ObjectManager.Player.GetSpellSlot("SummonerExhaust", true);
             SpellList.Add(Q); SpellList.Add(W); SpellList.Add(E); SpellList.Add(R);
             #endregion

@@ -73,9 +77,10 @@

-            menu.SubMenu("defense").AddItem(new MenuItem("Wstungapcloser", "Use W stun as a gapcloser")).SetValue(true);
+            menu.SubMenu("defense").AddItem(new MenuItem("Wstunescape", "Use W stun to escape")).SetValue(true);
+            menu.SubMenu("defense").AddItem(new MenuItem("Wstunescaperange", "Max W stun escape range")).SetValue(new Slider(250, 0, (int)W.Range));
             menu.SubMenu("defense").AddItem(new MenuItem("Eenemies", "Use E when enemies near you")).SetValue(true);
-            menu.SubMenu("defense").AddItem(new MenuItem("Eenemiesrange", "Use E when enemies closer than")).SetValue(new Slider(250, 0, 1250));
+            menu.SubMenu("defense").AddItem(new MenuItem("Eenemiesrange", "Use E when enemies closer than")).SetValue(new Slider(600, 0, 1250));

             menu.SubMenu("misc").AddItem(new MenuItem("passivestacker", "Always stack passive with E")).SetValue(false);
@@ -293,10 +298,19 @@
         private static void Cast_W()
         {
             var target = SimpleTs.GetTarget(W.Range, SimpleTs.DamageType.Magical);
+            var Wstunescaperange = menu.Item("Wstungapescaperange").GetValue<int>();
+            var closestThreat = ObjectManager.Get<Obj_AI_Hero>().First(ct => !ct.IsMe && ct.Distance(Player) < Wstunescaperange && ct.IsEnemy);
             //#TODO work on better targeting, like not wasting Q on tanks.
-            if (target != null)
-            {
-                W.Cast(target, UsePackets());
+            if (menu.Item("combotoggle").GetValue<KeyBind>().Active)
+            {
+                if (target != null)
+                {
+                    W.Cast(target, UsePackets());
+                }
+            }
+            if (menu.Item("Wstungapescape").GetValue<bool>())
+            {
+                W.Cast(closestThreat);
             }
         }
         #endregion
@@ -304,6 +318,14 @@
         #region Casting E
         private static void Cast_E(string mode)
         {
+            var defenseEenemies = menu.Item("Eenemies").GetValue<bool>();
+            var defenseEenemiesrange = menu.Item("Eenemiesrange").GetValue<int>();
+            var closestEnemy = ObjectManager.Get<Obj_AI_Hero>().First(ce => !ce.IsMe && ce.Distance(Player) < defenseEenemiesrange && ce.IsEnemy);
+            if (closestEnemy != null && defenseEenemies && E.IsReady())
+            {
+                E.Cast();
+            }
+
             if(mode == "farm" && !PassiveStacker() && (menu.Item("Elanestuncharge").GetValue<bool>()))
             {
                 if(GetPassiveStacks() < 4)


fix(dashboard): query past maxpagesize

fix(dashboard): query past maxpagesize

--- WebAPI.Dashboard/Areas/admin/Controllers/HomeController.cs
+++ WebAPI.Dashboard/Areas/admin/Controllers/HomeController.cs
@@ -2,6 +2,7 @@
 using System.Linq;
 using System.Web.Mvc;
 using Raven.Client;
+using Serilog;
 using StackExchange.Redis;
 using WebAPI.Common.Executors;
 using WebAPI.Common.Extensions;
@@ -63,9 +64,21 @@
                 return;
             }

-            StatCache.AllKeys = Session.Query<ApiKey>()
-                .Take(1024)
-                .ToArray();
+            const int pageSize = 1024;
+
+            var keys = Session.Query<ApiKey>()
+                .Take(pageSize)
+                .ToList();
+
+            keys.AddRange(Session.Query<ApiKey>()
+                .Skip(pageSize)
+                .Take(pageSize)
+                .ToList()
+            );
+
+            StatCache.AllKeys = keys.ToArray();
+
+            Log.Warning("analytics(key-count): {key}", StatCache.AllKeys.Length);

             var totalKeys = Session.Query<ApiKey>().Count();
             var totalUsers = Session.Query<Account>().Count();


Don't show 'Abandoned' view in dropdowns

--- TribalWars/Worlds/World.cs
+++ TribalWars/Worlds/World.cs
@@ -340,7 +340,7 @@

         public IEnumerable<string> GetBackgroundViews()
         {
-            return Views.Where(x => x.Background).Select(x => x.Name);
+            return Views.Where(x => x.Background).Where(x => x.Name != "Abandoned").Select(x => x.Name);
         }
         #endregion


Added some additional MIME types for serving fonts

--- Ceen.Httpd/Handler/FileHandler.cs
+++ Ceen.Httpd/Handler/FileHandler.cs
@@ -385,9 +385,19 @@
 				case ".hbs":
 					return "application/x-handlebars-template";
 				case ".woff":
+				case ".woff2":
 					return "application/font-woff";
 				case ".ttf":
 					return "application/font-ttf";
+				case ".eot":
+					return "application/vnd.ms-fontobject";
+				case ".otf":
+					return "application/font-otf";
+				case ".svg":
+					return "application/svg+xml";
+				case ".xml":
+					return "application/xml";
+
 				default:
 					return null;
 			}


Fixed "Fail-safe mode" checkbox value being updated when user goes to the "Tools" tab page, instead of the "Options" page.

--- ChargedMinersLauncher/MainForm.cs
+++ ChargedMinersLauncher/MainForm.cs
@@ -1069,32 +1069,33 @@

         void tabs_SelectedIndexChanged( object sender, EventArgs e ) {
-            if( tabs.Visible ) {
-                if( tabs.SelectedTab == tabSignIn ) {
-                    AcceptButton = bSignIn;
-                    if( cSignInUsername.Text.Length == 0 ) {
-                        cSignInUsername.Focus();
-                    } else if( tSignInPassword.Text.Length == 0 ) {
-                        tSignInPassword.Focus();
-                    } else {
-                        tSignInUrl.Focus();
-                    }
-                } else if( tabs.SelectedTab == tabResume ) {
-                    AcceptButton = bResume;
-                    bResume.Focus();
-                } else if( tabs.SelectedTab == tabDirect ) {
-                    AcceptButton = bDirectConnect;
-                    tDirectUrl.Focus();
-                } else {
-                    AcceptButton = null;
-                    if( tabs.SelectedTab == tabTools ) {
-                        SettingsFile sf = new SettingsFile();
-                        if( File.Exists( Paths.GameSettingsFile ) ) {
-                            sf.Load( Paths.GameSettingsFile );
-                        }
-                        xFailSafe.Checked = sf.GetBool( "mc.failsafe", false );
-                    }
-                }
+            if( !tabs.Visible ) {
+                return;
+            }
+            if( tabs.SelectedTab == tabSignIn ) {
+                AcceptButton = bSignIn;
+                if( cSignInUsername.Text.Length == 0 ) {
+                    cSignInUsername.Focus();
+                } else if( tSignInPassword.Text.Length == 0 ) {
+                    tSignInPassword.Focus();
+                } else {
+                    tSignInUrl.Focus();
+                }
+            } else if( tabs.SelectedTab == tabResume ) {
+                AcceptButton = bResume;
+                bResume.Focus();
+            } else if( tabs.SelectedTab == tabDirect ) {
+                AcceptButton = bDirectConnect;
+                tDirectUrl.Focus();
+            } else if( tabs.SelectedTab == tabOptions ) {
+                AcceptButton = null;
+                SettingsFile sf = new SettingsFile();
+                if( File.Exists( Paths.GameSettingsFile ) ) {
+                    sf.Load( Paths.GameSettingsFile );
+                }
+                xFailSafe.Checked = sf.GetBool( "mc.failsafe", false );
+            } else {
+                AcceptButton = null;
             }
         }


Added more LazyField<T> extension helper methods

--- Proligence.Orchard.Testing/LazyFieldExtensions.cs
+++ Proligence.Orchard.Testing/LazyFieldExtensions.cs
@@ -1,23 +1,43 @@
 namespace Proligence.Orchard.Testing
 {
+    using System;
     using System.Reflection;
     using global::Orchard.Core.Common.Utilities;

     public static class LazyFieldExtensions
     {
+        private const string LoaderFieldName = "_loader";
+        private const string SetterFieldName = "_setter";
+        private const string ValueFieldName = "_value";
+
         public static bool HasLoader<T>(this LazyField<T> lazyField)
         {
-            return ReadField(lazyField, "_loader") != null;
+            return ReadField(lazyField, LoaderFieldName) != null;
+        }
+
+        public static Func<T> GetLoader<T>(this LazyField<T> lazyField)
+        {
+            return (Func<T>)ReadField(lazyField, LoaderFieldName);
         }

         public static bool HasSetter<T>(this LazyField<T> lazyField)
         {
-            return ReadField(lazyField, "_setter") != null;
+            return ReadField(lazyField, SetterFieldName) != null;
+        }
+
+        public static Func<T, T> GetSetter<T>(this LazyField<T> lazyField)
+        {
+            return (Func<T, T>)ReadField(lazyField, SetterFieldName);
         }

         public static bool HasValue<T>(this LazyField<T> lazyField)
         {
-            return ReadField(lazyField, "_value") != null;
+            return ReadField(lazyField, ValueFieldName) != null;
+        }
+
+        public static T GetValue<T>(this LazyField<T> lazyField)
+        {
+            return (T)ReadField(lazyField, ValueFieldName);
         }

         private static object ReadField<T>(LazyField<T> lazyField, string name)


Updated the searches to all use udfs

Updated the searches to all use udfs

--- Purchasing.Core/Repositories/ISearchRepository.cs
+++ Purchasing.Core/Repositories/ISearchRepository.cs
@@ -1,11 +1,9 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
+using NHibernate;
 using NHibernate.Transform;
+using Purchasing.Core.Domain;
 using Purchasing.Core.Queries;
-using UCDArch.Core.PersistanceSupport;
 using UCDArch.Data.NHibernate;
-using Purchasing.Core.Domain;
-using NHibernate;

 namespace Purchasing.Core.Repositories
 {
@@ -37,64 +35,39 @@

     public class SearchRepository : ISearchRepository
     {
-        public ISession Session { get { return NHibernateSessionManager.Instance.GetSession(); } }
+        public ISession Session
+        {
+            get { return NHibernateSessionManager.Instance.GetSession(); }
+        }
+
+        #region ISearchRepository Members

         public IList<SearchResults.OrderResult> SearchOrders(string searchTerm, string user)
         {
-            const string queryFields = "(RES.[Justification], RES.[RequestNumber], RES.[DeliverTo], RES.[DeliverToEmail])";
-            return PerformQuery<SearchResults.OrderResult>(user, searchTerm, queryFields, "Order", queryId: "Id");
+            return PerformQuery<SearchResults.OrderResult>(searchTerm, "Order", user);
         }

         public IList<SearchResults.LineResult> SearchLineItems(string searchTerm, string user)
         {
-            const string queryFields = "(RES.[Description], RES.[Url], RES.[Notes], RES.[CatalogNumber], RES.[CommodityId])";
-            return PerformQuery<SearchResults.LineResult>(user, searchTerm, queryFields, "Line");
+            return PerformQuery<SearchResults.LineResult>(searchTerm, "Line", user);
         }

         public IList<SearchResults.CustomFieldResult> SearchCustomFieldAnswers(string searchTerm, string user)
         {
-            const string queryFields = "(RES.[Answer])";
-            return PerformQuery<SearchResults.CustomFieldResult>(user, searchTerm, queryFields, "CustomField");
+            return PerformQuery<SearchResults.CustomFieldResult>(searchTerm, "CustomField", user);
         }

         public IList<SearchResults.CommentResult> SearchComments(string searchTerm, string user)
         {
-            const string queryFields = "(RES.[text])";
-            return PerformQuery<SearchResults.CommentResult>(user, searchTerm, queryFields, "Comment");
+            return PerformQuery<SearchResults.CommentResult>(searchTerm, "Comment", user);
         }
-
-        private IList<T> PerformQuery<T>(string user, string query, string queryFields, string queryType, string queryId = "OrderId")
-        {
-            var q = Session.CreateSQLQuery(string.Format(@"SELECT RES.* FROM [PrePurchasing].[dbo].[v{0}Results] RES
-                INNER JOIN [PrePurchasing].[dbo].[vAccess] A
-                ON RES.[{1}] = A.[OrderId]
-                WHERE FREETEXT({2}, :query)
-                AND A.[AccessUserId] = :user AND A.[isadmin] = 0", queryType, queryId, queryFields))
-                .SetString("query", query)
-                .SetString("user", user)
-                .SetResultTransformer(Transformers.AliasToBean<T>());
-
-            return q.List<T>();
-        }
-
-        private IList<T> PerformUdfQuery<T>(string query, string queryType, string user = null)
-        {
-            var q = Session.CreateSQLQuery(
-                string.Format(
-                    @"DECLARE @ContainsSearchCondition varchar(255) = '{0}';
-                    SELECT * from dbo.udf_Get{1}Results(@ContainsSearchCondition)",
-                    query, queryType))
-                .SetResultTransformer(Transformers.AliasToBean<T>());
-
-            return q.List<T>();
-        }

         /// <summary>
         /// Searches commodities
         /// </summary>
         public IList<Commodity> SearchCommodities(string searchTerm)
         {
-            return PerformUdfQuery<Commodity>(searchTerm, "Commodities");
+            return PerformQuery<Commodity>(searchTerm, "Commodities");
         }

         /// <summary>
@@ -102,7 +75,7 @@
         /// </summary>
         public IList<Vendor> SearchVendors(string searchTerm)
         {
-            return PerformUdfQuery<Vendor>(searchTerm, "Vendor");
+            return PerformQuery<Vendor>(searchTerm, "Vendor");
         }

         /// <summary>
@@ -110,7 +83,29 @@
         /// </summary>
         public IList<Account> SearchAccounts(string searchTerm)
         {
-            return PerformUdfQuery<Account>(searchTerm, "Account");
+            return PerformQuery<Account>(searchTerm, "Account");
+        }
+
+        #endregion
+
+        private IList<T> PerformQuery<T>(string query, string queryType, string user = null)
+        {
+            var queryParams = new List<string> {"@User", "@ContainsSearchCondition"};
+
+            if (string.IsNullOrWhiteSpace(user))
+            {
+                queryParams.Remove("@User");
+            }
+
+            IQuery q = Session.CreateSQLQuery(
+                string.Format(
+                    @"DECLARE @User varchar(255) = '{0}';
+                    DECLARE @ContainsSearchCondition varchar(255) = '{1}';
+                    SELECT * from dbo.udf_Get{2}Results({3})",
+                    user, query, queryType, string.Join(",", queryParams)))
+                .SetResultTransformer(Transformers.AliasToBean<T>());
+
+            return q.List<T>();
         }
     }
-}
+}


Update GithubClient.cs

Update GithubClient.cs

--- ReadingList.Notes.Github/Services/GithubClient.cs
+++ ReadingList.Notes.Github/Services/GithubClient.cs
@@ -1,29 +1,30 @@
 using System.Collections.Generic;
-using System.Net.Http;
-using System.Threading.Tasks;
-using Octokit;
-
-namespace ReadingList.Notes.Github.Services
-{
-    public class GithubClient
-    {
-        public HttpClient Client { get; }
-        private readonly IGitHubClient _gitHubClient;
-        private const string ApplicationName = "ReadingList.Notes";
-
-        public GithubClient(HttpClient client)
-        {
-            client.DefaultRequestHeaders.Add("Accept","application/vnd.github.v3+json");
-            client.DefaultRequestHeaders.Add("User-Agent", ApplicationName);
-            Client = client;
-
-            _gitHubClient = new GitHubClient(new ProductHeaderValue(ApplicationName));
-        }
-
-        public async Task<string> GetRepositoryTextFile(string url) => await Client.GetStringAsync(url);
-
-        public async Task<IReadOnlyList<RepositoryContent>> GetRepositoryContent(string username, string repo, string repoPath) =>await _gitHubClient.Repository.Content.GetAllContents(username, repo, repoPath);
-
-    }
-}
-
+using System.Net.Http;
+using System.Threading.Tasks;
+using Octokit;
+
+namespace ReadingList.Notes.Github.Services
+{
+    public class GithubClient
+    {
+        public HttpClient Client { get; }
+        private readonly IGitHubClient _gitHubClient;
+        private const string ApplicationName = "ReadingList.Notes";
+
+        public GithubClient(HttpClient client)
+        {
+            client.DefaultRequestHeaders.Add("Accept","application/vnd.github.v3+json");
+            client.DefaultRequestHeaders.Add("User-Agent", ApplicationName);
+            Client = client;
+
+            _gitHubClient = new GitHubClient(new ProductHeaderValue(ApplicationName));
+        }
+
+        public async Task<string> GetRepositoryTextFile(string url) => await Client.GetStringAsync(url);
+
+        public async Task<IReadOnlyList<RepositoryContent>> GetRepositoryContent(string username, string repo, string repoPath) =>
+            await _gitHubClient.Repository.Content.GetAllContents(username, repo, repoPath);
+
+    }
+}
+


english am i right

english am i right

--- RelhaxModpack/RelhaxModpack/Utils/Translations.cs
+++ RelhaxModpack/RelhaxModpack/Utils/Translations.cs
@@ -3981,7 +3981,7 @@

             //Component: CleanupModFilesButtonDescription
             //
-            English.Add("CleanupModFilesButtonDescription", "Deletes any mods located in locations like win32 and win64 that could be causing load conflicts");
+            English.Add("CleanupModFilesButtonDescription", "Deletes any mods located in folders like win32 and win64 that could be causing load conflicts");
             German.Add("CleanupModFilesButtonDescription", TranslationNeeded);
             Polish.Add("CleanupModFilesButtonDescription", TranslationNeeded);
             French.Add("CleanupModFilesButtonDescription", TranslationNeeded);


Fixing reflection issue in deserializer

Fixing reflection issue in deserializer

Using GetRuntimeMethod() wont work because it only looks for public
members.  Changed to a more brute force lookup

--- RestSharp.WinRT/Deserializers/JsonDeserializer.cs
+++ RestSharp.WinRT/Deserializers/JsonDeserializer.cs
@@ -21,7 +21,8 @@

         public object Deserialize(IRestResponse response, Type type)
         {
-            var methodInfo = this.GetType().GetRuntimeMethod("Deserialize", new Type[] { typeof(IRestResponse)} );
+            //Note: I think using GetRuntimeMethod here doesnt work because it only finds public members, so we have to be more brute force
+            var methodInfo = this.GetType().GetTypeInfo().DeclaredMethods.Where(m => m.Name == "Deserialize" && m.IsGenericMethod).FirstOrDefault();
             var genericMethod = methodInfo.MakeGenericMethod(type);
             var result = genericMethod.Invoke(this, new object[] { response });


Replaced uses of SortedList and SortedDictionary with Dictionary.
Modified for loops since ICollection.Count is O(1) in C# 2.0.

TODO:
Remove interfaces from return types, using ReadOnlyCollection when applicable.

--- Expression.cs
+++ Expression.cs
@@ -54,7 +54,7 @@
 		/// </summary>
 		protected string inFunction = ""; // Infix function.
 		protected string postFunction = ""; // Postfix function.
-        protected SortedDictionary<string, double> variables = new SortedDictionary<string, double>();
+        protected Dictionary<string, double> variables = new Dictionary<string, double>();
 		protected const double TRUE = 1;
 		protected const double FALSE = 0;
         protected string[] splitPostFunction;
@@ -1258,7 +1258,7 @@

             // Define "EvaluateD" function.
             //
-            Type[] args = { typeof(SortedDictionary<string, double>) };
+            Type[] args = { typeof(Dictionary<string, double>) };
             MethodBuilder evalMethodD = dynamicFunctionClass.DefineMethod(
                 "EvaluateD",
                 MethodAttributes.Public | MethodAttributes.Virtual,


Attempt to get coverage to 100%

Attempt to get coverage to 100%

--- ClassicBasic.Interpreter/Token.cs
+++ ClassicBasic.Interpreter/Token.cs
@@ -109,9 +109,9 @@
                     return _text;
                 case TokenClass.String:
                     return "\"" + _text + "\"";
-                default:
-                    return $"Unknown class {_tokenClass}";
             }
+
+            return $"Unknown class {_tokenClass}";
         }
     }
 }


maarten: redid the echolocation script, much more stable & safe

--- SeeingSoundwaves/Assets/Resources/EchoLocation.cs
+++ SeeingSoundwaves/Assets/Resources/EchoLocation.cs
@@ -6,101 +6,28 @@

 public class EchoLocation : MonoBehaviour {

-    public bool EnableEchoLocation = false;
+    public bool EnableEchoLocation = false;
+    public Texture2D ScreenshotTexture;
+    public Material ScreenshotMat;

 	// Use this for initialization
-	void Start () {
-        GetComponent<Camera>().depth = 0;
+	void Start () {
 	}
-
-    Texture2D previousFrame;
-    private bool takeHiResShot = false;

-    static int o = 0;
-
 	// Update is called once per frame
 	void Update () {
-
-        //Vector4 v = new Vector4(GetComponent<Camera>().transform.position.x, GetComponent<Camera>().transform.position.y, GetComponent<Camera>().transform.position.z, 0.0f);
-        //GameObject cu = GameObject.FindGameObjectWithTag("DebugCube");
-        //if (cu != null)
-        //{
-        //    Material mat = (Material)Resources.Load("distanceLerp", typeof(Material));
-
-        //    mat.SetVector("_CameraPosition", GetComponent<Camera>().transform.position);
-        //    mat.SetFloat("_CameraDistance", Vector4.Distance(v, cu.transform.position));
-        //}
-
-        if (Input.GetKeyDown(KeyCode.Space))
-        {
-            // = true;
-            TakeHiResShot();
-            //GetComponent<Camera>().enabled = false;
-        }
-
-        if(previousFrame != null)
-        {
-            byte[] fileData = File.ReadAllBytes(string.Format("{0}/screenshots/screen.png", Application.dataPath));
-            Texture2D tex = new Texture2D(2, 2);
-            tex.LoadImage(fileData);
-
-            GameObject.Find("Viewport").GetComponent<Renderer>().material.SetTexture("_MainTex", tex);
+        if(Input.GetKeyDown(KeyCode.F))
+        {
+            StartCoroutine(screenshotFunc());
         }
 	}

-
-
-    public static string ScreenShotName(int width, int height)
-    {
-        o++;
-
-        return string.Format("{0}/screenshots/screen.png", Application.dataPath);
-
-        //return string.Format("{0}/screenshots/screen_{1}_{2}.png",
-                             //Application.dataPath,
-                             //o,
-                             //(Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds);
-
-
-    }
-
-    public void TakeHiResShot()
-    {
-        takeHiResShot = EnableEchoLocation;
-    }
-
-    void LateUpdate()
-    {
-        takeHiResShot |= Input.GetKeyDown(KeyCode.Space);
-        if (takeHiResShot)
-        {
-            int resWidth = Screen.width;
-            int resHeight = Screen.height;
-
-            RenderTexture rt = new RenderTexture(resWidth, resHeight, 24);
-            GetComponent<Camera>().targetTexture = rt;
-
-            Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false);
-            GetComponent<Camera>().Render();
-
-            RenderTexture.active = rt;
-            screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
-
-            GetComponent<Camera>().targetTexture = null;
-            RenderTexture.active = null; // JC: added to avoid errors
-
-            previousFrame = screenShot;
-
-            Destroy(rt);
-
-            byte[] bytes = screenShot.EncodeToPNG();
-            string filename = ScreenShotName(resWidth, resHeight);
-
-            System.IO.File.WriteAllBytes(filename, bytes);
-
-            //Debug.Log(string.Format("Took screenshot to: {0}", filename));
-
-            takeHiResShot = false;
-        }
+    IEnumerator screenshotFunc()
+    {
+        yield return new WaitForEndOfFrame();
+        ScreenshotTexture = new Texture2D(Mathf.RoundToInt(Screen.width), Mathf.RoundToInt(Screen.height), TextureFormat.ARGB32, false);
+        ScreenshotTexture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false);
+        ScreenshotTexture.Apply();
+        ScreenshotMat.mainTexture = ScreenshotTexture;
     }
 }


Additional verified example

Additional verified example

Correctly calculates results for Example 7.3 from MATLAB Codes for
Finite Element Analysis.

--- SharpFE.Core.Tests/Examples/Beam/BeamIn2DModel.cs
+++ SharpFE.Core.Tests/Examples/Beam/BeamIn2DModel.cs
@@ -289,7 +289,7 @@

             Assert.AreEqual(0, node1Displacement.X, 0.0001);
             Assert.AreEqual(0, node1Displacement.Z, 0.0001);
-            Assert.AreEqual(0.00109, node1Displacement.YY, 0.0001);
+            Assert.AreEqual(0.0010985, node1Displacement.YY, 0.0001);

             Console.WriteLine(node1Reaction);
             Assert.AreEqual(-5000, node1Reaction.Z, 1);
@@ -305,7 +305,7 @@
         ///<summary>
         /// Example problem and results are derived from:
         /// MATLAB Codes for Finite Element Analysis, Solid Mechanics and its applications Volume 157, A.J.M. Ferreira, Springer 2010
-        /// Section 7.2, page 73
+        /// Section 7.2, page 91
         /// </summary>
         [Test]
         public void Calculate2DFrameOf3BeamsAnd12Dof()
@@ -366,5 +366,64 @@
             Assert.AreEqual(23284, node4Reaction.YY, 1); ///NOTE this value of 23284 does not match the example, but was verified using a commercial finite element software

         }
+
+        ///<summary>
+        /// Example problem and results are derived from:
+        /// MATLAB Codes for Finite Element Analysis, Solid Mechanics and its applications Volume 157, A.J.M. Ferreira, Springer 2010
+        /// Section 7.3, page 95
+        /// </summary>
+        [Test]
+        public void Calculate2DPortalFrameOf3BeamsAnd12Dof()
+        {
+            FiniteElementModel model = new FiniteElementModel(ModelType.Frame2D);
+            FiniteElementNode node1 = model.NodeFactory.CreateFor2DTruss(-3, 0);
+            model.ConstrainNode(node1, DegreeOfFreedom.X);
+            model.ConstrainNode(node1, DegreeOfFreedom.Z);
+            model.ConstrainNode(node1, DegreeOfFreedom.YY);
+
+            FiniteElementNode node2 = model.NodeFactory.CreateFor2DTruss(-3, 6);
+
+            FiniteElementNode node3 = model.NodeFactory.CreateFor2DTruss(3, 6);
+
+            FiniteElementNode node4 = model.NodeFactory.CreateFor2DTruss(3, 0);
+            model.ConstrainNode(node4, DegreeOfFreedom.X);
+            model.ConstrainNode(node4, DegreeOfFreedom.Z);
+            model.ConstrainNode(node4, DegreeOfFreedom.YY);
+
+            IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 0);
+            ICrossSection section = new GenericCrossSection(0.0002, 0.0002);
+
+            model.ElementFactory.CreateLinear1DBeam(node1, node2, material, section);
+            model.ElementFactory.CreateLinear1DBeam(node2, node3, material, section);
+            model.ElementFactory.CreateLinear1DBeam(node3, node4, material, section);
+
+            ForceVector force2 = model.ForceFactory.Create(15000, 0, 0, 0, -10000, 0);
+            model.ApplyForceToNode(force2, node2);
+
+            IFiniteElementSolver solver = new LinearSolverSVD(model);
+            FiniteElementResults results = solver.Solve();
+
+            DisplacementVector node2Displacement = results.GetDisplacement(node2);
+            DisplacementVector node3Displacement = results.GetDisplacement(node3);
+            ReactionVector node1Reaction = results.GetReaction(node1);
+            ReactionVector node4Reaction = results.GetReaction(node4);
+
+            Assert.AreEqual(0.0052843, node2Displacement.X, 0.0001);
+            Assert.AreEqual(0.0006522, node2Displacement.Z, 0.0001);
+            Assert.AreEqual(0.0005, node2Displacement.YY, 0.0001);
+
+            Assert.AreEqual(0.0044052, node3Displacement.X, 0.0001);
+            Assert.AreEqual(-0.0006522, node3Displacement.Z, 0.0001);
+            Assert.AreEqual(0.0006, node3Displacement.YY, 0.0001);
+
+            Assert.AreEqual(-9000, node1Reaction.X, 500);
+            Assert.AreEqual(-5000, node1Reaction.Z, 500);
+            Assert.AreEqual(-30022, node1Reaction.YY, 500);
+
+            Console.WriteLine(node4Reaction);
+            Assert.AreEqual(-6000, node4Reaction.X, 500);
+            Assert.AreEqual(5000, node4Reaction.Z, 500);
+            Assert.AreEqual(-22586, node4Reaction.YY, 500);
+        }
     }
 }


Made Bounds an extension of IShipconstruct.

--- Extensions.cs
+++ Extensions.cs
@@ -764,12 +764,12 @@
 			construct.Clear();
 		}

-		public static Bounds Bounds(this Vessel vessel, Transform refT)
+        public static Bounds Bounds(this IShipconstruct vessel, Transform refT)
 		{
 			//update physical bounds
 			var b = new Bounds();
 			bool inited = false;
-			var parts = vessel.parts;
+			var parts = vessel.Parts;
 			for(int i = 0, partsCount = parts.Count; i < partsCount; i++)
 			{
 				Part p = parts[i];


Removed unused file

Removed unused file

--- WFS210.UI/ScopeDataView.cs
+++ WFS210.UI/ScopeDataView.cs
@@ -1,39 +0,0 @@
-using System;
-using MonoTouch.UIKit;
-using System.Drawing;
-using MonoTouch.CoreGraphics;
-
-namespace WFS210.UI
-{
-	public class ScopeDataView : UIView
-	{
-		public CGPath Path {get; set;}
-		public ScopeDataView ()
-		{
-			Path = new CGPath ();
-		}
-
-		/// <summary>
-		/// Draws on the specified rect.
-		/// </summary>
-		/// <param name="rect">Rect.</param>
-		public override void Draw (RectangleF rect)
-		{
-			base.Draw (rect);
-
-			//get graphics context
-			using (CGContext g = UIGraphics.GetCurrentContext ()) {
-				//set up drawing attributes
-				g.SetLineWidth (1);
-				UIColor.Red.SetStroke ();
-
-				//add geometry to graphics context and draw it
-				g.AddPath (Path);
-				g.DrawPath (CGPathDrawingMode.Stroke);
-
-			}
-		}
-
-	}
-}
-


Fix race condition. This was spotted by Petr Hosek. Thanks Petr!

We were closing stdin from an asynchronous event
handler. This is dangerous because we really don't know when this
handler will be called and in fact when using lit to run symbooglix in
parallel it caused the following scenario to happen

1. doQuery()
- Call PrintCheckSat()

2. Event handler interruption OutputHandler(), receives "sat|...", we close
stdin

3. Event handler called again (OutputHandler), receives "" (empty string),
we try to close stdin again

4. Control returns to somewhere in PrintCheckSat() or above in the call stack
and somewhere in the code it continues to try and use stdin even though we've
closed it.

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at System.IO.StreamWriter.FlushCore () [0x00018] in /build/mono/src/mono-3.2.8/mcs/class/corlib/System.IO/StreamWriter.cs:204
  at System.IO.StreamWriter.Write (System.Char[] buffer) [0x00022] in /build/mono/src/mono-3.2.8/mcs/class/corlib/System.IO/StreamWriter.cs:390
  at System.IO.TextWriter.WriteLine () [0x00000] in /build/mono/src/mono-3.2.8/mcs/class/corlib/System.IO/TextWriter.cs:257
  at System.IO.TextWriter.WriteLine (System.String value) [0x00007] in /build/mono/src/mono-3.2.8/mcs/class/corlib/System.IO/TextWriter.cs:317
  at symbooglix.SMTLIBQueryPrinter.printCheckSat () [0x00011] in /home/dsl11/dev/symbooglix/symbooglix/symbooglix/symbooglix/Expr/SMTLIBQueryPrinter.cs:183
  at symbooglix.Solver.SimpleSMTLIBSolver.doQuery (Microsoft.Boogie.Expr QueryToPrint) [0x00093] in /home/dsl11/dev/symbooglix/symbooglix/symbooglix/symbooglix/Core/Solver/SimpleSMTLIBSolver.cs:109
  at symbooglix.Solver.SimpleSMTLIBSolver.IsQuerySat (Microsoft.Boogie.Expr Query) [0x00003] in /home/dsl11/dev/symbooglix/symbooglix/symbooglix/symbooglix/Core/Solver/SimpleSMTLIBSolver.cs:74
  at symbooglix.Executor.enterProcedure (Microsoft.Boogie.Implementation Impl, System.Collections.Generic.List`1 procedureParams, symbooglix.Executor executor) [0x00273] in /home/dsl11/dev/symbooglix/symbooglix/
symbooglix/symbooglix/Core/Executor.cs:374
  at symbooglix.Executor.run (Microsoft.Boogie.Implementation entryPoint) [0x00035] in /home/dsl11/dev/symbooglix/symbooglix/symbooglix/symbooglix/Core/Executor.cs:195
  at symbooglix.driver.Main (System.String[] args) [0x002af] in /home/dsl11/dev/symbooglix/symbooglix/symbooglix/symbooglix/driver.cs:209

--- symbooglix/symbooglix/Core/Solver/SimpleSMTLIBSolver.cs
+++ symbooglix/symbooglix/Core/Solver/SimpleSMTLIBSolver.cs
@@ -146,7 +146,6 @@
                 }

                 Printer.printExit();
-                ( sendingProcess as Process ).StandardInput.Close();
             }

             private void ErrorHandler(object sendingProcess, DataReceivedEventArgs  stderrLine)


Timeout no longer disposable

Timeout no longer disposable

--- Core/Theraot/Threading/Timeout.cs
+++ Core/Theraot/Threading/Timeout.cs
@@ -5,7 +5,7 @@

 namespace Theraot.Core.Threading
 {
-    public class Timeout : IDisposable, IPromise
+    public class Timeout : IPromise
     {
         private static readonly HashSet<Timeout> _root;

@@ -46,7 +46,7 @@
             {
                 _callback = callback;
                 _wrapped = new Timer(Callback, null, dueTime, System.Threading.Timeout.Infinite);
-                token.Register(Dispose);
+                token.Register(Cancel);
             }
             _hashcode = unchecked((int)DateTime.Now.Ticks);
         }
@@ -65,7 +65,7 @@

         ~Timeout()
         {
-            Dispose();
+            Cancel();
         }

         Exception IPromise.Exception
@@ -134,7 +134,7 @@
             Change((long)dueTime.TotalMilliseconds);
         }

-        public void Dispose()
+        public void Cancel()
         {
             var wrapped = Interlocked.Exchange(ref _wrapped, null);
             if (wrapped != null)
@@ -165,7 +165,7 @@
             GC.KeepAlive(state);
             _callback.Invoke();
             _completed = true;
-            Dispose();
+            Cancel();
         }
     }
 }


Fix a problem on the specification of transition of S2

--- CreviceApp/Core.FSM.Transition.cs
+++ CreviceApp/Core.FSM.Transition.cs
@@ -187,7 +187,7 @@
         // This transition has one side effect.
         // 1. Functions given as the parameter of `@do` clause of StrokeGestureDefinition are executed.

-        // Transition 2_2 (default gesture established)
+        // Transition 2_3 (default gesture established)
         //
         // State2 -> State0
         //
@@ -195,14 +195,6 @@
         // This transition happens when `release` event of primary double action mouse button is given and
         // there have not been any actions executed.
         // 1. Functions given as the parameter of `@do` clause of IfButtonGestureDefinition are executed.
-
-        // Transition 2_3 (gesture end)
-        //
-        // State2 -> State0
-        //
-        // Transition from the state(S2) to the state(S0).
-        // This transition happends when `release` event of primary double action mouse button is given.
-        // This transition has no side effect.

         // Transition 2_4 (forced reset)
         //


fix format

fix format

--- android/Andrule/Andrule/Views/Tabs/SetupActivity.cs
+++ android/Andrule/Andrule/Views/Tabs/SetupActivity.cs
@@ -74,7 +74,7 @@

         private void SendData(IReadOnlyList<int> sensorData)
         {
-            netWorkHelper.Send(string.Format("^{0}|{1}|{2}|1|1|1$", sensorData[0], sensorData[1], sensorData[2]));
+            netWorkHelper.Send(string.Format("^{0}|{1}|{2}|1|1|1|1$", sensorData[0], sensorData[1], sensorData[2]));
         }

         public void OnSensorChanged(SensorEvent e)


some spotter error checking

some spotter error checking

--- CrewChiefV3/PCars/PCarsSpotter.cs
+++ CrewChiefV3/PCars/PCarsSpotter.cs
@@ -169,7 +169,9 @@
             if (enabled && currentState.mParticipantData.Count() > 1 && currentState.mViewedParticipantIndex >= 0)
             {
                 pCarsAPIParticipantStruct playerData = currentState.mParticipantData[currentState.mViewedParticipantIndex];
-                if (playerData.mWorldPosition[0] == 0 || playerData.mWorldPosition[2] == 0 || playerData.mWorldPosition[0] == -1 || playerData.mWorldPosition[2] == -1)
+                float playerX = playerData.mWorldPosition[0];
+                float playerY = playerData.mWorldPosition[2];
+                if (playerX == 0 || playerY == 0 || playerX == -1 || playerY == -1)
                 {
                     return;
                 }
@@ -189,15 +191,26 @@
                         if (i != currentState.mViewedParticipantIndex)
                         {
                             pCarsAPIParticipantStruct opponentData = currentState.mParticipantData[i];
-                            pCarsAPIParticipantStruct previousOpponentData = lastState.mParticipantData[PCarsGameStateMapper.getPreviousOpponentIndex(lastState.mParticipantData, i, opponentData.mName)];
+                            int prevOpponentIndex = PCarsGameStateMapper.getPreviousOpponentIndex(lastState.mParticipantData, i, opponentData.mName);
+                            float previousOpponentX = 0;
+                            float previousOpponentY = 0;
+                            if (prevOpponentIndex != -1)
+                            {
+                                pCarsAPIParticipantStruct previousOpponentData = lastState.mParticipantData[prevOpponentIndex];
+                                previousOpponentX = previousOpponentData.mWorldPosition[0];
+                                previousOpponentY = previousOpponentData.mWorldPosition[2];
+                            }
+                            float currentOpponentX = opponentData.mWorldPosition[0];
+                            float currentOpponentY = opponentData.mWorldPosition[2];
+
                             if (opponentData.mIsActive) {
-                                if (opponentData.mWorldPosition[0] != 0 && opponentData.mWorldPosition[2] != 0 &&
-                                        opponentData.mWorldPosition[0] != -1 && opponentData.mWorldPosition[2] != -1 &&
-                                    previousOpponentData.mWorldPosition[0] != 0 && previousOpponentData.mWorldPosition[2] != 0 &&
-                                        previousOpponentData.mWorldPosition[0] != -1 && previousOpponentData.mWorldPosition[2] != -1 &&
-                                    opponentIsRacing(opponentData, previousOpponentData, playerData, previousPlayerData))
+                                if (currentOpponentX != 0 && currentOpponentY != 0 &&
+                                        currentOpponentX != -1 && currentOpponentY != -1 &&
+                                    previousOpponentX != 0 && previousOpponentY != 0 &&
+                                        previousOpponentX != -1 && previousOpponentY != -1 &&
+                                    opponentIsRacing(currentOpponentX, currentOpponentY, previousOpponentX, previousOpponentY, playerData, previousPlayerData))
                                 {
-                                    Side side = getSide(currentState.mOrientation[1], playerData.mWorldPosition, opponentData.mWorldPosition);
+                                    Side side = getSide(currentState.mOrientation[1], playerX, playerY, currentOpponentX, currentOpponentY);
                                     if (side == Side.left)
                                     {
                                         carsOnLeft++;
@@ -295,17 +308,17 @@
             }
         }

-        private Boolean opponentIsRacing(pCarsAPIParticipantStruct opponentData, pCarsAPIParticipantStruct previousOpponentData,
+        private Boolean opponentIsRacing(float currentOpponentX, float currentOpponentY, float previousOpponentX, float previousOpponentY,
             pCarsAPIParticipantStruct playerData, pCarsAPIParticipantStruct previousPlayerData)
         {
-            float deltaX = Math.Abs(opponentData.mWorldPosition[0] - playerData.mWorldPosition[0]);
-            float deltaY = Math.Abs(opponentData.mWorldPosition[2] - playerData.mWorldPosition[2]);
+            float deltaX = Math.Abs(currentOpponentX - playerData.mWorldPosition[0]);
+            float deltaY = Math.Abs(currentOpponentY - playerData.mWorldPosition[2]);
             if (deltaX > trackWidth || deltaY > trackWidth)
             {
                 return false;
             }
-            float opponentVelocityX = Math.Abs(opponentData.mWorldPosition[0] - previousOpponentData.mWorldPosition[0]) / intervalSeconds;
-            float opponentVelocityY = Math.Abs(opponentData.mWorldPosition[2] - previousOpponentData.mWorldPosition[2]) / intervalSeconds;
+            float opponentVelocityX = Math.Abs(currentOpponentX - previousOpponentX) / intervalSeconds;
+            float opponentVelocityY = Math.Abs(currentOpponentY - previousOpponentY) / intervalSeconds;
             // hard code this - if the opponent car is going < 4m/s on both axis we're not interested
             if (opponentVelocityX < 4 && opponentVelocityY < 4)
             {
@@ -569,10 +582,10 @@
             }
         }

-        private Side getSide(float playerRotation, float[] playerWorldPosition, float[] opponentWorldPosition)
-        {
-            float rawXCoordinate = opponentWorldPosition[0] - playerWorldPosition[0];
-            float rawYCoordinate = opponentWorldPosition[2] - playerWorldPosition[2];
+        private Side getSide(float playerRotation, float playerX, float playerY, float oppponentX, float opponentY)
+        {
+            float rawXCoordinate = oppponentX - playerX;
+            float rawYCoordinate = opponentY - playerY;
             if (playerRotation < 0)
             {
                 playerRotation = (float)(2 * Math.PI) + playerRotation;


Remove semicolon

Remove semicolon

--- Web/ConsolRHandler.ashx.cs
+++ Web/ConsolRHandler.ashx.cs
@@ -35,7 +35,6 @@
 					context.Response.WriteFile("~/assets/consolr/index.html");
 					break;
 				case "/consolr/validate":
-					;
 					context.Response.ContentType = "application/json";
 					context.Response.Write(GetValidationResult(context));
 					break;


Sorted using statements.

Sorted using statements.

--- DDay.iCal/DataTypes/StatusCode.cs
+++ DDay.iCal/DataTypes/StatusCode.cs
@@ -1,10 +1,10 @@
 using System;
 using System.Collections;
+using System.IO;
+using System.Runtime.Serialization;
 using System.Text;
 using System.Text.RegularExpressions;
-using System.Runtime.Serialization;
 using DDay.iCal.Serialization;
-using System.IO;
 using DDay.iCal.Serialization.iCalendar;

 namespace DDay.iCal


Update DataBuffer.cs

Update DataBuffer.cs

modified process method

--- DHSignalIllustrator/DataBuffer.cs
+++ DHSignalIllustrator/DataBuffer.cs
@@ -130,61 +130,7 @@

         private void processSignalBuffer(int[,] signalBuffer, int row, int col)
         {
-            int total, temp;
-            int moveValidation = 0;
-            int validatioeRecord = 0;
-
-            for (int j = 0; j < col; j++)
-            {
-                total = 0;
-                for (int i = 0; i < row; i++)
-                {
-                    total += signalBuffer[i,j];//Sum up.
-                    if(i == 2)
-                    {
-                        resultBuffer[j] = signalBuffer[i, j];//Get initial value. The 3rd value of all 5 values.
-                    }
-                }
-
-                //Calculate background value.
-                temp = resultBuffer[j] - (total / row);
-
-                //Filter noise.
-                temp = (temp > filterMin && temp < filterMax) ? 1 : 0;
-                //temp = (temp < 1000) ? 0 : temp;
-                resultBuffer[j] = resultBuffer[j] * temp;
-
-                //Validation check.
-                if (temp != 0)
-                {
-                    moveValidation++;
-                    if (moveValidation > validatioeRecord)
-                    {
-                        validatioeRecord = moveValidation;
-                    }
-                }
-                else
-                {
-                    moveValidation = 0;
-                }
-            }
-
-            //Clear unwanted points.
-            if (validatioeRecord > 4)
-            {
-                for (int j = 0; j < col + 1; j++)
-                {
-                    resultBuffer[j] = 0;
-                }
-                //isSameRegionPeak = false;
-            } else if (validatioeRecord > 0) // && !isSameRegionPeak)
-            {
-                //isSameRegionPeak = true;
-                drawer.moveCount++;
-            }
-
-            //Draw points
-            //drawer.drawResultPoints(resultBuffer);
+            //Process the data here.

             //Cache points for 3D chart.
             drawer.cache3DData(resultBuffer);


Update CosmosVFS.cs

Update CosmosVFS.cs

--- source/Cosmos.System2/FileSystem/CosmosVFS.cs
+++ source/Cosmos.System2/FileSystem/CosmosVFS.cs
@@ -458,7 +458,7 @@
         /// <exception cref="ArgumentOutOfRangeException">Thrown when root directory address is smaller then root directory address.</exception>
         public override DirectoryEntry GetVolume(string aPath)
         {
-            if (string.IsNullOrEmpty(aPath))
+            if (String.IsNullOrEmpty(aPath))
             {
                 return null;
             }
@@ -526,7 +526,9 @@
             var xEntry = DoGetDirectoryEntry(aPath, xFileSystem);

             if (xEntry == null)
+            {
                 throw new Exception($"{aPath} is neither a file neither a directory");
+            }

             switch (xEntry.mEntryType)
             {


Done NetworkStack api docs

Done NetworkStack api docs

--- source/Cosmos.System2/Network/NetworkStack.cs
+++ source/Cosmos.System2/Network/NetworkStack.cs
@@ -13,14 +13,20 @@
     /// </summary>
     public static class NetworkStack
     {
-
+        /// <summary>
+        /// Debugger inctanse of the "System" ring, with the "NetworkStack" tag.
+        /// </summary>
         public static Debugger debugger = new Debugger("System", "NetworkStack");

+        /// <summary>
+        /// Get address dictionary.
+        /// </summary>
         internal static TempDictionary<NetworkDevice> AddressMap { get; private set; }

         /// <summary>
-        /// Initialize the Network Stack to prepare it for operation
+        /// Initialize the Network Stack to prepare it for operation.
         /// </summary>
+        /// <exception cref="ArgumentOutOfRangeException">Thrown on fatal error (contact support).</exception>
         public static void Init()
         {
             AddressMap = new TempDictionary<NetworkDevice>();
@@ -42,8 +48,17 @@
         /// <remarks>Multiple IP Configurations can be made, like *nix environments</remarks>
         /// </summary>
         /// <param name="nic"><see cref="NetworkDevice"/> that will have the assigned configuration</param>
-        /// <param name="config"><see cref="IPV4.Config"/> instance that defines the IP Address, Subnet
+        /// <param name="config"><see cref="Config"/> instance that defines the IP Address, Subnet
         /// Mask and Default Gateway for the device</param>
+        /// <exception cref="ArgumentException">
+        /// <list type="bullet">
+        /// <item>Thrown if configuration with the given config.IPAddress.Hash already exists.</item>
+        /// <item>Thrown on fatal error (contact support).</item>
+        /// </list>
+        /// </exception>
+        /// <exception cref="ArgumentOutOfRangeException">Thrown on fatal error (contact support).</exception>
+        /// <exception cref="Sys.IO.IOException">Thrown on IO error.</exception>
+        /// <exception cref="OverflowException">Thrown on fatal error (contact support).</exception>
         public static void ConfigIP(NetworkDevice nic, Config config)
         {
             AddressMap.Add(config.IPAddress.Hash, nic);
@@ -51,6 +66,14 @@
             nic.DataReceived = HandlePacket;
         }

+        /// <summary>
+        /// Handle packet.
+        /// </summary>
+        /// <param name="packetData">Packet data array.</param>
+        /// <exception cref="ArgumentOutOfRangeException">Thrown on fatal error (contact support).</exception>
+        /// <exception cref="Sys.IO.IOException">Thrown on IO error.</exception>
+        /// <exception cref="ArgumentException">Thrown on fatal error (contact support).</exception>
+        /// <exception cref="OverflowException">Thrown on fatal error (contact support).</exception>
         internal static void HandlePacket(byte[] packetData)
         {
             debugger.Send("Packet Received Length=" + packetData.Length.ToString());
@@ -75,6 +98,9 @@
         /// <summary>
         /// Called continously to keep the Network Stack going.
         /// </summary>
+        /// <exception cref="ArgumentException">Thrown on fatal error (contact support).</exception>
+        /// <exception cref="ArgumentOutOfRangeException">Thrown on memory error.</exception>
+        /// <exception cref="OverflowException">Thrown if data length of any packet in the queue is bigger than Int32.MaxValue.</exception>
         public static void Update()
         {
             OutgoingBuffer.Send();


fixed GetDatabase method such that it ignores any deleted spreadsheets

--- GDataDB/DatabaseClient.cs
+++ GDataDB/DatabaseClient.cs
@@ -1,41 +1,51 @@
-using System;
-using System.IO;
-using GDataDB.Impl;
-using Google.GData.Client;
-using Google.GData.Documents;
-using Google.GData.Spreadsheets;
-using SpreadsheetQuery=Google.GData.Documents.SpreadsheetQuery;
-
-namespace GDataDB {
-	public class DatabaseClient : IDatabaseClient {
-		public IService DocumentService { get; set;}
-		public IService SpreadsheetService { get; set; }
-
-		public DatabaseClient(string username, string password) {
-			var docService = new DocumentsService("database");
-			docService.setUserCredentials(username, password);
-			DocumentService = docService;
-
-			var ssService = new SpreadsheetsService("database");
-			ssService.setUserCredentials(username, password);
-			SpreadsheetService = ssService;
-		}
-
-		public IDatabase CreateDatabase(string name) {
-			using (var ms = new MemoryStream()) {
-				using (var sw = new StreamWriter(ms)) {
-					sw.WriteLine(",,,");
-					var spreadSheet = DocumentService.Insert(new Uri(DocumentsListQuery.documentsBaseUri), ms, "text/csv", name);
-					return new Database(SpreadsheetService, spreadSheet);
-				}
-			}
-		}
-
-		public IDatabase GetDatabase(string name) {
-			var feed = DocumentService.Query(new SpreadsheetQuery {TitleExact = true, Title = name});
-			if (feed.Entries.Count == 0)
-				return null;
-			return new Database(SpreadsheetService, feed.Entries[0]);
-		}
-	}
+using System;
+using System.IO;
+using GDataDB.Impl;
+using Google.GData.Client;
+using Google.GData.Documents;
+using Google.GData.Spreadsheets;
+using SpreadsheetQuery=Google.GData.Documents.SpreadsheetQuery;
+
+namespace GDataDB {
+	public class DatabaseClient : IDatabaseClient {
+        	private readonly IService documentService;
+        	private readonly IService spreadsheetService;
+
+        	public IService DocumentService
+        	{
+            		get { return documentService; }
+        	}
+
+        	public IService SpreadsheetService
+        	{
+            		get { return spreadsheetService; }
+        	}
+
+		public DatabaseClient(string username, string password) {
+			var docService = new DocumentsService("database");
+			docService.setUserCredentials(username, password);
+			DocumentService = docService;
+
+			var ssService = new SpreadsheetsService("database");
+			ssService.setUserCredentials(username, password);
+			SpreadsheetService = ssService;
+		}
+
+		public IDatabase CreateDatabase(string name) {
+			using (var ms = new MemoryStream()) {
+				using (var sw = new StreamWriter(ms)) {
+					sw.WriteLine(",,,");
+					var spreadSheet = DocumentService.Insert(new Uri(DocumentsListQuery.documentsBaseUri), ms, "text/csv", name);
+					return new Database(SpreadsheetService, spreadSheet);
+				}
+			}
+		}
+
+		public IDatabase GetDatabase(string name) {
+			var feed = DocumentService.Query(new SpreadsheetQuery {TitleExact = true, Title = name,  ShowDeleted = false });
+			if (feed.Entries.Count == 0)
+				return null;
+			return new Database(SpreadsheetService, feed.Entries[0]);
+		}
+	}
 }


3.1 targeting pack support in update-dependencies tool (#3791)

(cherry picked from commit f303428e35807e297826267f0a30f0376ab2f096)

--- eng/update-dependencies/DockerfileShaUpdater.cs
+++ eng/update-dependencies/DockerfileShaUpdater.cs
@@ -73,7 +73,9 @@
                     new string[]
                     {
                         $"$DOTNET_BASE_URL/Runtime/$VERSION_DIR/dotnet-targeting-pack-$VERSION_FILE-$ARCH.$ARCHIVE_EXT",
-                        $"$DOTNET_BASE_URL/Runtime/$DF_VERSION.0/dotnet-targeting-pack-$DF_VERSION.0-$ARCH.$ARCHIVE_EXT"
+                        $"$DOTNET_BASE_URL/Runtime/$DF_VERSION.0/dotnet-targeting-pack-$DF_VERSION.0-$ARCH.$ARCHIVE_EXT",
+                        // Fallback for legacy targeting pack versions (not needed for > 3.1)
+                        $"https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DF_VERSION.0/dotnet-targeting-pack-$DF_VERSION.0-$ARCH.$ARCHIVE_EXT"
                     }
                 },
                 { "runtime-apphost-pack", new string[] { $"$DOTNET_BASE_URL/Runtime/$VERSION_DIR/dotnet-apphost-pack-$VERSION_FILE-$ARCH.$ARCHIVE_EXT" } },
@@ -86,7 +88,9 @@
                     new string[]
                     {
                         $"$DOTNET_BASE_URL/aspnetcore/Runtime/$VERSION_DIR/aspnetcore-targeting-pack-$VERSION_FILE{GetAspnetTargetingPackArchFormat()}.$ARCHIVE_EXT",
-                        $"$DOTNET_BASE_URL/aspnetcore/Runtime/$DF_VERSION.0/aspnetcore-targeting-pack-$DF_VERSION.0{GetAspnetTargetingPackArchFormat()}.$ARCHIVE_EXT"
+                        $"$DOTNET_BASE_URL/aspnetcore/Runtime/$DF_VERSION.0/aspnetcore-targeting-pack-$DF_VERSION.0{GetAspnetTargetingPackArchFormat()}.$ARCHIVE_EXT",
+                        // Fallback for legacy targeting pack versions (not needed for > 3.1)
+                        $"https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/$DF_VERSION.0/aspnetcore-targeting-pack-$DF_VERSION.0{GetAspnetTargetingPackArchFormat()}.$ARCHIVE_EXT"
                     }
                 },


Add paragraph to Do extension method

Add paragraph to Do extension method

Former-commit-id: ad111e4ae094ec854da4ff635a2147bd3e08ae5c

--- GeneratorAPI/Generator.cs
+++ GeneratorAPI/Generator.cs
@@ -135,6 +135,8 @@

         /// <summary>
         ///     <para>Exposes TSource in <see cref=" IGenerator<TSource>"/></para>
+        ///     <para>Using methods such as <see cref="Skip{T}"/> or <see cref="Release{TSource}"/> before this method </para>
+        ///     <para>Results in that they will be seen in the <see cref=" Action<TSource>"/></para>
         /// </summary>
         public static IGenerator<TSource> Do<TSource>(this IGenerator<TSource> generator, Action<TSource> action) {
             if (action == null) throw new ArgumentNullException(nameof(action));


Remove an unused file

Remove an unused file

--- Dev/Editor/EffekseerMP/Default.cs
+++ Dev/Editor/EffekseerMP/Default.cs
@@ -1,228 +0,0 @@
-
-public class Script
-{
-    public static string UniqueName
-    {
-        get
-        {
-            return "Default";
-        }
-    }
-
-    public static string Author
-    {
-        get
-        {
-            return "Default";
-        }
-    }
-
-    public static string Title
-    {
-        get
-        {
-            if(Effekseer.Core.Language == Effekseer.Language.Japanese) return "標準形式";
-            return "Default format";
-        }
-    }
-
-    public static string Description
-    {
-        get
-        {
-            if(Effekseer.Core.Language == Effekseer.Language.Japanese) return "標準形式で出力する。";
-            return "Export as default format";
-        }
-    }
-
-    public static string Filter
-    {
-        get
-        {
-            if(Effekseer.Core.Language == Effekseer.Language.Japanese) return "標準形式 (*.efk)|*.efk";
-            return "Default format (*.efk)|*.efk";
-        }
-    }
-
-    public static void Call(string path)
-    {
-        var window = new Magnification();
-        window.Show(path);
-    }
-
-    class Magnification : Effekseer.GUI.IRemovableControl
-    {
-        string title = string.Empty;
-        string message = string.Empty;
-        string id = "###magnification";
-
-        bool opened = true;
-
-        bool isFirstUpdate = true;
-
-        string path = string.Empty;
-        float[] mag = new float[1];
-
-        public bool ShouldBeRemoved { get; private set; } = false;
-
-        public void Show(string path)
-        {
-            this.title = "Maginification";
-            this.path = path;
-            mag[0] = Effekseer.Core.Option.ExternalMagnification.GetValue();
-            Effekseer.GUI.Manager.AddControl(this);
-        }
-
-        public void Update()
-        {
-            if (isFirstUpdate)
-            {
-                Effekseer.GUI.Manager.NativeManager.OpenPopup(id);
-                isFirstUpdate = false;
-            }
-
-            if (Effekseer.GUI.Manager.NativeManager.BeginPopupModal(title + id, ref opened, Effekseer.swig.WindowFlags.AlwaysAutoResize))
-            {
-                if (Effekseer.GUI.Manager.NativeManager.DragFloat("Magnification", mag, 0.1f, 0, float.MaxValue))
-                {
-
-                }
-
-
-                if (Effekseer.GUI.Manager.NativeManager.Button("Save"))
-                {
-                    var binary = Effekseer.Binary.Exporter.Export(mag[0]);
-                    System.IO.File.WriteAllBytes(path, binary);
-                    Effekseer.Core.Option.ExternalMagnification.SetValue(mag[0]);
-                    ShouldBeRemoved = true;
-                }
-
-                if (Effekseer.GUI.Manager.NativeManager.Button("Cancel"))
-                {
-                    ShouldBeRemoved = true;
-                }
-
-                Effekseer.GUI.Manager.NativeManager.EndPopup();
-            }
-            else
-            {
-                ShouldBeRemoved = true;
-            }
-        }
-    }
-
-
-    /*
-    partial class magnification : System.Windows.Forms.Form
-    {
-        private System.ComponentModel.IContainer components = null;
-
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        private void InitializeComponent()
-        {
-            this.lbl_mag = new System.Windows.Forms.Label();
-            this.txt_magnification = new System.Windows.Forms.TextBox();
-            this.btn_ok = new System.Windows.Forms.Button();
-            this.btn_cancel = new System.Windows.Forms.Button();
-            this.SuspendLayout();
-            //
-            // lbl_mag
-            //
-            this.lbl_mag.AutoSize = true;
-            this.lbl_mag.Location = new System.Drawing.Point(12, 9);
-            this.lbl_mag.Name = "lbl_mag";
-            this.lbl_mag.Size = new System.Drawing.Size(29, 12);
-            this.lbl_mag.TabIndex = 0;
-            this.lbl_mag.Text = "Magnification";
-            if(Effekseer.Core.Language == Effekseer.Language.Japanese) this.lbl_mag.Text = "倍率";
-            //
-            // txt_magnification
-            //
-            this.txt_magnification.Location = new System.Drawing.Point(90, 6);
-            this.txt_magnification.Name = "txt_magnification";
-            this.txt_magnification.Size = new System.Drawing.Size(100, 19);
-            this.txt_magnification.TabIndex = 1;
-            this.txt_magnification.Text = Effekseer.Core.Option.ExternalMagnification.Value.ToString();
-            //
-            // btn_ok
-            //
-            this.btn_ok.Location = new System.Drawing.Point(12, 29);
-            this.btn_ok.Name = "btn_ok";
-            this.btn_ok.Size = new System.Drawing.Size(70, 23);
-            this.btn_ok.TabIndex = 2;
-            this.btn_ok.Text = "Save";
-            if(Effekseer.Core.Language == Effekseer.Language.Japanese) this.btn_ok.Text = "保存";
-            this.btn_ok.UseVisualStyleBackColor = true;
-            this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
-            //
-            // btn_cancel
-            //
-            this.btn_cancel.Location = new System.Drawing.Point(88, 29);
-            this.btn_cancel.Name = "btn_cancel";
-            this.btn_cancel.Size = new System.Drawing.Size(70, 23);
-            this.btn_cancel.TabIndex = 3;
-            this.btn_cancel.Text = "Cancel";
-            if(Effekseer.Core.Language == Effekseer.Language.Japanese) this.btn_cancel.Text = "キャンセル";
-            this.btn_cancel.UseVisualStyleBackColor = true;
-            this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
-            //
-            // magnification
-            //
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(184, 62);
-            this.ControlBox = false;
-            this.Controls.Add(this.btn_cancel);
-            this.Controls.Add(this.btn_ok);
-            this.Controls.Add(this.txt_magnification);
-            this.Controls.Add(this.lbl_mag);
-            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
-            this.Name = "magnification";
-            this.Text = "Magnification";
-            if(Effekseer.Core.Language == Effekseer.Language.Japanese) this.Text = "倍率";
-            this.ResumeLayout(false);
-            this.PerformLayout();
-
-        }
-
-        private System.Windows.Forms.Label lbl_mag;
-        private System.Windows.Forms.TextBox txt_magnification;
-        private System.Windows.Forms.Button btn_ok;
-        private System.Windows.Forms.Button btn_cancel;
-
-        public magnification(string path)
-        {
-            InitializeComponent();
-            this.path = path;
-            this.Size = new System.Drawing.Size(270, 120);
-        }
-
-        string path;
-
-        private void btn_ok_Click(object sender, System.EventArgs e)
-        {
-            float mag = 1.0f;
-            if (float.TryParse(txt_magnification.Text, out mag))
-            {
-                var binary = Effekseer.Binary.Exporter.Export(mag);
-                System.IO.File.WriteAllBytes(path, binary);
-                Effekseer.Core.Option.ExternalMagnification.SetValue(mag);
-                Close();
-            }
-        }
-
-        private void btn_cancel_Click(object sender, System.EventArgs e)
-        {
-            Close();
-        }
-    }
-    */
-}


Preliminary support for range-based searching.

--- DiffLib/LongestCommonSubstring.cs
+++ DiffLib/LongestCommonSubstring.cs
@@ -88,10 +88,70 @@
         /// </returns>
         public LongestCommonSubstringResult Find()
         {
+            return Find(0, _Collection1.Length, 0, _Collection2.Length);
+        }
+
+        ///
+        /// Finds the longest common substring and returns its position in the two collections, and
+        /// its length, or <c>null</c> if no such common substring can be located.
+        ///
+        /// <param name="lower1">
+        /// The starting position in the first collection, 0-based. Included in the search.
+        /// </param>
+        /// <param name="upper1">
+        /// The ending position in the first collection, 0-based. Not included in the search.
+        /// </param>
+        /// <param name="lower2">
+        /// The starting position in the second collection, 0-based. Included in the search.
+        /// </param>
+        /// <param name="upper2">
+        /// The ending position in the second collection, 0-based. Not included in the search.
+        /// </param>
+        /// <returns>
+        /// A <see cref="LongestCommonSubstringResult"/> containing the positions of the two substrings, one position
+        /// for each collection, both 0-based, and the length of the substring. If no common substring can be found, <c>null</c>
+        /// will be returned.
+        /// </returns>
+        /// <exception cref="ArgumentOutOfRangeException">
+        /// <para><paramref name="lower1"/> is less than 0.</para>
+        /// <para>- or -</para>
+        /// <para><paramref name="lower1"/> is greater than <paramref name="upper1"/>.</para>
+        /// <para>- or -</para>
+        /// <para><paramref name="upper1"/> is greater than the length of the first collection.</para>
+        /// <para>- or -</para>
+        /// <para><paramref name="lower2"/> is less than 0.</para>
+        /// <para>- or -</para>
+        /// <para><paramref name="lower2"/> is greater than <paramref name="upper2"/>.</para>
+        /// <para>- or -</para>
+        /// <para><paramref name="upper2"/> is greater than the length of the second collection.</para>
+        /// </exception>
+        public LongestCommonSubstringResult Find(int lower1, int upper1, int lower2, int upper2)
+        {
+            if (lower1 < 0)
+                throw new ArgumentOutOfRangeException("lower1", lower1, "lower1 must be 0 or greater");
+            if (lower1 > upper1)
+                throw new ArgumentOutOfRangeException("lower1", lower1,
+                    string.Format("lower1 must be equal to or less than upper1 ({0})", upper1));
+            if (upper1 > _Collection1.Length)
+                throw new ArgumentOutOfRangeException("upper1", upper1,
+                    "upper1 must be equal to or less than the length of the first collection");
+            if (lower2 < 0)
+                throw new ArgumentOutOfRangeException("lower2", lower2, "lower2 must be 0 or greater");
+            if (lower2 > upper2)
+                throw new ArgumentOutOfRangeException("lower2", lower2,
+                    string.Format("lower2 must be equal to or less than upper2 ({0})", upper2));
+            if (upper2 > _Collection2.Length)
+                throw new ArgumentOutOfRangeException("upper2", upper2,
+                    "upper2 must be equal to or less than the length of the first collection");
+
+            // Pathological cases
+            if (lower1 == upper1 || lower2 == upper2)
+                return null;
+
             int maxMatchingLength = -1;
             int maxMatchingPosition1 = -1;
             int maxMatchingPosition2 = -1;
-            for (int index1 = 0; index1 < _Collection1.Length; index1++)
+            for (int index1 = lower1; index1 < upper1; index1++)
             {
                 Occurance occurance;
                 if (_LookupTable.TryGetValue(_Collection1[index1].HashCode, out occurance))
@@ -101,7 +161,10 @@
                         int index2 = occurance.Position;
                         occurance = occurance.Next;

-                        int length = CountMatchingElements(index1, index2);
+                        if (index2 < lower2 || index2 >= upper2)
+                            continue;
+
+                        int length = CountMatchingElements(index1, upper1, index2, upper2);
                         if (length > 0 && length > maxMatchingLength)
                         {
                             maxMatchingLength = length;
@@ -133,10 +196,10 @@
                 _LookupTable[hc] = new Occurance(index, null);
         }

-        private int CountMatchingElements(int index1, int index2)
+        private int CountMatchingElements(int index1, int upper1, int index2, int upper2)
         {
             int startIndex = index1;
-            while (index1 < _Collection1.Length && index2 < _Collection2.Length &&
+            while (index1 < upper1 && index2 < upper2 &&
                    _Collection1[index1].HashCode == _Collection2[index2].HashCode)
             {
                 if (!_Comparer.Equals(_Collection1[index1].Item, _Collection2[index2].Item))


reduce banner size on on authorization page

--- source/WebHost/Views/Authorize/Consent.cshtml
+++ source/WebHost/Views/Authorize/Consent.cshtml
@@ -4,6 +4,14 @@
     ViewBag.Title = "Authorize";
 }

+@section css{
+
+}


Fixed issue where mapper was not checking the underlying type of fields when building lookups for retention time.

--- Source/Libraries/ECAClientUtilities/MapperBase.cs
+++ Source/Libraries/ECAClientUtilities/MapperBase.cs
@@ -292,7 +292,10 @@
                 else if (retentionTime == TimeSpan.Zero)
                     retentionTime = parentRetention;

-                if (fieldMapping.Field.Type.IsUserDefined)
+                DataType fieldType = fieldMapping.Field.Type;
+                DataType underlyingType = (fieldType as ArrayType)?.UnderlyingType;
+
+                if ((underlyingType ?? fieldType).IsUserDefined)
                 {
                     foreach (TypeMapping nestedMapping in m_mappingCompiler.EnumerateTypeMappings(fieldMapping.Expression))
                         BuildRetentionTimes(retentionTimes, nestedMapping, retentionTime);


Added test to RuntimeEntityTests check entity only commits changes to dirty components.

--- Source/OpenAOE.Engine.Tests/RuntimeEntityTests.cs
+++ Source/OpenAOE.Engine.Tests/RuntimeEntityTests.cs
@@ -1,4 +1,5 @@
-using Moq;
+using System;
+using Moq;
 using NUnit.Framework;
 using OpenAOE.Engine.Data;
 using OpenAOE.Engine.Data.Events;
@@ -81,5 +82,35 @@
             entity.Commit();
             entity.Current<ISimpleComponent>().Value.ShouldBe(5);
         }
+
+        [Test]
+        public void EntityCommitsDirtyComponentOnlyWhenDirty()
+        {
+            var mockWEntity = new Mock<IWriteableSimpleComponent>();
+            var mockEntity = mockWEntity.As<ISimpleComponent>();
+
+            var cloneWEntity = new Mock<IWriteableSimpleComponent>(mockEntity.Behavior);
+            var cloneEntity = cloneWEntity.As<ISimpleComponent>();
+
+            mockEntity.SetupGet(c => c.Type).Returns(typeof (ISimpleComponent));
+            mockEntity.Setup(c => c.Clone()).Returns(() => cloneEntity.Object);
+
+            // Setup entity and mark ISimpleComponent as dirty
+            var entity = new RuntimeEntity(0, new IComponent[] { mockEntity.Object }, Mock.Of<IEventPoster>());
+
+            // Ensure a commit with the component non-dirty doesn't trigger a copy.
+            entity.Commit();
+            cloneEntity.Verify(c => c.CopyTo(mockEntity.Object),
+                Times.Never());
+
+            // Modify the component to set as dirty
+            entity.Modify<IWriteableSimpleComponent>();
+
+            // Trigger an entity commit, which should cause the entity to replicate
+            // changes from `Next` to `Current`.
+            entity.Commit();
+            cloneEntity.Verify(c => c.CopyTo(mockEntity.Object),
+                Times.Once());
+        }
     }
 }