removed google analytics code because most people block it now.

--- Forum3/Views/Shared/_Layout.cshtml
+++ Forum3/Views/Shared/_Layout.cshtml
@@ -19,17 +19,6 @@
     </environment>

 	@await RenderSectionAsync("Styles", required: false)
-
-	<!-- PLEASE CHANGE THIS ID IF YOU DEPLOY THIS CODE TO OTHER SITES. THIS IS WARPSTORM.COM SPECIFIC. -->
-	<!-- Global Site Tag (gtag.js) - Google Analytics -->
-	<script async src="https://www.googletagmanager.com/gtag/js?id=UA-349282-1"></script>
-	<script>
-		window.dataLayer = window.dataLayer || [];
-		function gtag() { dataLayer.push(arguments) };
-		gtag('js', new Date());
-
-		gtag('config', 'UA-349282-1');
-	</script>
 </head>
 <body>
 	<header id="page-header" class="margin-center pad">


Simplified implementation of MaybeOneOf

Simplified implementation of MaybeOneOf

--- FriendlyRegex/RegularExpression.cs
+++ FriendlyRegex/RegularExpression.cs
@@ -30,12 +30,12 @@

         public IQuantifiableRegularExpression Then(char character)
         {
-            return ConcatenateThisWith(Literal(character));
+            return ConcatenateThisWith(AsLiteral(character));
         }

         public IQuantifiableRegularExpression Then(string literal)
         {
-            return ConcatenateThisWith(Literal(literal));
+            return ConcatenateThisWith(AsLiteral(literal));
         }

         public IQuantifiableRegularExpression Then(IRegularExpression expression)
@@ -45,12 +45,12 @@

         public Concatenation Maybe(char character)
         {
-            return Maybe(Literal(character));
+            return Maybe(AsLiteral(character));
         }

         public Concatenation Maybe(string literal)
         {
-            return Maybe(Literal(literal));
+            return Maybe(AsLiteral(literal));
         }

         public Concatenation Maybe(IRegularExpression expression)
@@ -70,8 +70,7 @@
         public IQuantifiableRegularExpression OneOf(params string[] literals)
         {
             var expressions = literals
-                .Select(literal => new Literal(literal))
-                .Cast<IRegularExpression>()
+                .Select(AsLiteral)
                 .ToArray();

             return OneOf(expressions);
@@ -87,8 +86,7 @@
         public Concatenation MaybeOneOf(params string[] literals)
         {
             var expressions = literals
-                .Select(literal => new Literal(literal))
-                .Cast<IRegularExpression>()
+                .Select(AsLiteral)
                 .ToArray();

             return MaybeOneOf(expressions);
@@ -243,12 +241,12 @@
             return Concatenation.Concatenate(expressions);
         }

-        private static IRegularExpression Literal(char character)
-        {
-            return Literal(character.ToString(CultureInfo.InvariantCulture));
-        }
-
-        private static IRegularExpression Literal(string literal)
+        private static IRegularExpression AsLiteral(char character)
+        {
+            return AsLiteral(character.ToString(CultureInfo.InvariantCulture));
+        }
+
+        private static IRegularExpression AsLiteral(string literal)
         {
             return new Literal(literal);
         }


Version 0.77

Version 0.77

--- GitMind/Properties/AssemblyInfo.cs
+++ GitMind/Properties/AssemblyInfo.cs
@@ -50,7 +50,7 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("0.76.*")]
+[assembly: AssemblyVersion("0.77.*")]

 [assembly: InternalsVisibleTo("GitMindTest")]


update

update

--- H3Control.Tests/ResponseDriller.cs
+++ H3Control.Tests/ResponseDriller.cs
@@ -74,7 +74,7 @@
             var elapsed2 = sw.ElapsedMilliseconds;

             var keys = result.Headers.Select(x => x.Key).OrderBy(x => x).ToList();
-            var maxKeyLength = Math.Max(20, keys.Max(x => x.Length) + 1);
+            var maxKeyLength = Math.Max(19, keys.Max(x => x.Length) + 1);
             int numHeaders = result.Headers.SelectMany(x => x.Value).Count();
             StringBuilder b = new StringBuilder();
             b.AppendFormat(@"{0} response details:


Removed unnecessary item from ActionFlags enum

--- InSimDotNet/Packets/ActionFlags.cs
+++ InSimDotNet/Packets/ActionFlags.cs
@@ -24,11 +24,6 @@
         /// <summary>
         /// Clear all objects (NumO must be zero).
         /// </summary>
-        PMO_CLEAR_ALL,
-
-        /// <summary>
-        /// Huh?
-        /// </summary>
-        PMO_NUM
+        PMO_CLEAR_ALL
     }
 }


Added null check to filter

Added null check to filter

--- InstantDatabase/InstantDatabase.cs
+++ InstantDatabase/InstantDatabase.cs
@@ -185,7 +185,7 @@
 				else
 					rowQuery = string.Format ("select count(*) from {0} where {1} = ? {2}", groupInfo.FromString(type.Name), groupInfo.GroupBy, groupInfo.FilterString (false));
 				//lock(Locker){
-				if(groupInfo.Filter.Contains("?") && string.IsNullOrEmpty(groupInfo.GroupString))
+				if(!string.IsNullOrEmpty(groupInfo.Filter) && groupInfo.Filter.Contains("?") && string.IsNullOrEmpty(groupInfo.GroupString))
 				group.RowCount = connection.ExecuteScalar<int> (rowQuery,groupInfo.Params);
 				else
 					group.RowCount = connection.ExecuteScalar<int> (rowQuery, group.GroupString,groupInfo.Params);
@@ -462,7 +462,7 @@
 				var parameters = new List<object>();
 				if(group.GroupString.Contains("?"))
 					parameters.Add(group.GroupString);
-				if(info.Filter.Contains("?"))
+				if(!string.IsNullOrEmpty(info.Filter) && info.Filter.Contains("?"))
 					parameters.Add(info.Params);
 				parameters.Add(row);
 				if(group.Filter.Contains("?"))


Allow creating an array instance based on existing PropertyDescriptor array/dictionary (#498)

Allow creating an array instance based on existing PropertyDescriptor array/dictionary, this way, for intense array usages we allow reducing allocations and iterations while adding items to array.

--- Jint/Native/Array/ArrayInstance.cs
+++ Jint/Native/Array/ArrayInstance.cs
@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 using System.Runtime.CompilerServices;

 using Jint.Native.Object;
@@ -37,6 +38,32 @@
             {
                 _sparse = new Dictionary<uint, PropertyDescriptor>((int) (capacity <= 1024 ? capacity : 1024));
             }
+        }
+
+        public ArrayInstance(Engine engine, PropertyDescriptor[] items) : base(engine)
+        {
+            _engine = engine;
+            int length = 0;
+            if (items == null || items.Length == 0)
+            {
+                _dense = System.Array.Empty<PropertyDescriptor>();
+                length = 0;
+            }
+            else
+            {
+                _dense = items;
+                length = items.Length;
+            }
+
+            SetOwnProperty(PropertyNameLength, new PropertyDescriptor(length, PropertyFlag.OnlyWritable));
+        }
+
+        public ArrayInstance(Engine engine, Dictionary<uint, PropertyDescriptor> items) : base(engine)
+        {
+            _engine = engine;
+            _sparse = items;
+            var length = items?.Count ?? 0;
+            SetOwnProperty(PropertyNameLength, new PropertyDescriptor(length, PropertyFlag.OnlyWritable));
         }

         public override string Class => "Array";


Fix IdleManagerFacts tests

Fix IdleManagerFacts tests

--- Kudu.Core.Test/IdleManagerFacts.cs
+++ Kudu.Core.Test/IdleManagerFacts.cs
@@ -23,7 +23,7 @@
             // Setup
             process.SetupGet(f => f.Name)
                    .Returns("Test-Process");
-            process.Setup(f => f.WaitForExit(idleTimeout))
+            process.Setup(f => f.WaitForExit(It.IsAny<TimeSpan>()))
                    .Returns(true)
                    .Verifiable();
             process.Setup(f => f.WaitUntilEOF())
