Fixed NullReferenceExceptions in the MeterDataSet constructor used by the COMTRADE export in openSEE.

--- Source/Libraries/FaultData/DataSets/MeterDataSet.cs
+++ Source/Libraries/FaultData/DataSets/MeterDataSet.cs
@@ -81,10 +81,10 @@
                 FilePath = (new TableOperations<DataFile>(connection)).QueryRecordWhere("FileGroupID = {0}", evt.FileGroupID).FilePath;
                 FileGroup = (new TableOperations<FileGroup>(connection)).QueryRecordWhere("ID = {0}", evt.FileGroupID);
                 Configuration.LineLength = (new TableOperations<Line>(connection)).QueryRecordWhere("ID = {0}", evt.LineID).Length;
-                Configuration.X0 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID).X0;
-                Configuration.X1 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID).X1;
-                Configuration.R0 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID).R0;
-                Configuration.R1 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID).R1;
+                Configuration.X0 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID)?.X0;
+                Configuration.X1 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID)?.X1;
+                Configuration.R0 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID)?.R0;
+                Configuration.R1 = (new TableOperations<LineImpedance>(connection)).QueryRecordWhere("LineID = {0}", evt.LineID)?.R1;
                 DataGroup dataGroup = ToDataGroup((new TableOperations<EventData>(connection)).QueryRecordWhere("ID = {0}", evt.EventDataID).TimeDomainData);
                 DataSeries = dataGroup.DataSeries.Where(ds=> ds.SeriesInfo.Channel.MeasurementType.Name != "Digital").ToList();
                 Digitals = dataGroup.DataSeries.Where(ds => ds.SeriesInfo.Channel.MeasurementType.Name == "Digital").ToList();


Out parameters removed from MethodRewriter.

