User pattern matching

User pattern matching

--- osu.Game/Skinning/LocalSkinOverrideContainer.cs
+++ osu.Game/Skinning/LocalSkinOverrideContainer.cs
@@ -46,8 +46,7 @@
         public TValue? GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue?> query) where TConfiguration : SkinConfiguration where TValue : struct
         {
             TValue? val = null;
-            var conf = (source as Skin)?.Configuration as TConfiguration;
-            if (conf != null)
+            if ((source as Skin)?.Configuration is TConfiguration conf)
                 val = query?.Invoke(conf);

             return val ?? fallbackSource?.GetValue(query);
@@ -56,8 +55,7 @@
         public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration where TValue : class
         {
             TValue val = null;
-            var conf = (source as Skin)?.Configuration as TConfiguration;
-            if (conf != null)
+            if ((source as Skin)?.Configuration is TConfiguration conf)
                 val = query?.Invoke(conf);

             return val ?? fallbackSource?.GetValue(query);


Use quotes for identifiers containing spaces instead of commas. Hide parameter can be in any position in params.

--- Assets/Fungus/Narrative/Scripts/ConversationManager.cs
+++ Assets/Fungus/Narrative/Scripts/ConversationManager.cs
@@ -3,6 +3,7 @@
 using System.Collections.Generic;
 using System.Text.RegularExpressions;
 using UnityEngine;
+using System.Text;

 namespace Fungus
 {
@@ -69,8 +70,6 @@
             Sprite currentPortrait = null;
             RectTransform currentPosition = null;
             Character previousCharacter = null;
-            Sprite previousPortrait = null;
-            RectTransform previousPosition = null;

             // Play the conversation
             for (int i = 0; i < conversationItems.Count; ++i)
@@ -101,32 +100,32 @@
                     sayDialog.SetCharacter(currentCharacter);
                 }

-                Stage stage = Stage.GetActiveStage();
-
-                if (stage != null &&
-                    currentCharacter != null)
-                {
+                var stage = Stage.GetActiveStage();
+
+                if (stage != null && currentCharacter != null &&
+                    (currentPortrait != currentCharacter.state.portrait ||
+                     currentPosition != currentCharacter.state.position))
+                {
+                    var portraitOptions = new PortraitOptions(true);
+                    portraitOptions.display = item.Hide ? DisplayType.Hide : DisplayType.Show;
+                    portraitOptions.character = currentCharacter;
+                    portraitOptions.fromPosition = currentCharacter.state.position;
+                    portraitOptions.toPosition = currentPosition;
+                    portraitOptions.portrait = currentPortrait;
+
+                    // Do a move tween if the character is already on screen and not yet at the specified position
+                    if (currentCharacter.state.onScreen &&
+                        currentPosition != currentCharacter.state.position)
+                    {
+                        portraitOptions.move = true;
+                    }
+
                     if (item.Hide)
                     {
-                        // Other params like portrait and position are ignored
-                        stage.Hide(currentCharacter);
-                    }
-                    else if (currentPortrait != currentCharacter.state.portrait || currentPosition != currentCharacter.state.position)
-                    {
-                        PortraitOptions portraitOptions = new PortraitOptions(true);
-                        portraitOptions.display = DisplayType.Show;
-                        portraitOptions.character = currentCharacter;
-                        portraitOptions.fromPosition = currentCharacter.state.position;
-                        portraitOptions.toPosition = currentPosition;
-                        portraitOptions.portrait = currentPortrait;
-
-                        // Do a move tween if the character is already on screen and not yet at the specified position
-                        if (currentCharacter.state.onScreen &&
-                            currentPosition != currentCharacter.state.position)
-                        {
-                            portraitOptions.move = true;
-                        }
-
+                        stage.Hide(portraitOptions);
+                    }
+                    else
+                    {
                         stage.Show(portraitOptions);
                     }
                 }
@@ -138,8 +137,6 @@
                 }

                 previousCharacter = currentCharacter;
-                previousPortrait = currentPortrait;
-                previousPosition = currentPosition;

                 // Ignore Lua style comments and blank lines
                 if (item.Text.StartsWith("--") || item.Text.Trim() == "")
@@ -164,7 +161,7 @@
         {
             //find SimpleScript say strings with portrait options
             //You can test regex matches here: http://regexstorm.net/tester
-            Regex sayRegex = new Regex(@"((?<sayParams>[\w ,]*):)?(?<text>.*)\r*(\n|$)");
+            var sayRegex = new Regex(@"((?<sayParams>[\w ""]*):)?(?<text>.*)\r*(\n|$)");
             MatchCollection sayMatches = sayRegex.Matches(conv);

             var items = new List<ConversationItem>(sayMatches.Count);
@@ -186,18 +183,7 @@

                 if (!string.IsNullOrEmpty(sayParams))
                 {
-                    if (sayParams.Contains(","))
-                    {
-                        separateParams = sayParams.Split(',');
-                        for (int j = 0; j < separateParams.Length; j++)
-                        {
-                            separateParams[j] = separateParams[j].Trim();
-                        }
-                    }
-                    else
-                    {
-                        separateParams = sayParams.Split(' ');
-                    }
+                    separateParams = Split(sayParams);
                 }

                 var item = CreateConversationItem(separateParams, text, currentCharacter);
@@ -256,6 +242,7 @@
             }

             // Check if there's a Hide parameter
+            int hideIndex = -1;
             if (item.Character != null)
             {
                 for (int i = 0; i < sayParams.Length; i++)
@@ -263,7 +250,9 @@
                     if (i != characterIndex &&
                         string.Compare(sayParams[i], "hide", true) == 0 )
                     {
+                        hideIndex = i;
                         item.Hide = true;
+                        break;
                     }
                 }
             }
@@ -276,7 +265,8 @@
                 {
                     if (item.Portrait == null &&
                         item.Character != null &&
-                        i != characterIndex)
+                        i != characterIndex &&
+                        i != hideIndex)
                     {
                         Sprite s = item.Character.GetPortrait(sayParams[i]);
                         if (s != null)
@@ -296,15 +286,67 @@
                 for (int i = 0; i < sayParams.Length; i++)
                 {
                     if (i != characterIndex &&
-                        i != portraitIndex)
-                    {
-                        item.Position = stage.GetPosition(sayParams[i]);
-                        break;
+                        i != portraitIndex &&
+                        i != hideIndex)
+                    {
+                        RectTransform r = stage.GetPosition(sayParams[i]);
+                        if (r != null)
+                        {
+                            item.Position = r;
+                            break;
+                        }
                     }
                 }
             }

             return item;
 		}
+
+        /// <summary>
+        /// Splits the string passed in by the delimiters passed in.
+        /// Quoted sections are not split, and all tokens have whitespace
+        /// trimmed from the start and end.
+        protected static string[] Split(string stringToSplit)
+        {
+            var results = new List<string>();
+
+            bool inQuote = false;
+            var currentToken = new StringBuilder();
+            for (int index = 0; index < stringToSplit.Length; ++index)
+            {
+                char currentCharacter = stringToSplit[index];
+                if (currentCharacter == '"')
+                {
+                    // When we see a ", we need to decide whether we are
+                    // at the start or send of a quoted section...
+                    inQuote = !inQuote;
+                }
+                else if (char.IsWhiteSpace(currentCharacter) && !inQuote)
+                {
+                    // We've come to the end of a token, so we find the token,
+                    // trim it and add it to the collection of results...
+                    string result = currentToken.ToString().Trim( new [] { ' ', '\n', '\t', '\"'} );
+                    if (result != "") results.Add(result);
+
+                    // We start a new token...
+                    currentToken = new StringBuilder();
+                }
+                else
+                {
+                    // We've got a 'normal' character, so we add it to
+                    // the curent token...
+                    currentToken.Append(currentCharacter);
+                }
+            }
+
+            // We've come to the end of the string, so we add the last token...
+            string lastResult = currentToken.ToString().Trim();
+            if (lastResult != "")
+            {
+                results.Add(lastResult);
+            }
+
+            return results.ToArray();
+        }
 	}
 }


fix(Controller): ensure controller colliders scale

The colliders added automatically by the script
are now scaled properly according to the parent scale

--- Assets/VRTK/Scripts/Internal/VRTK_ControllerTracker.cs
+++ Assets/VRTK/Scripts/Internal/VRTK_ControllerTracker.cs
@@ -19,8 +19,10 @@
         {
             if (trackedController && transform.parent != trackedController.transform)
             {
+                var transformLocalScale = transform.localScale;
                 transform.SetParent(trackedController.transform);
                 transform.localPosition = Vector3.zero;
+                transform.localScale = transformLocalScale;
             }
         }
     }


fix(Locomotion): use correct axis check in touchpad control

The deadzone check in the Touchpad Control script for the y axis was
checking against the x axis instead of the y axis.

--- Assets/VRTK/Scripts/Locomotion/VRTK_TouchpadControl.cs
+++ Assets/VRTK/Scripts/Locomotion/VRTK_TouchpadControl.cs
@@ -45,7 +45,7 @@
                 OnXAxisChanged(SetEventArguements(directionDevice.right, currentAxis.x, axisDeadzone.x));
             }

-            if (OutsideDeadzone(currentAxis.y, axisDeadzone.y) || currentAxis.x == 0f)
+            if (OutsideDeadzone(currentAxis.y, axisDeadzone.y) || currentAxis.y == 0f)
             {
                 OnYAxisChanged(SetEventArguements(directionDevice.forward, currentAxis.y, axisDeadzone.y));
             }


Added comments

Added comments

--- AxSybase/Hibernate/SybaseAseConnectionStringBuilder.cs
+++ AxSybase/Hibernate/SybaseAseConnectionStringBuilder.cs
@@ -5,6 +5,15 @@
 {
     public class SybaseAseConnectionStringBuilder : ConnectionStringBuilder
     {
+        // Please look there for several connection string samples.
+        // Feel free to customise this class with new parameters.
+        // https://www.connectionstrings.com/ase-ado-net-data-provider/
+        //
+        // Look there for the charset value. You must setup the
+        // charset like in the ASE server if you got an exception
+        // "Unsupported Charset" at OpenSession.
+        // https://www.connectionstrings.com/ase-unsupported-charset/
+
         private string _server;
         private int _port;
         private string _database;
@@ -56,27 +65,27 @@

         protected override string Create()
         {
-            string str = base.Create();
-            if (!string.IsNullOrEmpty(str))
+            string connectionString = base.Create();
+            if (!string.IsNullOrEmpty(connectionString))
             {
-                return str;
+                return connectionString;
             }

-            StringBuilder connectionString = new StringBuilder();
+            StringBuilder connectionStringBuilder = new StringBuilder();

-            connectionString.AppendFormat("Data Source={0};Port={1};Database={2};Uid={3};Pwd={4}",
-                                          _server,
-                                          _port,
-                                          _database,
-                                          _username,
-                                          _password);
+            connectionStringBuilder.AppendFormat("Data Source={0};Port={1};Database={2};Uid={3};Pwd={4}",
+                                                 _server,
+                                                 _port,
+                                                 _database,
+                                                 _username,
+                                                 _password);

             if (!string.IsNullOrWhiteSpace(_charset))
             {
-                connectionString.AppendFormat(";Charset={0}", _charset);
+                connectionStringBuilder.AppendFormat(";Charset={0}", _charset);
             }

-            return connectionString.ToString();
+            return connectionStringBuilder.ToString();
         }
     }
 }


