Fixed tests for migration build

Fixed tests for migration build

--- test/SimpleSoft.Database.Migrator.Tests/MigratorHostBuilderTests.cs
+++ test/SimpleSoft.Database.Migrator.Tests/MigratorHostBuilderTests.cs
@@ -1,4 +1,6 @@
 using System;
+using System.Threading;
+using System.Threading.Tasks;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Logging;
@@ -34,7 +36,7 @@
                 builder.AddServiceConfigurator(param =>
                 {
                     param.ServiceCollection
-                        .AddScoped<IMigrationManager<IMigrationContext>>(k => null);
+                        .AddMigrationManager<TestMigrationManager, IMigrationContext>();
                 });
                 builder.Build<IMigrationContext>();
             }
@@ -54,9 +56,9 @@
                     parameter = param;
                 });
                 BuildAndIgnoreMissingMigrationManagerException(builder);
-            }
-
-            Assert.NotNull(parameter);
+
+                Assert.NotNull(parameter);
+            }
         }

         [Fact]
@@ -71,9 +73,9 @@
                 }))
             {
                 BuildAndIgnoreMissingMigrationManagerException(builder);
-            }
-
-            Assert.NotNull(parameter);
+
+                Assert.NotNull(parameter);
+            }
         }

         [Fact]
@@ -105,6 +107,90 @@
             var runCount = 0;

             using (var builder = new MigratorHostBuilder()
+                .ConfigureConfigurationBuilder(param =>
+                {
+                    ++runCount;
+                })
+                .ConfigureConfigurationBuilder(param =>
+                {
+                    ++runCount;
+                }))
+            {
+                BuildAndIgnoreMissingMigrationManagerException(builder);
+
+                Assert.NotEmpty(builder.ConfigurationBuilderHandlers);
+                Assert.Equal(2, builder.ConfigurationBuilderHandlers.Count);
+                Assert.Equal(2, runCount);
+            }
+        }
+
+        #endregion
+
+        #region Configuration
+
+        [Fact]
+        public void GivenAHostBuilderWhenAddingConfigurationConfiguratorThenParamMustNotBeNull()
+        {
+            ConfigurationConfiguratorParam parameter = null;
+
+            using (var builder = new MigratorHostBuilder())
+            {
+                builder.AddConfigurationConfigurator(param =>
+                {
+                    parameter = param;
+                });
+                BuildAndIgnoreMissingMigrationManagerException(builder);
+            }
+
+            Assert.NotNull(parameter);
+        }
+
+        [Fact]
+        public void GivenAHostBuilderWhenConfiguringConfigurationsThenParamMustNotBeNull()
+        {
+            ConfigurationConfiguratorParam parameter = null;
+
+            using (var builder = new MigratorHostBuilder()
+                .ConfigureConfigurations(param =>
+                {
+                    parameter = param;
+                }))
+            {
+                BuildAndIgnoreMissingMigrationManagerException(builder);
+            }
+
+            Assert.NotNull(parameter);
+        }
+
+        [Fact]
+        public void GivenAHostBuilderWhenAddingMultipleConfigurationConfiguratorThenAllHandlersAreRun()
+        {
+            var runCount = 0;
+
+            using (var builder = new MigratorHostBuilder())
+            {
+                builder.AddConfigurationConfigurator(param =>
+                {
+                    ++runCount;
+                });
+                builder.AddConfigurationConfigurator(param =>
+                {
+                    ++runCount;
+                });
+                BuildAndIgnoreMissingMigrationManagerException(builder);
+
+                Assert.NotEmpty(builder.ConfigurationHandlers);
+                Assert.Equal(2, builder.ConfigurationHandlers.Count);
+                Assert.Equal(2, runCount);
+            }
+        }
+
+        [Fact]
+        public void GivenAHostBuilderWhenConfiguringMultipleConfigurationsThenAllHandlersAreRun()
+        {
+            var runCount = 0;
+
+            using (var builder = new MigratorHostBuilder()
                 .ConfigureConfigurations(param =>
                 {
                     ++runCount;
@@ -116,96 +202,12 @@
             {
                 BuildAndIgnoreMissingMigrationManagerException(builder);

-                Assert.NotEmpty(builder.ConfigurationBuilderHandlers);
-                Assert.Equal(2, builder.ConfigurationBuilderHandlers.Count);
-                Assert.Equal(2, runCount);
-            }
-        }
-
-        #endregion
-
-        #region Configuration
-
-        [Fact]
-        public void GivenAHostBuilderWhenAddingConfigurationConfiguratorThenParamMustNotBeNull()
-        {
-            ConfigurationConfiguratorParam parameter = null;
-
-            using (var builder = new MigratorHostBuilder())
-            {
-                builder.AddConfigurationConfigurator(param =>
-                {
-                    parameter = param;
-                });
-                BuildAndIgnoreMissingMigrationManagerException(builder);
-            }
-
-            Assert.NotNull(parameter);
-        }
-
-        [Fact]
-        public void GivenAHostBuilderWhenConfiguringConfigurationsThenParamMustNotBeNull()
-        {
-            ConfigurationConfiguratorParam parameter = null;
-
-            using (var builder = new MigratorHostBuilder()
-                .ConfigureConfigurations(param =>
-                {
-                    parameter = param;
-                }))
-            {
-                BuildAndIgnoreMissingMigrationManagerException(builder);
-            }
-
-            Assert.NotNull(parameter);
-        }
-
-        [Fact]
-        public void GivenAHostBuilderWhenAddingMultipleConfigurationConfiguratorThenAllHandlersAreRun()
-        {
-            var runCount = 0;
-
-            using (var builder = new MigratorHostBuilder())
-            {
-                builder.AddConfigurationConfigurator(param =>
-                {
-                    ++runCount;
-                });
-                builder.AddConfigurationConfigurator(param =>
-                {
-                    ++runCount;
-                });
-                BuildAndIgnoreMissingMigrationManagerException(builder);
-
                 Assert.NotEmpty(builder.ConfigurationHandlers);
                 Assert.Equal(2, builder.ConfigurationHandlers.Count);
                 Assert.Equal(2, runCount);
             }
         }

-        [Fact]
-        public void GivenAHostBuilderWhenConfiguringMultipleConfigurationsThenAllHandlersAreRun()
-        {
-            var runCount = 0;
-
-            using (var builder = new MigratorHostBuilder()
-                .ConfigureConfigurations(param =>
-                {
-                    ++runCount;
-                })
-                .ConfigureConfigurations(param =>
-                {
-                    ++runCount;
-                }))
-            {
-                BuildAndIgnoreMissingMigrationManagerException(builder);
-
-                Assert.NotEmpty(builder.ConfigurationHandlers);
-                Assert.Equal(2, builder.ConfigurationHandlers.Count);
-                Assert.Equal(2, runCount);
-            }
-        }
-
         #endregion

         #region LoggerFactory
@@ -495,5 +497,40 @@
                 //  IMigrationManager<IMigrationContext>. Test porpuses only
             }
         }
+
+        // ReSharper disable once ClassNeverInstantiated.Local
+        private class TestMigrationManager : IMigrationManager<IMigrationContext>
+        {
+            #region Implementation of IMigrationManager<out IMigrationContext>
+
+            /// <inheritdoc />
+            public IMigrationContext Context { get; } = null;
+
+            /// <inheritdoc />
+            public Task PrepareDatabaseAsync(CancellationToken ct)
+            {
+                return Task.CompletedTask;
+            }
+
+            /// <inheritdoc />
+            public Task AddMigrationAsync(string migrationId, string className, CancellationToken ct)
+            {
+                return Task.CompletedTask;
+            }
+
+            /// <inheritdoc />
+            public Task<string> GetMostRecentMigrationIdAsync(CancellationToken ct)
+            {
+                return Task.FromResult(string.Empty);
+            }
+
+            /// <inheritdoc />
+            public Task<bool> RemoveMostRecentMigrationAsync(CancellationToken ct)
+            {
+                return Task.FromResult(false);
+            }
+
+            #endregion
+        }
     }
 }


C# 6 Cleanup

C# 6 Cleanup

--- tests/MiniProfiler.Tests/lib/HaackHttpSimulator/ReflectionHelper.cs
+++ tests/MiniProfiler.Tests/lib/HaackHttpSimulator/ReflectionHelper.cs
@@ -116,7 +116,7 @@

             MethodInfo method = type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static, null, paramTypes, null);
             if (method == null)
-                throw new ArgumentException($"Could not find a method with the name '{methodName}'", "method");
+                throw new ArgumentException($"Could not find a method with the name '{methodName}'", nameof(method));

             return (TReturn)method.Invoke(null, parameters);
         }
@@ -127,7 +127,7 @@

             MethodInfo method = source.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance, null, paramTypes, null);
             if (method == null)
-                throw new ArgumentException($"Could not find a method with the name '{methodName}'", "method");
+                throw new ArgumentException($"Could not find a method with the name '{methodName}'", nameof(method));

             return (TReturn)method.Invoke(source, parameters);
         }


TSI-1638 Ensure that Links without Url are rendered without hyperlink in Breadcrumb View.

--- webapp-net/Core/Areas/Core/Views/Navigation/Breadcrumb.cshtml
+++ webapp-net/Core/Areas/Core/Views/Navigation/Breadcrumb.cshtml
@@ -1,8 +1,9 @@
 @model NavigationLinks
-@if (Model.Items!=null && Model.Items.Count>0)
+@if ((Model.Items != null) && (Model.Items.Count > 0))
 {
     const int maxItems = 5;
-    int start = Model.Items.Count > maxItems ? Model.Items.Count - (maxItems) + 1 : 1;
+    int depth = Model.Items.Count;
+    int start = (depth > maxItems) ? (depth - maxItems + 1) : 1;

@@ -12,13 +13,21 @@
         {

...

         }
-        @for (int i = start; i < Model.Items.Count - 1; i++)
+        @for (int i = start; i < depth - 1; i++)
         {
-
@Model.Items[i].LinkText

+            Link link = Model.Items[i];
+            if (string.IsNullOrEmpty(link.Url))
+            {
+
@link.LinkText

+            }
+            else
+            {
+
@link.LinkText

+            }
         }
-        @if (Model.Items.Count>1)
-        {
-
@Model.Items[Model.Items.Count-1].LinkText

+        @if (depth > 1)
+        {
+
@Model.Items[depth - 1].LinkText

         }


Remove the runtime reflection for latebound models. Brings our dynamic benchmark in line with Razor.

--- Src/Veil/Helpers.cs
+++ Src/Veil/Helpers.cs
@@ -1,6 +1,8 @@
 using System;
 using System.Collections.Concurrent;
 using System.IO;
+using System.Reflection;
+using System.Reflection.Emit;

 namespace Veil
 {
@@ -68,14 +70,13 @@
                 var type = pair.Item1;

                 var property = type.GetProperty(pair.Item2);
-                if (property != null) return o => property.GetValue(o, null);
+                if (property != null) return CreatePropertyAccess(type, property);

                 var field = type.GetField(pair.Item2);
-                if (field != null) return o => field.GetValue(o);
+                if (field != null) return CreateFieldAccess(type, field);

                 var dictionaryType = type.GetDictionaryTypeWithKey<string>();
-                var getItem = dictionaryType.GetMethod("get_Item");
-                if (dictionaryType != null) return o => getItem.Invoke(o, new[] { pair.Item2 });
+                if (dictionaryType != null) return CreateDictionaryAccess(dictionaryType, pair.Item2);

                 return null;
             }));
@@ -83,5 +84,52 @@
             if (binder == null) return null;
             return binder(model);
         }
