netserializer improvements.

netserializer improvements.

--- LiteNetLib/Utils/NetSerializer.cs
+++ LiteNetLib/Utils/NetSerializer.cs
@@ -4,9 +4,51 @@

 namespace LiteNetLib.Utils
 {
+    public abstract class NetSerializerHasher
+    {
+        public abstract ulong GetHash(string type);
+        public abstract void WriteHash(string type, NetDataWriter writer);
+        public abstract ulong ReadHash(NetDataReader reader);
+    }
+
+    public sealed class FNVHasher : NetSerializerHasher
+    {
+        private readonly Dictionary<string, ulong> _hashCache = new Dictionary<string, ulong>();
+        private readonly char[] _hashBuffer = new char[1024];
+
+        public override ulong GetHash(string type)
+        {
+            ulong hash;
+            if (_hashCache.TryGetValue(type, out hash))
+            {
+                return hash;
+            }
+            hash = 14695981039346656037UL; //offset
+            int len = type.Length;
+            type.CopyTo(0, _hashBuffer, 0, len);
+            for (var i = 0; i < len; i++)
+            {
+                hash = hash ^ _hashBuffer[i];
+                hash *= 1099511628211UL; //prime
+            }
+            _hashCache.Add(type, hash);
+            return hash;
+        }
+
+        public override ulong ReadHash(NetDataReader reader)
+        {
+            return reader.GetULong();
+        }
+
+        public override void WriteHash(string type, NetDataWriter writer)
+        {
+            writer.Put(GetHash(type));
+        }
+    }
+
     public sealed class NetSerializer
     {
-        private class RWDelegates
+        private sealed class RWDelegates
         {
             public readonly CustomTypeWrite WriteDelegate;
             public readonly CustomTypeRead ReadDelegate;
@@ -21,7 +63,7 @@
         private delegate void CustomTypeWrite(NetDataWriter writer, object customObj);
         private delegate object CustomTypeRead(NetDataReader reader);

-        private class StructInfo
+        private sealed class StructInfo
         {
             public readonly Action<NetDataWriter>[] WriteDelegate;
             public readonly Action<NetDataReader>[] ReadDelegate;
@@ -37,17 +79,20 @@
         }

         private readonly Dictionary<ulong, StructInfo> _cache;
-        private readonly Dictionary<string, ulong> _hashCache;
         private readonly Dictionary<Type, RWDelegates> _registeredCustomTypes;
-        private readonly char[] _hashBuffer = new char[1024];
         private readonly HashSet<Type> _acceptedTypes;
         private readonly NetDataWriter _writer;
+        private readonly NetSerializerHasher _hasher;
         private const int MaxStringLenght = 1024;

-        public NetSerializer()
-        {
+        public NetSerializer() : this(new FNVHasher())
+        {
+        }
+
+        public NetSerializer(NetSerializerHasher hasher)
+        {
+            _hasher = hasher;
             _cache = new Dictionary<ulong, StructInfo>();
-            _hashCache = new Dictionary<string, ulong>();
             _registeredCustomTypes = new Dictionary<Type, RWDelegates>();
             _writer = new NetDataWriter();
             _acceptedTypes = new HashSet<Type>
@@ -76,25 +121,6 @@
             };
         }

-        private ulong HashStr(string str)
-        {
-            ulong hash;
-            if (_hashCache.TryGetValue(str, out hash))
-            {
-                return hash;
-            }
-            hash = 14695981039346656037UL; //offset
-            int len = str.Length;
-            str.CopyTo(0, _hashBuffer, 0, len);
-            for (var i = 0; i < len; i++)
-            {
-                hash = hash ^ _hashBuffer[i];
-                hash *= 1099511628211UL; //prime
-            }
-            _hashCache.Add(str, hash);
-            return hash;
-        }
-
         private static Func<TClass, TProperty> ExtractGetDelegate<TClass, TProperty>(MethodInfo info)
         {
 #if WINRT || NETCORE
@@ -169,14 +195,15 @@

             for(int i = 0; i < accepted.Count; i++)
             {
+                var property = accepted[i];
+                var propertyType = property.PropertyType;
 #if WINRT || NETCORE
-                var getMethod = accepted[i].GetMethod;
-                var setMethod = accepted[i].SetMethod;
+                var getMethod = property.GetMethod;
+                var setMethod = property.SetMethod;
 #else
-                var getMethod = accepted[i].GetGetMethod();
-                var setMethod = accepted[i].GetSetMethod();
+                var getMethod = property.GetGetMethod();
+                var setMethod = property.GetSetMethod();
 #endif
-                var propertyType = accepted[i].PropertyType;
                 if (propertyType == typeof(string))
                 {
                     var setDelegate = ExtractSetDelegate<T, string>(setMethod);
@@ -328,17 +355,17 @@
                 else
                 {
                     RWDelegates registeredCustomType;
-                    PropertyInfo property = accepted[i];
-                    Type arrayType = null;
+                    bool array = false;
+
                     if (propertyType.IsArray)
                     {
-                        arrayType = propertyType;
-                        propertyType = arrayType.GetElementType();
+                        array = true;
+                        propertyType = propertyType.GetElementType();
                     }

                     if (_registeredCustomTypes.TryGetValue(propertyType, out registeredCustomType))
                     {
-                        if (arrayType != null) //Array type serialize/deserialize
+                        if (array) //Array type serialize/deserialize
                         {
                             info.ReadDelegate[i] = reader =>
                             {
@@ -407,7 +434,7 @@
         /// <param name="reusePacket">Reuse packet will overwrite last received packet class (less garbage)</param>
         public void ReadPacket(NetDataReader reader, bool reusePacket)
         {
-            ulong name = reader.GetULong();
+            ulong name = _hasher.ReadHash(reader);
             var info = _cache[name];

             if (!reusePacket || info.Reference == null)
@@ -424,6 +451,16 @@
             {
                 info.OnReceive(info.Reference);
             }
+        }
+
+        /// <summary>
+        /// Just register class for nested support
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        public void Register<T>() where T : class, new()
+        {
+            var t = typeof(T);
+            Register<T>(t, _hasher.GetHash(t.Name));
         }

         /// <summary>
@@ -443,7 +480,7 @@
         public void Subscribe<T>(Action<T> onReceive, Func<T> packetConstructor) where T : class, new()
         {
             var t = typeof(T);
-            var info = Register<T>(t, HashStr(t.Name));
+            var info = Register<T>(t, _hasher.GetHash(t.Name));
             if (packetConstructor == null)
             {
                 info.CreatorFunc = Activator.CreateInstance<T>;
@@ -463,12 +500,12 @@
         public void Serialize<T>(NetDataWriter writer, T obj) where T : class, new()
         {
             Type t = typeof(T);
-            ulong nameHash = HashStr(t.Name);
+            ulong nameHash = _hasher.GetHash(t.Name);
             var structInfo = Register<T>(t, nameHash);
             var wd = structInfo.WriteDelegate;
             var wdlen = wd.Length;
             structInfo.Reference = obj;
-            writer.Put(nameHash);
+            _hasher.WriteHash(t.Name, writer);
             for (int i = 0; i < wdlen; i++)
             {
                 wd[i](writer);


Remove unused import

Remove unused import

--- Mappy/Controllers/MapPresenter.cs
+++ Mappy/Controllers/MapPresenter.cs
@@ -4,7 +4,6 @@
     using System.Collections.Generic;
     using System.ComponentModel;
     using System.Drawing;
-    using System.Windows.Forms;
     using Data;

     using Mappy.Collections;


Reset scroll state when changing map

Reset scroll state when changing map

--- Mappy/UI/Controls/MapViewPanel.cs
+++ Mappy/UI/Controls/MapViewPanel.cs
@@ -85,6 +85,8 @@
         private void ResetView()
         {
             this.UpdateCanvasSize();
+
+            this.UpdateViewViewportLocation();

             this.UpdateBaseTile();

@@ -261,6 +263,12 @@

         private void UpdateViewViewportLocation()
         {
+            if (this.mapModel == null)
+            {
+                this.SetViewportPosition(0, 0);
+                return;
+            }
+
             var loc = this.mapModel.ViewportLocation;
             this.SetViewportPosition(loc.X, loc.Y);
         }


Removing all arguments from CreateTileLayer (use it's implementation for more advanced features)

--- Mapsui/Utilities/OpenStreetMap.cs
+++ Mapsui/Utilities/OpenStreetMap.cs
@@ -1,6 +1,4 @@
-using System;
-using BruTile.Cache;
-using BruTile.Predefined;
+using BruTile.Predefined;
 using BruTile.Web;
 using Mapsui.Layers;

@@ -11,13 +9,11 @@
         private static readonly BruTile.Attribution OpenStreetMapAttribution = new BruTile.Attribution(
             "© OpenStreetMap contributors", "http://www.openstreetmap.org/copyright");

-        public static TileLayer CreateTileLayer(
-            IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> tileFetcher = null)
+        public static TileLayer CreateTileLayer()
         {
             return new TileLayer(new HttpTileSource(new GlobalSphericalMercator(0, 18),
                         "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
                         new[] { "a", "b", "c" }, name: "OpenStreetMap",
-                        persistentCache: persistentCache, tileFetcher: tileFetcher,
                         attribution: OpenStreetMapAttribution));
         }
     }


[FIX] Treat collections as user objects by default

This prevents a bug occuring on Mono 6.0 causing collection
serialization with generated methods to fail (wrong IL).

--- Migrant/Customization/Settings.cs
+++ Migrant/Customization/Settings.cs
@@ -132,7 +132,7 @@
         /// Specifies if type stamps should be compared even when GUID has not changed.
         /// </param>
         public Settings(Method serializationMethod = Method.Generated, Method deserializationMethod = Method.Generated, VersionToleranceLevel versionTolerance = 0,
-                        bool supportForISerializable = false, bool supportForIXmlSerializable = false, bool treatCollectionAsUserObject = false,
+                        bool supportForISerializable = false, bool supportForIXmlSerializable = false, bool treatCollectionAsUserObject = true,
                         bool useBuffering = true, bool disableTypeStamping = false, ReferencePreservation referencePreservation = ReferencePreservation.Preserve, bool forceStampVerification = false)
         {
             SerializationMethod = serializationMethod;


- Updating DateTimeHelper to use .NET methods

--- Mixer.Base/Util/DateTimeHelper.cs
+++ Mixer.Base/Util/DateTimeHelper.cs
@@ -4,16 +4,8 @@
 {
     public static class DateTimeHelper
     {
-        private static readonly DateTimeOffset EpochDateTimeOffset = new DateTimeOffset(1970, 1, 1, 0, 0, 0, DateTimeOffset.Now.Offset);
+        public static DateTimeOffset UnixTimestampToDateTimeOffset(long milliseconds) { return DateTimeOffset.FromUnixTimeMilliseconds(milliseconds).ToOffset(DateTimeOffset.Now.Offset); }

-        public static DateTimeOffset UnixTimestampToDateTimeOffset(long milliseconds)
-        {
-            return EpochDateTimeOffset.AddMilliseconds(milliseconds);
-        }
-
-        public static long DateTimeOffsetToUnixTimestamp(DateTimeOffset dateTime)
-        {
-            return (long)dateTime.Subtract(EpochDateTimeOffset).TotalMilliseconds;
-        }
+        public static long DateTimeOffsetToUnixTimestamp(DateTimeOffset dateTime) { return dateTime.ToUnixTimeMilliseconds(); }
     }
 }


InfractionModule should accept IGuildUser

--- Modix/Modules/InfractionModule.cs
+++ Modix/Modules/InfractionModule.cs
@@ -25,7 +25,7 @@

         [Command("search"), Summary("Search infractions for a user")]
-        public async Task SearchInfractionsByUserId(ulong userId)
+        public async Task SearchInfractionsByUserId(IGuildUser guildUser)
         {
             var user = Context.User as SocketGuildUser;

@@ -41,7 +41,7 @@
                 var notes = await _moderationService.SearchInfractionsAsync(
                     new InfractionSearchCriteria
                     {
-                        SubjectId = userId
+                        SubjectId = user.Id
                     },
                     new[]
                     {
@@ -86,7 +86,7 @@
             }
             catch (Exception e)
             {
-                Log.Error(e, $"NoteModule SearchNotesByUserId failed with the following userId: {userId}");
+                Log.Error(e, $"NoteModule SearchNotesByUserId failed with the following userId: {user.Id}");
                 await ReplyAsync("Error occurred and search could not be complete");
             }
         }


Use default exported type to get the configuration


Utils: Add type finding fallback to ResolveReflection

--- MonoMod.Utils/ReflectionHelper.cs
+++ MonoMod.Utils/ReflectionHelper.cs
@@ -134,6 +134,10 @@

                 } else {
                     type = module.GetType(mref.FullName.Replace("/", "+"), false, false).GetTypeInfo();
+#if !NETSTANDARD1_X
+                    if (type == null)
+                        type = module.GetTypes().FirstOrDefault(m => mref.Is(m));
+#endif
                 }

                 return _Cache(mref, type);
@@ -145,9 +149,7 @@

             if (mref is GenericInstanceMethod mrefGenMethod) {
                 member = _ResolveReflection(mrefGenMethod.ElementMethod, module);
-                if (member == null)
-                    return null;
-                member = (member as MethodInfo).MakeGenericMethod(mrefGenMethod.GenericArguments.Select(arg => (_ResolveReflection(arg, null) as TypeOrTypeInfo).AsType()).ToArray());
+                member = (member as MethodInfo)?.MakeGenericMethod(mrefGenMethod.GenericArguments.Select(arg => (_ResolveReflection(arg, null) as TypeOrTypeInfo).AsType()).ToArray());

             } else if (typeless) {
                 if (mref is MethodReference)


removes GetBase method

removes GetBase method

--- SpeckleCore/Conversion/ConverterUtilities.cs
+++ SpeckleCore/Conversion/ConverterUtilities.cs
@@ -6,7 +6,7 @@
 using System.Threading.Tasks;

 namespace SpeckleCore
-{
+{
   /// <summary>
   /// Utility functions.
   /// </summary>
@@ -97,22 +97,5 @@
                   select method;
       return query;
     }
-
-
-    public static SpeckleObject GetBase(SpeckleObject obj)
-    {
-      SpeckleObject baseClass = (SpeckleObject)Activator.CreateInstance(obj.GetType().BaseType);
-
-      foreach (FieldInfo f in baseClass.GetType().GetFields())
-        f.SetValue(baseClass, f.GetValue(obj));
-
-      foreach (PropertyInfo p in baseClass.GetType().GetProperties())
-        if (p.CanWrite)
-          p.SetValue(baseClass, p.GetValue(obj));
-
-      //(baseClass as SpeckleObject).GenerateHash();
-
-      return baseClass;
-    }
-    }
+  }
 }


Code optimization

Code optimization

--- Src/Asp.Net/SqlSugar/Interface/IQueryable.cs
+++ Src/Asp.Net/SqlSugar/Interface/IQueryable.cs
@@ -200,8 +200,8 @@
         ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, Expression<Func<T, T2, bool>> expression);
         ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, Expression<Func<T, T2, T3, bool>> expression);

-        new ISugarQueryable<T, T2, T3> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -226,7 +226,7 @@
         new ISugarQueryable<T, T2, T3> Having(Expression<Func<T, bool>> expression);
         ISugarQueryable<T, T2, T3> Having(Expression<Func<T, T2, bool>> expression);
         ISugarQueryable<T, T2, T3> Having(Expression<Func<T, T2, T3, bool>> expression);
-        new ISugarQueryable<T, T2, T3> Having(string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3> Having(string whereString, object parameters = null);
         #endregion

         #region Aggr
@@ -269,8 +269,8 @@
         ISugarQueryable<T, T2, T3, T4> WhereIF(bool isWhere, Expression<Func<T, T2, T3, bool>> expression);
         ISugarQueryable<T, T2, T3, T4> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -300,7 +300,7 @@
         ISugarQueryable<T, T2, T3, T4> Having(Expression<Func<T, T2, bool>> expression);
         ISugarQueryable<T, T2, T3, T4> Having(Expression<Func<T, T2, T3, bool>> expression);
         ISugarQueryable<T, T2, T3, T4> Having(Expression<Func<T, T2, T3, T4, bool>> expression);
-        new ISugarQueryable<T, T2, T3, T4> Having(string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4> Having(string whereString, object parameters = null);
         #endregion

         #region Aggr
@@ -346,8 +346,8 @@
         ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -423,8 +423,8 @@
         ISugarQueryable<T, T2, T3, T4, T5, T6> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5, T6> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5, T6> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5, T6> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -499,8 +499,8 @@
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -580,8 +580,8 @@
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -668,8 +668,8 @@
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -759,8 +759,8 @@
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -855,8 +855,8 @@
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select
@@ -956,8 +956,8 @@
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>> expression);
         ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>> expression);

-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Where(string whereString, object whereObj = null);
-        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> WhereIF(bool isWhere, string whereString, object whereObj = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Where(string whereString, object parameters = null);
+        new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> WhereIF(bool isWhere, string whereString, object parameters = null);
         #endregion

         #region Select


Be a bit more thread safe with the property

--- Src/Core/Core.Logging/Logger.cs
+++ Src/Core/Core.Logging/Logger.cs
@@ -31,7 +31,10 @@
         {
             get
             {
-                return _destinations.AsReadOnly();
+                lock (_destinations)
+                {
+                    return _destinations.AsReadOnly();
+                }
             }
         }


get settings from VM in group window

get settings from VM in group window

--- TCC.Core/Windows/Widgets/GroupWindow.xaml.cs
+++ TCC.Core/Windows/Widgets/GroupWindow.xaml.cs
@@ -19,7 +19,7 @@
             BoundaryRef = Boundary;
             ButtonsRef = Buttons;
             MainContent = WindowContent;
-            Init(App.Settings.GroupWindowSettings);
+            Init(VM.Settings);
         }

         //TODO: to commands in VM


DoLocalizationAnalysis set back to true

DoLocalizationAnalysis set back to true

--- TaskLayer/TaskParameters/SearchParameters.cs
+++ TaskLayer/TaskParameters/SearchParameters.cs
@@ -18,7 +18,7 @@
             SearchTarget = true;
             SearchDecoy = true;
             DoHistogramAnalysis = false;
-            DoLocalizationAnalysis = false;
+            DoLocalizationAnalysis = true;
             WritePrunedDatabase = false;
             KeepAllUniprotMods = true;
             MassDiffAcceptor = GlobalEngineLevelSettings.SearchModesKnown.First();
@@ -47,4 +47,4 @@

         #endregion Public Properties
     }
-}+}


added assert helper to compare two jobviewmodels

--- Test.Integration/TestHelpers/AssertHelper.cs
+++ Test.Integration/TestHelpers/AssertHelper.cs
@@ -7,7 +7,17 @@
 {
     public static class AssertHelper
     {
-        public static bool AreJobViewModelsEqual(AddUpdateJobViewModel expected, JobViewModel actual)
+        public static bool AreJobViewModelsEqual(AddJobViewModel expected, JobViewModel actual)
+        {
+            return expected.Name == actual.Name
+                && expected.City == actual.City
+                && expected.State == actual.State
+                && expected.Title == actual.Title
+                && expected.StartDate == actual.StartDate
+                && expected.EndDate == actual.EndDate;
+        }
+
+        public static bool AreJobViewModelsEqual(JobViewModel expected, JobViewModel actual)
         {
             return expected.Name == actual.Name
                 && expected.City == actual.City


Move usings inside namespace in stringextensionstests

--- TestMoya/Extensions/StringExtensionsTests.cs
+++ TestMoya/Extensions/StringExtensionsTests.cs
@@ -1,8 +1,8 @@
-using Moya.Extensions;
-using Xunit;
+namespace TestMoya.Extensions
+{
+    using Moya.Extensions;
+    using Xunit;

-namespace TestMoya.Extensions
-{
     public class StringExtensionsTests
     {
         [Fact]


New tests for GroupBy and Lookup

New tests for GroupBy and Lookup

--- Tests/System/Linq/EnumerableGroupByTestEx.cs
+++ Tests/System/Linq/EnumerableGroupByTestEx.cs
@@ -1,4 +1,6 @@
 using NUnit.Framework;
+using System.Collections;
+using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
 using Theraot.Core;
@@ -8,6 +10,17 @@
     [TestFixture]
     public class EnumerableAsQueryableTestEx
     {
+        [Test]
+        public void GroupByIsDefered()
+        {
+            var _src = new IterateAndCount(10);
+            var a = _src.GroupBy<int, bool>(i => i > 5, null);
+            var b = _src.GroupBy<int, bool, string>(i => i > 5, j => "str: " + j.ToString(CultureInfo.InvariantCulture), null);
+            var c = _src.GroupBy<int, bool, string>(i => i > 5, (key, group) => StringHelper.Concat(group.ToArray()), null);
+            var d = _src.GroupBy<int, bool, int, string>(i => i > 5, j => j + 1, (key, group) => StringHelper.Concat(group.ToArray()), null);
+            Assert.AreEqual(_src.Total, 0);
+        }
+
         [Test]
         public void GroupByOverloadA()
         {
@@ -73,5 +86,44 @@
             Assert.AreEqual(_r[0], "23456");
             Assert.AreEqual(_r[1], "7891011");
         }
+
+        [Test]
+        public void ToLookupIsImmediate()
+        {
+            var _src = new IterateAndCount(10);
+            var a = _src.ToLookup(i => i > 5, null);
+            var b = _src.ToLookup<int, bool, string>(i => i > 5, j => "str: " + j.ToString(CultureInfo.InvariantCulture), null);
+            Assert.AreEqual(_src.Total, 20);
+        }
+
+        public class IterateAndCount : IEnumerable<int>
+        {
+            private readonly int _count;
+            private int _total = 0;
+
+            public IterateAndCount(int count)
+            {
+                _count = count;
+            }
+
+            public int Total
+            {
+                get { return _total; }
+            }
+
+            public IEnumerator<int> GetEnumerator()
+            {
+                for (int index = 0; index < _count; index++)
+                {
+                    _total = Total + 1;
+                    yield return Total;
+                }
+            }
+
+            IEnumerator IEnumerable.GetEnumerator()
+            {
+                return GetEnumerator();
+            }
+        }
     }
 }


Resolved conflicts in Startup.cs file.

Resolved conflicts in Startup.cs file.

--- Trappist/src/Promact.Trappist.Web/Startup.cs
+++ Trappist/src/Promact.Trappist.Web/Startup.cs
@@ -22,21 +22,12 @@
 using Promact.Trappist.Repository.Profile;
 using Promact.Trappist.Repository.Questions;
 using Promact.Trappist.Repository.Tests;
-using Promact.Trappist.DomainModel.Models.Test;
-using Promact.Trappist.Repository.Account;
-using Promact.Trappist.DomainModel.ApplicationClasses.SingleMultipleAnswerQuestionApplicationClass;
-using Promact.Trappist.DomainModel.Models.Test;
-using Promact.Trappist.DomainModel.ApplicationClasses.BasicSetup;
-using Microsoft.Extensions.Options;
-using Microsoft.EntityFrameworkCore;
-using Promact.Trappist.DomainModel.Seed;
 using Promact.Trappist.Utility.Constants;
 using Promact.Trappist.Utility.EmailServices;
 using Promact.Trappist.Utility.GlobalUtil;
 using Promact.Trappist.Web.Models;
 using System.Collections.Generic;
 using System.IO;
-using Promact.Trappist.Utility.GlobalUtil;

 namespace Promact.Trappist.Web
 {


* When reading from stdin, use Console.OpenStandardInput()

CCMAIL: kde-bindings@kde.org

svn path=/trunk/KDE/kdebindings/csharp/; revision=838488

--- ktexteditor/examples/kwrite/kwritemain.cs
+++ ktexteditor/examples/kwrite/kwritemain.cs
@@ -666,8 +666,7 @@
                 KWrite t = new KWrite((KTextEditor.Document) null);

                 if (args.IsSet("stdin")) {
-                    // FIXME: the first argument should be stdin here
-                    QTextStream input = new QTextStream(new StringBuilder(), (uint) QIODevice.OpenModeFlag.ReadOnly);
+                    QTextStream input = new QTextStream(Console.OpenStandardInput());

                     // set chosen codec
                     if (codec != null)


Change error handling for quota capture

Change error handling for quota capture

--- SurveyMonkey/SurveyMonkeyApi.cs
+++ SurveyMonkey/SurveyMonkeyApi.cs
@@ -128,9 +128,10 @@
                 QuotaAllotted = Int32.Parse(headers["X-Plan-Quota-Allotted"]);
                 QuotaUsed = Int32.Parse(headers["X-Plan-Quota-Current"]);
             }
-            catch (Exception e)
+            catch (Exception)
             {
-                throw new WebException("Invalid quota header information returned by the API", e);
+                //Just swallow anything. The information's not critical and I'm not sure the header's guaranteed to exist.
+                //If there's an actual problem it'll be more helpful to throw in ParseApiResponse()
             }
         }


Simplify convert to lambda.

Simplify convert to lambda.

--- WpfAnalyzers/CodeFixes/ConvertToLambdaFix.cs
+++ WpfAnalyzers/CodeFixes/ConvertToLambdaFix.cs
@@ -2,6 +2,7 @@
 {
     using System.Collections.Immutable;
     using System.Composition;
+    using System.Diagnostics.CodeAnalysis;
     using System.Threading;
     using System.Threading.Tasks;
     using Gu.Roslyn.AnalyzerExtensions;
@@ -54,82 +55,89 @@
         private static void ConvertToLambda(DocumentEditor editor, IdentifierNameSyntax identifier, CancellationToken cancellationToken)
         {
             if (editor.SemanticModel.TryGetSymbol(identifier, cancellationToken, out IMethodSymbol? method) &&
-                SymbolAndDeclaration.TryCreate(method, cancellationToken, out SymbolAndDeclaration<IMethodSymbol, MethodDeclarationSyntax> symbolAndDeclaration))
+                SymbolAndDeclaration.TryCreate(method, cancellationToken, out SymbolAndDeclaration<IMethodSymbol, MethodDeclarationSyntax> symbolAndDeclaration) &&
+                TryGetExpression(symbolAndDeclaration.Declaration, out var expression))
             {
-                ConvertToLambda(editor, identifier, symbolAndDeclaration, cancellationToken);
+                switch (method.Parameters.Length)
+                {
+                    case 1
+                        when method.Parameters[0] is { } parameter:
+                        editor.ReplaceNode(
+                            identifier,
+                            x => SyntaxFactory.ParseExpression($"{parameter.Name} => {expression}")
+                                         .WithLeadingTriviaFrom(x));
+                        RemoveIfNotUsed(editor, symbolAndDeclaration, cancellationToken);
+                        break;
+                    case 2
+                        when method.Parameters[0] is { } parameter1 &&
+                             method.Parameters[1] is { } parameter2:
+                        editor.ReplaceNode(
+                            identifier,
+                            x => SyntaxFactory.ParseExpression($"({parameter1.Name}, {parameter2.Name}) => {expression}")
+                                              .WithLeadingTriviaFrom(x));
+                        RemoveIfNotUsed(editor, symbolAndDeclaration, cancellationToken);
+                        break;
+                }
             }
         }

         private static void ConvertToLambda(DocumentEditor editor, LambdaExpressionSyntax lambda, CancellationToken cancellationToken)
         {
-            if (editor.SemanticModel.TryGetSymbol(lambda.Body, cancellationToken, out IMethodSymbol? method) &&
-                SymbolAndDeclaration.TryCreate(method, cancellationToken, out SymbolAndDeclaration<IMethodSymbol, MethodDeclarationSyntax> symbolAndDeclaration))
+            if (lambda is { Body: ExpressionSyntax body } &&
+                editor.SemanticModel.TryGetSymbol(body, cancellationToken, out IMethodSymbol? method) &&
+                SymbolAndDeclaration.TryCreate(method, cancellationToken, out SymbolAndDeclaration<IMethodSymbol, MethodDeclarationSyntax> symbolAndDeclaration) &&
+                TryGetExpression(symbolAndDeclaration.Declaration, out var expression))
             {
-                ConvertToLambda(editor, lambda, symbolAndDeclaration, cancellationToken);
-            }
-        }
-
-        private static void ConvertToLambda(DocumentEditor editor, SyntaxNode toReplace, SymbolAndDeclaration<IMethodSymbol, MethodDeclarationSyntax> symbolAndDeclaration, CancellationToken cancellationToken)
-        {
-            if (symbolAndDeclaration.Symbol.Parameters.TrySingle(out var parameter))
-            {
-                if (symbolAndDeclaration.Declaration.ExpressionBody is { } expressionBody)
+                switch (method.Parameters.Length)
                 {
-                    editor.ReplaceNode(
-                        toReplace,
-                        SyntaxFactory.ParseExpression($"{parameter.Name} => {expressionBody.Expression}")
-                                     .WithLeadingTriviaFrom(toReplace));
-                    RemoveMethod(editor, symbolAndDeclaration, cancellationToken);
-                }
-                else if (symbolAndDeclaration.Declaration.Body is { Statements: { } statements } &&
-                         statements.TrySingle(out var statement) &&
-                         statement is ReturnStatementSyntax returnStatement)
-                {
-                    editor.ReplaceNode(
-                        toReplace,
-                        SyntaxFactory.ParseExpression($"{parameter.Name} => {returnStatement.Expression}")
-                                     .WithLeadingTriviaFrom(toReplace));
-                    RemoveMethod(editor, symbolAndDeclaration, cancellationToken);
-                }
-            }
-
-            if (symbolAndDeclaration.Symbol.Parameters.Length == 2 &&
-                symbolAndDeclaration.Symbol.Parameters.TryElementAt(0, out var parameter1) &&
-                symbolAndDeclaration.Symbol.Parameters.TryElementAt(1, out var parameter2))
-            {
-                if (symbolAndDeclaration.Declaration.ExpressionBody is { } expressionBody)
-                {
-                    editor.ReplaceNode(
-                        toReplace,
-                        SyntaxFactory.ParseExpression($"({parameter1.Name}, {parameter2.Name}) => {expressionBody.Expression}")
-                                     .WithLeadingTriviaFrom(toReplace));
-                    RemoveMethod(editor, symbolAndDeclaration, cancellationToken);
-                }
-                else if (symbolAndDeclaration.Declaration.Body is { Statements: { } statements } &&
-                         statements.TrySingle(out var statement))
-                {
-                    switch (statement)
-                    {
-                        case ReturnStatementSyntax returnStatement:
-                            editor.ReplaceNode(
-                                toReplace,
-                                SyntaxFactory.ParseExpression($"({parameter1.Name}, {parameter2.Name}) => {returnStatement.Expression}")
-                                             .WithLeadingTriviaFrom(toReplace));
-                            RemoveMethod(editor, symbolAndDeclaration, cancellationToken);
-                            break;
-                        case ExpressionStatementSyntax expressionStatement:
-                            editor.ReplaceNode(
-                                toReplace,
-                                SyntaxFactory.ParseExpression($"({parameter1.Name}, {parameter2.Name}) => {expressionStatement.Expression}")
-                                             .WithLeadingTriviaFrom(toReplace));
-                            RemoveMethod(editor, symbolAndDeclaration, cancellationToken);
-                            break;
-                    }
+                    case 1
+                        when method.Parameters[0] is { } parameter:
+                        editor.ReplaceNode(
+                            lambda,
+                            x => SyntaxFactory.ParseExpression($"{parameter.Name} => {expression}")
+                                              .WithLeadingTriviaFrom(x));
+                        RemoveIfNotUsed(editor, symbolAndDeclaration, cancellationToken);
+                        break;
+                    case 2
+                        when method.Parameters[0] is { } parameter1 &&
+                             method.Parameters[1] is { } parameter2:
+                        editor.ReplaceNode(
+                            lambda,
+                            x => SyntaxFactory.ParseExpression($"({parameter1.Name}, {parameter2.Name}) => {expression}")
+                                              .WithLeadingTriviaFrom(x));
+                        RemoveIfNotUsed(editor, symbolAndDeclaration, cancellationToken);
+                        break;
                 }
             }
         }

-        private static void RemoveMethod(DocumentEditor editor, SymbolAndDeclaration<IMethodSymbol, MethodDeclarationSyntax> symbolAndDeclaration, CancellationToken cancellationToken)
+        private static bool TryGetExpression(MethodDeclarationSyntax declaration, [NotNullWhen(true)] out ExpressionSyntax? expression)
+        {
+            if (declaration.ExpressionBody is { } expressionBody)
+            {
+                expression = expressionBody.Expression;
+                return true;
+            }
+
+            if (declaration.Body is { Statements: { Count: 1 } statements } &&
+                statements.TrySingle(out var statement))
+            {
+                switch (statement)
+                {
+                    case ReturnStatementSyntax { Expression: { } temp }:
+                        expression = temp;
+                        return true;
+                    case ExpressionStatementSyntax { Expression: { } temp }:
+                        expression = temp;
+                        return true;
+                }
+            }
+
+            expression = null;
+            return false;
+        }
+
+        private static void RemoveIfNotUsed(DocumentEditor editor, SymbolAndDeclaration<IMethodSymbol, MethodDeclarationSyntax> symbolAndDeclaration, CancellationToken cancellationToken)
         {
             if (symbolAndDeclaration.Symbol.DeclaredAccessibility == Accessibility.Private &&
                 symbolAndDeclaration.Symbol.IsInvokedOnce(editor.SemanticModel, cancellationToken))


Made DataSet.FriendlyName a get-only property and compacted repetitive code.

Signed-off-by: Konstantina Chremmou <a7d1f757a659045fb6db8c1e3849a1c8ad00b97a@citrix.com>

--- XenAdmin/Controls/CustomDataGraph/DataSet.cs
+++ XenAdmin/Controls/CustomDataGraph/DataSet.cs
@@ -56,19 +56,25 @@
         public readonly string Id;
         public DataType Category;
         public string DataSourceName;
-        public string FriendlyName;
+        public string FriendlyName { get; }
         private int MultiplyingFactor = 1;
         public DataRange CustomYRange;
         public bool Hide { get; }

-        private DataSet(string id, IXenObject xo, bool hide, string settype)
+        private DataSet(string id, IXenObject xo, bool hide, string datasourceName)
         {
             XenObject = xo;
             Hide = hide;
             Id = id;
-            DataSourceName = settype;
-            FriendlyName = Helpers.GetFriendlyDataSourceName(settype, XenObject);
+            DataSourceName = datasourceName;
+
+            if (datasourceName == "memory_free_kib")
+                FriendlyName = Helpers.GetFriendlyDataSourceName("memory_used_kib", xo);
+            else if (datasourceName == "memory_internal_free")
+                FriendlyName = Helpers.GetFriendlyDataSourceName("memory_internal_used", xo);
+            else
+                FriendlyName = Helpers.GetFriendlyDataSourceName(datasourceName, xo);
         }

         #region Static methods
@@ -86,7 +92,6 @@

             var dataSet = new DataSet(id, xo, hide, settype);

-
             if (settype.StartsWith("latency") || settype.EndsWith("latency"))
             {
                 if (settype.StartsWith("latency_") || settype.StartsWith("read_latency_") ||
@@ -141,28 +146,15 @@
                                                 ? (int)Util.BINARY_KILO
                                                 : 1;

-                if (settype == "memory_free_kib" && xo is Host)
-                {
-                    dataSet.FriendlyName = Helpers.GetFriendlyDataSourceName("memory_used_kib", dataSet.XenObject);
-                    Host host = (Host)xo;
-                    Host_metrics metrics = host.Connection.Resolve(host.metrics);
-                    long max = metrics != null ? metrics.memory_total : 100;
-                    dataSet.CustomYRange = new DataRange(max, 0, max / 10d, Unit.Bytes, RangeScaleMode.Delegate)
+                if (settype == "memory_free_kib" || settype == "memory_internal_free")
+                {
+                    var max = GetMemoryMax(xo);
+                    var resolution = GetMemoryResolution(max);
+
+                    dataSet.CustomYRange = new DataRange(max, 0, resolution, Unit.Bytes, RangeScaleMode.Delegate)
                     {
-                        UpdateMax = dataSet.GetMemoryMax,
-                        UpdateResolution = dataSet.GetMemoryResolution
-                    };
-                }
-                else if (settype == "memory_internal_free" && xo is VM)
-                {
-                    dataSet.FriendlyName = Helpers.GetFriendlyDataSourceName("memory_internal_used", dataSet.XenObject);
-                    VM vm = (VM)xo;
-                    VM_metrics metrics = vm.Connection.Resolve(vm.metrics);
-                    long max = metrics != null ? metrics.memory_actual : (long)vm.memory_dynamic_max;
-                    dataSet.CustomYRange = new DataRange(max, 0, max / 10d, Unit.Bytes, RangeScaleMode.Delegate)
-                    {
-                        UpdateMax = dataSet.GetMemoryMax,
-                        UpdateResolution = dataSet.GetMemoryResolution
+                        UpdateMax = GetMemoryMax,
+                        UpdateResolution = GetMemoryResolution
                     };
                 }
                 else
@@ -351,38 +343,25 @@
             return listout;
         }

-        private double GetMemoryMax(IXenObject xo)
-        {
-            if (xo is Host)
-            {
-                Host host = (Host)xo;
-                Host_metrics metrics = host.Connection.Resolve(host.metrics);
-                return metrics != null ? metrics.memory_total : 100;
-            }
-            else if (xo is VM)
-            {
-                VM vm = (VM)xo;
-                VM_metrics metrics = vm.Connection.Resolve(vm.metrics);
-                return metrics != null ? metrics.memory_actual : vm.memory_dynamic_max;
-            }
+        private static double GetMemoryMax(IXenObject xo)
+        {
+            if (xo is Host host)
+                return host.Connection.Resolve(host.metrics)?.memory_total ?? 100;
+
+            if (xo is VM vm)
+                return (vm.Connection.Resolve(vm.metrics))?.memory_actual ?? vm.memory_dynamic_max;
+
             return 100;
         }

-        private double GetMemoryResolution(IXenObject xmo)
-        {
-            if (xmo is Host)
-            {
-                Host host = (Host)xmo;
-                Host_metrics metrics = host.Connection.Resolve(host.metrics);
-                return metrics != null ? metrics.memory_total / 10 : 10;
-            }
-            else if (xmo is VM)
-            {
-                VM vm = (VM)xmo;
-                VM_metrics metrics = vm.Connection.Resolve(vm.metrics);
-                return ((metrics != null ? metrics.memory_actual : (long)vm.memory_dynamic_max) / 10d);
-            }
-            return 10;
+        private static double GetMemoryResolution(IXenObject xmo)
+        {
+            return GetMemoryMax(xmo) / 10d;
+        }
+
+        private static double GetMemoryResolution(double max)
+        {
+            return max / 10d;
         }

         public static double GetMaxY(List<DataPoint> dataPoints)


CA-220171: Configure HA dialog incorrectly states failover tolerance would be 0

Signed-off-by: Mihaela Stoica <be95049f8e30d921fc7e2579c00c48bd84c40606@citrix.com>

--- XenAdmin/Dialogs/EditVmHaPrioritiesDialog.cs
+++ XenAdmin/Dialogs/EditVmHaPrioritiesDialog.cs
@@ -182,17 +182,18 @@
             long newNtol = assignPriorities.Ntol;

             // User has configured ntol to be zero. Check this is what they want (since it is practically useless).
-            DialogResult dialogResult;
-            using (var dlg = new ThreeButtonDialog(
-                    new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.HA_NTOL_ZERO_QUERY, Messages.HIGH_AVAILABILITY),
-                    ThreeButtonDialog.ButtonYes,
-                    new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)))
-            {
-                dialogResult = dlg.ShowDialog(this);
-            }
-            if (newNtol == 0 && dialogResult == DialogResult.No)
-            {
-                return;
+            if (newNtol == 0)
+            {
+                DialogResult dialogResult;
+                using (var dlg = new ThreeButtonDialog(
+                        new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.HA_NTOL_ZERO_QUERY, Messages.HIGH_AVAILABILITY),
+                        ThreeButtonDialog.ButtonYes,
+                        new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)))
+                {
+                    dialogResult = dlg.ShowDialog(this);
+                }
+                if (dialogResult == DialogResult.No)
+                    return;
             }

             if (assignPriorities.ChangesMade || newNtol != originalNtol)


Improved the UI

Improved the UI

--- YoutubeDownloader/Gui/MainWindow.Designer.cs
+++ YoutubeDownloader/Gui/MainWindow.Designer.cs
@@ -38,6 +38,7 @@
             //
             // tableLayoutPanel
             //
+            this.tableLayoutPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
             this.tableLayoutPanel.BackColor = System.Drawing.SystemColors.Control;
             this.tableLayoutPanel.ColumnCount = 2;
             this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 91.89744F));
@@ -45,14 +46,13 @@
             this.tableLayoutPanel.Controls.Add(this.workingDirectoryButton, 1, 0);
             this.tableLayoutPanel.Controls.Add(this.workingDirectoryTextBox, 0, 0);
             this.tableLayoutPanel.Controls.Add(this.downloadsList, 0, 1);
-            this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tableLayoutPanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
             this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0);
             this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(2);
             this.tableLayoutPanel.Name = "tableLayoutPanel";
             this.tableLayoutPanel.RowCount = 2;
-            this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.48936F));
-            this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 88.51064F));
+            this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.54545F));
+            this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 89.45454F));
             this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 39F));
             this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
             this.tableLayoutPanel.Size = new System.Drawing.Size(487, 275);
@@ -60,10 +60,10 @@
             //
             // workingDirectoryButton
             //
-            this.workingDirectoryButton.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.workingDirectoryButton.Anchor = System.Windows.Forms.AnchorStyles.None;
             this.workingDirectoryButton.Location = new System.Drawing.Point(450, 3);
             this.workingDirectoryButton.Name = "workingDirectoryButton";
-            this.workingDirectoryButton.Size = new System.Drawing.Size(34, 25);
+            this.workingDirectoryButton.Size = new System.Drawing.Size(34, 22);
             this.workingDirectoryButton.TabIndex = 1;
             this.workingDirectoryButton.Text = "...";
             this.workingDirectoryButton.UseVisualStyleBackColor = true;
@@ -71,8 +71,9 @@
             //
             // workingDirectoryTextBox
             //
+            this.workingDirectoryTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
             this.workingDirectoryTextBox.Cursor = System.Windows.Forms.Cursors.Default;
-            this.workingDirectoryTextBox.Location = new System.Drawing.Point(3, 3);
+            this.workingDirectoryTextBox.Location = new System.Drawing.Point(3, 4);
             this.workingDirectoryTextBox.MaxLength = 260;
             this.workingDirectoryTextBox.Name = "workingDirectoryTextBox";
             this.workingDirectoryTextBox.ReadOnly = true;
@@ -83,14 +84,14 @@
             // downloadsList
             //
             this.downloadsList.AllowDrop = true;
+            this.downloadsList.Anchor = System.Windows.Forms.AnchorStyles.None;
             this.tableLayoutPanel.SetColumnSpan(this.downloadsList, 2);
-            this.downloadsList.Dock = System.Windows.Forms.DockStyle.Fill;
             this.downloadsList.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
             this.downloadsList.FormattingEnabled = true;
-            this.downloadsList.Location = new System.Drawing.Point(3, 34);
+            this.downloadsList.Location = new System.Drawing.Point(3, 31);
             this.downloadsList.Name = "downloadsList";
             this.downloadsList.SelectionMode = System.Windows.Forms.SelectionMode.None;
-            this.downloadsList.Size = new System.Drawing.Size(481, 238);
+            this.downloadsList.Size = new System.Drawing.Size(481, 240);
             this.downloadsList.TabIndex = 3;
             this.downloadsList.UseTabStops = false;
             this.downloadsList.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.GetDrawItemDelegate);


Clearer syntax for JavaScriptReplaceableUrl

--- T4MVCExtensions/T4Extensions.cs
+++ T4MVCExtensions/T4Extensions.cs
@@ -333,17 +333,13 @@
                 throw new Exception("T4MVC JavascriptReplacableUrl could not locate action in source dictionary");
             string action = token.ToString();

-            var specificActionUrl = (from r in RouteTable.Routes.OfType<Route>()
-                                     where r.Defaults != null
-                                     && ((string.IsNullOrEmpty(area)
-                                        && (r.DataTokens == null || !r.DataTokens.Any(dt => string.Compare(dt.Key, "area", StringComparison.InvariantCultureIgnoreCase) == 0)))
-                                        || (r.DataTokens != null && r.DataTokens.Any(dt => string.Compare(dt.Key, "area", StringComparison.InvariantCultureIgnoreCase) == 0
-                                            && string.Compare(dt.Value.ToString(), area, StringComparison.InvariantCultureIgnoreCase) == 0)))
-                                     && r.Defaults.Any(dt => string.Compare(dt.Key, "controller", StringComparison.InvariantCultureIgnoreCase) == 0
-                                         && string.Compare(dt.Value.ToString(), controller, StringComparison.InvariantCultureIgnoreCase) == 0)
-                                     && r.Defaults.Any(dt => string.Compare(dt.Key, "action", StringComparison.InvariantCultureIgnoreCase) == 0
-                                         && string.Compare(dt.Value.ToString(), action, StringComparison.InvariantCultureIgnoreCase) == 0)
-                                     select r.Url).FirstOrDefault();
+            // This matches the ActionResult to a specific route (so we can get the exact URL)
+            string specificActionUrl = RouteTable.Routes.OfType<Route>()
+                .Where(r => r.DataTokens.CompareValue("area", area)
+                    && r.Defaults.CompareValue("controller", controller)
+                    && r.Defaults.CompareValue("action", action))
+                .Select(r => r.Url)
+                .FirstOrDefault();

             if (String.IsNullOrEmpty(specificActionUrl))
             {
@@ -351,6 +347,33 @@
             }

             return urlHelper.Content("~/" + specificActionUrl);
+        }
+
+        // This compares a specified value with that in a RouteValueDictionary for a given key
+        // while ignoring null dictionaries if the match value is also null or whitespace
+        private static bool CompareValue(this RouteValueDictionary dictionary, string key, string value)
+        {
+            // Normalize the value to null if empty or whitespace
+            if (string.IsNullOrWhiteSpace(value))
+            {
+                value = null;
+            }
+
+            // Do we actually have the RouteValueDictionary
+            if (dictionary == null)
+            {
+                // No dictionary, match if the value is also null or whitespace
+                return value == null;
+            }
+            else
+            {
+                // Match if the value is null or whitespace and the key is not in the dictionary
+                // or if the key is in the dictionary and matches the value
+                return string.Compare(value, dictionary
+                    .Where(kvp => string.Compare(kvp.Key, key, StringComparison.InvariantCultureIgnoreCase) == 0)
+                    .Select(kvp => kvp.Value.ToString())
+                    .FirstOrDefault(), StringComparison.InvariantCultureIgnoreCase) == 0;
+            }
         }

         public static string JavaScriptReplaceableUrl(this UrlHelper urlHelper, Task<ActionResult> taskResult)


fix sysmsg parameter replacement

fix sysmsg parameter replacement

--- TCC.Core/Data/Chat/ChatUtils.cs
+++ TCC.Core/Data/Chat/ChatUtils.cs
@@ -88,7 +88,7 @@
                 foreach (var keyVal in pars)
                 {
                     var regex = new Regex(Regex.Escape($"{{{keyVal.Key}}}"));
-                    result = regex.Replace(txt, $"{{{keyVal.Value}}}", 1);
+                    result = regex.Replace(txt, $"{{{keyVal.Value}}}", int.MaxValue);
                     if (txt == result) result = txt.ReplaceCaseInsensitive($"{{{keyVal.Key}}}", $"{{{keyVal.Value}}}");
                     if (txt == result) result = txt.ReplaceCaseInsensitive($"{{{keyVal.Key}", $"{{{keyVal.Value}");
                     txt = result;


Started work on updating orders from Libris.

--- Chalmers.ILL/Providers/LibrisOrderItemsSource.cs
+++ Chalmers.ILL/Providers/LibrisOrderItemsSource.cs
@@ -3,6 +3,7 @@
 using Chalmers.ILL.OrderItems;
 using Chalmers.ILL.Patron;
 using Chalmers.ILL.UmbracoApi;
+using Examine;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
@@ -46,6 +47,8 @@
             AddPatronInfoToSeeds();

             CreateNewOrdersFromSeeds();
+
+            UpdateExistingOrdersFromLibris();

             return Result;
         }
@@ -149,6 +152,40 @@
             }
         }