Move comments box again

Move comments box again

--- Battery-Commander.Web/Views/Evaluations/Details.cshtml
+++ Battery-Commander.Web/Views/Evaluations/Details.cshtml
@@ -14,17 +14,6 @@
         }
     }

-
-@using (Html.BeginForm("Comment", "Evaluations", FormMethod.Post, new { @class = "form-horitzontal" }))
-{
-    @Html.AntiForgeryToken()
-    @Html.HiddenFor(model => model.Id)
-
-
-        <textarea rows="4" cols="100" name="message"></textarea>
-        <button type="submit">Comment</button>
-
-}

@@ -98,6 +87,19 @@

+
+@using (Html.BeginForm("Comment", "Evaluations", FormMethod.Post, new { @class = "form-horitzontal" }))
+{
+    @Html.AntiForgeryToken()
+    @Html.HiddenFor(model => model.Id)
+
+
+        <textarea rows="4" cols="100" name="message"></textarea>
+        <button type="submit">Comment</button>
+
+}
+
+

@Html.DisplayNameFor(_ => Model.Events)


new comments

new comments

--- BibliographicSystem/Models/MicrosoftAcademicArticle.cs
+++ BibliographicSystem/Models/MicrosoftAcademicArticle.cs
@@ -2,6 +2,9 @@

 namespace BibliographicSystem.Models
 {
+    /// <summary>
+    /// class that represents an article from the microsoft academic
+    /// </summary>
     public class MicrosoftAcademicArticle
     {
         public string Title { get; set; }
@@ -13,6 +16,9 @@
         public List<Author> Authors { get; set; }
     }

+    /// <summary>
+    /// class that represents author of article
+    /// </summary>
     public class Author
     {
         public string AuthorName { get; set; }


improved report formatting

improved report formatting

--- BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs
+++ BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs
@@ -1399,8 +1399,10 @@
     List<string> ListElementsInAssembly(
       Document doc )
     {
-      Guid fp_description_param_guid
-        = new Guid( "ac6ed937-ffb7-4b18-9c69-7541f5c0319d" );
+      // 'FP Description' shared parameter GUID
+
+      Guid guid = new Guid(
+        "ac6ed937-ffb7-4b18-9c69-7541f5c0319d" );

       FilteredElementCollector assemblies
         = new FilteredElementCollector( doc )
@@ -1408,18 +1410,30 @@

       List<string> descriptions = new List<string>();

+      int n;
+      string s;
+
       foreach( AssemblyInstance a in assemblies )
       {
-        descriptions.Add( a.get_Parameter(
-          fp_description_param_guid ).AsString() );
-
         ICollection<ElementId> ids = a.GetMemberIds();

+        n = ids.Count;
+
+        s = string.Format(
+          "\r\nAssembly {0} has {1} member{2}{3}",
+          a.get_Parameter( guid ).AsString(),
+          n, Util.PluralSuffix( n ), Util.DotOrColon( n ) );
+
+        descriptions.Add( s );
+
+        n = 0;
+
         foreach( ElementId id in ids )
         {
           Element e = doc.GetElement( id );
-          descriptions.Add( e.get_Parameter(
-            fp_description_param_guid ).AsString() );
+
+          descriptions.Add( string.Format( "{0}: {1}",
+            n++, e.get_Parameter( guid ).AsString() ) );
         }
       }


FIX: Formatting

FIX: Formatting

--- CollAction/Helpers/ProjectNormalizeStringExtensions.cs
+++ CollAction/Helpers/ProjectNormalizeStringExtensions.cs
@@ -17,10 +17,11 @@
         {
             value = value.ToLowerInvariant();
             value = _spaceRemoveRegex.Replace(value,"-");
-            value = _invalidCharRemoveRegex.Replace(value,"");
+            value = _invalidCharRemoveRegex.Replace(value, "");
             value = value.Trim('-', '_');
-            value = _doubleDashRemoveRegex.Replace(value,"$1");
-            if(value.Length == 0){
+            value = _doubleDashRemoveRegex.Replace(value, "$1");
+            if(value.Length == 0)
+            {
                 value = "-";
             }


Message fix

Message fix

--- Common/Message/Data/Vessel/VesselFlightStateMsgData.cs
+++ Common/Message/Data/Vessel/VesselFlightStateMsgData.cs
@@ -41,6 +41,7 @@

             GuidUtil.Serialize(VesselId, lidgrenMsg);
             lidgrenMsg.Write(MainThrottle);
+            lidgrenMsg.Write(WheelThrottle);
             lidgrenMsg.Write(WheelThrottleTrim);
             lidgrenMsg.Write(X);
             lidgrenMsg.Write(Y);
@@ -66,6 +67,7 @@

             VesselId = GuidUtil.Deserialize(lidgrenMsg);
             MainThrottle = lidgrenMsg.ReadFloat();
+            WheelThrottle = lidgrenMsg.ReadFloat();
             WheelThrottleTrim = lidgrenMsg.ReadFloat();
             X = lidgrenMsg.ReadFloat();
             Y = lidgrenMsg.ReadFloat();
@@ -74,7 +76,6 @@
             GearUp = lidgrenMsg.ReadBoolean();
             GearDown = lidgrenMsg.ReadBoolean();
             Headlight = lidgrenMsg.ReadBoolean();
-            WheelThrottle = lidgrenMsg.ReadFloat();
             Pitch = lidgrenMsg.ReadFloat();
             Roll = lidgrenMsg.ReadFloat();
             Yaw = lidgrenMsg.ReadFloat();


Added implementation of the observer

Added implementation of the observer

--- DesignPatternsExamples/ObserverPattern/TwitterStock.cs
+++ DesignPatternsExamples/ObserverPattern/TwitterStock.cs
@@ -1,8 +1,13 @@
-namespace ObserverPattern
+using System;
+
+namespace ObserverPattern
 {
     public class TwitterStock : IObserver
     {
         private ISubject _stockData;
+        private double _price;
+        private DateTime _dateRecieved;
+        private string _symbol;

         public TwitterStock(ISubject stockData)
         {
@@ -11,7 +16,16 @@

         public void Update(Stock stock)
         {
-            throw new System.NotImplementedException();
+            _symbol = stock.Symbol;
+            _price = stock.Price;
+            _dateRecieved = stock.DateRecieved;
+
+            Display();
+        }
+
+        private void Display()
+        {
+            Console.WriteLine("{0} changed with price {1} on {2}.", _symbol, _price, _dateRecieved);
         }
     }
 }


reformatted processexecutor

reformatted processexecutor

--- Ductus.FluentDocker/Executors/ProcessExecutor.cs
+++ Ductus.FluentDocker/Executors/ProcessExecutor.cs
@@ -50,7 +50,7 @@
 #if COREFX
           startInfo.Environment[key] = Env[key];
 #else
-         startInfo.EnvironmentVariables[key] = Env[key];
+          startInfo.EnvironmentVariables[key] = Env[key];
 #endif
         }
       }


Clean up conditional

Clean up conditional

--- Desktop/Tempest/Providers/Network/NetworkConnection.cs
+++ Desktop/Tempest/Providers/Network/NetworkConnection.cs
@@ -841,33 +841,29 @@
 					if (header.IsStillEncrypted)
 						return (remaining < mlen);
 				}
-				else
-				{
-					byte[] iv = null;
-					if (msg.Encrypted && this.aes != null)
-					{
-						int ivLength = this.aes.IV.Length;
-						if (remaining < headerLength + ivLength)
-						{
-							Trace.WriteLineIf (NTrace.TraceVerbose, "Exiting (header not buffered (IV))");
-							return false;
-						}
-
-						iv = reader.ReadBytes (ivLength);
-
-						headerLength += ivLength;
-						if (remaining < headerLength)
-						{
-							Trace.WriteLineIf (NTrace.TraceVerbose, "Exiting (header not buffered)", callCategory);
-							return false;
-						}
-
-						header.State |= HeaderState.IV;
-						header.IV = iv;
-						header.HeaderLength += headerLength;
-
-						return (remaining < mlen); // we need to decrypt the rest if we have it.
-					}
+				else if (msg.Encrypted && this.aes != null)
+				{
+					int ivLength = this.aes.IV.Length;
+					if (remaining < headerLength + ivLength)
+					{
+						Trace.WriteLineIf (NTrace.TraceVerbose, "Exiting (header not buffered (IV))");
+						return false;
+					}
+
+					byte[] iv = reader.ReadBytes (ivLength);
+
+					headerLength += ivLength;
+					if (remaining < headerLength)
+					{
+						Trace.WriteLineIf (NTrace.TraceVerbose, "Exiting (header not buffered)", callCategory);
+						return false;
+					}
+
+					header.State |= HeaderState.IV;
+					header.IV = iv;
+					header.HeaderLength += headerLength;
+
+					return (remaining > mlen); // we need to decrypt the rest if we have it.
 				}

 				int identV = reader.ReadInt32();


Rebased on responses, fixed an additional SL issue

--- Desktop/Tempest/Providers/Network/NetworkConnection.cs
+++ Desktop/Tempest/Providers/Network/NetworkConnection.cs
@@ -315,8 +315,10 @@
 				this.lastMessageId = 0;
 				this.nextMessageId = 0;

+				#if NET_4
 				lock (this.messageResponses)
 					this.messageResponses.Clear();
+				#endif
 			}
 		}


This doesn't need to be public

This doesn't need to be public

--- ExpressionToCodeLib/Internal/TypeToCodeConfig.cs
+++ ExpressionToCodeLib/Internal/TypeToCodeConfig.cs
@@ -39,7 +39,7 @@
         return output.ToString();
     }

-    public static bool IsValueTupleType(TypeInfo typeInfo)
+    internal static bool IsValueTupleType(TypeInfo typeInfo)
         => typeInfo.IsGenericType && !typeInfo.IsGenericTypeDefinition && typeInfo.Namespace == "System" && typeInfo.Name.StartsWith("ValueTuple`", StringComparison.Ordinal);

     string GetUnaliasedTypeName(Type type)


Order gigs by date.

Order gigs by date.

--- GigHub/Persistence/Repositories/GigRepository.cs
+++ GigHub/Persistence/Repositories/GigRepository.cs
@@ -45,7 +45,7 @@
                         g.City.Contains(searchTerm));
             }

