Reimplement WindowsGameWindow.SetIconFromStream using reflection

--- osu.Framework/Platform/Windows/WindowsGameWindow.cs
+++ osu.Framework/Platform/Windows/WindowsGameWindow.cs
@@ -3,8 +3,12 @@

 using System;
 using System.IO;
+using System.Reflection;
 using System.Runtime.InteropServices;
 using osuTK.Input;
+using System.Linq;
+using System.Drawing;
+using osu.Framework.Logging;

 namespace osu.Framework.Platform.Windows
 {
@@ -12,9 +16,8 @@
     {
         private const int seticon_message = 0x0080;

-        // FIXME
-        //private Icon smallIcon;
-        //private Icon largeIcon;
+        private object smallIcon;
+        private object largeIcon;

         protected override void OnKeyDown(object sender, KeyboardKeyEventArgs e)
         {
@@ -38,12 +41,28 @@
             stream.Position = 0;
             secondStream.Position = 0;

-            // FIXME
-            //smallIcon = new Icon(stream, 24, 24);
-            //largeIcon = new Icon(secondStream, 256, 256);
+            try
+            {
+                // get the type info with reflection, since Icon won't be available to Xamarin
+                var drawingAssembly = typeof(Point).Assembly;
+                Type iconType = drawingAssembly.ExportedTypes.Single(x => x.Name == "Icon");
+                ConstructorInfo cons = iconType.GetConstructor(new Type[] { typeof(Stream), typeof(int), typeof(int) });
+                PropertyInfo handleProp = iconType.GetProperties().Single(x => x.Name == "Handle");

-            //SendMessage(WindowInfo.Handle, seticon_message, (IntPtr)0, smallIcon.Handle);
-            //SendMessage(WindowInfo.Handle, seticon_message, (IntPtr)1, largeIcon.Handle);
+                // create icons and get their handles
+                smallIcon = cons.Invoke(new object[] { stream, 24, 24 });
+                largeIcon = cons.Invoke(new object[] { secondStream, 256, 256 });
+                IntPtr smallIconHandle = (IntPtr)handleProp.GetValue(smallIcon);
+                IntPtr largeIconHandle = (IntPtr)handleProp.GetValue(largeIcon);
+
+                // pass the handles through to SendMessage
+                SendMessage(WindowInfo.Handle, seticon_message, (IntPtr)0, smallIconHandle);
+                SendMessage(WindowInfo.Handle, seticon_message, (IntPtr)1, largeIconHandle);
+            }
+            catch
+            {
+                Logger.Log("Failed to set window icon from Stream.", LoggingTarget.Runtime, LogLevel.Important);
+            }
         }

         [DllImport("user32.dll", CharSet = CharSet.Auto)]


Fix cache not rebuilding full tree

Fix cache not rebuilding full tree

--- osu.Framework/Testing/RoslynTypeReferenceBuilder.cs
+++ osu.Framework/Testing/RoslynTypeReferenceBuilder.cs
@@ -59,8 +59,10 @@

                 foreach (var t in oldTypes)
                 {
+                    string typePath = t.Symbol.Locations.First().SourceTree?.FilePath;
+
                     // The type we have is on an old compilation, we need to re-retrieve it on the new one.
-                    var project = getProjectFromFile(t.Symbol.Locations.First().SourceTree?.FilePath);
+                    var project = getProjectFromFile(typePath);

                     if (project == null)
                     {
@@ -70,16 +72,11 @@
                     }

                     var compilation = await compileProjectAsync(project);
-                    var newType = compilation.GetTypeByMetadataName(t.Symbol.ToString());
-
-                    if (newType == null)
-                    {
-                        Logger.Log("Class has been renamed. Rebuilding map...");
-                        Reset();
-                        break;
-                    }
-
-                    await getReferencedTypesRecursiveAsync(TypeReference.FromSymbol(newType), compiledTestType.Locations.Any(l => l.SourceTree?.FilePath == changedFile));
+                    var syntaxTree = compilation.SyntaxTrees.First(tree => tree.FilePath == typePath);
+
+                    var referencedTypes = await getReferencedTypesAsync(await getSemanticModelAsync(syntaxTree), compiledTestType.Locations.Any(l => l.SourceTree?.FilePath == changedFile));
+                    foreach (var referenced in referencedTypes)
+                        await getReferencedTypesRecursiveAsync(referenced, referenced.Symbol.Locations.Any(l => l.SourceTree?.FilePath == changedFile));
                 }
             }

@@ -171,45 +168,52 @@

             foreach (var reference in typeReference.Symbol.DeclaringSyntaxReferences)
             {
-                var syntaxTree = reference.SyntaxTree;
-                var semanticModel = await getSemanticModelAsync(reference.SyntaxTree);
-                var root = await syntaxTree.GetRootAsync();
-
-                var descendantNodes = root.DescendantNodes(n =>
-                {
-                    var kind = n.Kind();
-
-                    return kind != SyntaxKind.UsingDirective
-                           && kind != SyntaxKind.NamespaceKeyword
-                           && (includeBaseType || kind != SyntaxKind.BaseList);
-                });
-
-                // Find all the named type symbols in the syntax tree, and mark + recursively iterate through them.
-                foreach (var node in descendantNodes)
-                {
-                    switch (node.Kind())
+                foreach (var type in await getReferencedTypesAsync(await getSemanticModelAsync(reference.SyntaxTree), includeBaseType))
+                    result.Add(type);
+            }
+
+            return result;
+        }
+
+        private async Task<HashSet<TypeReference>> getReferencedTypesAsync(SemanticModel semanticModel, bool includeBaseType)
+        {
+            var result = new HashSet<TypeReference>();
+
+            var root = await semanticModel.SyntaxTree.GetRootAsync();
+            var descendantNodes = root.DescendantNodes(n =>
+            {
+                var kind = n.Kind();
+
+                return kind != SyntaxKind.UsingDirective
+                       && kind != SyntaxKind.NamespaceKeyword
+                       && (includeBaseType || kind != SyntaxKind.BaseList);
+            });
+
+            // Find all the named type symbols in the syntax tree, and mark + recursively iterate through them.
+            foreach (var node in descendantNodes)
+            {
+                switch (node.Kind())
+                {
+                    case SyntaxKind.GenericName:
+                    case SyntaxKind.IdentifierName:
                     {
-                        case SyntaxKind.GenericName:
-                        case SyntaxKind.IdentifierName:
-                        {
-                            if (semanticModel.GetSymbolInfo(node).Symbol is INamedTypeSymbol t)
-                                result.Add(TypeReference.FromSymbol(t));
-
-                            break;
-                        }
-
-                        case SyntaxKind.AsExpression:
-                        case SyntaxKind.IsExpression:
-                        case SyntaxKind.SizeOfExpression:
-                        case SyntaxKind.TypeOfExpression:
-                        case SyntaxKind.CastExpression:
-                        case SyntaxKind.ObjectCreationExpression:
-                        {
-                            if (semanticModel.GetTypeInfo(node).Type is INamedTypeSymbol t)
-                                result.Add(TypeReference.FromSymbol(t));
-
-                            break;
-                        }
+                        if (semanticModel.GetSymbolInfo(node).Symbol is INamedTypeSymbol t)
+                            result.Add(TypeReference.FromSymbol(t));
+
+                        break;
+                    }
+
+                    case SyntaxKind.AsExpression:
+                    case SyntaxKind.IsExpression:
+                    case SyntaxKind.SizeOfExpression:
+                    case SyntaxKind.TypeOfExpression:
+                    case SyntaxKind.CastExpression:
+                    case SyntaxKind.ObjectCreationExpression:
+                    {
+                        if (semanticModel.GetTypeInfo(node).Type is INamedTypeSymbol t)
+                            result.Add(TypeReference.FromSymbol(t));
+
+                        break;
                     }
                 }
             }


デモデータの最終更新日の基準が前日になる仕様に変更。

デモデータの最終更新日の基準が前日になる仕様に変更。

--- Implem.Pleasanter/Models/Demos/DemoModel.cs
+++ Implem.Pleasanter/Models/Demos/DemoModel.cs
@@ -574,7 +574,7 @@
                 DateTime.Now -
                 Def.DemoDefinitionCollection
                     .Where(o => o.UpdatedTime >= Parameters.General.MinTime)
-                    .Select(o => o.UpdatedTime).Max()).Days;
+                    .Select(o => o.UpdatedTime).Max()).Days - 1;
         }
     }
 }


Final -> cumulative, to represent a growing score.

--- osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs
+++ osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs
@@ -85,17 +85,17 @@
         public override bool HasFailed => totalHits == maxTotalHits && Health.Value <= 0.5;

         /// <summary>
-        /// The final combo portion of the score.
+        /// The cumulative combo portion of the score.
         /// </summary>
         private double comboScore => combo_portion_max * comboPortion / maxComboPortion;

         /// <summary>
-        /// The final accuracy portion of the score.
+        /// The cumulative accuracy portion of the score.
         /// </summary>
         private double accuracyScore => accuracy_portion_max * Math.Pow(Accuracy, 3.6) * totalHits / maxTotalHits;

         /// <summary>
-        /// The final bonus score.
+        /// The cumulative bonus score.
         /// This is added on top of <see cref="max_score"/>, thus the total score can exceed <see cref="max_score"/>.
         /// </summary>
         private double bonusScore;


access to last high and low

access to last high and low

--- Indicator/FindHighLowTimeFrame_Indicator.cs
+++ Indicator/FindHighLowTimeFrame_Indicator.cs
@@ -33,6 +33,10 @@
         private TimeSpan _tim_end = new TimeSpan(13, 0, 0);

         //output
+        private double _lastlow = Double.NaN;
+        private double _lasthigh = Double.NaN;
+
+

         //internal
         private DateTime _currentdayofupdate = DateTime.MinValue;
@@ -88,18 +92,19 @@

             if (isvalidtimeframe)
             {
-                double low = list.Where(x => x.Low == list.Min(y => y.Low)).LastOrDefault().Low;
-                double high = list.Where(x => x.High == list.Max(y => y.High)).LastOrDefault().High;
+                //We save the high and low values in public variables to get access from other scripts
+                this.LastLow = list.Where(x => x.Low == list.Min(y => y.Low)).LastOrDefault().Low;
+                this.LastHigh = list.Where(x => x.High == list.Max(y => y.High)).LastOrDefault().High;

                 //Draw current lines for this day session
                 if (Time[0].Date == DateTime.Now.Date)
                 {
-                    DrawHorizontalLine("LowLine" + start.Ticks, true, low, this.CurrentSessionLineColor, DashStyle.Solid, 2);
-                    DrawHorizontalLine("HighLine" + start.Ticks, true, high, this.CurrentSessionLineColor, DashStyle.Solid, 2);
+                    DrawHorizontalLine("LowLine" + start.Ticks, true, this.LastLow, this.CurrentSessionLineColor, DashStyle.Solid, 2);
+                    DrawHorizontalLine("HighLine" + start.Ticks, true, this.LastHigh, this.CurrentSessionLineColor, DashStyle.Solid, 2);
                 }

                 //Draw a rectangle at the dedicated time frame
-                DrawRectangle("HighLowRect" + start.Ticks, true, start, low, end, high, this.Color_TimeFrame, this.Color_TimeFrame, this.Opacity);
+                DrawRectangle("HighLowRect" + start.Ticks, true, start, this.LastLow, end, this.LastHigh, this.Color_TimeFrame, this.Color_TimeFrame, this.Opacity);
             }
         }

