Thank you, A_Biondi, for patch to porperly apply the new item name when copying within agent inventory

--- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -542,13 +542,13 @@
                 if (remoteClient.AgentId == oldAgentID)
                 {
                     CreateNewInventoryItem(
-                        remoteClient, newFolderID, item.Name, item.Flags, callbackID, asset, (sbyte)item.InvType,
+                        remoteClient, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
                         item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, Util.UnixTimeSinceEpoch());
                 }
                 else
                 {
                     CreateNewInventoryItem(
-                        remoteClient, newFolderID, item.Name, item.Flags, callbackID, asset, (sbyte)item.InvType,
+                        remoteClient, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
                         item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, Util.UnixTimeSinceEpoch());
                 }
             }


Fix build break

Fix build break

--- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -3404,7 +3404,7 @@
                     return;

                 lPos = ParentGroup.RootPart.AttachedPos;
-                state = AttachmentPoint;
+                state = (byte)AttachmentPoint;
             }
             else
             {


disable auto keyboard switching on mono for now

--- PalasoUIWindowsForms/WritingSystems/WSSortControl.cs
+++ PalasoUIWindowsForms/WritingSystems/WSSortControl.cs
@@ -228,8 +228,10 @@
 			{
 				return;
 			}
+#if !MONO
 			_defaultKeyboard = KeyboardController.GetActiveKeyboard();
 			_model.ActivateCurrentKeyboard();
+#endif
 		}

 		private void TextControl_Leave(object sender, EventArgs e)
@@ -238,7 +240,9 @@
 			{
 				return;
 			}
+#if !MONO
 			KeyboardController.ActivateKeyboard(_defaultKeyboard);
+#endif
 			if (_rulesValidationTimer.Enabled)
 			{
 				_rulesValidationTimer.Enabled = false;


Fixed a bug with the top left corner (0 index) getting the focus.

--- PartPreviewWindow/View3D/Gui3D/HeightValueDisplay.cs
+++ PartPreviewWindow/View3D/Gui3D/HeightValueDisplay.cs
@@ -67,7 +67,6 @@

         MeshViewerWidget MeshViewerToDrawWith { get { return view3DWidget.meshViewerWidget; } }

-        int SelectedBoundSideIndex = 0;
         public void SetPosition()
         {
             if (MeshViewerToDrawWith.HaveSelection)
@@ -75,7 +74,7 @@
                 // draw the hight from the bottom to the bed
                 AxisAlignedBoundingBox selectedBounds = MeshViewerToDrawWith.GetBoundsForSelection();

-                Vector2 screenPosition;
+                Vector2 screenPosition = new Vector2(-100, 0);
                 if (view3DWidget.DisplayAllValueData)
                 {
                     screenPosition = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(new Vector3(selectedBounds.maxXYZ.x, selectedBounds.minXYZ.y, selectedBounds.minXYZ.z));
@@ -88,18 +87,14 @@
                     bottomPoints[1] = new Vector3(selectedBounds.minXYZ.x, selectedBounds.maxXYZ.y, selectedBounds.minXYZ.z);
                     bottomPoints[2] = new Vector3(selectedBounds.maxXYZ.x, selectedBounds.minXYZ.y, selectedBounds.minXYZ.z);
                     bottomPoints[3] = new Vector3(selectedBounds.maxXYZ.x, selectedBounds.maxXYZ.y, selectedBounds.minXYZ.z);
-                    screenPosition = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomPoints[0]);
-                    for (int i = 1; i < 4; i++)
+
+                    for (int i = 0; i < 4; i++)
                     {
                         Vector2 testScreenPosition = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomPoints[i]);
                         if (testScreenPosition.x > screenPosition.x)
                         {
-                            SelectedBoundSideIndex = i;
                             startLineSelectionPos = testScreenPosition;
-                            Vector3 groundPos = bottomPoints[i];
-                            groundPos.z = 0;
-                            startLineGroundPos = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(groundPos);
-
+                            startLineGroundPos = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomPoints[i] + new Vector3(0, 0, -bottomPoints[i].z));
                             screenPosition = testScreenPosition + new Vector2(HorizontalLineLength, 0);
                         }
                     }


Undo rogue character

Undo rogue character

--- src/SFA.DAS.ProviderApprenticeshipsService.Web/Orchestrators/Mappers/BulkUploadMapper.cs
+++ src/SFA.DAS.ProviderApprenticeshipsService.Web/Orchestrators/Mappers/BulkUploadMapper.cs
@@ -76,7 +76,7 @@
         private UploadRowErrorViewModel MapError(IGrouping<int?, UploadError> arg)
         {
             var firstRecord = arg.FirstOrDefault();
-            Func<string, string> stringOrDefault = str => string.IsNullOrWhiteSpace(str) ? "�" : str;
+            Func<string, string> stringOrDefault = str => string.IsNullOrWhiteSpace(str) ? "-" : str;
             if (arg.Key != null && firstRecord != null)
             {
                 return new UploadRowErrorViewModel


Only handle arrow keys!

Only handle arrow keys!

--- Perspex.Controls/Primitives/SelectingItemsControl.cs
+++ Perspex.Controls/Primitives/SelectingItemsControl.cs
@@ -104,6 +104,8 @@
                 case Key.Right:
                     this.MoveSelection(FocusNavigationDirection.Right);
                     break;
+                default:
+                    return;
             }

             var selected = this.SelectedItem;


Adds back breadcrumb

Adds back breadcrumb

--- src/SFA.DAS.ProviderApprenticeshipsService.Web/Views/CreateCohort/ConfirmEmployer.cshtml
+++ src/SFA.DAS.ProviderApprenticeshipsService.Web/Views/CreateCohort/ConfirmEmployer.cshtml
@@ -41,3 +41,9 @@
         </form>

+
+@section breadcrumb {
+

+        Back
+

+}


Fixed test for net60.

Fixed test for net60.

--- tests/Magick.NET.Tests/MagickNETTests/TheVersionProperty.cs
+++ tests/Magick.NET.Tests/MagickNETTests/TheVersionProperty.cs
@@ -37,10 +37,10 @@
             [Fact]
             public void ShouldContainTheCorrectFramework()
             {
-#if NETCORE
+#if NET452
+                Assert.Contains("net20", MagickNET.Version);
+#else
                 Assert.Contains("netstandard21", MagickNET.Version);
-#else
-                Assert.Contains("net20", MagickNET.Version);
 #endif
             }
         }


Fixing bug on Match.

Fixing bug on Match.

--- ProgramSynthesis/ProseFunctions/Spg.Witness/Match.cs
+++ ProgramSynthesis/ProseFunctions/Spg.Witness/Match.cs
@@ -75,7 +75,7 @@
                     var found = TreeUpdate.FindNode(target, node.Value);
                     if(found == null) found = TreeUpdate.FindNode(currentTree, node.Value);
                     if (found == null) continue;
-                    kMatches.Add(node);
+                    kMatches.Add(found);
                 }
                 if (!kMatches.Any()) return null;
                 eExamples[input] = kMatches;
@@ -122,8 +122,8 @@
                 //var parent = (Pattern)kind.Examples[input];
                 foreach (TreeNode<SyntaxNodeOrToken> node in spec.DisjunctiveExamples[input])
                 {
-                    //var currentTree = GetAnchorTree(target, node);
-                    K k = new K(target, node);
+                    var found = TreeUpdate.FindNode(target, node.Value);
+                    K k = new K(target, found);
                     mats.Add(k);
                 }
                 kExamples[input] = mats;


It's working!

It's working!

Added `FullName()` method. Everything is green!

--- ProteinTracker/ProteinTrackerDotNetFit/HelloWorld.cs
+++ ProteinTracker/ProteinTrackerDotNetFit/HelloWorld.cs
@@ -6,5 +6,10 @@
     {
         public string FirstName { get; set; }
         public string LastName { get; set; }
+
+        public string FullName()
+        {
+            return FirstName + " " + LastName;
+        }
     }
 }


fix(DispatcherHelpers): Ensure correct dispatcher check (#1372)

Previously, the `IsOnDispatcher` check was for any dispatcher. Now, the dispatcher check is associated with the main window.

Fixes #1371

--- ReactWindows/ReactNative/Bridge/DispatcherHelpers.cs
+++ ReactWindows/ReactNative/Bridge/DispatcherHelpers.cs
@@ -30,7 +30,7 @@
         /// </returns>
         public static bool IsOnDispatcher()
         {
-            return CoreWindow.GetForCurrentThread()?.Dispatcher != null;
+            return CoreWindow.GetForCurrentThread()?.Dispatcher == CoreApplication.MainView.CoreWindow.Dispatcher;
         }

         /// <summary>


Implemented RavenEventStore according to unit tests.

--- Regalo.Core/EventSourcing/EventSourcingRepository.cs
+++ Regalo.Core/EventSourcing/EventSourcingRepository.cs
@@ -28,6 +28,9 @@
         public void Save(TAggregateRoot item)
         {
             IEnumerable<object> events = item.GetUncommittedEvents();
+
+            // Concurrency control/event conflict merging
+
             _eventStore.Store(item.Id, events);
         }
     }


Management\Wmi.cs: Fix for Object reference not set to an instance of an object. Resolves #4217 (Wmi task Info property can be null) reported by mikestu on 1st Oct 2009 #4217      Wmi task Info property can be null