+
+        private static Func<object, object> CreatePropertyAccess(Type modelType, PropertyInfo property)
+        {
+            var getter = property.GetGetMethod();
+
+            var method = new DynamicMethod("LateBoundPropertyAccess_{0}_{1}".FormatInvariant(modelType.Name, property.Name), typeof(object), new[] { typeof(object) }, true);
+            var il = method.GetILGenerator();
+            il.Emit(OpCodes.Ldarg_0);
+            il.Emit(OpCodes.Castclass, modelType);
+
+            if (getter.IsVirtual)
+                il.Emit(OpCodes.Callvirt, getter);
+            else
+                il.Emit(OpCodes.Call, getter);
+            il.Emit(OpCodes.Ret);
+
+            return (Func<object, object>)method.CreateDelegate(typeof(Func<object, object>));
+        }
+
+        private static Func<object, object> CreateFieldAccess(Type modelType, FieldInfo field)
+        {
+            var method = new DynamicMethod("LateBoundFieldAccess_{0}_{1}".FormatInvariant(modelType.Name, field.Name), typeof(object), new[] { typeof(object) }, true);
+            var il = method.GetILGenerator();
+            il.Emit(OpCodes.Ldarg_0);
+            il.Emit(OpCodes.Castclass, modelType);
+            il.Emit(OpCodes.Ldfld, field);
+            il.Emit(OpCodes.Ret);
+
+            return (Func<object, object>)method.CreateDelegate(typeof(Func<object, object>));
+        }
+
+        private static Func<object, object> CreateDictionaryAccess(Type modelType, string key)
+        {
+            var getItem = modelType.GetMethod("get_Item");
+            var method = new DynamicMethod("LateBoundDictionaryAccess_{0}_{1}".FormatInvariant(modelType.Name, key), typeof(object), new[] { typeof(object) }, true);
+            var il = method.GetILGenerator();
+            il.Emit(OpCodes.Ldarg_0);
+            il.Emit(OpCodes.Castclass, modelType);
+            il.Emit(OpCodes.Ldstr, key);
+            if (getItem.IsVirtual)
+                il.Emit(OpCodes.Callvirt, getItem);
+            else
+                il.Emit(OpCodes.Call, getItem);
+            il.Emit(OpCodes.Ret);
+
+            return (Func<object, object>)method.CreateDelegate(typeof(Func<object, object>));
+        }
     }
 }


Further work

Further work

--- Stylet/StyletIoC.cs
+++ Stylet/StyletIoC.cs
@@ -115,9 +115,14 @@
             return this.GetAll(typeof(T), key).Cast<T>();
         }

-        private bool CanResolve(Type type)
-        {
-            return this.registrations.ContainsKey(type);
+        private bool CanResolve(Type type, string key)
+        {
+            bool canResolve = this.registrations.ContainsKey(type);
+            // Try calling GetExpression and see if that blows up...
+            // TODO actually catch the resulting exception
+            if (canResolve)
+                this.GetExpression(type, key);
+            return canResolve;
         }

         private Expression GetExpression(Type type, string key)
@@ -354,6 +359,12 @@
                 this.Key = key;
             }

+            private string KeyForParameter(ParameterInfo parameter)
+            {
+                var attribute = (InjectAttribute)parameter.GetCustomAttributes(typeof(InjectAttribute)).FirstOrDefault();
+                return attribute == null ? null : attribute.Key;
+            }
+
             public override Expression GetInstanceExpression(StyletIoC service)
             {
                 if (this.creationExpression != null)
@@ -369,14 +380,15 @@
                 else if (ctorsWithAttribute.Count == 1)
                 {
                     ctor = ctorsWithAttribute[0];
-                    var cantResolve = ctor.GetParameters().Where(p => !service.CanResolve(p.ParameterType) && !p.HasDefaultValue).FirstOrDefault();
+                    var key = ((InjectAttribute)ctorsWithAttribute[0].GetCustomAttribute(typeof(InjectAttribute), false)).Key;
+                    var cantResolve = ctor.GetParameters().Where(p => !service.CanResolve(p.ParameterType, key) && !p.HasDefaultValue).FirstOrDefault();
                     if (cantResolve != null)
                         throw new StyletIoCFindConstructorException(String.Format("Found a constructor with [Inject] on type {0}, but can't resolve parameter '{1}' (which doesn't have a default value).", this.Type.Name, cantResolve.Name));
                 }
                 else
                 {
                     ctor = this.Type.GetConstructors()
-                        .Where(c => c.GetParameters().All(p => service.CanResolve(p.ParameterType) || p.HasDefaultValue))
+                        .Where(c => c.GetParameters().All(p => service.CanResolve(p.ParameterType, this.KeyForParameter(p)) || p.HasDefaultValue))
                         .OrderByDescending(c => c.GetParameters().Count(p => !p.HasDefaultValue))
                         .FirstOrDefault();

@@ -391,12 +403,9 @@
                 // If there parameter's got an InjectAttribute with a key, use that key to resolve
                 var ctorParams = ctor.GetParameters().Select(x =>
                 {
-                    if (service.CanResolve(x.ParameterType))
+                    var key = this.KeyForParameter(x);
+                    if (service.CanResolve(x.ParameterType, key))
                     {
-                        string key = null;
-                        var attribute = x.GetCustomAttributes(typeof(InjectAttribute), false).FirstOrDefault();
-                        if (attribute != null)
-                            key = ((InjectAttribute)attribute).Key;
                         try
                         {
                             return service.GetExpression(x.ParameterType, key);


changed empty string to property

changed empty string to property

--- TddToolkit/Empty.cs
+++ TddToolkit/Empty.cs
@@ -30,9 +30,12 @@
       return List<T>();
     }

-    public static string String()
+    public static string String
     {
-      return string.Empty;
+      get
+      {
+        return string.Empty;
+      }
     }

   }


try threaded

try threaded

--- Tests/TestConfig.cs
+++ Tests/TestConfig.cs
@@ -1,3 +0,0 @@
-using Xunit;
-
-[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true)]


Check that in compiler

Check that in compiler

--- VKPlugin/Measure.cs
+++ VKPlugin/Measure.cs
@@ -18,6 +18,8 @@

         int _userCount = 1;
         Thread _playerTypeIsAlive;
+
+        Dictionary<string, Thread> TypeIsAliveThreads = new Dictionary<string, Thread>();

         // Each type is a independent skin.
         internal enum MeasureType
@@ -416,7 +418,9 @@
         internal void TypeIsAlive(API api, MeasureType type, Thread thread)
         {
             // Сделать его статичным, поток полностью сюда кинуть. Имя потока зависит от type.
-
+
+            TypeIsAliveThreads.Add(type.ToString(), new Thread());
+
             if (thread == null || !thread.IsAlive)
             {
                 thread = new Thread(delegate()


Added comment about constant string arrays

--- VM12/T12/Emitter.cs
+++ VM12/T12/Emitter.cs
@@ -1561,6 +1561,12 @@

                             var baseType = (constDirective.Type as ASTDereferenceableType).DerefType;

+                            // FIXME: Support arrays of strings!!
+                            // We need to somehow make a list of string procs before we create the
+                            // array proc.
+                            // And the array proc should be a list of references to
+                            // the string procs
+
                             int index = 1;
                             builder.Append("\t");
                             foreach (var lit in arrayLitteral.Values)


Update Label.cs

Update Label.cs

--- VoidEngine/Label.cs
+++ VoidEngine/Label.cs
@@ -31,16 +31,16 @@
             this.position = position;
         }

-        public virtual void Update(GameTime gameTime, string text)
+        public virtual void Update(GameTime gameTime, string text2)
         {
-            this.text = text;
+            text = text2;
         }

         public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
         {
             Vector2 FontOrigin = texture.MeasureString(text) / 2;
             // Draw the string
-            spriteBatch.DrawString(texture, text, position, Color.White, 0, FontOrigin, 0.5f, SpriteEffects.None, 0.5f);
+            spriteBatch.DrawString(texture, text, position, Color.White, 0, new Vector2(0,0), 0.5f, SpriteEffects.None, 0.5f);
         }
     }
 }


feat: 数据字典的枚举器默认只返回已变更的属性集。 :chart:

feat: 数据字典的枚举器默认只返回已变更的属性集。 :chart:

--- src/Data/DataDictionary.cs
+++ src/Data/DataDictionary.cs
@@ -209,6 +209,9 @@
 				return false;
 			}

+			if(_data is Zongsoft.Common.ModelBase)
+				return ((Zongsoft.Common.ModelBase)_data).GetChangedProperties().TryGetValue(key, out result);
+
 			if(_values.TryGetValue(key, out result))
 				return true;

@@ -335,12 +338,66 @@

 			return true;
 		}
-
-		/// <summary>
-		/// 获取有效的数据字典的数据属性集。
-		/// </summary>
-		/// <returns>返回的有效（即发生变化的）的数据属性集。</returns>
-		public IEnumerable<KeyValuePair<string, object>> GetEntries()
+		#endregion
+
+		#region 接口实现
+		bool ICollection<KeyValuePair<string, object>>.IsReadOnly
+		{
+			get
+			{
+				return _properties != null;
+			}
+		}
+
+		bool IDictionary<string, object>.ContainsKey(string key)
+		{
+			return this.Contains(key);
+		}
+
+		void IDictionary<string, object>.Add(string key, object value)
+		{
+			this.Set(key, value);
+		}
+
+		bool IDictionary<string, object>.Remove(string key)
+		{
+			throw new NotSupportedException();
+		}
+
+		bool IDictionary<string, object>.TryGetValue(string key, out object value)
+		{
+			return this.TryGet(key, out value);
+		}
+
+		void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> item)
+		{
+			this.Set(item.Key, item.Value);
+		}
+
+		void ICollection<KeyValuePair<string, object>>.Clear()
+		{
+			throw new NotSupportedException();
+		}
+
+		bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
+		{
+			if(item.Key == null)
+				return false;
+
+			return this.Contains(item.Key);
+		}
+
+		void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
+		{
+			throw new NotImplementedException();
+		}
+
+		bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> item)
+		{
+			throw new NotSupportedException();
+		}
+
+		public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
 		{
 			if(_properties != null)
 			{
@@ -348,12 +405,9 @@

 				if(model != null)
 				{
-					foreach(var name in model.GetChangedPropertyNames())
-					{
-						var property = _properties[name];
-
-						if(property != null)
-							yield return new KeyValuePair<string, object>(name, _values.GetOrAdd(name, key => property.GetValue(_data)));
+					foreach(var property in model.GetChangedProperties())
+					{
+						yield return property;
 					}
 				}
 				else
@@ -363,100 +417,6 @@
 						yield return new KeyValuePair<string, object>(property.Name,
 																	  _values.GetOrAdd(property.Name, key => property.GetValue(_data)));
 					}
-				}
-			}
-			else
-			{
-				if(_data is IDictionary)
-				{
-					foreach(var key in ((IDictionary)_data).Keys)
-					{
-						yield return new KeyValuePair<string, object>(key == null ? null : key.ToString(), ((IDictionary)_data)[key]);
-					}
-				}
-				else if(_data is IDictionary<string, object>)
-				{
-					foreach(var key in ((IDictionary<string, object>)_data).Keys)
-					{
-						yield return new KeyValuePair<string, object>(key, ((IDictionary<string, object>)_data)[key]);
-					}
-				}
-				else if(_data is IDictionary<string, string>)
-				{
-					foreach(var key in ((IDictionary<string, string>)_data).Keys)
-					{
-						yield return new KeyValuePair<string, object>(key, ((IDictionary<string, string>)_data)[key]);
-					}
-				}
-			}
-		}
-		#endregion
-
-		#region 接口实现
-		bool ICollection<KeyValuePair<string, object>>.IsReadOnly
-		{
-			get
-			{
-				return _properties != null;
-			}
-		}
-
-		bool IDictionary<string, object>.ContainsKey(string key)
-		{
-			return this.Contains(key);
-		}
-
-		void IDictionary<string, object>.Add(string key, object value)
-		{
-			this.Set(key, value);
-		}
-
-		bool IDictionary<string, object>.Remove(string key)
-		{
-			throw new NotSupportedException();
-		}
-
-		bool IDictionary<string, object>.TryGetValue(string key, out object value)
-		{
-			return this.TryGet(key, out value);
-		}
-
-		void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> item)
-		{
-			this.Set(item.Key, item.Value);
-		}
-
-		void ICollection<KeyValuePair<string, object>>.Clear()
-		{
-			throw new NotSupportedException();
-		}
-
-		bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
-		{
-			if(item.Key == null)
-				return false;
-
-			return this.Contains(item.Key);
-		}
-
-		void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
-		{
-			throw new NotImplementedException();
-		}
-
-		bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> item)
-		{
-			throw new NotSupportedException();
-		}
-
-		public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
-		{
-			if(_properties != null)
-			{
-				foreach(PropertyDescriptor property in _properties)
-				{
-					yield return new KeyValuePair<string, object>(property.Name,
-																  _values.GetOrAdd(property.Name, key => property.GetValue(_data)));
 				}
 			}
 			else


Check if milestone exists

Check if milestone exists

--- src/MilestonesExtension.cs
+++ src/MilestonesExtension.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Linq;
 using ICities;
 using UnlockAllWondersAndLandmarks.OptionsFramework;

@@ -134,7 +135,12 @@

         private void UnlockBuilding(string buildingName)
         {
-            milestonesManager.UnlockMilestone($"{buildingName} Requirements");
+            var milestone = $"{buildingName} Requirements";
+
+            if (milestonesManager.EnumerateMilestones().Contains(milestone))
+            {
+                milestonesManager.UnlockMilestone(milestone);
+            }
         }

         public override int OnGetPopulationTarget(int originalTarget, int scaledTarget)


MInor change

MInor change

--- WebApiController.cs
+++ WebApiController.cs
@@ -43,7 +43,7 @@
                 }

                 var dir = new DirectoryInfo(photodir);
