FIX node constraint evaluation logics

FIX node constraint evaluation logics

--- RDFSharp/Model/Validation/Abstractions/Constraints/RDFNodeConstraint.cs
+++ RDFSharp/Model/Validation/Abstractions/Constraints/RDFNodeConstraint.cs
@@ -63,29 +63,17 @@

             //Evaluate node shape
             RDFValidationReport nodeshapeReport = nodeShape.EvaluateShape(validationContext,
-                new RDFValidationOptions() {
-                    PreserveExistingContextData = true
-                });
-
-            //Evaluate focus nodes
-            validationContext.FocusNodes.ForEach(focusNode => {
+                new RDFValidationOptions() { PreserveExistingContextData = true });

-                //Get value nodes of current focus node
-                validationContext.ValueNodes[focusNode.PatternMemberID].ForEach(valueNode => {
-
-                    //Evaluate current value node
-                    if (nodeshapeReport.Any(result => result.FocusNode.Equals(valueNode)))
-                        report.AddResult(new RDFValidationResult(validationContext.Shape,
-                                                                 RDFVocabulary.SHACL.NODE_CONSTRAINT_COMPONENT,
-                                                                 focusNode,
-                                                                 validationContext.Shape is RDFPropertyShape ? ((RDFPropertyShape)validationContext.Shape).Path : null,
-                                                                 valueNode,
-                                                                 validationContext.Shape.Messages,
-                                                                 validationContext.Shape.Severity));
-
-                });
-
-            });
+            //Report node shape evidences
+            foreach (RDFValidationResult nodeshapeResult in nodeshapeReport)
+                report.AddResult(new RDFValidationResult(validationContext.Shape,
+                                                         RDFVocabulary.SHACL.NODE_CONSTRAINT_COMPONENT,
+                                                         nodeshapeResult.FocusNode,
+                                                         validationContext.Shape is RDFPropertyShape ? ((RDFPropertyShape)validationContext.Shape).Path : null,
+                                                         nodeshapeResult.ResultValue,
+                                                         validationContext.Shape.Messages,
+                                                         validationContext.Shape.Severity));
             #endregion

             return report;


Added some basics

Added some basics

--- NBCAsm/Program.cs
+++ NBCAsm/Program.cs
@@ -1,23 +1,41 @@
 using System;
+using System.Diagnostics;

 namespace NBCAsm
 {
     class Program
     {
+        static string fileName = "";
+
         static void Main(string[] args)
         {
-            if (args.GetUpperBound(0)!=0)
+            if (args.GetLength(0)!=0)
             {
+                Debug.WriteLine("There are args");
                 foreach (string arg in args)
                 {
                     //Help argument
                     if (arg == "-help" || arg == "-h")
                     {
-                        Console.WriteLine("NBC Assembler Ver {0}", System.Reflection.Assembly.GetEntryAssembly().GetName().Version);
+                        Debug.WriteLine("ArgumentFound: " + arg);
+                        Console.WriteLine("NBC Assembler Ver {0}", "b1.0" );
+                        Console.WriteLine("Archeticture: PC-.NETCore");
+                        Console.WriteLine();
+                        Console.WriteLine("Syntax: NBCAsm <file> [-h|-help]");
                         Console.ReadLine();
+                    }
+
+                    if (!arg.StartsWith("-"))
+                    {
+                        fileName = arg;
                     }
                 }
             }
+            else
+            {
+                Debug.WriteLine("There are no args");
+            }
+            Console.ReadLine();
         }
     }
 }


DDDInterrogation uses 32 bit quantities, not 64 bit. (#530)

Though the client doesn't seem to mind.

--- Source/ACE/Network/GameMessages/Messages/GameMessageDDDInterrogation.cs
+++ Source/ACE/Network/GameMessages/Messages/GameMessageDDDInterrogation.cs
@@ -7,12 +7,12 @@
         public GameMessageDDDInterrogation()
             : base(GameMessageOpcode.DDD_Interrogation, GameMessageGroup.DatabaseQueue)
         {
-            Writer.Write(1ul);
-            Writer.Write(1ul);
-            Writer.Write(1ul);
-            Writer.Write(2ul);
-            Writer.Write(0ul);
-            Writer.Write(1ul);
+            Writer.Write(1u);
+            Writer.Write(1u);
+            Writer.Write(1u);
+            Writer.Write(2u);
+            Writer.Write(0u);
+            Writer.Write(1u);
         }
     }
 }


Bug fix

Bug fix

--- Source/HelixToolkit.SharpDX.Shared/Model/Scene/Abstract/GeometryNode.cs
+++ Source/HelixToolkit.SharpDX.Shared/Model/Scene/Abstract/GeometryNode.cs
@@ -49,6 +49,7 @@
                 if(Set(ref instances, value))
                 {
                     BoundManager.Instances = value;
+                    InstanceBuffer.Elements = value;
                 }
             }
             get { return instances; }


Close PID file stream

Close PID file stream

--- NodeController.cs
+++ NodeController.cs
@@ -95,15 +95,17 @@
             // Search for an existing wrapper process.
             try
             {
-                var reader = new StreamReader(pidFilename);
-                var line = reader.ReadLine();
-
-                if (line != null)
-                {
-                    var pid = int.Parse(line);
-                    _wrapper = Process.GetProcessById(pid);
-                    _wrapper.EnableRaisingEvents = true;
-                    _wrapper.Exited += Wrapper_Exited;
+                using (var reader = new StreamReader(pidFilename))
+                {
+                    var line = reader.ReadLine();
+
+                    if (line != null)
+                    {
+                        var pid = int.Parse(line);
+                        _wrapper = Process.GetProcessById(pid);
+                        _wrapper.EnableRaisingEvents = true;
+                        _wrapper.Exited += Wrapper_Exited;
+                    }
                 }
             }
             catch (ArgumentException)


Now conditionally attaching device name to each log if the device name was set by the application.

--- RSGLogEnricher.cs
+++ RSGLogEnricher.cs
@@ -29,6 +29,11 @@
             logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("MachineName", Environment.MachineName));
             logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("AppInstanceID", App.AppInstanceID));
             logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("DeviceID", App.DeviceID));
+            if (string.IsNullOrEmpty(App.DeviceName))
+            {
+                logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("DeviceName", App.DeviceName));
+            }
+
             logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("AppMajorVersion", appConfigurator.MajorVersionNumber));
             logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("AppMinorVersion", appConfigurator.MinorVersionNumber));
         }


Address code analysis issues

Address code analysis issues

--- SumoLogic.Logging.NLog/BufferedSumoLogicTarget.cs
+++ SumoLogic.Logging.NLog/BufferedSumoLogicTarget.cs
@@ -342,8 +342,14 @@
         /// Flush any pending log messages asynchronously (in case of asynchronous targets).
         /// </summary>
         /// <param name="asyncContinuation">The asynchronous continuation.</param>
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Exception is passed to async continuation for proper handling.")]
         protected override void FlushAsync(global::NLog.Common.AsyncContinuation asyncContinuation)
         {
+            if (asyncContinuation == null)
+            {
+                throw new ArgumentNullException("asyncContinuation");
+            }
+
             try
             {
                 var task = this.flushBufferTask;


show field bosses HP bar

show field bosses HP bar

--- TCC.Core/ViewModels/Widgets/NpcWindowViewModel.cs
+++ TCC.Core/ViewModels/Widgets/NpcWindowViewModel.cs
@@ -12,6 +12,7 @@
 using TCC.Data.NPCs;
 using TCC.Parsing;
 using TCC.Settings;
+using TCC.Utilities;
 using TeraDataLite;
 using TeraPacketParser.Messages;

@@ -106,7 +107,7 @@
                     PacketAnalyzer.NewProcessor.Unhook<S_DUNGEON_EVENT_MESSAGE>(HandlePhase1Shields);
                     PacketAnalyzer.NewProcessor.Unhook<C_PLAYER_LOCATION>(HandlePlayerLocation);
                 }
-                //PacketAnalyzer.Processor.Update();
+                //PacketAnalyzer.Processor.Update(); //TODO?
                 N(nameof(CurrentHHphase));
             }
         }
@@ -319,11 +320,9 @@
                 var boss = NpcList.ToSyncList().FirstOrDefault(x => x.EntityId == entityId) ?? AddNpc(entityId, zoneId, templateId, isBoss, visibility);
                 if (boss == null) return;
                 SetHp(boss, maxHp, curHp, src);
-                if (boss.Visible != visibility)
-                {
-                    boss.Visible = visibility;
-                    NpcListChanged?.Invoke();
-                }
+                if (boss.Visible == visibility) return;
+                boss.Visible = visibility;
+                NpcListChanged?.Invoke();
             }));
         }

@@ -341,7 +340,6 @@
             if (!IsCaching) boss.CurrentHP = curHp;
             else
             {
-                //Log.CW($"[BossGageWindowViewModel L273] Adding HP ({curHp}) to cache for NPC with eid {boss.EntityId}");
                 AddToCache(boss.EntityId, curHp);
                 if (src == HpChangeSource.Me) FlushCache(null, null);
             }
@@ -351,9 +349,6 @@
         private readonly Dictionary<ulong, float> _cache;
         private void AddToCache(ulong entityId, float curHp)
         {
-            //if (!_cache.ContainsKey(entityId)) _cache.Add(entityId, curHp);
-            /*else */
-            //Log.CW($"AddToCache({entityId}, {curHp})");
             _cache[entityId] = curHp;
         }

@@ -600,7 +595,6 @@
             PacketAnalyzer.NewProcessor.Hook<S_ABNORMALITY_BEGIN>(OnAbnormalityBegin);
             PacketAnalyzer.NewProcessor.Hook<S_ABNORMALITY_REFRESH>(OnAbnormalityRefresh);
             PacketAnalyzer.NewProcessor.Hook<S_ABNORMALITY_END>(OnAbnormalityEnd);
-
         }

         protected override void RemoveHooks()
@@ -621,7 +615,6 @@
             PacketAnalyzer.NewProcessor.Unhook<S_ABNORMALITY_BEGIN>(OnAbnormalityBegin);
             PacketAnalyzer.NewProcessor.Unhook<S_ABNORMALITY_REFRESH>(OnAbnormalityRefresh);
             PacketAnalyzer.NewProcessor.Unhook<S_ABNORMALITY_END>(OnAbnormalityEnd);
-
         }

         private void OnGuildTowerInfo(S_GUILD_TOWER_INFO m)
