yayayya

yayayya

--- TextDuck/Controllers/HomeController.cs
+++ TextDuck/Controllers/HomeController.cs
@@ -5,7 +5,6 @@
 using System.Text;
 using System.Web;
 using System.Web.Mvc;
-using System.Web.UI.WebControls;
 using TextDuck.DAL;
 using TextDuck.Models;
 using TextDuck.UF;
@@ -266,8 +265,8 @@

             return File(Encoding.UTF8.GetBytes(statusinn), "Apllication/octet-stream", string.Format("{0}.srt", id));
         }
-
-
+
+
         [Authorize]
         public ActionResult RequestMoved(int Id)
         {
@@ -359,5 +358,7 @@
             return View("Index");
         }

+
+
     }
 }


Fix the sample app following previous changes.

--- ThinMvvm.WindowsPhone.SampleApp/App.cs
+++ ThinMvvm.WindowsPhone.SampleApp/App.cs
@@ -8,6 +8,8 @@
 {
     public sealed class App : AppBase
     {
+        private readonly IWindowsPhoneNavigationService _navigationService;
+
         protected override string Language
         {
             get { return AppResources.ResourceLanguage; }
@@ -21,21 +23,21 @@

         public App()
         {
-            Container.Bind<IWindowsPhoneNavigationService, WindowsPhoneNavigationService>();
+            _navigationService = Container.Bind<IWindowsPhoneNavigationService, WindowsPhoneNavigationService>();
             Container.Bind<ISettingsStorage, WindowsPhoneSettingsStorage>();

             Container.Bind<ISettings, Settings>();
         }

-        protected override void Start( AppDependencies dependencies, AppArguments arguments )
+        protected override void Start( AppArguments arguments )
         {
             // simple app, no additional dependencies or arguments

-            dependencies.NavigationService.Bind<MainViewModel>( "/Views/MainView.xaml" );
-            dependencies.NavigationService.Bind<AboutViewModel>( "/Views/AboutView.xaml" );
+            _navigationService.Bind<MainViewModel>( "/Views/MainView.xaml" );
+            _navigationService.Bind<AboutViewModel>( "/Views/AboutView.xaml" );

-            dependencies.NavigationService.NavigateTo<MainViewModel, int>( 42 );
+            _navigationService.NavigateTo<MainViewModel, int>( 42 );
         }
     }
 }


A toggle on MouseInput to self-destruct on mobile platforms.

--- TouchScript/InputSources/MouseInput.cs
+++ TouchScript/InputSources/MouseInput.cs
@@ -12,6 +12,13 @@
     [AddComponentMenu("TouchScript/Input Sources/Mouse Input")]
     public class MouseInput : InputSource
     {
+
+        #region Public properties
+
+        public bool DestroyOnMobileDevices = true;
+
+        #endregion
+
         #region Private variables

         private int mousePointId = -1;
@@ -25,12 +32,17 @@
         /// <inheritdoc />
         protected override void Start()
         {
-            switch (Application.platform)
+            if (DestroyOnMobileDevices)
             {
-                case RuntimePlatform.Android:
-                case RuntimePlatform.IPhonePlayer:
-                    Destroy(this);
-                    return;
+                switch (Application.platform)
+                {
+                    case RuntimePlatform.Android:
+                    case RuntimePlatform.IPhonePlayer:
+                    case RuntimePlatform.WP8Player:
+                        // don't need mouse here
+                        Destroy(this);
+                        return;
+                }
             }
             base.Start();
         }


hugely improve compression efficiency (per: pjtr)

--- Trigrad/DataTypes/TrigradCompressed.cs
+++ Trigrad/DataTypes/TrigradCompressed.cs
@@ -2,6 +2,7 @@
 using System.Drawing;
 using System.IO;
 using System.IO.Compression;
+using System.Linq;
 using System.Security.Cryptography.X509Certificates;
 using TriangleNet;

@@ -52,33 +53,27 @@
                 Dictionary<Point, ushort> pointIndex = new Dictionary<Point, ushort>();

                 ushort colors = reader.ReadUInt16();
-
-                byte[] reds = new byte[colors];
-                byte[] greens = new byte[colors];
-                byte[] blues = new byte[colors];
-
+                List<byte> r = new List<byte>();
+                List<byte> g = new List<byte>();
+                List<byte> b = new List<byte>();
+                for (int i = 0; i < colors; i++) r.Add(reader.ReadByte());
+                for (int i = 0; i < colors; i++) g.Add(reader.ReadByte());
+                for (int i = 0; i < colors; i++) b.Add(reader.ReadByte());
                 for (int i = 0; i < colors; i++)
                 {
-                    reds[i] = reader.ReadByte();
-                }
-                for (int i = 0; i < colors; i++)
-                {
-                    greens[i] = reader.ReadByte();
-                }
-                for (int i = 0; i < colors; i++)
-                {
-                    blues[i] = reader.ReadByte();
-                }
-
-                for (int i = 0; i < colors; i++)
-                {
-                    colorIndex.Add(Color.FromArgb(reds[i], greens[i], blues[i]));
+                    colorIndex.Add(Color.FromArgb(r[i], g[i], b[i]));
                 }
                 uint points = reader.ReadUInt32();
+                List<ushort> x = new List<ushort>();
+                List<ushort> y = new List<ushort>();
+                List<ushort> c = new List<ushort>();
+                for (int i = 0; i < points; i++) x.Add(reader.ReadUInt16());
+                for (int i = 0; i < points; i++) y.Add(reader.ReadUInt16());
+                for (int i = 0; i < points; i++) c.Add(reader.ReadUInt16());
                 for (int i = 0; i < points; i++)
                 {
-                    Point p = new Point(reader.ReadUInt16(), reader.ReadUInt16());
-                    ushort index = reader.ReadUInt16();
+                    Point p = new Point(x[i], y[i]);
+                    ushort index = c[i];
                     pointIndex.Add(p, index);
                 }

@@ -102,7 +97,7 @@
                 List<Color> colorIndex = new List<Color>();
                 Dictionary<Point, ushort> pointIndex = new Dictionary<Point, ushort>();

-                foreach (var pair in SampleTable)
+                foreach (var pair in SampleTable.OrderBy(kvp => kvp.Value.ToArgb()))
                 {
                     if (colorIndex.Contains(pair.Value))
                     {
@@ -114,6 +109,9 @@
                         pointIndex.Add(pair.Key, (ushort)(colorIndex.Count - 1));
                     }
                 }
+
+                System.Console.WriteLine("{0} {1}", colorIndex.Count, pointIndex.Count);
+                System.Console.WriteLine("{0} {1}", colorIndex.Count * 3, pointIndex.Count * 3 * 2);

                 writer.Write((ushort)colorIndex.Count);

@@ -129,21 +127,36 @@
                 {
                     writer.Write(color.B);
                 }
+                var colorEnd = s.Position;
+

                 writer.Write((uint)pointIndex.Count);

-                foreach (var pair in pointIndex)
+                //var sorted = pointIndex;
+                //var sorted = pointIndex.OrderBy(kvp => kvp.Value).ToArray();
+                var sorted = pointIndex.OrderBy(kvp => kvp.Key.X * ushort.MaxValue + kvp.Key.Y).ToArray();
+                foreach (var pair in sorted)
                 {
                     writer.Write((ushort)pair.Key.X);
+                }
+                foreach (var pair in sorted)
+                {
                     writer.Write((ushort)pair.Key.Y);
+                }
+                var xyEnd = s.Position;

+
+                foreach (var pair in sorted)
+                {
                     writer.Write(pair.Value);
-
                 }
-
+                var indexEnd = s.Position;
+                System.Console.WriteLine("Colors: {0}", colorEnd);
+                System.Console.WriteLine("XY: {0}", xyEnd - colorEnd);
+                System.Console.WriteLine("Index: {0}", indexEnd - xyEnd);

                 writer.Flush();
             }
         }
     }
-}
+}


Fix Android manifest updater bug.

Fix Android manifest updater bug.