-                var files = dir.GetFiles("*.jpg").Select(x => x.Name).Take(6);
+                var files = dir.GetFiles("*.jpg").Select(x => x.Name).Take(10);

                 return context.JsonResponse(files);
             }
@@ -59,7 +59,7 @@
             try
             {
                 var dir = new DirectoryInfo(photodir);
-                var files = dir.GetFiles("*.jpg").Select(x => x.Name).Take(6);
+                var files = dir.GetFiles("*.jpg").Select(x => x.Name).Take(10);

                 return context.JsonResponse(files);
             }


fix bad refs.Remove() calls due to ArraySchema#GetByIndex issue. #133

--- Assets/Plugins/Colyseus/Serializer/Schema/Types/ArraySchema.cs
+++ Assets/Plugins/Colyseus/Serializer/Schema/Types/ArraySchema.cs
@@ -38,34 +38,31 @@

 		public object GetIndex(int index)
 		{
-			int dynamicIndex;
-
-			Indexes.TryGetValue(index, out dynamicIndex);
-
-			return dynamicIndex;
+			return (Indexes.ContainsKey(index))
+				? Indexes[index]
+				: -1;
 		}

 		public object GetByIndex(int index)
 		{
-			//
-			// FIXME: GetByIndex should be O(1)
-			//
-			var keys = new List<int>(Items.Keys);
+			int dynamicIndex = (int) GetIndex(index);

-			int dynamicIndex = (index < keys.Count)
-				? keys[index]
-				: -1;
+			if (dynamicIndex != -1)
+			{
+				T value;
+				Items.TryGetValue(dynamicIndex, out value);
+				return value;

-			T value;
-			Items.TryGetValue(dynamicIndex, out value);
-
-			return value;
+			} else
+			{
+				return null;
+			}
 		}

 		public void DeleteByIndex(int index)
 		{
-			// TODO:
-			Items.Remove(index);
+			Items.Remove((int)GetIndex(index));
+			Indexes.Remove(index);
 		}

 		public void Clear(ReferenceTracker refs = null)
@@ -122,7 +119,7 @@

 		public T this[int index]
 		{
-			get { return (T) GetByIndex(index); }
+			get { return (T) GetByVirtualIndex(index); }
 			set { Items[index] = value; }
 		}

@@ -180,5 +177,22 @@
 		{
 			OnRemove?.Invoke((T)item, (int)index);
 		}
+
+		protected T GetByVirtualIndex (int index)
+		{
+			//
+			// FIXME: should be O(1)
+			//
+			var keys = new List<int>(Items.Keys);
+
+			int dynamicIndex = (index < keys.Count)
+				? keys[index]
+				: -1;
+
+			T value;
+			Items.TryGetValue(dynamicIndex, out value);
+
+			return value;
+		}
 	}
 }


remove PictureViewModel

remove PictureViewModel

--- AstroPhotoGallery/AstroPhotoGallery/Models/PictureViewModel.cs
+++ AstroPhotoGallery/AstroPhotoGallery/Models/PictureViewModel.cs
@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Web;
-
-namespace AstroPhotoGallery.Models
-{
-    public class PictureViewModel
-    {
-        [Key]
-        public int Id { get; set; }
-
-        [Required]
-        [StringLength(50)]
-        [DisplayName("Title")]
-        public string PicTitle { get; set; }
-
-        [Required]
-        [DisplayName("Description")]
-        public string PicDescription { get; set; }
-
-        [ForeignKey("PicUploader")]
-        public string PicUploaderId { get; set; }
-
-        public string ImagePath { get; set; }
-
-    }
-}


Update RegisteredAssembliesVersion.cs

Update RegisteredAssembliesVersion.cs

--- CbxSw.RegisteredAssemblyVersion/RegisteredAssembliesVersion.cs
+++ CbxSw.RegisteredAssemblyVersion/RegisteredAssembliesVersion.cs
@@ -21,8 +21,8 @@

 		protected override string Description => "Shows the version of the registered assemblies.";
 		protected override string Title => "Assembly versions";
-		protected override string VendorName => "Delaware consulting";
-		protected override string VendorUrl => "http://digital.delawareconsulting.com/";
+		protected override string VendorName => "Checkbox software";
+		protected override string VendorUrl => "http://www.checkboxsoftware.net/";

 		protected override MasterResetItem[] GetMasterResetItems()
 		{
@@ -105,4 +105,4 @@
 			});
 		}
 	}
-}+}


Added SkipLastN

Added SkipLastN

--- Clifton.Core/Clifton.Core.ExtensionMethods/ExtensionMethods.cs
+++ Clifton.Core/Clifton.Core.ExtensionMethods/ExtensionMethods.cs
@@ -1495,5 +1495,23 @@

             return ret;
         }
+
+        // From: https://stackoverflow.com/questions/1779129/how-to-take-all-but-the-last-element-in-a-sequence-using-linq
+        public static IEnumerable<T> SkipLastN<T>(this IEnumerable<T> source, int n)
+        {
+            var it = source.GetEnumerator();
+            bool hasRemainingItems = false;
+            var cache = new Queue<T>(n + 1);
+
+            do
+            {
+                if (hasRemainingItems = it.MoveNext())
+                {
+                    cache.Enqueue(it.Current);
+                    if (cache.Count > n)
+                        yield return cache.Dequeue();
+                }
+            } while (hasRemainingItems);
+        }
     }
 }


more tweaks

more tweaks

--- src/StackExchange.Alexa.cs
+++ src/StackExchange.Alexa.cs
@@ -157,7 +157,7 @@
         	sb.AppendLine($"
Here's the full question:
");
         	sb.AppendLine($"
{question.bodyNoHtml}
");
         	sb.AppendLine("<break time=\"2s\"/>");
-        	sb.AppendLine("
Please say: cast upvote, cast downvote, answers, next question, or I'm done.
");
+        	sb.AppendLine("
Please say: upvote, downvote, answers, next question, or I'm done.
");

         	return CreateResponse(sb.ToString(), false);
         }


Move version check earlier (#6674)

Move version check earlier (#6674)

Fixes #6659

The version check was previously after having deserialized everything else. This doesn't make sense and can lead to errors. In this PR, I moved it up.

--- src/Tasks/StateFileBase.cs
+++ src/Tasks/StateFileBase.cs
@@ -77,8 +77,17 @@
                     using (FileStream s = File.OpenRead(stateFile))
                     {
                         using var translator = BinaryTranslator.GetReadTranslator(s, buffer: null);
+
                         byte version = 0;
                         translator.Translate(ref version);
+                        // If the version is wrong, log a message not a warning. This could be a valid cache with the wrong version preventing correct deserialization.
+                        // For the latter case, internals may be unexpectedly null.
+                        if (version != CurrentSerializationVersion)
+                        {
+                            log.LogMessageFromResources("General.CouldNotReadStateFileMessage", stateFile, log.FormatResourceString("General.IncompatibleStateFileType"));
+                            return null;
+                        }
+
                         var constructors = requiredReturnType.GetConstructors();
                         foreach (var constructor in constructors)
                         {
@@ -88,18 +97,8 @@
                                 retVal = constructor.Invoke(new object[] { translator }) as StateFileBase;
                             }
                         }
-
-                        // If retVal is still null or the version is wrong, log a message not a warning. This could be a valid cache with the wrong version preventing correct deserialization.
-                        // For the latter case, internals may be unexpectedly null.
-                        if (retVal == null || version != CurrentSerializationVersion)
-                        {
-                            // When upgrading to Visual Studio 2008 and running the build for the first time the resource cache files are replaced which causes a cast error due
-                            // to a new version number on the tasks class. "Unable to cast object of type 'Microsoft.Build.Tasks.SystemState' to type 'Microsoft.Build.Tasks.StateFileBase".
-                            // If there is an invalid cast, a message rather than a warning should be emitted.
-                            log.LogMessageFromResources("General.CouldNotReadStateFileMessage", stateFile, log.FormatResourceString("General.IncompatibleStateFileType"));
-                            return null;
-                        }
-                        else if (!requiredReturnType.IsInstanceOfType(retVal))
+
+                        if (retVal == null || !requiredReturnType.IsInstanceOfType(retVal))
                         {
                             log.LogMessageFromResources("General.CouldNotReadStateFileMessage", stateFile,
                                 log.FormatResourceString("General.IncompatibleStateFileType"));


force https

force https

--- src/TerrainFlow/Startup.cs
+++ src/TerrainFlow/Startup.cs
@@ -64,11 +64,17 @@
             app.Use(async (context, next) =>
             {
                 if (context.Request.Headers.ContainsKey("X-Forwarded-Proto"))
-                    Console.WriteLine("X-Forwarded-Proto: " + context.Request.Headers["X-Forwarded-Proto"][0]);
-
-                if (context.Request.Headers.ContainsKey("X-Forwarded-For"))
-                    Console.WriteLine("X-Forwarded-For: " + context.Request.Headers["X-Forwarded-For"][0]);
-                await next.Invoke();
+                {
+                    if (string.Equals(context.Request.Headers["X-Forwarded-Proto"][0], "https"))
+                    {
+                        await next();
+                    }
+                }
+                else
+                {
+                    var withHttps = "https://" + context.Request.Host + context.Request.Path;
+                    context.Response.Redirect(withHttps);
+                }
             });

             // Add the platform handler to the request pipeline.


Refactor: new C# features used

Refactor: new C# features used


开始添加聊天支持

开始添加聊天支持

--- 软件系统客户端模版/UIControls/OnlineChatRender.Designer.cs
+++ 软件系统客户端模版/UIControls/OnlineChatRender.Designer.cs
@@ -28,18 +28,61 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
             this.SuspendLayout();
+            //
+            // richTextBox1
+            //
+            this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.richTextBox1.Location = new System.Drawing.Point(1, 2);
+            this.richTextBox1.Name = "richTextBox1";
+            this.richTextBox1.Size = new System.Drawing.Size(633, 373);
+            this.richTextBox1.TabIndex = 0;
+            this.richTextBox1.Text = "";
+            //
+            // textBox1
+            //
+            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.textBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.textBox1.Location = new System.Drawing.Point(3, 401);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(629, 26);
+            this.textBox1.TabIndex = 1;
+            //
+            // label1
+            //
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(-1, 381);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(74, 17);
+            this.label1.TabIndex = 2;
+            this.label1.Text = "Enter键发送";
             //
             // OnlineChatRender
             //
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.richTextBox1);
             this.Name = "OnlineChatRender";
             this.Size = new System.Drawing.Size(635, 429);
             this.ResumeLayout(false);
+            this.PerformLayout();

         }

         #endregion
+
+        private System.Windows.Forms.RichTextBox richTextBox1;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.Label label1;
     }
 }


Search implemented.

Search implemented.

--- Assets/GameToolkit/Localization/Scripts/Editor/LocalizationWindow.cs
+++ Assets/GameToolkit/Localization/Scripts/Editor/LocalizationWindow.cs
@@ -100,7 +100,7 @@

         private void SearchBarView(Rect rect)
         {
-            m_SearchField.OnGUI(rect, "");
+            m_TreeView.searchString = m_SearchField.OnGUI(rect, m_TreeView.searchString);
         }

         private void BottomToolbarView(Rect rect)


ConcurrentDictionary review

ConcurrentDictionary review

--- Framework.Core/System/Collections/Concurrent/ConcurrentDictionary.cs
+++ Framework.Core/System/Collections/Concurrent/ConcurrentDictionary.cs
@@ -1,4 +1,6 @@
 #if LESSTHAN_NET40 || NETSTANDARD1_0
+
+#pragma warning disable RECS0017 // Possible compare of value type with 'null'

 using System.Collections.Generic;
 using Theraot.Collections;


rewrite condition for removing transaction from the broadcaster

--- NTumbleBit.TumblerServer/Services/RPCServices/RPCBroadcastService.cs
+++ NTumbleBit.TumblerServer/Services/RPCServices/RPCBroadcastService.cs
@@ -118,21 +118,12 @@
 					return false;
 				}
 				var error = ex.RPCResult.Error.Message;
-				if(error.EndsWith("non-final", StringComparison.OrdinalIgnoreCase))
+				if(ex.RPCResult.Error.Code != RPCErrorCode.RPC_TRANSACTION_ALREADY_IN_CHAIN &&
+				   !error.EndsWith("bad-txns-inputs-spent", StringComparison.OrdinalIgnoreCase) &&
+				   !error.EndsWith("txn-mempool-conflict", StringComparison.OrdinalIgnoreCase))
+				{
 					remove = false;
-				else
-				{
-					if(ex.RPCResult.Error.Code == RPCErrorCode.RPC_TRANSACTION_ALREADY_IN_CHAIN)
-					{
-					}
-					if(error.EndsWith("bad-txns-inputs-spent", StringComparison.OrdinalIgnoreCase))
-					{
-					}
-					else if(!error.EndsWith("txn-mempool-conflict", StringComparison.OrdinalIgnoreCase))
-					{
-						remove = false;
-					}
-				}
+				}
 			}

 			if(remove)