@@ -206,8 +211,6 @@
             set { _col_timeframe = SerializableColor.FromString(value); }
         }

-        #endregion
-
         //[Browsable(false)]
         //[XmlIgnore()]
         //public DataSeries MyPlot1
@@ -236,7 +239,7 @@

         /// <summary>
         /// </summary>
-         [Description("The end time of the time frame.")]
+        [Description("The end time of the time frame.")]
         [Category("TimeSpan")]
         [DisplayName("End")]
         public TimeSpan Time_End
@@ -245,15 +248,46 @@
             set { _tim_end = value; }
         }
         [Browsable(false)]
-         public long Time_EndSerialize
+        public long Time_EndSerialize
         {
             get { return _tim_end.Ticks; }
             set { _tim_end = new TimeSpan(value); }
         }

-		#endregion
-	}
+        #endregion
+
+
+
+
+        #region Output
+
+            /// <summary>
+            /// Last Low Values in dedicated time frame.
+            /// </summary>
+            [Browsable(false)]
+            [XmlIgnore()]
+            public double LastLow
+            {
+                get { return _lastlow; }
+                set { _lastlow = value; }
+            }
+
+            /// <summary>
+            /// Last High Values in dedicated time frame.
+            /// </summary>
+            [Browsable(false)]
+            [XmlIgnore()]
+            public double LastHigh
+            {
+                get { return _lasthigh; }
+                set { _lasthigh = value; }
+            }
+
+        #endregion
+
+        #endregion
+    }
 }

 #region AgenaTrader Automaticaly Generated Code. Do not change it manualy


Fix accuracy heatmap points changing colour

--- osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
+++ osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
@@ -166,7 +166,7 @@

                     var point = new HitPoint(pointType, this)
                     {
-                        Colour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
+                        BaseColour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
                     };

                     points[r][c] = point;
@@ -234,6 +234,11 @@

         private class HitPoint : Circle
         {
+            /// <summary>
+            /// The base colour which will be lightened/darkened depending on the value of this <see cref="HitPoint"/>.
+            /// </summary>
+            public Color4 BaseColour;
+
             private readonly HitPointType pointType;
             private readonly AccuracyHeatmap heatmap;

@@ -284,7 +289,7 @@

                 Alpha = Math.Min(amount / lighten_cutoff, 1);
                 if (pointType == HitPointType.Hit)
-                    Colour = ((Color4)Colour).Lighten(Math.Max(0, amount - lighten_cutoff));
+                    Colour = BaseColour.Lighten(Math.Max(0, amount - lighten_cutoff));
             }
         }


remove comment

remove comment

--- Infinite-PuTTY-Tunnel/Putty/PlinkSession.cs
+++ Infinite-PuTTY-Tunnel/Putty/PlinkSession.cs
@@ -113,8 +113,6 @@
                 try
                 {
                     Thread.Sleep(Settings.Default.WatchDogRetryDelayInMilliseconds);
-
-                    //If this is the second time through, then only try to start if the thread isn't up yet...
                     if (!IsActive && IsEnabled)
                         Start(true);
                 }


Fix some incorrect test case values

Fix some incorrect test case values

--- osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs
+++ osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs
@@ -210,15 +210,13 @@

             AddStep("Seek(450)", () => Clock.Seek(450));
             AddStep("SeekBackward", () => Clock.SeekBackward());
-            AddAssert("Time = 425", () => Clock.CurrentTime == 425);
+            AddAssert("Time = 400", () => Clock.CurrentTime == 400);
             AddStep("SeekBackward", () => Clock.SeekBackward());
-            AddAssert("Time = 375", () => Clock.CurrentTime == 375);
+            AddAssert("Time = 350", () => Clock.CurrentTime == 350);
             AddStep("SeekBackward", () => Clock.SeekBackward());
-            AddAssert("Time = 325", () => Clock.CurrentTime == 325);
+            AddAssert("Time = 150", () => Clock.CurrentTime == 150);
             AddStep("SeekBackward", () => Clock.SeekBackward());
-            AddAssert("Time = 125", () => Clock.CurrentTime == 125);
-            AddStep("SeekBackward", () => Clock.SeekBackward());
-            AddAssert("Time = 25", () => Clock.CurrentTime == 25);
+            AddAssert("Time = 50", () => Clock.CurrentTime == 50);
             AddStep("SeekBackward", () => Clock.SeekBackward());
             AddAssert("Time = 0", () => Clock.CurrentTime == 0);
         }


Improve xmldoc.

Improve xmldoc.

--- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs
+++ osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs
@@ -209,7 +209,9 @@
         /// <param name="length">The slider length.</param>
         /// <param name="curveType">The slider curve type.</param>
         /// <param name="repeatCount">The slider repeat count.</param>
-        /// <param name="repeatSamples">The slider repeat sounds (this includes the end node, but NOT the start node).</param>
+        /// <param name="headSamples">The samples to be played when the head of the slider is hit.</param>
+        /// <param name="tailSamples">The samples to be played when the tail of the slider is hit.</param>
+        /// <param name="repeatSamples">The samples to be played when the repeat nodes are hit.</param>
         /// <returns>The hit object.</returns>
         protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType,
                                                   int repeatCount, List<SampleInfo> headSamples, List<SampleInfo> tailSamples, List<List<SampleInfo>> repeatSamples);


Apply the expected font to the checkbox's label

--- osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs
+++ osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs
@@ -3,8 +3,11 @@

 using System;
 using System.Linq;
+using System.Reflection.Emit;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Graphics;
 using osu.Game.Graphics.UserInterface;
 using osu.Game.Overlays.Mods;
 using osu.Game.Rulesets.Mods;
@@ -120,6 +123,19 @@

             protected override bool PlaySoundsOnUserChange => false;

+            public HeaderCheckbox()
+                : base(false)
+
+            {
+            }
+
+            protected override void ApplyLabelParameters(SpriteText text)
+            {
+                base.ApplyLabelParameters(text);
+
+                text.Font = OsuFont.GetFont(weight: FontWeight.Bold);
+            }
+
             protected override void OnUserChange(bool value)
             {
                 base.OnUserChange(value);


Implement 'play' command and remove Captures from Engine

--- GTPWrapper/Engine.cs
+++ GTPWrapper/Engine.cs
@@ -40,10 +40,6 @@
         /// Gets a list of past moves.
         /// </summary>
         public List<Move> MoveHistory;
-        /// <summary>
-        /// Gets the number of captured stones by given color.
-        /// </summary>
-        public Dictionary<Color, int> Captures;

         /// <summary>
         /// Gets or sets the name of the engine.
@@ -73,11 +69,6 @@
             this.CommandQueue = new Queue<Command>();
             this.ResponseList = new Dictionary<Command, Response>();
             this.MoveHistory = new List<Move>();
-
-            this.Captures = new Dictionary<Color, int>() {
-                { Color.Black, 0 },
-                { Color.White, 0 }
-            };

             this.SupportedCommands = new List<string>(new string[] {
                 "protocol_version", "name", "version", "known_command", "list_commands", "quit",
@@ -182,7 +173,6 @@
                 case "clear_board":
                     this.MoveHistory.Clear();
                     this.Board.Clear();
-                    this.Captures[Color.Black] = this.Captures[Color.White] = 0;

                     return new Response(command);
                 case "komi":
@@ -192,6 +182,17 @@
                     } catch {}

                     return new Response(command, "syntax error", true);
+                case "play":
+                    try {
+                        Move move = Move.Parse(string.Join(" ", command.Arguments));
+                        this.Board = this.Board.MakeMove(move);
+                        MoveHistory.Add(move);
+                        return new Response(command);
+                    } catch(FormatException) {
+                        return new Response(command, "syntax error", true);
+                    } catch (InvalidOperationException) {
+                        return new Response(command, "illegal move", true);
+                    }
             }

             return new Response(command, "unknown command", true);


Added destination label

Added destination label

--- OptionsForm.Designer.cs
+++ OptionsForm.Designer.cs
@@ -23,13 +23,24 @@
     /// the contents of this method with the code editor.
     /// </summary>
     private void InitializeComponent() {
+      this.destinationLabel = new System.Windows.Forms.Label();
       this.SuspendLayout();
+      //
+      // destinationLabel
+      //
+      this.destinationLabel.AutoSize = true;
+      this.destinationLabel.Location = new System.Drawing.Point(12, 9);
+      this.destinationLabel.Name = "destinationLabel";
+      this.destinationLabel.Size = new System.Drawing.Size(58, 13);
+      this.destinationLabel.TabIndex = 0;
+      this.destinationLabel.Text = "destination";
       //
       // OptionsForm
       //
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.ClientSize = new System.Drawing.Size(284, 161);
+      this.Controls.Add(this.destinationLabel);
       this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
       this.MaximizeBox = false;
       this.MinimizeBox = false;
@@ -37,9 +48,12 @@
       this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
       this.Text = "options";
       this.ResumeLayout(false);
+      this.PerformLayout();

     }

     #endregion
+
+    private System.Windows.Forms.Label destinationLabel;
   }
 }


Migrate edit activity.

Migrate edit activity.

--- Joey/UI/Activities/EditTimeEntryActivity.cs
+++ Joey/UI/Activities/EditTimeEntryActivity.cs
@@ -20,7 +20,6 @@

         private FrameLayout DoneFrameLayout { get; set; }

-        private Subscription<ModelChangedMessage> subscriptionModelChanged;
         private TimeEntryModel model;

         protected override void OnCreateActivity (Bundle state)
@@ -40,8 +39,9 @@

             SetContentView (Resource.Layout.EditTimeEntryActivity);

+            CreateModelFromIntent ();
+
             if (state == null) {
-                model = GetModelFromIntent ();
                 if (model == null) {
                     Finish ();
                 } else {
@@ -52,39 +52,24 @@
             }
         }

-        protected override void OnResumeActivity ()
-        {
-            base.OnResumeActivity ();
-
-            EnsureModel ();
-
-            var bus = ServiceContainer.Resolve<MessageBus> ();
-            subscriptionModelChanged = bus.Subscribe<ModelChangedMessage> (OnModelChanged);
-        }
-
-        protected override void OnPause ()
-        {
-            if (subscriptionModelChanged != null) {
-                var bus = ServiceContainer.Resolve<MessageBus> ();
-                bus.Unsubscribe (subscriptionModelChanged);
-                subscriptionModelChanged = null;
-            }
-
-            base.OnPause ();
-        }
-
-        private TimeEntryModel GetModelFromIntent ()
+        private async void CreateModelFromIntent ()
         {
             var extras = Intent.Extras;
             if (extras == null)
-                return null;
+                return;

             var extraIdStr = extras.GetString (ExtraTimeEntryId);
             Guid extraId;
             if (!Guid.TryParse (extraIdStr, out extraId))
-                return null;
+                return;

-            return Model.ById<TimeEntryModel> (extraId);
+            model = new TimeEntryModel (extraId);
+
+            // Ensure that the model exists
+            await model.LoadAsync ();
+            if (model.Workspace == null || model.Workspace.Id == Guid.Empty) {
+                Finish ();
+            }
         }

         private View CreateDoneActionBarView ()
@@ -93,26 +78,9 @@
             return inflater.Inflate (Resource.Layout.DoneActionBarView, null);
         }

-        private void OnModelChanged (ModelChangedMessage msg)
-        {
-            if (Handle == IntPtr.Zero)
-                return;
-
-            if (msg.Model == model) {
-                EnsureModel ();
-            }
-        }
-
         private void OnDoneFrameLayoutClick (object sender, EventArgs e)
         {
             Finish ();
         }
