Handled the case multiple slices are used in the same method.

--- ArraySliceAddin/ModuleWeaver.cs
+++ ArraySliceAddin/ModuleWeaver.cs
@@ -118,97 +118,88 @@
             var processor = method.Body.GetILProcessor();
             var instructions = processor.Body.Instructions;

-            foreach ( var slice in slices )
-            {
+            var slicesLookup = slices.ToLookup(x => x.Definition);
+
+            for (int offset = 0; offset < instructions.Count; offset++)
+            {
+                var instruction = instructions[offset];
+                if (!instruction.OpCode.IsCall())
+                    continue;
+
+                var methodReference = instruction.Operand as MethodReference;
+                if (methodReference == null)
+                    continue;
+
+                if (methodReference.Name != "get_Item" && methodReference.Name != "set_Item")
+                    continue;
+
+                var objectToCall = instruction.TraceBack(methodReference, 0);
+                var parameter = instruction.TraceBack(methodReference, -1);
+
+                var slice = slicesLookup[objectToCall.Operand].First();
                 var arraySliceType = ModuleDefinition.Import(typeof(ArraySlice<>)).MakeGenericInstanceType(slice.GenericArgument);

-                for (int offset = 0; offset < instructions.Count; offset++)
-                {
-                    var instruction = instructions[offset];
-
-                    if (!instruction.OpCode.IsCall())
-                        continue;
-
-                    var methodReference = instruction.Operand as MethodReference;
-                    if (methodReference == null)
-                        continue;
-
-                    if (methodReference.Name != "get_Item" && methodReference.Name != "set_Item")
-                        continue;
-
-                    var methodDefinition = methodReference.Resolve();
-
-                    var genericInstanceType = methodDefinition.DeclaringType;
-                    if (genericInstanceType.FullName != arraySliceType.ElementType.FullName)
-                        continue;
-
-                    // FIXME: We know we cannot process if anything happens between the push of the array slice and the final operation.
-                    if (methodDefinition.IsGetter)
-                    {
-                        var objectToCall = instruction.TraceBack(methodReference, 0);
-                        var parameter = instruction.TraceBack(methodReference, -1);
-
-                        // Original GET:
-                        // 1    ldarg.s segment              $ Push the object to call
-                        // =    ldloc.1                      $ Push the parameter
-                        // 2    callvirt instance !0 class ArraySegment.ArraySlice`1<float32>::get_Item(int32)
-                        // =    stloc.s t                    $ Do whatever with the result of the GET call
-
-                        // Target GET:
-                        // 1    ldloc.s data                 $ Push the object to call
-                        // =    ldloc.1                      $ Push the parameter
-                        // 2    ldloc.s offset
-                        // 2    add                          $ Add the parameter (i) and the offset.
-                        // 2    ldelem.r4                    $ Use standard ldelem with type to get the value from the array.
-                        // =    stloc.s t                    $ Do whatever with the result of the GET call
-
-                        //HACK: We rewrite it to avoid killing the loop.
-                        objectToCall.OpCode = OpCodes.Ldloc;
-                        objectToCall.Operand = slice.ArrayVariable;
-
-                        instructions[offset] = Instruction.Create(OpCodes.Ldelem_Any, slice.GenericArgument);
-
-                        processor.InsertAfter(parameter, new[] {
+                var methodDefinition = methodReference.Resolve();
+
+                // FIXME: We know we cannot process if anything happens between the push of the array slice and the final operation.
+                if (methodDefinition.IsGetter)
+                {
+                    // Original GET:
+                    // 1    ldarg.s segment              $ Push the object to call
+                    // =    ldloc.1                      $ Push the parameter
+                    // 2    callvirt instance !0 class ArraySegment.ArraySlice`1<float32>::get_Item(int32)
+                    // =    stloc.s t                    $ Do whatever with the result of the GET call
+
+                    // Target GET:
+                    // 1    ldloc.s data                 $ Push the object to call
+                    // =    ldloc.1                      $ Push the parameter
+                    // 2    ldloc.s offset
+                    // 2    add                          $ Add the parameter (i) and the offset.
+                    // 2    ldelem.r4                    $ Use standard ldelem with type to get the value from the array.
+                    // =    stloc.s t                    $ Do whatever with the result of the GET call
+
+                    //HACK: We rewrite it to avoid killing the loop.
+                    objectToCall.OpCode = OpCodes.Ldloc;
+                    objectToCall.Operand = slice.ArrayVariable;
+
+                    instructions[offset] = Instruction.Create(OpCodes.Ldelem_Any, slice.GenericArgument);
+
+                    processor.InsertAfter(parameter, new[] {
                                 Instruction.Create( OpCodes.Ldloc, slice.OffsetVariable ),
                                 Instruction.Create( OpCodes.Add )
                         });
-                    }
-                    else if (methodDefinition.IsSetter)
-                    {
-                        var objectToCall = instruction.TraceBack(methodReference, 0);
-                        var parameter = instruction.TraceBack(methodReference, -1);
-
-                        // Original SET:
-                        // 1		ldarg segment	    $ Push the object to call
-                        // =		ldloc.0		        $ Push the parameter
-                        // =		ldc.r4 2		    $ Push the value to set
-                        // 2		callvirt instance void class ArraySegment.ArraySlice`1<float32>::set_Item(int32, !0)
-                        // -        nop			        $ Check if it even exists after SimplifyMacros in the collection.
-
-                        // Target SET
-                        // 1		ldloc data		    $ Push the array
-                        // =		ldloc.0		        $ Push the parameter
-                        // 2		ldloc offset
-                        // 2		add      		    $ Add the parameter (i) and the offset.
-                        // =		ldc.r4 2		    $ Push the value to set. Use standard ldc with type and check if it  is optimized afterwards.
-                        // 2		stelem   		    $ Use standard stelem with type and check if it is optimized afterwards.
-
-                        //HACK: We rewrite it to avoid killing the loop.
-                        objectToCall.OpCode = OpCodes.Ldloc;
-                        objectToCall.Operand = slice.ArrayVariable;
-
-                        instructions[offset] = Instruction.Create(OpCodes.Stelem_Any, slice.GenericArgument);
-
-                        processor.InsertAfter(parameter, new[] {
+                }
+                else if (methodDefinition.IsSetter)
+                {
+                    // Original SET:
+                    // 1		ldarg segment	    $ Push the object to call
+                    // =		ldloc.0		        $ Push the parameter
+                    // =		ldc.r4 2		    $ Push the value to set
+                    // 2		callvirt instance void class ArraySegment.ArraySlice`1<float32>::set_Item(int32, !0)
+                    // -        nop			        $ Check if it even exists after SimplifyMacros in the collection.
+
+                    // Target SET
+                    // 1		ldloc data		    $ Push the array
+                    // =		ldloc.0		        $ Push the parameter
+                    // 2		ldloc offset
+                    // 2		add      		    $ Add the parameter (i) and the offset.
+                    // =		ldc.r4 2		    $ Push the value to set. Use standard ldc with type and check if it  is optimized afterwards.
+                    // 2		stelem   		    $ Use standard stelem with type and check if it is optimized afterwards.
+
+                    //HACK: We rewrite it to avoid killing the loop.
+                    objectToCall.OpCode = OpCodes.Ldloc;
+                    objectToCall.Operand = slice.ArrayVariable;
+
+                    instructions[offset] = Instruction.Create(OpCodes.Stelem_Any, slice.GenericArgument);
+
+                    processor.InsertAfter(parameter, new[] {
                                 Instruction.Create( OpCodes.Ldloc, slice.OffsetVariable ),
                                 Instruction.Create( OpCodes.Add )
                         });

-                    }
-                    else continue;
-                }
-            }
-
+                }
+                else continue;
+            }

         }


Small changes for test.

Small changes for test.

--- svn/trunk/Source/Samples/OpenCL/Test/Program.cs
+++ svn/trunk/Source/Samples/OpenCL/Test/Program.cs
@@ -59,6 +59,7 @@

     class Program
     {
+        static int32 magicConst = 3;
         static void Main(string[] args)
         {
             var start = System.DateTime.Now;
@@ -77,8 +78,8 @@
                     //{
                     //    System.Console.Write("|");
                     //}
-
-                    if ((j) % 5 == 0)
+
+                    if ((j) % magicConst == 0)
                     {
                         System.Console.Write(arr[i * size + j]);
                         System.Console.Write("|");
@@ -91,14 +92,14 @@
         static void Do()
         {

-            var inArr = new int32[102]
+            var inArr = new int32[1002]
                              // { 2, 1, 2 }
                              //{2, 2, 2, 2, 2, 2, 2, 1, 2 }
                             //{2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2 }
                             //{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2 }
                             ;
-            for (int _i = 0; _i < 102; _i++) { inArr[_i] = 2; }
-            inArr[101] = 1;
+            for (int _i = 0; _i < 1002; _i++) { inArr[_i] = 2; }
+            inArr[1001] = 1;
             int32 size = inArr.Length;

             var rules = new Rule[] {new Rule(1,2,3,0,0),new Rule(2,1,0,0,0),new Rule(3,2,0,0,0),new Rule(2,3,2,0,0)
@@ -123,8 +124,8 @@

             var commandQueue = new CommandQueue(provider, provider.Devices.First());

-            var bArr = new int32[size * size * nTerms * 5];
-            var rulesArr = new int32[rules.Length * 5];
+            var bArr = new int32[size * size * nTerms * magicConst];
+            var rulesArr = new int32[rules.Length * magicConst];

             for (int i = 0; i < size; i++)
             {
@@ -132,23 +133,24 @@
                 {
                     if (inArr[i] == (rules[j]).b && (rules[j]).c == 0)
                     {
-                        var _base = i * nTerms * 5 + (int) (rules[j].a -1) * 5;
+                        var _base = i * nTerms * magicConst + (int)(rules[j].a - 1) * magicConst;
                         bArr[_base] = rules[j].a;
                         bArr[_base + 1] = 0;
                         bArr[_base + 2] = (rules[j].lblNum == 0 ? 1 : 0);
-                        bArr[_base + 3] = rules[j].lblNum;
-                        bArr[_base + 4] = rules[j].lblWeight;
+                        ///bArr[_base + 3] = rules[j].lblNum;
+                        //bArr[_base + 4] = rules[j].lblWeight;
                     }
                 }
             }

             for (int i = 0; i < rules.Length; i++)
             {
-                rulesArr[i * 5] = rules[i].a;
-                rulesArr[i * 5 + 1] = rules[i].b;
-                rulesArr[i * 5 + 2] = rules[i].c;
-                rulesArr[i * 5 + 3] = rules[i].lblNum;
-                rulesArr[i * 5 + 4] = rules[i].lblWeight;
+                var _base =  i * magicConst;
+                rulesArr[_base] = rules[i].a;
+                rulesArr[_base + 1] = rules[i].b;
+                rulesArr[_base + 2] = rules[i].c;
+                //rulesArr[_base + 3] = rules[i].lblNum;
+                //rulesArr[_base + 4] = rules[i].lblWeight;
             }

             var buffer = new Buffer<int32>(provider, Operations.ReadWrite, Memory.Device, bArr);
@@ -158,17 +160,18 @@
                 provider.Compile<_1D, int32, int32, int32, Buffer<int32>, Buffer<int32>>(
                 (range, l, rule_id, k, a, _rulesBuf) =>
                     from r in range
-                    let i = r.GlobalID0
-                    let _base = provider.CompileFunction((int32 _l, int32 _size, int32 _nTerms) => (int32)(_l * _size * 5 * _nTerms))
-                    let left_base_idx = _base(k, size, nTerms) + i * nTerms * 5
-                    let right_base_idx = _base((l - k - 1), size, nTerms) + (k + i + 1) * nTerms * 5
-                    let rule_base = (rule_id * 5)
+                    let i = r.GlobalID0
+                    let _base = provider.CompileFunction((int32 _l, int32 _size, int32 _nTerms, int32 _magicConst) => (int32)(_l * _size * _magicConst * _nTerms))
+                    let nT = nTerms * magicConst
+                    let rule_base = rule_id * magicConst
                     let rule_a = _rulesBuf[rule_base]
                     let rule_b = _rulesBuf[rule_base + 1]
                     let rule_c = _rulesBuf[rule_base + 2]
-                    let left = a[left_base_idx + (rule_b - 1) * 5]
-                    let right = a[right_base_idx + (rule_c - 1) * 5]
-                    let res_id = _base(l, size, nTerms) + i * nTerms * 5 + (rule_a - 1) * 5
+                    let left_base_idx = _base(k, size, nTerms, magicConst) + i * nT
+                    let right_base_idx = _base((l - k - 1), size, nTerms, magicConst) + (k + i + 1) * nT
+                    let left = a[left_base_idx + (rule_b - 1) * magicConst]
+                    let right = a[right_base_idx + (rule_c - 1) * magicConst]
+                    let res_id = _base(l, size, nTerms, magicConst) + i * nT + (rule_a - 1) * magicConst
                     let v = (rule_c != 0 && rule_b == left && rule_c == right)
                             ? rule_a
                             : a[res_id]
@@ -185,7 +188,7 @@
                 }
             }
             commandQueue.Finish();
-            commandQueue.Add(buffer.Read(0, size * size * nTerms * 5, bArr)).Finish();
+            commandQueue.Add(buffer.Read(0, size * size * nTerms * magicConst, bArr)).Finish();
             //toMatrix(bArr, (int) (size * nTerms * 5));
             buffer.Dispose();


make column and row header collection enumerable

--- ReoGrid/Core/Header.cs
+++ ReoGrid/Core/Header.cs
@@ -33,6 +33,7 @@
 using unvell.ReoGrid.CellTypes;
 using unvell.ReoGrid.Actions;
 using unvell.ReoGrid.Utility;
+using System.Collections;

 #if OUTLINE
 using unvell.ReoGrid.Outline;
@@ -2880,7 +2881,7 @@
 		/// <summary>
 		/// Row header collection
 		/// </summary>
-		public class RowHeaderCollection
+		public class RowHeaderCollection : IEnumerable<RowHeader>
 		{
 			internal Worksheet GridControl { get; set; }

@@ -2902,12 +2903,27 @@
 					return (index < 0 || index >= grid.rows.Count) ? null : grid.rows[index];
 				}
 			}
+
+			private IEnumerator<RowHeader> GetEnum()
+			{
+				return this.GridControl.rows.GetEnumerator();
+			}
+
+			public IEnumerator<RowHeader> GetEnumerator()
+			{
+				return this.GetEnum();
+			}
+
+			IEnumerator IEnumerable.GetEnumerator()
+			{
+				return this.GetEnum();
+			}
 		}

 		/// <summary>
 		/// Column header collection
 		/// </summary>
-		public class ColumnHeaderCollection
+		public class ColumnHeaderCollection : IEnumerable<ColumnHeader>
 		{
 			internal Worksheet GridControl { get; set; }

@@ -2942,6 +2958,21 @@
 					int index = RGUtility.GetNumberOfChar(address);
 					return this[index];
 				}
+			}
+
+			private IEnumerator<ColumnHeader> GetEnum()
+			{
+				return this.GridControl.cols.GetEnumerator();
+			}
+
+			public IEnumerator<ColumnHeader> GetEnumerator()
+			{
+				return this.GetEnum();
+			}
+
+			IEnumerator IEnumerable.GetEnumerator()
+			{
+				return this.GetEnum();
 			}
 		}


Tidied Routes For Friendlier URLs

Tidied Routes For Friendlier URLs

--- gdRead.Web/App_Start/RouteConfig.cs
+++ gdRead.Web/App_Start/RouteConfig.cs
@@ -10,11 +10,22 @@
             routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

             routes.MapRoute(
+                name: "UnAuthenticatedHomePage",
+                url: "Home/",
+                defaults: new { controller = "Home", action = "Index" }
+            );
+
+            routes.MapRoute(
+                name: "Dashboard",
+                url: "Dev/",
+                defaults: new { controller = "DevTest", action = "Dashboard" }
+            );
+
+            routes.MapRoute(
                 name: "Default",
                 url: "{controller}/{action}/{id}",
-                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
+                defaults: new { controller = "Home", action = "MyFeeds", id = UrlParameter.Optional }
             );
-
         }
     }
 }