--- Releases/3.5.4.0/Main3.5/Framework/Management/Wmi.cs
+++ Releases/3.5.4.0/Main3.5/Framework/Management/Wmi.cs
@@ -248,12 +248,12 @@
         /// </summary>
         private void Query()
         {
+            this.info = new List<ITaskItem>();
             this.GetManagementScope(this.Namespace);
             this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Executing WMI query: SELECT * FROM {0}", this.Class));
             ObjectQuery query = new ObjectQuery("SELECT * FROM " + this.Class);
             ManagementObjectSearcher searcher = new ManagementObjectSearcher(this.Scope, query);
             ManagementObjectCollection queryCollection = searcher.Get();
-            this.info = new List<ITaskItem>();
             foreach (ManagementObject m in queryCollection)
             {
                 ITaskItem item = new TaskItem(this.MachineName);


readCount should be a  UniqueJsonIdentifer too

--- inklewriter-engine-runtime/VariableReference.cs
+++ inklewriter-engine-runtime/VariableReference.cs
@@ -13,6 +13,7 @@
         public Path pathForVisitCount { get; set; }

         [JsonProperty("readCount")]
+        [UniqueJsonIdentifier]
         public string pathStringForVisitCount {
             get {
                 if( pathForVisitCount == null )


max value.

max value.

--- tools/TWCore.Object.Api/Controllers/FileSystemController.cs
+++ tools/TWCore.Object.Api/Controllers/FileSystemController.cs
@@ -237,6 +237,9 @@
                 if (!Request.Query.TryGetValue("name", out var name))
                     throw new Exception("You must specify a name of the file.");

+                if (Request.ContentLength.HasValue && Request.ContentLength.Value > 2097152)
+                    throw new Exception("The file is too large.");
+
                 object obj;
                 SessionData sessionData;


better error message when the template files are missing.

--- uSync8.Core/Serialization/Serializers/TemplateSerializer.cs
+++ uSync8.Core/Serialization/Serializers/TemplateSerializer.cs
@@ -47,7 +47,6 @@
                 if (System.IO.File.Exists(templatePath))
                 {
                     var content = System.IO.File.ReadAllText(templatePath);
-
                     item = new Template(name, alias);
                     item.Path = templatePath;
                     item.Content = content;
@@ -56,6 +55,7 @@
                 {
                     // template is missing
                     // we can't create
+                    return SyncAttempt<ITemplate>.Fail(name, ChangeType.Import, "The template '.cshtml' file is missing.");
                 }
             }


Orginized Agent code

Orginized Agent code

--- src/AIWorld/Entities/Agent.cs
+++ src/AIWorld/Entities/Agent.cs
@@ -34,28 +34,61 @@
     /// </summary>
     public class Agent : Entity, IMovingEntity, IScripted, IMessageHandler
     {
-        private readonly BasicEffect _basicEffect;
+        #region Fields
+
+        #region Fields - Services
+
         private readonly ICameraService _cameraService;
         private readonly IConsoleService _consoleService;
         private readonly IGameWorldService _gameWorldService;
+
+        #endregion
+
+        #region Fields - Logic stacks and containers
+
         private readonly Stack<IGoal> _goals = new Stack<IGoal>();
+        private readonly Stack<Node> _path = new Stack<Node>();
+        private readonly Dictionary<string, WeightedSteeringBehavior> _steeringBehaviors =
+            new Dictionary<string, WeightedSteeringBehavior>();
+
+        #endregion
+
+        #region Fields - Scipting callbacks
+
         private readonly AMXPublic _onClicked;
         private readonly AMXPublic _onIncomingMessage;
         private readonly AMXPublic _onKeyStateChanged;
         private readonly AMXPublic _onMouseClick;
         private readonly AMXPublic _onUpdate;
-        private readonly Stack<Node> _path = new Stack<Node>();
-
-        private readonly Dictionary<string, WeightedSteeringBehavior> _steeringBehaviors =
-            new Dictionary<string, WeightedSteeringBehavior>();
-
+
+        #endregion
+
+        #region Fields - Scripting logic
+
+        private float _targetRange;
+        private float _targetRangeSquared;
+
+        #endregion
+
+        #region Fields - Rendering
+
+        private Model _model;
+        private Matrix[] _transforms;
+
+        #endregion
+
+        #region Fields - Audio
+
+        private readonly BasicEffect _basicEffect;
         private AudioEmitter _audioEmitter;
-        private Model _model;
         private SoundEffect _soundEffect;
         private SoundEffectInstance _soundEffectInstance;
-        private float _targetRange;
-        private float _targetRangeSquared;
-        private Matrix[] _transforms;
+
+        #endregion
+
+        #endregion
+
+        #region Constructors

         /// <summary>
         ///     Initializes a new instance of the <see cref="Agent" /> class.
@@ -100,6 +133,10 @@
             _onIncomingMessage = Script.FindPublic("OnIncomingMessage");
         }

+        #endregion
+
+        #region Implementations
+
         #region Implementation of IMessageHandler

         /// <summary>
@@ -119,179 +156,6 @@

             if (_goals.Count > 0)
                 _goals.Peek().HandleMessage(message, contents);
-        }
-
-        #endregion
-
-        /// <summary>
-        ///     Is called when the user has clicked on this instance.
-        /// </summary>
-        /// <param name="e">The <see cref="MouseClickEventArgs" /> instance containing the event data.</param>
-        /// <returns>True if this instance has handled the input; False otherwise.</returns>
-        public override bool OnClicked(MouseClickEventArgs e)
-        {
-            if (_onClicked == null) return false;
-
-            // Push the arguments and call the callback.
-            Script.Push(e.Position.Z);
-            Script.Push(e.Position.X);
-            Script.Push(e.Button);
-            return _onClicked.Execute() == 1;
-        }
-
-        #region Overrides of GameComponent
-
-        /// <summary>
-        ///     Shuts down the component.
-        /// </summary>
-        protected override void Dispose(bool disposing)
-        {
-            // Stop sounds
-            if (_soundEffectInstance != null)
-            {
-                _soundEffectInstance.Stop(true);
-                _soundEffectInstance.Dispose();
-            }
-
-            // Dispose of the scriptbox
-            if (Script != null)
-                Script.Dispose();
-
-            Script = null;
-
-            // Dispose all goals
-            foreach (var g in _goals.OfType<IDisposable>())
-                g.Dispose();
-
-            base.Dispose(disposing);
-        }
-
-        #endregion
-
-        /// <summary>
-        ///     Starts the logic of this instance.
-        /// </summary>
-        public void Start()
-        {
-            TryExecuteMain(Script);
-        }
-
-        /// <summary>
-        ///     Attempts to execute the specified <paramref name="amxPublic" />. If it fails, a message will be printed to the
-        ///     in-game
-        ///     console.
-        /// </summary>
-        /// <param name="amxPublic">The AMX public.</param>
-        public void TryExecute(AMXPublic amxPublic)
-        {
-            try
-            {
-                amxPublic.Execute();
-            }
-            catch (Exception e)
-            {
-                _consoleService.WriteLine(Color.Red, e);
-            }
-        }
-
-        /// <summary>
-        ///     Attempts to execute the main function of the specified <paramref name="scriptBox" />. If it fails, a message will
-        ///     be
-        ///     printed to the in-game console.
-        /// </summary>
-        /// <param name="scriptBox">The script box.</param>
-        public void TryExecuteMain(ScriptBox scriptBox)
-        {
-            try
-            {
-                scriptBox.ExecuteMain();
-            }
-            catch (Exception e)
-            {
-                _consoleService.WriteLine(Color.Red, e);
-            }
-        }
-
-        private void game_MouseClick(object sender, MouseClickEventArgs e)
-        {
-            if (_onMouseClick == null || Script == null) return;
-
-            // Push the arguments and call the callback.
-            Script.Push(e.Position.Z);
-            Script.Push(e.Position.X);
-            Script.Push(e.Button);
-
-            _onMouseClick.Execute();
-        }
-
-        private void game_KeyStateChanged(object sender, KeyStateEventArgs e)
-        {
-            if (_onKeyStateChanged == null || Script == null) return;
-
-            // Allocate an array for new keys and old keys in the abstract machine.
-            var newKeys = Script.Allot(e.NewKeys.Length + 1);
-            var oldKeys = Script.Allot(e.OldKeys.Length + 1);
-
-            // Copy the keys to the machine.
-            for (var i = 0; i < e.NewKeys.Length; i++)
-                (newKeys + i).Set((int) e.NewKeys[i]);
-
-            for (var i = 0; i < e.OldKeys.Length; i++)
-                (oldKeys + i).Set((int) e.OldKeys[i]);
-
-            (newKeys + e.NewKeys.Length).Set((int) Keys.None);
-            (oldKeys + e.OldKeys.Length).Set((int) Keys.None);
-
-            // Push the arguments and call the callback.
-            Script.Push(oldKeys);
-            Script.Push(newKeys);
-
-            TryExecute(_onKeyStateChanged);
-
-            // Release the arrays.
-            Script.Release(newKeys);
-            Script.Release(oldKeys);
-        }
-
-        private void goal_Terminated(object sender, EventArgs e)
-        {
-            if (_goals.Count != 0)
-                _goals.Pop();
-        }
-
-        /// <summary>
-        ///     Calculates the steering force based on installed steering behaviors.
-        /// </summary>
-        /// <param name="gameTime">The game time.</param>
-        /// <returns>The summed steering force.</returns>
-        private Vector3 CalculateSteeringForce(GameTime gameTime)
-        {
-            var forces = _steeringBehaviors.Values.Aggregate(Vector3.Zero,
-                (current, behavior) => current + behavior.Calculate(gameTime));
-            return forces.Truncate(MaxForce);
-        }
-
-        /// <summary>
-        ///     Updates the position.
-        /// </summary>
-        /// <param name="gameTime">The game time.</param>
-        private void UpdatePosition(GameTime gameTime)
-        {
-            var deltaTime = (float) gameTime.ElapsedGameTime.TotalSeconds;
-            var steeringForce = CalculateSteeringForce(gameTime);
-
-            var acceleration = steeringForce/Mass;
-            Velocity += acceleration*deltaTime;
-
-            Velocity = Velocity.Truncate(MaxSpeed);
-
-            Position += Velocity*deltaTime;
-
-            if (Velocity.LengthSquared() > 0.00001)
-            {
-                Heading = Vector3.Normalize(Velocity);
-                Side = Heading.RotateAboutOriginY(Vector3.Zero, MathHelper.ToRadians(90));
-            }
         }

         /// <summary>
@@ -303,9 +167,91 @@
         /// <param name="color2">The color2.</param>
         private void DrawLine(Vector3 point1, Vector3 point2, Color color1, Color color2)
         {
-            var vertices = new[] {new VertexPositionColor(point1, color1), new VertexPositionColor(point2, color2)};
+            var vertices = new[] { new VertexPositionColor(point1, color1), new VertexPositionColor(point2, color2) };
             GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, vertices, 0, 1);
         }
+
+        #endregion
+
+        #region Implementation of IMovingEntity
+
+        /// <summary>
+        ///     Gets the velocity.
+        /// </summary>
+        public Vector3 Velocity { get; private set; }
+
+        /// <summary>
+        ///     Gets the mass.
+        /// </summary>
+        [ScriptingFunction]
+        public float Mass { get; set; }
+
+        /// <summary>
+        ///     Gets the heading.
+        /// </summary>
+        [ScriptingFunction]
+        public Vector3 Heading { get; private set; }
+
+        /// <summary>
+        ///     Gets the side.
+        /// </summary>
+        public Vector3 Side { get; private set; }
+
+        /// <summary>
+        ///     Gets the maximum speed.
+        /// </summary>
+        [ScriptingFunction]
+        public float MaxSpeed { get; set; }
+
+        /// <summary>
+        ///     Gets the maximum force.
+        /// </summary>
+        [ScriptingFunction]
+        public float MaxForce { get; set; }
+
+        #endregion
+
+        #region Implementation of IScripted
+
+        /// <summary>
+        ///     Gets the script.
+        /// </summary>
+        public ScriptBox Script { get; private set; }
+
+        #endregion
+
+        #endregion
+
+        #region Overrides
+
+        #region Overrides of GameComponent
+
+        /// <summary>
+        ///     Shuts down the component.
+        /// </summary>
+        protected override void Dispose(bool disposing)
+        {
+            // Stop sounds
+            if (_soundEffectInstance != null)
+            {
+                _soundEffectInstance.Stop(true);
+                _soundEffectInstance.Dispose();
+            }
+
+            // Dispose of the scriptbox
+            if (Script != null)
+                Script.Dispose();
+
+            Script = null;
+
+            // Dispose all goals
+            foreach (var g in _goals.OfType<IDisposable>())
+                g.Dispose();
+
+            base.Dispose(disposing);
+        }
+
+        #endregion

         #region Overrides of GameComponent

@@ -390,7 +336,7 @@

         #endregion

-        #region Agent API
+        #region Overrides of Entity

         /// <summary>
         ///     Gets or sets the identifier.
@@ -399,10 +345,205 @@
         public override int Id { get; set; }

         /// <summary>
+        ///     Gets the name of the script.
+        /// </summary>
+        public string ScriptName { get; private set; }
+
+        /// <summary>
+        ///     Gets the position.
+        /// </summary>
+        [ScriptingFunction]
+        public override Vector3 Position { get; set; }
+
+        /// <summary>
+        ///     Gets or sets the size.
+        /// </summary>
+        [ScriptingFunction]
+        public override float Size { get; set; }
+
+        /// <summary>
+        ///     Is called when the user has clicked on this instance.
+        /// </summary>
+        /// <param name="e">The <see cref="MouseClickEventArgs" /> instance containing the event data.</param>
+        /// <returns>True if this instance has handled the input; False otherwise.</returns>
+        public override bool OnClicked(MouseClickEventArgs e)
+        {
+            if (_onClicked == null) return false;
+
+            // Push the arguments and call the callback.
+            Script.Push(e.Position.Z);
+            Script.Push(e.Position.X);
+            Script.Push(e.Button);
+            return _onClicked.Execute() == 1;
+        }
+
+        #endregion
+
+        #endregion
+
+        #region Methods of Agent
+
+        /// <summary>
+        ///     Starts the logic of this instance.
+        /// </summary>
+        public void Start()
+        {
+            TryExecuteMain(Script);
+        }
+
+        /// <summary>
+        ///     Attempts to execute the specified <paramref name="amxPublic" />. If it fails, a message will be printed to the
+        ///     in-game
+        ///     console.
+        /// </summary>
+        /// <param name="amxPublic">The AMX public.</param>
+        public void TryExecute(AMXPublic amxPublic)
+        {
+            try
+            {
+                amxPublic.Execute();
+            }
+            catch (Exception e)
+            {
+                _consoleService.WriteLine(Color.Red, e);
+            }
+        }
+
+        /// <summary>
+        ///     Attempts to execute the main function of the specified <paramref name="scriptBox" />. If it fails, a message will
+        ///     be
+        ///     printed to the in-game console.
+        /// </summary>
+        /// <param name="scriptBox">The script box.</param>
+        public void TryExecuteMain(ScriptBox scriptBox)
+        {
+            try
+            {
+                scriptBox.ExecuteMain();
+            }
+            catch (Exception e)
+            {
+                _consoleService.WriteLine(Color.Red, e);
+            }
+        }
+
+        /// <summary>
+        ///     Calculates the steering force based on installed steering behaviors.
+        /// </summary>
+        /// <param name="gameTime">The game time.</param>
+        /// <returns>The summed steering force.</returns>
+        private Vector3 CalculateSteeringForce(GameTime gameTime)
+        {
+            var forces = _steeringBehaviors.Values.Aggregate(Vector3.Zero,
+                (current, behavior) => current + behavior.Calculate(gameTime));
+            return forces.Truncate(MaxForce);
+        }
+
+        /// <summary>
+        ///     Updates the position.
+        /// </summary>
+        /// <param name="gameTime">The game time.</param>
+        private void UpdatePosition(GameTime gameTime)
+        {
+            var deltaTime = (float) gameTime.ElapsedGameTime.TotalSeconds;
+            var steeringForce = CalculateSteeringForce(gameTime);
+
+            var acceleration = steeringForce/Mass;
+            Velocity += acceleration*deltaTime;
+
+            Velocity = Velocity.Truncate(MaxSpeed);
+
+            Position += Velocity*deltaTime;
+
+            if (Velocity.LengthSquared() > 0.00001)
+            {
+                Heading = Vector3.Normalize(Velocity);
+                Side = Heading.RotateAboutOriginY(Vector3.Zero, MathHelper.ToRadians(90));
+            }
+        }
+
+        #endregion
+
+        #region API - Sound Effect Instructions
+
+        /// <summary>
+        ///     Sets the sound effect.
+        /// </summary>
+        /// <param name="sound">The sound.</param>
+        /// <param name="isLooped">if set to <c>true</c> the sound is looped.</param>
+        /// <param name="volume">The volume.</param>
+        /// <returns>True on success; False otherwise.</returns>
+        [ScriptingFunction]
+        public bool SetSoundEffect(string sound, bool isLooped, float volume)
+        {
+            try
+            {
+                _audioEmitter = new AudioEmitter
+                {
+                    Position = Position,
+                    Forward = Heading,
+                    Up = Vector3.Up,
+                    Velocity = Velocity
+                };
+
+                _soundEffect = Game.Content.Load<SoundEffect>(sound);
+                _soundEffectInstance = _soundEffect.CreateInstance();
+                _soundEffectInstance.IsLooped = isLooped;
+                _soundEffectInstance.Volume = volume;
+                _soundEffectInstance.Apply3D(_cameraService.AudioListener, _audioEmitter);
+                _soundEffectInstance.Play();
+                return true;
+            }
+            catch (Exception e)
+            {
+                _consoleService.WriteLine(Color.Red, e);
+                return false;
+            }
+        }
+
+        /// <summary>
+        ///     Removes the sound effect.
+        /// </summary>
+        [ScriptingFunction]
+        public void RemoveSoundEffect()
+        {
+            if (_soundEffectInstance != null)
+                _soundEffectInstance.Dispose();
+            _soundEffectInstance = null;
+
+            if (_soundEffect != null)
+                _soundEffect.Dispose();
+            _soundEffect = null;
+
+            _audioEmitter = null;
+        }
+
+        #endregion
+
+        #region API - Drawing Instructions
+
+        /// <summary>
         ///     Gets or sets a value indicating whether to draw the path on the path stack.
         /// </summary>
         [ScriptingFunction]
         public bool DrawPath { get; set; }
+
+        /// <summary>
+        ///     Sets the model.
+        /// </summary>
+        /// <param name="modelname">The modelname.</param>
+        [ScriptingFunction]
+        public void SetModel(string modelname)
+        {
+            _model = Game.Content.Load<Model>(modelname);
+
+            _transforms = new Matrix[_model.Bones.Count];
+            _model.CopyAbsoluteBoneTransformsTo(_transforms);
+        }
+
+        #endregion
+
+        #region API - Calculations

         /// <summary>
         ///     Gets or sets the target range used by <see cref="IsInTargetRangeOfPoint(Vector3)" />.
@@ -419,131 +560,66 @@
         }

         /// <summary>
-        ///     Gets the script.
-        /// </summary>
-        public ScriptBox Script { get; private set; }
-
-        /// <summary>
-        ///     Clears the path stack.
-        /// </summary>
-        /// <returns>True on success; False otherwise.</returns>
-        [ScriptingFunction]
-        public bool ClearPathStack()
-        {
-            if (_path.Count == 0) return false;
-
-            _path.Clear();
-            return true;
-        }
-
-        /// <summary>
-        ///     Pops a node off the path stack.
-        /// </summary>
-        /// <param name="x">The x-coordinate.</param>
-        /// <param name="y">The y-coordinate.</param>
-        /// <returns>True on success; False otherwise.</returns>
-        [ScriptingFunction]
-        public bool PopPathNode(out float x, out float y)
-        {
-            if (_path.Count == 0)
-            {
-                x = 0;
-                y = 0;
-                return false;
-            }
-
-            var node = _path.Pop();
-
-            x = node.Position.X;
-            y = node.Position.Z;
-            return true;
-        }
-
-        /// <summary>
-        ///     Pushes a node to the path stack.
-        /// </summary>
-        /// <param name="x">The x-coordinate.</param>
-        /// <param name="y">The y-coordinate.</param>
-        [ScriptingFunction]
-        public void PushPathNode(float x, float y)
-        {
-            _path.Push(new Node(new Vector3(x, 0, y)));
-        }
-
-        /// <summary>
-        ///     Peeks at the top node on the path stack.
-        /// </summary>
-        /// <param name="x">The x-coordinate.</param>
-        /// <param name="y">The y-coordinate.</param>
-        /// <returns>True on success; False otherwise.</returns>
-        [ScriptingFunction]
-        public bool PeekPathNode(out float x, out float y)
-        {
-            if (_path.Count == 0)
-            {
-                x = 0;
-                y = 0;
-                return false;
-            }
-
-            var node = _path.Peek();
-
-            x = node.Position.X;
-            y = node.Position.Z;
-            return true;
-        }
-
-        /// <summary>
-        ///     Gets the size of the path stack.
-        /// </summary>
-        /// <returns>The size of the path stack</returns>
-        [ScriptingFunction]
-        public int GetPathStackSize()
-        {
-            return _path.Count;
-        }
-
-        /// <summary>
-        ///     Calculates and pushes a path to the path stack. The path is calculated from the graph with the specified
-        ///     <paramref name="key" />.
-        /// </summary>
-        /// <param name="key">The key of the graph to calculate the path in.</param>
-        /// <param name="startx">The start x-coordinate.</param>
-        /// <param name="starty">The start y-coordinate.</param>
-        /// <param name="endx">The end x-coordinate.</param>
-        /// <param name="endy">The end y-coordinate.</param>
-        /// <returns>True on success; False otherwise.</returns>
-        [ScriptingFunction]
-        public bool PushPath(string key, float startx, float starty, float endx, float endy)
-        {
-            var a = new Vector3(startx, 0, starty);
-            var b = new Vector3(endx, 0, endy);
-
-            var l = _path.Count;
-
-            var graph = _gameWorldService[key];
-            if (graph == null) return false;
-
-            foreach (var n in _gameWorldService[key].ShortestPath(a, b))
-                _path.Push(n);
-
-            return _path.Count > l;
-        }
-
-        //TODO: Add path smoothening function
-
-        /// <summary>
-        ///     Sets the model.
-        /// </summary>
-        /// <param name="modelname">The modelname.</param>
-        [ScriptingFunction]
-        public void SetModel(string modelname)
-        {
-            _model = Game.Content.Load<Model>(modelname);
-
-            _transforms = new Matrix[_model.Bones.Count];
-            _model.CopyAbsoluteBoneTransformsTo(_transforms);
-        }
+        ///     Determines whether this instance is in range of the specified point.
+        /// </summary>
+        /// <param name="point">The point.</param>
+        /// <param name="range">The range.</param>
+        /// <returns>True if within range; False otherwise.</returns>
+        public bool IsInRangeOfPoint(Vector3 point, float range)
+        {
+            return Vector3.Distance(point, Position) < range;
+        }
+
+        /// <summary>
+        ///     Determines whether this instance is in target range of the specified point.
+        /// </summary>
+        /// <param name="point">The point.</param>
+        /// <returns>True if within range; False otherwise.</returns>
+        public bool IsInTargetRangeOfPoint(Vector3 point)
+        {
+            return Vector3.DistanceSquared(point, Position) < _targetRangeSquared;
+        }
+
+        /// <summary>
+        ///     Determines whether this instance is in range of the specified point.
+        /// </summary>
+        /// <param name="x">The x-coordinate of the point.</param>
+        /// <param name="y">The y-coordinate of the point.</param>
+        /// <param name="range">The range.</param>
+        /// <returns>True if within range; False otherwise.</returns>
+        [ScriptingFunction]
+        public bool IsInRangeOfPoint(float x, float y, float range)
+        {
+            return IsInRangeOfPoint(new Vector3(x, 0, y), range);
+        }
+
+        /// <summary>
+        ///     Determines whether this instance is in target range of the specified point.
+        /// </summary>
+        /// <param name="x">The x-coordinate of the point.</param>
+        /// <param name="y">The y-coordinate of the point.</param>
+        /// <returns>True if within range; False otherwise.</returns>
+        [ScriptingFunction]
+        public bool IsInTargetRangeOfPoint(float x, float y)
+        {
+            return IsInTargetRangeOfPoint(new Vector3(x, 0, y));
+        }
+
+        /// <summary>
+        ///     Gets the distance to the specified point.
+        /// </summary>
+        /// <param name="x">The x-coordinate of the point.</param>
+        /// <param name="y">The y-coordinate of the point.</param>
+        /// <returns>The distance to the specified point.</returns>
+        [ScriptingFunction]
+        public float GetDistanceToPoint(float x, float y)
+        {
+            return Vector3.Distance(Position, new Vector3(x, 0, y));
+        }
+
+        #endregion
+
+        #region API - Steering Behaviors

         /// <summary>
         ///     Adds a steering behavior.
@@ -588,58 +664,6 @@
         }

         /// <summary>
