Added comments and fixed issue with updating the underlying model.

--- Clifton.Core/Clifton.Core.ModelTableManagement/ModelTable.cs
+++ Clifton.Core/Clifton.Core.ModelTableManagement/ModelTable.cs
@@ -83,16 +83,25 @@
 			}
 		}

+		/// <summary>
+		/// ModelView overrides this method.
+		/// </summary>
 		protected virtual void Insert(T newInstance)
 		{
 			db.Context.InsertOfConcreteType(newInstance);
 		}

+		/// <summary>
+		/// ModelView overrides this method.
+		/// </summary>
 		protected virtual void Delete(IEntity item)
 		{
 			db.Context.DeleteOfConcreteType(item);
 		}

+		/// <summary>
+		/// ModelView overrides this method.
+		/// </summary>
 		protected virtual void Update(IEntity instance)
 		{
 			db.Context.UpdateOfConcreteType(instance);
@@ -111,24 +120,24 @@
 				instance = items.SingleOrDefault(record => ((MappedRecord)record).Row == e.Row);
 			}

-			modelMgr.UpdateRecordField(instance, e.Column.ColumnName, e.ProposedValue);
-
 			// Comboboxes do not fire a DataRowAction.Change RowChanged event when closing the dialog,
 			// these fire only when the use changes the selected row, so we persist the change now if not
 			// a detached record (as in, it must exist in the database.)
 			if (e.Row.RowState != DataRowState.Detached)
 			{
-				// If it's actually a column in the table, then persist the change.
-				if (((ExtDataColumn)e.Column).IsDbColumn)
+				PropertyInfo pi = instance.GetType().GetProperty(e.Column.ColumnName);
+				object oldVal = pi.GetValue(instance);
+
+				// Prevents infinite recursion by updating the model only when the field has changed.
+				// Otherwise, programmatically setting a field calls UpdateRowField, which changes the table's field,
+				// which fires the ModelTable.Table_ColumnChanged event.  This then calls back here, creating an infinite loop.
+				if (((oldVal == null) && (e.ProposedValue != DBNull.Value)) ||
+					 ((oldVal != null) && (!oldVal.Equals(e.ProposedValue))))
 				{
-					PropertyInfo pi = instance.GetType().GetProperty(e.Column.ColumnName);
-					object oldVal = pi.GetValue(instance);
-
-					// Prevents infinite recursion by updating the model only when the field has changed.
-					// Otherwise, programmatically setting a field calls UpdateRowField, which changes the table's field,
-					// which fires the ModelTable.Table_ColumnChanged event.  This then calls back here, creating an infinite loop.
-					if (((oldVal == null) && (e.ProposedValue != DBNull.Value)) ||
-						 ((oldVal != null) && (!oldVal.Equals(e.ProposedValue))))
+					modelMgr.UpdateRecordField(instance, e.Column.ColumnName, e.ProposedValue);
+					// If it's actually a column in the table, then persist the change.
+					ExtDataColumn edc = (ExtDataColumn)e.Column;
+					if (edc.IsDbColumn)
 					{
 						Update(instance);
 					}
@@ -137,3 +146,4 @@
 		}
 	}
 }
+


Refaktorerte/ekstraherte ut metoder for bedre synlighet i sendAsync()

--- Difi.SikkerDigitalPost.Klient/Api/SikkerDigitalPostKlient.cs
+++ Difi.SikkerDigitalPost.Klient/Api/SikkerDigitalPostKlient.cs
@@ -96,13 +96,9 @@

             var guidHandler = new GuidUtility();

-            var arkiv = new AsicEArkiv(forsendelse, guidHandler, _databehandler.Sertifikat);
-            if (lagreDokumentpakke)
-            {
-                arkiv.LagreTilDisk(_klientkonfigurasjon.StandardLoggSti, "dokumentpakke", DateUtility.DateForFile() + " - Dokumentpakke.zip");
-            }
-
-            var forretningsmeldingEnvelope = new ForretningsmeldingEnvelope(new EnvelopeSettings(forsendelse, arkiv, _databehandler, guidHandler, _klientkonfigurasjon));
+            var arkiv = LagAsicEArkiv(forsendelse, lagreDokumentpakke, guidHandler);
+
+            var forretningsmeldingEnvelope = LagForretningsmeldingEnvelope(forsendelse, arkiv, guidHandler);

             Logg(TraceEventType.Verbose, forsendelse.KonversasjonsId, arkiv.Signatur.Xml().OuterXml, true, true, "Sendt - Signatur.xml");
             Logg(TraceEventType.Verbose, forsendelse.KonversasjonsId, arkiv.Manifest.Xml().OuterXml, true, true, "Sendt - Manifest.xml");
@@ -110,16 +106,16 @@

             try
             {
-                ValiderForretningsmeldingEnvelope(forretningsmeldingEnvelope.Xml(), arkiv.Manifest.Xml(),
-                    arkiv.Signatur.Xml());
+                ValiderForretningsmeldingEnvelope(forretningsmeldingEnvelope.Xml());
+                ValiderArkivManifest(arkiv.Manifest.Xml());
+                ValiderArkivSignatur(arkiv.Signatur.Xml());
             }
             catch (Exception e)
             {
                 throw new Exception("Sending av forsendelse feilet under validering. Feilmelding: " + e.GetBaseException(), e.InnerException);
             }

-            var soapContainer = new SoapContainer(forretningsmeldingEnvelope);
-            soapContainer.Vedlegg.Add(arkiv);
+            var soapContainer = LagSoapContainer(forretningsmeldingEnvelope, arkiv);
             var meldingsformidlerRespons = await SendSoapContainer(soapContainer);

             Logg(TraceEventType.Verbose, forsendelse.KonversasjonsId, meldingsformidlerRespons, true, true, "Mottatt - Meldingsformidlerespons.txt");
@@ -128,6 +124,34 @@
             Logging.Log(TraceEventType.Information, forsendelse.KonversasjonsId, "Kvittering for forsendelse" + Environment.NewLine + meldingsformidlerRespons);

             return ValiderTransportkvittering(meldingsformidlerRespons, forretningsmeldingEnvelope.Xml(), guidHandler);
+        }
+
+        private static SoapContainer LagSoapContainer(ForretningsmeldingEnvelope forretningsmeldingEnvelope, AsicEArkiv arkiv)
+        {
+            var soapContainer = new SoapContainer(forretningsmeldingEnvelope);
+            soapContainer.Vedlegg.Add(arkiv);
+            return soapContainer;
+        }
+
+        private ForretningsmeldingEnvelope LagForretningsmeldingEnvelope(Forsendelse forsendelse, AsicEArkiv arkiv,
+            GuidUtility guidHandler)
+        {
+            var forretningsmeldingEnvelope =
+                new ForretningsmeldingEnvelope(new EnvelopeSettings(forsendelse, arkiv, _databehandler, guidHandler,
+                    _klientkonfigurasjon));
+            return forretningsmeldingEnvelope;
+        }
+
+
+        private AsicEArkiv LagAsicEArkiv(Forsendelse forsendelse, bool lagreDokumentpakke, GuidUtility guidHandler)
+        {
+            var arkiv = new AsicEArkiv(forsendelse, guidHandler, _databehandler.Sertifikat);
+            if (lagreDokumentpakke)
+            {
+                arkiv.LagreTilDisk(_klientkonfigurasjon.StandardLoggSti, "dokumentpakke",
+                    DateUtility.DateForFile() + " - Dokumentpakke.zip");
+            }
+            return arkiv;
         }

         private static Transportkvittering ValiderTransportkvittering(string meldingsformidlerRespons,
@@ -368,7 +392,7 @@
             return data;
         }

-        private static void ValiderForretningsmeldingEnvelope(XmlDocument forretningsmeldingEnvelopeXml, XmlDocument manifestXml, XmlDocument signaturXml)
+        private static void ValiderForretningsmeldingEnvelope(XmlDocument forretningsmeldingEnvelopeXml)
         {
             const string preMessage = "Envelope validerer ikke: ";

@@ -376,17 +400,26 @@
             var envelopeValidert = envelopeValidering.ValiderDokumentMotXsd(forretningsmeldingEnvelopeXml.OuterXml);
             if (!envelopeValidert)
                 throw new XmlValidationException(preMessage + envelopeValidering.ValideringsVarsler);
+        }
+
+        private static void ValiderArkivSignatur(XmlDocument signaturXml)
+        {
+            const string preMessage = "Envelope validerer ikke: ";
+
+            var signaturValidering = new Signaturvalidator();
+            var signaturValidert = signaturValidering.ValiderDokumentMotXsd(signaturXml.OuterXml);
+            if (!signaturValidert)
+                throw new XmlValidationException(preMessage + signaturValidering.ValideringsVarsler);
+        }
+
+        private static void ValiderArkivManifest(XmlDocument manifestXml)
+        {
+            const string preMessage = "Envelope validerer ikke: ";

             var manifestValidering = new ManifestValidator();
             var manifestValidert = manifestValidering.ValiderDokumentMotXsd(manifestXml.OuterXml);
             if (!manifestValidert)
                 throw new XmlValidationException(preMessage + manifestValidering.ValideringsVarsler);
-
-            var signaturValidering = new Signaturvalidator();
-            var signaturValidert = signaturValidering.ValiderDokumentMotXsd(signaturXml.OuterXml);
-            if (!signaturValidert)
-                throw new XmlValidationException(preMessage + signaturValidering.ValideringsVarsler);
-
         }

         private void Logg(TraceEventType viktighet, Guid konversasjonsId, string melding, bool datoPrefiks, bool isXml, string filnavn, params string[] filsti)


Optimize index handling by avoiding repetitive ordering/concatenation

(This could probably be optimized further, but isn't really a problem now.)

--- Drums/VDrumExplorer.Data/Json/VisualTreeConversionContext.cs
+++ Drums/VDrumExplorer.Data/Json/VisualTreeConversionContext.cs
@@ -22,13 +22,13 @@
         private readonly ModuleJson moduleJson;
         private readonly IReadOnlyDictionary<string, string> lookupsByPath;
         internal FixedContainer ContainerContext { get; }
-        private readonly IDictionary<string, string> indexes;
+        private readonly List<KeyValuePair<string, string>> indexes;

         private VisualTreeConversionContext(
             ModuleJson moduleJson,
             FixedContainer containerContext,
             IReadOnlyDictionary<string, string> lookupsByPath,
-            IDictionary<string, string> indexes)
+            List<KeyValuePair<string, string>> indexes)
         {
             this.moduleJson = moduleJson;
             this.ContainerContext = containerContext;
@@ -40,14 +40,13 @@
             ModuleJson moduleJson,
             FixedContainer containerContext,
             IReadOnlyDictionary<string, string> lookupsByPath) =>
-            new VisualTreeConversionContext(moduleJson, containerContext, lookupsByPath, new Dictionary<string, string>());
+            new VisualTreeConversionContext(moduleJson, containerContext, lookupsByPath, new List<KeyValuePair<string, string>>());

         internal VisualTreeConversionContext WithIndex(string indexName, int indexValue)
         {
-            var newIndexes = new Dictionary<string, string>(indexes)
-            {
-                { indexName, indexValue.ToString(CultureInfo.InvariantCulture) }
-            };
+            var newPair = new KeyValuePair<string, string>("$" + indexName, indexValue.ToString(CultureInfo.InvariantCulture));
+            // Replace longer variables first
+            var newIndexes = indexes.Concat(new[] { newPair }).OrderByDescending(pair => pair.Key.Length).ToList();
             return new VisualTreeConversionContext(moduleJson, ContainerContext, lookupsByPath, newIndexes);
         }

@@ -95,10 +94,9 @@

         private string ReplaceIndexes(string text)
         {
-            // Replace longer variables first
-            foreach (var pair in indexes.OrderByDescending(p => p.Key.Length))
+            foreach (var pair in indexes)
             {
-                text = text.Replace("$" + pair.Key, pair.Value);
+                text = text.Replace(pair.Key, pair.Value);
             }
             return text;
         }


Test Contains, StartsWith and EndsWith

Test Contains, StartsWith and EndsWith