--- VersionUpdater/VersionUpdateHandler.cs
+++ VersionUpdater/VersionUpdateHandler.cs
@@ -12,6 +12,11 @@
 	public class VersionUpdateHandler
 		: CommandHandler
 	{
+		protected override void Update (CommandInfo info)
+		{
+			base.Update (info);
+		}
+
 		protected override void Run ()
 		{
 			var solutions = IdeApp
@@ -112,7 +117,7 @@
 							.Single ();
 						var buildIndex = manifestLines.IndexOf (buildLine);
 						var buildElement = manifestLines [buildIndex];
-						buildElement = Regex.Replace (buildString, buildMatch, nextBuildString);
+						buildElement = Regex.Replace (buildElement, buildMatch, nextBuildString);
 						manifestLines [buildIndex] = buildElement;

 						File.WriteAllLines (manifest.FilePath, manifestLines.ToArray ());


Remove long unused UntrustedWebRequest class

This purports to check web requests but doesn't appear to actually do that.

--- OpenSim/Framework/UntrustedWebRequest.cs
+++ OpenSim/Framework/UntrustedWebRequest.cs
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Text;
-using log4net;
-
-namespace OpenSim.Framework
-{
-    /// <summary>
-    /// Used for requests to untrusted endpoints that may potentially be
-    /// malicious
-    /// </summary>
-    public static class UntrustedHttpWebRequest
-    {
-        /// <summary>Setting this to true will allow HTTP connections to localhost</summary>
-        private const bool DEBUG = true;
-
-        private static readonly ILog m_log =
-                LogManager.GetLogger(
-                System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
-        private static readonly ICollection<string> allowableSchemes = new List<string> { "http", "https" };
-
-        /// <summary>
-        /// Creates an HttpWebRequest that is hardened against malicious
-        /// endpoints after ensuring the given Uri is safe to retrieve
-        /// </summary>
-        /// <param name="uri">Web location to request</param>
-        /// <returns>A hardened HttpWebRequest if the uri was determined to be safe</returns>
-        /// <exception cref="ArgumentNullException">If uri is null</exception>
-        /// <exception cref="ArgumentException">If uri is unsafe</exception>
-        public static HttpWebRequest Create(Uri uri)
-        {
-            return Create(uri, DEBUG, 1000 * 5, 1000 * 20, 10);
-        }
-
-        /// <summary>
-        /// Creates an HttpWebRequest that is hardened against malicious
-        /// endpoints after ensuring the given Uri is safe to retrieve
-        /// </summary>
-        /// <param name="uri">Web location to request</param>
-        /// <param name="allowLoopback">True to allow connections to localhost, otherwise false</param>
-        /// <param name="readWriteTimeoutMS">Read write timeout, in milliseconds</param>
-        /// <param name="timeoutMS">Connection timeout, in milliseconds</param>
-        /// <param name="maximumRedirects">Maximum number of allowed redirects</param>
-        /// <returns>A hardened HttpWebRequest if the uri was determined to be safe</returns>
-        /// <exception cref="ArgumentNullException">If uri is null</exception>
-        /// <exception cref="ArgumentException">If uri is unsafe</exception>
-        public static HttpWebRequest Create(Uri uri, bool allowLoopback, int readWriteTimeoutMS, int timeoutMS, int maximumRedirects)
-        {
-            if (uri == null)
-                throw new ArgumentNullException("uri");
-
-            if (!IsUriAllowable(uri, allowLoopback))
-                throw new ArgumentException("Uri " + uri + " was rejected");
-
-            HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(uri);
-            httpWebRequest.MaximumAutomaticRedirections = maximumRedirects;
-            httpWebRequest.ReadWriteTimeout = readWriteTimeoutMS;
-            httpWebRequest.Timeout = timeoutMS;
-            httpWebRequest.KeepAlive = false;
-
-            return httpWebRequest;
-        }
-
-        public static string PostToUntrustedUrl(Uri url, string data)
-        {
-            try
-            {
-                byte[] requestData = System.Text.Encoding.UTF8.GetBytes(data);
-
-                HttpWebRequest request = Create(url);
-                request.Method = "POST";
-                request.ContentLength = requestData.Length;
-                request.ContentType = "application/x-www-form-urlencoded";
-
-                using (Stream requestStream = request.GetRequestStream())
-                    requestStream.Write(requestData, 0, requestData.Length);
-
-                using (WebResponse response = request.GetResponse())
-                {
-                    using (Stream responseStream = response.GetResponseStream())
-                        return responseStream.GetStreamString();
-                }
-            }
-            catch (Exception ex)
-            {
-                m_log.Warn("POST to untrusted URL " + url + " failed: " + ex.Message);
-                return null;
-            }
-        }
-
-        public static string GetUntrustedUrl(Uri url)
-        {
-            try
-            {
-                HttpWebRequest request = Create(url);
-
-                using (WebResponse response = request.GetResponse())
-                {
-                    using (Stream responseStream = response.GetResponseStream())
-                        return responseStream.GetStreamString();
-                }
-            }
-            catch (Exception ex)
-            {
-                m_log.Warn("GET from untrusted URL " + url + " failed: " + ex.Message);
-                return null;
-            }
-        }
-
-        /// <summary>
-        /// Determines whether a URI is allowed based on scheme and host name.
-        /// No requireSSL check is done here
-        /// </summary>
-        /// <param name="allowLoopback">True to allow loopback addresses to be used</param>
-        /// <param name="uri">The URI to test for whether it should be allowed.</param>
-        /// <returns>
-        ///     <c>true</c> if [is URI allowable] [the specified URI]; otherwise, <c>false</c>.
-        /// </returns>
-        private static bool IsUriAllowable(Uri uri, bool allowLoopback)
-        {
-            if (!allowableSchemes.Contains(uri.Scheme))
-            {
-                m_log.WarnFormat("Rejecting URL {0} because it uses a disallowed scheme.", uri);
-                return false;
-            }
-
-            // Try to interpret the hostname as an IP address so we can test for internal
-            // IP address ranges.  Note that IP addresses can appear in many forms
-            // (e.g. http://127.0.0.1, http://2130706433, http://0x0100007f, http://::1
-            // So we convert them to a canonical IPAddress instance, and test for all
-            // non-routable IP ranges: 10.*.*.*, 127.*.*.*, ::1
-            // Note that Uri.IsLoopback is very unreliable, not catching many of these variants.
-            IPAddress hostIPAddress;
-            if (IPAddress.TryParse(uri.DnsSafeHost, out hostIPAddress))
-            {
-                byte[] addressBytes = hostIPAddress.GetAddressBytes();
-
-                // The host is actually an IP address.
-                switch (hostIPAddress.AddressFamily)
-                {
-                    case System.Net.Sockets.AddressFamily.InterNetwork:
-                        if (!allowLoopback && (addressBytes[0] == 127 || addressBytes[0] == 10))
-                        {
-                            m_log.WarnFormat("Rejecting URL {0} because it is a loopback address.", uri);
-                            return false;
-                        }
-                        break;
-                    case System.Net.Sockets.AddressFamily.InterNetworkV6:
-                        if (!allowLoopback && IsIPv6Loopback(hostIPAddress))
-                        {
-                            m_log.WarnFormat("Rejecting URL {0} because it is a loopback address.", uri);
-                            return false;
-                        }
-                        break;
-                    default:
-                        m_log.WarnFormat("Rejecting URL {0} because it does not use an IPv4 or IPv6 address.", uri);
-                        return false;
-                }
-            }
-            else
-            {
-                // The host is given by name.  We require names to contain periods to
-                // help make sure it's not an internal address.
-                if (!allowLoopback && !uri.Host.Contains("."))
-                {
-                    m_log.WarnFormat("Rejecting URL {0} because it does not contain a period in the host name.", uri);
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-        /// <summary>
-        /// Determines whether an IP address is the IPv6 equivalent of "localhost/127.0.0.1".
-        /// </summary>
-        /// <param name="ip">The ip address to check.</param>
-        /// <returns>
-        ///     <c>true</c> if this is a loopback IP address; <c>false</c> otherwise.
-        /// </returns>
-        private static bool IsIPv6Loopback(IPAddress ip)
-        {
-            if (ip == null)
-                throw new ArgumentNullException("ip");
-
-            byte[] addressBytes = ip.GetAddressBytes();
-            for (int i = 0; i < addressBytes.Length - 1; i++)
-            {
-                if (addressBytes[i] != 0)
-                    return false;
-            }
-
-            if (addressBytes[addressBytes.Length - 1] != 1)
-                return false;
-
-            return true;
-        }
-    }
-}


Fix bochs and cleanup

Fix bochs and cleanup

--- source/Cosmos.HAL2/BlockDevice/ATAPI.cs
+++ source/Cosmos.HAL2/BlockDevice/ATAPI.cs
@@ -1,10 +1,11 @@
-using System;
+using Cosmos.Core;
+using Cosmos.HAL.BlockDevice;
+using System;
 using System.Collections.Generic;
-using Cosmos.Core;
 using static Cosmos.HAL.BlockDevice.Ata;
 using static Cosmos.HAL.BlockDevice.AtaPio;

-namespace Cosmos.HAL.BlockDevice
+namespace Cosmos.HALs
 {
     public class ATAPI : BlockDevice
     {
@@ -13,6 +14,7 @@
         public const ushort SectorSize = 2048;
         private bool Primary { get; set; }
         private BusPositionEnum BusPosition { get; set; }
+        private AtaPio device;

         public class PacketCommands
         {
@@ -22,13 +24,14 @@

         public ATAPI(AtaPio parentDevice)
         {
+            device = parentDevice;
             this.BusPosition = parentDevice.BusPosition;
             this.Primary = parentDevice.ControllerID == ControllerIdEnum.Primary;

             mBlockSize = SectorSize;
             IO = new Core.IOGroup.ATA(!Primary);
             var p = BusPosition == BusPositionEnum.Master;
-            Ata.AtaDebugger.Send("ATAPI: Primary controller: "+ this.Primary+" Bus postion: IsMaster: "+ p);
+            Ata.AtaDebugger.Send("ATAPI: Primary controller: " + this.Primary + " Bus postion: IsMaster: " + p);

             Devices.Add(this);
             ATAPIDevices.Add(this);
@@ -50,33 +53,9 @@

             IO.Control.Byte = 0; //Enable IRQs
         }
-
-        public void Test()
-        {
-            Init();
-            var b = new byte[] { 0, 0, 0 };
-            ReadBlock(0, 1, ref b);
-            // PrintBytes(b);
-            Console.WriteLine("press enter for full test");
-            Console.ReadLine();
-            for (ulong i = 10; i < 100; i++)
-            {
-                ReadBlock(i, 1, ref b);
-                PrintBytes(b);
-            }
-        }
-
         private void HandleIRQ(ref INTs.IRQContext aContext)
         {
-            Console.WriteLine("*****RECIVED IRQ*****");
-        }
-
-        public void PrintBytes(byte[] b)
-        {
-            for (int p = 0; p < b.Length - 1; p++)
-            {
-                Console.Write(b[p].ToString() + ",");
-            }
+            Ata.AtaDebugger.Send("ATAPI IRQ");
         }

         public override void ReadBlock(ulong SectorNum, ulong SectorCount, ref byte[] aData)
@@ -103,8 +82,6 @@
             packet[10] = 0;
             packet[11] = 0;

-
-
             var buffer = new ushort[SectorSize / 2]; //Divide by 2 because we are reading words
             SendCmd(packet, SectorSize, ref buffer);

@@ -142,16 +119,20 @@
             //Wait for the select complete
             IO.Wait();

-            Console.WriteLine("[ATAPI] Sending command");
             IO.Features.Byte = 0x00; //PIO Mode
+
+            //Set commmand size
             IO.LBA1.Byte = (byte)((SectorSize) & 0xFF);
             IO.LBA2.Byte = (byte)((SectorSize >> 8) & 0xFF);
-            IO.Command.Byte = (byte)AtaPio.Cmd.Packet;
+
+            //Send ATAPI packet command
+            device.SendCmd(Cmd.Packet);
             Ata.AtaDebugger.Send("ATAPI: Polling");

-            AtaWait(true);
+            Poll(true);
             Ata.AtaDebugger.Send("ATAPI: Polling complete");

+            //Send the command as words
             for (int i = 0; i < AtapiPacket.Length; i++)
             {
                 var b1 = AtapiPacket[i];
@@ -162,6 +143,7 @@

                 i++;
             }
+            Poll(true);
             CheckForErrors();
             var a = (IO.LBA2.Byte << 8);

@@ -178,29 +160,6 @@
             }
         }

-        private void AtaWait(bool drq = false)
-        {
-            //Read status register 4 times
-            var junk = IO.Status.Byte;
-            junk = IO.Status.Byte;
-            junk = IO.Status.Byte;
-            junk = IO.Status.Byte;
-
-
-            while (true)
-            {
-                if ((IO.Status.Byte & (byte)AtaPio.Status.Busy) == 0) break;
-            }
-
-            if (drq)
-            {
-                while (true)
-                {
-                    if ((IO.Status.Byte & (byte)AtaPio.Status.DRQ) != 0) break;
-                }
-            }
-        }
-
         public void Eject()
         {
             ushort[] output = new ushort[12];
@@ -211,7 +170,6 @@
         {
             // 400ns until BSR is set
             IO.Wait();
-            Console.WriteLine("[ATAPI] Polling");

             while (true)
             {
@@ -231,25 +189,21 @@
                     }
                 }
             }
-            Console.WriteLine("[ATAPI] Finished Polling");
         }

         private void CheckForErrors()
         {
             if ((IO.Status.Byte & (byte)AtaPio.Status.Error) != 0)
             {
-                Console.WriteLine("ATA Error");
                 throw new Exception("ATA Error occured!");
             }

             if ((IO.Status.Byte & (byte)AtaPio.Status.ATA_SR_DF) != 0)
             {
-                Console.WriteLine("ATA Device Fault");
                 throw new Exception("ATA device fault encountered!");
             }
             if ((IO.Status.Byte & (byte)AtaPio.Status.DRQ) == 0)
             {
-                Console.WriteLine("ATAPI DRQ not set");
                 //throw new Exception("ATAPI DRQ not set");
             }
         }


Fix parsing repository remote

Fix parsing repository remote

--- source/Nuke.Common/Git/GitRepository.cs
+++ source/Nuke.Common/Git/GitRepository.cs
@@ -85,8 +85,8 @@
                 .TakeWhile(x => !x.StartsWith("["))
                 .Select(x => x.Split('='))
                 .ToDictionary(x => x.ElementAt(0).Trim(), x => x.ElementAt(1).Trim());
-            return data.Count == 2
-                ? (data["remote"], data["merge"].TrimStart("refs/heads/"))
+            return data.TryGetValue("remote", out var remote) && data.TryGetValue("merge", out var merge)
+                ? (remote, merge.TrimStart("refs/heads/"))
                 : (null, null);
         }


Make lock sync now.

Make lock sync now.

--- WalletWasabi/Services/WalletService.cs
+++ WalletWasabi/Services/WalletService.cs
@@ -156,7 +156,7 @@

 			BitcoinStore.IndexStore.NewFilter += IndexDownloader_NewFilterAsync;
 			BitcoinStore.IndexStore.Reorged += IndexDownloader_ReorgedAsync;
-			BitcoinStore.MempoolService.TransactionReceived += Mempool_TransactionReceivedAsync;
+			BitcoinStore.MempoolService.TransactionReceived += Mempool_TransactionReceived;
 		}

 		private void TransactionProcessor_CoinSpent(object sender, SmartCoin spentCoin)
@@ -207,13 +207,13 @@
 			RefreshCoinHistories();
 		}

-		private static AsyncLock TransactionProcessingLock { get; } = new AsyncLock();
-
-		private async void Mempool_TransactionReceivedAsync(object sender, SmartTransaction tx)
+		private static object TransactionProcessingLock { get; } = new object();
+
+		private void Mempool_TransactionReceived(object sender, SmartTransaction tx)
 		{
 			try
 			{
-				using (await TransactionProcessingLock.LockAsync())
+				lock (TransactionProcessingLock)
 				{
 					if (TransactionProcessor.Process(tx))
 					{
@@ -350,7 +350,7 @@
 			{
 				var relevantTransactions = confirmedTransactions.Where(x => x.BlockHash == blockState.BlockHash).ToArray();
 				var block = await FetchBlockAsync(blockState.BlockHash, cancel);
-				await ProcessBlockAsync(blockState.BlockHeight, block, blockState.TransactionIndices, relevantTransactions);
+				ProcessBlock(blockState.BlockHeight, block, blockState.TransactionIndices, relevantTransactions);
 			}

 			// Go through the filters and queue to download the matches.
@@ -368,13 +368,13 @@
 		{
 			try
 			{
-				using (await TransactionProcessingLock.LockAsync())
-				using (var client = new WasabiClient(Synchronizer.WasabiClient.TorClient.DestinationUriAction, Synchronizer.WasabiClient.TorClient.TorSocks5EndPoint))
-				{
-					var compactness = 10;
-
-					var mempoolHashes = await client.GetMempoolHashesAsync(compactness);
-
+				using var client = new WasabiClient(Synchronizer.WasabiClient.TorClient.DestinationUriAction, Synchronizer.WasabiClient.TorClient.TorSocks5EndPoint);
+				var compactness = 10;
+
+				var mempoolHashes = await client.GetMempoolHashesAsync(compactness);
+
+				lock (TransactionProcessingLock)
+				{
 					var count = 0;
 					foreach (var tx in unconfirmedTransactions)
 					{
@@ -420,7 +420,7 @@

 			Block currentBlock = await FetchBlockAsync(filterModel.BlockHash, cancel); // Wait until not downloaded.

-			if (await ProcessBlockAsync(filterModel.BlockHeight, currentBlock))
+			if (ProcessBlock(filterModel.BlockHeight, currentBlock))
 			{
 				SerializeTransactionCache();
 			}
@@ -518,10 +518,10 @@
 			return clusters;
 		}

-		private async Task<bool> ProcessBlockAsync(Height height, Block block, IEnumerable<int> filterByTxIndexes = null, IEnumerable<SmartTransaction> skeletonBlock = null)
+		private bool ProcessBlock(Height height, Block block, IEnumerable<int> filterByTxIndexes = null, IEnumerable<SmartTransaction> skeletonBlock = null)
 		{
 			var ret = false;
-			using (await TransactionProcessingLock.LockAsync())
+			lock (TransactionProcessingLock)
 			{
 				if (filterByTxIndexes is null)
 				{
@@ -1233,7 +1233,7 @@
 				}
 			}

-			using (await TransactionProcessingLock.LockAsync())
+			lock (TransactionProcessingLock)
 			{
 				if (TransactionProcessor.Process(new SmartTransaction(transaction.Transaction, Height.Mempool)))
 				{
@@ -1418,7 +1418,7 @@

 			BitcoinStore.IndexStore.NewFilter -= IndexDownloader_NewFilterAsync;
 			BitcoinStore.IndexStore.Reorged -= IndexDownloader_ReorgedAsync;
-			BitcoinStore.MempoolService.TransactionReceived -= Mempool_TransactionReceivedAsync;
+			BitcoinStore.MempoolService.TransactionReceived -= Mempool_TransactionReceived;
 			Coins.CollectionChanged -= Coins_CollectionChanged;
 			TransactionProcessor.CoinSpent -= TransactionProcessor_CoinSpent;
 			TransactionProcessor.CoinReceived -= TransactionProcessor_CoinReceivedAsync;


Update version to 8.0.0-beta-007

Update version to 8.0.0-beta-007

--- XUnitRemote/Properties/AssemblyInfo.cs
+++ XUnitRemote/Properties/AssemblyInfo.cs
@@ -34,4 +34,4 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("7.99.0.0")]
 [assembly: AssemblyFileVersion("7.99.0.0")]
-[assembly: AssemblyInformationalVersion("8.0.0-beta-006")]
+[assembly: AssemblyInformationalVersion("8.0.0-beta-007")]


Attribution for the logo and icons.

Attribution for the logo and icons.

--- ProxyUnsetter/Properties/AssemblyInfo.cs
+++ ProxyUnsetter/Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 [assembly: AssemblyTitle("ProxyUnsetter")]
-[assembly: AssemblyDescription("Tray application that will unset your proxy.")]
+[assembly: AssemblyDescription("Tray application that will unset your proxy.\n\nLogo and icons adapted from http://icons8.com/")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("THT")]
 [assembly: AssemblyProduct("ProxyUnsetter")]


Regionize code

Regionize code

--- RDFSharp/Query/Mirella/RDFQueryEngine.cs
+++ RDFSharp/Query/Mirella/RDFQueryEngine.cs
@@ -1203,7 +1203,7 @@
             var matchingTriples = new List<RDFTriple>();
             var resultTable = new DataTable();

-            //Manage pattern groundness (exists/notexists filter)
+            #region Ground Pattern
             if (!pattern.Variables.Any())
             {
                 RDFTriple triple = (pattern.Object is RDFResource ? new RDFTriple((RDFResource)pattern.Subject, (RDFResource)pattern.Predicate, (RDFResource)pattern.Object)
@@ -1215,8 +1215,9 @@
                 });
                 return resultTable;
             }
-
-            //Apply the right pattern to the graph
+            #endregion
+
+            #region Non-Ground Pattern
             if (pattern.Subject is RDFResource)
             {
                 if (pattern.Predicate is RDFResource)
@@ -1339,6 +1340,8 @@
                     }
                 }
             }
+            #endregion
+
             return resultTable;
         }

@@ -1350,7 +1353,7 @@
             RDFMemoryStore result = new RDFMemoryStore();
             DataTable resultTable = new DataTable();

-            //Manage pattern groundness (exists/notexists filter)
+            #region GROUND PATTERN
             if (!pattern.Variables.Any())
             {
                 RDFQuadruple quadruple = (pattern.Object is RDFResource ? new RDFQuadruple((RDFContext)pattern.Context, (RDFResource)pattern.Subject, (RDFResource)pattern.Predicate, (RDFResource)pattern.Object)
@@ -1362,7 +1365,9 @@
                 });
                 return resultTable;
             }
-
+            #endregion
+
+            #region NON-GROUND PATTERN
             //CSPO pattern
             if (pattern.Context != null)
             {
@@ -1832,6 +1837,7 @@
                     }
                 }
             }
+            #endregion

             return resultTable;
         }
@@ -1841,19 +1847,19 @@
         /// </summary>
         internal DataTable ApplyPropertyPath(RDFPropertyPath propertyPath, RDFDataSource graphOrStore)
         {
-            var resultTable = new DataTable();
+            DataTable resultTable = new DataTable();

             //Translate property path into equivalent list of patterns
-            var patternList = propertyPath.GetPatternList();
+            List<RDFPattern> patternList = propertyPath.GetPatternList();

             //Evaluate produced list of patterns
-            var patternTables = new List<DataTable>();
+            List<DataTable> patternTables = new List<DataTable>();
             patternList.ForEach(pattern =>
             {

                 //Apply pattern to graph
-                var patternTable = graphOrStore is RDFGraph ? ApplyPattern(pattern, (RDFGraph)graphOrStore) :
-                                                              ApplyPattern(pattern, (RDFStore)graphOrStore);
+                DataTable patternTable = graphOrStore is RDFGraph ? ApplyPattern(pattern, (RDFGraph)graphOrStore) :
+                                                                    ApplyPattern(pattern, (RDFStore)graphOrStore);

                 //Set extended properties
                 patternTable.ExtendedProperties.Add("IsOptional", pattern.IsOptional);
@@ -1868,7 +1874,7 @@
             resultTable = CombineTables(patternTables, false);

             //Remove property path variables
-            var propPathCols = new List<DataColumn>();
+            List<DataColumn> propPathCols = new List<DataColumn>();
             foreach (DataColumn dtCol in resultTable.Columns)
             {
                 if (dtCol.ColumnName.StartsWith("?__PP"))


Delta events fire "soon" after delta triggered

Also pretty much rewrote the whole generation loop.

--- Source/MTW_AncestorSpirits/EventTimer.cs
+++ Source/MTW_AncestorSpirits/EventTimer.cs
@@ -11,15 +11,58 @@
 {
     class EventTimer : IExposable
     {
-        private int ticksUntilNext = 0;
-        private bool canFireDelta = true;
-        private Random _random = null;
+        #region Data Types

         private enum EventType
         {
             positive = 0,
-            negative
+            negative,
+            undecided
         }
+
+        private enum EventCause
+        {
+            delta = 0,
+            timer
+        }
+
+        // Does ScribeRef allow you to just scribe it as a...uh, ref?
+        private class Event : IExposable
+        {
+            public int ttl;
+            public EventType type;
+            public EventCause cause;
+
+            public Event()
+            {
+                this.ttl = (int)AncestorConstants.EVENT_TIMER_TICKS_BETWEEN;
+                this.type = EventType.undecided;
+                this.cause = EventCause.timer;
+            }
+
+            public Event(int ttl, EventType type, EventCause cause)
+            {
+                this.ttl = ttl;
+                this.type = type;
+                this.cause = cause;
+            }
+
+            public void ExposeData()
+            {
+                Scribe_Values.LookValue<int>(ref this.ttl, "ttl", (int)AncestorConstants.EVENT_TIMER_TICKS_BETWEEN);
+                Scribe_Values.LookValue<EventType>(ref this.type, "type", EventType.undecided);
+                Scribe_Values.LookValue<EventCause>(ref this.cause, "cause", EventCause.timer);
+            }
+        }
+
+        #endregion
+
+        #region Vars & Accessors
+
+        private Event nextEvent = null;
+        private Event prevEvent = null;
+        private Random _random = null;
+

         private Random Random
         {
@@ -33,21 +76,50 @@
             }
         }

-        private int TicksToNextEvent()
+        private bool CanScheduleDelta
         {
-            var multiplier = (this.Random.NextDouble() - 0.5) * 2;
-            return (int)(multiplier * AncestorConstants.EVENT_TIMER_TICKS_PLUS_MINUS);
+            get
+            {
+                return (this.nextEvent.cause != EventCause.delta &&
+                    this.prevEvent != null &&
+                    this.prevEvent.cause != EventCause.delta);
+            }
         }

-        private void ScheduleNextEvent()
-        {
-            this.ticksUntilNext = this.TicksToNextEvent();
-        }
+        #endregion

         public EventTimer()
         {
-            this.ticksUntilNext = (int)AncestorConstants.EVENT_TIMER_DAYS_BEFORE_FIRST + this.TicksToNextEvent();
+            int timeToFirst = (int)AncestorConstants.EVENT_TIMER_DAYS_BEFORE_FIRST + this.GenTimerTicks();
+            this.nextEvent = new Event(timeToFirst, EventType.undecided, EventCause.timer);
         }
+
+        #region Event Generation
+
+        private int GenTimerTicks()
+        {
+            var multiplier = (this.Random.NextDouble() - 0.5) * 2;
+            return (int)(multiplier * AncestorConstants.EVENT_TIMER_TICKS_PLUS_MINUS) + (int)AncestorConstants.EVENT_TIMER_TICKS_BETWEEN;
+        }
+
+        private Event GenTimerEvent()
+        {
+            return new Event(this.GenTimerTicks(), EventType.undecided, EventCause.timer);
+        }
+
+        // Generates an event which will fire between 1 and 2 hours from generation time
+        private int GenDeltaTicks()
+        {
+            int ticksInHour = (int)(this.Random.NextDouble() * (double)AncestorConstants.TICKS_PER_HOUR);
+            return ticksInHour + AncestorConstants.TICKS_PER_HOUR;
+        }
+
+        private Event GenDeltaEvent(EventType type)
+        {
+            return new Event(this.GenDeltaTicks(), type, EventCause.delta);
+        }
+
+        #endregion

         private void TryForceIncident(String name)
         {
@@ -57,9 +129,23 @@
             incidentDef.Worker.TryExecute(incidentParams);
         }

-        private void FireEvent(EventType type)
+        private void FireNextEvent(AncestorApproval approval)
         {
-            if (type == EventType.positive)
+            // If undecided, resolve immediately
+            if (this.nextEvent.type == EventType.undecided)
+            {
+                var hourHistoryDelta = approval.HourHistoryDelta();
+                if (hourHistoryDelta >= 0.0)
+                {
+                    this.nextEvent.type = EventType.positive;
+                }
+                else
+                {
+                    this.nextEvent.type = EventType.negative;
+                }
+            }
+
+            if (this.nextEvent.type == EventType.positive)
             {
                 this.TryForceIncident("ResourcePodCrash");
             }
@@ -67,48 +153,36 @@
             {
                 this.TryForceIncident("Flashstorm");
             }
-            this.ScheduleNextEvent();
+
+            this.prevEvent = this.nextEvent;
+            this.nextEvent = this.GenTimerEvent();
         }

         public void UpdateTimer(AncestorApproval approval)
         {
             double intervalDelta = approval.IntervalDelta;
-            this.ticksUntilNext -= AncestorConstants.TICK_INTERVAL;
+            this.nextEvent.ttl -= AncestorConstants.TICK_INTERVAL;

-            // Shouldn't trigger immediately - should schedule for next hour
-            if (this.canFireDelta && approval.IntervalDelta > AncestorConstants.EVENT_TRIGGER_GAIN_INTERVAL_DELTA)
+            if (this.nextEvent.ttl <= 0)
             {
-                Log.Message("Immediate positive event!");
-                this.FireEvent(EventType.positive);
-                this.canFireDelta = false;
+                this.FireNextEvent(approval);
             }
-            else if (this.canFireDelta && approval.IntervalDelta < AncestorConstants.EVENT_TRIGGER_LOSS_INTERVAL_DELTA)
+            else if (approval.IntervalDelta > AncestorConstants.EVENT_TRIGGER_GAIN_INTERVAL_DELTA &&
+                this.CanScheduleDelta)
             {
-                Log.Message("Immediate negative event!");
-                this.FireEvent(EventType.negative);
-                this.canFireDelta = false;
+                this.nextEvent = this.GenDeltaEvent(EventType.positive);
             }
-            else if (this.ticksUntilNext <= 0)
+            else if (approval.IntervalDelta < AncestorConstants.EVENT_TRIGGER_LOSS_INTERVAL_DELTA &&
+                this.CanScheduleDelta)
             {
-                var hourHistoryDelta = approval.HourHistoryDelta();
-                Log.Message("Triggering event - delta = " + hourHistoryDelta);
-                if (hourHistoryDelta >= 0.0)
-                {
-                    this.FireEvent(EventType.positive);
-                }
-                else
-                {
-                    this.FireEvent(EventType.negative);
-                }
-                this.canFireDelta = true;
+                this.nextEvent = this.GenDeltaEvent(EventType.negative);
             }
         }

         public void ExposeData()
         {
-            Scribe_Values.LookValue<int>(ref this.ticksUntilNext, "ticksUntilNext",
-                (int)(AncestorConstants.EVENT_TIMER_DAYS_BEFORE_FIRST * AncestorConstants.EVENT_TIMER_TICKS_BETWEEN));
-            Scribe_Values.LookValue<bool>(ref this.canFireDelta, "canFireDelta", true);
+            Scribe_Deep.LookDeep<Event>(ref this.nextEvent, "nextEvent", new object[0]);
+            Scribe_Deep.LookDeep<Event>(ref this.prevEvent, "prevEvent", new object[0]);
         }
     }
 }


Enable command lookup caching by name and filter

Add a struct to use as a private struct to use as a key for the command
lookup cache.  Also re-enable caching in Helper.GetCommandInfo.

--- Engine/Helper.cs
+++ Engine/Helper.cs
@@ -28,7 +28,7 @@
         private readonly static Version minSupportedPSVersion = new Version(3, 0);
         private Dictionary<string, Dictionary<string, object>> ruleArguments;
         private PSVersionTable psVersionTable;
-        private Dictionary<string, CommandInfo> commandInfoCache;
+        private Dictionary<CommandLookupKey, CommandInfo> commandInfoCache;

         #endregion

@@ -142,7 +142,7 @@
             ruleArguments = new Dictionary<string, Dictionary<string, object>>(StringComparer.OrdinalIgnoreCase);
             if (commandInfoCache == null)
             {
-                commandInfoCache = new Dictionary<string, CommandInfo>(StringComparer.OrdinalIgnoreCase);
+                commandInfoCache = new Dictionary<CommandLookupKey, CommandInfo>();
             }

             IEnumerable<CommandInfo> aliases = this.invokeCommand.GetCommands("*", CommandTypes.Alias, true);
@@ -700,15 +700,16 @@
                 cmdletName = name;
             }

+            var key = new CommandLookupKey(name, commandType);
             lock (getCommandLock)
             {
-                if (commandInfoCache.ContainsKey(cmdletName))
-                {
-                    return commandInfoCache[cmdletName];
+                if (commandInfoCache.ContainsKey(key))
+                {
+                    return commandInfoCache[key];
                 }

                 var commandInfo = GetCommandInfoInternal(cmdletName, commandType);
-                commandInfoCache.Add(cmdletName, commandInfo);
+                commandInfoCache.Add(key, commandInfo);
                 return commandInfo;
             }
         }
@@ -726,15 +727,16 @@
                 return null;
             }

+            var key = new CommandLookupKey(name, commandType);
             lock (getCommandLock)
             {
-                if (commandInfoCache.ContainsKey(name))
-                {
-                    return commandInfoCache[name];
+                if (commandInfoCache.ContainsKey(key))
+                {
+                    return commandInfoCache[key];
                 }

                 var commandInfo = GetCommandInfoInternal(name, commandType);
-
+                commandInfoCache.Add(key, commandInfo);
                 return commandInfo;
             }
         }
@@ -1910,6 +1912,37 @@
         }

 #endregion Methods
+
+        private struct CommandLookupKey : IEquatable<CommandLookupKey>
+        {
+            private readonly string Name;
+
+            private readonly CommandTypes CommandTypes;
+
+            internal CommandLookupKey(string name, CommandTypes? commandTypes)
+            {
+                Name = name;
+                CommandTypes = commandTypes ?? CommandTypes.All;
+            }
+
+            public bool Equals(CommandLookupKey other)
+            {
+                return CommandTypes == other.CommandTypes
+                    && Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase);
+            }
+
+            public override int GetHashCode()
+            {
+                // Algorithm from https://stackoverflow.com/questions/1646807/quick-and-simple-hash-code-combinations
+                unchecked
+                {
+                    int hash = 17;
+                    hash = hash * 31 + Name.ToUpperInvariant().GetHashCode();
+                    hash = hash * 31 + CommandTypes.GetHashCode();
+                    return hash;
+                }
+            }
+        }
     }


restore tooltipservice. failing unit test.

--- src/Avalonia.Controls/ToolTipService.cs
+++ src/Avalonia.Controls/ToolTipService.cs
@@ -29,7 +29,6 @@
                 control.PointerEnter -= ControlPointerEnter;
                 control.PointerLeave -= ControlPointerLeave;
                 control.DetachedFromVisualTree -= ControlDetaching;
-                Close(control);
             }

             if (e.NewValue != null)


Add extension method for IRandom to get an unsigned 64-bit integer.

--- src/Bakery/Security/RandomExtensions.cs
+++ src/Bakery/Security/RandomExtensions.cs
@@ -21,5 +21,10 @@
 		{
 			return BitConverter.ToInt64(random.GetBytes(8), 0);
 		}
+
+		public static UInt64 GetUInt64(this IRandom random)
+		{
+			return BitConverter.ToUInt64(random.GetBytes(8), 0);
+		}
 	}
 }