+        private void UpdateExistingOrdersFromLibris()
+        {
+            try
+            {
+                var orders = GetSearchResultsForAllActiveOrders();
+
+                foreach (var order in orders)
+                {
+                    // TODO: Check for updates on all orders that have Libris as provider.
+                }
+            }
+            catch (Exception e)
+            {
+                throw new SourcePollingException("Error when updating existing orders from Libris.", e);
+            }
+        }
+
+        private ISearchResults GetSearchResultsForAllActiveOrders()
+        {
+            // TODO: Inject Examine or add this to OrderItemManager, which probably should be called something else.
+            var searcher = ExamineManager.Instance.SearchProviderCollection["ChalmersILLOrderItemsSearcher"];
+
+            var searchCriteria = searcher.CreateSearchCriteria(Examine.SearchCriteria.BooleanOperation.Or);
+
+            var query = searchCriteria.RawQuery(@"nodeTypeAlias:ChalmersILLOrderItem AND
+                (Status:01\:Ny OR
+                 Status:02\:Åtgärda OR
+                 Status:03\:Beställd OR
+                 Status:04\:Väntar OR
+                 Status:09\:Mottagen)");
+
+            return searcher.Search(query);
+        }
+
         private string ReplaceWithNotAvailableIfEmptyString(string val)
         {
             return (val == "" ? "N/A" : val);


Small styling change

Small styling change

--- NuGetFeed/Views/Home/Index.cshtml
+++ NuGetFeed/Views/Home/Index.cshtml
@@ -35,7 +35,7 @@

With NuGet Feed for Visual Studio you will be able to export all your references NuGet packages to NuGetFeed.org. Simply right-click the References folder and export directly to NuGetFeed.org.

-

+

Google Chrome Extension

Install the NuGet Feed extension in Google Chrome to add RSS links on NuGet.org. The NuGet Feed Chrome Extension also works with your favorite Chrome feed extension, by adding an alternate URL to all package pages on NuGet.org.


Added May 2015 Event

Added May 2015 Event

--- NwaDg.Web/Views/Home/Index.cshtml
+++ NwaDg.Web/Views/Home/Index.cshtml
@@ -42,7 +42,7 @@

UPCOMING EVENTS

                 View EventBrite Events

-

Sell Tickets through Eventbrite

+


spelling error

spelling error

--- Oak/Controllers/SeedController.cs
+++ Oak/Controllers/SeedController.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
@@ -67,7 +67,7 @@

             Seed.Export(exportPath, Schema.Scripts());

-            return Content("Scripts executed to: " + exportPath);
+            return Content("Scripts exported to: " + exportPath);
         }

         [HttpPost]


Reactivate theme modification

Reactivate theme modification

I don't know why was it commented.

--- Ocell.UI/Ocell.Phone8/App.xaml.cs
+++ Ocell.UI/Ocell.Phone8/App.xaml.cs
@@ -75,10 +75,10 @@

             bool isDarkTheme = ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible);

