Some refactorings of the HTMLEMailBuilder

--- Hermod/SMTP/EMail/HTMLEMailBuilder.cs
+++ Hermod/SMTP/EMail/HTMLEMailBuilder.cs
@@ -34,12 +34,37 @@

         #region Properties

+        #region HTMLText
+
+        private String _HTMLTextBodypart;
+
+        /// <summary>
+        /// The HTML body of the e-mail.
+        /// </summary>
+        public String HTMLText
+        {
+
+            get
+            {
+                return _HTMLTextBodypart;
+            }
+
+            set
+            {
+                if (value != null && value.Trim().IsNotNullOrEmpty())
+                    _HTMLTextBodypart = value;
+            }
+
+        }
+
+        #endregion
+
         #region PlainText

         private String _PlainTextBodypart;

         /// <summary>
-        /// The plaintext body of the HTML e-mail.
+        /// An alternative plaintext body of the e-mail.
         /// </summary>
         public String PlainText
         {
@@ -59,31 +84,6 @@

         #endregion

-        #region HTMLText
-
-        private String _HTMLTextBodypart;
-
-        /// <summary>
-        /// The HTML body of the HTML e-mail.
-        /// </summary>
-        public String HTMLText
-        {
-
-            get
-            {
-                return _HTMLTextBodypart;
-            }
-
-            set
-            {
-                if (value != null && value.Trim().IsNotNullOrEmpty())
-                    _HTMLTextBodypart = value;
-            }
-
-        }
-
-        #endregion
-
         #endregion

         #region Constructor(s)
@@ -91,13 +91,14 @@
         /// <summary>
         /// Create a new HTML e-mail builder.
         /// </summary>
-        public HTMLEMailBuilder()
-        {
-
-            this.ContentType  = new MailContentType(this, MailContentTypes.multipart_alternative) { CharSet = "utf-8" };
-
-            this.PlainText    = "";
-            this.HTMLText     = "";
+        /// <param name="HTMLMail">The HTML mail.</param>
+        /// <param name="PlainTextMail">An alternative plain text mail.</param>
+        public HTMLEMailBuilder(String  HTMLMail       = null,
+                                String  PlainTextMail  = null)
+        {
+
+            this.HTMLText   = HTMLMail;
+            this.PlainText  = PlainTextMail;

         }

@@ -112,21 +113,99 @@
         protected override EMailBodypart _EncodeBodyparts()
         {

-            return new EMailBodypart(EMailBuilder:     this,
-                                     Content:          new String[] { "This is a multi-part message in MIME format." },
-                                     NestedBodyparts:  new EMailBodypart[] {
-
-                                                           new EMailBodypart(ContentTypeBuilder:       AMail => new MailContentType(AMail, MailContentTypes.text_plain) { CharSet = "utf-8" },
-                                                                             ContentTransferEncoding:  this.ContentTransferEncoding,
-                                                                             ContentLanguage:          this.ContentLanguage,
-                                                                             Content:                  PlainText.Split(TextLineSplitter, StringSplitOptions.None)),
-
-                                                           new EMailBodypart(ContentTypeBuilder:       AMail => new MailContentType(AMail, MailContentTypes.text_html)  { CharSet = "utf-8" },
-                                                                             ContentTransferEncoding:  this.ContentTransferEncoding,
-                                                                             ContentLanguage:          this.ContentLanguage,
-                                                                             Content:                  HTMLText.Split(TextLineSplitter, StringSplitOptions.None))
-
-                                                       });
+            #region HTML & PlainText e-mail...
+
+            if (_HTMLTextBodypart. IsNotNullOrEmpty() &&
+                _PlainTextBodypart.IsNotNullOrEmpty())
+            {
+
+                this.ContentType = new MailContentType(this,
+                                                       MailContentTypes.multipart_alternative)
+                {
+
+                    CharSet = "utf-8"
+
+                };
+
+                return new EMailBodypart(EMailBuilder:     this,
+                                         Content:          new String[] { "This is a multi-part message in MIME format." },
+                                         NestedBodyparts:  new EMailBodypart[] {
+
+                                                               new EMailBodypart(ContentTypeBuilder:       AMail => new MailContentType(AMail, MailContentTypes.text_plain) { CharSet = "utf-8" },
+                                                                                ContentTransferEncoding:  this.ContentTransferEncoding,
+                                                                                ContentLanguage:          this.ContentLanguage,
+                                                                                Content:                  _PlainTextBodypart.Split(TextLineSplitter, StringSplitOptions.None)),
+
+                                                               new EMailBodypart(ContentTypeBuilder:       AMail => new MailContentType(AMail, MailContentTypes.text_html)  { CharSet = "utf-8" },
+                                                                                ContentTransferEncoding:  this.ContentTransferEncoding,
+                                                                                ContentLanguage:          this.ContentLanguage,
+                                                                                Content:                  _HTMLTextBodypart. Split(TextLineSplitter, StringSplitOptions.None))
+
+                                                           });
+
+            }
+
+            #endregion
+
+            #region HTML e-mail...
+
+            else if (_HTMLTextBodypart.IsNotNullOrEmpty())
+            {
+
+                this.ContentType = new MailContentType(this,
+                                                       MailContentTypes.text_html)
+                {
+
+                    CharSet = "utf-8"
+
+                };
+
+                return new EMailBodypart(EMailBuilder:     this,
+                                         Content:          _HTMLTextBodypart.Split(TextLineSplitter, StringSplitOptions.None));
+
+            }
+
+            #endregion
+
+            #region PlainText e-mail...
+
+            else if (_PlainTextBodypart.IsNotNullOrEmpty())
+            {
+
+                this.ContentType = new MailContentType(this,
+                                                       MailContentTypes.text_plain)
+                {
+
+                    CharSet = "utf-8"
+
+                };
+
+                return new EMailBodypart(EMailBuilder:     this,
+                                         Content:          _PlainTextBodypart.Split(TextLineSplitter, StringSplitOptions.None));
+
+            }
+
+            #endregion
+
+            #region Empty e-mail...
+
+            else
+            {
+
+                this.ContentType = new MailContentType(this,
+                                                       MailContentTypes.text_plain)
+                {
+
+                    CharSet = "utf-8"
+
+                };
+
+                return new EMailBodypart(EMailBuilder:     this,
+                                         Content:          new String[0]);
+
+            }
+
+            #endregion

         }


Convert to Unix linebreaks.

Convert to Unix linebreaks.

--- src/test/Test.FAKECore/SideBySideSpecification/TestSplicing.cs
+++ src/test/Test.FAKECore/SideBySideSpecification/TestSplicing.cs
@@ -23,7 +23,9 @@

         private static void CheckResult(XDocument result, string resultFileName)
         {
-            Splicing.normalize(result).ShouldEqual(File.ReadAllText(resultFileName));
+            var spliced = Splicing.normalize(result);
+            var expected = File.ReadAllText(resultFileName).Replace("\r\n", "\n");
+            spliced.Replace("\r\n", "\n").ShouldEqual(expected);
         }

         [Test]


Bugfix

Bugfix

--- src/WaveSample/Lib/WaveStream.cs
+++ src/WaveSample/Lib/WaveStream.cs
@@ -59,19 +59,19 @@
                 {
                     if (_byteSample == 1)
                     {
-                        yield return buffer[j] / 256D;
+                        yield return buffer[i] / 256D;
                     }
                     else if (_byteSample == 2)
                     {
-                        yield return BitConverter.ToInt16(buffer, (int)j) / 32768D;
+                        yield return BitConverter.ToInt16(buffer, (int)i) / 32768D;
                     }
                     else if (_byteSample == 4)
                     {
-                        yield return BitConverter.ToInt32(buffer, (int)j) / 2147483648D;
+                        yield return BitConverter.ToInt32(buffer, (int)i) / 2147483648D;
                     }
                     else // _byteSample == 8
                     {
-                        yield return BitConverter.ToInt64(buffer, (int)j) / 9223372036854775808D;
+                        yield return BitConverter.ToInt64(buffer, (int)i) / 9223372036854775808D;
                     }
                 }
             }


Change mass range

Change mass range

--- Source/AsteroidScience.cs
+++ Source/AsteroidScience.cs
@@ -73,7 +73,7 @@
             if (mass >= 10f && mass < 50f) return "Class B";
             if (mass >= 50f && mass < 200f) return "Class C";
             if (mass >= 200f && mass < 750f) return "Class D";
-            if (mass >= 750f && mass < 3000f) return "Class E";
+            if (mass >= 750f && mass < 5000f) return "Class E";
             return "Class Unholy";
         }


Overwrite summary file if already exists

--- src/VideoConverter.cs
+++ src/VideoConverter.cs
@@ -16,7 +16,7 @@

 		public static bool FastForward(string inputFile, string outputFile)
 		{
-			return Run($"-i {inputFile} -filter:v \"setpts = 0.01 * PTS\" {outputFile}");
+			return Run($"-y -i {inputFile} -filter:v \"setpts = 0.01 * PTS\" {outputFile}");
 		}

 		static bool Run(string args)


GetMetadataPage fails faster

GetMetadataPage fails faster

--- Source/SODA/SodaClient.cs
+++ Source/SODA/SodaClient.cs
@@ -269,18 +269,18 @@
         /// <returns>A collection of ResourceMetadata objects from the specified page of this client's Socrata host.</returns>
         public IEnumerable<ResourceMetadata> GetMetadataPage(int page)
         {
-            if (page > 0)
-            {
-                var catalogUri = SodaUri.ForMetadataList(Host, page);
-
-                IEnumerable<dynamic> rawDataList = Get<IEnumerable<dynamic>>(catalogUri);
-
-                foreach (var rawData in rawDataList)
-                {
-                    var metadata = GetMetadata((string)rawData.id);
-
-                    yield return metadata;
-                }
+            if (page <= 0)
+                throw new ArgumentOutOfRangeException("page", "Resouce metadata catalogs begin on page 1.");
+
+            var catalogUri = SodaUri.ForMetadataList(Host, page);
+
+            IEnumerable<dynamic> rawDataList = Get<IEnumerable<dynamic>>(catalogUri).ToArray();
+
+            foreach (var rawData in rawDataList)
+            {
+                var metadata = GetMetadata((string)rawData.id);
+
+                yield return metadata;
             }
         }


Completed implementing the invite user functionality.

--- sticky-notes-wp7/Pages/InviteUser.xaml.cs
+++ sticky-notes-wp7/Pages/InviteUser.xaml.cs
@@ -1,5 +1,6 @@
 namespace StickyNotes.Pages
 {
+    using System;
     using System.Net;
     using System.Windows;
     using System.Windows.Navigation;
@@ -37,10 +38,13 @@
         {
             this.OnlineRepository.BoardInvite(SettingsManager.SessionToken, this.Email, this.BoardId, (response) =>
             {
-                MessageBox.Show(response.code.ToString());
-                if (response.code == HttpStatusCode.BadRequest)
+                if (response.code != HttpStatusCode.Created)
                 {
-                    MessageBox.Show("User doesn't exist.", "Error", MessageBoxButton.OK);
+                    MessageBox.Show("There was an error adding the user to the board. The board may have been deleted, the user may not exist, or the user may already have been added the board.", "Error", MessageBoxButton.OK);
+                }
+                else
+                {
+                    NavigationService.Navigate(new Uri("/Pages/BoardList.xaml", UriKind.Relative));
                 }
             });
         }


regenerated the bindings

regenerated the bindings

--- src/Vulkan/Handles.cs
+++ src/Vulkan/Handles.cs
@@ -1064,37 +1064,53 @@
 			}
 		}