Remove Transaction tests from integration tests file

--- src/CypherTwo.Tests/IntegrationTests.cs
+++ src/CypherTwo.Tests/IntegrationTests.cs
@@ -2,8 +2,6 @@
 {
     using System;
     using System.Net.Http;
-    using System.Text;
-    using System.Transactions;
     using CypherTwo.Core;
     using NUnit.Framework;

@@ -76,67 +74,4 @@
             public string Title { get; set; }
         }
     }
-
-    [TestFixture]
-    public class TransactionTests
-    {
-        private static Random random = new Random((int)DateTime.Now.Ticks);
-
-        private INeoClient neoClient;
-
-        [Test]
-        public void TransactionCommitsOnScopeComplete()
-        {
-            this.neoClient = new NeoClient("http://localhost:7474/db/data");
-            this.neoClient.InitialiseAsync().Wait();
-            var randomText = this.RandomString(12);
-            int newId = -1;
-            using (var ts = new TransactionScope())
-            {
-                var reader = this.neoClient.QueryAsync("CREATE (n:Person  { name:'" + randomText + "' }) RETURN Id(n)").Result;
-                Assert.That(reader.Read(), Is.EqualTo(true));
-                newId = reader.Get<int>(0);
-                Assert.That(newId, Is.GreaterThan(-1));
-
-                ts.Complete();
-            }
-
-            var queryReader = this.neoClient.QueryAsync("MATCH (n:Person) WHERE n.name ='" + randomText + "' RETURN Id(n)").Result;
-            Assert.That(queryReader.Read(), Is.EqualTo(true));
-            Assert.That(queryReader.Get<int>(0), Is.EqualTo(newId));
-        }
-
-        [Test]
-        public void TransactionRollsbackWhenNotScopeComplete()
-        {
-            this.neoClient = new NeoClient("http://localhost:7474/db/data");
-            this.neoClient.InitialiseAsync().Wait();
-            var randomText = this.RandomString(12);
-            int newId = -1;
-            using (var ts = new TransactionScope())
-            {
-                var reader = this.neoClient.QueryAsync("CREATE (n:Person  { name:'" + randomText + "' }) RETURN Id(n)").Result;
-                Assert.That(reader.Read(), Is.EqualTo(true));
-                newId = reader.Get<int>(0);
-                Assert.That(newId, Is.GreaterThan(-1));
-            }
-
-            var queryReader = this.neoClient.QueryAsync("MATCH (n:Person) WHERE n.name ='" + randomText + "' RETURN Id(n)").Result;
-            Assert.That(queryReader.Read(), Is.EqualTo(false));
-        }
-
-        private string RandomString(int size)
-        {
-            var builder = new StringBuilder();
-
-            char ch;
-            for (int i = 0; i < size; i++)
-            {
-                ch = Convert.ToChar(Convert.ToInt32(Math.Floor((26 * random.NextDouble()) + 65)));
-                builder.Append(ch);
-            }
-
-            return builder.ToString();
-        }
-    }
 }