-            //if (Config.Background.Type == LightOrDark.Light)
-            //    ThemeManager.ToLightTheme();
-            //else if (Config.Background.Type == LightOrDark.Dark)
-            //    ThemeManager.ToDarkTheme();
+            if (Config.Background.Type == LightOrDark.Light)
+                ThemeManager.ToLightTheme();
+            else if (Config.Background.Type == LightOrDark.Dark)
+                ThemeManager.ToDarkTheme();

             RootFrame.Background = Config.Background.GetBrush();
         }


不要なif文を削除

不要なif文を削除

--- DraggableWindow/DraggableWindow/MainPage.xaml.cs
+++ DraggableWindow/DraggableWindow/MainPage.xaml.cs
@@ -93,9 +93,8 @@

       draggableGrid.SizeChanged += (s, e) =>
       {
-        if (IsAcrylicSupported)
-          _hostSprite.Size
-            = new Vector2((float)e.NewSize.Width, (float)e.NewSize.Height);
+        _hostSprite.Size
+          = new Vector2((float)e.NewSize.Width, (float)e.NewSize.Height);
       };
     }


Prevent subclassing Expression outside of Pegasus.

--- Pegasus/Expressions/Expression.cs
+++ Pegasus/Expressions/Expression.cs
@@ -13,5 +13,8 @@
     /// </summary>
     public abstract class Expression
     {
+        internal Expression()
+        {
+        }
     }
 }