[DEVOPS-372] add msg criteria & prev blast id params

--- Sailthru/Sailthru.Models/BlastRequest.cs
+++ Sailthru/Sailthru.Models/BlastRequest.cs
@@ -12,6 +12,8 @@
     using System.Text;
     using Newtonsoft.Json;
     using System.Collections;
+    using Newtonsoft.Json.Converters;
+    using System.Runtime.Serialization;

     /// <summary>
     /// Request object used for interaction with the blast API.
@@ -67,6 +69,31 @@
         }

         /// <summary>
+        /// Message criteria for retargeting campaigns.
+        /// </summary>
+        [JsonConverter(typeof(StringEnumConverter))]
+        public enum MessageCriteriaType
+        {
+            [EnumMember(Value = "not_opened")]
+            NotOpened,
+
+            [EnumMember(Value = "not_clicked")]
+            NotClicked,
+
+            [EnumMember(Value = "not_purchased")]
+            NotPurchased,
+
+            [EnumMember(Value = "opened")]
+            Opened,
+
+            [EnumMember(Value = "clicked")]
+            Clicked,
+
+            [EnumMember(Value = "purchased")]
+            Purchased
+        }
+
+        /// <summary>
         /// Gets or sets the name.
         /// </summary>
         /// <value>
@@ -299,5 +326,23 @@
         /// </value>
         [JsonProperty(PropertyName = "test_email")]
         public string TestEmail { get; set; }
+
+        /// <summary>
+        /// Gets or sets the message criteria.
+        /// </summary>
+        /// <value>
+        /// The message criteria.
+        /// </value>
+        [JsonProperty(PropertyName = "message_criteria")]
+        public MessageCriteriaType? MessageCriteria { get; set; }
+
+        /// <summary>
+        /// Gets or sets the previous blast ID.
+        /// </summary>
+        /// <value>
+        /// The previous blast ID.
+        /// </value>
+        [JsonProperty(PropertyName = "previous_blast_id")]
+        public int? PreviousBlastId { get; set; }
     }
 }


Simplify using return value of Assert.IsType().

