Too much for one commit

Too much for one commit

Mostly stuff relating to getting data out of the file

--- Src/WHampson.Cascara/BinaryFile.cs
+++ Src/WHampson.Cascara/BinaryFile.cs
@@ -25,6 +25,17 @@
 using System.Runtime.InteropServices;
 using System.IO;
 using WHampson.Cascara.Types;
+using System.Text.RegularExpressions;
+using System.Reflection;
+
+using Double = WHampson.Cascara.Types.Double;
+using Int16 = WHampson.Cascara.Types.Int16;
+using Int32 = WHampson.Cascara.Types.Int32;
+using Int64 = WHampson.Cascara.Types.Int64;
+using UInt16 = WHampson.Cascara.Types.UInt16;
+using UInt32 = WHampson.Cascara.Types.UInt32;
+using UInt64 = WHampson.Cascara.Types.UInt64;
+using Pointer = WHampson.Cascara.Types.Pointer;

 namespace WHampson.Cascara
 {
@@ -215,12 +226,162 @@
             pValue.Value = value;
         }

+        public T Extract<T>() where T : new()
+        {
+            //PrintSymbols(symTabl);
+
+            return (T) Extract(symTabl, typeof(T));
+            //return (T) new object();
+        }
+
+        private object Extract(SymbolTable tabl, Type t)
+        {
+            object o = Activator.CreateInstance(t);
+            PropertyInfo[] props = t.GetProperties();
+            foreach (PropertyInfo p in props)
+            {
+                SymbolInfo sInfo = tabl.GetEntry(p.Name);
+                if (sInfo == null)
+                {
+                    continue;
+                }
+
+                bool isCascaraPrimitive = p.GetValue(o) is ICascaraType;
+                bool isCascaraPointer = typeof(ICascaraPointer).IsAssignableFrom(p.PropertyType);
+                if (isCascaraPrimitive || p.PropertyType.IsPrimitive)
+                {
+                    SetPrimitiveValue(p, o, sInfo);
+                }
+                else if (isCascaraPointer)
+                {
+                    SetPointerValue(p, o, sInfo);
+                }
+                else if (sInfo.TypeInfo.Type == typeof(BftStruct) && sInfo.Child != null)
+                {
+                    if (p.PropertyType.IsArray)
+                    {
+                        SetArrayValues(p, o, tabl);
+                        continue;
+                    }
+
+                    object memb = Extract(sInfo.Child, p.PropertyType);
+                    p.SetValue(o, memb);
+                }
+
+                // TODO: handle arrays
+            }
+
+            return o;
+        }
+
+        private void SetArrayValues(PropertyInfo p, object o, SymbolTable tabl)
+        {
+            Type propType = p.PropertyType;
+            if (propType.IsGenericType)
+            {
+                Type propGenType = propType.GetElementType().GetGenericTypeDefinition();
+                Type ptrType = typeof(Pointer<>);
+                if (propGenType == ptrType)
+                {
+                    // TODO: better exception message
+                    throw new InvalidCastException(p.Name + " is Pointer<> array!");
+                }
+            }
+
+            Type elemType = propType.GetElementType();
+            int elemCount = CountElems(p.Name, tabl);
+            Array a = Array.CreateInstance(elemType, elemCount);
+            for (int i = 0; i < elemCount; i++)
+            {
+                string elemName = string.Format("{0}[{1}]", p.Name, i);
+                SymbolInfo sInfo = tabl.GetEntry(elemName);
+                // TODO: watch out for sInfo == null
+                object memb = Extract(sInfo.Child, elemType);
+                a.SetValue(memb, i);
+            }
+
+            p.SetValue(o, a);
+        }
+
+        public int CountElems(string name)
+        {
+            return CountElems(name, symTabl);
+        }
+
+        private int CountElems(string name, SymbolTable tabl)
+        {
+            name = Regex.Replace(name, @"\[\d+\]$", "");
+            int count = 0;
+            do
+            {
+                string elemName = name + string.Format("[{0}]", count);
+                SymbolInfo sInfo = tabl.GetEntry(elemName);
+                if (sInfo == null) break;
+                count++;
+            } while (true);
+
+            return count;
+        }
+
+        private void SetPrimitiveValue(PropertyInfo p, object o, SymbolInfo sInfo)
+        {
+            object val = GetValue(sInfo.TypeInfo.Type, sInfo.Offset);
+            p.SetValue(o, Convert.ChangeType(val, p.PropertyType));
+        }
+
+        private void SetPointerValue(PropertyInfo p, object o, SymbolInfo sInfo)
+        {
+            Type propType = p.PropertyType;
+            if (propType.IsGenericType)
+            {
+                Type propGenType = propType.GetGenericTypeDefinition();
+                Type arrayPtrType = typeof(ArrayPointer<>);
+                if (propGenType == arrayPtrType)
+                {
+                    int elemCount = CountElems(p.Name);
+                    object ptrVal = Activator.CreateInstance(propType, dataPtr + sInfo.Offset, elemCount);
+                    p.SetValue(o, ptrVal);
+                    return;
+                }
+            }
+
+            Pointer ptr = GetPointer(sInfo.Offset);
+            Type ptrGeneric = typeof(Pointer<>).MakeGenericType(new Type[] { sInfo.TypeInfo.Type });
+
+            p.SetValue(o, Convert.ChangeType(ptr, ptrGeneric));
+        }
+
+        public object GetValue(Type valType, int offset)
+        {
+            Type ptrGeneric = typeof(Pointer<>).MakeGenericType(new Type[] { valType });
+            object ptr = Activator.CreateInstance(ptrGeneric, dataPtr + offset);
+            PropertyInfo valProp = ptr.GetType().GetProperty("Value");
+
+            return valProp.GetValue(ptr);
+        }
+
+        private void PrintSymbols(SymbolTable tabl)
+        {
+            string baseName = (string.IsNullOrWhiteSpace(tabl.FullyQualifiedName))
+                ? ""
+                : tabl.FullyQualifiedName + ".";
+            foreach (var entry in tabl.entries)
+            {
+                Console.WriteLine(baseName + entry.Key);
+                SymbolInfo sInfo = entry.Value;
+                if (sInfo.TypeInfo.Type == typeof(BftStruct))
+                {
+                    PrintSymbols(sInfo.Child);
+                }
+            }
+        }
+
         public void ApplyTemplate(string templateFilePath)
         {
             TemplateProcessor proc = new TemplateProcessor(templateFilePath);
             symTabl = proc.Process(dataPtr, dataLen);

-            Console.WriteLine(symTabl);
+            //Console.WriteLine(symTabl);
         }

         /// <summary>
@@ -263,6 +424,78 @@
             return offset > -1 && offset < dataLen;
         }

+        //public Pointer GetPointer(Type t, string name)
+        //{
+        //    if (t == typeof(Bool8))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if(t == typeof(Bool16))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Bool32))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Bool64))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Char8))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Char16))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Double))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Float))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Int8))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Int16))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Int32))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(Int64))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(UInt8))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(UInt16))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(UInt32))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else if (t == typeof(UInt64))
+        //    {
+        //        return (Pointer) GetPointer<Bool8>(name);
+        //    }
+        //    else
+        //    {
+        //        throw new InvalidOperationException();
+        //    }
+        //}
+
         #region Disposal
         protected virtual void Dispose(bool disposing)
         {


Page layout update

Page layout update

--- NSemble.Modules.Blog/Views/ReadBlogPost.cshtml
+++ NSemble.Modules.Blog/Views/ReadBlogPost.cshtml
@@ -15,7 +15,11 @@

-
@NSemble.Core.Extensions.DynamicContentHelpers.CompiledContent(Model.BlogPost)

+

+    @NSemble.Core.Extensions.DynamicContentHelpers.CompiledContent(Model.BlogPost)
+
+
Tagged @UrlHelpers.TagLinks((string)ViewBag.AreaRoutePrefix, post.Tags)

+

@@ -32,9 +36,7 @@

         }
     }
-
-