-
-        private void EnsureModel ()
-        {
-            if (model == null || model.DeletedAt.HasValue) {
-                Finish ();
-            }
-        }
     }
 }


Closed #1. Исправлено падение при открытом шаблоне

--- LayoutsFromModel/PlotSettingsInfoBuilder.cs
+++ LayoutsFromModel/PlotSettingsInfoBuilder.cs
@@ -6,8 +6,9 @@
 using System;
 using System.Collections.Generic;
 using System.Collections.Specialized;
-
+using System.Linq;
 using Autodesk.AutoCAD.DatabaseServices;
+using Autodesk.AutoCAD.ApplicationServices;

 namespace LayoutsFromModel
 {
@@ -23,38 +24,52 @@
 		/// <returns>Коллекция PlotSettingsInfo</returns>
 		public static IEnumerable<PlotSettingsInfo> CreatePlotSettingsInfos(string templatePath)
 		{
-			using (Database db = new Database(false, true))
+			Database db = null;
+			bool isTemplateOpened = false;
+
+			DocumentCollection docMan = Application.DocumentManager;
+			Document doc = docMan.Cast<Document>().FirstOrDefault(d => d.Name.Equals(templatePath, StringComparison.InvariantCulture));
+			if (doc != null)
 			{
+				db = doc.Database;
+				isTemplateOpened = true;
+			}
+			else
+			{
+				db = new Database(false, true);
 				db.ReadDwgFile(templatePath, System.IO.FileShare.Read, true, null);
-				using (Transaction tr = db.TransactionManager.StartTransaction())
+			}
+
+			using (Transaction tr = db.TransactionManager.StartTransaction())
+			{
+				DBDictionary psDict = tr.GetObject(db.PlotSettingsDictionaryId, OpenMode.ForRead) as DBDictionary;
+				if (psDict != null)
 				{
-					DBDictionary psDict = tr.GetObject(db.PlotSettingsDictionaryId, OpenMode.ForRead) as DBDictionary;
-					if (psDict != null)
+					foreach (DBDictionaryEntry entry in psDict)
 					{
-						foreach (DBDictionaryEntry entry in psDict)
+						ObjectId psId = entry.Value;
+						PlotSettings ps = tr.GetObject(psId, OpenMode.ForRead) as PlotSettings;
+						// Настройки печати для модели и настройки листов самих по себе
+						// нам не нужны
+						// только именованные настройки печати для листов
+						if (!ps.ModelType && !ps.PlotSettingsName.Contains("*"))
 						{
-							ObjectId psId = entry.Value;
-							PlotSettings ps = tr.GetObject(psId, OpenMode.ForRead) as PlotSettings;
-							// Настройки печати для модели и настройки листов самих по себе
-							// нам не нужны
-							// только именованные настройки печати для листов
-							if (!ps.ModelType && !ps.PlotSettingsName.Contains("*"))
-							{
-								PlotSettings newPS = new PlotSettings(false);
-								newPS.CopyFrom(ps);
-								yield return new PlotSettingsInfo(newPS);
-							}
+							PlotSettings newPS = new PlotSettings(false);
+							newPS.CopyFrom(ps);
+							yield return new PlotSettingsInfo(newPS);
 						}
 					}
-					tr.Commit();
 				}
+				tr.Commit();
 			}
+			if (!isTemplateOpened)
+				db.Dispose();
 		}

 		/// <summary>
 		/// Создание коллекции PlotSettingsInfo из пользовательских форматов
 		/// в файле DWG to PDF.pc3
-		/// Также в коллекцию будут включены форматы, начинающиеся с "ISO_A" - это поведение
+		/// Также в коллекцию будут включены форматы, начинающиеся с "ISO_A" - это поведение
 		/// подлежит изменению
 		/// </summary>
 		/// <returns>Коллекция PlotSettingsInfo</returns>


Update の仕様を変更

Update の仕様を変更

--- Libraries/Views/Controls/SettingsControl.cs
+++ Libraries/Views/Controls/SettingsControl.cs
@@ -161,20 +161,7 @@
         /* ----------------------------------------------------------------- */
         [Browsable(false)]
         [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-        public IEnumerable<Control> MonitoredControls => MonitoredControlList;
-
-        /* ----------------------------------------------------------------- */
-        ///
-        /// MonitoredControlList
-        ///
-        /// <summary>
-        /// 監視されているコントロールの一覧を取得します。
-        /// </summary>
-        ///
-        /* ----------------------------------------------------------------- */
-        [Browsable(false)]
-        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-        protected IList<Control> MonitoredControlList { get; } = new List<Control>();
+        public IEnumerable<Control> MonitoredControls => _monitor;

         /* ----------------------------------------------------------------- */
         ///
@@ -272,17 +259,18 @@
         /// </summary>
         ///
         /* ----------------------------------------------------------------- */
-        public void Update(object properties) => Update(properties, string.Empty);
-        public void Update(object properties, string prefix)
-        {
-            var type = properties.GetType();
-
-            foreach (var control in MonitoredControlList)
+        public void Update<T>(T settings) => Update(settings, string.Empty);
+        public void Update<T>(T settings, string prefix)
+        {
+            var type = settings.GetType();
+
+            foreach (var control in _monitor)
             {
-                var name = prefix + control.Name.Replace(control.GetType().Name, string.Empty);
+                var name = control.Name.Replace(control.GetType().Name, string.Empty);
+                if (!string.IsNullOrEmpty(prefix)) name = name.Replace(prefix, string.Empty);
                 if (string.IsNullOrEmpty(name)) continue;

-                var value = type.GetProperty(name)?.GetValue(properties, null);
+                var value = type.GetProperty(name)?.GetValue(settings, null);
                 if (value == null) continue;

                 RaiseUpdateControl(control, value);
@@ -848,7 +836,7 @@
                     break;
             }

-            MonitoredControlList.Add(control);
+            _monitor.Add(control);
         }

         /* ----------------------------------------------------------------- */
@@ -863,7 +851,7 @@
         /* ----------------------------------------------------------------- */
         private void Detach(Control control)
         {
-            MonitoredControlList.Remove(control);
+            _monitor.Remove(control);

             control.ControlAdded   -= Control_ControlAdded;
             control.ControlRemoved -= Control_ControlRemoved;
@@ -910,6 +898,7 @@
         private Control _ok     = null;
         private Control _cancel = null;
         private Control _apply  = null;
+        private IList<Control> _monitor = new List<Control>();
         #endregion
     }
 }


flip fix

flip fix

--- Othello/Othello/Game.cs
+++ Othello/Othello/Game.cs
@@ -317,6 +317,7 @@

         private void flippeTiles(Tile tile, bool isWhiteTurn)
         {
+            Console.WriteLine("flipe");
             int enemy = isWhiteTurn ? 0 : 1;
             int me = isWhiteTurn ? 1 : 0;
             foreach (var neighbor in tile.voisin())
@@ -324,6 +325,7 @@
                 Tile neighborTile = neighbor;
                 if (neighbor.Value == enemy)
                 {
+                    Board[neighborTile.X, neighborTile.Y].Value = me;
                     int offsetX = tile.X - neighbor.X;
                     int offsetY = tile.Y - neighbor.Y;
                     Tile visited;
@@ -331,7 +333,6 @@
                     int y;
                     do
                     {
-
                         x = neighborTile.X - offsetX;
                         y = neighborTile.Y - offsetY;
                         if (neighbor.X == 0 || neighbor.Y == 0 || neighbor.X == 7 || neighbor.Y == 7)
@@ -339,9 +340,12 @@
                             break;
                         }
                         visited = board[x, y];
-                        if (visited.Value == tile.Value)
+                        if (visited.Value == enemy)
                         {
+                            Console.WriteLine(me);
+                            //Console.WriteLine(Board[visited.X, visited.Y].Value);
                             Board[visited.X, visited.Y].Value = me;
+
                         }
                         neighborTile = visited;
                     } while (visited.Value != tile.Value && visited.Value != -1 && x > 1 && x < 7 && y > 1 && y < 7);


ca va mieux

ca va mieux

--- Othello/Othello/Game.cs
+++ Othello/Othello/Game.cs
@@ -317,8 +317,37 @@
                 Tile neighborTile = neighbor;
                 if (neighbor.Value == enemy)
                 {
-                    Console.WriteLine("Neighbour");
                     bool flip = false;
+
+                    /*int offsetX = tile.X - neighborTile.X;
+                    int offsetY = tile.Y - neighborTile.Y;
+                    Tile visited;
+                    int x;
+                    int y;
+                    do
+                    {
+
+                        x = neighborTile.X - offsetX;
+                        y = neighborTile.Y - offsetY;
+                        if (x < 0 || y < 0 || x > 7 || y > 7)
+                        {
+                            break;
+                        }
+                        visited = board[x, y];
+                        if (visited.Value == enemy)
+                        {
+                            hasToBeFlipped.Add(neighborTile);
+
+                        }
+                        if (visited.Value == me)
+                        {
+                            flip = true;
+                            break;
+                        }
+                        neighborTile = visited;
+                    } while (visited.Value != -1);*/
+
+
                     int offsetX = tile.X - neighbor.X;
                     int offsetY = tile.Y - neighbor.Y;
                     int x = neighborTile.X;
@@ -328,25 +357,25 @@
                         return;
                     }
                     Tile visited = board[x, y];
-                    while (visited.Value != -1 && x > 1 && x < 7 && y > 1 && y < 7)
-                    {
-                        Console.WriteLine("coucou");
+                    while (visited.Value != -1 && x > 0 && x < 8 && y > 0 && y < 8)
+                    {
+                        visited = board[x, y];
+
                         if (visited.Value == enemy)
                         {
                             hasToBeFlipped.Add(neighborTile);
-
                         }
                         else if (visited.Value == me)
                         {
-                            Console.WriteLine("Fin");
                             flip = true;
                             break;
                         }
                         x = neighborTile.X - offsetX;
                         y = neighborTile.Y - offsetY;
-                        visited = board[x, y];
+
                         neighborTile = visited;
                     }
+
                     if (flip)
                     {
                         foreach (var tileToFlip in hasToBeFlipped)


Simplify Drift Calculation

Simplify Drift Calculation

--- LiveSplit/LiveSplit.Core/Model/TimeStamp.cs
+++ LiveSplit/LiveSplit.Core/Model/TimeStamp.cs
@@ -103,7 +103,7 @@

                         var newDrift = qpcDelta.TotalMilliseconds / ntpDelta.TotalMilliseconds;
                         var weight = Math.Pow(0.95, ntpDelta.TotalHours);
-                        NewDrift = Math.Exp(Math.Log(newDrift) * (1 - weight) + Math.Log(PersistentDrift) * weight);
+                        NewDrift = Math.Pow(newDrift, 1 - weight) * Math.Pow(PersistentDrift, weight);

                         Wait(TimeSpan.FromHours(0.5));
                     }


Added support to add an icon to `MaterialFlatButton`

Now you can add a 24px icon to the `MaterialFlatButton` using the `Icon`
property

--- MaterialSkin/Controls/MaterialFlatButton.cs
+++ MaterialSkin/Controls/MaterialFlatButton.cs
@@ -23,6 +23,19 @@

         private SizeF textSize;

+        private Image _icon;
+        public Image Icon
+        {
+            get { return _icon; }
+            set
+            {
+                _icon = value;
+                if (AutoSize)
+                    Size = GetPreferredSize();
+                Invalidate();
+            }
+        }
+
         public MaterialFlatButton()
         {
             Primary = false;
@@ -89,7 +102,45 @@
                 }
                 g.SmoothingMode = SmoothingMode.None;
             }
-			g.DrawString(Text.ToUpper(), SkinManager.ROBOTO_MEDIUM_10, Enabled ? (Primary ? SkinManager.ColorScheme.PrimaryBrush : SkinManager.GetPrimaryTextBrush()) : SkinManager.GetFlatButtonDisabledTextBrush(), ClientRectangle, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
+
+            //Icon
+            Rectangle iconRect = new Rectangle(4, 6, 24, 24);
+
+            if (String.IsNullOrEmpty(Text))
+                // Center Icon
+                iconRect.X += 2;
+
+            if (Icon != null)
+                g.DrawImage(Icon, iconRect);
+
+            //Text
+            Rectangle textRect = ClientRectangle;
+
+            if (Icon != null)
+            {
+                //
+                // Resize and move Text container
+                //
+
+                // First 4: left padding
+                // 24: icon width
+                // Second 4: space between Icon and Text
+                // Third 4: right padding
+                textRect.Width -= 4 + 24 + 4 + 4;
+
+                // First 4: left padding
+                // 24: icon width
+                // Second 4: space between Icon and Text
+                textRect.X += 4 + 24 + 4;
+            }
+
+            g.DrawString(
+                Text.ToUpper(),
+                SkinManager.ROBOTO_MEDIUM_10,
+                Enabled ? (Primary ? SkinManager.ColorScheme.PrimaryBrush : SkinManager.GetPrimaryTextBrush()) : SkinManager.GetFlatButtonDisabledTextBrush(),
+                textRect,
+                new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }
+                );
         }

         private Size GetPreferredSize()
@@ -99,7 +150,15 @@

         public override Size GetPreferredSize(Size proposedSize)
         {
-            return new Size((int) textSize.Width + 8, 36);
+            // Provides extra space for proper padding for content
+            int extra = 8;
+
+            if (Icon != null)
+                // 24 is for icon size
+                // 4 is for the space between icon & text
+                extra += 24 + 4;
+
+            return new Size((int)Math.Ceiling(textSize.Width) + extra, 36);
         }

         protected override void OnCreateControl()


Connecting

Connecting

--- IClientConnection.cs
+++ IClientConnection.cs
@@ -21,14 +21,24 @@
 // THE SOFTWARE.

 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
+using System.Net;

 namespace Tempest
 {
 	public interface IClientConnection
 		: IConnection
 	{
+		/// <summary>
+		/// Raised when the connection has connected.
+		/// </summary>
+		event EventHandler<ConnectionEventArgs> Connected;
+
+		/// <summary>
+		/// Connects to the <paramref name="endpoint"/>.
+		/// </summary>
+		/// <param name="endpoint">The endpoint to connect to.</param>
+		/// <exception cref="ArgumentNullException"><paramref name="endpoint"/> is <c>null</c>.</exception>
+		void Connect (EndPoint endpoint);
 	}
 }


Update QuickScriptEditor.cs

Update QuickScriptEditor.cs

--- MetX/MetX.QuickScripts/QuickScriptEditor.cs
+++ MetX/MetX.QuickScripts/QuickScriptEditor.cs
@@ -274,14 +274,9 @@
         QuickScriptWorker.ViewFile(Host, InputParam.Text);
     }

-    private void exitToolStripMenuItem_Click(object sender, EventArgs e)
-    {
-        Close();
-    }
-
     private void InputList_SelectedIndexChanged(object sender, EventArgs e)
     {
-
+        <<< Start here
     }

     private void InputParam_Enter(object sender, EventArgs e)


Implemented delayed signing and removing strong name.

--- ILRepack/ILRepack.cs
+++ ILRepack/ILRepack.cs
@@ -24,7 +24,7 @@
         public bool Closed { get; set; } // UNIMPL
         public bool CopyAttributes { get; set; }
         public bool DebugInfo { get; set; }
-        public bool DelaySign { get; set; } // UNIMPL, how does this work with cecil?
+        public bool DelaySign { get; set; }
         public string ExcludeFile { get; set; }
         public int FileAlignment { get; set; } // UNIMPL, not supported by cecil
         public string[] InputAssemblies { get; set; }
@@ -601,10 +601,23 @@
             var parameters = new WriterParameters();
             if (KeyFile != null && File.Exists(KeyFile))
             {
+                System.Reflection.StrongNameKeyPair snkp;
                 using (var stream = new FileStream(KeyFile, FileMode.Open))
                 {
-                    parameters.StrongNameKeyPair = new System.Reflection.StrongNameKeyPair(stream);
-                }
+                    snkp = new System.Reflection.StrongNameKeyPair(stream);
+                }
+                if (DelaySign)
+                {
+                    TargetAssemblyDefinition.Name.PublicKey = snkp.PublicKey;
+                    TargetAssemblyDefinition.MainModule.Attributes |= ModuleAttributes.StrongNameSigned;
+                }
+                else
+                    parameters.StrongNameKeyPair = snkp;
+            }
+            else
+            {
+                TargetAssemblyDefinition.Name.PublicKey = null;
+                TargetAssemblyDefinition.MainModule.Attributes &= ~ModuleAttributes.StrongNameSigned;
             }
             // write PDB/MDB?
             if (DebugInfo)