--- Sandra.UI.WF/Tests/JsonTokenizerTests.cs
+++ Sandra.UI.WF/Tests/JsonTokenizerTests.cs
@@ -63,8 +63,7 @@
             Assert.Collection(new JsonTokenizer(json).TokenizeAll(), symbol =>
             {
                 Assert.NotNull(symbol);
-                Assert.IsType<JsonComment>(symbol);
-                var commentSymbol = (JsonComment)symbol;
+                var commentSymbol = Assert.IsType<JsonComment>(symbol);
                 Assert.Equal(0, commentSymbol.Start);
                 Assert.Equal(expectedCommentText.Length, commentSymbol.Length);
                 Assert.Equal(expectedCommentText, commentSymbol.Text);
@@ -154,11 +153,11 @@
             Assert.Collection(new JsonTokenizer(json).TokenizeAll(), symbol =>
             {
                 Assert.NotNull(symbol);
-                Assert.IsType<JsonValue>(symbol);
+                var valueSymbol = Assert.IsType<JsonValue>(symbol);
                 Assert.Equal(json, symbol.Json);
                 Assert.Equal(0, symbol.Start);
                 Assert.Equal(json.Length, symbol.Length);
-                Assert.Equal(json, ((JsonValue)symbol).Value);
+                Assert.Equal(json, valueSymbol.Value);
             });
         }

@@ -170,8 +169,7 @@
             Assert.Collection(new JsonTokenizer(json).TokenizeAll(), symbol =>
             {
                 Assert.NotNull(symbol);
-                Assert.IsType<JsonString>(symbol);
-                var stringSymbol = (JsonString)symbol;
+                var stringSymbol = Assert.IsType<JsonString>(symbol);
                 Assert.Equal(json, stringSymbol.Json);
                 Assert.Equal(0, stringSymbol.Start);
                 Assert.Equal(json.Length, stringSymbol.Length);


Make Players to be protected to allow it able to used by extending classes

--- Scripts/GameApi/LiteNetLibGameManager.cs
+++ Scripts/GameApi/LiteNetLibGameManager.cs
@@ -42,7 +42,7 @@
         public bool doNotEnterGameOnConnect;
         public bool doNotDestroyOnSceneChanges;

-        internal readonly Dictionary<long, LiteNetLibPlayer> Players = new Dictionary<long, LiteNetLibPlayer>();
+        protected readonly Dictionary<long, LiteNetLibPlayer> Players = new Dictionary<long, LiteNetLibPlayer>();

         private float lastSendServerTime;
         private string serverSceneName;


Stable for GD

Stable for GD

--- Services/Importers/ArchiveOrgImporter.cs
+++ Services/Importers/ArchiveOrgImporter.cs
@@ -167,7 +167,13 @@
                 Venue dbVenue = null;
                 if (artist.features.per_source_venues)
                 {
-                    var venueName = meta.venue.Length > 0 ? meta.venue : meta.coverage;
+                    var venueName = String.IsNullOrEmpty(meta.venue) ? meta.coverage : meta.venue;
+
+                    if(String.IsNullOrEmpty(venueName))
+                    {
+                        venueName = "Unknown Venue";
+                    }
+
                     var venueUpstreamId = venueName;
                     dbVenue = await _venueService.ForUpstreamIdentifier(artist, venueUpstreamId);

@@ -176,7 +182,7 @@
                         dbVenue = await _venueService.Save(new Venue() {
                             artist_id = artist.id,
                             name = venueName,
-                            location = meta.coverage,
+                            location = String.IsNullOrEmpty(meta.coverage) ? "Unknown Location" : meta.coverage,
                             upstream_identifier = venueUpstreamId,
                             slug = Slugify(venueName),
                             updated_at = searchDoc._iguana_updated_at


fix DQueryable SubQueries for MListElement

--- Signum.Engine/DynamicQuery/DQueryable.cs
+++ Signum.Engine/DynamicQuery/DQueryable.cs
@@ -205,17 +205,28 @@

         List<BuildExpressionContext> subContext = new List<BuildExpressionContext>();
         foreach (var child in node.Children)
-        {
-            var collectionToken = child.Value.Key!.Parent!;
-            var colExpre = collectionToken.BuildExpression(context);
-
-            var elemType = colExpre.Type.ElementType()!;
-
-            var pe2 = Expression.Parameter(elemType, elemType.CleanType().Name.Substring(0, 1).ToLower());
+        {
+            var cet = child.Value.Key!;
+
+            var collectionToken = cet.Parent!;
+            var eptML = MListElementPropertyToken.AsMListEntityProperty(collectionToken);
+
+            var colExpre = eptML != null ? MListElementPropertyToken.BuildMListElements(eptML, context) :
+                collectionToken.BuildExpression(context);
+
+            var elementType = colExpre.Type.ElementType()!;
+
+            var pe2 = Expression.Parameter(elementType, elementType.CleanType().Name.Substring(0, 1).ToLower());

             var subQueryCtx = new BuildExpressionContext(pe2.Type, pe2, new Dictionary<QueryToken, ExpressionBox>
             {
-                { child.Value.Key, new ExpressionBox(pe2.BuildLiteNullifyUnwrapPrimaryKey(new []{child.Value.Key.GetPropertyRoute() }.NotNull().ToArray())) }
+                {
+                    cet,
+                    new ExpressionBox(
+                        pe2.BuildLiteNullifyUnwrapPrimaryKey(new []{ cet.GetPropertyRoute() }.NotNull().ToArray()),
+                        mlistElementRoute: eptML != null ? cet.GetPropertyRoute() : null
+                    )
+                }
             });

             var subQueryExp = SubQueryConstructor(subQueryCtx, child, out var newSubContext);


CalendarHelper Format

CalendarHelper Format

--- Signum.Web/HtmlHelpers/CalendarHelper.cs
+++ Signum.Web/HtmlHelpers/CalendarHelper.cs
@@ -111,7 +111,7 @@
                 case "u": return info.UniversalSortableDateTimePattern;
                 case "U": return info.FullDateTimePattern;
                 case "y":
-                case "Y": return info.YearMonthPattern;
+                case "Y": return info.ShortDatePattern;//info.YearMonthPattern;
                 default: return format;
             }
         }


git-svn-id: 75210f800c74dac7ab89a5be233e5d30c702c3e4@245 a0bf3537-8e53-448f-ae4a-0b965e85af5e


tab to space

tab to space

--- Assets/CameraMouseController.cs
+++ Assets/CameraMouseController.cs
@@ -5,94 +5,94 @@
 public class CameraMouseController : MonoBehaviour
 {

-	// Use this for initialization
-	void Start ()
-	{
-
-	}
+    // Use this for initialization
+    void Start ()
+    {
+
+    }

-	bool isDraggingCamera = false;
-	Vector3 lastMousePosition;
-	Vector3 cameraTargetOffset;
-
-	// Update is called once per frame
-	void Update ()
-	{
-
-		// Right now, all we need are camera controls
+    bool isDraggingCamera = false;
+    Vector3 lastMousePosition;
+    Vector3 cameraTargetOffset;
+
+    // Update is called once per frame
+    void Update ()
+    {
+
+        // Right now, all we need are camera controls

-		Ray mouseRay = Camera.main.ScreenPointToRay (Input.mousePosition);
-		// What is the point at which the mouse ray intersects Y=0
-		if (mouseRay.direction.y >= 0) {
-			//Debug.LogError("Why is mouse pointing up?");
-			return;
-		}
-		float rayLength = (mouseRay.origin.y / mouseRay.direction.y);
-		Vector3 hitPos = mouseRay.origin - (mouseRay.direction * rayLength);
+        Ray mouseRay = Camera.main.ScreenPointToRay (Input.mousePosition);
+        // What is the point at which the mouse ray intersects Y=0
+        if (mouseRay.direction.y >= 0) {
+            //Debug.LogError("Why is mouse pointing up?");
+            return;
+        }
+        float rayLength = (mouseRay.origin.y / mouseRay.direction.y);
+        Vector3 hitPos = mouseRay.origin - (mouseRay.direction * rayLength);

-		if (Input.GetMouseButtonDown (0)) {
-			// Mouse button just went down -- start a drag.
-			isDraggingCamera = true;
+        if (Input.GetMouseButtonDown (0)) {
+            // Mouse button just went down -- start a drag.
+            isDraggingCamera = true;

-			lastMousePosition = hitPos;
-		} else if (Input.GetMouseButtonUp (0)) {
-			// Mouse button went up, stop drag
-			isDraggingCamera = false;
-		}
+            lastMousePosition = hitPos;
+        } else if (Input.GetMouseButtonUp (0)) {
+            // Mouse button went up, stop drag
+            isDraggingCamera = false;
+        }

-		if (isDraggingCamera) {
-			Vector3 diff = lastMousePosition - hitPos;
-			Camera.main.transform.Translate (diff, Space.World);
-			mouseRay = Camera.main.ScreenPointToRay (Input.mousePosition);
-			// What is the point at which the mouse ray intersects Y=0
-			if (mouseRay.direction.y >= 0) {
-				Debug.LogError ("Why is mouse pointing up?");
-				return;
-			}
-			rayLength = (mouseRay.origin.y / mouseRay.direction.y);
-			lastMousePosition = hitPos = mouseRay.origin - (mouseRay.direction * rayLength);
-		}
+        if (isDraggingCamera) {
+            Vector3 diff = lastMousePosition - hitPos;
+            Camera.main.transform.Translate (diff, Space.World);
+            mouseRay = Camera.main.ScreenPointToRay (Input.mousePosition);
+            // What is the point at which the mouse ray intersects Y=0
+            if (mouseRay.direction.y >= 0) {
+                Debug.LogError ("Why is mouse pointing up?");
+                return;
+            }
+            rayLength = (mouseRay.origin.y / mouseRay.direction.y);
+            lastMousePosition = hitPos = mouseRay.origin - (mouseRay.direction * rayLength);
+        }

-		// Zoom to scrollwheel
-		float scrollAmount = Input.GetAxis ("Mouse ScrollWheel");
-		float minHeight = 2;
-		float maxHeight = 20;
-		// Move camera towards hitPos
-		Vector3 dir = hitPos - Camera.main.transform.position;
+        // Zoom to scrollwheel
+        float scrollAmount = Input.GetAxis ("Mouse ScrollWheel");
+        float minHeight = 2;
+        float maxHeight = 20;
+        // Move camera towards hitPos
+        Vector3 dir = hitPos - Camera.main.transform.position;

-		Vector3 p = Camera.main.transform.position;
+        Vector3 p = Camera.main.transform.position;

-		// Stop zooming out at a certain distance.
-		// TODO: Maybe you should still slide around at 20 zoom?
-		if (scrollAmount > 0 || p.y < (maxHeight - 0.1f)) {
-			cameraTargetOffset += dir * scrollAmount;
-		}
-		Vector3 lastCameraPosition = Camera.main.transform.position;
-		Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, Camera.main.transform.position + cameraTargetOffset, Time.deltaTime * 5f);
-		cameraTargetOffset -= Camera.main.transform.position - lastCameraPosition;
+        // Stop zooming out at a certain distance.
+        // TODO: Maybe you should still slide around at 20 zoom?
+        if (scrollAmount > 0 || p.y < (maxHeight - 0.1f)) {
+            cameraTargetOffset += dir * scrollAmount;
+        }
+        Vector3 lastCameraPosition = Camera.main.transform.position;
+        Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, Camera.main.transform.position + cameraTargetOffset, Time.deltaTime * 5f);
+        cameraTargetOffset -= Camera.main.transform.position - lastCameraPosition;

-		p = Camera.main.transform.position;
-		if (p.y < minHeight) {
-			p.y = minHeight;
-		}
-		if (p.y > maxHeight) {
-			p.y = maxHeight;
-		}
-		Camera.main.transform.position = p;
+        p = Camera.main.transform.position;
+        if (p.y < minHeight) {
+            p.y = minHeight;
+        }
+        if (p.y > maxHeight) {
+            p.y = maxHeight;
+        }
+        Camera.main.transform.position = p;

-		// Change camera angle
-		float lowZoom = minHeight + 3;
-		float highZoom = maxHeight - 10;
+        // Change camera angle
+        float lowZoom = minHeight + 3;
+        float highZoom = maxHeight - 10;

-		Camera.main.transform.rotation = Quaternion.Euler (
-			Mathf.Lerp (30, 75, Camera.main.transform.position.y / maxHeight),
-			Camera.main.transform.rotation.eulerAngles.y,
-			Camera.main.transform.rotation.eulerAngles.z
-		);
+        Camera.main.transform.rotation = Quaternion.Euler (
+            Mathf.Lerp (30, 75, Camera.main.transform.position.y / maxHeight),
+            Camera.main.transform.rotation.eulerAngles.y,
+            Camera.main.transform.rotation.eulerAngles.z
+        );

-	}
+    }

 }


fixed meteor appear only after barrier expansion

--- Assets/Scripts/IslandManager.cs
+++ Assets/Scripts/IslandManager.cs
@@ -236,7 +236,8 @@
             Debug.Log("ExpandBarrier TRUE: " + barrierRadius);
             if (barrierRadius > 0)
                 mainHex.Upgrade();
-            barrierImproved = true;
+            if (barrierRadius > 0)
+                barrierImproved = true;
             if (barrierChanged != null)
                 barrierChanged();
             return true;


Fix TweenManager issue: value tween shouldn't throw error if target missing

--- Assets/Spewnity/TweenManager.cs
+++ Assets/Spewnity/TweenManager.cs
@@ -35,7 +35,7 @@

         [Tooltip("If you have multiple TweenManagers, setting this to true ensures this TweenManager is assigned to TweenManager.instance")]
         public bool primaryInstance;
-
+
         [Tooltip("If false, any tween that lacks a target throws an error; if true, tweens lacking a target use THIS GameObject")]
         public bool autoTarget = false;

@@ -475,7 +475,8 @@
             {
                 if (tm.autoTarget)
                     this.target = tm.gameObject;
-                else throw new UnityException("Target for tween '" + name + "' is missing.");
+                else if (position.enabled || rotation.enabled || scale.enabled || color.enabled)
+                    throw new UnityException("Target for tween '" + name + "' is missing.");
             }

             // Update caches for non-transform components


#2 #3 Added a basic game manager

#2 #3 Added a basic game manager

--- Assets/Script/PlanetScript.cs
+++ Assets/Script/PlanetScript.cs
@@ -28,6 +28,7 @@
 	public int engineerCount = 0;
 	public int resourceCount = 0;
 	public GameObject[] adjacentPlanet;
+	public ManagerScript gameManager;

 	/**
 	 * These will be used for keeping track of the ship.


regex on MessageWithLayout instead of Message

--- AzureLog.Web/Models/QueryLog.cs
+++ AzureLog.Web/Models/QueryLog.cs
@@ -35,7 +35,7 @@
             if (!string.IsNullOrWhiteSpace(Text))
             {
                 var reg = new Regex(Text);
-                list = list.Where(l => reg.IsMatch(l.Message));
+                list = list.Where(l => reg.IsMatch(l.MessageWithLayout));
             }
             return list.OrderBy(l => l.LogTimestamp).ToList();
         }


add trace log

add trace log

--- Bjd.WebServer.CoreCLR/Target.cs
+++ Bjd.WebServer.CoreCLR/Target.cs
@@ -51,7 +51,9 @@
         //uri�ɂ�鏉����
         public void InitFromUri(string uri)
         {
+            System.Diagnostics.Trace.TraceInformation($"Target.InitFromUri {uri}");
             Init(uri);
+            System.Diagnostics.Trace.TraceInformation($"Target.InitFromUri TargetKind {TargetKind} WebDavKind {WebDavKind}");
         }
         //filename�ɂ�鏉����
         public void InitFromFile(string file)
@@ -228,6 +230,7 @@
             /*************************************************/
             //FullPath = Util.SwapChar('/', '\\', DocumentRoot + uri);
             FullPath = Util.SwapChar('/', Path.DirectorySeparatorChar, DocumentRoot + uri);
+            System.Diagnostics.Trace.TraceInformation($"Target.Init {FullPath}");

             /*************************************************/
             //�t�@�C���w�肳�ꂽ�^�[�Q�b�g���t�@�C���ł͂Ȃ��f�B���N�g���̏ꍇ
@@ -244,7 +247,8 @@
                     }
                 }
             }
-            else {
+            else
+            {
                 if (TargetKind == TargetKind.File)
                 {
                     if (Directory.Exists(FullPath))
@@ -276,6 +280,7 @@
                             if (File.Exists(newPath))
                             {
                                 FullPath = newPath;
+                                System.Diagnostics.Trace.TraceInformation($"Target.Init welcomeFileName {FullPath}");
                                 break;
                             }
                         }


Fixed a scaling issue in update form on higher DPI. This resolves #510 and fixes #497.

--- AutoUpdater.NET/UpdateForm.cs
+++ AutoUpdater.NET/UpdateForm.cs
@@ -99,7 +99,7 @@
                 }
             }

-            var labelSize = new Size(Width - 110, 0);
+            var labelSize = new Size(webBrowser.Width, 0);
             labelDescription.MaximumSize = labelUpdate.MaximumSize = labelSize;
         }