-            return upcomingGigs.ToList();
+            return upcomingGigs.OrderBy(g => g.DateTime).ToList();
         }

         public IEnumerable<Gig> GetUpcomingGigsByArtist(string userId)
@@ -56,6 +56,7 @@
                     g.DateTime > DateTime.Now &&
                     !g.IsCanceled)
                 .Include(g => g.Genre)
+                .OrderBy(g => g.DateTime)
                 .ToList();
         }

@@ -73,6 +74,7 @@
                 .Select(a => a.Gig)
                 .Include(g => g.Artist)
                 .Include(g => g.Genre)
+                .OrderBy(g => g.DateTime)
                 .ToList();
         }


Remove erroneously added System.Windows.Documents using statement

--- EndlessClient/HUD/Inventory/InventorySpaceValidator.cs
+++ EndlessClient/HUD/Inventory/InventorySpaceValidator.cs
@@ -8,7 +8,6 @@
 using Optional.Collections;
 using System.Collections.Generic;
 using System.Linq;
-using System.Windows.Documents;

 namespace EndlessClient.HUD.Inventory
 {


Fix other player attack animation rate limiting

If overlapping attacks occur, reset the character being animated and start over

--- EndlessClient/Rendering/Character/CharacterAnimator.cs
+++ EndlessClient/Rendering/Character/CharacterAnimator.cs
@@ -68,23 +68,33 @@

         public void StartOtherCharacterWalkAnimation(int characterID)
         {
-            if (_otherPlayerStartWalkingTimes.Any(x => x.UniqueID == characterID) ||
-                _otherPlayerStartAttackingTimes.Any(x => x.UniqueID == characterID))
-                return;
+            if (_otherPlayerStartAttackingTimes.Any(x => x.UniqueID == characterID))
+                return;
+
+            var existingStartTime = _otherPlayerStartWalkingTimes.SingleOrDefault(x => x.UniqueID == characterID);
+            if (existingStartTime != null)
+            {
+                ResetCharacterAnimationFrames(characterID);
+                _otherPlayerStartWalkingTimes.Remove(existingStartTime);
+            }

             var startWalkingTimeAndID = new RenderFrameActionTime(characterID, DateTime.Now);
-
             _otherPlayerStartWalkingTimes.Add(startWalkingTimeAndID);
         }

         public void StartOtherCharacterAttackAnimation(int characterID)
         {
-            if (_otherPlayerStartWalkingTimes.Any(x => x.UniqueID == characterID) ||
-                _otherPlayerStartAttackingTimes.Any(x => x.UniqueID == characterID))
-                return;
+            if (_otherPlayerStartWalkingTimes.Any(x => x.UniqueID == characterID))
+                return;
+
+            var existingStartTime = _otherPlayerStartAttackingTimes.SingleOrDefault(x => x.UniqueID == characterID);
+            if (existingStartTime != null)
+            {
+                ResetCharacterAnimationFrames(characterID);
+                _otherPlayerStartAttackingTimes.Remove(existingStartTime);
+            }

             var startAttackingTimeAndID = new RenderFrameActionTime(characterID, GetStartingAttackTime());
-
             _otherPlayerStartAttackingTimes.Add(startAttackingTimeAndID);
         }

@@ -196,6 +206,15 @@
             return x.UniqueID == _characterRepository.MainCharacter.ID && x.ActionStartTime.HasValue;
         }

+        private void ResetCharacterAnimationFrames(int characterID)
+        {
+            var character = _currentMapStateRepository.Characters.Single(x => x.ID == characterID);
+            var renderProps = character.RenderProperties.ResetAnimationFrames();
+            var newCharacter = character.WithRenderProperties(renderProps);
+            _currentMapStateRepository.Characters.Remove(character);
+            _currentMapStateRepository.Characters.Add(newCharacter);
+        }
+
         private static DateTime GetStartingAttackTime()
         {
             //make the first frame very short for attacking


added new methods

added new methods

--- ISAAR.MSolve.PreProcessor/Elements/Shell8disp.cs
+++ ISAAR.MSolve.PreProcessor/Elements/Shell8disp.cs
@@ -11,23 +11,25 @@
 namespace ISAAR.MSolve.PreProcessor.Elements
 {
     class Shell8disp //: IStructuralFiniteElement
-    {
-        public static int endeixiGaussCoordinates = 1;
+    {
         public static int gp_d1 { get; set; }
         public static int gp_d2 { get; set; }
         public static int gp_d3 { get; set; }
+        public static int [] tk { get; set; }
         private static int nGaussPoints;
-
-        private double[][] gausscoordinates;

         private static double ksi;
         private static double heta;
         private static double zeta;
         private static int npoint;
-        private double [] [] GetGaussCoordinates()
+
+        public static int endeixiGaussCoordinates = 1;
+        private double[][] gausscoordinates;
+        private double [] [] GetGaussCoordinates() //3 dianysmata me tis timew tvn ksi heta zeta se ola ta gauss points
         {
             if(endeixiGaussCoordinates == 1)
             {   nGaussPoints = gp_d1 * gp_d2 * gp_d3;
+                gausscoordinates = new double[3][];
                 for (int l = 0; l < 3; l++)
                 { gausscoordinates[l] = new double[nGaussPoints]; }
                 for (int l = 0; l < gp_d3; l++)
@@ -53,5 +55,144 @@
             else
             { return gausscoordinates; }
         }
+
+        private double[][] shapeFunctions;
+        public static int endeixiShapeFunctions = 1;
+        private double [] [] GetShapeFunctions() // 8 dianusmata me tis times twn N1....N8 se kathe gauss point
+        {
+            if (endeixiShapeFunctions == 1)
+            {
+                nGaussPoints = gp_d1 * gp_d2 * gp_d3;
+                gausscoordinates = this.GetGaussCoordinates();
+                shapeFunctions = new double[8][];
+                for (int j = 0; j < 8; j++)
+                { shapeFunctions[j] = new double[nGaussPoints]; }
+                for (int j = 0; j < nGaussPoints; j++)
+                {
+                    shapeFunctions[4][j] = 0.5 * (1 - Math.Pow(gausscoordinates[0][j], 2)) * (1 + gausscoordinates[1][j]);
+                    shapeFunctions[5][j] = 0.5 * (1 - Math.Pow(gausscoordinates[1][j], 2)) * (1 - gausscoordinates[0][j]);
+                    shapeFunctions[6][j] = 0.5 * (1 - Math.Pow(gausscoordinates[0][j], 2)) * (1 - gausscoordinates[1][j]);
+                    shapeFunctions[7][j] = 0.5 * (1 - Math.Pow(gausscoordinates[1][j], 2)) * (1 + gausscoordinates[0][j]);
+                    shapeFunctions[0][j] = 0.25 * (1 + gausscoordinates[0][j]) * (1 + gausscoordinates[1][j]) - 0.5 * shapeFunctions[4][j] - 0.5 * shapeFunctions[7][j];
+                    shapeFunctions[1][j] = 0.25 * (1 - gausscoordinates[0][j]) * (1 + gausscoordinates[1][j]) - 0.5 * shapeFunctions[4][j] - 0.5 * shapeFunctions[5][j];
+                    shapeFunctions[2][j] = 0.25 * (1 - gausscoordinates[0][j]) * (1 - gausscoordinates[1][j]) - 0.5 * shapeFunctions[5][j] - 0.5 * shapeFunctions[6][j];
+                    shapeFunctions[3][j] = 0.25 * (1 + gausscoordinates[0][j]) * (1 - gausscoordinates[1][j]) - 0.5 * shapeFunctions[6][j] - 0.5 * shapeFunctions[7][j];
+                }
+                endeixiShapeFunctions = 2;
+                return shapeFunctions;
+            }
+            else
+            { return shapeFunctions; }
+        }
+
+        private double[][] shapeFunctionDerivatives;
+        public static int endeixiShapeFunctionDerivatives = 1;
+        private double[][] GetShapeFunctionDerivatives() // 16 dianusmata me tis times twn N1ksi....N8ksi,N1heta,....N8heta se kathe gauss point
+        {
+            if (endeixiShapeFunctionDerivatives == 1)
+            {
+                nGaussPoints = gp_d1 * gp_d2 * gp_d3;
+                gausscoordinates = this.GetGaussCoordinates();
+                shapeFunctionDerivatives = new double[16][];
+                for (int j = 0; j < 16; j++)
+                { shapeFunctionDerivatives[j] = new double[nGaussPoints]; }
+                for (int j = 0; j < nGaussPoints; j++)
+                {
+                    //Ni_ksi
+                    shapeFunctionDerivatives[4][j] = (-gausscoordinates[0][j]) * (1 + gausscoordinates[1][j]);
+                    shapeFunctionDerivatives[5][j] = -0.5 * (1 - Math.Pow(gausscoordinates[1][j], 2));
+                    shapeFunctionDerivatives[6][j] = 0.5 * (-2 * gausscoordinates[0][j]) * (1 - gausscoordinates[1][j]);
+                    shapeFunctionDerivatives[7][j] = 0.5 * (1 - Math.Pow(gausscoordinates[1][j], 2));
+                    shapeFunctionDerivatives[0][j] = +0.25 * (1 + gausscoordinates[1][j]) - 0.5 * shapeFunctionDerivatives[4][j] - 0.5 * shapeFunctionDerivatives[7][j];
+                    shapeFunctionDerivatives[1][j] = -0.25 * (1 + gausscoordinates[1][j]) - 0.5 * shapeFunctionDerivatives[4][j] - 0.5 * shapeFunctionDerivatives[5][j];
+                    shapeFunctionDerivatives[2][j] = -0.25 * (1 - gausscoordinates[1][j]) - 0.5 * shapeFunctionDerivatives[5][j] - 0.5 * shapeFunctionDerivatives[6][j];
+                    shapeFunctionDerivatives[3][j] = +0.25 * (1 - gausscoordinates[1][j]) - 0.5 * shapeFunctionDerivatives[6][j] - 0.5 * shapeFunctionDerivatives[7][j];
+                    //Ni_heta
+                    shapeFunctionDerivatives[12][j] = 0.5 * (1 - Math.Pow(gausscoordinates[0][j], 2));
+                    shapeFunctionDerivatives[13][j] = 0.5 * (-2 * gausscoordinates[1][j]) * (1 - gausscoordinates[0][j]);
+                    shapeFunctionDerivatives[14][j] = 0.5 * (1 - Math.Pow(gausscoordinates[0][j], 2)) * (-1);
+                    shapeFunctionDerivatives[15][j] = 0.5 * (-2 * gausscoordinates[1][j]) * (1 + gausscoordinates[0][j]);
+                    shapeFunctionDerivatives[8][j] = +0.25 * (1 + gausscoordinates[0][j]) - 0.5 * shapeFunctionDerivatives[12][j] - 0.5 * shapeFunctionDerivatives[15][j];
+                    shapeFunctionDerivatives[9][j] = +0.25 * (1 - gausscoordinates[0][j]) - 0.5 * shapeFunctionDerivatives[12][j] - 0.5 * shapeFunctionDerivatives[13][j];
+                    shapeFunctionDerivatives[10][j] = -0.25 * (1 - gausscoordinates[0][j]) - 0.5 * shapeFunctionDerivatives[13][j] - 0.5 * shapeFunctionDerivatives[14][j];
+                    shapeFunctionDerivatives[11][j] = -0.25 * (1 + gausscoordinates[0][j]) - 0.5 * shapeFunctionDerivatives[14][j] - 0.5 * shapeFunctionDerivatives[15][j];
+                }
+                endeixiShapeFunctionDerivatives = 2;
+                return shapeFunctionDerivatives;
+            }
+            else
+            { return shapeFunctionDerivatives; }
+        }
+
+        private double[][,] ll1;
+        public static int endeixill1 = 1;
+        private double[][,] Getll1() //einai teliko kai oxi prok
+        {
+            if (endeixill1 == 1)
+            {
+                gausscoordinates = this.GetGaussCoordinates();
+                shapeFunctionDerivatives = this.GetShapeFunctionDerivatives();
+                nGaussPoints = gp_d1 * gp_d2 * gp_d3;
+
+                ll1 = new double[nGaussPoints][,];
+                for (int j = 0; j < nGaussPoints; j++)
+                { ll1[j] = new double[3, 24]; }
+                for (int j = 0; j < nGaussPoints; j++) //dhmiourgia olklhrou tou ll1 gia kathe gauss point
+                {
+                    for (int k = 0; k < 8; k++)
+                    {
+                        ll1[j][0, 3 * k] = shapeFunctionDerivatives[k][j];
+                        ll1[j][0, 3 * k + 1] = 0.5 * gausscoordinates[2][j] * tk[k] * shapeFunctionDerivatives[k][j];
+                        ll1[j][0, 3 * k + 2] = -ll1[j][0, 3 * k + 1];
+                        ll1[j][1, 3 * k] = shapeFunctionDerivatives[k + 8][j];
+                        ll1[j][1, 3 * k + 1] = 0.5 * gausscoordinates[2][j] * tk[k] * shapeFunctionDerivatives[k + 8][j];
+                        ll1[j][1, 3 * k + 2] = -ll1[j][1, 3 * k + 1];
+                        ll1[j][2, 3 * k] = 0;
+                        ll1[j][2, 3 * k + 1] = 0.5 * tk[k] * shapeFunctions[k][j];
+                        ll1[j][2, 3 * k + 2] = -ll1[j][2, 3 * k + 1];
+                    }
+
+                }
+                endeixill1 = 2;
+                return ll1;
+            }
+            else
+            { return ll1; }
+          }
+
+
+        private double[][,] J_0a;
+        public static int endeixiJ_0a = 1;
+        private double[][,] GetJ_0a() //einai teliko kai oxi prok
+        {
+            if (endeixiJ_0a == 1)
+            {
+                ll1 = this.Getll1();
+                for (int j = 0; j < nGaussPoints; j++)
+                { J_0a[j] = new double[3, 16]; }
+                for (int j = 0; j < nGaussPoints; j++)
+                {
+                    for (int k = 0; k < 8; k++)
+                    {
+                        J_0a[j][0, 2 * k] = ll1[j][0, 3 * k];
+                        J_0a[j][0, 2 * k + 1] = ll1[j][0, 3 * k + 1];
+                        J_0a[j][1, 2 * k] = ll1[j][1, 3 * k];
+                        J_0a[j][1, 2 * k + 1] = ll1[j][1, 3 * k + 1];
+                        J_0a[j][2, 2 * k] = ll1[j][2, 3 * k];
+                        J_0a[j][2, 2 * k + 1] = ll1[j][2, 3 * k + 1];
+                    }
+                }
+                endeixiJ_0a = 2;
+                return J_0a;
+            }
+            else
+            { return J_0a; }
+        }
+
+
+
+
+
     }
 }
+


Add WithMemorySize ext method test

Add WithMemorySize ext method test

--- Iced.UnitTests/Intel/FormatterTests/MiscTests.cs
+++ Iced.UnitTests/Intel/FormatterTests/MiscTests.cs
@@ -72,6 +72,23 @@
 			}
 			Assert.Equal("Fmt: 0 ins ", $"Fmt: {missing} ins " + sb.ToString());
 		}
+
+		[Fact]
+		void Test_WithMemorySize_extension_method() {
+			var options = FormatterOperandOptions.None;
+
+			options = FormatterOperandOptions.None.WithMemorySize(MemorySizeOptions.Always);
+			Assert.Equal(MemorySizeOptions.Always, (MemorySizeOptions)((uint)(options & FormatterOperandOptions.MemorySizeMask) >> (int)FormatterOperandOptions.MemorySizeShift));
+
+			options = FormatterOperandOptions.None.WithMemorySize(MemorySizeOptions.Minimum);
+			Assert.Equal(MemorySizeOptions.Minimum, (MemorySizeOptions)((uint)(options & FormatterOperandOptions.MemorySizeMask) >> (int)FormatterOperandOptions.MemorySizeShift));
+
+			options = FormatterOperandOptions.None.WithMemorySize(MemorySizeOptions.Never);
+			Assert.Equal(MemorySizeOptions.Never, (MemorySizeOptions)((uint)(options & FormatterOperandOptions.MemorySizeMask) >> (int)FormatterOperandOptions.MemorySizeShift));
+
+			options = FormatterOperandOptions.None.WithMemorySize(MemorySizeOptions.Default);
+			Assert.Equal(MemorySizeOptions.Default, (MemorySizeOptions)((uint)(options & FormatterOperandOptions.MemorySizeMask) >> (int)FormatterOperandOptions.MemorySizeShift));
+		}
 	}
 }
 #endif