set total

set total

--- Agency.cs
+++ Agency.cs
@@ -14,15 +14,15 @@
         static HashSet<Dog> GetAllDogs()
         {
             var totalDogs = 999;
-            var totalFleas = 10000;
+            var totalFleas = 1000;
             var dogs = new HashSet<Dog>();
             for (int i = 1; i <= totalDogs; i++)
             {
-                var dogName = Rnd.Next(999).ToString();
+                var dogName = Rnd.Next(totalDogs).ToString();
                 Dog dog = new Dog { Name = dogName };
                 for(int h = 1; h <= totalFleas; h ++)
                 {
-                    var fleaName = Rnd.Next(99).ToString();
+                    var fleaName = Rnd.Next(totalFleas).ToString();
                     Flea flea = new Flea { Name = fleaName };
                     dog.AddFlea(flea);
                 }


Removed Discharge Coefficient from the wheel loader interface for previous instances to work with the new combustion engine in AGX Dynamics.

--- AGXUnity/Model/WheelLoader.cs
+++ AGXUnity/Model/WheelLoader.cs
@@ -111,21 +111,6 @@
         m_throttleBore = value;
         if ( Engine != null )
           Engine.setThrottleBore( m_throttleBore );
-      }
-    }
-
-    [SerializeField]
-    private float m_dischargeCoefficient = 0.7f;
-
-    [ClampAboveZeroInInspector( true )]
-    public float DischargeCoefficient
-    {
-      get { return m_dischargeCoefficient; }
-      set
-      {
-        m_dischargeCoefficient = Mathf.Min( value, 1.0f );
-        if ( Engine != null )
-          Engine.setDischargeCoefficient( m_dischargeCoefficient );
       }
     }

@@ -430,7 +415,10 @@

       PowerLine = new agxPowerLine.PowerLine();
       PowerLine.setName( name );
+
       Engine = new agxDriveTrain.CombustionEngine( InletVolume );
+      Engine.setDischargeCoefficient( 0.2f );
+
       TorqueConverter = new agxDriveTrain.TorqueConverter();
       GearBox = new agxDriveTrain.GearBox();
       Differentials[ (int)DifferentialLocation.Rear ]   = new agxDriveTrain.Differential();
@@ -477,24 +465,6 @@
       Differentials[ (int)DifferentialLocation.Rear ].connect( rearDiffRearRightWheelShaft );
       rearDiffRearLeftWheelShaft.connect( m_actuators[ (int)WheelLocation.LeftRear ] );
       rearDiffRearRightWheelShaft.connect( m_actuators[ (int)WheelLocation.RightRear ] );
-
-      var munu = new agx.RealPairVector( new agx.RealPair[]
-      {
-        new agx.RealPair( -0.0001, 0.00 ),
-        new agx.RealPair( 0.00001, 0.50 ),
-        new agx.RealPair( 0.00011, 2.00 ),
-        new agx.RealPair( 0.00100, 2.00 ),
-        new agx.RealPair( 0.20000, 1.10 ),
-        new agx.RealPair( 0.40000, 1.15 ),
-        new agx.RealPair( 0.60000, 1.05 ),
-        new agx.RealPair( 0.80000, 1.01 ),
-        new agx.RealPair( 0.90000, 0.99 ),
-        new agx.RealPair( 1.00000, 0.98 ),
-        new agx.RealPair( 1.00100, 0.98 )
-      } );
-      TorqueConverter.setMuTable( munu );
-      TorqueConverter.setMaxMultiplication( 2.0 );
-      TorqueConverter.setPumpTorqueReferenceRPM( 1000.0 );

       GearBox.setGearRatios( new agx.RealVector( new double[] { GearRatios.x, GearRatios.y } ) );
       GearBox.gearUp();


throw exception when not enum (BsEnumDisplayName)


fixed a typo

fixed a typo

--- CH01/ShoppyExample/Program.cs
+++ CH01/ShoppyExample/Program.cs
@@ -69,8 +69,8 @@
             {
                 IObservable<Connectivity> myConnectivity = Observable.Empty<Connectivity>();
                 IObservable<IEnumerable<Discount>> newDiscounts =
-                    from connectiviy in myConnectivity
-                    where connectiviy == Connectivity.Online
+                    from connectivity in myConnectivity
+                    where connectivity == Connectivity.Online
                     from discounts in GetDiscounts()
                     select discounts;


SaveAs read-only file issue fixed

SaveAs read-only file issue fixed

--- ClosedXML/Excel/XLWorkbook.cs
+++ ClosedXML/Excel/XLWorkbook.cs
@@ -498,7 +498,10 @@
             else if (_loadSource == XLLoadSource.File)
             {
                 if (String.Compare(_originalFile.Trim(), file.Trim(), true) != 0)
+                {
                     File.Copy(_originalFile, file, true);
+                    File.SetAttributes(file, FileAttributes.Normal);
+                }

                 CreatePackage(file, GetSpreadsheetDocumentType(file), options);
             }


增加一些下载助手函数

增加一些下载助手函数

--- CommonLang/http/HttpHelper.cs
+++ CommonLang/http/HttpHelper.cs
@@ -10,6 +10,8 @@
 using System.Text;
 using System.Net;
 using System.IO;
+using System.Collections.Generic;
+using System.IO.Compression;

 namespace CommonLang.http
 {
@@ -44,10 +46,14 @@
 			string str = string.Empty;
 			try
 			{
-				WebRequest request = WebRequest.Create(url);
-				request.Timeout = 30000;
+				HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
+				request.Timeout = 5000;
+				request.UserAgent = "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";
+				request.Accept = "*/*";
+				request.KeepAlive = true;
+				request.Headers.Add("Accept-Language", "zh-cn,en-us;q=0.5");
 				//request.Headers.Set("Pragma", "no-cache");
-				request.Proxy = getProxy("10.98.65.9:8080", "hhky\\lxk_8876", "lxk2011");
+				//request.Proxy = getProxy("10.98.65.9:8080", "hhky\\lxk_8876", "lxk2011");
 				WebResponse response = request.GetResponse();
 				Stream streamReceive = response.GetResponseStream();
 				Encoding enc = Encoding.GetEncoding(encoding);
@@ -59,5 +65,107 @@
 			{ }
 			return str;
 		}
+
+		public static void download(string url,string filename,string refer)
+		{
+			System.Net.HttpWebRequest req = System.Net.HttpWebRequest.Create(url) as System.Net.HttpWebRequest;
+			req.AllowAutoRedirect = true;
+			req.Referer = refer;
+			req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13";
+			//req.Headers.Add("Accept-Language","zh-cn,en-us;q=0.8,zh-hk;q=0.6,ja;q=0.4,zh;q=0.2");
+			System.Net.HttpWebResponse res = req.GetResponse() as System.Net.HttpWebResponse;
+			System.IO.Stream stream = res.GetResponseStream();
+			byte[] buffer = new byte[32 * 1024];
+			int bytesProcessed = 0;
+			System.IO.FileStream fs = System.IO.File.Create(filename);
+			int bytesRead;
+			do
+			{
+				bytesRead = stream.Read(buffer, 0, buffer.Length);
+				fs.Write(buffer, 0, bytesRead);
+				bytesProcessed += bytesRead;
+			}
+			while (bytesRead > 0);
+			fs.Flush();
+			fs.Close();
+			res.Close();
+		}
+
+		public static Dictionary<string, object> getTextWithGzip(string webUrl, CookieContainer cookieContainer, Encoding encoding, string refer, WebProxy webProxy)
+		{
+			Dictionary<string, object> ret = new Dictionary<string, object>();
+			HttpWebRequest webrequest = null;
+			string html;
+			webrequest = WebRequest.Create(webUrl) as HttpWebRequest;
+
+			webrequest.ServicePoint.Expect100Continue = false;
+			webrequest.ServicePoint.UseNagleAlgorithm = false;
+			webrequest.ServicePoint.ConnectionLimit = 65500;
+			webrequest.AllowWriteStreamBuffering = false;
+			if (webProxy!=null)
+			{
+				webrequest.Proxy = webProxy;
+			}
+			else
+			{
+				webrequest.Proxy = GlobalProxySelection.GetEmptyWebProxy();
+			}
+			if (!String.IsNullOrEmpty(refer))
+			{
+				webrequest.Referer = refer;
+			}
+			else
+			{
+				webrequest.Referer = webUrl;
+			}
+			webrequest.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
+			webrequest.CookieContainer = cookieContainer;
+			webrequest.Timeout = 5000;
+			webrequest.UserAgent = "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";
+			webrequest.Accept = "*/*";
+			webrequest.KeepAlive = true;
+			webrequest.Headers.Add("Accept-Language", "zh-cn,en-us;q=0.5");
+
+			using (HttpWebResponse response = (HttpWebResponse)webrequest.GetResponse())
+			{
+
+				if (response.ContentEncoding.ToLower().Contains("gzip"))
+				{
+					using (GZipStream stream = new GZipStream(response.GetResponseStream(), CompressionMode.Decompress))
+					{
+						using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
+						{
+							html = reader.ReadToEnd();
+						}
+					}
+				}
+				else if (response.ContentEncoding.ToLower().Contains("deflate"))
+				{
+					using (DeflateStream stream = new DeflateStream(response.GetResponseStream(), CompressionMode.Decompress))
+					{
+						using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
+						{
+							html = reader.ReadToEnd();
+						}
+
+					}
+				}
+				else
+				{
+					using (Stream stream = response.GetResponseStream())
+					{
+						using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
+						{
+							html = reader.ReadToEnd();
+						}
+					}
+				}
+			}
+
+			ret["cookieContainer"] = cookieContainer;
+			ret["html"] = html;
+			return ret;
+		}
+
 	}
 }


make rng reproducible

make rng reproducible

--- CompatBot/Commands/Fortune.cs
+++ CompatBot/Commands/Fortune.cs
@@ -30,9 +30,9 @@
         public async Task ShowFortune(CommandContext ctx)
         {
             var prefix = DateTime.UtcNow.ToString("yyyyMMdd");
-            using var hmac = new System.Security.Cryptography.HMACSHA256();
+            using var sha256 = System.Security.Cryptography.SHA256.Create();
             var data = Encoding.UTF8.GetBytes(prefix + ctx.User.Id.ToString("x16"));
-            var hash = hmac.ComputeHash(data);
+            var hash = sha256.ComputeHash(data);
             var seed = BitConverter.ToInt32(hash, 0);
             var rng = new Random(seed);
             await using var db = new ThumbnailDb();


Cache JsonSerializerSettings

Cache JsonSerializerSettings

Core 1.0 made the default camelCase so you don't have to use a resolver
but if you just pass in Format.Indented, for example, it reverts to
TitleCase. So, we still can't get rid of the CustomContractResolver.

--- Controllers/BaseController.cs
+++ Controllers/BaseController.cs
@@ -61,19 +61,17 @@
 			}
 		}