-        ///     Sets the sound effect.
-        /// </summary>
-        /// <param name="sound">The sound.</param>
-        /// <param name="isLooped">if set to <c>true</c> the sound is looped.</param>
-        /// <param name="volume">The volume.</param>
-        /// <returns>True on success; False otherwise.</returns>
-        [ScriptingFunction]
-        public bool SetSoundEffect(string sound, bool isLooped, float volume)
-        {
-            try
-            {
-                _audioEmitter = new AudioEmitter
-                {
-                    Position = Position,
-                    Forward = Heading,
-                    Up = Vector3.Up,
-                    Velocity = Velocity
-                };
-
-                _soundEffect = Game.Content.Load<SoundEffect>(sound);
-                _soundEffectInstance = _soundEffect.CreateInstance();
-                _soundEffectInstance.IsLooped = isLooped;
-                _soundEffectInstance.Volume = volume;
-                _soundEffectInstance.Apply3D(_cameraService.AudioListener, _audioEmitter);
-                _soundEffectInstance.Play();
-                return true;
-            }
-            catch (Exception e)
-            {
-                _consoleService.WriteLine(Color.Red, e);
-                return false;
-            }
-        }
-
-        /// <summary>
-        ///     Removes the sound effect.
-        /// </summary>
-        [ScriptingFunction]
-        public void RemoveSoundEffect()
-        {
-            if (_soundEffectInstance != null)
-                _soundEffectInstance.Dispose();
-            _soundEffectInstance = null;
-
-            if (_soundEffect != null)
-                _soundEffect.Dispose();
-            _soundEffect = null;
-
-            _audioEmitter = null;
-        }
-
-        /// <summary>
         ///     Removes the specified steering behavior.
         /// </summary>
         /// <param name="key">The key of the steering behavior.</param>