Fix for most recent reported bug in #44

Fix for most recent reported bug in #44

--- src/Dapplo.Confluence/UserExtensions.cs
+++ src/Dapplo.Confluence/UserExtensions.cs
@@ -170,21 +170,20 @@
                 .AppendSegments(segments);

             // If there is no specified accountId, the current user is used
-            if (userIdentifier != null)
-            {
-                if (isCloudServer)
-                {
-                    // Check the account id value.
-                    if (string.IsNullOrEmpty(userIdentifier.AccountId)) throw new ArgumentNullException(nameof(userIdentifier), "It seems that there is no account ID supplied.");
-                    userWatchContentUri = userWatchContentUri.ExtendQuery("accountId", userIdentifier.AccountId);
-                }
-                else
-                {
-                    // Check the account id value.
-                    if (string.IsNullOrEmpty(userIdentifier.AccountId)) throw new ArgumentNullException(nameof(userIdentifier), "It seems that there is no account ID supplied.");
-
-                    userWatchContentUri = userWatchContentUri.ExtendQuery("username", userIdentifier.Username);
-                }
+            if (userIdentifier == null) return userWatchContentUri;
+
+            if (isCloudServer)
+            {
+                // Check the account id value.
+                if (string.IsNullOrEmpty(userIdentifier.AccountId)) throw new ArgumentNullException(nameof(userIdentifier), "It seems that there is no account ID supplied.");
+                userWatchContentUri = userWatchContentUri.ExtendQuery("accountId", userIdentifier.AccountId);
+            }
+            else
+            {
+                // Check the username value.
+                if (string.IsNullOrEmpty(userIdentifier.Username)) throw new ArgumentNullException(nameof(userIdentifier), "It seems that there is no username supplied.");
+
+                userWatchContentUri = userWatchContentUri.ExtendQuery("username", userIdentifier.Username);
             }

             return userWatchContentUri;


Remove unnecessary dispose override

Remove unnecessary dispose override

--- osu.Framework.Desktop/Input/Handlers/Mouse/OpenTKRawMouseHandler.cs
+++ osu.Framework.Desktop/Input/Handlers/Mouse/OpenTKRawMouseHandler.cs
@@ -111,11 +111,5 @@
         /// Lowest priority. We want the normal mouse handler to only kick in if all other handlers don't do anything.
         /// </summary>
         public override int Priority => 0;
-
-        protected override void Dispose(bool disposing)
-        {
-            base.Dispose(disposing);
-            scheduled.Cancel();
-        }
     }
 }