--- Flepper.Tests.Unit/QueryBuilder/Commands/WhereFilterTests.cs
+++ Flepper.Tests.Unit/QueryBuilder/Commands/WhereFilterTests.cs
@@ -238,5 +238,64 @@
                 .Should()
                 .Contain("WHERE [field] IS NOT NULL");
         }
+
+        [Fact]
+        public void ShoulContainLikeContains()
+        {
+            FlepperQueryBuilder.Select()
+                .From("table")
+                .Where("field").Contains("abc")
+                .Build()
+                .Trim()
+                .Should()
+                .Contain("LIKE");
+        }
+
+        [Fact]
+        public void ShoulContainLikeStartsWith()
+        {
+            FlepperQueryBuilder.Select()
+                .From("table")
+                .Where("field").StartsWith("abc")
+                .Build()
+                .Trim()
+                .Should()
+                .Contain("LIKE");
+        }
+
+        [Fact]
+        public void ShoulContainLikeEndsWith()
+        {
+            FlepperQueryBuilder.Select()
+                .From("table")
+                .Where("field").EndsWith("abc")
+                .Build()
+                .Trim()
+                .Should()
+                .Contain("LIKE");
+        }
+
+        [Fact]
+        public void ShoulContainLikeContainsAndStartsWithAndEndsWith()
+        {
+            var result = FlepperQueryBuilder.Select()
+                .From("table")
+                .Where("field1").Contains("abc")
+                .And("field2").StartsWith("abc")
+                .And("field3").EndsWith("abc")
+                .Build()
+                .Trim()
+                .Should();
+
+            result.Contain("@p0");
+            result.Contain("@p1");
+            result.Contain("@p2");
+
+            result.Contain("[field1]");
+            result.Contain("[field2]");
+            result.Contain("[field3]");
+
+            result.Be("SELECT * FROM [table] WHERE [field1] LIKE @p0  AND [field2] LIKE @p1  AND [field3] LIKE @p2");
+        }
     }
 }


Saga can disable logging of incoming messages when it is in uninitialized state

--- GridDomain.EventSourcing.Sagas/InstanceSagas/SagaInstance.cs
+++ GridDomain.EventSourcing.Sagas/InstanceSagas/SagaInstance.cs
@@ -8,7 +8,6 @@

 namespace GridDomain.EventSourcing.Sagas.InstanceSagas
 {
-
     public static class SagaInstance
     {
         public static SagaInstance<TSaga, TSagaData> New<TSaga, TSagaData>(TSaga saga, SagaDataAggregate<TSagaData> data)
@@ -25,9 +24,12 @@
     {
         public readonly Saga<TSagaData> Machine;
         private readonly SagaDataAggregate<TSagaData> _dataAggregate;
-        private readonly MethodInfo _transitGenericMethodInfo;
+        private readonly MethodInfo _transitGenericMethodInfo = typeof(SagaInstance<TSaga, TSagaData>)
+                                                                .GetMethods()
+                                                                .Single(m => m.IsGenericMethod && m.Name == nameof(Transit));
+
         private static readonly ISoloLogger Log = LogManager.GetLogger();
-
+
         public IReadOnlyCollection<object> CommandsToDispatch => Machine.CommandsToDispatch;
         public void ClearCommandsToDispatch()
         {
@@ -38,36 +40,45 @@

         public IAggregate Data => _dataAggregate;

-        public SagaInstance(Saga<TSagaData> machine, SagaDataAggregate<TSagaData> dataAggregate)
+        public SagaInstance(Saga<TSagaData> machine,
+                            SagaDataAggregate<TSagaData> dataAggregate,
+                            bool doUninitializedWarnings = true)
         {
             if (machine == null) throw new ArgumentNullException(nameof(machine));
             if (dataAggregate == null) throw new ArgumentNullException(nameof(dataAggregate));
             _dataAggregate = dataAggregate;
             Machine = machine;

-            var sagaData = _dataAggregate.Data;
-            if (!string.IsNullOrEmpty(sagaData?.CurrentStateName))
-            {
-                var initialState = Machine.GetState(sagaData.CurrentStateName);
-                Machine.TransitionToState(sagaData, initialState);
-                Machine.OnMessageReceived += (sender, context) =>
-                {
-                    var msg = context.Message;
-                    Log.Warn("Not initialized saga {Type} received a message {@msg}", GetType().Name, msg);
-                };
-            }
-            else
-            {
-                Log.Warn("Started saga {Type} {Id}  without initial state.\r\n" +
-                          "Saga will not process, only record incoming messages", GetType().Name, dataAggregate.Id);
-            }
+            if (!CheckInitialState(dataAggregate, doUninitializedWarnings)) return;

+            RegisterPersistence(dataAggregate);
+        }
+
+        private void RegisterPersistence(SagaDataAggregate<TSagaData> dataAggregate)
+        {
+            Machine.TransitionToState(_dataAggregate.Data, Machine.GetState(CurrentStateName));
             Machine.OnStateEnter += (sender, context) => dataAggregate.RememberTransition(context.Instance);
             Machine.OnEventReceived += (sender, context) => dataAggregate.RememberEvent(context.Event, context.SagaData, context.EventData);
+        }

-            _transitGenericMethodInfo = GetType()
-                                       .GetMethods()
-                                       .Single(m => m.IsGenericMethod && m.Name == nameof(Transit));
+        private string CurrentStateName => _dataAggregate.Data?.CurrentStateName;
+
+        private bool CheckInitialState(SagaDataAggregate<TSagaData> dataAggregate, bool logUninitializedState = true)
+        {
+            if (!string.IsNullOrEmpty(CurrentStateName)) return true;
+
+            Log.Warn("Started saga {Type} {Id} without initialization.", GetType().Name, dataAggregate.Id);
+            Log.Warn(_dataAggregate.Data == null ? "Saga data is empty" : "Current state name is not specified");
+
+            if (!logUninitializedState) return false;
+
+            Log.Warn("Saga will not process and only record incoming messages");
+            Machine.OnMessageReceived += (sender, context) =>
+            {
+                var msg = context.Message;
+                Log.Warn("Not initialized saga {Type} received a message {Msg}", GetType().Name, msg);
+            };
+            return false;
         }

         public void Transit(object message)


Remove 'Merge' from TomlTable

Remove 'Merge' from TomlTable

--- Source/Nett/TomlTable.cs
+++ Source/Nett/TomlTable.cs
@@ -216,11 +216,6 @@
             this.rows.Add(key, value);
         }

-        internal object Merge(TomlTable tt)
-        {
-            throw new NotImplementedException();
-        }
-
         internal override void OverwriteCommentsWithCommentsFrom(TomlObject src, bool overwriteWithEmpty)
         {
             base.OverwriteCommentsWithCommentsFrom(src, overwriteWithEmpty);


added GitHub URL

added GitHub URL

--- Source/WPF/GridHelper.cs
+++ Source/WPF/GridHelper.cs
@@ -14,7 +14,7 @@
  * =========================================================================================================
  *
  * GridHelper.cs Homepage: https://sites.google.com/site/mkvonarxcode/code/gridhelper
- * GridHelper.cs Github: TODO
+ * GridHelper.cs Github: https://github.com/mkvonarx/mkvonarx-csutils/blob/master/Source/WPF/GridHelper.cs
  *
  */


Trying to fix appveyor error.

Trying to fix appveyor error.

--- KenticoInspector.Reports/DatabaseTableSizeAnalysis/Report.cs
+++ KenticoInspector.Reports/DatabaseTableSizeAnalysis/Report.cs
@@ -50,7 +50,7 @@

             var top25LargestTables = _databaseService.ExecuteSqlFromFile<DatabaseTableSizeResult>(Scripts.GetTop25LargestTables);

-            return new ReportResults
+            var result = new ReportResults
             {
                 Type = ReportResultsType.Table.ToString(),
                 Status = ReportResultsStatus.Information.ToString(),
@@ -60,6 +60,8 @@
                     Rows = top25LargestTables
                 }
             };
+
+            return result;
         }
     }
 }


Reorder routes

Reorder routes

--- LanguageSchoolApp/LanguageSchoolApp/App_Start/RouteConfig.cs
+++ LanguageSchoolApp/LanguageSchoolApp/App_Start/RouteConfig.cs
@@ -27,11 +27,6 @@
                 defaults: new { controller = "Courses", action = "ById", id = UrlParameter.Optional }
             );

-            routes.MapRoute(
-                name: "404-PageNotFound",
-                url: "{*url}",
-                defaults: new { controller = "Home", action = "PageNotFound" }
-            );

             routes.MapRoute(
                 name: "Default",
@@ -39,6 +34,11 @@
                 defaults: new { controller = "home", action = "index", id = UrlParameter.Optional }
             );

+            routes.MapRoute(
+                name: "404-PageNotFound",
+                url: "{*url}",
+                defaults: new { controller = "Home", action = "PageNotFound" }
+            );
         }
     }
 }


Added back in archi Version.

Added back in archi Version.

--- ArchiSteamFarm/SharedInfo.cs
+++ ArchiSteamFarm/SharedInfo.cs
@@ -41,8 +41,8 @@
 			WCFHostname
 		}

+        internal const string VersionNumber = "2.1.6.3";
         internal const string MyVersionNumber = "2.1.5.8";
-
         internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016";

 		internal const string GithubRepo = "Blackpanther989/ArchiSteamFarm";


use named arguments

use named arguments

--- Assets/Editor/SmoothsTest.cs
+++ Assets/Editor/SmoothsTest.cs
@@ -73,6 +73,21 @@
     [Test]
     public void SmoothStepTest()
     {
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.0F), Is.EqualTo(0.0F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.1F), Is.EqualTo(0.0280000009F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.2F), Is.EqualTo(0.104000002F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.3F), Is.EqualTo(0.216000021F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.4F), Is.EqualTo(0.351999998F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.5F), Is.EqualTo(0.5F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.6F), Is.EqualTo(0.648000062F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.7F), Is.EqualTo(0.783999979F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.8F), Is.EqualTo(0.896000028F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.9F), Is.EqualTo(0.972000003F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 1.0F), Is.EqualTo(1.0F));
+
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: -0.2F), Is.EqualTo(0.0F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 1.1F), Is.EqualTo(1.0F));
+
         Action<float, float, float> test = (float a, float b, float t) =>
         {
             float actual = Mathf.SmoothStep(a, b, t);
@@ -80,26 +95,26 @@
             Assert.AreEqual(expected, actual);
         };

-        Assert.That(Mathf.SmoothStep(0.0F, 1.0F, 0.0F), Is.EqualTo(0.0F));
-        Assert.That(Mathf.SmoothStep(0.0F, 1.0F, 1.0F), Is.EqualTo(1.0F));
-        Assert.That(Mathf.SmoothStep(0.0F, 1.0F, -0.3F), Is.EqualTo(0.0F));
-        Assert.That(Mathf.SmoothStep(0.0F, 1.0F, 1.2F), Is.EqualTo(1.0F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 0.0F), Is.EqualTo(0.0F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 1.0F), Is.EqualTo(1.0F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: -0.3F), Is.EqualTo(0.0F));
+        Assert.That(Mathf.SmoothStep(from: 0.0F, to: 1.0F, t: 1.2F), Is.EqualTo(1.0F));
         test(0.0F, 1.0F, 0.1F);
         test(0.0F, 1.0F, 0.5F);
         test(0.0F, 1.0F, 0.8F);

-        Assert.That(Mathf.SmoothStep(2.0F, 5.0F, 0.0F), Is.EqualTo(2.0F));
-        Assert.That(Mathf.SmoothStep(2.0F, 5.0F, 1.0F), Is.EqualTo(5.0F));
-        Assert.That(Mathf.SmoothStep(2.0F, 5.0F, -0.3F), Is.EqualTo(2.0F));
-        Assert.That(Mathf.SmoothStep(2.0F, 5.0F, 1.2F), Is.EqualTo(5.0F));
+        Assert.That(Mathf.SmoothStep(from: 2.0F, to: 5.0F, t: 0.0F), Is.EqualTo(2.0F));
+        Assert.That(Mathf.SmoothStep(from: 2.0F, to: 5.0F, t: 1.0F), Is.EqualTo(5.0F));
+        Assert.That(Mathf.SmoothStep(from: 2.0F, to: 5.0F, t: -0.3F), Is.EqualTo(2.0F));
+        Assert.That(Mathf.SmoothStep(from: 2.0F, to: 5.0F, t: 1.2F), Is.EqualTo(5.0F));
         test(2.0F, 5.0F, 0.1F);
         test(2.0F, 5.0F, 0.5F);
         test(2.0F, 5.0F, 0.8F);