@@ -40,7 +40,7 @@
         public void WaitForExitPollsAllowsExecutableToContinueAfterTimeoutIfIOActivity()
         {
             // Arrange
-            var idleTimeout = TimeSpan.Zero;
+            var idleTimeout = TimeSpan.MinValue;
             var tracer = new Mock<ITracer>(MockBehavior.Strict);
             var idleManager = new IdleManager(idleTimeout, tracer.Object);
             var process = new Mock<IProcess>(MockBehavior.Strict);
@@ -49,7 +49,7 @@
             int num = 10;
             process.SetupGet(f => f.Name)
                    .Returns("Test-Process");
-            process.Setup(f => f.WaitForExit(idleTimeout))
+            process.Setup(f => f.WaitForExit(It.IsAny<TimeSpan>()))
                    .Returns(() =>
                     {
                         if (--num == 0)
@@ -78,7 +78,7 @@
         public void WaitForExitPollsAllowsExecutableToContinueAfterTimeoutIfCpuActivity()
         {
             // Arrange
-            var idleTimeout = TimeSpan.MaxValue;
+            var idleTimeout = TimeSpan.MinValue;
             var tracer = new Mock<ITracer>(MockBehavior.Strict);
             var idleManager = new IdleManager(idleTimeout, tracer.Object);
             var process = new Mock<IProcess>(MockBehavior.Strict);
@@ -87,7 +87,7 @@
             int num = 10, cpu = 0;
             process.SetupGet(f => f.Name)
                    .Returns("Test-Process");
-            process.Setup(f => f.WaitForExit(idleTimeout))
+            process.Setup(f => f.WaitForExit(It.IsAny<TimeSpan>()))
                    .Returns(() => --num == 0);
             process.Setup(f => f.GetTotalProcessorTime(It.IsAny<ITracer>()))
                    .Returns(() => TimeSpan.FromSeconds(++cpu))
@@ -109,7 +109,7 @@
         public void WaitForExitPollsAllowsExecutableToContinueAfterTimeoutIfCpuOrIOActivity()
         {
             // Arrange
-            var idleTimeout = TimeSpan.Zero;
+            var idleTimeout = TimeSpan.MinValue;
             var tracer = new Mock<ITracer>(MockBehavior.Strict);
             var idleManager = new IdleManager(idleTimeout, tracer.Object);
             var process = new Mock<IProcess>(MockBehavior.Strict);
@@ -118,7 +118,7 @@
             int num = 10;
             process.SetupGet(f => f.Name)
                    .Returns("Test-Process");
-            process.Setup(f => f.WaitForExit(idleTimeout))
+            process.Setup(f => f.WaitForExit(It.IsAny<TimeSpan>()))
                    .Returns(() => --num == 0);
             process.Setup(f => f.GetTotalProcessorTime(It.IsAny<ITracer>()))
                    .Returns(() =>
@@ -147,7 +147,7 @@
             // Arrange
             var tracer = new Mock<ITracer>(MockBehavior.Strict);
             DateTime startTime = DateTime.UtcNow;
-            TimeSpan idleTimeout = TimeSpan.FromSeconds(1);
+            TimeSpan idleTimeout = TimeSpan.FromMilliseconds(100);
             var idleManager = new IdleManager(idleTimeout, tracer.Object);
             var process = new Mock<IProcess>(MockBehavior.Strict);

@@ -156,7 +156,7 @@
                    .Returns("Test-Process");
             process.SetupGet(f => f.Arguments)
                    .Returns("");
-            process.Setup(f => f.WaitForExit(idleTimeout))
+            process.Setup(f => f.WaitForExit(It.IsAny<TimeSpan>()))
                    .Returns(() => { Thread.Sleep(10); return false; });
             process.Setup(f => f.GetTotalProcessorTime(It.IsAny<ITracer>()))
                    .Returns(TimeSpan.Zero);
@@ -171,7 +171,7 @@
             // Assert
             process.Verify();

-            //Assert.True(DateTime.UtcNow - startTime >= idleTimeout);
+            Assert.True(DateTime.UtcNow - startTime >= idleTimeout);
             Assert.Contains("Command 'Test-Process ' aborted due to no output and CPU activity for", ex.Message);
         }
     }


Adding the 2022 Azure image names

Adding the 2022 Azure image names

--- LabXml/Machines/OperatingSystem.cs
+++ LabXml/Machines/OperatingSystem.cs
@@ -28,12 +28,16 @@
             {"2016-Datacenter-Server-Core", "Windows Server 2016 Datacenter" },
             {"2019-Datacenter", "Windows Server 2019 Datacenter (Desktop Experience)" },
             {"2019-Datacenter-Core", "Windows Server 2019 Datacenter" },
+            {"2022-datacenter", "Windows Server 2022 Datacenter (Desktop Experience)" },
+            {"2022-datacenter-Core", "Windows Server 2022 Datacenter" },
             {"Datacenter-Core-1803-with-Containers-smalldisk", "Windows Server Datacenter" },
             {"Win7-SP1-Ent-N-x64", "Windows 7 Enterprise N" },
             {"Win81-Ent-N-x64", "Windows 8.1 Enterprise N" },
             {"Windows-10-N-x64", "Windows 10 Enterprise N" },
             {"20h2-ent", "Windows 10 Enterprise" },
-            {"20h2-pro", "Windows 10 Pro" }
+            {"20h2-pro", "Windows 10 Pro" },
+            {"win11-21h2-ent", "Windows 11 Enterprise" },
+            {"win11-21h2-pro", "Windows 11 Pro" }
             };
         private Dictionary<string, string> isoNameToAzureSku;


easy fix

easy fix

--- LegendaryClient/MainWindow.xaml.cs
+++ LegendaryClient/MainWindow.xaml.cs
@@ -125,8 +125,8 @@

         private void ProfileButton_Click(object sender, RoutedEventArgs e)
         {
-            uiLogic.UpdateProfile(Client.LoginPacket.AllSummonerData.Summoner.Name);
-
+            if (Client.IsLoggedIn)
+                uiLogic.UpdateProfile(Client.LoginPacket.AllSummonerData.Summoner.Name);
         }

         private void PlayButton_Click(object sender, RoutedEventArgs e)


sharepoint online create folder.

sharepoint online create folder.

--- azurecopy/SharepointHandler.cs
+++ azurecopy/SharepointHandler.cs
@@ -51,12 +51,16 @@
         // so need to get collection of everything up until the last segment of the url.
         public void MakeContainer(string url)
         {
-            throw new NotImplementedException();
-
-            var context = GetContext(url);
-
-            var folderCollection = GetSharepointFolderCollection(url);
-            Microsoft.SharePoint.Client.Folder newFolder = folderCollection.Add("test");
+            var uri = new Uri(url);
+
+            // Feel this is overkill when I could just search string for the last /
+            var newUri = uri.Scheme + "://" + uri.Host + string.Join("", uri.Segments.Take(uri.Segments.Length - 1));
+            var newContainer = uri.Segments[uri.Segments.Length - 1];
+
+            var context = GetContext(newUri);
+
+            var folderCollection = GetSharepointFolderCollection(newUri);
+            Microsoft.SharePoint.Client.Folder newFolder = folderCollection.Add(newContainer );

             context.ExecuteQuery();


Added more NtlmFlags

Added more NtlmFlags

--- MailKit/Security/Ntlm/NtlmFlags.cs
+++ MailKit/Security/Ntlm/NtlmFlags.cs
@@ -49,14 +49,35 @@
 		// This requests that the server send the authentication target with the Type 2 reply.
 		RequestTarget = 0x00000004,

+		// Indicates that authenticated communication between the client and server includes a digital signature (message integrity).
+		NegotiateSign = 0x00000010,
+
+		// Indicates that authenticated communication between the client and server should be encrypted.
+		NegotiateSeal = 0x00000020,
+
+		// Indicates that datagram authentication is being used.
+		NegotiateDatagramStyle = 0x00000040,
+
+		// Indicates that the Lan Manager Session Key should be used for signing and sealing authenticated communications.
+		NegotiateLanManagerKey = 0x00000080,
+
+		// This flag's usage has not been identified.
+		NegotiateNetware = 0x00000100,
+
 		// Indicates that NTLM authentication is supported.
 		NegotiateNtlm = 0x00000200,
+
+		/// Sent by the client in the Type 3 message to indicate that an anonymous context has been established. This also affects the response fields.
+		NegotiateAnonymous = 0x00000800,

 		// When set, the client will send with the message the name of the domain in which the workstation has membership.
 		NegotiateDomainSupplied = 0x00001000,

 		// Indicates that the client is sending its workstation name with the message.
 		NegotiateWorkstationSupplied = 0x00002000,
+
+		// Indicates that the client and server are on the same machine.
+		NegotiateLocalCall = 0x00004000,

 		// Indicates that communication between the client and server after authentication should carry a "dummy" signature.
 		NegotiateAlwaysSign = 0x00008000,


Fixed spaces in path to updater.

Fixed spaces in path to updater.

--- MangaReader.Core/Update/Updater.cs
+++ MangaReader.Core/Update/Updater.cs
@@ -34,10 +34,14 @@
     /// </summary>
     public static void StartUpdate()
     {
-      var args = string.Join(" ",
-        "--fromFile", UpdateConfig,
-        "--version", ClientVersion,
-        "--outputFolder", ConfigStorage.WorkFolder);
+      if (!File.Exists(UpdateFilename))
+      {
+        Log.AddFormat("Updater not found.");
+        return;
+      }
+
+      var args = string.Format("--fromFile \"{0}\" --version \"{1}\" --outputFolder \"{2}\"",
+        UpdateConfig, ClientVersion, ConfigStorage.WorkFolder);
       Log.AddFormat("Update process started: File '{0}', Args '{1}', Folder '{2}'",
         UpdateFilename, args, ConfigStorage.WorkFolder);


Removed a bug regarding polygon StrokeColor and StrokeWidth in MapView. See #793.

--- Mapsui.UI.Forms/Objects/Polygon.cs
+++ Mapsui.UI.Forms/Objects/Polygon.cs
@@ -70,6 +70,12 @@
                 case nameof(FillColor):
                     ((VectorStyle)Feature.Styles.First()).Fill = new Brush(FillColor.ToMapsui());
                     break;
+                case nameof(StrokeColor):
+                    ((VectorStyle)Feature.Styles.First()).Outline.Color = StrokeColor.ToMapsui();
+                    break;
+                case nameof(StrokeWidth):
+                    ((VectorStyle)Feature.Styles.First()).Outline.Width = StrokeWidth;
+                    break;
             }
         }


Fixed stupidity in getter

Fixed stupidity in getter

--- Models/Identity/ApplicationUser.cs
+++ Models/Identity/ApplicationUser.cs
@@ -11,16 +11,29 @@

     public class ApplicationUser : IdentityUser
     {
+        private ICollection<Post> posts;
+
         public ApplicationUser()
         {
-            this.Posts = new HashSet<Post>();
+            this.posts = new HashSet<Post>();
         }

-        public virtual ICollection<Post> Posts { get; }
+        public virtual ICollection<Post> Posts
+        {
+            get
+            {
+                return this.posts;
+            }
+            set
+            {
+                this.posts = value;
+            }
+        }

         public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
         {
-            return await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
+            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
+            return userIdentity;
         }
     }
 }


Fixed reusing views

Fixed reusing views

--- MonoDroid.Dialog/DroidResources.cs
+++ MonoDroid.Dialog/DroidResources.cs
@@ -89,6 +89,12 @@
             {
                 label = layout.FindViewById<TextView>(context.Resources.GetIdentifier("dialog_LabelField", "id", context.PackageName));
                 value = layout.FindViewById<TextView>(context.Resources.GetIdentifier("dialog_ValueField", "id", context.PackageName));
+				if(label == null || value == null)
+				{
+					layout = LoadLayout(context, parent, layoutId);
+					label = layout.FindViewById<TextView>(context.Resources.GetIdentifier("dialog_LabelField", "id", context.PackageName));
+					value = layout.FindViewById<TextView>(context.Resources.GetIdentifier("dialog_ValueField", "id", context.PackageName));
+				}
             }
             else
             {


Updated when the myos connect

Updated when the myos connect

--- MyoSnake/MyoSnake/MainPage.xaml.cs
+++ MyoSnake/MyoSnake/MainPage.xaml.cs
@@ -39,18 +39,6 @@

         private void Start_Click(object sender, RoutedEventArgs e)
         {
-            this.Frame.Navigate(typeof(MyoSnake.Selection));
-        }
-
-        private void HighScore_Click(object sender, RoutedEventArgs e)
-        {
-            this.Frame.Navigate(typeof(MyoSnake.HighScores));
-        }
-
-        protected override void OnNavigatedFrom(NavigationEventArgs e)
-        {
-            base.OnNavigatedFrom(e);
-
             // save if using myo
             if (dontUseMyoCB.IsChecked == true) // don't use the myo
             {
@@ -67,6 +55,12 @@
                 myoManager.connect();
             }

+            this.Frame.Navigate(typeof(MyoSnake.Selection));
+        }
+
+        private void HighScore_Click(object sender, RoutedEventArgs e)
+        {
+            this.Frame.Navigate(typeof(MyoSnake.HighScores));
         }
     }
 }


Fix for NullReferenceException.

Fix for NullReferenceException.

--- NBug/Core/Submission/Dispatcher.cs
+++ NBug/Core/Submission/Dispatcher.cs
@@ -76,9 +76,9 @@
 				using (Storer storer = new Storer())
 				using (Stream stream = storer.GetFirstReportFile())
 				{
-					var exceptionData = GetDataFromZip(stream);
 					if (stream != null)
 					{
+						var exceptionData = GetDataFromZip(stream);
 						if (this.EnumerateDestinations(stream, exceptionData) == false)
 						{
 							break;


Calendar now keeps selected time when changing date.

--- NControl.Controls/CalendardView.cs
+++ NControl.Controls/CalendardView.cs
@@ -251,11 +251,11 @@
 			// Update selected date
 			var col = (int)Math.Round(_ellipse.TranslationX / (_calendar.Width / 7));
 			var row = (int)Math.Round(_ellipse.TranslationY / (_calendar.Height / 6));
-			var choosenDate = StartDate.AddDays(col + (row * 7));
-			System.Diagnostics.Debug.WriteLine (choosenDate);
+			var choosenDate = StartDate.AddDays(col + (row * 7));
 			var callEvent = (choosenDate.Month == SelectedDate.Month);

-			SelectedDate = choosenDate;
+            SelectedDate = new DateTime(choosenDate.Year, choosenDate.Month, choosenDate.Day,
+                SelectedDate.Hour, SelectedDate.Minute, SelectedDate.Second);

 			// Call event
 			if (callEvent && OnDateSelected != null)


Build script fix

Build script fix

--- Nake.csx
+++ Nake.csx
@@ -7,6 +7,7 @@
 using Nake.Run;
 using Nake.Log;
 using Nake.Env;
+using Nake.App;

 using System.Linq;
 using System.Net;
@@ -59,12 +60,17 @@
     var tests = new FileSet{@"{outDir}\*.Tests.dll"}.ToString(" ");
     var results = @"{outDir}\nunit-test-results.xml";

-    Cmd(@"Packages\NUnit.Runners.2.6.3\tools\nunit-console.exe " +
-        @"/xml:{results} /framework:net-4.0 /noshadow /nologo {tests} " +
-        (AppVeyor ? "/include:Slow" : ""));
+    var succes = Cmd(@"Packages\NUnit.Runners.2.6.3\tools\nunit-console.exe " +
+        			 @"/xml:{results} /framework:net-4.0 /noshadow /nologo {tests} " +
+        		     (AppVeyor ? "/include:Slow" : ""),
+			       	 ignoreStdOutErrors: true,
+			       	 ignoreExitCode: true) != 0;

     if (AppVeyor)
         new WebClient().UploadFile("https://ci.appveyor.com/api/testresults/nunit/$APPVEYOR_JOB_ID$", results);
+
+    if (!succes)
+        Fail();
 }

 /// Builds official NuGet packages


added Move.CausesCheck method

added Move.CausesCheck method

--- NoraGrace/NoraGrace.Engine/Move.cs
+++ NoraGrace/NoraGrace.Engine/Move.cs
@@ -69,6 +69,7 @@
             }
             return false;
         }
+
         public static bool IsPsuedoLegal(this Move move, Board board)
         {
             if (move == Move.EMPTY) { return false; }
@@ -200,6 +201,80 @@

         }

+        public static bool CausesCheck(this Move move, Board board, CheckInfo oppenentCheckInfo)
+        {
+            Position from = move.From();
+            Position to = move.To();
+            PieceType pieceType = board.PieceAt(from).ToPieceType();
+
+            if (oppenentCheckInfo.DirectAll.Contains(to))
+            {
+                bool direct = false;
+                PieceType pieceTypeAfter = move.Promote() == Piece.EMPTY ? pieceType : move.Promote().ToPieceType(); //in case of promotion
+                switch (pieceTypeAfter)
+                {
+                    case PieceType.Pawn:
+                        direct = oppenentCheckInfo.PawnDirect.Contains(to);
+                        break;
+                    case PieceType.Knight:
+                        direct = oppenentCheckInfo.KnightDirect.Contains(to);
+                        break;
+                    case PieceType.Bishop:
+                        direct = oppenentCheckInfo.BishopDirect.Contains(to);
+                        break;
+                    case PieceType.Rook:
+                        direct = oppenentCheckInfo.RookDirect.Contains(to);
+                        break;
+                    case PieceType.Queen:
+                        direct = oppenentCheckInfo.BishopDirect.Contains(to) || oppenentCheckInfo.RookDirect.Contains(to);
+                        break;
+                }
+                if (direct) { return true; }
+            }
+
+            bool isEnpassantCapture = pieceType == PieceType.Pawn && to == board.EnPassant;
+
+            if (oppenentCheckInfo.PinnedOrDiscovered.Contains(from) || isEnpassantCapture)
+            {
+                Bitboard allAfterMove = (board.PieceLocationsAll & ~from.ToBitboard()) | to.ToBitboard();
+
+                if (isEnpassantCapture)
+                {
+                    Position enpassantCapturedSq = board.WhosTurn.MyRank(Rank.Rank5).ToPosition(board.EnPassant.ToFile());
+                    allAfterMove &= ~enpassantCapturedSq.ToBitboard();
+                }
+
+                Bitboard stmAll = board[board.WhosTurn];
+                Bitboard revealed = (Attacks.BishopAttacks(oppenentCheckInfo.KingPosition, allAfterMove) & stmAll & board.BishopSliders)
+                    | (Attacks.RookAttacks(oppenentCheckInfo.KingPosition, allAfterMove) & stmAll & board.RookSliders);
+                if (revealed != Bitboard.Empty) { return true; }
+            }
+
+            //check if castling reveals check via rook
+            if (pieceType == PieceType.King)
+            {
+                if (from == Position.E1 && to == Position.G1 && oppenentCheckInfo.RookDirect.Contains(Position.F1))
+                {
+                    return true;
+                }
+                if (from == Position.E1 && to == Position.C1 && oppenentCheckInfo.RookDirect.Contains(Position.D1))
+                {
+                    return true;
+                }
+
+                if (from == Position.E8 && to == Position.G8 && oppenentCheckInfo.RookDirect.Contains(Position.F8))
+                {
+                    return true;
+                }
+                if (from == Position.E8 && to == Position.C8 && oppenentCheckInfo.RookDirect.Contains(Position.D8))
+                {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
 	}


Didn't mean to commit this change in BlockingQueue.cs

--- OpenSim/Framework/BlockingQueue.cs
+++ OpenSim/Framework/BlockingQueue.cs
@@ -76,7 +76,7 @@
         {
             lock (m_queueSync)
             {
-                while (m_queue.Count < 1 && m_pqueue.Count < 1)
+                if (m_queue.Count < 1 && m_pqueue.Count < 1)
                 {
                     Monitor.Wait(m_queueSync, msTimeout);
                 }


Extension include file improvements Extension include file names are now prefixed with `Ext.` Include file error logging now includes the file name

--- Oxide.Ext.CSharp/PluginCompiler.cs
+++ Oxide.Ext.CSharp/PluginCompiler.cs
@@ -145,15 +145,15 @@
                         foreach (var reference in plugin.References)
                         {
                             if (!reference.StartsWith("Oxide.Ext.")) continue;
-                            var extension_name = reference.Substring(10);
-                            if (extension_names.Contains(extension_name)) continue;
-                            var include_file_path = include_path + "\\" + extension_name + ".cs";
+                            var name = reference.Substring(10);
+                            if (extension_names.Contains(name)) continue;
+                            var include_file_path = include_path + "\\Ext." + name + ".cs";
                             if (File.Exists(include_file_path))
                             {
                                 plugin.IncludePaths.Add(include_file_path);
                                 continue;
                             }
-                            var message = $"{extension_name} extension is referenced but is not loaded! An include file needs to be placed in Plugins\\Include if this is an optional dependency.";
+                            var message = $"{name} extension is referenced but is not loaded! An appropriate include file needs to be saved to Plugins\\Include\\Ext.{name}.cs if this is an optional dependency.";
                             Interface.Oxide.LogError(message);
                             plugin.CompilerErrors = message;
                             RemovePlugin(plugin);


code gen fix

code gen fix

--- PanoramicDataWin8/MainPage.xaml.cs
+++ PanoramicDataWin8/MainPage.xaml.cs
@@ -28,6 +28,7 @@
 using Windows.UI.Text;
 using Windows.UI.Xaml.Documents;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Newtonsoft.Json.Serialization;
 using PanoramicDataWin8.controller.data.tuppleware.gateway;
 using PanoramicDataWin8.controller.input;
@@ -564,7 +565,8 @@
             {
                 CodeGenCommand cmd = new CodeGenCommand();
                 string response = await cmd.CodeGen((vis.QueryModel.SchemaModel.OriginModels[0] as TuppleWareOriginModel), generateCodeUuid);
-                text += response + "\n";
+                JObject obj = JObject.Parse(response);
+                text += obj["code"] + "\n";
             }

             editBox.Document.SetText(TextSetOptions.ApplyRtfDocumentDefaults, text);


New feature: AutoCrop

New feature: AutoCrop

A strightforward implementation, there may be possibilities for better
performance in the future through either/both working at a lower level
(probable) or/and parallelisation (might incur too much overhead).

--- Pinta.Core/Actions/ImageActions.cs
+++ Pinta.Core/Actions/ImageActions.cs
@@ -57,7 +57,7 @@
 			fact.AddDefault ();

 			CropToSelection = new Gtk.Action ("CropToSelection", Catalog.GetString ("Crop to Selection"), null, "Menu.Image.Crop.png");
-			AutoCrop = new Gtk.Action ("AutoCrop", Catalog.GetString ("Automatically Crop"), null, "Menu.Image.Crop.png");
+			AutoCrop = new Gtk.Action ("AutoCrop", Catalog.GetString ("Automatic Crop"), null, "Menu.Image.Crop.png");
 			Resize = new Gtk.Action ("Resize", Catalog.GetString ("Resize Image..."), null, "Menu.Image.Resize.png");
 			CanvasSize = new Gtk.Action ("CanvasSize", Catalog.GetString ("Resize Canvas..."), null, "Menu.Image.CanvasSize.png");
 			FlipHorizontal = new Gtk.Action ("FlipHorizontal", Catalog.GetString ("Flip Horizontal"), null, "Menu.Image.FlipHorizontal.png");
@@ -179,7 +179,7 @@

 			Gdk.Rectangle rect = doc.GetSelectedBounds (true);

-			CropImageToSelection (doc, rect);
+			CropImageToRectangle (doc, rect);
 		}

 		private void HandlePintaCoreActionsImageAutoCropActivated (object sender, EventArgs e)
@@ -188,13 +188,80 @@

 			PintaCore.Tools.Commit ();

-			Gdk.Rectangle rect = doc.GetSelectedBounds (true);
-
-			CropImageToSelection (doc, rect);
+			Cairo.ImageSurface image = doc.CurrentLayer.Surface;
+			Gdk.Rectangle rect = image.GetBounds ();
+
+			Cairo.Color borderColor = image.GetPixel (0, 0);
+			bool cropSide = true;
+			int depth = -1;
+
+			//From the top down
+			while (cropSide) {
+				depth++;
+				for (int i = 0; i < image.Width; i++) {
+					if (!borderColor.Equals(image.GetPixel (i, depth))) {
+						cropSide = false;
+						break;
+					}
+				}
+
+			}
+
+			rect = new Gdk.Rectangle (rect.X, rect.Y + depth, rect.Width, rect.Height - depth);
+
+			depth = image.Height;
+			cropSide = true;
+			//From the bottom up
+			while (cropSide) {
+				depth--;
+				for (int i = 0; i < image.Width; i++) {
+					if (!borderColor.Equals(image.GetPixel (i, depth))) {
+						cropSide = false;
+						break;
+					}
+				}
+
+			}
+
+			rect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, depth - rect.Y);
+
+			depth = 0;
+			cropSide = true;
+			//From left to right
+			while (cropSide) {
+				depth++;
+				for (int i = 0; i < image.Height; i++) {
+					if (!borderColor.Equals(image.GetPixel (depth, i))) {
+						cropSide = false;
+						break;
+					}
+				}
+
+			}
+
+			rect = new Gdk.Rectangle (rect.X + depth, rect.Y, rect.Width - depth, rect.Height);
+
+			depth = image.Width;
+			cropSide = true;
+			//From right to left
+			while (cropSide) {
+				depth--;
+				for (int i = 0; i < image.Height; i++) {
+					if (!borderColor.Equals(image.GetPixel (depth, i))) {
+						cropSide = false;
+						break;
+					}
+				}
+
+			}
+
+			rect = new Gdk.Rectangle (rect.X, rect.Y, depth - rect.X, rect.Height);
+
+			CropImageToRectangle (doc, rect);
 		}
 		#endregion

-		static void CropImageToSelection (Document doc, Gdk.Rectangle rect)
+		static void CropImageToRectangle (Document doc, Gdk.Rectangle rect)
 		{
 			ResizeHistoryItem hist = new ResizeHistoryItem (doc.ImageSize);


Add reload call for Programs plugin

Add reload call for Programs plugin

--- Plugins/Wox.Plugin.Program/Main.cs
+++ Plugins/Wox.Plugin.Program/Main.cs
@@ -13,7 +13,7 @@

 namespace Wox.Plugin.Program
 {
-    public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable
+    public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable, IReloadable
     {
         private static readonly object IndexLock = new object();
         private static Win32[] _win32s;
@@ -145,5 +145,13 @@
             }
             return hide;
         }
+
+        public void ReloadData()
+        {
+            Task.Run(() =>
+            {
+               IndexPrograms();
+            });
+        }
     }
 }


Shorten code

Shorten code

--- R7.Documents/ViewDocuments.ascx.cs
+++ R7.Documents/ViewDocuments.ascx.cs
@@ -332,69 +332,39 @@

         void LoadColumns ()
         {
-            DocumentsDisplayColumnInfo objDisplayColumn = null;
+            var dateTimeFormat = Settings.GetDateTimeFormat ();

             // add columns dynamically
-            foreach (var objDisplayColumn_loopVariable in Settings.GetDisplayColumnList (LocalResourceFile)) {
-                objDisplayColumn = objDisplayColumn_loopVariable;
-                var dateTimeFormat = Settings.GetDateTimeFormat ();
-
-                if (objDisplayColumn.Visible) {
-                    switch (objDisplayColumn.ColumnName) {
+            foreach (var column in Settings.GetDisplayColumnList (LocalResourceFile)) {
+                if (column.Visible) {
+                    switch (column.ColumnName) {
                         case DocumentsDisplayColumnInfo.COLUMN_CATEGORY:
+                        case DocumentsDisplayColumnInfo.COLUMN_DESCRIPTION:
+                        case DocumentsDisplayColumnInfo.COLUMN_CLICKS:
                             AddDocumentColumn (Localization.GetString ("Category.Column", LocalResourceFile), "Category", "Category");
                             break;

                         case DocumentsDisplayColumnInfo.COLUMN_CREATEDBY:
-                            AddDocumentColumn (Localization.GetString ("CreatedBy.Column", LocalResourceFile), "CreatedBy", "CreatedByUser", "");
+                        case DocumentsDisplayColumnInfo.COLUMN_MODIFIEDBY:
+                        AddDocumentColumn (LocalizeString (column.ColumnName + ".Column"), column.ColumnName, column.ColumnName + "User");
                             break;

                         case DocumentsDisplayColumnInfo.COLUMN_CREATEDDATE:
-                            AddDocumentColumn (
-                                Localization.GetString ("CreatedDate.Column", LocalResourceFile),
-                                "CreatedDate",
-                                "CreatedDate",
-                                dateTimeFormat);
-                            break;
-
+                        case DocumentsDisplayColumnInfo.COLUMN_MODIFIEDDATE:
                         case DocumentsDisplayColumnInfo.COLUMN_PUBLISHEDONDATE:
-                            AddDocumentColumn (
-								Localization.GetString ("PublishedOnDate.Column", LocalResourceFile),
-                                "PublishedOnDate",
-                                "PublishedOnDate",
-                                dateTimeFormat);
-                            break;
-
-                        case DocumentsDisplayColumnInfo.COLUMN_DESCRIPTION:
-                            AddDocumentColumn (Localization.GetString ("Description.Column", LocalResourceFile), "Description", "Description");
+                            AddDocumentColumn (LocalizeString (column.ColumnName + ".Column"), column.ColumnName, column.ColumnName, dateTimeFormat);
                             break;

                         case DocumentsDisplayColumnInfo.COLUMN_DOWNLOADLINK:
                             AddDownloadLink ("DownloadLink.Column", "DownloadLink", "DownloadLink", "ctlDownloadLink");
                             break;

-                        case DocumentsDisplayColumnInfo.COLUMN_MODIFIEDBY:
-                            AddDocumentColumn (Localization.GetString ("ModifiedBy.Column", LocalResourceFile), "ModifiedBy", "ModifiedByUser");
-                            break;
-
-                        case DocumentsDisplayColumnInfo.COLUMN_MODIFIEDDATE:
-                            AddDocumentColumn (
-                                Localization.GetString ("ModifiedDate.Column", LocalResourceFile),
-                                "ModifiedDate",
-                                "ModifiedDate",
-                                dateTimeFormat);
-                            break;
-
                         case DocumentsDisplayColumnInfo.COLUMN_OWNEDBY:
-                            AddDocumentColumn (Localization.GetString ("Owner.Column", LocalResourceFile), "Owner", "OwnedByUser");
+                            AddDocumentColumn (LocalizeString ("Owner.Column"), "Owner", "OwnedByUser");
                             break;

                         case DocumentsDisplayColumnInfo.COLUMN_SIZE:
-                            AddDocumentColumn (Localization.GetString ("Size.Column", LocalResourceFile), "Size", "FormatSize");
-                            break;
-
-                        case DocumentsDisplayColumnInfo.COLUMN_CLICKS:
-                            AddDocumentColumn (Localization.GetString ("Clicks.Column", LocalResourceFile), "Clicks", "Clicks");
+                            AddDocumentColumn (LocalizeString ("Size.Column"), "Size", "FormatSize");
                             break;

                         case DocumentsDisplayColumnInfo.COLUMN_ICON:


added fallback logging for ragnaroklogger

--- Ragnarok/Logging/RagnarokLogger.cs
+++ Ragnarok/Logging/RagnarokLogger.cs
@@ -13,7 +13,14 @@

         private RagnarokLogger()
         {
-            logger = LogManager.Instance.GetOrCreateLogger(RagnarokUserMod.ModName);
+            try
+            {
+                logger = LogManager.Instance.GetOrCreateLogger(RagnarokUserMod.ModName);
+            }
+            catch (Exception ex)
+            {
+                DebugOutputPanel.AddMessage(PluginManager.MessageType.Error, "[Ragnarok][RagnarokLogger]: " + ex.Message);
+            }
         }

         public static bool Enabled { get; set; }
@@ -34,7 +41,14 @@
         [StringFormatMethod("message")]
         public void Error(string message, params object[] args)
         {
-            logger.Error(message, args);
+            try
+            {
+                logger.Error(message, args);
+            }
+            catch (Exception ex)
+            {
+                DebugOutputPanel.AddMessage(PluginManager.MessageType.Error, "[Ragnarok][RagnarokLogger.Error] ERROR: " + ex.Message);
+            }
         }

         public void Info(string message, params object[] args)
@@ -44,7 +58,14 @@
                 return;
             }

-            logger.Info(message, args);
+            try
+            {
+                logger.Info(message, args);
+            }
+            catch (Exception ex)
+            {
+                DebugOutputPanel.AddMessage(PluginManager.MessageType.Error, "[Ragnarok][RagnarokLogger.Info] ERROR: " + ex.Message);
+            }
         }

         [StringFormatMethod("message")]
@@ -55,12 +76,26 @@
                 return;
             }

-            logger.Log(messageType, message, args);
+            try
+            {
+                logger.Log(messageType, message, args);
+            }
+            catch (Exception ex)
+            {
+                DebugOutputPanel.AddMessage(PluginManager.MessageType.Error, "[Ragnarok][RagnarokLogger.Log] ERROR: " + ex.Message);
+            }
         }

         public void LogException(Exception exception)
         {
-            logger.LogException(exception);
+            try
+            {
+                logger.LogException(exception);
+            }
+            catch (Exception ex)
+            {
+                DebugOutputPanel.AddMessage(PluginManager.MessageType.Error, "[Ragnarok][RagnarokLogger.LogException] ERROR: " + ex.Message);
+            }
         }

         [StringFormatMethod("message")]
@@ -71,7 +106,14 @@
                 return;
             }

-            logger.Warn(message, args);
+            try
+            {
+                logger.Warn(message, args);
+            }
+            catch (Exception ex)
+            {
+                DebugOutputPanel.AddMessage(PluginManager.MessageType.Error, "[Ragnarok][RagnarokLogger.Warn] ERROR: " + ex.Message);
+            }
         }
     }
 }


Ignore enum members when highlighting fields

--- RoslynColorizer/RoslynColorizer.cs
+++ RoslynColorizer/RoslynColorizer.cs
@@ -77,7 +77,9 @@
             yield return id.TextSpan.ToTagSpan(snapshot, parameterType);
             break;
           case SymbolKind.Field:
-            yield return id.TextSpan.ToTagSpan(snapshot, fieldType);
+            if ( symbol.ContainingType.TypeKind != TypeKind.Enum ) {
+              yield return id.TextSpan.ToTagSpan(snapshot, fieldType);
+            }
             break;
         }
       }