Bug fixed: ユーザカラムの未設定が正しく表示できない問題を解消。

Bug fixed: ユーザカラムの未設定が正しく表示できない問題を解消。

--- Implem.Pleasanter/Libraries/Charts/TimeSeries.cs
+++ Implem.Pleasanter/Libraries/Charts/TimeSeries.cs
@@ -1,4 +1,5 @@
 using Implem.Libraries.Utilities;
+using Implem.Pleasanter.Libraries.DataTypes;
 using Implem.Pleasanter.Libraries.Responses;
 using Implem.Pleasanter.Libraries.Server;
 using Implem.Pleasanter.Libraries.Settings;
@@ -85,18 +86,25 @@
         public string ChartJson()
         {
             var elements = new List<Element>();
-            var choices = SiteSettings
-                .AllColumn(GroupByColumn)
+            var column = SiteSettings.AllColumn(GroupByColumn);
+            var choices = column
                 .EditChoices(SiteSettings.InheritPermission)
                 .Where(o => this.Select(p => p.Index).Contains(o.Key))
                 .ToDictionary(o => o.Key, o => o.Value);
+            if (column.UserColumn && this.Any(o =>
+                o.Index == User.UserTypes.Anonymous.ToInt().ToString()))
+            {
+                choices.Add(
+                    User.UserTypes.Anonymous.ToInt().ToString(),
+                    new ControlData(Displays.NotSet()));
+            }
             var valueColumn = SiteSettings.AllColumn(ValueColumn);
             var choiceKeys = choices.Keys.ToList();
             var indexes = choices.Select((o, i) => new Index
             {
                 Id = i,
                 Key = o.Key,
-                Text = !o.Value.Text.IsNullOrEmpty()
+                Text = o.Value.Text != string.Empty
                     ? o.Value.Text
                     : Displays.NotSet(),
                 Style = o.Value.Style


Fix compilation

Fix compilation

--- LionFire.Machine.Api/Controllers/ServicesController.cs
+++ LionFire.Machine.Api/Controllers/ServicesController.cs
@@ -9,8 +9,6 @@
     [Route("machine/[controller]")]
     public class ServicesController : Controller
     {
-        [HttpGet("[action]"]
-            public LoadAvgFile

         // GET: api/values
         [HttpGet]


removed bad chars

removed bad chars

--- Manatee.Json.Tests/Serialization/JsonSerializerTest.cs
+++ Manatee.Json.Tests/Serialization/JsonSerializerTest.cs
@@ -617,6 +617,7 @@
 		public void GreedySerializationDisabled()
 		{
 			JsonValue expected = new JsonObject();
+
 			var obj = new ObjectWithBasicProps
 				{
 					BoolProp = true,


Migrate application path from plugin to standard pattern/location

--- MatterControlLib/DataStorage/ApplicationDataStorage.cs
+++ MatterControlLib/DataStorage/ApplicationDataStorage.cs
@@ -90,9 +90,13 @@

 		private static string _printHistoryPath => Path.Combine(_applicationLibraryDataPath, "PrintHistory");

+		private static string _cloudLibraryPath => Path.Combine(_applicationLibraryDataPath, "CloudData");
+
 		public static string ApplicationUserDataPath => EnsurePath(_applicationUserDataPath);

 		public string ApplicationLibraryDataPath => EnsurePath(_applicationLibraryDataPath);
+
+		public string CloudLibraryPath => EnsurePath(_cloudLibraryPath);

 		public string LibraryAssetsPath => EnsurePath(_libraryAssetPath);


Fixed bug 1131

Fixed bug 1131

Former-commit-id: 6cd90294ac7869af0e0bf43766c1e2e9702359af

--- MeTLMeeting/MeTLLib/Providers/Connection/JabberWire.cs
+++ MeTLMeeting/MeTLLib/Providers/Connection/JabberWire.cs
@@ -350,13 +350,19 @@
                     });
             foreach (var room in rooms)
             {
-                var alias = credentials.name + conn.Resource;
-                new MucManager(conn).LeaveRoom(room, alias);
+                leaveRoom(room);
+                //var alias = credentials.name + conn.Resource;
+                //new MucManager(conn).LeaveRoom(room, alias);
             }
         }
         private bool isLocationValid()
         {
             return (location != null && !String.IsNullOrEmpty(location.activeConversation) && location.availableSlides.Count > 0 && location.currentSlide > 0);
+        }
+        private void leaveRoom(Jid room)
+        {
+            var alias = credentials.name + conn.Resource;
+            new MucManager(conn).LeaveRoom(room, alias);
         }
         private void joinRooms()
         {
@@ -531,7 +537,18 @@
         }
         public void sendFileResource(TargettedFile file)
         {
-            stanza(Globals.location.activeConversation, new MeTLStanzas.FileResource(file));
+            var fileResource = new MeTLStanzas.FileResource(file);
+            if (Globals.location.availableSlides.Contains(file.slide))
+                stanza(Globals.location.activeConversation, fileResource);
+            else
+            {
+                var fileConversation = file.conversationJid.ToString();
+                var fileConversationJid = new Jid(fileConversation + "@" + metlServerAddress.muc);
+                joinRoom(fileConversationJid);
+                stanza(fileConversation.ToString(), fileResource);
+                if (fileConversation != Globals.location.activeConversation)
+                    leaveRoom(fileConversationJid);
+            }
         }
         public void SendVideo(TargettedVideo video)
         {


Prims now have target omega and possibly much more.

But still will never collide with anything: collisions are way outside the scope of this module!

--- OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPrim.cs
+++ OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPrim.cs
@@ -142,7 +142,11 @@

         public override void ForceAboveParcel(float height)
         {
-            throw new NotImplementedException();
+            OpenMetaverse.Vector3 newPos = _position;
+            //place this object back above the parcel
+            _position.Z = height;
+
+            _position = newPos;
         }

         public override void LinkToNewParent(PhysicsActor obj, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
@@ -169,11 +173,18 @@

         public override void LockAngularMotion(OpenMetaverse.Vector3 axis)
         {
-            throw new NotImplementedException();
-        }
+            lock (_properties)
+            {
+                _properties.LockedAxes = axis;
+            }
+        }
+
         public override OpenMetaverse.Vector3 GetLockedAngularMotion()
         {
-            throw new NotImplementedException();
+            lock (_properties)
+            {
+                return _properties.LockedAxes;
+            }
         }

         public override void SetVolumeDetect(bool vd)
@@ -186,11 +197,12 @@

         public override void AddForce(OpenMetaverse.Vector3 force, ForceType ftype)
         {
-            throw new NotImplementedException();
-        }
+            AddForceSync(force, OpenMetaverse.Vector3.Zero, ftype);
+        }
+
         public override void AddAngularForce(OpenMetaverse.Vector3 force, ForceType ftype)
         {
-            throw new NotImplementedException();
+            AddForceSync(force, OpenMetaverse.Vector3.Zero, ftype);
         }

         public override void SubscribeCollisionEvents(int ms)
@@ -210,15 +222,56 @@

         public override void SyncWithPhysics(float timeStep, uint ticksSinceLastSimulate, uint frameNum)
         {
-            throw new NotImplementedException();
-        }
+            //throw new NotImplementedException();
+            // TODO: if you want to actually simulate prim motion!  Will get very complex very fast.
+        }
+
         public override void AddForceSync(OpenMetaverse.Vector3 Force, OpenMetaverse.Vector3 forceOffset, ForceType type)
         {
-            throw new NotImplementedException();
-        }
+            //these property setter force types need to be set and assigned regardless
+            //of if the object is currently a free dynamic
+            switch (type)
+            {
+                case ForceType.AngularVelocityTarget:
+                    lock (_properties)
+                    {
+                        _properties.AngularVelocityTarget = Force;
+                    }
+                    RequestPhysicsNeedsPersistence();
+                    break;
+
+                case ForceType.ConstantGlobalLinearForce:
+                    lock (_properties)
+                    {
+                        _properties.ForceIsLocal = false;
+                        _properties.Force = Force;
+                    }
+                    RequestPhysicsNeedsPersistence();
+                    break;
+
+                case ForceType.ConstantLocalLinearForce:
+                    lock (_properties)
+                    {
+                        _properties.ForceIsLocal = true;
+                        _properties.Force = Force;
+                    }
+                    RequestPhysicsNeedsPersistence();
+                    break;
+            }
+
+            //in all cases, wake up
+            //this.WakeUp();
+        }
+
         public override void UpdateOffsetPosition(OpenMetaverse.Vector3 newOffset, OpenMetaverse.Quaternion rotOffset)
         {
-            throw new NotImplementedException();
+            //Offset updates are only handled for child prims. Upstream a non child move is
+            //handled by setting our position directly
+            if (IsChild)
+            {
+                _position = newOffset;
+                _rotation = rotOffset;
+            }
         }

         public override void GatherTerseUpdate(out OpenMetaverse.Vector3 position, out OpenMetaverse.Quaternion rotation, out OpenMetaverse.Vector3 velocity, out OpenMetaverse.Vector3 acceleration, out OpenMetaverse.Vector3 angularVelocity)
@@ -244,11 +297,12 @@

         public override void Suspend()
         {
-            throw new NotImplementedException();
-        }
+            // Ignored.
+        }
+
         public override void Resume(bool interpolate, AfterResumeCallback callback)
         {
-            throw new NotImplementedException();
+            // Ignored.
         }

         public override bool Stopped
@@ -313,13 +367,7 @@
                 }
                 else
                 {
-                    int resultCount = --_selectCount;
-                    if (resultCount == -1)
-                    {
-                        //this can happen when you delink a child part from a group,
-                        //we need to reset to zero
-                        resultCount =  ++_selectCount;
-                    }
+                    --_selectCount;
                 }
             }
         }