@@ -650,63 +674,122 @@
             return _steeringBehaviors.Remove(key);
         }

-        /// <summary>
-        ///     Determines whether this instance is in range of the specified point.
-        /// </summary>
-        /// <param name="point">The point.</param>
-        /// <param name="range">The range.</param>
-        /// <returns>True if within range; False otherwise.</returns>
-        public bool IsInRangeOfPoint(Vector3 point, float range)
-        {
-            return Vector3.Distance(point, Position) < range;
-        }
-
-        /// <summary>
-        ///     Determines whether this instance is in target range of the specified point.
-        /// </summary>
-        /// <param name="point">The point.</param>
-        /// <returns>True if within range; False otherwise.</returns>
-        public bool IsInTargetRangeOfPoint(Vector3 point)
-        {
-            return Vector3.DistanceSquared(point, Position) < _targetRangeSquared;
-        }
-
-        /// <summary>
-        ///     Determines whether this instance is in range of the specified point.
-        /// </summary>
-        /// <param name="x">The x-coordinate of the point.</param>
-        /// <param name="y">The y-coordinate of the point.</param>
-        /// <param name="range">The range.</param>
-        /// <returns>True if within range; False otherwise.</returns>
-        [ScriptingFunction]
-        public bool IsInRangeOfPoint(float x, float y, float range)
-        {
-            return IsInRangeOfPoint(new Vector3(x, 0, y), range);
-        }
-
-        /// <summary>
-        ///     Determines whether this instance is in target range of the specified point.
-        /// </summary>
-        /// <param name="x">The x-coordinate of the point.</param>
-        /// <param name="y">The y-coordinate of the point.</param>
-        /// <returns>True if within range; False otherwise.</returns>
-        [ScriptingFunction]
-        public bool IsInTargetRangeOfPoint(float x, float y)
-        {
-            return IsInTargetRangeOfPoint(new Vector3(x, 0, y));
-        }
-
-        /// <summary>
-        ///     Gets the distance to the specified point.
-        /// </summary>
-        /// <param name="x">The x-coordinate of the point.</param>
-        /// <param name="y">The y-coordinate of the point.</param>
-        /// <returns>The distance to the specified point.</returns>
-        [ScriptingFunction]
-        public float GetDistanceToPoint(float x, float y)
-        {
-            return Vector3.Distance(Position, new Vector3(x, 0, y));
-        }
+        #endregion
+
+        #region API - Pathing
+
+        /// <summary>
+        ///     Pops a node off the path stack.
+        /// </summary>
+        /// <param name="x">The x-coordinate.</param>
+        /// <param name="y">The y-coordinate.</param>
+        /// <returns>True on success; False otherwise.</returns>
+        [ScriptingFunction]
+        public bool PopPathNode(out float x, out float y)
+        {
+            if (_path.Count == 0)
+            {
+                x = 0;
+                y = 0;
+                return false;
+            }
+
+            var node = _path.Pop();
+
+            x = node.Position.X;
+            y = node.Position.Z;
+            return true;
+        }
+
+        /// <summary>
+        ///     Pushes a node to the path stack.
+        /// </summary>
+        /// <param name="x">The x-coordinate.</param>
+        /// <param name="y">The y-coordinate.</param>
+        [ScriptingFunction]
+        public void PushPathNode(float x, float y)
+        {
+            _path.Push(new Node(new Vector3(x, 0, y)));
+        }
+
+        /// <summary>
+        ///     Peeks at the top node on the path stack.
+        /// </summary>
+        /// <param name="x">The x-coordinate.</param>
+        /// <param name="y">The y-coordinate.</param>
+        /// <returns>True on success; False otherwise.</returns>
+        [ScriptingFunction]
+        public bool PeekPathNode(out float x, out float y)
+        {
+            if (_path.Count == 0)
+            {
+                x = 0;
+                y = 0;
+                return false;
+            }
+
+            var node = _path.Peek();
+
+            x = node.Position.X;
+            y = node.Position.Z;
+            return true;
+        }
+
+        /// <summary>
+        ///     Gets the size of the path stack.
+        /// </summary>
+        /// <returns>The size of the path stack</returns>
+        [ScriptingFunction]
+        public int GetPathStackSize()
+        {
+            return _path.Count;
+        }
+
+        /// <summary>
+        ///     Calculates and pushes a path to the path stack. The path is calculated from the graph with the specified
+        ///     <paramref name="key" />.
+        /// </summary>
+        /// <param name="key">The key of the graph to calculate the path in.</param>
+        /// <param name="startx">The start x-coordinate.</param>
+        /// <param name="starty">The start y-coordinate.</param>
+        /// <param name="endx">The end x-coordinate.</param>
+        /// <param name="endy">The end y-coordinate.</param>
+        /// <returns>True on success; False otherwise.</returns>
+        [ScriptingFunction]
+        public bool PushPath(string key, float startx, float starty, float endx, float endy)
+        {
+            var a = new Vector3(startx, 0, starty);
+            var b = new Vector3(endx, 0, endy);
+
+            var l = _path.Count;
+
+            var graph = _gameWorldService[key];
+            if (graph == null) return false;
+
+            foreach (var n in _gameWorldService[key].ShortestPath(a, b))
+                _path.Push(n);
+
+            return _path.Count > l;
+        }
+
+        //TODO: Add path smoothening function
+
+        /// <summary>
+        ///     Clears the path stack.
+        /// </summary>
+        /// <returns>True on success; False otherwise.</returns>
+        [ScriptingFunction]
+        public bool ClearPathStack()
+        {
+            if (_path.Count == 0) return false;
+
+            _path.Clear();
+            return true;
+        }
+
+        #endregion
+
+        #region API - Goals

         /// <summary>
         ///     Adds the specified goal to the goal stack.
@@ -758,63 +841,56 @@

         #endregion

