Catching invalid cast exceptions

Catching invalid cast exceptions

Occurs when values are not what they are expected to be, e.g. null
values or 0 for floats/doubles.
This fixes #4

--- ExtendedEvent/Assets/ExtendedEvent/ExtendedEvent.cs
+++ ExtendedEvent/Assets/ExtendedEvent/ExtendedEvent.cs
@@ -177,56 +177,60 @@
         public void LoadDefaultValue() {
             if ( info == null ) return;

-            switch ( TypeName ) {
-                case "String":
-                    StringValue = info.IsOptional ? (string)info.DefaultValue : "";
-                    break;
-                case "Int32":
-                    IntValue = info.IsOptional ? (int)info.DefaultValue : 0;
-                    break;
-                case "Int64":
-                    LongValue = info.IsOptional ? (long)info.DefaultValue : 0;
-                    break;
-                case "Single":
-                    FloatValue = info.IsOptional ? (float)info.DefaultValue : 0;
-                    break;
-                case "Double":
-                    DoubleValue = info.IsOptional ? (double)info.DefaultValue : 0;
-                    break;
-                case "Boolean":
-                    BoolValue = info.IsOptional ? (bool)info.DefaultValue : false;
-                    break;
-                case "Vector2":
-                    Vector2Value = info.IsOptional ? (Vector2)info.DefaultValue : Vector2.zero;
-                    break;
-                case "Vector3":
-                    Vector3Value = info.IsOptional ? (Vector3)info.DefaultValue : Vector3.zero;
-                    break;
-                case "Vector4":
-                    Vector4Value = info.IsOptional ? (Vector4)info.DefaultValue : Vector4.zero;
-                    break;
-                case "Quaternion":
-                    QuaternionValue = info.IsOptional ? (Quaternion)info.DefaultValue : new Quaternion();
-                    break;
-                case "Bounds":
-                    BoundsValue = info.IsOptional ? (Bounds)info.DefaultValue : new Bounds();
-                    break;
-                case "Rect":
-                    RectValue = info.IsOptional ? (Rect)info.DefaultValue : new Rect();
-                    break;
-                case "Matrix4x4":
-                    MatrixValue = info.IsOptional ? (Matrix4x4)info.DefaultValue : new Matrix4x4();
-                    break;
-                case "AnimationCurve":
-                    AnimationCurveValue = info.IsOptional ? (AnimationCurve)info.DefaultValue : new AnimationCurve();
-                    break;
-                case "Object":
-                case "GameObject":
-                    ObjectValue = info.IsOptional ? (UnityEngine.Object)info.DefaultValue : null;
-                    break;
-                case "Enum":
-                    EnumValue = info.IsOptional ? (int)info.DefaultValue : 0;
-                    break;
+            try {
+                switch ( TypeName ) {
+                    case "String":
+                        StringValue = info.IsOptional ? (string)info.DefaultValue : "";
+                        break;
+                    case "Int32":
+                        IntValue = info.IsOptional ? (int)info.DefaultValue : 0;
+                        break;
+                    case "Int64":
+                        LongValue = info.IsOptional ? (long)info.DefaultValue : 0;
+                        break;
+                    case "Single":
+                        FloatValue = info.IsOptional ? (float)info.DefaultValue : 0;
+                        break;
+                    case "Double":
+                        DoubleValue = info.IsOptional ? (double)info.DefaultValue : 0;
+                        break;
+                    case "Boolean":
+                        BoolValue = info.IsOptional ? (bool)info.DefaultValue : false;
+                        break;
+                    case "Vector2":
+                        Vector2Value = info.IsOptional ? (Vector2)info.DefaultValue : Vector2.zero;
+                        break;
+                    case "Vector3":
+                        Vector3Value = info.IsOptional ? (Vector3)info.DefaultValue : Vector3.zero;
+                        break;
+                    case "Vector4":
+                        Vector4Value = info.IsOptional ? (Vector4)info.DefaultValue : Vector4.zero;
+                        break;
+                    case "Quaternion":
+                        QuaternionValue = info.IsOptional ? (Quaternion)info.DefaultValue : new Quaternion();
+                        break;
+                    case "Bounds":
+                        BoundsValue = info.IsOptional ? (Bounds)info.DefaultValue : new Bounds();
+                        break;
+                    case "Rect":
+                        RectValue = info.IsOptional ? (Rect)info.DefaultValue : new Rect();
+                        break;
+                    case "Matrix4x4":
+                        MatrixValue = info.IsOptional ? (Matrix4x4)info.DefaultValue : new Matrix4x4();
+                        break;
+                    case "AnimationCurve":
+                        AnimationCurveValue = info.IsOptional ? (AnimationCurve)info.DefaultValue : new AnimationCurve();
+                        break;
+                    case "Object":
+                    case "GameObject":
+                        ObjectValue = info.IsOptional ? (UnityEngine.Object)info.DefaultValue : null;
+                        break;
+                    case "Enum":
+                        EnumValue = info.IsOptional ? (int)info.DefaultValue : 0;
+                        break;
+                }
+            } catch ( InvalidCastException ) {
+                // Ignoring the default value for this parameter since it cannot be converted properly
             }
         }

@@ -319,58 +323,61 @@

             var finfo = info as FieldInfo;

-            switch ( TypeName ) {
-                case "String":
-                    StringValue = (string)finfo.GetValue( container );
-                    break;
-                case "Int32":
-                    IntValue = (int)finfo.GetValue( container );
-                    break;
-                case "Int64":
-                    LongValue = (long)finfo.GetValue( container );
-                    break;
-                case "Single":
-                    FloatValue = (float)finfo.GetValue( container );
-                    break;
-                case "Double":
-                    DoubleValue = (double)finfo.GetValue( container );
-                    break;
-                case "Boolean":
-                    BoolValue = (bool)finfo.GetValue( container );
-                    break;
-                case "Vector2":
-                    Vector2Value = (Vector2)finfo.GetValue( container );
-                    break;
-                case "Vector3":
-                    Vector3Value = (Vector3)finfo.GetValue( container );
-                    break;
-                case "Vector4":
-                    Vector4Value = (Vector4)finfo.GetValue( container );
-                    break;
-                case "Quaternion":
-                    QuaternionValue = (Quaternion)finfo.GetValue( container );
-                    break;
-                case "Bounds":
-                    BoundsValue = (Bounds)finfo.GetValue( container );
-                    break;
-                case "Rect":
-                    RectValue = (Rect)finfo.GetValue( container );
-                    break;
-                case "Matrix4x4":
-                    MatrixValue = (Matrix4x4)finfo.GetValue( container );
-                    break;
-                case "AnimationCurve":
-                    AnimationCurveValue = (AnimationCurve)finfo.GetValue( container );
-                    break;
-                case "Object":
-                case "GameObject":
-                    ObjectValue = (UnityEngine.Object)finfo.GetValue( container );
-                    break;
-                case "Enum":
-                    EnumValue = (int)finfo.GetValue( container );
-                    break;
-            }
-
+            try {
+                switch ( TypeName ) {
+                    case "String":
+                        StringValue = (string)finfo.GetValue( container );
+                        break;
+                    case "Int32":
+                        IntValue = (int)finfo.GetValue( container );
+                        break;
+                    case "Int64":
+                        LongValue = (long)finfo.GetValue( container );
+                        break;
+                    case "Single":
+                        FloatValue = (float)finfo.GetValue( container );
+                        break;
+                    case "Double":
+                        DoubleValue = (double)finfo.GetValue( container );
+                        break;
+                    case "Boolean":
+                        BoolValue = (bool)finfo.GetValue( container );
+                        break;
+                    case "Vector2":
+                        Vector2Value = (Vector2)finfo.GetValue( container );
+                        break;
+                    case "Vector3":
+                        Vector3Value = (Vector3)finfo.GetValue( container );
+                        break;
+                    case "Vector4":
+                        Vector4Value = (Vector4)finfo.GetValue( container );
+                        break;
+                    case "Quaternion":
+                        QuaternionValue = (Quaternion)finfo.GetValue( container );
+                        break;
+                    case "Bounds":
+                        BoundsValue = (Bounds)finfo.GetValue( container );
+                        break;
+                    case "Rect":
+                        RectValue = (Rect)finfo.GetValue( container );
+                        break;
+                    case "Matrix4x4":
+                        MatrixValue = (Matrix4x4)finfo.GetValue( container );
+                        break;
+                    case "AnimationCurve":
+                        AnimationCurveValue = (AnimationCurve)finfo.GetValue( container );
+                        break;
+                    case "Object":
+                    case "GameObject":
+                        ObjectValue = (UnityEngine.Object)finfo.GetValue( container );
+                        break;
+                    case "Enum":
+                        EnumValue = (int)finfo.GetValue( container );
+                        break;
+                }
+            } catch ( InvalidCastException ) {
+                // Ignoring the default value for this field since it cannot be converted properly
+            }
         }

         public Member( MethodInfo info, Type infoType, Type type, ParameterInfo[] parameters )


Fix StyleCop Warnings

Fix StyleCop Warnings


Tweak soldier display, fix null ref

Tweak soldier display, fix null ref

--- Battery-Commander.Web/Models/Soldier.cs
+++ Battery-Commander.Web/Models/Soldier.cs
@@ -94,7 +94,7 @@
         [Display(Name = "Login Enabled")]
         public Boolean CanLogin { get; set; } = false;