-		public Pipeline CreateGraphicsPipelines (PipelineCache pipelineCache, UInt32 createInfoCount, GraphicsPipelineCreateInfo pCreateInfos, AllocationCallbacks pAllocator)
-		{
-			Result result;
-			Pipeline pPipelines;
-			unsafe {
-				pPipelines = new Pipeline ();
-
-				fixed (UInt64* ptrpPipelines = &pPipelines.m) {
-					result = Interop.NativeMethods.vkCreateGraphicsPipelines (this.m, pipelineCache.m, createInfoCount, pCreateInfos.m, pAllocator != null ? pAllocator.m : null, ptrpPipelines);
-				}
-				if (result != Result.Success)
-					throw new ResultException (result);
-
-				return pPipelines;
-			}
-		}
-
-		public Pipeline CreateComputePipelines (PipelineCache pipelineCache, UInt32 createInfoCount, ComputePipelineCreateInfo pCreateInfos, AllocationCallbacks pAllocator)
-		{
-			Result result;
-			Pipeline pPipelines;
-			unsafe {
-				pPipelines = new Pipeline ();
-
-				fixed (UInt64* ptrpPipelines = &pPipelines.m) {
-					result = Interop.NativeMethods.vkCreateComputePipelines (this.m, pipelineCache.m, createInfoCount, pCreateInfos.m, pAllocator != null ? pAllocator.m : null, ptrpPipelines);
-				}
-				if (result != Result.Success)
-					throw new ResultException (result);
-
-				return pPipelines;
+		public Pipeline[] CreateGraphicsPipelines (PipelineCache pipelineCache, UInt32 createInfoCount, GraphicsPipelineCreateInfo pCreateInfos, AllocationCallbacks pAllocator)
+		{
+			Result result;
+			unsafe {
+				if (createInfoCount <= 0)
+					return null;
+
+				int size = Marshal.SizeOf (typeof (UInt64));
+				var ptrpPipelines = Marshal.AllocHGlobal ((int)(size * createInfoCount));
+				result = Interop.NativeMethods.vkCreateGraphicsPipelines (this.m, pipelineCache.m, createInfoCount, pCreateInfos.m, pAllocator != null ? pAllocator.m : null, (UInt64*)ptrpPipelines);
+				if (result != Result.Success)
+					throw new ResultException (result);
+
+				if (createInfoCount <= 0)
+					return null;
+				var arr = new Pipeline [createInfoCount];
+				for (int i = 0; i < createInfoCount; i++) {
+					arr [i] = new Pipeline ();
+					arr [i].m = ((UInt64*)ptrpPipelines) [i];
+				}
+
+				return arr;
+			}
+		}
+
+		public Pipeline[] CreateComputePipelines (PipelineCache pipelineCache, UInt32 createInfoCount, ComputePipelineCreateInfo pCreateInfos, AllocationCallbacks pAllocator)
+		{
+			Result result;
+			unsafe {
+				if (createInfoCount <= 0)
+					return null;
+
+				int size = Marshal.SizeOf (typeof (UInt64));
+				var ptrpPipelines = Marshal.AllocHGlobal ((int)(size * createInfoCount));
+				result = Interop.NativeMethods.vkCreateComputePipelines (this.m, pipelineCache.m, createInfoCount, pCreateInfos.m, pAllocator != null ? pAllocator.m : null, (UInt64*)ptrpPipelines);
+				if (result != Result.Success)
+					throw new ResultException (result);
+
+				if (createInfoCount <= 0)
+					return null;
+				var arr = new Pipeline [createInfoCount];
+				for (int i = 0; i < createInfoCount; i++) {
+					arr [i] = new Pipeline ();
+					arr [i].m = ((UInt64*)ptrpPipelines) [i];
+				}
+
+				return arr;
 			}
 		}

@@ -1211,20 +1227,28 @@
 			}
 		}

-		public DescriptorSet AllocateDescriptorSets (DescriptorSetAllocateInfo pAllocateInfo)
-		{
-			Result result;
-			DescriptorSet pDescriptorSets;
-			unsafe {
-				pDescriptorSets = new DescriptorSet ();
-
-				fixed (UInt64* ptrpDescriptorSets = &pDescriptorSets.m) {
-					result = Interop.NativeMethods.vkAllocateDescriptorSets (this.m, pAllocateInfo.m, ptrpDescriptorSets);
-				}
-				if (result != Result.Success)
-					throw new ResultException (result);
-
-				return pDescriptorSets;
+		public DescriptorSet[] AllocateDescriptorSets (DescriptorSetAllocateInfo pAllocateInfo)
+		{
+			Result result;
+			unsafe {
+				if (pAllocateInfo.DescriptorSetCount <= 0)
+					return null;
+
+				int size = Marshal.SizeOf (typeof (UInt64));
+				var ptrpDescriptorSets = Marshal.AllocHGlobal ((int)(size * pAllocateInfo.DescriptorSetCount));
+				result = Interop.NativeMethods.vkAllocateDescriptorSets (this.m, pAllocateInfo.m, (UInt64*)ptrpDescriptorSets);
+				if (result != Result.Success)
+					throw new ResultException (result);
+
+				if (pAllocateInfo.DescriptorSetCount <= 0)
+					return null;
+				var arr = new DescriptorSet [pAllocateInfo.DescriptorSetCount];
+				for (int i = 0; i < pAllocateInfo.DescriptorSetCount; i++) {
+					arr [i] = new DescriptorSet ();
+					arr [i].m = ((UInt64*)ptrpDescriptorSets) [i];
+				}
+
+				return arr;
 			}
 		}

@@ -1340,20 +1364,28 @@
 			}
 		}

-		public CommandBuffer AllocateCommandBuffers (CommandBufferAllocateInfo pAllocateInfo)
-		{
-			Result result;
-			CommandBuffer pCommandBuffers;
-			unsafe {
-				pCommandBuffers = new CommandBuffer ();
-
-				fixed (IntPtr* ptrpCommandBuffers = &pCommandBuffers.m) {
-					result = Interop.NativeMethods.vkAllocateCommandBuffers (this.m, pAllocateInfo.m, ptrpCommandBuffers);
-				}
-				if (result != Result.Success)
-					throw new ResultException (result);
-
-				return pCommandBuffers;
+		public CommandBuffer[] AllocateCommandBuffers (CommandBufferAllocateInfo pAllocateInfo)
+		{
+			Result result;
+			unsafe {
+				if (pAllocateInfo.CommandBufferCount <= 0)
+					return null;
+
+				int size = Marshal.SizeOf (typeof (IntPtr));
+				var ptrpCommandBuffers = Marshal.AllocHGlobal ((int)(size * pAllocateInfo.CommandBufferCount));
+				result = Interop.NativeMethods.vkAllocateCommandBuffers (this.m, pAllocateInfo.m, (IntPtr*)ptrpCommandBuffers);
+				if (result != Result.Success)
+					throw new ResultException (result);
+
+				if (pAllocateInfo.CommandBufferCount <= 0)
+					return null;
+				var arr = new CommandBuffer [pAllocateInfo.CommandBufferCount];
+				for (int i = 0; i < pAllocateInfo.CommandBufferCount; i++) {
+					arr [i] = new CommandBuffer ();
+					arr [i].m = ((IntPtr*)ptrpCommandBuffers) [i];
+				}
+
+				return arr;
 			}
 		}

@@ -1366,20 +1398,28 @@
 			}
 		}

-		public SwapchainKhr CreateSharedSwapchainsKHR (UInt32 swapchainCount, SwapchainCreateInfoKhr pCreateInfos, AllocationCallbacks pAllocator)
-		{
-			Result result;
-			SwapchainKhr pSwapchains;
-			unsafe {
-				pSwapchains = new SwapchainKhr ();
-
-				fixed (UInt64* ptrpSwapchains = &pSwapchains.m) {
-					result = Interop.NativeMethods.vkCreateSharedSwapchainsKHR (this.m, swapchainCount, pCreateInfos.m, pAllocator != null ? pAllocator.m : null, ptrpSwapchains);
-				}
-				if (result != Result.Success)
-					throw new ResultException (result);
-
-				return pSwapchains;
+		public SwapchainKhr[] CreateSharedSwapchainsKHR (UInt32 swapchainCount, SwapchainCreateInfoKhr pCreateInfos, AllocationCallbacks pAllocator)
+		{
+			Result result;
+			unsafe {
+				if (swapchainCount <= 0)
+					return null;
+
+				int size = Marshal.SizeOf (typeof (UInt64));
+				var ptrpSwapchains = Marshal.AllocHGlobal ((int)(size * swapchainCount));
+				result = Interop.NativeMethods.vkCreateSharedSwapchainsKHR (this.m, swapchainCount, pCreateInfos.m, pAllocator != null ? pAllocator.m : null, (UInt64*)ptrpSwapchains);
+				if (result != Result.Success)
+					throw new ResultException (result);
+
+				if (swapchainCount <= 0)
+					return null;
+				var arr = new SwapchainKhr [swapchainCount];
+				for (int i = 0; i < swapchainCount; i++) {
+					arr [i] = new SwapchainKhr ();
+					arr [i].m = ((UInt64*)ptrpSwapchains) [i];
+				}
+
+				return arr;
 			}
 		}


wrong scheme

wrong scheme

--- Source/iOS/StatusMagic.cs
+++ Source/iOS/StatusMagic.cs
@@ -21,7 +21,7 @@
                 var destination = " -destination 'platform=iOS Simulator,id=" +
                     string.Join("' -destination 'platform=iOS Simulator,id=", destinations) + "'";

-                string xcodebuild = string.Format("-scheme SimulatorStatusMagic {0} -derivedDataPath '/tmp/xscreenshot_derived/" + type + "/' clean build", destination);
+                string xcodebuild = string.Format("-scheme SimulatorStatusMagiciOS {0} -derivedDataPath '/tmp/xscreenshot_derived/" + type + "/' clean build", destination);
                 //string defaultPipe = "| tee '/tmp/xcodelogs.log' | xcpretty";
                 //string prefix = "set -o pipefail && ";


shortened default coin description

shortened default coin description

--- CryptoTracker/Helpers/API_CoinGecko.cs
+++ CryptoTracker/Helpers/API_CoinGecko.cs
@@ -1,16 +1,16 @@
 using Newtonsoft.Json.Linq;
 using System;
+using System.Collections.Generic;
+using System.ComponentModel;
 using System.Globalization;
-using System.Threading.Tasks;
-using System.ComponentModel;
-using System.Collections.Generic;
 using System.Net.Http;
 using System.Runtime.CompilerServices;
+using System.Threading.Tasks;

 namespace CryptoTracker.Helpers {

     public class Description {
-        public string en { get; set; }
+        public string en { get; set; } = "No description.\n";
     }

     public class Links {
@@ -184,7 +184,6 @@
         public string symbol { get; set; } = "null";
         public string name { get; set; } = "Null";
         public string hashing_algorithm { get; set; } = "null";
-        public string short_description { get; set; } = "No description";
         public Description description { get; set; } = new Description() { en = "" };
         public Links links { get; set; }
         public Image image { get; set; }
@@ -225,6 +224,8 @@
                 string descr = await App.GetCoinDescription(coinData.symbol.ToUpper(CultureInfo.InvariantCulture), 5).ConfigureAwait(true);
                 if (!String.IsNullOrEmpty(descr))
                     coinData.description.en = descr;
+                else
+                    coinData.description.en = coinData.description.en.Split('\n')[0];
                 return coinData;
             }
             catch (Exception ex) {


Renamed 'item' to 'replacementValue',

Renamed 'item' to 'replacementValue',

because I think it more explicitly describes the role of the method
argument.

--- Src/Champagne/Sequence.cs
+++ Src/Champagne/Sequence.cs
@@ -10,13 +10,14 @@
     {
         public static IEnumerable<T> Replace<T>(
             this IEnumerable<T> source,
-            T item,
+            T replacementValue,
             Func<T, bool> equalityComparer)
         {
             if (equalityComparer == null)
                 throw new ArgumentNullException("equalityComparer");

-            return source.Select(x => equalityComparer(x) ? item : x);
+            return source.Select(
+                x => equalityComparer(x) ? replacementValue : x);
         }
     }
 }


CIT-227 fixed price qoutation breadcrumb error

--- Web/Areas/Procurement/Controllers/PriceQuotationController.cs
+++ Web/Areas/Procurement/Controllers/PriceQuotationController.cs
@@ -82,10 +82,11 @@
         [HttpGet]
         public ActionResult Index()
         {
-            LoadLookups();
-            var model = new PriceQuotationFilterViewModel();
+            //LoadLookups();
+            //var model = new PriceQuotationFilterViewModel();
             //return View(model);
-            return View();
+            return Redirect(@Url.Action("BidProposalHeader","PriceQuotation"));
+            //return View();
         }

         //[HttpPost]


clean;

clean;

--- examples/TCP/TCP.cs
+++ examples/TCP/TCP.cs
@@ -131,7 +131,6 @@
       // FIXME check that address+port isn't already bound (by this TCP
       //       instance, by consulting the TCBs).

-
       if (tcbs[sid.sockid].state != TCP_State.Closed) {
         return new Result<Unit> (Unit.Value, Error.EFAULT);//FIXME is this the right code?
       }
@@ -140,8 +139,6 @@
       // NOTE we don't use address.address here, maybe we should drop that value
       //      since it's redundant?

-//      throw new Exception("TODO");
-      // Update TCB (as long as connection isn't live!)
       return new Result<Unit> (Unit.Value, null);
     }


C#: fix[support old version] fileType instead parsing

--- web/documentserver-example/csharp/TrackManager.cs
+++ web/documentserver-example/csharp/TrackManager.cs
@@ -98,6 +98,12 @@
             var downloadUri = (string)fileData["url"];
             var curExt = Path.GetExtension(fileName).ToLower();  // get current file extension
             var downloadExt = "."+(string)fileData["filetype"]; // get the extension of the downloaded file
+
+            // TODO [Delete in version 7.0 or higher]
+            if (downloadExt == null) {
+                downloadExt = Path.GetExtension(downloadUri).ToLower() ?? ""; // Support for versions below 7.0
+            }
+
             var newFileName = fileName;

             // convert downloaded file to the file with the current extension if these extensions aren't equal
@@ -176,6 +182,12 @@

             string curExt = Path.GetExtension(fileName).ToLower();  // get current file extension
             string downloadExt = "."+(string)fileData["filetype"];  // get the extension of the downloaded file
+
+            // TODO [Delete in version 7.0 or higher]
+            if (downloadExt == null) {
+                downloadExt = Path.GetExtension(downloadUri).ToLower(); // Support for versions below 7.0
+            }
+
             Boolean newFileName = false;

             // convert downloaded file to the file with the current extension if these extensions aren't equal


CA-334860: Attempt repatriating only VMs that have actually been evacuated

Signed-off-by: Konstantina Chremmou <a7d1f757a659045fb6db8c1e3849a1c8ad00b97a@citrix.com>

--- XenAdmin/Wizards/PatchingWizard/PlanActions/HostPlanAction.cs
+++ XenAdmin/Wizards/PatchingWizard/PlanActions/HostPlanAction.cs
@@ -103,7 +103,7 @@
             }
         }