More advanced applicative test in scratch-pad

--- Samples/TestBed/ApplicativeTest.cs
+++ Samples/TestBed/ApplicativeTest.cs
@@ -18,12 +18,12 @@
         });

     static Aff<int> parse(string str) =>
-        from x in parseInt(str).ToAff(Error.New($"parse error: expected int, got: {str}"))
+        from x in parseInt(str).ToEff(Error.New($"parse error: expected int, got: '{str}'"))
         from _ in delay(1000)
         select x;

     static Aff<int> add(string sa, string sb, string sc, string sd, string se, string sf) =>
-        SuccessAff(curry<int, int, int, int, int, int, int>(addF))
+        SuccessAff(curry<int, int, int, int, int, int, int>(addPure))
             .Apply(parse(sa))
             .Apply(parse(sb))
             .Apply(parse(sc))
@@ -31,7 +31,7 @@
             .Apply(parse(se))
             .Apply(parse(sf));

-    static int addF(int a, int b, int c, int d, int e, int f) =>
+    static int addPure(int a, int b, int c, int d, int e, int f) =>
         a + b + c + d + e + f;

     public static async Task Test()


Update TemplateHelper.cs

Update TemplateHelper.cs

Resolves the following exception: "The RouteData must contain an item named 'controller' with a non-empty string value"