Normalize Trace/Ref Numbers

Normalize Trace/Ref Numbers

--- NerdBudget/NerdBudget.Core/Models/Ledger.cs
+++ NerdBudget/NerdBudget.Core/Models/Ledger.cs
@@ -137,8 +137,11 @@
                 //  replace date numbers with [DATE]
                 tmp = Regex.Replace(tmp, "[0-9]{2}/[0-9]{2}/[0-9]{2,4}", "(MDY)", RegexOptions.Compiled);

-                //  replace date numbers with [DATE]
+                //  replace date numbers with [PHONE]
                 tmp = Regex.Replace(tmp, "[0-9]{3}-[0-9]{3}-[0-9]{4}", "(PHONE)", RegexOptions.Compiled);
+
+                //  replace date numbers with [PHONE]
+                tmp = Regex.Replace(tmp, "ACHTRACE[0-9]+", "(ACHTRACE)", RegexOptions.Compiled);

                 return tmp;
             }


Remove code for mono and Retab

Remove code for mono and Retab

--- PoshComplete/Program.cs
+++ PoshComplete/Program.cs
@@ -10,10 +10,10 @@

 namespace PoshComplete
 {
-	class Program
-	{
-		static void Main(string[] args)
-		{
+    class Program
+    {
+        static void Main(string[] args)
+        {
             if (System.Diagnostics.Process.GetProcessesByName("PoshComplete").Count() == 1)
             {
                 Opts opts = new Opts();
@@ -26,8 +26,8 @@
                     nancyHost.Stop();
                 }
             }
-		}
-	}
+        }
+    }

     class Opts : GetOpt
     {
@@ -48,36 +48,18 @@
                     string line = query.inputText;
                     List<Candidate> list = new List<Candidate>();

-                    #if __MonoCS__
-                        StaticConfiguration.DisableErrorTraces = false;
-                        List<Candidate> candidates;
+                    var candidates =
+                        System.Management.Automation.CommandCompletion.CompleteInput(
+                            line,
+                            line.Length,
+                            null,
+                            System.Management.Automation.PowerShell.Create()
+                        ).CompletionMatches;

-                        string json;
-                        using (var sr = new System.IO.StreamReader("./dictionary/Cmdlet.json", Encoding.GetEncoding("UTF-8")))
-                            json = sr.ReadToEnd();
-
-                        using (var jsonMs = new System.IO.MemoryStream(Encoding.UTF8.GetBytes(json)))
-                            candidates = (List<Candidate>)serializer.ReadObject(jsonMs);
-
-                        foreach (var cand in candidates)
-                            if (cand.word.StartsWith(line, StringComparison.OrdinalIgnoreCase))
-                                list.Add(new Candidate() { word = cand.word.Replace("'", ""),
-                                                           kind = cand.kind.ToString(),
-                                                           menu = cand.menu.Replace("\r\n", "") });
-                    #else
-                        var candidates =
-                            System.Management.Automation.CommandCompletion.CompleteInput(
-                                line,
-                                line.Length,
-                                null,
-                                System.Management.Automation.PowerShell.Create()
-                            ).CompletionMatches;
-
-                        foreach (var cand in candidates)
-                            list.Add(new Candidate() { word = cand.CompletionText.Replace("'", ""),
-                                                       kind = cand.ResultType.ToString(),
-                                                       menu = cand.ToolTip.Replace("\r\n", "") });
-                    #endif
+                    foreach (var cand in candidates)
+                        list.Add(new Candidate() { word = cand.CompletionText.Replace("'", ""),
+                                                    kind = cand.ResultType.ToString(),
+                                                    menu = cand.ToolTip.Replace("\r\n", "") });

                     serializer.WriteObject(ms, list);
                     return Encoding.UTF8.GetString(ms.ToArray(), 0, (int)ms.Length);


Catch errors.

Catch errors.

--- LLconsole/Program.cs
+++ LLconsole/Program.cs
@@ -6,24 +6,34 @@
 namespace LLconsole {
     class Program {
         static void run(string program) {
-            var exp = new LambdaLang.Expression();
-            exp.SetExpression(program);
-            var res = exp.Solve();
-            Console.WriteLine();
-            Console.WriteLine(res.ToString());
+            try {
+                var exp = new LambdaLang.Expression();
+                exp.SetExpression(program);
+                var res = exp.Solve();
+                Console.WriteLine();
+                Console.WriteLine(res.ToString());
+                if (exp.LastError != "") {
+                    Console.WriteLine(exp.LastError);
+                }
+            } catch (Exception e) {
+                Console.WriteLine();
+                Console.WriteLine(e.Message);
+            }
         }

         static void loop() {
             string l;
             do {
-                Console.WriteLine("...");
+                Console.WriteLine("... Enter a LambdaLang expression or program.");
+                Console.WriteLine("... ENTER ENTER to run. ^Z ENTER to exit.");
                 var pg = "";
                 do {
                     l = Console.ReadLine();
                     if (l != null)
                         pg += l;
                 } while (l != null && l != "");
-                run(pg);
+                if (!string.IsNullOrEmpty(pg))
+                    run(pg);
             } while (l != null);
         }


Move seq logging to debug as it is quite normal and only happens for serverlogs and no meaningful info is in the log.

--- PaletteInsightAgent/Output/CsvSerializer.cs
+++ PaletteInsightAgent/Output/CsvSerializer.cs
@@ -107,7 +107,7 @@
                     return filePathWithPart;
                 }

-                Log.Info("Increasing seq-id because file '{0}' already exists", fileNameWithPart);
+                Log.Debug("Increasing seq-id because file '{0}' already exists", fileNameWithPart);

                 // otherwise get the next seq id
                 seqIdx++;


Test for non SLR grammar fails, as intended

--- Piglet/Parser/Construction/ParserBuilder.cs
+++ Piglet/Parser/Construction/ParserBuilder.cs
@@ -206,7 +206,7 @@
                                     // The old value is the shift
                                     e.ShiftSymbol = e.PreviousValue == int.MaxValue
                                         ? grammar.AcceptSymbol // Conflicting with the accept symbol
-                                        : grammar.AllSymbols.First(f => f.TokenNumber == e.PreviousValue);
+                                        : grammar.AllSymbols.FirstOrDefault(f => f.TokenNumber == e.PreviousValue);
                                     throw;
                                 }
                             }