-        #region Implementation of IMovingEntity
-
-        /// <summary>
-        ///     Gets the velocity.
-        /// </summary>
-        public Vector3 Velocity { get; private set; }
-
-        /// <summary>
-        ///     Gets the mass.
-        /// </summary>
-        [ScriptingFunction]
-        public float Mass { get; set; }
-
-        /// <summary>
-        ///     Gets the heading.
-        /// </summary>
-        [ScriptingFunction]
-        public Vector3 Heading { get; private set; }
-
-        /// <summary>
-        ///     Gets the side.
-        /// </summary>
-        public Vector3 Side { get; private set; }
-
-        /// <summary>
-        ///     Gets the maximum speed.
-        /// </summary>
-        [ScriptingFunction]
-        public float MaxSpeed { get; set; }
-
-        /// <summary>
-        ///     Gets the maximum force.
-        /// </summary>
-        [ScriptingFunction]
-        public float MaxForce { get; set; }
-
-        #endregion
-
-        #region Overrides of Entity
-
-        /// <summary>
-        ///     Gets the name of the script.
-        /// </summary>
-        public string ScriptName { get; private set; }
-
-        /// <summary>
-        ///     Gets the position.
-        /// </summary>
-        [ScriptingFunction]
-        public override Vector3 Position { get; set; }
-
-        /// <summary>
-        ///     Gets or sets the size.
-        /// </summary>
-        [ScriptingFunction]
-        public override float Size { get; set; }
-
-        #endregion
+        #region Event Listeners of Agent
+
+        private void game_MouseClick(object sender, MouseClickEventArgs e)
+        {
+            if (_onMouseClick == null || Script == null) return;
+
+            // Push the arguments and call the callback.
+            Script.Push(e.Position.Z);
+            Script.Push(e.Position.X);
+            Script.Push(e.Button);
+
+            _onMouseClick.Execute();
+        }
+
+        private void game_KeyStateChanged(object sender, KeyStateEventArgs e)
+        {
+            if (_onKeyStateChanged == null || Script == null) return;
+
+            // Allocate an array for new keys and old keys in the abstract machine.
+            var newKeys = Script.Allot(e.NewKeys.Length + 1);
+            var oldKeys = Script.Allot(e.OldKeys.Length + 1);
+
+            // Copy the keys to the machine.
+            for (var i = 0; i < e.NewKeys.Length; i++)
+                (newKeys + i).Set((int) e.NewKeys[i]);
+
+            for (var i = 0; i < e.OldKeys.Length; i++)
+                (oldKeys + i).Set((int) e.OldKeys[i]);
+
+            (newKeys + e.NewKeys.Length).Set((int) Keys.None);
+            (oldKeys + e.OldKeys.Length).Set((int) Keys.None);
+
+            // Push the arguments and call the callback.
+            Script.Push(oldKeys);
+            Script.Push(newKeys);
+
+            TryExecute(_onKeyStateChanged);
+
+            // Release the arrays.
+            Script.Release(newKeys);
+            Script.Release(oldKeys);
+        }
+
+        private void goal_Terminated(object sender, EventArgs e)
+        {
+            if (_goals.Count != 0)
+                _goals.Pop();
+        }
+
+        #endregion
+
     }
 }


Add Point animator handling

Add Point animator handling

--- src/Avalonia.Visuals/Point.cs
+++ src/Avalonia.Visuals/Point.cs
@@ -2,6 +2,7 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.

 using System.Globalization;
+using Avalonia.Animation.Animators;
 using Avalonia.Utilities;

 namespace Avalonia
@@ -11,6 +12,11 @@
     /// </summary>
     public readonly struct Point
     {
+        static Point()
+        {
+            Animation.Animation.RegisterAnimator<PointAnimator>(prop => typeof(Point).IsAssignableFrom(prop.PropertyType));
+        }
+
         /// <summary>
         /// The X position.
         /// </summary>
@@ -133,7 +139,7 @@
         /// <param name="p">Point to multiply</param>
         /// <param name="k">Factor</param>
         /// <returns>Points having its coordinates multiplied</returns>
-        public static Point operator *(Point p, double k) => new Point(p.X*k, p.Y*k);
+        public static Point operator *(Point p, double k) => new Point(p.X * k, p.Y * k);

         /// <summary>
         /// Multiplies a point by a factor coordinate-wise
@@ -141,7 +147,7 @@
         /// <param name="p">Point to multiply</param>
         /// <param name="k">Factor</param>
         /// <returns>Points having its coordinates multiplied</returns>
-        public static Point operator *(double k, Point p) => new Point(p.X*k, p.Y*k);
+        public static Point operator *(double k, Point p) => new Point(p.X * k, p.Y * k);

         /// <summary>
         /// Divides a point by a factor coordinate-wise
@@ -149,8 +155,8 @@
         /// <param name="p">Point to divide by</param>
         /// <param name="k">Factor</param>
         /// <returns>Points having its coordinates divided</returns>
-        public static Point operator /(Point p, double k) => new Point(p.X/k, p.Y/k);
-
+        public static Point operator /(Point p, double k) => new Point(p.X / k, p.Y / k);
+
         /// <summary>
         /// Applies a matrix to a point.
         /// </summary>


Clarifies the documentation of the Fail property

--- src/Cake.Curl/CurlSettings.cs
+++ src/Cake.Curl/CurlSettings.cs
@@ -80,15 +80,18 @@
         public bool FollowRedirects { get; set; }

         ///
-        /// Gets or sets a value indicating whether HTTP errors above 400 should result in return code 22.
+        /// Gets or sets a value indicating whether HTTP errors should result in a non-zero exit code.
         ///
         /// <remarks>
-        /// (HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc
-        /// to better deal with failed attempts.
-        /// In normal cases when an HTTP server fails to deliver a document, it returns an HTML document stating so
-        /// (which often also describes why and more). This flag will prevent curl from outputting that and return error 22.
-        /// This method is not fail-safe and there are occasions where non-successful response codes will slip through,
-        /// especially when authentication is involved(response codes 401 and 407).
+        /// When HTTP servers fail to fulfill a request, they will often return an HTML page with the error information to the client.
+        /// In situations like these, curl's default behavior is to send the content of the error page to stdout and exit with a zero exit code, indicating success.
+        /// While this may be fine at the command line, it's quite problematic in scripts where it can lead to false positives.
+        /// Setting this property to <see langword="true"/>, tells curl to treat HTTP errors (4xx and 5xx) as failed operations
+        /// and to exit with status code 22 instead of 0.
+        /// Cake will then pick up the non-successful status code and turn it into a runtime exception.
+        /// Note that, according to curl's documentation, this method is not completely fail-safe
+        /// and there are occasions where non-successful response codes (especially those related to authentication, like 401
+        /// and 407) will slip through.
         /// </remarks>
         public bool Fail { get; set; }
     }


Add exception to first chance exception message.

--- src/Codex/CodexApplication.cs
+++ src/Codex/CodexApplication.cs
@@ -145,7 +145,7 @@
                 var verb = args[0].ToLowerInvariant();
                 if (actions.TryGetValue(verb, out var action))
                 {
-                    action.options.Parse(remaining);
+                    var remainingArguments = action.options.Parse(remaining);
                     Console.WriteLine("Parsed Arguments");
                     action.act();
                 }
@@ -204,7 +204,7 @@
                     }
                 }

-                if (ex is AggregateException)
+                if (ex is AggregateException || ex is OperationCanceledException)
                 {
                     return;
                 }
@@ -258,7 +258,7 @@
                     return;
                 }

-                var message = DateTime.Now.ToString() + ": First chance exception";
+                var message = DateTime.Now.ToString() + ": First chance exception: " + ex.ToString();

                 Log(message);
             }


修正 GenerateInt32() 方法的返回类型。

修正 GenerateInt32() 方法的返回类型。

--- src/Common/RandomGenerator.cs
+++ src/Common/RandomGenerator.cs
@@ -55,7 +55,7 @@
 			return BitConverter.ToInt64(bytes, 0);
 		}

-		public static long GenerateInt32()
+		public static int GenerateInt32()
 		{
 			var bytes = new byte[4];
 			_random.GetBytes(bytes);


CreateFullName() will call Resolve() so don't do it twice

--- src/DotNet/FullNameCreator.cs
+++ src/DotNet/FullNameCreator.cs
@@ -1211,10 +1211,7 @@
 				for (int i = 0; i < methodSig.GenParamCount; i++) {
 					if (i != 0)
 						sb.Append(',');
-					TypeSig typeSig = new GenericMVar((uint)i);
-					if (genericArguments != null)
-						typeSig = genericArguments.Resolve(typeSig);
-					CreateFullName(typeSig);
+					CreateFullName(new GenericMVar((uint)i));
 				}
 				sb.Append('>');
 			}


Fix XML doc comment

Fix XML doc comment

--- src/DotNet/MD/TablesStream.cs
+++ src/DotNet/MD/TablesStream.cs
@@ -81,7 +81,7 @@
 		}

 		/// <summary>