@@ -362,7 +410,23 @@
         {
             get
             {
-                return OpenMetaverse.Vector3.Zero;
+                OpenMetaverse.Vector3 force = OpenMetaverse.Vector3.Zero;
+                bool isLocal = false;
+
+                lock (_properties)
+                {
+                    force = _properties.Force;
+                    isLocal = _properties.ForceIsLocal;
+                }
+
+                if (!isLocal)
+                {
+                    return force;
+                }
+                else
+                {
+                    return force * _rotation;
+                }
             }
         }

@@ -370,7 +434,14 @@
         {
             get
             {
-                return OpenMetaverse.Vector3.Zero;
+                OpenMetaverse.Vector3 force = OpenMetaverse.Vector3.Zero;
+
+                lock (_properties)
+                {
+                    force = _properties.Force;
+                }
+
+                return force;
             }
         }

@@ -378,216 +449,227 @@
         {
             get
             {
+                bool isLocal = false;
+
+                lock (_properties)
+                {
+                    isLocal = _properties.ForceIsLocal;
+                }
+
+                return isLocal;
+            }
+        }
+
+        public override OpenSim.Framework.Geom.Box OBBobject
+        {
+            get
+            {
+                lock (_terseConsistencyLock)
+                {
+                    return _OBBobject;
+                }
+            }
+            set
+            {
+                lock (_terseConsistencyLock)
+                {
+                    _OBBobject = value;
+                }
+            }
+        }
+
+        public override OpenMetaverse.Vector3 GeometricCenter
+        {
+            get { return new OpenMetaverse.Vector3(); }
+        }
+
+        public override OpenMetaverse.Vector3 CenterOfMass
+        {
+            get
+            {
+                // TODO: maybe.
+                throw new NotImplementedException();
+            }
+        }
+
+        public override OpenMetaverse.Vector3 Velocity
+        {
+            get
+            {
+                lock (_terseConsistencyLock)
+                {
+                    return _velocity;
+                }
+            }
+            set
+            {
+            }
+        }
+
+        public override OpenMetaverse.Vector3 Torque
+        {
+            get
+            {
+                lock (_properties)
+                {
+                    return _properties.Torque;
+                }
+            }
+            set
+            {
+            }
+        }
+
+        public override float CollisionScore
+        {
+            get
+            {
+                return 0.0f;
+            }
+            set
+            {
+            }
+        }
+        public override OpenMetaverse.Vector3 Acceleration
+        {
+            get { return _acceleration; }
+        }
+
+        public override OpenMetaverse.Quaternion Rotation
+        {
+            get
+            {
+                lock (_terseConsistencyLock)
+                {
+                    return _rotation;
+                }
+            }
+            set
+            {
+                lock (_terseConsistencyLock)
+                {
+                    _rotation = value;
+                }
+            }
+        }
+
+        public override ActorType PhysicsActorType
+        {
+            get
+            {
+                return ActorType.Prim;
+            }
+        }
+
+        public override bool IsPhysical
+        {
+            get
+            {
+                return this._isPhysical;
+            }
+        }
+
+        public override bool Flying
+        {
+            get
+            {
                 return false;
             }
-        }
-
-        public override OpenSim.Framework.Geom.Box OBBobject
-        {
-            get
-            {
-                lock (_terseConsistencyLock)
-                {
-                    return _OBBobject;
-                }
-            }
-            set
-            {
-                lock (_terseConsistencyLock)
-                {
-                    _OBBobject = value;
-                }
-            }
-        }
-
-        public override OpenMetaverse.Vector3 GeometricCenter
-        {
-            get { return new OpenMetaverse.Vector3(); }
-        }
-
-        public override OpenMetaverse.Vector3 CenterOfMass
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public override OpenMetaverse.Vector3 Velocity
-        {
-            get
-            {
-                lock (_terseConsistencyLock)
-                {
-                    return _velocity;
-                }
-            }
-            set
-            {
-            }
-        }
-
-        public override OpenMetaverse.Vector3 Torque
+            set
+            {
+            }
+        }
+
+        public override bool SetAlwaysRun
+        {
+            get
+            {
+                return false;
+            }
+            set
+            {
+            }
+        }
+
+        public override bool ThrottleUpdates
+        {
+            get
+            {
+                return false;
+            }
+            set
+            {
+            }
+        }
+
+        public override bool IsColliding
+        {
+            get
+            {
+                return false;
+            }
+            set
+            {
+            }
+        }
+
+        public override bool CollidingGround
+        {
+            get
+            {
+                return false;
+            }
+            set
+            {
+            }
+        }
+
+        public override bool CollidingObj
+        {
+            get
+            {
+                return false;
+            }
+            set
+            {
+            }
+        }
+
+        public override bool FloatOnWater
+        {
+            set {  }
+        }
+
+        public override OpenMetaverse.Vector3 AngularVelocity
+        {
+            get
+            {
+                return _angularVelocity;
+            }
+            set
+            {
+                _angularVelocity = value;
+                AddForceSync(value, OpenMetaverse.Vector3.Zero, ForceType.AngularVelocityTarget);
+            }
+        }
+
+        public override OpenMetaverse.Vector3 AngularVelocityTarget
         {
             get
             {
                 lock (_properties)
                 {
-                    return _properties.Torque;
-                }
-            }
-            set
-            {
-            }
-        }
-
-        public override float CollisionScore
-        {
-            get
-            {
-                return 0.0f;
-            }
-            set
-            {
-            }
-        }
-        public override OpenMetaverse.Vector3 Acceleration
-        {
-            get { return _acceleration; }
-        }
-
-        public override OpenMetaverse.Quaternion Rotation
-        {
-            get
-            {
-                lock (_terseConsistencyLock)
-                {
-                    return _rotation;
-                }
-            }
-            set
-            {
-                lock (_terseConsistencyLock)
-                {
-                    _rotation = value;
-                }
-            }
-        }
-
-        public override ActorType PhysicsActorType
-        {
-            get
-            {
-                return ActorType.Prim;
-            }
-        }
-
-        public override bool IsPhysical
-        {
-            get
-            {
-                return this._isPhysical;
-            }
-        }
-
-        public override bool Flying
-        {
-            get
-            {
-                return false;
-            }
-            set
-            {
-            }
-        }
-
-        public override bool SetAlwaysRun
-        {
-            get
-            {
-                return false;
-            }
-            set
-            {
-            }
-        }
-
-        public override bool ThrottleUpdates
-        {
-            get
-            {
-                return false;
-            }
-            set
-            {
-            }
-        }
-
-        public override bool IsColliding
-        {
-            get
-            {
-                return false;
-            }
-            set
-            {
-            }
-        }
-
-        public override bool CollidingGround
-        {
-            get
-            {
-                return false;
-            }
-            set
-            {
-            }
-        }
-
-        public override bool CollidingObj
-        {
-            get
-            {
-                return false;
-            }
-            set
-            {
-            }
-        }
-
-        public override bool FloatOnWater
-        {
-            set {  }
-        }
-
-        public override OpenMetaverse.Vector3 AngularVelocity
-        {
-            get
-            {
-                return _angularVelocity;
-            }
-            set
-            {
-                _angularVelocity = value;
-            }
-        }
-
-        public override OpenMetaverse.Vector3 AngularVelocityTarget
-        {
-            get
+                    return _properties.AngularVelocityTarget;
+                }
+            }
+            set
             {
                 lock (_properties)
                 {
-                    return _properties.AngularVelocityTarget;
-                }
-            }
-            set
-            {
-                lock (_properties)
-                {
                     _properties.AngularVelocityTarget = value;
                 }
+
+                AddForceSync(value, OpenMetaverse.Vector3.Zero, ForceType.AngularVelocityTarget);
             }
         }