--- Serenity.Web/Mvc/TemplateHelper.cs
+++ Serenity.Web/Mvc/TemplateHelper.cs
@@ -35,7 +35,9 @@
                 var httpBase = new HttpContextWrapper(HttpContext.Current);

                 var controller = new FakeController();
-                var controllerContext = new ControllerContext(httpBase, new RouteData(), controller);
+                var route = new RouteData();
+                route.Values.Add("controller", "something");
+                var controllerContext = new ControllerContext(httpBase, route, controller);

                 var actualPath = controlPath;
                 if (actualPath.StartsWith("~/"))
@@ -74,4 +76,4 @@
             return RenderViewToString(templatePath, new ViewDataDictionary<T>(model));
         }
     }
-}+}


Make run page stuff load OnAppearing.

Make run page stuff load OnAppearing.

--- SimpleRun/Views/History/RunPage.cs
+++ SimpleRun/Views/History/RunPage.cs
@@ -17,7 +17,7 @@
 		Label durationLabel;
 		Map map;

-		double minLat = 0;
+		double minLat;
 		double maxLat;

 		double minLon;
@@ -28,11 +28,16 @@
 		public RunPage(Run _run)
 		{
 			run = _run;
+			Title = run.RunDate.ToShortDateString();
+		}

-			Title = run.RunDate.ToShortDateString();
+		protected override void OnAppearing()
+		{
+			base.OnAppearing();
+
 			ToolbarItems.Add(new ToolbarItem(
 				string.Empty,
-				"bin.png",
+				"bin@2x.png",
 				async () =>
 				{
 					var page = new ContentPage();


Adicionado Registro D510 do SpedFiscal

Adicionado Registro D510 do SpedFiscal

--- SpedBr/SpedBr.SpedFiscal/BlocoD.cs
+++ SpedBr/SpedBr.SpedFiscal/BlocoD.cs
@@ -504,7 +504,7 @@
             public decimal VlPis { get; set; }

             /// <summary>
-            ///     Valor total do desconto
+            ///     Valor da COFINS
             /// </summary>
             [SpedCampos(22, "VL_COFINS", "N", 0, 2, false)]
             public decimal VlCofins { get; set; }
@@ -529,6 +529,141 @@
         }

         /// <summary>
+        ///     REGISTRO D510: ITENS DO DOCUMENTO - NOTA FISCAL DE SERVIÇO DE COMUNICAÇÃO (CÓDIGO 21) E SERVIÇO DE TELECOMUNICAÇÃO (CÓDIGO 22).
+        /// </summary>
+        public class RegistroD510 : RegistroBaseSped
+        {
+            /// <summary>
+            /// Inicializa uma nova instância da classe <see cref="RegistroD510"/>.
+            /// </summary>
+            public RegistroD510()
+            {
+                Reg = "D510";
+            }
+
+            /// <summary>
+            ///     Número sequencial do item no documento fiscal
+            /// </summary>
+            [SpedCampos(2, "NUM_ITEM", "N", 3, 0, true)]
+            public int NumItem { get; set; }
+
+            /// <summary>
+            ///     Código do item (campo 02 do Registro 0200)
+            /// </summary>
+            [SpedCampos(3, "COD_ITEM", "C", 60, 0, true)]
+            public string CodItem { get; set; }
+
+            /// <summary>
+            ///     Código de classificação do item do serviço de comunicação ou de telecomunicação, conforme a Tabela 4.4.1
+            /// </summary>
+            [SpedCampos(4, "COD_CLASS", "N", 4, 0, true)]
+            public int CodClass { get; set; }
+
+            /// <summary>
+            ///     Quantidade do item
+            /// </summary>
+            [SpedCampos(5, "QTD", "N", 0, 3, true)]
+            public decimal Qtd { get; set; }
+
+            /// <summary>
+            ///     Unidade do item (Campo 02 do registro 0190)
+            /// </summary>
+            [SpedCampos(6, "UNID", "C", 6, 0, true)]
+            public string Unid { get; set; }
+
+            /// <summary>
+            ///     Valor do item
+            /// </summary>
+            [SpedCampos(7, "VL_ITEM", "N", 0, 2, true)]
+            public decimal Vl_Item { get; set; }
+
+            /// <summary>
+            ///     Valor total do desconto
+            /// </summary>
+            [SpedCampos(8, "VL_DESC", "N", 0, 2, false)]
+            public decimal Vl_Desc { get; set; }
+
+            /// <summary>
+            ///     Código da Situação Tributária, conforme a Tabela indicada no item 4.3.1
+            /// </summary>
+            [SpedCampos(9, "CST_ICMS", "N", 3, 0, true)]
+            public decimal CstIcms { get; set; }
+
+            /// <summary>
+            ///     Código Fiscal de Operação e Prestação
+            /// </summary>
+            [SpedCampos(10, "CFOP", "N", 4, 0, true)]
+            public decimal Cfop { get; set; }
+
+            /// <summary>
+            ///     Valor da base de cálculo do ICMS
+            /// </summary>
+            [SpedCampos(11, "VL_BC_ICMS", "N", 0, 2, false)]
+            public decimal VlBcIcms { get; set; }
+
+            /// <summary>
+            ///     Alíquota do ICMS
+            /// </summary>
+            [SpedCampos(12, "ALIQ_ICMS", "N", 6, 2, false)]
+            public decimal AliqIcms { get; set; }
+
+            /// <summary>
+            ///     Valor do ICMS creditado/debitado
+            /// </summary>
+            [SpedCampos(13, "VL_ICMS", "N", 0, 2, false)]
+            public decimal VlIcms { get; set; }
+
+            /// <summary>
+            ///     Valor da base de cálculo do ICMS de outras UFs
+            /// </summary>
+            [SpedCampos(14, "VL_BC_ICMS_UF", "N", 0, 2, false)]
+            public decimal VlBcIcmsUf { get; set; }
+
+            /// <summary>
+            ///     Valor do ICMS de outras UFs
+            /// </summary>
+            [SpedCampos(15, "VL_ICMS_UF", "N", 0, 2, false)]
+            public decimal VlIcmsUf { get; set; }
+
+            /// <summary>
+            ///     Indicador do tipo de receita:
+            ///     0 - Receita própria - serviços prestados;
+            ///     1 - Receita própria - cobrança de débitos;
+            ///     2 - Receita própria - venda de mercadorias;
+            ///     3 - Receita própria - venda de serviço pré-pago;
+            ///     4 - Outras receitas próprias;
+            ///     5 - Receitas de terceiros (co-faturamento);
+            ///     9 - Outras receitas de terceiros;
+            /// </summary>
+            [SpedCampos(16, "IND_REC", "C", 1, 0, true)]
+            public string IndRec { get; set; }
+
+            /// <summary>
+            ///     Código do participante (campo 02 do Registro 0150) receptor da receita, terceiro da operação, se houver.
+            /// </summary>
+            [SpedCampos(17, "COD_PART", "C", 60, 0, false)]
+            public string CodPart { get; set; }
+
+            /// <summary>
+            ///     Valor do PIS
+            /// </summary>
+            [SpedCampos(18, "VL_PIS", "N", 0, 2, false)]
+            public decimal VlPis { get; set; }
+
+            /// <summary>
+            ///     Valor da COFINS
+            /// </summary>
+            [SpedCampos(19, "VL_COFINS", "N", 0, 2, false)]
+            public decimal VlCofins { get; set; }
+
+            /// <summary>
+            ///     Código da conta analítica contábil debitada/creditada
+            /// </summary>
+            [SpedCampos(20, "COD_CTA", "C", 0, 0, false)]
+            public string CodCta { get; set; }
+        }
+
+        /// <summary>
         ///     REGISTRO D990: ENCERRAMENTO DO BLOCO D.
         /// </summary>
         public class RegistroD990 : RegistroBaseSped


Fix ConvertToSync method

Fix ConvertToSync method

--- TTWebClient/TickTraderWebClient.cs
+++ TTWebClient/TickTraderWebClient.cs
@@ -16,7 +16,7 @@
 {
     /// <summary>
     /// TickTrader Web Client
-    /// </summary>
+    /// </summary>
     public class TickTraderWebClient
     {
         #region Private fields
@@ -71,7 +71,7 @@
         /// Get public trade session information
         /// </summary>
         /// <returns>Public trade session information</returns>
-        public TTTradeSession GetPublicTradeSession() { return ConvertToSync(() => GetPublicTradeSessionAsync().Result); }
+        public TTTradeSession GetPublicTradeSession() { return ConvertToSync(() => GetPublicTradeSessionAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTradeSession> GetPublicTradeSessionAsync()
         {
             return PublicHttpGetAsync<TTTradeSession>("api/v1/public/tradesession");
@@ -81,7 +81,7 @@
         /// Get list of all available public currencies
         /// </summary>
         /// <returns>List of all available public currencies</returns>
-        public List<TTCurrency> GetPublicAllCurrencies() { return ConvertToSync(() => GetPublicAllCurrenciesAsync().Result); }
+        public List<TTCurrency> GetPublicAllCurrencies() { return ConvertToSync(() => GetPublicAllCurrenciesAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTCurrency>> GetPublicAllCurrenciesAsync()
         {
             return PublicHttpGetAsync<List<TTCurrency>>("api/v1/public/currency");
@@ -92,7 +92,7 @@
         /// </summary>
         /// <param name="filter">Currency names separated by space character</param>
         /// <returns>List of filtered public currencies</returns>
-        public List<TTCurrency> GetPublicCurrency(string filter) { return ConvertToSync(() => GetPublicCurrencyAsync(filter).Result); }
+        public List<TTCurrency> GetPublicCurrency(string filter) { return ConvertToSync(() => GetPublicCurrencyAsync(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTCurrency>> GetPublicCurrencyAsync(string filter)
         {
             return PublicHttpGetAsync<List<TTCurrency>>(string.Format("api/v1/public/currency/{0}", UrlEncode(filter)));
@@ -102,7 +102,7 @@
         /// Get list of all available public symbols
         /// </summary>
         /// <returns>List of all available public symbols</returns>
-        public List<TTSymbol> GetPublicAllSymbols() { return ConvertToSync(() => GetPublicAllSymbolsAsync().Result); }
+        public List<TTSymbol> GetPublicAllSymbols() { return ConvertToSync(() => GetPublicAllSymbolsAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTSymbol>> GetPublicAllSymbolsAsync()
         {
             return PublicHttpGetAsync<List<TTSymbol>>("api/v1/public/symbol");
@@ -113,7 +113,7 @@
         /// </summary>
         /// <param name="filter">Symbols names separated by space character</param>
         /// <returns>List of filtered public symbols</returns>
-        public List<TTSymbol> GetPublicSymbol(string filter) { return ConvertToSync(() => GetPublicSymbolAsync(filter).Result); }
+        public List<TTSymbol> GetPublicSymbol(string filter) { return ConvertToSync(() => GetPublicSymbolAsync(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTSymbol>> GetPublicSymbolAsync(string filter)
         {
             return PublicHttpGetAsync<List<TTSymbol>>(string.Format("api/v1/public/symbol/{0}", UrlEncode(filter)));
@@ -123,7 +123,7 @@
         /// Get list of all available public feed ticks
         /// </summary>
         /// <returns>List of all available public feed ticks</returns>
-        public List<TTFeedTick> GetPublicAllTicks() { return ConvertToSync(() => GetPublicAllTicksAsync().Result); }
+        public List<TTFeedTick> GetPublicAllTicks() { return ConvertToSync(() => GetPublicAllTicksAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTick>> GetPublicAllTicksAsync()
         {
             return PublicHttpGetAsync<List<TTFeedTick>>("api/v1/public/tick");
@@ -134,7 +134,7 @@
         /// </summary>
         /// <param name="filter">Symbols names separated by space character</param>
         /// <returns>List of filtered public feed ticks</returns>
-        public List<TTFeedTick> GetPublicTick(string symbol) { return ConvertToSync(() => GetPublicTickAsync(symbol).Result); }
+        public List<TTFeedTick> GetPublicTick(string symbol) { return ConvertToSync(() => GetPublicTickAsync(symbol).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTick>> GetPublicTickAsync(string symbol)
         {
             return PublicHttpGetAsync<List<TTFeedTick>>(string.Format("api/v1/public/tick/{0}", UrlEncode(symbol)));
@@ -144,7 +144,7 @@
         /// Get list of all available public feed level2 ticks
         /// </summary>
         /// <returns>List of all available public feed level2 ticks</returns>
-        public List<TTFeedTickLevel2> GetPublicAllTicksLevel2() { return ConvertToSync(() => GetPublicAllTicksLevel2Async().Result); }
+        public List<TTFeedTickLevel2> GetPublicAllTicksLevel2() { return ConvertToSync(() => GetPublicAllTicksLevel2Async().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTickLevel2>> GetPublicAllTicksLevel2Async()
         {
             return PublicHttpGetAsync<List<TTFeedTickLevel2>>("api/v1/public/level2");
@@ -155,7 +155,7 @@
         /// </summary>
         /// <param name="filter">Symbols names separated by space character</param>
         /// <returns>List of filtered public feed level2 ticks</returns>
-        public List<TTFeedTickLevel2> GetPublicTickLevel2(string filter) { return ConvertToSync(() => GetPublicTickLevel2Async(filter).Result); }
+        public List<TTFeedTickLevel2> GetPublicTickLevel2(string filter) { return ConvertToSync(() => GetPublicTickLevel2Async(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTickLevel2>> GetPublicTickLevel2Async(string filter)
         {
             return PublicHttpGetAsync<List<TTFeedTickLevel2>>(string.Format("api/v1/public/level2/{0}", UrlEncode(filter)));
@@ -165,7 +165,7 @@
         /// Get list of all available public symbol statistics
         /// </summary>
         /// <returns>List of all available public symbol statistics</returns>
-        public List<TTTicker> GetPublicAllTickers() { return ConvertToSync(() => GetPublicAllTickersAsync().Result); }
+        public List<TTTicker> GetPublicAllTickers() { return ConvertToSync(() => GetPublicAllTickersAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTTicker>> GetPublicAllTickersAsync()
         {
             return PublicHttpGetAsync<List<TTTicker>>("api/v1/public/ticker");
@@ -176,7 +176,7 @@
         /// </summary>
         /// <param name="filter">Symbols names separated by space character</param>
         /// <returns>List of filtered public symbol statistics</returns>
-        public List<TTTicker> GetPublicTicker(string filter) { return ConvertToSync(() => GetPublicTickerAsync(filter).Result); }
+        public List<TTTicker> GetPublicTicker(string filter) { return ConvertToSync(() => GetPublicTickerAsync(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTTicker>> GetPublicTickerAsync(string filter)
         {
             return PublicHttpGetAsync<List<TTTicker>>(string.Format("api/v1/public/ticker/{0}", UrlEncode(filter)));
@@ -190,7 +190,7 @@
         /// Get account information
         /// </summary>
         /// <returns>Account information</returns>
-        public TTAccount GetAccount() { return ConvertToSync(() => GetAccountAsync().Result); }
+        public TTAccount GetAccount() { return ConvertToSync(() => GetAccountAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTAccount> GetAccountAsync()
         {
             return PrivateHttpGetAsync<TTAccount>("api/v1/account");
@@ -200,7 +200,7 @@
         /// Get trade session information
         /// </summary>
         /// <returns>Trade session information</returns>
-        public TTTradeSession GetTradeSession() { return ConvertToSync(() => GetTradeSessionAsync().Result); }
+        public TTTradeSession GetTradeSession() { return ConvertToSync(() => GetTradeSessionAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTradeSession> GetTradeSessionAsync()
         {
             return PrivateHttpGetAsync<TTTradeSession>("api/v1/tradesession");
@@ -210,7 +210,7 @@
         /// Get list of all available currencies
         /// </summary>
         /// <returns>List of all available currencies</returns>
-        public List<TTCurrency> GetAllCurrencies() { return ConvertToSync(() => GetAllCurrenciesAsync().Result); }
+        public List<TTCurrency> GetAllCurrencies() { return ConvertToSync(() => GetAllCurrenciesAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTCurrency>> GetAllCurrenciesAsync()
         {
             return PrivateHttpGetAsync<List<TTCurrency>>("api/v1/currency");
@@ -221,7 +221,7 @@
         /// </summary>
         /// <param name="filter">Currency names separated by space character</param>
         /// <returns>List of filtered public currencies</returns>
-        public List<TTCurrency> GetCurrency(string filter) { return ConvertToSync(() => GetCurrencyAsync(filter).Result); }
+        public List<TTCurrency> GetCurrency(string filter) { return ConvertToSync(() => GetCurrencyAsync(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTCurrency>> GetCurrencyAsync(string filter)
         {
             return PrivateHttpGetAsync<List<TTCurrency>>(string.Format("api/v1/currency/{0}", UrlEncode(filter)));
@@ -231,7 +231,7 @@
         /// Get list of all available symbols
         /// </summary>
         /// <returns>List of all available symbols</returns>
-        public List<TTSymbol> GetAllSymbols() { return ConvertToSync(() => GetAllSymbolsAsync().Result); }
+        public List<TTSymbol> GetAllSymbols() { return ConvertToSync(() => GetAllSymbolsAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTSymbol>> GetAllSymbolsAsync()
         {
             return PrivateHttpGetAsync<List<TTSymbol>>("api/v1/symbol");
@@ -242,17 +242,17 @@
         /// </summary>
         /// <param name="filter">Symbols names separated by space character</param>
         /// <returns>List of filtered public symbols</returns>
-        public List<TTSymbol> GetSymbol(string filter) { return ConvertToSync(() => GetSymbolAsync(filter).Result); }
+        public List<TTSymbol> GetSymbol(string filter) { return ConvertToSync(() => GetSymbolAsync(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTSymbol>> GetSymbolAsync(string filter)
         {
             return PrivateHttpGetAsync<List<TTSymbol>>(string.Format("api/v1/symbol/{0}", UrlEncode(filter)));
         }

         /// <summary>
-        /// Get list of all available feed tick
+        /// Get list of all available feed tick
         /// </summary>
         /// <returns>List of all available feed tick</returns>
-        public List<TTFeedTick> GetAllTicks() { return ConvertToSync(() => GetAllTicksAsync().Result); }
+        public List<TTFeedTick> GetAllTicks() { return ConvertToSync(() => GetAllTicksAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTick>> GetAllTicksAsync()
         {
             return PrivateHttpGetAsync<List<TTFeedTick>>("api/v1/tick");
@@ -263,7 +263,7 @@
         /// </summary>
         /// <param name="filter">Symbols names separated by space character</param>
         /// <returns>List of filtered public feed ticks</returns>
-        public List<TTFeedTick> GetTick(string filter) { return ConvertToSync(() => GetTickAsync(filter).Result); }
+        public List<TTFeedTick> GetTick(string filter) { return ConvertToSync(() => GetTickAsync(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTick>> GetTickAsync(string filter)
         {
             return PrivateHttpGetAsync<List<TTFeedTick>>(string.Format("api/v1/tick/{0}", UrlEncode(filter)));
@@ -273,7 +273,7 @@
         /// Get list of all available feed level2 tick
         /// </summary>
         /// <returns>List of all available feed level2 tick</returns>
-        public List<TTFeedTickLevel2> GetAllTicksLevel2() { return ConvertToSync(() => GetAllTicksLevel2Async().Result); }
+        public List<TTFeedTickLevel2> GetAllTicksLevel2() { return ConvertToSync(() => GetAllTicksLevel2Async().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTickLevel2>> GetAllTicksLevel2Async()
         {
             return PrivateHttpGetAsync<List<TTFeedTickLevel2>>("api/v1/level2");
@@ -284,7 +284,7 @@
         /// </summary>
         /// <param name="filter">Symbols names separated by space character</param>
         /// <returns>List of filtered public feed level2 ticks</returns>
-        public List<TTFeedTickLevel2> GetTickLevel2(string filter) { return ConvertToSync(() => GetTickLevel2Async(filter).Result); }
+        public List<TTFeedTickLevel2> GetTickLevel2(string filter) { return ConvertToSync(() => GetTickLevel2Async(filter).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTFeedTickLevel2>> GetTickLevel2Async(string filter)
         {
             return PrivateHttpGetAsync<List<TTFeedTickLevel2>>(string.Format("api/v1/level2/{0}", UrlEncode(filter)));
@@ -295,9 +295,9 @@
         /// </summary>
         /// <remarks>
         /// **Works only for cash accounts!**
-        /// </remarks>>
+        /// </remarks>>
         /// <returns>List of all cash account assets</returns>
-        public List<TTAsset> GetAllAssets() { return ConvertToSync(() => GetAllAssetsAsync().Result); }
+        public List<TTAsset> GetAllAssets() { return ConvertToSync(() => GetAllAssetsAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTAsset>> GetAllAssetsAsync()
         {
             return PrivateHttpGetAsync<List<TTAsset>>("api/v1/asset");
@@ -308,10 +308,10 @@
         /// </summary>
         /// <remarks>
         /// **Works only for cash accounts!**
-        /// </remarks>>
+        /// </remarks>>
         /// <param name="currency">Currency name</param>
         /// <returns>Cash account asset for the given currency</returns>
-        public TTAsset GetAsset(string currency) { return ConvertToSync(() => GetAssetAsync(currency).Result); }
+        public TTAsset GetAsset(string currency) { return ConvertToSync(() => GetAssetAsync(currency).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTAsset> GetAssetAsync(string currency)
         {
             return PrivateHttpGetAsync<TTAsset>(string.Format("api/v1/asset/{0}", UrlEncode(currency)));
@@ -322,9 +322,9 @@
         /// </summary>
         /// <remarks>
         /// **Works only for net accounts!**
-        /// </remarks>>
+        /// </remarks>>
         /// <returns>List of all available positions</returns>
-        public List<TTPosition> GetAllPositions() { return ConvertToSync(() => GetAllPositionsAsync().Result); }
+        public List<TTPosition> GetAllPositions() { return ConvertToSync(() => GetAllPositionsAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTPosition>> GetAllPositionsAsync()
         {
             return PrivateHttpGetAsync<List<TTPosition>>("api/v1/position");
@@ -335,10 +335,10 @@
         /// </summary>
         /// <remarks>
         /// **Works only for net accounts!**
-        /// </remarks>>
+        /// </remarks>>
         /// <param name="id">Position Id or symbol name</param>
         /// <returns>Position</returns>
-        public TTPosition GetPosition(string id) { return ConvertToSync(() => GetPositionAsync(id).Result); }
+        public TTPosition GetPosition(string id) { return ConvertToSync(() => GetPositionAsync(id).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTPosition> GetPositionAsync(string id)
         {
             return PrivateHttpGetAsync<TTPosition>(string.Format("api/v1/position/{0}", UrlEncode(id)));
@@ -348,7 +348,7 @@
         /// Get list of all available trades
         /// </summary>
         /// <returns>List of all available trades</returns>
-        public List<TTTrade> GetAllTrades() { return ConvertToSync(() => GetAllTradesAsync().Result); }
+        public List<TTTrade> GetAllTrades() { return ConvertToSync(() => GetAllTradesAsync().ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<List<TTTrade>> GetAllTradesAsync()
         {
             return PrivateHttpGetAsync<List<TTTrade>>("api/v1/trade");
@@ -359,7 +359,7 @@
         /// </summary>
         /// <param name="tradeId">Trade Id</param>
         /// <returns>Trade</returns>
-        public TTTrade GetTrade(long tradeId) { return ConvertToSync(() => GetTradeAsync(tradeId).Result); }
+        public TTTrade GetTrade(long tradeId) { return ConvertToSync(() => GetTradeAsync(tradeId).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTrade> GetTradeAsync(long tradeId)
         {
             return PrivateHttpGetAsync<TTTrade>(string.Format("api/v1/trade/{0}", tradeId));
@@ -375,16 +375,16 @@
         /// - **Side** (required) - Side of trade. Possible values: `"Buy"`, `"Sell"`
         /// - **Symbol** (required) - Trade symbol (e.g. `"EURUSD"`)
         /// - **Price** (optional) - Price of the `"Limit"` / `"Stop"` trades (for `Market` trades price field is ignored)
-        /// - **Amount** (required) - Trade amount
+        /// - **Amount** (required) - Trade amount
         /// - **StopLoss** (optional) - Stop loss price
         /// - **TakeProfit** (optional) - Take profit price
         /// - **ExpiredTimestamp** (optional) - Expiration date and time for pending trades (`"Limit"`, `"Stop"`)
         /// - **ImmediateOrCancel** (optional) - "Immediate or cancel" flag (works only for `"Limit"` trades)
         /// - **Comment** (optional) - Client comment
-        /// </remarks>
+        /// </remarks>
         /// <param name="request">Create trade request</param>
         /// <returns>Created trade</returns>
-        public TTTrade CreateTrade(TTTradeCreate request) { return ConvertToSync(() => CreateTradeAsync(request).Result); }
+        public TTTrade CreateTrade(TTTradeCreate request) { return ConvertToSync(() => CreateTradeAsync(request).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTrade> CreateTradeAsync(TTTradeCreate request)
         {
             return PrivateHttpPostAsync<TTTrade, TTTradeCreate>("api/v1/trade", request);
@@ -401,10 +401,10 @@
         /// - **TakeProfit** (optional) - Take profit price
         /// - **ExpiredTimestamp** (optional) - Expiration date and time for pending trades (`Limit`, `Stop`)
         /// - **Comment** (optional) - Client comment
-        /// </remarks>
+        /// </remarks>
         /// <param name="request">Modify trade request</param>
         /// <returns>Modified trade</returns>
-        public TTTrade ModifyTrade(TTTradeModify request) { return ConvertToSync(() => ModifyTradeAsync(request).Result); }
+        public TTTrade ModifyTrade(TTTradeModify request) { return ConvertToSync(() => ModifyTradeAsync(request).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTrade> ModifyTradeAsync(TTTradeModify request)
         {
             return PrivateHttpPutAsync<TTTrade, TTTradeModify>("api/v1/trade", request);
@@ -414,7 +414,7 @@
         /// Cancel existing pending trade
         /// </summary>
         /// <param name="tradeId">Trade Id to cancel</param>
-        public TTTradeDelete CancelTrade(long tradeId) { return ConvertToSync(() => CancelTradeAsync(tradeId).Result); }
+        public TTTradeDelete CancelTrade(long tradeId) { return ConvertToSync(() => CancelTradeAsync(tradeId).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTradeDelete> CancelTradeAsync(long tradeId)
         {
             return PrivateHttpDeleteAsync<TTTradeDelete>(string.Format("api/v1/trade?type=Cancel&id={0}", tradeId));
@@ -425,7 +425,7 @@
         /// </summary>
         /// <param name="tradeId">Trade Id to close</param>
         /// <param name="amount">Amount to close (optional)</param>
-        public TTTradeDelete CloseTrade(long tradeId, decimal? amount) { return ConvertToSync(() => CloseTradeAsync(tradeId, amount).Result); }
+        public TTTradeDelete CloseTrade(long tradeId, decimal? amount) { return ConvertToSync(() => CloseTradeAsync(tradeId, amount).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTradeDelete> CloseTradeAsync(long tradeId, decimal? amount)
         {
             return PrivateHttpDeleteAsync<TTTradeDelete>(amount.HasValue ? string.Format("api/v1/trade?type=Close&id={0}&amount={1}", tradeId, amount.Value) : string.Format("api/v1/trade?type=Close&id={0}", tradeId));
@@ -436,7 +436,7 @@
         /// </summary>
         /// <param name="tradeId">Trade Id to close</param>
         /// <param name="byTradeId">By trade Id</param>
-        public TTTradeDelete CloseByTrade(long tradeId, long byTradeId) { return ConvertToSync(() => CloseByTradeAsync(tradeId, byTradeId).Result); }
+        public TTTradeDelete CloseByTrade(long tradeId, long byTradeId) { return ConvertToSync(() => CloseByTradeAsync(tradeId, byTradeId).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTradeDelete> CloseByTradeAsync(long tradeId, long byTradeId)
         {
             return PrivateHttpDeleteAsync<TTTradeDelete>(string.Format("api/v1/trade?type=CloseBy&id={0}&byid={1}", tradeId, byTradeId));
@@ -451,19 +451,19 @@
         /// - **TimestampTo** (optional) - Upper timestamp bound of the trade history request
         /// - **RequestDirection** (optional) - Request paging direction ("Forward" or "Backward"). Default is "Forward".
         /// - **RequestFromId** (optional) - Request paging from Id
-        ///
-        /// If timestamps fields are not set trade history will be requests from the begin or from the current timestamp
+        ///
+        /// If timestamps fields are not set trade history will be requests from the begin or from the current timestamp
         /// depending on **RequestDirection** value.
-        ///
+        ///
         /// Trade history is returned by chunks by paging size (default is 100). You can provide timestamp bounds (from, to)
-        /// and direction of access (forward or backward). After the first request you'll get a list of trade history
-        /// records with Ids. The next request should contain **RequestFromId** with the Id of the last processed trade
-        /// history record. As the result you'll get the next chunk of trade history records. If the last page was reached
+        /// and direction of access (forward or backward). After the first request you'll get a list of trade history
+        /// records with Ids. The next request should contain **RequestFromId** with the Id of the last processed trade
+        /// history record. As the result you'll get the next chunk of trade history records. If the last page was reached
         /// response flag **IsLastReport** will be set.
-        /// </remarks>
+        /// </remarks>
         /// <param name="request">Trade history request</param>
         /// <returns>Trade history report</returns>
-        public TTTradeHistoryReport GetTradeHistory(TTTradeHistoryRequest request) { return ConvertToSync(() => GetTradeHistoryAsync(request).Result); }
+        public TTTradeHistoryReport GetTradeHistory(TTTradeHistoryRequest request) { return ConvertToSync(() => GetTradeHistoryAsync(request).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTradeHistoryReport> GetTradeHistoryAsync(TTTradeHistoryRequest request)
         {
             return PrivateHttpPostAsync<TTTradeHistoryReport, TTTradeHistoryRequest>("api/v1/tradehistory", request);
@@ -478,20 +478,20 @@
         /// - **TimestampTo** (optional) - Upper timestamp bound of the trade history request
         /// - **RequestDirection** (optional) - Request paging direction ("Forward" or "Backward"). Default is "Forward".
         /// - **RequestFromId** (optional) - Request paging from Id
-        ///
-        /// If timestamps fields are not set trade history will be requests from the begin or from the current timestamp
+        ///
+        /// If timestamps fields are not set trade history will be requests from the begin or from the current timestamp
         /// depending on **RequestDirection** value.
-        ///
+        ///
         /// Trade history is returned by chunks by paging size (default is 100). You can provide timestamp bounds (from, to)
-        /// and direction of access (forward or backward). After the first request you'll get a list of trade history
-        /// records with Ids. The next request should contain **RequestFromId** with the Id of the last processed trade
-        /// history record. As the result you'll get the next chunk of trade history records. If the last page was reached
+        /// and direction of access (forward or backward). After the first request you'll get a list of trade history
+        /// records with Ids. The next request should contain **RequestFromId** with the Id of the last processed trade
+        /// history record. As the result you'll get the next chunk of trade history records. If the last page was reached
         /// response flag **IsLastReport** will be set.
-        /// </remarks>
+        /// </remarks>
         /// <param name="tradeId">Trade Id</param>
         /// <param name="request">Trade history request</param>
         /// <returns>Trade history report</returns>
-        public TTTradeHistoryReport GetTradeHistory(long tradeId, TTTradeHistoryRequest request) { return ConvertToSync(() => GetTradeHistoryAsync(tradeId, request).Result); }
+        public TTTradeHistoryReport GetTradeHistory(long tradeId, TTTradeHistoryRequest request) { return ConvertToSync(() => GetTradeHistoryAsync(tradeId, request).ConfigureAwait(false).GetAwaiter().GetResult()); }
         public Task<TTTradeHistoryReport> GetTradeHistoryAsync(long tradeId, TTTradeHistoryRequest request)
         {
             return PrivateHttpPostAsync<TTTradeHistoryReport, TTTradeHistoryRequest>(string.Format("api/v1/tradehistory/{0}", tradeId), request);
@@ -506,7 +506,7 @@
         /// </summary>
         public static void IgnoreServerCertificate()
         {
-            ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
+            ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
         }

         #endregion
@@ -669,7 +669,7 @@
                 _webApiKey = webApiKey;
                 _webApiSecret = webApiSecret;
             }
-
+
             protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
             {
                 var timestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;


disable baselines for identity tests

disable baselines for identity tests

--- Tests/Linq/Update/BulkCopyTests.cs
+++ Tests/Linq/Update/BulkCopyTests.cs
@@ -64,6 +64,7 @@
 				Assert.Inconclusive("Oracle BulkCopy doesn't support identity triggers");

 			// don't use transactions as some providers will fallback to non-provider-specific implementation then
+			using (new DisableBaseline("Non-stable identity values"))
 			using (var db = new TestDataConnection(context))
 			{
 				var lastId = db.InsertWithInt32Identity(new TestTable2());
@@ -149,6 +150,7 @@
 #endif
 		{
 			// don't use transactions as some providers will fallback to non-provider-specific implementation then
+			using (new DisableBaseline("Non-stable identity values"))
 			using (var db = new TestDataConnection(context))
 			{
 				var lastId = db.InsertWithInt32Identity(new TestTable1());


Tiny Text Tweaks.

Tiny Text Tweaks.

--- Tomboy/Plugins/StickyNoteImport.cs
+++ Tomboy/Plugins/StickyNoteImport.cs
@@ -25,7 +25,7 @@
 	protected override void Initialize ()
 	{
 		Gtk.ImageMenuItem item =
-			new Gtk.ImageMenuItem (Catalog.GetString ("Import From Sticky Notes"));
+			new Gtk.ImageMenuItem (Catalog.GetString ("Import from Sticky Notes"));
 		item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu);
 		item.Activated += ImportButtonClicked;
 		item.Show ();
@@ -63,7 +63,7 @@
 		ShowMessageDialog (
 			Catalog.GetString ("No Sticky Notes found."),
 			string.Format (Catalog.GetString ("No suitable Sticky Notes file was " +
-							  "found at \"{0}\""),
+							  "found at \"{0}\"."),
 				       xmlPath),
 			Gtk.MessageType.Error);
 	}


Fixing bugs.

Fixing bugs.

--- TreeEdit/Spg.Match/MatchManager.cs
+++ TreeEdit/Spg.Match/MatchManager.cs
@@ -142,6 +142,7 @@

             if (node.Children.Count != pattern.Children.Count)
             {
+                if (pattern.Children.Any()) return false;
                 return pattern.Value.IsMatch(node);
             }


テストを拡充

テストを拡充

--- UnitTest/Sdx/Web/GoogleFriendry.cs
+++ UnitTest/Sdx/Web/GoogleFriendry.cs
@@ -23,7 +23,7 @@
     private const string MB_USER_AGENT = "D502i	DoCoMo/1.0/D502i	DoCoMo/1.0/D502i/c10";

     [Fact]
-    public void TestSimpleUrl()
+    public void TestSimplePcUrl()
     {
       //mockをセット
       Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(PC_USER_AGENT);
@@ -33,12 +33,12 @@
       Assert.True(gfriend.IsPcUrl);
       Assert.False(gfriend.IsMbUrl);
       Assert.False(gfriend.IsSpUrl);
-
-      Assert.Null(gfriend.RedirectUrl);

       Assert.Equal("/top.aspx", gfriend.PcUrl);
       Assert.Equal("/i/top.aspx", gfriend.MbUrl);
       Assert.Equal("/sp/top.aspx", gfriend.SpUrl);
+
+      Assert.Equal(null, gfriend.RedirectUrl);

       Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(SP_USER_AGENT);
       Assert.Equal("/sp/top.aspx", gfriend.RedirectUrl);
@@ -46,5 +46,55 @@
       Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(MB_USER_AGENT);
       Assert.Equal("/i/top.aspx", gfriend.RedirectUrl);
     }
+
+    [Fact]
+    public void TestSimpleSpUrl()
+    {
+      //mockをセット
+      Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(PC_USER_AGENT);
+      Sdx.Context.Current.Request = new HttpRequest("", "http://www.example.com/sp/top.aspx", "");
+
+      var gfriend = new Sdx.Web.GoogleFriendry(pc: "/top.aspx", mb: "/i/top.aspx");
+      Assert.False(gfriend.IsPcUrl);
+      Assert.False(gfriend.IsMbUrl);
+      Assert.True(gfriend.IsSpUrl);
+
+      Assert.Equal("/top.aspx", gfriend.PcUrl);
+      Assert.Equal("/i/top.aspx", gfriend.MbUrl);
+      Assert.Equal("/sp/top.aspx", gfriend.SpUrl);
+
+      Assert.Equal("/top.aspx", gfriend.RedirectUrl);
+
+      Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(SP_USER_AGENT);
+      Assert.Equal(null, gfriend.RedirectUrl);
+
+      Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(MB_USER_AGENT);
+      Assert.Equal("/i/top.aspx", gfriend.RedirectUrl);
+    }
+
+    [Fact]
+    public void TestSimpleMbUrl()
+    {
+      //mockをセット
+      Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(PC_USER_AGENT);
+      Sdx.Context.Current.Request = new HttpRequest("", "http://www.example.com/i/top.aspx", "");
+
+      var gfriend = new Sdx.Web.GoogleFriendry(sp: "/sp/top.aspx", pc: "/top.aspx");
+      Assert.False(gfriend.IsPcUrl);
+      Assert.True(gfriend.IsMbUrl);
+      Assert.False(gfriend.IsSpUrl);
+
+      Assert.Equal("/top.aspx", gfriend.PcUrl);
+      Assert.Equal("/i/top.aspx", gfriend.MbUrl);
+      Assert.Equal("/sp/top.aspx", gfriend.SpUrl);
+
+      Assert.Equal("/top.aspx", gfriend.RedirectUrl);
+
+      Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(SP_USER_AGENT);
+      Assert.Equal("/sp/top.aspx", gfriend.RedirectUrl);
+
+      Sdx.Context.Current.UserAgent = new Sdx.Web.UserAgent(MB_USER_AGENT);
+      Assert.Equal(null, gfriend.RedirectUrl);
+    }
   }
 }


globalutility update

globalutility update

globalutility update

--- Utility/GlobalUtilities_Utility.cs
+++ Utility/GlobalUtilities_Utility.cs
@@ -523,7 +523,7 @@

         #endregion

-        #region Calculation of Percentage
+        #region Basic Calculation

         static public decimal getPercentage(double whole, double part)
         {
@@ -533,6 +533,31 @@
 	{
                 return 0;
 	}
+        }
+
+        static public double getMinPosNumber(double n1, double n2, double n3)
+        {
+            List<double> numbers = new List<double>();
+
+            numbers.Add(n1);
+            numbers.Add(n2);
+            numbers.Add(n3);
+
+            numbers.Sort();
+            numbers.RemoveAll(x => x <= 0);
+            return numbers.Min();
+
+
+        }
+
+        static public double getMaxNumber(double n1, double n2, double n3)
+        {
+            List<double> numbers = new List<double>();
+
+            numbers.Add(n1);
+            numbers.Add(n2);
+            numbers.Add(n3);
+            return numbers.Max();
         }

         #endregion


More smart selection token for replacement by autocompletion

--- VisualRust/RustCompletionSource.cs
+++ VisualRust/RustCompletionSource.cs
@@ -3,6 +3,7 @@
 using System.ComponentModel.Composition;
 using System.Linq;
 using System.Windows.Media;
+using Antlr4.Runtime;
 using Microsoft.VisualStudio.Language.Intellisense;
 using Microsoft.VisualStudio.Text;
 using Microsoft.VisualStudio.Text.Operations;
@@ -131,9 +132,7 @@

             // Get token under cursor.
             var tokens = Utils.LexString(line.GetText());
-            var activeToken = col == line.Length
-                ? tokens.Last()
-                : tokens.FirstOrDefault(t => col >= t.StartIndex && col <= t.StopIndex);
+            var activeToken = GetActiveToken(col, line);
             if (activeToken == null)
                 return;

@@ -155,6 +154,47 @@
             completionSets.Add(new RustCompletionSet("All", "All", span, completions, null));
         }

+        private static IToken GetActiveToken(int columnIndex, ITextSnapshotLine line)
+        {
+            var tokens = Utils.LexString(line.GetText());
+            if (columnIndex == line.Length)
+            {
+                return tokens.Last();
+            }
+
+            IToken token = null;
+            IToken previousToken = null;
+            foreach (var currentToken in tokens)
+            {
+                if (currentToken.StartIndex <= columnIndex && columnIndex <= currentToken.StopIndex)
+                {
+                    token = currentToken;
+                    break;
+                }
+
+                previousToken = currentToken;
+            }
+
+            if (token == null)
+            {
+                return null;
+            }
+
+            if (token.Type == RustLexer.RustLexer.IDENT)
+            {
+                return token;
+            }
+
+            // if current token isn't identifier and caret at end of ident token
+            if (token.StartIndex == columnIndex && previousToken != null && previousToken.Type == RustLexer.RustLexer.IDENT)
+            {
+                return previousToken;
+            }
+
+            // fake token for position between 2 non-ident tokens
+            return new CommonToken(new Tuple<ITokenSource, ICharStream>(token.TokenSource, token.TokenSource.InputStream), 1, 0, token.StartIndex, token.StartIndex - 1);
+        }
+
         private static int GetColumn(SnapshotPoint point)
         {
             var line = point.GetContainingLine();


Don't recompute transaction id in loop

Don't recompute transaction id in loop

--- WalletWasabi/Services/CcjClient.cs
+++ WalletWasabi/Services/CcjClient.cs
@@ -505,7 +505,9 @@
 						var coin = State.GetSingleOrDefaultFromWaitingList(coinReference);
 						if (coin == null) throw new NotSupportedException("This is impossible.");
 						roundRegistered.CoinsRegistered.Add(coin);
+						coin.CoinJoinInProgress = false;
 						State.RemoveCoinFromWaitingList(coin);
+						CoinDequeued?.Invoke(this, coin);
 					}
 					roundRegistered.ActiveOutputAddress = activeAddress;
 					roundRegistered.ChangeOutputAddress = changeAddress;
@@ -753,8 +755,8 @@

 		private void RemoveCoin(SmartCoin coinWaitingForMix)
 		{
+			coinWaitingForMix.CoinJoinInProgress = false;
 			State.RemoveCoinFromWaitingList(coinWaitingForMix);
-			coinWaitingForMix.CoinJoinInProgress = false;
 			coinWaitingForMix.Secret = null;
 			if (coinWaitingForMix.Label == "ZeroLink Change" && coinWaitingForMix.Unspent)
 			{


Use Constants.MaximumMixingLevelCount

Use Constants.MaximumMixingLevelCount

--- WalletWasabi/Services/CcjClient.cs
+++ WalletWasabi/Services/CcjClient.cs
@@ -413,90 +413,84 @@
 					BitcoinAddress changeAddress = null;
 					var activeOutputAddresses = new List<BitcoinAddress>();

-					IEnumerable<HdPubKey> allUnusedInternalKeys = KeyManager.GetKeys(x => x.KeyState != KeyState.Used);
-
-					if (changeAddress is null)
-					{
-						string changeLabel = "ZeroLink Change";
-						IEnumerable<HdPubKey> allChangeKeys = allUnusedInternalKeys.Where(x => x.Label == changeLabel);
-						HdPubKey changeKey = null;
-
-						KeyManager.AssertLockedInternalKeysIndexed(14);
-						IEnumerable<HdPubKey> internalNotCachedLockedKeys = KeyManager.GetKeys(KeyState.Locked, isInternal: true).Except(AccessCache.Keys);
-
-						if (allChangeKeys.Count() >= 7 || !internalNotCachedLockedKeys.Any()) // Then don't generate new keys, because it'd bloat the wallet.
-						{
-							// Find the first one that we did not try to register in the current session.
-							changeKey = allChangeKeys.FirstOrDefault(x => !AccessCache.ContainsKey(x));
-							// If there is no such a key, then use the oldest.
-							if (changeKey == default)
+					string changeLabel = "ZeroLink Change";
+					string activeLabel = "ZeroLink Mixed Coin";
+
+					IEnumerable<HdPubKey> allChangeKeys = KeyManager.GetKeys(x => x.KeyState != KeyState.Used && x.Label == changeLabel);
+					HdPubKey changeKey = null;
+
+					KeyManager.AssertLockedInternalKeysIndexed(14);
+					IEnumerable<HdPubKey> internalNotCachedLockedKeys = KeyManager.GetKeys(KeyState.Locked, isInternal: true).Except(AccessCache.Keys);
+
+					if (allChangeKeys.Count() >= 7 || !internalNotCachedLockedKeys.Any()) // Then don't generate new keys, because it'd bloat the wallet.
+					{
+						// Find the first one that we did not try to register in the current session.
+						changeKey = allChangeKeys.FirstOrDefault(x => !AccessCache.ContainsKey(x));
+						// If there is no such a key, then use the oldest.
+						if (changeKey == default)
+						{
+							changeKey = AccessCache.Where(x => allChangeKeys.Contains(x.Key)).OrderBy(x => x.Value).First().Key;
+						}
+						changeKey.SetLabel(changeLabel);
+						changeKey.SetKeyState(KeyState.Locked);
+					}
+					else
+					{
+						changeKey = internalNotCachedLockedKeys.RandomElement();
+						changeKey.SetLabel(changeLabel);
+					}
+					changeAddress = changeKey.GetP2wpkhAddress(Network);
+					AccessCache.AddOrReplace(changeKey, DateTimeOffset.UtcNow);
+
+					IEnumerable<HdPubKey> allActiveKeys = KeyManager.GetKeys(x => x.KeyState != KeyState.Used && x.Label == activeLabel);
+					List<HdPubKey> activeKeys = new List<HdPubKey>();
+
+					KeyManager.AssertLockedInternalKeysIndexed(14);
+
+					internalNotCachedLockedKeys = KeyManager.GetKeys(KeyState.Locked, isInternal: true).Except(AccessCache.Keys);
+
+					if (allActiveKeys.Count() >= 7 || !internalNotCachedLockedKeys.Any()) // Then don't generate new keys, because it'd bloat the wallet.
+					{
+						// Find the first one that we did not try to register in the current session.
+						foreach (var ac in allActiveKeys.Where(x => !AccessCache.ContainsKey(x)))
+						{
+							if (activeKeys.Count >= Constants.MaximumMixingLevelCount)
 							{
-								changeKey = AccessCache.Where(x => allChangeKeys.Contains(x.Key)).OrderBy(x => x.Value).First().Key;
+								break;
 							}
-							changeKey.SetLabel(changeLabel);
-							changeKey.SetKeyState(KeyState.Locked);
-						}
-						else
-						{
-							changeKey = internalNotCachedLockedKeys.RandomElement();
-							changeKey.SetLabel(changeLabel);
-						}
-						changeAddress = changeKey.GetP2wpkhAddress(Network);
-						AccessCache.AddOrReplace(changeKey, DateTimeOffset.UtcNow);
-					}
-
-					if (!activeOutputAddresses.Any())
-					{
-						string activeLabel = "ZeroLink Mixed Coin";
-						IEnumerable<HdPubKey> allActiveKeys = allUnusedInternalKeys.Where(x => x.Label == activeLabel);
-						List<HdPubKey> activeKeys = new List<HdPubKey>();
-
-						KeyManager.AssertLockedInternalKeysIndexed(14);
-						IEnumerable<HdPubKey> internalNotCachedLockedKeys = KeyManager.GetKeys(KeyState.Locked, isInternal: true).Except(AccessCache.Keys);
-
-						if (allActiveKeys.Count() >= 7 || !internalNotCachedLockedKeys.Any()) // Then don't generate new keys, because it'd bloat the wallet.
-						{
-							// Find the first one that we did not try to register in the current session.
-							foreach (var ac in allActiveKeys.Where(x => !AccessCache.ContainsKey(x)))
+							activeKeys.Add(ac);
+						}
+						// If there is no such a key, then use the oldest, but make sure it's not the same as the change.
+						if (activeKeys.Count < Constants.MaximumMixingLevelCount)
+						{
+							foreach (var ac in AccessCache.Where(x => allActiveKeys.Contains(x.Key) && changeAddress != x.Key.GetP2wpkhAddress(Network)).OrderBy(x => x.Value).Select(x => x.Key))
 							{
-								if (activeKeys.Count >= 10)
+								if (activeKeys.Count >= Constants.MaximumMixingLevelCount)
 								{
 									break;
 								}
 								activeKeys.Add(ac);
 							}
-							// If there is no such a key, then use the oldest, but make sure it's not the same as the change.
-							if (activeKeys.Count < 10)
+						}
+					}
+					else
+					{
+						foreach (var ac in internalNotCachedLockedKeys.Where(x => changeAddress != x.GetP2wpkhAddress(Network)))
+						{
+							if (activeKeys.Count >= Constants.MaximumMixingLevelCount)
 							{
-								foreach (var ac in AccessCache.Where(x => allActiveKeys.Contains(x.Key) && changeAddress != x.Key.GetP2wpkhAddress(Network)).OrderBy(x => x.Value).Select(x => x.Key))
-								{
-									if (activeKeys.Count >= 10)
-									{
-										break;
-									}
-									activeKeys.Add(ac);
-								}
+								break;
 							}
-						}
-						else
-						{
-							foreach (var ac in internalNotCachedLockedKeys.Where(x => changeAddress != x.GetP2wpkhAddress(Network)))
-							{
-								if (activeKeys.Count >= 10)
-								{
-									break;
-								}
-								activeKeys.Add(ac);
-							}
-						}
-
-						foreach (HdPubKey ac in activeKeys)
-						{
-							ac.SetLabel(activeLabel);
-							ac.SetKeyState(KeyState.Locked);
-							activeOutputAddresses.Add(ac.GetP2wpkhAddress(Network));
-							AccessCache.AddOrReplace(ac, DateTimeOffset.UtcNow);
-						}
+							activeKeys.Add(ac);
+						}
+					}
+
+					foreach (HdPubKey ac in activeKeys)
+					{
+						ac.SetLabel(activeLabel);
+						ac.SetKeyState(KeyState.Locked);
+						activeOutputAddresses.Add(ac.GetP2wpkhAddress(Network));
+						AccessCache.AddOrReplace(ac, DateTimeOffset.UtcNow);
 					}

 					KeyManager.ToFile();


CI test fix attempt

CI test fix attempt

--- Winston/User/ConsoleUserAdapter.cs
+++ Winston/User/ConsoleUserAdapter.cs
@@ -19,10 +19,11 @@
         {
             this.output = output;
             this.input = input;
-            if (Environment.UserInteractive)
+            try
             {
                 this.startRow = Console.CursorTop;
             }
+            catch (IOException) { }
         }

         public async Task<string> Ask(Question question) => await Task.Run(() =>
@@ -46,10 +47,11 @@

         public void Message(string message)
         {
-            if (Environment.UserInteractive)
+            try
             {
                 ConsoleEx.Move(0, startRow + lastPrintRow + lastProgressRow);
             }
+            catch (IOException) { }
             output.WriteLine(message);
             lastPrintRow++;
         }
@@ -57,17 +59,17 @@
         public Progress NewProgress(string name)
         {
             var result = new Progress { Name = name };
-            if (!Environment.UserInteractive)
-            {
-                return result;
-            }
             result.UpdateDownload = p =>
             {
                 lock (progressLock)
                 {
                     if (p != result.Last)
                     {
-                        ConsoleEx.WriteAt(result.ProgressPrefix.Length, result.Row, p.ToString());
+                        try
+                        {
+                            ConsoleEx.WriteAt(result.ProgressPrefix.Length, result.Row, p.ToString());
+                        }
+                        catch (IOException) { }
                         result.Last = p;
                     }
                 }
@@ -76,14 +78,22 @@
             {
                 lock (progressLock)
                 {
-                    ConsoleEx.WriteAt(result.ProgressPrefix.Length + 3, result.Row, " completed");
+                    try
+                    {
+                        ConsoleEx.WriteAt(result.ProgressPrefix.Length + 3, result.Row, " completed");
+                    }
+                    catch (IOException) { }
                 }
             };
             result.UpdateInstall = p =>
             {
                 lock (progressLock)
                 {
-                    ConsoleEx.WriteAt(result.ProgressPrefix.Length + 3, result.Row, p.ToString());
+                    try
+                    {
+                        ConsoleEx.WriteAt(result.ProgressPrefix.Length + 3, result.Row, p.ToString());
+                    }
+                    catch (IOException) { }
                     result.Last = p;
                 }
             };
@@ -91,7 +101,11 @@
             {
                 lock (progressLock)
                 {
-                    ConsoleEx.WriteAt(result.ProgressPrefix.Length + 3, result.Row, " completed");
+                    try
+                    {
+                        ConsoleEx.WriteAt(result.ProgressPrefix.Length + 3, result.Row, " completed");
+                    }
+                    catch (IOException) { }
                 }
             };
             result.Row = startRow + lastProgressRow;


added mailsubject instead of reportid since that probably easier to work with

--- WorkerHost/Jobs/SubscriptionJob.cs
+++ WorkerHost/Jobs/SubscriptionJob.cs
@@ -52,7 +52,7 @@
         private void SendFailedSubscriptionEmail(Subscription[] justFailed)
         {
             var body = "The following subscriptions just failed:" + Environment.NewLine;
-            body += string.Join(Environment.NewLine, justFailed.Select(x => "Subscription " + x.Id + " for report " + x.ReportId + " failed due to: " + x.ErrorMessage));
+            body += string.Join(Environment.NewLine, justFailed.Select(x => "Subscription " +   x.Id + " with subject " + x.MailSubject + " failed due to: " + x.ErrorMessage));

             _mailSender.Send("Failed subscriptions", body, _applicationSettings.ErrorMailRecipient);
         }