Update TcpTests.cs

Update TcpTests.cs

--- tests/Hprose.UnitTests/RPC/TcpTests.cs
+++ tests/Hprose.UnitTests/RPC/TcpTests.cs
@@ -8,6 +8,7 @@
 using System.Net;
 using System.Threading.Tasks;
 using System.Text;
+using System.Net.Sockets;

 namespace Hprose.UnitTests.RPC {
     [TestClass]
@@ -19,185 +20,183 @@
             data = Encoding.ASCII.GetBytes("abcdefg12345678");
             Assert.AreEqual(0x9AE0DAAF, CRC32.Compute(data, 7, 8));
         }
-        /*
-                public Task<int> Sum(int x, int y) {
-                    return Task<int>.Factory.StartNew(() => x + y);
+        public Task<int> Sum(int x, int y) {
+            return Task<int>.Factory.StartNew(() => x + y);
+        }
+        public string Hello(string name, Context context) {
+            return "Hello " + name;
+        }
+        public void OnewayCall(string name) {
+            Console.WriteLine(name);
+        }
+        [TestMethod]
+        public async Task Test1() {
+            IPAddress iPAddress = (await Dns.GetHostAddressesAsync("127.0.0.1"))[0];
+            TcpListener server = new TcpListener(iPAddress, 8412);
+            server.Start();
+            var service = new Service();
+            ServiceCodec.Instance.Debug = true;
+            service.Use(Log.IOHandler)
+                   .Use(Log.InvokeHandler)
+                   .Add<string, Context, string>(Hello)
+                   .Add<int, int, Task<int>>(Sum)
+                   .Add(() => { return "good"; }, "Good")
+                   .Bind(server);
+            var client = new Client("tcp://127.0.0.1:8412");
+            var result = await client.Invoke<string>("hello", new object[] { "world" });
+            Assert.AreEqual("Hello world", result);
+            Assert.AreEqual(3, await client.Invoke<int>("sum", new object[] { 1, 2 }));
+            Assert.AreEqual("good", await client.Invoke<string>("good"));
+            server.Stop();
+        }
+        public interface ITestInterface {
+            int Sum(int x, int y);
+            [Log(false)]
+            Task<string> Hello(string name);
+            [Name("OnewayCall")]
+            Task OnewayCallAsync(string name);
+            void OnewayCall(string name);
+        }
+        [TestMethod]
+        public async Task Test2() {
+            IPAddress iPAddress = (await Dns.GetHostAddressesAsync("127.0.0.1"))[0];
+            TcpListener server = new TcpListener(iPAddress, 8412);
+            server.Start();
+            var service = new Service();
+            service.AddMethod("Hello", this)
+                   .AddMethod("Sum", this)
+                   .Add<string>(OnewayCall)
+                   .Bind(server);
+            var client = new Client("tcp4://127.0.0.1:8412");
+            var log = new Log();
+            client.Use(log.IOHandler).Use(log.InvokeHandler);
+            var proxy = client.UseService<ITestInterface>();
+            var result = await proxy.Hello("world");
+            Assert.AreEqual("Hello world", result);
+            //Assert.AreEqual(3, proxy.Sum(1, 2));
+            //proxy.OnewayCall("Oneway Sync");
+            await proxy.OnewayCallAsync("Oneway Async");
+            server.Stop();
+        }
+        [TestMethod]
+        public async Task Test3() {
+            IPAddress iPAddress = (await Dns.GetHostAddressesAsync("127.0.0.1"))[0];
+            TcpListener server = new TcpListener(iPAddress, 8412);
+            server.Start();
+            var service = new Broker(new Service()).Service;
+            ServiceCodec.Instance.Debug = true;
+            service.Use(Log.IOHandler)
+                   .Use(Log.InvokeHandler)
+                   .Bind(server);
+
+            var client1 = new Client("tcp4://127.0.0.1:8412");
+            var prosumer1 = new Prosumer(client1, "1") {
+                OnSubscribe = (topic) => {
+                    Console.WriteLine(topic + " is subscribed.");
+                },
+                OnUnsubscribe = (topic) => {
+                    Console.WriteLine(topic + " is unsubscribed.");
                 }
-                public string Hello(string name, Context context) {
-                    return "Hello " + name;
-                }
-                public void OnewayCall(string name) {
-                    Console.WriteLine(name);
-                }
-                [TestMethod]
-                public async Task Test1() {
-                    HttpListener server = new HttpListener();
-                    server.Prefixes.Add("http://127.0.0.1:8080/");
-                    server.Start();
-                    var service = new Service();
-                    ServiceCodec.Instance.Debug = true;
-                    service.Use(Log.IOHandler)
-                           .Use(Log.InvokeHandler)
-                           .Add<string, Context, string>(Hello)
-                           .Add<int, int, Task<int>>(Sum)
-                           .Add(() => { return "good"; }, "Good")
-                           .Bind(server);
-                    var client = new Client("http://127.0.0.1:8080/");
-                    var result = await client.Invoke<string>("hello", new object[] { "world" });
-                    Assert.AreEqual("Hello world", result);
-                    Assert.AreEqual(3, await client.Invoke<int>("sum", new object[] { 1, 2 }));
-                    Assert.AreEqual("good", await client.Invoke<string>("good"));
-                    server.Stop();
-                }
-                public interface ITestInterface {
-                    int Sum(int x, int y);
-                    [Log(false)]
-                    Task<string> Hello(string name);
-                    [Name("OnewayCall")]
-                    Task OnewayCallAsync(string name);
-                    void OnewayCall(string name);
-                }
-                [TestMethod]
-                public async Task Test2() {
-                    HttpListener server = new HttpListener();
-                    server.Prefixes.Add("http://127.0.0.1:8081/");
-                    server.Start();
-                    var service = new Service();
-                    service.AddMethod("Hello", this)
-                           .AddMethod("Sum", this)
-                           .Add<string>(OnewayCall)
-                           .Bind(server, "http");
-                    var client = new Client("http://127.0.0.1:8081/");
-                    var log = new Log();
-                    client.Use(log.IOHandler).Use(log.InvokeHandler);
-                    var proxy = client.UseService<ITestInterface>();
-                    var result = await proxy.Hello("world");
-                    Assert.AreEqual("Hello world", result);
-                    Assert.AreEqual(3, proxy.Sum(1, 2));
-                    proxy.OnewayCall("Oneway Sync");
-                    await proxy.OnewayCallAsync("Oneway Async");
-                    server.Stop();
-                }
-                [TestMethod]
-                public async Task Test3() {
-                    HttpListener server = new HttpListener();
-                    server.Prefixes.Add("http://127.0.0.1:8082/");
-                    server.Start();
-                    var service = new Broker(new Service()).Service;
-                    ServiceCodec.Instance.Debug = true;
-                    service.Use(Log.IOHandler)
-                           .Use(Log.InvokeHandler)
-                           .Bind(server);
-
-                    var client1 = new Client("http://127.0.0.1:8082/");
-                    var prosumer1 = new Prosumer(client1, "1") {
-                        OnSubscribe = (topic) => {
-                            Console.WriteLine(topic + " is subscribed.");
-                        },
-                        OnUnsubscribe = (topic) => {
-                            Console.WriteLine(topic + " is unsubscribed.");
-                        }
-                    };
-                    var client2 = new Client("http://127.0.0.1:8082/");
-                    var prosumer2 = new Prosumer(client2, "2");
-                    await prosumer1.Subscribe<string>("test", (data, from) => {
-                        Assert.AreEqual("hello", data);
-                        Assert.AreEqual("2", from);
-                    });
-                    await prosumer1.Subscribe<string>("test2", (data) => {
-                        Assert.AreEqual("world", data);
-                    });
-                    var r1 = prosumer2.Push("hello", "test", "1");
-                    var r2 = prosumer2.Push("hello", "test", "1");
-                    var r3 = prosumer2.Push("world", "test2", "1");
-                    var r4 = prosumer2.Push("world", "test2", "1");
-                    await Task.WhenAll(r1, r2, r3, r4);
-                    await Task.Delay(10);
-                    await prosumer1.Unsubscribe("test");
-                    await prosumer1.Unsubscribe("test2");
-                    server.Stop();
-                }
-                public object Missing(string name, object[] args, Context context) {
-                    return name + ":" + args.Length + ":" + (context as dynamic).Request.RemoteEndPoint.Address;
-                }
-                [TestMethod]
-                public async Task Test4() {
-                    HttpListener server = new HttpListener();
-                    server.Prefixes.Add("http://127.0.0.1:8083/");
-                    server.Start();
-                    var service = new Service();
-                    service.AddMissingMethod(Missing).Bind(server);
-                    var client = new Client("http://127.0.0.1:8083/");
-                    var log = new Log();
-                    client.Use(log.IOHandler).Use(log.InvokeHandler);
-                    var result = await client.Invoke<string>("hello", new object[] { "world" });
-                    Assert.AreEqual("hello:1:127.0.0.1", result);
-                    result = await client.Invoke<string>("sum", new object[] { 1, 2 });
-                    Assert.AreEqual("sum:2:127.0.0.1", result);
-                    server.Stop();
-                }
-                [TestMethod]
-                public async Task Test5() {
-                    HttpListener server = new HttpListener();
-                    server.Prefixes.Add("http://127.0.0.1:8084/");
-                    server.Start();
-                    var log = new Log();
-                    ServiceCodec.Instance.Debug = true;
-                    var service = new Service();
-                    service
-                        .Use(log.InvokeHandler)
-                        .Use(log.IOHandler);
-                    var caller = new Caller(service);
-                    service.Bind(server);
-
-                    var client = new Client("http://127.0.0.1:8084/");
-                    var provider = new Provider(client, "1") {
-                        Debug = true
-                    };
-                    var listening = provider.Add<string, Context, string>(Hello)
-                           .Add<int, int, Task<int>>(Sum)
-                           .Use(log.InvokeHandler)
-                           .Listen();
-
-                    var proxy = caller.UseService<ITestInterface>("1");
-                    //var result1 = caller.Invoke<string>("1", "hello", new object[] { "world1" });
-                    //var result2 = caller.Invoke<string>("1", "hello", new object[] { "world2" });
-                    //var result3 = caller.Invoke<string>("1", "hello", new object[] { "world3" });
-                    var result1 = proxy.Hello("world1");
-                    var result2 = proxy.Hello("world2");
-                    var result3 = proxy.Hello("world3");
-                    var results = await Task.WhenAll(result1, result2, result3);
-                    Assert.AreEqual(results[0], "Hello world1");
-                    Assert.AreEqual(results[1], "Hello world2");
-                    Assert.AreEqual(results[2], "Hello world3");
-                    await provider.Close();
-                    server.Stop();
-                }
-                [TestMethod]
-                public async Task Test6() {
-                    HttpListener server = new HttpListener();
-                    server.Prefixes.Add("http://127.0.0.1:8085/");
-                    server.Start();
-                    var service = new Service {
-                        Codec = JsonRpcServiceCodec.Instance
-                    };
-                    service.AddMethod("Hello", this)
-                           .AddMethod("Sum", this)
-                           .Add<string>(OnewayCall)
-                           .Bind(server, "http");
-                    var client = new Client("http://127.0.0.1:8085/") {
-                        Codec = JsonRpcClientCodec.Instance
-                    };
-                    var log = new Log();
-                    client.Use(log.IOHandler).Use(log.InvokeHandler);
-                    var proxy = client.UseService<ITestInterface>();
-                    var result = await proxy.Hello("world");
-                    Assert.AreEqual("Hello world", result);
-                    Assert.AreEqual(3, proxy.Sum(1, 2));
-                    proxy.OnewayCall("Oneway Sync");
-                    await proxy.OnewayCallAsync("Oneway Async");
-                    server.Stop();
-                }
-        */
+            };
+            var client2 = new Client("tcp4://127.0.0.1:8412");
+            var prosumer2 = new Prosumer(client2, "2");
+            await prosumer1.Subscribe<string>("test", (data, from) => {
+                Assert.AreEqual("hello", data);
+                Assert.AreEqual("2", from);
+            });
+            await prosumer1.Subscribe<string>("test2", (data) => {
+                Assert.AreEqual("world", data);
+            });
+            var r1 = prosumer2.Push("hello", "test", "1");
+            var r2 = prosumer2.Push("hello", "test", "1");
+            var r3 = prosumer2.Push("world", "test2", "1");
+            var r4 = prosumer2.Push("world", "test2", "1");
+            await Task.WhenAll(r1, r2, r3, r4);
+            await Task.Delay(10);
+            await prosumer1.Unsubscribe("test");
+            await prosumer1.Unsubscribe("test2");
+            server.Stop();
+        }
+        public object Missing(string name, object[] args, Context context) {
+            return name + ":" + args.Length + ":" + (context as dynamic).Socket.RemoteEndPoint.Address;
+        }
+        [TestMethod]
+        public async Task Test4() {
+            IPAddress iPAddress = (await Dns.GetHostAddressesAsync("127.0.0.1"))[0];
+            TcpListener server = new TcpListener(iPAddress, 8412);
+            server.Start();
+            var service = new Service();
+            service.AddMissingMethod(Missing).Bind(server);
+            var client = new Client("tcp://127.0.0.1:8412");
+            var log = new Log();
+            client.Use(log.IOHandler).Use(log.InvokeHandler);
+            var result = await client.Invoke<string>("hello", new object[] { "world" });
+            Assert.AreEqual("hello:1:127.0.0.1", result);
+            result = await client.Invoke<string>("sum", new object[] { 1, 2 });
+            Assert.AreEqual("sum:2:127.0.0.1", result);
+            server.Stop();
+        }
+        [TestMethod]
+        public async Task Test5() {
+            IPAddress iPAddress = (await Dns.GetHostAddressesAsync("127.0.0.1"))[0];
+            TcpListener server = new TcpListener(iPAddress, 8412);
+            server.Start();
+            var log = new Log();
+            ServiceCodec.Instance.Debug = true;
+            var service = new Service();
+            service
+                .Use(log.InvokeHandler)
+                .Use(log.IOHandler);
+            var caller = new Caller(service);
+            service.Bind(server);
+
+            var client = new Client("tcp://127.0.0.1:8412");
+            var provider = new Provider(client, "1") {
+                Debug = true
+            };
+            var listening = provider.Add<string, Context, string>(Hello)
+                   .Add<int, int, Task<int>>(Sum)
+                   .Use(log.InvokeHandler)
+                   .Listen();
+
+            var proxy = caller.UseService<ITestInterface>("1");
+            //var result1 = caller.Invoke<string>("1", "hello", new object[] { "world1" });
+            //var result2 = caller.Invoke<string>("1", "hello", new object[] { "world2" });
+            //var result3 = caller.Invoke<string>("1", "hello", new object[] { "world3" });
+            var result1 = proxy.Hello("world1");
+            var result2 = proxy.Hello("world2");
+            var result3 = proxy.Hello("world3");
+            var results = await Task.WhenAll(result1, result2, result3);
+            Assert.AreEqual(results[0], "Hello world1");
+            Assert.AreEqual(results[1], "Hello world2");
+            Assert.AreEqual(results[2], "Hello world3");
+            await provider.Close();
+            server.Stop();
+        }
+        [TestMethod]
+        public async Task Test6() {
+            IPAddress iPAddress = (await Dns.GetHostAddressesAsync("127.0.0.1"))[0];
+            TcpListener server = new TcpListener(iPAddress, 8413);
+            server.Start();
+            var service = new Service {
+                Codec = JsonRpcServiceCodec.Instance
+            };
+            service.AddMethod("Hello", this)
+                   .AddMethod("Sum", this)
+                   .Add<string>(OnewayCall)
+                   .Bind(server, "tcp");
+            var client = new Client("tcp://127.0.0.1:8413") {
+                Codec = JsonRpcClientCodec.Instance
+            };
+            var log = new Log();
+            client.Use(log.IOHandler).Use(log.InvokeHandler);
+            var proxy = client.UseService<ITestInterface>();
+            var result = await proxy.Hello("world");
+            Assert.AreEqual("Hello world", result);
+            //Assert.AreEqual(3, proxy.Sum(1, 2));
+            //proxy.OnewayCall("Oneway Sync");
+            await proxy.OnewayCallAsync("Oneway Async");
+            server.Stop();
+        }
     }
 }