Initialize with 2 minutes

Initialize with 2 minutes

--- CSharp/BabyStepTimer/Program.cs
+++ CSharp/BabyStepTimer/Program.cs
@@ -21,7 +21,7 @@
         private const string BackgroundColorFailed = "#ffcccc";
         private const string BackgroundColorPassed = "#ccffcc";

-        private const long SecondsInCycle = 12;
+        private const long SecondsInCycle = 120;

         private static Form _mainForm;
         private static WebBrowser _webBrowser;


Bumped up alpha version for release prep.

--- CardMaker/Forms/CardMakerMDI.cs
+++ CardMaker/Forms/CardMakerMDI.cs
@@ -66,7 +66,7 @@

             m_sBaseTitle = "Card Maker Beta " + Application.ProductVersion;
 #if UNSTABLE
-            m_sBaseTitle += "[UNSTABLE] V.A13";
+            m_sBaseTitle += "[UNSTABLE] V.A14";
 #endif
             m_sFileOpenFilter = "CMP files (*.cmp)|*.cmp|All files (*.*)|*.*";


feat(Locale): add FindOrDefault

feat(Locale): add FindOrDefault

--- src/Locale.cs
+++ src/Locale.cs
@@ -127,6 +127,32 @@
         /// </remarks>
         public XPathNavigator Find(string predicate)
         {
+            var nav = FindOrDefault(predicate);
+            if (nav == null)
+                throw new KeyNotFoundException($"Cannot find CLDR '{predicate}'.");
+            return nav;
+        }
+
+        /// <summary>
+        ///   Find the first (or none) XML element that matches the XPath expression
+        ///   in the <see cref="ResourceBundle"/>.
+        /// </summary>
+        /// <param name="predicate">
+        ///   The XPath expression to match.
+        /// </param>
+        /// <returns>
+        ///   The matched element or <b>null</b>.
+        /// </returns>
+        /// <remarks>
+        ///   If the <paramref name="predicate"/> cannot be matched, then it is recursively
+        ///   modified with the "root aliases" and retried.
+        ///   <para>
+        ///   Lateral inheritance is also implemented. <c>[@count='x']</c> becomes
+        ///   <c>[@count='x' or @count='other']</c>.
+        ///   </para>
+        /// </remarks>
+        public XPathNavigator FindOrDefault(string predicate)
+        {
             // Lateral inheritance.
             predicate = countFallback.Replace(predicate, (match) =>
             {
@@ -137,19 +163,19 @@
             return QueryCache.GetOrAdd(predicate, (key) =>
             {
                 // Find it.
-                var nav = ResourceBundle().FirstElementOrDefault(predicate);
+                var nav = ResourceBundle().FirstElementOrDefault(key);
                 if (nav != null)
                     return nav;

                 // Try root aliases.
-                var alias = Aliases.Value.FirstOrDefault(a =>
-                    predicate.Contains(a.From) && !predicate.Contains(a.To));
+                var alias = Aliases.Value.FirstOrDefault(a =>
+                    key.Contains(a.From) && !key.Contains(a.To));
                 if (alias != null)
                 {
-                    return Find(predicate.Replace(alias.From, alias.To));
+                    return Find(key.Replace(alias.From, alias.To));
                 }

-                throw new KeyNotFoundException($"Cannot find CLDR '{predicate}'.");
+                return null;
             });
         }


make creation of Cluster and Session in CqlConnection be virtual so that they could be customized in child classes

--- Cassandra.Data/CqlConnection.cs
+++ Cassandra.Data/CqlConnection.cs
@@ -14,37 +14,39 @@
 //   limitations under the License.
 //
 using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Data;
+using System.Collections.Concurrent;
+using System.Data;
 using System.Data.Common;
-using Cassandra;

 namespace Cassandra.Data
 {
+    /// <summary>
+    /// Represents a CQL connection.
+    /// </summary>
     public class CqlConnection : DbConnection, ICloneable
     {
-        CassandraConnectionStringBuilder _connectionStringBuilder = null;
-        static Dictionary<string, Cluster> _clusters = new Dictionary<string, Cluster>();
-        Cluster _managedCluster = null;
-        ConnectionState _connectionState = ConnectionState.Closed;
-        CqlBatchTransaction _currentTransaction = null;
-
-        internal Session ManagedConnection = null;
-
+        private CassandraConnectionStringBuilder _connectionStringBuilder;
+        private readonly static ConcurrentDictionary<string, Cluster> _clusters = new ConcurrentDictionary<string, Cluster>();
+        private Cluster _managedCluster;
+        private ConnectionState _connectionState = ConnectionState.Closed;
+        private CqlBatchTransaction _currentTransaction;
+        internal protected Session ManagedConnection;
+
+        /// <summary>
+        /// Initializes a <see cref="CqlConnection"/>.
+        /// </summary>
         public CqlConnection()
         {
             _connectionStringBuilder = new CassandraConnectionStringBuilder();
         }

+        /// <summary>
+        /// Initializes a <see cref="CqlConnection"/>.
+        /// </summary>
+        /// <param name="connectionString">The connection string.</param>
         public CqlConnection(string connectionString)
         {
             _connectionStringBuilder = new CassandraConnectionStringBuilder(connectionString);
-        }
-
-        private Dictionary<string, string> getCredentials(string auth)
-        {
-            return null;
         }

         internal void ClearDbTransaction()
@@ -69,7 +71,7 @@

         protected override void Dispose(bool disposing)
         {
-            if (_connectionState == ConnectionState.Open)
+            if (_connectionState == ConnectionState.Open)
                 Close();
             base.Dispose(disposing);
         }
@@ -78,7 +80,11 @@
         {
             _connectionState = System.Data.ConnectionState.Closed;
             if (ManagedConnection != null)
+            {
                 ManagedConnection.Dispose();
+                ManagedConnection = null;
+            }
+            _managedCluster = null;
         }

         public override string ConnectionString
@@ -116,25 +122,8 @@
         public override void Open()
         {
             _connectionState = System.Data.ConnectionState.Connecting;
-
-            lock (_clusters)
-            {
-                if (!_clusters.ContainsKey(_connectionStringBuilder.ClusterName))
-                {
-                    var builder = _connectionStringBuilder.MakeClusterBuilder();
-                    OnBuildingCluster(builder);
-                    _managedCluster = builder.Build();
-                    _clusters.Add(_connectionStringBuilder.ClusterName, _managedCluster);
-                }
-                else
-                    _managedCluster = _clusters[_connectionStringBuilder.ClusterName];
-            }
-
-            if (string.IsNullOrEmpty(_connectionStringBuilder.DefaultKeyspace))
-                ManagedConnection = _managedCluster.Connect("");
-            else
-                ManagedConnection = _managedCluster.Connect(_connectionStringBuilder.DefaultKeyspace);
-
+            _managedCluster = CreateCluster(_connectionStringBuilder);
+            ManagedConnection = CreatedSession(_connectionStringBuilder.DefaultKeyspace);
             _connectionState = System.Data.ConnectionState.Open;
         }

@@ -149,6 +138,62 @@
         /// <param name="builder">The <see cref="Builder"/> for building a <see cref="Cluster"/>.</param>
         protected virtual void OnBuildingCluster(Builder builder)
         {
+        }
+
+        /// <summary>
+        /// Creates a <see cref="Cluster"/>. By default <see cref="Cluster"/>s are created and cached
+        /// by cluster name specified in connection string.
+        ///
+        /// To be overridden in child classes to change the default creation and caching behavior.
+        /// </summary>
+        /// <param name="connectionStringBuilder">The <see cref="CassandraConnectionStringBuilder"/>.</param>
+        /// <returns></returns>
+        protected virtual Cluster CreateCluster(CassandraConnectionStringBuilder connectionStringBuilder)
+        {
+            Cluster cluster;
+            if (!_clusters.TryGetValue(_connectionStringBuilder.ClusterName, out cluster))
+            {
+                var builder = _connectionStringBuilder.MakeClusterBuilder();
+                OnBuildingCluster(builder);
+                cluster = builder.Build();
+                _clusters.TryAdd(_connectionStringBuilder.ClusterName, cluster);
+            }
+
+            return cluster;
+        }
+
+        /// <summary>
+        /// Creates a <see cref="Session"/>.
+        ///
+        /// To be overridden in child classes if want to cache the <see cref="Session"/> created.
+        /// </summary>
+        /// <param name="keyspace">The keyspace.</param>
+        /// <returns>Returns the created <see cref="Session"/>.</returns>
+        protected virtual Session CreatedSession(string keyspace)
+        {
+            if (_managedCluster == null)
+            {
+                return null;
+            }
+
+            return _managedCluster.Connect(keyspace ?? string.Empty);
+        }
+
+        /// <summary>
+        /// To be called by CqlCommand to creates a <see cref="PreparedStatement"/>
+        /// from <see cref="ManagedConnection"/>.
+        ///
+        /// To be overriden in child classes if want to cache the <see cref="PreparedStatement"/> created.
+        /// </summary>
+        /// <param name="cqlQuery">The CQL query string.</param>
+        /// <returns>Returns the created <see cref="PreparedStatement"/>.</returns>
+        internal protected virtual PreparedStatement CreatePreparedStatement(string cqlQuery)
+        {
+            if (ManagedConnection == null)
+            {
+                return null;
+            }
+            return ManagedConnection.Prepare(cqlQuery);
         }

         public override string ServerVersion


Added store check and search result check.

--- CertificateInstaller/Program.cs
+++ CertificateInstaller/Program.cs
@@ -199,7 +199,16 @@
                 }

                 var personal = new X509Store(store, StoreLocation.LocalMachine);
-                personal.Open(OpenFlags.ReadWrite);
+                try
+                {
+                    personal.Open(OpenFlags.ReadWrite);
+                }
+                catch (Exception ex)
+                {
+                    Console.WriteLine(ex);
+                    return -1;
+                }
+
                 if (hash == null)
                 {
                     // add certificate
@@ -215,56 +224,63 @@
                 }

                 var selectedItem = personal.Certificates.Find(X509FindType.FindByThumbprint, hash, false);
-                if (address == null)
-                {
+                if (selectedItem.Count > 0)
+                {
+                    if (address == null)
+                    {
+                        if (host == null)
+                        {
+                            // remove certificate and mapping
+                            var mappings = NativeMethods.QuerySslCertificateInfo();
+                            foreach (var mapping in mappings)
+                            {
+                                if (mapping.Hash.SequenceEqual(selectedItem[0].GetCertHash()))
+                                {
+                                    NativeMethods.DeleteCertificateBinding(mapping.IpPort);
+                                }
+                            }
+
+                            personal.Remove(selectedItem[0]);
+                        }
+                        else
+                        {
+                            var mappings = NativeMethods.QuerySslSniInfo();
+                            foreach (var mapping in mappings)
+                            {
+                                if (mapping.Hash.SequenceEqual(selectedItem[0].GetCertHash()))
+                                {
+                                    NativeMethods.DeleteSniBinding(new Tuple<string, int>(mapping.Host, mapping.Port));
+                                }
+                            }
+                        }
+
+                        personal.Close();
+                        return 0;
+                    }
+
                     if (host == null)
                     {
-                        // remove certificate and mapping
-                        var mappings = NativeMethods.QuerySslCertificateInfo();
-                        foreach (var mapping in mappings)
-                        {
-                            if (mapping.Hash.SequenceEqual(selectedItem[0].GetCertHash()))
-                            {
-                                NativeMethods.DeleteCertificateBinding(mapping.IpPort);
-                            }
-                        }
-
-                        personal.Remove(selectedItem[0]);
-                    }
-                    else
-                    {
-                        var mappings = NativeMethods.QuerySslSniInfo();
-                        foreach (var mapping in mappings)
-                        {
-                            if (mapping.Hash.SequenceEqual(selectedItem[0].GetCertHash()))
-                            {
-                                NativeMethods.DeleteSniBinding(new Tuple<string, int>(mapping.Host, mapping.Port));
-                            }
-                        }
+                        // register mapping
+                        var endpoint = new IPEndPoint(IPAddress.Parse(address), int.Parse(port));
+                        NativeMethods.BindCertificate(endpoint, selectedItem[0].GetCertHash(), store, Guid.Parse(id));
+                    }
+                    else
+                    {
+                        NativeMethods.BindSni(new Tuple<string, int>(host, int.Parse(port)), selectedItem[0].GetCertHash(), store, Guid.Parse(id));
                     }

                     personal.Close();
                     return 0;
                 }
-
-                if (host == null)
-                {
-                    // register mapping
-                    var endpoint = new IPEndPoint(IPAddress.Parse(address), int.Parse(port));
-                    NativeMethods.BindCertificate(endpoint, selectedItem[0].GetCertHash(), store, Guid.Parse(id));
-                }
-                else
-                {
-                    NativeMethods.BindSni(new Tuple<string, int>(host, int.Parse(port)), selectedItem[0].GetCertHash(), store, Guid.Parse(id));
-                }
-
-                return 0;
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex);
                 return -1;
             }
+
+            Console.WriteLine("Not supported path");
+            return -1;
         }

         private static void ShowHelp(OptionSet optionSet)


#237 Fix layout problems (regarding Keyboard) in Chat sample


Fixed emptying key buffer

Fixed emptying key buffer

--- Client/Core/Keylogger/Logger.cs
+++ Client/Core/Keylogger/Logger.cs
@@ -236,7 +236,8 @@
                 }
                 j++;
             }
