Block Processing Test WIP

Block Processing Test WIP

--- src/Nethereum.BlockchainProcessing.IntegrationTests/BlockProcessing/BlockProcessingTests.cs
+++ src/Nethereum.BlockchainProcessing.IntegrationTests/BlockProcessing/BlockProcessingTests.cs
@@ -19,81 +19,138 @@

 namespace Nethereum.BlockchainProcessing.IntegrationTests.BlockProcessing
 {
-    public class BlockProcessingTests
+    public class BlockingProcessingRpcMock
     {
-        public class RpcResponses
+        public BlockingProcessingRpcMock(Web3Mock web3Mock)
         {
-            public List<BlockWithTransactions> Blocks { get;set;} = new List<BlockWithTransactions>();
-
-            public List<TransactionReceipt> Receipts { get;set;} = new List<TransactionReceipt>();
-
-        }
-
-        [Fact]
-        public async Task ShouldCrawlBlocksAndInvokeHandlingSteps()
-        {
-            var web3Mock = new Web3Mock();
-            var processingSteps = new BlockProcessingSteps();
-            var orchestrator = new BlockCrawlOrchestrator(web3Mock.EthApiContractServiceMock.Object, new []{ processingSteps });
-            var progressRepository = new InMemoryBlockchainProgressRepository(lastBlockProcessed: null);
-            var lastConfirmedBlockService = new LastConfirmedBlockNumberService(web3Mock.BlockNumberMock.Object);
-            var blockchainProcessor = new BlockchainProcessor(orchestrator, progressRepository, lastConfirmedBlockService);
-
-            var mockRpcResponses = new RpcResponses();
-
-            var currentBlockOnChain = new HexBigInteger(100);
-
-            // 0x243e72b69141f6af525a9a5fd939668ee9f2b354
-
-            mockRpcResponses.Blocks.Add(new BlockWithTransactions
-            {
-                Number = new HexBigInteger(1),
-                Transactions = new[]
-                {
-                    new Transaction{TransactionHash = "0x10ce02e0b4fdf5cfee0ed21141b38c2d88113c58828c771e813ce2624af127cd", TransactionIndex = new HexBigInteger(1)},
-                    new Transaction{TransactionHash = "0x20ce02e0b4fdf5cfee0ed21141b38c2d88113c58828c771e813ce2624af127cd", TransactionIndex = new HexBigInteger(2)}
-                }
-            });
-
-            mockRpcResponses.Receipts.AddRange(new []
-            {
-                new TransactionReceipt { TransactionHash = "0x10ce02e0b4fdf5cfee0ed21141b38c2d88113c58828c771e813ce2624af127cd", Logs = new []{ new FilterLog() }.ConvertToJArray() },
-                new TransactionReceipt { TransactionHash = "0x20ce02e0b4fdf5cfee0ed21141b38c2d88113c58828c771e813ce2624af127cd", Logs = new []{ new FilterLog() }.ConvertToJArray() }
-            });
-
-            web3Mock.BlockNumberMock.Setup(m => m.SendRequestAsync(null)).ReturnsAsync(currentBlockOnChain);

             web3Mock.GetBlockWithTransactionsByNumberMock.Setup(s => s.SendRequestAsync(It.IsAny<HexBigInteger>(), null))
                 .Returns<HexBigInteger, object>((n, id) =>
                 {
-                    return Task.FromResult(mockRpcResponses.Blocks.FirstOrDefault(b => b.Number == n));
+                    return Task.FromResult(Blocks.FirstOrDefault(b => b.Number == n));
                 });

             web3Mock.GetTransactionReceiptMock.Setup(s => s.SendRequestAsync(It.IsAny<string>(), null))
                 .Returns<string, object>((hash, id) =>
                 {
-                    return Task.FromResult(mockRpcResponses.Receipts.FirstOrDefault(b => b.TransactionHash == hash));
+                    return Task.FromResult(Receipts.FirstOrDefault(b => b.TransactionHash == hash));
                 });
+        }
+
+        public List<BlockWithTransactions> Blocks { get; set; } = new List<BlockWithTransactions>();
+
+        public List<TransactionReceipt> Receipts { get; set; } = new List<TransactionReceipt>();
+
+        public void AddTransactionsWithReceipts(int blockNumber, int numberOfTransactions, int logsPerTransaction)
+        {
+            var transactions = new Transaction[numberOfTransactions];
+
+            for (var i = 0; i < numberOfTransactions; i++)
+            {
+                transactions[0] = new Transaction
+                {
+                    TransactionHash = $"0x{blockNumber}{i}ce02e0b4fdf5cfee0ed21141b38c2d88113c58828c771e813ce2624af127cd",
+                    TransactionIndex = new HexBigInteger(i)
+                };
+            }
+
+            Blocks.Add(new BlockWithTransactions
+            {
+                Number = new HexBigInteger(blockNumber),
+                Transactions = transactions
+            });
+
+            foreach (var tx in transactions)
+            {
+                var logs = new FilterLog[logsPerTransaction];
+
+                for (var l = 0; l < logsPerTransaction; l++)
+                {
+                    logs[l] = new FilterLog();
+                }
+
+                Receipts.AddRange(new[] {new TransactionReceipt {
+                        TransactionHash = tx.TransactionHash,
+                        Logs = logs.ConvertToJArray() },
+                    });
+            }
+        }
+
+    }
+
+    public class ProcessedBlockchainData
+    {
+        public List<BlockWithTransactions> Blocks { get; set; } = new List<BlockWithTransactions>();
+        public List<TransactionVO> Transactions { get; set; } = new List<TransactionVO>();
+        public List<TransactionReceiptVO> TransactionsWithReceipt { get; set; } = new List<TransactionReceiptVO>();
+        public List<ContractCreationVO> ContractCreations { get; set; } = new List<ContractCreationVO>();
+        public List<FilterLogVO> FilterLogs { get; set; } = new List<FilterLogVO>();
+    }
+
+    public class BlockProcessingTestBase
+    {
+        protected Web3Mock Web3Mock;
+        protected BlockProcessingSteps processingSteps;
+        protected BlockCrawlOrchestrator orchestrator;
+        protected InMemoryBlockchainProgressRepository progressRepository;
+        protected LastConfirmedBlockNumberService lastConfirmedBlockService;
+        protected BlockchainProcessor blockchainProcessor;
+        protected Queue<HexBigInteger> blockNumberQueue;
+        protected BlockingProcessingRpcMock mockRpcResponses;
+        protected ProcessedBlockchainData processedBlockchainData;
+
+        public BlockProcessingTestBase()
+        {
+            Web3Mock = new Web3Mock();
+            processedBlockchainData = new ProcessedBlockchainData();
+        }
+
+        protected virtual void Initialise()
+        {
+            processingSteps = new BlockProcessingSteps();
+            orchestrator = new BlockCrawlOrchestrator(Web3Mock.EthApiContractServiceMock.Object, new[] { processingSteps });
+            progressRepository = new InMemoryBlockchainProgressRepository(lastBlockProcessed: null);
+            lastConfirmedBlockService = new LastConfirmedBlockNumberService(Web3Mock.BlockNumberMock.Object);
+            blockchainProcessor = new BlockchainProcessor(orchestrator, progressRepository, lastConfirmedBlockService);
+            blockNumberQueue = new Queue<HexBigInteger>();
+
+            Web3Mock
+                .BlockNumberMock
+                .Setup(m => m.SendRequestAsync(null))
+                .Returns(() => Task.FromResult(blockNumberQueue.Dequeue()));
+
+            mockRpcResponses = new BlockingProcessingRpcMock(Web3Mock);
+        }
+
+        protected virtual void MockGetBlockNumber(BigInteger blockNumberToReturn)
+        {
+            blockNumberQueue.Enqueue(new HexBigInteger(blockNumberToReturn));
+        }
+    }

-            var blocks = new List<BlockWithTransactions>();
-            var transactions = new List<TransactionVO>();
-            var transactionsWithReceipt = new List<TransactionReceiptVO>();
-            var contractCreations = new List<ContractCreationVO>();
-            var filterLogs = new List<FilterLogVO>();
+    public class BlockProcessingTests : BlockProcessingTestBase
+    {

-            processingSteps.BlockStep.AddSynchronousProcessorHandler((block) => blocks.Add(block));
-            processingSteps.TransactionStep.AddSynchronousProcessorHandler((tx) => transactions.Add(tx));
-            processingSteps.TransactionReceiptStep.AddSynchronousProcessorHandler((tx) => transactionsWithReceipt.Add(tx));
-            processingSteps.ContractCreationStep.AddSynchronousProcessorHandler((c) => contractCreations.Add(c));
-            processingSteps.FilterLogStep.AddSynchronousProcessorHandler((filterLog) => filterLogs.Add(filterLog));
+        [Fact]
+        public async Task ShouldCrawlBlocksAndInvokeHandlingSteps()
+        {
+            Initialise();
+            MockGetBlockNumber(100);

-            var fromBlock = new BigInteger(1);
-            var toBlock = fromBlock;
+            mockRpcResponses.AddTransactionsWithReceipts(blockNumber: 1, numberOfTransactions: 2, logsPerTransaction: 2);
+
+            processingSteps.BlockStep.AddSynchronousProcessorHandler((block) => processedBlockchainData.Blocks.Add(block));
+            processingSteps.TransactionStep.AddSynchronousProcessorHandler((tx) => processedBlockchainData.Transactions.Add(tx));
+            processingSteps.TransactionReceiptStep.AddSynchronousProcessorHandler((tx) => processedBlockchainData.TransactionsWithReceipt.Add(tx));
+            processingSteps.ContractCreationStep.AddSynchronousProcessorHandler((c) => processedBlockchainData.ContractCreations.Add(c));
+            processingSteps.FilterLogStep.AddSynchronousProcessorHandler((filterLog) => processedBlockchainData.FilterLogs.Add(filterLog));
+
+            var blockToCrawl = new BigInteger(1);

             var cancellationTokenSource = new CancellationTokenSource();

-            var progress =  await blockchainProcessor.ExecuteAsync(toBlock, cancellationTokenSource.Token, fromBlock);
+            await blockchainProcessor.ExecuteAsync(blockToCrawl, cancellationTokenSource.Token, blockToCrawl);

         }


Switching to socket.ConnectAsync as now available in contract

Fixes #437

--- src/System.Private.ServiceModel/src/System/ServiceModel/Channels/CoreClrSocketConnection.cs
+++ src/System.Private.ServiceModel/src/System/ServiceModel/Channels/CoreClrSocketConnection.cs
@@ -892,15 +892,15 @@
             }
         }