Additional linq extensions.

Additional linq extensions.

--- Framework/LinqExtensions.cs
+++ Framework/LinqExtensions.cs
@@ -170,5 +170,39 @@
 			}
 			return result;
 		}
+
+		public static int IndexOfMax<T>(this IEnumerable<T> items, Func<T, double> eval)
+		{
+			var bestIndex = -1;
+			double bestValue = double.MinValue;
+			var i = 0;
+			foreach (var item in items)
+			{
+				var value = eval(item);
+				if (value > bestValue)
+				{
+					bestIndex = i;
+					bestValue = value;
+				}
+				++i;
+			}
+			return bestIndex;
+		}
+
+		public static T ValueOfMax<T>(this IEnumerable<T> items, Func<T, double> eval, T initialItem = default(T))
+		{
+			var bestItem = initialItem;
+			double bestValue = double.MinValue;
+			foreach (var item in items)
+			{
+				var value = eval(item);
+				if (value > bestValue)
+				{
+					bestItem = item;
+					bestValue = value;
+				}
+			}
+			return bestItem;
+		}
 	}
 }


Remove unused port declaration from DefaultClientConfiguration.

--- GTClient/GTClient/Client.cs
+++ GTClient/GTClient/Client.cs
@@ -770,11 +770,6 @@
     /// </summary>
     public class DefaultClientConfiguration : ClientConfiguration
     {
-        /// <summary>
-        /// The default port used when connecting
-        /// </summary>
-        protected int port = 9999;
-
         public override IMarshaller CreateMarshaller()
         {
             return new LargeObjectMarshaller(new DotNetSerializingMarshaller());


export workitems with github/TFS '#' format to better support import in TFS(Git)

--- GitTfs/Core/GitTfsRemote.cs
+++ GitTfs/Core/GitTfsRemote.cs
@@ -356,10 +356,7 @@
                 {
                     if (changeset.Summary.Workitems.Any())
                     {
-                        string workitems = string.Empty;
-                        foreach (var workitem in changeset.Summary.Workitems)
-                            workitems += "\n" + GitTfsConstants.GitTfsWorkItemPrefix + workitem.Id + " associate";
-                        log.Log += workitems;
+                        log.Log += "\nwork-items: " + string.Join(", ", changeset.Summary.Workitems.Select(wi => "#" + wi.Id)); ;
                     }

                     if (!string.IsNullOrWhiteSpace(changeset.Summary.PolicyOverrideComment))


Ignore files that were previously deleted.

--- GitTfs/Core/TfsChangeset.cs
+++ GitTfs/Core/TfsChangeset.cs
@@ -27,7 +27,10 @@
                     continue;
                 if (change.ChangeType.IncludesOneOf(ChangeType.Add, ChangeType.Edit, ChangeType.Rename, ChangeType.Undelete, ChangeType.Branch, ChangeType.Merge))
                 {
+                    if (change.Item.DeletionId == 0)
+                    {
                         Update(change, pathInGitRepo, lastCommit, index);
+                    }
                 }
                 else if (change.ChangeType.IncludesOneOf(ChangeType.Delete))
                 {


Rename field

Rename field

--- HttpClientSample/Program.cs
+++ HttpClientSample/Program.cs
@@ -10,7 +10,7 @@
 {
     class Program
     {
-        static string _subscription = ConfigurationManager.AppSettings["AzureSubscription"];
+        static string Subscription = ConfigurationManager.AppSettings["AzureSubscription"];

         static void Main(string[] args)
         {
@@ -51,7 +51,7 @@
             // Create the resource group

             using (var response = await client.PutAsJsonAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}?api-version=2015-11-01",
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}?api-version=2015-11-01",
                 new
                 {
                     location = Location
@@ -63,7 +63,7 @@
             // Create the App Service Plan

             using (var response = await client.PutAsJsonAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/serverfarms/{AppServicePlan}?api-version=2015-08-01",
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/serverfarms/{AppServicePlan}?api-version=2015-08-01",
                 new
                 {
                     location = Location,
@@ -79,7 +79,7 @@
             // Create the Web App

             using (var response = await client.PutAsJsonAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}?api-version=2015-08-01",
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}?api-version=2015-08-01",
                 new
                 {
                     location = Location,
@@ -95,7 +95,7 @@
             // List the Web Apps and their host names

             using (var response = await client.GetAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites?api-version=2015-08-01"))
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites?api-version=2015-08-01"))
             {
                 response.EnsureSuccessStatusCode();

@@ -113,7 +113,7 @@
             // Set some app settings

             using (var response = await client.PutAsJsonAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}/config/appsettings?api-version=2015-08-01",
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}/config/appsettings?api-version=2015-08-01",
                 new
                 {
                     properties = new
@@ -129,7 +129,7 @@
             // Turn on http logging

             using (var response = await client.PutAsJsonAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}/config/logs?api-version=2015-08-01",
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}/config/logs?api-version=2015-08-01",
                 new
                 {
                     properties = new
@@ -150,7 +150,7 @@
             // Stop the app

             using (var response = await client.PostAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}/stop?api-version=2015-08-01",
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}/stop?api-version=2015-08-01",
                 null))
             {
                 response.EnsureSuccessStatusCode();
@@ -159,7 +159,7 @@
             // Delete the Web App

             using (var response = await client.DeleteAsync(
-                $"/subscriptions/{_subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}?api-version=2015-08-01"))
+                $"/subscriptions/{Subscription}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}?api-version=2015-08-01"))
             {
                 response.EnsureSuccessStatusCode();
             }


plugin: nuked syntax errors from Spacefolder.cs

--- KerbalFuture/SpaceFolder.cs
+++ KerbalFuture/SpaceFolder.cs
@@ -16,8 +16,8 @@
 		public bool partContainsModule(string miPart, string moduleName)
 		{
 			List<partDatabase> = GameDatabase.GetConfigNodes("PART");
-			partDatabase[] = GameDatabase.GetConfigNodes("
-			if(
+			partDatabase[] = GameDatabase.GetConfigNodes("");
+			if (
 			{
 				return true;
 			}
@@ -76,5 +76,4 @@
 	{
 		double holeDiameter;
 	}
-}
-sfj
+}


Refactor TreeChanges.PrintCallBack()

Refactor TreeChanges.PrintCallBack()

--- LibGit2Sharp/TreeChanges.cs
+++ LibGit2Sharp/TreeChanges.cs
@@ -48,40 +48,39 @@
         private int PrintCallBack(IntPtr data, GitDiffDelta delta, GitDiffRange range, GitDiffLineOrigin lineorigin, IntPtr content, uint contentlen)
         {
             string formattedoutput = Utf8Marshaler.FromNative(content, contentlen);
-            FilePath currentFilePath = FilePathMarshaler.FromNative(delta.NewFile.Path);

-            AddLineChange(currentFilePath, lineorigin);
+            TreeEntryChanges currentChange = AddFileChange(delta, lineorigin);
+            AddLineChange(currentChange, lineorigin);

-            if (lineorigin == GitDiffLineOrigin.GIT_DIFF_LINE_FILE_HDR)
-            {
-                AddFileChange(delta);
-            }
-
-            changes[currentFilePath].AppendToPatch(formattedoutput);
+            currentChange.AppendToPatch(formattedoutput);
             fullPatchBuilder.Append(formattedoutput);

             return 0;
         }

-        private void AddLineChange(FilePath currentFilePath, GitDiffLineOrigin lineOrigin)
+        private void AddLineChange(Changes currentChange, GitDiffLineOrigin lineOrigin)
         {
             switch (lineOrigin)
             {
                 case GitDiffLineOrigin.GIT_DIFF_LINE_ADDITION:
                     linesAdded++;
-                    this[currentFilePath].LinesAdded++;
+                    currentChange.LinesAdded++;
                     break;

                 case GitDiffLineOrigin.GIT_DIFF_LINE_DELETION:
                     linesDeleted++;
-                    this[currentFilePath].LinesDeleted++;
+                    currentChange.LinesDeleted++;
                     break;
             }
         }

-        private void AddFileChange(GitDiffDelta delta)
+        private TreeEntryChanges AddFileChange(GitDiffDelta delta, GitDiffLineOrigin lineorigin)
         {
             var newFilePath = FilePathMarshaler.FromNative(delta.NewFile.Path);
+
+            if (lineorigin != GitDiffLineOrigin.GIT_DIFF_LINE_FILE_HDR)
+                return this[newFilePath];
+
             var oldFilePath = FilePathMarshaler.FromNative(delta.OldFile.Path);
             var newMode = (Mode)delta.NewFile.Mode;
             var oldMode = (Mode)delta.OldFile.Mode;
@@ -92,6 +91,7 @@

             fileDispatcher[delta.Status](this, diffFile);
             changes.Add(newFilePath, diffFile);
+            return diffFile;
         }

         #region IEnumerable<Tag> Members


Probability param in SVM Parameter set default

--- LibSVMsharp/SVMParameter.cs
+++ LibSVMsharp/SVMParameter.cs
@@ -22,7 +22,7 @@
             CacheSize = 100;
             Eps = 0.001;
             Shrinking = true;
-            Probability = true;
+            Probability = false;
             WeightLabels = new int[0];
             Weights = new double[0];
         }
@@ -113,7 +113,6 @@
             y.Weights = Weights.Select(a => a).ToArray();
             return y;
         }
-
         public static SVMParameter Convert(svm_parameter x)
         {
             SVMParameter y = new SVMParameter();


when close figure set current point back to start, fixes partially #3053

--- src/Avalonia.Visuals/Media/PathMarkupParser.cs
+++ src/Avalonia.Visuals/Media/PathMarkupParser.cs
@@ -32,6 +32,7 @@

         private IGeometryContext _geometryContext;
         private Point _currentPoint;
+        private Point? _beginFigurePoint;
         private Point? _previousControlPoint;
         private bool _isOpen;
         private bool _isDisposed;
@@ -180,6 +181,8 @@

             _geometryContext.BeginFigure(_currentPoint);

+            _beginFigurePoint = _currentPoint;
+
             _isOpen = true;
         }

@@ -212,6 +215,12 @@
             if (_isOpen)
             {
                 _geometryContext.EndFigure(true);
+
+                if (_beginFigurePoint != null)
+                {
+                    _currentPoint = _beginFigurePoint.Value;
+                    _beginFigurePoint = null;
+                }
             }

             _previousControlPoint = null;


JimEvans: FxCop cleanup.

JimEvans: FxCop cleanup.

git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@14410 07704840-8298-11de-bf8c-fd130f914ac9

--- dotnet/src/WebDriver/Remote/RemoteKeyboard.cs
+++ dotnet/src/WebDriver/Remote/RemoteKeyboard.cs
@@ -45,6 +45,11 @@
         /// <param name="keySequence">A string representing the keystrokes to send.</param>
         public void SendKeys(string keySequence)
         {
+            if (keySequence == null)
+            {
+                throw new ArgumentException("key sequence to send must not be null", "keySequence");
+            }
+
             Dictionary<string, object> parameters = new Dictionary<string, object>();
             parameters.Add("value", keySequence.ToCharArray());
             this.driver.InternalExecute(DriverCommand.SendKeysToActiveElement, parameters);
@@ -57,6 +62,11 @@
         /// <remarks>The key value must be one of the values from the <see cref="Keys"/> class.</remarks>
         public void PressKey(string keyToPress)
         {
+            if (keyToPress == null)
+            {
+                throw new ArgumentException("key to press must not be null", "keyToPress");
+            }
+
             Dictionary<string, object> parameters = new Dictionary<string, object>();
             parameters.Add("value", keyToPress.ToCharArray());
             this.driver.InternalExecute(DriverCommand.SendKeysToActiveElement, parameters);
@@ -69,6 +79,11 @@
         /// <remarks>The key value must be one of the values from the <see cref="Keys"/> class.</remarks>
         public void ReleaseKey(string keyToRelease)
         {
+            if (keyToRelease == null)
+            {
+                throw new ArgumentException("key to release must not be null", "keyToRelease");
+            }
+
             Dictionary<string, object> parameters = new Dictionary<string, object>();
             parameters.Add("value", keyToRelease.ToCharArray());
             this.driver.InternalExecute(DriverCommand.SendKeysToActiveElement, parameters);


Fix test breakage caused by renamed emoji in Unicode 13

The name of the `Adult` emoji was changed to `Person` somewhen in
between Unicode 5 and Unicode 13.

--- tests/SingleEmojiTests.cs
+++ tests/SingleEmojiTests.cs
@@ -11,7 +11,7 @@
         {
             Assert.IsFalse(Emoji.AbButtonBloodType == null);
             Assert.IsFalse(null == Emoji.AbButtonBloodType);
-            Assert.IsFalse(Emoji.AbButtonBloodType == Emoji.Adult);
+            Assert.IsFalse(Emoji.AbButtonBloodType == Emoji.Person);
 #pragma warning disable CS1718 // Comparison made to same variable
             Assert.IsTrue(Emoji.AbButtonBloodType == Emoji.AbButtonBloodType);
 #pragma warning restore CS1718 // Comparison made to same variable
@@ -22,7 +22,7 @@
         {
             Assert.IsTrue(Emoji.AbButtonBloodType != null);
             Assert.IsTrue(null != Emoji.AbButtonBloodType);
-            Assert.IsTrue(Emoji.AbButtonBloodType != Emoji.Adult);
+            Assert.IsTrue(Emoji.AbButtonBloodType != Emoji.Person);
 #pragma warning disable CS1718 // Comparison made to same variable
             Assert.IsFalse(Emoji.AbButtonBloodType != Emoji.AbButtonBloodType);
 #pragma warning restore CS1718 // Comparison made to same variable


Line endings

Line endings

--- MoreLinq/ToDataTable.cs
+++ MoreLinq/ToDataTable.cs
@@ -1,21 +1,21 @@
-#region License and Terms
-// MoreLINQ - Extensions to LINQ to Objects
-// Copyright (c) 2008 Jonathan Skeet. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+#region License and Terms
+// MoreLINQ - Extensions to LINQ to Objects
+// Copyright (c) 2008 Jonathan Skeet. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 #endregion

-namespace MoreLinq
+namespace MoreLinq
 {
     using System;
     using System.Collections.Generic;
@@ -24,240 +24,240 @@
     using System.Linq.Expressions;
     using System.Reflection;

-    static partial class MoreEnumerable
-    {
-        private static MemberInfo GetAccessedMember(LambdaExpression lambda)
-        {
-            var body = lambda.Body;
-
-            // If it's a field access, boxing was used, we need the field
-            if ((body.NodeType == ExpressionType.Convert) || (body.NodeType == ExpressionType.ConvertChecked))
-            {
-                body = ((UnaryExpression)body).Operand;
-            }
-
-            // Check if the MemberExpression is valid and is a "first level" member access e.g. not a.b.c
-            var memberExpression = body as MemberExpression;
-            if ((memberExpression == null) || (memberExpression.Expression.NodeType != ExpressionType.Parameter))
-            {
-                throw new ArgumentException(string.Format("Illegal expression: {0}", lambda), "lambda");
-            }
-
-            return memberExpression.Member;
-        }
-
-        private static IEnumerable<MemberInfo> PrepareMemberInfos<T>(ICollection<Expression<Func<T, object>>> expressions)
-        {
-            //
-            // If no lambda expressions supplied then reflect them off the source element type.
-            //
-
-            if (expressions == null || expressions.Count == 0)
-            {
-                return from m in typeof(T).GetMembers()
-                       where m.MemberType == MemberTypes.Field
-                             || (m.MemberType == MemberTypes.Property && ((PropertyInfo) m).GetIndexParameters().Length == 0)
-                       select m;
-            }
-
-            //
-            // Ensure none of the expressions is null.
-            //
-
-            if (expressions.Any(e => e == null))
-                throw new ArgumentException("One of the supplied expressions was null.", "expressions");
-
-            try
-            {
-                return expressions.Select(x => GetAccessedMember(x));
-            }
-            catch (ArgumentException e)
-            {
-                throw new ArgumentException("One of the supplied expressions is not allowed.", "expressions", e);
-            }
-        }
-
-        /// <remarks>
-        /// The resulting array may contain null entries and those represent
-        /// columns for which there is no source member supplying a value.
-        /// </remarks>
-
-        private static MemberInfo[] BuildOrBindSchema(DataTable table, MemberInfo[] members)
-        {
-            //
-            // Retrieve member information needed to
-            // build or validate the table schema.
-            //
-
-            var columns = table.Columns;
-
-            var schemas = from m in members
-                          let type = m.MemberType == MemberTypes.Property
-                                   ? ((PropertyInfo) m).PropertyType
-                                   : ((FieldInfo) m).FieldType
-                          select new
-                          {
-                              Member = m,
-                              Type = type.IsGenericType
-                                     && typeof(Nullable<>) == type.GetGenericTypeDefinition()
-                                   ? type.GetGenericArguments()[0]
-                                   : type,
-                              Column = columns[m.Name],
-                          };
-
-            //
-            // If the table has no columns then build the schema.
-            // If it has columns then validate members against the columns
-            // and re-order members to be aligned with column ordering.
-            //
-
-            if (columns.Count == 0)
-            {
-                columns.AddRange(schemas.Select(m => new DataColumn(m.Member.Name, m.Type)).ToArray());
-            }
-            else
-            {
-                members = new MemberInfo[columns.Count];
-
-                foreach (var info in schemas)
-                {
-                    var member = info.Member;
-                    var column = info.Column;
-
-                    if (column == null)
-                        throw new ArgumentException(string.Format("Column named '{0}' is missing.", member.Name), "table");
-
-                    if (info.Type != column.DataType)
-                        throw new ArgumentException(string.Format("Column named '{0}' has wrong data type. It should be {1} when it is {2}.", member.Name, info.Type, column.DataType), "table");
-
-                    members[column.Ordinal] = member;
-                }
-            }
-
-            return members;
-        }
-
-        private static UnaryExpression CreateMemberAccessor(Expression parameter, MemberInfo member)
-        {
-            var access = Expression.MakeMemberAccess(parameter, member);
-            return Expression.Convert(access, typeof(object));
-        }
-
-        private static Func<T, object[]> CreateShredder<T>(IEnumerable<MemberInfo> members)
-        {
-            var parameter = Expression.Parameter(typeof(T), "e");
-
-            //
-            // It is valid for members sequence to have null entries, in
-            // which case a null constant is emitted into the corresponding
-            // row values array.
-            //
-
-            var initializers = members.Select(m => m != null
-                                                   ? (Expression)CreateMemberAccessor(parameter, m)
-                                                   : Expression.Constant(null, typeof(object)));
-
-            var array = Expression.NewArrayInit(typeof(object), initializers);
-
-            var lambda = Expression.Lambda<Func<T, object[]>>(array, parameter);
-
-            return lambda.Compile();
-        }
-
-        /// <summary>
-        /// Appends elements in the sequence as rows of a given <see cref="DataTable"/>
-        /// object with a set of lambda expressions specifying which members (property
-        /// or field) of each element in the sequence will supply the column values.
-        /// </summary>
-        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
-        /// <typeparam name="TTable">The type of the input and resulting <see cref="DataTable"/> object.</typeparam>
-        /// <param name="source">The source.</param>
-        /// <param name="table">The <see cref="DataTable"/> type of object where to add rows</param>
-        /// <param name="expressions">Expressions providing access to element members.</param>
-        /// <returns>
-        /// A <see cref="DataTable"/> or subclass representing the source.
-        /// </returns>
-        /// <remarks>This operator uses immediate execution.</remarks>
-        public static TTable ToDataTable<T, TTable>(this IEnumerable<T> source, TTable table, params Expression<Func<T, object>>[] expressions)
-            where TTable : DataTable
-        {
-            if (source == null) throw new ArgumentNullException("source");
-            if (table == null) throw new ArgumentNullException("table");
-
-            var members = PrepareMemberInfos(expressions).ToArray();
-            members = BuildOrBindSchema(table, members);
-            var shredder = CreateShredder<T>(members);
-
-            //
-            // Builds rows out of elements in the sequence and
-            // add them to the table.
-            //
-
-            table.BeginLoadData();
-
-            try
-            {
-                foreach (var element in source)
-                {
-                    var row = table.NewRow();
-                    row.ItemArray = shredder(element);
-                    table.Rows.Add(row);
-                }
-            }
-            finally
-            {
-                table.EndLoadData();
-            }
-
-            return table;
-        }
-
-        /// <summary>
-        /// Appends elements in the sequence as rows of a given <see cref="DataTable"/> object.
-        /// </summary>
-        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
-        /// <typeparam name="TTable"></typeparam>
-        /// <param name="source">The source.</param>
-        /// <param name="table"></param>
-        /// <returns>
-        /// A <see cref="DataTable"/> or subclass representing the source.
-        /// </returns>
-        /// <remarks>This operator uses immediate execution.</remarks>
-        public static TTable ToDataTable<T, TTable>(this IEnumerable<T> source, TTable table)
-            where TTable : DataTable
-        {
-            return ToDataTable(source, table, null);
-        }
-
-        /// <summary>
-        /// Appends elements in the sequence as rows of a given <see cref="DataTable"/>
-        /// object with a set of lambda expressions specifying which members (property
-        /// or field) of each element in the sequence will supply the column values.
-        /// </summary>
-        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
-        /// <param name="source">The source.</param>
-        /// <param name="expressions">Expressions providing access to element members.</param>
-        /// <returns>
-        /// A <see cref="DataTable"/> representing the source.
-        /// </returns>
-        /// <remarks>This operator uses immediate execution.</remarks>
-        public static DataTable ToDataTable<T>(this IEnumerable<T> source, params Expression<Func<T, object>>[] expressions)
-        {
-            return ToDataTable(source, new DataTable(), expressions);
-        }
-
-        /// <summary>
-        /// Converts a sequence to a <see cref="DataTable"/> object.
-        /// </summary>
-        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
-        /// <param name="source">The source.</param>
-        /// <returns>
-        /// A <see cref="DataTable"/> representing the source.
-        /// </returns>
-        /// <remarks>This operator uses immediate execution.</remarks>
-        public static DataTable ToDataTable<T>(this IEnumerable<T> source)
-        {
-            return ToDataTable(source, new DataTable());
-        }
-    }
-}
+    static partial class MoreEnumerable
+    {
+        private static MemberInfo GetAccessedMember(LambdaExpression lambda)
+        {
+            var body = lambda.Body;
+
+            // If it's a field access, boxing was used, we need the field
+            if ((body.NodeType == ExpressionType.Convert) || (body.NodeType == ExpressionType.ConvertChecked))
+            {
+                body = ((UnaryExpression)body).Operand;
+            }
+
+            // Check if the MemberExpression is valid and is a "first level" member access e.g. not a.b.c
+            var memberExpression = body as MemberExpression;
+            if ((memberExpression == null) || (memberExpression.Expression.NodeType != ExpressionType.Parameter))
+            {
+                throw new ArgumentException(string.Format("Illegal expression: {0}", lambda), "lambda");
+            }
+
+            return memberExpression.Member;
+        }
+
+        private static IEnumerable<MemberInfo> PrepareMemberInfos<T>(ICollection<Expression<Func<T, object>>> expressions)
+        {
+            //
+            // If no lambda expressions supplied then reflect them off the source element type.
+            //
+
+            if (expressions == null || expressions.Count == 0)
+            {
+                return from m in typeof(T).GetMembers()
+                       where m.MemberType == MemberTypes.Field
+                             || (m.MemberType == MemberTypes.Property && ((PropertyInfo) m).GetIndexParameters().Length == 0)
+                       select m;
+            }
+
+            //
+            // Ensure none of the expressions is null.
+            //
+
+            if (expressions.Any(e => e == null))
+                throw new ArgumentException("One of the supplied expressions was null.", "expressions");
+
+            try
+            {
+                return expressions.Select(x => GetAccessedMember(x));
+            }
+            catch (ArgumentException e)
+            {
+                throw new ArgumentException("One of the supplied expressions is not allowed.", "expressions", e);
+            }
+        }
+
+        /// <remarks>
+        /// The resulting array may contain null entries and those represent
+        /// columns for which there is no source member supplying a value.
+        /// </remarks>
+
+        private static MemberInfo[] BuildOrBindSchema(DataTable table, MemberInfo[] members)
+        {
+            //
+            // Retrieve member information needed to
+            // build or validate the table schema.
+            //
+
+            var columns = table.Columns;
+
+            var schemas = from m in members
+                          let type = m.MemberType == MemberTypes.Property
+                                   ? ((PropertyInfo) m).PropertyType
+                                   : ((FieldInfo) m).FieldType
+                          select new
+                          {
+                              Member = m,
+                              Type = type.IsGenericType
+                                     && typeof(Nullable<>) == type.GetGenericTypeDefinition()
+                                   ? type.GetGenericArguments()[0]
+                                   : type,
+                              Column = columns[m.Name],
+                          };
+
+            //
+            // If the table has no columns then build the schema.
+            // If it has columns then validate members against the columns
+            // and re-order members to be aligned with column ordering.
+            //
+
+            if (columns.Count == 0)
+            {
+                columns.AddRange(schemas.Select(m => new DataColumn(m.Member.Name, m.Type)).ToArray());
+            }
+            else
+            {
+                members = new MemberInfo[columns.Count];
+
+                foreach (var info in schemas)
+                {
+                    var member = info.Member;
+                    var column = info.Column;
+
+                    if (column == null)
+                        throw new ArgumentException(string.Format("Column named '{0}' is missing.", member.Name), "table");
+
+                    if (info.Type != column.DataType)
+                        throw new ArgumentException(string.Format("Column named '{0}' has wrong data type. It should be {1} when it is {2}.", member.Name, info.Type, column.DataType), "table");
+
+                    members[column.Ordinal] = member;
+                }
+            }
+
+            return members;
+        }
+
+        private static UnaryExpression CreateMemberAccessor(Expression parameter, MemberInfo member)
+        {
+            var access = Expression.MakeMemberAccess(parameter, member);
+            return Expression.Convert(access, typeof(object));
+        }
+
+        private static Func<T, object[]> CreateShredder<T>(IEnumerable<MemberInfo> members)
+        {
+            var parameter = Expression.Parameter(typeof(T), "e");
+
+            //
+            // It is valid for members sequence to have null entries, in
+            // which case a null constant is emitted into the corresponding
+            // row values array.
+            //
+
+            var initializers = members.Select(m => m != null
+                                                   ? (Expression)CreateMemberAccessor(parameter, m)
+                                                   : Expression.Constant(null, typeof(object)));
+
+            var array = Expression.NewArrayInit(typeof(object), initializers);
+
+            var lambda = Expression.Lambda<Func<T, object[]>>(array, parameter);
+
+            return lambda.Compile();
+        }
+
+        /// <summary>
+        /// Appends elements in the sequence as rows of a given <see cref="DataTable"/>
+        /// object with a set of lambda expressions specifying which members (property
+        /// or field) of each element in the sequence will supply the column values.
+        /// </summary>
+        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
+        /// <typeparam name="TTable">The type of the input and resulting <see cref="DataTable"/> object.</typeparam>
+        /// <param name="source">The source.</param>
+        /// <param name="table">The <see cref="DataTable"/> type of object where to add rows</param>
+        /// <param name="expressions">Expressions providing access to element members.</param>
+        /// <returns>
+        /// A <see cref="DataTable"/> or subclass representing the source.
+        /// </returns>
+        /// <remarks>This operator uses immediate execution.</remarks>
+        public static TTable ToDataTable<T, TTable>(this IEnumerable<T> source, TTable table, params Expression<Func<T, object>>[] expressions)
+            where TTable : DataTable
+        {
+            if (source == null) throw new ArgumentNullException("source");
+            if (table == null) throw new ArgumentNullException("table");
+
+            var members = PrepareMemberInfos(expressions).ToArray();
+            members = BuildOrBindSchema(table, members);
+            var shredder = CreateShredder<T>(members);
+
+            //
+            // Builds rows out of elements in the sequence and
+            // add them to the table.
+            //
+
+            table.BeginLoadData();
+
+            try
+            {
+                foreach (var element in source)
+                {
+                    var row = table.NewRow();
+                    row.ItemArray = shredder(element);
+                    table.Rows.Add(row);
+                }
+            }
+            finally
+            {
+                table.EndLoadData();
+            }
+
+            return table;
+        }
+
+        /// <summary>
+        /// Appends elements in the sequence as rows of a given <see cref="DataTable"/> object.
+        /// </summary>
+        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
+        /// <typeparam name="TTable"></typeparam>
+        /// <param name="source">The source.</param>
+        /// <param name="table"></param>
+        /// <returns>
+        /// A <see cref="DataTable"/> or subclass representing the source.
+        /// </returns>
+        /// <remarks>This operator uses immediate execution.</remarks>
+        public static TTable ToDataTable<T, TTable>(this IEnumerable<T> source, TTable table)
+            where TTable : DataTable
+        {
+            return ToDataTable(source, table, null);
+        }
+
+        /// <summary>
+        /// Appends elements in the sequence as rows of a given <see cref="DataTable"/>
+        /// object with a set of lambda expressions specifying which members (property
+        /// or field) of each element in the sequence will supply the column values.
+        /// </summary>
+        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
+        /// <param name="source">The source.</param>
+        /// <param name="expressions">Expressions providing access to element members.</param>
+        /// <returns>
+        /// A <see cref="DataTable"/> representing the source.
+        /// </returns>
+        /// <remarks>This operator uses immediate execution.</remarks>
+        public static DataTable ToDataTable<T>(this IEnumerable<T> source, params Expression<Func<T, object>>[] expressions)
+        {
+            return ToDataTable(source, new DataTable(), expressions);
+        }
+
+        /// <summary>
+        /// Converts a sequence to a <see cref="DataTable"/> object.
+        /// </summary>
+        /// <typeparam name="T">The type of the elements of <paramref name="source"/>.</typeparam>
+        /// <param name="source">The source.</param>
+        /// <returns>
+        /// A <see cref="DataTable"/> representing the source.
+        /// </returns>
+        /// <remarks>This operator uses immediate execution.</remarks>
+        public static DataTable ToDataTable<T>(this IEnumerable<T> source)
+        {
+            return ToDataTable(source, new DataTable());
+        }
+    }
+}


ZipShortest overload for 3 and 4 sequences

--- MoreLinq/ZipShortest.cs
+++ MoreLinq/ZipShortest.cs
@@ -27,14 +27,96 @@
         /// from each of the argument sequences.
         ///
         /// <remarks>
+        /// If the input sequences are of different lengths, the result sequence
+        /// is terminated as soon as the shortest input sequence is exhausted.
+        /// This operator uses deferred execution and streams its results.
+        /// </remarks>
+        /// <example>
+        ///
+        /// var numbers = new[] { 1, 2, 3 };
+        /// var letters = new[] { "A", "B", "C", "D" };
+        /// var chars   = new[] { 'a', 'b', 'c', 'd', 'e' };
+        /// var zipped  = numbers.ZipShortest(letters, chars, (n, l, c) => c + n + l);
+        ///
+        /// The <c>zipped</c> variable, when iterated over, will yield
+        /// "98A", "100B", "102C", in turn.
+        /// </example>
+        /// <typeparam name="T1">Type of elements in first sequence</typeparam>
+        /// <typeparam name="T2">Type of elements in second sequence</typeparam>
+        /// <typeparam name="T3">Type of elements in third sequence</typeparam>
+        /// <typeparam name="TResult">Type of elements in result sequence</typeparam>
+        /// <param name="first">First sequence</param>
+        /// <param name="second">Second sequence</param>
+        /// <param name="third">Third sequence</param>
+        /// <param name="resultSelector">Function to apply to each triplet of elements</param>
+
+        public static IEnumerable<TResult> ZipShortest<T1, T2, T3, TResult>(this IEnumerable<T1> first,
+            IEnumerable<T2> second, IEnumerable<T3> third, Func<T1, T2, T3, TResult> resultSelector)
+        {
+            if (first == null) throw new ArgumentNullException("first");
+            if (second == null) throw new ArgumentNullException("second");
+            if (third == null) throw new ArgumentNullException("third");
+            if (resultSelector == null) throw new ArgumentNullException("resultSelector");
+
+            return ZipImpl<T1, T2, T3, object, TResult>(first, second, third, null, (a, b, c, _) => resultSelector(a, b, c));
+        }
+
+        ///
+        /// Returns a projection of tuples, where each tuple contains the N-th element
+        /// from each of the argument sequences.
+        ///
+        /// <remarks>
+        /// If the input sequences are of different lengths, the result sequence
+        /// is terminated as soon as the shortest input sequence is exhausted.
+        /// This operator uses deferred execution and streams its results.
+        /// </remarks>
+        /// <example>
+        ///
+        /// var numbers = new[] { 1, 2, 3 };
+        /// var letters = new[] { "A", "B", "C", "D" };
+        /// var chars   = new[] { 'a', 'b', 'c', 'd', 'e' };
+        /// var flags   = new[] { true, false };
+        /// var zipped  = numbers.ZipShortest(letters, chars, flags (n, l, c, f) => n + l + c + f);
+        ///
+        /// The <c>zipped</c> variable, when iterated over, will yield
+        /// "1AaTrue", "2BbFalse" in turn.
+        /// </example>
+        /// <typeparam name="T1">Type of elements in first sequence</typeparam>
+        /// <typeparam name="T2">Type of elements in second sequence</typeparam>
+        /// <typeparam name="T3">Type of elements in third sequence</typeparam>
+        /// <typeparam name="T4">Type of elements in fourth sequence</typeparam>
+        /// <typeparam name="TResult">Type of elements in result sequence</typeparam>
+        /// <param name="first">First sequence</param>
+        /// <param name="second">Second sequence</param>
+        /// <param name="third">Third sequence</param>
+        /// <param name="fourth">Fourth sequence</param>
+        /// <param name="resultSelector">Function to apply to each quadruplet of elements</param>
+
+        public static IEnumerable<TResult> ZipShortest<T1, T2, T3, T4, TResult>(this IEnumerable<T1> first,
+            IEnumerable<T2> second, IEnumerable<T3> third, IEnumerable<T4> fourth, Func<T1, T2, T3, T4, TResult> resultSelector)
+        {
+            if (first == null) throw new ArgumentNullException("first");
+            if (second == null) throw new ArgumentNullException("second");
+            if (third == null) throw new ArgumentNullException("third");
+            if (fourth == null) throw new ArgumentNullException("fourth");
+            if (resultSelector == null) throw new ArgumentNullException("resultSelector");
+
+            return ZipImpl(first, second, third, fourth, resultSelector);
+        }
+
+        ///
+        /// Returns a projection of tuples, where each tuple contains the N-th element
+        /// from each of the argument sequences.
+        ///
+        /// <remarks>
         /// If the two input sequences are of different lengths, the result sequence
         /// is terminated as soon as the shortest input sequence is exhausted.
         /// This operator uses deferred execution and streams its results.
         /// </remarks>
         /// <example>
         ///
-        /// int[] numbers = { 1, 2, 3 };
-        /// string[] letters = { "A", "B", "C", "D" };
+        /// var numbers = new[] { 1, 2, 3 };
+        /// var letters = new[] { "A", "B", "C", "D" };
         /// var zipped = numbers.ZipShortest(letters, (n, l) => n + l);
         ///
         /// The <c>zipped</c> variable, when iterated over, will yield "1A", "2B", "3C", in turn.
@@ -53,21 +135,28 @@
             if (second == null) throw new ArgumentNullException("second");
             if (resultSelector == null) throw new ArgumentNullException("resultSelector");

-            return ZipImpl(first, second, resultSelector);
+            return ZipImpl<TFirst, TSecond, object, object, TResult>(first, second, null, null, (a, b, c, d) => resultSelector(a, b));
         }

-        static IEnumerable<TResult> ZipImpl<TFirst, TSecond, TResult>(
-            IEnumerable<TFirst> first,
-            IEnumerable<TSecond> second,
-            Func<TFirst, TSecond, TResult> resultSelector)
+        static IEnumerable<TResult> ZipImpl<T1, T2, T3, T4, TResult>(
+            IEnumerable<T1> s1, IEnumerable<T2> s2,
+            IEnumerable<T3> s3, IEnumerable<T4> s4,
+            Func<T1, T2, T3, T4, TResult> resultSelector)
         {
-            using (var e1 = first.GetEnumerator())
-            using (var e2 = second.GetEnumerator())
+            using (var e1 = s1.GetEnumerator())
+            using (var e2 = s2.GetEnumerator())
+            using (var e3 = s3 != null ? s3.GetEnumerator() : null)
+            using (var e4 = s4 != null ? s4.GetEnumerator() : null)
             {
                 while (e1.MoveNext())
                 {
-                    if (e2.MoveNext())
-                        yield return resultSelector(e1.Current, e2.Current);
+                    if (e2.MoveNext() && (e3 == null || e3.MoveNext())
+                                      && (e4 == null || e4.MoveNext()))
+                    {
+                        yield return resultSelector(e1.Current, e2.Current,
+                            e3 != null ? e3.Current : default(T3),
+                            e4 != null ? e4.Current : default(T4));
+                    }
                 }
             }
         }


Pass IsNewData to the clone.

Pass IsNewData to the clone.

--- MovieMiner/MinerBase.cs
+++ MovieMiner/MinerBase.cs
@@ -301,10 +301,18 @@

 			Load();

+			// Make sure for these fields, copy to the clone and clear it from "this"
+
 			if (CloneCausedReload)
 			{
 				clone.CloneCausedReload = true;
 				CloneCausedReload = false;
+			}
+
+			if (IsNewData)
+			{
+				clone.IsNewData = true;
+				IsNewData = false;
 			}

 			// Copy and fill in all of the base goodness.


use environment variable for project packages in test

--- test/DotNet.Globals.Core.Tests/PackageOperationTests.cs
+++ test/DotNet.Globals.Core.Tests/PackageOperationTests.cs
@@ -12,7 +12,9 @@
     {
         public DirectoryInfo PackagesFolder { get; set; }
         public DirectoryInfo ExecutablesFolder { get; set; }
+
         private Mock<ILogger> _mockLogger;
+        private string _workspaceRoot;

         public PackageOperationTests()
         {
@@ -20,7 +22,9 @@
                 .CreateSubdirectory(Guid.NewGuid().ToString());
             this.ExecutablesFolder = new DirectoryInfo(Path.GetTempPath())
                 .CreateSubdirectory(Guid.NewGuid().ToString());
-            _mockLogger = new Mock<ILogger>();
+
+            this._mockLogger = new Mock<ILogger>();
+            this._workspaceRoot = Environment.GetEnvironmentVariable("WORKSPACEROOT") ?? string.Empty;
         }

         [Fact]
@@ -70,7 +74,7 @@
             PackageOperations packageOperations = PackageOperations
                 .GetInstance(this._mockLogger.Object, this.PackagesFolder.FullName, this.ExecutablesFolder.FullName);

-            packageOperations.Install("../../src/DotNet.Globals.Cli", new Options());
+            packageOperations.Install(Path.Combine(this._workspaceRoot, "../../src/DotNet.Globals.Cli"), new Options());

             this._mockLogger.Verify(l => l.LogInformation("Resolving package from project folder"));
             this._mockLogger.Verify(l => l.LogSuccess("Package has been resolved"));
@@ -85,7 +89,7 @@

             Exception ex = Assert.Throws<Exception>(() =>
             {
-                packageOperations.Install(".", new Options());
+                packageOperations.Install(Path.Combine(this._workspaceRoot, "."), new Options());
             });

             Assert.Equal("Entry point not found in package", ex.Message);


David/Nick #1194 - Fixing unit tests

David/Nick #1194 - Fixing unit tests

--- test/StockportContentApiTests/Integration/RoutesTest.cs
+++ test/StockportContentApiTests/Integration/RoutesTest.cs
@@ -327,8 +327,8 @@
         [InlineData("Group", "/api/unittest/groups/zumba-fitness")]
         [InlineData("Payment", "/api/unittest/payment/payment_slug")]
         [InlineData("Showcase", "/api/unittest/showcase/showcase_slug")]
-        [InlineData("GroupCategory", "/api/unittest/groupCategory")]
-        [InlineData("ContactUsId", "/api/unittest/contactUsId/test-email")]
+        [InlineData("GroupCategory", "/api/unittest/group-categories")]
+        [InlineData("ContactUsId", "/api/unittest/contact-us-id/test-email")]
         [InlineData("Organisation", "/api/unittest/organisations/slug")]
         [InlineData("GroupHomePage", "/api/unittest/grouphomepage")]
         public async Task EndToEnd_ReturnsPageForASlug(string file, string path)


Added tests for traversal methods of BinaryTree<char>

--- tests/DataStructuresAlgorithms.Tests/Tests/TreeTests.cs
+++ tests/DataStructuresAlgorithms.Tests/Tests/TreeTests.cs
@@ -7,6 +7,7 @@
     public class TreeTests
     {
         BinaryTree<int> travTree0;
+        BinaryTree<char> treeLetters;
         public TreeTests()
         {
             /*
@@ -33,6 +34,27 @@
                  , 150)

                  , 100));
+
+            var _J = new Node<char>('J');
+            var _I = new Node<char>(_J, null, 'I');
+            var _H = new Node<char>(null, _I, 'H');
+            var _D = new Node<char>(_H, null, 'D');
+            var _M = new Node<char>(null, null, 'M');
+            var _L = new Node<char>(null, _M, 'L');
+            var _K = new Node<char>(_L, null, 'K');
+            var _E = new Node<char>(_K, null, 'E');
+            var _B = new Node<char>(_D, _E, 'B');
+            var _F = new Node<char>(null, null, 'F');
+            var _S = new Node<char>(null, null, 'S');
+            var _R = new Node<char>(_S, null, 'R');
+            var _N = new Node<char>(_R, null, 'N');
+            var _Q = new Node<char>(null, null, 'Q');
+            var _P = new Node<char>(null, _Q, 'P');
+            var _O = new Node<char>(null, _P, 'O');
+            var _G = new Node<char>(_N, _O, 'G');
+            var _C = new Node<char>(_F, _G, 'C');
+            var _A = new Node<char>(_B, _C, 'A');
+            treeLetters = new BinaryTree<char>(_A);
         }

         [Fact]
@@ -40,12 +62,23 @@
         {
             Console.WriteLine("\nPostOrderTraversalRecursionTest1");
             var orderedVals = new int[] { 25, 75, 50, 110, 125, 175, 150, 100 };
+            var orderedLetters = "JIHDMLKEBFSRNQPOGCA".ToCharArray();
             int i = 0;
             foreach(var nodeVal in BinaryTree<int>.PostOrderTraversalRecursiveIterator(travTree0.Root))
             {
                 Assert.True(nodeVal.Value == orderedVals[i++]);
             }
             foreach (var nodeVal in BinaryTree<int>.PostOrderTraversalRecursiveIterator(null))
+            {
+                Assert.True(false);
+            }
+
+            i = 0;
+            foreach (var nodeLetter in BinaryTree<char>.PostOrderTraversalRecursiveIterator(treeLetters.Root))
+            {
+                Assert.True(nodeLetter.Value == orderedLetters[i++]);
+            }
+            foreach (var nodeLetter in BinaryTree<char>.PostOrderTraversalRecursiveIterator(null))
             {
                 Assert.True(false);
             }
@@ -56,12 +89,24 @@
         {
             Console.WriteLine("\nPreOrderTraversalRecursionTest1");
             var orderedVals = new int[] { 100, 50, 25, 75, 150, 125, 110, 175 };
+            var orderedLetters = "ABDHIJEKLMCFGNRSOPQ".ToCharArray();
+
             int i = 0;
             foreach (var nodeVal in BinaryTree<int>.PreOrderTraversalRecursiveIterator(travTree0.Root))
             {
                 Assert.True(nodeVal.Value == orderedVals[i++]);
             }
             foreach (var nodeVal in BinaryTree<int>.PreOrderTraversalRecursiveIterator(null))
+            {
+                Assert.True(false);
+            }
+
+            i = 0;
+            foreach (var nodeLetter in BinaryTree<char>.PreOrderTraversalRecursiveIterator(treeLetters.Root))
+            {
+                Assert.True(nodeLetter.Value == orderedLetters[i++]);
+            }
+            foreach (var nodeLetter in BinaryTree<char>.PreOrderTraversalRecursiveIterator(null))
             {
                 Assert.True(false);
             }
@@ -72,12 +117,24 @@
         {
             Console.WriteLine("\nInOrderTraversalRecursionTest1");
             var orderedVals = new int[] { 25, 50, 75, 100, 110, 125, 150, 175 };
+            var orderedLetters = "HJIDBLMKEAFCSRNGOPQ".ToCharArray();
+
             int i = 0;
             foreach (var nodeVal in BinaryTree<int>.InOrderTraversalRecursiveIterator(travTree0.Root))
             {
                 Assert.True(nodeVal.Value == orderedVals[i++]);
             }
             foreach(var nodeVal in BinaryTree<int>.InOrderTraversalRecursiveIterator(null))
+            {
+                Assert.True(false);
+            }
+
+            i = 0;
+            foreach (var nodeLetter in BinaryTree<char>.InOrderTraversalRecursiveIterator(treeLetters.Root))
+            {
+                Assert.True(nodeLetter.Value == orderedLetters[i++]);
+            }
+            foreach (var nodeLetter in BinaryTree<char>.InOrderTraversalRecursiveIterator(null))
             {
                 Assert.True(false);
             }
@@ -116,12 +173,24 @@
         {
             Console.WriteLine("\nPreOrderTraversalIterativeIteratorTest");
             var orderedVals = new int[] { 100, 50, 25, 75, 150, 125, 110, 175 };
+            var orderedLetters = "ABDHIJEKLMCFGNRSOPQ".ToCharArray();
+
             int i = 0;
             foreach (var nodeVal in BinaryTree<int>.PreOrderTraversalIterativeIterator(travTree0.Root))
             {
                 Assert.True(nodeVal.Value == orderedVals[i++]);
             }
             foreach (var nodeVal in BinaryTree<int>.PreOrderTraversalIterativeIterator(null))
+            {
+                Assert.True(false);
+            }
+
+            i = 0;
+            foreach (var nodeLetter in BinaryTree<char>.PreOrderTraversalIterativeIterator(treeLetters.Root))
+            {
+                Assert.True(nodeLetter.Value == orderedLetters[i++]);
+            }
+            foreach (var nodeLetter in BinaryTree<char>.PreOrderTraversalIterativeIterator(null))
             {
                 Assert.True(false);
             }
@@ -132,12 +201,24 @@
         {
             Console.WriteLine("\nInOrderTraversalIterativeIteratorTest");
             var orderedVals = new int[] { 25, 50, 75, 100, 110, 125, 150, 175 };
+            var orderedLetters = "HJIDBLMKEAFCSRNGOPQ".ToCharArray();
+
             int i = 0;
             foreach (var nodeVal in BinaryTree<int>.InOrderTraversalIterativeIterator(travTree0.Root))
             {
                 Assert.True(nodeVal.Value == orderedVals[i++]);
             }
             foreach (var nodeVal in BinaryTree<int>.InOrderTraversalIterativeIterator(null))
+            {
+                Assert.True(false);
+            }
+
+            i = 0;
+            foreach (var nodeLetter in BinaryTree<char>.InOrderTraversalIterativeIterator(treeLetters.Root))
+            {
+                Assert.True(nodeLetter.Value == orderedLetters[i++]);
+            }
+            foreach (var nodeLetter in BinaryTree<char>.InOrderTraversalIterativeIterator(null))
             {
                 Assert.True(false);
             }
@@ -148,12 +229,24 @@
         {
             Console.WriteLine("\nPostOrderTraversalIterativeIteratorTest");
             var orderedVals = new int[] { 25, 75, 50, 110, 125, 175, 150, 100 };
+            var orderedLetters = "JIHDMLKEBFSRNQPOGCA".ToCharArray();
+
             int i = 0;
             foreach (var nodeVal in BinaryTree<int>.PostOrderTraversalIterativeIterator(travTree0.Root))
             {
                 Assert.True(nodeVal.Value == orderedVals[i++]);
             }
             foreach (var nodeVal in BinaryTree<int>.PostOrderTraversalIterativeIterator(null))
+            {
+                Assert.True(false);
+            }
+
+            i = 0;
+            foreach (var nodeLetter in BinaryTree<char>.PostOrderTraversalIterativeIterator(treeLetters.Root))
+            {
+                Assert.True(nodeLetter.Value == orderedLetters[i++]);
+            }
+            foreach (var nodeLetter in BinaryTree<char>.PostOrderTraversalIterativeIterator(null))
             {
                 Assert.True(false);
             }


* Name Guidelines update.

* Name Guidelines update.

--- source/SharpFlame/ViewInfo.cs
+++ source/SharpFlame/ViewInfo.cs
@@ -133,10 +133,10 @@
             MainMapView.DrawLater();
         }

-        private void viewPosSet(XYZInt newViewPos)
+        private void ViewPosSet(XYZInt newViewPos)
         {
             ViewPos = newViewPos;
-            viewPosClamp();
+            ViewPosClamp();

             MainMapView.DrawLater();
         }
@@ -146,12 +146,12 @@
             ViewPos.X += displacement.X;
             ViewPos.Z += displacement.Z;
             ViewPos.Y += displacement.Y;
-            viewPosClamp();
+            ViewPosClamp();

             MainMapView.DrawLater();
         }

-        private void viewPosClamp()
+        private void ViewPosClamp()
         {
             const int maxHeight = 1048576;
             const int maxDist = 1048576;
@@ -211,7 +211,7 @@
             if ( flag )
             {
                 var xyzDbl2 = new XYZDouble(ViewPos.X, ViewPos.Y, Convert.ToDouble(- ViewPos.Z));
-                moveToViewTerrainPosFromDistance(xyzDbl, Convert.ToDouble((xyzDbl2 - xyzDbl).GetMagnitude()));
+                MoveToViewTerrainPosFromDistance(xyzDbl, Convert.ToDouble((xyzDbl2 - xyzDbl).GetMagnitude()));
             }

             MainMapView.DrawLater();
@@ -253,10 +253,10 @@
             xyzInt.Y = ViewPos.Y;
             xyzInt.Z = Convert.ToInt32(- horizontal.Y + dblTemp * xyzDbl.Z);

-            viewPosSet(xyzInt);
-        }
-
-        private void moveToViewTerrainPosFromDistance(XYZDouble terrainPos, double distance)
+            ViewPosSet(xyzInt);
+        }
+
+        private void MoveToViewTerrainPosFromDistance(XYZDouble terrainPos, double distance)
         {
             var xyzDbl = default(XYZDouble);
             var xyzInt = new XYZInt(0, 0, 0);
@@ -267,7 +267,7 @@
             xyzInt.Y = Convert.ToInt32(terrainPos.Y - xyzDbl.Y * distance);
             xyzInt.Z = Convert.ToInt32(- terrainPos.Z - xyzDbl.Z * distance);

-            viewPosSet(xyzInt);
+            ViewPosSet(xyzInt);
         }

         public bool PosGetScreenXY(XYZDouble pos, ref XYInt result)
@@ -317,7 +317,7 @@
             return true;
         }

-        private bool screenXYGetTerrainPos(XYInt screenPos, ref WorldPos resultPos)
+        private bool ScreenXyGetTerrainPos(XYInt screenPos, ref WorldPos resultPos)
         {
             var xyzDbl = default(XYZDouble);
             var terrainViewVector = default(XYZDouble);
@@ -585,7 +585,7 @@
             return false;
         }

-        private void applyTerrain()
+        private void ApplyTerrain()
         {
             var mouseOverTerrain = GetMouseOverTerrain();

@@ -605,7 +605,7 @@
             MainMapView.DrawLater();
         }

-        private void applyRoad()
+        private void ApplyRoad()
         {
             var mouseOverTerrain = GetMouseOverTerrain();

@@ -677,7 +677,7 @@
             }
         }

-        private void applyRoadLineSelection()
+        private void ApplyRoadLineSelection()
         {
             var mouseOverTerrian = GetMouseOverTerrain();

@@ -759,7 +759,7 @@
             }
         }

-        private void applyTerrainFill(FillCliffAction cliffAction, bool inside)
+        private void ApplyTerrainFill(FillCliffAction cliffAction, bool inside)
         {
             var mouseOverTerrain = GetMouseOverTerrain();

@@ -1014,7 +1014,7 @@
             MainMapView.DrawLater();
         }

-        private void applyTexture()
+        private void ApplyTexture()
         {
             var mouseOverTerrain = GetMouseOverTerrain();

@@ -1028,7 +1028,7 @@
                 Map = Map,
                 TextureNum = uiOptions.Textures.SelectedTile,
                 SetTexture = uiOptions.Textures.SetTexture,
-                Orientation = relativeToViewAngle(uiOptions.Textures.TextureOrientation),
+                Orientation = RelativeToViewAngle(uiOptions.Textures.TextureOrientation),
                 RandomOrientation = uiOptions.Textures.Randomize,
                 SetOrientation = uiOptions.Textures.SetOrientation,
                 TerrainAction = uiOptions.Textures.TerrainMode
@@ -1047,7 +1047,7 @@
         /// </summary>
         /// <param name="currentOrientation"></param>
         /// <returns></returns>
-        private TileOrientation relativeToViewAngle(TileOrientation currentOrientation)
+        private TileOrientation RelativeToViewAngle(TileOrientation currentOrientation)
         {
             var anglePY = new Angles.AnglePY();
             Matrix3DMath.MatrixToPY(ViewAngleMatrix, ref anglePY);
@@ -1081,7 +1081,7 @@
             return currentOrientation;
         }

-        private void applyCliffTriangle(bool remove)
+        private void ApplyCliffTriangle(bool remove)
         {
             var mouseOverTerrain = GetMouseOverTerrain();

@@ -1116,7 +1116,7 @@
             MainMapView.DrawLater();
         }

-        private void applyCliff()
+        private void ApplyCliff()
         {
             var mouseOverTerrain = GetMouseOverTerrain();

@@ -1141,7 +1141,7 @@
             MainMapView.DrawLater();
         }

-        private void applyCliffRemove()
+        private void ApplyCliffRemove()
         {
             var mouseOverTerrain = GetMouseOverTerrain();

@@ -1441,7 +1441,7 @@
                 var mouseOverTerrain = new clsMouseOver.clsOverTerrain();
                 if ( App.SettingsManager.DirectPointer )
                 {
-                    if ( screenXYGetTerrainPos(MouseOver.ScreenPos, ref mouseOverTerrain.Pos) )
+                    if ( ScreenXyGetTerrainPos(MouseOver.ScreenPos, ref mouseOverTerrain.Pos) )
                     {
                         if ( Map.PosIsOnMap(mouseOverTerrain.Pos.Horizontal) )
                         {
@@ -1505,7 +1505,7 @@
                     {
                         if (uiOptions.MouseTool == MouseTool.TerrainBrush)
                         {
-                            applyTerrain();
+                            ApplyTerrain();
                             // TODO: implement me.
 //                            if (Program.frmMainInstance.cbxAutoTexSetHeight.Checked)
 //                            {
@@ -1518,23 +1518,23 @@
                         }
                         else if (uiOptions.MouseTool == MouseTool.TextureBrush)
                         {
-                            applyTexture();
+                            ApplyTexture();
                         }
                         else if (uiOptions.MouseTool == MouseTool.CliffTriangle)
                         {
-                            applyCliffTriangle(false);
+                            ApplyCliffTriangle(false);
                         }
                         else if (uiOptions.MouseTool == MouseTool.CliffBrush)
                         {
-                            applyCliff();
+                            ApplyCliff();
                         }
                         else if (uiOptions.MouseTool == MouseTool.CliffRemove)
                         {
-                            applyCliffRemove();
+                            ApplyCliffRemove();
                         }
                         else if (uiOptions.MouseTool == MouseTool.RoadPlace)
                         {
-                            applyRoad();
+                            ApplyRoad();
                         }
                         else if (uiOptions.MouseTool == MouseTool.RoadRemove)
                         {
@@ -1552,7 +1552,7 @@
                         }
                         else if (uiOptions.MouseTool == MouseTool.CliffTriangle)
                         {
-                            applyCliffTriangle(true);
+                            ApplyCliffTriangle(true);
                         }
                     }
                 }
@@ -1732,7 +1732,7 @@
                                 }
                                 else
                                 {
-                                    applyTerrain();
+                                    ApplyTerrain();
                                     if ( Program.frmMainInstance.cbxAutoTexSetHeight.Checked )
                                     {
                                         applyHeightSet(uiOptions.Terrain.Brush, (byte)uiOptions.Height.LmbHeight);
@@ -1761,21 +1761,21 @@
                                 }
                                 else
                                 {
-                                    applyTexture();
+                                    ApplyTexture();
                                 }
                             }
                         }
                         else if (uiOptions.MouseTool == MouseTool.CliffTriangle)
                         {
-                            applyCliffTriangle(false);
+                            ApplyCliffTriangle(false);
                         }
                         else if (uiOptions.MouseTool == MouseTool.CliffBrush)
                         {
-                            applyCliff();
+                            ApplyCliff();
                         }
                         else if (uiOptions.MouseTool == MouseTool.CliffRemove)
                         {
-                            applyCliffRemove();
+                            ApplyCliffRemove();
                         }
                         else if (uiOptions.MouseTool == MouseTool.TerrainFill)
                         {
@@ -1787,7 +1787,7 @@
                                 }
                                 else
                                 {
-                                    applyTerrainFill(Program.frmMainInstance.FillCliffAction, Program.frmMainInstance.cbxFillInside.Checked);
+                                    ApplyTerrainFill(Program.frmMainInstance.FillCliffAction, Program.frmMainInstance.cbxFillInside.Checked);
                                     MainMapView.DrawLater();
                                 }
                             }
@@ -1796,14 +1796,14 @@
                         {
                             if ( Map.Tileset != null )
                             {
-                                applyRoad();
+                                ApplyRoad();
                             }
                         }
                         else if (uiOptions.MouseTool == MouseTool.RoadLines)
                         {
                             if ( Map.Tileset != null )
                             {
-                                applyRoadLineSelection();
+                                ApplyRoadLineSelection();
                             }
                         }
                         else if (uiOptions.MouseTool == MouseTool.RoadRemove)
@@ -1888,7 +1888,7 @@
                 }
                 else if (uiOptions.MouseTool == MouseTool.CliffTriangle)
                 {
-                    applyCliffTriangle(true);
+                    ApplyCliffTriangle(true);
                 }
                 else if (uiOptions.MouseTool == MouseTool.Gateways)
                 {


Updated ToModel<T> to use reflection for cast

--- src/App_Classes/Extensions.cs
+++ src/App_Classes/Extensions.cs
@@ -65,34 +65,73 @@
         }

         /// <summary>
-        /// Casts a DbDataReader object to a object Model
+        /// Casts a DbDataReader object to T
+        /// Note: Properties in object T must have custom ColumnName attribute with corresponding column name
         /// </summary>
         /// <param name="@this">reader object</param>
-        public static T ToModel<T>(this DbDataReader @this) where T : class
+        public static T ToModel<T>(this DbDataReader @this) where T : class, new()
         {
-            T objectCast = null;
+            T objectCast = new T();

             // return early if no data
             if (!@this.HasRows || @this.FieldCount == 0)
                 return objectCast;

-            // ToDo: use GetColumnSchema for generic mapping
-            // map NpgsqlDataReader to ModelName type
-            if (typeof (T) == typeof (ModelName) && objectCast == null)
+            Type objectCastType = objectCast.GetType();
+            IEnumerable<PropertyInfo> objProperties = objectCastType.GetTypeInfo().DeclaredProperties;
+
+            foreach(var propInfo in objProperties)
             {
-                var modelName = new ModelName
+                // get column name attribute from property
+                ColumnName columnNameAttr = propInfo.GetCustomAttribute(typeof(ColumnName), false) as ColumnName;
+                string columnName = columnNameAttr !=null ? columnNameAttr.AttributeValue : null;
+
+                if (@this[columnName] != DBNull.Value)
                 {
-                    Id = Guid.Parse(@this["model_id"].ToString()),
-                    Name = @this["name"].ToString(),
-                    Description = @this["description"].ToString(),
-                    Created = @this["created"] != DBNull.Value ? DateTime.Parse(@this["created"].ToString()) : DateTime.MinValue,
-                    Updated = @this["updated"] != DBNull.Value ? (DateTime?)DateTime.Parse(@this["updated"].ToString()) : null,
-                };
+                    string propName = propInfo.Name;
+
+                    Type propType = propInfo.PropertyType;
+                    if (propType == typeof(Guid) || propType == typeof (Guid?))
+                    {
+                        Guid parsedValue;
+                        if (Guid.TryParse(@this[columnName].ToString(), out parsedValue))
+                        {
+                            if (propType == typeof(Guid))
+                                propInfo.SetValue(objectCast, parsedValue, null);
+                            else
+                                propInfo.SetValue(objectCast, (Guid?)parsedValue, null);
+                        }
+                    }
+                    else if (propType == typeof (int) || propType == typeof (int?))
+                    {
+                        int parsedValue;
+                        if (int.TryParse(@this[columnName].ToString(), out parsedValue))
+                        {
+                            if (propType == typeof (int))
+                                propInfo.SetValue(objectCast, parsedValue, null);
+                            else
+                                propInfo.SetValue(objectCast, (int?)parsedValue, null);
+                        }
+                    }
+                    else if (propType == typeof (DateTime) || propType == typeof (DateTime?))
+                    {
+                        DateTime parsedValue;
+                        if (DateTime.TryParse(@this[columnName].ToString(), out parsedValue))
+                        {
+                            if (propType == typeof (DateTime))
+                                propInfo.SetValue(objectCast, parsedValue, null);
+                            else
+                                propInfo.SetValue(objectCast, (DateTime?)parsedValue, null);
+                        }
+                    }
+                    else if (propType == typeof (string))
+                    {
+                        propInfo.SetValue(objectCast, @this[columnName].ToString(), null);
+                    }
+
+                } // end if @this[columnName] != DBNull.Value
+            } // end foreach var propInfo in objProperties

-                objectCast = modelName as T;
-            }
-
-
             return objectCast;
         }

@@ -150,4 +189,4 @@
             } // end foreach MemberInfo Field in miT
         }
     }
-}+}


cosmetic

cosmetic

--- src/AutoMapper/TypeDetails.cs
+++ src/AutoMapper/TypeDetails.cs
@@ -72,7 +72,7 @@
                     case FieldInfo field:
                         return !field.IsStatic && shouldMapField(field);
                     default:
-                        throw new ArgumentException("Should be a field, property or constructor.");
+                        throw new ArgumentException("Should be a field or a property.");
                 }
             };
         }


アセンブリ名の付け漏れ修正

アセンブリ名の付け漏れ修正

--- src/Compiler/CodeGenerator.cs
+++ src/Compiler/CodeGenerator.cs
@@ -156,10 +156,11 @@
                             il.WriteLine(args.Join('\n'));
                             var callsig = fx.Function.IsVirtual ? "callvirt instance" : "call";
                             var retvar = GetParameterName(fx.Function.ReturnType);
+                            var asmname = $"[{fx.Assembly.GetName().Name}]";
                             var classname = GetTypeName(GetType(fx), call.Caller!.GenericsMapper);
                             var fname = fx.Function.Name;
                             var param_args = fx.Function.GetParameters().Map(x => GetParameterName(x.ParameterType)).Join(", ");
-                            il.WriteLine($"{callsig} {retvar} {classname}::{fname}({param_args})");
+                            il.WriteLine($"{callsig} {retvar} class {asmname}{classname}::{fname}({param_args})");
                         }
                         else if (f.Function is FunctionBody fb)
                         {


Added setters to ExchangeInfo.PersistMessages, PersistWorkQueuesAndExchanges.

--- src/Common/RestBus.Common/Amqp/ExchangeInfo.cs
+++ src/Common/RestBus.Common/Amqp/ExchangeInfo.cs
@@ -18,7 +18,7 @@

         public string ServerAddress { get; protected set; }
         public string ServiceName { get; protected set; }
-        public ExchangeKind SupportedKinds { get; protected set; }
+        public ExchangeKind SupportedKinds { get; set; }

         /// <summary>
         /// Controls the message delivery mode.
@@ -26,13 +26,7 @@
         /// This property has no effect if the work queue is non durable.
         /// <seealso cref="PersistentWorkQueuesAndExchanges"/>
         /// </summary>
-        public bool PersistentMessages
-        {
-            get
-            {
-                return false;
-            }
-        }
+        public bool PersistentMessages { get; set; }

         /// <summary>
         /// Controls the durability of work queues and exchanges.
@@ -42,12 +36,6 @@
         /// This property only controls the durabilty of work queues and exchanges. It doesn't control the durability of messages sent to the work queue.
         /// <seealso cref="PersistentMessages"/>
         /// </remarks>
-        public bool PersistentWorkQueuesAndExchanges
-        {
-            get
-            {
-                return false;
-            }
-        }
+        public bool PersistentWorkQueuesAndExchanges { get; set; }
     }
 }


DebuggerNonUserCode added to StatusManager.

--- src/Crystal3/UI/StatusManager/StatusManager.cs
+++ src/Crystal3/UI/StatusManager/StatusManager.cs
@@ -1,6 +1,7 @@
 using Crystal3.Core;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -92,6 +93,7 @@
             }
         }

+        [DebuggerNonUserCode]
         public Task<T> DoIndefiniteWorkAsync<T>(string statusText, Task<T> workCallback)
         {
             UpdateStatusText(statusText);


Do not reveng __ExtendedProperties table

--- src/Design40/ReverseEngineering/Model/Table.cs
+++ src/Design40/ReverseEngineering/Model/Table.cs
@@ -14,7 +14,8 @@
        FROM
              INFORMATION_SCHEMA.TABLES
        WHERE
-             TABLE_TYPE = 'TABLE'";
+             TABLE_TYPE = 'TABLE'
+       AND TABLE_NAME <> '__ExtendedProperties'";

         public virtual string Id { get;[param: CanBeNull] set; }
         public virtual string SchemaName { get;[param: CanBeNull] set; }


Avoid catching log errors

Avoid catching log errors

--- src/Discord.Net.WebSocket/Audio/AudioClient.cs
+++ src/Discord.Net.WebSocket/Audio/AudioClient.cs
@@ -332,12 +332,13 @@
                 try
                 {
                     await pair.Writer.WriteAsync(packet, 0, packet.Length).ConfigureAwait(false);
-                    await _audioLogger.DebugAsync($"Received {packet.Length} bytes from user {userId}").ConfigureAwait(false);
                 }
                 catch (Exception ex)
                 {
                     await _audioLogger.DebugAsync($"Malformed Frame", ex).ConfigureAwait(false);
-                }
+                    return;
+                }
+                await _audioLogger.DebugAsync($"Received {packet.Length} bytes from user {userId}").ConfigureAwait(false);
             }
         }