-        public override string ToString() => $"{Rank.ShortName()} {LastName} {FirstName} {MiddleName.FirstOrDefault()}".Trim().ToUpper();
+        public override string ToString() => $"{Rank.ShortName()} {LastName} {FirstName} {MiddleName?.FirstOrDefault()}".Trim().ToUpper();

         public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
         {


More code docs

More code docs

--- src/AutoMapper/IValueConverter.cs
+++ src/AutoMapper/IValueConverter.cs
@@ -1,7 +1,18 @@
 namespace AutoMapper
 {
+    /// <summary>
+    /// Converts a source member value to a destination member value
+    /// </summary>
+    /// <typeparam name="TSourceMember">Source member type</typeparam>
+    /// <typeparam name="TDestinationMember">Destination member type</typeparam>
     public interface IValueConverter<in TSourceMember, out TDestinationMember>
     {
+        /// <summary>
+        /// Perform conversion from source member value to destination member value
+        /// </summary>
+        /// <param name="sourceMember">Source member object</param>
+        /// <param name="context">Resolution context</param>
+        /// <returns>Destination member value</returns>
         TDestinationMember Convert(TSourceMember sourceMember, ResolutionContext context);
     }
 }


Changed ordering of group enum

Changed ordering of group enum

--- BatteryCommander.Common/Models/Group.cs
+++ BatteryCommander.Common/Models/Group.cs
@@ -37,9 +37,6 @@
         [Display(Name = "1st PLT HQ")]
         Headquarters_FirstPlatoon,

-        [Display(Name = "2nd PLT HQ")]
-        Headquarters_SecondPlatoon,
-
         [Display(Name = "1st PLT Gun 1")]
         Gun1,

@@ -51,6 +48,12 @@

         [Display(Name = "1st PLT Gun 4")]
         Gun4,
+
+        [Display(Name = "1st PLT Ammo")]
+        Ammo1,
+
+        [Display(Name = "2nd PLT HQ")]
+        Headquarters_SecondPlatoon,

         [Display(Name = "2nd PLT Gun 5")]
         Gun5,
@@ -64,9 +67,6 @@
         [Display(Name = "2nd PLT Gun 8")]
         Gun8,

-        [Display(Name = "1st PLT Ammo")]
-        Ammo1,
-
         [Display(Name = "2nd PLT Ammo")]
         Ammo2,


If to switch

If to switch

--- Framework.Core/System/Numerics/BigInteger.string.cs
+++ Framework.Core/System/Numerics/BigInteger.string.cs
@@ -137,41 +137,38 @@
                     var decimalSeparator = info.NumberDecimalSeparator;
                     var groups = false;
                     var type = 0;
-                    if (fmt == '\0')
-                    {
-                        // parse custom
-                    }
-                    else
-                    {
-                        if (fmt == 'c' || fmt == 'C')
-                        {
+                    switch (fmt)
+                    {
+                        case '\0':
+                            // parse custom
+                            break;
+                        case 'c':
+                        case 'C':
                             decimalSeparator = info.CurrencyDecimalSeparator;
                             precision = digits != -1 ? digits : info.CurrencyDecimalDigits;
                             groupingSeparator = info.CurrencyGroupSeparator;
                             groupingSizes = info.CurrencyGroupSizes;
                             groups = true;
                             type = 1;
-                        }
-                        else if (fmt == 'f' || fmt == 'F')
-                        {
+                            break;
+                        case 'f':
+                        case 'F':
                             precision = digits != -1 ? digits : info.NumberDecimalDigits;
-                        }
-                        else if (fmt == 'n' || fmt == 'N')
-                        {
+                            break;
+                        case 'n':
+                        case 'N':
                             precision = digits != -1 ? digits : info.NumberDecimalDigits;
                             groups = true;
-                        }
-                        else if (fmt == 'p' || fmt == 'P')
-                        {
+                            break;
+                        case 'p':
+                        case 'P':
                             decimalSeparator = info.PercentDecimalSeparator;
                             precision = digits != -1 ? digits : info.PercentDecimalDigits;
                             groups = true;
                             type = 2;
-                        }
-                        else
-                        {
+                            break;
+                        default:
                             throw new NotSupportedException();
-                        }
                     }

                     var result = new StringBuilder(builder.Length + 20);


Update Global.asax.cs

Update Global.asax.cs

--- src/Backbone.Todos/Global.asax.cs
+++ src/Backbone.Todos/Global.asax.cs
@@ -8,9 +8,7 @@
 //The entire C# source code for the ServiceStack + Redis TODO REST backend. There is no other .cs :)
 namespace Backbone.Todos
 {
-    /// <summary>
-    /// Define your ServiceStack web service request (i.e. Request DTO).
-    /// </summary>
+    // Define your ServiceStack web service request (i.e. Request DTO).
     public class Todo
     {
         public long Id { get; set; }
@@ -19,9 +17,7 @@
         public bool Done { get; set; }
     }

-    /// <summary>
-    /// Create your ServiceStack rest-ful web service implementation.
-    /// </summary>
+    // Create your ServiceStack rest-ful web service implementation.
     public class TodoService : Service
     {
         public object Get(Todo todo)
@@ -34,9 +30,7 @@
             return Redis.As<Todo>().GetAll();
         }

-        /// <summary>
-        /// Handles creating and updating the Todo items.
-        /// </summary>
+        // Handles creating and updating the Todo items.
         public Todo Post(Todo todo)
         {
             var redis = Redis.As<Todo>();
@@ -50,37 +44,26 @@
             return todo;
         }

-        /// <summary>
-        /// Handles creating and updating the Todo items.
-        /// </summary>
+        // Handles creating and updating the Todo items.
         public Todo Put(Todo todo)
         {
             return Post(todo);
         }

-        /// <summary>
-        /// Handles Deleting the Todo item
-        /// </summary>
+        // Handles Deleting the Todo item
         public void Delete(Todo todo)
         {
             Redis.As<Todo>().DeleteById(todo.Id);
         }
     }

-    /// <summary>
-    /// Create your ServiceStack web service application with a singleton AppHost.
-    /// </summary>
+    // Create your ServiceStack web service application with a singleton AppHost.
     public class ToDoAppHost : AppHostBase
     {
-        /// <summary>
-        /// Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
-        /// </summary>
+        // Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
         public ToDoAppHost() : base("Backbone.js TODO", typeof(TodoService).Assembly) { }

-        /// <summary>
-        /// Configure the container with the necessary routes for your ServiceStack application.
-        /// </summary>
-        /// <param name="container">The built-in IoC used with ServiceStack.</param>
+        // Configure the container with the necessary routes for your ServiceStack application.
         public override void Configure(Container container)
         {
             //Configure ServiceStack Json web services to return idiomatic Json camelCase properties.
@@ -89,7 +72,7 @@
             //Register Redis factory in Funq IoC. The default port for Redis is 6379.
             container.Register<IRedisClientsManager>(new BasicRedisClientManager("localhost:6379"));

-            //Register user-defined REST Paths
+            //Register user-defined REST Paths using the fluent configuration API
             Routes
               .Add<Todo>("/todos")
               .Add<Todo>("/todos/{Id}");
@@ -100,8 +83,8 @@
     {
         protected void Application_Start(object sender, EventArgs e)
         {
-            //Initialize your application
+            //Initialize your ServiceStack AppHost
             (new ToDoAppHost()).Init();
         }
     }
-}+}


ModuleContainer: some internal refactoring to make it simpler

--- BigDataPipeline.Core/ModuleContainer.cs
+++ BigDataPipeline.Core/ModuleContainer.cs
@@ -12,24 +12,32 @@
     public class ModuleContainer : IModuleContainer
     {
         delegate object InstanceFactory (params object[] args);
+
+        class ModuleInfo
+        {
+            public Type TypeInfo;
+            public InstanceFactory Factory;
+        }

         object padlock = new object ();

         HashSet<string> blackListedAssemblies = new HashSet<string> (StringComparer.OrdinalIgnoreCase) { "mscorlib", "vshost", "BigDataPipeline", "NLog", "Newtonsoft.Json", "Topshelf", "Topshelf.Linux", "Topshelf.NLog", "BigDataPipeline.Web", "Nancy", "AWSSDK", "Dapper", "Mono.CSharp", "Mono.Security", "NCrontab", "Renci.SshNet", "System.Net.FtpClient", "MongoDB.Bson", "MongoDB.Driver", "System.Data.SQLite", "System.Net.Http.Formatting", "System.Web.Razor", "Microsoft.Owin.Hosting", "Microsoft.Owin", "Owin" };

-        Dictionary<string, List<Type>> exportedTypesByBaseType = new Dictionary<string, List<Type>> (StringComparer.Ordinal);
-
-        Dictionary<string, Type> exportedTypes = new Dictionary<string, Type> (StringComparer.Ordinal);
-
         Dictionary<string, Assembly> loadedAssemblies = new Dictionary<string, Assembly> (StringComparer.Ordinal);
         List<Assembly> validAssemblies = new List<Assembly> (30);

-        Dictionary<string, InstanceFactory> exportedFactories = new Dictionary<string, InstanceFactory> (StringComparer.Ordinal);
+        Dictionary<string, List<Type>> exportedTypesByBaseType = new Dictionary<string, List<Type>> (StringComparer.Ordinal);
+
+        Dictionary<string, ModuleInfo> exportedModules = new Dictionary<string, ModuleInfo> (StringComparer.Ordinal);

         NLog.Logger _logger = NLog.LogManager.GetLogger ("ModuleContainer");

         static ModuleContainer _instance = new ModuleContainer ();

+        /// <summary>
+        /// Gets the singleton instance for the ModuleContainer.
+        /// </summary>
+        /// <value>The instance.</value>
         public static ModuleContainer Instance
         {
             get
@@ -186,6 +194,8 @@

         private void SearchForImplementations (Type[] listOfInterfaces)
         {
+            List<Type> implementationsList;
+            ModuleInfo info;
             // try to load derived types
             try
             {
@@ -210,33 +220,29 @@
                     // search for types derived from desired types list (listOfInterfaces)
                     for (int i = 0; i < types.Length; i++)
                     {
-                        var t = types[i];
+                        Type t = types[i];
                         if (t == null || t.IsAbstract || t.IsGenericTypeDefinition || !t.IsClass) //t.IsInterface
                             continue;
                         for (int j = 0; j < listOfInterfaces.Length; j++)
                         {
                             if (listOfInterfaces[j].IsAssignableFrom (t))
                             {
-                                if (exportedTypes.ContainsKey (t.Name))
+                                // register type in exportedModules map
+                                if (!exportedModules.TryGetValue (t.FullName, out info))
                                 {
-                                    // ignore if the full name is the same!!!
-                                    if (exportedTypes[t.Name].FullName == t.FullName)
-                                        continue;
-                                    _logger.Info ("Module with same name detected {0}. {1} was overwritten with {2}.", t.Name, exportedTypes[t.Name].FullName, t.FullName);
+                                    info = new ModuleInfo { TypeInfo = t };
+                                    // register type by fullName (namespace + name) and name
+                                    exportedModules[t.FullName] = info;
+                                    exportedModules[t.Name] = info;
                                 }

-                                // register type by fullName (namespace + name) and name
-                                exportedTypes[t.FullName] = t;
-                                exportedTypes[t.Name] = t;
-
-                                // add to interface list of types
-                                List<Type> list;
-                                if (!exportedTypesByBaseType.TryGetValue (listOfInterfaces[j].Name, out list))
+                                // add to interface list of types
+                                if (!exportedTypesByBaseType.TryGetValue (listOfInterfaces[j].Name, out implementationsList))
                                 {
-                                    list = new List<Type> ();
-                                    exportedTypesByBaseType[listOfInterfaces[j].Name] = list;
+                                    implementationsList = new List<Type> ();
+                                    exportedTypesByBaseType[listOfInterfaces[j].Name] = implementationsList;
                                 }
-                                list.Add (t);
+                                implementationsList.Add (t);
                             }
                         }
                     }
@@ -354,20 +360,15 @@
         /// <returns></returns>
         public object GetInstance (string fullTypeName)
         {
-            Type t;
-            InstanceFactory ctor;
+            ModuleInfo module;
             // if we have the type, lets get it
-            if (exportedTypes.TryGetValue (fullTypeName, out t))
-            {
-                if (!exportedFactories.TryGetValue (t.FullName, out ctor))
+            if (exportedModules.TryGetValue (fullTypeName, out module))
+            {
+                if (module.Factory == null)
                 {
-                    ctor = CreateFactory (t);
-                    lock (padlock)
-                    {
-                        exportedFactories[t.FullName] = ctor;
-                    }
+                    module.Factory = CreateFactory (module.TypeInfo);
                 }
-                return ctor ();
+                return module.Factory ();
             }
             return null;
         }
@@ -401,12 +402,16 @@
         public IEnumerable<Type> GetTypes<T> () where T : class
         {
             List<Type> list;
+            // load interface implementations
             if (!exportedTypesByBaseType.TryGetValue (typeof (T).Name, out list))
             {
+                // if none was found, it was not initilized yet...
                 SearchForImplementations (new[] { typeof (T) });
+                // after the interface initilization, check again...
                 if (!exportedTypesByBaseType.TryGetValue (typeof (T).Name, out list))
                     yield break;
             }
+            // return implementations
             for (int i = 0; i < list.Count; i++)
                 yield return list[i];
         }


Minor comment

Minor comment

--- ApiExamples/CSharp/ApiExamples/ExHtmlSaveOptions.cs
+++ ApiExamples/CSharp/ApiExamples/ExHtmlSaveOptions.cs
@@ -455,7 +455,7 @@
             builder.ParagraphFormat.Style = builder.Document.Styles["Heading 3"];
             builder.Writeln("Heading #6");

-            // Create a HtmlSaveOptions object and set the DocumentSplitHeadingLevel to 2
+            // Create a HtmlSaveOptions object and set the DocumentSplitHeadingLevel to 2 //INSP: Comment duplicates code, instead of explaining why we use these options.
             HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html);
             options.DocumentSplitCriteria = DocumentSplitCriteria.HeadingParagraph;
             options.DocumentSplitHeadingLevel = 2;


much better solution

much better solution

thanks JH

--- src/BloomExe/Edit/EditingModel.cs
+++ src/BloomExe/Edit/EditingModel.cs
@@ -651,7 +651,7 @@
 			_view.AddMessageEventListener("preparePageForEditingAfterOrigamiChangesEvent", RethinkPageAndReloadIt);
 			_view.AddMessageEventListener("finishSavingPage", FinishSavingPage);
 			_view.AddMessageEventListener("handleAddNewPageKeystroke", HandleAddNewPageKeystroke);
-			_view.AddMessageEventListener("addPage", AddNewPageBasedOnTemplate);
+			_view.AddMessageEventListener("addPage", (id) => AddNewPageBasedOnTemplate(id));
 		}

@@ -670,13 +670,11 @@
 			{
 				if (CanDuplicatePage)
 				{
-					AddNewPageBasedOnTemplate(this._pageSelection.CurrentSelection.IdOfFirstAncestor);
-					if (_addNewSuccess)
+					if (AddNewPageBasedOnTemplate(this._pageSelection.CurrentSelection.IdOfFirstAncestor))
 						return;
 				}
 				var idOfFirstPageInTemplateBook = CurrentBook.FindTemplateBook().GetPageByIndex(0).Id;
-				AddNewPageBasedOnTemplate(idOfFirstPageInTemplateBook);
-				if (_addNewSuccess)
+				if (AddNewPageBasedOnTemplate(idOfFirstPageInTemplateBook))
 					return;
 			}
 			catch (Exception error)
@@ -704,19 +702,17 @@
 			return _templatePagesDict;
 		}

-		private bool _addNewSuccess;
-		// Normally one would return success or not, but AddMessageEventListener expects a void return value
-		private void AddNewPageBasedOnTemplate(string pageId)
+		private bool AddNewPageBasedOnTemplate(string pageId)
 		{
 			IPage page;
-			_addNewSuccess = false;
 			var dict = GetTemplatePagesForThisBook();
 			if (dict != null && dict.TryGetValue(pageId, out page))
 			{
 				_templateInsertionCommand.Insert(page as Page);
 				_lastPageAdded = pageId;
-				_addNewSuccess = true;
-			}
+				return true;
+			}
+			return false;
 		}

 		private void RethinkPageAndReloadIt(string obj)


Add report if can't find wav file, only mp3

--- src/BloomExe/Publish/EpubMaker.cs
+++ src/BloomExe/Publish/EpubMaker.cs
@@ -382,6 +382,8 @@
 				}
 				else
 				{
+					NonFatalProblem.Report(ModalIf.All, PassiveIf.All,
+						string.Format("Bloom could not find one of the expected audio files for this book, {0}. Bloom can only make a very rough estimate of the length of the mp3 file."));
 					// Crude estimate. In one sample, a 61K mp3 is 7s long.
 					// So, multiply by 7 and divide by 61K to get seconds.
 					// Then, to make a TimeSpan we need ticks, which are 0.1 microseconds,


Updating setting SDK resolver isRunningInVisualStudio (#5562)

--- src/Build/Evaluation/Evaluator.cs
+++ src/Build/Evaluation/Evaluator.cs
@@ -242,7 +242,7 @@
             _sdkResolverService = sdkResolverService;
             _submissionId = submissionId;
             _evaluationProfiler = new EvaluationProfiler(profileEvaluation);
-            _isRunningInVisualStudio = BuildEnvironmentHelper.Instance.RunningInVisualStudio;
+            _isRunningInVisualStudio = String.Equals("true", _data.GlobalPropertiesDictionary.GetProperty("BuildingInsideVisualStudio")?.EvaluatedValue, StringComparison.OrdinalIgnoreCase);

             // In 15.9 we added support for the global property "NuGetInteractive" to allow SDK resolvers to be interactive.
             // In 16.0 we added the /interactive command-line argument so the line below keeps back-compat


Removed file reference in main plugin.

Removed file reference in main plugin.

--- FRBDK/Glue/DialogTreePlugin/MainDialogTreePlugin.cs
+++ FRBDK/Glue/DialogTreePlugin/MainDialogTreePlugin.cs
@@ -18,8 +18,7 @@
     public class MainDialogTreePlugin : PluginBase
     {
         MainControl mainControl;
-        MainControlViewModel mainControlViewModel;
-
+

         public override string FriendlyName => "Dialog Tree Plugin";


Fixed samples height spelling

Fixed samples height spelling

--- Samples/Samples/DrawingText.cs
+++ Samples/Samples/DrawingText.cs
@@ -92,13 +92,13 @@
 			ctx.SetColor (Colors.DarkCyan);
 			text.Text = "Praesent ac lacus nec dolor pulvinar feugiat a id elit.";
 			var size4 = text.GetSize ();
-			text.Heigth = size4.Height / 2;
+			text.Height = size4.Height / 2;
 			text.Trimming=TextTrimming.WordElipsis;
 			ctx.DrawTextLayout (text, col2.Left, col2.Bottom + 5);

 			ctx.SetLineWidth (1);
 			ctx.SetColor (Colors.Blue);
-			ctx.Rectangle (new Rectangle (col2.Left, col2.Bottom + 5, text.Width, text.Heigth));
+			ctx.Rectangle (new Rectangle (col2.Left, col2.Bottom + 5, text.Width, text.Height));
 			ctx.Stroke();
 			ctx.Restore ();

@@ -121,7 +121,7 @@
 			text.Text = string.Format ("Size 1 {0}\r\nSize 2 {1}\r\nSize 3 {2} Scale {3}",
 			                           size1, size2, size3, scale);
 			text.Width = -1; // this clears textsize
-			text.Heigth = -1;
+			text.Height = -1;
 			ctx.Rotate (5);
 			// maybe someone knows a formula with angle and textsize to calculyte ty
 			var ty = 30;


Added test for revisions

Added test for revisions

--- FluentTc.Tests/Locators/BuildIncludeBuilderTests.cs
+++ FluentTc.Tests/Locators/BuildIncludeBuilderTests.cs
@@ -76,5 +76,19 @@
             // Assert
             columns.Should().Be("buildTypeId,href,id,number,state,status,webUrl,startDate,finishDate,statusText");
         }
+
+        [Test]
+        public void GetColumns_IncludeRevisions_Formatted()
+        {
+            // Arrange
+            var buildIncludeBuilder = new BuildIncludeBuilder();
+            buildIncludeBuilder.IncludeRevisions();
+
+            // Act
+            var columns = buildIncludeBuilder.GetColumns();
+
+            // Assert
+            columns.Should().Be("buildTypeId,href,id,number,state,status,webUrl,revisions");
+        }
     }
 }


Fix internal managed cert count

Fix internal managed cert count

--- src/Certify.UI/MainWindow.xaml.cs
+++ src/Certify.UI/MainWindow.xaml.cs
@@ -71,18 +71,20 @@
                 return;
             }

-            if (!_appViewModel.IsRegisteredVersion && _appViewModel.ManagedCertificates != null && _appViewModel.ManagedCertificates.Count >= NUM_ITEMS_FOR_REMINDER)
+            var managedCertCount = _appViewModel.ManagedCertificates?.Where(c => string.IsNullOrEmpty(c.SourceId)).Count() ?? 0;
+
+            if (!_appViewModel.IsRegisteredVersion && managedCertCount >= NUM_ITEMS_FOR_REMINDER)
             {
                 MessageBox.Show(SR.MainWindow_TrialLimitationReached);

-                if (_appViewModel.ManagedCertificates?.Count >= NUM_ITEMS_FOR_LIMIT)
+                if (managedCertCount >= NUM_ITEMS_FOR_LIMIT)
                 {
                     return;
                 }
             }
             else
             {
-                if (_appViewModel.IsRegisteredVersion && _appViewModel.ManagedCertificates?.Count >= 1)
+                if (_appViewModel.IsRegisteredVersion && managedCertCount >= 1)
                 {
                     var licensingManager = ViewModel.AppViewModel.Current.PluginManager?.LicensingManager;

@@ -90,7 +92,7 @@
                     {
                         MessageBox.Show(Certify.Locales.SR.MainWindow_KeyExpired);

-                        if (_appViewModel.ManagedCertificates?.Count >= NUM_ITEMS_FOR_LIMIT)
+                        if (managedCertCount >= NUM_ITEMS_FOR_LIMIT)
                         {
                             return;
                         }
@@ -200,7 +202,7 @@
             Mouse.OverrideCursor = Cursors.AppStarting;
             _appViewModel.IsLoading = true;

-
+

             var cts = new CancellationTokenSource();

@@ -211,7 +213,7 @@
                 await _appViewModel.LoadSettingsAsync();

                 // service host diagnostics
-
+
                 var svcDiag = await _appViewModel.PerformServiceDiagnostics();
                 if (svcDiag.Any(d => d.IsSuccess == false))
                 {


Adding Normalize() method to Tokenizer

Adding Normalize() method to Tokenizer

--- src/CommandLine/Core/Tokenizer.cs
+++ src/CommandLine/Core/Tokenizer.cs
@@ -61,6 +61,23 @@
                                 Enumerable.Empty<Token>().Concat(new[]{ t })));

             var flattened = exploded.SelectMany(x => x);
+
+            return Result.Succeed(flattened, tokenizerResult.SuccessfulMessages());
+        }
+
+        public static Result<IEnumerable<Token>, Error> Normalize(
+            Result<IEnumerable<Token>, Error> tokenizerResult, Func<string, bool> nameLookup)
+        {
+            var tokens = tokenizerResult.SucceededWith();
+
+            var normalized =
+                tokens.Pairwise(
+                    (f, s) =>
+                        f.IsName() && s.IsValue() && nameLookup(f.Text) && ((Value)s).ExplicitlyAssigned
+                            ? Enumerable.Empty<Token>().Concat(f)
+                            : Enumerable.Empty<Token>().Concat(new[] { f, s }));
+
+            var flattened = normalized.SelectMany(x => x);

             return Result.Succeed(flattened, tokenizerResult.SuccessfulMessages());
         }


Incorrect deserialization as some older invoices used different enum

--- Harvest.Net/Serialization/HarvestXmlDeserializer.cs
+++ Harvest.Net/Serialization/HarvestXmlDeserializer.cs
@@ -147,7 +147,10 @@
                     if (match != null)
                         prop.SetValue(x, match, null);
                     else
+                    {
+                        if (value.ToString() == "30 days") value = "net30";
                         prop.SetValue(x, type.FindEnumValue(value.ToString(), Culture), null);
+                    }
                 }
                 else if (type == typeof(Uri))
                 {


[050dev] Reminder TODO

[050dev] Reminder TODO

--- packages/CSharp/dev/Scripts/Toolset.cs
+++ packages/CSharp/dev/Scripts/Toolset.cs
@@ -35,6 +35,7 @@

         string Opus.Core.IToolset.Version(Opus.Core.BaseTarget baseTarget)
         {
+            // TODO: fix this - might come from the DotNetFramework
             return "dev";
         }


Debug assert for enum type

Debug assert for enum type

--- CPPCheckPlugin/CPPCheckPluginPackage.cs
+++ CPPCheckPlugin/CPPCheckPluginPackage.cs
@@ -305,6 +305,7 @@
 					var vcFileInterface = fileObjectType.GetInterface("Microsoft.VisualStudio.VCProjectEngine.VCFile");
 					var fileTypeValue = vcFileInterface.GetProperty("FileType").GetValue(file);
 					Type fileTypeEnumType = fileTypeValue.GetType();
+					Debug.Assert(fileTypeEnumType.FullName == "Microsoft.VisualStudio.VCProjectEngine.eFileType");
 					var fileTypeEnumValue = Enum.GetName(fileTypeEnumType, fileTypeValue);
 					var fileTypeCppCodeConstant = "eFileTypeCppCode";
 					// First check the enum contains the value we're looking for


fix #73 use full include path

fix #73 use full include path

--- CPPCheckPlugin/CPPCheckPluginPackage.cs
+++ CPPCheckPlugin/CPPCheckPluginPackage.cs
@@ -242,7 +242,7 @@
 					var compilerToolInterface = toolType.GetInterface("Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool");
 					if (compilerToolInterface != null)
 					{
-						String includes = tool.AdditionalIncludeDirectories;
+						String includes = tool.FullIncludePath;
 						String definitions = tool.PreprocessorDefinitions;
 						String macrosToUndefine = tool.UndefinePreprocessorDefinitions;
 						String[] includePaths = includes.Split(';');


indentation fix

indentation fix

--- InnerFence.ChargeDemo.Phone/AssociationUriMapper.cs
+++ InnerFence.ChargeDemo.Phone/AssociationUriMapper.cs
@@ -21,6 +21,6 @@
             // In your app, this is where you define which view you want the
             // returning charge request call to land on.
             return new Uri("/MainPage.xaml", UriKind.Relative);
-        }
+        }
     }
 }