this is so bad, brain is beyond fried. must stop.

--- OpenSim/Services/HypergridService/GatekeeperService.cs
+++ OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -284,7 +284,7 @@
             }

             if (userURL == m_ExternalName)
-                m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
+                return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
             else
             {
                 Object[] args = new Object[] { userURL };


Preparing

Preparing

--- Runtime/Core/LayerImpl.cs
+++ Runtime/Core/LayerImpl.cs
@@ -36,7 +36,10 @@
     {
       self = new Layer(gameObject, OnLayerDestroy);

-
+      //temporary
+      if (gameObject.scene.name == SceneMain.NextActiveSceneName)
+        Layer.ActiveLayer = self;
+

       Bootstrap(); // Setup actors logic for a scene.
       Setup();     // Entry point for developers.


Print a message if a cache ignore is set - give the user some sort of warning!

--- LINQToTTree/LINQToTTreeLib/TTreeQueryExecutor.cs
+++ LINQToTTree/LINQToTTreeLib/TTreeQueryExecutor.cs
@@ -330,6 +330,10 @@
                     return new FutureValue<TResult>(cacheHit.Item2);
                 }
             }
+            else
+            {
+                Console.WriteLine("WARNING: IgnoreQueryCache is set to true - we are not looking for cache hits on this LINQtoTTree query!");
+            }

             ///
             /// Ok, no cache hit. So queue up the run.


Normalize tabs

Normalize tabs

--- LeanKit.API.Client.Library/LeanKitIntegration.cs
+++ LeanKit.API.Client.Library/LeanKitIntegration.cs
@@ -161,8 +161,8 @@
 										if (movedCardEvent != null) boardChangedEventArgs.MovedCards.Add(movedCardEvent);
 										break;
 									case EventType.CardFieldsChanged:
-                                        var changedFieldsEvent = CreateCardUpdateEvent(boardEvent, checkResults.AffectedLanes);
-                                        if (changedFieldsEvent != null) boardChangedEventArgs.UpdatedCards.Add(changedFieldsEvent);
+										var changedFieldsEvent = CreateCardUpdateEvent(boardEvent, checkResults.AffectedLanes);
+										if (changedFieldsEvent != null) boardChangedEventArgs.UpdatedCards.Add(changedFieldsEvent);
 										break;
 									case EventType.CardDeleted:
 										boardChangedEventArgs.DeletedCards.Add(CreateCardDeletedEvent(boardEvent));
@@ -194,8 +194,8 @@
 										boardChangedEventArgs.UserWipOverrides.Add(CreateUserWipOverrideEvent(boardEvent));
 										break;
 									case EventType.AttachmentChange:
-                                        var attachmentEvent = CreateAttachmentEvent(boardEvent);
-                                        if (attachmentEvent != null) boardChangedEventArgs.AttachmentChangedEvents.Add(attachmentEvent);
+										var attachmentEvent = CreateAttachmentEvent(boardEvent);
+										if (attachmentEvent != null) boardChangedEventArgs.AttachmentChangedEvents.Add(attachmentEvent);
 										break;

 									case EventType.CardMoveToBoard:
@@ -316,9 +316,9 @@
 		private CardUserAssignmentEvent CreateCardUserAssignmentEvent(BoardHistoryEvent boardEvent,
 			IEnumerable<Lane> affectedLanes)
 		{
-            // Is the card on a taskboard?
-            if (!_includeTaskboards && !_board.AllLanes().ContainsLane(boardEvent.ToLaneId))
-                return null;
+			// Is the card on a taskboard?
+			if (!_includeTaskboards && !_board.AllLanes().ContainsLane(boardEvent.ToLaneId))
+				return null;

 			try
 			{
@@ -338,9 +338,9 @@
 		private CardUserUnAssignmentEvent CreateCardUserUnAssignmentEvent(BoardHistoryEvent boardEvent,
 			IEnumerable<Lane> affectedLanes)
 		{
-            // Is the card on a taskboard?
-            if (!_includeTaskboards && !_board.AllLanes().ContainsLane(boardEvent.ToLaneId))
-                return null;
+			// Is the card on a taskboard?
+			if (!_includeTaskboards && !_board.AllLanes().ContainsLane(boardEvent.ToLaneId))
+				return null;

 			try
 			{
@@ -397,9 +397,9 @@

 		private AttachmentChangedEvent CreateAttachmentEvent(BoardHistoryEvent boardEvent)
 		{
-            // Is the card on a taskboard?
-            if (!_board.AllLanes().ContainsLane(boardEvent.ToLaneId) && !_includeTaskboards)
-                return null;
+			// Is the card on a taskboard?
+			if (!_board.AllLanes().ContainsLane(boardEvent.ToLaneId) && !_includeTaskboards)
+				return null;

 			var card = _board.AllLanes().FindContainedCard(boardEvent.ToLaneId, boardEvent.CardId);
 			return new AttachmentChangedEvent(boardEvent.EventDateTime, card, boardEvent.FileName, boardEvent.CommentText,
@@ -500,14 +500,14 @@
 		{
 			try
 			{
-                // Is the card being updated on a taskboard?
-                if (!_board.AllLanes().ContainsLane(boardEvent.ToLaneId) && !_includeTaskboards)
-                    return null;
+				// Is the card being updated on a taskboard?
+				if (!_board.AllLanes().ContainsLane(boardEvent.ToLaneId) && !_includeTaskboards)
+					return null;

 				var originalCard = _board.GetCardById(boardEvent.CardId);

-                if (originalCard == null)
-                    return null;
+				if (originalCard == null)
+					return null;

 				var updatedCard =
 					affectedLanes.FindContainedCard(boardEvent.ToLaneId, boardEvent.CardId);


Only show 1 drop down for Game Names at a time

The drop down with all the games and the drop down with the autocomplete
suggestions should not be shown simultaneously.

--- LiveSplit/LiveSplit.View/View/RunEditorDialog.cs
+++ LiveSplit/LiveSplit.View/View/RunEditorDialog.cs
@@ -1456,8 +1456,7 @@
         {
             foreach (Control childControl in control.Controls)
             {
-                if (childControl != cbxGameName)
-                    SetClickEvents(childControl);
+                SetClickEvents(childControl);
             }
             control.Click += ClickControl;
         }
@@ -1500,6 +1499,7 @@
                             _box.Items.Add(_startString);
                         foreach (string str in legalStrings)
                             _box.Items.Add(str);
+                        DroppedDown = false;
                         _dropDown.Show(this, new Point(0, Height));
                     }
                 }


Made "Clear Times" also reset the Attempt Count

--- LiveSplit/LiveSplit.View/View/RunEditorDialog.cs
+++ LiveSplit/LiveSplit.View/View/RunEditorDialog.cs
@@ -1270,6 +1270,8 @@

         private void clearTimesToolStripMenuItem_Click(object sender, EventArgs e)
         {
+            tbxAttempts.Text = "0";
+            Run.AttemptCount = 0;
             ClearHistory(true);
         }


Escape literals

Escape literals

--- Settings/StringParser.cs
+++ Settings/StringParser.cs
@@ -1,12 +1,19 @@
-using System.Text;
+using System.Collections.Generic;
+using System.Text;

 namespace Cloudsdale.Settings {
     public class StringParser {
+        public static readonly Dictionary<char, string> Escapes = new Dictionary<char, string> {
+            {'\r', @"\r"},
+            {'\n', @"\n"},
+            {'\t', @"\t"},
+            {'\\', @"\"}
+        };
+
         public static string ParseLiteral(string input) {
             var result = new StringBuilder(input.Length);
-            char c;
             for (var i = 0; i < input.Length; ++i) {
-                c = input[i];
+                var c = input[i];
                 if (c != '\\') {
                     result.Append(c);
                     continue;
@@ -29,6 +36,21 @@
                     case '\\':
                         result.Append('\\');
                         break;
+                    default:
+                        result.Append('\\').Append(c);
+                        break;
+                }
+            }
+            return result.ToString();
+        }
+
+        public static string EscapeLiteral(string input) {
+            var result = new StringBuilder(input.Length + 10);
+            foreach (var c in input) {
+                if (Escapes.ContainsKey(c)) {
+                    result.Append(Escapes[c]);
+                } else {
+                    result.Append(c);
                 }
             }
             return result.ToString();


Correctly calculates flags for add, sub and bitwise instructions

--- Sharp8086/CPU/Cpu8086.cs
+++ Sharp8086/CPU/Cpu8086.cs
@@ -243,7 +243,7 @@
             SetRegister(Register.CS, 0xF000);
             SetRegister(Register.IP, 0xFFF0);
         }
-
+
         public bool ProcessInstructions(int amount)
         {
             for (var i = 0; i < amount; i++)
@@ -483,75 +483,180 @@
             SetRegister(Register.IP, ReadU16((uint)interrupt * 4));
             SetRegister(Register.CS, ReadU16((uint)interrupt * 4 + 2));
         }
-        private ushort CalculateIncrementFlags(bool is8Bit, ushort value1, ushort value2, int result)
-        {
-            ushort truncResult;
-            bool sign;
-            bool overflow;
-            if (is8Bit)
-            {
-                truncResult = (byte)result;
-                sign = ((truncResult >> 7) & 1) == 1;
-                overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x80) == 0x80;
-            }
-            else
-            {
-                truncResult = (ushort)result;
-                sign = ((truncResult >> 15) & 1) == 1;
-                overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x8000) == 0x8000;
-            }
+
+        private void CalculateIncFlags8Bit(byte value1, byte value2, int result)
+        {
+            var truncResult = (byte)result;
+            var sign = ((truncResult >> 7) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x80) == 0x80;
             var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
             var zero = truncResult == 0;
             var parity = parityLookup[(byte)(result & 0xFF)];
-
-            var flagsRegister = GetFlags();
-            flagsRegister &= ~(FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
-            flagsRegister |= (parity ? FlagsRegister.Parity : 0) |
-                             (auxiliary ? FlagsRegister.Auxiliary : 0) |
-                             (zero ? FlagsRegister.Zero : 0) |
-                             (sign ? FlagsRegister.Sign : 0) |
-                             (overflow ? FlagsRegister.Overflow : 0);
-            SetFlags(flagsRegister);
-
-            return truncResult;
-        }
-        private ushort CalculateFlags(bool is8Bit, ushort value1, ushort value2, int result)
-        {
-            ushort truncResult;
-            bool carry;
-            bool sign;
-            bool overflow;
-            if (is8Bit)
-            {
-                truncResult = (byte)result;
-                carry = (uint)result > 0xFF;
-                sign = ((truncResult >> 7) & 1) == 1;
-                overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x80) == 0x80;
-            }
-            else
-            {
-                truncResult = (ushort)result;
-                carry = (uint)result > 0xFFFF;
-                sign = ((truncResult >> 15) & 1) == 1;
-                overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x8000) == 0x8000;
-            }
+
+            flags &= ~(FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+        }
+        private void CalculateIncFlags16Bit(ushort value1, ushort value2, int result)
+        {
+            var truncResult = (ushort)result;
+            var sign = ((truncResult >> 15) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x8000) == 0x8000;
+            var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+        }
+        private void CalculateDecFlags8Bit(byte value1, byte value2, int result)
+        {
+            var truncResult = (byte)result;
+            var sign = ((truncResult >> 7) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (value1 ^ value2) & 0x80) == 0x80;
             var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
             var zero = truncResult == 0;
             var parity = parityLookup[(byte)(result & 0xFF)];
-
-            var flagsRegister = GetFlags();
-            flagsRegister &= ~(FlagsRegister.Carry | FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
-            flagsRegister |= (carry ? FlagsRegister.Carry : 0) |
-                             (parity ? FlagsRegister.Parity : 0) |
-                             (auxiliary ? FlagsRegister.Auxiliary : 0) |
-                             (zero ? FlagsRegister.Zero : 0) |
-                             (sign ? FlagsRegister.Sign : 0) |
-                             (overflow ? FlagsRegister.Overflow : 0);
-            SetFlags(flagsRegister);
+
+            flags &= ~(FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+        }
+        private void CalculateDecFlags16Bit(ushort value1, ushort value2, int result)
+        {
+            var truncResult = (ushort)result;
+            var sign = ((truncResult >> 15) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (value1 ^ value2) & 0x8000) == 0x8000;
+            var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+        }
+        private byte CalculateBitwiseFlags8Bit(byte value1, byte value2, int result)
+        {
+            var truncResult = (byte)result;
+            var sign = ((truncResult >> 7) & 1) == 1;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Carry | FlagsRegister.Parity | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (parity ? FlagsRegister.Parity : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0);

             return truncResult;
-        }
-
+        }
+        private ushort CalculateBitwiseFlags16Bit(ushort value1, ushort value2, int result)
+        {
+            var truncResult = (ushort)result;
+            var sign = ((truncResult >> 15) & 1) == 1;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Carry | FlagsRegister.Parity | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (parity ? FlagsRegister.Parity : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0);
+
+            return truncResult;
+        }
+        private byte CalculateAddFlags8Bit(byte value1, byte value2, int result)
+        {
+            var truncResult = (byte)result;
+            var carry = (uint)result > 0xFF;
+            var sign = ((truncResult >> 7) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x80) == 0x80;
+            var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Carry | FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (carry ? FlagsRegister.Carry : 0) |
+                     (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+
+            return truncResult;
+        }
+        private ushort CalculateAddFlags16Bit(ushort value1, ushort value2, int result)
+        {
+            var truncResult = (ushort)result;
+            var carry = (uint)result > 0xFFFF;
+            var sign = ((truncResult >> 15) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (truncResult ^ value2) & 0x8000) == 0x8000;
+            var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Carry | FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (carry ? FlagsRegister.Carry : 0) |
+                     (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+
+            return truncResult;
+        }
+        private byte CalculateSubFlags8Bit(byte value1, byte value2, int result)
+        {
+            var truncResult = (byte)result;
+            var carry = (uint)result > 0xFF;
+            var sign = ((truncResult >> 7) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (value1 ^ value2) & 0x80) == 0x80;
+            var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Carry | FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (carry ? FlagsRegister.Carry : 0) |
+                     (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+
+            return truncResult;
+        }
+        private ushort CalculateSubFlags16Bit(ushort value1, ushort value2, int result)
+        {
+            var truncResult = (ushort)result;
+            var carry = (uint)result > 0xFFFF;
+            var sign = ((truncResult >> 15) & 1) == 1;
+            var overflow = ((truncResult ^ value1) & (value1 ^ value2) & 0x8000) == 0x8000;
+            var auxiliary = ((value1 ^ value2 ^ truncResult) & 0x10) != 0;
+            var zero = truncResult == 0;
+            var parity = parityLookup[(byte)(result & 0xFF)];
+
+            flags &= ~(FlagsRegister.Carry | FlagsRegister.Parity | FlagsRegister.Auxiliary | FlagsRegister.Zero | FlagsRegister.Sign | FlagsRegister.Overflow);
+            flags |= (carry ? FlagsRegister.Carry : 0) |
+                     (parity ? FlagsRegister.Parity : 0) |
+                     (auxiliary ? FlagsRegister.Auxiliary : 0) |
+                     (zero ? FlagsRegister.Zero : 0) |
+                     (sign ? FlagsRegister.Sign : 0) |
+                     (overflow ? FlagsRegister.Overflow : 0);
+
+            return truncResult;
+        }
+
         private BiosData CreateBiosData()
         {
             BiosData data;
@@ -674,24 +779,39 @@
             {
                 case OpCodeManager.InstructionType.Adc:
                     result = value1 + value2 + (cpu.GetFlags().Has(FlagsRegister.Carry) ? 1 : 0);
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateAddFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateAddFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Add:
                     result = value1 + value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateAddFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateAddFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.And:
                 case OpCodeManager.InstructionType.Test:
                     result = value1 & value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Compare:
                 case OpCodeManager.InstructionType.Subtract:
                     result = value1 - value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateSubFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateSubFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Or:
                     result = value1 | value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Rol:
@@ -707,6 +827,9 @@
                         var shift = value2 & mask;
                         result = (ushort)(value1 << shift) | (ushort)(value1 >> (-shift & mask));
                     }
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Ror:
@@ -722,33 +845,51 @@
                         var shift = value2 & mask;
                         result = (ushort)(value1 >> shift) | (ushort)(value1 << (-shift & mask));
                     }
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Sbb:
                     result = value1 - (value2 + (cpu.GetFlags().Has(FlagsRegister.Carry) ? 1 : 0));
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateSubFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateSubFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Shl:
                     result = value1 << value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Sar:
                     result = (short)value1 >> value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Shr:
                     result = value1 >> value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 case OpCodeManager.InstructionType.Xor:
                     result = value1 ^ value2;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateBitwiseFlags8Bit((byte)value1, (byte)value2, result);
+                    else cpu.CalculateBitwiseFlags16Bit(value1, value2, result);
                     break;

                 default:
                     throw new NotImplementedException();
             }

-            var truncResult = cpu.CalculateFlags(instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8), value1, value2, result);
+            var truncResult = instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8) ? (byte)result : (ushort)result;

             if (instruction.Type != OpCodeManager.InstructionType.Compare && instruction.Type != OpCodeManager.InstructionType.Test)
             {
@@ -835,16 +976,22 @@
             switch (instruction.Type)
             {
                 case OpCodeManager.InstructionType.Decrement:
-                    result = value - 1;
-                    cpu.CalculateIncrementFlags(instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8), value, 1, result);
+                    result = value - 1;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateDecFlags8Bit((byte)value, 1, result);
+                    else cpu.CalculateDecFlags16Bit(value, 1, result);
                     break;
                 case OpCodeManager.InstructionType.Increment:
-                    result = value + 1;
-                    cpu.CalculateIncrementFlags(instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8), value, 1, result);
+                    result = value + 1;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateIncFlags8Bit((byte)value, 1, result);
+                    else cpu.CalculateIncFlags16Bit(value, 1, result);
                     break;
                 case OpCodeManager.InstructionType.Negate:
-                    result = ~value + 1;
-                    cpu.CalculateFlags(instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8), value, 1, result);
+                    result = ~value + 1;
+                    if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
+                        cpu.CalculateSubFlags8Bit(0, (byte)value, result);
+                    else cpu.CalculateSubFlags16Bit(0, value, result);
                     break;
                 case OpCodeManager.InstructionType.Not:
                     result = ~value;
@@ -1242,7 +1389,8 @@
             }
             var result = value1 - value2;

-            cpu.CalculateFlags(instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8), value1, value2, result);
+            if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8)) cpu.CalculateSubFlags8Bit((byte)value1, (byte)value2, result);
+            else cpu.CalculateSubFlags16Bit(value1, value2, result);

             if (!cpu.GetFlags().Has(FlagsRegister.Direction))
             {
@@ -1584,7 +1732,8 @@
                     throw new ArgumentOutOfRangeException();
             }

-            cpu.CalculateFlags(instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8), value1, value2, (int)result);
+            if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8)) cpu.CalculateAddFlags8Bit((byte)value1, (byte)value2, (int)result);
+            else cpu.CalculateAddFlags16Bit(value1, value2, (int)result);

             cpu.SetRegister(Register.AX, (ushort)result);
             if (!instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8))