-            _keyBuffer.RemoveRange(0, j);
+            if (j > 0 && j <= _keyBuffer.Count)
+                _keyBuffer.RemoveRange(0, j);
         }

         private void timerLogKeys_Elapsed(object sender, System.Timers.ElapsedEventArgs e)


Consolidate XLCell.InsertData and XLCell.InsertTable into one internal method: XLCell.InsertDataInternal

--- ClosedXML/Excel/Cells/XLCell.cs
+++ ClosedXML/Excel/Cells/XLCell.cs
@@ -655,79 +655,214 @@
             return InsertTable(data, tableName, true);
         }

-        public IXLTable InsertTable<T>(IEnumerable<T> data, string tableName, bool createTable)
+        public IXLTable InsertTable<T>(IEnumerable<T> data, String tableName, Boolean createTable)
+        {
+            return InsertTable(data, tableName, createTable, addHeadings: true, transpose: false);
+        }
+
+        public IXLTable InsertTable<T>(IEnumerable<T> data, String tableName, Boolean createTable, Boolean addHeadings, Boolean transpose)
         {
             if (createTable && this.Worksheet.Tables.Any(t => t.Contains(this)))
                 throw new InvalidOperationException(String.Format("This cell '{0}' is already part of a table.", this.Address.ToString()));

-            if (data != null && !(data is String))
-            {
-                var ro = _rowNumber + 1;
-                var fRo = _rowNumber;
-                var hasTitles = false;
-                var maxCo = 0;
-                var isDataTable = false;
-                var isDataReader = false;
-                var itemType = data.GetItemType();
-
-                if (!data.Any())
-                {
-                    if (itemType.IsPrimitive || itemType == typeof(String) || itemType == typeof(DateTime) || itemType.IsNumber())
-                        maxCo = _columnNumber + 1;
-                    else
-                        maxCo = _columnNumber + itemType.GetFields().Length + itemType.GetProperties().Length;
-                }
-                else if (itemType.IsPrimitive || itemType == typeof(String) || itemType == typeof(DateTime) || itemType.IsNumber())
-                {
-                    foreach (object o in data)
+            var range = InsertDataInternal(data, addHeadings, transpose);
+
+            if (createTable)
+                // Create a table and save it in the file
+                return tableName == null ? range.CreateTable() : range.CreateTable(tableName);
+            else
+                // Create a table, but keep it in memory. Saved file will contain only "raw" data and column headers
+                return tableName == null ? range.AsTable() : range.AsTable(tableName);
+        }
+
+        public IXLTable InsertTable(DataTable data)
+        {
+            return InsertTable(data, null, true);
+        }
+
+        public IXLTable InsertTable(DataTable data, Boolean createTable)
+        {
+            return InsertTable(data, null, createTable);
+        }
+
+        public IXLTable InsertTable(DataTable data, String tableName)
+        {
+            return InsertTable(data, tableName, true);
+        }
+
+        public IXLTable InsertTable(DataTable data, String tableName, Boolean createTable)
+        {
+            if (data == null || data.Columns.Count == 0)
+                return null;
+
+            if (createTable && this.Worksheet.Tables.Any(t => t.Contains(this)))
+                throw new InvalidOperationException(String.Format("This cell '{0}' is already part of a table.", this.Address.ToString()));
+
+            if (data.Rows.Cast<DataRow>().Any())
+                return InsertTable(data.Rows.Cast<DataRow>(), tableName, createTable);
+
+            var co = _columnNumber;
+
+            foreach (DataColumn col in data.Columns)
+            {
+                Worksheet.SetValue(col.ColumnName, _rowNumber, co);
+                co++;
+            }
+
+            ClearMerged();
+            var range = Worksheet.Range(
+                _rowNumber,
+                _columnNumber,
+                _rowNumber,
+                co - 1);
+
+            if (createTable)
+                // Create a table and save it in the file
+                return tableName == null ? range.CreateTable() : range.CreateTable(tableName);
+            else
+                // Create a table, but keep it in memory. Saved file will contain only "raw" data and column headers
+                return tableName == null ? range.AsTable() : range.AsTable(tableName);
+        }
+
+        internal XLRange InsertDataInternal<T>(IEnumerable<T> data, Boolean addHeadings, Boolean transpose)
+        {
+            if (data == null || data is String)
+                return null;
+
+            var currentRowNumber = _rowNumber;
+            if (addHeadings && !transpose) currentRowNumber++;
+
+            var currentColumnNumber = _columnNumber;
+            if (addHeadings && transpose) currentColumnNumber++;
+
+            var firstRowNumber = _rowNumber;
+            var hasHeadings = false;
+            var maximumColumnNumber = currentColumnNumber;
+            var maximumRowNumber = currentRowNumber;
+
+            var itemType = data.GetItemType();
+            var isArray = itemType.IsArray;
+            var isDataTable = itemType == typeof(DataTable);
+            var isDataReader = itemType == typeof(IDataReader);
+
+            // Inline functions to handle looping with transposing
+            //////////////////////////////////////////////////////
+            void incrementFieldPosition()
+            {
+                if (transpose)
+                {
+                    maximumRowNumber = Math.Max(maximumRowNumber, currentRowNumber);
+                    currentRowNumber++;
+                }
+                else
+                {
+                    maximumColumnNumber = Math.Max(maximumColumnNumber, currentColumnNumber);
+                    currentColumnNumber++;
+                }
+            }
+
+            void incrementRecordPosition()
+            {
+                if (transpose)
+                {
+                    maximumColumnNumber = Math.Max(maximumColumnNumber, currentColumnNumber);
+                    currentColumnNumber++;
+                }
+                else
+                {
+                    maximumRowNumber = Math.Max(maximumRowNumber, currentRowNumber);
+                    currentRowNumber++;
+                }
+            }
+
+            void resetRecordPosition()
+            {
+                if (transpose)
+                    currentRowNumber = _rowNumber;
+                else
+                    currentColumnNumber = _columnNumber;
+            }
+            //////////////////////////////////////////////////////
+
+            if (!data.Any())
+            {
+                if (itemType.IsPrimitive || itemType == typeof(String) || itemType == typeof(DateTime) || itemType.IsNumber())
+                    maximumColumnNumber = _columnNumber;
+                else
+                    maximumColumnNumber = _columnNumber + itemType.GetFields().Length + itemType.GetProperties().Length - 1;
+            }
+            else if (itemType.IsPrimitive || itemType == typeof(String) || itemType == typeof(DateTime) || itemType.IsNumber())
+            {
+                foreach (object o in data)
+                {
+                    resetRecordPosition();
+
+                    if (addHeadings && !hasHeadings)
                     {
-                        var co = _columnNumber;
-
-                        if (!hasTitles)
+                        var fieldName = XLColumnAttribute.GetHeader(itemType);
+                        if (String.IsNullOrWhiteSpace(fieldName))
+                            fieldName = itemType.Name;
+
+                        Worksheet.SetValue(fieldName, firstRowNumber, currentColumnNumber);
+                        hasHeadings = true;
+                        resetRecordPosition();
+                    }
+
+                    Worksheet.SetValue(o, currentRowNumber, currentColumnNumber);
+                    incrementFieldPosition();
+                    incrementRecordPosition();
+                }
+            }
+            else
+            {
+                const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
+                var memberCache = new Dictionary<Type, IEnumerable<MemberInfo>>();
+                var accessorCache = new Dictionary<Type, TypeAccessor>();
+                IEnumerable<MemberInfo> members = null;
+                TypeAccessor accessor = null;
+                bool isPlainObject = itemType == typeof(object);
+
+                if (!isPlainObject)
+                {
+                    members = itemType.GetFields(bindingFlags).Cast<MemberInfo>()
+                         .Concat(itemType.GetProperties(bindingFlags))
+                         .Where(mi => !XLColumnAttribute.IgnoreMember(mi))
+                         .OrderBy(mi => XLColumnAttribute.GetOrder(mi));
+                    accessor = TypeAccessor.Create(itemType);
+                }
+
+                foreach (T m in data)
+                {
+                    resetRecordPosition();
+
+                    if (m.GetType().IsPrimitive || m is String || m is DateTime || m is TimeSpan || m.IsNumber())
+                    {
+                        if (addHeadings && !hasHeadings)
                         {
                             var fieldName = XLColumnAttribute.GetHeader(itemType);
                             if (String.IsNullOrWhiteSpace(fieldName))
                                 fieldName = itemType.Name;

-                            Worksheet.SetValue(fieldName, fRo, co);
-                            hasTitles = true;
-                            co = _columnNumber;
+                            Worksheet.SetValue(fieldName, firstRowNumber, currentColumnNumber);
+                            hasHeadings = true;
+                            resetRecordPosition();
                         }

-                        Worksheet.SetValue(o, ro, co);
-                        co++;
-
-                        if (co > maxCo)
-                            maxCo = co;
-
-                        ro++;
+                        Worksheet.SetValue(m as object, currentRowNumber, currentColumnNumber);
+                        incrementFieldPosition();
                     }
-                }
-                else
-                {
-                    const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
-                    var memberCache = new Dictionary<Type, IEnumerable<MemberInfo>>();
-                    var accessorCache = new Dictionary<Type, TypeAccessor>();
-                    IEnumerable<MemberInfo> members = null;
-                    TypeAccessor accessor = null;
-                    bool isPlainObject = itemType == typeof(object);
-
-                    if (!isPlainObject)
-                    {
-                        members = itemType.GetFields(bindingFlags).Cast<MemberInfo>()
-                             .Concat(itemType.GetProperties(bindingFlags))
-                             .Where(mi => !XLColumnAttribute.IgnoreMember(mi))
-                             .OrderBy(mi => XLColumnAttribute.GetOrder(mi));
-                        accessor = TypeAccessor.Create(itemType);
-                    }
-
-                    foreach (T m in data)
+                    else
                     {
                         if (isPlainObject)
                         {
                             // In this case data is just IEnumerable<object>, which means we have to determine the runtime type of each element
                             // This is very inefficient and we prefer type of T to be a concrete class or struct
                             var type = m.GetType();
+
+                            isArray |= type.IsArray;
+                            isDataTable |= type == typeof(DataRow);
+                            isDataReader |= type == typeof(IDataRecord);
+
                             if (!memberCache.ContainsKey(type))
                             {
                                 var _accessor = TypeAccessor.Create(type);
@@ -745,14 +880,12 @@
                             accessor = accessorCache[type];
                         }

-                        var co = _columnNumber;
-
-                        if (itemType.IsArray)
+                        if (isArray)
                         {
                             foreach (var item in (m as Array))
                             {
-                                Worksheet.SetValue(item, ro, co);
-                                co++;
+                                Worksheet.SetValue(item, currentRowNumber, currentColumnNumber);
+                                incrementFieldPosition();
                             }
                         }
                         else if (isDataTable || m is DataRow)
@@ -761,25 +894,25 @@
                             if (!isDataTable)
                                 isDataTable = true;

-                            if (!hasTitles)
+                            if (addHeadings && !hasHeadings)
                             {
                                 foreach (var fieldName in from DataColumn column in row.Table.Columns
                                                           select String.IsNullOrWhiteSpace(column.Caption)
                                                                      ? column.ColumnName
                                                                      : column.Caption)
                                 {
-                                    Worksheet.SetValue(fieldName, fRo, co);
-                                    co++;
+                                    Worksheet.SetValue(fieldName, firstRowNumber, currentColumnNumber);
+                                    incrementFieldPosition();
                                 }

-                                co = _columnNumber;
-                                hasTitles = true;
+                                resetRecordPosition();
+                                hasHeadings = true;
                             }

                             foreach (var item in row.ItemArray)
                             {
-                                Worksheet.SetValue(item, ro, co);
-                                co++;
+                                Worksheet.SetValue(item, currentRowNumber, currentColumnNumber);
+                                incrementFieldPosition();
                             }
                         }
                         else if (isDataReader || m is IDataRecord)
@@ -790,27 +923,27 @@
                             var record = m as IDataRecord;

                             var fieldCount = record.FieldCount;
-                            if (!hasTitles)
+                            if (addHeadings && !hasHeadings)
                             {
                                 for (var i = 0; i < fieldCount; i++)
                                 {
-                                    Worksheet.SetValue(record.GetName(i), fRo, co);
-                                    co++;
+                                    Worksheet.SetValue(record.GetName(i), firstRowNumber, currentColumnNumber);
+                                    incrementFieldPosition();
                                 }

-                                co = _columnNumber;
-                                hasTitles = true;
+                                resetRecordPosition();
+                                hasHeadings = true;
                             }

                             for (var i = 0; i < fieldCount; i++)
                             {
-                                Worksheet.SetValue(record[i], ro, co);
-                                co++;
+                                Worksheet.SetValue(record[i], currentRowNumber, currentColumnNumber);
+                                incrementFieldPosition();
                             }
                         }
                         else
                         {
-                            if (!hasTitles)
+                            if (addHeadings && !hasHeadings)
                             {
                                 foreach (var mi in members)
                                 {
@@ -820,100 +953,43 @@
                                         if (String.IsNullOrWhiteSpace(fieldName))
                                             fieldName = mi.Name;

-                                        Worksheet.SetValue(fieldName, fRo, co);
+                                        Worksheet.SetValue(fieldName, firstRowNumber, currentColumnNumber);
                                     }

-                                    co++;
+                                    incrementFieldPosition();
                                 }

-                                co = _columnNumber;
-                                hasTitles = true;
+                                resetRecordPosition();
+                                hasHeadings = true;
                             }

                             foreach (var mi in members)
                             {
                                 if (mi.MemberType == MemberTypes.Property && (mi as PropertyInfo).GetGetMethod().IsStatic)
-                                    Worksheet.SetValue((mi as PropertyInfo).GetValue(null, null), ro, co);
+                                    Worksheet.SetValue((mi as PropertyInfo).GetValue(null, null), currentRowNumber, currentColumnNumber);
                                 else if (mi.MemberType == MemberTypes.Field && (mi as FieldInfo).IsStatic)
-                                    Worksheet.SetValue((mi as FieldInfo).GetValue(null), ro, co);
+                                    Worksheet.SetValue((mi as FieldInfo).GetValue(null), currentRowNumber, currentColumnNumber);
                                 else
-                                    Worksheet.SetValue(accessor[m, mi.Name], ro, co);
-
-                                co++;
+                                    Worksheet.SetValue(accessor[m, mi.Name], currentRowNumber, currentColumnNumber);
+
+                                incrementFieldPosition();
                             }
                         }
-
-                        if (co > maxCo)
-                            maxCo = co;
-
-                        ro++;
                     }
-                }
-
-                ClearMerged();
-                var range = Worksheet.Range(
-                    _rowNumber,
-                    _columnNumber,
-                    ro - 1,
-                    maxCo - 1);
-
-                if (createTable)
-                    // Create a table and save it in the file
-                    return tableName == null ? range.CreateTable() : range.CreateTable(tableName);
-                else
-                    // Create a table, but keep it in memory. Saved file will contain only "raw" data and column headers
-                    return tableName == null ? range.AsTable() : range.AsTable(tableName);
-            }
-
-            return null;
-        }
-
-        public IXLTable InsertTable(DataTable data)
-        {
-            return InsertTable(data, null, true);
-        }
-
-        public IXLTable InsertTable(DataTable data, bool createTable)
-        {
-            return InsertTable(data, null, createTable);
-        }
-
-        public IXLTable InsertTable(DataTable data, string tableName)
-        {
-            return InsertTable(data, tableName, true);
-        }
-
-        public IXLTable InsertTable(DataTable data, string tableName, bool createTable)
-        {
-            if (data == null || data.Columns.Count == 0)
-                return null;
-
-            if (createTable && this.Worksheet.Tables.Any(t => t.Contains(this)))
-                throw new InvalidOperationException(String.Format("This cell '{0}' is already part of a table.", this.Address.ToString()));
-
-            if (data.Rows.Cast<DataRow>().Any()) return InsertTable(data.Rows.Cast<DataRow>(), tableName, createTable);
-            var ro = _rowNumber;
-            var co = _columnNumber;
-
-            foreach (DataColumn col in data.Columns)
-            {
-                Worksheet.SetValue(col.ColumnName, ro, co);
-                co++;
+
+                    incrementRecordPosition();
+                }
             }

             ClearMerged();