-		/// Initialize MD tables
+		/// Initializes MD tables
 		/// </summary>
 		/// <param name="peImage">The PEImage</param>
 		public void Initialize(IPEImage peImage) {


trying to write the server log messages in correct order

--- AC_ServerStarter/TrackCyclePlugin.cs
+++ AC_ServerStarter/TrackCyclePlugin.cs
@@ -305,16 +305,12 @@

         private void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
         {
-            string message = e.Data;
-            ThreadPool.QueueUserWorkItem(o => this.processAsync(message));
-        }
-
-        private void processAsync(string message)
-        {
             lock (this.lockObject)
             {
                 try
                 {
+                    string message = e.Data;
+
                     if (!string.IsNullOrEmpty(message) && !message.StartsWith("No car with address") && !message.StartsWith("Smoothing"))
                     {
                         this.PluginManager.Log(message);


SetPixel working: All algae blooms set to black

--- AlgaeScore/AlgaeScore/ImageReader.cs
+++ AlgaeScore/AlgaeScore/ImageReader.cs
@@ -17,7 +17,6 @@

         }

-
         public void pixelImage()
         {
             using (Image image = Image.FromFile("LakeErieAlgae.jpg"))
@@ -29,23 +28,19 @@
                         for (var h = 0; h < context.Height; h++)
                         {
                             var pixel = context.GetRawPixel(w, h);
-                            if (pixel.Red == 128)
+                            var average = Convert.ToByte((pixel.Red + pixel.Green + pixel.Blue) / 3d);
+                            if (average >= 89)
                             {
-                                if (pixel.Green == 254)
+                                if (average <= 172)
                                 {
-                                    if (pixel.Blue == 121)
-                                    {
-                                        pixel.Equals(Color.White);
-                                    }
-                                }
+                                    context.SetPixel(w, h, Color.Black);
+                                }
                             }
                             else
                             {
-                                pixel.Equals(Color.Black);
+                                context.SetPixel(w, h, Color.White);
                             }
-
-                            var average = Convert.ToByte((pixel.Red + pixel.Green + pixel.Blue) / 3d);
-                            context.SetPixel(w, h, pixel.Alpha, average, average, average);
+                            //context.SetPixel(w, h, pixel.Alpha, average, average, average);
                             //Detect when a pixel in the image matches the value of the 'green' shade
                             //If it is, set the pixel to 'white'
                             //Otherwise, 'black'
@@ -58,6 +53,7 @@
                 }
                 //image.DetectPadding();
                 image.Save(@"C:\Users\Alex\Documents\GitHub\AlgaeScore\AlgaeScore\AlgaeScore\bin\Debug\new.bmp", ImageFormat.Bmp);
+                //Create histogram of new bitmap file
             }


another XSS

another XSS

--- App/StackExchange.DataExplorer/Controllers/UserController.cs
+++ App/StackExchange.DataExplorer/Controllers/UserController.cs
@@ -256,6 +256,7 @@
                     message = user.Id == CurrentUser.Id ?
                         "You have no favorite queries, click the star icon on a query to favorite it" : "No favorites";
                 } else {
+                    order_by = "edited";
                     builder.Where("qs.OwnerId = @user", new { user = id });
                     builder.Where("qs.Hidden = 0");
                     builder.OrderBy("qs.LastActivity DESC");


Fixed up some lack-of-title nonsense

Fixed up some lack-of-title nonsense

--- App/StackExchange.DataExplorer/Controllers/UserController.cs
+++ App/StackExchange.DataExplorer/Controllers/UserController.cs
@@ -237,9 +237,9 @@
             }
             else if (order_by == "favorite")
             {
-                queries = Current.DB.Query<Metadata>(@"
+                queries = Current.DB.Query<Metadata, Query, QueryExecutionViewData>(@"
                     SELECT
-                        metadata.*
+                        metadata.*, query.*
                     FROM
                         Votes
                     JOIN
@@ -251,24 +251,20 @@
                             (Votes.OwnerId IS NULL AND metadata.OwnerID IS NULL)
                         ) AND
                         Votes.UserId = @user AND
-                        Votes.VoteTypeId = @vote",
-                    new
-                    {
-                        user = id,
-                        vote = (int)VoteType.Favorite
-                    }
-                ).Select<Metadata, QueryExecutionViewData>(
-                    (metadata) =>
+                        Votes.VoteTypeId = @vote
+                    JOIN
+                        Queries query
+                    ON
+                        metadata.LastQueryId = query.Id", // Strictly speaking this join is incorrect, but
+                                                          // if you couldn't be bothered to put in a title
+                                                          // I think (hope) it's "good enough"
+                    (metadata, query) =>
                     {
                         return new QueryExecutionViewData
                         {
                             Id = metadata.RevisionId,
                             Name = metadata.Title,
-                            // Figuring out the correct SQL-title here is an absolute pain,
-                            // so either we need to store it as an updatable default in
-                            // the metadata, or write the query to figure out which query
-                            // we should be pulling
-                            DefaultName = "unknown title",
+                            DefaultName = query.AsTitle(),
                             Description = metadata.Description,
                             FavoriteCount = metadata.Votes,
                             Views = metadata.Views,
@@ -277,33 +273,34 @@
                             SiteName = Site.Name.ToLower(),
                             UseLatestLink = true
                         };
+                    },
+                    new
+                    {
+                        user = id,
+                        vote = (int)VoteType.Favorite
                     }
                 );
             }
             else
             {
-                queries = Current.DB.Query<Metadata>(@"
+                queries = Current.DB.Query<Metadata, Query, QueryExecutionViewData>(@"
                     SELECT
                         *
                     FROM
-                        Metadata
-                    WHERE
-                        OwnerId = @user
+                        Metadata metadata
+                    JOIN
+                        Queries query
+                    ON
+                        metadata.LastQueryId = query.Id AND OwnerId = @user
                     ORDER BY
-                        LastActivity",
-                    new
-                    {
-                        user = id
-                    }
-                ).Select<Metadata, QueryExecutionViewData>(
-                    (metadata) =>
+                        metadata.LastActivity",
+                    (metadata, query) =>
                     {
                         return new QueryExecutionViewData
                         {
                             Id = metadata.RevisionId,
                             Name = metadata.Title,
-                            // Same excuse as above
-                            DefaultName = "unknown title",
+                            DefaultName = query.AsTitle(),
                             Description = metadata.Description,
                             FavoriteCount = metadata.Votes,
                             Views = metadata.Views,
@@ -312,6 +309,10 @@
                             SiteName = Site.Name.ToLower(),
                             UseLatestLink = true
                         };
+                    },
+                    new
+                    {
+                        user = id
                     }
                 );
             }


Show testing banner

Show testing banner

--- Anlab.Mvc/Views/Shared/Layout.cshtml
+++ Anlab.Mvc/Views/Shared/Layout.cshtml
@@ -1,3 +1,6 @@
+@using Microsoft.Extensions.Configuration
+@inject IConfiguration Configuration
+
 @using AnlabMvc.Helpers
 @using AnlabMvc.Models.Roles
 <!DOCTYPE html>
@@ -32,6 +35,9 @@

+        @if(Configuration["Environment:ShowTestBanner"] == "Yes"){
+
-----------!!! TEST SITE -- TEST SITE -- TEST SITE !!! -----------

+        }


Make classes not sealed in PromptDoalog.cs #2932

--- CSharp/Library/Microsoft.Bot.Builder/Dialogs/PromptDialog.cs
+++ CSharp/Library/Microsoft.Bot.Builder/Dialogs/PromptDialog.cs
@@ -658,7 +658,7 @@
         /// <summary>   Prompt for a text string. </summary>
         /// <remarks>   Normally used through <see cref="PromptDialog.Text(IDialogContext, ResumeAfter{string}, string, string, int)"/>.</remarks>
         [Serializable]
-        public sealed class PromptString : Prompt<string, string>
+        public class PromptString : Prompt<string, string>
         {
             /// <summary>   Constructor for a prompt string dialog. </summary>
             /// <param name="prompt">   The prompt. </param>
@@ -701,7 +701,7 @@
         /// <summary>   Prompt for a confirmation. </summary>
         /// <remarks>   Normally used through <see cref="PromptDialog.Confirm(IDialogContext, ResumeAfter{bool}, string, string, int, PromptStyle, string[], string[][])"/>.</remarks>
         [Serializable]
-        public sealed class PromptConfirm : Prompt<bool, string>
+        public class PromptConfirm : Prompt<bool, string>
         {
             private PromptChoice<string> innerPromptChoice;

@@ -805,7 +805,7 @@
         /// <summary>   Prompt for a Int64 </summary>
         /// <remarks>   Normally used through <see cref="PromptDialog.Number(IDialogContext, ResumeAfter{long}, string, string, int, string, long?, long?)"/>.</remarks>
         [Serializable]
-        public sealed class PromptInt64 : Prompt<long, long>
+        public class PromptInt64 : Prompt<long, long>
         {
             /// <summary>
             /// (Optional) Minimum value allowed.
@@ -855,7 +855,7 @@
         /// <summary>   Prompt for a double. </summary>
         /// <remarks>   Normally used through <see cref="PromptDialog.Number(IDialogContext, ResumeAfter{double}, string, string, int, string, double?, double?)"/>.</remarks>
         [Serializable]
-        public sealed class PromptDouble : Prompt<double, double>
+        public class PromptDouble : Prompt<double, double>
         {
             /// <summary>
             /// (Optional) Minimum value allowed.
@@ -1018,7 +1018,7 @@
         /// <summary> Prompt for an attachment</summary>
         /// <remarks> Normally used through <see cref="PromptDialog.Attachment(IDialogContext, ResumeAfter{IEnumerable{Connector.Attachment}}, string, IEnumerable{string}, string, int)"/>.</remarks>
         [Serializable]
-        public sealed class PromptAttachment : Prompt<IEnumerable<Attachment>, Attachment>
+        public class PromptAttachment : Prompt<IEnumerable<Attachment>, Attachment>
         {
             public IEnumerable<string> ContentTypes
             {


Update email service for attachment handling

--- CertiPay.Common.Notifications/Notifications/IEmailService.cs
+++ CertiPay.Common.Notifications/Notifications/IEmailService.cs
@@ -110,7 +110,7 @@

                 foreach (var attachment in notification.Attachments)
                 {
-                    await AttachUrl(msg, attachment);
+                    await AttachFile(msg, attachment);
                 }

                 await SendAsync(msg, token);
@@ -171,31 +171,42 @@
             // TODO Check blacklisted email addresses?
         }

-        public async Task AttachUrl(MailMessage msg, EmailNotification.Attachment attachment)
-        {
-            using (HttpClient client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = true }) { Timeout = DownloadTimeout })
-            {
-                Log.Info("Attaching {@attachment} for {@msg}", attachment, ForLog(msg));
-
-                if (String.IsNullOrWhiteSpace(attachment.Uri))
-                {
-                    Log.Warn("No Url provided for attachment, skipping");
-                    return;
-                }
-
-                if (String.IsNullOrWhiteSpace(attachment.Filename))
-                {
-                    Log.Warn("No filename provided for attachment, using default");
-                    attachment.Filename = "Attachment.pdf";
-                }
-
-                byte[] data = await client.GetByteArrayAsync(attachment.Uri).ConfigureAwait(false);
+        internal async Task AttachFile(MailMessage msg, EmailNotification.Attachment attachment)
+        {
+            if (String.IsNullOrWhiteSpace(attachment.Filename))
+            {
+                throw new ArgumentException("Attachment is missing a filename");
+            }
+
+            if (String.IsNullOrWhiteSpace(attachment.Uri) && String.IsNullOrWhiteSpace(attachment.Content))
+            {
+                throw new ArgumentException("Attachment does not have content");
+            }
+
+            using (Log.Timer("Attaching {@attachment} for {@msg}", attachment, ForLog(msg)))
+            {
+                byte[] data = new byte[] { };
+
+                if (!String.IsNullOrWhiteSpace(attachment.Content))
+                {
+                    // Attach the content decoded from Base64
+
+                    data = Convert.FromBase64String(attachment.Content);
+                }
+
+                if (!String.IsNullOrWhiteSpace(attachment.Uri))
+                {
+                    using (HttpClient client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = true }) { Timeout = DownloadTimeout })
+                    {
+                        // Attach the file downloaded
+
+                        data = await client.GetByteArrayAsync(attachment.Uri).ConfigureAwait(false);
+                    }
+                }

                 // MailMessage disposes of the attachment stream when it disposes

                 msg.Attachments.Add(new Attachment(new MemoryStream(data), attachment.Filename));
-
-                Log.Info("Completed attachment for {@msg}", ForLog(msg));
             }
         }

@@ -211,4 +222,4 @@
             };
         }
     }
-}
+}


Fixed a fill mesh bug.

Fixed a fill mesh bug.

--- Assets/Scripts/Core/Mesh/FillMesh.cs
+++ Assets/Scripts/Core/Mesh/FillMesh.cs
@@ -91,6 +91,9 @@

 			float ratio = clockwise ? amount : (1 - amount);
 			float tan = Mathf.Tan(Mathf.PI * 0.5f * ratio);
+			float thresold = vertRect.height / vertRect.width - tan;
+			if (!clockwise)
+				thresold = -thresold;
 			float x = vertRect.x + (ratio == 0 ? float.MaxValue : (vertRect.height / tan));
 			float y = vertRect.y + (ratio == 1 ? float.MaxValue : (vertRect.width * tan));
 			float x2 = x;
@@ -111,7 +114,7 @@

 			if (y > vertRect.yMax)
 			{
-				if (amount < 0.5f)
+				if (thresold > 0)
 					vb.AddVert(new Vector3(x2, yMax, 0));
 				else
 					vb.AddVert(new Vector3(xMax, yMax, 0));
@@ -121,7 +124,7 @@

 			if (x > vertRect.xMax)
 			{
-				if (amount < 0.5f)
+				if (thresold > 0)
 					vb.AddVert(new Vector3(xMax, y2, 0));
 				else
 					vb.AddVert(new Vector3(xMax, yMax, 0));


Fix basic reflection hook-ups

Fix basic reflection hook-ups

--- Assets/Scripts/ModSelectorService.cs
+++ Assets/Scripts/ModSelectorService.cs
@@ -16,10 +16,11 @@
         static ModWrapper()
         {
             ModType = ReflectionHelper.FindType("Mod");
-            ModNameProperty = ModType.GetProperty("ModName", BindingFlags.Instance | BindingFlags.Public);
+            TitleProperty = ModType.GetProperty("Title", BindingFlags.Instance | BindingFlags.Public);
             ModObjectsProperty = ModType.GetProperty("ModObjects", BindingFlags.Instance | BindingFlags.Public);

             ModDirectoryField = ModType.GetField("modDirectory", BindingFlags.Instance | BindingFlags.NonPublic);
+            UnityVersionField = ModType.GetField("modUnityVersion", BindingFlags.Instance | BindingFlags.NonPublic);

             BombType = ReflectionHelper.FindType("ModBomb");
             WidgetType = ReflectionHelper.FindType("ModWidget");
@@ -31,8 +32,9 @@
             Debug.Log(modObject);
             ModObject = modObject;

-            ModName = (string)ModNameProperty.GetValue(ModObject, null);
+            ModName = (string)TitleProperty.GetValue(ModObject, null);
             ModDirectory = (string)ModDirectoryField.GetValue(ModObject);
+            UnityVersion = (string)UnityVersionField.GetValue(ModObject);
             ModObjects = (List<GameObject>)ModObjectsProperty.GetValue(ModObject, null);

             try
@@ -163,9 +165,10 @@
         }

         public static readonly Type ModType = null;
-        public static readonly PropertyInfo ModNameProperty = null;
+        public static readonly PropertyInfo TitleProperty = null;
         public static readonly PropertyInfo ModObjectsProperty = null;
         public static readonly FieldInfo ModDirectoryField = null;
+        public static readonly FieldInfo UnityVersionField = null;

         public static readonly Type BombType = null;
         public static readonly Type WidgetType = null;
@@ -176,6 +179,7 @@
         public readonly string ModTitle;
         public readonly string ModVersion;
         public readonly string ModDirectory;
+        public readonly string UnityVersion;
         public readonly List<GameObject> ModObjects;

         private readonly List<GameObject> _activeModObjects;
@@ -423,9 +427,9 @@
     {
         UnityEngine.Object modManager = ModManager;

-        FieldInfo modsField = _modManagerType.GetField("mods", BindingFlags.Instance | BindingFlags.NonPublic);
-        IList modsList = (IList)modsField.GetValue(modManager);
-        foreach (object modObject in modsList)
+        FieldInfo modsField = _modManagerType.GetField("loadedMods", BindingFlags.Instance | BindingFlags.NonPublic);
+        IDictionary modsList = (IDictionary)modsField.GetValue(modManager);
+        foreach (object modObject in modsList.Values)
         {
             ModWrapper modWrapper = new ModWrapper(modObject);


Change Tuple is struct #99

Change Tuple is struct #99

--- Assets/UniRx/Scripts/System/Tuple.cs
+++ Assets/UniRx/Scripts/System/Tuple.cs
@@ -1,5 +1,5 @@
 // defined from .NET Framework 4.0 and NETFX_CORE
-// Tuple is borrowd from mono/mcs
+// This code is based from mono/mcs, mainly modified class to struct

 #if !NETFX_CORE

@@ -131,11 +131,8 @@
         }
     }

-
-    /* The rest is generated by the script at the bottom */
-
     [Serializable]
-    public class Tuple<T1> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
+    public struct Tuple<T1> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
     {
         T1 item1;

@@ -156,13 +153,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
-
+            var t = (Tuple<T1>)other;
             return comparer.Compare(item1, t.item1);
         }

@@ -173,10 +169,10 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1>;
-            if (t == null)
+            if (!(other is Tuple<T1>))
                 return false;

+            var t = (Tuple<T1>)other;
             return comparer.Equals(item1, t.item1);
         }

@@ -202,7 +198,7 @@
     }

     [Serializable]
-    public class Tuple<T1, T2> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
+    public struct Tuple<T1, T2> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
     {
         T1 item1;
         T2 item2;
@@ -230,12 +226,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1, T2>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1, T2>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
+            var t = (Tuple<T1, T2>)other;

             int res = comparer.Compare(item1, t.item1);
             if (res != 0) return res;
@@ -249,10 +245,10 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1, T2>;
-            if (t == null)
+            if (!(other is Tuple<T1, T2>))
                 return false;

+            var t = (Tuple<T1, T2>)other;
             return comparer.Equals(item1, t.item1) &&
                 comparer.Equals(item2, t.item2);
         }
@@ -282,7 +278,7 @@
     }

     [Serializable]