Put rarely used View menu items into a submenu.

--- Pinta.Core/Actions/ViewActions.cs
+++ Pinta.Core/Actions/ViewActions.cs
@@ -114,24 +114,6 @@
 		#region Initialization
 		public void RegisterActions (Gtk.Application app, GLib.Menu menu)
 		{
-			app.AddAction (ToolBar);
-			menu.AppendItem (ToolBar.CreateMenuItem ());
-
-			app.AddAction (StatusBar);
-			menu.AppendItem (StatusBar.CreateMenuItem ());
-
-			app.AddAction (ToolBox);
-			menu.AppendItem (ToolBox.CreateMenuItem ());
-
-			app.AddAction (PixelGrid);
-			menu.AppendItem (PixelGrid.CreateMenuItem ());
-
-			app.AddAction (Rulers);
-			menu.AppendItem (Rulers.CreateMenuItem ());
-
-			app.AddAction (ImageTabs);
-			menu.AppendItem (ImageTabs.CreateMenuItem ());
-
 			var zoom_section = new GLib.Menu ();
 			menu.AppendSection (null, zoom_section);

@@ -160,6 +142,30 @@
 			metric_menu.Append (Translations.GetString ("Pixels"), $"app.{RulerMetric.Name}(0)");
 			metric_menu.Append (Translations.GetString ("Inches"), $"app.{RulerMetric.Name}(1)");
 			metric_menu.Append (Translations.GetString ("Centimeters"), $"app.{RulerMetric.Name}(2)");
+
+			var show_hide_section = new GLib.Menu ();
+			menu.AppendSection (null, show_hide_section);
+
+			var show_hide_menu = new GLib.Menu ();
+			show_hide_section.AppendSubmenu (Translations.GetString ("Show/Hide"), show_hide_menu);
+
+			app.AddAction (PixelGrid);
+			show_hide_menu.AppendItem (PixelGrid.CreateMenuItem ());
+
+			app.AddAction (Rulers);
+			show_hide_menu.AppendItem (Rulers.CreateMenuItem ());
+
+			app.AddAction (ToolBar);
+			show_hide_menu.AppendItem (ToolBar.CreateMenuItem ());
+
+			app.AddAction (StatusBar);
+			show_hide_menu.AppendItem (StatusBar.CreateMenuItem ());
+
+			app.AddAction (ToolBox);
+			show_hide_menu.AppendItem (ToolBox.CreateMenuItem ());
+
+			app.AddAction (ImageTabs);
+			show_hide_menu.AppendItem (ImageTabs.CreateMenuItem ());
 		}

 		public void CreateStatusBar (Statusbar statusbar)