Update for CollapsibleContentProvider

Update for CollapsibleContentProvider

--- JabbR/ContentProviders/SlideshareContentProvider.cs
+++ JabbR/ContentProviders/SlideshareContentProvider.cs
@@ -13,14 +13,26 @@
     /// slideshare link (eg. http://www.slideshare.net/verticalmeasures/search-social-and-content-marketing-move-your-business-forward-accelerate).
     /// Send feedback/issues to Seth Webster (@sethwebsterDanTup on Twitter).
     /// </summary>
-    public class SlideShareContentProvider : IContentProvider
+    public class SlideShareContentProvider : CollapsibleContentProvider
     {
         private static readonly String oEmbedUrl = "http://www.slideshare.net/api/oembed/2?url={0}&format=json";
+        dynamic slideShareData;

-        public string GetContent(HttpWebResponse response)
+        protected override string GetTitle(HttpWebResponse response)
         {
-            if (response.ResponseUri.AbsoluteUri.StartsWith("http://slideshare.net/", StringComparison.OrdinalIgnoreCase)
-              || response.ResponseUri.AbsoluteUri.StartsWith("http://www.slideshare.net/", StringComparison.OrdinalIgnoreCase))
+            EnsureSlideShareData(response);
+            return slideShareData.title;
+        }
+
+        protected override string GetCollapsibleContent(HttpWebResponse response)
+        {
+            EnsureSlideShareData(response);
+            return slideShareData.html;
+        }
+
+        private void EnsureSlideShareData(HttpWebResponse response)
+        {
+            if (null == slideShareData)
             {
                 // We have to make a call to the SlideShare api because
                 // their embed code request the unique ID of the slide deck
@@ -31,12 +43,15 @@
                 var webResponse = webRequest.GetResponse();
                 using (var reader = new StreamReader(webResponse.GetResponseStream()))
                 {
-                    dynamic slideShareData = JsonConvert.DeserializeObject(reader.ReadToEnd()
-                               );
-                    return slideShareData.html;
+                    slideShareData = JsonConvert.DeserializeObject(reader.ReadToEnd());
                 }
             }
-            return null;
+        }
+
+        protected override bool IsValidContent(HttpWebResponse response)
+        {
+            return response.ResponseUri.AbsoluteUri.StartsWith("http://slideshare.net/", StringComparison.OrdinalIgnoreCase)
+               || response.ResponseUri.AbsoluteUri.StartsWith("http://www.slideshare.net/", StringComparison.OrdinalIgnoreCase);
         }
     }
 }