-		private static JsonSerializerSettings GetSettings() {
-			return new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = CustomContractResolver.Instance };
-		}
+		private static JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = CustomContractResolver.Instance };

 		private IActionResult ApiResponse(object result) {
 			if (result is ValidApiResponse || result is InvalidApiResponse) {
-				return Json(result, GetSettings());
+				return Json(result, jsonSerializerSettings);
 			}
-			return Json(new ValidApiResponse(result), GetSettings());
+			return Json(new ValidApiResponse(result), jsonSerializerSettings);
 		}

 		private IActionResult ExceptionalApiResponse(Exception ex) {
-			return Json(new InvalidApiResponse(ex), GetSettings());
+			return Json(new InvalidApiResponse(ex), jsonSerializerSettings);
 		}
 	}
 }


get roles by level using queryable.

get roles by level using queryable.

--- Purchasing.Web/Controllers/Dev/JandJWorkgroupManagementController.cs
+++ Purchasing.Web/Controllers/Dev/JandJWorkgroupManagementController.cs
@@ -396,11 +396,12 @@
                 Workgroup = workgroup
             };

-            viewModel.Roles = new List<Role>();
-            viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.AccountManager));
-            viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.Purchaser));
-            viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.Approver));
-            viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.Requester));
+            //viewModel.Roles = new List<Role>();
+            //viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.AccountManager));
+            //viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.Purchaser));
+            //viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.Approver));
+            //viewModel.Roles.Add(roleRepository.GetNullableById(Role.Codes.Requester));
+            viewModel.Roles = roleRepository.Queryable.Where(a => a.Level >= 1 && a.Level <= 4).ToList();
             return viewModel;
         }


Data access layer modfied

Data access layer modfied

--- DataAccessLayer/DataAccess.cs
+++ DataAccessLayer/DataAccess.cs
@@ -93,6 +93,7 @@
                 {
                     cmd.Parameters.AddRange(parameters);
                 }
+
                 cmd.CommandType = CommandType.StoredProcedure;
                 SqlDataAdapter da = new SqlDataAdapter(cmd);
                 DataTable dt = new DataTable();


Fixed layout problem in ticket preview. Closes #100.

git-svn-id: f68c6b3b1dcd5d00a2560c384475aaef3bc99487@844 af82e41b-90c4-0310-8c96-b1721e28e2e2

--- templates/ticket.cs
+++ templates/ticket.cs
@@ -182,7 +182,7 @@
             rows="10" cols="78" style="width: 97%; max-width: 694px"><?cs var:ticket.comment ?></textarea>
   <?cs call:wiki_toolbar('comment') ?>
    <?cs if ticket.comment_preview ?>
-
+
      <fieldset>
      <legend>Comment Preview</legend>
        <?cs var:ticket.comment_preview ?>
@@ -195,7 +195,7 @@

 Summary:
-<input id="summary" type="text" name="summary" class="textwidget" size="80"
+<input id="summary" type="text" name="summary" class="textwidget" size="70"
        value="<?cs var:ticket.summary ?>" />
 <?cs if $trac.acl.TICKET_ADMIN ?>

@@ -207,7 +207,7 @@

   Reporter:
-  <input id="reporter" type="text" name="reporter" class="textwidget" size="80"
+  <input id="reporter" type="text" name="reporter" class="textwidget" size="70"
          value="<?cs var:ticket.reporter ?>" />
 <?cs /if ?>

@@ -222,7 +222,7 @@
    <?cs call:hdf_select(enums.severity, "severity", ticket.severity) ?>

    Keywords:
-   <input type="text" id="keywords" name="keywords" size="25" class="textwidget"
+   <input type="text" id="keywords" name="keywords" size="20" class="textwidget"
           value="<?cs var:ticket.keywords ?>" />

@@ -238,7 +238,7 @@

   Cc:
    <input type="text" id="cc" name="cc" class="textwidget"
-          value="<?cs var:ticket.cc ?>" size="35" />
+          value="<?cs var:ticket.cc ?>" size="30" />

@@ -250,7 +250,7 @@

   <fieldset>
    <legend>Action</legend>
-
<?cs var:ticket.action ?>

+

   <?cs if:!ticket.action ?>
    <?cs set:ticket.action = 'leave' ?>
   <?cs /if ?>


Increment version number

Increment version number

--- vmPing/Properties/AssemblyInfo.cs
+++ vmPing/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.0.0")]
-[assembly: AssemblyFileVersion("1.3.0.0")]
+[assembly: AssemblyVersion("1.3.1.0")]
+[assembly: AssemblyFileVersion("1.3.1.0")]


fix checkpoint fix

fix checkpoint fix

--- 140-speedrun-timer/Cheats.cs
+++ 140-speedrun-timer/Cheats.cs
@@ -43,8 +43,12 @@
 			if (!levelsFolder)
 				return;

-			_savepoints.AddRange(levelsFolder.GetComponentsInChildren<Savepoint>());
-			_savepoints.Sort((s1, s2) => s1.transform.position.x.CompareTo(s2.transform.position.x));
+			foreach (var savepoint in levelsFolder.GetComponentsInChildren<Savepoint>())
+			{
+				if (!(savepoint is SpawnPoint))
+					_savepoints.Add(savepoint);
+			}
+			_savepoints.Sort((s1, s2) => s1.GetGlobalSavepointID().CompareTo(s2.GetGlobalSavepointID()));

 			_beatSwitches.AddRange(levelsFolder.GetComponentsInChildren<BeatLayerSwitch>());
 			_beatSwitches.Sort((s1, s2) => s1.globalBeatLayer.CompareTo(s2.globalBeatLayer));
@@ -100,13 +104,13 @@
 			}
 			else if (Input.GetKeyDown(KeyCode.Home))
 			{
-				Globals.levelsManager.SetCurrentCheckpoint(1);
-				TeleportToCurrentCheckpoint();
+				var savepoint = _savepoints[0];
+				TeleportToSavepoint(savepoint);
 			}
 			else if (Input.GetKeyDown(KeyCode.End))
 			{
-				Globals.levelsManager.SetCurrentCheckpoint(_savepoints.Count - 1);
-				TeleportToCurrentCheckpoint();
+				var savepoint = _savepoints[_savepoints.Count - 1];
+				TeleportToSavepoint(savepoint);
 			}
 			else if (Input.GetKeyDown(KeyCode.PageUp))
 			{
@@ -217,29 +221,24 @@
 		Savepoint GetNearestCheckpoint(bool searchToRight = true)
 		{
 			var levelManager = Globals.levelsManager;
-			var playerPos = Globals.player.GetComponent<MyCharacterController>().transform.position;
+			var playerPos = Globals.player.transform.position;
 			var currentSavePoint = levelManager.GetSavepoint();

-			var i = searchToRight
-				? 1 // skip the first savepoint, it is the spawn point
-				: _savepoints.Count - 1;
+			var i = searchToRight ? 0 : _savepoints.Count - 1;
 			for (; i >= 0 && i < _savepoints.Count; i += searchToRight ? 1 : -1)
 			{
-				var savepoint = GetSavepoint(i);
-				if (currentSavePoint == savepoint)
-					continue;
-
+				var savepoint = _savepoints[i];
 				var savepointPos = savepoint.transform.position;
 				var distance = savepointPos.x - playerPos.x;

 				if (searchToRight)
 				{
-					if (distance > 0)
+					if (distance > 0.1)
 						return savepoint;
 				}
 				else
 				{
-					if (distance < 0)
+					if (distance < -0.1)
 						return savepoint;
 				}
 			}


[UDP] Don't crash on random messages

[UDP] Don't crash on random messages

--- Desktop/Tempest/Providers/Network/UdpConnectionlessListener.cs
+++ Desktop/Tempest/Providers/Network/UdpConnectionlessListener.cs
@@ -304,6 +304,9 @@
 			int remaining = args.BytesTransferred;

 			List<Message> messages = this.connectionlessSerializer.BufferMessages (ref buffer, ref bufferOffset, ref messageOffset, ref remaining, ref header, ref reader);
+			if (messages == null)
+				return;
+
 			foreach (Message m in messages)
 			{
 				var tempestMessage = m as TempestMessage;


20140513-2144-DWDT Corrected bug in RepositoryMembershipProvider.ValidateUser(String) which was causing function to incorrectly fail validation.

--- Dibware.Web.Security/Providers/RepositoryMembershipProvider.cs
+++ Dibware.Web.Security/Providers/RepositoryMembershipProvider.cs
@@ -532,7 +532,7 @@
             // Try and get the hashed password for the supplied username,
             // and set a flag to indicate it was found...
             var actualPasswordHash = MembershipProviderRepository.GetHashedPasswordForUser(username);
-            Boolean isValid = String.IsNullOrEmpty(actualPasswordHash);
+            Boolean isValid = !String.IsNullOrEmpty(actualPasswordHash);

             // Are we still valid...
             if (isValid)


Never emit keyword, if it wasn't used by the user.

--- src/dotless.Core/Parser/Tree/Color.cs
+++ src/dotless.Core/Parser/Tree/Color.cs
@@ -367,8 +367,6 @@
                 return;
             }

-            var keyword = GetKeyword(rgb);
-
             var hexString = '#' + rgb
                              .Select(i => i.ToString("X2"))
                              .JoinStrings("")
@@ -377,11 +375,11 @@
             if (env.Compress)
             {
                 hexString = Regex.Replace(hexString, @"#(.)\1(.)\2(.)\3", "#$1$2$3");
-                env.Output.Append(string.IsNullOrEmpty(keyword) || hexString.Length < keyword.Length ? hexString : keyword);
+                env.Output.Append(hexString);
                 return;
             }

-            env.Output.Append(!string.IsNullOrEmpty(keyword) ? keyword : hexString);
+            env.Output.Append(hexString);
         }

         public Node Operate(Operation op, Node other)


remove unnecessary code

remove unnecessary code

--- src/Avalonia.FreeDesktop/DBusSystemTray/DBusSysTray.cs
+++ src/Avalonia.FreeDesktop/DBusSystemTray/DBusSysTray.cs
@@ -163,25 +163,7 @@

         public async Task<object> GetAsync(string prop)
         {
-            return prop switch
-            {
-                "Category" => _backingProperties.Category,
-                "Id" => _backingProperties.Id,
-                "Title" => _backingProperties.Title,
-                "Status" => _backingProperties.Status,
-                "WindowId" => _backingProperties.WindowId,
-                "IconThemePath" => _backingProperties.IconThemePath,
-                "ItemIsMenu" => _backingProperties.ItemIsMenu,
-                "IconName" => _backingProperties.IconName,
-                "IconPixmap" => _backingProperties.IconPixmap,
-                "OverlayIconName" => _backingProperties.OverlayIconName,
-                "OverlayIconPixmap" => _backingProperties.OverlayIconPixmap,
-                "AttentionIconName" => _backingProperties.AttentionIconName,
-                "AttentionIconPixmap" => _backingProperties.AttentionIconPixmap,
-                "AttentionMovieName" => _backingProperties.AttentionMovieName,
-                "ToolTip" => _backingProperties.ToolTip,
-                _ => default
-            };
+            return default;
         }

         public async Task<StatusNotifierItemProperties> GetAllAsync()


Fixed SleepLoopRenderTimer

Fixed SleepLoopRenderTimer

--- src/Avalonia.Visuals/Rendering/SleepLoopRenderTimer.cs
+++ src/Avalonia.Visuals/Rendering/SleepLoopRenderTimer.cs
@@ -45,14 +45,13 @@

         void LoopProc()
         {
-            var now = _st.Elapsed;
-            var lastTick = now;
-
+            var lastTick = _st.Elapsed;
             while (true)
             {
+                var now = _st.Elapsed;
                 var timeTillNextTick = lastTick + _timeBetweenTicks - now;
                 if (timeTillNextTick.TotalMilliseconds > 1) Thread.Sleep(timeTillNextTick);
-
+                lastTick = now;
                 lock (_lock)
                 {
                     if (_count == 0)
@@ -63,7 +62,7 @@
                 }

                 _tick?.Invoke(now);
-                now = _st.Elapsed;
+
             }
         }


Surface HttpHeaders from WcfProperties to be able to set http headers with Wcf-WebHttp adapter

--- src/BizTalk.Schemas/ContextProperties/WcfProperties.cs
+++ src/BizTalk.Schemas/ContextProperties/WcfProperties.cs
@@ -27,6 +27,9 @@
 		public static readonly MessageContextProperty<Action, string> Action
 			= new MessageContextProperty<Action, string>();

+		public static readonly MessageContextProperty<HttpHeaders, string> HttpHeaders
+			= new MessageContextProperty<HttpHeaders, string>();
+
 		public static readonly MessageContextProperty<InboundBodyLocation, string> InboundBodyLocation
 			= new MessageContextProperty<InboundBodyLocation, string>();


[add]:コメントの追加

[add]:コメントの追加

コメントを追加しました

--- block-program/Detection/Image/IImage.cs
+++ block-program/Detection/Image/IImage.cs
@@ -3,18 +3,61 @@
 namespace Myxini.Recognition.Image
 {
 	public interface IImage
-	{
-		E GetElement<E>(int x, int y, int channel);
+	{
+		/// <summary>
+		/// 画像の要素を取得します
+		/// </summary>
+		/// <typeparam name="ElementType">要素の型です</typeparam>
+		/// <param name="x">画像のX座標</param>
+		/// <param name="y">画像のY座標</param>
+		/// <param name="channel">画像のチャネル</param>
+		/// <returns>画像の要素</returns>
+		ElementType GetElement<ElementType>(int x, int y, int channel);

+		/// <summary>
+		/// 画像の一部を取得します
+		/// </summary>
+		/// <param name="x">部分画像の領域のX座標</param>
+		/// <param name="y">部分画像の領域のY座標</param>
+		/// <param name="width">部分画像の領域の幅</param>
+		/// <param name="height">部分画像の領域の高さ</param>
+		/// <returns>部分画像</returns>
 		IImage RegionOfImage(int x, int y, int width, int height);
+
+		/// <summary>
+		/// 画像の一部を取得します
+		/// </summary>
+		/// <param name="region">部分画像の領域</param>
+		/// <returns>部分画像</returns>
 		IImage RegionOfImage(Rectangle region);

+		/// <summary>
+		/// 画像のディープコピーを返します
+		/// </summary>
+		/// <returns>ディープコピーした画像</returns>
+		IImage Clone();

+		/// <summary>
+		/// 画像のチャンネル数
+		/// </summary>
 		int Channel { get; }
+		/// <summary>
+		/// 画像の領域
+		/// この画像が部分画像の時，X,Yには元画像のオフセットが指定されます．
+		/// </summary>
 		Rectangle BoundingBox { get; }
+		/// <summary>
+		/// 画像の幅
+		/// </summary>
 		int Width { get; }
+		/// <summary>
+		/// 画像の高さ
+		/// </summary>
 		int Height { get; }

+		/// <summary>
+		/// この画像が部分画像かを返します
+		/// </summary>
 		bool IsRegionOfImage { get; }
 	}
 }


[Fix] KinectクラスのコンストラクタでStartメッソドを呼んでいなかったので追加しました

--- block-program/Detection/Image/Kinect.cs
+++ block-program/Detection/Image/Kinect.cs
@@ -12,17 +12,42 @@
 				throw new InvalidOperationException();
 			}

+			this.Sensor = KinectSensor.KinectSensors[index];
+
 			this.Sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
 			this.Sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);

 			this.Sensor.ColorFrameReady += this.OnUpdateColorImage;
 			this.Sensor.DepthFrameReady += this.OnUpdateDepthImage;