-        protected override Task<IConnection> CreateConnectionAsync(IPAddress address, int port)
+        protected override async Task<IConnection> CreateConnectionAsync(IPAddress address, int port)
         {
             Socket socket = null;
             try
             {
                 AddressFamily addressFamily = address.AddressFamily;
                 socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp);
-                socket.Connect(new IPEndPoint(address, port));
-                return Task.FromResult<IConnection>(new CoreClrSocketConnection(socket, _connectionBufferPool));
+                await socket.ConnectAsync(new IPEndPoint(address, port));
+                return new CoreClrSocketConnection(socket, _connectionBufferPool);
             }
             catch
             {


Fixed the ArucoGridBoard placement in tracking.

--- src/aruco_unity_package/Assets/ArucoUnity/Scripts/Objects/Trackers/ArucoGridBoardTracker.cs
+++ src/aruco_unity_package/Assets/ArucoUnity/Scripts/Objects/Trackers/ArucoGridBoardTracker.cs
@@ -1,5 +1,4 @@
-using ArucoUnity.Objects;
-using ArucoUnity.Plugin;
+using ArucoUnity.Plugin;

 namespace ArucoUnity
 {
@@ -76,8 +75,8 @@
           {
             // Adjust the estimated coordinates
             var position = arucoGridBoard.Tvec.ToPosition()
-              + arucoGridBoard.transform.right * arucoGridBoard.transform.localScale.x / 2
-              + arucoGridBoard.transform.forward * arucoGridBoard.transform.localScale.z / 2;
+              + arucoGridBoard.transform.right * arucoGridBoard.GetGameObjectScale().x / 2
+              + arucoGridBoard.transform.forward * arucoGridBoard.GetGameObjectScale().z / 2;

             arucoCameraDisplay.PlaceArucoObject(arucoGridBoard.transform, cameraId, position, arucoGridBoard.Rvec.ToRotation());
           }


Removed unused response root for old Topic analysis fuctionality

--- Glav.CognitiveServices.FluentApi.TextAnalytic/Domain/ApiResponses/TopicResultResponseRoot.cs
+++ Glav.CognitiveServices.FluentApi.TextAnalytic/Domain/ApiResponses/TopicResultResponseRoot.cs
@@ -1,19 +0,0 @@
-using Glav.CognitiveServices.FluentApi.Core.Contracts;
-
-namespace Glav.CognitiveServices.FluentApi.TextAnalytic.Domain.ApiResponses
-{
-    public sealed class TopicResultResponseRoot : IActionResponseRoot
-    {
-        public string code { get; set; }
-        public string message { get; set; }
-        public TopicErrorItem innerError { get; set; }
-    }
-
-    public sealed class TopicErrorItem
-    {
-        public string code { get; set; }
-        public string message { get; set; }
-        public int minimumNumberOfDocuments { get; set; }
-
-    }
-}


Failing test

Failing test

--- src/tests/Chassis.UnitTests/Apps/AppFactoryTests.cs
+++ src/tests/Chassis.UnitTests/Apps/AppFactoryTests.cs
@@ -3,6 +3,7 @@
 using Autofac.Core;
 using Autofac.Multitenant;
 using Chassis.Apps;
+using Chassis.Startup;
 using Chassis.Tenants;
 using Chassis.Types;
 using NUnit.Framework;
@@ -43,6 +44,14 @@
                 _app.Container.TryResolve(out unique).ShouldBe(false);
             }

+            [Test]
+            public void AutoScan()
+            {
+                Bob bob;
+                _app.Container.TryResolve(out bob).ShouldBe(true);
+                _app.Start();
+            }
+
         }

         public class MultiTenantTests
@@ -76,6 +85,14 @@
                 TenantUnique unique;
                 _app.Container.TryResolve(out unique).ShouldBe(true);
             }
+
+            [Test]
+            public void AutoScan()
+            {
+                Bob bob;
+                _app.Container.TryResolve(out bob).ShouldBe(true);
+                _app.Start();
+            }
         }