Improve message cache management

Improve message cache management

--- src/Discord.Net/Models/Channel.cs
+++ src/Discord.Net/Models/Channel.cs
@@ -146,14 +146,12 @@
 			var cacheLength = _client.Config.MessageCacheLength;
 			if (cacheLength > 0)
 			{
-				while (_messages.Count > cacheLength - 1)
-				{
-					var oldest = _messages.Select(x => x.Value.Id).OrderBy(x => x).FirstOrDefault();
-					if (oldest != null)
-					{
-						if (_messages.TryRemove(oldest, out message))
-							_client.Messages.TryRemove(oldest);
-					}
+				var oldestIds = _messages.Select(x => x.Value.Id).OrderBy(x => x).Take(_messages.Count - cacheLength);
+				foreach (var id in oldestIds)
+				{
+					Message removed;
+					if (_messages.TryRemove(id, out removed))
+						_client.Messages.TryRemove(id);
 				}
 				_messages.TryAdd(message.Id, message);
 			}


Minor edit

Minor edit

--- src/Discord.Net/Models/Message.cs
+++ src/Discord.Net/Models/Message.cs
@@ -341,7 +341,7 @@
         public Task Acknowledge()
         {
             if (Client.Config.Mode != DiscordMode.Client)
-                throw new InvalidOperationException("Message.Acknowledge may only be used in Client mode.");
+                throw new InvalidOperationException("This function may only be used in Client mode.");

             if (User.Id != Client.CurrentUser.Id)
                 return Client.ClientAPI.Send(new AckMessageRequest(Channel.Id, Id));


Added skipexec param to if exec

Added skipexec param to if exec

--- HCEngine/HCEngine/Default/Language/Statements/If.cs
+++ HCEngine/HCEngine/Default/Language/Statements/If.cs
@@ -13,7 +13,7 @@
         /// </summary>
         public IScriptExecution Execute(ISourceReader reader, IExecutionScope scope, bool skipExec)
         {
-            return new ScriptExecution(Exec(reader, scope));
+            return new ScriptExecution(Exec(reader, scope, skipExec));
         }

         /// <summary>
@@ -24,7 +24,7 @@
             return word.Equals(DefaultLanguageKeywords.IfKeyword);
         }

-        private IEnumerator<object> Exec(ISourceReader reader, IExecutionScope scope)
+        private IEnumerator<object> Exec(ISourceReader reader, IExecutionScope scope, bool skipExec)
         {
             throw new NotImplementedException();
         }


Fix injection of clearance cookies

Fix injection of clearance cookies

Cookies will be set to dot-domains (e.g. .domain.tld) instead of regular domains (e.g. domain.tld), to be available for requests to subdomains.
Also invalidating existing dot-domain cookies is no longer necessary as their values are simply overwritten.

--- CloudFlareUtilities/ClearanceHandler.cs
+++ CloudFlareUtilities/ClearanceHandler.cs
@@ -61,7 +61,7 @@
         /// <param name="request">The HTTP request message to send to the server.</param>
         /// <param name="cancellationToken">A cancellation token to cancel operation.   </param>
         /// <returns>The task object representing the asynchronous operation.</returns>
-        protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
+        protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
         {
             EnsureClientHeader(request);
             InjectCookies(request);
@@ -105,11 +105,8 @@

             if (ClientHandler.UseCookies)
             {
-                foreach (var cookie in ClientHandler.CookieContainer.GetCookiesByName(request.RequestUri, IdCookieName, ClearanceCookieName))
-                    cookie.Expired = true;
-
-                ClientHandler.CookieContainer.SetCookies(request.RequestUri, idCookie.ToHeaderValue());
-                ClientHandler.CookieContainer.SetCookies(request.RequestUri, clearanceCookie.ToHeaderValue());
+                ClientHandler.CookieContainer.Add(request.RequestUri, idCookie);
+                ClientHandler.CookieContainer.Add(request.RequestUri, clearanceCookie);
             }
             else
             {


Fix DataGridRow resizing issue

Fix DataGridRow resizing issue

--- src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs
+++ src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs
@@ -218,6 +218,8 @@
             {
                 // No explicit height values were set so we can autosize
                 autoSizeHeight = true;
+                // We need to invalidate desired height in order to grow or shrink as needed
+                InvalidateDesiredHeight();
                 measureHeight = double.PositiveInfinity;
             }
             else


Inline method to reveal the nested loops of the test class lifecycle.

--- src/Fixie/Internal/ClassRunner.cs
+++ src/Fixie/Internal/ClassRunner.cs
@@ -51,8 +51,9 @@
                 {
                     runCasesInvokedByLifecycle = true;

-                    foreach (var @case in YieldCases(orderedMethods, summary))
-                        Run(@case, caseLifecycle, summary);
+                    foreach (var method in orderedMethods)
+                        foreach (var @case in YieldCases(method, summary))
+                            Run(@case, caseLifecycle, summary);
                 };

                 var runContext = isOnlyTestClass && methods.Count == 1
@@ -99,13 +100,6 @@

                 return methods;
             }
-        }
-
-        IEnumerable<Case> YieldCases(IReadOnlyList<MethodInfo> orderedMethods, ExecutionSummary summary)
-        {
-            foreach (var method in orderedMethods)
-                foreach (var @case in YieldCases(method, summary))
-                    yield return @case;
         }

         IEnumerable<Case> YieldCases(MethodInfo method, ExecutionSummary summary)


Fix broken test

Fix broken test

--- src/Foundatio/Queues/QueueBase.cs
+++ src/Foundatio/Queues/QueueBase.cs
@@ -55,9 +55,10 @@
             }
         }