-        Assert.That(Mathf.SmoothStep(4.0F, 1.0F, 0.0F), Is.EqualTo(4.0F));
-        Assert.That(Mathf.SmoothStep(4.0F, 1.0F, 1.0F), Is.EqualTo(1.0F));
-        Assert.That(Mathf.SmoothStep(4.0F, 1.0F, -0.3F), Is.EqualTo(4.0F));
-        Assert.That(Mathf.SmoothStep(4.0F, 1.0F, 1.2F), Is.EqualTo(1.0F));
+        Assert.That(Mathf.SmoothStep(from: 4.0F, to: 1.0F, t: 0.0F), Is.EqualTo(4.0F));
+        Assert.That(Mathf.SmoothStep(from: 4.0F, to: 1.0F, t: 1.0F), Is.EqualTo(1.0F));
+        Assert.That(Mathf.SmoothStep(from: 4.0F, to: 1.0F, t: -0.3F), Is.EqualTo(4.0F));
+        Assert.That(Mathf.SmoothStep(from: 4.0F, to: 1.0F, t: 1.2F), Is.EqualTo(1.0F));
         test(4.0F, 1.0F, 0.1F);
         test(4.0F, 1.0F, 0.5F);
         test(4.0F, 1.0F, 0.8F);


Push sending avatar full updates into the LLUDP queue and async them, which isn't really a good thing, but...

--- OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -174,6 +174,9 @@
                 lastPresencesDInView.Remove (presence.UUID);
                 return; // if 2 far ignore
             }
+            if (!lastPresencesDInView.ContainsKey (presence.UUID))
+                return;//Only send updates if they are in view
+
             QueuePresenceForUpdateInternal (presence, flags);
         }

@@ -186,7 +189,15 @@
                 lastPresencesDInView.Remove (presence.UUID);
                 return; // if 2 far ignore
             }
-            SendFullUpdateForPresence (presence);
+            if (!lastPresencesDInView.ContainsKey (presence.UUID))
+            {
+                lastPresencesInView.Add (presence);
+                lastPresencesDInView.Add (presence.UUID, presence);
+            }
+            else
+                return;
+
+            AddPresenceUpdate (presence, PrimUpdateFlags.ForcedFullUpdate);
         }

         private void QueuePresenceForUpdateInternal (IScenePresence presence, PrimUpdateFlags flags)
@@ -203,6 +214,11 @@
                 return;
             }

+            AddPresenceUpdate (presence, flags);
+        }
+
+        private void AddPresenceUpdate (IScenePresence presence, PrimUpdateFlags flags)
+        {
             lock (m_presenceUpdatesToSendLock)
             {
 #if UseRemovingEntityUpdates
@@ -428,26 +444,29 @@

         protected void SendFullUpdateForPresence (IScenePresence presence)
         {
-            m_presence.ControllingClient.SendAvatarDataImmediate (presence);
-            //Send the animations too
-            presence.Animator.SendAnimPackToClient (m_presence.ControllingClient);
-            //Send the presence of this agent to us
-            IAvatarAppearanceModule module = presence.RequestModuleInterface<IAvatarAppearanceModule>();
-            if(module != null)
-                module.SendAppearanceToAgent(m_presence);
-            //We need to send all attachments of this avatar as well
-            IAttachmentsModule attmodule = m_presence.Scene.RequestModuleInterface<IAttachmentsModule>();
-            if (attmodule != null)
-            {
-                ISceneEntity[] entities = attmodule.GetAttachmentsForAvatar (m_presence.UUID);
-                foreach (ISceneEntity entity in entities)
-                {
-                    foreach (ISceneChildEntity child in entity.ChildrenEntities ())
-                    {
-                        QueuePartForUpdate (child, PrimUpdateFlags.ForcedFullUpdate);
-                    }
-                }
-            }
+            Util.FireAndForget (delegate (object o)
+            {
+                m_presence.ControllingClient.SendAvatarDataImmediate (presence);
+                //Send the animations too
+                presence.Animator.SendAnimPackToClient (m_presence.ControllingClient);
+                //Send the presence of this agent to us
+                IAvatarAppearanceModule module = presence.RequestModuleInterface<IAvatarAppearanceModule> ();
+                if (module != null)
+                    module.SendAppearanceToAgent (m_presence);
+                //We need to send all attachments of this avatar as well
+                IAttachmentsModule attmodule = m_presence.Scene.RequestModuleInterface<IAttachmentsModule> ();
+                if (attmodule != null)
+                {
+                    ISceneEntity[] entities = attmodule.GetAttachmentsForAvatar (m_presence.UUID);
+                    foreach (ISceneEntity entity in entities)
+                    {
+                        foreach (ISceneChildEntity child in entity.ChildrenEntities ())
+                        {
+                            QueuePartForUpdate (child, PrimUpdateFlags.ForcedFullUpdate);
+                        }
+                    }
+                }
+            });
         }

         #endregion
@@ -556,8 +575,11 @@
                                 continue;
                             }
                             m_EntitiesInPacketQueue.Add (update.Entity.UUID);*/
-                            updates.Add (update);
                             m_presenceUpdatesToSend.RemoveAt (0);
+                            if (update.Flags == PrimUpdateFlags.ForcedFullUpdate)
+                                SendFullUpdateForPresence ((IScenePresence)update.Entity);
+                            else
+                                updates.Add (update);
 #else
                             EntityUpdate update = m_presenceUpdatesToSend.Dequeue ();
                             updates.Add (update);


removed overlooked lock

removed overlooked lock

--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1416,14 +1416,11 @@
                 m_PrimObjects.Clear();
                 m_Assemblies.Clear();
                 m_DomainScripts.Clear();
+                m_ScriptEngines.Remove(this);
             }
             finally
             {
                 m_ScriptsRwLock.ReleaseReaderLock();
-            }
-            lock (m_ScriptEngines)
-            {
-                m_ScriptEngines.Remove(this);
             }
         }


Fixed bugs with "R" and "-" notes

Fixed bugs with "R" and "-" notes

--- OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs
+++ OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs
@@ -47,7 +47,7 @@
 		public string[] GetIMF(string syllable)
 		{
 			byte[] bytes = Encoding.Unicode.GetBytes(syllable);
-			int numval = Convert.ToInt16(bytes[0]) + Convert.ToInt16(bytes[1]) * (16 * 16);
+			int numval = Convert.ToInt32(bytes[0]) + Convert.ToInt32(bytes[1]) * (16 * 16);
 			numval -= 44032;
 			int i = numval / 588;
 			numval -= i * 588;
@@ -119,57 +119,67 @@
 		public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevNeighbour, Note? nextNeighbour, Note[] prevNeighbours)
 		{
 			Note note = notes[0];
-      string color = string.Empty;
-      int shift = 0;
-
-      PhonemeAttributes attr = note.phonemeAttributes.FirstOrDefault(a => a.index == 0);
-      color = attr.voiceColor;
-      shift = attr.toneShift;
-
-      // Check if lyric is R or - and return appropriate Result; otherwise, move to next steps
-      if (note.lyric == "R" || note.lyric == "-")
-			{
+			string color = string.Empty;
+			int shift = 0;
+
+			PhonemeAttributes attr = note.phonemeAttributes.FirstOrDefault(a => a.index == 0);
+			color = attr.voiceColor;
+			shift = attr.toneShift;
+
+			string[] currIMF;
+			string currPhoneme;
+			string[] prevIMF;
+
+			// Check if lyric is R or - and return appropriate Result; otherwise, move to next steps
+			if (note.lyric == "R" || note.lyric == "-")
+			{
+				currPhoneme = note.lyric;
+
 				if (prevNeighbour == null)
 				{
 					return new Result
 					{
 						phonemes = new Phoneme[] {
-							new Phoneme { phoneme = note.lyric }
+							new Phoneme { phoneme = currPhoneme }
 						}
 					};
 				}
 				else
 				{
-					string RPhoneme = note.lyric;
-					string[] RprevIMF = (string.IsNullOrEmpty(prevNeighbour?.phoneticHint)) ? GetIMF(prevNeighbour?.lyric) : GetIMFFromHint(prevNeighbour?.phoneticHint);
-
-					if (string.IsNullOrEmpty(RprevIMF[2])) RPhoneme = $"{((RprevIMF[1][0] == 'w' || RprevIMF[1][0] == 'y' || RprevIMF[1] == "oi") ? RprevIMF[1].Remove(0, 1) : ((RprevIMF[1] == "eui" || RprevIMF[1] == "ui") ? "i" : RprevIMF[1]))} {RPhoneme}";
-					else
-					{
-						if (Array.IndexOf(sonorants, RprevIMF[2]) > -1)
-						{
-							if (singer.TryGetMappedOto($"{RprevIMF[2]} {RPhoneme}", note.tone + shift, color, out _)) RPhoneme = $"{RprevIMF[2]} {RPhoneme}";
-							else RPhoneme = $"{RprevIMF[2].ToUpper()} {RPhoneme}";
-						}
-						else RPhoneme = "- " + RPhoneme;
-					}
-
-					return new Result
-					{
+					if (singer.TryGetMappedOto(prevNeighbour?.lyric, note.tone, color, out _)) {
+						string lastSound = GetLastSoundOfAlias(prevNeighbour?.lyric);
+						currPhoneme = $"{(!singer.TryGetMappedOto($"{lastSound} {currPhoneme}", note.tone, color, out _) ? lastSound.ToUpper() : lastSound)} {currPhoneme}";
+					}
+
+					else {
+						if (string.IsNullOrEmpty(prevNeighbour?.phoneticHint)) {
+							byte[] bytes = Encoding.Unicode.GetBytes($"{prevNeighbour?.lyric[0]}");
+							int numval = Convert.ToInt32(bytes[0]) + Convert.ToInt32(bytes[1]) * (16 * 16);
+							if (prevNeighbour?.lyric.Length == 1 && numval >= 44032 && numval <= 55215) prevIMF = GetIMF(prevNeighbour?.lyric);
+							else return new Result {
+								phonemes = new Phoneme[] {
+									new Phoneme { phoneme = currPhoneme }
+								}
+							};
+						} else prevIMF = GetIMFFromHint(prevNeighbour?.phoneticHint);
+
+						if (string.IsNullOrEmpty(prevIMF[2])) currPhoneme = $"{((prevIMF[1][0] == 'w' || prevIMF[1][0] == 'y' || prevIMF[1] == "oi") ? prevIMF[1].Remove(0, 1) : ((prevIMF[1] == "eui" || prevIMF[1] == "ui") ? "i" : prevIMF[1]))} {currPhoneme}";
+						else currPhoneme = $"{(!singer.TryGetMappedOto($"{prevIMF[2]} {currPhoneme}", note.tone, color, out _) ? prevIMF[2].ToUpper() : prevIMF[2])} {currPhoneme}";
+					}
+
+					return new Result {
 						phonemes = new Phoneme[] {
-							new Phoneme { phoneme = RPhoneme }
+							new Phoneme { phoneme = currPhoneme }
 						}
 					};
 				}
 			}

 			// Get IMF of current note if valid, otherwise return the lyric as is
-			string[] currIMF;
-
 			if (string.IsNullOrEmpty(note.phoneticHint))
 			{
 				byte[] bytes = Encoding.Unicode.GetBytes($"{note.lyric[0]}");
-				int numval = Convert.ToInt16(bytes[0]) + Convert.ToInt16(bytes[1]) * (16 * 16);
+				int numval = Convert.ToInt32(bytes[0]) + Convert.ToInt32(bytes[1]) * (16 * 16);
 				if (note.lyric.Length == 1 && numval >= 44032 && numval <= 55215) currIMF = GetIMF(note.lyric);
 				else return new Result
 				{
@@ -181,7 +191,7 @@
 			else currIMF = GetIMFFromHint(note.phoneticHint);

 			// Convert current note to phoneme
-			string currPhoneme = $"{currIMF[0]}{currIMF[1]}";
+			currPhoneme = $"{currIMF[0]}{currIMF[1]}";

 			if (currIMF[0] == "gg" || currIMF[0] == "dd" || currIMF[0] == "bb")
 			{
@@ -196,15 +206,13 @@
 			if (prevNeighbour != null && singer.TryGetMappedOto(prevNeighbour?.lyric, note.tone + shift, color, out _)) currPhoneme = $"{GetLastSoundOfAlias(prevNeighbour?.lyric)} {currPhoneme}";
 			else
 			{
-				string[] prevIMF;
-
 				if (prevNeighbour == null || prevNeighbour?.lyric == "R" || prevNeighbour?.lyric == "-") currPhoneme = $"- {currPhoneme}";
 				else
 				{
 					if (string.IsNullOrEmpty(prevNeighbour?.phoneticHint))
 					{
 						byte[] bytes = Encoding.Unicode.GetBytes($"{prevNeighbour?.lyric[0]}");
-						int numval = Convert.ToInt16(bytes[0]) + Convert.ToInt16(bytes[1]) * (16 * 16);
+						int numval = Convert.ToInt32(bytes[0]) + Convert.ToInt32(bytes[1]) * (16 * 16);
 						if (prevNeighbour?.lyric.Length == 1 && numval >= 44032 && numval <= 55215) prevIMF = GetIMF(prevNeighbour?.lyric);
 						else return new Result
 						{


improved performance by squashing many .ToArray() into a single Linq query

--- OrleansDashboard/DashboardTelemetryConsumer.cs
+++ OrleansDashboard/DashboardTelemetryConsumer.cs
@@ -5,13 +5,14 @@
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Globalization;
+using System.Linq;
 using System.Threading;
 using OrleansDashboard.Client;
 using OrleansDashboard.Client.Model;

 namespace OrleansDashboard
 {
-    public sealed class DashboardTelemetryConsumer : ITelemetryConsumer, IMetricTelemetryConsumer
+    public sealed class DashboardTelemetryConsumer : IMetricTelemetryConsumer
     {
         public class Value<T>
         {
@@ -87,40 +88,32 @@
         {
             var grain = grainFactory.GetGrain<ISiloGrain>(localSiloDetails.SiloAddress.ToParsableString());

-            var counters = new List<StatCounter>();
+            var countersArray = metrics.Select(metric => new StatCounter
+                {
+                    Name = metric.Key,
+                    Value = metric.Value.Current.ToString(CultureInfo.InvariantCulture),
+                    Delta = (metric.Value.Current - metric.Value.Last).ToString(CultureInfo.InvariantCulture)
+                })
+                .Concat(timespanMetrics.Select(metric => new StatCounter
+                {
+                    Name = metric.Key,
+                    Value = (metric.Value.Current).ToString("c", CultureInfo.InvariantCulture),
+                    Delta = (metric.Value.Current - metric.Value.Last).ToString("c", CultureInfo.InvariantCulture)
+                }))
+                .ToArray();

-            foreach (var metric in metrics.ToArray())
+            if (countersArray.Length > 0)
             {
-                var v = metric.Value.Current;
-                var d = metric.Value.Current - metric.Value.Last;
-
-                counters.Add(new StatCounter { Name = metric.Key, Value = v.ToString(CultureInfo.InvariantCulture), Delta = d.ToString(CultureInfo.InvariantCulture) });
-            }
-
-            foreach (var metric in timespanMetrics.ToArray())
-            {
-                var v = metric.Value.Current;
-                var d = metric.Value.Current - metric.Value.Last;
-
-                counters.Add(new StatCounter { Name = metric.Key, Value = v.ToString("c", CultureInfo.InvariantCulture), Delta = d.ToString("c", CultureInfo.InvariantCulture) });
-            }
-
-            if (counters.Count > 0)
-            {
-                var countersArray = counters.ToArray();
-
                 grain.ReportCounters(countersArray.AsImmutable());
             }
         }

         public void Close()
         {
-            if (!isClosed)
-            {
-                isClosed = true;
+            if (isClosed) return;

-                timer.Dispose();
-            }
+            isClosed = true;
+            timer.Dispose();
         }

         public void Dispose()


Removed dynamic ping calculation for syncing server/local time

--- Binance.Net/BinanceClient.cs
+++ Binance.Net/BinanceClient.cs
@@ -62,6 +62,7 @@
         private BinanceExchangeInfo exchangeInfo;
         private DateTime? lastExchangeInfoUpdate;

+
         // Addresses
         private string baseApiAddress;
         private const string Api = "api";
@@ -198,15 +199,14 @@
             else
             {
                 var localTime = DateTime.UtcNow;
-                var sw = Stopwatch.StartNew();
                 var result = await ExecuteRequest<BinanceCheckTime>(url).ConfigureAwait(false);
                 if (!result.Success)
                     return new CallResult<DateTime>(default(DateTime), result.Error);

                 if (!timeSynced || resetAutoTimestamp)
                 {
-                    // Calculate time offset between local and server by taking the elapsed time request time / 2 (round trip)
-                    timeOffset = ((result.Data.ServerTime - localTime).TotalMilliseconds) - sw.ElapsedMilliseconds / 2.0;
+                    // Calculate time offset between local and server
+                    timeOffset = (result.Data.ServerTime - localTime).TotalMilliseconds;
                     timeSynced = true;
                     lastTimeSync = DateTime.UtcNow;
                     log.Write(LogVerbosity.Info, $"Time offset set to {timeOffset}ms");


Remove  unused attribute

Remove  unused attribute

--- BmpListener/Bmp/BmpHeader.cs
+++ BmpListener/Bmp/BmpHeader.cs
@@ -1,5 +1,4 @@
 using Newtonsoft.Json;
-using Newtonsoft.Json.Converters;

 namespace BmpListener.Bmp
 {
@@ -15,7 +14,6 @@
         [JsonIgnore]
         public uint Length { get; private set; }

-        [JsonConverter(typeof(StringEnumConverter))]
         public MessageType Type { get; private set; }

         public void ParseBytes(byte[] data)


BrailleIOShowOff now runs in Lector's Workspace

git-svn-id: 01af18a6463d82f2dfa8239e3c2aedb49696f51b@250 6efbd2d2-d52f-40b0-b04a-ac586c898535

--- BrailleIO_ShowOff/ShowOff.cs
+++ BrailleIO_ShowOff/ShowOff.cs
@@ -27,18 +27,13 @@

         public static void initForm()
         {
-
             //FIXME: test
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
         }

-
         public ShowOff()
         {
-
-
-
             InitializeComponent();
             this.Activate();
             this.Show();


Fix SaveLoader AircraftDaemon using the wrong Vectors

Vec2 != Vector2. Normally the former would get implicitly cast to
the latter, but Utility.Create doesn't know it needs to do that.

--- Pathfinder/Internal/Replacements/SaveLoader.cs
+++ Pathfinder/Internal/Replacements/SaveLoader.cs
@@ -576,8 +576,8 @@

             executor.AddExecutor("daemons.AircraftDaemon", (exec, info) =>
             {
-                var srcVec = Vec2.Zero;
-                var dstVec = Vec2.One * 0.5f;
+                var srcVec = Vector2.Zero;
+                var dstVec = Vector2.One * 0.5f;
                 if (info.Attributes.ContainsKey("OriginX"))
                     srcVec.X = info.Attributes.GetFloat("OriginX");
                 if (info.Attributes.ContainsKey("OriginY"))


Removed 'HASHINDEX' directive from HashedArrayList

--- C5/arrays/HashedArrayList.cs
+++ C5/arrays/HashedArrayList.cs
@@ -20,8 +20,6 @@
  SOFTWARE.
 */

-#define HASHINDEX
-
 using System;
 using SCG = System.Collections.Generic;
 namespace C5
@@ -37,10 +35,6 @@
     ///
     [Serializable]
     public class HashedArrayList<T> : ArrayBase<T>, IList<T>, SCG.IList<T>
-#if HASHINDEX
-#else
-, IStack<T>, IQueue<T>
-#endif
     {
         #region Fields

@@ -68,9 +62,7 @@
         ///
         bool fIFO = false;

-#if HASHINDEX
-    HashSet<KeyValuePair<T, int>> itemIndex;
-#endif
+        HashSet<KeyValuePair<T, int>> itemIndex;
         #endregion
         #region Events

@@ -312,15 +304,10 @@
         /// <returns>The index of first occurrence</returns>
         int indexOf(T item)
         {
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>(item);
-      if (itemIndex.Find(ref p) && p.Value >= offset && p.Value < offset + size)
-        return p.Value - offset;
-#else
-            for (int i = 0; i < size; i++)
-                if (equals(item, array[offset + i]))
-                    return i;
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>(item);
+            if (itemIndex.Find(ref p) && p.Value >= offset && p.Value < offset + size)
+                return p.Value - offset;
+
             return ~size;
         }

@@ -331,44 +318,26 @@
         /// <returns>The index of last occurrence</returns>
         int lastIndexOf(T item)
         {
-#if HASHINDEX
-      return indexOf(item);
-#else
-            for (int i = size - 1; i >= 0; i--)
-                if (equals(item, array[offset + i]))
-                    return i;
-            return ~size;
-#endif
+            return indexOf(item);
+
         }
         #endregion

         #region Inserting

-#if HASHINDEX
-    ///
-    /// Internal version of Insert with no modification checks.
-    ///
-    /// <exception cref="DuplicateNotAllowedException"> if item already in list.</exception>
-    /// <param name="i">Index to insert at</param>
-    /// <param name="item">Item to insert</param>
-#else
         ///
         /// Internal version of Insert with no modification checks.
         ///
+        /// <exception cref="DuplicateNotAllowedException"> if item already in list.</exception>
         /// <param name="i">Index to insert at</param>
         /// <param name="item">Item to insert</param>
-#endif
         protected override void insert(int i, T item)
         {
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, offset + i);
-      if (itemIndex.FindOrAdd(ref p))
-        throw new DuplicateNotAllowedException("Item already in indexed list: " + item);
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, offset + i);
+            if (itemIndex.FindOrAdd(ref p))
+                throw new DuplicateNotAllowedException("Item already in indexed list: " + item);
             baseinsert(i, item);
-#if HASHINDEX
-      reindex(i + offset + 1);
-#endif
+            reindex(i + offset + 1);
         }

         private void baseinsert(int i, T item)
@@ -400,25 +369,21 @@
             if (underlyingsize > i)
                 Array.Copy(array, i + 1, array, i, underlyingsize - i);
             array[underlyingsize] = default(T);
-#if HASHINDEX
-      itemIndex.Remove(new KeyValuePair<T, int>(retval));
-      reindex(i);
-#endif
+            itemIndex.Remove(new KeyValuePair<T, int>(retval));
+            reindex(i);
             return retval;
         }
         #endregion

         #region Indexing

-#if HASHINDEX
-    private void reindex(int start) { reindex(start, underlyingsize); }
-
-    private void reindex(int start, int end)
-    {
-      for (int j = start; j < end; j++)
-        itemIndex.UpdateOrAdd(new KeyValuePair<T, int>(array[j], j));
-    }
-#endif
+        private void reindex(int start) { reindex(start, underlyingsize); }
+
+        private void reindex(int start, int end)
+        {
+            for (int j = start; j < end; j++)
+                itemIndex.UpdateOrAdd(new KeyValuePair<T, int>(array[j], j));
+        }
         #endregion

         #region fixView utilities
@@ -664,9 +629,7 @@
         public HashedArrayList(int capacity, SCG.IEqualityComparer<T> itemequalityComparer)
             : base(capacity, itemequalityComparer)
         {
-#if HASHINDEX
-      itemIndex = new HashSet<KeyValuePair<T, int>>(new KeyValuePairEqualityComparer<T, int>(itemequalityComparer));
-#endif
+            itemIndex = new HashSet<KeyValuePair<T, int>>(new KeyValuePairEqualityComparer<T, int>(itemequalityComparer));
         }

         #endregion
@@ -735,25 +698,15 @@
         }

-#if HASHINDEX
-    ///
-    /// On this list, this indexer is read/write.
-    ///
-    /// <exception cref="IndexOutOfRangeException"> if index is negative or
-    /// >= the size of the collection.</exception>
-    /// <exception cref="DuplicateNotAllowedException"> By the get operation
-    /// if the item already is present somewhere else in the list.</exception>
-    /// <value>The index'th item of this list.</value>
-    /// <param name="index">The index of the item to fetch or store.</param>
-#else
         ///
         /// On this list, this indexer is read/write.
         ///
         /// <exception cref="IndexOutOfRangeException"> if index is negative or
         /// >= the size of the collection.</exception>
+        /// <exception cref="DuplicateNotAllowedException"> By the get operation
+        /// if the item already is present somewhere else in the list.</exception>
         /// <value>The index'th item of this list.</value>
         /// <param name="index">The index of the item to fetch or store.</param>
-#endif
         [Tested]
         public virtual T this[int index]
         {
@@ -774,23 +727,21 @@
                     throw new IndexOutOfRangeException();
                 index += offset;
                 T item = array[index];
-#if HASHINDEX
-        KeyValuePair<T, int> p = new KeyValuePair<T, int>(value, index);
-        if (itemequalityComparer.Equals(value, item))
-        {
-          array[index] = value;
-          itemIndex.Update(p);
-        }
-        else if (!itemIndex.FindOrAdd(ref p))
-        {
-          itemIndex.Remove(new KeyValuePair<T, int>(item));
-          array[index] = value;
-        }
-        else
-          throw new DuplicateNotAllowedException("Item already in indexed list");
-#else
-                array[index] = value;
-#endif
+
+                KeyValuePair<T, int> p = new KeyValuePair<T, int>(value, index);
+                if (itemequalityComparer.Equals(value, item))
+                {
+                    array[index] = value;
+                    itemIndex.Update(p);
+                }
+                else if (!itemIndex.FindOrAdd(ref p))
+                {
+                    itemIndex.Remove(new KeyValuePair<T, int>(item));
+                    array[index] = value;
+                }
+                else
+                    throw new DuplicateNotAllowedException("Item already in indexed list");
+
                 (underlying ?? this).raiseForSetThis(index, value, item);
             }
         }
@@ -801,25 +752,16 @@
         /// <value></value>
         public virtual Speed IndexingSpeed { get { return Speed.Constant; } }

-#if HASHINDEX
-    ///
-    /// Insert an item at a specific index location in this list.
-    ///
-    /// <exception cref="IndexOutOfRangeException"> if index is negative or
-    /// > the size of the collection. </exception>
-    /// <exception cref="DuplicateNotAllowedException">
-    /// If the item is already present in the list.</exception>
-    /// <param name="index">The index at which to insert.</param>
-    /// <param name="item">The item to insert.</param>
-#else
+
         ///
         /// Insert an item at a specific index location in this list.
         ///
-        /// <exception cref="IndexOutOfRangeException"> if i is negative or
+        /// <exception cref="IndexOutOfRangeException"> if index is negative or
         /// > the size of the collection. </exception>
+        /// <exception cref="DuplicateNotAllowedException">
+        /// If the item is already present in the list.</exception>
         /// <param name="index">The index at which to insert.</param>
         /// <param name="item">The item to insert.</param>
-#endif
         [Tested]
         public virtual void Insert(int index, T item)
         {
@@ -853,27 +795,16 @@
             Insert(pointer.Offset + pointer.Count - Offset, item);
         }

-#if HASHINDEX
-    ///
-    /// Insert into this list all items from an enumerable collection starting
-    /// at a particular index.
-    ///
-    /// <exception cref="IndexOutOfRangeException"> if index is negative or
-    /// > the size of the collection.</exception>
-    /// <exception cref="DuplicateNotAllowedException"> If items
-    /// contains duplicates or some item already  present in the list.</exception>
-    /// <param name="index">Index to start inserting at</param>
-    /// <param name="items">Items to insert</param>
-#else
         ///
         /// Insert into this list all items from an enumerable collection starting
         /// at a particular index.
         ///
         /// <exception cref="IndexOutOfRangeException"> if index is negative or
         /// > the size of the collection.</exception>
+        /// <exception cref="DuplicateNotAllowedException"> If items
+        /// contains duplicates or some item already  present in the list.</exception>
         /// <param name="index">Index to start inserting at</param>
         /// <param name="items">Items to insert</param>
-#endif
         [Tested]
         public virtual void InsertAll(int index, SCG.IEnumerable<T> items)
         {
@@ -894,11 +825,9 @@

                 foreach (T item in items)
                 {
-#if HASHINDEX
-          KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, i);
-          if (itemIndex.FindOrAdd(ref p))
-            throw new DuplicateNotAllowedException("Item already in indexed list");
-#endif
+                    KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, i);
+                    if (itemIndex.FindOrAdd(ref p))
+                        throw new DuplicateNotAllowedException("Item already in indexed list");
                     array[i++] = item;
                 }
             }
@@ -913,9 +842,7 @@
                 if (added > 0)
                 {
                     addtosize(added);
-#if HASHINDEX
-          reindex(i);
-#endif
+                    reindex(i);
                     fixViewsAfterInsert(added, index);
                     (underlying ?? this).raiseForInsertAll(index, added);
                 }
@@ -935,18 +862,11 @@
             }
         }

-#if HASHINDEX
-    ///
-    /// Insert an item at the front of this list;
-    ///
-    /// <exception cref="DuplicateNotAllowedException">If the item is already in the list</exception>
-    /// <param name="item">The item to insert.</param>
-#else
         ///
         /// Insert an item at the front of this list;
         ///
+        /// <exception cref="DuplicateNotAllowedException">If the item is already in the list</exception>
         /// <param name="item">The item to insert.</param>
-#endif
         [Tested]
         public virtual void InsertFirst(T item)
         {
@@ -956,18 +876,11 @@
         }

-#if HASHINDEX
-    ///
-    /// Insert an item at the back of this list.
-    ///
-    /// <exception cref="DuplicateNotAllowedException">If the item is already in the list</exception>
-    /// <param name="item">The item to insert.</param>
-#else
         ///
         /// Insert an item at the back of this list.
         ///
+        /// <exception cref="DuplicateNotAllowedException">If the item is already in the list</exception>
         /// <param name="item">The item to insert.</param>
-#endif
         [Tested]
         public virtual void InsertLast(T item)
         {
@@ -1004,34 +917,21 @@
                 }
             }
             res.size = j;
-#if HASHINDEX
-      res.reindex(0);
-#endif
+            res.reindex(0);
             return res;
         }

-#if HASHINDEX
-    ///
-    /// Create a new list consisting of the results of mapping all items of this
-    /// list. The new list will use the default item equalityComparer for the item type V.
-    /// <para>The new list will be of type HashedArrayList</para>
-    ///
-    /// <exception cref="DuplicateNotAllowedException">If mapper
-    /// creates duplicates</exception>
-    /// <typeparam name="V">The type of items of the new list</typeparam>
-    /// <param name="mapper">The delegate defining the map.</param>
-    /// <returns>The new list.</returns>
-#else
         ///
         /// Create a new list consisting of the results of mapping all items of this
         /// list. The new list will use the default item equalityComparer for the item type V.
         /// <para>The new list will be of type HashedArrayList</para>
         ///
+        /// <exception cref="DuplicateNotAllowedException">If mapper
+        /// creates duplicates</exception>
         /// <typeparam name="V">The type of items of the new list</typeparam>
         /// <param name="mapper">The delegate defining the map.</param>
         /// <returns>The new list.</returns>
-#endif
         [Tested]
         public virtual IList<V> Map<V>(Func<T, V> mapper)
         {
@@ -1042,29 +942,17 @@
             return map<V>(mapper, res);
         }

-#if HASHINDEX
-    ///
-    /// Create a new list consisting of the results of mapping all items of this
-    /// list. The new list will use a specified item equalityComparer for the item type.
-    /// <para>The new list will be of type HashedArrayList</para>
-    ///
-    /// <exception cref="DuplicateNotAllowedException">If mapper
-    /// creates duplicates</exception>
-    /// <typeparam name="V">The type of items of the new list</typeparam>
-    /// <param name="mapper">The delegate defining the map.</param>
-    /// <param name="itemequalityComparer">The item equalityComparer to use for the new list</param>
-    /// <returns>The new list.</returns>
-#else
         ///
         /// Create a new list consisting of the results of mapping all items of this
         /// list. The new list will use a specified item equalityComparer for the item type.
         /// <para>The new list will be of type HashedArrayList</para>
         ///
+        /// <exception cref="DuplicateNotAllowedException">If mapper
+        /// creates duplicates</exception>
         /// <typeparam name="V">The type of items of the new list</typeparam>
         /// <param name="mapper">The delegate defining the map.</param>
         /// <param name="itemequalityComparer">The item equalityComparer to use for the new list</param>
         /// <returns>The new list.</returns>
-#endif
         public virtual IList<V> Map<V>(Func<T, V> mapper, SCG.IEqualityComparer<V> itemequalityComparer)
         {
             validitycheck();
@@ -1082,11 +970,9 @@
                 {
                     V mappeditem = mapper(array[offset + i]);
                     modifycheck(stamp);
-#if HASHINDEX
-          KeyValuePair<V, int> p = new KeyValuePair<V, int>(mappeditem, i);
-          if (res.itemIndex.FindOrAdd(ref p))
-            throw new ArgumentException("Mapped item already in indexed list");
-#endif
+                    KeyValuePair<V, int> p = new KeyValuePair<V, int>(mappeditem, i);
+                    if (res.itemIndex.FindOrAdd(ref p))
+                        throw new ArgumentException("Mapped item already in indexed list");
                     res.array[i] = mappeditem;
                 }
             res.size = size;
@@ -1325,9 +1211,7 @@
                 array[offset + i] = array[end - i];
                 array[end - i] = swap;
             }
-#if HASHINDEX
-      reindex(offset, offset + size);
-#endif
+            reindex(offset, offset + size);
             //TODO: be more forgiving wrt. disposing
             disposeOverlappingViews(true);
             (underlying ?? this).raiseCollectionChanged();
@@ -1382,9 +1266,7 @@
                 return;
             Sorting.IntroSort<T>(array, offset, size, comparer);
             disposeOverlappingViews(false);
-#if HASHINDEX
-      reindex(offset, offset + size);
-#endif
+            reindex(offset, offset + size);
             (underlying ?? this).raiseCollectionChanged();
         }

@@ -1415,9 +1297,7 @@
                 }
             }
             disposeOverlappingViews(false);
-#if HASHINDEX
-      reindex(offset, offset + size);
-#endif
+            reindex(offset, offset + size);
             (underlying ?? this).raiseCollectionChanged();
         }
         #endregion
@@ -1478,20 +1358,16 @@
             checkRange(start, count);
             start += offset;
             fixViewsBeforeRemove(start, count);
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>();
-      for (int i = start, end = start + count; i < end; i++)
-      {
-        p.Key = array[i];
-        itemIndex.Remove(p);
-      }
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>();
+            for (int i = start, end = start + count; i < end; i++)
+            {
+                p.Key = array[i];
+                itemIndex.Remove(p);
+            }
             Array.Copy(array, start + count, array, start, underlyingsize - start - count);
             addtosize(-count);
             Array.Clear(array, underlyingsize, count);
-#if HASHINDEX
-      reindex(start);
-#endif
+            reindex(start);
             (underlying ?? this).raiseForRemoveInterval(start, count);
         }
         void raiseForRemoveInterval(int start, int count)
@@ -1518,11 +1394,8 @@
             [Tested]
             get
             {
-#if HASHINDEX
-        return Speed.Constant;
-#else
-                return Speed.Linear;
-#endif
+                return Speed.Constant;
+
             }
         }

@@ -1608,9 +1481,7 @@
             {
                 olditem = array[offset + i];
                 array[offset + i] = item;
-#if HASHINDEX
-        itemIndex.Update(new KeyValuePair<T, int>(item, offset + i));
-#endif
+                itemIndex.Update(new KeyValuePair<T, int>(item, offset + i));
                 (underlying ?? this).raiseForUpdate(item, olditem);
                 return true;
             }
@@ -1749,23 +1620,19 @@
             int j = offset;
             int removed = 0;
             int i = offset, end = offset + size;
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>();
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>();
             while (i < end)
             {
                 T item;
                 //pass by a stretch of nodes
                 while (i < end && !toremove.Contains(item = array[i]))
                 {
-#if HASHINDEX
-          if (j < i)
-          {
-            p.Key = item;
-            p.Value = j;
-            itemIndex.Update(p);
-          }
-#endif
+                    if (j < i)
+                    {
+                        p.Key = item;
+                        p.Value = j;
+                        itemIndex.Update(p);
+                    }
                     //if (j<i)
                     array[j] = item;
                     i++; j++;
@@ -1774,10 +1641,8 @@
                 //Remove a stretch of nodes
                 while (i < end && toremove.Remove(item = array[i]))
                 {
-#if HASHINDEX
-          p.Key = item;
-          itemIndex.Remove(p);
-#endif
+                    p.Key = item;
+                    itemIndex.Remove(p);
                     if (mustFire)
                         raiseHandler.Remove(item);
                     removed++;
@@ -1791,9 +1656,7 @@
             Array.Copy(array, offset + size, array, j, underlyingsize - offset - size);
             addtosize(-removed);
             Array.Clear(array, underlyingsize, removed);
-#if HASHINDEX
-      reindex(j);
-#endif
+            reindex(j);
             if (mustFire)
                 raiseHandler.Raise();
         }
@@ -1813,9 +1676,7 @@
             int j = offset;
             int removed = 0;
             int i = offset, end = offset + size;
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>();
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>();
             while (i < end)
             {
                 T item;
@@ -1823,14 +1684,12 @@
                 while (i < end && !predicate(item = array[i]))
                 {
                     updatecheck();
-#if HASHINDEX
-          if (j < i)
-          {
-            p.Key = item;
-            p.Value = j;
-            itemIndex.Update(p);
-          }
-#endif
+                    if (j < i)
+                    {
+                        p.Key = item;
+                        p.Value = j;
+                        itemIndex.Update(p);
+                    }
                     //if (j<i)
                     array[j] = item;
                     i++; j++;
@@ -1841,10 +1700,8 @@
                 while (i < end && predicate(item = array[i]))
                 {
                     updatecheck();
-#if HASHINDEX
-          p.Key = item;
-          itemIndex.Remove(p);
-#endif
+                    p.Key = item;
+                    itemIndex.Remove(p);
                     if (mustFire)
                         raiseHandler.Remove(item);
                     removed++;
@@ -1859,9 +1716,7 @@
             Array.Copy(array, offset + size, array, j, underlyingsize - offset - size);
             addtosize(-removed);
             Array.Clear(array, underlyingsize, removed);
-#if HASHINDEX
-      reindex(j);
-#endif
+            reindex(j);
             if (mustFire)
                 raiseHandler.Raise();
         }
@@ -1879,9 +1734,7 @@
                     return;
                 int oldsize = size;
                 fixViewsBeforeRemove(0, size);
-#if HASHINDEX
-        itemIndex.Clear();
-#endif
+                itemIndex.Clear();
                 array = new T[8];
                 size = 0;
                 (underlying ?? this).raiseForRemoveInterval(offset, oldsize);
@@ -1914,23 +1767,19 @@
             int j = offset;
             int removed = 0;
             int i = offset, end = offset + size;
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>();
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>();
             while (i < end)
             {
                 T item;
                 //pass by a stretch of nodes
                 while (i < end && toretain.Remove(item = array[i]))
                 {
-#if HASHINDEX
-          if (j < i)
-          {
-            p.Key = item;
-            p.Value = j;
-            itemIndex.Update(p);
-          }
-#endif
+                    if (j < i)
+                    {
+                        p.Key = item;
+                        p.Value = j;
+                        itemIndex.Update(p);
+                    }
                     //if (j<i)
                     array[j] = item;
                     i++; j++;
@@ -1939,10 +1788,8 @@
                 //Remove a stretch of nodes
                 while (i < end && !toretain.Contains(item = array[i]))
                 {
-#if HASHINDEX
-          p.Key = item;
-          itemIndex.Remove(p);
-#endif
+                    p.Key = item;
+                    itemIndex.Remove(p);
                     if (mustFire)
                         raiseHandler.Remove(item);
                     removed++;
@@ -1956,9 +1803,7 @@
             Array.Copy(array, offset + size, array, j, underlyingsize - offset - size);
             addtosize(-removed);
             Array.Clear(array, underlyingsize, removed);
-#if HASHINDEX
-      reindex(j);
-#endif
+            reindex(j);
             raiseHandler.Raise();
         }

@@ -1977,9 +1822,7 @@
             int j = offset;
             int removed = 0;
             int i = offset, end = offset + size;
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>();
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>();
             while (i < end)
             {
                 T item;
@@ -1987,14 +1830,12 @@
                 while (i < end && predicate(item = array[i]))
                 {
                     updatecheck();
-#if HASHINDEX
-          if (j < i)
-          {
-            p.Key = item;
-            p.Value = j;
-            itemIndex.Update(p);
-          }
-#endif
+                    if (j < i)
+                    {
+                        p.Key = item;
+                        p.Value = j;
+                        itemIndex.Update(p);
+                    }
                     //if (j<i)
                     array[j] = item;
                     i++; j++;
@@ -2005,10 +1846,8 @@
                 while (i < end && !predicate(item = array[i]))
                 {
                     updatecheck();
-#if HASHINDEX
-          p.Key = item;
-          itemIndex.Remove(p);
-#endif
+                    p.Key = item;
+                    itemIndex.Remove(p);
                     if (mustFire)
                         raiseHandler.Remove(item);
                     removed++;
@@ -2023,9 +1862,7 @@
             Array.Copy(array, offset + size, array, j, underlyingsize - offset - size);
             addtosize(-removed);
             Array.Clear(array, underlyingsize, removed);
-#if HASHINDEX
-      reindex(j);
-#endif
+            reindex(j);
             raiseHandler.Raise();
         }

@@ -2041,26 +1878,12 @@
         public virtual bool ContainsAll(SCG.IEnumerable<T> items)
         {
             validitycheck();
-#if HASHINDEX
-      foreach (T item in items)
-        if (indexOf(item) < 0)
-          return false;
-
-      return true;
-#else
-            //TODO: use aux hash bag to obtain linear time procedure
-            HashBag<T> tomatch = new HashBag<T>(itemequalityComparer);
-            tomatch.AddAll(items);
-            if (tomatch.Count == 0)
-                return true;
-            for (int i = offset, end = offset + size; i < end; i++)
-            {
-                tomatch.Remove(array[i]);
-                if (tomatch.Count == 0)
-                    return true;
-            }
-            return false;
-#endif
+            foreach (T item in items)
+                if (indexOf(item) < 0)
+                    return false;
+
+            return true;
+
         }

@@ -2074,15 +1897,8 @@
         public virtual int ContainsCount(T item)
         {
             validitycheck();
-#if HASHINDEX
-      return indexOf(item) >= 0 ? 1 : 0;
-#else
-            int count = 0;
-            for (int i = 0; i < size; i++)
-                if (equals(item, array[offset + i]))
-                    count++;
-            return count;
-#endif
+            return indexOf(item) >= 0 ? 1 : 0;
+
         }

         ///
@@ -2091,13 +1907,8 @@
         /// <returns></returns>
         public virtual ICollectionValue<T> UniqueItems()
         {
-#if HASHINDEX
-      return this;
-#else
-            HashBag<T> hashbag = new HashBag<T>(itemequalityComparer);
-            hashbag.AddAll(this);
-            return hashbag.UniqueItems();
-#endif
+            return this;
+
         }

         ///
@@ -2106,13 +1917,8 @@
         /// <returns></returns>
         public virtual ICollectionValue<KeyValuePair<T, int>> ItemMultiplicities()
         {
-#if HASHINDEX
-      return new MultiplicityOne<T>(this);
-#else
-            HashBag<T> hashbag = new HashBag<T>(itemequalityComparer);
-            hashbag.AddAll(this);
-            return hashbag.ItemMultiplicities();
-#endif
+            return new MultiplicityOne<T>(this);
+
         }

@@ -2126,42 +1932,8 @@
         [Tested]
         public virtual void RemoveAllCopies(T item)
         {
-#if HASHINDEX
-      Remove(item);
-#else
-            updatecheck();
-            if (size == 0)
-                return;
-            RaiseForRemoveAllHandler raiseHandler = new RaiseForRemoveAllHandler(underlying ?? this);
-            bool mustFire = raiseHandler.MustFire;
-            ViewHandler viewHandler = new ViewHandler(this);
-            int j = offset;
-            int removed = 0;
-            int i = offset, end = offset + size;
-            while (i < end)
-            {
-                //pass by a stretch of nodes
-                while (i < end && !equals(item, array[i]))
-                    array[j++] = array[i++];
-                viewHandler.skipEndpoints(removed, i);
-                //Remove a stretch of nodes
-                while (i < end && equals(item, array[i]))
-                {
-                    if (mustFire)
-                        raiseHandler.Remove(array[i]);
-                    removed++;
-                    i++;
-                    viewHandler.updateViewSizesAndCounts(removed, i);
-                }
-            }
-            if (removed == 0)
-                return;
-            viewHandler.updateViewSizesAndCounts(removed, underlyingsize);
-            Array.Copy(array, offset + size, array, j, underlyingsize - offset - size);
-            addtosize(-removed);
-            Array.Clear(array, underlyingsize, removed);
-            raiseHandler.Raise();
-#endif
+            Remove(item);
+
         }

@@ -2225,30 +1997,28 @@
             }

-#if HASHINDEX
-      if (underlyingsize != itemIndex.Count)
-      {
-        Logger.Log(string.Format("size ({0})!= index.Count ({1})", size, itemIndex.Count));
-        retval = false;
-      }
-
-      for (int i = 0; i < underlyingsize; i++)
-      {
-        KeyValuePair<T, int> p = new KeyValuePair<T, int>(array[i]);
-
-        if (!itemIndex.Find(ref p))
-        {
-          Logger.Log(string.Format("Item {1} at {0} not in hashindex", i, array[i]));
-          retval = false;
-        }
-
-        if (p.Value != i)
-        {
-          Logger.Log(string.Format("Item {1} at {0} has hashindex {2}", i, array[i], p.Value));
-          retval = false;
-        }
-      }
-#endif
+            if (underlyingsize != itemIndex.Count)
+            {
+                Logger.Log(string.Format("size ({0})!= index.Count ({1})", size, itemIndex.Count));
+                retval = false;
+            }
+
+            for (int i = 0; i < underlyingsize; i++)
+            {
+                KeyValuePair<T, int> p = new KeyValuePair<T, int>(array[i]);
+
+                if (!itemIndex.Find(ref p))
+                {
+                    Logger.Log(string.Format("Item {1} at {0} not in hashindex", i, array[i]));
+                    retval = false;
+                }
+
+                if (p.Value != i)
+                {
+                    Logger.Log(string.Format("Item {1} at {0} has hashindex {2}", i, array[i], p.Value));
+                    retval = false;
+                }
+            }
             return retval;
         }

@@ -2266,11 +2036,8 @@
             [Tested]
             get
             {
-#if HASHINDEX
-        return false;
-#else
-                return true;
-#endif
+                return false;
+
             }
         }

@@ -2283,11 +2050,8 @@
         {
             get
             {
-#if HASHINDEX
-        return true;
-#else
-                return false;
-#endif
+                return true;
+
             }
         }

@@ -2300,15 +2064,11 @@
         public virtual bool Add(T item)
         {
             updatecheck();
-#if HASHINDEX
-      KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, size + offset);
-      if (itemIndex.FindOrAdd(ref p))
-        return false;
-#endif
+            KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, size + offset);
+            if (itemIndex.FindOrAdd(ref p))
+                return false;
             baseinsert(size, item);
-#if HASHINDEX
-      reindex(size + offset);
-#endif
+            reindex(size + offset);
             (underlying ?? this).raiseForAdd(item);
             return true;
         }
@@ -2336,11 +2096,9 @@
             {
                 foreach (T item in items)
                 {
-#if HASHINDEX
-          KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, i);
-          if (itemIndex.FindOrAdd(ref p))
-            continue;
-#endif
+                    KeyValuePair<T, int> p = new KeyValuePair<T, int>(item, i);
+                    if (itemIndex.FindOrAdd(ref p))
+                        continue;
                     array[i++] = item;
                 }
             }
@@ -2355,9 +2113,7 @@
                 if (added > 0)
                 {
                     addtosize(added);
-#if HASHINDEX
-          reindex(i);
-#endif
+                    reindex(i);
                     fixViewsAfterInsert(added, i - added);
                     (underlying ?? this).raiseForAddAll(i - added, added);
                 }
@@ -2410,56 +2166,6 @@
         }
         #endregion

-#if HASHINDEX
-#else
-        #region IStack<T> Members
-
-        ///
-        /// Push an item to the top of the stack.
-        ///
-        /// <param name="item">The item</param>
-        [Tested]
-        public virtual void Push(T item)
-        {
-            InsertLast(item);
-        }
-
-        ///
-        /// Pop the item at the top of the stack from the stack.
-        ///
-        /// <returns>The popped item.</returns>
-        [Tested]
-        public virtual T Pop()
-        {
-            return RemoveLast();
-        }
-
-        #endregion
-
-        #region IQueue<T> Members
-
-        ///
-        /// Enqueue an item at the back of the queue.
-        ///
-        /// <param name="item">The item</param>
-        [Tested]
-        public virtual void Enqueue(T item)
-        {
-            InsertLast(item);
-        }
-
-        ///
-        /// Dequeue an item from the front of the queue.
-        ///
-        /// <returns>The item</returns>
-        [Tested]
-        public virtual T Dequeue()
-        {
-            return RemoveFirst();
-        }
-
-        #endregion
-#endif
         #region IDisposable Members

         ///
@@ -2527,9 +2233,7 @@
       {
         array[i] = (T)(info.GetValue("elem" + i,typeof(T)));
       }
-#if HASHINDEX
       reindex(0);
-#endif
     }

     ///


Fixed potential issue if a layer was added/removed before finishing a snapshot.

--- Pinta.Core/HistoryItems/CompoundHistoryItem.cs
+++ Pinta.Core/HistoryItems/CompoundHistoryItem.cs
@@ -78,7 +78,7 @@

 		public void FinishSnapshotOfImage ()
 		{
-			for (int i = 0; i < PintaCore.Workspace.ActiveDocument.Layers.Count; ++i) {
+			for (int i = 0; i < snapshots.Count; ++i) {
 				history_stack.Add (new SimpleHistoryItem (string.Empty, string.Empty, snapshots[i], i));
 			}
 			snapshots.Clear ();


Add mime type for ogg audio

Add mime type for ogg audio

--- src/BloomExe/web/ServerBase.cs
+++ src/BloomExe/web/ServerBase.cs
@@ -540,6 +540,7 @@
 				case ".txt": return "text/plain";
 				case ".svg": return "image/svg+xml";
 				case ".mp3": return "audio/mpeg";
+				case ".ogg": return "audio/ogg";
 				default: return "application/octet-stream";
 			}
 		}


Re-enable tests that were pending bug fix

The fix for issue #4 was addressed in
7e1f01280b297f99e2cd3e47e54b7ff1fb140e70 but the tests, which were
added in ece2756c420bacb28a3f0a3692486fb7237fcf8e, were still left to
be ignored.

--- StackTraceParserTests.cs
+++ StackTraceParserTests.cs
@@ -343,7 +343,6 @@
                at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies, IResultTransformer forcedResultTransformer)
                at NHibernate.Impl.MultiQueryImpl.DoList()";

-        [Ignore("Pending fix for issue #4 (https://github.com/atifaziz/StackTraceParser/issues/4)")]
         [StackTraceTestCase(RunawayBugStackTrace, 00, @"System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)")]
         [StackTraceTestCase(RunawayBugStackTrace, 01, @"System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)")]
         [StackTraceTestCase(RunawayBugStackTrace, 02, @"System.Reflection.Assembly.Load(AssemblyName assemblyRef)")]


Fixed multi-selection bug in search results

--- Plugins/AssetUsageDetector/Editor/Utilities.cs
+++ Plugins/AssetUsageDetector/Editor/Utilities.cs
@@ -181,6 +181,9 @@
 			if( obj == null )
 				return;

+			if( obj is Component )
+				obj = ( (Component) obj ).gameObject;
+
 			Event e = Event.current;

 			// If CTRL or Shift keys are pressed, do a multi-select;
@@ -189,25 +192,10 @@
 				Selection.activeObject = obj.PingInEditor();
 			else
 			{
-				Component objAsComp = obj as Component;
-				GameObject objAsGO = obj as GameObject;
-				int selectionIndex = -1;
-
 				Object[] selection = Selection.objects;
-				for( int i = 0; i < selection.Length; i++ )
-				{
-					Object selected = selection[i];
-
-					// Don't allow including both a gameobject and one of its components in the selection
-					if( selected == obj || ( objAsComp != null && selected == objAsComp.gameObject ) ||
-						( objAsGO != null && selected is Component && ( (Component) selected ).gameObject == objAsGO ) )
-					{
-						selectionIndex = i;
-						break;
-					}
-				}
-
 				Object[] newSelection;
+
+				int selectionIndex = Array.IndexOf( selection, obj );
 				if( selectionIndex == -1 )
 				{
 					// Include object in selection


Catch different server available message for .NET 451

--- src/Burble/SimpleHttpClient.cs
+++ src/Burble/SimpleHttpClient.cs
@@ -26,7 +26,7 @@
          {
             throw new HttpClientTimeoutException(request);
          }
-         catch (HttpRequestException e) when (e.InnerException.Message == "The server name or address could not be resolved")
+         catch (HttpRequestException e) when (IsServerUnavailable(e))
          {
             throw new HttpClientServerUnavailableException(request);
          }
@@ -35,5 +35,14 @@
             throw new HttpClientException(request, e);
          }
       }
+
+      private static bool IsServerUnavailable(HttpRequestException e)
+      {
+#if NET451
+         return e.InnerException.Message.StartsWith("The remote name could not be resolved: ");
+#else
+         return e.InnerException.Message == "The server name or address could not be resolved";
+#endif
+      }
    }
 }