@@ -83,6 +100,21 @@
         class SingleTenant : IApplicationMarker
         {
             public void ConfigureContainer(TypePool pool, ContainerBuilder builder)
+            {
+
+            }
+        }
+
+        public class Bob : IStartupStep
+        {
+            IApplication _application;
+
+            public Bob(IApplication application)
+            {
+                _application = application;
+            }
+
+            public void Execute()
             {

             }


removed license header

removed license header

--- src/tests/UnitTests.NetFramework/MemoryProtector.cs
+++ src/tests/UnitTests.NetFramework/MemoryProtector.cs
@@ -1,29 +1,4 @@
-
-/*
-MIT License
-
-Copyright (c) 2016 Erkin Ekici - undergroundwires@safeorb.it
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-using System;
+using System;
 using SafeOrbit.Cryptography.Encryption;
 #if NET46
 using System.Security.Cryptography;


no message

no message

--- SmartDataViewer/Assets/3rdPlugins/SmartDataViewer/Editor/BuildInEditor/ConfigEditorSchema.cs
+++ SmartDataViewer/Assets/3rdPlugins/SmartDataViewer/Editor/BuildInEditor/ConfigEditorSchema.cs
@@ -52,7 +52,7 @@
         /// 表头高度
         /// </summary>
         protected int TableHeadHeight = 26;
-
+
         /// <summary>
         /// 缩放
         /// </summary>
@@ -74,6 +74,7 @@
         protected int ItemMaxCount { get; set; }
         protected Dictionary<string, bool> FieldsOrder { get; set; }

+

         //TODO 2.0 外联表原始数据
         protected Dictionary<string, object> outLinkRawData { get; set; }
@@ -391,41 +392,37 @@
             {
                 if (enable)
                 {
-                    value = EditorGUILayout.EnumPopup(value as Enum,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    value = EditorGUILayout.EnumPopup(value as Enum, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
                     EditorGUILayout.LabelField((value as Enum).ToString(),
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                        new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is Bounds)
             {
                 if (enable)
                 {
-                    value = EditorGUILayout.BoundsField((Bounds) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    value = EditorGUILayout.BoundsField((Bounds) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.BoundsField((Bounds) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.BoundsField((Bounds) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is Color)
             {
                 if (enable)
                 {
-                    value = EditorGUILayout.ColorField((Color) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    value = EditorGUILayout.ColorField((Color) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.ColorField((Color) value, new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.ColorField((Color) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is AnimationCurve)
@@ -433,69 +430,61 @@
                 if (enable)
                 {
                     value = EditorGUILayout.CurveField((AnimationCurve) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                        new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.CurveField((AnimationCurve) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.CurveField((AnimationCurve) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is string)
             {
                 if (enable)
                 {
-                    value = EditorGUILayout.TextField(value as string,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    value = EditorGUILayout.TextField(value as string, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.LabelField(value as string,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.LabelField(value as string, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is float)
             {
                 if (enable)
                 {
-                    value = EditorGUILayout.FloatField((float) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    value = EditorGUILayout.FloatField((float) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.LabelField(value as string,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.LabelField(value as string, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is int)
             {
                 if (enable)
                 {
-                    value = EditorGUILayout.IntField((int) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    value = EditorGUILayout.IntField((int) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.LabelField(value as string,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.LabelField(value as string, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is bool)
             {
                 if (enable)
                 {
-                    value = EditorGUILayout.Toggle((bool) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    value = EditorGUILayout.Toggle((bool) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
                     EditorGUILayout.LabelField(((bool) value).ToString(),
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                        new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is Vector2)
@@ -503,13 +492,12 @@
                 if (enable)
                 {
                     value = EditorGUILayout.Vector2Field("", (Vector2) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                        new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.Vector2Field("", (Vector2) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.Vector2Field("", (Vector2) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is Vector3)
@@ -517,13 +505,12 @@
                 if (enable)
                 {
                     value = EditorGUILayout.Vector3Field("", (Vector3) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                        new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.Vector3Field("", (Vector3) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.Vector3Field("", (Vector3) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
             else if (value is Vector4)
@@ -531,13 +518,12 @@
                 if (enable)
                 {
                     value = EditorGUILayout.Vector3Field("", (Vector4) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                        new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                     setValue(value);
                 }
                 else
                 {
-                    EditorGUILayout.Vector3Field("", (Vector4) value,
-                        new GUILayoutOption[] {GUILayout.Width(width * Resize)});
+                    EditorGUILayout.Vector3Field("", (Vector4) value, new GUILayoutOption[] {GUILayout.Width(width*Resize)});
                 }
             }
         }
@@ -950,19 +936,18 @@
             int.TryParse(GUILayout.TextField(PageAmount.ToString(), GUILayout.Width(40)), out PageAmount);

-            if (GUILayout.Button("Jump:", EditorGUIStyle.GetJumpButtonGuiStyle(), GUILayout.Width(36)))
-            {
-                if (jumpTo - 1 < 0)
+            if (GUILayout.Button("Jump:",EditorGUIStyle.GetJumpButtonGuiStyle(),GUILayout.Width(36)))
+            {
+                if (jumpTo-1 <0)
                     jumpTo = 0;

-                if (jumpTo - 1 > maxIndex)
+                if (jumpTo-1 >maxIndex)
                     jumpTo = maxIndex;

-                PageIndex = jumpTo - 1;
-            }
-
-            jumpTo = EditorGUILayout.IntField(jumpTo, GUILayout.Width(40));
-
+                PageIndex = jumpTo -1;
+            }
+            jumpTo = EditorGUILayout.IntField(jumpTo,GUILayout.Width(40));
+
             if (GUILayout.Button(Language.Previous, GUI.skin.GetStyle("ButtonLeft"), GUILayout.Height(16)))
             {
                 if (PageIndex - 1 < 0)


modified function to insert unicode characters

--- Source/Apps/Microsoft/Released/Microsoft-TwitterTemplate/Service/Data/TweetFunctionCSharp.cs
+++ Source/Apps/Microsoft/Released/Microsoft-TwitterTemplate/Service/Data/TweetFunctionCSharp.cs
@@ -21,7 +21,7 @@
 public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
 {
     string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
-    TweetHandler tweetHandler = new TweetHandler(connectionString);
+    TweetHandler tweetHandler = new TweetHandler(connectionString, log);
     string jsonContent = await req.Content.ReadAsStringAsync();
     var tweets = JsonConvert.DeserializeObject(jsonContent);
     if (tweets is JArray)
@@ -29,7 +29,7 @@
         foreach (var item in (JArray)tweets)
         {
             var individualtweet = item.ToString();
-            log.Info("********************Run**************************" + individualtweet.ToString());
+            //log.Info("********************Run**************************" + individualtweet.ToString());

             await tweetHandler.ParseTweet(individualtweet, log);
         }
@@ -46,18 +46,20 @@

 public class TweetHandler
 {
-    public TweetHandler(string connection)
+    public TweetHandler(string connection, TraceWriter log)
     {
         if (string.IsNullOrEmpty(connection))
         {
             throw new ArgumentNullException("connection", "Connection string is null or empty.");
         }
         this.connectionString = connection;
+        this.log = log;
     }

     private dynamic tweet = string.Empty;
     private JObject tweetObj = new JObject();
     private string connectionString;
+    private TraceWriter log = null;

     //Create dictionaries for SQL tables
     private Dictionary<string, string> originalTweets = new Dictionary<string, string>()
@@ -150,16 +152,17 @@
             }
         }

-        log.Info("********************ParseTweet************************** Handles: " + twitterHandles);
-        log.Info("********************ParseTweet************************** Handle IDs: " + twitterHandleId);
-        log.Info("********************ParseTweet************************** Tweet Language: " + tweet.TweetLanguageCode.ToString());
+        //log.Info("********************ParseTweet************************** TweetText: " + tweet.TweetText.ToString());
+        //log.Info("********************ParseTweet************************** Handles: " + twitterHandles);
+        //log.Info("********************ParseTweet************************** Handle IDs: " + twitterHandleId);
+        //log.Info("********************ParseTweet************************** Tweet Language: " + tweet.TweetLanguageCode.ToString());
         // Check if language of tweet is supported for sentiment analysis
         originalTweets["lang"] = tweet.TweetLanguageCode.ToString();
         if (originalTweets["lang"] == "en")
         {
-            log.Info("********************ParseTweet**************************" + tweet.TweetId.ToString());
+            //log.Info("********************ParseTweet**************************" + tweet.TweetId.ToString());
             string sentiment = await MakeSentimentRequest(tweet, log);
-            log.Info("********************ParseTweet************************** Sentiment: " + sentiment);
+            //log.Info("********************ParseTweet************************** Sentiment: " + sentiment);
             string sentimentBin = (Math.Floor(double.Parse(sentiment) * 10) / 10).ToString(CultureInfo.InvariantCulture);
             string sentimentPosNeg = String.Empty;
             if (double.Parse(sentimentBin) > 0.1)
@@ -311,6 +314,7 @@
         {
             connection.Open();
             var command = new SqlCommand(sqlQuery, connection);
+            //log.Info("*********************************ExecuteSqlNonQuery************************** Query: " + sqlQuery);
             command.ExecuteNonQuery();
         }
     }
@@ -321,6 +325,7 @@
         using (SqlConnection connection = new SqlConnection(connectionString.ToString()))
         {
             connection.Open();
+            //log.Info("*********************************ExecuteSqlScalar************************** Query: " + sqlQuery);
             var command = new SqlCommand(sqlQuery, connection);
             return (int)command.ExecuteScalar();
         }
@@ -361,7 +366,10 @@
             {
                 ExecuteSqlNonQuery(generateSQLQuery("pbist_twitter.tweets_normalized", originalTweets));
             }
-            catch (Exception e) { }
+            catch (Exception e)
+            {
+                //log.Info("******************Exception******************** Message:" + e);
+            }
         }
     }

@@ -370,11 +378,12 @@
     {
         string sqlQueryGenerator = $"insert into " + tableName + "(" +
                                    String.Join(", ", dictionary.Select(x => x.Key)) + ")" + " VALUES " + "('" +
-                                   String.Join("','", dictionary.Select(x => {
+                                   String.Join("',N'", dictionary.Select(x => {
                                        if (string.IsNullOrEmpty(x.Value))
                                        {
                                            return x.Value;
                                        }
+                                       //log.Info("********************generateSQLQuery************************** Text: " + x.Value);
                                        return x.Value.Replace("'", "''");
                                    })) + "')";
         return sqlQueryGenerator;
@@ -462,7 +471,7 @@

         dynamic objResult = null;

-        log.Info("*************MakeSentimentRequest***************** TweetText: " + tweet.TweetText.ToString());
+        //log.Info("*************MakeSentimentRequest***************** TweetText: " + tweet.TweetText.ToString());

         using (var client = new HttpClient())
         {
@@ -493,18 +502,18 @@
             {
                 result = await response.Content.ReadAsStringAsync();
                 objResult = JsonConvert.DeserializeObject(result);
-                log.Info("*************MakeSentimentRequest***************** Score: " + objResult.Results.output1[0].score);
+                //log.Info("*************MakeSentimentRequest***************** Score: " + objResult.Results.output1[0].score);
             }
             else
             {
-                log.Info(string.Format("The request failed with status code: {0}", response.StatusCode));
+                //log.Info(string.Format("The request failed with status code: {0}", response.StatusCode));

                 // Print the headers - they include the requert ID and the timestamp,
                 // which are useful for debugging the failure
-                log.Info(response.Headers.ToString());
+                //log.Info(response.Headers.ToString());

                 string responseContent = await response.Content.ReadAsStringAsync();
-                log.Info(responseContent);
+                //log.Info(responseContent);
             }
         }
         return objResult.Results.output1[0].score;


if 文の判定が無駄に呼ばれるのを修正

if 文の判定が無駄に呼ばれるのを修正

--- Sdx/Pager.cs
+++ Sdx/Pager.cs
@@ -159,7 +159,7 @@
       {
         start = 1;
       }
-      if(start > LastPage - number + 1)
+      else if(start > LastPage - number + 1)
       {
         start = LastPage - number + 1;
       }


* Site/code.cs

* Site/code.cs

--- Site/code.cs
+++ Site/code.cs
@@ -15,6 +15,7 @@
 {
 	config.Ignore(x => x.Id);
 	config.Ignore(x => x.Email);
+	config.Bind(source => source.LastName, target => target.Surname);
 });

 var person = new Person


Special handling of amount when outside [0,1] range.

When a texture amount is outside of the [0,1] range
we need to separate the color channels and multiply
them with the amount to get the proper HDR colors.

One use-case example is subsurface scattering radius
where the amount can go well over 1.0. We need to be
able to get this radius info transfered properly.

--- Utilities.cs
+++ Utilities.cs
@@ -13,6 +13,7 @@
 using Pbr = Rhino.Render.PhysicallyBasedMaterial.ParametersNames;
 using Rhino.Runtime.InteropWrappers;
 using System.Runtime.Remoting.Messaging;
+using ccl.ShaderNodes;

 namespace RhinoCyclesCore
 {
@@ -319,18 +320,18 @@
 		{
 			if (IsOn && teximg.HasTextureImage)
 			{
-				var imtexnode = new ccl.ShaderNodes.ImageTextureNode();
-				var invcol = new ccl.ShaderNodes.InvertNode();
-				var normalmapnode = new ccl.ShaderNodes.NormalMapNode();
-				var tobwnode = new ccl.ShaderNodes.RgbToBwNode();
-				var alphamult = new ccl.ShaderNodes.MathMultiply();
-
-				var mixerNode = new ccl.ShaderNodes.MixNode();
-
-				alphamult.ins.Value1.Value = amount;
+				var imtexnode = new ccl.ShaderNodes.ImageTextureNode($"image texture for input {valueSocket?.Parent.VariableName ?? "unknown input"}");
+				var invcol = new ccl.ShaderNodes.InvertNode($"invert color for imtexnode for {valueSocket?.Parent.VariableName ?? "unknown input"}");
+				var normalmapnode = new ccl.ShaderNodes.NormalMapNode($"Normal map node for {valueSocket?.Parent.VariableName ?? "unknown input"}");
+				var tobwnode = new ccl.ShaderNodes.RgbToBwNode($"convert imtexnode to bw for {valueSocket?.Parent.VariableName ?? "unknown input"}");
+				var alphamult = new ccl.ShaderNodes.MathMultiply($"alpha multiplier for {valueSocket?.Parent.VariableName ?? "unknown input"}");
+
+				var mixerNode = new ccl.ShaderNodes.MixNode($"rgb mix node for imtexnode and {valueSocket?.Parent.VariableName ?? "unknown input"}");
+
+				alphamult.ins.Value1.Value = Math.Min(1.0f, Math.Max(0.0f, amount));
 				alphamult.ins.Value2.Value = 1.0f;

-				mixerNode.ins.Fac.Value = amount;
+				mixerNode.ins.Fac.Value = Math.Min(1.0f, Math.Max(0.0f, amount));

 				sh.AddNode(mixerNode);
 				sh.AddNode(imtexnode);
@@ -382,7 +383,43 @@
 						}
 						outsock.Connect(mixerNode.ins.Color2);
 					}
-					mixerNode.outs.Color.Connect(sock);
+					if (amount >= 0.0f && amount <= 1.0f)
+					{
+						mixerNode.outs.Color.Connect(sock);
+					} else { // multiply the output of mixerNode.outs.Color with amount.
+						SeparateRgbNode separateRgbNode = new SeparateRgbNode($"separating the color for multiplication {valueSocket?.Parent.VariableName ?? "unknown input"}");
+						MathMultiply multiplyR = new MathMultiply($"multiplier for R {valueSocket?.Parent.VariableName ?? "unknown input"}");
+						MathMultiply multiplyG = new MathMultiply($"multiplier for G {valueSocket?.Parent.VariableName ?? "unknown input"}");
+						MathMultiply multiplyB = new MathMultiply($"multiplier for B {valueSocket?.Parent.VariableName ?? "unknown input"}");
+						CombineRgbNode combineRgbNode = new CombineRgbNode($"combining the new color values {valueSocket?.Parent.VariableName ?? "unknown input"}");
+
+						sh.AddNode(separateRgbNode);
+						sh.AddNode(multiplyR);
+						sh.AddNode(multiplyG);
+						sh.AddNode(multiplyB);
+						sh.AddNode(combineRgbNode);
+
+						multiplyR.UseClamp = false;
+						multiplyG.UseClamp = false;
+						multiplyB.UseClamp = false;
+
+						multiplyR.ins.Value1.Value = amount;
+						multiplyG.ins.Value1.Value = amount;
+						multiplyB.ins.Value1.Value = amount;
+
+						mixerNode.outs.Color.Connect(separateRgbNode.ins.Image);
+
+						separateRgbNode.outs.R.Connect(multiplyR.ins.Value2);
+						separateRgbNode.outs.G.Connect(multiplyG.ins.Value2);
+						separateRgbNode.outs.B.Connect(multiplyB.ins.Value2);
+
+						multiplyR.outs.Value.Connect(combineRgbNode.ins.R);
+						multiplyG.outs.Value.Connect(combineRgbNode.ins.G);
+						multiplyB.outs.Value.Connect(combineRgbNode.ins.B);
+
+						combineRgbNode.outs.Image.Connect(sock);
+
+					}
 				}
 				return imtexnode;
 			}


Improved shuffle performance for big playlists massively

--- Espera/Espera.Core/Management/Playlist.cs
+++ Espera/Espera.Core/Management/Playlist.cs
@@ -234,31 +234,40 @@

         internal void Shuffle()
         {
-            int count = this.playlist.Count;
+            List<PlaylistEntry> newplaylist = this.playlist.ToList();
+            int? newCurrentIndex = null;
             var random = new Random();

-            for (int index = 0; index < count; index++)
-            {
-                int newIndex = random.Next(count);
-
-                PlaylistEntry temp = this.playlist[index];
-
-                this.playlist[newIndex].Index = index;
-                this.playlist[index] = this.playlist[newIndex];
+            for (int index = 0; index < newplaylist.Count; index++)
+            {
+                int newIndex = random.Next(newplaylist.Count);
+
+                PlaylistEntry temp = newplaylist[index];
+
+                newplaylist[newIndex].Index = index;
+                newplaylist[index] = newplaylist[newIndex];

                 temp.Index = newIndex;
-                this.playlist[newIndex] = temp;
+                newplaylist[newIndex] = temp;

                 // Migrate the CurrentSongIndex to the new position
                 if (index == this.CurrentSongIndex)
                 {
-                    this.CurrentSongIndex = newIndex;
+                    newCurrentIndex = newIndex;
                 }

                 else if (newIndex == this.CurrentSongIndex)
                 {
-                    this.CurrentSongIndex = index;
+                    newCurrentIndex = index;
                 }
+            }
+
+            this.playlist.Clear();
+            this.playlist.AddRange(newplaylist);
+
+            if (newCurrentIndex.HasValue)
+            {
+                this.CurrentSongIndex = newCurrentIndex;
             }
         }


Fixes switched capture output and capture error output

--- FlubuCore/Tasks/Process/RunProgramTask.cs
+++ FlubuCore/Tasks/Process/RunProgramTask.cs
@@ -151,7 +151,7 @@
                     if (!_doNotLogOutput)
                         DoLogInfo(l);

-                    if (_captureOutput)
+                    if (_captureErrorOutput)
                         _errorOutput.AppendLine(l);
                 })
                 .OnOutputLine(l =>
@@ -159,7 +159,7 @@
                     if (!_doNotLogOutput)
                         DoLogInfo(l);

-                    if (_captureErrorOutput)
+                    if (_captureOutput)
                         _output.AppendLine(l);
                 });


Fixed changing rows for a sprite not changing its render dimensions.

--- Framework/Rendering/Assets/SpriteSheet.cs
+++ Framework/Rendering/Assets/SpriteSheet.cs
@@ -68,7 +68,7 @@

                 if (this.Set(ref this._rows, value)) {
                     this._spriteIndexToLocation.Clear();
-                    this.ResetColumnWidth();
+                    this.ResetRowHeight();
                 }
             }
         }


changed parameter order

changed parameter order

--- GameOverlay/Graphics/D2DDevice.cs
+++ GameOverlay/Graphics/D2DDevice.cs
@@ -533,28 +533,28 @@

         #region Primitives

-        public void DrawCircle(Primitives.Circle circle, ID2DBrush brush, float stroke)
+        public void DrawCircle(Primitives.Circle circle, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawEllipse(circle, brush.GetBrush(), stroke);
         }

-        public void DrawCircle(float x, float y, float radius, ID2DBrush brush, float stroke)
+        public void DrawCircle(float x, float y, float radius, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawEllipse(new Ellipse(new RawVector2(x, y), radius, radius), brush.GetBrush(), stroke);
         }

-        public void DrawDashedCircle(Primitives.Circle circle, ID2DBrush brush, float stroke)
+        public void DrawDashedCircle(Primitives.Circle circle, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawEllipse(circle, brush.GetBrush(), stroke, _sharedStrokeStyle);
         }

-        public void DrawDashedCircle(float x, float y, float radius, ID2DBrush brush, float stroke)
+        public void DrawDashedCircle(float x, float y, float radius, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -575,28 +575,28 @@
             _device.FillEllipse(new Ellipse(new RawVector2(x, y), radius, radius), brush.GetBrush());
         }

-        public void DrawEllipse(Primitives.Ellipse ellipse, ID2DBrush brush, float stroke)
+        public void DrawEllipse(Primitives.Ellipse ellipse, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawEllipse(ellipse, brush.GetBrush(), stroke);
         }

-        public void DrawEllipse(float x, float y, float radius_x, float radius_y, ID2DBrush brush, float stroke)
+        public void DrawEllipse(float x, float y, float radius_x, float radius_y, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawEllipse(new Ellipse(new RawVector2(x, y), radius_x, radius_y), brush.GetBrush(), stroke);
         }

-        public void DrawDashedEllipse(Primitives.Ellipse ellipse, ID2DBrush brush, float stroke)
+        public void DrawDashedEllipse(Primitives.Ellipse ellipse, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawEllipse(ellipse, brush.GetBrush(), stroke, _sharedStrokeStyle);
         }

-        public void DrawDashedEllipse(float x, float y, float radius_x, float radius_y, ID2DBrush brush, float stroke)
+        public void DrawDashedEllipse(float x, float y, float radius_x, float radius_y, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -617,56 +617,56 @@
             _device.FillEllipse(new Ellipse(new RawVector2(x, y), radius_x, radius_y), brush.GetBrush());
         }

-        public void DrawLine(Primitives.Line line, ID2DBrush brush, float stroke)
+        public void DrawLine(Primitives.Line line, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawLine(line.Start, line.End, brush.GetBrush(), stroke);
         }

-        public void DrawLine(float start_x, float start_y, float end_x, float end_y, ID2DBrush brush, float stroke)
+        public void DrawLine(float start_x, float start_y, float end_x, float end_y, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawLine(new RawVector2(start_x, start_y), new RawVector2(end_x, end_y), brush.GetBrush(), stroke);
         }

-        public void DrawDashedLine(Primitives.Line line, ID2DBrush brush, float stroke)
+        public void DrawDashedLine(Primitives.Line line, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawLine(line.Start, line.End, brush.GetBrush(), stroke, _sharedStrokeStyle);
         }

-        public void DrawDashedLine(float start_x, float start_y, float end_x, float end_y, ID2DBrush brush, float stroke)
+        public void DrawDashedLine(float start_x, float start_y, float end_x, float end_y, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawLine(new RawVector2(start_x, start_y), new RawVector2(end_x, end_y), brush.GetBrush(), stroke, _sharedStrokeStyle);
         }

-        public void DrawRectangle(Primitives.Rectangle rectangle, ID2DBrush brush, float stroke)
+        public void DrawRectangle(Primitives.Rectangle rectangle, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawRectangle(rectangle, brush.GetBrush(), stroke);
         }

-        public void DrawRectangle(float left, float top, float right, float bottom, ID2DBrush brush, float stroke)
+        public void DrawRectangle(float left, float top, float right, float bottom, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawRectangle(new RawRectangleF(left, top, right, bottom), brush.GetBrush(), stroke);
         }

-        public void DrawDashedRectangle(Primitives.Rectangle rectangle, ID2DBrush brush, float stroke)
+        public void DrawDashedRectangle(Primitives.Rectangle rectangle, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawRectangle(rectangle, brush.GetBrush(), stroke, _sharedStrokeStyle);
         }

-        public void DrawDashedRectangle(float left, float top, float right, float bottom, ID2DBrush brush, float stroke)
+        public void DrawDashedRectangle(float left, float top, float right, float bottom, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -687,14 +687,14 @@
             _device.FillRectangle(new RawRectangleF(left, top, right, bottom), brush.GetBrush());
         }

-        public void DrawRoundedRectangle(Primitives.RoundedRectangle rectangle, ID2DBrush brush, float stroke)
+        public void DrawRoundedRectangle(Primitives.RoundedRectangle rectangle, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

             _device.DrawRoundedRectangle(rectangle, brush.GetBrush(), stroke);
         }

-        public void DrawRoundedRectangle(float left, float top, float right, float bottom, float radius_x, float radius_y, ID2DBrush brush, float stroke)
+        public void DrawRoundedRectangle(float left, float top, float right, float bottom, float radius_x, float radius_y, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -714,7 +714,7 @@
             _device.DrawRoundedRectangle(rectangle, brush.GetBrush(), stroke, _sharedStrokeStyle);
         }

-        public void DrawDashedRoundedRectangle(float left, float top, float right, float bottom, float radius_x, float radius_y, ID2DBrush brush, float stroke)
+        public void DrawDashedRoundedRectangle(float left, float top, float right, float bottom, float radius_x, float radius_y, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -789,7 +789,7 @@
             geometry.Dispose();
         }

-        public void DrawDashedTriangle(Primitives.Triangle triangle, ID2DBrush brush, float stroke)
+        public void DrawDashedTriangle(Primitives.Triangle triangle, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -810,7 +810,7 @@
             geometry.Dispose();
         }

-        public void DrawDashedTriangle(float a_x, float a_y, float b_x, float b_y, float c_x, float c_y, ID2DBrush brush, float stroke)
+        public void DrawDashedTriangle(float a_x, float a_y, float b_x, float b_y, float c_x, float c_y, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -877,7 +877,7 @@

         #region Outline

-        public void OutlineLine(Primitives.Line line, ID2DBrush brush, ID2DBrush outline, float stroke)
+        public void OutlineLine(Primitives.Line line, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -902,7 +902,7 @@
             geometry.Dispose();
         }

-        public void OutlineLine(float start_x, float start_y, float end_x, float end_y, ID2DBrush brush, ID2DBrush outline, float stroke)
+        public void OutlineLine(float start_x, float start_y, float end_x, float end_y, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -927,12 +927,12 @@
             geometry.Dispose();
         }

-        public void OutlineCircle(Primitives.Circle circle, ID2DBrush brush, float stroke, ID2DBrush outline)
-        {
-            OutlineCircle(circle.Location.X, circle.Location.Y, circle.Radius, brush, stroke, outline);
-        }
-
-        public void OutlineCircle(float x, float y, float radius, ID2DBrush brush, float stroke, ID2DBrush outline)
+        public void OutlineCircle(Primitives.Circle circle, float stroke, ID2DBrush brush, ID2DBrush outline)
+        {
+            OutlineCircle(circle.Location.X, circle.Location.Y, circle.Radius, stroke, brush, outline);
+        }
+
+        public void OutlineCircle(float x, float y, float radius, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             var ellipse = new Ellipse(new RawVector2(x, y), radius, radius);

@@ -951,12 +951,12 @@
             _device.DrawEllipse(ellipse, outline.GetBrush(), half);
         }

-        public void OutlineRectangle(Primitives.Rectangle rectangle , ID2DBrush brush, float stroke, ID2DBrush outline)
-        {
-            OutlineRectangle(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom, brush, stroke, outline);
-        }
-
-        public void OutlineRectangle(float left, float top, float right, float bottom, ID2DBrush brush, float stroke, ID2DBrush outline)
+        public void OutlineRectangle(Primitives.Rectangle rectangle , float stroke, ID2DBrush brush, ID2DBrush outline)
+        {
+            OutlineRectangle(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom, stroke, brush, outline);
+        }
+
+        public void OutlineRectangle(float left, float top, float right, float bottom, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             float half = stroke / 2.0f;

@@ -970,7 +970,7 @@
             _device.DrawRectangle(new RawRectangleF(left, top, width, height), brush.GetBrush(), half);
         }

-        public void OutlineFillCircle(Primitives.Circle circle, ID2DBrush brush, ID2DBrush outline, float stroke)
+        public void OutlineFillCircle(Primitives.Circle circle, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -992,7 +992,7 @@
             ellipseGeometry.Dispose();
         }

-        public void OutlineFillCircle(float x, float y, float radius, ID2DBrush brush, ID2DBrush outline, float stroke)
+        public void OutlineFillCircle(float x, float y, float radius, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1014,7 +1014,7 @@
             ellipseGeometry.Dispose();
         }

-        public void OutlineFillRectangle(Primitives.Rectangle rectangle, ID2DBrush brush, ID2DBrush outline, float stroke)
+        public void OutlineFillRectangle(Primitives.Rectangle rectangle, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1037,7 +1037,7 @@
             rectangleGeometry.Dispose();
         }

-        public void OutlineFillRectangle(float left, float top, float right, float bottom, ID2DBrush brush, ID2DBrush outline, float stroke)
+        public void OutlineFillRectangle(float left, float top, float right, float bottom, float stroke, ID2DBrush brush, ID2DBrush outline)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1064,7 +1064,7 @@

         #region Special

-        public void DrawBarH(Primitives.Rectangle rectangle, float percentage, ID2DBrush outline, ID2DBrush fill, float stroke)
+        public void DrawBarH(Primitives.Rectangle rectangle, float percentage, float stroke, ID2DBrush outline, ID2DBrush fill)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1088,7 +1088,7 @@
             _device.FillRectangle(rect, fill.GetBrush());
         }

-        public void DrawBarH(float left, float top, float right, float bottom, float percentage, ID2DBrush outline, ID2DBrush fill, float stroke)
+        public void DrawBarH(float left, float top, float right, float bottom, float percentage, float stroke, ID2DBrush outline, ID2DBrush fill)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1112,7 +1112,7 @@
             _device.FillRectangle(rect, fill.GetBrush());
         }

-        public void DrawBarV(Primitives.Rectangle rectangle, float percentage, ID2DBrush outline, ID2DBrush fill, float stroke)
+        public void DrawBarV(Primitives.Rectangle rectangle, float percentage, float stroke, ID2DBrush outline, ID2DBrush fill)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1136,7 +1136,7 @@
             _device.FillRectangle(rect, fill.GetBrush());
         }

-        public void DrawBarV(float left, float top, float right, float bottom, float percentage, ID2DBrush outline, ID2DBrush fill, float stroke)
+        public void DrawBarV(float left, float top, float right, float bottom, float percentage, float stroke, ID2DBrush outline, ID2DBrush fill)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1160,7 +1160,7 @@
             _device.FillRectangle(rect, fill.GetBrush());
         }

-        public void DrawCrosshair(CrosshairStyle style, Primitives.Point location, float size, ID2DBrush brush, float stroke)
+        public void DrawCrosshair(CrosshairStyle style, Primitives.Point location, float size, float stroke, ID2DBrush brush)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1170,32 +1170,32 @@
             }
             else if (style == CrosshairStyle.Plus)
             {
-                DrawLine(location.X - size, location.Y, location.X + size, location.Y, brush, stroke);
-                DrawLine(location.X, location.Y - size, location.X, location.Y + size, brush, stroke);
+                DrawLine(location.X - size, location.Y, location.X + size, location.Y, stroke, brush);
+                DrawLine(location.X, location.Y - size, location.X, location.Y + size, stroke, brush);
             }
             else if (style == CrosshairStyle.Cross)
             {
-                DrawLine(location.X - size, location.Y - size, location.X + size, location.Y + size, brush, stroke);
-                DrawLine(location.X + size, location.Y - size, location.X - size, location.Y + size, brush, stroke);
+                DrawLine(location.X - size, location.Y - size, location.X + size, location.Y + size, stroke, brush);
+                DrawLine(location.X + size, location.Y - size, location.X - size, location.Y + size, stroke, brush);
             }
             else if (style == CrosshairStyle.Gap)
             {
-                DrawLine(location.X - size - stroke, location.Y, location.X - stroke, location.Y, brush, stroke);
-                DrawLine(location.X + size + stroke, location.Y, location.X + stroke, location.Y, brush, stroke);
-
-                DrawLine(location.X, location.Y - size - stroke, location.X, location.Y - stroke, brush, stroke);
-                DrawLine(location.X, location.Y + size + stroke, location.X, location.Y + stroke, brush, stroke);
+                DrawLine(location.X - size - stroke, location.Y, location.X - stroke, location.Y, stroke, brush);
+                DrawLine(location.X + size + stroke, location.Y, location.X + stroke, location.Y, stroke, brush);
+
+                DrawLine(location.X, location.Y - size - stroke, location.X, location.Y - stroke, stroke, brush);
+                DrawLine(location.X, location.Y + size + stroke, location.X, location.Y + stroke, stroke, brush);
             }
             else if (style == CrosshairStyle.Diagonal)
             {
-                DrawLine(location.X - size, location.Y - size, location.X + size, location.Y + size, brush, stroke);
-                DrawLine(location.X + size, location.Y - size, location.X - size, location.Y + size, brush, stroke);
+                DrawLine(location.X - size, location.Y - size, location.X + size, location.Y + size, stroke, brush);
+                DrawLine(location.X + size, location.Y - size, location.X - size, location.Y + size, stroke, brush);
             }
         }

-        public void DrawCrosshair(CrosshairStyle style, float x, float y, float size, ID2DBrush brush, float stroke)
-        {
-            DrawCrosshair(style, new Primitives.Point(x, y), size, brush, stroke);
+        public void DrawCrosshair(CrosshairStyle style, float x, float y, float size, float stroke, ID2DBrush brush)
+        {
+            DrawCrosshair(style, new Primitives.Point(x, y), size, stroke, brush);
         }

         public void DrawArrowLine(Primitives.Point start, Primitives.Point end, float size, ID2DBrush brush)
@@ -1232,12 +1232,12 @@
             FillTriangle(start_x, start_y, xm, ym, xn, yn, brush);
         }

-        public void DrawBox2D(Primitives.Rectangle rectangle, ID2DBrush outline, float stroke, ID2DBrush fill)
-        {
-            DrawBox2D(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom, outline, stroke, fill);
-        }
-
-        public void DrawBox2D(float left, float top, float right, float bottom, ID2DBrush outline, float stroke, ID2DBrush fill)
+        public void DrawBox2D(Primitives.Rectangle rectangle, float stroke, ID2DBrush outline, ID2DBrush fill)
+        {
+            DrawBox2D(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom, stroke, outline, fill);
+        }
+
+        public void DrawBox2D(float left, float top, float right, float bottom, float stroke, ID2DBrush outline, ID2DBrush fill)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1264,12 +1264,12 @@
             geometry.Dispose();
         }

-        public void DrawRectangleEdges(Primitives.Rectangle rectangle, ID2DBrush brush, float stroke)
-        {
-            DrawRectangleEdges(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom, brush, stroke);
-        }
-
-        public void DrawRectangleEdges(float left, float top, float right, float bottom, ID2DBrush brush, float stroke)
+        public void DrawRectangleEdges(Primitives.Rectangle rectangle, float stroke, ID2DBrush brush)
+        {
+            DrawRectangleEdges(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom, stroke, brush);
+        }
+
+        public void DrawRectangleEdges(float left, float top, float right, float bottom, float stroke, ID2DBrush brush)
         {
             float width = right - left;
             float height = bottom - top;
@@ -1449,7 +1449,7 @@
             _device.DrawBitmap(bmp, new RawRectangleF(location.X, location.Y, location.X + bitmap.PixelSize.Width, location.Y + bitmap.PixelSize.Height), opacity, BitmapInterpolationMode.Linear);
         }

-        public void DrawImage(D2DImage bmp, float x, float y, float opacity)
+        public void DrawImage(D2DImage bmp, float x, float y, float opacity = 1.0f)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1457,7 +1457,7 @@
             _device.DrawBitmap(bmp, new RawRectangleF(x, y, x + bitmap.PixelSize.Width, y + bitmap.PixelSize.Height), opacity, BitmapInterpolationMode.Linear);
         }

-        public void DrawImage(D2DImage bmp, Primitives.Rectangle rectangle, float opacity)
+        public void DrawImage(D2DImage bmp, Primitives.Rectangle rectangle, float opacity = 1.0f)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");

@@ -1465,7 +1465,7 @@
             _device.DrawBitmap(bmp, rectangle, opacity, BitmapInterpolationMode.Linear, new RawRectangleF(0, 0, bitmap.PixelSize.Width, bitmap.PixelSize.Height));
         }

-        public void DrawImage(D2DImage bmp, float x, float y, float width, float height, float opacity)
+        public void DrawImage(D2DImage bmp, float x, float y, float width, float height, float opacity = 1.0f)
         {
             if (!IsDrawing) throw new InvalidOperationException("Use BeginScene before drawing any primitives!");


Bugfix for bad "pacman" arc generation on breaktabs

When generating the unit vector between the two arcs on breaktab generation if the arc centers share the same location then no line segment exists between them and a unit vector of (0.00,0.00) is generated.  This results in bad end angles and therefore bad arcs.  The fix for this is to use the line segment between start and end points instead in this special case.

This bug is mostly seen on horizontal breaktabs on rectangular boards spaced at 2mm (double the drillradius default of 1) but is suppressed in many cases due to floating point rounding errors giving slightly different centers.

--- GerberLibrary/Core/GerberPanel.cs
+++ GerberLibrary/Core/GerberPanel.cs
@@ -1102,8 +1102,10 @@

                 var C1 = PStart + StartNorm * drillradius;
                 var C2 = PEnd + EndNorm * drillradius;
-
-                var DF = C2 - C1;
+
+                //if centers are at the same location then the linesegment between them does not exist.  This results in a generating a bad unit vector and
+                //therfore bad angles and bad arcs.  If the centers are at the same location use the linesgment between the start and end points instead.
+                var DF = (C1 != C2) ? C2 - C1 : PEnd - PStart;
                 DF.Normalize();
                 var DR = DF.Rotate(90);


Change Fetch

Change Fetch

--- GitMind/Git/Private/GitService.cs
+++ GitMind/Git/Private/GitService.cs
@@ -146,55 +146,10 @@
 		}

-
+
 		public async Task FetchAsync(string workingFolder)
 		{
-			Log.Debug("Fetching .... ");
-			CancellationTokenSource cts = new CancellationTokenSource(FetchTimeout);
-			bool result = false;
-			try
-			{
-				result = await Task.Run(() =>
-				{
-					try
-					{
-						using (GitRepository gitRepository = GitRepository.Open(workingFolder))
-						{
-							Log.Debug("Before fetch");
-							gitRepository.Fetch();
-							Log.Debug("After fetch");
-						}
-
-						Log.Debug("Fetched repository");
-						return true;
-					}
-					catch (Exception e)
-					{
-						if (e.Message == "Unsupported URL protocol")
-						{
-							Log.Warn("Unsupported URL protocol");
-							return false;
-						}
-						else
-						{
-							Log.Warn($"Failed to fetch, {e.Message}");
-							return true;
-						}
-					}
-				})
-				.WithCancellation(cts.Token);
-			}
-			catch (Exception e)
-			{
-				Log.Warn($"Failed to fetch {e}");
-				result = false;
-			}
-
-			Log.Debug("Done fetching");
-			if (!result)
-			{
-				Log.Warn("Failed to fetch");
-			}
+			await DoAsync(workingFolder, FetchTimeout, repo => repo.Fetch());
 		}

@@ -990,7 +945,7 @@
 		{
 			return Task.Run(() =>
 			{
-				Log.Debug($"Start {memberName} in {workingFolder} ...");
+				Log.Debug($"{memberName} in {workingFolder} ...");
 				try
 				{
 					using (GitRepository gitRepository = GitRepository.Open(workingFolder))
@@ -1006,10 +961,53 @@
 				}
 				catch (Exception e)
 				{
+					Log.Warn($"Failed to {memberName} in {workingFolder}, {e.Message}");
 					return Error.From(e, $"Failed to {memberName} in {workingFolder}, {e.Message}");
 				}
 			});
 		}
+
+		private static Task<R> DoAsync(
+			string workingFolder,
+			TimeSpan timeout,
+			Action<GitRepository> doAction,
+			[CallerMemberName] string memberName = "")
+		{
+			CancellationTokenSource cts = new CancellationTokenSource(timeout);
+
+			try
+			{
+				return Task.Run(() =>
+				{
+					Log.Debug($"{memberName} in {workingFolder} ...");
+					try
+					{
+						using (GitRepository gitRepository = GitRepository.Open(workingFolder))
+						{
+							doAction(gitRepository);
+
+							Log.Debug($"Done {memberName} in {workingFolder}");
+
+							return R.Ok;
+						}
+					}
+					catch (Exception e)
+					{
+						Log.Warn($"Failed to {memberName} in {workingFolder}, {e.Message}");
+						return Error.From(e, $"Failed to {memberName} in {workingFolder}, {e.Message}");
+					}
+				},
+				cts.Token)
+				.WithCancellation(cts.Token);
+			}
+			catch (OperationCanceledException e)
+			{
+				Log.Warn($"Timeout for {memberName} in {workingFolder}, {e.Message}");
+				Error error = Error.From(e, $"Failed to {memberName} in {workingFolder}, {e.Message}");
+				return Task.FromResult(new R(error));
+			}
+		}
+

 		private static Task<R<T>> DoAsync<T>(
 			string workingFolder,
@@ -1018,7 +1016,7 @@
 		{
 			return Task.Run(async () =>
 			{
-				Log.Debug($"Start {memberName} in {workingFolder} ...");
+				Log.Debug($"{memberName} in {workingFolder} ...");
 				try
 				{
 					using (GitRepository gitRepository = GitRepository.Open(workingFolder))
@@ -1034,6 +1032,7 @@
 				}
 				catch (Exception e)
 				{
+					Log.Warn($"Failed to {memberName} in {workingFolder}, {e.Message}");
 					return Error.From(e, $"Failed to {memberName} in {workingFolder}, {e.Message}");
 				}
 			});


Simplify string construction logic

Simplify string construction logic

--- osu.Game/Rulesets/Mods/Mod.cs
+++ osu.Game/Rulesets/Mods/Mod.cs
@@ -60,8 +60,9 @@
         {
             get
             {
-                string settingDescription = string.IsNullOrEmpty(SettingDescription) ? string.Empty : $" ({SettingDescription})";
-                return $"{Name}{settingDescription}";
+                string description = SettingDescription;
+
+                return string.IsNullOrEmpty(description) ? Name : $"{Name} ({description})";
             }
         }

@@ -81,13 +82,14 @@
                 foreach ((SettingSourceAttribute attr, PropertyInfo property) in this.GetOrderedSettingsSourceProperties())
                 {
                     object bindableObj = property.GetValue(this);
-                    bool? settingIsDefault = (bindableObj as IHasDefaultValue)?.IsDefault;
-                    string tooltipText = settingIsDefault == true ? string.Empty : attr.Label + " " + bindableObj;
-                    tooltipTexts.Add(tooltipText);
+
+                    if ((bindableObj as IHasDefaultValue)?.IsDefault == true)
+                        continue;
+
+                    tooltipTexts.Add($"{attr.Label} {bindableObj}");
                 }

-                string joinedTooltipText = string.Join(", ", tooltipTexts.Where(s => !string.IsNullOrEmpty(s)));
-                return $"{joinedTooltipText}";
+                return string.Join(", ", tooltipTexts.Where(s => !string.IsNullOrEmpty(s)));
             }
         }


Update when_honjo_is_used.cs

Update when_honjo_is_used.cs

--- Honjo.Tests/when_honjo_is_used.cs
+++ Honjo.Tests/when_honjo_is_used.cs
@@ -2,8 +2,6 @@
 using System.Collections.Generic;
 using HonjoLib;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-//http://odetocode.com/articles/80.aspx

 namespace Honjo.Tests
 {
@@ -407,4 +405,4 @@
             testSetUp.Honjo.Test(testSetUp, false);
         }
     }
-}+}


improve variable table name lookup ...

improve variable table name lookup ...

--- HydroData.admin/Helpers/Helper.cs
+++ HydroData.admin/Helpers/Helper.cs
@@ -96,7 +96,7 @@

 	public static string GetRouteVar(int vid)
 	{
-		return Helper.Vars[vid].TableName;
+		return Helper.Vars[vid].TableName.Substring(Helper.Vars[vid].TableName.IndexOf(".") + 1);
 	}

 	public static VariableInfo FindVarByName(string varname)


Fix #24: Only subscribe to Invalid URI messages once

--- InteractApp/EventInfoPage.xaml.cs
+++ InteractApp/EventInfoPage.xaml.cs
@@ -1,9 +1,13 @@
 using Xamarin.Forms;
+using Android.Support.Design.Widget;
+using Java.Security.Cert;

 namespace InteractApp
 {
 	public partial class EventInfoPage : ContentPage
 	{
+		private static bool _subscribed = false;
+
 		readonly EventInfoPageViewModel _viewModel;

 		public EventInfoPageViewModel ViewModel {
@@ -25,9 +29,12 @@
 				Command = new Command (ViewModel.RSVP),
 			});

-			MessagingCenter.Subscribe<EventInfoPageViewModel> (this, "Invalid URI", (sender) => {
-				DisplayAlert ("Oops", "Invalid URI. Either you can't RSVP to this, or we screwed up. If you believe we screwed up, please contact Interact.", "YESSIR");
-			});
+			if (!_subscribed) {
+				MessagingCenter.Subscribe<EventInfoPageViewModel> (this, "Invalid URI", (sender) => {
+					DisplayAlert ("Oops", "Invalid URI. Either you can't RSVP to this, or we screwed up. If you believe we screwed up, please contact Interact.", "YESSIR");
+				});
+				_subscribed = true;
+			}
 		}
 	}
 }


Add IF.Host process in job object earlier

Add IF Host in job object before
checking if the process outputs OK.
This will prevent zombie IronFrame.Host
processes if they fail to start and don't
get automatically terminated.

--- IronFrame/ContainerHostService.cs
+++ IronFrame/ContainerHostService.cs
@@ -76,18 +76,18 @@
                 Credentials = credentials,
             };

-            var hostProcess = processRunner.Run(hostRunSpec);
-
-            WaitForProcessToStart(hostProcess, HostProcessStartTimeout);
-
             // Order here is important.
-            // - Start the process and verify that it's running
+            // - Start the process
             // - Add the process to the job object
+            // - Verify that the process is healthy
             // - Start the RPC message pump
             //
             // We need to ensure that the host process cannot create any new processes before
             // it's added to the job object.
+
+            var hostProcess = processRunner.Run(hostRunSpec);
             jobObject.AssignProcessToJob(hostProcess.Handle);
+            WaitForProcessToStart(hostProcess, HostProcessStartTimeout);

             var messageTransport = MessageTransport.Create(hostProcess.StandardOutput, hostProcess.StandardInput);
             var messagingClient = MessagingClient.Create(async message =>


faster jasilytimeout

faster jasilytimeout

--- Jasily/Threading/JasilyTimeout.cs
+++ Jasily/Threading/JasilyTimeout.cs
@@ -11,6 +11,7 @@
     public class JasilyTimeout
     {
         private readonly uint created;
+        private readonly uint timeout;

         private JasilyTimeout(int origin)
         {
@@ -18,6 +19,7 @@

             this.Value = origin;
             this.created = CurrentTickCount;
+            this.timeout = (uint)origin + this.created;
         }

         /// <summary>
@@ -30,7 +32,7 @@
         /// <summary>
         /// 返回从 JasilyTimeout 构造开始到当前的毫秒时间
         /// </summary>
-        public uint TimeOffset => CurrentTickCount - this.created;
+        public uint TimeOffset => (uint)Environment.TickCount - this.created; // 为了性能，不调用 CurrentTickCount 了

         /// <summary>
         /// 剩下的时间
@@ -44,7 +46,7 @@
             }
         }

-        public bool IsTimeout => this.TimeOffset >= this.Value;
+        public bool IsTimeout => (uint)Environment.TickCount >= this.timeout; // 为了性能，不调用 CurrentTickCount 了

         public static implicit operator JasilyTimeout(int milliseconds)
         {


Dev (#202)

Dev (#202)

* Make keyword constants readonly

* Fix readme typo (#198)

--- source/TSQLLint.Core/Constants.cs
+++ source/TSQLLint.Core/Constants.cs
@@ -227,9 +227,9 @@
             "XML"
         };

-        public static HashSet<string> TSqlKeywords = new HashSet<string>(_TSqlKeywords);
-
-        public static HashSet<string> TSqlDataTypes = new HashSet<string>(_TSqlDataTypes);
+        public static readonly HashSet<string> TSqlKeywords = new HashSet<string>(_TSqlKeywords);
+
+        public static readonly HashSet<string> TSqlDataTypes = new HashSet<string>(_TSqlDataTypes);

         public static int TabWidth => 4;


Apply artificial radiation sources after Gamma Transparency is applied (#455)

* Apply artificial radiation sources after Gamma Transparency is applied
* Update CHANGELOG.md

--- src/Kerbalism/Radiation.cs
+++ src/Kerbalism/Radiation.cs
@@ -626,8 +626,7 @@
 			// add extern radiation
 			radiation += PreferencesStorm.Instance.ExternRadiation;

-			// add emitter radiation
-			radiation += Emitter.Total(v);
+

 			// if there is a storm in progress
 			if (Storm.InProgress(v))
@@ -637,13 +636,19 @@
 				if (magnetosphere) blackout = true;
 				else radiation += PreferencesStorm.Instance.StormRadiation * sunlight;
 			}
-
+
+			// apply gamma transparency if inside atmosphere
+			radiation *= gamma_transparency
+
+			// add emitter radiation after atmosphere transparency
+			radiation += Emitter.Total(v);
+
 			// clamp radiation to positive range
 			// note: we avoid radiation going to zero by using a small positive value
 			radiation = Math.Max(radiation, Nominal);

-			// return radiation, scaled by gamma transparency if inside atmosphere
-			return radiation * gamma_transparency;
+			// return radiation
+			return radiation;
 		}


Add a Stop method to timeout.  Maybe it should be renamed though, since you cant restart it.

--- src/Manos/Manos/Timeout.cs
+++ src/Manos/Manos/Timeout.cs
@@ -43,6 +43,8 @@
 		internal object data;
 		internal TimeoutCallback callback;

+		private bool stopped;
+
 		public Timeout (TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback) : this (TimeSpan.Zero, span, repeat,data, callback)
 		{
 		}
@@ -64,6 +66,9 @@
 		/// </param>
 		public void Run (ManosApp app)
 		{
+			if (stopped)
+				return;
+
 			try {
 				callback (app, data);
 			} catch (Exception e) {
@@ -73,13 +78,21 @@

 			repeat.RepeatPerformed ();
 		}
-
+
+		/// <summary>
+		/// Stop the current timeout from further execution.  Once a timeout is stopped it can not be restarted
+		/// </summary>
+		public void Stop ()
+		{
+			stopped = true;
+		}
+
 		/// <summary>
 		/// Inidicates that the IOLoop should retain this timeout, because it will be run again at some point in the future. Infrastructure.
 		/// </summary>
 		public bool ShouldContinueToRepeat ()
 		{
-			return repeat.ShouldContinueToRepeat ();
+			return !stopped || repeat.ShouldContinueToRepeat ();
 		}
 	}
 }


Work on robot software - #13

Work on robot software - #13

--- src/MindstormR.EV3/Main.cs
+++ src/MindstormR.EV3/Main.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Diagnostics;
 using MonoBrickFirmware;
 using MonoBrickFirmware.Display.Dialogs;
 using MonoBrickFirmware.Display;
@@ -16,21 +17,47 @@
         {
             try
             {
-                string url = "http://test.henkmollema.nl/robot/login";
-                WebClient client = new WebClient();
-                string s = client.DownloadString(url);
+                const string baseUrl = "http://test.henkmollema.nl/robot/";
+
+                var sw = Stopwatch.StartNew();
+                var client = new WebClient();
+                string s = client.DownloadString(baseUrl + "login");
+                sw.Stop();
+
                 if (!int.TryParse(s, out _id))
                 {
-                    new InfoDialog(string.Format("Invalid ID from the webserver: '{0}'.", s), true, "Error").Show();
+                    Info("Invalid ID from the webserver: '{0}'. ({1:n2}s)", true, "Error", s, sw.Elapsed.TotalSeconds);
                     return;
                 }

-                new InfoDialog("Robot id: " + _id, true).Show();
+                Info("Robot logged in. ID: {0}. ({1:n2}s)", _id, sw.Elapsed.TotalSeconds);
+                for (int i = 0; i < 5; i++)
+                {
+                    sw.Restart();
+                    string data = client.DownloadString(baseUrl + 1020 + "/command");
+                    sw.Stop();
+                    Info("Command from robot 1020: '{0}'. ({1:n2})", data, sw.Elapsed.TotalSeconds);
+                }
             }
             catch (Exception ex)
             {
                 string msg = ex.Message;
             }
         }
+
+        private static void Info(string format, params object[] arg)
+        {
+            new InfoDialog(string.Format(format, arg), true).Show();
+        }
+
+        private static void Info(string format, bool waitForOk, params object[] arg)
+        {
+            new InfoDialog(string.Format(format, arg), waitForOk).Show();
+        }
+
+        private static void Info(string format, bool waitForOk, string title, params object[] arg)
+        {
+            new InfoDialog(string.Format(format, arg), waitForOk, title).Show();
+        }
     }
 }


Max StackTraceUsage should be computed using bitwise OR (#4965)

--- src/NLog/Layouts/Layout.cs
+++ src/NLog/Layouts/Layout.cs
@@ -377,7 +377,7 @@

             // determine the max StackTraceUsage, to decide if Logger needs to capture callsite
             StackTraceUsage = StackTraceUsage.None;    // In case this Layout should implement IUsesStackTrace
-            StackTraceUsage = objectGraphScannerList.OfType<IUsesStackTrace>().DefaultIfEmpty().Max(item => item?.StackTraceUsage ?? StackTraceUsage.None);
+            StackTraceUsage = objectGraphScannerList.OfType<IUsesStackTrace>().DefaultIfEmpty().Aggregate(StackTraceUsage.None, (usage, item) => usage | item?.StackTraceUsage ?? StackTraceUsage.None);

             _scannedForObjects = true;
         }


Escape the content of CDATA

Escape the content of CDATA

Fixes #164

--- src/nunit-gui/Xml2RtfConverter.cs
+++ src/nunit-gui/Xml2RtfConverter.cs
@@ -82,7 +82,12 @@
         {
             sb.Append(string.Format(@"\cf{0}<![CDATA[\par ", (int)ColorKinds.CData));
             var cdataLines = cdata.Value.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
-            sb.Append(string.Join(@"\par", cdataLines));
+            var res = new List<string>(cdataLines.Length);
+            foreach (var cdataLine in cdataLines)
+            {
+                res.Add(XmlEncode(cdataLine));
+            }
+            sb.Append(string.Join(@"\par", res.ToArray()));
             sb.Append(@"\par]]>\par");
         }


Fix UpdateLiffAppAsync error

Fix UpdateLiffAppAsync error

--- Line.Messaging/Liff/LiffClient.cs
+++ Line.Messaging/Liff/LiffClient.cs
@@ -70,7 +70,7 @@
         public async Task UpdateLiffAppAsync(string liffId, ViewType viewType, string url)
         {
             var request = new HttpRequestMessage(HttpMethod.Put, $"{_requestUri}/{liffId}/view");
-            var content = JsonConvert.SerializeObject(new { view = new View(viewType, url) }, _jsonSerializerSettings);
+            var content = JsonConvert.SerializeObject(new { type = viewType, url }, _jsonSerializerSettings);
             request.Content = new StringContent(content, Encoding.UTF8, "application/json");

             var response = await _client.SendAsync(request);


+Constructor to make new vertex from existing vertex

--- MapParse/MapParse/Types/Vertex.cs
+++ MapParse/MapParse/Types/Vertex.cs
@@ -14,12 +14,10 @@
 			this.Tex = new float[2];
 		}

-		public static Vertex Create()
+		public Vertex(Vertex v)
 		{
-			Vertex v;
-			v.P = new Vec3();
-			v.Tex = new float[2];
-			return v;
+			this.P = v.P;
+			this.Tex = v.Tex;
 		}
 	}
 }


WmsProvider: rewriting request to 'Task<Stream> GetStreamAsync(string url)'

--- Mapsui.Desktop/Wms/WmsProvider.cs
+++ Mapsui.Desktop/Wms/WmsProvider.cs
@@ -24,6 +24,7 @@
 using System.Linq;
 using System.Net;
 using System.Text;
+using System.Threading.Tasks;
 using System.Xml;
 using Mapsui.Geometries;
 using Mapsui.Rendering;
@@ -307,14 +308,15 @@
                 return false;
             }

-            var uri = new Uri(GetRequestUrl(viewport.Extent, width, height));
+            var url = GetRequestUrl(viewport.Extent, width, height);

             try
             {
-                using (var dataStream = GetDataStream(uri))
+                using (var task = GetStreamAsync(url))
                 {
+                    var responseStream = task.Result;
                     // PDD: This could be more efficient
-                    byte[] bytes = BruTile.Utilities.ReadFully(dataStream);
+                    byte[] bytes = BruTile.Utilities.ReadFully(responseStream);
                     raster = new Raster(new MemoryStream(bytes), viewport.Extent);
                 }
                 return true;
@@ -336,16 +338,26 @@
             return false;
         }

-        private Stream GetDataStream(Uri uri)
-        {
-            var webRequest = WebRequest.Create(uri);
-            webRequest.Method = GetPreferredMethod().Type;
-            webRequest.Timeout = TimeOut;
-            webRequest.Credentials = Credentials ?? CredentialCache.DefaultCredentials;
-            using (var webResponse = (HttpWebResponse) webRequest.GetResponse())
-            {
-                return webResponse.GetResponseStream();
-            }
+        private Task<Stream> GetStreamAsync(string url)
+        {
+            var source = new TaskCompletionSource<Stream>();
+
+            try
+            {
+                var webRequest = WebRequest.Create(url);
+                webRequest.Method = GetPreferredMethod().Type;
+                webRequest.Timeout = TimeOut;
+                webRequest.Credentials = Credentials ?? CredentialCache.DefaultCredentials;
+                using (var webResponse = (HttpWebResponse)webRequest.GetResponse())
+                {
+                    source.SetResult(webResponse.GetResponseStream());
+                }
+            }
+            catch (Exception ex)
+            {
+                source.SetException(ex);
+            }
+            return source.Task;
         }

         /// <summary>


Skip null values when serializing resources

Undefined values should not be part of a request.
Only the endpoint is allowed to send undefined (i.e., null) values.

--- MessageBird/Resources/Messages.cs
+++ MessageBird/Resources/Messages.cs
@@ -73,7 +73,9 @@

         public string Serialize()
         {
-            return JsonConvert.SerializeObject(Message);
+            JsonSerializerSettings settings = new JsonSerializerSettings();
+            settings.NullValueHandling = NullValueHandling.Ignore;
+            return JsonConvert.SerializeObject(Message, settings);
         }
     }
 }


Support maximize/minimize on caption area

When a user double clicks the caption area the form window state should toggle
between either maximized or normal.

--- MetroFramework/Forms/MetroForm.cs
+++ MetroFramework/Forms/MetroForm.cs
@@ -14,7 +14,7 @@

 namespace MetroFramework.Forms
 {
-    public class MetroForm : Form, IMetroForm
+    public class MetroForm : Form, IMetroForm, IMessageFilter
     {
         #region Interface

@@ -538,5 +538,40 @@
         }

         #endregion
+
+        #region IMessageFilter
+        public bool PreFilterMessage(ref Message m)
+        {
+            switch (m.Msg)
+            {
+                // Double clicking in the top area should result in either form maximize or
+                // returning back to normal size.
+                case (int)WinApi.Messages.WM_LBUTTONDBLCLK:
+
+                    // Get handle for current control clicked.
+                    Control target = FromHandle(m.HWnd);
+
+                    // Only valid when target is main form itself.
+                    if (target != null && target.Handle != Handle)
+                    {
+                        return false;
+                    }
+
+                    // Mouse x/y coords.
+                    var click = new Point((Int16)m.LParam, (Int16)((int)m.LParam >> 16));
+
+                    // Handle window state change if within bounds of click,
+                    // which is a hardcoded limit of 50 pixels top down.
+                    if (click.Y <= 50)
+                    {
+                        WindowState = WindowState == FormWindowState.Maximized ? FormWindowState.Normal : FormWindowState.Maximized;
+                    }
+
+                    break;
+            }
+            return false;
+        }
+        #endregion
+
     }
 }


Fixed the render to correctly support array initializers for all primitive types

--- src/SME.CPP/RenderState.cs
+++ src/SME.CPP/RenderState.cs
@@ -326,7 +326,7 @@
 						var cpptype = TypeScope.GetType(n);

 						string values;
-                        if (new[] { typeof(sbyte), typeof(byte), typeof(ushort), typeof(short), typeof(int) }.Select(x => eltype.Module.Import(x).Resolve()).Contains(eltype.Resolve()))
+                        if (new[] { typeof(sbyte), typeof(byte), typeof(ushort), typeof(short), typeof(int), typeof(uint), typeof(long), typeof(ulong) }.Select(x => eltype.Module.Import(x).Resolve()).Contains(eltype.Resolve()))
                             values = string.Join(", ", arc.Initializer.Elements.Select(x => string.Format("{0}", x)));
                         else
                             throw new Exception("Unexpected initializer type");
@@ -340,7 +340,7 @@
 						var cpptype = TypeScope.GetType(n);

 						string values;
-						if (new[] { typeof(sbyte), typeof(byte), typeof(ushort), typeof(short), typeof(int) }.Select(x => eltype.Module.Import(x).Resolve()).Contains(eltype.Resolve()))
+                        if (new[] { typeof(sbyte), typeof(byte), typeof(ushort), typeof(short), typeof(int), typeof(uint), typeof(long), typeof(ulong) }.Select(x => eltype.Module.Import(x).Resolve()).Contains(eltype.Resolve()))
                             values = string.Join(", ", arc.ElementExpressions.Select(x => Renderer.RenderExpression(x)));
 						else
 							throw new Exception("Unexpected initializer type");


expand on comment

expand on comment

git-svn-id: ee144a4ada4e65570a65b3ba2a4ac9d4eedc8fa4@1609005 13f79535-47bb-0310-9956-ffa450edef68

--- dotnet/assemblies/NPanday.Utils/src/main/csharp/SettingsUtil.cs
+++ dotnet/assemblies/NPanday.Utils/src/main/csharp/SettingsUtil.cs
@@ -595,7 +595,7 @@
                     {
                         id = "*";
                     }
-                    // TODO: support '!' syntax
+                    // TODO: support '!' syntax, or comma separated lists (above requires external to be first)
                     mirrors.Add(id, mirror.url);
                 }
             }


use local time from clock for timestamp

use local time from clock for timestamp

--- Src/Metrics/Reporters/Reporter.cs
+++ Src/Metrics/Reporters/Reporter.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading;
+using Metrics.Utils;

 namespace Metrics.Reporters
 {
@@ -17,7 +18,7 @@
         public void RunReport(MetricsRegistry registry, HealthChecksRegistry healthChecks, CancellationToken token)
         {
             this.token = token;
-            this.Timestamp = DateTime.Now;
+            this.Timestamp = Clock.Default.LocalDateTime;
             this.RegistryName = registry.Name;

             StartReport();


emit refs at defs

emit refs at defs

--- Srclib.Nuget/Graph/GraphRunner.cs
+++ Srclib.Nuget/Graph/GraphRunner.cs
@@ -222,7 +222,21 @@

         var symbol = _sm.GetSymbolInfo(node);
         if (symbol.Symbol == null)
+        {
+          // it might be a declaration
+          var declaration = _sm.GetDeclaredSymbol(node);
+          if (_defined.Contains(declaration))
+          {
+            var reference = Ref.To(declaration)
+              .At(_path, token.Span);
+
+            reference.Def = true;
+
+            _output.Refs.Add(reference);
+          }
+
           goto skip;
+        }

         var definition = symbol.Symbol.OriginalDefinition;
         if (_defined.Contains(definition))


very raw prototype for links on external refs

--- Srclib.Nuget/Graph/GraphRunner.cs
+++ Srclib.Nuget/Graph/GraphRunner.cs
@@ -14,8 +14,38 @@
 using System.Xml.Linq;
 using Srclib.Nuget.Documentation;

+using Newtonsoft.Json;
+
 namespace Srclib.Nuget.Graph
 {
+
+    class Wrap
+    {
+        [JsonProperty]
+        public string version;
+
+        [JsonProperty]
+        public Framework frameworks;
+    }
+
+    class Framework
+    {
+        [JsonProperty]
+        public Net451 net451;
+    }
+
+    class Net451
+    {
+        [JsonProperty]
+        public Bin bin;
+    }
+
+    class Bin
+    {
+        [JsonProperty]
+        public string assembly;
+    }
+
   /// <summary>
   /// C# syntax walker that produces graph output.
   /// </summary>
@@ -81,6 +111,13 @@
           //_output.Defs.Add(def);
           def.External = true;
           var reference = Ref.To(definition).At(file, token.Span);
+          if (definition.ContainingAssembly.Identity.Name.Equals("TestLibrary"))
+          {
+            reference.DefRepo = "github.com/ildarisaev/TestLib";
+            reference.DefUnit = "TestLibrary";
+            reference.DefUnitType = "NugetPackage";
+            //Console.Error.WriteLine("setting a link to external project");
+          }
           _output.Refs.Add(reference);
         }
       }
@@ -117,6 +154,10 @@
       context.Export = context.LibraryExporter.GetExport(context.Project.Name);

       //If other languages are to be supported, this part needs to change.
+      if (!(context.Export.MetadataReferences[0] is IRoslynMetadataReference))
+      {
+        return new Output();
+      }
       var roslynRef = (IRoslynMetadataReference)context.Export.MetadataReferences[0];
       var compilationRef = (CompilationReference)roslynRef.MetadataReference;
       var csCompilation = (CSharpCompilation)compilationRef.Compilation;
@@ -138,13 +179,34 @@
                 PortableExecutableReference r = null;
                 try
                 {
-                    string path = ld.Path + "/" + DepresolveConsoleCommand.GetDll(ld.Path);
+                    //Console.Error.WriteLine("ld.Path=" + ld.Path);
+                    string path = "";
+                    if (ld.Path.EndsWith("project.json") && (ld.Path.IndexOf("wrap") != -1))
+                    {
+                        //Console.Error.WriteLine("178");
+                        if (File.Exists(ld.Path))
+                        {
+                            //Console.Error.WriteLine("181");
+                            var content = File.ReadAllText(ld.Path);
+                            //Console.Error.WriteLine("183");
+                            var spec = JsonConvert.DeserializeObject<Wrap>(content);
+                            //Console.Error.WriteLine("185");
+                            //Console.Error.WriteLine("assembly=" + spec.frameworks.net451.bin.assembly);
+                            path = ld.Path.Substring(0, ld.Path.Length - 12) + spec.frameworks.net451.bin.assembly;
+                        }
+                    }
+                    else
+                    {
+                        path = ld.Path + "/" + DepresolveConsoleCommand.GetDll(ld.Path);
+                    }
                     //Console.Error.WriteLine("trying to add reference to " + path);
                     r = MetadataReference.CreateFromFile(path);
                 }
                 catch (Exception e)
                 {
                     //Console.Error.WriteLine("caught exception");
+                    //Console.Error.WriteLine(e.Message);
+                    //Console.Error.WriteLine(e.StackTrace);
                     try
                     {
                         string name = ld.Identity.Name;
@@ -157,6 +219,8 @@
                     catch (Exception ee)
                     {
                         //Console.Error.WriteLine("caught exception");
+                        //Console.Error.WriteLine(e.Message);
+                        //Console.Error.WriteLine(e.StackTrace);
                     }
                 }
                 if (r != null)
@@ -548,6 +612,22 @@
         }

         var definition = symbol.Symbol.OriginalDefinition;
+        /*if (definition != null)
+        {
+          Console.Error.WriteLine("definition=" + definition.ToString());
+          if (definition.IsExported())
+          {
+            if (definition.ContainingAssembly != null)
+            {
+              Console.Error.WriteLine("assembly=" + definition.ContainingAssembly.ToString());
+              Console.Error.WriteLine("name=" + definition.ContainingAssembly.Identity.Name);
+            }
+            if (definition.ContainingModule != null)
+            {
+              Console.Error.WriteLine("module=" + definition.ContainingModule.ToString());
+            }
+          }
+        }*/
         _refs.Add(Tuple.Create(token, definition, _path));
       }