Don't allow negative brush size

Don't allow negative brush size

--- Pinta.Core/Tools/BaseBrushTool.cs
+++ Pinta.Core/Tools/BaseBrushTool.cs
@@ -45,14 +45,14 @@
 		protected virtual int BrushWidth {
 			get {
 				int width;
-
-				if (Int32.TryParse (brush_width.ComboBox.ActiveText, out width))
-					return width;
-				else {
-					(brush_width.ComboBox as Gtk.ComboBoxEntry).Entry.Text = DEFAULT_BRUSH_WIDTH.ToString ();
-
-					return DEFAULT_BRUSH_WIDTH;
+				if (Int32.TryParse (brush_width.ComboBox.ActiveText, out width)) {
+					if (width > 0) {
+						(brush_width.ComboBox as Gtk.ComboBoxEntry).Entry.Text = width.ToString ();
+						return width;
+					}
 				}
+				(brush_width.ComboBox as Gtk.ComboBoxEntry).Entry.Text = DEFAULT_BRUSH_WIDTH.ToString ();
+				return DEFAULT_BRUSH_WIDTH;
 			}
 			set { (brush_width.ComboBox as Gtk.ComboBoxEntry).Entry.Text = value.ToString (); }
 		}


Added try-catch because of closing Listener in another thread

JoiningClients should be kicked first guess?

--- PokeD.Server/Modules/ModuleP3D.cs
+++ PokeD.Server/Modules/ModuleP3D.cs
@@ -131,13 +131,13 @@

             Listener?.Stop();

+            for (var i = 0; i < JoiningClients.Count; i++)
+                JoiningClients[i]?.SendKick("Server is closing!");
+            JoiningClients.Clear();
+
             for (var i = 0; i < Clients.Count; i++)
                 Clients[i]?.SendKick("Server is closing!");
             Clients.Clear();
-
-            for (var i = 0; i < JoiningClients.Count; i++)
-                JoiningClients[i]?.SendKick("Server is closing!");
-            JoiningClients.Clear();

             NearPlayers.Clear();

@@ -169,11 +169,15 @@
         {
             while (!IsDisposing && !ListenerToken.IsCancellationRequested)
             {
-                var client = new P3DPlayer(Listener.AcceptSocket(), this);
-                client.Ready += OnClientReady;
-                client.Disconnected += OnClientLeave;
-                client.StartListening();
-                JoiningClients.Add(client);
+                try
+                {
+                    var client = new P3DPlayer(Listener.AcceptSocket(), this);
+                    client.Ready += OnClientReady;
+                    client.Disconnected += OnClientLeave;
+                    client.StartListening();
+                    JoiningClients.Add(client);
+                }
+                catch (SocketException) { }
             }
         }


Removed Beta label from FakeItEasy package version.

--- Properties/VersionAssemblyInfo.cs
+++ Properties/VersionAssemblyInfo.cs
@@ -16,8 +16,8 @@

 [assembly: AssemblyVersion("3.0.0.0")]
 [assembly: AssemblyFileVersion("3.2.0.0")]
-[assembly: AssemblyConfiguration("Release built on 2013-12-27 15:23")]
-[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
+[assembly: AssemblyConfiguration("Release built on 2014-01-07 21:40")]
+[assembly: AssemblyCopyright("Copyright © 2014 Autofac Contributors")]
 [assembly: AssemblyDescription("Autofac.Configuration 3.2.0")]


Fix crash caused by previous commit

Fix crash caused by previous commit

--- NTumbleBit/BouncyCastle/security/SecureRandom.cs
+++ NTumbleBit/BouncyCastle/security/SecureRandom.cs
@@ -20,7 +20,7 @@

 		public override int Next(int maxValue)
 		{
-			throw new NotImplementedException();
+			return (int)(RandomUtils.GetUInt32() % maxValue);
 		}

 		public override int Next(int minValue, int maxValue)


Remove wrong type for username and e-mail field

--- Oogstplanner.Web/Views/Account/_LoginForm.cshtml
+++ Oogstplanner.Web/Views/Account/_LoginForm.cshtml
@@ -11,7 +11,7 @@

     @Html.LabelFor(vm => vm.Login.UserName, new { @class="sr-only" })
     @Html.TextBoxFor(vm => vm.Login.UserName,
-        new { @class = "form-control", @type="email", @placeholder = "Gebruikersnaam of e-mailadres" })
+        new { @class = "form-control", @placeholder = "Gebruikersnaam of e-mailadres" })
     @Html.LabelFor(vm => vm.Login.Password, new { @class="sr-only" })
     @Html.PasswordFor(vm => vm.Login.Password,
         new { @class = "form-control", @placeholder = "Wachtwoord" })


Replace our patched up, broken an rebroken sit code with the code from core which has now matured beyond what we had.

--- OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1942,7 +1942,7 @@
                         Velocity = Vector3.Zero;
                         SendAvatarDataToAllAgents();

-                        HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);  //KF ??
+                        //HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
                     }
                     //ControllingClient.SendSitResponse(m_requestedSitTargetID, m_requestedSitOffset, Quaternion.Identity, false, Vector3.Zero, Vector3.Zero, false);
                     m_requestedSitTargetUUID = UUID.Zero;