--- Source/LogSpectRewriter/Rewriting/MethodRewriter.cs
+++ Source/LogSpectRewriter/Rewriting/MethodRewriter.cs
@@ -53,31 +53,31 @@

         public void Rewrite(MethodDefinition method)
         {
-            FieldDefinition methodLoggerField;
-            this.CreateMethodLoggerField(method, out methodLoggerField);
-            this.RewriteMethodWithLogging(methodLoggerField, method);
-        }
-
-        private void CreateMethodLoggerField(MethodDefinition method, out FieldDefinition methodLoggerField)
-        {
-            CustomAttribute compilerGeneratedAttribute = new CustomAttribute(this.compilerGeneratedAttributeConstructor);
-
-            methodLoggerField = new FieldDefinition(
+            FieldDefinition methodLoggerField = new FieldDefinition(
                 string.Format("<>{0}_{1:x8}", method.Name, method.FullName.GetHashCode()),
                 Mono.Cecil.FieldAttributes.Private | Mono.Cecil.FieldAttributes.Static,
                 this.methodLogger);
-            methodLoggerField.CustomAttributes.Add(compilerGeneratedAttribute);
-
+            methodLoggerField.CustomAttributes.Add(new CustomAttribute(this.compilerGeneratedAttributeConstructor));
             method.DeclaringType.Fields.Add(methodLoggerField);
-        }
-
-        private void RewriteMethodWithLogging(FieldDefinition methodLoggerField, MethodDefinition method)
-        {
-            VariableDefinition argsVariable;
-            VariableDefinition returnValueVariable;
-            VariableDefinition exceptionVariable;
-            this.CreateVariables(method, out argsVariable, out returnValueVariable, out exceptionVariable);
-
+
+            VariableDefinition argsVariable = new VariableDefinition("<>args", this.objectArray);
+            method.Body.Variables.Add(argsVariable);
+
+            VariableDefinition returnValueVariable = null;
+            if (method.MethodReturnType.ReturnType.MetadataType != MetadataType.Void)
+            {
+                returnValueVariable = new VariableDefinition("<>returnValue", method.ReturnType);
+                method.Body.Variables.Add(returnValueVariable);
+            }
+
+            VariableDefinition exceptionVariable = new VariableDefinition("<>exception", this.exception);
+            method.Body.Variables.Add(exceptionVariable);
+
+            this.RewriteBody(methodLoggerField, method, argsVariable, returnValueVariable, exceptionVariable);
+        }
+
+        private void RewriteBody(FieldDefinition methodLoggerField, MethodDefinition method, VariableDefinition argsVariable, VariableDefinition returnValueVariable, VariableDefinition exceptionVariable)
+        {
             IEnumerable<Instruction> beforeTryInstructions = this.CreateBeforeTryInstructions(method, methodLoggerField, argsVariable);
             IList<Instruction> tryBodyInstructions = this.CreateTryBodyInstructions(method, methodLoggerField, returnValueVariable, argsVariable);
             IList<Instruction> catchBodyInstructions = this.CreateCatchBodyInstructions(methodLoggerField, exceptionVariable);
@@ -112,26 +112,6 @@

             method.Body.OptimizeMacros();
             method.Body.InitLocals = true;
-        }
-
-        private void CreateVariables(
-            MethodDefinition method,
-            out VariableDefinition argsVariable,
-            out VariableDefinition returnValueVariable,
-            out VariableDefinition exceptionVariable)
-        {
-            argsVariable = new VariableDefinition("<>args", this.objectArray);
-            method.Body.Variables.Add(argsVariable);
-
-            returnValueVariable = null;
-            if (method.MethodReturnType.ReturnType.MetadataType != MetadataType.Void)
-            {
-                returnValueVariable = new VariableDefinition("<>returnValue", method.ReturnType);
-                method.Body.Variables.Add(returnValueVariable);
-            }
-
-            exceptionVariable = new VariableDefinition("<>exception", this.exception);
-            method.Body.Variables.Add(exceptionVariable);
         }

         /// <summary>


TEST: Remove some duplication in the Select-String tests.

--- Source/ReferenceTests/Commands/SelectStringTests.cs
+++ Source/ReferenceTests/Commands/SelectStringTests.cs
@@ -8,18 +8,30 @@

 namespace ReferenceTests.Commands
 {
-     [TestFixture]
+    [TestFixture]
     public class SelectStringTests : ReferenceTestBase
     {
-        [Test]
-        public void FileWithSingleLineAndPatternMatchesTextInLine()
-        {
-            string fileName = CreateFile("first line", ".txt");
-
-            string command = string.Format("Select-String -Path '{0}' -Pattern 'first'", fileName);
-            MatchInfo match = ReferenceHost.RawExecute(command)
+        MatchInfo RawExecuteSingleMatch(string command)
+        {
+            return ReferenceHost.RawExecute(command)
                 .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
                 .Single();
+        }
+
+        private MatchInfo[] RawExecuteMultipleMatches(string command)
+        {
+            return ReferenceHost.RawExecute(command)
+                .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
+                .ToArray();
+        }
+
+        [Test]
+        public void FileWithSingleLineAndPatternMatchesTextInLine()
+        {
+            string fileName = CreateFile("first line", ".txt");
+
+            string command = string.Format("Select-String -Path '{0}' -Pattern 'first'", fileName);
+            MatchInfo match = RawExecuteSingleMatch(command);
             Match regexMatch = match.Matches.FirstOrDefault();

             Assert.IsNull(match.Context);
@@ -75,9 +87,7 @@
             string fileName = CreateFile(NewlineJoin("first line", "second line"), ".txt");

             string command = string.Format("Select-String 'line' '{0}'", fileName);
-            MatchInfo[] matches = ReferenceHost.RawExecute(command)
-                .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                .ToArray();
+            MatchInfo[] matches = RawExecuteMultipleMatches(command);
             MatchInfo firstMatch = matches[0];
             MatchInfo secondMatch = matches[1];

@@ -101,9 +111,7 @@
             string fileName = CreateFile(NewlineJoin("first line", "second line"), ".txt");

             string command = string.Format("Select-String -Path '{0}' -Pattern 'first','line'", fileName);
-            MatchInfo[] matches = ReferenceHost.RawExecute(command)
-                .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                .ToArray();
+            MatchInfo[] matches = RawExecuteMultipleMatches(command);
             MatchInfo firstMatch = matches[0];
             MatchInfo secondMatch = matches[1];

@@ -126,9 +134,7 @@
             string fileName = CreateFile("first line", ".txt");

             string command = string.Format("Select-String -Path '{0}' -Pattern 'nomatch','line'", fileName);
-            MatchInfo match = ReferenceHost.RawExecute(command)
-                 .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                 .Single();
+            MatchInfo match = RawExecuteSingleMatch(command);
             Match regexMatch = match.Matches.Single();

             Assert.AreEqual(1, match.LineNumber);
@@ -146,9 +152,7 @@
             string fileName2 = CreateFile("first line", ".txt");

             string command = string.Format("Select-String -Path '{0}','{1}' -Pattern 'first'", fileName1, fileName2);
-            MatchInfo[] matches = ReferenceHost.RawExecute(command)
-                .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                .ToArray();
+            MatchInfo[] matches = RawExecuteMultipleMatches(command);
             MatchInfo firstMatch = matches[0];
             MatchInfo secondMatch = matches[1];

@@ -159,9 +163,7 @@
         [Test]
         public void MatchUsingStringFromPipeline()
         {
-            MatchInfo match = ReferenceHost.RawExecute("\"-HELLO-\" | select-string -pattern \"HELLO\"")
-                 .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                 .Single();
+            MatchInfo match = RawExecuteSingleMatch("\"-HELLO-\" | select-string -pattern \"HELLO\"");
             Match regexMatch = match.Matches.Single();

             Assert.AreEqual("InputStream", match.Filename);
@@ -178,9 +180,7 @@
         [Test]
         public void MatchUsingStringArrayFromPipeline()
         {
-            MatchInfo match = ReferenceHost.RawExecute("\"-12345-\",\"-HELLO-\" | select-string -pattern \"HELLO\"")
-                 .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                 .Single();
+            MatchInfo match = RawExecuteSingleMatch("\"-12345-\",\"-HELLO-\" | select-string -pattern \"HELLO\"");
             Match regexMatch = match.Matches.Single();

             Assert.AreEqual("InputStream", match.Filename);
@@ -203,9 +203,7 @@
         public void MatchUsingInputObjectStringArray()
         {
             string command = "select-string -inputobject \"-12345-\",\"-HELLO-\" -pattern \"HELLO\"";
-            MatchInfo match = ReferenceHost.RawExecute(command)
-                 .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                 .Single();
+            MatchInfo match = RawExecuteSingleMatch(command);
             Match regexMatch = match.Matches.Single();

             Assert.AreEqual("InputStream", match.Filename);
@@ -231,9 +229,7 @@
         [Test]
         public void MultipleMatchesUsingStringArrayFromPipeline()
         {
-            MatchInfo[] matches = ReferenceHost.RawExecute("\"-12345-\",\"-HELLO-\",\"hello\" | select-string -pattern \"HELLO\"")
-                 .Select(psObject => (MatchInfo)psObject.ImmediateBaseObject)
-                 .ToArray();
+            MatchInfo[] matches = RawExecuteMultipleMatches("\"-12345-\",\"-HELLO-\",\"hello\" | select-string -pattern \"HELLO\"");
             MatchInfo firstMatch = matches[0];
             MatchInfo secondMatch = matches[1];


Add ability to undo component add

Add ability to undo component add

--- Assets/MRTK/Tools/Toolbox/MixedRealityToolboxWindow.cs
+++ Assets/MRTK/Tools/Toolbox/MixedRealityToolboxWindow.cs
@@ -314,6 +314,7 @@
                         if (GUILayout.Button(buttonContent, GUILayout.MaxHeight(ToolboxItemHeight), GUILayout.Width(ToolboxItemButtonWidth)))
                         {
                             Selection.activeObject = !requiresCanvas ? Instantiate(item.Prefab) : Instantiate(item.Prefab, canvasUtilities[dropdownIndex].transform);
+                            Undo.RegisterCreatedObjectUndo(Selection.activeObject, $"Create {item.Name} Object");
                         }
                     }
                     GUILayout.FlexibleSpace();


put { of DeleteOtherPathsCmdEvt.apply() on same line

--- Assets/Scripts/SimEvt/CmdEvt/DeleteOtherPathsCmdEvt.cs
+++ Assets/Scripts/SimEvt/CmdEvt/DeleteOtherPathsCmdEvt.cs
@@ -22,8 +22,7 @@
 	public DeleteOtherPathsCmdEvt(long timeVal, long timeCmdVal, Dictionary<int, int[]> pathsVal)
 		: base(timeVal, timeCmdVal, pathsVal) { }

-	public override void apply (Sim g)
-	{
+	public override void apply (Sim g) {
 		List<KeyValuePair<Segment, int>> units = new List<KeyValuePair<Segment, int>>();
 		// convert paths list into valid deleteOtherPaths() argument (this is a bit ugly)
 		foreach (KeyValuePair<int, int[]> path in paths) {


Init Oops state correctly. Closes #84.

Init Oops state correctly. Closes #84.

--- Assets/Scripts/System/StateMachine/States/OopsState.cs
+++ Assets/Scripts/System/StateMachine/States/OopsState.cs
@@ -4,15 +4,17 @@

 /// <summary>
 /// The behaviour attached to the Oops state in the Animator component of the GM GameObject.
-///
+///
 /// The functions of this script get called using the Animator transitions and conditions
-/// set within Unity's built in Animator.  Please see the Animator component of the GM
+/// set within Unity's built in Animator.  Please see the Animator component of the GM
 /// GameObject to find out more.
 /// </summary>
 public class OopsState : State
 {
     override public void OnStateEnter(Animator animator, AnimatorStateInfo info, int layerIndex)
     {
+        base.OnStateEnter(animator, info, layerIndex);
+
         //All we need for this state is the Info object and the text included with it
         helper.DeactivateAll();
         helper.info.SetActive(true);


Update demo

Update demo

--- Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs
+++ Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs
@@ -19,7 +19,7 @@
                 InitKeyType = InitKeyType.Attribute,
                 IsAutoCloseConnection = true
             });
-            db.DbMaintenance.CreateDatabase(@"c:\");
+            db.DbMaintenance.CreateDatabase();
             db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
             db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
             var list = db.Queryable<CodeFirstTable1>().ToList();


Fixed creation of output window. Checking if it already exists before creating it.

--- Src/Clide/Diagnostics/TraceOutputWindowManager.cs
+++ Src/Clide/Diagnostics/TraceOutputWindowManager.cs
@@ -137,8 +137,11 @@
                 var outputWindow = (IVsOutputWindow)this.serviceProvider.GetService(typeof(SVsOutputWindow));
                 tracer.ShieldUI(() =>
                 {
-                    ErrorHandler.ThrowOnFailure(outputWindow.CreatePane(ref this.outputPaneGuid, this.outputPaneTitle, 1, 1));
-                    ErrorHandler.ThrowOnFailure(outputWindow.GetPane(ref this.outputPaneGuid, out this.outputWindowPane));
+                    if (!ErrorHandler.Succeeded(outputWindow.GetPane(ref this.outputPaneGuid, out this.outputWindowPane)) || this.outputWindowPane == null)
+                    {
+                        ErrorHandler.ThrowOnFailure(outputWindow.CreatePane(ref this.outputPaneGuid, this.outputPaneTitle, 1, 1));
+                        ErrorHandler.ThrowOnFailure(outputWindow.GetPane(ref this.outputPaneGuid, out this.outputWindowPane));
+                    }
                 },
                 Strings.Diagnostics.FailedToCreateOutputWindow);
                 tracer.Info("Trace output window created");


Fixed some bugs in TE form

Fixed some bugs in TE form

--- StroopTest/Views/MatchingPages/FormMatchConfig.cs
+++ StroopTest/Views/MatchingPages/FormMatchConfig.cs
@@ -114,7 +114,7 @@
                 case "DNMTS":
                     this.expositionType.SelectedIndex = 1;
                     break;
-                case "DMTS / DNMTS":
+                case "DMTS/DNMTS":
                     this.expositionType.SelectedIndex = 2;
                     break;
             }
@@ -142,6 +142,7 @@
                         if (imagesListFile.ListContent.Count < stimuluNumber.Value)
                         {
                             errorProvider1.SetError(openImgListButton, LocRM.GetString("impossibleUseListWarn", currentCulture));
+                            errorProvider2.Clear();
                             saveButton.Enabled = false;
                         }
                         else if (imagesListFile.ListContent.Count < attemptNumber.Value * stimuluNumber.Value)
@@ -161,6 +162,7 @@
                     if (wordListFile.ListContent.Count < stimuluNumber.Value)
                     {
                         errorProvider1.SetError(openWordListButton, LocRM.GetString("impossibleUseListWarn", currentCulture));
+                        errorProvider2.Clear();
                         saveButton.Enabled = false;
                     }
                     else if (wordListFile.ListContent.Count < attemptNumber.Value * stimuluNumber.Value)
@@ -572,11 +574,15 @@
                     button = openWordListButton;
                     type = StrList.WORD;
                 }
-
+                if(button == null)
+                {
+                    return;
+                }
                 StrList listFile = new StrList(button.Text, type);
                 if (listFile.ListContent.Count < stimuluNumber.Value)
                 {
                     errorProvider1.SetError(button, LocRM.GetString("impossibleUseListWarn", currentCulture));
+                    errorProvider2.Clear();
                     saveButton.Enabled = false;
                 }
                 else if (listFile.ListContent.Count < attemptNumber.Value * stimuluNumber.Value)
@@ -591,7 +597,7 @@
                     saveButton.Enabled = true;
                 }
             }
-            else
+            else if (button != null)
             {
                 errorProvider1.SetError(button, "");
                 errorProvider2.SetError(button, "");
@@ -740,6 +746,7 @@
                 {
                     saveButton.Enabled = false;
                     errorProvider1.SetError(button, LocRM.GetString("impossibleUseListWarn", currentCulture));
+                    errorProvider2.Clear();
                 }
                 else if (ListFile != null && ListFile.ListContent.Count < attemptNumber.Value * stimuluNumber.Value)
                 {


refactored logger

refactored logger

--- TIKSN.Core/PowerShell/PowerShellLoggerProvider.cs
+++ TIKSN.Core/PowerShell/PowerShellLoggerProvider.cs
@@ -1,20 +1,20 @@
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
+using System;
 using System.Collections.Concurrent;
-using System.Management.Automation;

 namespace TIKSN.PowerShell
 {
     public class PowerShellLoggerProvider : ILoggerProvider
     {
+        private readonly ICurrentCommandProvider _currentCommandProvider;
         private readonly ConcurrentDictionary<string, PowerShellLogger> _loggers = new ConcurrentDictionary<string, PowerShellLogger>();
-        private readonly Cmdlet cmdlet;
         private readonly IOptions<PowerShellLoggerOptions> options;

-        public PowerShellLoggerProvider(Cmdlet cmdlet, IOptions<PowerShellLoggerOptions> options)
+        public PowerShellLoggerProvider(ICurrentCommandProvider currentCommandProvider, IOptions<PowerShellLoggerOptions> options)
         {
-            this.cmdlet = cmdlet;
             this.options = options;
+            _currentCommandProvider = currentCommandProvider ?? throw new ArgumentNullException(nameof(currentCommandProvider));
         }

         public ILogger CreateLogger(string categoryName)
@@ -28,7 +28,7 @@

         private PowerShellLogger CreateLoggerImplementation(string name)
         {
-            return new PowerShellLogger(cmdlet, options, name);
+            return new PowerShellLogger(_currentCommandProvider, options, name);
         }
     }
 }


ADDED: ECS - Generic AddComponent method to EntityManager.

--- Source/Slash.ECS/Source/Components/EntityManager.cs
+++ Source/Slash.ECS/Source/Components/EntityManager.cs
@@ -153,6 +153,19 @@
         public void AddComponent(int entityId, IEntityComponent component)
         {
             this.AddComponent(entityId, component, true);
+        }
+
+        /// <summary>
+        ///   Attaches a new component of the passed type to the entity with the specified id.
+        /// </summary>
+        /// <typeparam name="T">Type of the component to add.</typeparam>
+        /// <param name="entityId">Id of the entity to attach the component to.</param>
+        /// <returns>Attached component.</returns>
+        public T AddComponent<T>(int entityId) where T : IEntityComponent, new()
+        {
+            T component = new T();
+            this.AddComponent(entityId, component, true);
+            return component;
         }

         /// <summary>


Refactored the surface view and scanning lifecycle in Android

--- Source/ZXing.Net.Mobile.Android/ZXingSurfaceView.cs
+++ Source/ZXing.Net.Mobile.Android/ZXingSurfaceView.cs
@@ -27,8 +27,7 @@
         const int MIN_FRAME_HEIGHT = 240;
         const int MAX_FRAME_WIDTH = 600;
         const int MAX_FRAME_HEIGHT = 400;
-
-        CancellationTokenSource autoFocusTokenCancelSrc;
+
         ISurfaceHolder surfaceHolder;
         Camera camera;
         MobileBarcodeScanningOptions scanningOptions;
@@ -36,12 +35,14 @@
         Activity activity;
         bool isAnalyzing = false;
         bool wasScanned = false;
+        bool wasStarted = false;
         bool isTorchOn = false;
         int cameraId = 0;

         DateTime lastPreviewAnalysis = DateTime.UtcNow;
         BarcodeReader barcodeReader = null;
         Task processingTask;
+        TaskCompletionSource<object> tcsSurfaceReady;

         static ManualResetEventSlim _cameraLockEvent = new ManualResetEventSlim (true);

@@ -57,7 +58,7 @@
             : base (activity)
         {
             this.activity = activity;
-            this.scanningOptions = options;
+            this.scanningOptions = options ?? new MobileBarcodeScanningOptions ();

             Init ();
         }
@@ -70,27 +71,52 @@

         void Init ()
         {
-            this.surfaceHolder = Holder;
-            this.surfaceHolder.AddCallback (this);
-            this.surfaceHolder.SetType (SurfaceType.PushBuffers);
-
-            this.autoFocusTokenCancelSrc = new CancellationTokenSource ();
+            tcsSurfaceReady = new TaskCompletionSource<object> ();
+            Holder.AddCallback (this);
+            Holder.SetType (SurfaceType.PushBuffers);
         }

         public void SurfaceCreated (ISurfaceHolder holder)
         {
-            OnSurfaceCreated();
-        }
-
-        bool surfaceCreated = false;
-
-        void OnSurfaceCreated ()
-        {
-            surfaceCreated = true;
+
+        }
+
+        public void SurfaceChanged (ISurfaceHolder holder, Format format, int wx, int hx)
+        {
+            tcsSurfaceReady.TrySetResult (null);
+
+            if (wasStarted) {
+                SetupCamera ().ContinueWith (t => {
+                    MobileBarcodeScanner.LogError ("SetupCamera Failed: {0}", t.Exception);
+                }, TaskContinuationOptions.OnlyOnFaulted);
+            }
+        }
+
+        public void SurfaceDestroyed (ISurfaceHolder holder)
+        {
+            ShutdownCamera ();
+
+            if (camera != null) {
+                var theCamera = camera;
+                camera = null;
+
+                theCamera.SetPreviewCallback (null);
+                theCamera.StopPreview ();
+                theCamera.Release ();
+            }
+            tcsSurfaceReady = new TaskCompletionSource<object> ();
+            ReleaseExclusiveAccess ();
+        }
+
+        async Task SetupCamera ()
+        {
+            if (camera != null)
+                return;
+
+            await tcsSurfaceReady.Task;
+
             lastPreviewAnalysis = DateTime.UtcNow.AddMilliseconds (this.scanningOptions.InitialDelayBeforeAnalyzingFrames);
             isAnalyzing = true;
-
-            Console.WriteLine ("StartScanning");

             CheckCameraPermissions ();

@@ -134,35 +160,21 @@
                     camera = Camera.Open ();
                 }

-                if (camera == null)
-                    Android.Util.Log.Debug (MobileBarcodeScanner.TAG, "Camera is null :(");
-
-                camera.SetPreviewCallback (this);
-
+                if (camera != null)
+                    camera.SetPreviewCallback (this);
+                else {
+                    MobileBarcodeScanner.LogWarn (MobileBarcodeScanner.TAG, "Camera is null :(");
+                    return;
+                }
+
             } catch (Exception ex) {
                 ShutdownCamera ();
-
-                Console.WriteLine ("Setup Error: " + ex);
-            }
-
-            PerformanceCounter.Stop (perf, "Camera took {0}ms");
-        }
-
-        bool surfaceChanged = false;
-
-        public void SurfaceChanged (ISurfaceHolder holder, Format format, int wx, int hx)
-        {
-            OnSurfaceChanged();
-        }
-
-        void OnSurfaceChanged ()
-        {
-            surfaceChanged = true;
-
-            if (camera == null)
-                return;
-
-            var perf = PerformanceCounter.Start ();
+                MobileBarcodeScanner.LogError ("Setup Error: {0}", ex);
+                return;
+            }
+            PerformanceCounter.Stop (perf, "Setup Camera took {0}ms");
+
+            perf = PerformanceCounter.Start ();

             var parameters = camera.GetParameters ();
             parameters.PreviewFormat = ImageFormatType.Nv21;
@@ -240,10 +252,7 @@
             camera.SetPreviewDisplay (this.Holder);
             camera.StartPreview ();

-            PerformanceCounter.Stop (perf, "SurfaceChanged took {0}ms");
-
-            // Reset cancel token source so we can do things like autofocus
-            autoFocusTokenCancelSrc = new CancellationTokenSource();
+            PerformanceCounter.Stop (perf, "Setup Camera Parameters took {0}ms");

             // Docs suggest if Auto or Macro modes, we should invoke AutoFocus at least once
             var currentFocusMode = camera.GetParameters ().FocusMode;
@@ -252,33 +261,7 @@
                 AutoFocus ();
         }

-        public void SurfaceDestroyed (ISurfaceHolder holder)
-        {
-            ShutdownCamera();
-
-            autoFocusTokenCancelSrc.Cancel ();
-
-            if (camera != null) {
-                var theCamera = camera;
-                camera = null;
-
-                theCamera.SetPreviewCallback (null);
-                theCamera.StopPreview ();
-                theCamera.Release ();
-            }
-            ReleaseExclusiveAccess ();
-        }
-
-
-        public byte[] rotateCounterClockwise (byte[] data, int width, int height)
-        {
-            var rotatedData = new byte[data.Length];
-            for (int y = 0; y < height; y++) {
-                for (int x = 0; x < width; x++)
-                    rotatedData [x * height + height - y - 1] = data [x + y * width];
-            }
-            return rotatedData;
-        }
+

         public void OnPreviewFrame (byte[] bytes, Android.Hardware.Camera camera)
         {
@@ -386,25 +369,25 @@
             var touchX = e.GetX (mostRecentPointer);
             var touchY = e.GetY (mostRecentPointer);

+            AutoFocus ((int)touchX, (int)touchY);
+
+            return r;
+        }
+
+        public void AutoFocus ()
+        {
+            AutoFocus (0, 0, false);
+        }
+
+        public void AutoFocus (int x, int y)
+        {
             // The bounds for focus areas are actually -1000 to 1000
             // So we need to translate the touch coordinates to this scale
-            var focusX = (touchX / Width * 2000) - 1000;
-            var focusY = (touchY / Height * 2000) - 1000;
+            var focusX = (x / Width * 2000) - 1000;
+            var focusY = (y / Height * 2000) - 1000;

             // Call the autofocus with our coords
             AutoFocus ((int)focusX, (int)focusY, true);
-
-            return r;
-        }
-
-        public void AutoFocus ()
-        {
-            AutoFocus (0, 0, false);
-        }
-
-        public void AutoFocus (int x, int y)
-        {
-            AutoFocus (x, y, true);
         }

         void AutoFocus (int x, int y, bool useCoordinates)
@@ -412,48 +395,46 @@
             if (camera != null) {
                 var cameraParams = camera.GetParameters ();

-                if (!autoFocusTokenCancelSrc.IsCancellationRequested) {
-                    Android.Util.Log.Debug (MobileBarcodeScanner.TAG, "AutoFocus Requested");
-
-                    // Cancel any previous requests
-                    camera.CancelAutoFocus ();
-
-                    try {
-                        // If we want to use coordinates
-                        // Also only if our camera supports Auto focus mode
-                        // Since FocusAreas only really work with FocusModeAuto set
-                        if (useCoordinates
-                            && cameraParams.SupportedFocusModes.Contains (Camera.Parameters.FocusModeAuto)) {
-                            // Let's give the touched area a 20 x 20 minimum size rect to focus on
-                            // So we'll offset -10 from the center of the touch and then
-                            // make a rect of 20 to give an area to focus on based on the center of the touch
-                            x = x - 10;
-                            y = y - 10;
-
-                            // Ensure we don't go over the -1000 to 1000 limit of focus area
-                            if (x >= 1000)
-                                x = 980;
-                            if (x < -1000)
-                                x = -1000;
-                            if (y >= 1000)
-                                y = 980;
-                            if (y < -1000)
-                                y = -1000;
-
-                            // Explicitly set FocusModeAuto since Focus areas only work with this setting
-                            cameraParams.FocusMode = Camera.Parameters.FocusModeAuto;
-                            // Add our focus area
-                            cameraParams.FocusAreas = new List<Camera.Area> {
-                                new Camera.Area (new Rect (x, y, x + 20, y + 20), 1000)
-                            };
-                            camera.SetParameters (cameraParams);
-                        }
-
-                        // Finally autofocus (weather we used focus areas or not)
-                        camera.AutoFocus (this);
-                    } catch (Exception ex) {
-                        Android.Util.Log.Debug (MobileBarcodeScanner.TAG, "AutoFocus Failed: {0}", ex);
+            Android.Util.Log.Debug (MobileBarcodeScanner.TAG, "AutoFocus Requested");
+
+                // Cancel any previous requests
+                camera.CancelAutoFocus ();
+
+                try {
+                    // If we want to use coordinates
+                    // Also only if our camera supports Auto focus mode
+                    // Since FocusAreas only really work with FocusModeAuto set
+                    if (useCoordinates
+                        && cameraParams.SupportedFocusModes.Contains (Camera.Parameters.FocusModeAuto)) {
+                        // Let's give the touched area a 20 x 20 minimum size rect to focus on
+                        // So we'll offset -10 from the center of the touch and then
+                        // make a rect of 20 to give an area to focus on based on the center of the touch
+                        x = x - 10;
+                        y = y - 10;
+
+                        // Ensure we don't go over the -1000 to 1000 limit of focus area
+                        if (x >= 1000)
+                            x = 980;
+                        if (x < -1000)
+                            x = -1000;
+                        if (y >= 1000)
+                            y = 980;
+                        if (y < -1000)
+                            y = -1000;
+
+                        // Explicitly set FocusModeAuto since Focus areas only work with this setting
+                        cameraParams.FocusMode = Camera.Parameters.FocusModeAuto;
+                        // Add our focus area
+                        cameraParams.FocusAreas = new List<Camera.Area> {
+                            new Camera.Area (new Rect (x, y, x + 20, y + 20), 1000)
+                        };
+                        camera.SetParameters (cameraParams);
                     }
+
+                    // Finally autofocus (weather we used focus areas or not)
+                    camera.AutoFocus (this);
+                } catch (Exception ex) {
+                    Android.Util.Log.Debug (MobileBarcodeScanner.TAG, "AutoFocus Failed: {0}", ex);
                 }
             }
         }
@@ -461,9 +442,7 @@
         int getCameraDisplayOrientation (Activity context)
         {
             var degrees = 0;
-
             var display = context.WindowManager.DefaultDisplay;
-
             var rotation = display.Rotation;

             switch (rotation) {
@@ -481,9 +460,7 @@
                 break;
             }

-
-            Camera.CameraInfo info = new Camera.CameraInfo ();
-
+            var info = new Camera.CameraInfo ();
             Camera.GetCameraInfo (cameraId, info);

             int correctedDegrees;
@@ -498,6 +475,16 @@
             return correctedDegrees;
         }

+        public byte [] rotateCounterClockwise (byte [] data, int width, int height)
+        {
+            var rotatedData = new byte [data.Length];
+            for (int y = 0; y < height; y++) {
+                for (int x = 0; x < width; x++)
+                    rotatedData [x * height + height - y - 1] = data [x + y * width];
+            }
+            return rotatedData;
+        }
+
         public void SetCameraDisplayOrientation (Activity context)
         {
             var degrees = getCameraDisplayOrientation (context);
@@ -513,8 +500,6 @@

         public void ShutdownCamera ()
         {
-            autoFocusTokenCancelSrc.Cancel ();
-
             var theCamera = camera;
             camera = null;

@@ -524,6 +509,7 @@
                     if (theCamera != null) {
                         try {
                             theCamera.SetPreviewCallback (null);
+                            theCamera.SetPreviewDisplay (null);
                             theCamera.StopPreview ();
                         } catch (Exception ex) {
                             Android.Util.Log.Error (MobileBarcodeScanner.TAG, ex.ToString ());
@@ -573,18 +559,19 @@
         {
             this.callback = scanResultCallback;
             this.scanningOptions = options ?? MobileBarcodeScanningOptions.Default;
-
-            if (surfaceCreated)
-                OnSurfaceCreated();
-
-            if (surfaceChanged)
-                OnSurfaceChanged();
+            wasStarted = true;
+
+            SetupCamera ().ContinueWith (t => {
+                if (t.Exception != null)
+                    MobileBarcodeScanner.LogError ("SetupCamera failed: {0}", t.Exception);
+            }, TaskContinuationOptions.OnlyOnFaulted);
         }

         public void StopScanning ()
         {
             isAnalyzing = false;
             ShutdownCamera ();
+            wasStarted = false;
         }

         public void PauseAnalysis ()
@@ -669,7 +656,7 @@
                     || supportedFlashModes.Contains (Camera.Parameters.FlashModeOn)))
                     hasTorch = CheckTorchPermissions (false);

-                return hasTorch.Value;
+                return hasTorch != null && hasTorch.Value;
             }
         }


Filter empty items out of start page, part/printer bars

- Issue MatterHackers/MCCentral#3534

--- PartPreviewWindow/PlusTab/ExplorerBar.cs
+++ PartPreviewWindow/PlusTab/ExplorerBar.cs
@@ -187,10 +187,6 @@
 		{
 			toolbar.ActionArea.CloseAllChildren();

-			// Select the 25 most recent files and project onto FileSystemItems
-			var recentFiles = new DirectoryInfo(ApplicationDataStorage.Instance.PlatingDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime);
-
-
 			var lastProfileID = ProfileManager.Instance.LastProfileID;
 			var lastProfile = ProfileManager.Instance[lastProfileID];

@@ -243,7 +239,9 @@

 				toolbar.AddChild(emptyPlateButton);

-				foreach (var item in recentFiles.Take(10).Select(f => new SceneReplacementFileItem(f.FullName)).ToList<ILibraryItem>())
+				// Select the 25 most recent files and project onto FileSystemItems
+				var recentFiles = new DirectoryInfo(ApplicationDataStorage.Instance.PlatingDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime);
+				foreach (var item in recentFiles.Where(f => f.Length > 500).Select(f => new SceneReplacementFileItem(f.FullName)).Take(10).ToList<ILibraryItem>())
 				{
 					var iconButton = new IconViewItem(new ListViewItem(item, ApplicationController.Instance.Library.PlatingHistory), 70, 70, theme)
 					{
@@ -285,7 +283,6 @@
 		public PartsBar(PartPreviewContent partPreviewContent, ThemeConfig theme)
 			: base("Parts".Localize(), theme)
 		{
-			var recentParts = new DirectoryInfo(ApplicationDataStorage.Instance.PartHistoryDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime);

 			var emptyPlateButton = new ImageWidget(AggContext.StaticData.LoadIcon("new-part.png", 70, 70))
 			{
@@ -317,7 +314,9 @@
 			};
 			toolbar.AddChild(emptyPlateButton);

-			foreach (var item in recentParts.Take(10).Select(f => new SceneReplacementFileItem(f.FullName)).ToList<ILibraryItem>())
+			var recentParts = new DirectoryInfo(ApplicationDataStorage.Instance.PartHistoryDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime);
+
+			foreach (var item in recentParts.Where(f => f.Length > 500).Select(f => new SceneReplacementFileItem(f.FullName)).Take(10).ToList<ILibraryItem>())
 			{
 				var iconButton = new IconViewItem(new ListViewItem(item, ApplicationController.Instance.Library.PlatingHistory), 70, 70, theme)
 				{


Moved versioning to build-time

Moved versioning to build-time

--- Sources/AutoMapper.Unity/Properties/AssemblyInfo.cs
+++ Sources/AutoMapper.Unity/Properties/AssemblyInfo.cs
@@ -21,6 +21,7 @@
 // The following GUID is for the ID of the typelib if this project is exposed to COM
 [assembly: Guid("3774deac-cb9d-460c-8059-24c1544ceba0")]

+#region All assembly information will be set at AppVeyor
 // Version information for an assembly consists of the following four values:
 //
 //      Major Version
@@ -28,9 +29,11 @@
 //      Build Number
 //      Revision
 //
-[assembly: AssemblyInformationalVersion("1.0.0-alpha")]
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.0.0.0")]
+[assembly: AssemblyFileVersion("0.0.0.0")]
+[assembly: AssemblyInformationalVersion("0.0.0.0")]
+#endregion
+


Move right click processing to mouseup

Move right click processing to mouseup

--- PartPreviewWindow/View3D/View3DWidget.cs
+++ PartPreviewWindow/View3D/View3DWidget.cs
@@ -761,9 +761,11 @@
 		private ViewControls3DButtons? activeButtonBeforeMouseOverride = null;

 		Vector2 lastMouseMove;
+		Vector2 mouseDownPositon = Vector2.Zero;
 		Matrix4X4 worldMatrixOnMouseDown;
 		public override void OnMouseDown(MouseEventArgs mouseEvent)
 		{
+			mouseDownPositon = mouseEvent.Position;
 			worldMatrixOnMouseDown = World.GetTransform4X4();
 			// Show transform override
 			if (activeButtonBeforeMouseOverride == null
@@ -891,34 +893,6 @@
 					}
 				}
 			}
-
-			UiThread.RunOnIdle(() =>
-			{
-				if (mouseEvent.Button == MouseButtons.Right)
-				{
-					var info2 = new IntersectInfo();
-					if (Scene.SelectedItem is IObject3D selectedItem
-						&& FindHitObject3D(mouseEvent.Position, ref info2) is IObject3D hitObject2
-						&& hitObject2 == selectedItem)
-					{
-						var menu = ApplicationController.Instance.GetActionMenuForSceneItem(Scene.SelectedItem, Scene);
-
-						var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
-						systemWindow.ShowPopup(
-							new MatePoint(this)
-							{
-								Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
-								AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
-							},
-							new MatePoint(menu)
-							{
-								Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
-								AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
-							},
-							altBounds: new RectangleDouble(mouseEvent.X + 1, mouseEvent.Y + 1, mouseEvent.X + 1, mouseEvent.Y + 1));
-					}
-				}
-			});
 		}

 		public override void OnMouseMove(MouseEventArgs mouseEvent)
@@ -926,6 +900,11 @@
 			IObject3D selectedItem = Scene.SelectedItem;

 			lastMouseMove = mouseEvent.Position;
+			if(lastMouseMove != mouseDownPositon)
+			{
+				mouseDownPositon = Vector2.Zero;
+			}
+
 			// File system Drop validation
 			mouseEvent.AcceptDrop = this.AllowDragDrop()
 					&& mouseEvent.DragFiles?.Count > 0
@@ -1193,6 +1172,73 @@
 				}
 			}

+			if (mouseEvent.Button == MouseButtons.Right
+				&& mouseDownPositon == mouseEvent.Position
+				&& this.TrackballTumbleWidget.FirstWidgetUnderMouse)
+			{
+				IntersectInfo info = new IntersectInfo();
+				var hitObject = FindHitObject3D(mouseEvent.Position, ref info);
+				if (hitObject != null)
+				{
+					if (hitObject != Scene.SelectedItem)
+					{
+						Scene.SelectedItem = null;
+						Scene.SelectedItem = hitObject;
+					}
+
+					UiThread.RunOnIdle(() =>
+					{
+						var menu = ApplicationController.Instance.GetActionMenuForSceneItem(Scene.SelectedItem, Scene);
+
+						var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
+						systemWindow.ShowPopup(
+						new MatePoint(this)
+						{
+							Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
+							AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
+						},
+						new MatePoint(menu)
+						{
+							Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
+							AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
+						},
+						altBounds: new RectangleDouble(mouseEvent.X + 1, mouseEvent.Y + 1, mouseEvent.X + 1, mouseEvent.Y + 1));
+					});
+				}
+				else // open up the menu for the bed (copy past image)
+				{
+					UiThread.RunOnIdle(() =>
+					{
+						var popupMenu = new PopupMenu(theme);
+
+						var pasteMenu = popupMenu.CreateMenuItem("Paste".Localize());
+						pasteMenu.Click += (s2, e2) =>
+						{
+							Scene.Paste();
+							popupMenu.Unfocus();
+						};
+
+						pasteMenu.Enabled = Clipboard.Instance.ContainsImage;
+
+						var popupBounds = new RectangleDouble(mouseEvent.X + 1, mouseEvent.Y + 1, mouseEvent.X + 1, mouseEvent.Y + 1);
+
+						var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
+						systemWindow.ShowPopup(
+							new MatePoint(this)
+							{
+								Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom),
+								AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
+							},
+							new MatePoint(popupMenu)
+							{
+								Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
+								AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
+							},
+							altBounds: popupBounds);
+					});
+				}
+			}
+
 			base.OnMouseUp(mouseEvent);

 			if (deferEditorTillMouseUp)


Update comment

Update comment

--- Framework/Json/AppJson.cs
+++ Framework/Json/AppJson.cs
@@ -724,7 +724,7 @@
         public class NavigateResult
         {
             /// <summary>
-            /// Gets or sets IsSession. If true, method NavigateSessionAsync(); with session data available is called next.
+            /// Gets or sets IsSession. If true, session is requested and method NavigateSessionAsync(); with session data available is called next.
             /// </summary>
             public bool IsSession { get; set; }


focus bug fix

focus bug fix

--- PowerArgs/CLI/Controls/CompactConsole.cs
+++ PowerArgs/CLI/Controls/CompactConsole.cs
@@ -14,6 +14,17 @@
         public CompactConsole()
         {
             SubscribeForLifetime(nameof(Bounds),()=>HardRefresh(), this);
+            this.Ready.SubscribeOnce(() =>
+            {
+                Application.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Tab, null, () =>
+                {
+                    var forgotten = OnHandleHey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false));
+                }, this);
+                Application.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Tab, ConsoleModifiers.Shift, () =>
+                {
+                    var forgotten = OnHandleHey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, true, false, false));
+                }, this);
+            });
         }

         protected abstract CommandLineArgumentsDefinition CreateDefinition();
@@ -71,14 +82,6 @@
             outputLabel = outputPanel.Add(new Label() { Text = outputValue ?? UpdateAssistiveText(), Mode = LabelRenderMode.MultiLineSmartWrap }).Fill();

             tb.KeyInputReceived.SubscribeForLifetime(async (keyInfo)=>await OnHandleHey(keyInfo), tb);
-            Application.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Tab, null, () =>
-            {
-                var forgotten = OnHandleHey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false));
-            }, tb);
-            Application.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Tab, ConsoleModifiers.Shift, () =>
-            {
-                var forgotten = OnHandleHey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, true, false, false));
-            }, tb);
         }

         private async Task OnHandleHey(ConsoleKeyInfo keyInfo)