+
             var range = Worksheet.Range(
                 _rowNumber,
                 _columnNumber,
-                ro,
-                co - 1);
-
-            if (createTable)
-                // Create a table and save it in the file
-                return tableName == null ? range.CreateTable() : range.CreateTable(tableName);
-            else
-                // Create a table, but keep it in memory. Saved file will contain only "raw" data and column headers
-                return tableName == null ? range.AsTable() : range.AsTable(tableName);
+                maximumRowNumber,
+                maximumColumnNumber);
+
+            return range;
         }

         public XLTableCellType TableCellType()
@@ -929,153 +1005,26 @@

         public IXLRange InsertData(IEnumerable data)
         {
-            return InsertData(data, false);
+            if (data == null || data is String)
+                return null;
+
+            return InsertDataInternal(data?.Cast<object>(), addHeadings: false, transpose: false);
         }

         public IXLRange InsertData(IEnumerable data, Boolean transpose)
         {
-            if (data != null && !(data is String))
-            {
-                var rowNumber = _rowNumber;
-                var columnNumber = _columnNumber;
-
-                var maxColumnNumber = 0;
-                var maxRowNumber = 0;
-                var isDataTable = false;
-                var isDataReader = false;
-
-                const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
-                var memberCache = new Dictionary<Type, IEnumerable<MemberInfo>>();
-                var accessorCache = new Dictionary<Type, TypeAccessor>();
-                IEnumerable<MemberInfo> members = null;
-                TypeAccessor accessor = null;
-
-                void incrementFieldPosition()
-                {
-                    if (transpose)
-                        rowNumber++;
-                    else
-                        columnNumber++;
-                }
-
-                void incrementRecordPosition()
-                {
-                    if (transpose)
-                        columnNumber++;
-                    else
-                        rowNumber++;
-                }
-
-                void resetRecordPosition()
-                {
-                    if (transpose)
-                        rowNumber = _rowNumber;
-                    else
-                        columnNumber = _columnNumber;
-                }
-
-                foreach (var m in data)
-                {
-                    var itemType = m.GetType();
-
-                    resetRecordPosition();
-
-                    if (itemType.IsPrimitive || itemType == typeof(String) || itemType == typeof(DateTime) || itemType.IsNumber())
-                    {
-                        Worksheet.SetValue(m, rowNumber, columnNumber);
-
-                        incrementFieldPosition();
-                    }
-                    else if (itemType.IsArray)
-                    {
-                        foreach (var item in (Array)m)
-                        {
-                            Worksheet.SetValue(item, rowNumber, columnNumber);
-
-                            incrementFieldPosition();
-                        }
-                    }
-                    else if (isDataTable || m is DataRow)
-                    {
-                        if (!isDataTable)
-                            isDataTable = true;
-
-                        foreach (var item in (m as DataRow).ItemArray)
-                        {
-                            Worksheet.SetValue(item, rowNumber, columnNumber);
-
-                            incrementFieldPosition();
-                        }
-                    }
-                    else if (isDataReader || m is IDataRecord)
-                    {
-                        if (!isDataReader)
-                            isDataReader = true;
-
-                        var record = m as IDataRecord;
-
-                        var fieldCount = record.FieldCount;
-                        for (var i = 0; i < fieldCount; i++)
-                        {
-                            Worksheet.SetValue(record[i], rowNumber, columnNumber);
-
-                            incrementFieldPosition();
-                        }
-                    }
-                    else
-                    {
-                        if (!memberCache.ContainsKey(itemType))
-                        {
-                            var _accessor = TypeAccessor.Create(itemType);
-
-                            var _members = itemType.GetFields(bindingFlags).Cast<MemberInfo>()
-                                 .Concat(itemType.GetProperties(bindingFlags))
-                                 .Where(mi => !XLColumnAttribute.IgnoreMember(mi))
-                                 .OrderBy(mi => XLColumnAttribute.GetOrder(mi));
-
-                            memberCache.Add(itemType, _members);
-                            accessorCache.Add(itemType, _accessor);
-                        }
-
-                        accessor = accessorCache[itemType];
-                        members = memberCache[itemType];
-
-                        foreach (var mi in members)
-                        {
-                            if (mi.MemberType == MemberTypes.Property && (mi as PropertyInfo).GetGetMethod().IsStatic)
-                                Worksheet.SetValue((mi as PropertyInfo).GetValue(null, null), rowNumber, columnNumber);
-                            else if (mi.MemberType == MemberTypes.Field && (mi as FieldInfo).IsStatic)
-                                Worksheet.SetValue((mi as FieldInfo).GetValue(null), rowNumber, columnNumber);
-                            else
-                                Worksheet.SetValue(accessor[m, mi.Name], rowNumber, columnNumber);
-
-                            incrementFieldPosition();
-                        }
-                    }
-
-                    incrementRecordPosition();
-
-                    if (columnNumber > maxColumnNumber)
-                        maxColumnNumber = columnNumber;
-
-                    if (rowNumber > maxRowNumber)
-                        maxRowNumber = rowNumber;
-                }
-
-                ClearMerged();
-                return Worksheet.Range(
-                    _rowNumber,
-                    _columnNumber,
-                    maxRowNumber - 1,
-                    maxColumnNumber - 1);
-            }
-
-            return null;
+            if (data == null || data is String)
+                return null;
+
+            return InsertDataInternal(data?.Cast<object>(), addHeadings: false, transpose: transpose);
         }

         public IXLRange InsertData(DataTable dataTable)
         {
-            return InsertData(dataTable.Rows);
+            if (dataTable == null)
+                return null;
+
+            return InsertDataInternal(dataTable?.Rows?.Cast<DataRow>(), addHeadings: false, transpose: false);
         }

         public IXLCell SetDataType(XLDataType dataType)