added api to take a screenshot at any time and embed it in the test log. Existing apis only embed on failure

--- ProtoTest.Golem/WebDriver/WebDriverTestBase.cs
+++ ProtoTest.Golem/WebDriver/WebDriverTestBase.cs
@@ -47,6 +47,21 @@
         {
             driver.Navigate().GoToUrl(url);
             return (T) Activator.CreateInstance(typeof (T));
+        }
+
+        /// <summary>
+        /// Take a screenshot and embed it within the TestLog.
+        /// </summary>
+        /// <param name="message">Associate a message with the screenshot (optional)</param>
+        public static void LogScreenShot(string message=null)
+        {
+            Image screenshot = testData.driver.GetScreenshot();
+            if (screenshot != null)
+            {
+                if (message != null) TestLog.Default.WriteLine("!------- " + message + " --------!");
+
+                TestLog.Default.EmbedImage(null, screenshot);
+            }
         }

         private void LogScreenshotIfTestFailed()


Fixed message when deleting all articles from feed.

--- CRR/Views/ArticleListView.cs
+++ CRR/Views/ArticleListView.cs
@@ -145,7 +145,7 @@
         choices.Add(Config.Global.UI.Strings.PromptAnswerYes, 1);
         choices.Add(Config.Global.UI.Strings.PromptAnswerNo, 2);