@@ -631,7 +624,13 @@
         private void OnSpawnNpc(S_SPAWN_NPC m)
         {
             EntityManager.CheckHarrowholdMode(m.HuntingZoneId, m.TemplateId);
-            EntityManager.SpawnNPC(m.HuntingZoneId, m.TemplateId, m.EntityId, false, m.Villager, m.RemainingEnrageTime);
+            EntityManager.SpawnNPC(m.HuntingZoneId, m.TemplateId, m.EntityId, IsFieldBoss(m.HuntingZoneId, m.TemplateId), m.Villager, m.RemainingEnrageTime);
+        }
+        private bool IsFieldBoss(ushort zone, uint template)
+        {
+            return (zone == 39 && template == 501) ||
+                   (zone == 26 && template == 5001) ||
+                   (zone == 51 && template == 4001);
         }
         private void OnSpawnMe(S_SPAWN_ME m)
         {


Cm changes

Cm changes

--- TestsFinal/Backend/Business/CalculationManager.cs
+++ TestsFinal/Backend/Business/CalculationManager.cs
@@ -82,7 +82,7 @@
                 var startOprand = globalCalculation.LocalCalculations.First(lc => lc.Order == orderToRemove - 1).Result;
                 calculation.StartOperand = startOprand;
                 SetResult(calculation);
-                SetOperationString(localCalculation);
+                SetOperationString(calculation);
                 orderToRemove++;
             }
             RefreshGlobalResult(globalCalculation);


Remove leftovers from Merger

Remove leftovers from Merger