-        public virtual Task<IQueueEntry<T>> DequeueAsync(TimeSpan? timeout = null) {
-            using (var timeoutCancellationTokenSource = timeout.ToCancellationTokenSource(TimeSpan.FromSeconds(30)))
-                return DequeueAsync(timeoutCancellationTokenSource.Token);
+        public virtual async Task<IQueueEntry<T>> DequeueAsync(TimeSpan? timeout = null) {
+            using (var timeoutCancellationTokenSource = timeout.ToCancellationTokenSource(TimeSpan.FromSeconds(30))) {
+                return await DequeueAsync(timeoutCancellationTokenSource.Token).AnyContext();
+            }
         }

         public abstract Task RenewLockAsync(IQueueEntry<T> queueEntry);


PubDate is actually required.

PubDate is actually required.

--- DotOPDS/Models/Book.cs
+++ DotOPDS/Models/Book.cs
@@ -15,7 +15,7 @@
         public string Archive { get; set; }              // archive with file. optional
         public string Title { get; set; }                // book title. required
         public string Annotation { get; set; }           // book annotation. optional
-        public DateTime Date { get; set; }               // publication date. optional
+        public DateTime Date { get; set; }               // publication date. required
         public string Series { get; set; }               // book series. optional
         public int SeriesNo { get; set; }                // number of book in series. optional
         public Cover Cover { get; set; }                 // cover image. optional


up/down

up/down

--- ConsoleFramework/Controls/TextEditor.cs
+++ ConsoleFramework/Controls/TextEditor.cs
@@ -128,7 +128,7 @@
         /// TODO :
         /// </summary>
         static void moveWindowToCursor(Point cursor,
-            TextEditorController controller, bool light=false) {
+            TextEditorController controller, bool light = false) {
             Rect oldWindow = controller.Window;

             if (cursor.X >= oldWindow.Width) {
@@ -184,27 +184,44 @@
                 var oldWindow = controller.Window;
                 switch (direction) {
                     case Direction.Up: {
-                        Point textPos = cursorPosToTextPos(oldCursorPos, oldWindow);
-                        if (textPos.Y == 0) {
-                            if (textPos.X == 0) {
+                        Point oldTextPos = cursorPosToTextPos(oldCursorPos, oldWindow);
+                        Point textPos;
+                        if (oldTextPos.Y == 0) {
+                            if (oldTextPos.X == 0) {
                                 break;
                             }

-                            controller.setCursorPosLight(new Point(0, 0));
-                            controller.Window = new Rect(new Point(0, 0), oldWindow.Size);
-                            break;
+                            textPos = new Point(0, 0);
+                        } else {
+                            string prevLine = controller.textHolder.Lines[oldTextPos.Y - 1];
+                            textPos = new Point(
+                                Math.Min(controller.lastCursorX, prevLine.Length),
+                                oldTextPos.Y - 1
+                            );
                         }

-                        string prevLine = controller.textHolder.Lines[textPos.Y - 1];
-                        moveWindowToCursor(
-                            textPosToCursorPos(
-                                new Point(
-                                    Math.Min(controller.lastCursorX, prevLine.Length),
-                                    textPos.Y - 1
-                                ), oldWindow),
-                            controller,
-                            true
-                        );
+                        moveWindowToCursor(textPosToCursorPos(textPos, oldWindow), controller, true);
+                        break;
+                    }
+                    case Direction.Down: {
+                        Point oldTextPos = cursorPosToTextPos(oldCursorPos, oldWindow);
+                        Point textPos;
+                        if (oldTextPos.Y == controller.textHolder.LinesCount - 1) {
+                            string lastLine = controller.textHolder.Lines[controller.textHolder.LinesCount - 1];
+                            if (oldTextPos.X == lastLine.Length) {
+                                break;
+                            }
+
+                            textPos = new Point(lastLine.Length, controller.textHolder.LinesCount - 1);
+                        } else {
+                            string nextLine = controller.textHolder.Lines[oldTextPos.Y + 1];
+                            textPos = new Point(
+                                Math.Min(controller.lastCursorX, nextLine.Length),
+                                oldTextPos.Y + 1
+                            );
+                        }
+
+                        moveWindowToCursor(textPosToCursorPos(textPos, oldWindow), controller, true);
                         break;
                     }
                     // TODO : remaining directions


ui update for authorized devices

ui update for authorized devices

--- KryptPadWebApp/Views/Account/AuthorizeDevice.cshtml
+++ KryptPadWebApp/Views/Account/AuthorizeDevice.cshtml
@@ -3,7 +3,7 @@
     /**/

     ViewBag.Title = "Authorize Device";
-    Layout = "~/Views/Shared/_AppLayout.cshtml";
+    Layout = "~/Views/Shared/_Layout.cshtml";
 }

 <div class="container">


AI now flees only on own platform. Still a minor issue with the bottom floor (water), but I assume water=death in the real game anyways.

--- Corvus/Corvus/Components/AIComponent.cs
+++ Corvus/Corvus/Components/AIComponent.cs
@@ -158,10 +158,8 @@
                             //Follow the entity.
                             FollowEntity(e, Time);

-                            Random r = new Random();
-                            int blockChance = r.Next(1, 5);
-                            //If the entity is attacking and is within attacking range, and is facing us, and we're not currently blocking, and blockChance is good, block.
-                            if (coc.IsAttackingMelee && EntityWithinAttackRange(e) && EntityFacingMe(e) && !coc.IsBlocking && blockChance >= 3)
+                            //If the entity is attacking and is within attacking range, and is facing us, and we're not currently blocking, block.
+                            if (coc.IsAttackingMelee && EntityWithinAttackRange(e) && EntityFacingMe(e) && !coc.IsBlocking)
                                 CombatComponent.BeginBlock();

                             //If the entity isn't attacking, stop blocking.
@@ -212,7 +210,7 @@
                 else if (DeathStarted) //DYING AI
                 {
                     double totalMs = (DateTime.Now - StartOfDeath).TotalMilliseconds;
-                    double walkTime = 250;
+                    double walkTime = 200;

                     if (totalMs < walkTime)
                         MovementComponent.BeginWalking(Direction.Left);
@@ -228,11 +226,23 @@
                 else if (FleeingStarted) //FLEEING AI
                 {
                     Direction entityDir = GetEntityDirection(FleeingFromEntity);
-
-                    if (entityDir == Direction.Left)
-                        MovementComponent.BeginWalking(Direction.Right);
-                    else
-                        MovementComponent.BeginWalking(Direction.Left);
+                    Vector2 leftPlatformVector = new Vector2(Parent.Location.Center.X - 50, Parent.Location.Bottom + 1);
+                    Vector2 rightPlatformVector = new Vector2(Parent.Location.Center.X + 50, Parent.Location.Bottom + 1);
+                    Vector2 leftWallVector = new Vector2(Parent.Location.Center.X - 50, Parent.Location.Center.Y);
+                    Vector2 rightWallVector = new Vector2(Parent.Location.Center.X + 50, Parent.Location.Center.Y);
+                    bool leftPossible = PhysicsSystem.IsLocationSolid(leftPlatformVector);// && !PhysicsSystem.IsLocationSolid(leftWallVector);
+                    bool rightPossible = PhysicsSystem.IsLocationSolid(rightPlatformVector);// && !PhysicsSystem.IsLocationSolid(rightWallVector);
+
+                    if (MovementComponent.CurrentDirection == Direction.Left)
+                        if (leftPossible)
+                            MovementComponent.BeginWalking(Direction.Left);
+                        else
+                            MovementComponent.BeginWalking(Direction.Right);
+                    else if (MovementComponent.CurrentDirection == Direction.Right)
+                        if (rightPossible)
+                            MovementComponent.BeginWalking(Direction.Right);
+                        else
+                            MovementComponent.BeginWalking(Direction.Left);

                     //Begin process of death if entity has run out of health.
                     if (AttributesComponent.CurrentHealth <= 0)


Fix death spamming when falling into the void

--- Craft.Net.Data/Entities/LivingEntity.cs
+++ Craft.Net.Data/Entities/LivingEntity.cs
@@ -100,7 +100,7 @@

         public override void PhysicsUpdate(World world)
         {
-            if (Position.Y < -32)
+            if (Position.Y < -32 && Health > 0)
                 Health -= 4;
             base.PhysicsUpdate(world);
         }


changed from first to single in country

changed from first to single in country

--- DataGenerator/Types/Name/NameFactory.cs
+++ DataGenerator/Types/Name/NameFactory.cs
@@ -78,9 +78,9 @@
         ///     Returns a function that returns names based on Country.
         /// </returns>
         public Func<string> FirstNameInitialiser(Country country) {
-            var commonName = GetNameBasedOnCountry(country);
-            return GenerateName(commonName.Female
-                .Concat(commonName.Male)
+            var nameBasedOnCountry = GetNameBasedOnCountry(country);
+            return GenerateName(nameBasedOnCountry.Female
+                .Concat(nameBasedOnCountry.Male)
                 .ToList());
         }

@@ -146,17 +146,17 @@
         private Name GetNameBasedOnCountry(Country country) {
             switch (country) {
                 case Country.Sweden:
-                    return _names.First(name => name.Country == Sweden);
+                    return _names.Single(name => name.Country == Sweden);
                 case Country.Norway:
-                    return _names.First(name => name.Country == Norway);
+                    return _names.Single(name => name.Country == Norway);
                 case Country.Denmark:
-                    return _names.First(name => name.Country == Denmark);
+                    return _names.Single(name => name.Country == Denmark);
                 case Country.Russia:
-                    return _names.First(name => name.Country == Russia);
+                    return _names.Single(name => name.Country == Russia);
                 case Country.Finland:
-                    return _names.First(name => name.Country == Finland);
+                    return _names.Single(name => name.Country == Finland);
                 case Country.Spain:
-                    return _names.First(name => name.Country == Spain);
+                    return _names.Single(name => name.Country == Spain);
                 default:
                     throw new ArgumentOutOfRangeException(nameof(country), country, null);
             }


Namespaces fix.

Namespaces fix.

--- DataStructures/Graphs/IWeightedGraph.cs
+++ DataStructures/Graphs/IWeightedGraph.cs
@@ -1,6 +1,6 @@
 using System;

-namespace DataStructures
+namespace DataStructures.Graphs
 {
     /// <summary>
     /// This interface should be implemented alongside the IGraph interface.


Added Maundy Thursday to the list of chirstian holidays

--- DateTimeExtensions/ChristianHolidays.cs
+++ DateTimeExtensions/ChristianHolidays.cs
@@ -96,6 +96,16 @@
 			}
 		}

+		private static Holiday maundyThursday;
+		public static Holiday MaundyThursday {
+			get {
+				if (maundyThursday == null) {
+					maundyThursday = new EasterBasedHoliday("Maundy Thursday", -3);
+				}
+				return maundyThursday;
+			}
+		}
+
 		private static Holiday goodFriday;
 		public static Holiday GoodFriday {
 			get {


added referencing tagged values to connectors

--- EANavigator/EAAddin.cs
+++ EANavigator/EAAddin.cs
@@ -264,14 +264,16 @@
     		{
     			menuOptionsList.AddRange(getTaggedValueMenuItems(element as UML.Classes.Kernel.Element));
     		}
-    		//tagged values can reference only ElementWrappers, attributes and operations
+    		//tagged values can reference only ElementWrappers, attributes, relationships and operations
     		//same for link to element feature links
     		if (element is TSF.UmlToolingFramework.Wrappers.EA.ElementWrapper
     		    || element is UML.Classes.Kernel.Property
-    		    || element is UML.Classes.Kernel.Operation)
+    		    || element is UML.Classes.Kernel.Operation
+    		    || element is UML.Classes.Kernel.Relationship)
     		{
     			//the root package can't have links
-    			if (element.owner != null)
+    			if (element.owner != null
+    			    && !(element is UML.Classes.Kernel.Relationship))
     			{
     				menuOptionsList.Add(menuLinkedToElementFeature);
     			}


Fix BOM test paths for Unix (#377)

Fix BOM test paths for Unix (#377)

--- test/Templates.Test/ByteOrderMarkTest.cs
+++ test/Templates.Test/ByteOrderMarkTest.cs
@@ -10,6 +10,7 @@
     public class ByteOrderMarkTest
     {
         private readonly ITestOutputHelper _output;
+        private readonly char _separator = Path.DirectorySeparatorChar;

         public ByteOrderMarkTest(ITestOutputHelper output)
         {
@@ -17,14 +18,16 @@
         }

         [Theory]
-        [InlineData(@"\Microsoft.AspNetCore.SpaTemplates\content")]
-        [InlineData(@"\Microsoft.DotNet.Web.ProjectTemplates\content")]
-        [InlineData(@"\Microsoft.DotNet.Web.Spa.ProjectTemplates\content")]
-        public void CheckForByteOrderMarkSpaTemplates(string path)
+        [InlineData("Microsoft.AspNetCore.SpaTemplates")]
+        [InlineData("Microsoft.DotNet.Web.ProjectTemplates")]
+        [InlineData("Microsoft.DotNet.Web.Spa.ProjectTemplates")]
+        public void CheckForByteOrderMarkSpaTemplates(string projectType)
         {
             var currentDirectory = Directory.GetCurrentDirectory();
-            var srcDirectory = Path.GetFullPath(Path.Combine(currentDirectory, @"..\..\..\..\..\src"));
-            var directories = Directory.GetDirectories(srcDirectory + path, "*Sharp");
+            var repositoryPath = Directory.GetParent(currentDirectory).Parent.Parent.Parent.Parent.FullName;
+            var srcDirectory = Path.Combine(repositoryPath, "src");
+            var path = Path.Combine(projectType, "content");
+            var directories = Directory.GetDirectories(Path.Combine(srcDirectory, path), "*Sharp");

             var filesWithBOMCharactersPresent = false;
             foreach (var directory in directories)


Progress bug fixed

Progress bug fixed

--- Libraries/SharpDox.Build/Context/Step/ExportStep.cs
+++ Libraries/SharpDox.Build/Context/Step/ExportStep.cs
@@ -1,8 +1,5 @@
-using System.IO;
-using SharpDox.Sdk.Exporter;
-using SharpDox.Sdk.Config;
-using SharpDox.Model;
-using System;
+using SharpDox.Model;
+using System.IO;

 namespace SharpDox.Build.Context.Step
 {
@@ -28,7 +25,7 @@
                     var outputPath = GetOutputPath(_stepInput.CoreConfigSection.OutputPath, exporter.ExporterName);

                     exporter.OnStepMessage += (m) => ExecuteOnStepMessage(string.Format("[{0}] {1}", exporter.ExporterName, m));
-                    exporter.OnStepProgress += (p) => ExecuteOnStepProgress((int)(((double)p / _stepInput.AllExporters.Length) + (i / _stepInput.AllExporters.Length * 100)));
+                    exporter.OnStepProgress += (p) => ExecuteOnStepProgress((int)(((double)p / _stepInput.CoreConfigSection.ActivatedExporters.Count) + (i / _stepInput.CoreConfigSection.ActivatedExporters.Count * 100)));
                     exporter.Export(sdProject, outputPath);
                 }
                 i++;


Remove IClientConnection.Connect extension, unstable/bad practice

--- Desktop/Tempest/ConnectionExtensions.cs
+++ Desktop/Tempest/ConnectionExtensions.cs
@@ -4,7 +4,7 @@
 // Author:
 //   Eric Maupin <me@ermau.com>
 //
-// Copyright (c) 2012 Eric Maupin
+// Copyright (c) 2011-2012 Eric Maupin
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -102,47 +102,12 @@
 		public static void Send (this IEnumerable<IConnection> connections, Message msg)
 		{
 			if (connections == null)
-					throw new ArgumentNullException ("connections");
+				throw new ArgumentNullException ("connections");
 			if (msg == null)
-					throw new ArgumentNullException ("msg");
+				throw new ArgumentNullException ("msg");

 			foreach (IConnection c in connections)
-					c.Send (msg);
-		}
-	}
-
-	public static class ClientConnectionExtensions
-	{
-		public static ConnectionResult Connect (this IClientConnection self, EndPoint endPoint, MessageTypes messageTypes, int timeout = -1)
-		{
-			ConnectionResult result = ConnectionResult.FailedUnknown;
-			AutoResetEvent wait = new AutoResetEvent (false);
-
-			EventHandler<ClientConnectionEventArgs> connected = null;
-			EventHandler<DisconnectedEventArgs> disconnected = null;
-
-			connected = (s, e) =>
-			{
-				self.Connected -= connected;
-				self.Disconnected -= disconnected;
-				result = ConnectionResult.Success;
-				wait.Set();
-			};
-
-			disconnected = (s, e) =>
-			{
-				self.Connected -= connected;
-				self.Disconnected -= disconnected;
-				result = e.Result;
-				wait.Set();
-			};
-
-			self.Connected += connected;
-			self.Disconnected += disconnected;
-			self.ConnectAsync (endPoint, messageTypes);
-			wait.WaitOne (timeout);
-
-			return result;
+				c.Send (msg);
 		}
 	}
 }


Fixed test

Fixed test

--- test/TransNet_Test/TransformationTest.cs
+++ test/TransNet_Test/TransformationTest.cs
@@ -110,7 +110,7 @@
         private string GetExampleXML()
         {
             return
-                "<MaltegoMessage><MaltegoTransformResponseMessage><_entities><Entity Type=\"EntityType\"><Value>Value</Value><Weight>1</Weight><AdditionalFields><Field Name=\"AdditionalField\" DisplayName=\"DisplayName\" MatchingRule=\"strict\">Value</Field></AdditionalFields></Entity></_entities></MaltegoTransformResponseMessage></MaltegoMessage>";
+                "<MaltegoMessage><MaltegoTransformResponseMessage><Entities><Entity Type=\"EntityType\"><Value>Value</Value><Weight>1</Weight><AdditionalFields><Field Name=\"AdditionalField\" DisplayName=\"DisplayName\" MatchingRule=\"strict\">Value</Field></AdditionalFields></Entity></Entities></MaltegoTransformResponseMessage></MaltegoMessage>";
         }
     }
 }


Create directory if it doesn't exist.

Create directory if it doesn't exist.

--- Pegasus.Workbench/AppViewModel.cs
+++ Pegasus.Workbench/AppViewModel.cs
@@ -70,6 +70,7 @@
             this.Save = new ReactiveCommand(grammarNameChanges.Select(n => n != "Untitled.peg"));
             this.Save.RegisterAsyncAction(_ =>
             {
+                Directory.CreateDirectory(Path.GetDirectoryName(this.grammarFileName));
                 File.WriteAllText(this.grammarFileName, this.grammarText);
                 this.GrammarChanged = false;
             });
@@ -78,6 +79,7 @@
             this.SaveAs.RegisterAsyncAction(_ =>
             {
                 var fileName = (string)_;
+                Directory.CreateDirectory(Path.GetDirectoryName(fileName));
                 File.WriteAllText(fileName, this.grammarText);
                 this.GrammarFileName = fileName;
                 this.GrammarChanged = false;


Take updates lock on loaded vessels only

--- LmpClient/Systems/VesselLockSys/VesselLockEvents.cs
+++ LmpClient/Systems/VesselLockSys/VesselLockEvents.cs
@@ -144,7 +144,8 @@
                         switch (lockDefinition.Type)
                         {
                             case LockType.Update:
-                                LockSystem.Singleton.AcquireUpdateLock(lockDefinition.VesselId);
+                                if (vessel.loaded)
+                                    LockSystem.Singleton.AcquireUpdateLock(lockDefinition.VesselId);
                                 break;
                             case LockType.UnloadedUpdate:
                                 LockSystem.Singleton.AcquireUnloadedUpdateLock(lockDefinition.VesselId);


Added OnFinish to Forms-UWP

Added OnFinish to Forms-UWP

--- Lottie.Forms.UWP/Renderers/AnimationViewRenderer.cs
+++ Lottie.Forms.UWP/Renderers/AnimationViewRenderer.cs
@@ -31,6 +31,7 @@
             if (Control == null)
             {
                 _animationView = new LottieAnimationView();
+                _animationView.AnimatorUpdate += FireOnFinishIfProgressReachesOne;
                 SetNativeControl(_animationView);
             }

@@ -54,8 +55,16 @@
                 if (e.NewElement.AutoPlay)
                     _animationView.PlayAnimation();
             }
-        }
-
+        }
+
+        private void FireOnFinishIfProgressReachesOne(object sender, ValueAnimator.ValueAnimatorUpdateEventArgs e)
+        {
+            if (e.Animation.Progress >= 1)
+            {
+                Element.FireOnFinish();
+            }
+        }
+
         private void OnPlay(object sender, EventArgs e)
         {
             if (_animationView != null)


Fix for Signal Versions when controller type

When a controller type is changed from an FTP type controller to maxtime controller it continues to try and Ftp to the controller because of the historical records.

--- MOE.Common/Models/Repositories/SignalsRepository.cs
+++ MOE.Common/Models/Repositories/SignalsRepository.cs
@@ -460,11 +460,13 @@
             List<int> controllerTypes = new List<int>{4,5};
             var activeSignals = _db.Signals.Where(r => r.VersionActionId != 3)
                 .Include(s => s.ControllerType)
-                .Where(s => !controllerTypes.Contains(s.ControllerTypeID))
+                //.Where(s => !controllerTypes.Contains(s.ControllerTypeID))
                 .ToList();
             activeSignals = activeSignals
                 .GroupBy(r => r.SignalID)
                 .Select(g => g.OrderByDescending(r => r.Start).FirstOrDefault()).ToList();
+            activeSignals = activeSignals.Where(s => !controllerTypes.Contains(s.ControllerTypeID)).ToList();
+
             return activeSignals;
         }


Bump version

Bump version

--- MonoDroid/Xamarin.Mobile/Properties/AssemblyInfo.cs
+++ MonoDroid/Xamarin.Mobile/Properties/AssemblyInfo.cs
@@ -25,5 +25,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("0.6.3.0")]
-[assembly: AssemblyFileVersion("0.6.3.0")]
+[assembly: AssemblyVersion("0.7.0.0")]
+[assembly: AssemblyFileVersion("0.7.0.0")]


KeyOctaveクラスにコンストラクタを追加

KeyOctaveクラスにコンストラクタを追加

--- MusicXMLUtils/Structure/Attributes/Key/KeyOctave.cs
+++ MusicXMLUtils/Structure/Attributes/Key/KeyOctave.cs
@@ -49,5 +49,14 @@

         [XmlText(DataType = "integer")]
         public string Value { get; set; }
+
+        public KeyOctave()
+        {
+        }
+
+        public KeyOctave(string value)
+        {
+            this.Value = value;
+        }
     }
 }


移除自动格式化

移除自动格式化

普通字符替换会引起一些异常，后续可采用解析树进行格式化。

--- Natasha/Engine/ComplieModule/ScriptComplieEngine.cs
+++ Natasha/Engine/ComplieModule/ScriptComplieEngine.cs
@@ -140,7 +140,7 @@
         public static Assembly StreamComplier(string content, Action<Diagnostic> errorAction = null)
         {

-            StringBuilder recoder = new StringBuilder(LineFormat(ref content));
+            StringBuilder recoder = new StringBuilder(content);

             var (Tree, ClassName) = GetTreeAndClassName(content);

@@ -240,7 +240,7 @@
         public static Assembly FileComplier(string content, Action<Diagnostic> errorAction = null)
         {

-            StringBuilder recoder = new StringBuilder(LineFormat(ref content));
+            StringBuilder recoder = new StringBuilder(content);

             //类名获取


Update expected results on directory finder tests

--- src/NUnitEngine/nunit.engine.tests/Internal/DirectoryFinderTests.cs
+++ src/NUnitEngine/nunit.engine.tests/Internal/DirectoryFinderTests.cs
@@ -56,10 +56,10 @@
         [TestCase("net-4.0/nunit.framework.dll", 1)]
         [TestCase("net-*/nunit.framework.dll", 3)]
         [TestCase("net-*/*.framework.dll", 3)]
-        [TestCase("*/v2-tests/*.dll", 2)]
-        [TestCase("add*/v?-*/*.dll", 2)]
-        [TestCase("**/v2-tests/*.dll", 2)]
-        [TestCase("addins/**/*.dll", 7)]
+        [TestCase("*/v2-tests/*.dll", 5)]
+        [TestCase("add*/v?-*/*.dll", 5)]
+        [TestCase("**/v2-tests/*.dll", 5)]
+        [TestCase("addins/**/*.dll", 10)]
         [TestCase("addins/../net-*/nunit.framework.dll", 3)]
         public void GetFiles(string pattern, int count)
         {


.warnp will now correctly overwrite old setting on the same number of warnings

--- src/NadekoBot/Modules/Administration/Commands/UserPunishCommands.cs
+++ src/NadekoBot/Modules/Administration/Commands/UserPunishCommands.cs
@@ -214,25 +214,15 @@

                 using (var uow = DbHandler.UnitOfWork())
                 {
-                    var ps = uow.GuildConfigs.For(Context.Guild.Id).WarnPunishments;
-                    var p = ps.FirstOrDefault(x => x.Count == number);
-
-                    if (p == null)
-                    {
-                        ps.Add(new WarningPunishment()
-                        {
-                            Count = number,
-                            Punishment = punish,
-                            Time = time,
-                        });
-                    }
-                    else
-                    {
-                        p.Count = number;
-                        p.Punishment = punish;
-                        p.Time = time;
-                        uow._context.Update(p);
-                    }
+                    var ps = uow.GuildConfigs.For(Context.Guild.Id, set => set.Include(x => x.WarnPunishments)).WarnPunishments;
+                    ps.RemoveAll(x => x.Count == number);
+
+                    ps.Add(new WarningPunishment()
+                    {
+                        Count = number,
+                        Punishment = punish,
+                        Time = time,
+                    });
                     uow.Complete();
                 }


Fix confirmation email

Fix confirmation email

The customized Index.cshtml.cs didn't include the fix of
https://github.com/aspnet/Identity/issues/1638.

--- Areas/Identity/Pages/Account/Manage/Index.cshtml.cs
+++ Areas/Identity/Pages/Account/Manage/Index.cshtml.cs
@@ -128,7 +128,7 @@
             var callbackUrl = Url.Page(
                 "/Account/ConfirmEmail",
                 pageHandler: null,
-                values: new { user.Id, code },
+                values: new { userId = user.Id, code = code },
                 protocol: Request.Scheme);
             await _emailSender.SendEmailAsync(
                 user.Email,


updating support links

updating support links

(cherry picked from commit 54eb75af91fa0b800216f6c33f78cb815e353b0a)

--- MatterControlLib/ApplicationView/BrandMenuButton.cs
+++ MatterControlLib/ApplicationView/BrandMenuButton.cs
@@ -136,13 +136,13 @@
 				menuItem.Click += (s, e) => ApplicationController.Instance.LaunchBrowser("https://forums.matterhackers.com/category/20/mattercontrol");

 				menuItem = modifyMenu.CreateMenuItem("Guides and Articles".Localize(), linkIcon);
-				menuItem.Click += (s, e) => ApplicationController.Instance.LaunchBrowser("http://www.matterhackers.com/topic/mattercontrol");
+				menuItem.Click += (s, e) => ApplicationController.Instance.LaunchBrowser("https://www.matterhackers.com/topic/mattercontrol");

 				menuItem = modifyMenu.CreateMenuItem("Support".Localize(), linkIcon);
-				menuItem.Click += (s, e) => ApplicationController.Instance.LaunchBrowser("http://https://www.matterhackers.com/mattercontrol/support");
+				menuItem.Click += (s, e) => ApplicationController.Instance.LaunchBrowser("https://www.matterhackers.com/mattercontrol/support");

 				menuItem = modifyMenu.CreateMenuItem("Release Notes".Localize(), linkIcon);
-				menuItem.Click += (s, e) => ApplicationController.Instance.LaunchBrowser("http://wiki.mattercontrol.com/Release_Notes");
+				menuItem.Click += (s, e) => ApplicationController.Instance.LaunchBrowser("https://www.matterhackers.com/mattercontrol/support/release-notes");

 				modifyMenu.CreateSeparator();


circle page cache

circle page cache

--- DuDuRiBao/Pages/CircleStoryPage.xaml.cs
+++ DuDuRiBao/Pages/CircleStoryPage.xaml.cs
@@ -39,13 +39,24 @@
             StoryListView.Refresh = RefreshMainList;
             StoryListView.LoadMore = LoadMoreStories;
             StoryListView.FloatButtonAction = VM.JoinCircle;
+
+            Loaded += CircleStoryPage_Loaded;
+        }
+
+        private void CircleStoryPage_Loaded(object sender, RoutedEventArgs e)
+        {
+            if (IsUsingCachedWhenNavigate())
+            {
+                return;
+            }
+            StoryListView.SetRefresh(true);
         }

         protected override void OnNavigatedTo(NavigationEventArgs e)
         {
             NavigationManager.Instance.UpdateGoBackBtnVisibility();
+            _canUseCached = VM.CircleId == e.Parameter.ToString();
             VM.CircleId = e.Parameter.ToString();
-            StoryListView.SetRefresh(true);
         }

         private void StoryListView_ItemClick(object sender, ItemClickEventArgs e)


#257 pull poll from receipt to the interface

Polling it is the normal behaviour to retrieve a receipt, so hiding the method from the interface makes no sense.

--- src/Nethereum.RPC/TransactionReceipts/ITransactionReceiptService.cs
+++ src/Nethereum.RPC/TransactionReceipts/ITransactionReceiptService.cs
@@ -29,6 +29,6 @@
         Task<List<TransactionReceipt>> SendRequestsAndWaitForReceiptAsync(IEnumerable<Func<Task<string>>> transactionFunctions,
           CancellationTokenSource tokenSource = null);

-
+        Task<TransactionReceipt> PollForReceiptAsync(string transaction, CancellationTokenSource tokenSource = null);
     }
 }


Fix graph building when LAV Audio can't decode

--- MediaBrowser.Theater.DirectShow/DirectShowPlayer.cs
+++ MediaBrowser.Theater.DirectShow/DirectShowPlayer.cs
@@ -1171,9 +1171,16 @@
                             if (decIn != null)
                             {
                                 hr = _filterGraph.ConnectDirect(pins[0], decIn, null);
-                                DsError.ThrowExceptionForHR(hr);
-                                decOut = DsFindPin.ByDirection((DirectShowLib.IBaseFilter) _lavaudio,
-                                    PinDirection.Output, 0);
+                                if (hr < 0) //LAV cannot handle this audio type
+                                {
+                                    _logger.Warn("LAV Audio could not decode audio media type.");
+                                }
+                                else
+                                {
+                                    //DsError.ThrowExceptionForHR(hr);
+                                    decOut = DsFindPin.ByDirection((DirectShowLib.IBaseFilter)_lavaudio,
+                                        PinDirection.Output, 0);
+                                }

                                 rendIn = DsFindPin.ByDirection(AudioRenderer, PinDirection.Input, 0);


Log internal subtitle clear

Log internal subtitle clear

--- MediaBrowser.Theater.DirectShow/DirectShowPlayer.cs
+++ MediaBrowser.Theater.DirectShow/DirectShowPlayer.cs
@@ -3018,6 +3018,7 @@
                 int subIndex = (int)CurrentSubtitleStreamIndex;
                 if (subIndex > 0)
                 {
+                    _logger.Debug("Clear internal subtitle");
                     var iss = _sourceFilter as IAMStreamSelect;
                     if (iss != null)
                     {


Fix null ref in Katana.Engine.

Fix null ref in Katana.Engine.

--- src/Katana.Engine/KatanaEngine.cs
+++ src/Katana.Engine/KatanaEngine.cs
@@ -169,7 +169,10 @@
             {
                 Func<string, Action<IAppBuilder>> loader = _settings.LoaderFactory();
                 Action<IAppBuilder> startup = loader.Invoke(context.Parameters.App);
-                startup(context.Builder);
+                if (startup != null)
+                {
+                    startup(context.Builder);
+                }
             }
             else
             {


Update LUAPlugin.cs

Update LUAPlugin.cs

Correction

--- Pluton/PluginLoaders/LUAPlugin.cs
+++ Pluton/PluginLoaders/LUAPlugin.cs
@@ -77,7 +77,7 @@
         {
             UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic;
             script = new Script();
-            script.Globals.Set("Util", UserData.Create(Util.GetInstance()));
+            script.Globals.Set("Util", UserData.Create(Util.GetUtil()));
             script.Globals.Set("Plugin", UserData.Create(this));
             script.Globals.Set("Server", UserData.Create(Server.GetInstance()));
             script.Globals.Set("DataStore", UserData.Create(DataStore.GetInstance()));
@@ -86,15 +86,15 @@
             script.Globals.Set("ServerConsoleCommands", UserData.Create(consoleCommands));
             script.Globals.Set("Web", UserData.Create(Web.GetInstance()));
             script.Globals.Set("World", UserData.Create(World.GetInstance()));
-            foreach (DynValue v in script.Globals.Keys)
-            {
-                Globals.Add(v.ToString().Replace('"'.ToString(), ""));
-            }
-            Tables = script.Globals;
             try
             {
                 script.DoString(code);
                 State = PluginState.Loaded;
+                foreach (DynValue v in script.Globals.Keys)
+                {
+                    Globals.Add(v.ToString().Replace('"'.ToString(), ""));
+                }
+                Tables = script.Globals;
             }
             catch (Exception ex)
             {
@@ -105,5 +105,6 @@
             PluginLoader.GetInstance().OnPluginLoaded(this);
         }
     }
+    }
 }


Fix corner a bit and add extra offset

Fix corner a bit and add extra offset

--- PoE-TradeUI/ui/Background.xaml.cs
+++ PoE-TradeUI/ui/Background.xaml.cs
@@ -23,7 +23,7 @@
             /*Paint background*/
             var bgCount = ActualHeight / _backgroundPattern.Height;
             for (var y = 0; y < bgCount; y++) {
-                context.DrawImage(_backgroundPattern.BitmapImage, new Rect(0, y * _backgroundPattern.Height - y, ActualWidth, _backgroundPattern.Height));
+                context.DrawImage(_backgroundPattern.BitmapImage, new Rect(0, y * _backgroundPattern.Height - y + 1, ActualWidth, _backgroundPattern.Height));
             }

             /*Paint banner*/
@@ -33,8 +33,8 @@
             /*Paint left and right border*/
             var leftBorderCount = ActualHeight / _borderLeft.Height;
             for (var y = 0; y < leftBorderCount; y++) {
-                context.DrawImage(_borderLeft.BitmapImage, new Rect(0, y * _borderLeft.Height - y, _borderLeft.Width, _borderLeft.Height));
-                context.DrawImage(_borderRight.BitmapImage, new Rect(ActualWidth - _borderRight.Width, y * _borderRight.Height - y, _borderRight.Width, _borderRight.Height));
+                context.DrawImage(_borderLeft.BitmapImage, new Rect(0, y * _borderLeft.Height - y + 1, _borderLeft.Width, _borderLeft.Height));
+                context.DrawImage(_borderRight.BitmapImage, new Rect(ActualWidth - _borderRight.Width, y * _borderRight.Height - y + 1, _borderRight.Width, _borderRight.Height));
             }

             /*Paint top border*/
@@ -44,7 +44,7 @@
             }

             /*Paint corners*/
-            context.DrawImage(_cornerTl.BitmapImage, new Rect(0, 0, _cornerTl.Width, _cornerTl.Height));
+            context.DrawImage(_cornerTl.BitmapImage, new Rect(1, 0, _cornerTl.Width, _cornerTl.Height));
             context.DrawImage(_cornerTr.BitmapImage, new Rect(ActualWidth - _cornerTr.Width, 0, _cornerTr.Width, _cornerTr.Height));


Ability to open external identity provider by passing custom state "SignInType" + Ignore non json states

--- src/Server/Bit.IdentityServer/Implementations/DefaultViewService.cs
+++ src/Server/Bit.IdentityServer/Implementations/DefaultViewService.cs
@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Linq;
 using System.Net.Http;
 using System.Threading;
 using System.Threading.Tasks;
@@ -98,7 +99,30 @@
             if (model.Custom == null && message.ReturnUrl != null)
             {
                 string state = new Uri(message.ReturnUrl).ParseQueryString()["state"] ?? "{}";
-                model.Custom = JsonConvert.DeserializeObject<dynamic>(state, jsonSerSettings);
+
+                try
+                {
+                    dynamic custom = model.Custom = JsonConvert.DeserializeObject<dynamic>(state, jsonSerSettings);
+
+                    string signInType = custom.SignInType;
+
+                    if (signInType != null && model.ExternalProviders.Any(extProvider => extProvider.Type == signInType))
+                    {
+                        string redirectUri = model.ExternalProviders.Single(extProvider => extProvider.Type == signInType).Href;
+
+                        return await ReturnHtmlAsync(model, $@"<!DOCTYPE html>
+                            <html>
+                                <head>
+                                    <meta http-equiv='refresh' content='0;{redirectUri}'>
+                                </head>
+                                <body></body>
+                            </html>", CancellationToken.None).ConfigureAwait(false);
+                    }
+                }
+                catch
+                {
+                    model.Custom = new { };
+                }
             }

             string json = JsonConvert.SerializeObject(new


Added ToString.

Added ToString.

--- src/Succubus/Succubus.Core/MessageFrames/SynchronousMessageFrame.cs
+++ src/Succubus/Succubus.Core/MessageFrames/SynchronousMessageFrame.cs
@@ -17,5 +17,10 @@

         public object Message { get; set; }

+        public override string ToString()
+        {
+            return String.Format("Sync {2} CId: {0} Type: {1} ", CorrelationId, EmbeddedType,
+                Request == null ? "Request" : "Response");
+        }
     }
 }


OverrideContext: make BufferParser public w/ nice name

--- OmniSharp/AutoComplete/Overrides/OverrideContext.cs
+++ OmniSharp/AutoComplete/Overrides/OverrideContext.cs
@@ -17,9 +17,9 @@
         public OverrideContext
             (AutoCompleteRequest request, BufferParser parser) {

-            this._parser = parser;
+            this.BufferParser = parser;
             this.CompletionContext = new AutoCompleteBufferContext
-                (request, this._parser);
+                (request, this.BufferParser);

             this.CurrentType = this.CompletionContext.ParsedContent
                 .UnresolvedFile.GetInnermostTypeDefinition
@@ -40,7 +40,8 @@
         public IEnumerable<GetOverrideTargetsResponse> OverrideTargets {get; set;}
         public AutoCompleteBufferContext CompletionContext {get; set;}

-        BufferParser _parser {get; set;}
+        public BufferParser BufferParser {get; set;}
+
     }

 }


PR feedback

PR feedback

--- src/System.Collections/src/System/Collections/Generic/SortedList.cs
+++ src/System.Collections/src/System/Collections/Generic/SortedList.cs
@@ -453,7 +453,7 @@

             if (arrayIndex < 0 || arrayIndex > array.Length)
             {
-                throw new ArgumentOutOfRangeException("index", arrayIndex, SR.ArgumentOutOfRange_Index);
+                throw new ArgumentOutOfRangeException("arrayIndex", arrayIndex, SR.ArgumentOutOfRange_Index);
             }

             if (array.Length - arrayIndex < Count)


Allows to sell objects on a parcel of land together with that parcel of land. The objects that are sold together with the parcel of land need to fulfill the following preconditions: owned by the current parcel owner, not set to a group, transferrable. This feature does not work for group owned parcels or land bought by a group.

--- OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -385,9 +385,16 @@
             newData.SalePrice = 0;
             newData.AuthBuyerID = UUID.Zero;
             newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
+
+            bool sellObjects = (LandData.Flags & (uint)(ParcelFlags.SellParcelObjects)) != 0
+                && !LandData.IsGroupOwned && !groupOwned;
+            UUID previousOwner = LandData.OwnerID;
+
             m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
             m_scene.EventManager.TriggerParcelPrimCountUpdate();
             SendLandUpdateToAvatarsOverMe(true);
+
+            if (sellObjects) SellLandObjects(previousOwner);
         }

         public void DeedToGroup(UUID groupID)
@@ -1067,6 +1074,43 @@

         #endregion

+        #region Object Sales
+
+        public void SellLandObjects(UUID previousOwner)
+        {
+            // m_log.DebugFormat(
+            //    "[LAND OBJECT]: Request to sell objects in {0} from {1}", LandData.Name, previousOwner);
+
+            if (LandData.IsGroupOwned)
+                return;
+
+            IBuySellModule m_BuySellModule = m_scene.RequestModuleInterface<IBuySellModule>();
+            if (m_BuySellModule == null)
+            {
+                m_log.Error("[LAND OBJECT]: BuySellModule not found");
+                return;
+            }
+
+            ScenePresence sp;
+            if (!m_scene.TryGetScenePresence(LandData.OwnerID, out sp))
+            {
+                m_log.Error("[LAND OBJECT]: New owner is not present in scene");
+                return;
+            }
+
+            lock (primsOverMe)
+            {
+                foreach (SceneObjectGroup obj in primsOverMe)
+                {
+                    if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero &&
+                        (obj.GetEffectivePermissions() & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
+                        m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
+                }
+            }
+        }
+
+        #endregion
+
         #region Object Returning

         public void ReturnObject(SceneObjectGroup obj)


2.9.3

--- Emby.Theater/Properties/AssemblyInfo.cs
+++ Emby.Theater/Properties/AssemblyInfo.cs
@@ -32,4 +32,4 @@
 // 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("2.9.2")]
+[assembly: AssemblyVersion("2.9.3")]


Restore duplication of the SL bug where linking phantom to solid lets the child prim remain phantom

--- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2511,7 +2511,6 @@
             // physics flags from group to be applied to linked parts
             bool grpusephys = UsesPhysics;
             bool grptemporary = IsTemporary;
-            bool gprphantom = IsPhantom;

             Vector3 oldGroupPosition = linkPart.GroupPosition;
             Quaternion oldRootRotation = linkPart.RotationOffset;
@@ -2557,7 +2556,7 @@
                 linkPart.CreateSelected = true;

                 // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now
-                linkPart.UpdatePrimFlags(grpusephys, grptemporary, gprphantom, linkPart.VolumeDetectActive, true);
+                linkPart.UpdatePrimFlags(grpusephys, grptemporary, (linkPart.Flags & PrimFlags.Phantom) != null, linkPart.VolumeDetectActive, true);
                 if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
                 {
                     linkPart.PhysActor.link(m_rootPart.PhysActor);
@@ -2579,7 +2578,7 @@
                     {
                         LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
                         // let physics know
-                        part.UpdatePrimFlags(grpusephys, grptemporary, gprphantom, part.VolumeDetectActive, true);
+                        part.UpdatePrimFlags(grpusephys, grptemporary, (part.Flags & PrimFlags.Phantom) != null, part.VolumeDetectActive, true);
                         if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
                         {
                             part.PhysActor.link(m_rootPart.PhysActor);


Use TCP_NODELAY

Use TCP_NODELAY

--- Enyim.Caching/Memcached/PooledSocket.cs
+++ Enyim.Caching/Memcached/PooledSocket.cs
@@ -34,10 +34,8 @@

             this.isAlive = true;

-            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-            // TODO test if we're better off using nagle
-            //PHP: OPT_TCP_NODELAY
-            //socket.NoDelay = true;
+            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+            socket.NoDelay = true;

             var timeout = connectionTimeout == TimeSpan.MaxValue
                             ? Timeout.Infinite


Release version 1.0.2 to nuget

Release version 1.0.2 to nuget

--- WebFormsDocumentViewer/Properties/AssemblyInfo.cs
+++ WebFormsDocumentViewer/Properties/AssemblyInfo.cs
@@ -32,5 +32,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.0.1.0")]
-[assembly: AssemblyFileVersion("1.0.1.0")]
+[assembly: AssemblyVersion("1.0.2.0")]
+[assembly: AssemblyFileVersion("1.0.2.0")]


Added CLSCompliant attribute

Added CLSCompliant attribute

(triggered by Code Analysis warning).

--- AtomEventStore.AzureBlob/Properties/AssemblyInfo.cs
+++ AtomEventStore.AzureBlob/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;

@@ -34,3 +35,5 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("0.3.2.0")]
 [assembly: AssemblyFileVersion("0.3.2.0")]
+
+[assembly: CLSCompliant(true)]