@@ -1636,8 +1785,9 @@
                 cpu.SetRegister(Register.AX, (ushort)quotient);
                 cpu.SetRegister(Register.DX, (ushort)remainder);
             }
-
-            cpu.CalculateFlags(instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8), (ushort)value1, value2, (int)quotient);
+
+            if (instruction.Flag.Has(OpCodeManager.OpCodeFlag.Size8)) cpu.CalculateAddFlags8Bit((byte)value1, (byte)value2, (int)quotient);
+            else cpu.CalculateAddFlags16Bit((ushort)value1, value2, (int)quotient);
         }
         private static void DispatchPush([NotNull] Cpu8086 cpu, OpCodeManager.Instruction instruction)
         {


Small code optimizations

Small code optimizations

--- SharpTox/ToxFunctions.cs
+++ SharpTox/ToxFunctions.cs
@@ -23,7 +23,7 @@
         private static extern int tox_bootstrap_from_address(IntPtr tox, string address, byte ipv6enabled, ushort port, byte[] public_key);
         public static bool BootstrapFromAddress(IntPtr tox, string address, bool ipv6enabled, ushort port, string public_key)
         {
-            return tox_bootstrap_from_address(tox, address, ipv6enabled ? (byte)1 : (byte)0, (ushort)IPAddress.HostToNetworkOrder((short)port), ToxTools.StringToHexBin(public_key)) == 1 ? true: false;
+            return tox_bootstrap_from_address(tox, address, ipv6enabled ? (byte)1 : (byte)0, (ushort)IPAddress.HostToNetworkOrder((short)port), ToxTools.StringToHexBin(public_key)) == 1;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -95,7 +95,7 @@
         private static extern int tox_del_friend(IntPtr tox, int id);
         public static bool DeleteFriend(IntPtr tox, int id)
         {
-            return tox_del_friend(tox, id) == 0 ? true : false;
+            return tox_del_friend(tox, id) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -123,7 +123,7 @@
         private static extern int tox_friend_exists(IntPtr tox, int friendnumber);
         public static bool FriendExists(IntPtr tox, int friendnumber)
         {
-            return tox_friend_exists(tox, friendnumber) == 0 ? false : true;
+            return tox_friend_exists(tox, friendnumber) != 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -213,7 +213,7 @@
         public static bool SetUserIsTyping(IntPtr tox, int friendnumber, bool is_typing)
         {
             byte typing = is_typing ? (byte)1 : (byte)0;
-            return tox_set_user_is_typing(tox, friendnumber, typing) == 0 ? true : false;
+            return tox_set_user_is_typing(tox, friendnumber, typing) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -230,7 +230,7 @@
         private static extern byte tox_get_is_typing(IntPtr tox, int friendnumber);
         public static bool GetIsTyping(IntPtr tox, int friendnumber)
         {
-            return tox_get_is_typing(tox, friendnumber) == 1 ? true : false;
+            return tox_get_is_typing(tox, friendnumber) == 1;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -248,7 +248,7 @@
         public static bool SetStatusMessage(IntPtr tox, string message)
         {
             byte[] msg = Encoding.UTF8.GetBytes(message);
-            return tox_set_status_message(tox, msg, (ushort)msg.Length) == 0 ? true : false;
+            return tox_set_status_message(tox, msg, (ushort)msg.Length) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -371,7 +371,7 @@
         private static extern int tox_load_encrypted(IntPtr tox, byte[] data, uint length, byte[] key, ushort key_length);
         public static bool LoadEncrypted(IntPtr tox, byte[] data, byte[] key)
         {
-            return tox_load_encrypted(tox, data, (uint)data.Length, key, (ushort)key.Length) == 0 ? true : false;
+            return tox_load_encrypted(tox, data, (uint)data.Length, key, (ushort)key.Length) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -403,7 +403,7 @@
         private static extern int tox_invite_friend(IntPtr tox, int friendnumber, int groupnumber);
         public static bool InviteFriend(IntPtr tox, int friendnumber, int groupnumber)
         {
-            return tox_invite_friend(tox, friendnumber, groupnumber) == 0 ? true : false;
+            return tox_invite_friend(tox, friendnumber, groupnumber) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -418,7 +418,7 @@
         public static bool GroupMessageSend(IntPtr tox, int groupnumber, string message)
         {
             byte[] msg = Encoding.UTF8.GetBytes(message);
-            return tox_group_message_send(tox, groupnumber, msg, (uint)msg.Length) == 0 ? true: false;
+            return tox_group_message_send(tox, groupnumber, msg, (uint)msg.Length) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -426,7 +426,7 @@
         public static bool GroupActionSend(IntPtr tox, int groupnumber, string action)
         {
             byte[] act = Encoding.UTF8.GetBytes(action);
-            return tox_group_action_send(tox, groupnumber, act, (uint)act.Length) == 0 ? true : false;
+            return tox_group_action_send(tox, groupnumber, act, (uint)act.Length) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -499,7 +499,7 @@
         private static extern int tox_file_send_data(IntPtr tox, int friendnumber, byte filenumber, byte[] data, ushort length);
         public static bool FileSendData(IntPtr tox, int friendnumber, int filenumber, byte[] data)
         {
-            return tox_file_send_data(tox, friendnumber, (byte)filenumber, data, (ushort)data.Length) == 0 ? true : false;
+            return tox_file_send_data(tox, friendnumber, (byte)filenumber, data, (ushort)data.Length) == 0;
         }

         [DllImport("libtoxcore.dll", CallingConvention = CallingConvention.Cdecl)]


Version 4.4.3

Version 4.4.3

--- Shielded/AssemblyInfo.cs
+++ Shielded/AssemblyInfo.cs
@@ -17,7 +17,7 @@
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.

-[assembly: AssemblyVersion("4.4.2")]
+[assembly: AssemblyVersion("4.4.3")]

 // The following attributes are used to specify the signing key for the assembly,
 // if desired. See the Mono documentation for more information about signing.


Log when requests time out

Log when requests time out

--- Mindscape.Raygun4Net.Xamarin.iOS/RaygunClient.cs
+++ Mindscape.Raygun4Net.Xamarin.iOS/RaygunClient.cs
@@ -277,7 +277,7 @@
       try
       {
         var clientVersion = new AssemblyName(GetType().Assembly.FullName).Version.ToString();
-        RaygunLogger.Debug(string.Format("Configuring Raygun ({0})", clientVersion));
+        RaygunLogger.Info(string.Format("Configuring Raygun ({0})", clientVersion));
       }
       catch
       {
@@ -605,7 +605,7 @@
       // Get all stored crash reports.
       var reports = _fileManager.GetAllStoredCrashReports();

-      RaygunLogger.Debug(string.Format("Attempting to send {0} stored crash report(s)", reports.Count));
+      RaygunLogger.Info(string.Format("Attempting to send {0} stored crash report(s)", reports.Count));

       // Quick escape if there's no crash reports.
       if (reports.Count == 0)
@@ -627,7 +627,7 @@
           }
         }).ContinueWith(t =>
         {
-          if (t.IsFaulted)
+          if (t != null && t.IsFaulted)
           {
             RaygunLogger.Error("Fault occurred when sending stored reports - clearing stored reports");

@@ -642,13 +642,15 @@
             }
           }

-          // Consume all errors as we dont want them being sent.
-          t.Exception.Handle((e) =>
-          {
-            RaygunLogger.Error("Error occurred while sending stored reports: " + e.Message);
-            return true; // Handled
-          });
-
+          if (t != null && t.Exception != null)
+          {
+            // Consume all errors as we dont want them being sent.
+            t.Exception.Handle((e) =>
+            {
+              RaygunLogger.Error("Error occurred while sending stored reports: " + e.Message);
+              return true; // Handled
+            });
+          }
         });
       }
       catch (Exception e)
@@ -687,7 +689,17 @@
       }
       catch (Exception e)
       {
-        RaygunLogger.Error("Failed to send stored crash report due to error: " + e.Message);
+        RaygunLogger.Error(string.Format("Failed to send stored crash report due to error {0}: {1}", e.GetType().Name, e.Message));
+
+        const string TaskCanceledEx = "TaskCanceledException";
+        if (e.GetType().Name == TaskCanceledEx || e.InnerException.GetType().Name == TaskCanceledEx)
+        {
+          RaygunLogger.LogResponseStatusCode((int)HttpStatusCode.RequestTimeout);
+        }
+        else
+        {
+          RaygunLogger.LogResponseStatusCode((int)HttpStatusCode.BadRequest);
+        }
       }
     }

@@ -707,6 +719,7 @@
         .Build();

       var customGroupingKey = OnCustomGroupingKey(exception, message);
+
       if (string.IsNullOrEmpty(customGroupingKey) == false)
       {
         message.Details.GroupingKey = customGroupingKey;
@@ -813,7 +826,7 @@
       }
       catch (Exception e)
       {
-        RaygunLogger.Error(string.Format("Error Logging Exception to Raygun API due to {0}", e.Message));
+        RaygunLogger.Error(string.Format("Failed to send message due to error {0}: {1}", e.GetType().Name, e.Message));

         var path = _fileManager.SaveCrashReport(raygunMessage, MaxReportsStoredOnDevice);

@@ -837,7 +850,10 @@
         try
         {
           // Set the timeout
-          client.Timeout = TimeSpan.FromMilliseconds(timeout);
+          if (timeout > 0)
+          {
+            client.Timeout = TimeSpan.FromMilliseconds(timeout);
+          }

           // Create the request contnet.
           HttpContent content = new StringContent(message, System.Text.Encoding.UTF8, "application/json");
@@ -857,8 +873,18 @@
         }
         catch (Exception e)
         {
-          RaygunLogger.Error(string.Format("Error Logging Exception to Raygun.io {0}", e.Message));
-          statusCode = (int)HttpStatusCode.BadRequest;
+          RaygunLogger.Error(string.Format("Failed to send message due to error {0}: {1}", e.GetType().Name, e.Message));
+
+          // Was this due to the request timing out?
+          const string TaskCanceledEx = "TaskCanceledException";
+          if (e.GetType().Name == TaskCanceledEx || e.InnerException.GetType().Name == TaskCanceledEx)
+          {
+            statusCode = (int)HttpStatusCode.RequestTimeout;
+          }
+          else
+          {
+            statusCode = (int)HttpStatusCode.BadRequest;
+          }
         }
       }


Use value as ToString

Use value as ToString

--- SirenSharp/FieldTypes.cs
+++ SirenSharp/FieldTypes.cs
@@ -41,7 +41,7 @@

         public override string ToString()
         {
-            return base.ToString();
+            return this.v;
         }

         public class FieldTypesJsonConverter : JsonConverter