task.delay isn't very reliable when cpu is under heavy load.. increase the timeouts.

--- test/Foundatio.Tests/Utility/ScheduledTimerTests.cs
+++ test/Foundatio.Tests/Utility/ScheduledTimerTests.cs
@@ -67,7 +67,7 @@
                 resetEvent.Set();
                 return Task.FromResult<DateTime?>(null);
             };
-
+
             using (var timer = new ScheduledTimer(callback, minimumIntervalTime: TimeSpan.FromMilliseconds(100), loggerFactory: Log)) {
                 timer.ScheduleNext();
                 await Task.Delay(1);
@@ -78,11 +78,11 @@
                 await resetEvent.WaitAsync(new CancellationTokenSource(100).Token);
                 Assert.Equal(1, hits);

-                await resetEvent.WaitAsync(new CancellationTokenSource(150).Token);
+                await resetEvent.WaitAsync(new CancellationTokenSource(2000).Token);
                 Assert.Equal(2, hits);

                 Assert.Throws<TaskCanceledException>(() => { resetEvent.Wait(new CancellationTokenSource(50).Token); });
-                await resetEvent.WaitAsync(new CancellationTokenSource(500).Token);
+                await resetEvent.WaitAsync(new CancellationTokenSource(2000).Token);
                 Assert.Equal(3, hits);
             }
         }