@@ -1979,22 +1979,24 @@

             if (ParentID != 0)
             {
-                SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
+                m_log.Debug("StandupCode Executed");
+                SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
                 if (part != null)
                 {
-                    part.TaskInventory.LockItemsForRead(true);
                     TaskInventoryDictionary taskIDict = part.TaskInventory;
                     if (taskIDict != null)
                     {
-                        foreach (UUID taskID in taskIDict.Keys)
+                        lock (taskIDict)
                         {
-                            UnRegisterControlEventsToScript(LocalId, taskID);
-                            taskIDict[taskID].PermsMask &= ~(
-                                2048 | //PERMISSION_CONTROL_CAMERA
-                                4); // PERMISSION_TAKE_CONTROLS
+                            foreach (UUID taskID in taskIDict.Keys)
+                            {
+                                UnRegisterControlEventsToScript(LocalId, taskID);
+                                taskIDict[taskID].PermsMask &= ~(
+                                    2048 | //PERMISSION_CONTROL_CAMERA
+                                    4); // PERMISSION_TAKE_CONTROLS
+                            }
                         }
                     }
-                    part.TaskInventory.LockItemsForRead(false);

                     // Reset sit target.
                     if (part.SitTargetAvatar == UUID)
@@ -2003,54 +2005,16 @@
                     ParentPosition = part.GetWorldPosition();
                     ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
                 }
-				// part.GetWorldRotation()   is the rotation of the object being sat on
-				// Rotation  is the sittiing Av's rotation
-
-	           	Quaternion partRot;
-//	            if (part.LinkNum == 1)
-//	            {				// Root prim of linkset
-//	                partRot = part.ParentGroup.RootPart.RotationOffset;
-//	            }
-//	            else
-//	            {				// single or child prim
-
-//	            }
-                if (part == null) //CW: Part may be gone. llDie() for example.
-                {
-                    partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
-                }
-                else
-                {
-                    partRot = part.GetWorldRotation();
-                }
-
-	            Quaternion partIRot = Quaternion.Inverse(partRot);
-
-				Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av
-				Vector3 avStandUp = new Vector3(0.3f, 0f, 0f) * avatarRot;		// 0.3M infront of av
-
-
-                if (m_physicsActor == null)
+
+                if (PhysicsActor == null)
                 {
                     AddToPhysicalScene(false);
                 }
-                //CW: If the part isn't null then we can set the current position
-                if (part != null)
-                {
-                    Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + ((m_pos - part.OffsetPosition) * partRot);			// + av sit offset!
-                    AbsolutePosition = avWorldStandUp;                	 //KF: Fix stand up.
-                    part.IsOccupied = false;
-                    part.ParentGroup.DeleteAvatar(ControllingClient.AgentId);
-                }
-                else
-                {
-                    //CW: Since the part doesn't exist, a coarse standup position isn't an issue
-                    AbsolutePosition = m_lastWorldPosition;
-                }
-
-		        m_parentPosition = Vector3.Zero;
-				m_parentID = 0;
-                m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
+
+                m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
+                ParentPosition = Vector3.Zero;
+
+                ParentID = 0;
                 SendAvatarDataToAllAgents();
                 m_requestedSitTargetID = 0;

@@ -2058,7 +2022,7 @@
                     part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
             }