-        var dialog = new Dialog(Config.Global.UI.Strings.PromptMarkAll, choices);
+        var dialog = new Dialog(Config.Global.UI.Strings.PromptDeleteAll, choices);
         dialog.ItemSelected += DeleteAll_ItemSelected;
         dialog.Show();


adjusted the Anchor property of the "Built-in Enums Map..." button on the Parameters form so that it behaves well when stretching the form.

--- CS/Snoop/Forms/Parameters.cs
+++ CS/Snoop/Forms/Parameters.cs
@@ -292,6 +292,7 @@
             //
             // m_bnParamEnumsMap
             //
+      this.m_bnParamEnumsMap.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
             this.m_bnParamEnumsMap.Location = new System.Drawing.Point(153, 459);
             this.m_bnParamEnumsMap.Name = "m_bnParamEnumsMap";
             this.m_bnParamEnumsMap.Size = new System.Drawing.Size(130, 23);


CRQ-14551 : fix

CRQ-14551 : fix

--- Sdl.Web.Tridion.Templates.R2/TemplateR2Base.cs
+++ Sdl.Web.Tridion.Templates.R2/TemplateR2Base.cs
@@ -71,7 +71,7 @@
             if (!string.IsNullOrEmpty(schemasForEmbed))
             {
                 Logger.Info($"schemasToEmbedInRichText set to '{schemasForEmbed}'.");
-                schemasForEmbedList = schemasForEmbed.Split(';').Select(s => s.Trim().ToLower()).ToList();
+                schemasForEmbedList = schemasForEmbed.Split(';').Select(s => s.Trim()).ToList();
             }
             return schemasForEmbedList;
         }