-    public class Tuple<T1, T2, T3> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
+    public struct Tuple<T1, T2, T3> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
     {
         T1 item1;
         T2 item2;
@@ -317,12 +313,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1, T2, T3>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
+            var t = (Tuple<T1, T2, T3>)other;

             int res = comparer.Compare(item1, t.item1);
             if (res != 0) return res;
@@ -338,10 +334,10 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3>;
-            if (t == null)
+            if (!(other is Tuple<T1, T2, T3>))
                 return false;

+            var t = (Tuple<T1, T2, T3>)other;
             return comparer.Equals(item1, t.item1) &&
                 comparer.Equals(item2, t.item2) &&
                 comparer.Equals(item3, t.item3);
@@ -373,7 +369,7 @@
     }

     [Serializable]
-    public class Tuple<T1, T2, T3, T4> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
+    public struct Tuple<T1, T2, T3, T4> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
     {
         T1 item1;
         T2 item2;
@@ -415,12 +411,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1, T2, T3, T4>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
+            var t = (Tuple<T1, T2, T3, T4>)other;

             int res = comparer.Compare(item1, t.item1);
             if (res != 0) return res;
@@ -438,9 +434,9 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4>;
-            if (t == null)
+            if (!(other is Tuple<T1, T2, T3, T4>))
                 return false;
+            var t = (Tuple<T1, T2, T3, T4>)other;

             return comparer.Equals(item1, t.item1) &&
                 comparer.Equals(item2, t.item2) &&
@@ -476,7 +472,7 @@
     }

     [Serializable]
-    public class Tuple<T1, T2, T3, T4, T5> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
+    public struct Tuple<T1, T2, T3, T4, T5> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
     {
         T1 item1;
         T2 item2;
@@ -525,12 +521,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1, T2, T3, T4, T5>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
+            var t = (Tuple<T1, T2, T3, T4, T5>)other;

             int res = comparer.Compare(item1, t.item1);
             if (res != 0) return res;
@@ -550,9 +546,9 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5>;
-            if (t == null)
+            if (!(other is Tuple<T1, T2, T3, T4, T5>))
                 return false;
+            var t = (Tuple<T1, T2, T3, T4, T5>)other;

             return comparer.Equals(item1, t.item1) &&
                 comparer.Equals(item2, t.item2) &&
@@ -590,7 +586,7 @@
     }

     [Serializable]
-    public class Tuple<T1, T2, T3, T4, T5, T6> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
+    public struct Tuple<T1, T2, T3, T4, T5, T6> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
     {
         T1 item1;
         T2 item2;
@@ -646,12 +642,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5, T6>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1, T2, T3, T4, T5, T6>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
+            var t = (Tuple<T1, T2, T3, T4, T5, T6>)other;

             int res = comparer.Compare(item1, t.item1);
             if (res != 0) return res;
@@ -673,9 +669,9 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5, T6>;
-            if (t == null)
+            if (!(other is Tuple<T1, T2, T3, T4, T5, T6>))
                 return false;
+            var t = (Tuple<T1, T2, T3, T4, T5, T6>)other;

             return comparer.Equals(item1, t.item1) &&
                 comparer.Equals(item2, t.item2) &&
@@ -716,7 +712,7 @@
     }

     [Serializable]
-    public class Tuple<T1, T2, T3, T4, T5, T6, T7> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
+    public struct Tuple<T1, T2, T3, T4, T5, T6, T7> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
     {
         T1 item1;
         T2 item2;
@@ -779,12 +775,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5, T6, T7>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
+            var t = (Tuple<T1, T2, T3, T4, T5, T6, T7>)other;

             int res = comparer.Compare(item1, t.item1);
             if (res != 0) return res;
@@ -808,9 +804,9 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5, T6, T7>;
-            if (t == null)
+            if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7>))
                 return false;
+            var t = (Tuple<T1, T2, T3, T4, T5, T6, T7>)other;

             return comparer.Equals(item1, t.item1) &&
                 comparer.Equals(item2, t.item2) &&
@@ -911,12 +907,12 @@

         int IStructuralComparable.CompareTo(object other, IComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>;
-            if (t == null)
+            if (other == null) return 1;
+            if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>))
             {
-                if (other == null) return 1;
                 throw new ArgumentException("other");
             }
+            var t = (Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>)other;

             int res = comparer.Compare(item1, t.item1);
             if (res != 0) return res;
@@ -942,9 +938,9 @@

         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
         {
-            var t = other as Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>;
-            if (t == null)
+            if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>))
                 return false;
+            var t = (Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>)other;

             return comparer.Equals(item1, t.item1) &&
                 comparer.Equals(item2, t.item2) &&


修正演习时敌方装备损管导致显示和计算错误的问题

修正演习时敌方装备损管导致显示和计算错误的问题