-            Animator.UpdateMovementAnimations();
+            Animator.TrySetMovementAnimation("STAND");
         }

         private SceneObjectPart FindNextAvailableSitTarget(UUID targetID)
@@ -2089,8 +2053,8 @@
                 Quaternion avSitOrientation = part.SitTargetOrientation;
                 UUID avOnTargetAlready = part.SitTargetAvatar;

-                bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero));
-	            bool SitTargetisSet = (Vector3.Zero != avSitOffset);		//NB Latest SL Spec shows Sit Rotation setting is ignored.
+                bool SitTargetUnOccupied = avOnTargetAlready == UUID.Zero;
+                bool SitTargetisSet = avSitOffset != Vector3.Zero || avSitOrientation != Quaternion.Identity;

                 if (SitTargetisSet && SitTargetUnOccupied)
                 {
@@ -2106,167 +2070,87 @@
         private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset, Quaternion pSitOrientation)
         {
             bool autopilot = true;
-            Vector3 autopilotTarget = new Vector3();
-            Quaternion sitOrientation = Quaternion.Identity;
             Vector3 pos = new Vector3();
+            Quaternion sitOrientation = pSitOrientation;
             Vector3 cameraEyeOffset = Vector3.Zero;
             Vector3 cameraAtOffset = Vector3.Zero;
             bool forceMouselook = false;

             SceneObjectPart part = FindNextAvailableSitTarget(targetID);
-            if (part == null) return;
-
-            // TODO: determine position to sit at based on scene geometry; don't trust offset from client
-            // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
-
-			// part is the prim to sit on
-			// offset is the world-ref vector distance from that prim center to the click-spot
-			// UUID  is the UUID of the Avatar doing the clicking
-
-			m_avInitialPos = AbsolutePosition; 			// saved to calculate unscripted sit rotation
-
-            // Is a sit target available?
-            Vector3 avSitOffSet = part.SitTargetPosition;
-            Quaternion avSitOrientation = part.SitTargetOrientation;
-
-            bool SitTargetisSet = (Vector3.Zero != avSitOffSet);		//NB Latest SL Spec shows Sit Rotation setting is ignored.
-   //     	Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
-           	Quaternion partRot;
-//            if (part.LinkNum == 1)
-//            {				// Root prim of linkset
-//                partRot = part.ParentGroup.RootPart.RotationOffset;
-//            }
-//            else
-//            {				// single or child prim
-                partRot = part.GetWorldRotation();
-//            }
-           	Quaternion partIRot = Quaternion.Inverse(partRot);
-//Console.WriteLine("SendSitResponse offset=" + offset + "  Occup=" + part.IsOccupied + "    TargSet=" + SitTargetisSet);
-			// Sit analysis rewritten by KF 091125
-            if (SitTargetisSet) 		// scipted sit
-            {
-				if (!part.IsOccupied)
-				{
-//Console.WriteLine("Scripted, unoccupied");
-    	            part.SitTargetAvatar = UUID;		// set that Av will be on it
-    	            offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z);	// change ofset to the scripted one
-
-                    Quaternion nrot = avSitOrientation;
-                    if (!part.IsRoot)
-                    {
-                        nrot = part.RotationOffset * avSitOrientation;
-                    }
-    	            sitOrientation = nrot;		// Change rotatione to the scripted one
-                    OffsetRotation = nrot;
-    	            autopilot = false;						// Jump direct to scripted llSitPos()
-    	        }
-    	       	else
-    	       	{
-//Console.WriteLine("Scripted, occupied");
-    	    		 return;
-    	       	}
-    	    }
-    	    else	// Not Scripted
-    	    {
-    	       	if ( (Math.Abs(offset.X) > 0.1f) || (Math.Abs(offset.Y) > 0.1f) ) // Changed 0.5M to 0.1M as they want to be able to sit close together
-    	       	{
-    	       		// large prim & offset, ignore if other Avs sitting
-//    	       		offset.Z -= 0.05f;
-    	       		m_avUnscriptedSitPos = offset * partIRot;					// (non-zero) sit where clicked
-    	       		autopilotTarget = part.AbsolutePosition + offset;			// World location of clicked point
-
-//Console.WriteLine(" offset ={0}", offset);
-//Console.WriteLine(" UnscriptedSitPos={0}", m_avUnscriptedSitPos);
-//Console.WriteLine(" autopilotTarget={0}", autopilotTarget);
-
-    	       	}
-    	       	else		// small offset
-    	       	{
-//Console.WriteLine("Small offset");
-					if (!part.IsOccupied)
-					{
-						m_avUnscriptedSitPos = Vector3.Zero;	// Zero = Sit on prim center
-						autopilotTarget = part.AbsolutePosition;
-//Console.WriteLine("UsSmall autopilotTarget={0}", autopilotTarget);
-    	       		}
-    	       		else return; 		// occupied small
-    	       	}	// end large/small
-    	    } // end Scripted/not
-
-            part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
-
-            cameraAtOffset = part.GetCameraAtOffset();
-            cameraEyeOffset = part.GetCameraEyeOffset();
-            forceMouselook = part.GetForceMouselook();
-            if(cameraAtOffset == Vector3.Zero) cameraAtOffset =  new Vector3(0f, 0f, 0.1f); //
-            if(cameraEyeOffset == Vector3.Zero) cameraEyeOffset =  new Vector3(0f, 0f, 0.1f); //
-
-            if (m_physicsActor != null)
-            {
-                // If we're not using the client autopilot, we're immediately warping the avatar to the location
-                // We can remove the physicsActor until they stand up.
-                m_sitAvatarHeight = m_physicsActor.Size.Z;
-                if (autopilot)
-                {				// its not a scripted sit
-//                        if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5)
-					if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 256.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 256.0f) )
-                    {
-                        autopilot = false;		// close enough
-                        m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup.
-                                                             Not using the part's position because returning the AV to the last known standing
-                                                             position is likely to be more friendly, isn't it? */
+            if (part != null)
+            {
+                // TODO: determine position to sit at based on scene geometry; don't trust offset from client
+                // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
+
+                // Is a sit target available?
+                Vector3 avSitOffSet = part.SitTargetPosition;
+                Quaternion avSitOrientation = part.SitTargetOrientation;
+                UUID avOnTargetAlready = part.SitTargetAvatar;
+
+                bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero));
+                bool SitTargetisSet =
+                    (!(avSitOffSet == Vector3.Zero &&
+                       (
+                           avSitOrientation == Quaternion.Identity // Valid Zero Rotation quaternion
+                           || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point
+                           || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion
+                       )
+                       ));
+
+//                m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
+
+                if (SitTargetisSet && SitTargetUnOccupied)
+                {
+                    part.SitTargetAvatar = UUID;
+                    offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z);
+                    sitOrientation = avSitOrientation;
+                    autopilot = false;
+                }
+                part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
+
+                pos = part.AbsolutePosition + offset;
+                //if (Math.Abs(part.AbsolutePosition.Z - AbsolutePosition.Z) > 1)
+                //{
+                   // offset = pos;
+                    //autopilot = false;
+                //}
+                if (PhysicsActor != null)
+                {
+                    // If we're not using the client autopilot, we're immediately warping the avatar to the location
+                    // We can remove the physicsActor until they stand up.
+                    m_sitAvatarHeight = PhysicsActor.Size.Z;
+
+                    if (autopilot)
+                    {
+                        if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5)
+                        {
+                            autopilot = false;
+
+                            RemoveFromPhysicalScene();
+                            AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
+                        }
+                    }
+                    else
+                    {
                         RemoveFromPhysicalScene();
-                        Velocity = Vector3.Zero;
-                        AbsolutePosition = autopilotTarget + new Vector3(0.0f, 0.0f, (m_sitAvatarHeight / 2.0f));  // Warp av to over sit target
-                    } // else the autopilot will get us close
-                }
-                else
-                {	// its a scripted sit
-                    m_lastWorldPosition = part.AbsolutePosition;  /* CW - This give us a position to return the avatar to if the part is killed before standup.
-                                                                          I *am* using the part's position this time because we have no real idea how far away
-                                                                          the avatar is from the sit target. */
-                    RemoveFromPhysicalScene();
-                    Velocity = Vector3.Zero;
-                }
-            }
-            else return;    // physactor is null!
-
-			Vector3 offsetr; // = offset * partIRot;
-			// KF: In a linkset, offsetr needs to be relative to the group root!  091208
-	//		offsetr = (part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + (offset * partIRot);
- //           if (part.LinkNum < 2)    091216 All this was necessary because of the GetWorldRotation error.
-  //          {				// Single, or Root prim of linkset, target is ClickOffset * RootRot
-            	//offsetr = offset * partIRot;
-//
-  //          }
-  //          else
-    //        {	// Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot)
-        //    	offsetr = //(part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) +
-      //      				(offset * partRot);
-    //        }
-
-//Console.WriteLine(" ");
-//Console.WriteLine("link number ={0}", part.LinkNum);
-//Console.WriteLine("Prim offset ={0}", part.OffsetPosition );
-//Console.WriteLine("Root Rotate ={0}", part.ParentGroup.RootPart.RotationOffset);
-//Console.WriteLine("Click offst ={0}", offset);
-//Console.WriteLine("Prim Rotate ={0}", part.GetWorldRotation());
-//Console.WriteLine("offsetr     ={0}", offsetr);
-//Console.WriteLine("Camera At   ={0}", cameraAtOffset);
-//Console.WriteLine("Camera Eye  ={0}", cameraEyeOffset);
-
-            //NOTE: SendSitResponse should be relative to the GROUP *NOT* THE PRIM if we're sitting on a child
-            ControllingClient.SendSitResponse(part.ParentGroup.UUID, ((offset * part.RotationOffset) + part.OffsetPosition), sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
-
-            m_requestedSitTargetUUID = part.UUID;		//KF: Correct autopilot target
+                    }
+                }
+
+                cameraAtOffset = part.GetCameraAtOffset();
+                cameraEyeOffset = part.GetCameraEyeOffset();
+                forceMouselook = part.GetForceMouselook();
+            }
+
+            ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
+            m_requestedSitTargetUUID = targetID;
+
             // This calls HandleAgentSit twice, once from here, and the client calls
             // HandleAgentSit itself after it gets to the location
             // It doesn't get to the location until we've moved them there though
             // which happens in HandleAgentSit :P
             m_autopilotMoving = autopilot;