+
+			this.Sensor.Start();
 		}

 		public Kinect(KinectSensor kinect)
 		{
 			this.Sensor = kinect;
+			if(this.Sensor.IsRunning)
+			{
+				this.Sensor.Stop();
+			}
+
+			this.Sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
+			this.Sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
+
+			this.Sensor.ColorFrameReady += this.OnUpdateColorImage;
+			this.Sensor.DepthFrameReady += this.OnUpdateDepthImage;
+
+			this.Sensor.Start();
 		}
+
+		public ~Kinect()
+		{
+			if(this.Sensor.IsRunning)
+			{
+				this.Sensor.Stop();
+			}
+		}
+

 		public static KinectSensor enumerateKinect(Func<KinectSensor, bool> function)
 		{


New General Alert Validator Test Added

New General Alert Validator Test Added

--- src/CAPNet.Tests/ValidatorTests/AlertValidatorTests.cs
+++ src/CAPNet.Tests/ValidatorTests/AlertValidatorTests.cs
@@ -7,7 +7,7 @@
     public class AlertValidatorTests
     {
         [Fact]
-        public void GeneralValidAlert()
+        public void GeneralAlertWithAllRequiredFieldsIsValid()
         {
             var alert = new Alert();
             alert.Identifier = "KSTO1055887203";
@@ -36,5 +36,41 @@
             var alertValidator = new AlertValidator(alert);
             Assert.True(alertValidator.IsValid);
         }
+
+        [Fact]
+        public void GeneralAlertWithWrongCategoryInInfoIsInvalid()
+        {
+            var alert = new Alert();
+            alert.Identifier = "KSTO1055887203";
+            alert.Sender = "Sender";
+            alert.Status = Status.Draft;
+            alert.MessageType = MessageType.Error;
+            alert.Note = "DescriptiveError";
+            alert.Scope = Scope.Restricted;
+            alert.Restriction = "Draft";
+            alert.Sent = new System.DateTimeOffset();
+
+            var info = new Info();
+            //invalid category set :
+            var category = (Category)123;
+            //Category required
+            info.Categories.Add(category);
+            //Certainty required
+            info.Certainty = Certainty.Observed;
+            //EventRequired
+            info.Event = "ImportantEvent";
+            //SeverityRequired
+            info.Severity = Severity.Minor;
+            //UrgencyRequired
+            info.Urgency = Urgency.Future;
+            alert.Info.Add(info);
+
+            var alertValidator = new AlertValidator(alert);
+            Assert.False(alertValidator.IsValid);
+            var categoryErrors = from error in alertValidator.Errors
+                                where typeof(InvalidCategoryError) == error.GetType()
+                                select error;
+            Assert.NotEmpty(categoryErrors);
+        }
     }
 }


fixing setup

fixing setup

--- src/Common/Commands.ScenarioTests.Common/SMTestBase.cs
+++ src/Common/Commands.ScenarioTests.Common/SMTestBase.cs
@@ -58,8 +58,8 @@
                             {AzureAccount.Property.Subscriptions, newGuid.ToString()}
                         }
                     });
-                client.SetSubscriptionAsDefault(newGuid, "test");
-                client.AddOrSetSubscription( new AzureSubscription { Id = newGuid, Name = "test", Environment = EnvironmentName.AzureCloud, Account = "test" });
+               client.AddOrSetSubscription( new AzureSubscription { Id = newGuid, Name = "test", Environment = EnvironmentName.AzureCloud, Account = "test" });
+               client.SetSubscriptionAsDefault(newGuid, "test");
            }
             AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory();
         }


Tweaks to 2021/06

Tweaks to 2021/06

--- 2021/AOC2021/Day06/Puzzle.cs
+++ 2021/AOC2021/Day06/Puzzle.cs
@@ -1,5 +1,4 @@
-using System.Text.RegularExpressions;
-using AOC2021.Common;
+using AOC2021.Common;

 namespace AOC2021.Day06
 {
@@ -14,10 +13,6 @@
         }

         private readonly int[] _initial;
-
-        public override long Solution1() => LoopFishes(80);
-
-        public override long Solution2() => LoopFishes(256);

         private long LoopFishes(int days)
         {
@@ -40,5 +35,9 @@

             return fishes.Sum();
         }
+
+        public override long Solution1() => LoopFishes(80);
+
+        public override long Solution2() => LoopFishes(256);
     }
 }


Avoid allocations if possible.

Avoid allocations if possible.

--- src/EditorFeatures/Text/Extensions.TextBufferMapper.cs
+++ src/EditorFeatures/Text/Extensions.TextBufferMapper.cs
@@ -23,9 +23,15 @@
                 var textImage = ((ITextSnapshot2)editorSnapshot).TextImage;
                 Contract.ThrowIfNull(textImage);

-                // put reverse entry that won't hold onto anything
-                var weakEditorSnapshot = new WeakReference<ITextSnapshot>(editorSnapshot);
-                s_roslynToEditorSnapshotMap.GetValue(textImage, _ => weakEditorSnapshot);
+                // If we're already in the map, there's nothing to update.  Do a quick check
+                // to avoid two allocations per call to ToReverseMappedTextImage.
+                if (!s_roslynToEditorSnapshotMap.TryGetValue(textImage, out var weakReference) ||
+                    weakReference.GetTarget() != editorSnapshot)
+                {
+                    // put reverse entry that won't hold onto anything
+                    s_roslynToEditorSnapshotMap.GetValue(
+                        textImage, _ => new WeakReference<ITextSnapshot>(editorSnapshot));
+                }

                 return textImage;
             }


Changed the archive format so we can easily restore time periods

--- src/Exceptionless.Core/Extensions/StorageExtensions.cs
+++ src/Exceptionless.Core/Extensions/StorageExtensions.cs
@@ -55,7 +55,7 @@
             if (path.StartsWith("archive"))
                 return true;