--- BattleInfoPlugin/Models/FleetData.cs
+++ BattleInfoPlugin/Models/FleetData.cs
@@ -168,11 +168,13 @@

         public static bool HasDamecon(this ShipData ship)
         {
+            if (ship is MastersShipData) return false;
             return ship?.Slots.Any(x => x?.Source.Id == 42) ?? false;
         }

         public static bool HasMegami(this ShipData ship)
         {
+            if (ship is MastersShipData) return false;
             return ship?.Slots.Any(x => x?.Source.Id == 43) ?? false;
         }
     }


dust off some fun code

dust off some fun code

--- CompatBot/EventHandlers/Starbucks.cs
+++ CompatBot/EventHandlers/Starbucks.cs
@@ -208,26 +208,32 @@
         }

-        private static Task CheckGameFansAsync(DiscordClient client, DiscordChannel channel, DiscordMessage message)
+        private static async Task CheckGameFansAsync(DiscordClient client, DiscordChannel channel, DiscordMessage message)
         {
             var bot = client.GetMember(channel.Guild, client.CurrentUser);
             var ch = channel.IsPrivate ? channel.Users.FirstOrDefault(u => u.Id != client.CurrentUser.Id)?.Username + "'s DM" : "#" + channel.Name;
             if (!channel.PermissionsFor(bot).HasPermission(Permissions.AddReactions))
             {
                 Config.Log.Debug($"No permissions to react in {ch}");
-                return Task.CompletedTask;
+                return;
             }

             var mood = client.GetEmoji(":sqvat:", "😒");
             if (message.Reactions.Any(r => r.Emoji == mood && r.IsMe))
-                return Task.CompletedTask;
+                return;

             var reactionMsg = string.Concat(message.Reactions.Select(r => TextMap.TryGetValue(r.Emoji, out var txt) ? txt : " ")).Trim();
             if (string.IsNullOrEmpty(reactionMsg))
-                return Task.CompletedTask;
+                return;

             Config.Log.Debug($"Emoji text: {reactionMsg} (in {ch})");
-            return Task.CompletedTask;
+
+            if (reactionMsg.Contains("UFC"))
+            {
+                await message.CreateReactionAsync(mood).ConfigureAwait(false);
+                await message.CreateReactionAsync(DiscordEmoji.FromUnicode("🇳")).ConfigureAwait(false);
+                await message.CreateReactionAsync(DiscordEmoji.FromUnicode("🇴")).ConfigureAwait(false);
+            }
         }
     }
 }


Another fix for Enumerable.Take

Another fix for Enumerable.Take

--- Core/System/Linq/Enumerable.net30.cs
+++ Core/System/Linq/Enumerable.net30.cs
@@ -1025,45 +1025,48 @@

         private static IEnumerable<TSource> TakeWhileExtracted<TSource>(this IEnumerable<TSource> source, int maxCount)
         {
+            if (maxCount > 0)
+            {
+                int count = 0;
+                foreach (TSource item in source)
+                {
+                    yield return item;
+                    count++;
+                    if (count == maxCount)
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+
+        private static IEnumerable<TSource> TakeWhileExtracted<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
+        {
             int count = 0;
             foreach (TSource item in source)
             {
+                if (!predicate(item, count))
+                {
+                    break;
+                }
                 yield return item;
                 count++;
-                if (count == maxCount)
-                {
-                    break;
-                }
-            }
-        }
-
-        private static IEnumerable<TSource> TakeWhileExtracted<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
+            }
+        }
+
+        private static IEnumerable<TSource> WhereExtracted<TSource>(IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
         {
             int count = 0;
             foreach (TSource item in source)
             {
                 if (!predicate(item, count))
                 {
-                    break;
+                    continue;
                 }
                 yield return item;
                 count++;
             }
         }
-
-        private static IEnumerable<TSource> WhereExtracted<TSource>(IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
-        {
-            int count = 0;
-            foreach (TSource item in source)
-            {
-                if (!predicate(item, count))
-                {
-                    continue;
-                }
-                yield return item;
-                count++;
-            }
-        }
     }
 }


Missing Context on Publish, fixes issue #158

Former-commit-id: a2ee457a1f6c2c720af25b62c46f7b6ea9f47bbb

--- src/MassTransit/ServiceBus.cs
+++ src/MassTransit/ServiceBus.cs
@@ -242,7 +242,7 @@
             if (contextCallback == null)
                 throw new ArgumentNullException("contextCallback");

-            BusObjectPublisherCache.Instance[messageType].Publish(this, message);
+            BusObjectPublisherCache.Instance[messageType].Publish(this, message, contextCallback);
         }

         /// <summary>


Added constants for building opcodes and arguments

--- src/MonoSump/SumpCommander.cs
+++ src/MonoSump/SumpCommander.cs
@@ -5,6 +5,67 @@
 {
 	public class SumpCommander : ISumpCommander
 	{
+		//this is copied almost verbatim from GPL code, but it's just constants, so it shouldn't matter that this is BSD licensed
+		/// <summary>
+		/// demultiplex
+		/// </summary>
+		const int FLAG_DEMUX = 0x00000001;		// demultiplex
+		/// <summary>
+		/// Noise filter
+		/// </summary>
+	    const int FLAG_FILTER = 0x00000002;		// noise filter
+		/// <summary>
+		/// Disable channel group 0
+		/// </summary>
+	    const int FLAG_DISABLE_G0 = 0x00000004;	// disable channel group 0
+		/// <summary>
+		/// Disable channel gorup 1
+		/// </summary>
+	    const int FLAG_DISABLE_G1 = 0x00000008;	// disable channel group 1
+		/// <summary>
+		/// Disable channel group 2
+		/// </summary>
+	    const int FLAG_DISABLE_G2 = 0x00000010;	// disable channel group 2
+		/// <summary>
+		/// Disable channel group 3
+		/// </summary>
+	    const int FLAG_DISABLE_G3 = 0x00000020;	// disable channel group 3
+		/// <summary>
+		/// Use external clock
+		/// </summary>
+	    const int FLAG_EXTERNAL = 0x00000040;	// disable channel group 3
+		/// <summary>
+		/// Invert the clock (only works with internal clock)
+		/// </summary>
+	    const int FLAG_INVERTED = 0x00000080;	// disable channel group 3
+		/// <summary>
+		/// Run length encoding (currently no plans to implement, since I don't have hardware capable of testing)
+		/// </summary>
+	    const int FLAG_RLE = 0x00000100;	// run length encoding
+		/// <summary>
+		/// Mask for delay value
+		/// </summary>
+	    const int TRIGGER_DELAYMASK = 0x0000ffff;// mask for delay value
+		/// <summary>
+		/// Mask for level value
+		/// </summary>
+	    const int TRIGGER_LEVELMASK = 0x00030000;// mask for level value
+		/// <summary>
+		/// Mask for channel for the trigger
+		/// </summary>
+	    const int TRIGGER_CHANNELMASK = 0x01f00000;// mask for level value
+		/// <summary>
+		/// Trigger uses serial mode
+		/// </summary>
+	    const int TRIGGER_SERIAL = 0x04000000;	// trigger operates in serial mode
+		/// <summary>
+		/// Trigger should start capture when fired
+		/// </summary>
+	    const int TRIGGER_CAPTURE = 0x08000000;	// trigger will start capture when fired
+		/// <summary>
+		/// clock speed in Hz
+		/// </summary>
+	    const int CLOCK = 100000000;	// device clock in Hz
 		IPort Port;
 		public SumpCommander(IPort port)
 		{


Improved support for PnPProvisioningContext while cloning ClientContext objects

--- Core/OfficeDevPnP.Core/Extensions/ClientContextExtensions.cs
+++ Core/OfficeDevPnP.Core/Extensions/ClientContextExtensions.cs
@@ -378,6 +378,7 @@
                         // Let's apply that specific Access Token
                         clonedClientContext.ExecutingWebRequest += (sender, args) =>
                         {
+                            // We get a fresh new Access Token for every request, to avoid using an expired one
                             var accessToken = PnPProvisioningContext.Current.AcquireToken(siteUrl.Authority, null);
                             args.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + accessToken;
                         };


Changed comment

Changed comment

--- framework/csCommonSense/Utils/Converters/MgrsConversion.cs
+++ framework/csCommonSense/Utils/Converters/MgrsConversion.cs
@@ -7,12 +7,17 @@

 namespace csCommon.Converters
 {
-    // Class for conversion between Latitude-Longitude coordinates and MGRS (Military Grid Reference System) coordinates.
-    // For more details, see the documentation of NETGeographicLib [http://geographiclib.sourceforge.net/html/NET/].
-
+    /// <summary>
+    /// Class for conversion between Latitude-Longitude coordinates and MGRS (Military Grid Reference System) coordinates.
+    /// For more details, see the documentation of NETGeographicLib [http://geographiclib.sourceforge.net/html/NET/].
+    /// </summary>
     public class MgrsConversion
     {
-        // Returns a string representation the MGRS coordinates, with the highest level of precision (1 m).
+        /// <summary>
+        /// Returns a string representation the MGRS coordinates, with the highest level of precision (1 m).
+        /// </summary>
+        /// <param name="lat"> Latitude in degrees </param>
+        /// <param name="lon"> Longitude in degrees </param>
         public static string convertLatLonToMgrs(double lat, double lon)
         {
             int zone;
@@ -24,13 +29,19 @@
             return mgrs;
         }

-        // Returns a string representation the MGRS coordinates, with specified precision.
-        // Precision should be specified with the prec parameter:
-        // prec = 1 -> 10 km precision
-        // prec = 2 -> 1 km precision
-        // prec = 3 -> 100 m precision
-        // prec = 4 -> 10 m precision
-        // prec = 5 -> 1 m precision
+        /// <summary>
+        /// Returns a string representation the MGRS coordinates, with specified precision.
+        /// Precision should be specified with the prec parameter:
+        /// prec = 1 -> 10 km precision
+        /// prec = 2 -> 1 km precision
+        /// prec = 3 -> 100 m precision
+        /// prec = 4 -> 10 m precision
+        /// prec = 5 -> 1 m precision
+        /// </summary>
+        /// <param name="lat"> Latitude in degrees </param>
+        /// <param name="lon"> Longitude in degrees </param>
+        /// <param name="prec"> Precision parameter (see description) </param>
+
         public static string convertLatLonToMgrsWithPrecision(double lat, double lon, int prec)
         {
             int zone;
@@ -42,7 +53,10 @@
             return mgrs;
         }

-        // Returns a double array with [lat, lon] in degrees
+        /// <summary>
+        /// Returns a double array with [lat, lon] in degrees
+        /// </summary>
+        /// <param name="mgrs"> MGRS string </param>
         public static double[] convertMgrsToLatLon(string mgrs)
         {
             int zone, prec;