-        protected void BringBabiesBack(ref Session session, List<XenRef<VM>> vmrefs, bool enableOnly)
+        protected void BringBabiesBack(ref Session session, List<XenRef<VM>> vmRefs, bool enableOnly)
         {
             // CA-17428: Apply hotfixes to a pool of hosts through XenCenter fails.
             // Hosts do reenable themselves anyway, so just wait 1 min for that,
@@ -111,17 +111,28 @@

             WaitForHostToBecomeEnabled(session, true);

-            if (enableOnly || vmrefs.Count == 0)
+            if (enableOnly)
                 return;

-            int vmCount = vmrefs.Count;
-            int vmNumber = 0;
+            //CA-334860: Attempt repatriating only VMs that have actually been evacuated
+            //and are currently residing on a different host
+
+            var nonResidingRefs = (from XenRef<VM> vmRef in vmRefs
+                let vm = Connection.TryResolveWithTimeout(vmRef)
+                where vm != null && vm.resident_on != HostXenRef.opaque_ref
+                select vmRef).ToList();
+
+            if (nonResidingRefs.Count == 0)
+                return;

             var hostObj = GetResolvedHost();
             AddProgressStep(string.Format(Messages.PLAN_ACTION_STATUS_REPATRIATING_VMS, hostObj.Name()));
-            PBD.CheckPlugPBDsForVMs(Connection, vmrefs, true);
-
-            foreach (var vmRef in vmrefs)
+            PBD.CheckPlugPBDsForVMs(Connection, nonResidingRefs, true);
+
+            int vmCount = nonResidingRefs.Count;
+            int vmNumber = 0;
+
+            foreach (var vmRef in nonResidingRefs)
             {
                 var vm = Connection.Resolve(vmRef);
                 if (vm == null)
@@ -132,6 +143,9 @@
                 if (vm.power_state != vm_power_state.Running)
                     continue; // vm may have been shutdown or suspended.

+                if (vm.resident_on == HostXenRef.opaque_ref)
+                    continue; // vm may have been migrated back manually in the meantime
+
                 do
                 {
                     tries++;


Updated to some labels.

Updated to some labels.

--- Derby/Views/Competition/Details.cshtml
+++ Derby/Views/Competition/Details.cshtml
@@ -194,9 +194,10 @@
                         {
                             if (den.IsSystemPlaceholder)
                             {
-                                // Build the Finals "den". This is frist, but really it builds last. Because oh idk, tequila.
+                                // Build the Finals "den". This is first, but really it builds last. Because oh idk, tequila.
                                 if (race == null)
                                 {
+                                    // Even though this doesn't show, just in case someone deleted it.

@@ -220,9 +221,9 @@

-
+

-                                                Create Race for Finals
+                                                Select Finals Racers

@@ -246,9 +247,9 @@
                             if (race == null)
                             {

-
+

-                                            Build Race/Heats for Den
+                                            Build Race for Den


Improve widget snapping performance

Improve widget snapping performance

--- DesktopWidgets/Helpers/WindowHelper.cs
+++ DesktopWidgets/Helpers/WindowHelper.cs
@@ -15,27 +15,52 @@
             var bounds = new List<Rect> {SystemParameters.WorkArea};
             bounds.AddRange(MonitorHelper.GetAllMonitorBounds());
             bounds.AddRange(App.WidgetViews.Where(x => !x.Equals(window)).Select(view => view.GetBounds()));
+            var windowRect = window.GetBounds();

-            var windowRect = window.GetBounds();
-            foreach (var rect in bounds)
+            var horizontal = new List<double>();
+            horizontal.AddRange(bounds.Select(x => x.Left));
+            horizontal.AddRange(bounds.Select(x => x.Right));
+            var vertical = new List<double>();
+            vertical.AddRange(bounds.Select(x => x.Top));
+            vertical.AddRange(bounds.Select(x => x.Bottom));
+
+            var newLeft = double.NaN;
+            var newTop = double.NaN;
+
+            foreach (var rect in horizontal.Distinct())
             {
-                if (Math.Abs(rect.Left - windowRect.Left) <= margin)
-                    window.Left = rect.Left;
-                else if (Math.Abs(rect.Right - windowRect.Left) <= margin)
-                    window.Left = rect.Right;
-                else if (Math.Abs(rect.Left - windowRect.Right) <= margin)
-                    window.Left = rect.Left - window.ActualWidth;
-                else if (Math.Abs(windowRect.Left + windowRect.Width - rect.Left - rect.Width) <= margin)
-                    window.Left = rect.Left + rect.Width - windowRect.Width;
+                if (Math.Abs(rect - windowRect.Left) <= margin)
+                    newLeft = rect;
+                else if (Math.Abs(rect - windowRect.Right) <= margin)
+                    newLeft = rect - windowRect.Width;
+                else if (Math.Abs(rect - windowRect.Left) <= margin)
+                    newLeft = rect;
+                else if (Math.Abs(rect - windowRect.Right) <= margin)
+                    newLeft = rect - windowRect.Width;

-                if (Math.Abs(rect.Top - windowRect.Top) <= margin)
-                    window.Top = rect.Top;
-                else if (Math.Abs(rect.Bottom - windowRect.Top) <= margin)
-                    window.Top = rect.Bottom;
-                else if (Math.Abs(rect.Top - windowRect.Bottom) <= margin)
-                    window.Top = rect.Top - window.ActualHeight;
-                else if (Math.Abs(windowRect.Top + windowRect.Height - rect.Top - rect.Height) <= margin)
-                    window.Top = rect.Top + rect.Height - windowRect.Height;
+                if (!double.IsNaN(newLeft))
+                {
+                    window.Left = newLeft;
+                    break;
+                }
+            }
+
+            foreach (var rect in vertical.Distinct())
+            {
+                if (Math.Abs(rect - windowRect.Top) <= margin)
+                    newTop = rect;
+                else if (Math.Abs(rect - windowRect.Bottom) <= margin)
+                    newTop = rect - windowRect.Height;
+                else if (Math.Abs(rect - windowRect.Top) <= margin)
+                    newTop = rect;
+                else if (Math.Abs(rect - windowRect.Bottom) <= margin)
+                    newTop = rect - windowRect.Height;
+
+                if (!double.IsNaN(newTop))
+                {
+                    window.Top = newTop;
+                    break;
+                }
             }
         }
     }


Update ModerationModule.cs

Update ModerationModule.cs

--- DiscordBot/Modules/ModerationModule.cs
+++ DiscordBot/Modules/ModerationModule.cs
@@ -39,7 +39,7 @@

         [Command("mute"), Summary("Mute a user for a fixed duration")]
         [Alias("shutup", "stfu")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task MuteUser(IUser user, uint arg)
         {
             await Context.Message.DeleteAsync();
@@ -65,7 +65,7 @@

         [Command("mute"), Summary("Mute a user for a fixed duration")]
         [Alias("shutup", "stfu")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task MuteUser(IUser user, string naturalDuration, params string[] messages)
         {
             try
@@ -88,7 +88,7 @@

         [Command("mute"), Summary("Mute a user for a fixed duration")]
         [Alias("shutup", "stfu")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task MuteUser(IUser user, uint arg, params string[] messages)
         {
             string message = string.Join(' ', messages);
@@ -133,7 +133,7 @@
         }

         [Command("unmute"), Summary("Unmute a muted user")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task UnmuteUser(IUser user, bool fromMute = false)
         {
             var u = user as IGuildUser;
@@ -156,7 +156,7 @@

         [Command("addrole"), Summary("Add a role to a user")]
         [Alias("roleadd")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task AddRole(IRole role, IUser user)
         {
             var contextUser = Context.User as SocketGuildUser;
@@ -177,7 +177,7 @@

         [Command("removerole"), Summary("Remove a role from a user")]
         [Alias("roleremove")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task RemoveRole(IRole role, IUser user)
         {
             var contextUser = Context.User as SocketGuildUser;
@@ -199,7 +199,7 @@

         [Command("clear"), Summary("Remove last x messages")]
         [Alias("clean", "nuke", "purge")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task ClearMessages(int count)
         {
             ITextChannel channel = Context.Channel as ITextChannel;
@@ -217,7 +217,7 @@

         [Command("clear"), Summary("Remove messages until the message at the specified id")]
         [Alias("clean", "nuke", "purge")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task ClearMessages(ulong messageId)
         {
             ITextChannel channel = Context.Channel as ITextChannel;
@@ -261,7 +261,7 @@
         }

         [Command("rules"), Summary("Display rules of the current channel.")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task Rules(int seconds = 60)
         {
             Rules(Context.Channel, seconds);
@@ -269,7 +269,7 @@
         }

         [Command("rules"), Summary("Display rules of the mentionned channel.")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task Rules(IMessageChannel channel, int seconds = 60)
         {
             //Display rules of this channel for x seconds
@@ -295,7 +295,7 @@
         }

         [Command("globalrules"), Summary("Display globalrules in current channel.")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task GlobalRules(int seconds = 60)
         {
             //Display rules of this channel for x seconds
@@ -310,7 +310,7 @@
         }

         [Command("channels"), Summary("Get a description of the channels.")]
-        [RequireUserPermission(GuildPermission.KickMembers)]
+        [RequireStaff]
         async Task ChannelsDescription(int seconds = 60)
         {
             //Display rules of this channel for x seconds
@@ -344,7 +344,7 @@
         }

         [Command("slowmode"), Summary("Put on slowmode.")]
-        [RequireUserPermission(GuildPermission.BanMembers)]
+        [RequireStaff]
         async Task SlowMode(int time)
         {
             await Context.Message.DeleteAsync();
@@ -439,4 +439,4 @@
             user.AddRoleAsync(Context.Guild.GetRole(roleId));
         }
     }
-}+}


Updated the Delivery-Status-Notification SMTP example

--- Documentation/Examples/SmtpExamples.cs
+++ Documentation/Examples/SmtpExamples.cs
@@ -236,10 +236,9 @@
 			/// <param name="message">The message.</param>
 			protected override string GetEnvelopeId (MimeMessage message)
 			{
-				// Note: realistically you'll want to save this value in case you
-				// ever get a Delivery Status Notification so that you can look
-				// up which message the envelope-id is referring to.
-				return Guid.NewGuid ().ToString ();
+				// Since you will want to be able to map whatever identifier you return here to the
+				// message, the obvious identifier to use is probably the Message-Id value.
+				return message.MessageId;
 			}

 			/// <summary>
@@ -253,7 +252,9 @@
 			/// <param name="mailbox">The mailbox.</param>
 			protected override DeliveryStatusNotification? GetDeliveryStatusNotifications (MimeMessage message, MailboxAddress mailbox)
 			{
-				// In this example, we only want to be notified about failures to deliver to a mailbox.
+				// In this example, we only want to be notified of failures to deliver to a mailbox.
+				// If you also want to be notified of delays or successful deliveries, simply bitwise-or
+				// whatever combination of flags you want to be notified about.
 				return DeliveryStatusNotification.Failure;
 			}
 		}


[Modify] Replace it

[Modify] Replace it

--- websocket-sharp/Server/WebSocketServiceManager.cs
+++ websocket-sharp/Server/WebSocketServiceManager.cs
@@ -201,13 +201,8 @@

       set {
         lock (_sync) {
-          string msg;
-
-          if (!canSet (out msg)) {
-            _log.Warn (msg);
-
+          if (!canSet ())
             return;
-          }

           foreach (var host in _hosts.Values)
             host.KeepClean = value;


テストを更新

テストを更新

--- Tests/Ntp/ClientTester.cs
+++ Tests/Ntp/ClientTester.cs
@@ -1,83 +1,83 @@
-/* ------------------------------------------------------------------------- */
-///
-/// PacketTester.cs
-///
-/// Copyright (c) 2010 CubeSoft, Inc.
-///
-/// Licensed under the Apache License, Version 2.0 (the "License");
-/// you may not use this file except in compliance with the License.
-/// You may obtain a copy of the License at
-///
-///  http://www.apache.org/licenses/LICENSE-2.0
-///
-/// Unless required by applicable law or agreed to in writing, software
-/// distributed under the License is distributed on an "AS IS" BASIS,
-/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-/// See the License for the specific language governing permissions and
-/// limitations under the License.
-///
-/* ------------------------------------------------------------------------- */
-using System;
-using NUnit.Framework;
-
-namespace Cube.Tests.Net.Ntp
-{
-    /* --------------------------------------------------------------------- */
+/* ------------------------------------------------------------------------- */
+///
+/// PacketTester.cs
+///
+/// Copyright (c) 2010 CubeSoft, Inc.
+///
+/// Licensed under the Apache License, Version 2.0 (the "License");
+/// you may not use this file except in compliance with the License.
+/// You may obtain a copy of the License at
+///
+///  http://www.apache.org/licenses/LICENSE-2.0
+///
+/// Unless required by applicable law or agreed to in writing, software
+/// distributed under the License is distributed on an "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+/// See the License for the specific language governing permissions and
+/// limitations under the License.
+///
+/* ------------------------------------------------------------------------- */
+using System;
+using NUnit.Framework;
+
+namespace Cube.Tests.Net.Ntp
+{
+    /* --------------------------------------------------------------------- */
     ///
-    /// Cube.Tests.Net.Ntp.ClientTester
-    ///
-    /// <summary>
-    /// Client クラスのテストをするためのクラスです。
-    /// </summary>
-    ///
-    /* --------------------------------------------------------------------- */
-    [TestFixture]
-    public class ClientTester
-    {
-        /* ----------------------------------------------------------------- */
-        ///
-        /// TestGetAsync
-        ///
-        /// <summary>
-        /// NTP サーバとの通信のテストを行います。
-        /// </summary>
-        ///
-        /* ----------------------------------------------------------------- */
-        [Test]
-        public void TestGetAsync()
-        {
-            Assert.DoesNotThrow(() =>
-            {
-                var client = new Cube.Net.Ntp.Client("ntp.cube-soft.jp");
-                Assert.That(client.Host.HostName, Is.Not.Null.Or.Empty);
-                Assert.That(client.Host.AddressList.Length, Is.AtLeast(1));
-                Assert.That(client.Port, Is.EqualTo(123));
-                Assert.That(client.Timeout, Is.EqualTo(TimeSpan.FromSeconds(5)));
-
-                var task = client.GetAsync();
-                Assert.That(task.Result.IsValid, Is.True);
-            });
-        }
-
-        /* ----------------------------------------------------------------- */
-        ///
-        /// TestTimeoutException
-        ///
-        /// <summary>
-        /// タイムアウト処理のテストを行います。
-        /// </summary>
-        ///
-        /* ----------------------------------------------------------------- */
-        [Test]
-        public void TestTimeoutException()
-        {
-            var ex = Assert.Throws<AggregateException>(() =>
-            {
-                var client = new Cube.Net.Ntp.Client("ntp.cube-soft.jp");
-                client.Timeout = TimeSpan.FromMilliseconds(1);
-                client.GetAsync().Wait();
-            });
-            Assert.That(ex.InnerException, Is.TypeOf<TimeoutException>());
+    /// Cube.Tests.Net.Ntp.ClientTester
+    ///
+    /// <summary>
+    /// Client クラスのテストをするためのクラスです。
+    /// </summary>
+    ///
+    /* --------------------------------------------------------------------- */
+    [TestFixture]
+    public class ClientTester
+    {
+        /* ----------------------------------------------------------------- */
+        ///
+        /// TestGetAsync
+        ///
+        /// <summary>
+        /// NTP サーバとの通信のテストを行います。
+        /// </summary>
+        ///
+        /* ----------------------------------------------------------------- */
+        [Test]
+        public void TestGetAsync()
+        {
+            Assert.DoesNotThrow(() =>
+            {
+                var client = new Cube.Net.Ntp.Client("ntp.cube-soft.jp");
+                Assert.That(client.Host.HostName, Is.Not.Null.Or.Empty);
+                Assert.That(client.Host.AddressList.Length, Is.AtLeast(1));
+                Assert.That(client.Port, Is.EqualTo(123));
+                Assert.That(client.Timeout, Is.EqualTo(TimeSpan.FromSeconds(5)));
+
+                var task = client.GetAsync();
+                Assert.That(task.Result.IsValid, Is.True);
+            });
+        }
+
+        /* ----------------------------------------------------------------- */
+        ///
+        /// TestTimeoutException
+        ///
+        /// <summary>
+        /// タイムアウト処理のテストを行います。
+        /// </summary>
+        ///
+        /* ----------------------------------------------------------------- */
+        [Test]
+        public void TestTimeoutException()
+        {
+            var ex = Assert.Throws<AggregateException>(() =>
+            {
+                var client = new Cube.Net.Ntp.Client("ntp.cube-soft.jp");
+                client.Timeout = TimeSpan.FromMilliseconds(1);
+                client.GetAsync().Wait();
+            });
+            Assert.That(ex.InnerException, Is.TypeOf<TimeoutException>());
         }

         /* ----------------------------------------------------------------- */
@@ -96,6 +96,6 @@
             {
                 var client = new Cube.Net.Ntp.Client("404.not.found");
             });
-        }
-    }
-}
+        }
+    }
+}


Modification to stop a caught exception happening during install of packs

Just makes it tidier to debug-  i have all exceptions stopping the
debugger now

--- EDDiscovery/Forms/VersioningManager.cs
+++ EDDiscovery/Forms/VersioningManager.cs
@@ -191,22 +191,20 @@
             return ActionLanguage.ActionFile.ReadVarsAndEnableFromFile(file, out enable);      // note other files share the actionfile Enabled and INSTALL format.. not the other bits
         }

-        static public bool SetEnableFlag(DownloadItem item, bool enable, string appfolder)
-        {
-            try
-            {
+        static public bool SetEnableFlag(DownloadItem item, bool enable, string appfolder)      // false if could not change the flag
+        {
+            if (File.Exists(item.localfilename))    // if its there..
+            {
                 if (ActionLanguage.ActionFile.SetEnableFlag(item.localfilename, enable))     // if enable flag was changed..
                 {
                     if (!item.localmodified)      // if was not local modified, lets set the SHA so it does not appear local modified just because of the enable
                         WriteOrCheckSHAFile(item, item.localvars, appfolder, true);
-                }
-
-                return true;
-            }
-            catch
-            {
-                return false;
-            }
+
+                    return true;
+                }
+            }
+
+            return false;
         }

         public bool InstallFiles(DownloadItem item, string appfolder)
@@ -231,7 +229,7 @@
                         DownloadItem other = downloaditems.Find(x => x.itemname.Equals(item.downloadedvars[key]));

                         if (other != null && other.localfilename != null )
-                            SetEnableFlag(other, false, appfolder);
+                            SetEnableFlag(other, false, appfolder); // don't worry if it fails..
                     }
                 }


[CHG] some typo and descriptions corrections.

--- TextmagicRest/Messages.cs
+++ TextmagicRest/Messages.cs
@@ -15,9 +15,9 @@
     public partial class Client
     {
         /// <summary>
-        ///
-        /// </summary>
-        /// <param name="id"></param>
+        /// Get a single outgoing message.
+        /// </summary>
+        /// <param name="id">Message ID</param>
         /// <returns></returns>
         public Message GetMessage(int id)
         {
@@ -31,7 +31,7 @@
         }

         /// <summary>
-        /// Get all user oubound messages.
+        /// Get all user outbound messages.
         /// </summary>
         /// <returns></returns>
         public MessagesResult GetMessages()
@@ -40,7 +40,7 @@
         }

         /// <summary>
-        /// Get all user oubound messages.
+        /// Get all user outbound messages.
         /// </summary>
         /// <param name="page">Fetch specified results page</param>
         /// <returns></returns>
@@ -50,7 +50,7 @@
         }

         /// <summary>
-        /// Get all user oubound messages.
+        /// Get all user outbound messages.
         /// </summary>
         /// <param name="page">Fetch specified results page</param>
         /// <param name="limit">How many results to return</param>
@@ -66,7 +66,7 @@
         }

         /// <summary>
-        /// Find oubound messages by given parameters.
+        /// Find outbound messages by given parameters.
         /// </summary>
         /// <param name="page">Fetch specified results page</param>
         /// <param name="limit">How many results to return</param>
@@ -90,7 +90,7 @@
         /// <summary>
         /// Delete a single message.
         /// </summary>
-        /// <param name="id"></param>
+        /// <param name="id">Message ID</param>
         /// <returns></returns>
         public DeleteResult DeleteMessage(int id)
         {
@@ -184,7 +184,7 @@
         }

         /// <summary>
-        /// Get bulk message sending session status.
+        /// Get bulk message session status.
         /// </summary>
         /// <param name="id">Bulk session ID</param>
         /// <returns></returns>
@@ -333,9 +333,9 @@
         }

         /// <summary>
-        /// Get a single inbound message.
-        /// </summary>
-        /// <param name="id">Inbound message ID</param>
+        /// Get a single inbox message.
+        /// </summary>
+        /// <param name="id">Inbox message ID</param>
         /// <returns></returns>
         public Reply GetReply(int id)
         {
@@ -349,7 +349,7 @@
         }

         /// <summary>
-        /// Get all inbound messages.
+        /// Get all inbox messages.
         /// </summary>
         /// <returns></returns>
         public RepliesResult GetReplies()
@@ -358,7 +358,7 @@
         }

         /// <summary>
-        /// Get all inbound messages.
+        /// Get all inbox messages.
         /// </summary>
         /// <param name="page">Fetch specified results page</param>
         /// <returns></returns>
@@ -368,7 +368,7 @@
         }

         /// <summary>
-        /// Get all inbound messages.
+        /// Get all inbox messages.
         /// </summary>
         /// <param name="page">Fetch specified results page</param>
         /// <param name="limit">How many results to return</param>
@@ -428,7 +428,7 @@
         }

         /// <summary>
-        /// Check pricing for outbound message(s).
+        /// Check pricing for a new outbound message.
         /// </summary>
         /// <param name="options"></param>
         /// <returns></returns>
@@ -588,7 +588,5 @@

             return Execute<SessionsResult>(request);
         }
-
-
     }
 }


saga implementation

saga implementation

--- Jal.Router.Tests/Integration/Tests.cs
+++ Jal.Router.Tests/Integration/Tests.cs
@@ -46,7 +46,7 @@
             container.Register(Component.For(typeof(IMessageHandler<Message>)).ImplementedBy(typeof(MessageHandler)).Named(typeof(MessageHandler).FullName).LifestyleSingleton());
             container.Register(Component.For(typeof(IMessageHandler<Message>)).ImplementedBy(typeof(OtherMessageHandler)).Named(typeof(OtherMessageHandler).FullName).LifestyleSingleton());
             container.Install(new AzureServiceBusRouterInstaller());
-            container.Install(new AzureStorageInstaller("DefaultEndpointsProtocol=https;AccountName=narwhalappssaeus001;AccountKey=xn2flH2joqs8LM0JKQXrOAWEEXc/I4e9AF873p1W/2grHSht8WEIkBbbl3PssTatuRCLlqMxbkvhKN9VmcPsFA=="));
+            //container.Install(new AzureStorageInstaller("DefaultEndpointsProtocol=https;AccountName=narwhalappssaeus001;AccountKey=xn2flH2joqs8LM0JKQXrOAWEEXc/I4e9AF873p1W/2grHSht8WEIkBbbl3PssTatuRCLlqMxbkvhKN9VmcPsFA=="));
             container.Install(new RouterLoggerInstaller());
             container.Register(Component.For(typeof (ILog)).Instance(LogManager.GetLogger("Cignium.Enigma.App")));
             _bus = container.Resolve<IBus>();
@@ -69,9 +69,9 @@

             //_router.Route<Message>(message);

-            //_brokered.Route<Message>(bm);
+            _brokered.Route<Message>(bm);

-            _sagabrokered.Route<Message>(bm, "saga");
+            //_sagabrokered.Route<Message>(bm, "saga");

             //_router.Route(message, new Response() {Status = "Hi"});


LSTMのパラメータをChainerに合わせた

LSTMのパラメータをChainerに合わせた

--- KelpNet/Functions/Connections/LSTM.cs
+++ KelpNet/Functions/Connections/LSTM.cs
@@ -22,30 +22,30 @@
         private List<Real[]> iParam;
         private List<Real[]> fParam;
         private List<Real[]> oParam;
-        private List<Real[]> cParam;
-
-        private NdArray hParam;
-
-        NdArray gxPrev0;
-        NdArray gxPrev1;
-        NdArray gxPrev2;
-        NdArray gxPrev3;
-        Real[] gcPrev;
+
+        public List<Real[]> cParam;
+        public NdArray hParam;
+
+        private NdArray gxPrev0;
+        private NdArray gxPrev1;
+        private NdArray gxPrev2;
+        private NdArray gxPrev3;
+        private Real[] gcPrev;

         public readonly int InputCount;
         public readonly int OutputCount;

-        public LSTM(int inSize, int outSize, Real[,] initialUpwardW = null, Real[] initialUpwardb = null, Real[,] initialLateralW = null, string name = FUNCTION_NAME, string[] inputNames = null, string[] outputNames = null, bool gpuEnable = false) : base(name, inputNames, outputNames)
+        public LSTM(int inSize, int outSize, Real[,] upwardInit = null, Real[,] lateralInit = null, Real[] biasInit = null, Real[] forgetBiasInit = null, string name = FUNCTION_NAME, string[] inputNames = null, string[] outputNames = null, bool gpuEnable = false) : base(name, inputNames, outputNames)
         {
             this.InputCount = inSize;
             this.OutputCount = outSize;

             List<NdArray> functionParameters = new List<NdArray>();

-            this.upward0 = new Linear(inSize, outSize, noBias: false, initialW: initialUpwardW, initialb: initialUpwardb, name: "upward0", gpuEnable: gpuEnable);
-            this.upward1 = new Linear(inSize, outSize, noBias: false, initialW: initialUpwardW, initialb: initialUpwardb, name: "upward1", gpuEnable: gpuEnable);
-            this.upward2 = new Linear(inSize, outSize, noBias: false, initialW: initialUpwardW, initialb: initialUpwardb, name: "upward2", gpuEnable: gpuEnable);
-            this.upward3 = new Linear(inSize, outSize, noBias: false, initialW: initialUpwardW, initialb: initialUpwardb, name: "upward3", gpuEnable: gpuEnable);
+            this.upward0 = new Linear(inSize, outSize, noBias: false, initialW: upwardInit, initialb: biasInit, name: "upward0", gpuEnable: gpuEnable);
+            this.upward1 = new Linear(inSize, outSize, noBias: false, initialW: upwardInit, initialb: biasInit, name: "upward1", gpuEnable: gpuEnable);
+            this.upward2 = new Linear(inSize, outSize, noBias: false, initialW: upwardInit, initialb: forgetBiasInit, name: "upward2", gpuEnable: gpuEnable);
+            this.upward3 = new Linear(inSize, outSize, noBias: false, initialW: upwardInit, initialb: biasInit, name: "upward3", gpuEnable: gpuEnable);

             functionParameters.AddRange(this.upward0.Parameters);
             functionParameters.AddRange(this.upward1.Parameters);
@@ -53,10 +53,10 @@
             functionParameters.AddRange(this.upward3.Parameters);

             //lateralはBiasは無し
-            this.lateral0 = new Linear(outSize, outSize, noBias: true, initialW: initialLateralW, name: "lateral0", gpuEnable: gpuEnable);
-            this.lateral1 = new Linear(outSize, outSize, noBias: true, initialW: initialLateralW, name: "lateral1", gpuEnable: gpuEnable);
-            this.lateral2 = new Linear(outSize, outSize, noBias: true, initialW: initialLateralW, name: "lateral2", gpuEnable: gpuEnable);
-            this.lateral3 = new Linear(outSize, outSize, noBias: true, initialW: initialLateralW, name: "lateral3", gpuEnable: gpuEnable);
+            this.lateral0 = new Linear(outSize, outSize, noBias: true, initialW: lateralInit, name: "lateral0", gpuEnable: gpuEnable);
+            this.lateral1 = new Linear(outSize, outSize, noBias: true, initialW: lateralInit, name: "lateral1", gpuEnable: gpuEnable);
+            this.lateral2 = new Linear(outSize, outSize, noBias: true, initialW: lateralInit, name: "lateral2", gpuEnable: gpuEnable);
+            this.lateral3 = new Linear(outSize, outSize, noBias: true, initialW: lateralInit, name: "lateral3", gpuEnable: gpuEnable);

             functionParameters.AddRange(this.lateral0.Parameters);
             functionParameters.AddRange(this.lateral1.Parameters);
@@ -94,7 +94,7 @@
                 Real[] laterals1 = this.lateral1.Forward(hParam)[0].Data;
                 Real[] laterals2 = this.lateral2.Forward(hParam)[0].Data;
                 Real[] laterals3 = this.lateral3.Forward(hParam)[0].Data;
-                hParam.UseCount -= 4; //回数を補正 RFI
+                hParam.UseCount -= 4; //回数を補正

                 for (int i = 0; i < outputDataSize; i++)
                 {


fix Null bug when running in x64 mode and not installed x86 java

--- KeyFingerprintLooker/Utils/RegUtil.cs
+++ KeyFingerprintLooker/Utils/RegUtil.cs
@@ -109,24 +109,22 @@
 			string[] CurrentVersionJavaKeys = new String[0];
 			string[] WOW64JavaKeys = new String[0];

-			if(ProcessTypeList.Contains(ProcessType.X64))
+			List<String> InstallLocationList = new List<String>();
+
+			if(ProcessTypeList.Contains(ProcessType.X64) && CurrentVersionJavaSoftKey != null)
 			{
 				CurrentVersionJavaKeys = CurrentVersionJavaSoftKey.GetSubKeyNames();
+				List<String> CurrentVersionInstallLocationList = FindInstallLocationByJavaSoft(CurrentVersionJavaSoftKey, CurrentVersionJavaKeys, whichToFound);
+				InstallLocationList.AddRange(CurrentVersionInstallLocationList);
 			}

-			if(ProcessTypeList.Contains(ProcessType.X86))
+			if(ProcessTypeList.Contains(ProcessType.X86) && WOW64JavaSoftKey != null)
 			{
 				WOW64JavaKeys = WOW64JavaSoftKey.GetSubKeyNames();
+				List<String> WOW64InstallLocationList = FindInstallLocationByJavaSoft(WOW64JavaSoftKey, WOW64JavaKeys, whichToFound);
+				InstallLocationList.AddRange(WOW64InstallLocationList);
 			}
-
 			#endregion
-
-			List<String> CurrentVersionInstallLocationList = FindInstallLocationByJavaSoft(CurrentVersionJavaSoftKey, CurrentVersionJavaKeys, whichToFound);
-			List<String> WOW64InstallLocationList = FindInstallLocationByJavaSoft(WOW64JavaSoftKey, WOW64JavaKeys, whichToFound);
-
-			List<String> InstallLocationList = new List<String>();
-			InstallLocationList.AddRange(CurrentVersionInstallLocationList);
-			InstallLocationList.AddRange(WOW64InstallLocationList);

 			lmKey.Close();


refactoring, reducing amount of code

refactoring, reducing amount of code

--- Langlay.SettingsUi/ConfigViewModel.cs
+++ Langlay.SettingsUi/ConfigViewModel.cs
@@ -50,131 +50,61 @@
         public bool RunAtWindowsStartup
         {
             get { return ConfigService.DoRunAtWindowsStartup; }
-            set
-            {
-                if (value != ConfigService.DoRunAtWindowsStartup)
-                {
-                    ConfigService.DoRunAtWindowsStartup = value;
-                    NotifyPropertyChanged(x => x.RunAtWindowsStartup);
-                }
-            }
+            set { SetPropertyValue(x => x.RunAtWindowsStartup, x => x.DoRunAtWindowsStartup, value); }
         }

         public bool ShowOverlay
         {
             get { return ConfigService.DoShowOverlay; }
-            set
-            {
-                if (ConfigService.DoShowOverlay != value)
-                {
-                    ConfigService.DoShowOverlay = value;
-                    NotifyPropertyChanged(x => x.ShowOverlay);
-                }
-            }
+            set { SetPropertyValue(x => x.ShowOverlay, x => x.DoShowOverlay, value); }
         }

         public bool ShowOverlayOnMainDisplayOnly
         {
             get { return ConfigService.DoShowOverlayOnMainDisplayOnly; }
-            set
-            {
-                if (ConfigService.DoShowOverlayOnMainDisplayOnly != value)
-                {
-                    ConfigService.DoShowOverlayOnMainDisplayOnly = value;
-                    NotifyPropertyChanged(x => x.ShowOverlayOnMainDisplayOnly);
-                }
-            }
+            set { SetPropertyValue(x => x.ShowOverlayOnMainDisplayOnly, x => x.DoShowOverlayOnMainDisplayOnly, value); }
         }

         public bool ShowOverlayRoundCorners
         {
             get { return ConfigService.DoShowOverlayRoundCorners; }
-            set
-            {
-                if (ConfigService.DoShowOverlayRoundCorners != value)
-                {
-                    ConfigService.DoShowOverlayRoundCorners = value;
-                    NotifyPropertyChanged(x => x.ShowOverlayRoundCorners);
-                }
-            }
+            set { SetPropertyValue(x => x.ShowOverlayRoundCorners, x => x.DoShowOverlayRoundCorners, value); }
         }

         public bool ShowCursorTooltip
         {
             get { return ConfigService.DoShowCursorTooltip; }
-            set
-            {
-                if (ConfigService.DoShowCursorTooltip != value)
-                {
-                    ConfigService.DoShowCursorTooltip = value;
-                    NotifyPropertyChanged(x => x.ShowCursorTooltip);
-                }
-            }
+            set { SetPropertyValue(x => x.ShowCursorTooltip, x => x.DoShowCursorTooltip, value); }
         }

         public uint OverlayMilliseconds
         {
             get { return ConfigService.OverlayDuration; }
-            set
-            {
-                if (ConfigService.OverlayDuration != value)
-                {
-                    ConfigService.OverlayDuration = value;
-                    NotifyPropertyChanged(x => x.OverlayMilliseconds);
-                }
-            }
+            set { SetPropertyValue(x => x.OverlayMilliseconds, x => x.OverlayDuration, value); }
         }

         public uint OverlayOpacity
         {
             get { return ConfigService.OverlayOpacity; }
-            set
-            {
-                if (ConfigService.OverlayOpacity != value)
-                {
-                    ConfigService.OverlayOpacity = value;
-                    NotifyPropertyChanged(x => x.OverlayOpacity);
-                }
-            }
+            set { SetPropertyValue(x => x.OverlayOpacity, x => x.OverlayOpacity, value); }
         }

         public uint OverlayScale
         {
             get { return ConfigService.OverlayScale; }
-            set
-            {
-                if (ConfigService.OverlayScale != value)
-                {
-                    ConfigService.OverlayScale = value;
-                    NotifyPropertyChanged(x => x.OverlayScale);
-                }
-            }
+            set { SetPropertyValue(x => x.OverlayScale, x => x.OverlayScale, value); }
         }

         public OverlayLocation OverlayLocation
         {
             get { return ConfigService.OverlayLocation; }
-            set
-            {
-                if (ConfigService.OverlayLocation != value)
-                {
-                    ConfigService.OverlayLocation = value;
-                    NotifyPropertyChanged(x => x.OverlayLocation);
-                }
-            }
+            set { SetPropertyValue(x => x.OverlayLocation, x => x.OverlayLocation, value); }
         }

         public SwitchMethod SwitchMethod
         {
             get { return ConfigService.SwitchMethod; }
-            set
-            {
-                if (ConfigService.SwitchMethod != value)
-                {
-                    ConfigService.SwitchMethod = value;
-                    NotifyPropertyChanged(x => x.SwitchMethod);
-                }
-            }
+            set { SetPropertyValue(x => x.SwitchMethod, x => x.SwitchMethod, value); }
         }

         public ObservableCollection<KeyCodeViewModel> LanguageSwitchSequence
@@ -190,51 +120,32 @@
         public bool SwitchLanguage
         {
             get { return ConfigService.DoSwitchLanguage; }
-            set
-            {
-                if (ConfigService.DoSwitchLanguage != value)
-                {
-                    ConfigService.DoSwitchLanguage = value;
-                    NotifyPropertyChanged(x => x.SwitchLanguage);
-                }
-            }
+            set { SetPropertyValue(x => x.SwitchLanguage, x => x.DoSwitchLanguage, value); }
         }

         public bool SwitchLayout
         {
             get { return ConfigService.DoSwitchLayout; }
-            set
-            {
-                if (ConfigService.DoSwitchLayout != value)
-                {
-                    ConfigService.DoSwitchLayout = value;
-                    NotifyPropertyChanged(x => x.SwitchLayout);
-                }
-            }
+            set { SetPropertyValue(x => x.SwitchLayout, x => x.DoSwitchLayout, value); }
         }

         public bool ShowSettingsOnce
         {
             get { return ConfigService.DoShowSettingsOnce; }
-            set
-            {
-                if (ConfigService.DoShowSettingsOnce != value)
-                {
-                    ConfigService.DoShowSettingsOnce = value;
-                    NotifyPropertyChanged(x => x.ShowSettingsOnce);
-                }
-            }
+            set { SetPropertyValue(x => x.ShowSettingsOnce, x => x.DoShowSettingsOnce, value); }
         }

         private void SetPropertyValue<T1>(
-            Expression<Func<ConfigViewModel, T1>> expression, T1 value)
+            Expression<Func<ConfigViewModel, T1>> expression1,
+            Expression<Func<ConfigService, T1>> expression2, T1 value)
         {
-            var valueOld = expression.Compile()(this);
-            if (!EqualityComparer<T1>.Default.Equals(valueOld , value))
+            var valueOld = expression2.Compile()(ConfigService);
+            if (!EqualityComparer<T1>.Default.Equals(valueOld, value))
             {
-                // TODO: need to set to the property
+                var propertyName = ExpressionUtils.GetMemberName(expression2);
+                ConfigService.GetType().GetProperty(propertyName).SetValue(ConfigService, value, null);

-                NotifyPropertyChanged(expression);
+                NotifyPropertyChanged(expression1);
             }
         }


Fix: Generic context tests

Fix: Generic context tests

--- test/AsmResolver.DotNet.Tests/Signatures/GenericContextTest.cs
+++ test/AsmResolver.DotNet.Tests/Signatures/GenericContextTest.cs
@@ -20,22 +20,22 @@
         [Theory]
         [InlineData(GenericParameterType.Type)]
         [InlineData(GenericParameterType.Method)]
-        public void ResolveGenericParameterWithEmptyTypeShouldThrow(GenericParameterType parameterType)
+        public void ResolveGenericParameterWithEmptyType(GenericParameterType parameterType)
         {
             var context = new GenericContext();

             var parameter = new GenericParameterSignature(parameterType, 0);
-            Assert.Throws<ArgumentOutOfRangeException>(() => context.GetTypeArgument(parameter));
+            Assert.Equal(parameter, context.GetTypeArgument(parameter));
         }
-
+
         [Fact]
         public void ResolveMethodGenericParameterWithMethod()
         {
             var genericInstance = new GenericInstanceMethodSignature();
             genericInstance.TypeArguments.Add(_importer.ImportTypeSignature(typeof(string)));
-
+
             var context = new GenericContext(null, genericInstance);
-
+
             var parameter = new GenericParameterSignature(GenericParameterType.Method, 0);
             Assert.Equal("System.String", context.GetTypeArgument(parameter).FullName);
         }
@@ -45,9 +45,9 @@
         {
             var genericInstance = new GenericInstanceTypeSignature(_importer.ImportType(typeof(List<>)), false);
             genericInstance.TypeArguments.Add(_importer.ImportTypeSignature(typeof(string)));
-
+
             var context = new GenericContext(genericInstance, null);
-
+
             var parameter = new GenericParameterSignature(GenericParameterType.Type, 0);
             Assert.Equal("System.String", context.GetTypeArgument(parameter).FullName);
         }
@@ -57,12 +57,12 @@
         {
             var genericType = new GenericInstanceTypeSignature(_importer.ImportType(typeof(List<>)), false);
             genericType.TypeArguments.Add(_importer.ImportTypeSignature(typeof(string)));
-
+
             var genericMethod = new GenericInstanceMethodSignature();
             genericMethod.TypeArguments.Add(_importer.ImportTypeSignature(typeof(int)));
-
+
             var context = new GenericContext(genericType, genericMethod);
-
+
             var parameter = new GenericParameterSignature(GenericParameterType.Type, 0);
             Assert.Equal("System.String", context.GetTypeArgument(parameter).FullName);
         }
@@ -72,38 +72,38 @@
         {
             var genericType = new GenericInstanceTypeSignature(_importer.ImportType(typeof(List<>)), false);
             genericType.TypeArguments.Add(_importer.ImportTypeSignature(typeof(string)));
-
+
             var genericMethod = new GenericInstanceMethodSignature();
             genericMethod.TypeArguments.Add(_importer.ImportTypeSignature(typeof(int)));
-
+
             var context = new GenericContext(genericType, genericMethod);
-
+
             var parameter = new GenericParameterSignature(GenericParameterType.Method, 0);
             Assert.Equal("System.Int32", context.GetTypeArgument(parameter).FullName);
         }

         [Fact]
-        public void ResolveTypeGenericParameterWithOnlyMethodShouldThrow()
+        public void ResolveTypeGenericParameterWithOnlyMethod()
         {
             var genericInstance = new GenericInstanceMethodSignature();
             genericInstance.TypeArguments.Add(_importer.ImportTypeSignature(typeof(string)));
-
+
             var context = new GenericContext(null, genericInstance);
-
+
             var parameter = new GenericParameterSignature(GenericParameterType.Type, 0);
-            Assert.Throws<ArgumentOutOfRangeException>(() => context.GetTypeArgument(parameter));
+            Assert.Equal(parameter,context.GetTypeArgument(parameter));
         }

         [Fact]
-        public void ResolveMethodGenericParameterWithOnlyTypeShouldThrow()
+        public void ResolveMethodGenericParameterWithOnlyType()
         {
             var genericInstance = new GenericInstanceTypeSignature(_importer.ImportType(typeof(List<>)), false);
             genericInstance.TypeArguments.Add(_importer.ImportTypeSignature(typeof(string)));
-
+
             var context = new GenericContext(genericInstance, null);
-
+
             var parameter = new GenericParameterSignature(GenericParameterType.Method, 0);
-            Assert.Throws<ArgumentOutOfRangeException>(() => context.GetTypeArgument(parameter));
+            Assert.Equal(parameter, context.GetTypeArgument(parameter));
         }
     }
-}+}


added one more unit test for language code case insensitivity

--- test/OrangeJetpack.Localization.Tests/LocalizedContentTests.cs
+++ test/OrangeJetpack.Localization.Tests/LocalizedContentTests.cs
@@ -189,13 +189,13 @@
             const string thirdLanguageCode = "eN";
             const string fourthLanguageCode = "en";

-            var contentsOne = new[]
+            var firstContentsArray = new[]
             {
                 new LocalizedContent(firstLanguageCode, "this is english content"),
                 new LocalizedContent(secondLanguageCode, "this is another content")
             };

-            var contentsTwo = new[]
+            var secondContentsArray = new[]
             {
                 new LocalizedContent(thirdLanguageCode, "this is english content"),
                 new LocalizedContent(fourthLanguageCode, "this is another content")
@@ -203,14 +203,14 @@

             var firstObj = new TestClassB
             {
-                PropertyA = contentsOne.First().Serialize(),
-                PropertyB = contentsOne.Last().Serialize()
+                PropertyA = firstContentsArray.First().Serialize(),
+                PropertyB = firstContentsArray.Last().Serialize()
             };

             var secondObj = new TestClassB
             {
-                PropertyA = contentsTwo.First().Serialize(),
-                PropertyB = contentsTwo.Last().Serialize()
+                PropertyA = secondContentsArray.First().Serialize(),
+                PropertyB = secondContentsArray.Last().Serialize()
             };

             const string localizationRequestLanguage = "en";
@@ -402,6 +402,32 @@
         }

         [Fact]
+        public void LocalizeCollection_ObjectsHaveDifferentLanguageCodeCases_LocalizesCorrectly()
+        {
+            const string firstLanguageCode = "eN";
+            const string secondLanguageCode = "En";
+
+            var contents = new[]
+            {
+                new LocalizedContent(firstLanguageCode, "this is english content"),
+                new LocalizedContent(secondLanguageCode, "this is another content")
+            };
+
+            var testClasses = new[]
+            {
+                new TestClassA {PropertyA = contents.First().Serialize(), PropertyB = contents.First().Serialize()},
+                new TestClassA {PropertyA = contents.Last().Serialize(), PropertyB = contents.Last().Serialize()}
+            };
+
+            var localized = testClasses.Localize<TestClassA>(firstLanguageCode.ToUpper()).ToList();
+
+            Assert.Equal("this is english content", localized.ElementAt(0).PropertyA);
+            Assert.Equal("this is english content", localized.ElementAt(0).PropertyB);
+            Assert.Equal("this is another content", localized.ElementAt(1).PropertyA);
+            Assert.Equal("this is another content", localized.ElementAt(1).PropertyB);
+        }
+
+        [Fact]
         public void Set_ProvideLocalizedContentArray_SetsProperty()
         {
             var testClass = new TestClassA();


module version parsing fix

module version parsing fix

--- ARKBreedingStats/Updater/AsbModule.cs
+++ ARKBreedingStats/Updater/AsbModule.cs
@@ -81,9 +81,12 @@
             if (IsFolder)
             {
                 var filePath = FileService.GetPath(LocalPath, "_ver.txt");
-                LocallyAvailable = File.Exists(filePath) &&
-                                   Version.TryParse(File.ReadAllText(filePath), out VersionLocal);
-                UpdateAvailable = VersionOnline > VersionLocal;
+                if (File.Exists(filePath) &&
+                    Version.TryParse(File.ReadAllText(filePath), out VersionLocal))
+                {
+                    LocallyAvailable = true;
+                    UpdateAvailable = VersionOnline > VersionLocal;
+                }
             }
             else
             {


GameInfo.cs: Rewrite using Error.RuntimeError().

--- AIWolfLib/GameInfo.cs
+++ AIWolfLib/GameInfo.cs
@@ -310,7 +310,8 @@
                 Status status;
                 if (!Enum.TryParse(p.Value, out status))
                 {
-                    throw new AIWolfRuntimeException(GetType() + ": Invalid status string " + p.Value + ".");
+                    Error.RuntimeError(GetType() + "(): Invalid status string " + p.Value + ".", "Force it to be Status.ALIVE.");
+                    status = Status.ALIVE;
                 }
                 StatusMap[Agent.GetAgent(p.Key)] = status;
             }
@@ -320,11 +321,14 @@
             foreach (var p in _RoleMap)
             {
                 Role role;
-                if (!Enum.TryParse(p.Value, out role))
-                {
-                    throw new AIWolfRuntimeException(GetType() + ": Invalid role string " + p.Value + ".");
-                }
-                RoleMap[Agent.GetAgent(p.Key)] = role;
+                if (!Enum.TryParse(p.Value, out role) || role == Role.UNC)
+                {
+                    Error.RuntimeError(GetType() + "(): Invalid role string " + p.Value + ".", "It is removed from role map.");
+                }
+                else
+                {
+                    RoleMap[Agent.GetAgent(p.Key)] = role;
+                }
             }
         }
     }


Update AddToPlate to support ContentItem & ContentStream interfaces

--- Library/Widgets/PrintLibraryWidget.cs
+++ Library/Widgets/PrintLibraryWidget.cs
@@ -366,18 +366,29 @@

 					var library = ApplicationController.Instance.Library;

-					foreach (var item in selectedLibraryItems.Where(o => o is ILibraryContentStream))
-					{
-						var contentProvider = library.GetContentProvider(item) as ISceneContentProvider;
-						var result = contentProvider?.CreateItem(item, null);
-
-						// TODO: Bounding box should be part of IObject3D state so we don't have this constraint
-						// We must wait for the mesh to load so we can use it's bounds below to calculate its position
-						await result.MeshLoaded;
-
-						if (result?.Object3D != null)
-						{
-							itemsToAdd.Add(result.Object3D);
+					foreach (var item in selectedLibraryItems)
+					{
+						if (item is ILibraryContentStream contentModel)
+						{
+							var contentProvider = library.GetContentProvider(item) as ISceneContentProvider;
+
+							var result = contentProvider?.CreateItem(item, null);
+
+							// Wait for the content to load
+							await result.MeshLoaded;
+
+							if (result?.Object3D != null)
+							{
+								itemsToAdd.Add(result.Object3D);
+							}
+						}
+						else if (item is ILibraryContentItem contentItem)
+						{
+							var content = await contentItem.GetContent(null);
+							if (content != null)
+							{
+								itemsToAdd.Add(content);
+							}
 						}
 					}


change version

change version

--- .build/VersionInfo.cs
+++ .build/VersionInfo.cs
@@ -2,8 +2,8 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;

-[assembly: AssemblyVersion("0.1.0")]
-[assembly: AssemblyFileVersion("0.1.0")]
+[assembly: AssemblyVersion("0.0.1")]
+[assembly: AssemblyFileVersion("0.0.1")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyCopyright("Copyright ©  2017")]
 [assembly: AssemblyTrademark("")]


Stop camera preview when navigated from the page

--- UWPBank/MediaPage.xaml.cs
+++ UWPBank/MediaPage.xaml.cs
@@ -43,14 +43,16 @@
             Window.Current.Activated += Current_Activated;
         }

+        protected override async void OnNavigatingFrom(NavigatingCancelEventArgs e)
+        {
+            await mediaCapture.StopPreviewAsync();
+            mediaCapture = null;
+            Window.Current.Activated -= Current_Activated;
+        }
+
         private async void Current_Activated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
         {
             await ReInitCamera();
         }
-
-        protected override void OnNavigatedFrom(NavigationEventArgs e)
-        {
-            Window.Current.Activated -= Current_Activated;
-        }
     }
 }


編輯註解

編輯註解

編輯註解

--- UartOscilloscope/Form1.cs
+++ UartOscilloscope/Form1.cs
@@ -1,5 +1,5 @@
 ///   <summary>
-///   C#實作Uart接收程式，By Jimmy
+///   C#實作Uart接收程式，By Jimmy Hu
 ///   版本資訊：
 ///   2016.5.3(二)   Vision26：新增Data_Graphic_OpenGL副程式，實作OpenGL波型繪圖功能
 ///   2016.5.13(五)  Vision27：增加佇列資料結構實作OpenGL波型繪圖(Data_Graphic_Queue_OpenGL)副程式


Documented ShowMessageAsync.

Documented ShowMessageAsync.

--- MahApps.Metro/Controls/MetroWindow.cs
+++ MahApps.Metro/Controls/MetroWindow.cs
@@ -199,6 +199,13 @@
             get { return TitleCaps ? Title.ToUpper() : Title; }
         }

+        /// <summary>
+        /// Creates a MessageDialog inside of the current window.
+        /// </summary>
+        /// <param name="title">The title of the MessageDialog.</param>
+        /// <param name="message">The message contained within the MessageDialog.</param>
+        /// <param name="style">The type of buttons to use.</param>
+        /// <returns></returns>
         public System.Threading.Tasks.Task<MessageDialogResult> ShowMessageAsync(string title, string message, MessageDialogStyle style = MessageDialogStyle.Affirmative)
         {
             //create the dialog control


tried to implement ManagementServer

tried to implement ManagementServer

--- Management/Server/ManagementServer.cs
+++ Management/Server/ManagementServer.cs
@@ -11,6 +11,8 @@
 using SuperSocket.WebSocket;
 using SuperSocket.WebSocket.Protocol;
 using SuperSocket.WebSocket.SubProtocol;
+using System.IO;
+using System.Threading;

 namespace SuperSocket.Management.Server
 {
@@ -22,6 +24,8 @@
         private Dictionary<string, UserConfig> m_UsersDict;

         private string[] m_ExcludedServers;
+
+        private FileSystemWatcher m_StatusFileWatcher;

         /// <summary>
         /// Initializes a new instance of the <see cref="ManagementServer"/> class.
@@ -65,6 +69,86 @@
             return true;
         }

+        private long m_LastModifiedTime = 0;
+
+        protected override void OnStarted()
+        {
+            m_StatusFileWatcher = new FileSystemWatcher(Path.Combine(Bootstrap.BaseDirectory), "status.bin");
+            m_StatusFileWatcher.NotifyFilter = NotifyFilters.LastWrite;
+            m_StatusFileWatcher.Changed += new FileSystemEventHandler(m_StatusFileWatcher_Changed);
+            m_StatusFileWatcher.EnableRaisingEvents = true;
+
+            base.OnStarted();
+        }
+
+        void m_StatusFileWatcher_Changed(object sender, FileSystemEventArgs e)
+        {
+            m_StatusFileWatcher.EnableRaisingEvents = false;
+
+            if(!FireStatusFileChanged(e))
+                m_StatusFileWatcher.EnableRaisingEvents = true;
+        }
+
+        private bool FireStatusFileChanged(FileSystemEventArgs e)
+        {
+            long currentTicks = 0;
+
+            try
+            {
+                currentTicks = File.GetLastWriteTime(e.FullPath).Ticks;
+            }
+            catch (Exception exc)
+            {
+                Logger.Error("One exception was thrown when get the status file's last write time.", exc);
+                return false;
+            }
+
+            var prevTicks = m_LastModifiedTime;
+
+            if (currentTicks == prevTicks)
+                return false;
+
+            //Already updated
+            if (Interlocked.CompareExchange(ref m_LastModifiedTime, currentTicks, prevTicks) != prevTicks)
+                return false;
+
+            ThreadPool.QueueUserWorkItem(HandleUpdatedStatusFile, e.FullPath);
+
+            return true;
+        }
+
+        private void HandleUpdatedStatusFile(object state)
+        {
+            var filePath = (string)state;
+
+            Thread.Sleep(500);
+
+            NodeStatus nodeStatus;
+
+            try
+            {
+                nodeStatus = NodeStatus.LoadFrom(filePath);
+                Logger.Info(JsonConvert.SerializeObject(nodeStatus, m_IPEndPointConverter));
+            }
+            catch (Exception exc)
+            {
+                Logger.Error("One exception was thrown when load the status data file.", exc);
+            }
+            finally
+            {
+                m_StatusFileWatcher.EnableRaisingEvents = true;
+            }
+        }
+
+        protected override void OnStopped()
+        {
+            m_StatusFileWatcher.EnableRaisingEvents = false;
+            m_StatusFileWatcher.Dispose();
+            m_StatusFileWatcher = null;
+
+            base.OnStopped();
+        }
+
         private static JsonConverter m_IPEndPointConverter = new ListenersJsonConverter();

         /// <summary>


Updating comment to reflect type change

Updating comment to reflect type change

--- MaterialDesignColors.Wpf/ColorPair.cs
+++ MaterialDesignColors.Wpf/ColorPair.cs
@@ -9,7 +9,7 @@

         /// <summary>
         /// The foreground or opposite color. If left null, this will be calculated for you.
-        /// Calculated by calling ColorHelper.ContrastingForegroundColor()
+        /// Calculated by calling ColorAssist.ContrastingForegroundColor()
         /// </summary>
         public Color? ForegroundColor { get; set; }


expose alternative base uri

expose alternative base uri

--- Microsoft.HBase.Client/HBaseClient.cs
+++ Microsoft.HBase.Client/HBaseClient.cs
@@ -46,6 +46,11 @@
         private readonly IRetryPolicyFactory _retryPolicyFactory;

         /// <summary>
+        /// Base uri for hbase rest api
+        /// </summary>
+        public string RestEndpointBase { get; set; }
+
+        /// <summary>
         /// Initializes a new instance of the <see cref="HBaseClient"/> class.
         /// </summary>
         /// <param name="credentials">The credentials.</param>
@@ -97,7 +102,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    using (HttpWebResponse response = await PostRequestAsync(tableName + "/scanner", scannerSettings, WebRequester.RestEndpointBaseZero))
+                    using (HttpWebResponse response = await PostRequestAsync(tableName + "/scanner", scannerSettings, this.RestEndpointBase ?? WebRequester.RestEndpointBaseZero))
                     {
                         if (response.StatusCode != HttpStatusCode.Created)
                         {
@@ -159,7 +164,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    using (HttpWebResponse webResponse = await PutRequestAsync(schema.name + "/schema", schema))
+                    using (HttpWebResponse webResponse = await PutRequestAsync(schema.name + "/schema", schema, this.RestEndpointBase))
                     {
                         if (webResponse.StatusCode == HttpStatusCode.Created)
                         {
@@ -219,7 +224,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    using (HttpWebResponse webResponse = await DeleteRequestAsync<TableSchema>(table + "/schema", null))
+                    using (HttpWebResponse webResponse = await DeleteRequestAsync<TableSchema>(table + "/schema", null, this.RestEndpointBase))
                     {
                         if (webResponse.StatusCode != HttpStatusCode.OK)
                         {
@@ -278,7 +283,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    return await GetRequestAndDeserializeAsync<CellSet>(tableName + "/" + rowKey);
+                    return await GetRequestAndDeserializeAsync<CellSet>(tableName + "/" + rowKey, this.RestEndpointBase);
                 }
                 catch (Exception e)
                 {
@@ -312,7 +317,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    return await GetRequestAndDeserializeAsync<StorageClusterStatus>("/status/cluster");
+                    return await GetRequestAndDeserializeAsync<StorageClusterStatus>("/status/cluster", this.RestEndpointBase);
                 }
                 catch (Exception e)
                 {
@@ -349,7 +354,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    return await GetRequestAndDeserializeAsync<TableInfo>(table + "/regions");
+                    return await GetRequestAndDeserializeAsync<TableInfo>(table + "/regions", this.RestEndpointBase);
                 }
                 catch (Exception e)
                 {
@@ -387,7 +392,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    return await GetRequestAndDeserializeAsync<TableSchema>(table + "/schema");
+                    return await GetRequestAndDeserializeAsync<TableSchema>(table + "/schema", this.RestEndpointBase);
                 }
                 catch (Exception e)
                 {
@@ -421,7 +426,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    return await GetRequestAndDeserializeAsync<org.apache.hadoop.hbase.rest.protobuf.generated.Version>("version");
+                    return await GetRequestAndDeserializeAsync<org.apache.hadoop.hbase.rest.protobuf.generated.Version>("version", this.RestEndpointBase);
                 }
                 catch (Exception e)
                 {
@@ -454,9 +459,8 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    return await GetRequestAndDeserializeAsync<TableList>("");
-                }
-
+                    return await GetRequestAndDeserializeAsync<TableList>("", this.RestEndpointBase);
+                }
                 catch (Exception e)
                 {
                     if (!retryPolicy.ShouldRetryAttempt(e))
@@ -496,7 +500,7 @@
                 IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
                 try
                 {
-                    using (HttpWebResponse webResponse = await PostRequestAsync(table + "/schema", schema))
+                    using (HttpWebResponse webResponse = await PostRequestAsync(table + "/schema", schema, this.RestEndpointBase))
                     {
                         if (webResponse.StatusCode != HttpStatusCode.OK || webResponse.StatusCode != HttpStatusCode.Created)
                         {
@@ -553,7 +557,7 @@
                 {
                     using (
                        HttpWebResponse webResponse =
-                          await GetRequestAsync(scannerInfo.TableName + "/scanner/" + scannerInfo.ScannerId, WebRequester.RestEndpointBaseZero))
+                          await GetRequestAsync(scannerInfo.TableName + "/scanner" + scannerInfo.ScannerId, this.RestEndpointBase ?? WebRequester.RestEndpointBaseZero))
                     {
                         if (webResponse.StatusCode == HttpStatusCode.OK)
                         {
@@ -600,7 +604,7 @@
                 try
                 {
                     // note the fake row key to insert a set of cells
-                    using (HttpWebResponse webResponse = await PutRequestAsync(table + "/somefalsekey", cells))
+                    using (HttpWebResponse webResponse = await PutRequestAsync(table + "/somefalsekey", cells, this.RestEndpointBase))
                     {
                         if (webResponse.StatusCode != HttpStatusCode.OK)
                         {


BufferMessageAdapter. Write save order reg + cancel commands.

--- Algo/Storages/BufferMessageAdapter.cs
+++ Algo/Storages/BufferMessageAdapter.cs
@@ -36,6 +36,7 @@
 		/// <typeparam name="TKey">The key type.</typeparam>
 		/// <typeparam name="TMarketData">Market data type.</typeparam>
 		class DataBuffer<TKey, TMarketData>
+			where TMarketData : Message
 		{
 			private readonly SynchronizedDictionary<TKey, List<TMarketData>> _data = new SynchronizedDictionary<TKey, List<TMarketData>>();

@@ -51,18 +52,19 @@
 			/// <param name="data">New information.</param>
 			public void Add(TKey key, TMarketData data)
 			{
-				Add(key, new[] { data });
+				//Add(key, new[] { data });
+				_data.SyncDo(d => d.SafeAdd(key).Add(data));
 			}

-			/// <summary>
-			/// To add new information to the buffer.
-			/// </summary>
-			/// <param name="key">The key possessing new information.</param>
-			/// <param name="data">New information.</param>
-			public void Add(TKey key, IEnumerable<TMarketData> data)
-			{
-				_data.SyncDo(d => d.SafeAdd(key).AddRange(data));
-			}
+			///// <summary>
+			///// To add new information to the buffer.
+			///// </summary>
+			///// <param name="key">The key possessing new information.</param>
+			///// <param name="data">New information.</param>
+			//public void Add(TKey key, IEnumerable<TMarketData> data)
+			//{
+			//	_data.SyncDo(d => d.SafeAdd(key).AddRange(data));
+			//}

 			/// <summary>
 			/// To get accumulated data from the buffer and delete them.
@@ -182,6 +184,62 @@
 		public IEnumerable<NewsMessage> GetNews()
 		{
 			return _newsBuffer.SyncGet(c => c.CopyAndClear());
+		}
+
+		/// <summary>
+		/// Send message.
+		/// </summary>
+		/// <param name="message">Message.</param>
+		public override void SendInMessage(Message message)
+		{
+			switch (message.Type)
+			{
+				case MessageTypes.OrderRegister:
+					var regMsg = (OrderRegisterMessage)message;
+
+					_transactionsBuffer.Add(regMsg.SecurityId, new ExecutionMessage
+					{
+						ServerTime = DateTimeOffset.Now,
+						ExecutionType = ExecutionTypes.Transaction,
+						SecurityId = regMsg.SecurityId,
+						HasOrderInfo = true,
+						OrderPrice = regMsg.Price,
+						OrderVolume = regMsg.Volume,
+						Currency = regMsg.Currency,
+						PortfolioName = regMsg.PortfolioName,
+						ClientCode = regMsg.ClientCode,
+						BrokerCode = regMsg.BrokerCode,
+						Comment = regMsg.Comment,
+						Side = regMsg.Side,
+						TimeInForce = regMsg.TimeInForce,
+						ExpiryDate = regMsg.TillDate,
+						VisibleVolume = regMsg.VisibleVolume,
+						LocalTime = regMsg.LocalTime,
+						TransactionId = regMsg.TransactionId,
+						//RepoInfo = regMsg.RepoInfo?.Clone(),
+						//RpsInfo = regMsg.RpsInfo?.Clone(),
+					});
+					break;
+				case MessageTypes.OrderCancel:
+					var cancelMsg = (OrderCancelMessage)message;
+
+					_transactionsBuffer.Add(cancelMsg.SecurityId, new ExecutionMessage
+					{
+						ServerTime = DateTimeOffset.Now,
+						ExecutionType = ExecutionTypes.Transaction,
+						SecurityId = cancelMsg.SecurityId,
+						HasOrderInfo = true,
+						IsCancelled = true,
+						OrderId = cancelMsg.OrderId,
+						OrderStringId = cancelMsg.OrderStringId,
+						OriginalTransactionId = cancelMsg.OrderTransactionId,
+						OrderVolume = cancelMsg.Volume,
+						//Side = cancelMsg.Side,
+					});
+					break;
+			}
+
+			base.SendInMessage(message);
 		}

 		/// <summary>


Turning off Serilog .NET Core integration test due to AppVeyor failures

--- tests/NetCoreIntegrationTests/NetCoreIntegrationTestFixture.cs
+++ tests/NetCoreIntegrationTests/NetCoreIntegrationTestFixture.cs
@@ -83,7 +83,7 @@
                 @"\Rx.NET\Integration\Installation\Pcl259\Pcl259.csproj",
                 @"\Rx.NET\Samples\Portable\PortableClassLibrary\PortableClassLibrary.csproj"
             ),
-            new TestRepository("https://github.com/serilog/serilog.git"),
+            //new TestRepository("https://github.com/serilog/serilog.git"), SourceLink messed up from AppVeyor: "SourceLink.Create.CommandLine.dll. Assembly with same name is already loaded Confirm that the <UsingTask> declaration is correct"
             new TestRepository("https://github.com/Abc-Arbitrage/ZeroLog.git"),
             new TestRepository("https://github.com/cake-build/cake"),
         };


Testing Removal of Dynamic

Testing Removal of Dynamic

--- tests/Testity.EngineMath.Tests/UnitTests/GenericVectorTests.cs
+++ tests/Testity.EngineMath.Tests/UnitTests/GenericVectorTests.cs
@@ -420,7 +420,7 @@
 					Assert.AreEqual(Operator.Divide(vec3UnNormalized[i], vec3UnNormalized.Magnitude()), nVec3[i]);
         }

-		[Test(Author = "Andrew Blakely", Description = "Tests Vector<TMathType> min method.", TestOf = typeof(Vector3<>))]
+		/*[Test(Author = "Andrew Blakely", Description = "Tests Vector<TMathType> min method.", TestOf = typeof(Vector3<>))]
 		//Don't expect these odd values to compare properly. They represent non-value value types essentially.
 		//[TestCase(double.NegativeInfinity, double.PositiveInfinity, double.NaN)]
 		//[TestCase(double.MaxValue, double.MinValue, double.Epsilon)]
@@ -520,5 +520,5 @@
 		{
 			return vals.Aggregate(Operator<TMathType>.Zero, (a, b) => Operator.Add(a, b));
 		}
-	}
+	}*/
 }


Added a small building dynamic example

Added a small building dynamic example

--- ISAAR.MSolve.SamplesConsole/Program.cs
+++ ISAAR.MSolve.SamplesConsole/Program.cs
@@ -34,6 +34,27 @@
             parentAnalyzer.Solve();
         }

+        private static void SolveBuildingInNoSoilSmallDynamic()
+        {
+            VectorExtensions.AssignTotalAffinityCount();
+            Model model = new Model();
+            model.SubdomainsDictionary.Add(1, new Subdomain() { ID = 1 });
+            BeamBuildingBuilder.MakeBeamBuilding(model, 20, 20, 20, 5, 4, model.NodesDictionary.Count + 1,
+                model.ElementsDictionary.Count + 1, 1, 4, false, false);
+            model.ConnectDataStructures();
+
+            SolverSkyline solver = new SolverSkyline(model);
+            ProblemStructural provider = new ProblemStructural(model, solver.SubdomainsDictionary);
+            LinearAnalyzer analyzer = new LinearAnalyzer(solver, solver.SubdomainsDictionary);
+            StaticAnalyzer parentAnalyzer = new StaticAnalyzer(provider, analyzer, solver.SubdomainsDictionary);
+
+            analyzer.LogFactories[1] = new LinearAnalyzerLogFactory(new int[] { 420 });
+
+            parentAnalyzer.BuildMatrices();
+            parentAnalyzer.Initialize();
+            parentAnalyzer.Solve();
+        }
+

         static void Main(string[] args)
         {


update ImageShareOption

update ImageShareOption

--- ImageShareTemplate/ImageShareOption.cs
+++ ImageShareTemplate/ImageShareOption.cs
@@ -11,17 +11,39 @@
         /// The proportion horizontal ratio.
         /// </summary>
         public double RatioX { get; set; }
+
         /// <summary>
         /// The proportion vertical ratio.
         /// </summary>
         public double RatioY { get; set; }

+        /// <summary>
+        /// We have separate area to render item on main image to four quadrant.
+        ///
+        ///  +---------+---------+
+        ///  |         |         |
+        ///  | Block 1 | Block 2 |
+        ///  |         |         |
+        ///  +---------+---------+
+        ///  |         |         |
+        ///  | Block 3 | Block 4 |
+        ///  |         |         |
+        ///  +---------+---------+
+        ///
+        /// </summary>
         public IBlock Block1 { get; set; }
         public IBlock Block2 { get; set; }
         public IBlock Block3 { get; set; }
         public IBlock Block4 { get; set; }

-        public string MainImagePath { get; set; }
+        /// <summary>
+        /// Main image this will be background.
+        /// </summary>
+        public byte[] ImageSource { get; set; }
+
+        /// <summary>
+        /// Target image result follow provider specification.
+        /// </summary>
         public IImageProvider ImageProvider { get; set; }

     }