- Fix the ErrorActionResult

- Fix the ErrorActionResult

--- Nop.Plugin.Api/JSON/ActionResults/ErrorActionResult.cs
+++ Nop.Plugin.Api/JSON/ActionResults/ErrorActionResult.cs
@@ -1,11 +1,15 @@
 using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;

 namespace Nop.Plugin.Api.JSON.ActionResults
 {
+    using System;
+    using System.IO;
+    using System.Text;
+    using Microsoft.AspNetCore.Http;
+    using Microsoft.AspNetCore.WebUtilities;
+
     public class ErrorActionResult : IActionResult
     {
         private readonly string _jsonString;
@@ -19,10 +23,20 @@

         public Task ExecuteResultAsync(ActionContext context)
         {
-            var content = new StringContent(_jsonString);
-            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
-            var response = new HttpResponseMessage(_statusCode) { Content = content };
-            return Task.FromResult(response);
+            if (context == null)
+                throw new ArgumentNullException(nameof(context));
+
+            HttpResponse response = context.HttpContext.Response;
+
+            response.StatusCode = (int)_statusCode;
+            response.ContentType = "application/json";
+
+            using (TextWriter writer = new HttpResponseStreamWriter(response.Body, Encoding.UTF8))
+            {
+                writer.Write(_jsonString);
+            }
+
+            return Task.CompletedTask;
         }
     }
 }