Refactor GetLastMeasurement(string name) to simplify


Added костыль

Added костыль


removed unused hotkeys

removed unused hotkeys

--- TCC.Core/KeyboardHook.cs
+++ TCC.Core/KeyboardHook.cs
@@ -55,21 +55,17 @@
                 if (WindowManager.InfoWindow.IsVisible) WindowManager.InfoWindow.HideWindow();
                 else InfoWindowViewModel.Instance.ShowWindow();
             }
-            if (e.Key == Settings.Settings.ShowAllHotkey.Key && e.Modifier == Settings.Settings.ShowAllHotkey.Modifier)
-            {
-
-            }
             if (e.Key == Keys.K && e.Modifier == ModifierKeys.Control)
             {
                 if (WindowManager.SkillConfigWindow.IsVisible) WindowManager.SkillConfigWindow.Close();
                 else WindowManager.SkillConfigWindow.ShowWindow();
             }
-            if (e.Key == Settings.Settings.LootSettingsHotkey.Key && e.Modifier == Settings.Settings.LootSettingsHotkey.Modifier)
-            {
-                if (!GroupWindowViewModel.Instance.AmILeader) return;
-                if (!Proxy.Proxy.IsConnected) return;
-                Proxy.Proxy.LootSettings();
-            }
+            //if (e.Key == Settings.Settings.LootSettingsHotkey.Key && e.Modifier == Settings.Settings.LootSettingsHotkey.Modifier)
+            //{
+            //    if (!GroupWindowViewModel.Instance.AmILeader) return;
+            //    if (!Proxy.Proxy.IsConnected) return;
+            //    Proxy.Proxy.LootSettings();
+            //}

         }


class window changecooldown handling

class window changecooldown handling

--- TCC.Core/SkillManager.cs
+++ TCC.Core/SkillManager.cs
@@ -87,7 +87,16 @@
         {
             if (SkillsDatabase.TryGetSkill(id, SessionManager.CurrentPlayer.Class, out Skill skill))
             {
-                CooldownBarWindowManager.Instance.AddOrRefreshSkill(new SkillCooldown(skill, cd, CooldownType.Skill, CooldownBarWindowManager.Instance.Dispatcher));
+                if (SettingsManager.ClassWindowOn && ClassWindowViewModel.ClassWindowExists())
+                {
+
+                    WindowManager.ClassWindow.Context.ChangeSkillCooldown(skill, cd);
+                }
+                else
+                {
+                    CooldownBarWindowManager.Instance.AddOrRefreshSkill(new SkillCooldown(skill, cd, CooldownType.Skill, CooldownBarWindowManager.Instance.Dispatcher));
+                }
+
             }

         }


made class public

made class public

--- TCC.UI/Data/Character.cs
+++ TCC.UI/Data/Character.cs
@@ -6,7 +6,7 @@

 namespace TCC
 {
-    class Character
+    public class Character
     {
         public string Name { get; set; }
         public Class Class { get; set; }


Update service startup logging

Update service startup logging

--- src/Certify.Service/Program.cs
+++ src/Certify.Service/Program.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Net.Http;
+using System.ServiceProcess;
 using System.Threading.Tasks;
 using Certify.Management;
 using Microsoft.Owin.Hosting;
@@ -23,13 +24,15 @@
                 x.OnException(ex =>
                 {
                     // Do something with the exception
-                    LogException(ex);
+                    LogEvent(ex, includeReporting: true);
                 });
 #if DEBUG
                 x.SetInstanceName("Debug");
 #else
                 // x.SetInstanceName("CertifySSLManager.Service");
 #endif
+                x.DependsOn("HTTP Service");
+
                 // FIXME: we should offer option during setup to configure this as a service account
                 // account requires admin rights in IIS (and wwwroot etc) and permission to
                 // administer certificates in certificate store
@@ -52,18 +55,26 @@
             });
         }