default build and revision numbers

default build and revision numbers

--- ProxyUnsetter/Properties/AssemblyInfo.cs
+++ ProxyUnsetter/Properties/AssemblyInfo.cs
@@ -32,5 +32,4 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.0.*")]


formats date created for landing page

formats date created for landing page

--- Purchasing.Web/Views/Home/Landing.cshtml
+++ Purchasing.Web/Views/Home/Landing.cshtml
@@ -62,7 +62,7 @@

                     Misc icon with bubble info
                     @Html.ActionLink(item.OrderRequestNumber(), "Review", "Order", new { id = item.Id }, new { })
-                    @item.DateCreated
+                    @string.Format("{0:ddd MMM d - hh:mm tt}",item.DateCreated)
                     @item.CreatedBy.FullName
                     @item.StatusCode.Name


Implemented static texture maps

Implemented static texture maps

--- TrueCraft.Client/Rendering/Blocks/SlabRenderer.cs
+++ TrueCraft.Client/Rendering/Blocks/SlabRenderer.cs
@@ -8,134 +8,189 @@
 {
     public class SlabRenderer : BlockRenderer
     {
+        private static Vector2 StoneTopTexture = new Vector2(6, 0);
+        private static Vector2 StoneSideTexture = new Vector2(5, 0);
+        private static Vector2 StoneBottomTexture = new Vector2(6, 0);
+        private static Vector2 SandstoneTopTexture = new Vector2(0, 13);
+        private static Vector2 SandstoneSideTexture = new Vector2(0, 12);
+        private static Vector2 SandstoneBottomTexture = new Vector2(0, 14);
+        private static Vector2 WoodTopTexture = new Vector2(4, 0);
+        private static Vector2 WoodSideTexture = new Vector2(4, 0);
+        private static Vector2 WoodBottomTexture = new Vector2(4, 0);
+        private static Vector2 CobbleTopTexture = new Vector2(1, 0);
+        private static Vector2 CobbleSideTexture = new Vector2(1, 0);
+        private static Vector2 CobbleBottomTexture = new Vector2(1, 0);
+
+        private static Vector2[] StoneTextureMap =
+        {
+            // Positive Z
+            StoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            StoneSideTexture + Vector2.UnitY,
+            StoneSideTexture,
+            StoneSideTexture + Vector2.UnitX,
+            // Negative Z
+            StoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            StoneSideTexture + Vector2.UnitY,
+            StoneSideTexture,
+            StoneSideTexture + Vector2.UnitX,
+            // Positive X
+            StoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            StoneSideTexture + Vector2.UnitY,
+            StoneSideTexture,
+            StoneSideTexture + Vector2.UnitX,
+            // Negative X
+            StoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            StoneSideTexture + Vector2.UnitY,
+            StoneSideTexture,
+            StoneSideTexture + Vector2.UnitX,
+            // Negative Y
+            StoneTopTexture + Vector2.UnitX + Vector2.UnitY,
+            StoneTopTexture + Vector2.UnitY,
+            StoneTopTexture,
+            StoneTopTexture + Vector2.UnitX,
+            // Negative Y
+            StoneBottomTexture + Vector2.UnitX + Vector2.UnitY,
+            StoneBottomTexture + Vector2.UnitY,
+            StoneBottomTexture,
+            StoneBottomTexture + Vector2.UnitX,
+        };
+
+        private static Vector2[] SandstoneTextureMap =
+        {
+            // Positive Z
+            SandstoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            SandstoneSideTexture + Vector2.UnitY,
+            SandstoneSideTexture,
+            SandstoneSideTexture + Vector2.UnitX,
+            // Negative Z
+            SandstoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            SandstoneSideTexture + Vector2.UnitY,
+            SandstoneSideTexture,
+            SandstoneSideTexture + Vector2.UnitX,
+            // Positive X
+            SandstoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            SandstoneSideTexture + Vector2.UnitY,
+            SandstoneSideTexture,
+            SandstoneSideTexture + Vector2.UnitX,
+            // Negative X
+            SandstoneSideTexture + Vector2.UnitX + Vector2.UnitY,
+            SandstoneSideTexture + Vector2.UnitY,
+            SandstoneSideTexture,
+            SandstoneSideTexture + Vector2.UnitX,
+            // Negative Y
+            SandstoneTopTexture + Vector2.UnitX + Vector2.UnitY,
+            SandstoneTopTexture + Vector2.UnitY,
+            SandstoneTopTexture,
+            SandstoneTopTexture + Vector2.UnitX,
+            // Negative Y
+            SandstoneBottomTexture + Vector2.UnitX + Vector2.UnitY,
+            SandstoneBottomTexture + Vector2.UnitY,
+            SandstoneBottomTexture,
+            SandstoneBottomTexture + Vector2.UnitX,
+        };
+
+        private static Vector2[] WoodTextureMap =
+        {
+            // Positive Z
+            WoodSideTexture + Vector2.UnitX + Vector2.UnitY,
+            WoodSideTexture + Vector2.UnitY,
+            WoodSideTexture,
+            WoodSideTexture + Vector2.UnitX,
+            // Negative Z
+            WoodSideTexture + Vector2.UnitX + Vector2.UnitY,
+            WoodSideTexture + Vector2.UnitY,
+            WoodSideTexture,
+            WoodSideTexture + Vector2.UnitX,
+            // Positive X
+            WoodSideTexture + Vector2.UnitX + Vector2.UnitY,
+            WoodSideTexture + Vector2.UnitY,
+            WoodSideTexture,
+            WoodSideTexture + Vector2.UnitX,
+            // Negative X
+            WoodSideTexture + Vector2.UnitX + Vector2.UnitY,
+            WoodSideTexture + Vector2.UnitY,
+            WoodSideTexture,
+            WoodSideTexture + Vector2.UnitX,
+            // Negative Y
+            WoodTopTexture + Vector2.UnitX + Vector2.UnitY,
+            WoodTopTexture + Vector2.UnitY,
+            WoodTopTexture,
+            WoodTopTexture + Vector2.UnitX,
+            // Negative Y
+            WoodBottomTexture + Vector2.UnitX + Vector2.UnitY,
+            WoodBottomTexture + Vector2.UnitY,
+            WoodBottomTexture,
+            WoodBottomTexture + Vector2.UnitX,
+        };
+
+        private static Vector2[] CobbleTextureMap =
+        {
+            // Positive Z
+            CobbleSideTexture + Vector2.UnitX + Vector2.UnitY,
+            CobbleSideTexture + Vector2.UnitY,
+            CobbleSideTexture,
+            CobbleSideTexture + Vector2.UnitX,
+            // Negative Z
+            CobbleSideTexture + Vector2.UnitX + Vector2.UnitY,
+            CobbleSideTexture + Vector2.UnitY,
+            CobbleSideTexture,
+            CobbleSideTexture + Vector2.UnitX,
+            // Positive X
+            CobbleSideTexture + Vector2.UnitX + Vector2.UnitY,
+            CobbleSideTexture + Vector2.UnitY,
+            CobbleSideTexture,
+            CobbleSideTexture + Vector2.UnitX,
+            // Negative X
+            CobbleSideTexture + Vector2.UnitX + Vector2.UnitY,
+            CobbleSideTexture + Vector2.UnitY,
+            CobbleSideTexture,
+            CobbleSideTexture + Vector2.UnitX,
+            // Negative Y
+            CobbleTopTexture + Vector2.UnitX + Vector2.UnitY,
+            CobbleTopTexture + Vector2.UnitY,
+            CobbleTopTexture,
+            CobbleTopTexture + Vector2.UnitX,
+            // Negative Y
+            CobbleBottomTexture + Vector2.UnitX + Vector2.UnitY,
+            CobbleBottomTexture + Vector2.UnitY,
+            CobbleBottomTexture,
+            CobbleBottomTexture + Vector2.UnitX,
+        };
+
         static SlabRenderer()
         {
-            BlockRenderer.RegisterRenderer(StoneSlabBlock.BlockID, new SlabRenderer());
-            BlockRenderer.RegisterRenderer(DoubleStoneSlabBlock.BlockID, new SlabRenderer());
-        }
-
-        public enum SlabType : byte
-        {
-            Stone = 0,
-            Sandstone = 1,
-            Wood =2,
-            Cobblestone = 3
-        }
-
-        protected virtual Vector2 GetSideTexture(SlabType type)
-        {
-            switch (type)
+            BlockRenderer.RegisterRenderer(SlabBlock.BlockID, new SlabRenderer());
+            BlockRenderer.RegisterRenderer(DoubleSlabBlock.BlockID, new SlabRenderer());
+
+            for (int i = 0; i < StoneTextureMap.Length; i++)
             {
-                case SlabType.Stone:
-                    return new Vector2(5, 0);
-
-                case SlabType.Sandstone:
-                    return new Vector2(0, 12);
-
-                case SlabType.Wood:
-                    return new Vector2(4, 0);
-
-                case SlabType.Cobblestone:
-                    return new Vector2(1, 0);
-
+                StoneTextureMap[i] *= new Vector2(16f / 256f);
+                SandstoneTextureMap[i] *= new Vector2(16f / 256f);
+                WoodTextureMap[i] *= new Vector2(16f / 256f);
+                CobbleTextureMap[i] *= new Vector2(16f / 256f);
+            }
+        }
+
+        protected virtual Vector2[] GetTextureMap(SlabBlock.SlabMaterial material)
+        {
+            switch (material)
+            {
+                case SlabBlock.SlabMaterial.Stone:
+                    return StoneTextureMap;
+                case SlabBlock.SlabMaterial.Standstone:
+                    return SandstoneTextureMap;
+                case SlabBlock.SlabMaterial.Wooden:
+                    return WoodTextureMap;
+                case SlabBlock.SlabMaterial.Cobblestone:
+                    return CobbleTextureMap;
                 default:
-                    return Vector2.Zero;
+                    return null;
             }
         }

-        protected virtual Vector2 GetTopTexture(SlabType type)
-        {
-            switch (type)
-            {
-                case SlabType.Stone:
-                    return new Vector2(6, 0);
-
-                case SlabType.Sandstone:
-                    return new Vector2(0, 13);
-
-                case SlabType.Wood:
-                    return new Vector2(4, 0);
-
-                case SlabType.Cobblestone:
-                    return new Vector2(1, 0);
-
-                default:
-                    return Vector2.Zero;
-            }
-        }
-
-        protected virtual Vector2 GetBottomTexture(SlabType type)
-        {
-            switch (type)
-            {
-                case SlabType.Stone:
-                    return new Vector2(6, 0);
-
-                case SlabType.Sandstone:
-                    return new Vector2(0, 14);
-
-                case SlabType.Wood:
-                    return new Vector2(4, 0);
-
-                case SlabType.Cobblestone:
-                    return new Vector2(1, 0);
-
-                default:
-                    return Vector2.Zero;
-            }
-        }
-
-        protected virtual Vector2[] GetTextureMap(SlabType type, bool isDouble)
-        {
-            var sideTexture = GetSideTexture(type);
-            var topTexture = GetTopTexture(type);
-            var bottomTexture = GetBottomTexture(type);
-
-            var result = new Vector2[]
-            {
-                // Positive Z
-                sideTexture + Vector2.UnitX + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture,
-                sideTexture + Vector2.UnitX,
-                // Negative Z
-                sideTexture + Vector2.UnitX + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture,
-                sideTexture + Vector2.UnitX,
-                // Positive X
-                sideTexture + Vector2.UnitX + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture,
-                sideTexture + Vector2.UnitX,
-                // Negative X
-                sideTexture + Vector2.UnitX + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture + ((isDouble) ? Vector2.UnitY : Vector2.UnitY / 2),
-                sideTexture,
-                sideTexture + Vector2.UnitX,
-                // Positive Y
-                topTexture + Vector2.UnitX + Vector2.UnitY,
-                topTexture + Vector2.UnitY,
-                topTexture,
-                topTexture + Vector2.UnitX,
-                // Negative Y
-                bottomTexture + Vector2.UnitX + Vector2.UnitY,
-                bottomTexture + Vector2.UnitY,
-                bottomTexture,
-                bottomTexture + Vector2.UnitX
-            };
-
-            for (int i = 0; i < result.Length; i++)
-                result[i] *= new Vector2(16f / 256f);
-
-            return result;
-        }
-
-        public static int Value = 0;
-
         public override VertexPositionNormalColorTexture[] Render(BlockDescriptor descriptor, Vector3 offset, Tuple<int, int> textureMap, int indiciesOffset, out int[] indicies)
         {
-            if (descriptor.ID == StoneSlabBlock.BlockID)
+            if (descriptor.ID == SlabBlock.BlockID)
                 return RenderSlab(descriptor, offset, textureMap, indiciesOffset, out indicies);
             else
                 return RenderDoubleSlab(descriptor, offset, textureMap, indiciesOffset, out indicies);
@@ -143,7 +198,7 @@

         protected virtual VertexPositionNormalColorTexture[] RenderSlab(BlockDescriptor descriptor, Vector3 offset, Tuple<int, int> textureMap, int indiciesOffset, out int[] indicies)
         {
-            var result = CreateUniformCube(offset, GetTextureMap((SlabType)descriptor.Metadata, false), indiciesOffset, out indicies, Color.White);
+            var result = CreateUniformCube(offset, GetTextureMap((SlabBlock.SlabMaterial)descriptor.Metadata), indiciesOffset, out indicies, Color.White);
             for (int i = 0; i < 6; i++)
             {
                 var face = (CubeFace)i;
@@ -153,8 +208,13 @@
                     case CubeFace.NegativeZ:
                     case CubeFace.PositiveX:
                     case CubeFace.NegativeX:
-                        for (int j = 2; j < 4; j++)
-                            result[(i * 4) + j].Position.Y -= 0.5f;
+                        for (int j = 0; j < 2; j++)
+                            result[(i * 4) + j].Texture.Y -= (1f / 32f);
+                        for (int k = 2; k < 4; k++)
+                        {
+                            result[(i * 4) + k].Position.Y -= 0.5f;
+                            // result[(i * 4) + k].Texture.Y -= (1f / 16f);
+                        }
                         break;

                     case CubeFace.PositiveY:
@@ -169,7 +229,7 @@

         protected virtual VertexPositionNormalColorTexture[] RenderDoubleSlab(BlockDescriptor descriptor, Vector3 offset, Tuple<int, int> textureMap, int indiciesOffset, out int[] indicies)
         {
-            return CreateUniformCube(offset, GetTextureMap((SlabType)descriptor.Metadata, true), indiciesOffset, out indicies, Color.White);
+            return CreateUniformCube(offset, GetTextureMap((SlabBlock.SlabMaterial)descriptor.Metadata), indiciesOffset, out indicies, Color.White);
         }
     }
 }


check for null in selection setting

check for null in selection setting

--- TCC.Core/Controls/Settings/SelectionSetting.xaml.cs
+++ TCC.Core/Controls/Settings/SelectionSetting.xaml.cs
@@ -67,7 +67,7 @@
         private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             var cb = (ComboBox)sender;
-            SelectedItem = cb.SelectedItem.ToString();
+            SelectedItem = cb.SelectedItem == null ? cb.Items[0].ToString() : cb.SelectedItem.ToString();
         }

         private void SelectionSetting_OnLoaded(object sender, RoutedEventArgs e)


set camera position to visible region if available

--- UnifiedMap/UnifiedMap.Droid/UnifiedMapRenderer.cs
+++ UnifiedMap/UnifiedMap.Droid/UnifiedMapRenderer.cs
@@ -156,6 +156,11 @@

             ApplyPadding();
             _behavior.Initialize();
+
+            if(Map.VisibleRegion != null)
+            {
+                InternalMoveToRegion(Map.VisibleRegion, false, -1);
+            }
         }

         public UnifiedMap Map => Element;


Reverted attributes alteration.

Reverted attributes alteration.

--- GitSharp.Core/GitIndex.cs
+++ GitSharp.Core/GitIndex.cs
@@ -316,7 +316,6 @@
                 {
                     try
                     {
-                        _cacheFile.Attributes = FileAttributes.Normal; //need to set to normal before delete to avoid error
                         _cacheFile.Delete();
                     }
                     catch (IOException)
@@ -339,7 +338,6 @@
             {
                 try
                 {
-                    @lock.Attributes = FileAttributes.Normal; //need to set to normal before delete to avoid error
                     @lock.Delete();
                 }
                 catch (IOException)
@@ -352,7 +350,6 @@
                     tmpIndex = new FileInfo(_cacheFile.FullName + ".tmp");
                     if (tmpIndex.Exists)
                     {
-                        tmpIndex.Attributes = FileAttributes.Normal; //need to set to normal before delete to avoid error
                         tmpIndex.Delete();
                     }
                 }
@@ -502,7 +499,6 @@

             if (file.Exists)
             {
-                file.Attributes = FileAttributes.Normal; //need to set to normal before delete to avoid error
                 file.Delete();
             }


fix(build): temp fix for dir structure

fix(build): temp fix for dir structure


S-51801: Create ChangeStatus overload to handle different cases and begin
to split those cases out.

Rather than relying on special fields being there or not (which is almost
the same as passing in a boolean, another type of code smell), just simply
create versions of ChangeStatus that are used where they are needed.

This cleans up the code in each individual case, and you don't have to
carry as much context in your mind when reading it.

--- VersionOne.Bugzilla.BugzillaAPI/BugzillaClient.cs
+++ VersionOne.Bugzilla.BugzillaAPI/BugzillaClient.cs
@@ -3,6 +3,7 @@
 using Newtonsoft.Json.Linq;
 using RestSharp;
 using System.Collections.Generic;
+using VersionOne.ServiceHost.Core.Logging;

 namespace VersionOne.Bugzilla.BugzillaAPI
 {
@@ -23,7 +24,7 @@
         public string Login(string username, string password)
 		{
 			var req = new RestRequest("login?{login}{password}",Method.GET);
-
+
 			req.AddParameter("login", username);
 			req.AddParameter("password", password);

@@ -116,7 +117,7 @@
             var bug = GetBug(bugId);

             //if bug.target_milestone is empty
-                //throws user errror
+            //throws user errror

            ChangeStatus(bug, newBugStatus);

@@ -126,13 +127,13 @@
         public bool ResolveBug(int bugId, string resolution)
         {
             var bug = GetBug(bugId);
-
+
             if (resolution.Equals(Resolution.FIXED.ToString()) && HasOpenDependencies(bug))
             {
                 throw new Exception(String.Format("Still {0} unresolved bugs for bugID {1}", bug.DependesOn.Count, bugId));
             }
-
-            ChangeStatus(bug, Status.RESOLVED.ToString(), resolution); //
+
+             ChangeStatusAndResolve(bug, Status.RESOLVED.ToString(), resolution);

             return true;
         }
@@ -172,16 +173,34 @@
             return response;
         }

-        private void ChangeStatus(Bug bug, string status, string resolution="")
+        private void ChangeStatus(Bug bug, string status)
         {
             if (StatusExists(status))
             {
                 var req = new RestRequest("bug/" + bug.ID, Method.PUT);
-                if (HasResolution(resolution)) {
+
+                req.AddParameter("status", status);
+                req.AddParameter("token", IntegrationUserToken);
+
+                var result = Client.Put(req);
+
+                var response = JObject.Parse(result.Content);
+
+                if (result.StatusCode != System.Net.HttpStatusCode.OK) throw new Exception(response["message"].ToString());
+            }
+        }
+
+        private void ChangeStatusAndResolve(Bug bug, string status,  string resolution)
+        {
+            if (StatusExists(status))
+            {
+                var req = new RestRequest("bug/" + bug.ID, Method.PUT);
+                if (HasResolution(resolution))
+                {
                     req.AddParameter("remaining_time", 0);
                     req.AddParameter("resolution", resolution);
                 }
-
+
                 req.AddParameter("status", status);
                 req.AddParameter("token", IntegrationUserToken);

@@ -198,6 +217,7 @@
                 }
             }
         }
+

         private void CreateComment(Bug bug, string comment)
         {


Update CachedCurrencyConverter.cs

Update CachedCurrencyConverter.cs

--- TIKSN.Core/Finance/Cache/CachedCurrencyConverter.cs
+++ TIKSN.Core/Finance/Cache/CachedCurrencyConverter.cs
@@ -9,20 +9,22 @@
 {
     public class CachedCurrencyConverter : ICurrencyConverter
     {
-        private List<CachedCurrencyPairs> cachedCurrencyPairs;
-
-        private List<CachedRate> cachedRates;
-
         private readonly ICurrencyConverter _originalConverter;
         private readonly ITimeProvider _timeProvider;
-
-        public CachedCurrencyConverter(ICurrencyConverter originalConverter, ITimeProvider timeProvider, TimeSpan ratesCacheInterval, TimeSpan currencyPairsCacheInterval, int? ratesCacheCapacity = null, int? currencyPairsCacheCapacity = null)
+        private readonly List<CachedCurrencyPairs> cachedCurrencyPairs;
+
+        private readonly List<CachedRate> cachedRates;
+
+        public CachedCurrencyConverter(ICurrencyConverter originalConverter, ITimeProvider timeProvider,
+            TimeSpan ratesCacheInterval, TimeSpan currencyPairsCacheInterval, int? ratesCacheCapacity = null,
+            int? currencyPairsCacheCapacity = null)
         {
             if (ratesCacheCapacity.HasValue)
             {
                 if (ratesCacheCapacity.Value < 0)
                 {
-                    throw new ArgumentOutOfRangeException(nameof(ratesCacheCapacity), "Rates cache capacity can not be negative.");
+                    throw new ArgumentOutOfRangeException(nameof(ratesCacheCapacity),
+                        "Rates cache capacity can not be negative.");
                 }
             }

@@ -30,18 +32,21 @@
             {
                 if (currencyPairsCacheCapacity.Value < 0)
                 {
-                    throw new ArgumentOutOfRangeException(nameof(currencyPairsCacheCapacity), "Currency pairs cache capacity can not be negative.");
+                    throw new ArgumentOutOfRangeException(nameof(currencyPairsCacheCapacity),
+                        "Currency pairs cache capacity can not be negative.");
                 }
             }

             if (ratesCacheInterval < TimeSpan.Zero)
             {
-                throw new ArgumentOutOfRangeException(nameof(ratesCacheInterval), "Rates cache interval can not be negative.");
+                throw new ArgumentOutOfRangeException(nameof(ratesCacheInterval),
+                    "Rates cache interval can not be negative.");
             }

             if (currencyPairsCacheInterval < TimeSpan.Zero)
             {
-                throw new ArgumentOutOfRangeException(nameof(currencyPairsCacheInterval), "Currency pairs cache interval can not be negative.");
+                throw new ArgumentOutOfRangeException(nameof(currencyPairsCacheInterval),
+                    "Currency pairs cache interval can not be negative.");
             }

             this._originalConverter = originalConverter ?? throw new ArgumentNullException(nameof(originalConverter));
@@ -52,31 +57,85 @@

             this.cachedCurrencyPairs = new List<CachedCurrencyPairs>();
             this.cachedRates = new List<CachedRate>();
-            _timeProvider = timeProvider ?? throw new ArgumentNullException(nameof(timeProvider));
-        }
-
-        public int? CurrencyPairsCacheCapacity { get; private set; }
-
-        public TimeSpan CurrencyPairsCacheInterval { get; private set; }
-
-        public int CurrencyPairsCacheSize
-        {
-            get
-            {
-                return this.cachedCurrencyPairs.Count;
-            }
-        }
-
-        public int? RatesCacheCapacity { get; private set; }
-
-        public TimeSpan RatesCacheInterval { get; private set; }
-
-        public int RatesCacheSize
-        {
-            get
-            {
-                return this.cachedRates.Count;
-            }
+            this._timeProvider = timeProvider ?? throw new ArgumentNullException(nameof(timeProvider));
+        }
+
+        public int? CurrencyPairsCacheCapacity { get; }
+
+        public TimeSpan CurrencyPairsCacheInterval { get; }
+
+        public int CurrencyPairsCacheSize => this.cachedCurrencyPairs.Count;
+
+        public int? RatesCacheCapacity { get; }
+
+        public TimeSpan RatesCacheInterval { get; }
+
+        public int RatesCacheSize => this.cachedRates.Count;
+
+        public async Task<Money> ConvertCurrencyAsync(Money baseMoney, CurrencyInfo counterCurrency,
+            DateTimeOffset asOn, CancellationToken cancellationToken)
+        {
+            if (baseMoney.Amount == decimal.Zero)
+            {
+                return new Money(counterCurrency);
+            }
+
+            var pair = new CurrencyPair(baseMoney.Currency, counterCurrency);
+
+            var cachedRate = this.GetFromCache(this.cachedRates.Where(item => item.Pair == pair),
+                this.RatesCacheInterval, asOn);
+
+            if (cachedRate != null)
+            {
+                return new Money(counterCurrency, baseMoney.Amount * cachedRate.ExchangeRate);
+            }
+
+            var actualMoney =
+                await this._originalConverter.ConvertCurrencyAsync(baseMoney, counterCurrency, asOn, cancellationToken);
+
+            var actualRate = actualMoney.Amount / baseMoney.Amount;
+
+            this.AddToCache(this.cachedRates, this.RatesCacheCapacity,
+                new CachedRate(pair, actualRate, asOn, this._timeProvider));
+
+            return actualMoney;
+        }
+
+        public async Task<IEnumerable<CurrencyPair>> GetCurrencyPairsAsync(DateTimeOffset asOn,
+            CancellationToken cancellationToken)
+        {
+            var cachedPairs = this.GetFromCache(this.cachedCurrencyPairs, this.CurrencyPairsCacheInterval, asOn);
+
+            if (cachedPairs != null)
+            {
+                return cachedPairs.CurrencyPairs;
+            }
+
+            var actualPairs = await this._originalConverter.GetCurrencyPairsAsync(asOn, cancellationToken);
+
+            this.AddToCache(this.cachedCurrencyPairs, this.CurrencyPairsCacheCapacity,
+                new CachedCurrencyPairs(actualPairs, asOn, this._timeProvider));
+
+            return actualPairs;
+        }
+
+        public async Task<decimal> GetExchangeRateAsync(CurrencyPair pair, DateTimeOffset asOn,
+            CancellationToken cancellationToken)
+        {
+            var cachedRate = this.GetFromCache(this.cachedRates.Where(item => item.Pair == pair),
+                this.RatesCacheInterval, asOn);
+
+            if (cachedRate != null)
+            {
+                return cachedRate.ExchangeRate;
+            }
+
+            var actualRate = await this._originalConverter.GetExchangeRateAsync(pair, asOn, cancellationToken);
+
+            this.AddToCache(this.cachedRates, this.RatesCacheCapacity,
+                new CachedRate(pair, actualRate, asOn, this._timeProvider));
+
+            return actualRate;
         }

         public void Clear()
@@ -85,75 +144,14 @@
             this.cachedRates.Clear();
         }

-        public async Task<Money> ConvertCurrencyAsync(Money baseMoney, CurrencyInfo counterCurrency, DateTimeOffset asOn, CancellationToken cancellationToken)
-        {
-            if (baseMoney.Amount == decimal.Zero)
-            {
-                return new Money(counterCurrency, decimal.Zero);
-            }
-            else
-            {
-                var pair = new CurrencyPair(baseMoney.Currency, counterCurrency);
-
-                var cachedRate = this.GetFromCache(this.cachedRates.Where(item => item.Pair == pair), this.RatesCacheInterval, asOn);
-
-                if (cachedRate != null)
-                {
-                    return new Money(counterCurrency, baseMoney.Amount * cachedRate.ExchangeRate);
-                }
-
-                var actualMoney = await this._originalConverter.ConvertCurrencyAsync(baseMoney, counterCurrency, asOn, cancellationToken);
-
-                var actualRate = actualMoney.Amount / baseMoney.Amount;
-
-                this.AddToCache(this.cachedRates, this.RatesCacheCapacity, new CachedRate(pair, actualRate, asOn, _timeProvider));
-
-                return actualMoney;
-            }
-        }
-
-        public async Task<IEnumerable<CurrencyPair>> GetCurrencyPairsAsync(DateTimeOffset asOn, CancellationToken cancellationToken)
-        {
-            var cachedPairs = this.GetFromCache(this.cachedCurrencyPairs, this.CurrencyPairsCacheInterval, asOn);
-
-            if (cachedPairs != null)
-            {
-                return cachedPairs.CurrencyPairs;
-            }
-
-            var actualPairs = await this._originalConverter.GetCurrencyPairsAsync(asOn, cancellationToken);
-
-            this.AddToCache(this.cachedCurrencyPairs, this.CurrencyPairsCacheCapacity, new CachedCurrencyPairs(actualPairs, asOn, _timeProvider));
-
-            return actualPairs;
-        }
-
-        public async Task<decimal> GetExchangeRateAsync(CurrencyPair pair, DateTimeOffset asOn, CancellationToken cancellationToken)
-        {
-            var cachedRate = this.GetFromCache(this.cachedRates.Where(item => item.Pair == pair), this.RatesCacheInterval, asOn);
-
-            if (cachedRate != null)
-            {
-                return cachedRate.ExchangeRate;
-            }
-
-            var actualRate = await this._originalConverter.GetExchangeRateAsync(pair, asOn, cancellationToken);
-
-            this.AddToCache(this.cachedRates, this.RatesCacheCapacity, new CachedRate(pair, actualRate, asOn, _timeProvider));
-
-            return actualRate;
-        }
-
         private static TimeSpan Absolute(TimeSpan value)
         {
             if (value < TimeSpan.Zero)
             {
                 return -value;
             }
-            else
-            {
-                return value;
-            }
+
+            return value;
         }

         private static bool IsActual(DateTimeOffset cachedAsOn, DateTimeOffset actualAsOn, TimeSpan interval)
@@ -203,11 +201,12 @@

         private T GetFromCache<T>(IEnumerable<T> cache, TimeSpan interval, DateTimeOffset asOn) where T : CachedData
         {
-            var cachedItem = cache.Where(item => IsActual(item.AsOn, asOn, interval)).OrderBy(item => Absolute(item.AsOn - asOn)).FirstOrDefault();
+            var cachedItem = cache.Where(item => IsActual(item.AsOn, asOn, interval))
+                .OrderBy(item => Absolute(item.AsOn - asOn)).FirstOrDefault();

             if (cachedItem != null)
             {
-                cachedItem.Update(_timeProvider);
+                cachedItem.Update(this._timeProvider);
             }

             return cachedItem;
@@ -215,7 +214,8 @@

         private class CachedCurrencyPairs : CachedData
         {
-            public CachedCurrencyPairs(IEnumerable<CurrencyPair> currencyPairs, DateTimeOffset asOn, ITimeProvider timeProvider)
+            public CachedCurrencyPairs(IEnumerable<CurrencyPair> currencyPairs, DateTimeOffset asOn,
+                ITimeProvider timeProvider)
             {
                 this.CurrencyPairs = currencyPairs;
                 this.AsOn = asOn;
@@ -223,7 +223,7 @@
                 this.Update(timeProvider);
             }

-            public IEnumerable<CurrencyPair> CurrencyPairs { get; set; }
+            public IEnumerable<CurrencyPair> CurrencyPairs { get; }
         }

         private abstract class CachedData
@@ -232,10 +232,7 @@

             public DateTimeOffset LastAccess { get; private set; }

-            public void Update(ITimeProvider timeProvider)
-            {
-                this.LastAccess = timeProvider.GetCurrentTime();
-            }
+            public void Update(ITimeProvider timeProvider) => this.LastAccess = timeProvider.GetCurrentTime();
         }

         private class CachedRate : CachedData
@@ -249,9 +246,9 @@
                 this.Update(timeProvider);
             }

-            public decimal ExchangeRate { get; private set; }
-
-            public CurrencyPair Pair { get; private set; }
+            public decimal ExchangeRate { get; }
+
+            public CurrencyPair Pair { get; }
         }
     }
-}+}