Fix incorrect use of AddPattern

Fix incorrect use of AddPattern

--- Pinta.Core/ImageFormats/FormatDescriptor.cs
+++ Pinta.Core/ImageFormats/FormatDescriptor.cs
@@ -99,7 +99,7 @@

 			if (SystemManager.GetOperatingSystem() != OS.Windows) {
 				foreach (string mime in mimes) {
-					ff.AddPattern (mime);
+					ff.AddMimeType (mime);
 				}
 			}


removed ()

removed ()

--- RoomArrangement/Algorithms/ThrowAndStick.cs
+++ RoomArrangement/Algorithms/ThrowAndStick.cs
@@ -59,13 +59,13 @@
 			// Check for Boundary compliance
 			foreach(Room r in Database.List)
 			{
-				var xFarthest = (r.Anchor.X + r.Space.XDimension - Database.Boundary.XDimension);
+				var xFarthest = r.Anchor.X + r.Space.XDimension - Database.Boundary.XDimension;
 				if(xFarthest > 0)
 					fitnessList.Add(Pow(GaussianFunc(xFarthest), 2));
 				else
 					fitnessList.Add(1d);

-				var yFarthest = (r.Anchor.Y + r.Space.YDimension - Database.Boundary.YDimension);
+				var yFarthest = r.Anchor.Y + r.Space.YDimension - Database.Boundary.YDimension;
 				if(yFarthest > 0)
 					fitnessList.Add(Pow(GaussianFunc(yFarthest), 2));
 				else


Paint the caption area with the MainMenuStrip's BackColor.

--- Sandra.UI/AppTemplate/MenuCaptionBarForm.cs
+++ Sandra.UI/AppTemplate/MenuCaptionBarForm.cs
@@ -19,6 +19,7 @@
 **********************************************************************************/
 #endregion

+using System.Drawing;
 using System.Linq;
 using System.Windows.Forms;

@@ -72,5 +73,19 @@
                     .Sum();
             }
         }
+
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            if (MainMenuStrip != null && MainMenuStrip.Items.Count > 0)
+            {
+                var g = e.Graphics;
+                var mainMenuWidth = MainMenuStrip.Width;
+
+                using (var captionAreaColorBrush = new SolidBrush(MainMenuStrip.BackColor))
+                {
+                    g.FillRectangle(captionAreaColorBrush, new Rectangle(mainMenuWidth, 0, Width - MainMenuStrip.Width, MainMenuStrip.Height));
+                }
+            }
+        }
     }
 }


Optimise emission of empty strings to System.String.Empty.

--- Scripting/Compiler/Emission/MethodWriter.cs
+++ Scripting/Compiler/Emission/MethodWriter.cs
@@ -126,7 +126,11 @@
             else if(T == typeof(string))
             {
                 Debug("Pushing primitive string : \""+(Value as string)+"\"");
-                Generator.Emit(OpCodes.Ldstr, Value as string);
+
+                if (((string)Value).Length == 0)
+                    Generator.Emit(OpCodes.Ldsfld, typeof(string).GetField("Empty"));
+                else
+                    Generator.Emit(OpCodes.Ldstr, Value as string);
             }
             else if(T == typeof(int))
             {


Added back inadvertently deleted methods.

--- Serialization/Generic/TypeSerializerBase.cs
+++ Serialization/Generic/TypeSerializerBase.cs
@@ -26,6 +26,7 @@
 using Org.Edgerunner.DotSerialize.Exceptions;
 using Org.Edgerunner.DotSerialize.Properties;
 using Org.Edgerunner.DotSerialize.Reflection;
+using Org.Edgerunner.DotSerialize.Reflection.Construction;
 using Org.Edgerunner.DotSerialize.Serialization.Factories;
 using Org.Edgerunner.DotSerialize.Serialization.Reference;

@@ -56,7 +57,63 @@
       protected Settings Settings { get; set; }
       protected IReferenceManager RefManager { get; set; }

-      #region ITypeSerializer<T> Members
+      protected virtual object DeserializeAttribute(XmlReader reader, Type type)
+      {
+         if (!((TypeHelper.IsPrimitive(type)) || (TypeHelper.IsEnum(type))))
+            throw new SerializerException("Only primitives or enums can be stored in attributes.");
+
+         object result;
+
+         if (TypeHelper.IsPrimitive(type))
+            result = DeserializePrimitive(type, reader);
+         else if (TypeHelper.IsEnum(type))
+            result = DeserializeEnum(type, reader);
+         else
+            throw new SerializerException(string.Format("Unable to deserialize unexpected type \"{0}\" from an attribute.",
+                                                        type.Name()));
+         return result;
+      }
+
+      protected virtual object DeserializeElement(XmlReader reader, Type type)
+      {
+         object result = null;
+         var actualType = TypeHelper.GetReferenceType(reader) ?? type;
+         if (TypeHelper.IsPrimitive(actualType))
+            result = DeserializePrimitive(actualType, reader);
+         else if (TypeHelper.IsArray(actualType))
+            result = DeserializeArray(actualType, reader);
+         else if (TypeHelper.IsEnum(actualType))
+            result = DeserializeEnum(actualType, reader);
+         else
+         {
+            // Class or struct
+            if (TypeHelper.ReferenceIsNull(reader))
+               return null;
+
+            var memberValues = new Dictionary<TypeMemberInfo, object>();
+            RefManager.StartLateBindingCapture(actualType);
+            var info = Inspector.GetInfo(actualType);
+
+            // read attributes
+            while (reader.MoveToNextAttribute())
+               DeserializeAttribMember(reader, info, memberValues);
+            reader.MoveToContent();
+
+            if (!reader.IsEmptyElement)
+               // read child elements
+               // ReSharper disable once LoopVariableIsNeverChangedInsideLoop
+               while (ReadNextElement(reader))
+                  if (reader.NodeType == XmlNodeType.Element)
+                     DeserializeElementMember(reader, info, memberValues);
+
+            result = TypeFactory.CreateInstance(actualType, memberValues);
+            if (result == null)
+               throw new SerializerException(string.Format("Unable to create an instance of type \"{0}\".", type.Name()));
+
+            RefManager.FinishCaptures(result);
+         }
+         return result;
+      }

       public virtual object Deserialize(XmlReader reader, Type type)
       {
@@ -76,6 +133,42 @@
                           "A custom type serializer probably positioned the reader incorrectly." +
                           "Unable to deserialize type \"{0}\".",
                           type.Name()));
+      }
+
+      protected virtual void SerializeAttribute(XmlWriter writer, object obj, TypeMemberInfo attribute)
+      {
+         writer.WriteStartAttribute(attribute.EntityName);
+         object entityValue = GetEntityValue(obj, attribute);
+         // now we resolve a type serializer to do the work
+         ITypeSerializer typeSerializer =
+            Factory.CallMethod(new[] { attribute.DataType }, "GetTypeSerializer") as ITypeSerializer;
+         if (typeSerializer != null)
+            typeSerializer.Serialize(writer, attribute.DataType, entityValue);
+         else
+         // Since there was no bound custom type serializer we default to the GenericTypeSerializer
+         {
+            var defaultSerializer = Factory.GetDefaultSerializer();
+            defaultSerializer.Serialize(writer, attribute.DataType, entityValue);
+         }
+         writer.WriteEndAttribute();
+      }
+
+      protected virtual void SerializeElement(XmlWriter writer, object obj, TypeMemberInfo element)
+      {
+         writer.WriteStartElement(element.EntityName);
+         // now we resolve a type serializer to do the work
+         ITypeSerializer typeSerializer =
+            Factory.CallMethod(new[] { element.DataType }, "GetTypeSerializer") as ITypeSerializer;
+         object entityValue = GetEntityValue(obj, element);
+         if (typeSerializer != null)
+            typeSerializer.Serialize(writer, element.DataType, entityValue);
+         else
+         // Since there was no bound custom type serializer we default to the GenericTypeSerializer
+         {
+            var defaultSerializer = Factory.GetDefaultSerializer();
+            defaultSerializer.Serialize(writer, element.DataType, entityValue);
+         }
+         writer.WriteEndElement();
       }

       public virtual void Serialize(XmlWriter writer, Type type, object obj)
@@ -157,8 +250,6 @@
          Serialize(writer, typeof(T), obj);
       }

-      #endregion
-
       protected virtual void DeserializeAttribMember(XmlReader reader,
                                                      TypeInfo info,
                                                      Dictionary<TypeMemberInfo, object> memberValues)
@@ -268,42 +359,6 @@
             if (!reader.Read())
                return false;
          return true;
-      }
-
-      protected virtual void SerializeAttribute(XmlWriter writer, object obj, TypeMemberInfo attribute)
-      {
-         writer.WriteStartAttribute(attribute.EntityName);
-         object entityValue = GetEntityValue(obj, attribute);
-         // now we resolve a type serializer to do the work
-         ITypeSerializer typeSerializer =
-            Factory.CallMethod(new[] { attribute.DataType }, "GetTypeSerializer") as ITypeSerializer;
-         if (typeSerializer != null)
-            typeSerializer.Serialize(writer, attribute.DataType, entityValue);
-         else
-         // Since there was no bound custom type serializer we default to the GenericTypeSerializer
-         {
-            var defaultSerializer = Factory.GetDefaultSerializer();
-            defaultSerializer.Serialize(writer, attribute.DataType, entityValue);
-         }
-         writer.WriteEndAttribute();
-      }
-
-      protected virtual void SerializeElement(XmlWriter writer, object obj, TypeMemberInfo element)
-      {
-         writer.WriteStartElement(element.EntityName);
-         // now we resolve a type serializer to do the work
-         ITypeSerializer typeSerializer =
-            Factory.CallMethod(new[] { element.DataType }, "GetTypeSerializer") as ITypeSerializer;
-         object entityValue = GetEntityValue(obj, element);
-         if (typeSerializer != null)
-            typeSerializer.Serialize(writer, element.DataType, entityValue);
-         else
-         // Since there was no bound custom type serializer we default to the GenericTypeSerializer
-         {
-            var defaultSerializer = Factory.GetDefaultSerializer();
-            defaultSerializer.Serialize(writer, element.DataType, entityValue);
-         }
-         writer.WriteEndElement();
       }

       protected virtual object GetEntityValue(object entity, TypeMemberInfo memberInfo)


added Localtime to Table

added Localtime to Table

--- Main/Api/ApiTrade.cs
+++ Main/Api/ApiTrade.cs
@@ -17,6 +17,10 @@
         public decimal vol { get; set; }
         public decimal margin { get; set; }
         public string misc { get; set; }