-        private static void LogException(object exceptionObject)
-        {
-            // log exception
+        public static void LogEvent(object exceptionObject, string msg = null, bool includeReporting = false)
+        {
+            // log event/exception
             try
             {
                 var logPath = Util.GetAppDataFolder("logs") + "\\service.exceptions.log";
-                System.IO.File.AppendAllText(logPath, "Service Exception :: [" + DateTime.Now + "] :: " + ((Exception)exceptionObject).ToString());
+                if (msg != null)
+                {
+                    System.IO.File.AppendAllText(logPath, "\r\n[" + DateTime.Now + "] :: " + msg);
+                }
+
+                if (exceptionObject != null)
+                {
+                    System.IO.File.AppendAllText(logPath, "\r\nService Exception :: [" + DateTime.Now + "] :: " + ((Exception)exceptionObject).ToString());
+                }
             }
             catch { }

             //submit diagnostic info if connection available and status reporting enabled
-            if (Management.CoreAppSettings.Current.EnableStatusReporting)
+            if (Management.CoreAppSettings.Current.EnableStatusReporting && includeReporting)
             {
                 var client = new HttpClient();

@@ -73,7 +84,7 @@
                     new Models.Shared.FeedbackReport
                     {
                         EmailAddress = "(service exception)",
-                        Comment = "An unhandled service exception has occurred.: " + ((Exception)exceptionObject).ToString(),
+                        Comment = "An unhandled service exception has occurred.: " + ((Exception)exceptionObject)?.ToString(),
                         IsException = true,
                         AppVersion = appVersion.ToString(),
                         SupportingData = new
@@ -99,13 +110,14 @@
                 }
             }
         }
+
         private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
         {
             // an unhandled exception has caused the service to crash

             if (e.ExceptionObject != null)
             {
-                LogException(e.ExceptionObject);
+                LogEvent(e.ExceptionObject, includeReporting: true);
             }
         }
     }
@@ -114,8 +126,46 @@
     {
         private IDisposable _webApp;

+        public string DiagnoseServices()
+        {
+            // var devices = ServiceController.GetDevices();
+            // var services = ServiceController.GetServices();
+
+            string httpStatus = "Unknown";
+
+            try
+            {
+                var sc = new ServiceController("HTTP Service");
+                switch (sc.Status)
+                {
+                    case ServiceControllerStatus.Running:
+                        httpStatus = "Running";
+                        break;
+                    case ServiceControllerStatus.Stopped:
+                        httpStatus = "Stopped";
+                        break;
+                    case ServiceControllerStatus.Paused:
+                        httpStatus = "Paused";
+                        break;
+                    case ServiceControllerStatus.StopPending:
+                        httpStatus = "Stopping";
+                        break;
+                    case ServiceControllerStatus.StartPending:
+                        httpStatus = "Starting";
+                        break;
+                    default:
+                        httpStatus = "Status Changing";
+                        break;
+                }
+            }
+            catch { }
+
+            return $"System Http Service: {httpStatus}";
+        }
+
         public void Start()
         {
+
             var serviceConfig = SharedUtils.ServiceConfigManager.GetAppServiceConfig();

             var serviceUri = $"http://{serviceConfig.Host}:{serviceConfig.Port}";
@@ -123,10 +173,16 @@
             try
             {
                 _webApp = WebApp.Start<APIHost>(serviceUri);
-            }
-            catch (Exception)
-            {
-                System.Diagnostics.Debug.WriteLine($"Service failed to listen on {serviceUri}. Attempting to reallocate port.");
+                Program.LogEvent(null, $"Service API bound OK to {serviceUri}", false);
+            }
+            catch (Exception exp)
+            {
+                var httpSysStatus = DiagnoseServices();
+
+                var msg = $"Service failed to listen on {serviceUri}. :: {httpSysStatus} :: Attempting to reallocate port. {exp.ToString()}";
+
+                Program.LogEvent(exp, msg, false);
+
                 // failed to listen on service uri, attempt reconfiguration of port.
                 int currentPort = serviceConfig.Port;

@@ -137,6 +193,8 @@
                 // if the http listener cannot bind here then the entire service will fail to start
                 _webApp = WebApp.Start<APIHost>(serviceUri);

+                Program.LogEvent(null, $"Service API bound OK to {serviceUri}", false);
+
                 // if that worked, save the new port setting
                 SharedUtils.ServiceConfigManager.SetAppServicePort(newPort);


Bug fixes. Config null exception on data provider

--- src/AppStudio.DataProviders/DataProviderBase.cs
+++ src/AppStudio.DataProviders/DataProviderBase.cs
@@ -11,7 +11,13 @@
     public abstract class DataProviderBase<TConfig>
     {
         TConfig _config;
-        protected TConfig Config { get; set; }
+        protected TConfig Config
+        {
+            get
+            {
+                return _config;
+            }
+        }

         int _pageSize;

@@ -62,7 +68,7 @@
                     return result;
                 }
             }
-
+
             return new TSchema[0];
         }

@@ -95,5 +101,5 @@
             return GetDefaultParserInternal(config);
         }
         protected abstract IParser<TSchema> GetDefaultParserInternal(TConfig config);
-    }
+    }
 }


cleanup

cleanup

--- src/Chromamboo/Bootstrapper.cs
+++ src/Chromamboo/Bootstrapper.cs
@@ -4,7 +4,7 @@
 {
     public class Bootstrapper : IBoostrapper
     {
-        private INotificationBuilder notificationBuilder;
+        private readonly INotificationBuilder notificationBuilder;

         public Bootstrapper(INotificationBuilder notificationBuilder)
         {


Fixes to GetMetadata

Fixes to GetMetadata

--- Chronological/Environment.cs
+++ Chronological/Environment.cs
@@ -56,7 +56,7 @@

         }

-        public async Task<Availability> GetMetadataAsync(DateTime from, DateTime to, string queryName = "TimeSeriesInsightsMetadataQuery")
+        public async Task<EnvironmentMetadata> GetMetadataAsync(DateTime from, DateTime to, string queryName = "TimeSeriesInsightsMetadataQuery")
         {
             Uri uri = new UriBuilder("https", EnvironmentFqdn)
             {
@@ -84,7 +84,7 @@
             {
                 string responseJson = await sr.ReadToEndAsync();

-                var result = JsonConvert.DeserializeObject<Availability>(responseJson);
+                var result = JsonConvert.DeserializeObject<EnvironmentMetadata>(responseJson);
                 return result;
             }


Model defined in terms of Vgk, Vpk instead of Vg, Vp, Vk

--- Circuit/Components/Triode.cs
+++ Circuit/Components/Triode.cs
@@ -9,7 +9,7 @@
 {
     public abstract class TriodeModel
     {
-        public abstract void Evaluate(Expression Vp, Expression Vg, Expression Vk, out Expression Ip, out Expression Ig, out Expression Ik);
+        public abstract void Evaluate(Expression Vpk, Expression Vgk, out Expression Ip, out Expression Ig, out Expression Ik);
     }

     /// <summary>
@@ -35,15 +35,12 @@
             : this(100.0m, 1.4m, 1060.0m, 600.0m, 300.0m, 1.0e6m, 0.33m)
         { }

-        public override void Evaluate(Expression Vp, Expression Vg, Expression Vk, out Expression Ip, out Expression Ig, out Expression Ik)
+        public override void Evaluate(Expression Vpk, Expression Vgk, out Expression Ip, out Expression Ig, out Expression Ik)
         {
-            Expression Vpk = Vp - Vk;
-            Expression Vgk = Vg - Vk;
-
             Expression ex = Kp * (1 / Mu + Vgk / Call.Sqrt(Kvb + Vpk * Vpk));

             // ln(1+e^x) = x for large x, and large x causes numerical issues.
-            Expression E1 = Call.If(ex > 10, ex, Call.Ln(1 + Call.Exp(ex))) * Vpk / Kp;
+            Expression E1 = Call.If(ex > 5, ex, Call.Ln(1 + Call.Exp(ex))) * Vpk / Kp;

             Ip = Call.If(E1 > 0, (E1 ^ Ex) / Kg, Constant.Zero);
             // TODO: Use Max instead?
@@ -70,11 +67,8 @@
             : this(83.5m, 1.73e-6m)
         { }

-        public override void Evaluate(Expression Vp, Expression Vg, Expression Vk, out Expression Ip, out Expression Ig, out Expression Ik)
+        public override void Evaluate(Expression Vpk, Expression Vgk, out Expression Ip, out Expression Ig, out Expression Ik)
         {
-            Expression Vpk = Vp - Vk;
-            Expression Vgk = Vg - Vk;
-
             Expression Ed = Mu * Vgk + Vpk;
             Ip = Call.If(Ed > 0, K * (Ed ^ 1.5), 0);
             Ig = 0;
@@ -121,7 +115,15 @@
         public override void Analyze(IList<Equal> Mna, IList<Expression> Unknowns)
         {
             Expression Ip, Ig, Ik;
-            model.Evaluate(p.V, g.V, k.V, out Ip, out Ig, out Ik);
+
+            Expression Vpk = DependentVariable(Name + "pk", t);
+            Expression Vgk = DependentVariable(Name + "gk", t);
+            Mna.Add(Equal.New(Vpk, p.V - k.V));
+            Mna.Add(Equal.New(Vgk, g.V - k.V));
+            Unknowns.Add(Vpk);
+            Unknowns.Add(Vgk);
+
+            model.Evaluate(Vpk, Vgk, out Ip, out Ig, out Ik);
             p.i = Ip;
             g.i = Ig;
             k.i = Ik;


Fix problem with sync on spreadsheet export

--- src/BloomExe/web/controllers/BookCommandsApi.cs
+++ src/BloomExe/web/controllers/BookCommandsApi.cs
@@ -42,7 +42,14 @@
 		}
 		public void RegisterWithApiHandler(BloomApiHandler apiHandler)
 		{
-
+			// Must not require sync, because it launches a Bloom dialog, which will make other api requests
+			// that will be blocked if this is locked.
+			apiHandler.RegisterEndpointHandlerExact("bookCommand/exportToSpreadsheet",
+				(request) =>
+				{
+					_spreadsheetApi.ShowExportToSpreadsheetUI(GetBookObjectFromPost(request));
+					request.PostSucceeded();
+				}, true, false);
 			apiHandler.RegisterEndpointHandler("bookCommand/", HandleBookCommand, true);
 		}

@@ -63,9 +70,6 @@
 					break;
 				case "exportToWord":
 					HandleExportToWord(book);
-					break;
-				case "exportToSpreadsheet":
-					_spreadsheetApi.ShowExportToSpreadsheetUI(book);
 					break;
 				// As currently implemented this would more naturally go in CollectionApi, since it adds a book
 				// to the collection (a backup). However, we are probably going to change how backups are handled


Start with new UI, temp disable gablarski://

--- src/Clients/Windows/Program.cs
+++ src/Clients/Windows/Program.cs
@@ -187,12 +187,14 @@
 			Application.EnableVisualStyles ();
 			Application.SetCompatibleTextRenderingDefault (false);

-			var m = new MainForm();
-			m.Show();
+			SetupSocial();
+
+			MainWindow window = new MainWindow();
+			window.Show();

 			UpdateTaskbarServers();

-			if (args.Length > 0)
+			/*if (args.Length > 0)
 			{
 				int id;
 				if (Int32.TryParse (args[0], out id))
@@ -218,9 +220,10 @@
 			{
 				if (!m.ShowConnect (true))
 					return;
-			}
-
-			Application.Run (m);
+			}*/
+
+			System.Windows.Application app = new System.Windows.Application();
+			app.Run (window);

 			Settings.Save();
 		}