.16: gitflow-release-stash: 1.16.3

.16: gitflow-release-stash: 1.16.3

--- Terradue.OpenSearch.Test/AuthOpenSearchable.Test.cs
+++ Terradue.OpenSearch.Test/AuthOpenSearchable.Test.cs
@@ -46,32 +46,6 @@
             OpenSearchFactory.FindOpenSearchable(settings, new Uri("https://catalog.terradue.com/demo1/search"), null);

-
-        }
-
-
-            OpenSearchEngine ose = new OpenSearchEngine();
-            ose.LoadPlugins();
-
-            var settings = new OpenSearchableFactorySettings(ose);
-            settings.Credentials = new System.Net.NetworkCredential("demo1", "Demo199++");
-            UrlBasedOpenSearchableFactory factory = new UrlBasedOpenSearchableFactory(settings);
-
-            IOpenSearchable entity1 = factory.Create(new OpenSearchUrl("https://catalog.terradue.com/demo1/search"));
-
-            NameValueCollection nvc = new NameValueCollection();
-
-            var osr = ose.Query(entity1, nvc, "atom");
-
-            nvc = new NameValueCollection();
-            nvc.Set("count", "10");
-
-            osr = ose.Query(entity1, nvc, "atom");
-
-            OpenSearchFactory.FindOpenSearchable(settings, new Uri("https://catalog.terradue.com/demo1/search"), null);
-
-
-
         }

         [Test]