+
+        public DateTime LocalTime {
+            get { return time.ToLocalTime(); }
+        }

         public ApiTrade() {
             ordertxid = "";
@@ -48,6 +52,7 @@
             dt.Columns.Add("ordertxid");
             dt.Columns.Add("pair");
             dt.Columns.Add("time", DateTime.Now.GetType());
+            dt.Columns.Add("localtime", DateTime.Now.GetType());
             dt.Columns.Add("type");
             dt.Columns.Add("price");
             dt.Columns.Add("cost");
@@ -61,6 +66,7 @@
                 dr["ordertxid"] = Lib.Converter.toString(trade.ordertxid);
                 dr["pair"] = Lib.Converter.toString(trade.pair);
                 dr["time"] = trade.time;
+                dr["localtime"] = trade.LocalTime;
                 dr["type"] = Lib.Converter.toString(trade.type);
                 dr["price"] = Lib.Converter.toString(trade.price);
                 dr["cost"] = Lib.Converter.toString(trade.cost);


Tidying, removed bogus dialog display on fatal error

--- Mamesaver/Program.cs
+++ Mamesaver/Program.cs
@@ -21,6 +21,7 @@
         private static Container _container;
         private static bool _debug;

+
         [STAThread]
         public static void Main(string[] args)
         {
@@ -41,7 +42,7 @@

                 using (AsyncScopedLifestyle.BeginScope(_container))
                 {
-                    var saver = _container.GetInstance<Mamesaver>();
+                    var saver = _container.GetInstance<MameOrchestrator>();

                     switch (arguments[0].Trim().Substring(0, 2).ToLower())
                     {
@@ -84,7 +85,6 @@
         private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
         {
             Log.Error(e.ExceptionObject as Exception, "Thread exception");
-            DisplayError();

             // Screensaver is in an unhandled state; force exit
             Environment.Exit(-1);
@@ -93,8 +93,7 @@
         private static void OnThreadException(object sender, ThreadExceptionEventArgs e)
         {
             Log.Error(e.Exception, "Thread exception");
-            DisplayError();
-            Application.Exit();
+            Environment.Exit(-1);
         }

         private static void DisplayError()
@@ -128,6 +127,9 @@
             Log.Logger = configuration.CreateLogger();
         }

+        /// <summary>
+        ///     Displays the screensaver configuration form.
+        /// </summary>
         public static void ShowConfig()
         {
             Application.EnableVisualStyles();


Added .chm mapping to MimeTypes

Added .chm mapping to MimeTypes

--- MimeKit/MimeTypes.cs
+++ MimeKit/MimeTypes.cs
@@ -103,6 +103,7 @@
 				{ "cer", "application/pkix-cert" },
 				{ "cha", "application/x-chat" },
 				{ "chat", "application/x-chat" },
+				{ "chm", "application/vnd.ms-htmlhelp" },
 				{ "class", "application/x-java-applet" },
 				{ "clp", "application/x-msclip" },
 				{ "cmx", "image/x-cmx" },
@@ -171,7 +172,6 @@
 				{ "fpx", "image/vnd.fpx" },
 				{ "frl", "application/freeloader" },
 				{ "fsx", "application/fsharp-script" },
-				{ "f", "text/plain" },
 				{ "g3", "image/g3fax" },
 				{ "gif", "image/gif" },
 				{ "gl", "video/gl" },
@@ -668,6 +668,7 @@
 				{ "application/vnd.ms-excel.sheet.binary.macroEnabled.12", ".xlsb" },
 				{ "application/vnd.ms-excel.sheet.macroEnabled.12", ".xlsm" },
 				{ "application/vnd.ms-excel.template.macroEnabled.12", ".xltm" },
+				{ "application/vnd.ms-htmlhelp", ".chm" },
 				{ "application/vnd.ms-pki.certstore", ".sst" },
 				{ "application/vnd.ms-pki.pko", ".pko" },
 				{ "application/vnd.ms-pki.seccat", ".cat" },


Update translation library

Update translation library

Fixes one-way bindings

--- SierraLib.Translation/TranslateExtension.cs
+++ SierraLib.Translation/TranslateExtension.cs
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Markup;
-using System.Windows.Data;
-
-namespace SierraLib.Translation
-{
-    public class TranslateExtension : System.Windows.Markup.MarkupExtension
-    {
-        private string _key;
-        private string _default;
-
-        public TranslateExtension()
-            : this("unknown")
-        { }
-
-        public TranslateExtension(string key)
-            : this(key, null)
-        {   }
-
-        public TranslateExtension(string key, string defaultValue)
-        {
-            _key = key;
-            _default = defaultValue;
-        }
-
-        [ConstructorArgument("key")]
-        public string Key
-        {
-            get { return _key; }
-            set { _key = value; }
-        }
-
-        [ConstructorArgument("defaultValue")]
-        public string Default
-        {
-            get { return _default; }
-            set { _default = value; }
-        }
-
-        public override object ProvideValue(IServiceProvider serviceProvider)
-        {
-            var binding = new Binding("Value")
-                  {
-                      Source = new TranslationBinding(_key, _default)
-                  };
-            return binding.ProvideValue(serviceProvider);
-        }
-    }
-}


allow comment out UserConnections

allow comment out UserConnections

--- Signum.Engine/Connection/UserConnections.cs
+++ Signum.Engine/Connection/UserConnections.cs
@@ -25,7 +25,7 @@

             Debug.WriteLine("UserConnection's file found on {0}".Formato(FileName));
             Debug.WriteLine("{0}".Formato(File.ReadAllText(FileName)));
-            return File.ReadAllLines(FileName).Select(s => s.Split('>')).ToDictionary(a => a[0], a => a[1]);
+            return File.ReadAllLines(FileName).Where(s=>s.HasText() && !s.StartsWith("-") && !s.StartsWith("/")).Select(s => s.Split('>')).ToDictionary(a => a[0], a => a[1]);
         }

         public static string Replace(string connectionString)


[ListHelper] Added "if" before setting default value of a field.

--- Source/GSoft.Dynamite/Helpers/ListHelper.cs
+++ Source/GSoft.Dynamite/Helpers/ListHelper.cs
@@ -756,9 +756,12 @@

                         // Change managed metadata mapping
                         this.taxonomyHelper.AssignTermSetToListColumn(list, field.Id, termGroupName, termSetName, termSubsetName);
-
+
                         // Set the default value for the field
-                        this.taxonomyHelper.SetDefaultTaxonomyFieldValue(list.ParentWeb, field as TaxonomyField, taxonomyValue);
+                        if (taxonomyValue != null)
+                        {
+                            this.taxonomyHelper.SetDefaultTaxonomyFieldValue(list.ParentWeb, field as TaxonomyField, taxonomyValue);
+                        }
                     }
                     else if (field.GetType() == typeof(SPFieldText) && (fieldDefinition.GetType() == typeof(TextFieldInfo)))
                     {


Render id if supplied

Render id if supplied

--- Navigation/Sorter.cs
+++ Navigation/Sorter.cs
@@ -305,6 +305,8 @@
 		protected override void RenderContents(HtmlTextWriter writer)
 		{
 			SetChildProperties();
+			if (!string.IsNullOrEmpty(ID))
+				writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
 			base.RenderContents(writer);
 		}
 	}


Fix attempt for filter overlflow

Fix attempt for filter overlflow

--- Source/Miruken/Callback/FilterExtensions.cs
+++ Source/Miruken/Callback/FilterExtensions.cs
@@ -72,6 +72,9 @@
                         allProviders = allProviders.Where(p => p.Required);
                     handler = handler.SkipFilters();
                     break;
+                case false:
+                    handler = handler.SkipFilters();
+                    break;
             }

             var ordered = new SortedSet<(IFilter, IFilterProvider)>(FilterComparer.Instance);


Fixed updating points for the limit line when actualPoints count is 1.

--- Source/OxyPlot/Series/TwoColorAreaSeries.cs
+++ Source/OxyPlot/Series/TwoColorAreaSeries.cs
@@ -283,11 +283,15 @@
             base.UpdateData();

             // update points from the limit line
-            if (this.ActualPoints != null && this.ActualPoints.Count > 1)
+            if (this.ActualPoints != null )
             {
                 this.points2.Clear();
-                this.points2.Add(new DataPoint(this.ActualPoints.Min(el => el.X), this.Limit));
-                this.points2.Add(new DataPoint(this.ActualPoints.Max(el => el.X), this.Limit));
+
+                if (this.ActualPoints.Count > 1)
+                {
+                    this.points2.Add(new DataPoint(this.ActualPoints.Min(el => el.X), this.Limit));
+                    this.points2.Add(new DataPoint(this.ActualPoints.Max(el => el.X), this.Limit));
+                }
             }
         }


Fixed bug in reading WNF state information.

--- NtApiDotNet/NtWnf.cs
+++ NtApiDotNet/NtWnf.cs
@@ -210,7 +210,7 @@
                         return;
                     }

-                    var value = key.Result.QueryValue(StateName.ToString("X"), false);
+                    var value = key.Result.QueryValue(StateName.ToString("X016"), false);
                     if (value.IsSuccess)
                     {
                         ReadStateData(value.Result);


Notes to clarify when part requests are active

--- Source/Parameters/DMPartRequestParameter.cs
+++ Source/Parameters/DMPartRequestParameter.cs
@@ -119,7 +119,7 @@

 		protected override string GetNotes()
 		{
-			return base.GetNotes();
+			return "Only vessels in orbit around the target planet are tracked.";
 		}

 		protected override void OnUpdate()


Updated to Box2D rev 101

Updated to Box2D rev 101

--- SourceFiles/FP3.0/Collision/TimeOfImpact.cs
+++ SourceFiles/FP3.0/Collision/TimeOfImpact.cs
@@ -70,7 +70,7 @@

         public SeparationFunction(ref SimplexCache cache,
                                   ref DistanceProxy proxyA, ref Sweep sweepA,
-                                  ref DistanceProxy proxyB, ref Sweep sweepB)
+                                  ref DistanceProxy proxyB, ref Sweep sweepB, float t1)
         {
             _localPoint = Vector2.Zero;
             _proxyA = proxyA;
@@ -82,8 +82,8 @@
             _sweepB = sweepB;

             Transform xfA, xfB;
-            _sweepA.GetTransform(out xfA, 0.0f);
-            _sweepB.GetTransform(out xfB, 0.0f);
+            _sweepA.GetTransform(out xfA, t1);
+            _sweepB.GetTransform(out xfB, t1);

             if (count == 1)
             {
@@ -311,7 +311,7 @@
             const float tolerance = 0.25f * Settings.LinearSlop;
             Debug.Assert(target > tolerance);

-            float t1 = 0.0f;
+            const float t1 = 0.0f;
             const int k_maxIterations = 20; // TODO_ERIN: b2Settings
             int iter = 0;

@@ -347,7 +347,7 @@
                 }

                 SeparationFunction fcn = new SeparationFunction(ref cache, ref input.ProxyA, ref sweepA,
-                                                                ref input.ProxyB, ref sweepB);
+                                                                ref input.ProxyB, ref sweepB, t1);

                 // Compute the TOI on the separating axis. We do this by successively
                 // resolving the deepest point. This loop is bounded by the number of vertices.


Optimise LinqBridge.Enumerable.Where

Optimise LinqBridge.Enumerable.Where

--- Src/Newtonsoft.Json/Utilities/LinqBridge.cs
+++ Src/Newtonsoft.Json/Utilities/LinqBridge.cs
@@ -158,11 +158,20 @@
       this IEnumerable<TSource> source,
       Func<TSource, bool> predicate)
     {
+      CheckNotNull(source, "source");
       CheckNotNull(predicate, "predicate");

-      return source.Where((item, i) => predicate(item));
-    }
-
+      return WhereYield(source, predicate);
+    }
+
+    private static IEnumerable<TSource> WhereYield<TSource>(
+      IEnumerable<TSource> source,
+      Func<TSource, bool> predicate)
+    {
+      foreach (var item in source)
+        if (predicate(item))
+          yield return item;
+    }
     /// <summary>
     /// Filters a sequence of values based on a predicate.
     /// Each element's index is used in the logic of the predicate function.


Update TablatureDocument file version to 1.4.1.