Case insentitivy for "Extends.ParentClass" file name

--- Cogs.Dto/CogsDirectoryReader.cs
+++ Cogs.Dto/CogsDirectoryReader.cs
@@ -129,7 +129,7 @@
             string[] allFiles = Directory.GetFiles(typeDir);
             string extendsFileName = allFiles
                 .Select(x => Path.GetFileName(x))
-                .FirstOrDefault(x => x.StartsWith("Extends."));
+                .FirstOrDefault(x => x.ToLower().StartsWith("extends."));
             if (!string.IsNullOrWhiteSpace(extendsFileName))
             {
                 return extendsFileName.Substring(8);


Move more configurable constructors below, less configurable/more defaults up.

--- ClosedXML/Excel/XLWorkbook.cs
+++ ClosedXML/Excel/XLWorkbook.cs
@@ -667,6 +667,11 @@
             LoadSheetsFromTemplate(file);
         }

+        public XLWorkbook(XLEventTracking eventTracking)
+            : this(new LoadOptions { EventTracking = eventTracking })
+        {
+        }
+
         /// <summary>
         ///   Opens an existing workbook from a file.
         /// </summary>
@@ -676,20 +681,21 @@
         {
         }

+        public XLWorkbook(String file, XLEventTracking eventTracking)
+            : this(file, new LoadOptions { EventTracking = eventTracking })
+        {
+        }
+
         public XLWorkbook(String file, LoadOptions loadOptions)
-            : this(file, loadOptions.EventTracking)
-        {
-            if (loadOptions.RecalculateAllFormulas)
-                this.RecalculateAllFormulas();
-        }
-
-        public XLWorkbook(String file, XLEventTracking eventTracking)
-            : this(eventTracking)
+            : this(loadOptions)
         {
             _loadSource = XLLoadSource.File;
             _originalFile = file;
             _spreadsheetDocumentType = GetSpreadsheetDocumentType(_originalFile);
             Load(file);
+
+            if (loadOptions.RecalculateAllFormulas)
+                this.RecalculateAllFormulas();
         }

         /// <summary>
@@ -715,11 +721,6 @@

             if (loadOptions.RecalculateAllFormulas)
                 this.RecalculateAllFormulas();
-        }
-
-        public XLWorkbook(XLEventTracking eventTracking)
-            : this(new LoadOptions { EventTracking = eventTracking })
-        {
         }

         public XLWorkbook(LoadOptions loadOptions)


only show distinct entries

only show distinct entries

--- CompatBot/Commands/Syscall.cs
+++ CompatBot/Commands/Syscall.cs
@@ -43,6 +43,7 @@
                 var productInfoList = await db.SyscallToProductMap.AsNoTracking()
                     .Where(m => m.SyscallInfo.Module == search || m.SyscallInfo.Function == search)
                     .Select(m => new {m.Product.ProductCode, m.Product.Name})
+                    .Distinct()
                     .ToAsyncEnumerable()
                     .OrderBy(i => i.Name, StringComparer.InvariantCultureIgnoreCase)
                     .ThenBy(i => i.ProductCode)
@@ -71,6 +72,7 @@
                 var sysInfoList = await db.SyscallToProductMap.AsNoTracking()
                     .Where(m => m.Product.ProductCode == productId)
                     .Select(m => m.SyscallInfo)
+                    .Distinct()
                     .ToAsyncEnumerable()
                     .OrderBy(sci => sci.Module)
                     .ThenBy(sci => sci.Function)


add new mess

add new mess