Removed unnecessary lock

Removed unnecessary lock

This lock shouldn't be needed.

--- MaxMind.Db/Reader.cs
+++ MaxMind.Db/Reader.cs
@@ -111,11 +111,7 @@

             if (mode == FileAccessMode.Memory)
             {
-                byte[] fileBytes;
-                lock (_fileLocker)
-                {
-                    fileBytes = File.ReadAllBytes(_fileName);
-                }
+                byte[] fileBytes = File.ReadAllBytes(_fileName);
                 _stream = new ThreadLocal<Stream>(() =>
                 {
                     return new MemoryStream(fileBytes, false);


Fix merge

Fix merge

--- src/EditorFeatures/Core/IntelliSense/AsyncCompletion/ItemManager.cs
+++ src/EditorFeatures/Core/IntelliSense/AsyncCompletion/ItemManager.cs
@@ -51,7 +51,7 @@
             var stopwatch = SharedStopwatch.StartNew();
             var itemList = session.CreateCompletionList(SortCompletionitems(data, cancellationToken));

-            AsyncCompletionLogger.LogItemManagerSortTicksDataPoint((int)stopwatch.Elapsed.TotalMilliseconds);
+            AsyncCompletionLogger.LogItemManagerSortTicksDataPoint(stopwatch.Elapsed);
             return Task.FromResult(itemList);
         }


cosmetic

cosmetic

--- src/IntegrationTests/CustomMapFrom/MapObjectPropertyFromSubQuery.cs
+++ src/IntegrationTests/CustomMapFrom/MapObjectPropertyFromSubQuery.cs
@@ -628,7 +628,7 @@
             cfg.CreateMap<CableEnd, CableEndModel>().ForMember(dest => dest.DataHallId, opt => opt.MapFrom(src => src.Rack.DataHall.DataCentreId));
             cfg.CreateMap<Cable, CableListModel>()
                 .ForMember(dest => dest.AEnd, opt => opt.MapFrom(src => src.Ends.FirstOrDefault(x => x.Name == "A")))
-                .ForMember(dest => dest.AnotherEnd, opt => opt.MapFrom(src => src.Ends.FirstOrDefault(x => x.Name == "B"))); ;
+                .ForMember(dest => dest.AnotherEnd, opt => opt.MapFrom(src => src.Ends.FirstOrDefault(x => x.Name == "B")));
         });

         [Fact]


+ addAccessToken param for Execute helpers

--- src/FacebookSharp.Core/Facebook.Sync.cs
+++ src/FacebookSharp.Core/Facebook.Sync.cs
@@ -1,22 +1,29 @@
 namespace FacebookSharp
 {
     using RestSharp;
+    using RestSharp.Authenticators;

     public partial class Facebook
     {
 #if !SILVERLIGHT
-        private RestResponse Execute(RestRequest request)
+        private RestResponse Execute(RestRequest request, bool addAccessToken)
         {
-            var client = new RestClient();
-            client.BaseUrl = GraphBaseUrl;
+            var client = new RestClient(GraphBaseUrl);
+
+            if (addAccessToken && !string.IsNullOrEmpty(Settings.AccessToken))
+                client.Authenticator = new OAuth2UriQueryParamaterAuthenticator(Settings.AccessToken);
+
             return client.Execute(request);
         }

-        private RestResponse<T> Execute<T>(RestRequest request)
+        private RestResponse<T> Execute<T>(RestRequest request, bool addAccessToken)
             where T : new()
         {
-            var client = new RestClient();
-            client.BaseUrl = GraphBaseUrl;
+            var client = new RestClient(GraphBaseUrl);
+
+            if (addAccessToken && !string.IsNullOrEmpty(Settings.AccessToken))
+                client.Authenticator = new OAuth2UriQueryParamaterAuthenticator(Settings.AccessToken);
+
             return client.Execute<T>(request);
         }
 #endif


Fixes #182. Don't add Odata type if it already has one. I don't think there should be scenarios where we'd reassign the type.

--- src/Microsoft.Graph/Requests/Extensions/PlannerExternalReference.cs
+++ src/Microsoft.Graph/Requests/Extensions/PlannerExternalReference.cs
@@ -30,7 +30,13 @@
                 this.AdditionalData = new Dictionary<string, object>();
             }

-            this.AdditionalData.Add(CoreConstants.Serialization.ODataType, ODataTypeName);
+            // We don't want to reapply ODataType. This happens when you try to re-serialize
+            // an object you already downloaded. Addresses this issue:
+            // https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/182
+            if (!this.AdditionalData.ContainsKey(CoreConstants.Serialization.ODataType))
+            {
+                this.AdditionalData.Add(CoreConstants.Serialization.ODataType, ODataTypeName);
+            }
         }
     }
 }


Stylecop errors

Stylecop errors

--- src/Microsoft.Owin.Security.Twitter/TwitterAuthenticationOptions.cs
+++ src/Microsoft.Owin.Security.Twitter/TwitterAuthenticationOptions.cs
@@ -61,7 +61,6 @@
         /// <value>The consumer secret used to sign requests to Twitter.</value>
         public string ConsumerSecret { get; set; }

-
         /// <summary>
         /// Gets or sets timeout value in milliseconds for back channel communications with Twitter.
         /// </summary>


DNN-9066: Use list instead of directory in order to have dup names

--- src/Modules/Manage/Dnn.PersonaBar.Sites/Services/SitesController.cs
+++ src/Modules/Manage/Dnn.PersonaBar.Sites/Services/SitesController.cs
@@ -265,12 +265,12 @@
             try
             {
                 var defaultTemplate = _controller.GetDefaultTemplate();
-                var temps = new Dictionary<string, string>();
+                var temps = new List<Tuple<string, string>>();
                 var templates = _controller.GetPortalTemplates();
                 foreach (var template in templates)
                 {
                     var item = _controller.CreateListItem(template);
-                    temps.Add(item.Text, item.Value);
+                    temps.Add(new Tuple<string, string>(item.Text, item.Value));
                     if (item.Value.StartsWith(defaultTemplate))
                         defaultTemplate = item.Value;
                 }
@@ -282,12 +282,12 @@
                     {
                         Templates = temps.Select(t => new
                         {
-                            Name = t.Key,
-                            t.Value
+                            Name = t.Item1,
+                            Value = t.Item2
                         }),
                         DefaultTemplate = defaultTemplate
                     },
-                    TotalResults = 1
+                    TotalResults = temps.Count
                 };

                 return Request.CreateResponse(HttpStatusCode.OK, response);


formatting

formatting