--- Tools/Ecore2Code/PythonCodeGenerator/Generator.cs
+++ Tools/Ecore2Code/PythonCodeGenerator/Generator.cs
@@ -27,16 +27,12 @@
     /* CodeGen Notes:
      *
      * return types are set using @returns(type) decorator syntax
-     * argument types are set using @accepts(type) decorator syntax
-     *
-     * we just need to then define these data descriptors somewhere (so
-     * our code compiles)
+     * argument types are set using @accepts(type) decorator syntax
      *
      * Classes are defined as:
      *
      * class foo(object):
-     *      """type(x) == int, type(y) == System.EventArgs, type(z) == bar"""
-     *      __slots__ = ['x', 'y', 'z']
+     *      """type(x) == int, type(y) == System.EventArgs, type(z) == bar"""
      *
      * @returns(str)
      * def bar():
@@ -56,7 +52,7 @@
         string lastNamespace;
         Stack<TypeDeclInfo> typeStack = new Stack<TypeDeclInfo>();
         Stack<CodeNamespace> namespaceStack = new Stack<CodeNamespace>();
-        int col, row, lastCol, lastRow;
+        int col, row;
         int lastIndent;
         internal const string ctorFieldInit = "_ConstructorFieldInitFunction";
         List<string> processedTypes = new List<string>();
@@ -79,14 +75,7 @@
 #endif
                 if (Options != null) {
                     Options.BlankLinesBetweenMembers = false;
-                }
-
-
-                // fetch the merger, if one is available.  When a merger
-                // is available our internal write functions will write
-                // to a cache.  When we advance output we'll commit the
-                // cache all at once.
-                string oldNewline = Output.NewLine;
+                }

                 CodeUnitPreProcessor.removeNetSystemImports(ref e);
                 e = CodeUnitPreProcessor.replaceNetVariableTypesWithNativeVaribaleTypes(e);
@@ -373,7 +362,6 @@
         }

         protected override void GenerateConstructor(CodeConstructor e, CodeTypeDeclaration c) {
-            FlushOutput(e);

             Write("def __init__(self");
             if (e.Parameters.Count > 0) {
@@ -436,8 +424,6 @@
         }

         protected override void GenerateEntryPointMethod(CodeEntryPointMethod e, CodeTypeDeclaration c) {
-            FlushOutput(e);
-
             entryPointNamespace = lastNamespace;
             entryPoint = e;
         }
@@ -543,8 +529,6 @@

         protected override void GenerateMethod(CodeMemberMethod e, CodeTypeDeclaration c) {
-            FlushOutput(e);
-
             if ((e.Attributes & MemberAttributes.ScopeMask) == MemberAttributes.Static)
                 WriteLine("@staticmethod");

@@ -710,15 +694,12 @@
                 GenerateNamespaceImportsWorker(e);
             }

-            FlushOutput(e);
-
             if (!String.IsNullOrEmpty(e.Name)) {
                 namespaceStack.Push(e);

                 lastNamespace = e.Name;

-                // the best way to realize namespaces in python are modules not classes
-                // ipy wasn't even able to execute this generated code so there is no purpose for it
+                // the best way to realize namespaces in python are modules not classes
                 Write("# Namespace ");
                 Write(e.Name);
                 Write("\n");
@@ -781,8 +762,6 @@
         }

         protected override void GenerateProperty(CodeMemberProperty e, CodeTypeDeclaration c) {
-            FlushOutput(e);
-
             string priv = String.Empty;
             if ((e.Attributes & MemberAttributes.AccessMask) == MemberAttributes.Private) priv = "_";

@@ -878,9 +857,7 @@

             int oldIndent = Indent;
             Indent = lastIndent;
-
-            FlushOutput(e);
-
+
             WriteLine("# begin snippet member " + Indent.ToString() + CurrentTypeName);

             WriteSnippetWorker(e.Text);
@@ -1007,9 +984,7 @@
         }

         protected override void GenerateTypeConstructor(CodeTypeConstructor e) {
-            FlushOutput(e);
-
-            MyGenerateStatements(e.Statements);
+            GenerateStatements(e.Statements);
         }

         private void GenerateFieldInit() {
@@ -1137,9 +1112,7 @@
                 topLevelTypes.Add(e.Name);
             }
             currentTypeLevel++;
-
-            if (UserDataFalse(e.UserData, "NoEmit")) FlushOutput(e);
-
+
             if (e.Name != "__top__" || !UserDataFalse(e.UserData, "IsTopType")) {

                 typeStack.Push(new TypeDeclInfo(e));
@@ -1630,7 +1603,7 @@
                 WriteLine("):"); //!!! Consult UserData["NoNewLine"]
                 Indent++;
                 lastIndent = Indent;
-                MyGenerateStatements(stmts);
+                GenerateStatements(stmts);
                 Indent--;
                 cursorCol = col;
                 cursorRow = row;
@@ -1648,11 +1621,7 @@

             // store the location the cursor shold goto for this function.
             //userData[typeof(System.Drawing.Point)] = new System.Drawing.Point(cursorCol, cursorRow); //???
-        }
-
-        private void MyGenerateStatements(CodeStatementCollection statements) {
-            GenerateStatements(statements);
-        }
+        }

         private static string UserDataString(IDictionary userData, string name, string defaultValue) {
             if (userData == null) return defaultValue;
@@ -1671,28 +1640,7 @@
             return userData == null ||
                 userData[name] == null ||
                 ((bool)userData[name]) == true;
-        }
-
-        /// <summary>
-        /// Flushes output to the merger based upon the location
-        /// of this object.
-        /// </summary>
-        private void FlushOutput(CodeObject co) {
-            int line = row;
-            if (co.UserData["IPCreated"] != null) {
-                line = (int)co.UserData["Line"];
-                int column = (int)co.UserData["Column"];
-
-                DoFlush(line, column);
-            }
-        }
-
-        /// <summary> Performs the actual work of flushing output </summary>
-        private void DoFlush(int line, int column) {
-
-            lastRow = line;
-            lastCol = column;
-        }
+        }

         private void Write(object val) {
             Write(val.ToString());


A better scene saver for build server

A better scene saver for build server

--- UnityProject/Assets/Scripts/Editor/BuildServer.cs
+++ UnityProject/Assets/Scripts/Editor/BuildServer.cs
@@ -2,6 +2,7 @@
 using System.Linq;
 using System;
 using System.IO;
+using System.Threading.Tasks;
 using DatabaseAPI;
 using UnityEditor.SceneManagement;
 using UnityEngine;
@@ -18,7 +19,9 @@
 		BuildPreferences.SetRelease(true);
         BuildPipeline.BuildPlayer(buildPlayerOptions);
 	}
-	private static void PerformWindowsBuild()
+
+	//IMPORTANT: ALWAYS DO WINDOWS BUILD FIRST IN YOUR BUILD CYCLE:
+	private static async void PerformWindowsBuild()
 	{
 		//Always build windows client first so that build info can increment the build number
 		int buildNum = 0;
@@ -45,9 +48,12 @@
 		File.WriteAllText(Path.Combine(Application.streamingAssetsPath, "buildinfo.json"), JsonUtility.ToJson(buildInfo));
 		File.WriteAllText(Path.Combine(Application.streamingAssetsPath, "buildinfoupdate.json"), JsonUtility.ToJson(buildInfoUpdate));

+		//TODO auto save for all scenes that aren't lobby when we have multiple server maps
 		//Force netweaver to cache network components:
-		var outpostScene = EditorSceneManager.GetSceneByPath("Assets/scenes/OutpostStation.unity");
-		EditorSceneManager.SaveScene(outpostScene);
+		EditorSceneManager.OpenScene("Assets/scenes/OutpostStation.unity");
+		await Task.Delay(TimeSpan.FromSeconds(5));
+		EditorSceneManager.MarkAllScenesDirty();
+		EditorSceneManager.SaveOpenScenes();

 		BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
 		buildPlayerOptions.scenes = new[] {"Assets/scenes/Lobby.unity", "Assets/scenes/OutpostStation.unity"};


fix(UI): disable song tracker on spawn

fix(UI): disable song tracker on spawn

--- UnityProject/Assets/Scripts/UI/ControlDisplays.cs
+++ UnityProject/Assets/Scripts/UI/ControlDisplays.cs
@@ -106,6 +106,8 @@
 		UIManager.PlayerHealthUI.gameObject.SetActive(true);
 		panelRight.gameObject.SetActive(true);
 		rightClickManager.SetActive(true);
+		preRoundWindow.SetActive(false);
+		SoundManager.SongTracker.Stop();
 	}

 	void GhostUI()
@@ -118,6 +120,8 @@
 		UIManager.PlayerHealthUI.gameObject.SetActive(true);
 		panelRight.gameObject.SetActive(true);
 		rightClickManager.SetActive(true);
+		preRoundWindow.SetActive(false);
+		SoundManager.SongTracker.Stop();
 	}

 	/// <summary>


Mempool refactor

Mempool refactor

--- WalletWasabi/Blockchain/Mempool/MempoolService.cs
+++ WalletWasabi/Blockchain/Mempool/MempoolService.cs
@@ -169,18 +169,22 @@

 		public void Process(Transaction tx)
 		{
+			var txAdded = new SmartTransaction(tx, Height.Mempool);
 			lock (ProcessedLock)
 			{
 				if (ProcessedTransactionHashes.Add(tx.GetHash()))
 				{
-					TransactionReceived?.Invoke(this, new SmartTransaction(tx, Height.Mempool));
+					txAdded = new SmartTransaction(tx, Height.Mempool);
 				}
 				else
 				{
 					Interlocked.Increment(ref _duplicatedReceives);
 				}
-
 				Interlocked.Increment(ref _totalReceives);
+			}
+			if (txAdded is { })
+			{
+				TransactionReceived?.Invoke(this, txAdded);
 			}
 		}
 	}


Rotation circles are now offset.

Rotation circles are now offset.

--- Gum/Wireframe/Editors/StandardWireframeEditor.cs
+++ Gum/Wireframe/Editors/StandardWireframeEditor.cs
@@ -246,7 +246,7 @@
                 rotationHandle.Visible = true;

                 // right side
-                const float minimumOffset = 24;
+                float minimumOffset = 24 / Renderer.Self.Camera.Zoom;

                 float xOffset = 0;


Fixed sealing bug

Fixed sealing bug

--- src/DataDog.Tracing/Span.cs
+++ src/DataDog.Tracing/Span.cs
@@ -74,7 +74,6 @@
             {
                 EnsureNotSealed();
                 (Meta ?? (Meta = new Dictionary<string, string>()))[name] = value;
-                _sealed = true;
             }
         }

@@ -88,7 +87,6 @@
                 meta["error.msg"] = ex.Message;
                 meta["error.type"] = ex.GetType().Name;
                 meta["error.stack"] = ex.StackTrace;
-                _sealed = true;
             }
         }
     }


* Fixed numeric formatting specification in OracleErrorLog.

--- src/Elmah/OracleErrorLog.cs
+++ src/Elmah/OracleErrorLog.cs
@@ -104,8 +104,8 @@
             if(_schemaOwner.Length > _maxSchemaNameLength)
             {
                 throw new ApplicationException(string.Format(
-                    "Oracle schema owner is too long.  Maximum length allowed is {0} characters.",
-                    _maxSchemaNameLength.ToString("NO")));
+                    "Oracle schema owner is too long. Maximum length allowed is {0} characters.",
+                    _maxSchemaNameLength.ToString("N0")));
             }

             if (_schemaOwner.Length > 0)


Added a MessageBox to remind that permutation krystal display needs to be improved.

--- Moritz.Krystals/KrystalBrowser/KrystalsBrowser.cs
+++ Moritz.Krystals/KrystalBrowser/KrystalsBrowser.cs
@@ -216,6 +216,10 @@
             {
                 return new string[] { _krystal.MaxValue.ToString() };
             }
+            if(_krystal.Name.Contains(K.KrystalType.perm.ToString())) // TODO permutation display with axes.
+            {
+                MessageBox.Show("TODO: permutation display with axis and contour values.", "Permutation krystal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+            }

             int kLevel = (int)krystal.Level;

@@ -344,25 +348,22 @@
             int nBlocks = blocksList.Count;
             const int tab = 15;

-            if(!krystalName.Contains(K.KrystalType.perm.ToString())) // TODO permutation display with axes.
-            {
-                for(int j = 0; j < nBlocks; j++)
-                {
-                    List<string> blockLines = blocksList[j];
-                    int nBlockLines = blockLines.Count;
-                    for(int k = 0; k < nBlockLines; k++)
-                    {
-                        sbLines[k].Append(blockLines[k]);
-                    }
-                    if(j < nBlocks - 1)
-                    {
-                        int tabstop = tab * (j + 1);
-                        for(int k = 0; k < nParagraphBlockLines; k++)
+            for(int j = 0; j < nBlocks; j++)
+            {
+                List<string> blockLines = blocksList[j];
+                int nBlockLines = blockLines.Count;
+                for(int k = 0; k < nBlockLines; k++)
+                {
+                    sbLines[k].Append(blockLines[k]);
+                }
+                if(j < nBlocks - 1)
+                {
+                    int tabstop = tab * (j + 1);
+                    for(int k = 0; k < nParagraphBlockLines; k++)
+                    {
+                        while(sbLines[k].Length < tabstop)
                         {
-                            while(sbLines[k].Length < tabstop)
-                            {
-                                sbLines[k].Append(' ');
-                            }
+                            sbLines[k].Append(' ');
                         }
                     }
                 }


use OBC.Equality for dummy extension methods

--- OBeautifulCode.AutoFakeItEasy/ExtensionMethods.cs
+++ OBeautifulCode.AutoFakeItEasy/ExtensionMethods.cs
@@ -13,6 +13,8 @@

     using FakeItEasy;

+    using OBeautifulCode.Equality.Recipes;
+
     /// <summary>
     /// Some extension methods.
     /// </summary>
@@ -115,7 +117,7 @@
         /// <summary>
         /// Returns a reference dummy if it is not equal to a comparison dummy or
         /// creates new dummies of the same type until a dummy is created that does not equal the comparison dummy.
-        /// Uses the comparison dummy's implementation of <see cref="object.Equals(object)"/>.
+        /// Uses <see cref="EqualityExtensions.IsEqualTo{T}(T, T, IEqualityComparer{T})"/>.
         /// </summary>
         /// <param name="referenceDummy">The reference dummy.</param>
         /// <param name="comparisonDummy">A dummy to compare against.</param>
@@ -136,15 +138,17 @@
             T comparisonDummy,
             int maxAttempts = -1)
         {
-            bool Condition(T t) => !Equals(t, comparisonDummy);
-            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+            bool Condition(T t) => !t.IsEqualTo(comparisonDummy);
+
+            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+
             return result;
         }

         /// <summary>
         /// Returns a reference dummy if it is not in a set of comparison dummies or
         /// creates new dummies of the same type until a dummy is created that is not in the set of comparison dummies.
-        /// Uses the comparison dummy's implementation of <see cref="object.Equals(object)"/>.
+        /// Uses <see cref="EqualityComparerHelper.GetEqualityComparerToUse{T}(IEqualityComparer{T})"/>.
         /// </summary>
         /// <param name="referenceDummy">The reference dummy.</param>
         /// <param name="comparisonDummies">The set of comparison dummies.</param>
@@ -167,15 +171,16 @@
         {
             comparisonDummies = comparisonDummies?.ToList() ?? throw new ArgumentNullException(nameof(comparisonDummies));

-            bool Condition(T t) => !comparisonDummies.Contains(t);
-            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+            bool Condition(T t) => !comparisonDummies.Contains(t, EqualityComparerHelper.GetEqualityComparerToUse<T>());
+
+            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+
             return result;
         }

         /// <summary>
         /// Returns a reference dummy if it is not in a set of comparison dummies or
         /// creates new dummies of the same type until a dummy is created that is not in the set of comparison dummies.
-        /// Uses the comparison dummy's implementation of <see cref="object.Equals(object)"/>.
         /// </summary>
         /// <param name="referenceDummy">The reference dummy.</param>
         /// <param name="comparisonDummies">The set of comparison dummies.</param>
@@ -201,14 +206,16 @@
             comparisonDummies = comparisonDummies?.ToList() ?? throw new ArgumentNullException(nameof(comparisonDummies));

             bool Condition(T t) => !comparisonDummies.Contains(t, comparer);
-            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+
+            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+
             return result;
         }

         /// <summary>
         /// Returns a reference dummy if it is in a set of comparison dummies or
         /// creates new dummies of the same type until a dummy is created that is in the set of comparison dummies.
-        /// Uses the comparison dummy's implementation of <see cref="object.Equals(object)"/>.
+        /// Uses <see cref="EqualityComparerHelper.GetEqualityComparerToUse{T}(IEqualityComparer{T})"/>.
         /// </summary>
         /// <param name="referenceDummy">The reference dummy.</param>
         /// <param name="comparisonDummies">The set of comparison dummies.</param>
@@ -229,20 +236,18 @@
             IEnumerable<T> comparisonDummies,
             int maxAttempts = -1)
         {
-            if (comparisonDummies == null)
-            {
-                throw new ArgumentNullException(nameof(comparisonDummies));
-            }
-
-            Func<T, bool> condition = comparisonDummies.Contains;
-            var result = ThatIs(referenceDummy, condition, maxAttempts);
+            comparisonDummies = comparisonDummies?.ToList() ?? throw new ArgumentNullException(nameof(comparisonDummies));
+
+            bool Condition(T t) => comparisonDummies.Contains(t, EqualityComparerHelper.GetEqualityComparerToUse<T>());
+
+            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+
             return result;
         }

         /// <summary>
         /// Returns a reference dummy if it is in a set of comparison dummies or
         /// creates new dummies of the same type until a dummy is created that is in the set of comparison dummies.
-        /// Uses the comparison dummy's implementation of <see cref="object.Equals(object)"/>.
         /// </summary>
         /// <param name="referenceDummy">The reference dummy.</param>
         /// <param name="comparisonDummies">The set of comparison dummies.</param>
@@ -268,7 +273,9 @@
             comparisonDummies = comparisonDummies?.ToList() ?? throw new ArgumentNullException(nameof(comparisonDummies));

             bool Condition(T t) => comparisonDummies.Contains(t, comparer);
-            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+
+            var result = ThatIs(referenceDummy, Condition, maxAttempts);
+
             return result;
         }


Also set Godlike flag. Might be useful

Also set Godlike flag. Might be useful

--- OpenSim/Services/LLLoginService/LLLoginService.cs
+++ OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -329,6 +329,8 @@
                     return LLFailedLoginResponse.GridProblem;
                 }

+                if (account.UserLevel >= 200)
+                    flags |= TeleportFlags.Godlike;
                 //
                 // Get the avatar
                 //


Code refactoring

Code refactoring

--- TaskCoordinatorTest/SharedTypes/TaskCoordinator/BaseTasksCoordinator.cs
+++ TaskCoordinatorTest/SharedTypes/TaskCoordinator/BaseTasksCoordinator.cs
@@ -112,24 +112,24 @@
             }
         }

+        private void _ExitTask(int id)
+        {
+            Task res;
+            if (this._tasks.TryRemove(id, out res))
+            {
+                lock (this._semaphoreLock)
+                {
+                    this._semaphore += 1;
+                }
+            }
+        }
+
         private void _StartNewTask()
         {
             bool result = false;
             bool semaphoreOK = false;
             int taskId = -1;
-            Action<int> exitTaskAction = (id) =>
-            {
-                Task res;
-                if (this._tasks.TryRemove(id, out res))
-                {
-                    lock (this._semaphoreLock)
-                    {
-                        this._semaphore += 1;
-                    }
-                }
-            };
-
-
+
             try
             {
                 var cancellation = this.Cancellation;
@@ -169,7 +169,7 @@
                     var task = Task<Task<int>>.Factory.StartNew(() => JobRunner(cancellation, taskId), cancellation).Unwrap();
                     this._tasks.TryUpdate(taskId, task, dummy);
                     task.ContinueWith((antecedent, state) => {
-                        exitTaskAction((int)state);
+                        this._ExitTask((int)state);
                         if (antecedent.IsFaulted)
                         {
                             var err = antecedent.Exception;
@@ -183,7 +183,7 @@
             }
             catch (Exception ex)
             {
-                exitTaskAction(taskId);
+                this._ExitTask(taskId);
                 if (!(ex is OperationCanceledException))
                 {
                     Log.Error(ex);
@@ -238,14 +238,7 @@
             }
             finally
             {
-                Task res;
-                if (this._tasks.TryRemove(taskId, out res))
-                {
-                    lock (this._semaphoreLock)
-                    {
-                        this._semaphore += 1;
-                    }
-                }
+                this._ExitTask(taskId);
             }

             return taskId;


revert to LF line-ending

revert to LF line-ending

--- src/extensions/Wyam.Markdown/Markdown.cs
+++ src/extensions/Wyam.Markdown/Markdown.cs
@@ -1,280 +1,280 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Text.RegularExpressions;
-using Markdig;
-using Markdig.Helpers;
-using Markdig.Parsers;
-using Markdig.Renderers;
-using Markdig.Syntax;
-using Wyam.Common.Caching;
-using Wyam.Common.Documents;
-using Wyam.Common.Execution;
-using Wyam.Common.Meta;
-using Wyam.Common.Modules;
-using Wyam.Common.Tracing;
-
-namespace Wyam.Markdown
-{
-    /// <summary>
-    /// Parses markdown content and renders it to HTML.
-    /// </summary>
-    /// <remarks>
-    /// Parses markdown content in each input document and outputs documents with rendered HTML content.
-    /// Note that <c>@</c> (at) symbols will be automatically HTML escaped for better compatibility with downstream
-    /// Razor modules. If you want to include a raw <c>@</c> symbol when <c>EscapeAt()</c> is <c>true</c>, use
-    /// <c>\@</c>. Use the <c>EscapeAt()</c> fluent method to modify this behavior.
-    /// </remarks>
-    /// <category>Templates</category>
-    public class Markdown : IModule
-    {
-        /// <summary>
-        /// The default Markdown configuration.
-        /// </summary>
-        public const string DefaultConfiguration = "common";
-
-        private static readonly Regex EscapeAtRegex = new Regex("(?<!\\\\)@");
-
-        private readonly string _sourceKey;
-        private readonly string _destinationKey;
-        private readonly OrderedList<IMarkdownExtension> _extensions = new OrderedList<IMarkdownExtension>();
-        private string _configuration = DefaultConfiguration;
-        private bool _escapeAt = true;
-        private bool _prependLinkRoot = false;
-
-        /// <summary>
-        /// Processes Markdown in the content of the document.
-        /// </summary>
-        public Markdown()
-        {
-        }
-
-        /// <summary>
-        /// Processes Markdown in the metadata of the document. The rendered HTML will be placed
-        /// </summary>
-        /// <param name="sourceKey">The metadata key of the Markdown to process.</param>
-        /// <param name="destinationKey">The metadata key to store the rendered HTML (if null, it gets placed back in the source metadata key).</param>
-        public Markdown(string sourceKey, string destinationKey = null)
-        {
-            _sourceKey = sourceKey;
-            _destinationKey = destinationKey;
-        }
-
-        /// <summary>
-        /// Specifies whether the <c>@</c> symbol should be escaped (the default is <c>true</c>).
-        /// This is important if the Markdown documents are going to be passed to the Razor module,
-        /// otherwise the Razor processor will interpret the unescaped <c>@</c> symbols as code
-        /// directives.
-        /// If you want to include a raw <c>@</c> symbol when <c>EscapeAt()</c> is <c>true</c>, use <c>\@</c>.
-        /// </summary>
-        /// <param name="escapeAt">If set to <c>true</c>, <c>@</c> symbols are HTML escaped.</param>
-        /// <returns>The current module instance.</returns>
-        public Markdown EscapeAt(bool escapeAt = true)
-        {
-            _escapeAt = escapeAt;
-            return this;
-        }
-
-        /// <summary>
-        /// Includes a set of useful advanced extensions, e.g., citations, footers, footnotes, math,
-        /// grid-tables, pipe-tables, and tasks, in the Markdown processing pipeline.
-        /// </summary>
-        /// <returns>The current module instance.</returns>
-        public Markdown UseExtensions()
-        {
-            _configuration = "advanced";
-            return this;
-        }
-
-        /// <summary>
-        /// Includes a set of extensions defined as a string, e.g., "pipetables", "citations",
-        /// "mathematics", or "abbreviations". Separate different extensions with a '+'.
-        /// </summary>
-        /// <param name="extensions">The extensions string.</param>
-        /// <returns>The current module instance.</returns>
-        public Markdown UseConfiguration(string extensions)
-        {
-            _configuration = extensions;
-            return this;
-        }
-
-        /// <summary>
-        /// Includes a custom extension in the markdown processing given by a class implementing
-        /// the IMarkdownExtension interface.
-        /// </summary>
-        /// <typeparam name="TExtension">The type of the extension to use.</typeparam>
-        /// <returns>The current module instance.</returns>
-        public Markdown UseExtension<TExtension>()
-            where TExtension : class, IMarkdownExtension, new()
-        {
-            _extensions.AddIfNotAlready<TExtension>();
-            return this;
-        }
-
-        /// <summary>
-        /// Includes a custom extension in the markdown processing given by a object implementing
-        /// the IMarkdownExtension interface.
-        /// </summary>
-        /// <param name="extension">A object that that implement <see cref="IMarkdownExtension"/>.</param>
-        /// <typeparam name="TExtension">The type of the extension to use.</typeparam>
-        /// <returns>The current module instance.</returns>
-        public Markdown UseExtension<TExtension>(TExtension extension)
-            where TExtension : IMarkdownExtension
-        {
-            if (extension != null)
-            {
-                _extensions.AddIfNotAlready(extension);
-            }
-
-            return this;
-        }
-
-        /// <summary>
-        /// Includes multiple custom extension in the markdown processing given by classes implementing
-        /// the <see cref="IMarkdownExtension"/> interface.
-        /// </summary>
-        /// <param name="extensions">A sequence of types that implement <see cref="IMarkdownExtension"/>.</param>
-        /// <returns>The current module instance.</returns>
-        public Markdown UseExtensions(IEnumerable<Type> extensions)
-        {
-            if (extensions == null)
-            {
-                return this;
-            }
-
-            foreach (Type type in extensions)
-            {
-                IMarkdownExtension extension = Activator.CreateInstance(type) as IMarkdownExtension;
-                if (extension != null)
-                {
-                    // Need - public void AddIfNotAlready<TElement>(TElement telement) where TElement : T;
-                    // Kind of hack'ish, but no other way to preserve types.
-                    MethodInfo addIfNotAlready = typeof(OrderedList<IMarkdownExtension>).GetMethods()
-                        .Where(x => x.IsGenericMethod && x.Name == nameof(OrderedList<IMarkdownExtension>.AddIfNotAlready) && x.GetParameters().Length == 1)
-                        .Select(x => x.MakeGenericMethod(type))
-                        .Single();
-                    addIfNotAlready.Invoke(_extensions, new object[] { extension });
-                }
-            }
-
-            return this;
-        }
-
-        /// <summary>
-        /// Specifies if the <see cref="Keys.LinkRoot"/> setting must be used to rewrite root-relative links when rendering markdown.
-        /// By default, root-relative links, which are links starting with a '/' are left untouched.
-        /// When setting this value to <c>true</c>, the <see cref="Keys.LinkRoot"/> setting value is added before the link.
-        /// </summary>
-        /// <param name="prependLinkRoot">If set to <c>true</c>, the <see cref="Keys.LinkRoot"/> setting value is added before any root-relative link (eg. stating with a '/').</param>
-        /// <returns>The current module instance.</returns>
-        public Markdown PrependLinkRoot(bool prependLinkRoot = false)
-        {
-            _prependLinkRoot = prependLinkRoot;
-            return this;
-        }
-
-        /// <inheritdoc />
-        public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context)
-        {
-            return inputs.AsParallel().Select(context, input => ProcessDocument(input, context));
-        }
-
-        private IDocument ProcessDocument(IDocument input, IExecutionContext context)
-        {
-            Trace.Verbose(
-                       "Processing Markdown {0} for {1}",
-                       string.IsNullOrEmpty(_sourceKey) ? string.Empty : ("in" + _sourceKey),
-                       input.SourceString());
-
-            string result;
-
-            IExecutionCache executionCache = context.ExecutionCache;
-
-            if (!executionCache.TryGetValue<string>(input, _sourceKey, out result))
-            {
-                string content;
-                if (string.IsNullOrEmpty(_sourceKey))
-                {
-                    content = input.Content;
-                }
-                else if (input.ContainsKey(_sourceKey))
-                {
-                    content = input.String(_sourceKey) ?? string.Empty;
-                }
-                else
-                {
-                    // Don't do anything if the key doesn't exist
-                    return input;
-                }
-
-                MarkdownPipeline pipeline = CreatePipeline();
-
-                MarkdownDocument document = MarkdownParser.Parse(content, pipeline);
-
-                using (var writer = new StringWriter())
-                {
-                    var htmlRenderer = new HtmlRenderer(writer);
-                    pipeline.Setup(htmlRenderer);
-
-                    htmlRenderer.LinkRewriter = (link) =>
-                    {
-                        if (link == null || link.Length == 0)
-                        {
-                            return link;
-                        }
-
-                        if (link[0] == '/' && _prependLinkRoot)
-                        {
-                            // root-based url, must be rewritten
-                            if (context.Settings.ContainsKey(Keys.LinkRoot))
-                            {
-                                // append link-root
-                                // ex: '/virtual/directory' + '/relative/abs/link.html' => '/virtual/directory/relative/abs/link.html'
-                                link = context.Settings[Keys.LinkRoot] + link;
-                            }
-
-                            // Disabled for now
-                            ////if (context.Settings.ContainsKey(Keys.Host))
-                            ////{
-                            ////    // append host
-                            ////    // ex: 'http://example.com' + '/relative/abs/link.html' => 'http://example.com/relative/abs/link.html'
-                            ////    link = context.Settings[Keys.Host] + link;
-                            ////}
-                        }
-
-                        return link;
-                    };
-
-                    htmlRenderer.Render(document);
-                    writer.Flush();
-                    result = writer.ToString();
-                }
-
-                if (_escapeAt)
-                {
-                    result = EscapeAtRegex.Replace(result, "@");
-                    result = result.Replace("\\@", "@");
-                }
-
-                executionCache.Set(input, _sourceKey, result);
-            }
-
-            return string.IsNullOrEmpty(_sourceKey)
-                ? context.GetDocument(input, context.GetContentStream(result))
-                : context.GetDocument(input, new MetadataItems
-                {
-                        {string.IsNullOrEmpty(_destinationKey) ? _sourceKey : _destinationKey, result}
-                });
-        }
-
-        private MarkdownPipeline CreatePipeline()
-        {
-            MarkdownPipelineBuilder pipelineBuilder = new MarkdownPipelineBuilder();
-            pipelineBuilder.Configure(_configuration);
-            pipelineBuilder.Extensions.AddRange(_extensions);
-            return pipelineBuilder.Build();
-        }
-    }
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using Markdig;
+using Markdig.Helpers;
+using Markdig.Parsers;
+using Markdig.Renderers;
+using Markdig.Syntax;
+using Wyam.Common.Caching;
+using Wyam.Common.Documents;
+using Wyam.Common.Execution;
+using Wyam.Common.Meta;
+using Wyam.Common.Modules;
+using Wyam.Common.Tracing;
+
+namespace Wyam.Markdown
+{
+    /// <summary>
+    /// Parses markdown content and renders it to HTML.
+    /// </summary>
+    /// <remarks>
+    /// Parses markdown content in each input document and outputs documents with rendered HTML content.
+    /// Note that <c>@</c> (at) symbols will be automatically HTML escaped for better compatibility with downstream
+    /// Razor modules. If you want to include a raw <c>@</c> symbol when <c>EscapeAt()</c> is <c>true</c>, use
+    /// <c>\@</c>. Use the <c>EscapeAt()</c> fluent method to modify this behavior.
+    /// </remarks>
+    /// <category>Templates</category>
+    public class Markdown : IModule
+    {
+        /// <summary>
+        /// The default Markdown configuration.
+        /// </summary>
+        public const string DefaultConfiguration = "common";
+
+        private static readonly Regex EscapeAtRegex = new Regex("(?<!\\\\)@");
+
+        private readonly string _sourceKey;
+        private readonly string _destinationKey;
+        private readonly OrderedList<IMarkdownExtension> _extensions = new OrderedList<IMarkdownExtension>();
+        private string _configuration = DefaultConfiguration;
+        private bool _escapeAt = true;
+        private bool _prependLinkRoot = false;
+
+        /// <summary>
+        /// Processes Markdown in the content of the document.
+        /// </summary>
+        public Markdown()
+        {
+        }
+
+        /// <summary>
+        /// Processes Markdown in the metadata of the document. The rendered HTML will be placed
+        /// </summary>
+        /// <param name="sourceKey">The metadata key of the Markdown to process.</param>
+        /// <param name="destinationKey">The metadata key to store the rendered HTML (if null, it gets placed back in the source metadata key).</param>
+        public Markdown(string sourceKey, string destinationKey = null)
+        {
+            _sourceKey = sourceKey;
+            _destinationKey = destinationKey;
+        }
+
+        /// <summary>
+        /// Specifies whether the <c>@</c> symbol should be escaped (the default is <c>true</c>).
+        /// This is important if the Markdown documents are going to be passed to the Razor module,
+        /// otherwise the Razor processor will interpret the unescaped <c>@</c> symbols as code
+        /// directives.
+        /// If you want to include a raw <c>@</c> symbol when <c>EscapeAt()</c> is <c>true</c>, use <c>\@</c>.
+        /// </summary>
+        /// <param name="escapeAt">If set to <c>true</c>, <c>@</c> symbols are HTML escaped.</param>
+        /// <returns>The current module instance.</returns>
+        public Markdown EscapeAt(bool escapeAt = true)
+        {
+            _escapeAt = escapeAt;
+            return this;
+        }
+
+        /// <summary>
+        /// Includes a set of useful advanced extensions, e.g., citations, footers, footnotes, math,
+        /// grid-tables, pipe-tables, and tasks, in the Markdown processing pipeline.
+        /// </summary>
+        /// <returns>The current module instance.</returns>
+        public Markdown UseExtensions()
+        {
+            _configuration = "advanced";
+            return this;
+        }
+
+        /// <summary>
+        /// Includes a set of extensions defined as a string, e.g., "pipetables", "citations",
+        /// "mathematics", or "abbreviations". Separate different extensions with a '+'.
+        /// </summary>
+        /// <param name="extensions">The extensions string.</param>
+        /// <returns>The current module instance.</returns>
+        public Markdown UseConfiguration(string extensions)
+        {
+            _configuration = extensions;
+            return this;
+        }
+
+        /// <summary>
+        /// Includes a custom extension in the markdown processing given by a class implementing
+        /// the IMarkdownExtension interface.
+        /// </summary>
+        /// <typeparam name="TExtension">The type of the extension to use.</typeparam>
+        /// <returns>The current module instance.</returns>
+        public Markdown UseExtension<TExtension>()
+            where TExtension : class, IMarkdownExtension, new()
+        {
+            _extensions.AddIfNotAlready<TExtension>();
+            return this;
+        }
+
+        /// <summary>
+        /// Includes a custom extension in the markdown processing given by a object implementing
+        /// the IMarkdownExtension interface.
+        /// </summary>
+        /// <param name="extension">A object that that implement <see cref="IMarkdownExtension"/>.</param>
+        /// <typeparam name="TExtension">The type of the extension to use.</typeparam>
+        /// <returns>The current module instance.</returns>
+        public Markdown UseExtension<TExtension>(TExtension extension)
+            where TExtension : IMarkdownExtension
+        {
+            if (extension != null)
+            {
+                _extensions.AddIfNotAlready(extension);
+            }
+
+            return this;
+        }
+
+        /// <summary>
+        /// Includes multiple custom extension in the markdown processing given by classes implementing
+        /// the <see cref="IMarkdownExtension"/> interface.
+        /// </summary>
+        /// <param name="extensions">A sequence of types that implement <see cref="IMarkdownExtension"/>.</param>
+        /// <returns>The current module instance.</returns>
+        public Markdown UseExtensions(IEnumerable<Type> extensions)
+        {
+            if (extensions == null)
+            {
+                return this;
+            }
+
+            foreach (Type type in extensions)
+            {
+                IMarkdownExtension extension = Activator.CreateInstance(type) as IMarkdownExtension;
+                if (extension != null)
+                {
+                    // Need - public void AddIfNotAlready<TElement>(TElement telement) where TElement : T;
+                    // Kind of hack'ish, but no other way to preserve types.
+                    MethodInfo addIfNotAlready = typeof(OrderedList<IMarkdownExtension>).GetMethods()
+                        .Where(x => x.IsGenericMethod && x.Name == nameof(OrderedList<IMarkdownExtension>.AddIfNotAlready) && x.GetParameters().Length == 1)
+                        .Select(x => x.MakeGenericMethod(type))
+                        .Single();
+                    addIfNotAlready.Invoke(_extensions, new object[] { extension });
+                }
+            }
+
+            return this;
+        }
+
+        /// <summary>
+        /// Specifies if the <see cref="Keys.LinkRoot"/> setting must be used to rewrite root-relative links when rendering markdown.
+        /// By default, root-relative links, which are links starting with a '/' are left untouched.
+        /// When setting this value to <c>true</c>, the <see cref="Keys.LinkRoot"/> setting value is added before the link.
+        /// </summary>
+        /// <param name="prependLinkRoot">If set to <c>true</c>, the <see cref="Keys.LinkRoot"/> setting value is added before any root-relative link (eg. stating with a '/').</param>
+        /// <returns>The current module instance.</returns>
+        public Markdown PrependLinkRoot(bool prependLinkRoot = false)
+        {
+            _prependLinkRoot = prependLinkRoot;
+            return this;
+        }
+
+        /// <inheritdoc />
+        public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context)
+        {
+            return inputs.AsParallel().Select(context, input => ProcessDocument(input, context));
+        }
+
+        private IDocument ProcessDocument(IDocument input, IExecutionContext context)
+        {
+            Trace.Verbose(
+                       "Processing Markdown {0} for {1}",
+                       string.IsNullOrEmpty(_sourceKey) ? string.Empty : ("in" + _sourceKey),
+                       input.SourceString());
+
+            string result;
+
+            IExecutionCache executionCache = context.ExecutionCache;
+
+            if (!executionCache.TryGetValue<string>(input, _sourceKey, out result))
+            {
+                string content;
+                if (string.IsNullOrEmpty(_sourceKey))
+                {
+                    content = input.Content;
+                }
+                else if (input.ContainsKey(_sourceKey))
+                {
+                    content = input.String(_sourceKey) ?? string.Empty;
+                }
+                else
+                {
+                    // Don't do anything if the key doesn't exist
+                    return input;
+                }
+
+                MarkdownPipeline pipeline = CreatePipeline();
+
+                MarkdownDocument document = MarkdownParser.Parse(content, pipeline);
+
+                using (var writer = new StringWriter())
+                {
+                    var htmlRenderer = new HtmlRenderer(writer);
+                    pipeline.Setup(htmlRenderer);
+
+                    htmlRenderer.LinkRewriter = (link) =>
+                    {
+                        if (link == null || link.Length == 0)
+                        {
+                            return link;
+                        }
+
+                        if (link[0] == '/' && _prependLinkRoot)
+                        {
+                            // root-based url, must be rewritten
+                            if (context.Settings.ContainsKey(Keys.LinkRoot))
+                            {
+                                // append link-root
+                                // ex: '/virtual/directory' + '/relative/abs/link.html' => '/virtual/directory/relative/abs/link.html'
+                                link = context.Settings[Keys.LinkRoot] + link;
+                            }
+
+                            // Disabled for now
+                            ////if (context.Settings.ContainsKey(Keys.Host))
+                            ////{
+                            ////    // append host
+                            ////    // ex: 'http://example.com' + '/relative/abs/link.html' => 'http://example.com/relative/abs/link.html'
+                            ////    link = context.Settings[Keys.Host] + link;
+                            ////}
+                        }
+
+                        return link;
+                    };
+
+                    htmlRenderer.Render(document);
+                    writer.Flush();
+                    result = writer.ToString();
+                }
+
+                if (_escapeAt)
+                {
+                    result = EscapeAtRegex.Replace(result, "@");
+                    result = result.Replace("\\@", "@");
+                }
+
+                executionCache.Set(input, _sourceKey, result);
+            }
+
+            return string.IsNullOrEmpty(_sourceKey)
+                ? context.GetDocument(input, context.GetContentStream(result))
+                : context.GetDocument(input, new MetadataItems
+                {
+                        {string.IsNullOrEmpty(_destinationKey) ? _sourceKey : _destinationKey, result}
+                });
+        }
+
+        private MarkdownPipeline CreatePipeline()
+        {
+            MarkdownPipelineBuilder pipelineBuilder = new MarkdownPipelineBuilder();
+            pipelineBuilder.Configure(_configuration);
+            pipelineBuilder.Extensions.AddRange(_extensions);
+            return pipelineBuilder.Build();
+        }
+    }
 }


mainline(ClientEngine): ignore more socket error

--- mainline/ClientEngine/TcpClientSession.cs
+++ mainline/ClientEngine/TcpClientSession.cs
@@ -34,7 +34,8 @@
         protected bool IsIgnorableSocketError(int errorCode)
         {
             //SocketError.Shutdown = 10058
-            if (errorCode == 10058)
+            //SocketError.ConnectionAborted = 10053
+            if (errorCode == 10058 || errorCode == 10053)
                 return true;

             return false;


updated constructor dbSet calls

updated constructor dbSet calls

--- WhenItsDone/Lib/WhenItsDone.Data/Repositories/AsyncGenericRepository.cs
+++ WhenItsDone/Lib/WhenItsDone.Data/Repositories/AsyncGenericRepository.cs
@@ -31,6 +31,13 @@
             return result;
         };

+        private readonly Func<AsyncGenericRepository<TEntity>, IEnumerable<TEntity>> getDeletedDelegate = (AsyncGenericRepository<TEntity> context) =>
+        {
+            var result = context.dbSet.Where(x => x.IsDeleted).ToList().AsEnumerable();
+
+            return result;
+        };
+
         public AsyncGenericRepository(IWhenItsDoneDbContext dbContext)
         {
             if (dbContext == null)
@@ -39,13 +46,12 @@
             }

             this.dbContext = dbContext;
+            this.dbSet = dbContext.Set<TEntity>();

-            if (dbContext.Set<TEntity>() == null)
+            if (this.dbSet == null)
             {
                 throw new ArgumentNullException("DbContext does not contain DbSet<{0}>", typeof(TEntity).Name);
             }
-
-            this.dbSet = dbContext.Set<TEntity>();
         }

         public Task<TEntity> GetByIdAsync(int id)
@@ -152,9 +158,11 @@
             return runningTask;
         }

-        public IEnumerable<TEntity> GetDeleted()
+        public Task<IEnumerable<TEntity>> GetDeleted()
         {
-            return this.dbSet.Where(x => x.IsDeleted);
+            var getDeletedTask = Task.Run(() => this.getDeletedDelegate(this));
+
+            return getDeletedTask;
         }

         public void Update(TEntity entity)


9644.2: minor

9644.2: minor

--- a_mini/projects/Tools/MergeProjectTool/MergeProjectsToolBox.Designer.cs
+++ a_mini/projects/Tools/MergeProjectTool/MergeProjectsToolBox.Designer.cs
@@ -40,7 +40,7 @@
             this.listView2.FullRowSelect = true;
             this.listView2.Location = new System.Drawing.Point(3, 3);
             this.listView2.Name = "listView2";
-            this.listView2.Size = new System.Drawing.Size(260, 205);
+            this.listView2.Size = new System.Drawing.Size(606, 205);
             this.listView2.TabIndex = 23;
             this.listView2.UseCompatibleStateImageBehavior = false;
             this.listView2.View = System.Windows.Forms.View.Details;
@@ -60,7 +60,7 @@
             this.lstAsmReferenceList.FormattingEnabled = true;
             this.lstAsmReferenceList.Location = new System.Drawing.Point(3, 214);
             this.lstAsmReferenceList.Name = "lstAsmReferenceList";
-            this.lstAsmReferenceList.Size = new System.Drawing.Size(260, 251);
+            this.lstAsmReferenceList.Size = new System.Drawing.Size(606, 251);
             this.lstAsmReferenceList.TabIndex = 21;
             //
             // lstPreset
@@ -73,7 +73,7 @@
             //
             // listView1
             //
-            this.listView1.Location = new System.Drawing.Point(269, 3);
+            this.listView1.Location = new System.Drawing.Point(615, 10);
             this.listView1.Name = "listView1";
             this.listView1.Size = new System.Drawing.Size(367, 498);
             this.listView1.TabIndex = 19;
@@ -90,7 +90,7 @@
             this.Controls.Add(this.lstPreset);
             this.Controls.Add(this.listView1);
             this.Name = "MergeProjectsToolBox";
-            this.Size = new System.Drawing.Size(651, 567);
+            this.Size = new System.Drawing.Size(1003, 567);
             this.ResumeLayout(false);

         }


Fix position of font settings view when rotating to landscape

--- xamarin/GLViewController.cs
+++ xamarin/GLViewController.cs
@@ -82,6 +82,8 @@

 			viewWidth = (float) View.Frame.Size.Width;
 			viewHeight = (float) View.Frame.Size.Height;
+
+			fontSettingsViewController.View.Frame = View.Frame;

 			projectionMatrix = Matrix4.CreateOrthographic ((float) viewWidth, (float) viewHeight, 0, -1);
 		}


improve module name match, to handle things like "Roland SC-8820 Port A".

--- lib/module-database/MidiModuleDatabase.cs
+++ lib/module-database/MidiModuleDatabase.cs
@@ -39,8 +39,10 @@

 		public override MidiModuleDefinition Resolve (string moduleName)
 		{
+			if (moduleName == null)
+				throw new ArgumentNullException ("moduleName");
 			string name = ResolvePossibleAlias (moduleName);
-			return Modules.FirstOrDefault (m => m.Name == name);
+			return Modules.FirstOrDefault (m => m.Name == name) ?? Modules.FirstOrDefault (m => name.Contains (m.Name));
 		}

 		public string ResolvePossibleAlias (string name)


Rename client trace to git-push-date.

Rename client trace to git-push-date.

--- Kudu.TestHarness/ApplicationManagerExtensions.cs
+++ Kudu.TestHarness/ApplicationManagerExtensions.cs
@@ -8,7 +8,7 @@
         {
             GitDeploymentResult result = Git.GitDeploy(appManager.DeploymentManager, appManager.ServiceUrl, localRepoPath, appManager.GitUrl, localBranchName, remoteBranchName);

-            string traceFile = String.Format("git-{0:MM-dd-H-mm-ss}.txt", DateTime.Now);
+            string traceFile = String.Format("git-push-{0:MM-dd-H-mm-ss}.txt", DateTime.Now);

             appManager.Save(traceFile, result.GitTrace);


Fix up trace message spelling.

Fix up trace message spelling.

--- LINQToTTree/LINQToTTreeLib/TTreeQueryExecutor.cs
+++ LINQToTTree/LINQToTTreeLib/TTreeQueryExecutor.cs
@@ -391,7 +391,7 @@

             TraceHelpers.TraceInfo(13, "ExecuteQueuedQueries: Startup - copying over proxy file");
             CopyToQueryDirectory(_proxyFile);
-            TraceHelpers.TraceInfo(14, "ExecuteQueuedQueries: Startup - buiding the TSelector");
+            TraceHelpers.TraceInfo(14, "ExecuteQueuedQueries: Startup - building the TSelector");
             var templateRunner = WriteTSelector(_proxyFile.Name, Path.GetFileNameWithoutExtension(_proxyFile.Name), combinedInfo);
             CompileAndLoad(templateRunner);


Make Internal Analytics (Log Page View and Log Post View) Asynchronous

--- Portal.CMS.Services/Analytics/AnalyticsService.cs
+++ Portal.CMS.Services/Analytics/AnalyticsService.cs
@@ -4,14 +4,15 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading.Tasks;

 namespace Portal.CMS.Services.Analytics
 {
     public interface IAnalyticsService
     {
-        void LogPageView(string area, string controller, string action, string referredUrl, string ipAddress, string userAgent, int? userId);
-
-        void LogPostView(int postId, string referredUrl, string ipAddress, string userAgent, int? UserId);
+        Task LogPageView(string area, string controller, string action, string referredUrl, string ipAddress, string userAgent, int? userId);
+
+        Task LogPostView(int postId, string referredUrl, string ipAddress, string userAgent, int? UserId);

         List<KeyValuePair<string, int>> TotalHitsToday();

@@ -41,7 +42,7 @@

         #endregion Dependencies

-        public void LogPageView(string area, string controller, string action, string referredUrl, string ipAddress, string userAgent, int? userId)
+        public async Task LogPageView(string area, string controller, string action, string referredUrl, string ipAddress, string userAgent, int? userId)
         {
             var newAnalyticPageView = new AnalyticPageView
             {
@@ -57,10 +58,10 @@

             _context.AnalyticPageViews.Add(newAnalyticPageView);

-            _context.SaveChanges();
-        }
-
-        public void LogPostView(int postId, string referredUrl, string ipAddress, string userAgent, int? UserId)
+            await _context.SaveChangesAsync();
+        }
+
+        public async Task LogPostView(int postId, string referredUrl, string ipAddress, string userAgent, int? UserId)
         {
             var analyticPostView = new AnalyticPostView
             {
@@ -74,7 +75,7 @@

             _context.AnalyticPostViews.Add(analyticPostView);

-            _context.SaveChanges();
+            await _context.SaveChangesAsync();
         }

         public List<KeyValuePair<string, int>> TotalHitsToday()


Preprocess nodes to find enums that were converted to numbers by C#

--- Lambda2Js/JavascriptCompilerExpressionVisitor.cs
+++ Lambda2Js/JavascriptCompilerExpressionVisitor.cs
@@ -54,13 +54,16 @@
         public override Expression Visit(Expression node)
         {
             var context = new JavascriptConversionContext(node, this, this.result, this.Options);
+            var node2 = PreprocessNode(node);
+
+            var context = new JavascriptConversionContext(node2, this, this.result, this.Options);
             foreach (var each in this.extensions)
             {
                 each.ConvertToJavascript(context);

                 #region Supported will be removed in v2
 #if V1
-                if (context.gotWriter && context.Node != node)
+                if (context.gotWriter && context.Node != node2)
                     throw new Exception(
                         "Cannot both write and return a new node. Either write javascript code, or return a new node.");
 #endif
@@ -68,12 +71,12 @@
                 if (context.preventDefault || context.gotWriter)
                 {
                     // canceling any further action with the current node
-                    return node;
+                    return node2;
                 }

                 #region Supported will be removed in v2
 #if V1
-                if (context.Node != node)
+                if (context.Node != node2)
                 {
                     // a new node must be completelly revisited
                     return this.Visit(context.Node);
@@ -83,7 +86,46 @@
             }

             // nothing happened, continue to the default conversion behavior
-            return base.Visit(node);
+            return base.Visit(node2);
+        }
+
+        private Expression PreprocessNode(Expression node)
+        {
+            if (node.NodeType == ExpressionType.Equal
+                || node.NodeType == ExpressionType.Or
+                || node.NodeType == ExpressionType.And
+                || node.NodeType == ExpressionType.ExclusiveOr
+                || node.NodeType == ExpressionType.OrAssign
+                || node.NodeType == ExpressionType.AndAssign
+                || node.NodeType == ExpressionType.ExclusiveOrAssign)
+            {
+                var binary = (BinaryExpression)node;
+                var left = binary.Left as UnaryExpression;
+                var leftVal = left != null && (left.NodeType == ExpressionType.Convert || left.NodeType == ExpressionType.ConvertChecked) ? left.Operand : binary.Left;
+                var right = binary.Right as UnaryExpression;
+                var rightVal = right != null && (right.NodeType == ExpressionType.Convert || right.NodeType == ExpressionType.ConvertChecked) ? right.Operand : binary.Right;
+                if (rightVal.Type != leftVal.Type)
+                {
+                    if (leftVal.Type.IsEnum && TypeHelpers.IsNumericType(rightVal.Type) && rightVal.NodeType == ExpressionType.Constant)
+                    {
+                        leftVal = binary.Left;
+                        rightVal = Expression.Convert(
+                            Expression.Constant(Enum.ToObject(leftVal.Type, ((ConstantExpression)rightVal).Value)),
+                            rightVal.Type);
+                    }
+                    else if (rightVal.Type.IsEnum && TypeHelpers.IsNumericType(leftVal.Type) && leftVal.NodeType == ExpressionType.Constant)
+                    {
+                        leftVal = Expression.Convert(
+                            Expression.Constant(Enum.ToObject(rightVal.Type, ((ConstantExpression)leftVal).Value)),
+                            leftVal.Type);
+                        rightVal = binary.Right;
+                    }
+
+                    return Expression.MakeBinary(node.NodeType, leftVal, rightVal);
+                }
+            }
+
+            return node;
         }

         protected override Expression VisitBinary(BinaryExpression node)


Fix SuperToolTip on Linux

Fix SuperToolTip on Linux

SuperToolTips on Linux so far had two problems: the fading in kind of
worked but it never showed with full opacity due to a mono bug
(#19856). The other problem was that it showed the wrong window type -
the window had a title bar and close button instead of a borderless
window.

This change fixes the windowtype problem and refactors the fading logic
to save an extra cycle.

Change-Id: I641544215d8c19e7a39ba0dc2c2fb5a20925371a

--- PalasoUIWindowsForms/SuperToolTip/SuperToolTip.cs
+++ PalasoUIWindowsForms/SuperToolTip/SuperToolTip.cs
@@ -239,16 +239,17 @@

 		private void FadeOnTick(object obj, EventArgs e)
 		{
-			if (window.Opacity == 1 && fadingDirection == FadingDirection.FadeIn)
+			window.Opacity = window.Opacity + (fadingDirection == FadingDirection.FadeOut ? -.1 : .1);
+
+			if (window.Opacity >= 1.0 && fadingDirection == FadingDirection.FadeIn)
 			{
 				fadingTimer.Stop();
 			}
-			if (window.Opacity == 0 && fadingDirection == FadingDirection.FadeOut)
+			else if (window.Opacity <= 0.0 && fadingDirection == FadingDirection.FadeOut)
 			{
 				fadingTimer.Stop();
 				window.Close();
 			}
-			window.Opacity = window.Opacity + (fadingDirection == FadingDirection.FadeOut ? -.1 : .1);
 		}

 		private SuperToolTipInfoWrapper GetControlInfo(Control control)
@@ -351,7 +352,7 @@

 		public SuperToolTipWindow()
 		{
-			FormBorderStyle = FormBorderStyle.FixedToolWindow;
+			FormBorderStyle = FormBorderStyle.FixedSingle;
 			ShowInTaskbar = false;
 			ControlBox = false;
 			_checkMouseLeftTimer = new Timer();


Cleanup FileTargetTests

Cleanup FileTargetTests

--- tests/NLog.UnitTests/Targets/FileTargetTests.cs
+++ tests/NLog.UnitTests/Targets/FileTargetTests.cs
@@ -62,10 +62,10 @@
         [Test]
         public void SimpleFileTest1()
         {
-            string tempFile = Path.GetTempFileName();
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempFile = Path.GetTempFileName();
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = SimpleLayout.Escape(tempFile),
                                         LineEnding = LineEndingMode.LF,
@@ -91,15 +91,11 @@
         [Test]
         public void CsvHeaderTest()
         {
-            // test for the following changes
-            // https://github.com/NLog/NLog/commit/e1ed0d4857dddc95d5db09ee95e9a0c85afc7810
-            // codeplex ticket 6370
-
-            string tempFile = Path.GetTempFileName();
-            try
-            {
-
-                for (int i = 0; i < 2; i++)
+            var tempFile = Path.GetTempFileName();
+            try
+            {
+
+                for (var i = 0; i < 2; i++)
                 {
                     var layout = new CsvLayout
                     {
@@ -113,7 +109,7 @@
                         }
                     };

-                    FileTarget ft = new FileTarget
+                    var ft = new FileTarget
                         {
                             FileName = SimpleLayout.Escape(tempFile),
                             LineEnding = LineEndingMode.LF,
@@ -138,10 +134,10 @@
         [Test]
         public void DeleteFileOnStartTest()
         {
-            string tempFile = Path.GetTempFileName();
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempFile = Path.GetTempFileName();
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = SimpleLayout.Escape(tempFile),
                                         LineEnding = LineEndingMode.LF,
@@ -207,13 +203,11 @@
         [Test]
         public void CreateDirsTest()
         {
-            // create the file in a not-existent
-            // directory which forces creation
-            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-            string tempFile = Path.Combine(tempPath, "file.txt");
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            var tempFile = Path.Combine(tempPath, "file.txt");
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = tempFile,
                                         LineEnding = LineEndingMode.LF,
@@ -241,13 +235,11 @@
         [Test]
         public void SequentialArchiveTest1()
         {
-            // create the file in a not-existent
-            // directory which forces creation
-            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-            string tempFile = Path.Combine(tempPath, "file.txt");
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            var tempFile = Path.Combine(tempPath, "file.txt");
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = tempFile,
                                         ArchiveFileName = Path.Combine(tempPath, "archive/{####}.txt"),
@@ -262,23 +254,23 @@

                 // we emit 5 * 250 *(3 x aaa + \n) bytes
                 // so that we should get a full file + 3 archives
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("aaa");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("bbb");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("ccc");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("ddd");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("eee");
                 }
@@ -320,13 +312,11 @@
         [Test]
         public void RollingArchiveTest1()
         {
-            // create the file in a not-existent
-            // directory which forces creation
-            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-            string tempFile = Path.Combine(tempPath, "file.txt");
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            var tempFile = Path.Combine(tempPath, "file.txt");
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = tempFile,
                                         ArchiveFileName = Path.Combine(tempPath, "archive/{####}.txt"),
@@ -341,23 +331,23 @@

                 // we emit 5 * 250 * (3 x aaa + \n) bytes
                 // so that we should get a full file + 3 archives
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("aaa");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("bbb");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("ccc");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("ddd");
                 }
-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Debug("eee");
                 }
@@ -398,12 +388,10 @@
         [Test]
         public void MultiFileWrite()
         {
-            // create the file in a not-existent
-            // directory which forces creation
-            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = Path.Combine(tempPath, "${level}.txt"),
                                         LineEnding = LineEndingMode.LF,
@@ -412,7 +400,7 @@

                 SimpleConfigurator.ConfigureForTargetLogging(ft, LogLevel.Debug);

-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Trace("@@@");
                     logger.Debug("aaa");
@@ -454,12 +442,10 @@
         [Test]
         public void BufferedMultiFileWrite()
         {
-            // create the file in a not-existent
-            // directory which forces creation
-            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = Path.Combine(tempPath, "${level}.txt"),
                                         LineEnding = LineEndingMode.LF,
@@ -468,7 +454,7 @@

                 SimpleConfigurator.ConfigureForTargetLogging(new BufferingTargetWrapper(ft, 10), LogLevel.Debug);

-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Trace("@@@");
                     logger.Debug("aaa");
@@ -510,13 +496,10 @@
         [Test]
         public void AsyncMultiFileWrite()
         {
-            //InternalLogger.LogToConsole = true;
-            //InternalLogger.LogLevel = LogLevel.Trace;
-
-            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-            try
-            {
-                FileTarget ft = new FileTarget
+            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            try
+            {
+                var ft = new FileTarget
                                     {
                                         FileName = Path.Combine(tempPath, "${level}.txt"),
                                         LineEnding = LineEndingMode.LF,
@@ -527,14 +510,12 @@
                 // such as ${threadid} are properly cached and not recalculated
                 // in logging threads.

-                string threadID = Thread.CurrentThread.ManagedThreadId.ToString();
-
-                //InternalLogger.LogToConsole = true;
-                //InternalLogger.LogLevel = LogLevel.Trace;
+                var threadID = Thread.CurrentThread.ManagedThreadId.ToString();
+
                 SimpleConfigurator.ConfigureForTargetLogging(new AsyncTargetWrapper(ft, 1000, AsyncTargetWrapperOverflowAction.Grow), LogLevel.Debug);
                 LogManager.ThrowExceptions = true;

-                for (int i = 0; i < 250; ++i)
+                for (var i = 0; i < 250; ++i)
                 {
                     logger.Trace("@@@");
                     logger.Debug("aaa");
@@ -604,7 +585,7 @@
         [Test]
         public void DisposingFileTarget_WhenNotIntialized_ShouldNotThrow()
         {
-            bool exceptionThrown = false;
+            var exceptionThrown = false;
             var fileTarget = new FileTarget();

             try
@@ -622,13 +603,11 @@
         [Test]
         public void FileTarget_WithArchiveFileNameEndingInNumberPlaceholder_ShouldArchiveFile()
         {
-            // create the file in a not-existent
-            // directory which forces creation
-            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-            string tempFile = Path.Combine(tempPath, "file.txt");
+            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            var tempFile = Path.Combine(tempPath, "file.txt");
             try
             {
-                FileTarget ft = new FileTarget
+                var ft = new FileTarget
                 {
                     FileName = tempFile,
                     ArchiveFileName = Path.Combine(tempPath, "archive/test.log.{####}"),
@@ -637,7 +616,7 @@

                 SimpleConfigurator.ConfigureForTargetLogging(ft, LogLevel.Debug);

-                for (int i = 0; i < 100; ++i)
+                for (var i = 0; i < 100; ++i)
                 {
                     logger.Debug("a");
                 }


unneeded sort and tolist

unneeded sort and tolist

--- tests/NLog.UnitTests/Targets/FileTargetTests.cs
+++ tests/NLog.UnitTests/Targets/FileTargetTests.cs
@@ -1017,8 +1017,8 @@
                 logger.Debug("1234567890");
                 LogManager.Configuration = null;

-                var files2 = Directory.GetFiles(archiveFolder).OrderBy(s => s).ToList();
-                Assert.Equal(maxArchiveFiles, files2.Count);
+                var files2 = Directory.GetFiles(archiveFolder);
+                Assert.Equal(maxArchiveFiles, files2.Length);

                 //the oldest file should be deleted
                 Assert.DoesNotContain(files[0], files2);


Additional logging for WaitForNonStaleResults.

--- Projects/RavenMagic/IDocumentSessionExtensions.cs
+++ Projects/RavenMagic/IDocumentSessionExtensions.cs
@@ -58,12 +58,27 @@
             indexName.MustNotBeNullOrWhiteSpace("indexName");
             waitTimeout.MustNotBeNull("waitTimeout");

-            Log.Debug(string.Format("WaitForNonStaleResults(indexName: {0}, waitTimeout: {1}", indexName, waitTimeout));
+            if (!documentSession.IsIndexStale(indexName))
+            {
+                Log.Debug(string.Format("{0} index is not stale.", indexName, waitTimeout));
+                return;
+            }
+
+            Log.Debug(string.Format("Waiting {1} for {0} to have no stale results...", indexName, waitTimeout));

             documentSession
                         .Query<object>(indexName)
                         .Customize(x => x.WaitForNonStaleResults(waitTimeout))
                         .Any();
+
+            if (documentSession.IsIndexStale(indexName))
+            {
+                Log.Debug(string.Format("After waiting {1} {0} index is still stale..", indexName, waitTimeout));
+            }
+            else
+            {
+                Log.Debug(string.Format("{0} index is now fresh.", indexName));
+            }
         }
     }
 }


Added Id parameter to POST method in EventController

--- ProCultura.Web.Api/Controllers/EventController.cs
+++ ProCultura.Web.Api/Controllers/EventController.cs
@@ -26,7 +26,7 @@
             return _eventsAppService.GetEventWithId(id);
         }

-        public EventModel PostEvent(NewEventModel request)
+        public EventModel PostEvent([FromUri] int id, [FromBody] NewEventModel request)
         {
             return _eventsAppService.CreateEvent(request);
         }


Replaced the Topic reference with the ITopic interface

git-svn-id: 16f658619b342a39b0afd2472f072a689916e5a2@370 6f2d7086-9719-0410-ba06-0b8292a297aa

--- Psycho/src/Core/Psycho.Core/Psycho.Style/Style.cs
+++ Psycho/src/Core/Psycho.Core/Psycho.Style/Style.cs
@@ -24,7 +24,7 @@
 {
 	public class Style
 	{
-		Topic topic;
+		ITopic topic;
 		string font;
 		FrameShape frameShape;
 		ConnectionPoint connectionPoint;
@@ -46,9 +46,9 @@
 			this.Topic = my_topic;
 		}

-		public Topic Topic
-		{
-			get { return topic; }
+		public ITopic Topic
+		{
+			get { return Topic; }
 			set { Topic = value; }
 		}


Removes timeout and simplifies wait code.

--- Python/Product/AnacondaInstallLauncher/Program.cs
+++ Python/Product/AnacondaInstallLauncher/Program.cs
@@ -20,6 +20,7 @@
 using System.IO;
 using System.Linq;
 using System.Threading;
+using System.Threading.Tasks;

 namespace Microsoft.PythonTools.AnacondaInstallLauncher {
     class Program {
@@ -135,35 +136,29 @@

         void WaitForUninstall(bool requireWait) {
             try {
-                WaitForProcess(DateTime.UtcNow.AddMinutes(30), requireWait);
+                WaitForProcess(requireWait);
             } catch (Exception ex) {
                 Console.Error.WriteLine(ex.ToString());
             }
         }

-        bool KeepWaiting {
-            get {
-                if (_cancel) {
+        bool IsDirectoryPresent() {
+            if (!Directory.Exists(_targetDir)) {
+                Console.Error.WriteLine("Target directory is not present");
+                return false;
+            }
+            try {
+                if (!Directory.EnumerateFileSystemEntries(_targetDir).Any()) {
+                    Console.Error.WriteLine("Target directory is empty");
                     return false;
                 }
+            } catch (Exception ex) {
+                Console.Error.WriteLine("Error reading target directory");
+                Console.Error.WriteLine(ex.ToString());
+                return false;
+            }

-                if (!Directory.Exists(_targetDir)) {
-                    Console.Error.WriteLine("Target directory is not present");
-                    return false;
-                }
-                try {
-                    if (!Directory.EnumerateFileSystemEntries(_targetDir).Any()) {
-                        Console.Error.WriteLine("Target directory is empty");
-                        return false;
-                    }
-                } catch (Exception ex) {
-                    Console.Error.WriteLine("Error reading target directory");
-                    Console.Error.WriteLine(ex.ToString());
-                    return false;
-                }
-
-                return true;
-            }
+            return true;
         }

         Process[] GetProcesses() {
@@ -173,38 +168,23 @@
                 .ToArray();
         }

-        void WaitForProcess(DateTime stopAt, bool requireProcess) {
-            if (!KeepWaiting) {
+        void WaitForProcess(bool requireProcess) {
+            if (!IsDirectoryPresent()) {
                 return;
             }

             var procs = GetProcesses();
             int retries = 30;
-            while (requireProcess && procs.Length == 0 && retries-- > 0) {
+            while (requireProcess && procs.Length == 0 && retries-- > 0 && !_cancel) {
                 Thread.Sleep(1000);
                 procs = GetProcesses();
             }
             Console.Error.WriteLine("Waiting for {0} processes named {1}", procs.Length, string.Join(", ", procs.Select(p => p.ProcessName)));

-            bool any = true;
-            while (any && KeepWaiting) {
-                if (DateTime.UtcNow >= _stopAt) {
-                    Console.Error.WriteLine("Timeout has expired");
-                    break;
-                }
+            var tasks = procs.Select(p => Task.Run(() => p.WaitForExit())).ToArray();
+            var task = Task.WhenAll(tasks);

-                Thread.Sleep(1000);
-                any = false;
-                foreach (var p in procs) {
-                    try {
-                        if (!p.HasExited) {
-                            any = true;
-                        }
-                    } catch (Exception ex) {
-                        Console.Error.WriteLine("Error {0} waiting for process: {1}", ex.GetType().Name, ex.Message);
-                    }
-                }
-            }
+            while (!_cancel && IsDirectoryPresent() && !task.Wait(1000)) { }

             Console.Error.WriteLine("Finished waiting");
         }


Call ScrollIntoView on drag & drop events

--- vmPing/Controls/ListBoxBehavior.cs
+++ vmPing/Controls/ListBoxBehavior.cs
@@ -74,28 +74,28 @@
         static void ListBox_Loaded(object sender, RoutedEventArgs e)
         {
             var listBox = (ListBox)sender;
-            var incc = listBox.Items as INotifyCollectionChanged;
-            if (incc == null) return;
+            if (!(listBox.Items is INotifyCollectionChanged notify)) return;
             listBox.Loaded -= ListBox_Loaded;
             Associations[listBox] = new Capture(listBox);
+            if (listBox.Items.Count > 1) listBox.ScrollIntoView(listBox.Items[listBox.Items.Count - 1]);
         }

         class Capture : IDisposable
         {
             private readonly ListBox listBox;
-            private readonly INotifyCollectionChanged incc;
+            private readonly INotifyCollectionChanged notify;

             public Capture(ListBox listBox)
             {
                 this.listBox = listBox;
-                incc = listBox.ItemsSource as INotifyCollectionChanged;
-                if (incc != null)
+                notify = listBox.ItemsSource as INotifyCollectionChanged;
+                if (notify != null)
                 {
-                    incc.CollectionChanged += incc_CollectionChanged;
+                    notify.CollectionChanged += Notify_CollectionChanged;
                 }
             }

-            void incc_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+            void Notify_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
             {
                 if (e.Action == NotifyCollectionChangedAction.Add)
                 {
@@ -106,9 +106,9 @@

             public void Dispose()
             {
-                if (incc != null)
-                    incc.CollectionChanged -= incc_CollectionChanged;
+                if (notify != null)
+                    notify.CollectionChanged -= Notify_CollectionChanged;
             }
         }
     }
-}
+}


FullMonty => StandardOperation

FullMonty => StandardOperation

--- tests/Tgstation.Server.Tests/IntegrationTest.cs
+++ tests/Tgstation.Server.Tests/IntegrationTest.cs
@@ -18,7 +18,7 @@
 		readonly IServerClientFactory clientFactory = new ServerClientFactory(new ProductHeaderValue(Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version.ToString()));

 		[TestMethod]
-		public async Task FullMonty()
+		public async Task StandardOperation()
 		{
 			var server = new TestingServer();
 			using (var serverCts = new CancellationTokenSource())


Fix name.

Fix name.

--- src/ImGui/Control/Slider.cs
+++ src/ImGui/Control/Slider.cs
@@ -45,7 +45,7 @@
                 sliderWidth,
                 rect.Height);
             bool hovered;
-            value = GUIBehavior.ToggleBehavior(sliderRect, id, true, value, minValue, maxValue, out hovered);
+            value = GUIBehavior.SliderBehavior(sliderRect, id, true, value, minValue, maxValue, out hovered);

             // render
             var state = GUIState.Normal;
@@ -103,7 +103,7 @@
             var sliderRect = new Rect(rect.X, rect.Y,
                 rect.Width, sliderHeight);
             bool hovered;
-            value = GUIBehavior.ToggleBehavior(sliderRect, id, false, value, minValue, maxValue, out hovered);
+            value = GUIBehavior.SliderBehavior(sliderRect, id, false, value, minValue, maxValue, out hovered);

             // render
             var state = GUIState.Normal;
@@ -172,7 +172,7 @@
                 sliderWidth,
                 rect.Height);
             bool hovered;
-            value = GUIBehavior.ToggleBehavior(sliderRect, id, true, value, minValue, maxValue, out hovered);
+            value = GUIBehavior.SliderBehavior(sliderRect, id, true, value, minValue, maxValue, out hovered);

             // render
             var state = GUIState.Normal;
@@ -240,7 +240,7 @@
                 sliderHeight);

             bool hovered;
-            value = GUIBehavior.ToggleBehavior(sliderRect, id, false, value, minValue, maxValue, out hovered);
+            value = GUIBehavior.SliderBehavior(sliderRect, id, false, value, minValue, maxValue, out hovered);

             // render
             var state = GUI.Normal;
@@ -264,7 +264,7 @@

     internal partial class GUIBehavior
     {
-        public static double ToggleBehavior(Rect sliderRect, int id, bool horizontal, double value, double minValue, double maxValue, out bool hovered)
+        public static double SliderBehavior(Rect sliderRect, int id, bool horizontal, double value, double minValue, double maxValue, out bool hovered)
         {
             GUIContext g = Form.current.uiContext;


Name symbols packages as Foo.1.0.symbols.nupkg

--- source/NuGet.Lucene.Web/Symbols/SymbolSource.cs
+++ source/NuGet.Lucene.Web/Symbols/SymbolSource.cs
@@ -192,7 +192,7 @@

         public virtual string GetNupkgPath(IPackageName package)
         {
-            return Path.Combine(SymbolsPath, package.Id, package.Id + "." + package.Version + ".nupkg");
+            return Path.Combine(SymbolsPath, package.Id, package.Id + "." + package.Version + ".symbols.nupkg");
         }

         /// <summary>


Fix line handling

Fix line handling

--- source/Nuke.Common/Utilities/TemplateUtility.cs
+++ source/Nuke.Common/Utilities/TemplateUtility.cs
@@ -45,9 +45,9 @@
                 return null;

             return replacements.Aggregate(
-                line
-                    .Substring(startIndex: 0, commentIndex)
-                    .TrimEnd(),
+                commentIndex == -1
+                    ? line
+                    : line.Substring(startIndex: 0, commentIndex).TrimEnd(),
                 (t, r) => t.Replace(r.Key, r.Value));
         }


Fix: Crash when opening web links

Fix: Crash when opening web links

--- source/Playnite.Common/System/ProcessStarter.cs
+++ source/Playnite.Common/System/ProcessStarter.cs
@@ -15,7 +15,16 @@
         public static Process StartUrl(string url)
         {
             logger.Debug($"Opening URL: {url}");
-            return Process.Start(url);
+            try
+            {
+                return Process.Start(url);
+            }
+            catch (Exception e)
+            {
+                // There are some crash report with 0x80004005 error when opening standard URL.
+                logger.Error(e, "Failed to open URL.");
+                return Process.Start("cmd.exe", $"/C start {url}");
+            }
         }

         public static Process StartProcess(string path, bool asAdmin = false)