-            string archivePath = $"archive\\{projectId}\\{created:yy\\MM\\dd}\\{Path.GetFileName(path)}";
+            string archivePath = $"archive\\{created:yy\\MM\\dd\\hh}\\{projectId}\\{Path.GetFileName(path)}";
             try {
                 if (shouldArchive && !await storage.ExistsAsync(archivePath).AnyContext()) {
                     if (!await storage.RenameFileAsync(path, archivePath).AnyContext())


fixed major bug in the message expiration.

--- src/Foundatio.RabbitMQ/Messaging/RabbitMQMessageBus.cs
+++ src/Foundatio.RabbitMQ/Messaging/RabbitMQMessageBus.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Threading;
 using System.Threading.Tasks;
 using Foundatio.Extensions;
@@ -137,7 +138,7 @@

             var basicProperties = _publisherChannel.CreateBasicProperties();
             basicProperties.Persistent = _persistent;
-            basicProperties.Expiration = _defaultMessageTimeToLive.Milliseconds.ToString();
+            basicProperties.Expiration = _defaultMessageTimeToLive.TotalMilliseconds.ToString(CultureInfo.InvariantCulture);
             // RabbitMQ only supports delayed messages with a third party plugin called "rabbitmq_delayed_message_exchange"
             if (_delayedExchange && delay.HasValue && delay.Value > TimeSpan.Zero) {
                 // Its necessary to typecast long to int because rabbitmq on the consumer side is reading the


chore: add outer class name for CVSS.proto

PiperOrigin-RevId: 430998475

Source-Link: https://github.com/googleapis/googleapis/commit/19753e2ba265f02a4264bd41276dcb40b69b3ba6

Source-Link: https://github.com/googleapis/googleapis-gen/commit/0d0110de803fa23602bac0abab7e29253844b370
Copy-Tag: eyJwIjoiYXBpcy9HcmFmZWFzLlYxLy5Pd2xCb3QueWFtbCIsImgiOiIwZDAxMTBkZTgwM2ZhMjM2MDJiYWMwYWJhYjdlMjkyNTM4NDRiMzcwIn0=

--- apis/Grafeas.V1/Grafeas.V1/Cvss.g.cs
+++ apis/Grafeas.V1/Grafeas.V1/Cvss.g.cs
@@ -83,8 +83,9 @@
             "UEVDSUZJRUQQABITCg9TQ09QRV9VTkNIQU5HRUQQARIRCg1TQ09QRV9DSEFO",
             "R0VEEAIiUgoGSW1wYWN0EhYKEklNUEFDVF9VTlNQRUNJRklFRBAAEg8KC0lN",
             "UEFDVF9ISUdIEAESDgoKSU1QQUNUX0xPVxACEg8KC0lNUEFDVF9OT05FEANC",
-            "UQoNaW8uZ3JhZmVhcy52MVABWjhnb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90",
-            "by9nb29nbGVhcGlzL2dyYWZlYXMvdjE7Z3JhZmVhc6ICA0dSQWIGcHJvdG8z"));
+            "XAoNaW8uZ3JhZmVhcy52MUIJQ1ZTU1Byb3RvUAFaOGdvb2dsZS5nb2xhbmcu",
+            "b3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvZ3JhZmVhcy92MTtncmFmZWFzogID",
+            "R1JBYgZwcm90bzM="));
       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
           new pbr::FileDescriptor[] { },
           new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {


Lucene.Net.Spatial.Util.ShapeFieldCacheProvider: Simplified cache value creation by using ConditionalWeakTable<TKey, TValue>.GetValue(), and removed dependency on WeakDictionary (See LUCENENET-610, LUCENENET-640).

--- src/Lucene.Net.Spatial/Util/ShapeFieldCacheProvider.cs
+++ src/Lucene.Net.Spatial/Util/ShapeFieldCacheProvider.cs
@@ -1,6 +1,5 @@
 using Lucene.Net.Index;
 using Lucene.Net.Search;
-using Lucene.Net.Support;
 using Lucene.Net.Util;
 using Spatial4n.Core.Shapes;
 using System.Runtime.CompilerServices;
@@ -40,13 +39,8 @@
     {
         //private Logger log = Logger.GetLogger(GetType().FullName);

-#if FEATURE_CONDITIONALWEAKTABLE_ADDORUPDATE
         private readonly ConditionalWeakTable<IndexReader, ShapeFieldCache<T>> sidx =
             new ConditionalWeakTable<IndexReader, ShapeFieldCache<T>>();
-#else
-        private readonly WeakDictionary<IndexReader, ShapeFieldCache<T>> sidx =
-            new WeakDictionary<IndexReader, ShapeFieldCache<T>>();
-#endif

         protected internal readonly int m_defaultSize;
         protected internal readonly string m_shapeField;
@@ -60,23 +54,17 @@

         protected internal abstract T ReadShape(BytesRef term);

-        private readonly object locker = new object();
-
         public virtual ShapeFieldCache<T> GetCache(AtomicReader reader)
         {
-            lock (locker)
+            // LUCENENET: ConditionalWeakTable allows us to simplify and remove locks
+            return sidx.GetValue(reader, (key) =>
             {
-                ShapeFieldCache<T> idx;
-                if (sidx.TryGetValue(reader, out idx) && idx != null)
-                {
-                    return idx;
-                }
                 /*long startTime = Runtime.CurrentTimeMillis();
                 log.Fine("Building Cache [" + reader.MaxDoc() + "]");*/
-                idx = new ShapeFieldCache<T>(reader.MaxDoc, m_defaultSize);
+                ShapeFieldCache<T> idx = new ShapeFieldCache<T>(key.MaxDoc, m_defaultSize);
                 int count = 0;
                 DocsEnum docs = null;
-                Terms terms = reader.GetTerms(m_shapeField);
+                Terms terms = ((AtomicReader)key).GetTerms(m_shapeField);
                 TermsEnum te = null;
                 if (terms != null)
                 {
@@ -99,12 +87,10 @@
                         term = te.Next();
                     }
                 }
-                sidx.AddOrUpdate(reader, idx);
-
                 /*long elapsed = Runtime.CurrentTimeMillis() - startTime;
                 log.Fine("Cached: [" + count + " in " + elapsed + "ms] " + idx);*/
                 return idx;
-            }
+            });
         }
     }
 }


Changed default listen port.

Changed default listen port.

--- src/Main/Hadouken.Impl.BitTorrent/MonoTorrentEngine.cs
+++ src/Main/Hadouken.Impl.BitTorrent/MonoTorrentEngine.cs
@@ -51,7 +51,7 @@
             string defaultSavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");

             string savePath = _data.GetSetting("bt.savePath", defaultSavePath);
-            int listenPort = Convert.ToInt32(_data.GetSetting("bt.listenPort", "6999"));
+            int listenPort = Convert.ToInt32(_data.GetSetting("bt.listenPort", "6998"));

             _clientEngine = new ClientEngine(new EngineSettings(savePath, listenPort));
         }


Fix compilation errors

Fix compilation errors

The web interface is definitely not the best tool to edit code. :smile:

--- src/NJsonSchema/Converters/JsonInheritanceConverter.cs
+++ src/NJsonSchema/Converters/JsonInheritanceConverter.cs
@@ -9,6 +9,7 @@
 using System;
 using System.Linq;
 using System.Reflection;
+using System.Runtime.Serialization;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using NJsonSchema.Infrastructure;
@@ -113,7 +114,7 @@

             if (subtype == null)
             {
-                var typeInfo = jObject.GetValue("$type").Dump("$type");
+                var typeInfo = jObject.GetValue("$type");
                 if (typeInfo != null)
                 {
                     subtype = Type.GetType(typeInfo.Value<string>());


Delete AssemblyInfo.cs

Delete AssemblyInfo.cs

--- src/NLog.Targets.TextWriter/Properties/AssemblyInfo.cs
+++ src/NLog.Targets.TextWriter/Properties/AssemblyInfo.cs
@@ -1,28 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyCopyright("Copyright ©  2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("9699ca8a-1131-4e27-b77c-456f4ea3ba36")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:


Skip Submodule_RecognizedWithCorrectVersion test due to #125

--- src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs
+++ src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs
@@ -12,7 +12,7 @@
     {
     }

-    [Fact]
+    [Fact(Skip = "Unstable test. See issue #125")]
     public void Submodule_RecognizedWithCorrectVersion()
     {
         using (var expandedRepo = TestUtilities.ExtractRepoArchive("submodules"))


Publish a finish message for failed tests

--- src/OctopusPuppet.Cmd/TeamcityConsoleDeployNotifier.cs
+++ src/OctopusPuppet.Cmd/TeamcityConsoleDeployNotifier.cs
@@ -96,14 +96,14 @@
             {
                 name = name,
                 description = description,
-                flowId = NoParent,
+                flowId = name,
                 timeStamp = timeStamp
             });

             var closeBlockMessage = _serviceMessageFormatter.FormatMessage("blockClosed", new
             {
                 name = name,
-                flowId = NoParent,
+                flowId = name,
                 timeStamp = timeStamp
             });

@@ -122,22 +122,6 @@
             var flowId = GetFlowId(value);
             var timeStamp = GetJavaTimeStamp();

-            var progressStartMessage = _serviceMessageFormatter.FormatMessage("progressStart", new
-            {
-                name = name,
-                parent = NoParent,
-                flowId = flowId,
-                timeStamp = timeStamp
-            });
-
-            var message = _serviceMessageFormatter.FormatMessage("message", new
-            {
-                text = string.Format("Starting deployment for {0} - expected deployment duration {1}", name, value.Vertex.DeploymentDuration),
-                parent = NoParent,
-                flowId = flowId,
-                timeStamp = timeStamp
-            });
-
             var testStartedMessage = _serviceMessageFormatter.FormatMessage("testStarted", new
             {
                 name = name,
@@ -146,26 +130,11 @@
                 timeStamp = timeStamp
             });

-            //Console.Out.WriteLine(progressStartMessage);
-            //Console.Out.WriteLine(message);
             Console.Out.WriteLine(testStartedMessage);
         }

         private void ComponentDeploymentInProgress(ComponentVertexDeploymentProgress value)
         {
-            var name = GetName(value);
-            var flowId = GetFlowId(value);
-            var timeStamp = GetJavaTimeStamp();
-
-            var progressMessage = _serviceMessageFormatter.FormatMessage("progressMessage", new
-            {
-                name = name,
-                parent = NoParent,
-                flowId = flowId,
-                timeStamp = timeStamp
-            });
-
-            //Console.Out.WriteLine(progressMessage);
         }

         private void ComponentDeploymentFailure(ComponentVertexDeploymentProgress value)
@@ -184,27 +153,16 @@
                 timeStamp = timeStamp
             });

-            var progressFinishMessage = _serviceMessageFormatter.FormatMessage("progressFinish", new
-            {
-                name = name,
-                parent = NoParent,
-                flowId = flowId,
-                timeStamp = timeStamp
-            });
-
-            var message = _serviceMessageFormatter.FormatMessage("message", new
-            {
-                text = value.Text,
-                errorDetails = value.Text,
-                status = "ERROR",
+            var testFinishMessage = _serviceMessageFormatter.FormatMessage("testFinished", new
+            {
+                name = name,
                 parent = NoParent,
                 flowId = flowId,
                 timeStamp = timeStamp
             });

             Console.Out.WriteLine(testFailedMessage);
-            //Console.Out.WriteLine(message);
-            //Console.Out.WriteLine(progressFinishMessage);
+            Console.Out.WriteLine(testFinishMessage);
         }

         private void ComponentDeploymentCancelled(ComponentVertexDeploymentProgress value)
@@ -223,66 +181,43 @@
                 timeStamp = timeStamp
             });