--- Components/ProductController.cs
+++ Components/ProductController.cs
@@ -13,6 +13,7 @@
             Product p;
             using (IDataContext ctx = DataContext.Instance())
             {
+                Console.WriteLine("hello world");
                 Console.WriteLine("hello world");
                 var rep = ctx.GetRepository<Product>();
                 p = rep.GetById(productId);


removed generic type dependencies from ContentElement

--- ContentDomain/ContentElement.cs
+++ ContentDomain/ContentElement.cs
@@ -9,7 +9,7 @@
     public sealed class ContentElement<T>
         where T : class, IContentValue
     {
-        private Dictionary<Language, T> _values = new Dictionary<Language,T>();
+        private Dictionary<Language, IContentValue> _values = new Dictionary<Language, IContentValue>();

         public int Id { get; private set; }

@@ -21,7 +21,7 @@
             DefaultLanguage = defaultLanguage;
         }

-        public void SetValue(T value)
+        public void SetValue(IContentValue value)
         {
             if (value == null)
                 throw new ArgumentNullException("value");
@@ -31,7 +31,7 @@
             _values[value.Language] = value;
         }

-        public T GetValue(Language language)
+        public IContentValue GetValue(Language language)
         {
             if (!_values.ContainsKey(language))
                 throw new ArgumentException(


Define minimum size for freeform controls as header and tab area

--- DarkUI/Docking/DarkDockGroup.cs
+++ DarkUI/Docking/DarkDockGroup.cs
@@ -234,7 +234,7 @@
             if (_contents.Count > 0)
             {
                 int maxSize = 0;
-                int maxMinSize = 0;
+                int maxMinSize = Consts.ToolWindowHeaderSize;

                 switch (DockArea)
                 {
@@ -243,6 +243,9 @@

                     case DarkDockArea.Left:
                     case DarkDockArea.Right:
+                        if (_contents.Count > 1)
+                            maxMinSize += Consts.ToolWindowTabAreaSize;
+
                         foreach (var currContent in _contents)
                         {
                             if (currContent.Size.Height > maxSize)


make project building solution again (#248)

--- Sources/HipMobileUI.Android/Resources/Resource.designer.cs
+++ Sources/HipMobileUI.Android/Resources/Resource.designer.cs
@@ -40,7 +40,6 @@
 			global::AndroidHUD.Resource.Attribute.ahTextSize = global::PaderbornUniversity.SILab.Hip.Mobile.Droid.Resource.Attribute.ahTextSize;
 			global::AndroidHUD.Resource.Drawable.ic_errorstatus = global::PaderbornUniversity.SILab.Hip.Mobile.Droid.Resource.Drawable.ic_errorstatus;
 			global::AndroidHUD.Resource.Drawable.ic_successstatus = global::PaderbornUniversity.SILab.Hip.Mobile.Droid.Resource.Drawable.ic_successstatus;
-			global::AndroidHUD.Resource.Drawable.roundedbg = global::PaderbornUniversity.SILab.Hip.Mobile.Droid.Resource.Drawable.roundedbg;
 			global::AndroidHUD.Resource.Drawable.roundedbgdark = global::PaderbornUniversity.SILab.Hip.Mobile.Droid.Resource.Drawable.roundedbgdark;
 			global::AndroidHUD.Resource.Id.loadingImage = global::PaderbornUniversity.SILab.Hip.Mobile.Droid.Resource.Id.loadingImage;
 			global::AndroidHUD.Resource.Id.loadingProgressBar = global::PaderbornUniversity.SILab.Hip.Mobile.Droid.Resource.Id.loadingProgressBar;
@@ -5253,9 +5252,6 @@
 			// aapt resource value: 0x7f020059
 			public const int btn_close = 2130837593;

-			// aapt resource value: 0x7f020059
-			public const int btn_close = 2130837593;
-
 			// aapt resource value: 0x7f02005a
 			public const int design_bottom_navigation_item_background = 2130837594;

@@ -6020,9 +6016,6 @@

 			// aapt resource value: 0x7f020165
 			public const int notification_template_icon_low_bg = 2130837861;
-
-			// aapt resource value: 0x7f020157
-			public const int notification_tile_bg = 2130837847;

 			// aapt resource value: 0x7f020157
 			public const int notification_tile_bg = 2130837847;


Changed test  to use Assert.DoesNotThrow instead of try-catch

--- Src/AutoFixtureUnitTest/RandomRangedNumberGeneratorTest.cs
+++ Src/AutoFixtureUnitTest/RandomRangedNumberGeneratorTest.cs
@@ -239,9 +239,9 @@

             var sut = new RandomRangedNumberGenerator();

-            // Exercise System
-            try
-            {
+            // Exercise System and Verify
+           Assert.DoesNotThrow(() =>
+               {
                 var numbers = Enumerable
                     .Range(0, numberOfThreads)
                     .AsParallel()
@@ -254,12 +254,9 @@
                                             .Cast<int>()
                                             .ToArray())
                     .ToArray();
-            }
-            // Verify
-            catch (AggregateException aex)
-            {
-                Assert.True(false, "Thread-safety failed\n" + string.Join("\n", aex.Flatten().InnerExceptions));
-            }
+               }
+            );
+
             // Nothing else to verify
             // Teardown
         }


Selenium tests for #250

Selenium tests for #250

--- Test/NakedFunctions.Selenium.Test/DevelopmentStoryTests.cs
+++ Test/NakedFunctions.Selenium.Test/DevelopmentStoryTests.cs
@@ -80,6 +80,8 @@
             QueryContributedActionReturningOnlyAContext();
             LocalCollectionContributedAction();
             SaveNewChildObjectAndTestItsVisibilityInTheParentsCollection();
+            UseOfDeferredFunctionIncludingReload();
+            UseOfResolveMethodInADeferredFunction();
             //QueryContributedActionWithCoValidation();
             //QueryContributedActionWithChoicesFunction();

@@ -590,7 +592,6 @@
             OpenObjectActions(Pane.Left);
             OpenActionDialog("Add New Detail", Pane.Left);
             var product = WaitForCss("#pane2 .title");
-            //product.Click();
             CopyToClipboard(product);
             PasteIntoInputField("#pane1 .parameter .value.droppable");
             Click(OKButton());
@@ -598,8 +599,65 @@
             WaitForView(Pane.Single, PaneType.Object);
             Thread.Sleep(1000);
             var listIcon1 = WaitForCssNo(".collection .icon.list", 0);
-            Click(listIcon1); //It's opening the List on the Product!
+            Click(listIcon1);
             wait.Until(dr => dr.FindElements(By.CssSelector("tr td")).Any(el => el.Text == "1 x Sport-100 Helmet, Red"));
+        }
+
+        //[TestMethod]
+        public void UseOfDeferredFunctionIncludingReload()
+        {
+            GeminiUrl("object/object?i1=View&o1=AW.Types.Customer--12211&as1=open&i2=View&o2=AW.Types.Product--707");
+            WaitForTitle("AW00012211 Victor Romero", Pane.Left);
+            Click(GetObjectAction("Create Another Order", Pane.Left));
+            WaitForView(Pane.Left, PaneType.Object);
+            var num = GetPropertyValue("Sales Order Number", Pane.Left);
+            Assert.IsTrue(num.StartsWith("SO75"));
+            OpenObjectActions(Pane.Left);
+            OpenActionDialog("Add New Detail", Pane.Left);
+            ClearFieldThenType("#quantity1", "10");
+            var product = WaitForCss("#pane2 .title");
+            CopyToClipboard(product);
+            PasteIntoInputField("#pane1 .parameter .value.droppable");
+            Click(OKButton());
+            Click(FullIcon());
+            WaitForView(Pane.Single, PaneType.Object);
+            Assert.AreEqual("£297.41", GetPropertyValue("Sub Total"));
+            Assert.AreEqual("£297.41", GetPropertyValue("Total Due"));
+        }
+
+        [TestMethod]
+        public void UseOfResolveMethodInADeferredFunction()
+        {
+            GeminiUrl("object/object?i1=View&o1=AW.Types.Customer--12211&as1=open&i2=View&o2=AW.Types.Product--707");
+            WaitForTitle("AW00012211 Victor Romero", Pane.Left);
+            Click(GetObjectAction("Create Another Order", Pane.Left));
+            WaitForView(Pane.Left, PaneType.Object);
+            var num = GetPropertyValue("Sales Order Number", Pane.Left);
+            Assert.IsTrue(num.StartsWith("SO75"));
+            OpenObjectActions(Pane.Left);
+            OpenActionDialog("Add New Detail", Pane.Left);
+            var product = WaitForCss("#pane2 .title");
+            CopyToClipboard(product);
+            PasteIntoInputField("#pane1 .parameter .value.droppable");
+            Click(OKButton());
+            Click(FullIcon());
+            WaitForView(Pane.Single, PaneType.Object);
+            Thread.Sleep(1000);
+            var listIcon1 = WaitForCssNo(".collection .icon.list", 0);
+            Click(listIcon1);
+            //var detail = wait.Until(dr => dr.FindElements(By.CssSelector("tr td")).First(el => el.Text == "1 x Sport-100 Helmet, Red"));
+            var detail = WaitForCssNo("tbody tr td", 1);
+            Assert.AreEqual("1 x Sport-100 Helmet, Red", detail.Text);
+            Assert.AreEqual("£29.74", GetPropertyValue("Sub Total", Pane.Left));
+            RightClick(detail);
+            WaitForView(Pane.Right, PaneType.Object, "1 x Sport-100 Helmet, Red");
+            OpenObjectActions(Pane.Right);
+            OpenActionDialog("Change Quantity", Pane.Right);
+            TypeIntoFieldWithoutClearing("#newquantity2", "2");
+            Click(OKButton());
+            Thread.Sleep(500);
+            Assert.AreEqual("£59.48", GetPropertyValue("Sub Total", Pane.Left));
+
         }

         [TestMethod, Ignore] //NOT currently working


Disable GDB + Bochs GUI

Disable GDB + Bochs GUI

--- Tests/Cosmos.TestRunner.Full/DefaultEngineConfiguration.cs
+++ Tests/Cosmos.TestRunner.Full/DefaultEngineConfiguration.cs
@@ -21,9 +21,8 @@
             }
         }

-        public virtual bool RunWithGDB => true;
-        public virtual bool StartBochsDebugGUI => true;
-
+        public virtual bool RunWithGDB => false;
+        public virtual bool StartBochsDebugGUI => false;
         public virtual bool DebugIL2CPU => false;
         public virtual string KernelPkg => String.Empty;
         public virtual TraceAssemblies TraceAssembliesLevel => TraceAssemblies.User;


make an interface for this

make an interface for this

--- TrelloWorld/TrelloWorld.Server/Services/MarkdownService.cs
+++ TrelloWorld/TrelloWorld.Server/Services/MarkdownService.cs
@@ -4,27 +4,33 @@

 namespace TrelloWorld.Server.Services
 {
-    public class MarkdownService
+    public interface IMarkdownService
     {
+        Task<string> GetConfigureAppKey();
+    }
+
+    public class MarkdownService : IMarkdownService
+    {
+        private readonly Markdown _md;
         private readonly string _rootPath;

         public MarkdownService(string rootPath)
         {
             _rootPath = rootPath;
+            _md = new Markdown();
         }
+
         public async Task<string> GetConfigureAppKey()
         {
             return await GetMarkdown(Path.Combine(_rootPath, "ConfigureAppKey.md"));
         }

-        private static async Task<string> GetMarkdown(string fileName)
+        private async Task<string> GetMarkdown(string fileName)
         {
-            Markdown md = new Markdown();
-
             using (var reader = new StreamReader(fileName))
             {
                 var raw = await reader.ReadToEndAsync();
-                return md.Transform(raw);
+                return _md.Transform(raw);
             }
         }
     }


Turn off openconsole for Trezor T setup

Turn off openconsole for Trezor T setup

--- WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
+++ WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -401,9 +401,17 @@
 							{
 								IsHardwareBusy = true;
 								MainWindowViewModel.Instance.StatusBar.TryAddStatus(StatusBarStatus.SettingUpHardwareWallet);
-								// After HWI 1.0.1 the openconsole can be made false for Trezor T.
-								// HWI will start detecting the exact type of hardware wallets.
-								await client.SetupAsync(selectedWallet.HardwareWalletInfo.Model, selectedWallet.HardwareWalletInfo.Path, true, cts.Token);
+
+								// Trezor T doesn't require interactive mode.
+								if (selectedWallet.HardwareWalletInfo.Model == HardwareWalletModels.Trezor_T
+									|| selectedWallet.HardwareWalletInfo.Model == HardwareWalletModels.Trezor_T_Simulator)
+								{
+									await client.SetupAsync(selectedWallet.HardwareWalletInfo.Model, selectedWallet.HardwareWalletInfo.Path, false, cts.Token);
+								}
+								else
+								{
+									await client.SetupAsync(selectedWallet.HardwareWalletInfo.Model, selectedWallet.HardwareWalletInfo.Path, true, cts.Token);
+								}

 								MainWindowViewModel.Instance.StatusBar.TryAddStatus(StatusBarStatus.ConnectingToHardwareWallet);
 								await EnumerateHardwareWalletsAsync();


Added more explicit RTLSDR detection

Added more explicit RTLSDR detection

git-svn-id: 6b7e1e5d0861e268462ba7828ef63c1bcab52a9b@305 d3cde5d6-82b8-4669-8b62-43054d6781d8

--- RTLSDR/RTLSDRIO.cs
+++ RTLSDR/RTLSDRIO.cs
@@ -46,12 +46,13 @@

         public void Open()
         {
-            if (NativeMethods.rtlsdr_get_device_count() > 0)
+            if (NativeMethods.rtlsdr_get_device_count() <= 0)
             {
-                NativeMethods.rtlsdr_open(ref _dev, _deviceIndex);
-                NativeMethods.rtlsdr_set_sample_rate(_dev, DefaultSamplerate);
-                NativeMethods.rtlsdr_set_center_freq(_dev, DefaultFrequency);
+                throw new ApplicationException("No compatible device detected");
             }
+            NativeMethods.rtlsdr_open(ref _dev, _deviceIndex);
+            NativeMethods.rtlsdr_set_sample_rate(_dev, DefaultSamplerate);
+            NativeMethods.rtlsdr_set_center_freq(_dev, DefaultFrequency);
         }

         public void Start(SamplesAvailableDelegate callback)


注释无效代码

注释无效代码

--- csharp/ToolGood.Words/internals/Translate.cs
+++ csharp/ToolGood.Words/internals/Translate.cs
@@ -158,8 +158,8 @@
         internal static Dictionary<string, string> GetTransformationDict(string fileName)
         {
             var ass = typeof(WordsHelper).Assembly;
-            var dir = Path.GetDirectoryName(ass.Location);
-            var file = Path.Combine(dir, fileName);
+            //var dir = Path.GetDirectoryName(ass.Location);
+            //var file = Path.Combine(dir, fileName);
             string tStr;
             //if (File.Exists(file)) {
             //    tStr = File.ReadAllText(file);


tokenizer, highlighter: T_NS_SEPARATOR treated as Delimiter

git-tfs-id: [https://devsense.visualstudio.com/DefaultCollection]$/Phalanger/Main;C8059

--- Source/Core.Parsers/Parsers/Tokenizer.cs
+++ Source/Core.Parsers/Parsers/Tokenizer.cs
@@ -415,7 +415,8 @@
 					case Tokens.T_RGENERIC:                     // :>
 					case Tokens.T_SEMI:                         // ;
 					case Tokens.T_COMMA:                        // ,
-						tokenCategory = TokenCategory.Delimiter;
+                    case Tokens.T_NS_SEPARATOR:                 // \
+                        tokenCategory = TokenCategory.Delimiter;
 						return token;

 					//case Tokens.T_NAMESPACE_NAME:               // namespace name
@@ -440,7 +441,6 @@
 					case Tokens.T_CONSTANT_ENCAPSED_STRING:     // quoted string not containing '$'
 					case Tokens.T_BAD_CHARACTER:                // incorrectly slashed character in string
 					case Tokens.T_NUM_STRING:                   // number in string
-                    case Tokens.T_NS_SEPARATOR:
                         tokenCategory = TokenCategory.String;
 						return token;


Camera DrawDevice Setup Fix #FIX: Fixed Camera internal DrawDevice projection on setup lacking target size and causing NaN projection results.

--- Source/Core/Duality/Components/Camera.cs
+++ Source/Core/Duality/Components/Camera.cs
@@ -321,9 +321,11 @@

 			this.drawDevice = new DrawDevice();

-			// Default to world space render mode, so coordinate conversions
-			// work as expected regardless of rendering state.
+			// Default to world space render mode with the expected view sizes,
+			// so coordinate conversions work as expected regardless of rendering state.
 			this.drawDevice.RenderMode = RenderMode.World;
+			this.drawDevice.TargetSize = DualityApp.TargetViewSize;
+			this.drawDevice.ViewportRect = new Rect(this.drawDevice.TargetSize);
 		}
 		private void ReleaseDevice()
 		{