--- Tabster.Core/FileTypes/TablatureDocument.cs
+++ Tabster.Core/FileTypes/TablatureDocument.cs
@@ -14,7 +14,7 @@
         #region Constants

         public const string FILE_EXTENSION = ".tabster";
-        public static readonly Version FILE_VERSION = new Version("1.4");
+        public static readonly Version FILE_VERSION = new Version("1.4.1");

         #endregion


String key needs to be declared with @ prefix

The key generated sometimes contains "/", therefore it should be declared as a verbatim string

--- resources/payload-templates/dropper.cs
+++ resources/payload-templates/dropper.cs
@@ -221,7 +221,7 @@
 			foreach (string du in Program.basearray)
 			{
 				var o = String.Format("{0};{1};{2};{3};{4};#REPLACEURLID#", dn, u, cn, arch, pid);
-			 	string key = "#REPLACEKEY#";
+			 	string key = @"#REPLACEKEY#";
 			 	baseURL = du;
 			 	string s = baseURL+"#REPLACESTARTURL#";
 				try {


fixed tests

fixed tests

--- TrueNorth.Elmah.Tests/TraceListenerTests.cs
+++ TrueNorth.Elmah.Tests/TraceListenerTests.cs
@@ -55,7 +55,7 @@
             var logs = ErrorLog.Default.GetErrors(0, 10, errors);

             Assert.AreEqual(5, logs);
-            Assert.AreEqual("TraceWarning", errors.First().Error.Message);
+            Assert.AreEqual("!WriteLine!", errors.First().Error.Message);
             Assert.AreEqual("ErrorMessage 1,2,3", errors.Last().Error.Message);

         }


Shoehorn the module view into 16:9 aspect ratio regardless of resolution.

--- TwitchPlaysAssembly/Src/UI/ModuleCameras.cs
+++ TwitchPlaysAssembly/Src/UI/ModuleCameras.cs
@@ -235,6 +235,7 @@
         {
             Camera instantiatedCamera = Instantiate<Camera>(camera);
             cameras.Add( new ModuleCamera(instantiatedCamera, this) );
+	        instantiatedCamera.aspect = (9f / 16f) / (instantiatedCamera.rect.width / instantiatedCamera.rect.height);
         }
         stacks[0] = pinnedModuleStack;
         stacks[1] = priorityModuleStack;


modify: Token#ToStringの実装を文字列リテラルに変更

modify: Token#ToStringの実装を文字列リテラルに変更

--- lury-lexer/Token.cs
+++ lury-lexer/Token.cs
@@ -134,11 +134,7 @@
         /// </summary>
         /// <returns>トークンエントリの名前、出現位置そしてトークン文字列を含む文字列。</returns>
         public override string ToString()
-            => string.Format(
-                "{0} {1}{2}",
-                this.CodePosition.CharPosition,
-                this.Entry.Name,
-                this.Entry.Name.Length > 1 ? " - " + this.Text : "");
+            => $"{this.CodePosition.CharPosition} {this.Entry.Name}{(this.Entry.Name.Length > 1 ? " - " + this.Text : "")}";

         #endregion
     }


AdventureSample - refactor subroutine line detection

--- projects/AdventureSample/src/GWBas2CS/BasicVisitor.cs
+++ projects/AdventureSample/src/GWBas2CS/BasicVisitor.cs
@@ -959,8 +959,7 @@
             private readonly SyntaxGenerator generator;
             private readonly SortedList<int, Line> statements;
             private readonly HashSet<int> references;
-            private readonly HashSet<int> subStarts;
-            private readonly HashSet<int> subEnds;
+            private readonly SubLines subLines;
             private readonly Loops loops;

             public Lines(SyntaxGenerator generator)
@@ -968,8 +967,7 @@
                 this.generator = generator;
                 this.statements = new SortedList<int, Line>();
                 this.references = new HashSet<int>();
-                this.subStarts = new HashSet<int>();
-                this.subEnds = new HashSet<int>();
+                this.subLines = new SubLines();
                 this.loops = new Loops();
             }

@@ -1004,43 +1002,40 @@
                 var case2 = this.generator.SwitchSection(this.generator.LiteralExpression(2), new SyntaxNode[] { ret2 });
                 var call = this.generator.InvocationExpression(this.generator.IdentifierName("Sub_" + destination));
                 this.Add(number, this.generator.SwitchStatement(call, case1, case2));
-                this.subStarts.Add(destination);
+                this.subLines.AddStart(destination);
             }

             public void AddReturn(int number)
             {
                 var ret = this.generator.ReturnStatement(this.generator.LiteralExpression(0));
                 this.Add(number, ret);
-                this.subEnds.Add(number);
+                this.subLines.AddEnd(number);
             }

             public IEnumerable<SyntaxNode> Subroutines()
             {
                 string subName = null;
-                List<SyntaxNode> subLines = new List<SyntaxNode>();
+                List<SyntaxNode> statements = new List<SyntaxNode>();
                 foreach (KeyValuePair<int, Line> line in this.statements)
                 {
-                    if (subName == null)
-                    {
-                        if (this.subStarts.Contains(line.Key))
-                        {
-                            subName = "Sub_" + line.Key;
-                        }
+                    if ((subName == null) && this.subLines.IsStart(line.Key))
+                    {
+                        subName = "Sub_" + line.Key;
                     }

                     if (subName != null)
                     {
-                        subLines.AddRange(line.Value.Nodes(this.references));
-                        if (this.subEnds.Contains(line.Key))
+                        statements.AddRange(line.Value.Nodes(this.references));
+                        if (this.subLines.IsEnd(line.Key))
                         {
                             var ret = this.generator.TypeExpression(SpecialType.System_Int32);
                             yield return this.generator.MethodDeclaration(
                                 subName,
                                 returnType: ret,
                                 accessibility: Accessibility.Private,
-                                statements: subLines);
+                                statements: statements);
                             subName = null;
-                            subLines.Clear();
+                            statements.Clear();
                         }
                     }
                 }
@@ -1053,14 +1048,14 @@
                 {
                     if (readingSub)
                     {
-                        if (this.subEnds.Contains(line.Key))
+                        if (this.subLines.IsEnd(line.Key))
                         {
                             readingSub = false;
                         }
                     }
                     else
                     {
-                        if (this.subStarts.Contains(line.Key))
+                        if (this.subLines.IsStart(line.Key))
                         {
                             readingSub = true;
                         }
@@ -1203,6 +1198,37 @@
                     }
                 }
             }
+
+            private sealed class SubLines
+            {
+                private readonly List<int> starts;
+                private readonly List<int> ends;
+
+                public SubLines()
+                {
+                    this.starts = new List<int>();
+                    this.ends = new List<int>();
+                }
+
+                public void AddStart(int n) => Add(this.starts, n);
+
+                public bool IsStart(int n) => Find(this.starts, n);
+
+                public void AddEnd(int n) => Add(this.ends, n);
+
+                public bool IsEnd(int n) => Find(this.ends, n);
+
+                private static void Add(List<int> list, int n)
+                {
+                    int i = list.BinarySearch(n);
+                    if (i < 0)
+                    {
+                        list.Insert(~i, n);
+                    }
+                }
+
+                private static bool Find(List<int> list, int n) => list.BinarySearch(n) >= 0;
+            }
         }
     }
 }


Fix possible empty statement waring.

Fix possible empty statement waring.

--- src/CCDirector.cs
+++ src/CCDirector.cs
@@ -591,8 +591,8 @@

                 // In Seconds
                 Scheduler.Update(deltaTime);