-
+
     @{
         var postUrl = UrlHelpers.ToUrl(post, (string) ViewBag.AreaRoutePrefix);
         var commentInput = new NSemble.Modules.Blog.Models.PostComments.CommentInput();


Removed unused using.

Removed unused using.

--- StatusBar.iOS/Status/StatusLine.cs
+++ StatusBar.iOS/Status/StatusLine.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Drawing;
-using MonoTouch.CoreGraphics;
 using MonoTouch.UIKit;
 using StatusBar.Core;


Expose SongBar's height

Expose SongBar's height

--- osu.Game.Tournament/Components/SongBar.cs
+++ osu.Game.Tournament/Components/SongBar.cs
@@ -22,7 +22,7 @@
     {
         private BeatmapInfo beatmap;

-        private const float height = 145;
+        public const float HEIGHT = 145 / 2f;

         [Resolved]
         private IBindable<RulesetInfo> ruleset { get; set; }
@@ -157,7 +157,7 @@
                 new Container
                 {
                     RelativeSizeAxes = Axes.X,
-                    Height = height / 2,
+                    Height = HEIGHT,
                     Width = 0.5f,
                     Anchor = Anchor.BottomRight,
                     Origin = Anchor.BottomRight,
@@ -229,7 +229,7 @@
                 {
                     RelativeSizeAxes = Axes.X,
                     Width = 0.5f,
-                    Height = height / 2,
+                    Height = HEIGHT,
                     Anchor = Anchor.BottomRight,
                     Origin = Anchor.BottomRight,
                 }


Fix tournament client crashing if beatmap added with an ID of zero

--- osu.Game.Tournament/TournamentGameBase.cs
+++ osu.Game.Tournament/TournamentGameBase.cs
@@ -215,7 +215,7 @@

             foreach (var r in ladder.Rounds)
             foreach (var b in r.Beatmaps)
-                if (b.BeatmapInfo == null)
+                if (b.BeatmapInfo == null && b.ID > 0)
                 {
                     var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
                     req.Perform(API);


enabled Location as filter tab

enabled Location as filter tab

forgot it QQ

--- osu.Game/Overlays/Social/FilterControl.cs
+++ osu.Game/Overlays/Social/FilterControl.cs
@@ -24,7 +24,7 @@
         Relevance,
         Rank,
         Name,
-        //Location,
+        Location,
         //[Description("Time Zone")]
         //TimeZone,
         //[Description("World Map")]


Split out transition length constants

Split out transition length constants

--- osu.Game/Screens/Edit/Timing/TapButton.cs
+++ osu.Game/Screens/Edit/Timing/TapButton.cs
@@ -68,6 +68,8 @@

         private const int max_taps_to_consider = 8;

+        private const double transition_length = 500;
+
         private readonly List<double> tapTimings = new List<double>();

         [BackgroundDependencyLoader]
@@ -212,15 +214,15 @@

         protected override bool OnHover(HoverEvent e)
         {
-            hoverLayer.FadeIn(500, Easing.OutQuint);
-            textContainer.FadeColour(textColour, 500, Easing.OutQuint);
+            hoverLayer.FadeIn(transition_length, Easing.OutQuint);
+            textContainer.FadeColour(textColour, transition_length, Easing.OutQuint);
             return true;
         }

         protected override void OnHoverLost(HoverLostEvent e)
         {
-            hoverLayer.FadeOut(500, Easing.OutQuint);
-            textContainer.FadeColour(textColour, 500, Easing.OutQuint);
+            hoverLayer.FadeOut(transition_length, Easing.OutQuint);
+            textContainer.FadeColour(textColour, transition_length, Easing.OutQuint);
             base.OnHoverLost(e);
         }

@@ -265,6 +267,7 @@

             scaleContainer.ScaleTo(1, out_duration, Easing.OutQuint);
             innerCircle.ScaleTo(1, out_duration, Easing.OutQuint);
+
             innerCircleHighlight.FadeOut(out_duration, Easing.OutQuint);

             resetDelegate = Scheduler.AddDelayed(reset, 1000);
@@ -321,9 +324,9 @@

         private void reset()
         {
-            bpmText.FadeOut(500, Easing.OutQuint);
-
-            using (BeginDelayedSequence(tapTimings.Count > 0 ? 500 : 0))
+            bpmText.FadeOut(transition_length, Easing.OutQuint);
+
+            using (BeginDelayedSequence(tapTimings.Count > 0 ? transition_length : 0))
             {
                 Schedule(() => bpmText.Text = "the beat!");
                 bpmText.FadeIn(800, Easing.OutQuint);


Version Bump

Version Bump

--- Syndll2/Properties/AssemblyInfo.cs
+++ Syndll2/Properties/AssemblyInfo.cs
@@ -11,9 +11,9 @@
 [assembly: ComVisible(false)]
 [assembly: Guid("a7fe65a7-0b61-4ea1-81c0-adc5a037ea17")]

-[assembly: AssemblyVersion("0.3.3")]
-[assembly: AssemblyFileVersion("0.3.3.14")]
-[assembly: AssemblyInformationalVersion("0.3.3-beta")]
+[assembly: AssemblyVersion("0.4.0")]
+[assembly: AssemblyFileVersion("0.4.0.15")]
+[assembly: AssemblyInformationalVersion("0.4.0-beta")]

 [assembly: InternalsVisibleTo("Syndll2.Tests, PublicKey=" +
 "00240000048000009400000006020000002400005253413100040000010001000f0f0c410cd366" +


New test.

New test.

--- Tests/Linq/Linq/ExpressionsTest.cs
+++ Tests/Linq/Linq/ExpressionsTest.cs
@@ -1,4 +1,6 @@
 using System;
+using System.Collections;
+using System.Collections.Generic;
 using System.Linq;
 using System.Linq.Expressions;

@@ -292,5 +294,28 @@
 				q.ToList();
 			}
 		}
+
+		[Sql.ExpressionMethod("AssociationExpression")]
+		static IEnumerable<GrandChild> GrandChildren(Parent p)
+		{
+			throw new InvalidOperationException();
+		}
+
+		static Expression<Func<Parent,IEnumerable<GrandChild>>> AssociationExpression()
+		{
+			return parent => parent.Children.SelectMany(gc => gc.GrandChildren);
+		}
+
+		[Test]
+		public void AssociationMethodExpression([DataContexts] string context)
+		{
+			using (var db = GetDataContext(context))
+				AreEqual(
+					from p in Parent
+					select p.Children.SelectMany(gc => gc.GrandChildren).Count()
+					,
+					from p in db.Parent
+					select GrandChildren(p).Count());
+		}
 	}
 }


Added status field to remark

Added status field to remark

--- src/Collectively.Api/Modules/RemarkModule.cs
+++ src/Collectively.Api/Modules/RemarkModule.cs
@@ -31,6 +31,7 @@
                     Description = x.Description,
                     CreatedAt = x.CreatedAt,
                     State = x.State,
+                    Status = x.Status,
                     Rating = x.Rating,
                     CommentsCount = x.CommentsCount,
                     ParticipantsCount = x.ParticipantsCount,


Fix ProjectN regression in `ByReference<T>` (dotnet/corert#6713)

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

--- src/Common/src/CoreLib/System/ByReference.cs
+++ src/Common/src/CoreLib/System/ByReference.cs
@@ -11,7 +11,11 @@
     // around lack of first class support for byref fields in C# and IL. The JIT and
     // type loader has special handling for it that turns it into a thin wrapper around ref T.
     [NonVersionable]
-    internal readonly ref struct ByReference<T>
+    internal
+#if !PROJECTN // readonly breaks codegen contract and asserts UTC
+    readonly
+#endif
+    ref struct ByReference<T>
     {
         // CS0169: The private field '{blah}' is never used
 #pragma warning disable 169


Added missing TestAttribute

Added missing TestAttribute

--- src/Common/tests/ExtendedTextWrapperTests.cs
+++ src/Common/tests/ExtendedTextWrapperTests.cs
@@ -82,6 +82,7 @@
             Assert.That(sb.ToString(), Is.EqualTo(LABEL + OPTION));
         }

+        [Test]
         public void WriteLabel_ColorStyle()
         {
             writer.WriteLabel(LABEL, OPTION, ColorStyle.Pass);
@@ -103,4 +104,4 @@
         }
     }
 }
-#endif+#endif


Increase wait on TestExpiredNotInQuery

Increase wait on TestExpiredNotInQuery

--- src/Couchbase.Lite.Tests.Shared/QueryTest.cs
+++ src/Couchbase.Lite.Tests.Shared/QueryTest.cs
@@ -256,7 +256,7 @@
             }

             Db.SetDocumentExpiration(docId, DateTimeOffset.Now);
-            Thread.Sleep(5);
+            Thread.Sleep(50);

             using (var doc2 = new MutableDocument("doc2")) {
                 doc2.SetString("expire_me", "never");


formatting changes to static Helper.GetDataFromUrl- null checking url string

--- source/nuPickers/Helper.cs
+++ source/nuPickers/Helper.cs
@@ -102,19 +102,22 @@
         {
             string data = string.Empty;

-            if (!string.IsNullOrEmpty(url))	// do nothing if we don't have a URL
+            if (!string.IsNullOrEmpty(url))
             {
-            using (WebClient client = new WebClient())
-            {
-                if (url.StartsWith("~/"))
+                using (WebClient client = new WebClient())
                 {
-                    string filePath = HttpContext.Current.Server.MapPath(url);
+                    if (url.StartsWith("~/"))
+                    {
+                        string filePath = HttpContext.Current.Server.MapPath(url);

-                        var newValue = (HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/");
-
-                        url = File.Exists(filePath)
-                            ? filePath
-                            : url.Replace("~/", newValue);
+                        if (File.Exists(filePath))
+                        {
+                            url = filePath;
+                        }
+                        else
+                        {
+                            url = url.Replace("~/", (HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/"));
+                        }
                     }

                     data = client.DownloadString(url);


Update SelectionTool.cs

Update SelectionTool.cs

--- src/Draw2D.ViewModels/Tools/SelectionTool.cs
+++ src/Draw2D.ViewModels/Tools/SelectionTool.cs
@@ -23,6 +23,7 @@
         private double _previousY;
         private IList<IBaseShape> _shapesToCopy = null;
         private bool _disconnected = false;
+        private bool _copied = false;

         public enum State
         {
@@ -52,6 +53,7 @@
         private void LeftDownNoneInternal(IToolContext context, double x, double y, Modifier modifier)
         {
             _disconnected = false;
+            _copied = false;

             _originX = x;
             _originY = y;
@@ -235,6 +237,12 @@
             _previousX = x;
             _previousY = y;

+            if (modifier == Modifier.None)
+            {
+                _disconnected = false;
+                _copied = false;
+            }
+
             if (context.DocumentContainer?.ContainerView?.SelectionState != null)
             {
                 if (context.DocumentContainer.ContainerView.SelectionState?.Shapes.Count == 1)
@@ -263,22 +271,36 @@
                                 }
                             }
                         }
+
+                        if (modifier == Settings?.CopyModifier && _copied == false)
+                        {
+                            Duplicate(context);
+                            this.CurrentState = State.Move;
+                            _copied = true;
+                        }
                     }

                     shape.Move(context.DocumentContainer.ContainerView.SelectionState, dx, dy);
                 }
                 else
                 {
-                    var selectedToDisconnect = new List<IBaseShape>(context.DocumentContainer.ContainerView.SelectionState?.Shapes);
-                    foreach (var shape in selectedToDisconnect)
-                    {
-                        if (Settings.DisconnectPoints && modifier == Settings?.ConnectionModifier)
-                        {
-                            if (!(shape is IPointShape) && _disconnected == false)
+                    if (Settings.DisconnectPoints && modifier == Settings?.ConnectionModifier && _disconnected == false)
+                    {
+                        var selectedToDisconnect = new List<IBaseShape>(context.DocumentContainer.ContainerView.SelectionState?.Shapes);
+                        foreach (var shape in selectedToDisconnect)
+                        {
+                            if (IsAcceptedShape(shape))
                             {
                                 DisconnectImpl(context, shape);
                             }
                         }
+                    }
+
+                    if (modifier == Settings?.CopyModifier && _copied == false)
+                    {
+                        Duplicate(context);
+                        this.CurrentState = State.Move;
+                        _copied = true;
                     }

                     var selectedToMove = new List<IBaseShape>(context.DocumentContainer.ContainerView.SelectionState?.Shapes);
@@ -297,6 +319,7 @@
             CurrentState = State.None;

             _disconnected = false;
+            _copied = false;

             context.DocumentContainer?.ContainerView?.SelectionState?.Dehover();


Add missing parenthesis when printing a reference to an array

--- src/Generator/Generators/C/CppTypePrinter.cs
+++ src/Generator/Generators/C/CppTypePrinter.cs
@@ -141,7 +141,13 @@
             var array = pointer.Pointee as ArrayType;
             if (array != null && array.QualifiedType.IsConst())
                 pointeeType.Type = "const " + pointeeType.Type;
+
+            var paren = array != null && pointer.Modifier == PointerType.TypeModifier.LVReference;
+            if (paren)
+                pointeeType.NamePrefix.Append("(");
             pointeeType.NamePrefix.Append(mod);
+            if (paren)
+                pointeeType.NameSuffix.Insert(0, ")");

             var qual = GetStringQuals(quals, false);
             if (!string.IsNullOrEmpty(qual))


Change the sample index to keep TSP as default one

--- src/GeneticSharp.Runner.GtkApp/MainWindow.cs
+++ src/GeneticSharp.Runner.GtkApp/MainWindow.cs
@@ -66,7 +66,7 @@
         PrepareComboBoxes();
         PrepareSamples();

-        cmbSample.Active = 2;
+        cmbSample.Active = 3;
         hslCrossoverProbability.Value = GeneticAlgorithm.DefaultCrossoverProbability;
         hslMutationProbability.Value = GeneticAlgorithm.DefaultMutationProbability;


Use correct rustc path

Use correct rustc path

--- VisualRust/Racer/RacerSingleton.cs
+++ VisualRust/Racer/RacerSingleton.cs
@@ -7,6 +7,7 @@
 using System.Runtime.InteropServices;
 using System.Text;
 using VisualRust.Options;
+using VisualRust.Shared;
 using Process = System.Diagnostics.Process;

 namespace VisualRust.Racer
@@ -89,7 +90,11 @@

         private static String GetRustcSysroot()
         {
-            string exePath = "rustc"; // TODO wich rustc ???
+            var cargo = Cargo.FindSupportedInstallation();
+            if (cargo == null)
+                return null;
+
+            string exePath = cargo.RustcExecutable;
             ProcessStartInfo psi = new ProcessStartInfo
             {
                 UseShellExecute = false,
@@ -97,6 +102,7 @@
                 FileName = exePath,
                 RedirectStandardOutput = true,
                 Arguments = "--print sysroot",
+                StandardOutputEncoding = Encoding.UTF8
             };
             try
             {


[QLTY] Missing comment

[QLTY] Missing comment

--- XGraph/ViewModels/PortViewModel.cs
+++ XGraph/ViewModels/PortViewModel.cs
@@ -24,6 +24,12 @@
     {
         #region Properties

+        /// <summary>
+        /// Gets or sets the position.
+        /// </summary>
+        /// <value>
+        /// The position.
+        /// </value>
         public Point Position
         {
             get; set;


Fix field type

Fix field type

--- src/NTDll.Desktop/NTDll+OBJECT_ATTRIBUTES.cs
+++ src/NTDll.Desktop/NTDll+OBJECT_ATTRIBUTES.cs
@@ -16,7 +16,7 @@
         /// </summary>
         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
         [OfferIntPtrPropertyAccessors]
-        public partial struct OBJECT_ATTRIBUTES
+        public unsafe partial struct OBJECT_ATTRIBUTES
         {
             /// <summary>
             /// The number of bytes of data contained in this structure. The <see cref="Create"/> method sets this member to <c>sizeof(OBJECT_ATTRIBUTES)</c>.
@@ -35,7 +35,7 @@
             /// A <see cref="UNICODE_STRING"/> that contains the name of the object for which a handle is to be opened.
             /// This must either be a fully qualified object name, or a relative path name to the directory specified by the <see cref="RootDirectory"/> member.
             /// </summary>
-            public UNICODE_STRING ObjectName;
+            public UNICODE_STRING* ObjectName;

             /// <summary>
             /// Bitmask of flags that specify object handle attributes.


Use default value for the event bus on missing parameters

--- src/Orchard.Events/DefaultOrchardEventBus.cs
+++ src/Orchard.Events/DefaultOrchardEventBus.cs
@@ -1,10 +1,8 @@
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
-using System.Collections.Concurrent;
+using System.Reflection;
 using System.Threading.Tasks;
-using System.Reflection;
-using System.Linq.Expressions;
-using System.Linq;
 using Orchard.DependencyInjection;

 namespace Orchard.Events
@@ -70,7 +68,21 @@
             for (var i = 0; i < methodParameters.Length; i++)
             {
                 var parameterName = methodParameters[i].Name;
-                parameters[i] = arguments[parameterName];
+
+                // If the requested parameter is not present in the original call, just set null
+                object value = null;
+                if (!arguments.TryGetValue(parameterName, out value))
+                {
+                    var parameterType = methodParameters[i].ParameterType;
+                    if (parameterType.GetTypeInfo().IsValueType)
+                    {
+                        value = Activator.CreateInstance(parameterType);
+                    }
+
+                    value = null;
+                }
+
+                parameters[i] = value;
             }

             var result = methodInfo.Invoke(service, parameters) as Task;


fixed code that crashes mono compiler.

fixed code that crashes mono compiler.

--- src/Perspex.Controls/Utils/UndoRedoHelper.cs
+++ src/Perspex.Controls/Utils/UndoRedoHelper.cs
@@ -37,7 +37,12 @@

         public void Undo()
         {
-            _host.UndoRedoState= (_currentNode = _currentNode?.Previous ?? _currentNode).Value;
+			if (_currentNode != null)
+			{
+				_currentNode = _currentNode.Previous;
+			}
+
+			_host.UndoRedoState = _currentNode?.Value;
         }

         public bool IsLastState => _currentNode.Next == null;
@@ -62,8 +67,12 @@
         }

         public void Redo()
-        {
-            _host.UndoRedoState = (_currentNode = _currentNode?.Next ?? _currentNode).Value;
+        {
+			if (_currentNode != null) {
+				_currentNode = _currentNode.Next;
+			}
+
+			_host.UndoRedoState = _currentNode?.Value;
         }

         public void Snapshot()


Add logging for /waitForDebugger parameter in host

--- src/PowerShellEditorServices.Host/Program.cs
+++ src/PowerShellEditorServices.Host/Program.cs
@@ -17,29 +17,6 @@
         [STAThread]
         static void Main(string[] args)
         {
-#if DEBUG
-            // In the future, a more robust argument parser will be added here
-            bool waitForDebugger =
-                args.Any(
-                    arg =>
-                        string.Equals(
-                            arg,
-                            "/waitForDebugger",
-                            StringComparison.InvariantCultureIgnoreCase));
-
-            // Should we wait for the debugger before starting?
-            if (waitForDebugger)
-            {
-                // Wait for 15 seconds and then continue
-                int waitCountdown = 15;
-                while (!Debugger.IsAttached && waitCountdown > 0)
-                {
-                    Thread.Sleep(1000);
-                    waitCountdown--;
-                }
-            }
-#endif
-
             string logPath = null;
             string logPathArgument =
                 args.FirstOrDefault(
@@ -80,6 +57,43 @@
             // TODO: Set the level based on command line parameter
             Logger.Initialize(logPath, LogLevel.Verbose);

+#if DEBUG
+            bool waitForDebugger =
+                args.Any(
+                    arg =>
+                        string.Equals(
+                            arg,
+                            "/waitForDebugger",
+                            StringComparison.InvariantCultureIgnoreCase));
+
+            // Should we wait for the debugger before starting?
+            if (waitForDebugger)
+            {
+                Logger.Write(LogLevel.Normal, "Waiting for debugger to attach before continuing...");
+
+                // Wait for 15 seconds and then continue
+                int waitCountdown = 15;
+                while (!Debugger.IsAttached && waitCountdown > 0)
+                {
+                    Thread.Sleep(1000);
+                    waitCountdown--;
+                }
+
+                if (Debugger.IsAttached)
+                {
+                    Logger.Write(
+                        LogLevel.Normal,
+                        "Debugger attached, continuing startup sequence");
+                }
+                else if (waitCountdown == 0)
+                {
+                    Logger.Write(
+                        LogLevel.Normal,
+                        "Timed out while waiting for debugger to attach, continuing startup sequence");
+                }
+            }
+#endif
+
             Logger.Write(LogLevel.Normal, "PowerShell Editor Services Host starting...");

             // Start the server


Fix annoying typo.

Fix annoying typo.

--- src/QuartzNET-DynamoDB/DynamoBootstrapper.cs
+++ src/QuartzNET-DynamoDB/DynamoBootstrapper.cs
@@ -92,7 +92,7 @@
                     return;
                 }

-                Console.WriteLine(string.Format("Watiing for Table {0} to delete.", tableName));
+                Console.WriteLine(string.Format("Waiting for Table {0} to delete.", tableName));

                 Thread.Sleep(500);
             }
@@ -129,7 +129,7 @@
                 {
                 }

-                Console.WriteLine(string.Format("Watiing for Table {0} to become active.", tableName));
+                Console.WriteLine(string.Format("Waiting for Table {0} to become active.", tableName));

                 Thread.Sleep(500);
             }


Now supports any value for domain linking.

--- src/Rolcore.Web/UI/GoogleAnalyticsSnippet.cs
+++ src/Rolcore.Web/UI/GoogleAnalyticsSnippet.cs
@@ -11,12 +11,12 @@

         protected bool AllowPageLinker
         {
-            get { return this.PageDomainName.Equals("none"); }
+            get { return !string.IsNullOrEmpty(this.PageDomainName); }
         }

         protected bool AllowRollUpLinker
         {
-            get { return this.RollupDomainName.Equals("none"); }
+            get { return !string.IsNullOrEmpty(this.RollupDomainName); }
         }

         protected bool PageTrackerInUse


MethodOverride can parse UrlEncoded bodies

--- src/SimpleOwin.Middlewares/MethodOverride.cs
+++ src/SimpleOwin.Middlewares/MethodOverride.cs
@@ -20,7 +20,7 @@

                     if (string.IsNullOrWhiteSpace(method))
                     {
-                        // try checking body, requires JsonBodyParser middleware
+                        // try checking body, requires JsonBodyParser/UrlEncoded middleware
                         if (checkBody)
                         {
                             var body = env.GetOwinEnvironmentValue<Lazy<object>>("simpleOwin.body");
@@ -28,11 +28,25 @@
                             {
                                 try
                                 {
-                                    var dict = body.Value as IDictionary<string, object>;
-                                    if (dict != null)
+                                    var dictStringObject = body.Value as IDictionary<string, object>;
+                                    if (dictStringObject == null)
+                                    {
+                                        var dictStringStringArray = body.Value as IDictionary<string, string[]>;
+                                        string[] tempValue;
+                                        if (dictStringStringArray != null && dictStringStringArray.TryGetValue(key, out tempValue))
+                                        {
+                                            if (tempValue != null && tempValue.Length == 1)
+                                            {
+                                                var stringTempValue = tempValue[0];
+                                                if (!string.IsNullOrWhiteSpace(stringTempValue))
+                                                    method = stringTempValue;
+                                            }
+                                        }
+                                    }
+                                    else
                                     {
                                         object tempValue;
-                                        if (dict.TryGetValue(key, out tempValue))
+                                        if (dictStringObject.TryGetValue(key, out tempValue))
                                         {
                                             var stringTempValue = tempValue as string;
                                             if (!string.IsNullOrWhiteSpace(stringTempValue))


Disable System.Drawing test

Disable System.Drawing test

--- src/System.Drawing.Common/tests/FontTests.cs
+++ src/System.Drawing.Common/tests/FontTests.cs
@@ -820,6 +820,7 @@
             }
         }

+        [ActiveIssue(36683)]
         [ConditionalFact(Helpers.IsDrawingSupported)]
         public void ToLogFont_DisposedGraphics_ThrowsArgumentException()
         {


Fix for Null Ref in ActivityComputer

Fix for Null Ref in ActivityComputer

--- src/TraceEvent/Computers/ActivityComputer.cs
+++ src/TraceEvent/Computers/ActivityComputer.cs
@@ -447,7 +447,7 @@
                     if (filePath.EndsWith("clr.dll", StringComparison.OrdinalIgnoreCase) || filePath.EndsWith("mscorwks.dll", StringComparison.OrdinalIgnoreCase))
                     {
                         seenThreadPoolDll = true;
-                        if (prevFilePath.EndsWith("ntoskrnl.exe", StringComparison.OrdinalIgnoreCase))
+                        if (prevFilePath != null && prevFilePath.EndsWith("ntoskrnl.exe", StringComparison.OrdinalIgnoreCase))
                             return false;
                     }
                     else if (!filePath.EndsWith("webengine4.dll", StringComparison.OrdinalIgnoreCase))


refs #206. remove BOM

refs #206. remove BOM


Update property group type enum

Update property group type enum

--- src/Umbraco.Core/Models/PropertyGroupType.cs
+++ src/Umbraco.Core/Models/PropertyGroupType.cs
@@ -6,14 +6,12 @@
     public enum PropertyGroupType : short
     {
         /// <summary>
-        /// Display as a group (using a header).
+        /// Display property types in a group.
         /// </summary>
         Group = 0,
         /// <summary>
-        /// Display as an app (using a name and icon).
+        /// Display property types in a tab.
         /// </summary>
-        App = 1,
-        //Tab = 2,
-        //Fieldset = 3
+        Tab = 1
     }
 }


Performance appender should not be public

--- src/ZeroLog/Appenders/PerformanceAppender.cs
+++ src/ZeroLog/Appenders/PerformanceAppender.cs
@@ -5,7 +5,7 @@

 namespace ZeroLog.Appenders
 {
-    public class PerformanceAppender : IAppender
+    class PerformanceAppender : IAppender
     {
         private readonly MessageReceived[] _messages;
         private int _count;


Use type-safe collections

Use type-safe collections

--HG--
extra : convert_revision : charlie%40nunit.com-20091031214132-2geywk1u3mhyfmlb

--- src/framework/NUnit/Core/Builders/PairwiseStrategy.cs
+++ src/framework/NUnit/Core/Builders/PairwiseStrategy.cs
@@ -126,7 +126,7 @@

 		internal class Tuple
 		{
-			private readonly ArrayList features = new ArrayList();
+			private readonly FeatureList features = new FeatureList();

 			public int Count
 			{
@@ -175,7 +175,7 @@

 		internal class TupleCollection
 		{
-			private readonly ArrayList tuples = new ArrayList();
+			private readonly TupleList tuples = new TupleList();

 			public int Count
 			{
@@ -249,7 +249,7 @@

 		internal class TestCaseCollection : IEnumerable
 		{
-			private readonly ArrayList testCases = new ArrayList();
+			private readonly TestCaseList testCases = new TestCaseList();

 			public void Add(TestCase testCase)
 			{
@@ -503,7 +503,7 @@
 					{
 						int d = dimensionOrder[i];

-						ArrayList bestFeatures = new ArrayList();
+						IntList bestFeatures = new IntList();

 						int bestCoverage = this.CountTuplesCovered(test, d, test.Features[d]);

@@ -568,7 +568,7 @@
 					immutableDimensions[tuple[i].Dimension] = true;
 				}

-				ArrayList mutableDimensions = new ArrayList();
+				IntList mutableDimensions = new IntList();

 				for (int i = 0; i < this.dimensions.Length; i++)
 				{
@@ -578,7 +578,7 @@
 					}
 				}

-				return (int[])mutableDimensions.ToArray(typeof(int));
+				return (int[])mutableDimensions.ToArray();
 			}

 			private int CountTuplesCovered(TestCase test, int dimension, int feature)
@@ -646,12 +646,12 @@

 		public override IEnumerable GetTestCases()
 		{
-			ArrayList[] valueSet = CreateValueSet();
+			ObjectList[] valueSet = CreateValueSet();
 			int[] dimensions = CreateDimensions(valueSet);

 			IEnumerable pairwiseTestCases = new PairwiseTestCaseGenerator(dimensions).GetTestCases();

-			ArrayList testCases = new ArrayList();
+			ArgumentsCollection testCases = new ArgumentsCollection();

 			foreach (TestCase pairwiseTestCase in pairwiseTestCases)
 			{
@@ -668,13 +668,13 @@
 			return testCases;
 		}

-		private ArrayList[] CreateValueSet()
-		{
-			ArrayList[] valueSet = new ArrayList[Sources.Length];
+		private ObjectList[] CreateValueSet()
+		{
+			ObjectList[] valueSet = new ObjectList[Sources.Length];

 			for (int i = 0; i < valueSet.Length; i++)
 			{
-				ArrayList values = new ArrayList();
+				ObjectList values = new ObjectList();

 				foreach (object value in Sources[i])
 				{
@@ -687,7 +687,7 @@
 			return valueSet;
 		}

-		private int[] CreateDimensions(ArrayList[] valueSet)
+		private int[] CreateDimensions(ObjectList[] valueSet)
 		{
 			int[] dimensions = new int[valueSet.Length];

@@ -698,5 +698,17 @@

 			return dimensions;
 		}
-	}
+
+#if CLR_2_0
+        class FeatureList : System.Collections.Generic.List<FeatureInfo> { }
+        class TupleList : System.Collections.Generic.List<Tuple> { }
+        class IntList : System.Collections.Generic.List<int> { }
+        class TestCaseList : System.Collections.Generic.List<TestCase> { }
+#else
+        class FeatureList : ArrayList { }
+        class TupleList : ArrayList { }
+        class IntList : ArrayList { }
+        class TestCaseList : ArrayList { }
+#endif
+    }
 }


remove obsolete comments

remove obsolete comments

git-svn-id: 223c0ba935819ffdcafdc68147dc609b4e469b1e@1670039 13f79535-47bb-0310-9956-ffa450edef68

--- src/log4net/Appender/SmtpAppender.cs
+++ src/log4net/Appender/SmtpAppender.cs
@@ -17,7 +17,7 @@
 //
 #endregion

-// .NET Compact Framework has no support for System.Web.Mail
+// .NET Compact Framework has no support for System.Net.Mail
 #if !NETCF

 using System;
@@ -45,13 +45,6 @@
 	/// cyclic buffer. This keeps memory requirements at a reasonable level while
 	/// still delivering useful application context.
 	/// </para>
-	/// <note type="caution">
-	/// Authentication and setting the server Port are only available on the MS .NET 1.1 runtime.
-	/// For these features to be enabled you need to ensure that you are using a version of
-	/// the log4net assembly that is built against the MS .NET 1.1 framework and that you are
-	/// running the your application on the MS .NET 1.1 runtime. On all other platforms only sending
-	/// unauthenticated messages to a server listening on port 25 (the default) is supported.
-	/// </note>
 	/// <para>
 	/// Authentication is supported by setting the <see cref="Authentication"/> property to
 	/// either <see cref="SmtpAuthentication.Basic"/> or <see cref="SmtpAuthentication.Ntlm"/>.
@@ -85,24 +78,13 @@
 		#region Public Instance Properties

 		/// <summary>
-		/// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses (use semicolon on .NET 1.1 and comma for later versions).
+		/// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses (comma is the preferred delimiter).
 		/// </summary>
 		/// <value>
-        /// <para>
-        /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
-        /// </para>
-        /// <para>
-        /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
-        /// </para>
+		/// <para>
+		/// A comma- or semicolon-delimited list of e-mail addresses.
+		/// </para>
 		/// </value>
-		/// <remarks>
-        /// <para>
-        /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
-        /// </para>
-        /// <para>
-        /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
-        /// </para>
-		/// </remarks>
 		public string To
 		{
 			get { return m_to; }
@@ -111,24 +93,13 @@

         /// <summary>
         /// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses
-        /// that will be carbon copied (use semicolon on .NET 1.1 and comma for later versions).
+        /// that will be carbon copied (comma is the preferred delimiter).
         /// </summary>
         /// <value>
         /// <para>
-        /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
-        /// </para>
-        /// <para>
-        /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
-        /// </para>
+        /// A comma- or semicolon-delimited list of e-mail addresses.
+	/// </para>
         /// </value>
-        /// <remarks>
-        /// <para>
-        /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
-        /// </para>
-        /// <para>
-        /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
-        /// </para>
-        /// </remarks>
         public string Cc
         {
             get { return m_cc; }
@@ -140,13 +111,8 @@
         /// that will be blind carbon copied.
         /// </summary>
         /// <value>
-        /// A semicolon-delimited list of e-mail addresses.
+        /// A comma- or semicolon-delimited list of e-mail addresses.
         /// </value>
-        /// <remarks>
-        /// <para>
-        /// A semicolon-delimited list of recipient e-mail addresses.
-        /// </para>
-        /// </remarks>
         public string Bcc
         {
             get { return m_bcc; }
@@ -229,7 +195,6 @@
 		/// The mode to use to authentication with the SMTP server
 		/// </summary>
 		/// <remarks>
-		/// <note type="caution">Authentication is only available on the MS .NET 1.1 runtime.</note>
 		/// <para>
 		/// Valid Authentication mode values are: <see cref="SmtpAuthentication.None"/>,
 		/// <see cref="SmtpAuthentication.Basic"/>, and <see cref="SmtpAuthentication.Ntlm"/>.
@@ -250,7 +215,6 @@
 		/// The username to use to authenticate with the SMTP server
 		/// </summary>
 		/// <remarks>
-		/// <note type="caution">Authentication is only available on the MS .NET 1.1 runtime.</note>
 		/// <para>
 		/// A <see cref="Username"/> and <see cref="Password"/> must be specified when
 		/// <see cref="Authentication"/> is set to <see cref="SmtpAuthentication.Basic"/>,
@@ -267,7 +231,6 @@
 		/// The password to use to authenticate with the SMTP server
 		/// </summary>
 		/// <remarks>
-		/// <note type="caution">Authentication is only available on the MS .NET 1.1 runtime.</note>
 		/// <para>
 		/// A <see cref="Username"/> and <see cref="Password"/> must be specified when
 		/// <see cref="Authentication"/> is set to <see cref="SmtpAuthentication.Basic"/>,
@@ -284,11 +247,9 @@
 		/// The port on which the SMTP server is listening
 		/// </summary>
 		/// <remarks>
-		/// <note type="caution">Server Port is only available on the MS .NET 1.1 runtime.</note>
 		/// <para>
 		/// The port on which the SMTP server is listening. The default
-		/// port is <c>25</c>. The Port can only be changed when running on
-		/// the MS .NET 1.1 runtime.
+		/// port is <c>25</c>.
 		/// </para>
 		/// </remarks>
 		public int Port
@@ -322,9 +283,6 @@
         /// <summary>
         /// Enable or disable use of SSL when sending e-mail message
         /// </summary>
-        /// <remarks>
-        /// This is available on MS .NET 2.0 runtime and higher
-        /// </remarks>
         public bool EnableSsl
         {
             get { return m_enableSsl; }
@@ -334,9 +292,6 @@
         /// <summary>
         /// Gets or sets the reply-to e-mail address.
         /// </summary>
-        /// <remarks>
-        /// This is available on MS .NET 2.0 runtime and higher
-        /// </remarks>
         public string ReplyTo
         {
             get { return m_replyTo; }
@@ -437,10 +392,6 @@
 		/// <param name="messageBody">the body text to include in the mail</param>
 		virtual protected void SendEmail(string messageBody)
 		{
-			// .NET 2.0 has a new API for SMTP email System.Net.Mail
-			// This API supports credentials and multiple hosts correctly.
-			// The old API is deprecated.
-
 			// Create and configure the smtp client
 			SmtpClient smtpClient = new SmtpClient();
 			if (!String.IsNullOrEmpty(m_smtpHost))
@@ -490,8 +441,7 @@
 				mailMessage.SubjectEncoding = m_subjectEncoding;
                 mailMessage.Priority = m_mailPriority;

-                // TODO: Consider using SendAsync to send the message without blocking. This would be a change in
-                // behaviour compared to .NET 1.x. We would need a SendCompletedCallback to log errors.
+                // TODO: Consider using SendAsync to send the message without blocking. We would need a SendCompletedCallback to log errors.
                 smtpClient.Send(mailMessage);
             }
 		}


made sample size configurable with fixed buffer size

--- src/mindtouch.dream/Text/CharacterEncodingDetector.cs
+++ src/mindtouch.dream/Text/CharacterEncodingDetector.cs
@@ -19,6 +19,7 @@
  * limitations under the License.
  */

+using System;
 using System.IO;
 using System.Text;
 using MindTouch.Text.CharDet;
@@ -27,18 +28,43 @@
     public class CharacterEncodingDetector : IEncodingDetector {

         //--- Constants ---
+        private const int DEFAULT_MAX_SAMPLE_SIZE = 1024;
         private const int BUFFER_SIZE = 1024;
+
+        //--- Fields ---
+        private readonly int _maxSampleSize;
+
+        //--- Constructors ---
+        public CharacterEncodingDetector() : this(DEFAULT_MAX_SAMPLE_SIZE) { }
+
+        public CharacterEncodingDetector(int maxSampleSize) {
+            _maxSampleSize = maxSampleSize;
+        }

         //--- Methods ---
         public Encoding Detect(Stream stream) {
+            var buffer = new byte[BUFFER_SIZE];
+            var detector = new Detector(Language.ALL);
             long position = stream.Position;
-            var buffer = new byte[BUFFER_SIZE];
-            int read = stream.Read(buffer, 0, buffer.Length);
+
+            // process stream until we have a result or have exhausted the sample size
+            var remainingSampleSize = _maxSampleSize;
+            while((remainingSampleSize > 0) && (detector.Result == null)) {
+                int read = stream.Read(buffer, 0, Math.Min(remainingSampleSize, buffer.Length));
+
+                // check if we reached the end of the stream
+                if(read == 0) {
+                    break;
+                }
+                remainingSampleSize -= read;
+
+                // feed sample to character encoding detector
+                detector.HandleData(buffer, read);
+            }
+            detector.DataEnd();
+
+            // restore stream position and return the detector's result
             stream.Position = position;
-
-            var detector = new Detector(Language.ALL);
-            detector.HandleData(buffer, read);
-            detector.DataEnd();
             return detector.Result;
         }
     }


(GH-2120) pushing nuget to GitHub Packages

--- build/utils/credentials.cake
+++ build/utils/credentials.cake
@@ -32,6 +32,7 @@

     public GitHubCredentials(string userName, string token)
     {
+        UserName = userName;
         Token = token;
     }


Changed ReadCategoryFromAsync to return a SyndicationCategory

--- src/Atom10FeedFormatter.cs
+++ src/Atom10FeedFormatter.cs
@@ -144,7 +144,7 @@
             await writer.WriteEndElementAsync();
         }

-        internal static async Task ReadCategoryAsync(XmlReaderWrapper reader, SyndicationCategory category, string version, bool preserveAttributeExtensions, bool preserveElementExtensions, int _maxExtensionSize)
+        internal static async Task<SyndicationCategory> ReadCategoryAsync(XmlReaderWrapper reader, SyndicationCategory category, string version, bool preserveAttributeExtensions, bool preserveElementExtensions, int _maxExtensionSize)
         {
             await MoveToStartElementAsync(reader);
             bool isEmpty = reader.IsEmptyElement;
@@ -242,6 +242,8 @@
             {
                 await reader.ReadStartElementAsync();
             }
+
+            return category;
         }

         internal Task<TextSyndicationContent> ReadTextContentFromAsync(XmlReaderWrapper reader, string context, bool preserveAttributeExtensions)
@@ -721,17 +723,16 @@
             return new DateTimeOffset();
         }

-        private Task ReadCategoryAsync(XmlReaderWrapper reader, SyndicationCategory category)
+        private Task<SyndicationCategory> ReadCategoryAsync(XmlReaderWrapper reader, SyndicationCategory category)
         {
              return ReadCategoryAsync(reader, category, this.Version, this.PreserveAttributeExtensions, this.PreserveElementExtensions, _maxExtensionSize);
         }

-        private async Task<SyndicationCategory> ReadCategoryFromAsync(XmlReaderWrapper reader, SyndicationFeed feed)
+        private Task<SyndicationCategory> ReadCategoryFromAsync(XmlReaderWrapper reader, SyndicationFeed feed)

         {
             SyndicationCategory result = CreateCategory(feed);
-            await ReadCategoryAsync(reader, result);
-            return result;
+            return ReadCategoryAsync(reader, result);
         }

         private async Task<SyndicationCategory> ReadCategoryFromAsync(XmlReaderWrapper reader, SyndicationItem item)


Update DataTableExtensions.cs

Update DataTableExtensions.cs

--- src/DataTableExtensions.cs
+++ src/DataTableExtensions.cs
@@ -122,7 +122,7 @@
 				return @"null";

 			Func<bool, string> toBoolString = b => b ? @"1" : @"0";
-			Func<DateTime, string> toDateString = d => d.ToISO8601String(false, false).Substring(0, @"yyyy-MM-ddTHH:mm:ss.fff".Length);
+			Func<DateTime, string> toDateString = d => d.ToISO8601String(false).Substring(0, @"yyyy-MM-ddTHH:mm:ss.fff".Length);

 			if (value is DateTime)
 				return toDateString((DateTime)value);


Update DataTableExtensions.cs

Update DataTableExtensions.cs

+ improvements to TableToSQLInsert method to use a TextWriter rather than holding the string in memory
+ created method ConvertFromString for determining the type of all values in a DataColumn and changing it, refactoring (ConvertValueFromString)

--- src/DataTableExtensions.cs
+++ src/DataTableExtensions.cs
@@ -20,8 +20,9 @@
 		/// <param name="path">The path to the CSV file.</param>
 		/// <param name="separator">The field separator used in the CSV file.</param>
 		/// <param name="containsHeaders">Specifies whether the CSV file contains a header row or not, which will be used to set the DataTable column headings.</param>
+		/// <param name="inferTypes">Specifies whether to attempt to determine the type of each column based on it's contents.  Supports dates and numbers.</param>
 		/// <returns>A <see cref="System.Data.DataTable"/> representing the contents of the CSV file.</returns>
-		public static DataTable CSVToDataTable(string path, string separator = null, bool containsHeaders = true)
+		public static DataTable CSVToDataTable(string path, string separator = null, bool containsHeaders = true, bool inferTypes = false)
 		{
 			var csv = OpenCSV(path, separator).ToList();
 			var dt = new DataTable(path);
@@ -31,6 +32,11 @@
 			foreach (var values in (containsHeaders ? csv.Skip(1) : csv))
 				dt.Rows.Add(values);
 			dt.EndLoadData();
+
+			if (inferTypes) {
+				for (var col = 0; col < dt.Columns.Count; col ++)
+					dt.Columns[col].ConvertFromString();
+			}
 			return dt;
 		}

@@ -126,9 +132,10 @@
 		public static void ConvertToCSV(this DataTable table, TextWriter writer, string separator = "\t")
 		{
 			var lines = table.Rows.OfType<DataRow>().Select(row => string.Join(separator,
-				table.Columns.OfType<DataColumn>().Select(c =>
-					GetValueForCSV(row[c], separator, true)
-				)));
+				table.Columns.OfType<DataColumn>().Select(col =>
+					GetValueForCSV(row[col], separator)
+				)
+			));

 			writer.WriteLine(string.Join(separator,
 				table.Columns.OfType<DataColumn>().Select(c => c.Caption)));
@@ -139,10 +146,10 @@
 			writer.Flush();
 		}

-		public static string GetValueForCSV(object value, string separator, bool tryConvertFromString)
+		public static string GetValueForCSV(object value, string separator)
 		{
 			const string quote = "\"";
-			return GetValueBase(value, string.Empty, string.Empty, tryConvertFromString, s => {
+			return GetValueBase(value, string.Empty, string.Empty, s => {
 				s = s.Replace(Environment.NewLine, " ").Replace("\r", " ").Replace("\n", " "); // remove line breaks, replace with spaces
 				s = s.Replace(quote, @"\" + quote); // replace quotes with a backslash and then a quote
 				return s.IndexOf(separator, StringComparison.InvariantCultureIgnoreCase) > -1 ? (quote + s + quote) : s;
@@ -150,19 +157,59 @@
 		}
 		#endregion

-		internal static string GetValueBase(object value, string nullSubstitution, string byteArrayPrefix, bool tryConvertFromString, Func<string, string> escapeIfNecessary) {
+		internal static object ConvertValueFromString(string value) {
+			decimal valAsDecimal;
+			if (!(value.StartsWith(@"0") && value.Length > 1) // ignore it if it starts with 0
+				&& decimal.TryParse(value, out valAsDecimal)) // check if it is a valid number, use decimal as it keeps the formatting / precision
+				return valAsDecimal;
+			DateTime valAsDate;
+			if (DateTime.TryParse(value, out valAsDate))
+				return valAsDate;
+			if (value.Equals(bool.FalseString, StringComparison.InvariantCultureIgnoreCase) || value.Equals(bool.TrueString, StringComparison.InvariantCultureIgnoreCase))
+				return bool.Parse(value);
+			return value;
+		}
+
+		// infer the data type if same for all values in a column
+		public static void ConvertFromString (this DataColumn column) {
+			if (! column.DataType.Equals(typeof(string)))
+				throw new ArgumentException("Column DataType is not String", "column");
+
+			var rows = column.Table.Rows.OfType<DataRow>().Select(row => ConvertValueFromString((string)row[column]));
+			var items = new List<object>(column.Table.Rows.Count);
+			foreach (var row in rows) {
+				if (items.Any() && !row.GetType().Equals(items.First().GetType())) { // data type of all items don't match
+					items = null;
+					break;
+				}
+				items.Add(row);
+			}
+			if (items != null && items.Any()) {
+				var ordinal = column.Ordinal;
+				var table = column.Table;
+				table.BeginLoadData();
+
+				var newType = items.First().GetType();
+				if (newType.Equals(typeof(decimal)))
+					if (! items.Any(value => (decimal)value > int.MaxValue || value.ToString().Contains(@".")))
+						newType = typeof(int);
+
+				var newColumn = new DataColumn(column.ColumnName, newType);
+				table.Columns.Remove(column);
+
+				table.Columns.Add(newColumn);
+				newColumn.SetOrdinal(ordinal);
+
+				foreach (var row in table.Rows.OfType<DataRow>().Zip(items, (dr, newValue) => Tuple.Create(dr, newValue)))
+					row.Item1[newColumn] = row.Item2;
+
+				table.EndLoadData();
+			}
+		}
+
+		internal static string GetValueBase(object value, string nullSubstitution, string byteArrayPrefix, Func<string, string> escapeIfNecessary) {
 			if (value == null)
-				return nullSubstitution; // the null substitution never needs escaping
-
-			if (tryConvertFromString && value is string)
-			{
-				string valAsString = (string)value;
-				DateTime valAsDate;
-				if (DateTime.TryParse(valAsString, out valAsDate))
-					value = valAsDate;
-				if (valAsString.Equals(bool.FalseString, StringComparison.InvariantCultureIgnoreCase) || valAsString.Equals(bool.TrueString, StringComparison.InvariantCultureIgnoreCase))
-					value = bool.Parse(valAsString);
-			}
+				return nullSubstitution;

 			Func<bool, string> toBoolString = b => escapeIfNecessary(b ? @"1" : @"0");
 			Func<DateTime, string> toDateString = d => escapeIfNecessary(d.ToSortableDateTime());
@@ -171,42 +218,91 @@
 				return toDateString((DateTime)value);
 			if (value is bool)
 				return toBoolString((bool)value);
-			if (value is System.Byte[])
-				return escapeIfNecessary((byteArrayPrefix ?? string.Empty) + (new SoapHexBinary(value as System.Byte[]).ToString()));
+			if (value is Byte[])
+				return escapeIfNecessary(byteArrayPrefix ?? string.Empty + (new SoapHexBinary(value as Byte[]).ToString()));
+			if (value is string)
+				return escapeIfNecessary((string)value);

 			return escapeIfNecessary(value.ToString());
 		}

 		#region SQL
-		public static string TableToSQLInsert(this DataTable dt, string tableName, bool createTable)
-		{
-			var sql = "insert into " + tableName + " (" +
-				string.Join(", ", dt.Columns.OfType<DataColumn>().Select(
-					col => "[" + col.ColumnName + "]"
-				)) + ") values\r\n";
-			sql += " (" + string.Join(")\r\n,(", dt.Rows.OfType<DataRow>().Select(
-				row => string.Join(", ", dt.Columns.OfType<DataColumn>().Select(
-					col => GetValueForSQL(row[col], true)
-				)))
-			) + ")";
-
+		public static void TableToSQLInsert(this DataTable dt, string tableName, bool createTable, TextWriter writer)
+		{
 			if (createTable)
 			{
-				// TODO: more efficient way of doing this that doesn't involve calling GetValueForSQL again for each cell, plus to see if the inferred data types for all values in a column are the same, and to use it - i.e. DateTime
-				sql = (tableName.StartsWith("@") ? "DECLARE " : "CREATE TABLE ") + tableName + (tableName.StartsWith("@") ? " TABLE " : string.Empty) + " (" + string.Join(
-					", ",
-					dt.Columns.OfType<DataColumn>().Select(dc => "[" + dc.ColumnName + "] NVARCHAR(" + dt.Rows.OfType<DataRow>().Max(dr => GetValueForSQL(dr[dc], true).Length).ToString() + ")")
-					) + ")\r\n" + sql;
-			}
-
-			return sql;
-		}
-
-		public static string GetValueForSQL(object value, bool tryConvertFromString)
-		{
-			return GetValueBase(value, @"null", @"0x", tryConvertFromString, s => {
-				float valAsFloat;
-				if (!s.StartsWith(@"0") && float.TryParse(s, out valAsFloat)) // check if it is a valid number
+				Func<DataColumn, string> ColumnDataTypeToSQL = col => {
+					var underlyingType = Nullable.GetUnderlyingType(col.DataType);
+					var rows = col.Table.Rows.OfType<DataRow>();
+					var nullable = (underlyingType != null) || col.AllowDBNull || rows.Any(row => row[col] == null);
+
+					Func<Func<object, int>, string> getMaxLength = getLength => {
+						var max = 1;
+						if (rows.Any())
+							max = Math.Max(max, rows.Where(dr => dr[col] != null).Max(dr => getLength(dr[col])));
+						return @"(" + max.ToString() + @")";
+					};
+
+					string sql;
+					sql = ((underlyingType ?? col.DataType).Name.ToLowerInvariant());
+					switch (sql) {
+						case "byte[]":
+							sql = @"varbinary" + getMaxLength(obj => ((byte[])obj).Length);
+							break;
+						case "guid":
+							sql = @"uniqueidentifier";
+							break;
+						case "int32":
+							sql = @"int";
+							break;
+						case "int64":
+							sql = @"bigint";
+							break;
+						case "boolean":
+							sql = @"bit";
+							break;
+						case "string":
+							sql = @"nvarchar" + getMaxLength(obj => ((string)obj).Length);
+							break;
+					}
+					sql += ((nullable) ? string.Empty : @" not") + @" null";
+					return sql;
+				};
+				const string tableVariableChar = @"@";
+				writer.WriteLine((tableName.StartsWith(tableVariableChar) ? @"DECLARE " : @"CREATE TABLE ") + tableName + (tableName.StartsWith(tableVariableChar) ? @" TABLE " : string.Empty) + @" (" +
+					string.Join(
+						@", ",
+						dt.Columns.OfType<DataColumn>().Select(col => @"[" + col.ColumnName + @"] " + ColumnDataTypeToSQL(col))
+					) + @")"
+				);
+			}
+
+			writer.WriteLine(@"insert into " + tableName + @" (" +
+				string.Join(@", ", dt.Columns.OfType<DataColumn>().Select(
+					col => @"[" + col.ColumnName + @"]"
+				)) + @") values");
+
+			var lines = dt.Rows.OfType<DataRow>().Select(
+				row => @"(" + string.Join(@", ", dt.Columns.OfType<DataColumn>().Select(
+					col => GetValueForSQL(row[col])
+				)) + @")");
+
+			bool first = true;
+			foreach (var line in lines) {
+				if (first) {
+					first = false;
+					writer.Write(@" ");
+				} else
+					writer.Write(@",");
+				writer.WriteLine(line);
+			}
+			writer.Flush();
+		}
+
+		public static string GetValueForSQL(object value)
+		{
+			return GetValueBase(value, @"null", @"0x", s => {
+				if (value is decimal || value is int || value is long || value is float) // if it is a numeric type, no need to escape it
 					return s;
 				else
 					return @"'" + s.Replace(@"'", @"''") + @"'"; // escape the value


add main menu

add main menu

--- src/ExampleMenu/Program.cs
+++ src/ExampleMenu/Program.cs
@@ -17,12 +17,20 @@
 		{
 			Console.WriteLine ("Simple CMenu demonstration");

+			var mainmenu = new CMenu ();
+			mainmenu.Add ("tutorial", s => Tutorial ());
+			mainmenu.Add ("examples", s => Examples ());
+			mainmenu.Input ("help");
+			mainmenu.Run ();
+		}
+
+		static void Tutorial ()
+		{
 			Basics ();
 			CaseSensitivity ();
 			InputModification ();
 			InnerCommands ();
 			NestedCommands ();
-			Examples ();
 		}

 		static void Basics ()
@@ -122,17 +130,24 @@

 		static void Examples ()
 		{
-			menu.Add (new MI_Echo ());
-			menu.Add (new MI_If (menu));
-			menu.Add (new MI_Pause ());
+			var m = new CMenu ();
+
+			m.Add (new MI_Add ());
+
+			m.Add (new MI_Echo ());
+			m.Add (new MI_If (m));
+			m.Add (new MI_Pause ());

 			var frs = new FileRecordStore ();
-			menu.Add (new MI_Record (frs));
-			menu.Add (new MI_Replay (menu, frs));
+			m.Add (new MI_Record (frs));
+			m.Add (new MI_Replay (m, frs));

-			Console.WriteLine ("Several example commands were added to the menu.");
-			menu.Input ("help");
-			menu.Run ();
+			m.Add (new MI_Proc ());
+			m.Add (new MI_Call (m));
+			m.Add (new MI_Return (m));
+
+			m.Input ("help");
+			m.Run ();
 		}
 	}
 }


Add code to be better about dumping status

--- wsl-bash-wrapper/Program.cs
+++ wsl-bash-wrapper/Program.cs
@@ -5,44 +5,54 @@
 namespace BashWrapper {
 	class Program {
 		static void Main( string[] args ) {
-			var tmp_win_path = Path.GetTempFileName();
-			var tmp_wsl_path = ConvertPathToWSL( tmp_win_path );
+            try
+            {
+                var tmp_win_path = Path.GetTempFileName();
+                var tmp_wsl_path = ConvertPathToWSL(tmp_win_path);

-			var p = new Process();
+                var p = new Process();

-			var p_args = "";
-			bool first = true;
-			foreach( var t in args ) {
-				var a = t;
-				if( !first )
-					p_args += " ";
+                var p_args = "";
+                bool first = true;
+                foreach (var t in args)
+                {
+                    var a = t;
+                    if (!first)
+                        p_args += " ";

-				if( a.Contains( " " ) )
-					a = "\"" + a + "\"";
+                    if (a.Contains(" "))
+                        a = "\"" + a + "\"";

-				p_args += a;
-				first = false;
-			}
+                    p_args += a;
+                    first = false;
+                }

-			p.StartInfo.FileName = FindBash();
-			p.StartInfo.Arguments = p_args + " > " + tmp_wsl_path;
+                p.StartInfo.FileName = FindBash();
+                p.StartInfo.Arguments = p_args + " > " + tmp_wsl_path;

-			p.StartInfo.WorkingDirectory = ConvertPathToWSL( Directory.GetCurrentDirectory() );
-			p.StartInfo.LoadUserProfile = true;
+                p.StartInfo.WorkingDirectory = ConvertPathToWSL(Directory.GetCurrentDirectory());
+                p.StartInfo.LoadUserProfile = true;

-			p.Start();
-			p.WaitForExit();
+                p.Start();
+                p.WaitForExit();

-			var ret = p.ExitCode;
-			var sr = new StreamReader( tmp_win_path );
+                var ret = p.ExitCode;
+                var sr = new StreamReader(tmp_win_path);

-			while( !sr.EndOfStream )
-				Console.WriteLine( sr.ReadLine() );
+                while (!sr.EndOfStream)
+                    Console.WriteLine(sr.ReadLine());

-			sr.Close();
-			File.Delete( tmp_win_path );
+                sr.Close();
+                File.Delete(tmp_win_path);

-			Environment.Exit( ret );
+                Console.WriteLine($"Return code from cash: {ret}.");
+
+                Environment.Exit(ret);
+            } catch (Exception e)
+            {
+                Console.WriteLine($"Failed to run bash with error code: {e.Message}");
+                throw;
+            }
 		}

 		static string FindBash() {


[mscorlib] Hide ComImportAttribute from MT

--- mscorlib/system/runtime/interopservices/attributes.cs
+++ mscorlib/system/runtime/interopservices/attributes.cs
@@ -666,7 +666,10 @@
 #endif
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
     [System.Runtime.InteropServices.ComVisible(true)]
-    public sealed class ComImportAttribute : Attribute
+#if !MONOTOUCH
+    public
+#endif
+    sealed class ComImportAttribute : Attribute
     {
         internal static Attribute GetCustomAttribute(RuntimeType type)
         {


remove the cached data once it has been taken from the cache

--- qXL/src/qXLAddIn.cs
+++ qXL/src/qXLAddIn.cs
@@ -184,6 +184,7 @@
                 if (MemoryCache.Default.Contains(key))
                 {
                     r = MemoryCache.Default[key] as object[,];
+                    MemoryCache.Default.Remove(key);
                 }
                 else
                 {
@@ -193,7 +194,7 @@
                     if (!(result is object[,])) return result;

                     r = result as object[,];
-                    MemoryCache.Default.Add(key, r, DateTimeOffset.Now.AddSeconds(15));
+                    MemoryCache.Default.Add(key, r, DateTimeOffset.Now.AddSeconds(30));
                 }
                 return ArrayResizer.Resize(r);
             }


CI fixes

CI fixes

--- osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs
+++ osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs
@@ -1,7 +1,6 @@
 // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
 // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

-using System;
 using System.Collections.Generic;
 using System.Linq;
 using osu.Game.Beatmaps;


Check for attachments not at their offset position, but at the avatar's position so that they get sent with the avatar.

--- OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -146,8 +146,21 @@
                 if (m_cachedYOffset > scene.RegionInfo.RegionSizeY)
                     posToCheckFrom.Y = scene.RegionInfo.RegionSizeY - (scene.RegionInfo.RegionSizeY - (client.AbsolutePosition.Y + m_cachedYOffset));
             }
+            Vector3 entityPosToCheckFrom = entity.AbsolutePosition;
+            if (entity is ISceneEntity)
+            {
+                //We need to check whether this object is an attachment, and if so, set it so that we check from the avatar's
+                // position, rather than from the offset of the attachment
+                ISceneEntity sEntity = (ISceneEntity)entity;
+                if (sEntity.IsAttachment)
+                {
+                    IScenePresence attachedAvatar = sEntity.Scene.GetScenePresence (sEntity.RootChild.AttachedAvatar);
+                    if (attachedAvatar != null)
+                        entityPosToCheckFrom = attachedAvatar.AbsolutePosition;
+                }
+            }
             //If the distance is greater than the clients draw distance, its out of range
-            if (Vector3.DistanceSquared (posToCheckFrom, entity.AbsolutePosition) >
+            if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom) >
                 DD * DD) //Use squares to make it faster than having to do the sqrt
             {
                 ISceneEntity childEntity = (entity as ISceneEntity);


removed person from summary

removed person from summary

--- Digipost.Api.Client.Domain/Identification.cs
+++ Digipost.Api.Client.Domain/Identification.cs
@@ -15,7 +15,7 @@
     {

         /// <summary>
-        ///     Identify if person is in Digipost by Digipost-address, organisation number or Social Security Number (SSN).
+        ///     Identify if recipient exists in Digipost by Digipost-address, organisation number or Social Security Number (SSN).
         /// </summary>
         public Identification(IdentificationChoice identificationChoice, string value)
         {
@@ -29,7 +29,7 @@
         }

         /// <summary>
-        ///     Identify if person is in Digipost by name and address.
+        ///     Identify if recipient exists in Digipost by name and address.
         /// </summary>
         public Identification(IdentificationChoice identificationChoice, RecipientByNameAndAddress recipientByNameAndAddress)
         {
@@ -39,7 +39,7 @@
         }

         /// <summary>
-        ///     Identify if person is in Digipost by name and address.
+        ///     Identify if recipient exists in Digipost by name and address.
         /// </summary>
         public Identification(RecipientByNameAndAddress recipientByNameAndAddress)
         {


Apply http://opensimulator.org/mantis/view.php?id=4066 If XEngine compile fails, show script name in error message in-world as well as the exception itself Thanks Luca Peck

--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -642,7 +642,7 @@
                     m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();

                     m_ScriptFailCount++;
-                    string text = "Error compiling script:\n" + e.Message.ToString();
+                    string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
                     if (text.Length > 1000)
                         text = text.Substring(0, 1000);
                     World.SimChat(Utils.StringToBytes(text),


Extend scripts show command to accept a single item UUID parameter to display one script's status

Usage is now scripts show [<script-item-uuid>]

--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -273,11 +273,13 @@
             }

             MainConsole.Instance.Commands.AddCommand(
-                "scripts", false, "scripts show", "scripts show", "Show script information",
-                "Show information on all scripts known to the script engine", HandleShowScripts);
+                "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
+                "Show information on all scripts known to the script engine."
+                    + "If a <script-item-uuid> is given then only information on that script will be shown.",
+                HandleShowScripts);

             MainConsole.Instance.Commands.AddCommand(
-                "scripts", false, "show scripts", "show scripts", "Show script information",
+                "scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information",
                 "Synonym for scripts show command", HandleShowScripts);

             MainConsole.Instance.Commands.AddCommand(
@@ -308,43 +310,6 @@
                 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
         }

-        public void HandleShowScripts(string module, string[] cmdparams)
-        {
-            lock (m_Scripts)
-            {
-                MainConsole.Instance.OutputFormat(
-                    "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName);
-
-                foreach (IScriptInstance instance in m_Scripts.Values)
-                {
-                    SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
-                    string status;
-
-                    if (instance.ShuttingDown)
-                    {
-                        status = "shutting down";
-                    }
-                    else if (instance.Suspended)
-                    {
-                        status = "suspended";
-                    }
-                    else if (!instance.Running)
-                    {
-                        status = "stopped";
-                    }
-                    else
-                    {
-                        status = "running";
-                    }
-
-                    MainConsole.Instance.OutputFormat(
-                        "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})",
-                        instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID,
-                        sop.AbsolutePosition, status);
-                }
-            }
-        }
-
         /// <summary>
         /// Parse the raw item id into a script instance from the command params if it's present.
         /// </summary>
@@ -392,6 +357,48 @@
                     }
                 }
             }
+        }
+
+        public void HandleShowScripts(string module, string[] cmdparams)
+        {
+            if (cmdparams.Length == 2)
+            {
+                lock (m_Scripts)
+                {
+                    MainConsole.Instance.OutputFormat(
+                        "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName);
+                }
+            }
+
+            HandleScriptsAction(cmdparams, HandleShowScript);
+        }
+
+        private void HandleShowScript(IScriptInstance instance)
+        {
+            SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
+            string status;
+
+            if (instance.ShuttingDown)
+            {
+                status = "shutting down";
+            }
+            else if (instance.Suspended)
+            {
+                status = "suspended";
+            }
+            else if (!instance.Running)
+            {
+                status = "stopped";
+            }
+            else
+            {
+                status = "running";
+            }
+
+            MainConsole.Instance.OutputFormat(
+                "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})",
+                instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID,
+                sop.AbsolutePosition, status);
         }

         private void HandleSuspendScript(IScriptInstance instance)


minor: improve logged error in XEngine.SetXmlState if there was a problem writing the linemap.

The previous error report of already exists is inaccurate since existing files do get overwritten.

--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -2155,7 +2155,8 @@
                     catch (IOException ex)
                     {
                         // if there already exists a file at that location, it may be locked.
-                        m_log.ErrorFormat("[XEngine]: Linemap file {0} already exists! {1}", mappath, ex.Message);
+                        m_log.Error(
+                            string.Format("[XEngine]: Linemap file {0} could not be written.  Exception  ", mappath), ex);
                     }
                 }
             }


Fix comment

Fix comment

--- Optimization/CompoundingAnnualReturnFitness.cs
+++ Optimization/CompoundingAnnualReturnFitness.cs
@@ -14,7 +14,7 @@

         double scale = 0.01;

-        //Fitness based on total trades
+        //Fitness based on Compounding Annual Return
         protected override FitnessResult CalculateFitness(Dictionary<string, string> result)
         {
             this.Name = "Return";


TODO comments

TODO comments

--- PART/Source/Core/Engine/DataProviderManager.cs
+++ PART/Source/Core/Engine/DataProviderManager.cs
@@ -241,6 +241,7 @@
             //We put a row into the DataProviderCall table
             using (var dataContext = new CprBroker.Data.Applications.ApplicationDataContext())
             {
+                // TODO: Shall we get the ActivityID from BrokerContext.ActivityID?
                 Guid activityID = System.Guid.NewGuid();
                 var call = new CprBroker.Data.Applications.DataProviderCall
                     {


git-svn-id: http://code.wesay.org/Palaso/trunk/Palaso@1082 b25276a9-ce15-0410-9281-991c76e3d784

committer: hatton <3c620416bc545d8a9753d4db847e5544071ce657@b25276a9-ce15-0410-9281-991c76e3d784>

--- Palaso.Tests/Progress/Commands/CommandTests.cs
+++ Palaso.Tests/Progress/Commands/CommandTests.cs
@@ -81,7 +81,7 @@
 			//no: it doesn't do this            Assert.IsTrue(cmd.Enabled);

 			//todo: I can't see a way to know that it ended, if you cancel it.
-			//finish isn't called. Should it be?
+			//finish isn't called. Should it be ?
 		}

 		private void OnBeginCancel(object sender, EventArgs e)


Make thumbprint comparison in PrivateKeyJwtSecretValidator consistent with X509CertificateThumbprintSecretValidator

--- source/Core/Validation/PrivateKeyJwtSecretValidator.cs
+++ source/Core/Validation/PrivateKeyJwtSecretValidator.cs
@@ -20,6 +20,7 @@
 using System.Linq;
 using System.Security.Cryptography.X509Certificates;
 using System.Threading.Tasks;
+using IdentityModel;
 using IdentityServer3.Core.Configuration;
 using IdentityServer3.Core.Extensions;
 using IdentityServer3.Core.Logging;
@@ -133,7 +134,10 @@
         {
             SecurityKey securityKey = null;
             var certificate = new JwtSecurityToken(jwtTokenString).GetCertificateFromToken();
-            if (certificate != null && secrets.Any(s => !s.Expiration.HasValue && s.Value == certificate.Thumbprint))
+            if (certificate != null
+                && certificate.Thumbprint != null
+                && secrets.Any(s => !s.Expiration.HasValue
+                                    && TimeConstantComparer.IsEqual(s.Value.ToLowerInvariant(), certificate.Thumbprint.ToLowerInvariant())))
             {
                 securityKey = new X509SecurityKey(certificate);
             }


Updating the diff options was not working in the case of a generalized diff, due to a wrong query parameter name.

git-svn-id: f68c6b3b1dcd5d00a2560c384475aaef3bc99487@2946 af82e41b-90c4-0310-8c96-b1721e28e2e2

--- templates/changeset.cs
+++ templates/changeset.cs
@@ -77,7 +77,7 @@
  <div><?cs
   if:!changeset.chgset ?>
    <input type="hidden" name="old_path" value="<?cs var:changeset.old_path ?>" />
-   <input type="hidden" name="path" value="<?cs var:changeset.new_path ?>" />
+   <input type="hidden" name="new_path" value="<?cs var:changeset.new_path ?>" />
    <input type="hidden" name="old" value="<?cs var:changeset.old_rev ?>" />
    <input type="hidden" name="new" value="<?cs var:changeset.new_rev ?>" /><?cs
   /if ?>


Removed a useless null check in ProtocolCodecFilter


Moved lamda compilation to the outer scope. No need to compile it every time we execute the rule.


Added summary to GetRolesInOrganizationUnit

--- src/Abp.ZeroCore/Authorization/Roles/AbpRoleManager.cs
+++ src/Abp.ZeroCore/Authorization/Roles/AbpRoleManager.cs
@@ -404,23 +404,29 @@
             return IdentityResult.Success;
         }

+        /// <summary>
+        /// Gets roles of a given organizationUnit
+        /// </summary>
+        /// <param name="organizationUnit">OrganizationUnit to get belonging roles </param>
+        /// <param name="includeChildren">Includes roles for children organization units to result when true. Default is false</param>
+        /// <returns></returns>
         [UnitOfWork]
         public virtual Task<List<TRole>> GetRolesInOrganizationUnit(OrganizationUnit organizationUnit, bool includeChildren = false)
         {
             if (!includeChildren)
             {
-                var query = from uor in _organizationUnitRoleRepository.GetAll()
-                    join role in Roles on uor.RoleId equals role.Id
-                    where uor.OrganizationUnitId == organizationUnit.Id
+                var query = from organizationUnitRole in _organizationUnitRoleRepository.GetAll()
+                    join role in Roles on organizationUnitRole.RoleId equals role.Id
+                    where organizationUnitRole.OrganizationUnitId == organizationUnit.Id
                     select role;

                 return Task.FromResult(query.ToList());
             }
             else
             {
-                var query = from uor in _organizationUnitRoleRepository.GetAll()
-                    join role in Roles on uor.RoleId equals role.Id
-                    join ou in _organizationUnitRepository.GetAll() on uor.OrganizationUnitId equals ou.Id
+                var query = from organizationUnitRole in _organizationUnitRoleRepository.GetAll()
+                    join role in Roles on organizationUnitRole.RoleId equals role.Id
+                    join ou in _organizationUnitRepository.GetAll() on organizationUnitRole.OrganizationUnitId equals ou.Id
                     where ou.Code.StartsWith(organizationUnit.Code)
                     select role;


Fix beer pour stop bug and pour amout bug


rename

rename

--- src/Advanced.Algorithms/Graph/Matching/HopcroftKarp.cs
+++ src/Advanced.Algorithms/Graph/Matching/HopcroftKarp.cs
@@ -43,20 +43,20 @@
             while (freeVerticesOnRight.Count > 0)
             {
                 var visited = new HashSet<T>();
-                var paths = new HashSet<MatchEdge<T>>();
+                var path = new HashSet<MatchEdge<T>>();

                 foreach (var vertex in freeVerticesOnRight)
                 {
-                    var path = dfs(graph,
+                    var currentPath = dfs(graph,
                       leftToRightMatchEdges, rightToLeftMatchEdges, vertex, default, visited, true);

-                    if (path != null)
-                    {
-                        union(paths, path);
-                    }
-                }
-
-                xor(matches, paths, leftToRightMatchEdges, rightToLeftMatchEdges);
+                    if (currentPath != null)
+                    {
+                        union(path, currentPath);
+                    }
+                }
+
+                xor(matches, path, leftToRightMatchEdges, rightToLeftMatchEdges);

                 freeVerticesOnRight = bfs(graph, partitions, leftToRightMatchEdges, rightToLeftMatchEdges);
             }


Fixed

Fixed


Remove useless buffer copies, degernate vertices, degenerate faces


Rename field name to be more accurate

Rename field name to be more accurate

--- Assets/MixedRealityToolkit-SDK/Features/Input/Handlers/DragAndDropHandler.cs
+++ Assets/MixedRealityToolkit-SDK/Features/Input/Handlers/DragAndDropHandler.cs
@@ -66,7 +66,7 @@

         private bool isDragging;
         private bool isDraggingEnabled = true;
-        private bool isDraggingWithHand;
+        private bool isDraggingWithSourcePose;

         // Used for moving with a pointer ray
         private float stickLength;
@@ -150,7 +150,7 @@
                     ? focusDetails.Point
                     : hostTransform.position;

-            isDraggingWithHand = currentPointer == MixedRealityToolkit.InputSystem.GazeProvider.GazePointer;
+            isDraggingWithSourcePose = currentPointer == MixedRealityToolkit.InputSystem.GazeProvider.GazePointer;

             StartDragging(initialDraggingPosition);
         }
@@ -226,7 +226,7 @@
                 hostRigidbody.isKinematic = true;
             }

-            if (isDraggingWithHand)
+            if (isDraggingWithSourcePose)
             {
                 Vector3 pivotPosition = HandPivotPosition;
                 objectReferenceDistance = Vector3.Magnitude(initialDraggingPosition - pivotPosition);
@@ -283,7 +283,7 @@
             Transform cameraTransform = CameraCache.Main.transform;
             Vector3 pivotPosition = Vector3.zero;

-            if (isDraggingWithHand)
+            if (isDraggingWithSourcePose)
             {
                 Vector3 inputPosition = eventData.InputData.Position;
                 pivotPosition = HandPivotPosition;


Forgotten to update base controller in last commit

--- Assets/MixedRealityToolkit/_Core/DataProviders/Controllers/BaseController.cs
+++ Assets/MixedRealityToolkit/_Core/DataProviders/Controllers/BaseController.cs
@@ -2,14 +2,18 @@
 // Licensed under the MIT License. See LICENSE in the project root for license information.

 using Microsoft.MixedReality.Toolkit.Core.Definitions.Devices;
+using Microsoft.MixedReality.Toolkit.Core.Definitions.InputSystem;
 using Microsoft.MixedReality.Toolkit.Core.Definitions.Utilities;
 using Microsoft.MixedReality.Toolkit.Core.Interfaces.DataProviders.Controllers;
 using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
 using Microsoft.MixedReality.Toolkit.Core.Services;
 using Microsoft.MixedReality.Toolkit.Core.Utilities.Gltf.Serialization;
 using System;
+using System.Runtime.CompilerServices;
 using System.Threading.Tasks;
 using UnityEngine;
+
+[assembly: InternalsVisibleTo("Microsoft.MixedReality.Toolkit.Core.DataProviders.Controllers.WindowsMixedReality")]

 namespace Microsoft.MixedReality.Toolkit.Core.DataProviders.Controllers
 {
@@ -91,6 +95,11 @@
         /// <param name="controllerType"></param>
         public bool SetupConfiguration(Type controllerType)
         {
+            if (controllerType == null)
+            {
+                throw new ArgumentException("controllerType cannot be null");
+            }
+
             // We can only enable controller profiles if mappings exist.
             var controllerMappings = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.ControllerMappingProfiles.MixedRealityControllerMappings;

@@ -105,8 +114,8 @@
                     controllerMappings[i].Handedness == ControllerHandedness &&
                     controllerMappings[i].Interactions.Length > 0)
                 {
-                    MixedRealityInteractionMapping[] profileInteractions = controllerMappings[i].Interactions;
-                    MixedRealityInteractionMapping[] newInteractions = new MixedRealityInteractionMapping[profileInteractions.Length];
+                    var profileInteractions = controllerMappings[i].Interactions;
+                    var newInteractions = new MixedRealityInteractionMapping[profileInteractions.Length];

                     for (int j = 0; j < profileInteractions.Length; j++)
                     {
@@ -115,7 +124,7 @@

                     AssignControllerMappings(controllerMappings[i].Interactions);
                     profileFound = true;
-
+
                     // If no controller mappings found, warn the user.  Does not stop the project from running.
                     if (Interactions == null || Interactions.Length < 1)
                     {
@@ -151,10 +160,7 @@
         /// Load the Interaction mappings for this controller from the configured Controller Mapping profile
         /// </summary>
         /// <param name="mappings">Configured mappings from a controller mapping profile</param>
-        public void AssignControllerMappings(MixedRealityInteractionMapping[] mappings)
-        {
-            Interactions = mappings;
-        }
+        public void AssignControllerMappings(MixedRealityInteractionMapping[] mappings) => Interactions = mappings;

         /// <summary>
         /// Attempts to load the controller model render settings from the <see cref="MixedRealityControllerVisualizationProfile"/>
@@ -163,21 +169,27 @@
         /// <param name="controllerType">The controller type.</param>
         /// <param name="glbData">The raw binary glb data of the controller model, typically loaded from the driver.</param>
         /// <returns>True, if controller model is being properly rendered.</returns>
-        internal async void TryRenderControllerModel(Type controllerType, byte[] glbData = null)
-        {
-            await TryRenderControllerModelAsync(controllerType, glbData);
-        }
+        internal async void TryRenderControllerModel(Type controllerType, byte[] glbData = null) => await TryRenderControllerModelAsync(controllerType, glbData);

         /// <summary>
         /// Attempts to load the controller model render settings from the <see cref="MixedRealityControllerVisualizationProfile"/>
         /// to render the controllers in the scene.
         /// </summary>
         /// <param name="controllerType">The controller type.</param>
+        /// <param name="useAlternatePoseAction">Should the visualizer be assigned the alternate pose actions?</param>
         /// <param name="glbData">The raw binary glb data of the controller model, typically loaded from the driver.</param>
+        internal async void TryRenderControllerModel(Type controllerType, bool useAlternatePoseAction, byte[] glbData = null) => await TryRenderControllerModelAsync(controllerType, glbData, useAlternatePoseAction);
+
+        /// <summary>
+        /// Attempts to load the controller model render settings from the <see cref="MixedRealityControllerVisualizationProfile"/>
+        /// to render the controllers in the scene.
+        /// </summary>
+        /// <param name="controllerType">The controller type.</param>
+        /// <param name="glbData">The raw binary glb data of the controller model, typically loaded from the driver.</param>
+        /// <param name="useAlternatePoseAction">Should the visualizer be assigned the alternate pose actions?</param>
         /// <returns>True, if controller model is being properly rendered.</returns>
-        internal async Task TryRenderControllerModelAsync(Type controllerType, byte[] glbData = null)
+        internal async Task TryRenderControllerModelAsync(Type controllerType, byte[] glbData = null, bool useAlternatePoseAction = false)
         {
-            Debug.Log("Attempting to render controller models...");
             var visualizationProfile = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.ControllerVisualizationProfile;

             if (visualizationProfile == null)
@@ -193,14 +205,12 @@
             // If a specific controller template wants to override the global model, assign that instead.
             if (!visualizationProfile.UseDefaultModels)
             {
-                Debug.Log("Getting the override models");
                 controllerModel = visualizationProfile.GetControllerModelOverride(controllerType, ControllerHandedness);
             }

             // Attempt to load the controller model from glbData.
             if (controllerModel == null && glbData != null)
             {
-                Debug.Log("Attempting to load glb data...");
                 var gltfObject = GltfUtility.GetGltfObjectFromGlb(glbData);
                 await gltfObject.ConstructAsync();
                 controllerModel = gltfObject.GameObjectReference;
@@ -211,31 +221,33 @@
                 if (Visualizer != null)
                 {
                     Visualizer.Controller = this;
+
+                    if (useAlternatePoseAction && visualizationProfile.TryGetControllerPoseOverride(controllerType, ControllerHandedness, out MixedRealityInputAction altPoseAction))
+                    {
+                        Visualizer.PoseAction = altPoseAction;
+                    }
                     return; // Nothing left to do;
                 }
-
-                Debug.LogError("Failed to load controller model from driver!");
             }

             // If we didn't get an override model, and we didn't load the driver model,
             // then get the global controller model for each hand.
             if (controllerModel == null)
             {
-                Debug.Log("Setting the fallback models");
-                if (ControllerHandedness == Handedness.Left && visualizationProfile.GlobalLeftHandModel != null)
-                {
-                    controllerModel = visualizationProfile.GlobalLeftHandModel;
-                }
-                else if (ControllerHandedness == Handedness.Right && visualizationProfile.GlobalRightHandModel != null)
-                {
-                    controllerModel = visualizationProfile.GlobalRightHandModel;
+                switch (ControllerHandedness)
+                {
+                    case Handedness.Left when visualizationProfile.GlobalLeftHandModel != null:
+                        controllerModel = visualizationProfile.GlobalLeftHandModel;
+                        break;
+                    case Handedness.Right when visualizationProfile.GlobalRightHandModel != null:
+                        controllerModel = visualizationProfile.GlobalRightHandModel;
+                        break;
                 }
             }

             // If we've got a controller model prefab, then place it in the scene.
             if (controllerModel != null)
             {
-                Debug.Log("Attempting to Instantiate Model Prefab...");
                 var controllerObject = UnityEngine.Object.Instantiate(controllerModel, MixedRealityToolkit.Instance.MixedRealityPlayspace);
                 controllerObject.name = $"{ControllerHandedness}_{controllerObject.name}";
                 Visualizer = controllerObject.GetComponent<IMixedRealityControllerVisualizer>();
@@ -243,6 +255,11 @@
                 if (Visualizer != null)
                 {
                     Visualizer.Controller = this;
+
+                    if (useAlternatePoseAction && visualizationProfile.TryGetControllerPoseOverride(controllerType, ControllerHandedness, out MixedRealityInputAction altPoseAction))
+                    {
+                        Visualizer.PoseAction = altPoseAction;
+                    }
                 }
                 else
                 {


< sign direction changed

< sign direction changed

--- CSharp/Homeworks/OperatorsExpressionsHW/Ex07PrimeNumbers/Ex07PrimeNumbers.cs
+++ CSharp/Homeworks/OperatorsExpressionsHW/Ex07PrimeNumbers/Ex07PrimeNumbers.cs
@@ -12,15 +12,15 @@
         static void Main(string[] args)
         {
             uint myInt = uint.Parse(Console.ReadLine());
-            bool isPrime = (myInt >= 2 ? true : myInt % 2 != 0) &&
-                (myInt >= 3 ? true : myInt % 3 != 0) &&
-                (myInt >= 4 ? true : myInt % 4 != 0) &&
-                (myInt >= 5 ? true : myInt % 5 != 0) &&
-                (myInt >= 6 ? true : myInt % 6 != 0) &&
-                (myInt >= 7 ? true : myInt % 7 != 0) &&
-                (myInt >= 8 ? true : myInt % 8 != 0) &&
-                (myInt >= 9 ? true : myInt % 9 != 0) &&
-                (myInt >= 10 ? true : myInt % 10 != 0);
+            bool isPrime = (myInt <= 2 ? true : myInt % 2 != 0) &&
+                (myInt <= 3 ? true : myInt % 3 != 0) &&
+                (myInt <= 4 ? true : myInt % 4 != 0) &&
+                (myInt <= 5 ? true : myInt % 5 != 0) &&
+                (myInt <= 6 ? true : myInt % 6 != 0) &&
+                (myInt <= 7 ? true : myInt % 7 != 0) &&
+                (myInt <= 8 ? true : myInt % 8 != 0) &&
+                (myInt <= 9 ? true : myInt % 9 != 0) &&
+                (myInt <= 10 ? true : myInt % 10 != 0);

             Console.WriteLine(isPrime);
         }