-            var progressFinishMessage = _serviceMessageFormatter.FormatMessage("progressFinish", new
-            {
-                name = name,
-                parent = NoParent,
-                flowId = flowId,
-                timeStamp = timeStamp
-            });
-
-            var message = _serviceMessageFormatter.FormatMessage("message", new
-            {
-                text = string.Format("Cancelled deploy for {0}", name),
-                errorDetails = string.Format("Cancelled deploy for {0}", name),
-                status = "ERROR",
+            var testFinishMessage = _serviceMessageFormatter.FormatMessage("testFinished", new
+            {
+                name = name,
                 parent = NoParent,
                 flowId = flowId,
                 timeStamp = timeStamp
             });

             Console.Out.WriteLine(testFailedMessage);
-            //Console.Out.WriteLine(message);
-            //Console.Out.WriteLine(progressFinishMessage);
+            Console.Out.WriteLine(testFinishMessage);
         }

         private void ComponentDeploymentSuccess(ComponentVertexDeploymentProgress value)
         {
             var name = GetName(value);
-            var duration = value.Vertex.DeploymentDuration.HasValue
-                ? value.Vertex.DeploymentDuration.Value.Milliseconds
-                : 0;
-            var flowId = GetFlowId(value);
-            var timeStamp = GetJavaTimeStamp();
+            var flowId = GetFlowId(value);
+            var timeStamp = GetJavaTimeStamp();
+
+            var testFailedMessage = _serviceMessageFormatter.FormatMessage("testFailed", new
+            {
+                name = name,
+                message = "Deployment cancelled",
+                details = string.Format("Cancelled deployment for {0}", name),
+                parent = NoParent,
+                flowId = flowId,
+                timeStamp = timeStamp
+            });

             var testFinishMessage = _serviceMessageFormatter.FormatMessage("testFinished", new
             {
                 name = name,
-                duration = duration,
-                parent = NoParent,
-                flowId = flowId,
-                timeStamp = timeStamp
-            });
-
-            var progressFinishMessage = _serviceMessageFormatter.FormatMessage("progressFinish", new
-            {
-                name = name,
-                parent = NoParent,
-                flowId = flowId,
-                timeStamp = timeStamp
-            });
-
-            var message = _serviceMessageFormatter.FormatMessage("message", new
-            {
-                text = string.Format("Successfully deploy for {0}", name),
-                parent = "",
+                parent = NoParent,
                 flowId = flowId,
                 timeStamp = timeStamp
             });

             Console.Out.WriteLine(testFinishMessage);
-            //Console.Out.WriteLine(message);
-            //Console.Out.WriteLine(progressFinishMessage);
         }

         private string GetJavaTimeStamp()


Fixed RenderedObjectsOpaque

Fixed RenderedObjectsOpaque

--- src/OpenSage.Game/Graphics/Rendering/RenderPipeline.cs
+++ src/OpenSage.Game/Graphics/Rendering/RenderPipeline.cs
@@ -237,7 +237,7 @@
             commandList.PopDebugGroup();

             commandList.PushDebugGroup("Opaque");
-            RenderedObjectsOpaque = DoRenderPass(context, commandList, _renderList.Opaque, standardPassCameraFrustum, cloudResourceSet);
+            RenderedObjectsOpaque += DoRenderPass(context, commandList, _renderList.Opaque, standardPassCameraFrustum, cloudResourceSet);
             commandList.PopDebugGroup();

             commandList.PushDebugGroup("Transparent");


Bug fix: Decorator subsystem created new InstanceProducer instances that contained the decorated type as ImplementationType instead of the decorator type. This only influenced the diagnostic system.

--- SimpleInjector.NET/Extensions/Decorators/ServiceTypeDecoratorInfo.cs
+++ SimpleInjector.NET/Extensions/Decorators/ServiceTypeDecoratorInfo.cs
@@ -61,7 +61,7 @@
             Container container, Lifestyle lifestyle, Expression decoratedExpression,
             IEnumerable<KnownRelationship> decoratorRelationships = null)
         {
-            var registration = new ExpressionRegistration(decoratedExpression, originalImplementationType,
+            var registration = new ExpressionRegistration(decoratedExpression, decoratorType,
                 lifestyle, container);

             registration.ReplaceRelationships(decoratorRelationships ?? Enumerable.Empty<KnownRelationship>());


[Fixes 7246] Added null checks for version ids

Fixes #7246

--- src/Orchard/ContentManagement/DefaultContentManager.cs
+++ src/Orchard/ContentManagement/DefaultContentManager.cs
@@ -277,7 +277,8 @@
             return _contentItemVersionRepository
                 .Fetch(x => x.ContentItemRecord.Id == id)
                 .OrderBy(x => x.Number)
-                .Select(x => Get(x.Id, VersionOptions.VersionRecord(x.Id)));
+                .Select(x => Get(x.Id, VersionOptions.VersionRecord(x.Id)))
+                .Where(ci => ci != null);
         }

         public IEnumerable<T> GetMany<T>(IEnumerable<int> ids, VersionOptions options, QueryHints hints) where T : class, IContent {
@@ -301,6 +302,7 @@

             var itemsById = contentItemVersionRecords
                 .Select(r => Get(r.ContentItemRecord.Id, options.IsDraftRequired ? options : VersionOptions.VersionRecord(r.Id)))
+                .Where(ci => ci != null)
                 .GroupBy(ci => ci.Id)
                 .ToDictionary(g => g.Key);

@@ -317,6 +319,7 @@

             var itemsById = contentItemVersionRecords
                 .Select(r => Get(r.ContentItemRecord.Id, VersionOptions.VersionRecord(r.Id)))
+                .Where(ci => ci != null)
                 .GroupBy(ci => ci.VersionRecord.Id)
                 .ToDictionary(g => g.Key);


Fix warning

Fix warning

--- Source/HelixToolkit.SharpDX.Shared/Model/Scene/Abstract/SceneNode.cs
+++ Source/HelixToolkit.SharpDX.Shared/Model/Scene/Abstract/SceneNode.cs
@@ -320,7 +320,7 @@

         #endregion Events

-        internal RenderCore core;
+        private RenderCore core;
         /// <summary>
         /// Initializes a new instance of the <see cref="SceneNode"/> class.
         /// </summary>


SupressDuplicateDeads: Use SiloAddress.Endpoint instead of InstanceName.

--- src/Orleans/SystemTargetInterfaces/IMembershipTable.cs
+++ src/Orleans/SystemTargetInterfaces/IMembershipTable.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net;
 using System.Threading.Tasks;
 using Orleans.Runtime;
 using Orleans.Concurrency;
@@ -206,21 +207,21 @@
         // return a copy of the table removing all dead appereances of dead nodes, except for the last one.
         public MembershipTableData SupressDuplicateDeads()
         {
-            var dead = new Dictionary<string, Tuple<MembershipEntry, string>>();
+            var dead = new Dictionary<IPEndPoint, Tuple<MembershipEntry, string>>();
             // pick only latest Dead for each instance
             foreach (var next in Members.Where(item => item.Item1.Status == SiloStatus.Dead))
             {
-                var name = next.Item1.InstanceName;
+                var ipEndPoint = next.Item1.SiloAddress.Endpoint;
                 Tuple<MembershipEntry, string> prev;
-                if (!dead.TryGetValue(name, out prev))
+                if (!dead.TryGetValue(ipEndPoint, out prev))
                 {
-                    dead[name] = next;
+                    dead[ipEndPoint] = next;
                 }
                 else
                 {
                     // later dead.
                     if (next.Item1.SiloAddress.Generation.CompareTo(prev.Item1.SiloAddress.Generation) > 0)
-                        dead[name] = next;
+                        dead[ipEndPoint] = next;
                 }
             }
             //now add back non-dead


Change tests for get-user-new-shows-request.

--- Source/Tests/TraktApiSharp.Tests/Modules/TraktCalendarModuleTests.cs
+++ Source/Tests/TraktApiSharp.Tests/Modules/TraktCalendarModuleTests.cs
@@ -2424,9 +2424,10 @@
             var calendarNewShowsJson = TestUtility.ReadFileContents(@"Objects\Get\Calendars\CalendarAllShows.json");
             calendarNewShowsJson.Should().NotBeNullOrEmpty();

-            var days = 14;
-
-            TestUtility.SetupMockResponseWithOAuth($"calendars/my/shows/new/{days}", calendarNewShowsJson);
+            var today = DateTime.UtcNow;
+            var days = 14;
+
+            TestUtility.SetupMockResponseWithOAuth($"calendars/my/shows/new/{today.ToTraktDateString()}/{days}", calendarNewShowsJson);

             var response = TestUtility.MOCK_TEST_CLIENT.Calendar.GetUserNewShowsAsync(null, days).Result;

@@ -2439,6 +2440,7 @@
             var calendarNewShowsJson = TestUtility.ReadFileContents(@"Objects\Get\Calendars\CalendarAllShows.json");
             calendarNewShowsJson.Should().NotBeNullOrEmpty();

+            var today = DateTime.UtcNow;
             var days = 14;

             var filter = new TraktCalendarFilter()
@@ -2450,7 +2452,8 @@
                 .WithRuntimes(30, 60)
                 .WithRatings(80, 95);

-            TestUtility.SetupMockResponseWithOAuth($"calendars/my/shows/new/{days}?{filter.ToString()}", calendarNewShowsJson);
+            TestUtility.SetupMockResponseWithOAuth(
+                $"calendars/my/shows/new/{today.ToTraktDateString()}/{days}?{filter.ToString()}", calendarNewShowsJson);

             var response = TestUtility.MOCK_TEST_CLIENT.Calendar.GetUserNewShowsAsync(null, days, null, filter).Result;

@@ -2604,14 +2607,16 @@
             var calendarShowsJson = TestUtility.ReadFileContents(@"Objects\Get\Calendars\CalendarAllShows.json");
             calendarShowsJson.Should().NotBeNullOrEmpty();

-            var days = 14;
-
-            var extendedOption = new TraktExtendedOption();
-
-            extendedOption.Full = true;
-            extendedOption.Images = true;
-
-            TestUtility.SetupMockResponseWithOAuth($"calendars/my/shows/new/{days}?extended={extendedOption.ToString()}", calendarShowsJson);
+            var today = DateTime.UtcNow;
+            var days = 14;
+
+            var extendedOption = new TraktExtendedOption();
+
+            extendedOption.Full = true;
+            extendedOption.Images = true;
+
+            TestUtility.SetupMockResponseWithOAuth(
+                $"calendars/my/shows/new/{today.ToTraktDateString()}/{days}?extended={extendedOption.ToString()}", calendarShowsJson);

             var response = TestUtility.MOCK_TEST_CLIENT.Calendar.GetUserNewShowsAsync(null, days, extendedOption).Result;

@@ -2624,6 +2629,7 @@
             var calendarShowsJson = TestUtility.ReadFileContents(@"Objects\Get\Calendars\CalendarAllShows.json");
             calendarShowsJson.Should().NotBeNullOrEmpty();

+            var today = DateTime.UtcNow;
             var days = 14;

             var extendedOption = new TraktExtendedOption();
@@ -2641,7 +2647,7 @@
                 .WithRatings(80, 95);

             TestUtility.SetupMockResponseWithOAuth(
-                $"calendars/my/shows/new/{days}?extended={extendedOption.ToString()}&{filter.ToString()}",
+                $"calendars/my/shows/new/{today.ToTraktDateString()}/{days}?extended={extendedOption.ToString()}&{filter.ToString()}",
                 calendarShowsJson);

             var response = TestUtility.MOCK_TEST_CLIENT.Calendar.GetUserNewShowsAsync(null, days, extendedOption, filter).Result;


fixed reportrepository.cs

fixed reportrepository.cs

--- Trappist/src/Promact.Trappist.Repository/Reports/ReportRepository.cs
+++ Trappist/src/Promact.Trappist.Repository/Reports/ReportRepository.cs
@@ -208,8 +208,8 @@
                                 else
                                     hardQuestionAttempted += 1;
                             }
-                        }
-                        if (givenSolutionByAttendee.Any(y => y.Score == 1))
+                        }
+                        if (givenSolutionByAttendee.Any(y => y.Score == 1 && y.QuestionId == x.QuestionId && y.TestAttendeeId == testAttendee))
                             correctAttemptedQuestion += 1;

                     }


Client side validation added.

Client side validation added.

--- XOMNI.SDK/XOMNI.SDK.Public/Clients/Catalog/DynamicAttributeClient.cs
+++ XOMNI.SDK/XOMNI.SDK.Public/Clients/Catalog/DynamicAttributeClient.cs
@@ -5,6 +5,7 @@
 using XOMNI.SDK.Public.Clients;
 using XOMNI.SDK.Public.Models;
 using XOMNI.SDK.Public.Models.Catalog;
+using XOMNI.SDK.Public.Extensions;

 namespace XOMNI.SDK.Public.Clients.Catalog
 {
@@ -16,8 +17,11 @@

 		}

-		public async Task<ApiResponse<PaginatedContainer<DynamicAttributeType>>> GetDynamicattributeTypesAsync(int skip, int take)
+		public async Task<ApiResponse<PaginatedContainer<DynamicAttributeType>>> GetDynamicAttributeTypesAsync(int skip, int take)
 		{
+            Validator.For(skip, "skip").IsGreaterThanOrEqual(0);
+            Validator.For(take, "take").IsGreaterThanOrEqual(1);
+
 			string path = string.Format("/catalog/dynamicattributetypes?skip={0}&take={1}", skip, take);

 			using (var response = await Client.GetAsync(path).ConfigureAwait(false))
@@ -28,6 +32,9 @@

         public async Task<ApiResponse<PaginatedContainer<DynamicAttribute>>> GetDynamicAttributesAsync(int skip, int take)
 		{
+            Validator.For(skip, "skip").IsGreaterThanOrEqual(0);
+            Validator.For(take, "take").IsGreaterThanOrEqual(1);
+
 			string path = string.Format("/catalog/dynamicattributes?skip={0}&take={1}", skip, take);

 			using (var response = await Client.GetAsync(path).ConfigureAwait(false))


Utility to check if a TV connection is active

--- TvConnection.cs
+++ TvConnection.cs
@@ -79,6 +79,14 @@
             ConnectedPort = port;
         }

+        public bool IsConnected
+        {
+            get
+            {
+                return TvDirectSocket != null && !bSentPowerOff && ConnectedHostName != null;
+            }
+        }
+
         private void newConnected(IAsyncAction info, AsyncStatus status)
         {
             if (status == AsyncStatus.Completed)


КопироватьФайл/ПереместитьФайл

КопироватьФайл/ПереместитьФайл

--- src/ScriptEngine.HostedScript/Library/GlobalContext.cs
+++ src/ScriptEngine.HostedScript/Library/GlobalContext.cs
@@ -82,6 +82,18 @@
         public void Quit(int exitCode)
         {
             throw new ScriptInterruptionException(exitCode);
+        }
+
+        [ContextMethod("КопироватьФайл", "CopyFile")]
+        public void CopyFile(string source, string destination)
+        {
+            System.IO.File.Copy(source, destination, true);
+        }
+
+        [ContextMethod("ПереместитьФайл", "MoveFile")]
+        public void MoveFile(string source, string destination)
+        {
+            System.IO.File.Move(source, destination);
         }

         [ContextMethod("ВвестиСтроку", "InputString")]