CCMBridge Create() was failing when node count was > 4, but needed to check for > 6 when not using MYTEST

--- CCMBridge/CCMBridge.cs
+++ CCMBridge/CCMBridge.cs
@@ -78,7 +78,7 @@
         public static CCMBridge Create(string name, int nbNodes, bool useAlreadyExisting= false)
         {
 #if !MYTEST
-            if (!useAlreadyExisting && (nbNodes > 4))
+            if (!useAlreadyExisting && (nbNodes > 6))
                 throw new InvalidOperationException();
 #endif

@@ -90,7 +90,7 @@
         public static CCMBridge Create(string name, int nbNodesDC1, int nbNodesDC2, bool useAlreadyExisting =false)
         {
 #if !MYTEST
-            if (!useAlreadyExisting && (nbNodesDC1 + nbNodesDC2 > 4))
+            if (!useAlreadyExisting && (nbNodesDC1 + nbNodesDC2 > 6))
                 throw new InvalidOperationException();
 #endif

@@ -472,7 +472,7 @@
             public static CCMCluster Create(int nbNodes, Builder builder)
             {
 #if !MYTEST
-                if (nbNodes > 4)
+                if (nbNodes > 6)
                     throw new InvalidOperationException();
 #endif
                 if (nbNodes == 0)
@@ -484,7 +484,7 @@
             public static CCMCluster Create(int nbNodesDC1, int nbNodesDC2, Builder builder)
             {
 #if !MYTEST
-                if (nbNodesDC1 + nbNodesDC2 > 4)
+                if (nbNodesDC1 + nbNodesDC2 > 6)
                     throw new InvalidOperationException();
 #endif
                 if (nbNodesDC1 == 0)


updated POST method to create a stump

updated POST method to create a stump

--- src/main/dot-net/Stumps.Engine/Web/ApiModules/StumpsModule.cs
+++ src/main/dot-net/Stumps.Engine/Web/ApiModules/StumpsModule.cs
@@ -55,6 +55,8 @@

                 var model = this.Bind<StumpModel>();
                 var contract = CreateContractFromRecord(model, environment);
+
+                environment.Stumps.CreateStump(contract);

                 return HttpStatusCode.OK;


change solving methods

change solving methods

--- CSharp/lab1/Program.cs
+++ CSharp/lab1/Program.cs
@@ -14,15 +14,15 @@

 		public static void Main(string[] args)
 		{
-			var gaus = new Gaus("input.txt");
+			var gaus = new SquaresMethod("input.txt");
 		}

-		 public class Gaus
+		 public class SquaresMethod
 		 {
 			 public double[,] Matrix { get; private set; }
 			 public string Path { get; private set; }

-			 public Gaus(int size, double fillValue = 1.0)
+			 public SquaresMethod(int size, double fillValue = 1.0)
 			 {
 				 Matrix = new double[size, size];
 				 for (var i = 0; i < size; i++)
@@ -30,7 +30,7 @@
 						 Matrix[i, j] = fillValue;
 			 }

-			 public Gaus(string path)
+			 public SquaresMethod(string path)
 			 {
 				 try
 				 {
@@ -51,11 +51,6 @@
 					 MessageBox.Show(ex.Message, "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
 				 }
 			 }
-
-			 public void SolveGaus()
-			 {
-
-			 }
 		 }
 	}


Trying to prevent ocassional chrome crashes

Error: The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.

--- BTCPayServer.Tests/SeleniumTester.cs
+++ BTCPayServer.Tests/SeleniumTester.cs
@@ -42,18 +42,19 @@
         {
             await Server.StartAsync();
             ChromeOptions options = new ChromeOptions();
+            if (Server.PayTester.InContainer)
+            {
+                // this must be first option https://stackoverflow.com/questions/53073411/selenium-webdriverexceptionchrome-failed-to-start-crashed-as-google-chrome-is#comment102570662_53073789
+                options.AddArgument("no-sandbox");
+            }
+
             var isDebug = !Server.PayTester.InContainer;
-
             if (!isDebug)
             {
                 options.AddArguments("headless"); // Comment to view browser
                 options.AddArguments("window-size=1200x1000"); // Comment to view browser
             }
             options.AddArgument("shm-size=2g");
-            if (Server.PayTester.InContainer)
-            {
-                options.AddArgument("no-sandbox");
-            }
             Driver = new ChromeDriver(Server.PayTester.InContainer ? "/usr/bin" : Directory.GetCurrentDirectory(), options);
             if (isDebug)
             {


If fields are null, create an empty list - no longer throw exception

--- BankFileParsers/Helpers/ListToCsv.cs
+++ BankFileParsers/Helpers/ListToCsv.cs
@@ -22,7 +22,7 @@

         public static string ExportToCsv<T>(this List<T> list, List<string> dictionaryKeys, List<string> fields)
         {
-            if (fields == null) throw new NotImplementedException("fields cannot be null, worse case, pass in an empty list");
+            if (fields == null) fields = new List<string>();
             var ret = "";
             var dict = new Dictionary<string, PropertyInfo>();
             var type = typeof (T);


Remove IQueryable interface and implementation from LuceneStoreDecorator  #103

--- Biggy.Lucene/LuceneStoreDecorator.cs
+++ Biggy.Lucene/LuceneStoreDecorator.cs
@@ -16,16 +16,16 @@
     ///     Decorator class that adds lucene full text functionality to any store
     /// </summary>
     /// <typeparam name="T"></typeparam>
-    public class LuceneStoreDecorator<T> : IQueryableBiggyStore<T>, IDisposable where T : new()
+    public class LuceneStoreDecorator<T> : IBiggyStore<T>, IDisposable where T : new()
     {
         private readonly IBiggyStore<T> _biggyStore;
         private readonly LuceneIndexer<T> _luceneIndexer;
-        private readonly IQueryableBiggyStore<T> _queryableStore;
+        //private readonly IQueryableBiggyStore<T> _queryableStore;

         public LuceneStoreDecorator(IBiggyStore<T> biggyStore, bool useRamDirectory = false)
         {
             _biggyStore = biggyStore;
-            _queryableStore = _biggyStore as IQueryableBiggyStore<T>;
+            //_queryableStore = _biggyStore as IQueryableBiggyStore<T>;
             _luceneIndexer = new LuceneIndexer<T>(useRamDirectory);
         }

@@ -74,10 +74,10 @@
             _luceneIndexer.Dispose();
         }

-        public IQueryable<T> AsQueryable()
-        {
-            return _queryableStore.AsQueryable();
-        }
+        //public IQueryable<T> AsQueryable()
+        //{
+        //    return _queryableStore.AsQueryable();
+        //}

         public virtual T Update(T item)
         {


Added code to make type inference more robust in getting type of list to be used to populate a listview

--- Binding/Components/ListViewHelper.cs
+++ Binding/Components/ListViewHelper.cs
@@ -43,7 +43,7 @@
 			{
 				return;
 			}
-			var listedProps = GetColumnHeaderProperties(viewModelProperty);
+			var listedProps = GetColumnHeaderProperties(viewModel, viewModelProperty);
 			if (listedProps != null && listedProps.Count > 0)
 			{
 				foreach (var item in list)
@@ -75,18 +75,21 @@
 			}
 		}

-		private List<PropertyInfo> GetColumnHeaderProperties(PropertyInfo vmProp)
+		private List<PropertyInfo> GetColumnHeaderProperties(object viewModel, PropertyInfo viewModelProperty)
 		{
-			if(vmProp.PropertyType.GenericTypeArguments.Length == 0)
+			if(viewModelProperty.PropertyType.GenericTypeArguments.Length == 0)
 			{
 				throw new Exception("Only lists are currently supported for supplying ListView columns");
 			}
-		    var type = vmProp.PropertyType.GenericTypeArguments[0];
+		    var type = viewModelProperty.PropertyType.GenericTypeArguments[0];
 		    if (type.IsInterface)
 		    {
 		        return null;
 		    }
-			var columnSource = Activator.CreateInstance(type);
+            Type listType = InferListTypeFromContent(viewModel, viewModelProperty) ??
+                            InferListTypeFromViewModelProperty(viewModelProperty);
+
+            var columnSource = Activator.CreateInstance(listType);
 			return columnSource.GetType()
 				.GetProperties().Where(a => a.GetCustomAttribute<ListViewColumnAttribute>() != null && a.CanRead)
 				.ToList();


Increment version

Increment version

--- vmPing/Properties/AssemblyInfo.cs
+++ vmPing/Properties/AssemblyInfo.cs
@@ -12,7 +12,7 @@
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("vmPing")]
-[assembly: AssemblyCopyright("Copyright © 2020 Ryan Smith")]
+[assembly: AssemblyCopyright("Copyright © 2021 Ryan Smith")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

@@ -51,5 +51,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.4.0")]
-[assembly: AssemblyFileVersion("1.3.4.0")]
+[assembly: AssemblyVersion("1.3.8.0")]
+[assembly: AssemblyFileVersion("1.3.8.0")]


entity code generator duplicate file bugfix

--- CodeGenerator/EntityCodeGenerator.cs
+++ CodeGenerator/EntityCodeGenerator.cs
@@ -287,10 +287,13 @@
                 XElement g = null;
                 foreach (var group in doc.Elements(ns + "ItemGroup"))
                 {
-                    var compiles = group.Elements(ns + "Compile");
-                    foreach (var c in compiles)
+                    foreach (var c in group.Elements(ns + "Compile")
+                                .Concat(group.Elements(ns + "Content"))
+                                .Concat(group.Elements(ns + "None")))
                         if (c.Attribute("Include").Value.ToLowerInvariant() == codeFile.ToLowerInvariant())
-                            return;
+                        {
+                            return; // already in project file
+                        }
                 }

                 string contentType;


Fixed typo in doc

Fixed typo in doc

--- CotcSdk/HighLevel/Model/GamerInfo.cs
+++ CotcSdk/HighLevel/Model/GamerInfo.cs
@@ -6,7 +6,7 @@
 	/// Info about a player.
 	/// Can be enriched with information, accessible using the index operator [].
 	/// Typically contains a profile field, with displayname, email and lang. You can fetch this by doing
-	/// `string name = GamerInfo["profile"]["displayname"];`
+	/// `string name = GamerInfo["profile"]["displayName"];`
 	/// </summary>
 	public class GamerInfo: PropertiesObject {
 		/// <summary>Id of the gamer.</summary>


CustomBlocks: TimestampHelper class updated

--- CustomBlocks/UUID/TimestampHelper.cs
+++ CustomBlocks/UUID/TimestampHelper.cs
@@ -43,9 +43,10 @@
 		private static ulong curLCGValue;
 		//used for overflow check when timestamp is not increased over previous invoke to GenerateGUID method
 		private static ulong lastLCGValue;
-		//following constants ensures that LGC overflow will occur in 4294967290 rounds (this gives us almost 2^32 uinique values)
-		private const ulong m = 4294967291UL;
-		private const ulong a = 279470273UL;
+		//following constants ensures that LGC overflow will occur in 1048572 rounds (this gives us 2^20-3 uinique values)
+		//see http://statmath.wu-wien.ac.at/software/prng/doc/prng.html for constant selection details
+		private const ulong m = 1048573UL;
+		private const ulong a = 22202UL;

 		static TimestampHelper()
 		{


Restore cancellation token usage

Restore cancellation token usage

Restore use of the cancellation token to Program to allow for use in
tests.

--- src/API/Program.cs
+++ src/API/Program.cs
@@ -11,6 +11,7 @@
 {
     using System;
     using System.IO;
+    using System.Threading;
     using Microsoft.AspNetCore.Hosting;
     using Microsoft.Extensions.Configuration;

@@ -26,7 +27,17 @@
         /// <returns>
         /// The exit code from the application.
         /// </returns>
-        public static int Main(string[] args)
+        public static int Main(string[] args) => Run(args);
+
+        /// <summary>
+        /// Runs ths application.
+        /// </summary>
+        /// <param name="args">The arguments to the application.</param>
+        /// <param name="cancellationToken">The optional cancellation token to use.</param>
+        /// <returns>
+        /// The exit code from the application.
+        /// </returns>
+        public static int Run(string[] args, CancellationToken cancellationToken = default(CancellationToken))
         {
             try
             {
@@ -45,7 +56,16 @@

                 using (var host = builder.Build())
                 {
-                    host.Run();
+                    using (var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
+                    {
+                        Console.CancelKeyPress += (_, e) =>
+                        {
+                            tokenSource.Cancel();
+                            e.Cancel = true;
+                        };
+
+                        host.Run(tokenSource.Token);
+                    }
                 }

                 return 0;


Commented

Commented

--- DelegatesAndFuncs.Tests/NumsTests.cs
+++ DelegatesAndFuncs.Tests/NumsTests.cs
@@ -19,6 +19,7 @@
             CollectionAssert.AreEquivalent(expectedOutput, numsLowerThan10);
         }

+        // Showing exception testing
         [TestMethod]
         [ExpectedException(typeof(ArgumentException))]
         public void TestNameEmptyShouldThrowException()


tenants can be loaded from db

tenants can be loaded from db

--- Demos/SaasKit.Demos.Nancy/Program.cs
+++ Demos/SaasKit.Demos.Nancy/Program.cs
@@ -7,33 +7,69 @@
     using System;
     using System.Collections.Generic;
     using System.Linq;
+    using System.Net.Http;
+    using System.Net.Http.Headers;
+using System.Threading;

+    /*
+     The class that used to load data object from REST api
+
+     */
+    public class DataObject
+    {
+        public string TenantString { get; set; }
+        public string Name { get; set; }
+        //public int Id { get; set; }
+    }
+
+
+
+
+

     public class Program
     {
-        //public static UserTenant[] TenantList;
-        public static List<UserTenant> TenantList;
-        private const String HostFilePath = @"C:\Windows\System32\drivers\etc\Hosts";
-        private static string OriginalHostFile = "";
-
-        private static void Main(string[] args)
-        {
-            var startOptions = new StartOptions();
-
-            // Note: Add the following host entries to your host file
-            //      127.0.0.1    sony.localhost
-            //      127.0.0.1    samsung.localhost
-            //      127.0.0.1    htc.localhost
-
-
-            TenantList = new List<UserTenant>();
-
-            TenantList.Add(new UserTenant("Sony", 0, "sony.localhost", "127.0.0.1", 9000));
-            TenantList.Add(new UserTenant("Samsung", 1, "samsung.localhost", "127.0.0.1", 9000));
-            TenantList.Add(new UserTenant("HTC", 1, "htc.localhost", "127.0.0.1", 9000));
-            TenantList.Add(new UserTenant("Acer", 1, "acer.localhost", "127.0.0.1", 9000));
-
-
+
+
+        private static List<UserTenant> getTenantListFromDatabase()
+        {
+            string URL = "http://localhost:44552/api/tenants";
+            string urlParameters = "";
+            HttpClient client = new HttpClient();
+            client.BaseAddress = new Uri(URL);
+
+            // Add an Accept header for JSON format.
+            client.DefaultRequestHeaders.Accept.Add(
+            new MediaTypeWithQualityHeaderValue("application/json"));
+
+            // List data response.
+            HttpResponseMessage response = client.GetAsync(urlParameters).Result;  // Blocking call!
+
+            List<UserTenant> TenantList = new List<UserTenant>();
+
+            Console.WriteLine(response);
+            if (response.IsSuccessStatusCode)
+            {
+                // Parse the response body. Blocking!
+                var dataObjects = response.Content.ReadAsAsync<IEnumerable<DataObject>>().Result;
+                foreach (var d in dataObjects)
+                {
+                    Console.WriteLine("{0} {1}", d.Name, d.TenantString);
+                    //adding details to tenant list
+                    TenantList.Add(new UserTenant(d.Name, 0, d.TenantString+".localhost", "127.0.0.1", 9000));
+
+                }
+
+            }
+            else
+            {
+                Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
+            }
+            return TenantList;
+        }
+
+        public static void SpinProgram(StartOptions startOptions)
+        {
             /**
             * If you want to add a new tenant while program is running
             * In the command line, type these data separated by space
@@ -41,17 +77,6 @@
             * all the parameters are customizable
             * **/

-
-            SaveOriginalHostFile(HostFilePath);
-            AppendCurrentHosts(TenantList, HostFilePath);
-            DisplayCurrentHostFile(HostFilePath);
-            RegisterAllTenants(TenantList, startOptions);
-
-
-
-
-            while (true)
-            {
             using (WebApp.Start<Startup>(startOptions))
             {
                 Console.WriteLine("Running on {0}", string.Join(" and ", startOptions.Urls.ToArray()));
@@ -60,7 +85,7 @@
                 if (line == "")
                 {
                     RestoreOriginalHostFile(HostFilePath, OriginalHostFile);
-                    break;
+                    return;
                 }
                 else
                 {
@@ -71,7 +96,7 @@
                             dataInput[2], dataInput[3], Convert.ToInt32(dataInput[4]));

                         //Adding tenants when program is running
-                        AddNewTenant(TenantList, newUserTenant, HostFilePath,startOptions);
+                        AddNewTenant(TenantList, newUserTenant, HostFilePath, startOptions);
                     }
                     catch (Exception)
                     {
@@ -81,7 +106,49 @@
                 }

             }
-        }
+
+
+        }
+
+
+
+        //public static UserTenant[] TenantList;
+        public static List<UserTenant> TenantList;
+        private const String HostFilePath = @"C:\Windows\System32\drivers\etc\Hosts";
+        private static string OriginalHostFile = "";
+
+        private static void Main(string[] args)
+        {
+            var startOptions = new StartOptions();
+
+            // Note: Add the following host entries to your host file
+            //      127.0.0.1    sony.localhost
+            //      127.0.0.1    samsung.localhost
+            //      127.0.0.1    htc.localhost
+
+
+            TenantList = new List<UserTenant>();
+
+            //TenantList.Add(new UserTenant("Sony", 0, "sony.localhost", "127.0.0.1", 9000));
+            //TenantList.Add(new UserTenant("Samsung", 1, "samsung.localhost", "127.0.0.1", 9000));
+            //TenantList.Add(new UserTenant("HTC", 1, "htc.localhost", "127.0.0.1", 9000));
+            //TenantList.Add(new UserTenant("Acer", 1, "acer.localhost", "127.0.0.1", 9000));
+            TenantList=getTenantListFromDatabase();
+
+
+
+
+            SaveOriginalHostFile(HostFilePath);
+            AppendCurrentHosts(TenantList, HostFilePath);
+            DisplayCurrentHostFile(HostFilePath);
+            RegisterAllTenants(TenantList, startOptions);
+            SpinProgram(startOptions);
+
+
+
+
+
+
     }

         private static void AddNewTenant(List<UserTenant> tenantList, UserTenant newUserTenant, string hostFilePath, StartOptions startOptions)


Pager

Pager

--- DoingWell/UserControls/Pager.xaml.cs
+++ DoingWell/UserControls/Pager.xaml.cs
@@ -40,6 +40,7 @@
         private static void TotalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             (d as Pager).CalPageCount();
+            (d as Pager).RefreshLayout();
         }
         #endregion Total

@@ -55,6 +56,7 @@
         private static void PageSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             (d as Pager).CalPageCount();
+            (d as Pager).RefreshLayout();
         }
         #endregion PageSize

@@ -70,7 +72,6 @@
         private static void PageCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             (d as Pager).CurrentPage = 1;
-            (d as Pager).RefreshLayout();
         }
         #endregion PageCount


fixed SQL Syntax issue

fixed SQL Syntax issue

--- EAAddinFramework/EAWrappers/Model.cs
+++ EAAddinFramework/EAWrappers/Model.cs
@@ -862,6 +862,7 @@
                     this.repositoryType == RepositoryType.ORACLE ||
                     this.repositoryType == RepositoryType.FIREBIRD ||
                     this.repositoryType == RepositoryType.POSTGRES ||
+                    this.repositoryType == RepositoryType.MYSQL ||
                     this.repositoryType == RepositoryType.SQLITE)
             {
                 formattedSQL = formattedSQL.Replace("len(", "length(");


Fix #573

Fix #573

--- EDEngineer/Utils/BlueprintFilters.cs
+++ EDEngineer/Utils/BlueprintFilters.cs
@@ -104,6 +104,7 @@
                                   .Select(c => new CategoryFilter(c, $"BCF{c}"))
                                   .ToList();

+            InsertMagicFilters();
             AllFilters = GradeFilters.Cast<BlueprintFilter>()
                 .Union(EngineerFilters)
                 .Union(TypeFilters)
@@ -113,7 +114,6 @@

             LoadSavedFilters();

-            InsertMagicFilters();
         }

         private void LoadSavedFilters()
@@ -165,10 +165,10 @@
             _magicGradeFilter = GradeFilter.MagicFilter;
             GradeFilters.Insert(0, _magicGradeFilter);

-            var synthesisTypeFilter = new TypeFilter("@Synthesis", "TFSynthesis") { Checked = false } ;
+            var synthesisTypeFilter = new TypeFilter("@Synthesis", "TFSynthesis");
             TypeFilters.Add(synthesisTypeFilter);

-            var technologyTypeFilter = new TypeFilter("@Technology", "TFTechnology") { Checked = false };
+            var technologyTypeFilter = new TypeFilter("@Technology", "TFTechnology");
             TypeFilters.Add(technologyTypeFilter);
         }


Fix command clash warning for "ask" and "tell"

--- EditorController/EditorController.cs
+++ EditorController/EditorController.cs
@@ -2067,6 +2067,26 @@

         public CanAddVerbResult CanAddVerb(string verbPattern)
         {
+            if (verbPattern == "ask")
+            {
+                return new CanAddVerbResult
+                {
+                    CanAdd = false,
+                    ClashingCommand = "ask",
+                    ClashingCommandDisplay = "ask"
+                };
+            }
+
+            if (verbPattern == "tell")
+            {
+                return new CanAddVerbResult
+                {
+                    CanAdd = false,
+                    ClashingCommand = "tell",
+                    ClashingCommandDisplay = "tell"
+                };
+            }
+
             CanAddVerbResult result = new CanAddVerbResult();
             verbPattern += " object";


optimize SRP

optimize SRP

--- src/Sir.HttpServer/Views/Shared/SearchForm.cshtml
+++ src/Sir.HttpServer/Views/Shared/SearchForm.cshtml
@@ -66,7 +66,6 @@
     <input type="hidden" value="0" name="skip" id="skip" />
     <input type="hidden" value="100" name="take" id="take" />
     <input type="hidden" value="title" name="select" id="select" />
-    <input type="hidden" value="description" name="select" id="select" />
     <input type="hidden" value="url" name="select" id="select" />
     <input type="hidden" value="filename" name="select" id="select" />
 }


Increased the buffer size from 4096 to the largest possible size (81920 bytes) without the buffer ending up on the Large Object Heap

--- src/SwissArmyKnife/Extensions/StreamExtensions.cs
+++ src/SwissArmyKnife/Extensions/StreamExtensions.cs
@@ -10,7 +10,11 @@
     {
 #if NET35 // || DEBUG

-        private const int _defaultBufferSize = 4096;
+        /// 81920 is the largest multiple of 4096 that's
+        /// smaller than 85900 bytes. This makes the
+        /// buffer as large as possible without the short
+        /// lived object ending up on the Large Object Heap
+        private const int _defaultBufferSize = 81920;

         /// <summary>
         /// Reads the bytes from the current stream


Add Activator.CreateInstance negative tests (#15923)

Regression tests for issues found in CoreRT/.NET Native.

--- src/System.Runtime/tests/System/ActivatorTests.cs
+++ src/System.Runtime/tests/System/ActivatorTests.cs
@@ -85,8 +85,10 @@
             // out of Activator.CreateInstance. Accidental or not, we'll inherit that behavior on .NET Native.)
             Assert.Throws<InvalidCastException>(() => Activator.CreateInstance(typeof(Choice1), new object[] { new VarIntArgs(), 1, (short)2 }));

-            Assert.ThrowsAny<MissingMemberException>(() => Activator.CreateInstance<TypeWithoutDefaultCtor>()); // Type has no default constructor
-            Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance<TypeWithDefaultCtorThatThrows>()); // Type has a default constructor throws an exception
+            Assert.ThrowsAny<MissingMemberException>(() => Activator.CreateInstance(typeof(TypeWithoutDefaultCtor))); // Type has no default constructor
+            Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(typeof(TypeWithDefaultCtorThatThrows))); // Type has a default constructor throws an exception
+            Assert.ThrowsAny<MissingMemberException>(() => Activator.CreateInstance(typeof(AbstractTypeWithDefaultCtor))); // Type is abstract
+            Assert.ThrowsAny<MissingMemberException>(() => Activator.CreateInstance(typeof(IInterfaceType))); // Type is an interface

             // Type is not a valid RuntimeType
             Assert.Throws<ArgumentException>("type", () => Activator.CreateInstance(Helpers.NonRuntimeType()));
@@ -109,6 +111,23 @@

             Assert.ThrowsAny<MissingMemberException>(() => Activator.CreateInstance<TypeWithoutDefaultCtor>()); // Type has no default constructor
             Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance<TypeWithDefaultCtorThatThrows>()); // Type has a default constructor that throws
+            Assert.ThrowsAny<MissingMemberException>(() => Activator.CreateInstance<AbstractTypeWithDefaultCtor>()); // Type is abstract
+            Assert.ThrowsAny<MissingMemberException>(() => Activator.CreateInstance<IInterfaceType>()); // Type is an interface
+        }
+
+        [Fact]
+        public static void TestActivatorOnNonActivatableFinalizableTypes()
+        {
+            // On runtimes where the generic Activator is implemented with special codegen intrinsics, we might allocate
+            // an uninitialized instance of the object before we realize there's no default constructor to run.
+            // Make sure this has no observable side effects.
+            Assert.ThrowsAny<MissingMemberException>(() => { Activator.CreateInstance<TypeWithPrivateDefaultCtorAndFinalizer>(); });
+
+            GC.Collect();
+            GC.WaitForPendingFinalizers();
+            GC.Collect();
+
+            Assert.False(TypeWithPrivateDefaultCtorAndFinalizer.WasCreated);
         }

         class PrivateType
@@ -193,6 +212,27 @@

         public class VarIntArgs { }

+        public class TypeWithPrivateDefaultCtorAndFinalizer
+        {
+            public static bool WasCreated { get; private set; }
+
+            private TypeWithPrivateDefaultCtorAndFinalizer() { }
+
+            ~TypeWithPrivateDefaultCtorAndFinalizer()
+            {
+                WasCreated = true;
+            }
+        }
+
+        private interface IInterfaceType
+        {
+        }
+
+        public abstract class AbstractTypeWithDefaultCtor
+        {
+            public AbstractTypeWithDefaultCtor() { }
+        }
+
         public struct StructTypeWithoutReflectionMetadata { }

         public class TypeWithoutDefaultCtor


Fix bug Insert

Fix bug Insert

--- src/TITcs.SharePoint.SSOM/SharePointRepository.cs
+++ src/TITcs.SharePoint.SSOM/SharePointRepository.cs
@@ -1,5 +1,6 @@
 using Microsoft.SharePoint;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.IO;
@@ -112,11 +113,11 @@

                     foreach (var field in fields.ItemDictionary)
                     {
-                        if (field.Value is Collection<Lookup>)
+                        if (field.Value is IEnumerable<Lookup>)
                         {
                             var fieldValues = new SPFieldLookupValueCollection();

-                            foreach (var keyValuePair in (Collection<Lookup>)field.Value)
+                            foreach (var keyValuePair in (IEnumerable<Lookup>)field.Value)
                             {
                                 fieldValues.Add(new SPFieldLookupValue
                                 {
@@ -577,7 +578,11 @@
                     return new File
                     {
                         Url = fileRef,
-                        Name = fileName
+                        Name = fileName,
+                        Length = stream.Length,
+                        Created = DateTime.Now,
+                        Extension = ext,
+                        Title = fileName
                     };
                 }
             });


Fix errors related to multiple wrappers for the same object

--- src/HeapDump/GCHeapDumper.cs
+++ src/HeapDump/GCHeapDumper.cs
@@ -1271,7 +1271,7 @@
                             }

                             // Create a CCW node that represents the COM object that has one child that points at the managed object.
-                            var ccwNode = m_gcHeapDump.MemoryGraph.GetNodeIndex(comPtr);
+                            var ccwNode = m_gcHeapDump.MemoryGraph.GetNodeIndex(ccwInfo.Handle);
                             var typeName = "[CCW";
                             var targetType = m_dotNetHeap.GetObjectType(root.Object);
                             if (targetType != null)


Remove test code

Remove test code

--- src/MarkdownEdit/App.xaml.cs
+++ src/MarkdownEdit/App.xaml.cs
@@ -13,7 +13,6 @@
         private void OnStartup(object sender, StartupEventArgs ea)
         {
             InitializeSettings();
-            new RemoteManager();
         }

         private void InitializeSettings()


Removed byte[] from SARC

Removed byte[] from SARC

--- Cetera/Archive/SARC.cs
+++ Cetera/Archive/SARC.cs
@@ -1,193 +1,204 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Runtime.InteropServices;
-using Cetera.IO;
-
-namespace Cetera.Archive
-{
-    public sealed class SARC : List<SARC.Node>
-    {
-        public SARCHeader sarcHeader;
-        public SimplerSARCHeader ssarcHeader;
-        public SFATHeader sfatHeader;
-        public SFNTHeader sfntHeader;
-
-        [DebuggerDisplay("{fileName}")]
-        public class Node
-        {
-            public State state;
-            public SFATNode nodeEntry;
-            public SimplerSFATNode sNodeEntry;
-            public String fileName;
-            public byte[] fileData;
-        }
-        public enum State : byte
-        {
-            Normal = 0,
-            Simpler = 1
-        }
-
-        [StructLayout(LayoutKind.Sequential, Pack = 1)]
-        public struct SimplerSARCHeader
-        {
-            String4 magic;
-            public uint nodeCount;
-            uint unk1;
-            uint unk2;
-        }
-        [StructLayout(LayoutKind.Sequential, Pack = 1)]
-        public struct SimplerSFATNode
-        {
-            public uint hash;
-            public uint dataStart;
-            public uint dataLength;
-            public uint unk1;
-        }
-
-        [StructLayout(LayoutKind.Sequential, Pack = 1)]
-        public struct SARCHeader
-        {
-            String4 magic;
-            ushort headerSize;
-            ByteOrder byteOrder;
-            uint fileSize;
-            public uint dataOffset;
-            uint unk1;
-        }
-
-        [StructLayout(LayoutKind.Sequential, Pack = 1)]
-        public struct SFATHeader
-        {
-            String4 magic;
-            ushort headerSize;
-            public ushort nodeCount;
-            uint hashMultiplier;
-        }
-
-        [StructLayout(LayoutKind.Sequential, Pack = 1)]
-        public struct SFATNode
-        {
-            public uint nameHash;
-            public ushort SFNTOffset;
-            public ushort unk1;
-            public uint dataStart;
-            public uint dataEnd;
-        }
-
-        [StructLayout(LayoutKind.Sequential, Pack = 1)]
-        public struct SFNTHeader
-        {
-            String4 magic;
-            ushort headerSize;
-            ushort unk1;
-        }
-
-        public unsafe uint CalcNodeHash(String name, int hashMultiplier)
-        {
-            uint result = 0;
-
-            for (int i = 0; i < name.Length; i++)
-            {
-                result = (uint)(name[i] + (result * hashMultiplier));
-            }
-
-            return result;
-        }
-
-        public String readASCII(BinaryReaderX br)
-        {
-            String result = "";
-            Encoding ascii = Encoding.GetEncoding("ascii");
-
-            byte[] character = br.ReadBytes(1);
-            while (character[0] != 0x00)
-            {
-                result += ascii.GetString(character);
-                character = br.ReadBytes(1);
-            }
-            br.BaseStream.Position -= 1;
-
-            return result;
-        }
-
-        public SARC(Stream input)
-        {
-            using (BinaryReaderX br = new BinaryReaderX(input))
-            {
-                br.BaseStream.Position = 6;
-                ushort ind = br.ReadUInt16();
-                if (ind != 0xfeff && ind != 0xfffe)
-                {
-                    br.BaseStream.Position = 0;
-                    SimplerSARC(br.BaseStream);
-                }
-                else
-                {
-                    br.BaseStream.Position = 0;
-
-                    sarcHeader = br.ReadStruct<SARCHeader>();
-                    sfatHeader = br.ReadStruct<SFATHeader>();
-
-                    for (int i = 0; i < sfatHeader.nodeCount; i++)
-                    {
-                        Add(new Node());
-                        this[i].state = State.Normal;
-                        this[i].nodeEntry = br.ReadStruct<SFATNode>();
-                    }
-
-                    sfntHeader = br.ReadStruct<SFNTHeader>();
-
-                    for (int i = 0; i < sfatHeader.nodeCount; i++)
-                    {
-                        this[i].fileName = readASCII(br);
-
-                        byte tmp;
-                        do
-                        {
-                            tmp = br.ReadByte();
-                        } while (tmp == 0x00);
-                        br.BaseStream.Position -= 1;
-                    }
-
-                    for (int i = 0; i < sfatHeader.nodeCount; i++)
-                    {
-                        br.BaseStream.Position = sarcHeader.dataOffset + this[i].nodeEntry.dataStart;
-                        this[i].fileData = br.ReadBytes((int)(this[i].nodeEntry.dataEnd - this[i].nodeEntry.dataStart));
-                    }
-                }
-            }
-        }
-
-        public void SimplerSARC(Stream input)
-        {
-            using (BinaryReaderX br = new BinaryReaderX(input))
-            {
-                ssarcHeader = br.ReadStruct<SimplerSARCHeader>();
-
-                for (int i = 0; i < ssarcHeader.nodeCount; i++)
-                {
-                    Add(new Node());
-                    this[i].state = State.Simpler;
-                    this[i].sNodeEntry = br.ReadStruct<SimplerSFATNode>();
-                }
-
-                for (int i = 0; i < ssarcHeader.nodeCount; i++)
-                {
-                    br.BaseStream.Position = this[i].sNodeEntry.dataStart;
-                    this[i].fileName = "File" + i.ToString();
-                    this[i].fileData = br.ReadBytes((int)this[i].sNodeEntry.dataLength);
-                }
-            }
-        }
-
-        public void Save(Stream input)
-        {
-            int t = 0;
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices;
+using Cetera.IO;
+
+namespace Cetera.Archive
+{
+    public sealed class SARC : List<SARC.Node>
+    {
+        public SARCHeader sarcHeader;
+        public SimplerSARCHeader ssarcHeader;
+        public SFATHeader sfatHeader;
+        public SFNTHeader sfntHeader;
+
+        [DebuggerDisplay("{fileName}")]
+        public class Node
+        {
+            public State state;
+            public SFATNode nodeEntry;
+            public SimplerSFATNode sNodeEntry;
+            public String fileName;
+        }
+        public enum State : byte
+        {
+            Normal = 0,
+            Simpler = 1
+        }
+
+        [StructLayout(LayoutKind.Sequential, Pack = 1)]
+        public struct SimplerSARCHeader
+        {
+            String4 magic;
+            public uint nodeCount;
+            uint unk1;
+            uint unk2;
+        }
+        public class SimplerSFATNode
+        {
+            public SimplerSFATNode(Stream input)
+            {
+                using (BinaryReaderX br = new BinaryReaderX(input, true))
+                {
+                    hash = br.ReadUInt32();
+                    dataStart = br.ReadUInt32();
+                    dataLength = br.ReadUInt32();
+                    unk1 = br.ReadUInt32();
+                }
+            }
+            public uint hash;
+            public uint dataStart;
+            public uint dataLength;
+            public uint unk1;
+        }
+
+        [StructLayout(LayoutKind.Sequential, Pack = 1)]
+        public struct SARCHeader
+        {
+            String4 magic;
+            ushort headerSize;
+            ByteOrder byteOrder;
+            uint fileSize;
+            public uint dataOffset;
+            uint unk1;
+        }
+
+        [StructLayout(LayoutKind.Sequential, Pack = 1)]
+        public struct SFATHeader
+        {
+            String4 magic;
+            ushort headerSize;
+            public ushort nodeCount;
+            uint hashMultiplier;
+        }
+
+        public class SFATNode
+        {
+            public SFATNode(Stream input)
+            {
+                using (BinaryReaderX br = new BinaryReaderX(input, true))
+                {
+                    nameHash = br.ReadUInt32();
+                    SFNTOffset = br.ReadUInt16();
+                    unk1 = br.ReadUInt16();
+                    dataStart = br.ReadUInt32();
+                    dataEnd = br.ReadUInt32();
+                }
+            }
+            public uint nameHash;
+            public ushort SFNTOffset;
+            public ushort unk1;
+            public uint dataStart;
+            public uint dataEnd;
+        }
+
+        [StructLayout(LayoutKind.Sequential, Pack = 1)]
+        public struct SFNTHeader
+        {
+            String4 magic;
+            ushort headerSize;
+            ushort unk1;
+        }
+
+        public unsafe uint CalcNodeHash(String name, int hashMultiplier)
+        {
+            uint result = 0;
+
+            for (int i = 0; i < name.Length; i++)
+            {
+                result = (uint)(name[i] + (result * hashMultiplier));
+            }
+
+            return result;
+        }
+
+        public String readASCII(BinaryReaderX br)
+        {
+            String result = "";
+            Encoding ascii = Encoding.GetEncoding("ascii");
+
+            byte[] character = br.ReadBytes(1);
+            while (character[0] != 0x00)
+            {
+                result += ascii.GetString(character);
+                character = br.ReadBytes(1);
+            }
+            br.BaseStream.Position -= 1;
+
+            return result;
+        }
+
+        public SARC(Stream input)
+        {
+            using (BinaryReaderX br = new BinaryReaderX(input))
+            {
+                br.BaseStream.Position = 6;
+                ushort ind = br.ReadUInt16();
+                if (ind != 0xfeff && ind != 0xfffe)
+                {
+                    br.BaseStream.Position = 0;
+                    SimplerSARC(br.BaseStream);
+                }
+                else
+                {
+                    br.BaseStream.Position = 0;
+
+                    sarcHeader = br.ReadStruct<SARCHeader>();
+                    sfatHeader = br.ReadStruct<SFATHeader>();
+
+                    for (int i = 0; i < sfatHeader.nodeCount; i++)
+                    {
+                        Add(new Node());
+                        this[i].state = State.Normal;
+                        this[i].nodeEntry = br.ReadStruct<SFATNode>();
+                    }
+
+                    sfntHeader = br.ReadStruct<SFNTHeader>();
+
+                    for (int i = 0; i < sfatHeader.nodeCount; i++)
+                    {
+                        this[i].fileName = readASCII(br);
+
+                        byte tmp;
+                        do
+                        {
+                            tmp = br.ReadByte();
+                        } while (tmp == 0x00);
+                        br.BaseStream.Position -= 1;
+                    }
+                }
+            }
+        }
+
+        public void SimplerSARC(Stream input)
+        {
+            using (BinaryReaderX br = new BinaryReaderX(input))
+            {
+                ssarcHeader = br.ReadStruct<SimplerSARCHeader>();
+
+                for (int i = 0; i < ssarcHeader.nodeCount; i++)
+                {
+                    Add(new Node());
+                    this[i].state = State.Simpler;
+                    this[i].sNodeEntry = br.ReadStruct<SimplerSFATNode>();
+                }
+
+                for (int i = 0; i < ssarcHeader.nodeCount; i++)
+                {
+                    br.BaseStream.Position = this[i].sNodeEntry.dataStart;
+                    this[i].fileName = "File" + i.ToString();
+                }
+            }
+        }
+
+        public void Save(Stream input)
+        {
+            int t = 0;
+        }
+    }
+}


update CreateProxyWithTarget

update CreateProxyWithTarget

--- src/WeihanLi.Common/Aspect/DefaultProxyFactory.cs
+++ src/WeihanLi.Common/Aspect/DefaultProxyFactory.cs
@@ -66,7 +66,7 @@

             var implementType = implement.GetType();

-            var proxyType = implementType.IsSealed && serviceType.IsClass
+            var proxyType = serviceType.IsClass
                     ? _proxyTypeFactory.CreateProxyType(serviceType)
                     : _proxyTypeFactory.CreateProxyType(serviceType, implementType)
                 ;


using ConsoleWriter inside of CommandFactory

--- src/Oakton/CommandFactory.cs
+++ src/Oakton/CommandFactory.cs
@@ -85,7 +85,6 @@
             try
             {

-                // TODO -- change the signature to take in the app name when needed
                 var usageGraph = command.Usages;
                 var input = usageGraph.BuildInput(queue);

@@ -97,25 +96,21 @@
             }
             catch (InvalidUsageException e)
             {
-                Console.ForegroundColor = ConsoleColor.Red;
-                Console.WriteLine("Invalid usage");
+                ConsoleWriter.Write(ConsoleColor.Red, "Invalid usage");
+

                 if (e.Message.IsNotEmpty())
                 {
-                    Console.ForegroundColor = ConsoleColor.Yellow;
-                    Console.WriteLine(e.Message);
+                    ConsoleWriter.Write(ConsoleColor.Yellow, e.Message);
                 }

-                Console.ResetColor();
                 Console.WriteLine();
             }
             catch (Exception e)
             {
-                Console.ForegroundColor = ConsoleColor.Red;
-                Console.WriteLine("Error parsing input");
-                Console.ForegroundColor = ConsoleColor.Yellow;
-                Console.WriteLine(e);
-                Console.ResetColor();
+                ConsoleWriter.Write(ConsoleColor.Red, "Error parsing input");
+                ConsoleWriter.Write(ConsoleColor.Yellow, e.ToString());
+
                 Console.WriteLine();
             }


Added getStructureSet extension method on planItem

--- Extensions/PlanningItemExtensions.cs
+++ Extensions/PlanningItemExtensions.cs
@@ -14,7 +14,7 @@
     public static class PlanningItemExtensions
     {
         /// <summary>
-        /// Returns the structure set from the planning item. Removes the need to cast to plan or plan sum.
+        /// Returns the structures from the planning item. Removes the need to cast to plan or plan sum.
         /// </summary>
         /// <param name="plan">the planning item</param>
         /// <returns>the referenced structure set</returns>
@@ -29,6 +29,26 @@
             {
                 var p = plan as PlanSum;
                 return p.StructureSet?.Structures;
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// Returns the structure set from the planning item. Removes the need to cast to plan or plan sum.
+        /// </summary>
+        /// <param name="plan">the planning item</param>
+        /// <returns>the referenced structure set</returns>
+        public static StructureSet GetStructureSet(this PlanningItem plan)
+        {
+            if (plan is PlanSetup && plan != null)
+            {
+                var p = plan as PlanSetup;
+                return p.StructureSet;
+            }
+            if (plan is PlanSum && plan != null)
+            {
+                var p = plan as PlanSum;
+                return p.StructureSet;
             }
             return null;
         }


Bug in parsing cron pattern related to "L" in day of week field

--- src/Quartz/CronExpression.cs
+++ src/Quartz/CronExpression.cs
@@ -904,6 +904,10 @@
             {
                 if (type == DayOfWeek)
                 {
+                    if (val < 1 || val > 7)
+                    {
+                        throw new FormatException("Day-of-Week values must be between 1 and 7");
+                    }
                     lastdayOfWeek = true;
                 }
                 else


Ignoring broken test

Ignoring broken test

--- test/FunctionalTests/CoreCLRTests/RazorSdkUsedTest_CoreCLR.cs
+++ test/FunctionalTests/CoreCLRTests/RazorSdkUsedTest_CoreCLR.cs
@@ -22,7 +22,7 @@

         public ApplicationTestFixture Fixture { get; }

-        [Fact]
+        [Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/241")]
         public async Task Publish_UsesRazorSDK()
         {
             using (StartLog(out var loggerFactory))


RIDER-20161


Add unit tests for seasons module season ratings request.


example

example

--- ConsoleTest/Program.cs
+++ ConsoleTest/Program.cs
@@ -14,21 +14,30 @@
     {
         static void Main(string[] args)
         {
-            using (FeigReaderTcpConnection connection = new FeigReaderTcpConnection("192.168.1.125", 10001))
+            using (FeigReaderTcpConnection connection = new FeigReaderTcpConnection("192.168.1.125", 10001))
             {
                 LRU1002Reader reader = new LRU1002Reader(connection);
                 UpdateConfiguration(reader);

-                DateTime startDateTime = DateTime.Now;
-                IList<FeigTag> tags = reader.Inventory(FeigReaderAntenna.Antenna1, FeigReaderAntenna.Antenna4);
-                DateTime endDateTime = DateTime.Now;
+                while (true)
+                {
+                    DateTime startDateTime = DateTime.Now;
+                    IList<FeigTag> tags = reader.Inventory(FeigReaderAntenna.Antenna1, FeigReaderAntenna.Antenna4);
+                    DateTime endDateTime = DateTime.Now;

-                foreach (FeigTag tag in tags)
-                {
-                    Console.WriteLine("Ant. " + tag.Antenna + " " + tag.RSSI + " dBm, " + ArrayToString(tag.SerialNumber));
+                    foreach (FeigTag tag in tags)
+                    {
+                        Console.WriteLine("Ant. " + tag.Antenna + " " + tag.RSSI + " dBm, " + ArrayToString(tag.SerialNumber) + " - " + ArrayToString(tag.Handle));
+                    }
+
+                    Console.WriteLine("in " + (endDateTime - startDateTime).TotalMilliseconds);
+
+                    //byte[] sendAndRecieve = connection.SendAndRecieve(0xFF, 0xB0, 0x24, 0x30, 0x01, 0x00, 0x01, 0x07, 0x02, 0x30, 0x00, 0x20, 0x14, 0x12, 0x19, 0x87, 0x40, 0x03, 0x00, 0x01, 0x02, 0x2F, 0xBE);
+
+                    Console.ReadKey();
+                    Console.Clear();
                 }
-
-                Console.WriteLine("in " + (endDateTime - startDateTime).TotalMilliseconds);
+
             }

             Console.ReadKey();


Remove Obsolete tag from RequestBody constructor.

--- src/RestSharp/RequestBody.cs
+++ src/RestSharp/RequestBody.cs
@@ -20,7 +20,6 @@
         public string Name { get; }
         public object Value { get; }

-        [Obsolete("The RestBody constructor will be internal in future versions")]
         public RequestBody(string contentType, string name, object value) {
             ContentType = contentType;
             Name        = name;


What's that dollar sign doing there

What's that dollar sign doing there

--- src/Squirrel/ReleaseEntry.cs
+++ src/Squirrel/ReleaseEntry.cs
@@ -53,7 +53,7 @@
         public string EntryAsString {
             get {
                 if (StagingPercentage != null) {
-                    return String.Format("{0} {1}{2} {3} # ${4}", SHA1, BaseUrl, Filename, Filesize, stagingPercentageAsString(StagingPercentage.Value));
+                    return String.Format("{0} {1}{2} {3} # {4}", SHA1, BaseUrl, Filename, Filesize, stagingPercentageAsString(StagingPercentage.Value));
                 } else {
                     return String.Format("{0} {1}{2} {3}", SHA1, BaseUrl, Filename, Filesize);
                 }


reverted client from temp change

reverted client from temp change

--- CrowesNest/HackTool.cs
+++ CrowesNest/HackTool.cs
@@ -30,8 +30,7 @@
         [XmlElement("Category")]
         public string Category { get; set; }

-        //public string Client { get; set; } = @"Z:\XYZ";
-        public string Client { get; set; } = @"C:\Users\Raul Martinez\Desktop\test output";
+        public string Client { get; set; } = @"Z:\XYZ";
         public string DeployString { get; set; }
         public bool AutoLog { get; set; }


Extracted Compile code to CompileIntoAssembly receiving outputpath and references.

--- src/Tools/RPCGen/Compiler.cs
+++ src/Tools/RPCGen/Compiler.cs
@@ -13,16 +13,15 @@
  * under the License.
  */

+using Microsoft.CSharp;
+using RPCGen;
 using System;
+using System.CodeDom.Compiler;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
 using System.Reflection;
-using System.CodeDom.Compiler;
-using Microsoft.CSharp;
 using System.Text;
-using System.Linq;
-using RPCGen;

 namespace Flood.Tools.RPCGen
 {
@@ -170,45 +169,32 @@
             Console.WriteLine("Generated '{0}'", fileName);
         }

-        public void Compile(string outputAssemblyPath)
-        {
-            outputAssemblyPath = Path.GetFullPath(outputAssemblyPath);
-            var generatedAssemblyPath = Path.GetFullPath(Path.GetRandomFileName())+".dll";
-
-            CodeDomProvider provider = new CSharpCodeProvider();
-            CompilerParameters cp = new CompilerParameters()
-            {
-                GenerateExecutable = false,
-                OutputAssembly = generatedAssemblyPath,
-                IncludeDebugInformation = true
-            };
-
-            var dlls = new DirectoryInfo(".").GetFiles("*.dll");
-            var references = new HashSet<string>();
-
-            foreach (var assemblyName in assembly.GetReferencedAssemblies())
-            {
-                string location;
-                var dll = dlls.FirstOrDefault(fi => fi.Name == assemblyName.Name + ".dll");
-                if(dll != null)
-                    location = dll.FullName;
-                else
-                    location = Assembly.Load(assemblyName).Location;
-
-                references.Add(location);
-            }
-
-            // Add an explicit reference to the EngineBindings.dll.
-            var bindings = dlls.FirstOrDefault(fi => fi.Name == "EngineBindings.dll");
-            if (bindings != null)
-                references.Add(bindings.FullName);
-
-            foreach (var @ref in references)
-                cp.ReferencedAssemblies.Add(@ref);
-
-            cp.ReferencedAssemblies.Add(destAssemblyPath);
-
-            try {
+        public void Compile(string outputPath)
+        {
+            var references = GetAssemblyReferencesPaths(assembly);
+
+            CompileIntoAssembly(destAssemblyPath, outputPath, references);
+        }
+
+        private void CompileIntoAssembly(string destPath, string outputPath, HashSet<string> references)
+        {
+            outputPath = Path.GetFullPath(outputPath);
+
+            using (var generatedAssembly = new TemporaryAssemblyPaths())
+            {
+                CodeDomProvider provider = new CSharpCodeProvider();
+                CompilerParameters cp = new CompilerParameters()
+                {
+                    GenerateExecutable = false,
+                    OutputAssembly = generatedAssembly.DllPath,
+                    IncludeDebugInformation = true
+                };
+
+                references.Add(destPath);
+
+                foreach (var @ref in references)
+                    cp.ReferencedAssemblies.Add(@ref);
+
                 CompilerResults cr = provider.CompileAssemblyFromFile(cp, GeneratedFiles.ToArray());

                 if (cr.Errors.HasErrors)
@@ -220,14 +206,22 @@
                     throw new Exception(message.ToString());
                 }

-                var weaver = new EngineWeaver.AssemblyWeaver(destAssemblyPath);
-                weaver.AddAssembly(generatedAssemblyPath);
-                weaver.Write(outputAssemblyPath);
-
-            } finally
-            {
-                File.Delete(generatedAssemblyPath);
-            }
+                var weaver = new EngineWeaver.AssemblyWeaver(destPath);
+                weaver.AddAssembly(generatedAssembly.DllPath);
+                weaver.Write(outputPath);
+            }
+        }
+
+        private static HashSet<string>  GetAssemblyReferencesPaths(Assembly assembly)
+        {
+            var references = new HashSet<string>();
+
+            foreach (var assemblyName in assembly.GetReferencedAssemblies())
+            {
+                references.Add(assemblyName.Name + ".dll");
+            }
+
+            return references;
         }
     }
 }


Updated LoadFromXXX() methods to use ISerializable.Deserialize() methods

git-svn-id: 95472bb50cfb75dbf91fed26dc933cae36d5c45c@197 1ca100b6-b014-4248-a4f8-5dbb9f49130a

--- DDay.iCal/iCalendar.cs
+++ DDay.iCal/iCalendar.cs
@@ -9,6 +9,7 @@
 using System.Text;
 using DDay.iCal.Components;
 using DDay.iCal.DataTypes;
+using DDay.iCal.Serialization;

 namespace DDay.iCal
 {
@@ -369,22 +370,43 @@
         /// </summary>
         /// <param name="Filepath">The path to the file to load.</param>
         /// <returns>An <see cref="iCalendar"/> object</returns>
-        static public iCalendar LoadFromFile(string Filepath) { return LoadFromFile(typeof(iCalendar), Filepath); }
+        static public iCalendar LoadFromFile(string Filepath)
+        {
+            return LoadFromFile(
+                typeof(iCalendar),
+                Filepath,
+                Encoding.UTF8,
+                new iCalendarSerializer());
+        }
         static public T LoadFromFile<T>(string Filepath)
         {
             if (typeof(T) == typeof(iCalendar) ||
                 typeof(T).IsSubclassOf(typeof(iCalendar)))
             {
-                object obj = LoadFromFile(typeof(T), Filepath);
+                object obj = LoadFromFile(
+                    typeof(T),
+                    Filepath,
+                    Encoding.UTF8,
+                    new iCalendarSerializer());
                 return (T)obj;
             }
             else return default(T);
         }
         static public iCalendar LoadFromFile(Type iCalendarType, string Filepath)
-        {
+        {
+            return LoadFromFile(
+                iCalendarType, Filepath, Encoding.UTF8, new iCalendarSerializer());
+        }
+        static public iCalendar LoadFromFile(Type iCalendarType, string Filepath, Encoding encoding)
+        {
+            return LoadFromFile(
+                iCalendarType, Filepath, encoding, new iCalendarSerializer());
+        }
+        static public iCalendar LoadFromFile(Type iCalendarType, string Filepath, Encoding encoding, ISerializable serializer)
+        {
             FileStream fs = new FileStream(Filepath, FileMode.Open);

-            iCalendar iCal = LoadFromStream(iCalendarType, fs);
+            iCalendar iCal = LoadFromStream(iCalendarType, fs, encoding, serializer);
             fs.Close();
             return iCal;
         }
@@ -394,45 +416,67 @@
         /// </summary>
         /// <param name="s">The stream from which to load the <see cref="iCalendar"/> object</param>
         /// <returns>An <see cref="iCalendar"/> object</returns>
-        static new public iCalendar LoadFromStream(Stream s) { return LoadFromStream(typeof(iCalendar), s); }
-        static new public iCalendar LoadFromStream(TextReader tr) { return LoadFromStream(typeof(iCalendar), tr); }
+        static new public iCalendar LoadFromStream(Stream s)
+        {
+            return LoadFromStream(typeof(iCalendar), s, Encoding.UTF8);
+        }
+        static new public iCalendar LoadFromStream(Stream s, Encoding encoding)
+        {
+            return LoadFromStream(typeof(iCalendar), s, encoding);
+        }
+        static new public iCalendar LoadFromStream(TextReader tr)
+        {
+            return LoadFromStream(typeof(iCalendar), tr);
+        }
         static new public T LoadFromStream<T>(TextReader tr)
+        {
+            return LoadFromStream<T>(tr, new iCalendarSerializer());
+        }
+        static new public T LoadFromStream<T>(TextReader tr, ISerializable serializer)
         {
             if (typeof(T) == typeof(iCalendar) ||
                 typeof(T).IsSubclassOf(typeof(iCalendar)))
-                return (T)(object)LoadFromStream(typeof(T), tr);
+                return (T)(object)LoadFromStream(typeof(T), tr, serializer);
             else return default(T);
         }
         static new public T LoadFromStream<T>(Stream s)
+        {
+            return LoadFromStream<T>(s, Encoding.UTF8, new iCalendarSerializer());
+        }
+        static new public T LoadFromStream<T>(Stream s, Encoding encoding)
+        {
+            return LoadFromStream<T>(s, encoding, new iCalendarSerializer());
+        }
+        static new public T LoadFromStream<T>(Stream s, Encoding encoding, ISerializable serializer)
         {
             if (typeof(T) == typeof(iCalendar) ||
                 typeof(T).IsSubclassOf(typeof(iCalendar)))
-                return (T)(object)LoadFromStream(typeof(T), s);
+                return (T)(object)LoadFromStream(typeof(T), s, encoding, serializer);
             else return default(T);
         }
         static public iCalendar LoadFromStream(Type iCalendarType, Stream s)
+        {
+            return LoadFromStream(iCalendarType, s, Encoding.UTF8);
+        }
+        static public iCalendar LoadFromStream(Type iCalendarType, Stream s, Encoding e)
+        {
+            iCalendarSerializer serializer = new iCalendarSerializer();
+            return (iCalendar)serializer.Deserialize(s, e, iCalendarType);
+        }
+        static public iCalendar LoadFromStream(Type iCalendarType, TextReader tr)
+        {
+            iCalendarSerializer serializer = new iCalendarSerializer();
+            return (iCalendar)serializer.Deserialize(tr, iCalendarType);
+        }
+        static public iCalendar LoadFromStream(Type iCalendarType, Stream s, Encoding e, ISerializable serializer)
         {
-            TextReader tr = new StreamReader(s, Encoding.UTF8);
-            return LoadFromStream(iCalendarType, tr);
-        }
-        static public iCalendar LoadFromStream(Type iCalendarType, TextReader tr)
-        {
-            // Create a lexer for our text stream
-            iCalLexer lexer = new iCalLexer(tr);
-            iCalParser parser = new iCalParser(lexer);
-
-            // Determine the calendar type we'll be using when constructing
-            // iCalendar objects...
-            parser.iCalendarType = iCalendarType;
-
-            // Parse the iCalendar!
-            iCalendar iCal = parser.icalobject();
-
-            // Close our text stream
-            tr.Close();
-
-            // Return the parsed iCalendar
-            return iCal;
+            return (iCalendar)serializer.Deserialize(s, e, iCalendarType);
+        }
+        static public iCalendar LoadFromStream(Type iCalendarType, TextReader tr, ISerializable serializer)
+        {
+            string text = tr.ReadToEnd();
+            MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(text));
+            return LoadFromStream(iCalendarType, ms, Encoding.UTF8, serializer);
         }

         /// <summary>
@@ -488,7 +532,7 @@
                 ms.SetLength(bytes.Length);
                 bytes.CopyTo(ms.GetBuffer(), 0);

-                return LoadFromStream(iCalendarType, ms);
+                return LoadFromStream(iCalendarType, ms, Encoding.UTF8);
             }
             catch (System.Net.WebException ex)
             {


Update HtmlRenderOptions.cs (#91)

Update HtmlRenderOptions.cs (#91)

* Update HtmlRenderOptions.cs

* Update HtmlRenderOptions.cs

--- Flashback.Model/HtmlRenderOptions.cs
+++ Flashback.Model/HtmlRenderOptions.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Text;

 namespace Flashback.Model
@@ -16,37 +16,10 @@
         public bool RenderEmoticons { get; set; }
         public bool ShowSignatures { get; set; }

-        private string GetForeColor()
-        {
-            if (IsDarkThemed)
-                return "#ffffff";
-
-            return "#000000";
-        }
-
-        private string GetBackgroundColor()
-        {
-            if (IsDarkThemed)
-                return "#000000";
-            else
-                return "#ffffff";
-        }
-
-        private string GetQuotesBackground()
-        {
-            if (IsDarkThemed)
-                return "#3D3D3D";
-            else
-                return "#DEDEDE";
-        }
-
-        private string GetQuotesBorder()
-        {
-            if (IsDarkThemed)
-                return "#ffffff";
-            else
-                return "#000000";
-        }
+        private string GetForeColor() => IsDarkThemed ? "#ffffff" : "#000000";
+        private string GetBackgroundColor() => IsDarkThemed ? "#000000" : "#ffffff";
+        private string GetQuotesBackground() => IsDarkThemed ? "#3d3d3d" : "#dedede";
+        private string GetQuotesBorder() => IsDarkThemed ? "#ffffff" : "#000000";

         public string ReplaceSmileys(string postMessage)
         {


Support providing exception messages for Guard.NotNull()

--- DevTyr.Gullap/Guard.cs
+++ DevTyr.Gullap/Guard.cs
@@ -4,10 +4,10 @@
 {
 	public static class Guard
 	{
-		public static void NotNull (object obj, string argumentName)
+		public static void NotNull (object obj, string argumentName, string message = null)
 		{
 			if (obj == null)
-				throw new ArgumentNullException(argumentName);
+				throw new ArgumentNullException(argumentName, message);
 		}

 		public static void NotNullOrEmpty (string obj, string argumentName)


Hydra. Rithmic task fix.

Hydra. Rithmic task fix.

--- Hydra/Plugins/Rithmic/RithmicTask.cs
+++ Hydra/Plugins/Rithmic/RithmicTask.cs
@@ -81,8 +81,8 @@
 			[PropertyOrder(3)]
 			public RithmicServers Server
 			{
-				get { return ExtensionInfo["RithmicServers"].To<RithmicServers>(); }
-				set { ExtensionInfo["AdminConnectionPoint"] = value.To<string>(); }
+				get { return ExtensionInfo["Server"].To<RithmicServers>(); }
+				set { ExtensionInfo["Server"] = value.To<string>(); }
 			}

 			/// <summary>


Schedule completions so First doesn't get trolled

--- Akavache.Sqlite3/OperationQueue.cs
+++ Akavache.Sqlite3/OperationQueue.cs
@@ -21,6 +21,7 @@
     class SqliteOperationQueue
     {
         readonly AsyncLock flushLock = new AsyncLock();
+        readonly IScheduler scheduler;

         readonly BulkSelectSqliteOperation bulkSelectKey;
         readonly BulkSelectByTypeSqliteOperation bulkSelectType;
@@ -38,6 +39,8 @@

         public SqliteOperationQueue(SQLiteConnection conn, IScheduler scheduler)
         {
+            this.scheduler = scheduler;
+
             bulkSelectKey = new BulkSelectSqliteOperation(conn, false);
             bulkSelectType = new BulkSelectByTypeSqliteOperation(conn);
             bulkInsertKey = new BulkInsertSqliteOperation(conn);
@@ -219,12 +222,19 @@
             var subj = (AsyncSubject<T>)completion;
             try
             {
-                subj.OnNext(block());
-                subj.OnCompleted();
+                var result = block();
+
+                // NB: We do this in a scheduled result to stop First() and friends
+                // from blowing up
+                scheduler.Schedule(() =>
+                {
+                    subj.OnNext(result);
+                    subj.OnCompleted();
+                });
             }
             catch (Exception ex)
             {
-                subj.OnError(ex);
+                scheduler.Schedule(() => subj.OnError(ex));
             }
         }

@@ -234,11 +244,16 @@
             try
             {
                 block();
-                subj.OnNext(Unit.Default); subj.OnCompleted();
+
+                scheduler.Schedule(() =>
+                {
+                    subj.OnNext(Unit.Default);
+                    subj.OnCompleted();
+                });
             }
             catch (Exception ex)
             {
-                subj.OnError(ex);
+                scheduler.Schedule(() => subj.OnError(ex));
             }
         }
     }


Storage. Fix PriceStep and VolumeStep = 0.


Cache string builder.

Cache string builder.

--- ArkeOS.Tools.KohlCompiler/Lexer.cs
+++ ArkeOS.Tools.KohlCompiler/Lexer.cs
@@ -69,6 +69,7 @@
         }

         private readonly Queue<FileInfo> files;
+        private readonly StringBuilder builder;
         private FileInfo file;
         private bool eof;
         private Token currentToken;
@@ -77,6 +78,7 @@

         public Lexer(IReadOnlyList<string> filePaths) {
             this.files = new Queue<FileInfo>(filePaths.Select(f => new FileInfo(f)));
+            this.builder = new StringBuilder();
             this.file = this.files.Dequeue();
             this.eof = false;
             this.currentToken = this.LexNextToken();
@@ -106,27 +108,28 @@
         private bool TryReadChar(Predicate<char> predicate, out char chr) => this.TryPeekChar(out chr) && predicate(chr) && this.TryReadChar(out _);

         private Token ReadWhitespace() {
-            var res = new StringBuilder();
+            this.builder.Clear();

             while (this.TryReadChar(char.IsWhiteSpace, out var c))
-                res.Append(c);
-
-            return new Token(TokenType.Whitespace, res.ToString());
+                this.builder.Append(c);
+
+            return new Token(TokenType.Whitespace, this.builder.ToString());
         }

         private Token ReadWord() {
-            var res = new StringBuilder();
+            this.builder.Clear();

             while (this.TryReadChar(chr => char.IsLetterOrDigit(chr) || chr == '_', out var c))
-                res.Append(c);
-
-            var str = res.ToString();
+                this.builder.Append(c);
+
+            var str = this.builder.ToString();

             return Lexer.Keywords.TryGetValue(str, out var t) ? new Token(t) : new Token(TokenType.Identifier, str);
         }

         private Token ReadNumber() {
-            var res = new StringBuilder();
+            this.builder.Clear();
+
             var radix = 10;

             if (this.TryReadChar('0')) {
@@ -134,16 +137,16 @@
                 else if (this.TryReadChar('x')) radix = 16;
                 else if (this.TryReadChar('b')) radix = 2;
                 else if (this.TryReadChar('o')) radix = 8;
-                else res.Append('0');
+                else this.builder.Append('0');
             }

             var valid = Lexer.ValidDigitsForBase[radix];

             while (this.TryReadChar(chr => valid.Contains(chr) || chr == '_', out var c))
                 if (c != '_')
-                    res.Append(c);
-
-            return new Token(TokenType.Number, Convert.ToUInt64(res.ToString(), radix).ToString());
+                    this.builder.Append(c);
+
+            return new Token(TokenType.Number, Convert.ToUInt64(this.builder.ToString(), radix).ToString());
         }

         private Token ReadSymbol() {


fix bug link

fix bug link

--- Assets/Script/Constelation/Link.cs
+++ Assets/Script/Constelation/Link.cs
@@ -32,6 +32,7 @@
 		so.ApplyModifiedProperties ();

 		float alpha = Vector3.Angle (vector, new Vector3 (1, 0, 0));
+		alpha = (vector.y < 0) ? -alpha : alpha;
 		this.transform.Rotate (new Vector3(0,0,alpha));
 	}


AppStateSettings: Enable local tile service.

--- Assets/Scripts/AppStateSettings.cs
+++ Assets/Scripts/AppStateSettings.cs
@@ -1,13 +1,11 @@
-using UnityEngine;
+using System;
+using UnityEngine;
 using MapzenGo.Models;
 using System.Collections.Generic;
 using System.Linq;
 using Assets.Scripts.Classes;
-using Assets.Scripts.Utils;
 using MapzenGo.Models.Plugins;
 using UniRx;
-using System;
-using Assets.MapzenGo.Models.Enums;

 namespace Assets.Scripts
 {
@@ -17,7 +15,6 @@
         public const string HideLayerSpeech = "Show ";
         public const string ToggleSpeech = "Toggle ";

-
         public GameObject World;
         public GameObject Terrain;
         public GameObject Table;
@@ -32,7 +29,7 @@
         } // guarantee this will be always a singleton only - can't use the constructor!

         public Vector3 Center { get; set; }
-        public CachedTileManager TileManager { get; set; }
+        public TileManager TileManager { get; set; }

         public AppConfig Config { get; set; }
         public ViewState State { get; set; }
@@ -43,6 +40,7 @@
         public void Init()
         {
             Speech = new SpeechManager();
+            MapzenTags.ForEach(k => Speech.AddKeyword(ToggleSpeech + k, () => ToggleMapzen(k)));
         }

         private void ToggleMapzen(string tag)
@@ -112,36 +110,46 @@
             InitMap();
         }

+        public void ClearCache()
+        {
+            var tm = TileManager as CachedTileManager;
+            if (tm != null)
+            {
+                tm.ClearCache();
+                ResetMap();
+            }
+        }
+
         public void InitMap()
         {
             var iv = Config.InitalView;
-
-            //Enum.GetNames(typeof(PoiType)).ToList().ForEach(pt =>
-            //{
-            //    if (!MapzenTags.Contains(pt)) MapzenTags.Add(pt);
-            //});

             var i = iv.Range;
             if (i > mapScales.Length) i = mapScales.Length;
             var mapScale = mapScales[i - 1];
             Map.transform.localScale = new Vector3(mapScale, mapScale, mapScale);

-            MapzenTags.ForEach(k => Speech.AddKeyword(ToggleSpeech + k, () => ToggleMapzen(k)));
             World = new GameObject("World");
             World.transform.SetParent(Map.transform, false);

             // init map
+#if DEBUG
+            var tm = World.AddComponent<TileManager>();
+            tm._mapzenUrl = "http://localhost:10733/{0}/{1}/{2}/{3}.{4}";
+#else
             var tm = World.AddComponent<CachedTileManager>();
+            tm._key = "vector-tiles-dB21RAF";
+            Speech.AddKeyword("Clear cache", () => { tm.ClearCache(); });
+#endif
             tm.Latitude = iv.Lat;
             tm.Longitude = iv.Lon;
             tm.Range = iv.Range;
             tm.Zoom = iv.Zoom;
             tm.TileSize = iv.TileSize;
-            tm._key = "vector-tiles-dB21RAF";

             TileManager = tm;

-            #region UI
+#region UI

             var ui = new GameObject("UI"); // Placeholder (root element in UI tree)
             ui.transform.SetParent(World.transform, false);
@@ -153,11 +161,11 @@
             AddRectTransformToGameObject(poi);
             poi.transform.SetParent(ui.transform, false);

-            #endregion
-
-            #region FACTORIES
-
-            #region defaultfactories
+#endregion
+
+#region FACTORIES
+
+#region defaultfactories
             var factories = new GameObject("Factories");
             factories.transform.SetParent(World.transform, false);

@@ -204,6 +212,16 @@
                 var pois = new GameObject("PoiFactory");
                 pois.transform.SetParent(factories.transform, false);
                 var poisFactory = pois.AddComponent<PoiFactory>();
+            }
+
+            if (iv.Mapzen.Contains("assets")) // assets
+            {
+                var models = new GameObject("ModelFactory");
+                models.transform.SetParent(factories.transform, false);
+                var modelFactory = models.AddComponent<ModelFactory>();
+                //modelFactory.scale = Table.transform.localScale.x;
+                modelFactory.scale = 2;
+                modelFactory.BundleURL = "http://localhost/buildings/eindhoven";
             }

             #endregion
@@ -225,9 +243,9 @@
                 });
             }

-            #endregion
-
-            #region TILE PLUGINS
+#endregion
+
+#region TILE PLUGINS

             var tilePlugins = new GameObject("TilePlugins");
             tilePlugins.transform.SetParent(World.transform, false);
@@ -267,7 +285,7 @@
                 });
             }

-            #endregion
+#endregion
             //tileLayer.transform.SetParent(tilePlugins.transform, false);
             //var tileLayerPlugin = tileLayer.AddComponent<TileLayerPlugin>();
             //tileLayerPlugin.tileLayers = Config.Layers;


Fixed bug display dialog of interactable

--- Assets/Scripts/PlayerController.cs
+++ Assets/Scripts/PlayerController.cs
@@ -221,7 +221,7 @@

                 if(interactableController.playerOrientation == PlayerOrientation.None || interactableController.playerOrientation == playerOrientation)
                 {
-                    if(interactiveObject != interactionCollider.gameObject && dialogController.Show(interactableController.actions))
+                    if(dialogController.Show(interactableController.actions))
                     {
                         interactiveObject = interactionCollider.gameObject;
                         break;


#236 puzzle clue count wrong.

#236 puzzle clue count wrong.

--- Assets/Scripts/Quest/PuzzleCode.cs
+++ Assets/Scripts/Quest/PuzzleCode.cs
@@ -162,14 +162,19 @@

             for (int i = 0; i < guess.Count; i++)
             {
-                bool done = false;
+                if (guess[i] && answer.state[i]) continue;
+
                 for (int j = 0; j < answer.state.Count; j++)
                 {
-                    if (!done && i != j && !used[j] && answer.state[j] == guess[i] && answer.state[j] != guess[j])
+                    if (i == j) continue;
+                    if (used[j]) continue;
+                    if (answer.state[j] == guess[j]) continue;
+
+                    if (answer.state[j] == guess[i])
                     {
                         r++;
-                        done = true;
                         used[j] = true;
+                        break;
                     }
                 }
             }


fix test

fix test

--- BTCPayServer.Tests/StorageTests.cs
+++ BTCPayServer.Tests/StorageTests.cs
@@ -223,7 +223,7 @@

             //delete file
             Assert.IsType<RedirectToActionResult>(await controller.DeleteFile(fileId));
-            controller.TempData.GetStatusMessageModel();
+            statusMessageModel = controller.TempData.GetStatusMessageModel();
             Assert.NotNull(statusMessageModel);

             Assert.Equal(StatusMessageModel.StatusSeverity.Success, statusMessageModel.Severity);


Remove asserts.

Remove asserts.

--- RenderEngine.cs
+++ RenderEngine.cs
@@ -407,11 +407,6 @@
 					depth = RenderWindow.OpenChannel(RenderWindow.StandardChannels.DistanceFromCamera)
 					)
 				{
-					sdd.Assert(channel != null);
-					sdd.Assert(nx!= null);
-					sdd.Assert(ny!= null);
-					sdd.Assert(nz!= null);
-					sdd.Assert(depth!= null);
 					if (channel != null)
 					{
 						var rect = new Rectangle((int)tx, (int)ty, (int)tw, (int)th);


billboardengine uses now indexbuffer

billboardengine uses now indexbuffer

--- BillboardSample/BillboardEngine.cs
+++ BillboardSample/BillboardEngine.cs
@@ -13,6 +13,9 @@
     /// Simplistic system for rendering of multiple camera oriented billboards.
     /// billboards must be re-added every frame to keep them camera orientated!
     /// There are many possibilities to improve performance - meant for learning purpose only.
+    ///
+    /// Note that the index buffer could be shared among all billboard engines (same content).
+    /// The vertex buffer could also be shared among all billboard engines since it is rewriten every frame anyways.
     /// </summary>
     class BillboardEngine : IDisposable
     {
@@ -34,6 +37,7 @@

         private int vertexBuffer;
         private int vertexArray;
+        private int indexBuffer;

         private Vector3 camX;
         private Vector3 camY;
@@ -45,7 +49,7 @@
         {
             MaxBillboardCount = maxNumBillboards;
             NumBillboards = 0;
-            billboardVertices = new BillboardVertex[MaxBillboardCount * 6];
+            billboardVertices = new BillboardVertex[MaxBillboardCount * 4];

             int vertexSize = Marshal.SizeOf(typeof(BillboardVertex));

@@ -68,6 +72,22 @@
             GL.EnableVertexAttribArray(2);
                 // Disable vertex array again.
             GL.BindVertexArray(0);
+
+            // Create index buffer.
+            indexBuffer = GL.GenBuffer();
+            GL.BindBuffer(BufferTarget.ElementArrayBuffer, indexBuffer);
+            uint[] indices = new uint[maxNumBillboards * 6];
+            for(uint billboard=0; billboard<maxNumBillboards; ++billboard)
+            {
+                indices[billboard * 6 + 0] = billboard*4 + 0;
+                indices[billboard * 6 + 1] = billboard*4 + 1;
+                indices[billboard * 6 + 2] = billboard*4 + 2;
+
+                indices[billboard * 6 + 3] = billboard*4 + 2;
+                indices[billboard * 6 + 4] = billboard*4 + 3;
+                indices[billboard * 6 + 5] = billboard*4 + 0;
+            }
+            GL.BufferData(BufferTarget.ElementArrayBuffer, new IntPtr(maxNumBillboards * sizeof(uint)), indices, BufferUsageHint.StaticDraw);
         }

         /// <summary>
@@ -109,25 +129,22 @@
             }

             // computes edge positions
-            billboardVertices[NumBillboards * 6].Position = position - xAxis - yAxis;
-            billboardVertices[NumBillboards * 6].Texcoord = texTopLeft;
-            billboardVertices[NumBillboards * 6].Color = color;
-
-            billboardVertices[NumBillboards * 6 + 1].Position = position + xAxis - yAxis;
-            billboardVertices[NumBillboards * 6 + 1].Texcoord = new Vector2(texBottomRight.X, texTopLeft.Y);
-            billboardVertices[NumBillboards * 6 + 1].Color = color;
-
-            billboardVertices[NumBillboards * 6 + 2].Position = position - xAxis + yAxis;
-            billboardVertices[NumBillboards * 6 + 2].Texcoord = new Vector2(texTopLeft.X, texBottomRight.Y);
-            billboardVertices[NumBillboards * 6 + 2].Color = color;
-
-            billboardVertices[NumBillboards * 6 + 3] = billboardVertices[NumBillboards * 6 + 1];
-
-            billboardVertices[NumBillboards * 6 + 4].Position = position + xAxis + yAxis;
-            billboardVertices[NumBillboards * 6 + 4].Texcoord = texBottomRight;
-            billboardVertices[NumBillboards * 6 + 4].Color = color;
-
-            billboardVertices[NumBillboards * 6 + 5] = billboardVertices[NumBillboards * 6 + 2];
+            int startVertexIndex = NumBillboards * 4;
+            billboardVertices[startVertexIndex].Position = position - xAxis + yAxis;
+            billboardVertices[startVertexIndex].Texcoord = texTopLeft;
+            billboardVertices[startVertexIndex].Color = color;
+
+            billboardVertices[startVertexIndex + 1].Position = position + xAxis + yAxis;
+            billboardVertices[startVertexIndex + 1].Texcoord = new Vector2(texBottomRight.X, texTopLeft.Y);
+            billboardVertices[startVertexIndex + 1].Color = color;
+
+            billboardVertices[startVertexIndex + 2].Position = position + xAxis - yAxis;
+            billboardVertices[startVertexIndex + 2].Texcoord = texBottomRight;
+            billboardVertices[startVertexIndex + 2].Color = color;
+
+            billboardVertices[startVertexIndex + 3].Position = position - xAxis - yAxis;
+            billboardVertices[startVertexIndex + 3].Texcoord = new Vector2(texTopLeft.X, texBottomRight.Y);
+            billboardVertices[startVertexIndex + 3].Color = color;

             ++NumBillboards;
         }
@@ -135,7 +152,8 @@
         public void End()
         {
             GL.BindBuffer(BufferTarget.ArrayBuffer, vertexBuffer);
-            GL.BufferSubData<BillboardVertex>(BufferTarget.ArrayBuffer, IntPtr.Zero, new IntPtr(Marshal.SizeOf(typeof(BillboardVertex)) * NumBillboards * 6), billboardVertices);
+            GL.BufferSubData<BillboardVertex>(BufferTarget.ArrayBuffer, IntPtr.Zero,
+                    new IntPtr(Marshal.SizeOf(typeof(BillboardVertex)) * NumBillboards * 4), billboardVertices);

             beginWasCalled = false;
         }
@@ -153,8 +171,9 @@

             GL.BindVertexArray(vertexArray);
             GL.BindBuffer(BufferTarget.ArrayBuffer, vertexBuffer);
-
-            GL.DrawArrays(PrimitiveType.Triangles, 0, NumBillboards * 6);
+            GL.BindBuffer(BufferTarget.ElementArrayBuffer, indexBuffer);
+
+            GL.DrawElements(PrimitiveType.Triangles, NumBillboards * 6, DrawElementsType.UnsignedInt, 0);

             // Reset states.


Make game use 80% of screen size

Make game use 80% of screen size

--- BreakoutParty/BreakoutPartyGame.cs
+++ BreakoutParty/BreakoutPartyGame.cs
@@ -76,15 +76,13 @@
         {
             Graphics = new GraphicsDeviceManager(this);
             Content.RootDirectory = "Content";
-            Graphics.PreferredBackBufferWidth = 800;
-            Graphics.PreferredBackBufferHeight = 600;
-
+            Graphics.PreferredBackBufferWidth = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width * 0.8f);
+            Graphics.PreferredBackBufferHeight = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height * 0.8f);
         }

         protected override void Initialize()
         {
             base.Initialize();
-
             Data = Gamedata.Load();

             Batch = new SpriteBatch(Graphics.GraphicsDevice);


prefix this in constructor

prefix this in constructor

--- BtreeDictionary/BtreeNodeVector.cs
+++ BtreeDictionary/BtreeNodeVector.cs
@@ -31,14 +31,14 @@
             /// <param name="key">Value to find.</param>
             public NodeVector (BtreeDictionary<TKey, TValue> tree, TKey key)
             {
-                indexStack = new List<int>();
-                nodeStack = new List<Node>();
+                this.indexStack = new List<int>();
+                this.nodeStack = new List<Node>();

                 for (Node node = tree.root;;)
                 {
                     Debug.Assert (node != null);

-                    nodeStack.Add (node);
+                    this.nodeStack.Add (node);
                     int ix = node.Search (key, tree.comparer);

                     if (node is Leaf)
@@ -46,12 +46,12 @@
                         IsFound = ix >= 0;
                         if (! IsFound)
                             ix = ~ix;
-                        indexStack.Add (ix);
+                        this.indexStack.Add (ix);
                         return;
                     }

                     ix = (ix < 0)? ~ix : ix+1;
-                    indexStack.Add (ix);
+                    this.indexStack.Add (ix);
                     node = ((Branch) node).GetChild (ix);
                 }
             }


Updates to Plugin.cs  - Applied consistent formatting.  - Changed occurence of currentMapName to isInNexus for clarification.

--- FameBot/Core/Plugin.cs
+++ FameBot/Core/Plugin.cs
@@ -184,10 +184,12 @@
                 gui?.SetHandle(flashPtr);
                 if (config.AutoConnect)
                     Start();
-            } else if(processes.Length > 1)
+            }
+            else if (processes.Length > 1)
             {
                 Log("Multiple flash players running. Use the /bind command on the client you want to use.");
-            } else
+            }
+            else
             {
                 Log("Couldn't find flash player. Use the /bind command in game, then start the bot.");
             }
@@ -251,7 +253,7 @@

         private void ReceiveCommand(Client client, string cmd, string[] args)
         {
-            switch(cmd)
+            switch (cmd)
             {
                 case "bind":
                     flashPtr = GetForegroundWindow();
@@ -308,7 +310,8 @@
                 followTarget = false;
                 if (connectedClient != null)
                     MoveToRealms(connectedClient);
-            } else
+            }
+            else
             {
                 gotoRealm = false;
                 followTarget = true;
@@ -371,14 +374,14 @@
             UpdatePacket packet = p as UpdatePacket;

             // Get new info
-            foreach(Entity obj in packet.NewObjs)
-            {
-                if(Enum.IsDefined(typeof(Classes), obj.ObjectType))
+            foreach (Entity obj in packet.NewObjs)
+            {
+                if (Enum.IsDefined(typeof(Classes), obj.ObjectType))
                 {
                     PlayerData playerData = new PlayerData(obj.Status.ObjectId);
                     playerData.Class = (Classes)obj.ObjectType;
                     playerData.Pos = obj.Status.Position;
-                    foreach(var data in obj.Status.Data)
+                    foreach (var data in obj.Status.Data)
                     {
                         playerData.Parse(data.Id, data.IntValue, data.StringValue);
                     }
@@ -387,11 +390,11 @@
                         playerPositions.Remove(obj.Status.ObjectId);
                     playerPositions.Add(obj.Status.ObjectId, new Target(obj.Status.ObjectId, playerData.Name, playerData.Pos));
                 }
-                if(obj.ObjectType == 1810)
-                {
-                    foreach(var data in obj.Status.Data)
-                    {
-                        if(data.StringValue != null)
+                if (obj.ObjectType == 1810)
+                {
+                    foreach (var data in obj.Status.Data)
+                    {
+                        if (data.StringValue != null)
                         {
                             // TODO: replace with regex
                             var strArray = data.StringValue.Split(' ');
@@ -405,32 +408,33 @@
                         }
                     }
                 }
-                if(Enum.IsDefined(typeof(EnemyId), (int)obj.ObjectType))
+                if (Enum.IsDefined(typeof(EnemyId), (int)obj.ObjectType))
                 {
                     if (enemies.Exists(en => en.ObjectId == obj.Status.ObjectId))
                         enemies.RemoveAll(en => en.ObjectId == obj.Status.ObjectId);
                     enemies.Add(new Enemy(obj.Status.ObjectId, obj.Status.Position));
                 }

-                if(GameData.Objects.ByID((ushort)obj.ObjectType).Name == "Rock Grey")
+                if (GameData.Objects.ByID((ushort)obj.ObjectType).Name == "Rock Grey")
                 {
                     if (!rocks.Exists(rock => rock.ObjectId == obj.Status.ObjectId))
                         rocks.Add(new Rock(obj.Status.ObjectId, obj.Status.Position));
                 }
             }
-
+
             // Remove old info
             foreach (int dropId in packet.Drops)
             {
                 if (playerPositions.ContainsKey(dropId))
                 {
-                    if(followTarget && targets.Exists(t => t.ObjectId == dropId))
+                    if (followTarget && targets.Exists(t => t.ObjectId == dropId))
                     {
                         targets.Remove(targets.Find(t => t.ObjectId == dropId));
-                        if(targets.Count > 0)
+                        if (targets.Count > 0)
                         {
                             Log(string.Format("Dropping \"{0}\" from targets.", playerPositions[dropId].Name));
-                        } else
+                        }
+                        else
                         {
                             Log("No targets left in target list.");
                             if (config.EscapeIfNoTargets)
@@ -504,13 +508,14 @@
                 if (followTarget && playerPositions.Count > 0 && !gotoRealm)
                 {
                     List<Target> newTargets = D36n4.Invoke(playerPositions.Values.ToList(), config.Epsilon, config.MinPoints, config.FindClustersNearCenter);
-                    if(newTargets == null)
+                    if (newTargets == null)
                     {
                         if (targets.Count != 0 && config.EscapeIfNoTargets)
-                            Escape(client);
+                            Escape(client);
                         targets.Clear();
                         Log("No valid clusters found.");
-                    } else
+                    }
+                    else
                     {
                         if (targets.Count != newTargets.Count)
                             Log(string.Format("Now targeting {0} players.", newTargets.Count));
@@ -521,7 +526,7 @@
             }

             // Updates
-            foreach(Status status in packet.Statuses)
+            foreach (Status status in packet.Statuses)
             {
                 // Update player positions
                 if (playerPositions.ContainsKey(status.ObjectId))
@@ -532,11 +537,11 @@
                     enemies.Find(en => en.ObjectId == status.ObjectId).Location = status.Position;

                 // Update portal player counts when in nexus.
-                if (portals.Exists(ptl => ptl.ObjectId == status.ObjectId) && (currentMapName?.Equals("Nexus") ?? false))
-                {
-                    foreach(var data in status.Data)
-                    {
-                        if(data.StringValue != null)
+                if (portals.Exists(ptl => ptl.ObjectId == status.ObjectId) && (isInNexus))
+                {
+                    foreach (var data in status.Data)
+                    {
+                        if (data.StringValue != null)
                         {
                             var strCount = data.StringValue.Split(' ')[1].Split('/')[0].Remove(0, 1);
                             portals[portals.FindIndex(ptl => ptl.ObjectId == status.ObjectId)].PlayerCount = int.Parse(strCount);
@@ -550,7 +555,7 @@
                     foreach (var data in status.Data)
                     {
                         if (data.Id == StatsType.Speed)
-                        {
+                        {
                             if (data.IntValue > 45)
                             {
                                 List<StatData> list = new List<StatData>(status.Data) {
@@ -602,7 +607,7 @@
                     return;
                 }

-                if(rocks.Exists(rock => rock.Location.DistanceSquaredTo(client.PlayerData.Pos) <= 4))
+                if (rocks.Exists(rock => rock.Location.DistanceSquaredTo(client.PlayerData.Pos) <= 4))
                 {
                     Location closestRock = rocks.OrderBy(rock => rock.Location.DistanceSquaredTo(client.PlayerData.Pos)).First().Location;
                     double angleDifference = client.PlayerData.Pos.GetAngleDifferenceDegrees(targetPosition, closestRock);
@@ -610,7 +615,7 @@
                     if (Math.Abs(angleDifference) < 70.0)
                     {
                         double angle = Math.Atan2(client.PlayerData.Pos.Y - closestRock.Y, client.PlayerData.Pos.X - closestRock.X);
-                        if(angleDifference <= 0)
+                        if (angleDifference <= 0)
                             angle += (Math.PI / 2); // add 90 degrees to the angle to go clockwise around the rock.
                         if (angleDifference > 0)
                             angle -= (Math.PI / 2); // remove 90 degrees from the angle to go anti-clockwise around the rock.
@@ -639,7 +644,7 @@

         private async void MoveToRealms(Client client)
         {
-            if(client == null)
+            if (client == null)
             {
                 Log("No client passed to MoveToRealms.");
                 return;
@@ -663,19 +668,20 @@
                 if (portals.Count != 0)
                 {
                     int bestCount = 0;
-                    if(portals.Where(ptl => ptl.PlayerCount == 85).Count() > 1)
-                    {
-                        foreach(Portal ptl in portals.Where(ptl => ptl.PlayerCount == 85))
+                    if (portals.Where(ptl => ptl.PlayerCount == 85).Count() > 1)
+                    {
+                        foreach (Portal ptl in portals.Where(ptl => ptl.PlayerCount == 85))
                         {
                             int count = playerPositions.Values.Where(plr => plr.Position.DistanceSquaredTo(ptl.Location) <= 4).Count();
-                            if(count > bestCount)
+                            if (count > bestCount)
                             {
                                 bestCount = count;
                                 bestName = ptl.Name;
                                 target = ptl.Location;
                             }
                         }
-                    } else
+                    }
+                    else
                     {
                         Portal ptl = portals.OrderByDescending(prtl => prtl.PlayerCount).First();
                         target = ptl.Location;
@@ -688,7 +694,7 @@

             CalculateMovement(client, target, 0.5f);

-            if(client.PlayerData.Pos.DistanceTo(target) < 1f && portals.Count != 0)
+            if (client.PlayerData.Pos.DistanceTo(target) < 1f && portals.Count != 0)
             {
                 if (client.State.LastRealm?.Name.Contains(bestName) ?? false)
                 {
@@ -708,7 +714,8 @@
             if (gotoRealm)
             {
                 MoveToRealms(client);
-            } else
+            }
+            else
             {
                 Log("Stopped moving to realm.");
             }
@@ -719,7 +726,7 @@
             UsePortalPacket packet = (UsePortalPacket)Packet.Create(PacketType.USEPORTAL);
             packet.ObjectId = portalId;

-            if(!portals.Exists(ptl => ptl.ObjectId == portalId))
+            if (!portals.Exists(ptl => ptl.ObjectId == portalId))
             {
                 gotoRealm = true;
                 MoveToRealms(client);


Example - RequestHandler: Throw exception on invalid URI (#2047)

--- CefSharp.Example/RequestHandler.cs
+++ CefSharp.Example/RequestHandler.cs
@@ -60,11 +60,16 @@

         CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback)
         {
+            Uri url;
+            if (Uri.TryCreate(request.Url, UriKind.Absolute, out url) == false)
+            {
+                throw new Exception("Request to \"" + request.Url + "\" can't continue, not a valid URI");
+            }
+
             //Example of how to set Referer
             // Same should work when setting any header

             // For this example only set Referer when using our custom scheme
-            var url = new Uri(request.Url);
             if (url.Scheme == CefSharpSchemeHandlerFactory.SchemeName)
             {
                 //Referrer is now set using it's own method (was previously set in headers before)