-                if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_UPDATE));
-                EventDispatcher.DispatchEvent(eventAfterUpdate);
+                if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_UPDATE))
+                	EventDispatcher.DispatchEvent(eventAfterUpdate);
             }

             /* to avoid flickr, nextScene MUST be here: after tick and before draw.


Display tool overlays in front on toggle

--- osu.Framework/Game.cs
+++ osu.Framework/Game.cs
@@ -271,6 +271,8 @@

         private Bindable<ExecutionMode> executionMode;

+        private float currentOverlayDepth;
+
         public bool OnPressed(KeyBindingPressEvent<FrameworkAction> e)
         {
             if (e.Repeat)
@@ -303,12 +305,14 @@
                     {
                         LoadComponentAsync(drawVisualiser = new DrawVisualiser
                         {
+                            State = { Value = Visibility.Visible },
+                            Depth = getNextFrontMostOverlayDepth(),
                             ToolPosition = getCascadeLocation(0),
-                            Depth = float.MinValue / 2,
                         }, overlayContent.Add);
                     }
-
-                    drawVisualiser.ToggleVisibility();
+                    else
+                        toggleOverlay(drawVisualiser);
+
                     return true;

                 case FrameworkAction.ToggleGlobalStatistics:
@@ -317,12 +321,14 @@
                     {
                         LoadComponentAsync(globalStatistics = new GlobalStatisticsDisplay
                         {
-                            Depth = float.MinValue / 2,
+                            State = { Value = Visibility.Visible },
                             Position = getCascadeLocation(1),
+                            Depth = getNextFrontMostOverlayDepth(),
                         }, overlayContent.Add);
                     }
-
-                    globalStatistics.ToggleVisibility();
+                    else
+                        toggleOverlay(globalStatistics);
+
                     return true;

                 case FrameworkAction.ToggleAtlasVisualiser:
@@ -331,12 +337,14 @@
                     {
                         LoadComponentAsync(textureVisualiser = new TextureVisualiser
                         {
+                            State = { Value = Visibility.Visible },
                             Position = getCascadeLocation(2),
-                            Depth = float.MinValue / 2,
+                            Depth = getNextFrontMostOverlayDepth(),
                         }, overlayContent.Add);
                     }
-
-                    textureVisualiser.ToggleVisibility();
+                    else
+                        toggleOverlay(textureVisualiser);
+
                     return true;

                 case FrameworkAction.ToggleAudioMixerVisualiser:
@@ -344,12 +352,14 @@
                     {
                         LoadComponentAsync(audioMixerVisualiser = new AudioMixerVisualiser
                         {
+                            State = { Value = Visibility.Visible },
                             Position = getCascadeLocation(3),
-                            Depth = float.MinValue / 2,
+                            Depth = getNextFrontMostOverlayDepth(),
                         }, overlayContent.Add);
                     }
-
-                    audioMixerVisualiser.ToggleVisibility();
+                    else
+                        toggleOverlay(audioMixerVisualiser);
+
                     return true;

                 case FrameworkAction.ToggleLogOverlay:
@@ -384,6 +394,16 @@
             static Vector2 getCascadeLocation(int index)
                 => new Vector2(100 + index * (TitleBar.HEIGHT + 10));
         }
+
+        private void toggleOverlay(OverlayContainer overlay)
+        {
+            overlay.ToggleVisibility();
+
+            if (overlay.State.Value == Visibility.Visible)
+                overlayContent.ChangeChildDepth(overlay, getNextFrontMostOverlayDepth());
+        }
+
+        private float getNextFrontMostOverlayDepth() => currentOverlayDepth -= 0.01f;

         public void OnReleased(KeyBindingReleaseEvent<FrameworkAction> e)
         {


Make sure to freeze bitmaps.  Also change pixel writing mechanism to 1 copy from 2

--- source/SharpGL/Core/SharpGL.WPF/OpenGLControl.xaml.cs
+++ source/SharpGL/Core/SharpGL.WPF/OpenGLControl.xaml.cs
@@ -4,6 +4,7 @@
 using System;
 using System.ComponentModel;
 using System.Diagnostics;
+using System.Runtime.InteropServices;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Interop;
@@ -112,7 +113,8 @@

                 // JWH - FOR NEW RENDER METHOD
                 // Force re-creation of image buffer since size has changed
-                m_imageBuffer = null;
+                if (m_writeableBitmap?.CanFreeze == true)
+                    m_writeableBitmap.Freeze();
             }
         }

@@ -161,22 +163,22 @@
             gl.ThrowIfErrors();

             //  Fire the OpenGL initialised event.
-            var handler = OpenGLInitialized;
-            if (handler != null)
-                handler(this, eventArgsFast);
+            OpenGLInitialized?.Invoke(this, eventArgsFast);

             timer.Interval = new TimeSpan(0, 0, 0, 0, (int)(1000.0 / FrameRate));
         }

         // JWH - Fields to support the WritableBitmap method of rendering the image for display
-        byte[] m_imageBuffer;
         WriteableBitmap m_writeableBitmap;
         Int32Rect m_imageRect;
-        int m_imageStride;
+        int m_imageSize;
         double m_dpiX = 0;
         double m_dpiY = 0;
         PixelFormat m_format = PixelFormats.Bgra32;
         int m_bytesPerPixel = 32 >> 3;
+
+        [DllImport("Kernel32.dll", EntryPoint = "RtlMoveMemory")]
+        public static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);

         /// <summary>
         /// JWH - FOR NEW RENDER METHOD
@@ -213,24 +215,25 @@
                 }
             }

+
+
             // If the image buffer is null, create it
             // This should happen when the size of the image changes
-            if (m_imageBuffer == null)
+            if (m_writeableBitmap == null || m_writeableBitmap.IsFrozen)
             {
                 int width = gl.RenderContextProvider.Width;
                 int height = gl.RenderContextProvider.Height;
-
-                int imageBufferSize = width * height * m_bytesPerPixel;
-                m_imageBuffer = new byte[imageBufferSize];
+                m_imageSize = width * height * m_bytesPerPixel;
                 m_writeableBitmap = new WriteableBitmap(width, height, m_dpiX, m_dpiY, m_format, null);
                 m_imageRect = new Int32Rect(0, 0, width, height);
-                m_imageStride = width * m_bytesPerPixel;
                 image.Source = m_writeableBitmap;
             }

             // Fill the image buffer from the bits and create the writeable bitmap
-            System.Runtime.InteropServices.Marshal.Copy(bits, m_imageBuffer, 0, m_imageBuffer.Length);
-            m_writeableBitmap.WritePixels(m_imageRect, m_imageBuffer, m_imageStride, 0);
+            m_writeableBitmap.Lock();
+            CopyMemory(m_writeableBitmap.BackBuffer, bits, m_imageSize);
+            m_writeableBitmap.AddDirtyRect(m_imageRect);
+            m_writeableBitmap.Unlock();
         }

         public BitmapSource Snapshot(int width, int height)
@@ -273,7 +276,9 @@
                     }
                 }

-                return new TransformedBitmap(m_writeableBitmap, new ScaleTransform(1.0, -1.0));
+                BitmapSource toReturn = new TransformedBitmap(m_writeableBitmap, new ScaleTransform(1.0, -1.0));
+                toReturn.Freeze();
+                return toReturn;
             }
             finally
             {


Reorder toggle cases and move mixer visualiser default

--- osu.Framework/Game.cs
+++ osu.Framework/Game.cs
@@ -270,6 +270,20 @@

                     return true;

+                case FrameworkAction.ToggleDrawVisualiser:
+
+                    if (drawVisualiser == null)
+                    {
+                        LoadComponentAsync(drawVisualiser = new DrawVisualiser
+                        {
+                            ToolPosition = new Vector2(100),
+                            Depth = float.MinValue / 2,
+                        }, AddInternal);
+                    }
+
+                    drawVisualiser.ToggleVisibility();
+                    return true;
+
                 case FrameworkAction.ToggleGlobalStatistics:

                     if (globalStatistics == null)
@@ -284,20 +298,6 @@
                     globalStatistics.ToggleVisibility();
                     return true;

-                case FrameworkAction.ToggleDrawVisualiser:
-
-                    if (drawVisualiser == null)
-                    {
-                        LoadComponentAsync(drawVisualiser = new DrawVisualiser
-                        {
-                            ToolPosition = new Vector2(100),
-                            Depth = float.MinValue / 2,
-                        }, AddInternal);
-                    }
-
-                    drawVisualiser.ToggleVisibility();
-                    return true;
-
                 case FrameworkAction.ToggleAtlasVisualiser:

                     if (textureVisualiser == null)
@@ -312,6 +312,19 @@
                     textureVisualiser.ToggleVisibility();
                     return true;

+                case FrameworkAction.ToggleAudioMixerVisualiser:
+                    if (audioMixerVisualiser == null)
+                    {
+                        LoadComponentAsync(audioMixerVisualiser = new AudioMixerVisualiser
+                        {
+                            Position = new Vector2(100, 100 + TitleBar.HEIGHT + 5),
+                            Depth = float.MinValue / 2,
+                        }, AddInternal);
+                    }
+
+                    audioMixerVisualiser.ToggleVisibility();
+                    return true;
+
                 case FrameworkAction.ToggleLogOverlay:
                     logOverlayVisibility.Value = !logOverlayVisibility.Value;
                     return true;
@@ -337,18 +350,6 @@

                     executionMode.Value = nextExecutionMode;
                     break;
-
-                case FrameworkAction.ToggleAudioMixerVisualiser:
-                    if (audioMixerVisualiser == null)
-                    {
-                        LoadComponentAsync(audioMixerVisualiser = new AudioMixerVisualiser
-                        {
-                            Depth = float.MinValue / 2,
-                        }, AddInternal);
-                    }
-
-                    audioMixerVisualiser.ToggleVisibility();
-                    return true;
             }

             return false;


minor refactor

minor refactor

--- source/Utils/PeanutButter.Utils/MetadataExtensions.cs
+++ source/Utils/PeanutButter.Utils/MetadataExtensions.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Collections.Generic;
 using System.Runtime.CompilerServices;
 using System.Threading;


Throw exceptions instead of allowing access to private API for now

--- src/Connection.cs
+++ src/Connection.cs
@@ -453,7 +453,7 @@
 				replyMsg.Body = writer.ToArray ();
 			}

-			//temporary hack to make p2p work, maybe we should always send the Destination?
+			//TODO: we should be more strict here, but this fallback was added as a quick fix for p2p
 			if (method_call.Sender != null)
 				replyMsg.Header.Fields[FieldCode.Destination] = method_call.Sender;

@@ -478,7 +478,7 @@
 				replyMsg.Body = writer.ToArray ();
 			}

-			//temporary hack to make p2p work, maybe we should always send the Destination?
+			//TODO: we should be more strict here, but this fallback was added as a quick fix for p2p
 			if (method_call.Sender != null)
 				replyMsg.Header.Fields[FieldCode.Destination] = method_call.Sender;

@@ -541,6 +541,15 @@

 				//FIXME: breaks for overloaded methods
 				MethodInfo mi = type.GetMethod (methodName, BindingFlags.Public | BindingFlags.Instance);
+
+				//TODO: send errors instead of passing up local exceptions for these
+
+				if (mi == null)
+					throw new Exception ("The requested method could not be resolved");
+
+				if (!Mapper.IsPublic (mi))
+					throw new Exception ("The resolved method is not marked as being public on this bus");
+
 				object retObj = null;
 			 	try {
 					retObj = mi.Invoke (obj, GetDynamicValues (method_call.message, mi.GetParameters ()));
@@ -570,6 +579,7 @@
 					writer.Write (ie.Message);
 					error.message.Body = writer.ToArray ();

+					//TODO: we should be more strict here, but this fallback was added as a quick fix for p2p
 					if (method_call.Sender != null)
 						error.message.Header.Fields[FieldCode.Destination] = method_call.Sender;


AdventureSample - extract Wave method

AdventureSample - extract Wave method


Fix the MouseClick generator for #19

Fix the MouseClick generator for #19

In #19 it was found that the MouseClick would do 2x a mouse down, and not mouse down & up.

--- src/Dapplo.Windows.Input/Mouse/MouseInputGenerator.cs
+++ src/Dapplo.Windows.Input/Mouse/MouseInputGenerator.cs
@@ -20,7 +20,7 @@
     /// <returns>number of input events generated</returns>
     public static uint MouseClick(MouseButtons mouseButtons, NativePoint? location = null, uint? timestamp = null)
     {
-        return NativeInput.SendInput(Structs.Input.CreateMouseInputs(MouseInput.MouseDown(mouseButtons, location, timestamp), MouseInput.MouseDown(mouseButtons, location, timestamp)));
+        return NativeInput.SendInput(Structs.Input.CreateMouseInputs(MouseInput.MouseDown(mouseButtons, location, timestamp), MouseInput.MouseUp(mouseButtons, location, timestamp)));
     }

     /// <summary>
@@ -73,4 +73,4 @@
         var mouseInput = MouseInput.MoveMouseWheel(wheelDelta, location, timestamp);
         return NativeInput.SendInput(Structs.Input.CreateMouseInputs(mouseInput));
     }
-}+}


Included Tests

Included Tests

--- src/DatenMeister.Tests/Runtime/Extents/ExtentTests.cs
+++ src/DatenMeister.Tests/Runtime/Extents/ExtentTests.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using Autofac;
 using DatenMeister.Core.EMOF.Implementation;
+using DatenMeister.Core.EMOF.Implementation.AutoEnumerate;
 using DatenMeister.Core.EMOF.Interface.Reflection;
 using DatenMeister.Integration;
 using DatenMeister.Modules.ZipExample;
@@ -113,6 +114,45 @@
         }

         [Test]
+        public void TestAutoEnumerateType()
+        {
+            var path = "./test.xmi";
+            var loaderConfig = new XmiStorageConfiguration("datenmeister:///data")
+            {
+                filePath = path,
+                workspaceId = WorkspaceNames.NameData
+            };
+
+            using (var dm = DatenMeisterTests.GetDatenMeisterScope())
+            {
+                if (File.Exists(path))
+                {
+                    File.Delete(path);
+                }
+
+                var extentLoader = dm.Resolve<IExtentManager>();
+                var loadedExtent = extentLoader.LoadExtent(loaderConfig, ExtentCreationFlags.LoadOrCreate);
+                loadedExtent.GetConfiguration().AutoEnumerateType = AutoEnumerateType.Ordinal;
+                extentLoader.StoreExtent(loadedExtent);
+
+                dm.UnuseDatenMeister();
+            }
+
+            using (var dm = DatenMeisterTests.GetDatenMeisterScope(dropDatabase: false))
+            {
+                var workspaceLogic = dm.Resolve<IWorkspaceLogic>();
+                var foundExtent = workspaceLogic.FindExtent("datenmeister:///data");
+                Assert.That(foundExtent, Is.Not.Null);
+                Assert.That(foundExtent.GetConfiguration().AutoEnumerateType, Is.EqualTo(AutoEnumerateType.Ordinal));
+
+                foundExtent.GetConfiguration().AutoEnumerateType = AutoEnumerateType.Guid;
+                Assert.That(foundExtent.GetConfiguration().AutoEnumerateType, Is.EqualTo(AutoEnumerateType.Guid));
+
+                dm.UnuseDatenMeister();
+            }
+        }
+
+        [Test]
         public void TestAddDefaultExtentType()
         {
             using var dm = DatenMeisterTests.GetDatenMeisterScope();