--- src/Nether.Web/Features/Leaderboard/LeaderboardServiceExtensions.cs
+++ src/Nether.Web/Features/Leaderboard/LeaderboardServiceExtensions.cs
@@ -112,12 +112,14 @@
             {
                 string name = config["Name"];
                 LeaderboardType type = (LeaderboardType)Enum.Parse(typeof(LeaderboardType), config["Type"]);
-                LeaderboardConfig leaderboardConfig = new LeaderboardConfig {
+                LeaderboardConfig leaderboardConfig = new LeaderboardConfig
+                {
                     Name = name,
-                    Type = type };
+                    Type = type
+                };

-                switch(type)
-                {
+                switch (type)
+                {
                     case LeaderboardType.Top:
                         string top = config["Top"];
                         if (top == null)


Improve add new feed by a more tolerant URI parser

--- src/NewsReader/NewsReader.Applications/Controllers/AppController.cs
+++ src/NewsReader/NewsReader.Applications/Controllers/AppController.cs
@@ -203,7 +203,17 @@
         private async Task AddNewFeed()
         {
             Uri feedUri;
-            if (Uri.TryCreate(feedListViewModel.Value.AddNewFeedUri, UriKind.RelativeOrAbsolute, out feedUri))
+            var uriString = feedListViewModel.Value.AddNewFeedUri.Trim();
+            if (!uriString.StartsWith("http", StringComparison.CurrentCultureIgnoreCase))
+            {
+                uriString = "http://" + uriString;
+            }
+            else if (uriString.StartsWith("http://http://", StringComparison.CurrentCultureIgnoreCase)
+                || uriString.StartsWith("http://https://", StringComparison.CurrentCultureIgnoreCase))
+            {
+                uriString = uriString.Substring(7);
+            }
+            if (Uri.TryCreate(uriString, UriKind.RelativeOrAbsolute, out feedUri))
             {
                 var newFeed = new Feed(feedUri);
                 await newsFeedsController.Value.LoadFeedAsync(newFeed);


Removing unused fields from ApiClient

Removing unused fields from ApiClient

--- src/GitHub.Api/Application/ApiClient.cs
+++ src/GitHub.Api/Application/ApiClient.cs
@@ -1,7 +1,6 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using System.Threading;
 using System.Threading.Tasks;
 using Octokit;

@@ -27,13 +26,9 @@
         private readonly IKeychain keychain;
         private readonly IGitHubClient githubClient;
         private readonly ILoginManager loginManager;
-        private static readonly SemaphoreSlim sem = new SemaphoreSlim(1);

         IList<Organization> organizationsCache;
         Octokit.User userCache;
-
-        string owner;
-        bool? isEnterprise;

         public ApiClient(UriString hostUrl, IKeychain keychain, IGitHubClient githubClient)
         {


Added null check to content item when indexing (#1802)

Fixes #1800

--- src/OrchardCore.Modules/OrchardCore.Lucene/LuceneIndexingService.cs
+++ src/OrchardCore.Modules/OrchardCore.Lucene/LuceneIndexingService.cs
@@ -104,6 +104,12 @@
                         if (task.Type == IndexingTaskTypes.Update)
                         {
                             var contentItem = await contentManager.GetAsync(task.ContentItemId);
+
+                            if (contentItem == null)
+                            {
+                                continue;
+                            }
+
                             var context = new BuildIndexContext(new DocumentIndex(task.ContentItemId), contentItem, contentItem.ContentType);

                             // Update the document from the index if its lastIndexId is smaller than the current task id.


Add Period and Decimal to existing Enter as Play shortcuts

--- src/HearThis/UI/RecordingToolControl.cs
+++ src/HearThis/UI/RecordingToolControl.cs
@@ -165,7 +165,7 @@

 		/// <summary>
 		/// Filter out all keystrokes except the few that we want to handle.
-		/// We handle Space, Enter, PageUp, PageDown and Arrow keys.
+		/// We handle Space, Enter, Period, PageUp, PageDown and Arrow keys.
 		/// </summary>
 		/// <remarks>This is invoked because we implement IMessagFilter and call Application.AddMessageFilter(this)</remarks>
 		public bool PreFilterMessage(ref Message m)
@@ -181,8 +181,10 @@

 			switch ((Keys)m.WParam)
 			{
+				case Keys.OemPeriod:
+				case Keys.Decimal:
 				case Keys.Enter:
-					_audioButtonsControl   .OnPlay(this, null);
+					_audioButtonsControl.OnPlay(this, null);
 					break;

 				case Keys.Right:


Fix error response parsing (#391)

Fix error response parsing (#391)

Fixes #390

--- Minio/MinioClient.cs
+++ Minio/MinioClient.cs
@@ -423,18 +423,19 @@
                     }

                     errorResponse.Resource = response.Request.Resource;
+                    var resourceSplits = response.Request.Resource.Split('/');

                     if (HttpStatusCode.NotFound.Equals(response.StatusCode))
                     {
-                        int pathLength = response.Request.Resource.Split('/').Count();
+                        int pathLength = resourceSplits.Count();
                         bool isAWS = response.ResponseUri.Host.EndsWith("s3.amazonaws.com");
                         bool isVirtual = isAWS && !response.ResponseUri.Host.StartsWith("s3.amazonaws.com");

                         if (pathLength > 1)
                         {
                             errorResponse.Code = "NoSuchKey";
-                            var bucketName = response.Request.Resource.Split('/')[0];
-                            var objectName = response.Request.Resource.Split('/')[1];
+                            var bucketName = resourceSplits[0];
+                            var objectName = String.Join("/", resourceSplits.Skip(1));
                             if (objectName == string.Empty)
                             {
                                 e = new BucketNotFoundException(bucketName, "Not found.");
@@ -446,7 +447,7 @@
                         }
                         else if (pathLength == 1)
                         {
-                            var resource = response.Request.Resource.Split('/')[0];
+                            var resource = resourceSplits[0];

                             if (isAWS && isVirtual && response.Request.Resource != string.Empty)
                             {


Add sector for PublicSectorOrganisation

Add sector for PublicSectorOrganisation

Added sector property for PublicSectorOrganisation so that it is
retrieved from the blob storage.

--- src/SFA.DAS.ReferenceData.Domain/Models/PublicSectorOrganisation.cs
+++ src/SFA.DAS.ReferenceData.Domain/Models/PublicSectorOrganisation.cs
@@ -4,6 +4,7 @@
     {
         public string Name { get; set; }
         public DataSource Source { get; set; }
+        public string Sector { get; set; }
     }

     public enum DataSource


Order subscription results to get stable comparison for approval test

--- src/SqlPersistence.Tests/Subscription/SubscriptionPersisterTests.cs
+++ src/SqlPersistence.Tests/Subscription/SubscriptionPersisterTests.cs
@@ -83,7 +83,7 @@
         persister.Subscribe(new Subscriber("e@machine2", "endpoint"), type1, null).Await();
         persister.Subscribe(new Subscriber("e@machine2", "endpoint"), type2, null).Await();
         persister.Subscribe(new Subscriber("e@machine3", null), type2, null).Await();
-        var result = persister.GetSubscribers(type1,type2).Result;
+        var result = persister.GetSubscribers(type1,type2).Result.OrderBy(s => s.TransportAddress);
         ObjectApprover.VerifyWithJson(result);
     }


Lydia/Josh A #908 Fixed fixed aria-label for radio buttons abd duplicate IDs on Frequency

--- src/StockportWebapp/Views/stockportgov/Shared/Add-Your-Event.cshtml
+++ src/StockportWebapp/Views/stockportgov/Shared/Add-Your-Event.cshtml
@@ -104,7 +104,7 @@

-

+

                                             Is this a recurring event?

@@ -122,13 +122,13 @@

-

+

                                                 @foreach (var item in Model.Frequencylist.Keys)
                                                 {

-                                                        <input type="radio" value="@item" asp-for="Frequency"> @item
+                                                        <input type="radio" value="@item" id=@item.Replace(" ", "") name="Frequency"> @item

                                                     if (!string.IsNullOrWhiteSpace(@Model.Frequencylist[item]))


Remove outdated TODO in HttpClientHandler for UAP

The current behavior for .NET Core (Windows, *Nix, and UAP) is to use a
default HTTP version if none or an illegal version is specified.

On .NET Framework, an exception is thrown in these cases, "Only HTTP/1.0
and HTTP/1.1 version requests are currently supported." This error
message wouldn't make sense now anyways since HTTP/2 is supported in
.NET Core. So, it is better to use a default version than to throw an
exception.

This difference between .NET Core and .NET Framework will be document
here:
https://github.com/dotnet/corefx/wiki/ApiCompat

Fixes #7878

--- src/System.Net.Http/src/netcore50/System/Net/HttpHandlerToFilter.cs
+++ src/System.Net.Http/src/netcore50/System/Net/HttpHandlerToFilter.cs
@@ -85,11 +85,6 @@
                 }
                 else
                 {
-                    // TODO (#7878): We need to throw an exception here similar to .NET Desktop
-                    // throw new ArgumentException(SR.GetString(SR.net_wrongversion), "value");
-                    //
-                    // But we need to do that checking in the HttpClientHandler object itself.
-                    // and we have that bug as well for the WinHttpHandler version also.
                     maxVersion = RTHttpVersion.Http11;
                 }


Rename string-slicing extension methods (dotnet/corefx#27328)

* Rename string-slicing extension methods

As part of

https://github.com/dotnet/corefx/issues/26894

the api folks have approved renaming AsROSpan and AsROMemory
on string instances to AsSpan and AsMemory (as the "readonly"
is obvious given the read-only nature of the input.)

This puts the renaming in effect. Basically a big search-replace
commit.

* Fix OpenSSL build break

* I see this is going to be a treadmill

Signed-off-by: dotnet-bot-corefx-mirror <03c4cb6107ae99956a7681f2c97ff7104809a2bd@microsoft.com>
Signed-off-by: dotnet-bot <03c4cb6107ae99956a7681f2c97ff7104809a2bd@microsoft.com>

--- src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
+++ src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
@@ -106,7 +106,7 @@
                 Grow(s.Length);
             }

-            s.AsReadOnlySpan().CopyTo(_chars.Slice(pos));
+            s.AsSpan().CopyTo(_chars.Slice(pos));
             _pos += s.Length;
         }


Handle decimal.TryParse deterministically (#1343)

This works properly with the current way decimal values for line heights
are displayed in CollectionSettingsDialog and stored in the settings file.
If that display should be localized, some adjustment would be needed to
ensure compatible storage and decoding of these decimal values.

--- src/BloomExe/Collection/CollectionSettings.cs
+++ src/BloomExe/Collection/CollectionSettings.cs
@@ -509,7 +509,10 @@
 		{
 			var s = GetValue(library, id, defaultValue.ToString(CultureInfo.InvariantCulture));
 			decimal d;
-			decimal.TryParse(s, out d);
+			// REVIEW: if we localize the display of decimal values in the line-height combo box, then this
+			// needs to handle the localized version of the number.  (This happens automatically by removing
+			// the middle two arguments.)
+			decimal.TryParse(s, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d);
 			return d;
 		}


BL-2778 Stop always redoing thumbs for Sources

--- src/BloomExe/CollectionTab/LibraryListView.cs
+++ src/BloomExe/CollectionTab/LibraryListView.cs
@@ -244,7 +244,11 @@
 					}
 					break;
 				case ButtonManagementStage.ImproveAndRefresh:
-					ImproveAndRefreshBookButtons();
+					// GJM Sept 23 2015: BL-2778 Concern about memory leaks led to not updating thumbnails on
+					// source collections for new books. To undo, uncomment ImproveAndRefreshBookButtons()
+					// and comment out removing the event handler.
+					//ImproveAndRefreshBookButtons();
+					Application.Idle -= ManageButtonsAtIdleTime; // stop running to this to do nothing.
 					break;
 				default:
 					throw new ArgumentOutOfRangeException();


Removed exception when no online clients

--- src/Core/Services/AzureTableStorageService.cs
+++ src/Core/Services/AzureTableStorageService.cs
@@ -34,7 +34,7 @@
         public async Task<IList<SensorStatePersisted>> GetSensorsStateAsync(IList<Client> clients)
         {
             if (clients == null) throw new ArgumentNullException(nameof(clients));
-            if (clients.Count == 0) throw new ArgumentException(nameof(clients));
+            if (clients.Count == 0) return new List<SensorStatePersisted>();

             var operationsTasks = new List<Task<TableResult>>();
             var tableRef = getTableReference(TABLE_SENSORS_STATE);


some renames

some renames

--- src/CorvusAlba.MyLittleLispy.Runtime/Frame.cs
+++ src/CorvusAlba.MyLittleLispy.Runtime/Frame.cs
@@ -8,7 +8,7 @@
         private readonly Stack<Scope> _scopes;
         private readonly Frame _globalFrame;

-        public bool IsTrampolin
+        public bool IsGlobal
         {
             get
             {


AST : add length propert to SourceSpan

AST : add length propert to SourceSpan

--- src/Scriban/Parsing/SourceSpan.cs
+++ src/Scriban/Parsing/SourceSpan.cs
@@ -23,6 +23,8 @@

         public TextPosition End { get; set; }

+        public int Length => End.Offset - Start.Offset + 1;
+
         public override string ToString()
         {
             return $"{FileName}({Start})-({End})";


Refatoração. Usando nova base de classes para gerar FNC e montagem do teorema.

--- AnalisadorSintaticoLogico/JALJ_MIA_ASLgui/Form1.cs
+++ AnalisadorSintaticoLogico/JALJ_MIA_ASLgui/Form1.cs
@@ -14,8 +14,8 @@
     public partial class FormMain : Form
     {
         TreeFiller m_treeFiller = null;
-        List<CnfOr> m_premisses = new List<CnfOr>();
-        List<CnfOr> m_theorem = new List<CnfOr>();
+        List<MultipleDisjunction> m_premisses = new List<MultipleDisjunction>();
+        List<MultipleDisjunction> m_theorem = new List<MultipleDisjunction>();

         #region Created by Form Designer

@@ -65,7 +65,8 @@
             // Parsing phase.
             AST ast = CNF.Convert(asl.Parse());
             string fnc = ASTFormat.Format(ast, ASTFormat.FormatType.PLAIN);
-            IEnumerable<CnfOr> orClauses = CNF.Separate(ast, true);
+            CNFProposition cnf = new CNFProposition(ast);
+            //IEnumerable<CnfOr> orClauses = CNF.Separate(ast, true);

             // Add this formula to the FNC list.
             RichTextTool rtt = new RichTextTool(ref richTextBoxCNF);
@@ -76,7 +77,7 @@
             richTextBoxCNF.SelectionBackColor = Color.White;
             rtt.ToggleBold(); rtt.AppendText(" - "); rtt.ToggleBold();
             richTextBoxCNF.SelectionBackColor = Color.LawnGreen;
-            if (orClauses != null) rtt.AppendText(string.Join(", ", orClauses));
+            rtt.AppendText(cnf.ToString());
             rtt.Eol();

             // Add the tree to the image.
@@ -114,7 +115,7 @@
         /// Extract the CNF formulas.
         /// </summary>
         /// <returns>An enumerable of formulas in CNF form.</returns>
-        private void ExtractCNFs(TreeNode rootNode, ref List<CnfOr> data)
+        private void ExtractCNFs(TreeNode rootNode, ref List<MultipleDisjunction> data)
         {
             string expr = textBoxInput.Text;    // expression input.

@@ -126,13 +127,15 @@
             if (!Tokenize(asl)) return;
             // Parsing phase.
             AST ast = CNF.Convert(asl.Parse());
-            string fnc = ASTFormat.Format(ast, ASTFormat.FormatType.PLAIN);
-
-            IEnumerable<CnfOr> orClauses = CNF.Separate(ast, true);
+            CNFProposition cnf = new CNFProposition(ast);
+            string fnc = ast.ToString();
+
+            //IEnumerable<CnfOr> orClauses = CNF.Separate(ast, true);
+            IEnumerable<MultipleDisjunction> orClauses = cnf.Props;

             // Add the formula to the node and data.
             data.AddRange(orClauses);
-            foreach (CnfOr clause in orClauses)
+            foreach (var clause in orClauses)
             {
                 TreeNode node = new TreeNode(clause.ToString());
                 rootNode.Nodes.Add(node);


Minor changes

Minor changes

--- ApiExamples/CSharp/ApiExamples/ExTxtSaveOptions.cs
+++ ApiExamples/CSharp/ApiExamples/ExTxtSaveOptions.cs
@@ -101,9 +101,8 @@
             builder.Write("Paragraph 3.");

             // When saved to plain text, the paragraphs we created can be separated by a custom string
-            TxtSaveOptions txtSaveOptions = new TxtSaveOptions {SaveFormat = SaveFormat.Text};
-            txtSaveOptions.ParagraphBreak = " End of paragraph.\n\n\t";
-
+            TxtSaveOptions txtSaveOptions = new TxtSaveOptions { ParagraphBreak = " End of paragraph.\n\n\t" };
+
             doc.Save(ArtifactsDir + "TxtSaveOptions.ParagraphBreak.txt", txtSaveOptions);
             //ExEnd
         }
@@ -120,8 +119,7 @@
             builder.Writeln("À È Ì Ò Ù.");

             // We can use a SaveOptions object to make sure the encoding we save the .txt document in supports our content
-            TxtSaveOptions txtSaveOptions =
-                new TxtSaveOptions { SaveFormat = SaveFormat.Text, Encoding = System.Text.Encoding.UTF8 };
+            TxtSaveOptions txtSaveOptions = new TxtSaveOptions { Encoding = System.Text.Encoding.UTF8 };

             doc.Save(ArtifactsDir + "TxtSaveOptions.Encoding.txt", txtSaveOptions);
             //ExEnd


tweak cask logic for readability

tweak cask logic for readability

--- Automate/Framework/Machines/Objects/CaskMachine.cs
+++ Automate/Framework/Machines/Objects/CaskMachine.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Linq;
 using Microsoft.Xna.Framework;
 using StardewValley;
 using StardewValley.Objects;
@@ -63,27 +64,27 @@
         {
             Cask cask = this.Machine;

-            if (input.TryGetIngredient(match => match.Type == ItemType.Object && (match.Sample as SObject)?.Quality < 4 && this.AgingRates.ContainsKey(match.Sample.ParentSheetIndex), 1, out IConsumable consumable))
+            foreach (ITrackedStack consumable in input.GetItems().Where(match => match.Type == ItemType.Object && (match.Sample as SObject)?.Quality < SObject.bestQuality))
             {
-                SObject ingredient = (SObject)consumable.Take();
+                if (!this.AgingRates.TryGetValue(consumable.Sample.ParentSheetIndex, out float agingRate))
+                    continue;
+
+                SObject ingredient = (SObject)consumable.Take(1);

                 cask.heldObject.Value = ingredient;
-                cask.agingRate.Value = this.AgingRates[ingredient.ParentSheetIndex];
-                cask.daysToMature.Value = 56;
-                cask.MinutesUntilReady = 999999;
-                switch (ingredient.Quality)
+                cask.agingRate.Value = agingRate;
+                cask.daysToMature.Value = ingredient.Quality switch
                 {
-                    case SObject.medQuality:
-                        cask.daysToMature.Value = 42;
-                        break;
-                    case SObject.highQuality:
-                        cask.daysToMature.Value = 28;
-                        break;
-                    case SObject.bestQuality:
-                        cask.daysToMature.Value = 0;
-                        cask.MinutesUntilReady = 1;
-                        break;
-                }
+                    SObject.medQuality => 42,
+                    SObject.highQuality => 28,
+                    SObject.bestQuality => 0,
+                    _ => 56
+                };
+                cask.MinutesUntilReady = ingredient.Quality switch
+                {
+                    SObject.bestQuality => 1,
+                    _ => 999999
+                };

                 return true;
             }


Bonjour. Harambe c just un gorile

Bonjour. Harambe c just un gorile

--- ConsoleApplication1/ConsoleApplication1/Program.cs
+++ ConsoleApplication1/ConsoleApplication1/Program.cs
@@ -9,7 +9,7 @@
     class Program
     {
         static void Main(string[] args)
-        {
+        { Console.WriteLine("harambe was just a gorilla");
             int chiffre = int.Parse(Console.ReadLine());
             for (int i = 1; i <= chiffre; i++)
             {


fix: not shown cover art in LibraryListHeader


made serialization methods public

made serialization methods public

this avoids using reflection on the revit plugin


Appendの無駄にめんどくさいことやってた実装を素朴な定義に置き換え

Appendの無駄にめんどくさいことやってた実装を素朴な定義に置き換え


show walkthrough progress in bottom-right

--- WeaponSelection/Scripts/Walkthrough/Walkthrough.cs
+++ WeaponSelection/Scripts/Walkthrough/Walkthrough.cs
@@ -57,11 +57,16 @@
             GUILayout.BeginArea(minimisedRect, GUI.skin.box);

             GUILayout.BeginHorizontal();
+
             if (GUILayout.Button("Maximise"))
             {
                 m_isMaximised = true;
             }
+
             GUILayout.FlexibleSpace();
+
+            RenderProgress();
+
             GUILayout.EndHorizontal();

             GUILayout.EndArea();
@@ -108,6 +113,9 @@
                 --m_currentScreenIndex;
             }

+            GUI.enabled = true;
+            RenderProgress();
+
             bool isNotLastScreen = m_currentScreenIndex < m_screens.Count - 1;
             GUI.enabled = isNotLastScreen;
             if (GUILayout.Button("Next"))
@@ -119,5 +127,13 @@

             GUILayout.EndHorizontal();
         }
+
+        private void RenderProgress()
+        {
+            var progressText = string.Format("{0}/{1}",
+                                             m_currentScreenIndex + 1,
+                                             m_screens.Count);
+            GUILayout.Label(progressText);
+        }
     }
 }


Add SeasonWide property to ImagesSummary class

--- src/TvDbSharper/Dto/SeriesDtos.cs
+++ src/TvDbSharper/Dto/SeriesDtos.cs
@@ -124,6 +124,8 @@
         public int? Season { get; set; }

         public int? Series { get; set; }
+
+        public int? SeasonWide { get; set; }
     }

     public enum KeyType


Change additional processing steps

Change additional processing steps

--- INFOIBV/Form1.cs
+++ INFOIBV/Form1.cs
@@ -71,12 +71,7 @@
 			// Combine white top hat & thresholded images, additional processing steps for connecting objects
 			Processor pcombine = new MultiProcessor(new Processor[] {
 				new ArithmeticProcessor(Arithmetic.Sum, darkImage),
-				new MorphologyProcessor(Morphology.Opening, new Average3X3()),
-				new MorphologyProcessor(Morphology.Opening, new Average3X3()),
-				new MorphologyProcessor(Morphology.Closing, new Average3X3()),
-				new MorphologyProcessor(Morphology.Dilation, new Average3X3()),
-				new MorphologyProcessor(Morphology.Erosion, new Average3X3()),
-				new MorphologyProcessor(Morphology.Erosion, new Average3X3()),
+				new MorphologyProcessor(Morphology.Closing, new Average5X5()),
 			});
 			var fullImage = pcombine.Process(lightImage);
 			AddImageToPreview(fullImage, "Combined thresholded image");


Update MiNetService.cs

Update MiNetService.cs

Typo Fixes

--- src/MiNET/MiNET.Service/MiNetService.cs
+++ src/MiNET/MiNET.Service/MiNetService.cs
@@ -48,7 +48,7 @@
 			{
 				var service = new MiNetService();
 				service.Start();
-				Console.WriteLine("MiNET runing. Press <enter> to stop service..");
+				Console.WriteLine("MiNET running. Press <enter> to stop service.");
 				Console.ReadLine();
 				service.Stop();
 			}
@@ -65,7 +65,7 @@

 					host.RunAsLocalService();
 					host.SetDisplayName("MiNET Service");
-					host.SetDescription("MiNET MineCraft Pocket Edition server.");
+					host.SetDescription("MiNET Minecraft Pocket Edition server.");
 					host.SetServiceName("MiNET");
 				});
 			}
@@ -80,4 +80,4 @@
 			return Type.GetType("Mono.Runtime") != null;
 		}
 	}
-}+}


PrepareForUpdate is now only valid for Entity instances.

--- src/Micro+/Storage/DbEntityPersister.cs
+++ src/Micro+/Storage/DbEntityPersister.cs
@@ -7,7 +7,7 @@

 namespace MicroORM.Storage
 {
-    internal class DbEntityPersister
+    internal class DbEntityPersister<TEntity>
     {
         private IDbProvider _dbProvider;

@@ -51,14 +51,13 @@
             }
         }

-        internal Tuple<bool, string, QueryParameterCollection> PrepareForUpdate<TEntity>(TEntity entity)
+        private Tuple<bool, string, QueryParameterCollection> PrepareForUpdate<TEntity>(TEntity entity) where TEntity : Entity.Entity
         {
             // Any changes made to entity?!
-            Entity.Entity dbEntity = entity as Entity.Entity;
             KeyValuePair<string, object>[] valuesToUpdate =
                 EntityValueComparer.ComputeChangedValues<TEntity>(
                 ParameterTypeDescriptor.ToKeyValuePairs(new object[] { entity }),
-                dbEntity != null ? dbEntity.EntityInfo.EntityValueCollection : new EntityValueCollection());
+                entity.EntityInfo.EntityValueCollection);

             if (valuesToUpdate == null || valuesToUpdate.Length == 0)
                 return new Tuple<bool, string, QueryParameterCollection>(false, null, null);


Switch to UTF8 for StratumClient

Switch to UTF8 for StratumClient

--- src/MiningCore/Stratum/StratumClient.cs
+++ src/MiningCore/Stratum/StratumClient.cs
@@ -48,7 +48,7 @@
         private static readonly RecyclableMemoryStreamManager streamManager = new RecyclableMemoryStreamManager(0x200, 16 * 0x200, 0x20000);

         private const int MaxRequestLength = 8192;
-        public static readonly Encoding Encoding = Encoding.ASCII;
+        public static readonly Encoding Encoding = Encoding.UTF8;
         private static readonly ArrayPool<byte> ByteArrayPool = ArrayPool<byte>.Shared;

         private ConcurrentQueue<PooledArraySegment<byte>> sendQueue;


use .Publish().RefCount() to ensure all subscribers catch their messages

--- src/NEventSocket/Sockets/EventSocket.cs
+++ src/NEventSocket/Sockets/EventSocket.cs
@@ -48,7 +48,9 @@
                 Receiver.SelectMany(x => Encoding.ASCII.GetString(x))
                         .AggregateUntil(
                             () => new Parser(), (builder, ch) => builder.Append(ch), builder => builder.Completed)
-                        .Select(builder => builder.ExtractMessage());
+                        .Select(builder => builder.ExtractMessage())
+                        .Publish()
+                        .RefCount();

             Log.Trace(() => "EventSocket initialized");
         }


Allow variables to contain backslashes

Allow variables to contain backslashes

--- src/NSwag.Commands/NSwagDocumentBase.cs
+++ src/NSwag.Commands/NSwagDocumentBase.cs
@@ -178,10 +178,10 @@

                 if (applyTransformations)
                 {
-                    data = Regex.Replace(data, "%[A-Za-z0-9_]*?%", p => Environment.ExpandEnvironmentVariables(p.Value).Replace("\\", "/"));
+                    data = Regex.Replace(data, "%[A-Za-z0-9_]*?%", p => JsonConvert.ToString(Environment.ExpandEnvironmentVariables(p.Value)));

                     foreach (var p in ConvertVariables(variables))
-                        data = data.Replace("$(" + p.Key + ")", p.Value);
+                        data = data.Replace("$(" + p.Key + ")", JsonConvert.ToString(p.Value));

                     var obj = JObject.Parse(data);
                     if (obj["defaultVariables"] != null)


ship regular file

ship regular file

--- src/Namster/Views/Shared/_Layout.cshtml
+++ src/Namster/Views/Shared/_Layout.cshtml
@@ -9,10 +9,10 @@
         <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

         <environment names="Development">
-            <link rel="stylesheet" href="~/css/dist/site.css" />
+            <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
         </environment>
         <environment names="Staging,Production">
-            <link rel="stylesheet" href="~/css/dist/site.min.css" asp-append-version="true"/>
+            <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
         </environment>

         @RenderSection("styles", required: false)


Ignore extensionless files to be compatible with the .NET Package.GetParts

The VsixInstaller validates the digital signature by comparing the signed parts with the parts returned by `System.IO.Packaging.Package.GetParts`. The GetParts method ignores the extensionless files.

--- src/OpenVsixSignTool.Core/OpcPackage.cs
+++ src/OpenVsixSignTool.Core/OpcPackage.cs
@@ -86,6 +86,11 @@
                     continue;
                 }

+                if (string.IsNullOrEmpty(Path.GetExtension(entry.FullName)))
+                {
+                    continue;
+                }
+
                 OpcPart part;
                 if (!_partTracker.TryGetValue(entry.FullName, out part))
                 {


socket_set_option, socket_get_option stubs

--- src/Peachpie.Library.Network/Sockets.cs
+++ src/Peachpie.Library.Network/Sockets.cs
@@ -134,10 +134,11 @@
         public const int SO_TYPE = 4104;
         public const int SO_ERROR = 4103;

+        /// <summary>
+        /// Socket option name.
+        /// </summary>
         public enum SocketOption
         {
-            FREE = SO_FREE,
-            NOSERVER = SO_NOSERVER,
             DEBUG = SO_DEBUG,
             REUSEADDR = SO_REUSEADDR,
             KEEPALIVE = SO_KEEPALIVE,
@@ -344,7 +345,50 @@
         }

         //socket_export_stream — Export a socket extension resource into a stream that encapsulates a socket
-        //socket_get_option — Gets socket options for the socket
+
+        /// <summary>
+        /// Gets socket options for the socket
+        /// </summary>
+        public static PhpValue socket_get_option(PhpResource socket, int level, SocketOption option, PhpValue option_value)
+        {
+            var s = SocketResource.GetValid(socket);
+            if (s == null)
+            {
+                return false;
+            }
+
+            switch (option)
+            {
+                case SocketOption.LINGER:
+                    {
+                        var linger = s.Socket.LingerState;
+                        return new PhpArray(2)
+                        {
+                            { "l_onoff", linger.Enabled ? 1 : 0 },
+                            { "l_linger", linger.LingerTime },
+                        };
+                    }
+
+                case SocketOption.DEBUG:
+                case SocketOption.REUSEADDR:
+                case SocketOption.KEEPALIVE:
+                case SocketOption.DONTROUTE:
+                case SocketOption.BROADCAST:
+                case SocketOption.OOBINLINE:
+                case SocketOption.SNDBUF:
+                case SocketOption.RCVBUF:
+                case SocketOption.SNDLOWAT:
+                case SocketOption.RCVLOWAT:
+                case SocketOption.SNDTIMEO:
+                case SocketOption.RCVTIMEO:
+                case SocketOption.TYPE:
+                case SocketOption.ERROR:
+                default:
+                    PhpException.ArgumentValueNotSupported(nameof(option), option);
+                    return false;
+            }
+        }
+
         //socket_getopt — Alias of socket_get_option
         //socket_getpeername — Queries the remote side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on its type

@@ -455,8 +499,56 @@
         //socket_sendto — Sends a message to a socket, whether it is connected or not
         //socket_set_block — Sets blocking mode on a socket resource
         //socket_set_nonblock — Sets nonblocking mode for file descriptor fd
-        //socket_set_option — Sets socket options for the socket
-        //socket_setopt — Alias of socket_set_option
+
+        /// <summary>
+        /// Sets socket options for the socket.
+        /// </summary>
+        public static bool socket_set_option(PhpResource socket, int level, SocketOption option, PhpValue option_value)
+        {
+            var s = SocketResource.GetValid(socket);
+            if (s == null)
+            {
+                return false;
+            }
+
+            PhpArray arr;
+
+            switch (option)
+            {
+                case SocketOption.LINGER:
+                    if (option_value.IsPhpArray(out arr))
+                    {
+                        s.Socket.LingerState = new LingerOption((int)arr["l_onoff"] != 0, (int)arr["l_linger"]);
+                        return true;
+                    }
+                    return false;
+
+                case SocketOption.DEBUG:
+                case SocketOption.REUSEADDR:
+                case SocketOption.KEEPALIVE:
+                case SocketOption.DONTROUTE:
+                case SocketOption.BROADCAST:
+                case SocketOption.OOBINLINE:
+                case SocketOption.SNDBUF:
+                case SocketOption.RCVBUF:
+                case SocketOption.SNDLOWAT:
+                case SocketOption.RCVLOWAT:
+                case SocketOption.SNDTIMEO:
+                case SocketOption.RCVTIMEO:
+                case SocketOption.TYPE:
+                case SocketOption.ERROR:
+                default:
+                    PhpException.ArgumentValueNotSupported(nameof(option), option);
+                    return false;
+            }
+        }
+
+        /// <summary>
+        /// Alias of <see cref="socket_set_option"/>.
+        /// </summary>
+        public static bool socket_setopt(PhpResource socket, int level, SocketOption option, PhpValue option_value)
+            => socket_set_option(socket, level, option, option_value);
+
         //socket_shutdown — Shuts down a socket for receiving, sending, or both

         //socket_strerror — Return a string describing a socket error


Cleanup and add key flags.

Cleanup and add key flags.

--- NtApiDotNet/NtKey.cs
+++ NtApiDotNet/NtKey.cs
@@ -1184,129 +1184,69 @@
         /// </summary>
         /// <returns>The last write time</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public DateTime LastWriteTime
-        {
-            get
-            {
-                return DateTime.FromFileTime(GetFullInfo().Item1.LastWriteTime.QuadPart);
-            }
-        }
+        public DateTime LastWriteTime => DateTime.FromFileTime(GetFullInfo().Item1.LastWriteTime.QuadPart);

         /// <summary>
         /// Get key subkey count
         /// </summary>
         /// <returns>The subkey count</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public int SubKeyCount
-        {
-            get
-            {
-                return GetFullInfo().Item1.SubKeys;
-            }
-        }
+        public int SubKeyCount => GetFullInfo().Item1.SubKeys;

         /// <summary>
         /// Get key value count
         /// </summary>
         /// <returns>The key value count</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public int ValueCount
-        {
-            get
-            {
-                return GetFullInfo().Item1.Values;
-            }
-        }
+        public int ValueCount => GetFullInfo().Item1.Values;

         /// <summary>
         /// Get the key title index
         /// </summary>
         /// <returns>The key title index</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public int TitleIndex
-        {
-            get
-            {
-                return GetFullInfo().Item1.TitleIndex;
-            }
-        }
+        public int TitleIndex => GetFullInfo().Item1.TitleIndex;

         /// <summary>
         /// Get the key class name
         /// </summary>
         /// <returns>The key class name</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public string ClassName
-        {
-            get
-            {
-                return GetFullInfo().Item2;
-            }
-        }
+        public string ClassName => GetFullInfo().Item2;

         /// <summary>
         /// Get the maximum key value name length
         /// </summary>
         /// <returns>The maximum key value name length</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public int MaxValueNameLength
-        {
-            get
-            {
-                return GetFullInfo().Item1.MaxValueNameLen;
-            }
-        }
+        public int MaxValueNameLength => GetFullInfo().Item1.MaxValueNameLen;

         /// <summary>
         /// Get the maximum key value data length
         /// </summary>
         /// <returns>The maximum key value data length</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public int MaxValueDataLength
-        {
-            get
-            {
-                return GetFullInfo().Item1.MaxValueDataLen;
-            }
-        }
+        public int MaxValueDataLength => GetFullInfo().Item1.MaxValueDataLen;

         /// <summary>
         /// Get the maximum subkey name length
         /// </summary>
         /// <returns>The maximum subkey name length</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public int MaxNameLength
-        {
-            get
-            {
-                return GetFullInfo().Item1.MaxNameLen;
-            }
-        }
+        public int MaxNameLength => GetFullInfo().Item1.MaxNameLen;

         /// <summary>
         /// Get the maximum class name length
         /// </summary>
         /// <returns>The maximum class name length</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public int MaxClassLength
-        {
-            get
-            {
-                return GetFullInfo().Item1.MaxClassLen;
-            }
-        }
+        public int MaxClassLength => GetFullInfo().Item1.MaxClassLen;

         /// <summary>
         /// Get the key path as a Win32 style one. If not possible returns
         /// the original path.
         /// </summary>
-        public string Win32Path
-        {
-            get
-            {
-                return NtKeyUtils.NtKeyNameToWin32(FullPath);
-            }
-        }
+        public string Win32Path => NtKeyUtils.NtKeyNameToWin32(FullPath);

         /// <summary>
         /// The disposition when the key was created.
@@ -1323,10 +1263,7 @@
         /// </summary>
         public KeyVirtualizationFlags VirtualizationFlags
         {
-            get
-            {
-                return (KeyVirtualizationFlags)Query<int>(KeyInformationClass.KeyVirtualizationInformation);
-            }
+            get => (KeyVirtualizationFlags)Query<int>(KeyInformationClass.KeyVirtualizationInformation);
             set
             {
                 // Map value to set virtualization flags.
@@ -1353,10 +1290,7 @@
         /// </summary>
         public KeyControlFlags ControlFlags
         {
-            get
-            {
-                return Query<KeyFlagsInformation>(KeyInformationClass.KeyFlagsInformation).ControlFlags;
-            }
+            get => Query<KeyFlagsInformation>(KeyInformationClass.KeyFlagsInformation).ControlFlags;

             set
             {
@@ -1372,10 +1306,7 @@
         /// </summary>
         public int Wow64Flags
         {
-            get
-            {
-                return Query<KeyFlagsInformation>(KeyInformationClass.KeyFlagsInformation).Wow64Flags;
-            }
+            get => Query<KeyFlagsInformation>(KeyInformationClass.KeyFlagsInformation).Wow64Flags;

             set
             {
@@ -1387,15 +1318,14 @@
         }

         /// <summary>
+        /// Get key flags.
+        /// </summary>
+        public int KeyFlags => Query<KeyFlagsInformation>(KeyInformationClass.KeyFlagsInformation).KeyFlags;
+
+        /// <summary>
         /// Indicates if this key is from a trusted hive.
         /// </summary>
-        public bool Trusted
-        {
-            get
-            {
-                return Query<KeyTrustInformation>(KeyInformationClass.KeyTrustInformation).TrustedKey;
-            }
-        }
+        public bool Trusted => Query<KeyTrustInformation>(KeyInformationClass.KeyTrustInformation).TrustedKey;

         /// <summary>
         /// Returns whether this object is a container.