-            m_autoPilotTarget = autopilotTarget;
+            m_autoPilotTarget = pos;
             m_sitAtAutoTarget = autopilot;
-            m_initialSitTarget = autopilotTarget;
             if (!autopilot)
                 HandleAgentSit(remoteClient, UUID);
         }
@@ -2300,9 +2184,9 @@
                 m_requestedSitTargetID = part.LocalId;
                 //m_requestedSitOffset = offset;
                 m_requestedSitTargetUUID = targetID;
-
+
                 m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
-
+
                 if (m_scene.PhysicsScene.SupportsRayCast())
                 {
                     //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback());
@@ -2521,7 +2405,7 @@
                 HandleAgentSit(remoteClient, agentID, "SIT");
             }
         }
-
+
         public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation)
         {
             SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
@@ -2532,68 +2416,33 @@
                 {
                     if (part.SitTargetAvatar == UUID)
                     {
-//Console.WriteLine("Scripted Sit");
-                    	// Scripted sit
                         Vector3 sitTargetPos = part.SitTargetPosition;
                         Quaternion sitTargetOrient = part.SitTargetOrientation;
-                        m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z);
-                        m_pos += SIT_TARGET_ADJUSTMENT;
-                        if (!part.IsRoot)
-                        {
-                            m_pos *= part.RotationOffset;
-                        }
-                        m_bodyRot = sitTargetOrient;
-                        m_parentPosition = part.AbsolutePosition;
-	    	            part.IsOccupied = true;
-                        part.ParentGroup.AddAvatar(agentID);
+
+//                        m_log.DebugFormat(
+//                            "[SCENE PRESENCE]: Sitting {0} at sit target {1}, {2} on {3} {4}",
+//                            Name, sitTargetPos, sitTargetOrient, part.Name, part.LocalId);
+
+                        //Quaternion vq = new Quaternion(sitTargetPos.X, sitTargetPos.Y+0.2f, sitTargetPos.Z+0.2f, 0);
+                        //Quaternion nq = new Quaternion(-sitTargetOrient.X, -sitTargetOrient.Y, -sitTargetOrient.Z, sitTargetOrient.w);
+
+                        //Quaternion result = (sitTargetOrient * vq) * nq;
+
+                        m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT;
+                        Rotation = sitTargetOrient;
+                        ParentPosition = part.AbsolutePosition;
                     }
                     else
                     {
-						// if m_avUnscriptedSitPos is zero then Av sits above center
-						// Else Av sits at m_avUnscriptedSitPos
-
-                    	// Non-scripted sit by Kitto Flora 21Nov09
-                    	// Calculate angle of line from prim to Av
-                    	Quaternion partIRot;
-//                    	if (part.LinkNum == 1)
-//                  	{				// Root prim of linkset
-//                    		partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset);
-//                    	}
-//                    	else
-//                    	{				// single or child prim
-                    		partIRot = Quaternion.Inverse(part.GetWorldRotation());
-//                    	}
-                    	Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos;
-	                	float y_diff = (m_avInitialPos.Y - sitTargetPos.Y);
-    	            	float x_diff = ( m_avInitialPos.X - sitTargetPos.X);
-    	            	if(Math.Abs(x_diff) < 0.001f) x_diff = 0.001f;			// avoid div by 0
-    	            	if(Math.Abs(y_diff) < 0.001f) y_diff = 0.001f;			// avoid pol flip at 0
-    	            	float sit_angle = (float)Math.Atan2( (double)y_diff, (double)x_diff);
-						// NOTE: when sitting m_ pos and m_bodyRot are *relative* to the prim location/rotation, not 'World'.
-    	            	//  Av sits at world euler <0,0, z>, translated by part rotation
-    	            	m_bodyRot = partIRot * Quaternion.CreateFromEulers(0f, 0f, sit_angle);		// sit at 0,0,inv-click
-
-                        m_parentPosition = part.AbsolutePosition;
-    	                part.IsOccupied = true;
-                        part.ParentGroup.AddAvatar(agentID);
-                        m_pos = new Vector3(0f, 0f, 0.05f) + 					// corrections to get Sit Animation
-                        		(new Vector3(0.0f, 0f, 0.61f) * partIRot) + 	// located on center
-                        		(new Vector3(0.34f, 0f, 0.0f) * m_bodyRot) +
-                        		m_avUnscriptedSitPos;							// adds click offset, if any
-	                    //Set up raytrace to find top surface of prim
-	         			Vector3 size = part.Scale;
-	 					float mag = 2.0f; // 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z));
-						Vector3 start =  part.AbsolutePosition + new Vector3(0f, 0f, mag);
-	 					Vector3 down = new Vector3(0f, 0f, -1f);
-//Console.WriteLine("st={0}  do={1}  ma={2}", start, down, mag);
-		                m_scene.PhysicsScene.RaycastWorld(
-	                    		start,		// Vector3 position,
-	                    		down, 		// Vector3 direction,
-	                    		mag, 		// float length,
-	                    		SitAltitudeCallback);          	// retMethod
-	                } // end scripted/not
-                }
-                else  // no Av
+                        m_pos -= part.AbsolutePosition;
+                        ParentPosition = part.AbsolutePosition;
+
+//                        m_log.DebugFormat(
+//                            "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
+//                            Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
+                    }
+                }
+                else
                 {
                     return;
                 }
@@ -2601,58 +2450,12 @@

             ParentID = m_requestedSitTargetID;

-            //We want our offsets to reference the root prim, not the child we may have sat on
-            if (!part.IsRoot)
-            {
-                m_parentID = part.ParentGroup.RootPart.LocalId;
-                m_pos += part.OffsetPosition;
-            }
-            else
-            {
-                m_parentID = m_requestedSitTargetID;
-            }
-
-            if (part.SitTargetAvatar != UUID)
-            {
-                m_offsetRotation = m_offsetRotation / part.RotationOffset;
-            }
             Velocity = Vector3.Zero;
             RemoveFromPhysicalScene();
+
             Animator.TrySetMovementAnimation(sitAnimation);
             SendAvatarDataToAllAgents();
         }
-
-        public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal)
-        {
-			// KF: 091202 There appears to be a bug in Prim Edit Size - the process sometimes make a prim that RayTrace no longer
-			//     sees. Take/re-rez, or sim restart corrects the condition. Result of bug is incorrect sit height.
-			if(hitYN)
-			{
-				// m_pos = Av offset from prim center to make look like on center
-				// m_parentPosition = Actual center pos of prim
-				// collisionPoint = spot on prim where we want to sit
-				// collisionPoint.Z = global sit surface height
-				SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
-				Quaternion partIRot;
-//	            if (part.LinkNum == 1)
-///    	        {				// Root prim of linkset
-//    	            partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset);
-//    	        }
-//    	        else
-//    	        {				// single or child prim
-    	            partIRot = Quaternion.Inverse(part.GetWorldRotation());
-//    	        }
-                if (m_initialSitTarget != null)
-                {
-                    float offZ = collisionPoint.Z - m_initialSitTarget.Z;
-                    Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction
-                    //Console.WriteLine("sitPoint={0},  offset={1}",  sitPoint,  offset);
-                    m_pos += offset;
-                    //  ControllingClient.SendClearFollowCamProperties(part.UUID);
-                }
-
-			}
-		} // End SitAltitudeCallback  KF.

         /// <summary>
         /// Event handler for the 'Always run' setting on the client


Small fix

Small fix

--- OpenUtau.Plugin.Builtin/ENDeltaVer1Phonemizer.cs
+++ OpenUtau.Plugin.Builtin/ENDeltaVer1Phonemizer.cs
@@ -27,7 +27,7 @@
         private readonly string[] burstConsonants = "b,tS,d,dZ,4,g,k,p,t".Split(',');
         private readonly string[] affricates = "tS,dZ".Split(',');
         private readonly Dictionary<string, string> dictionaryReplacements = ("aa=A;ae={;ah=V;ao=O;aw=aU;ax=@;ay=aI;" +
-            "b=b;ch=tS;d=d;dh=D;dx=4;eh=E;em=@m;en=@n;eng=@N;er=3;ey=eI;f=f;g=g;hh=h;ih=I;iy=i;jh=dZ;k=k;l=l;m=m;n=n;ng=N;ow=oU;oy=OI;" +
+            "b=b;ch=tS;d=d;dh=D;dx=4;eh=E;el=@l;em=@m;en=@n;eng=@N;er=3;ey=eI;f=f;g=g;hh=h;ih=I;iy=i;jh=dZ;k=k;l=l;m=m;n=n;ng=N;ow=oU;oy=OI;" +
             "p=p;q=・;r=r;s=s;sh=S;t=t;th=T;uh=U;uw=u;v=v;w=w;y=j;z=z;zh=Z").Split(';')
                 .Select(entry => entry.Split('='))
                 .Where(parts => parts.Length == 2)


Use nunit constraint assert

Use nunit constraint assert

--- osu.Framework.Tests/Localisation/ThreadCultureTest.cs
+++ osu.Framework.Tests/Localisation/ThreadCultureTest.cs
@@ -73,7 +73,7 @@
             });

             AddUntilStep("wait for query", () => cultures.Count == 3);
-            AddAssert($"culture is {name}", () => cultures.All(c => c.Name == name));
+            AddAssert($"culture is {name}", () => cultures.Select(c => c.Name), () => Is.All.EqualTo(name));
         }

         private void assertThreadCulture(string name)


Only delete buffer if initialised

Only delete buffer if initialised

--- osu.Framework/Graphics/OpenGL/Buffers/VertexBuffer.cs
+++ osu.Framework/Graphics/OpenGL/Buffers/VertexBuffer.cs
@@ -61,9 +61,11 @@
             if (IsDisposed)
                 return;

-            Unbind();
-
-            GLWrapper.DeleteBuffer(vboId);
+            if (isInitialised)
+            {
+                Unbind();
+                GLWrapper.DeleteBuffer(vboId);
+            }

             IsDisposed = true;
         }