Adding timer tests

Adding timer tests

--- Tests/Core.Tests.Unit/Timers/TimerExceptionTests.cs
+++ Tests/Core.Tests.Unit/Timers/TimerExceptionTests.cs
@@ -1,38 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="TimerExceptionTests.cs">
-//      Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-//      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-//      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-//      IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-//      CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-//      TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-//      SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// </copyright>
-//-----------------------------------------------------------------------
-
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Microsoft.PSharp.Core.Tests.Unit
-{
-    public class TimerExceptionTests
-    {
-		class NonMachineSubClass { }
-
-		[Fact]
-		public void TestExceptionOnInvalidTimerType()
-		{
-			PSharpRuntime runtime = PSharpRuntime.Create();
-
-			Exception ex = Assert.Throws<AssertionFailureException>(() => runtime.SetTimerMachineType(typeof(NonMachineSubClass)));
-		}
-
-    }
-}


Added failing/skipped test for #925.

Added failing/skipped test for #925.

--- test/Autofac.Test/Features/ResolveAnything/ResolveAnythingTests.cs
+++ test/Autofac.Test/Features/ResolveAnything/ResolveAnythingTests.cs
@@ -198,6 +198,16 @@
             Assert.NotNull(container.Resolve<Progress<Exception>>());
         }

+        [Fact(Skip = "Issue #925")]
+        public void ConstructableOpenGenericsWithUnresolvableTypeParametersCanBeResolved()
+        {
+            var container = CreateResolveAnythingContainer();
+            Assert.True(container.IsRegistered<Progress<IComparable>>());
+            Assert.NotNull(container.Resolve<Progress<IComparable>>());
+            Assert.True(container.IsRegistered<Progress<AbstractType>>());
+            Assert.NotNull(container.Resolve<Progress<AbstractType>>());
+        }
+
         [Fact]
         public void ConstructableOpenGenericsWithGenericTypeArgumentNotMatchingFilterCanBeResolved()
         {


Set dropbox login callback to smaller page

--- TodotxtTouch.WindowsPhone/Service/DropBoxService.cs
+++ TodotxtTouch.WindowsPhone/Service/DropBoxService.cs
@@ -182,7 +182,7 @@
 			_dropNetClient.GetTokenAsync(
 				success =>
 				{
-					string tokenUrl = _dropNetClient.BuildAuthorizeUrl("http://todotxt.traceur-llc.com/index.html");
+					string tokenUrl = _dropNetClient.BuildAuthorizeUrl("http://todotxt.traceur-llc.com/dblogin.html");

 					Messenger.Default.Send(new RetrievedDropboxTokenMessage(new Uri(tokenUrl)));
 				},


Add unit test

Add unit test

--- UnitTestUsefullFunctions/UnitTestFunctionsPrimes.cs
+++ UnitTestUsefullFunctions/UnitTestFunctionsPrimes.cs
@@ -531,6 +531,15 @@
     {
       const int source = 131;
       const int expected = 33;
+      int result = FunctionsPrimes.Pi(source);
+      Assert.AreEqual(result, expected);
+    }
+
+    [TestMethod]
+    public void TestMethod_Pi_137()
+    {
+      const int source = 137;
+      const int expected = 34;
       int result = FunctionsPrimes.Pi(source);
       Assert.AreEqual(result, expected);
     }


Resharper code

Resharper code

--- UnitTestUsefullFunctions/UnitTestFunctionsString.cs
+++ UnitTestUsefullFunctions/UnitTestFunctionsString.cs
@@ -101,7 +101,7 @@
     public void TestMethod_HasDuplicate_yes_on_several_items()
     {
       int[] source = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 9 };
-      bool expected = true;
+      const bool expected = true;
       bool result = StringFunc.HasDuplicate(source);
       Assert.AreEqual(result, expected);
     }


Fix for problem introduced in VS 2017 15.6.1

--- VisualStudio/ProjectPackage/XSharpIDEBuildLogger.cs
+++ VisualStudio/ProjectPackage/XSharpIDEBuildLogger.cs
@@ -111,7 +111,7 @@
                     didCompile = true;
                 }
             }
-            if (messageEvent.SenderName.ToLower() == "nativeresourcecompiler")
+            if (messageEvent.SenderName?.ToLower() == "nativeresourcecompiler")
             {
                 didCompile = true;
             }