minor code cleanup

minor code cleanup

--- MailKit/Security/Ntlm/ChallengeResponse2.cs
+++ MailKit/Security/Ntlm/ChallengeResponse2.cs
@@ -49,11 +49,11 @@
 namespace MailKit.Security.Ntlm {
 	static class ChallengeResponse2
 	{
-		static byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
+		static readonly byte[] Magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };

 		// This is the pre-encrypted magic value with a null DES key (0xAAD3B435B51404EE)
 		// Ref: http://packetstormsecurity.nl/Crackers/NT/l0phtcrack/l0phtcrack2.5-readme.html
-		static byte[] nullEncMagic = { 0xAA, 0xD3, 0xB4, 0x35, 0xB5, 0x14, 0x04, 0xEE };
+		static readonly byte[] NullEncMagic = { 0xAA, 0xD3, 0xB4, 0x35, 0xB5, 0x14, 0x04, 0xEE };

 		static byte[] ComputeLM (string password, byte[] challenge)
 		{
@@ -66,20 +66,20 @@
 				// Note: In .NET DES cannot accept a weak key
 				// this can happen for a null password
 				if (string.IsNullOrEmpty (password)) {
-					Buffer.BlockCopy (nullEncMagic, 0, buffer, 0, 8);
+					Buffer.BlockCopy (NullEncMagic, 0, buffer, 0, 8);
 				} else {
 					des.Key = PasswordToKey (password, 0);
 					using (var ct = des.CreateEncryptor ())
-						ct.TransformBlock (magic, 0, 8, buffer, 0);
+						ct.TransformBlock (Magic, 0, 8, buffer, 0);
 				}

 				// and if a password has less than 8 characters
 				if (password == null || password.Length < 8) {
-					Buffer.BlockCopy (nullEncMagic, 0, buffer, 8, 8);
+					Buffer.BlockCopy (NullEncMagic, 0, buffer, 8, 8);
 				} else {
 					des.Key = PasswordToKey (password, 7);
 					using (var ct = des.CreateEncryptor ())
-						ct.TransformBlock (magic, 0, 8, buffer, 8);
+						ct.TransformBlock (Magic, 0, 8, buffer, 8);
 				}
 			}


Use coordinates iso vertices

Use coordinates iso vertices

--- Mapsui.Nts/Providers/Shapefile/ShapeFile.cs
+++ Mapsui.Nts/Providers/Shapefile/ShapeFile.cs
@@ -45,7 +45,7 @@
         /// </summary>
         Point = 1,
         /// <summary>
-        /// PolyLine is an ordered set of vertices that consists of one or more parts. A part is a
+        /// PolyLine is an ordered set of coordinates that consists of one or more parts. A part is a
         /// connected sequence of two or more points. Parts may or may not be connected to one
         ///	another. Parts may or may not intersect one another.
         /// Mapsui interprets this as either <see cref="LineString"/> or <see cref="MultiLineString"/>
@@ -54,9 +54,9 @@
         /// <summary>
         /// A polygon consists of one or more rings. A ring is a connected sequence of four or more
         /// points that form a closed, non-self-intersecting loop. A polygon may contain multiple
-        /// outer rings. The order of vertices or orientation for a ring indicates which side of the ring
+        /// outer rings. The order of coordinates or orientation for a ring indicates which side of the ring
         /// is the interior of the polygon. The neighborhood to the right of an observer walking along
-        /// the ring in vertex order is the neighborhood inside the polygon. Vertices of rings defining
+        /// the ring in vertex order is the neighborhood inside the polygon. Coordinates of rings defining
         /// holes in polygons are in a counterclockwise direction. Vertices for a single, ringed
         /// polygon are, therefore, always in clockwise order. The rings of a polygon are referred to
         /// as its parts.
@@ -117,7 +117,7 @@
         /// <summary>
         /// A MultiPatch consists of a number of surface patches. Each surface patch describes a
         /// surface. The surface patches of a MultiPatch are referred to as its parts, and the type of
-        /// part controls how the order of vertices of an MultiPatch part is interpreted.
+        /// part controls how the order of coordinates of an MultiPatch part is interpreted.
         /// Mapsui doesn't support this feature type.
         /// </summary>
         MultiPatch = 31
@@ -759,10 +759,10 @@
                     var lineStrings = new List<LineString>();
                     for (var lineId = 0; lineId < nParts; lineId++)
                     {
-                        var vertices = new List<Coordinate>();
+                        var coordinates = new List<Coordinate>();
                         for (var i = segments[lineId]; i < segments[lineId + 1]; i++)
-                            vertices.Add(new Coordinate(_brShapeFile.ReadDouble(), _brShapeFile.ReadDouble()));
-                        lineStrings.Add(new LineString(vertices.ToArray()));
+                            coordinates.Add(new Coordinate(_brShapeFile.ReadDouble(), _brShapeFile.ReadDouble()));
+                        lineStrings.Add(new LineString(coordinates.ToArray()));
                     }
                     if (lineStrings.Count == 1)
                         return lineStrings[0];


using DeveloperMode in GdiGeometryRenderer

--- Mapsui.Rendering.Gdi/GdiGeometryRenderer.cs
+++ Mapsui.Rendering.Gdi/GdiGeometryRenderer.cs
@@ -24,6 +24,7 @@
 using System.Globalization;
 using Mapsui.Geometries;
 using Mapsui.Styles;
+using Mapsui.Utilities;
 using Bitmap = System.Drawing.Bitmap;
 using Brush = System.Drawing.Brush;
 using Color = System.Drawing.Color;
@@ -249,11 +250,12 @@
                 GraphicsUnit.Pixel,
                 new ImageAttributes());

-#if DEBUG
-            var font = new System.Drawing.Font("Arial", 12);
-            var message = (GC.GetTotalMemory(true) / 1000).ToString(CultureInfo.InvariantCulture) + " KB";
-            graphics.DrawString(message, font, new SolidBrush(Color.Black), 10f, 10f);
-#endif
+            if (DeveloperTools.DeveloperMode)
+            {
+                var font = new System.Drawing.Font("Arial", 12);
+                var message = (GC.GetTotalMemory(true)/1000).ToString(CultureInfo.InvariantCulture) + " KB";
+                graphics.DrawString(message, font, new SolidBrush(Color.Black), 10f, 10f);
+            }

             bitmap.Dispose();
         }


Split out logic from ProcessType() ... and specialized GetNotifyPropertyNames() a bit more to make for future extensions easier

--- Mathtone.MIST.Builder/NotificationWeaver.cs
+++ Mathtone.MIST.Builder/NotificationWeaver.cs
@@ -105,20 +105,12 @@
 				}

 				//Identify the name of the property/properties that will be passed to the notification method.
-				foreach (var propDef in typeDef.Properties) {
-					var propNames = GetNotifyPropertyNames(propDef);
-
-					if (!ContainsAttribute(propDef, SuppressNotifyTypeName)) {
-						//In implcit mode implement notification for all public properties
-						if (!propNames.Any() && mode == NotificationMode.Implicit && propDef.GetMethod.IsPublic) {
-							propNames = new[] { propDef.Name };
-						}
-						if (propNames != null) {
-							InsertNotificationsIntoProperty(propDef, notifyTarget, propNames);
-							rtn = true;
-						}
-					}
-				}
+                foreach(var propDef in propertiesToNotifyForIn(typeDef, mode))
+                {
+                    var propNames = GetNotifyPropertyNames(propDef);
+                    InsertNotificationsIntoProperty(propDef, notifyTarget, propNames);
+                    rtn = true;
+                }
 			}

 			//Recursively process any nested type definitions.
@@ -129,12 +121,24 @@
 			return rtn;
 		}

-		/// <summary>
-		/// Gets the notification target method, market with a <see cref="NotifyTarget"/> attribute.
-		/// </summary>
-		/// <param name="typeDef">The type definition.</param>
-		/// <returns>MethodReference.</returns>
-		protected MethodReference GetNotifyTarget(TypeDefinition typeDef) {
+        private IEnumerable<PropertyDefinition> propertiesToNotifyForIn(TypeDefinition typeDef, NotificationMode mode)
+        {
+            foreach (var propDef in typeDef.Properties)
+            {
+                if (ContainsAttribute(propDef, SuppressNotifyTypeName))
+                    continue;
+
+                if (ContainsAttribute(propDef, NotifyTypeName) || mode == NotificationMode.Implicit)
+                    yield return propDef;
+            }
+        }
+
+        /// <summary>
+        /// Gets the notification target method, market with a <see cref="NotifyTarget"/> attribute.
+        /// </summary>
+        /// <param name="typeDef">The type definition.</param>
+        /// <returns>MethodReference.</returns>
+        protected MethodReference GetNotifyTarget(TypeDefinition typeDef) {

 			//Check each method for a NotifyTargetAttribute
 			foreach (var methDef in typeDef.Methods) {
@@ -208,40 +212,43 @@
 		public static bool ContainsAttribute(PropertyDefinition definition, string attributeTypeName) =>
 			definition.CustomAttributes.Any(a => a.AttributeType.FullName == attributeTypeName);

-		/// <summary>
-		/// Gets the property names that should be passed to the notification target method when the property value is changed.
-		/// </summary>
-		/// <param name="propDef">The property definition.</param>
-		/// <returns>IEnumerable<System.String>.</returns>
-		IEnumerable<string> GetNotifyPropertyNames(PropertyDefinition propDef) {
-			//Check for the NotifyAttribute
-			var attr = propDef.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullName == NotifyTypeName);
-
-			if (attr != null) {
-				//Return property names supplied by the constructor, if none are specified return the property name itself.
-				if (attr.HasConstructorArguments) {
-					var args = attr.ConstructorArguments[0].Value as CustomAttributeArgument[];
-					if (args == null) {
-						//Argument is null
-						yield return null;
-					}
-					else if (args.Length == 0) {
-						//Apparently the user saw reason to pass an empty array.
-						yield return propDef.Name;
-					}
-					else {
-						//Multiple arguments have been passed.
-						foreach (var arg in args) {
-							yield return (string)arg.Value;
-						}
-					}
-				}
-				else {
-					//No fancy stuff, just return the property name.
-					yield return propDef.Name;
-				}
-			}
-		}
+        /// <summary>
+        /// Gets the property names that should be passed to the notification target method when the property value is changed.
+        /// </summary>
+        /// <param name="propDef">The property definition.</param>
+        /// <returns>IEnumerable<System.String>.</returns>
+        IEnumerable<string> GetNotifyPropertyNames(PropertyDefinition propDef)
+        {
+            var attr = propDef.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullName == NotifyTypeName);
+            if (attr == null || !attr.HasConstructorArguments)
+            {
+                //No fancy stuff, just return the property name.
+                yield return propDef.Name;
+            }
+            else
+            {
+                //Return property names supplied by the constructor, if none are specified return the property name itself.
+                var args = attr.ConstructorArguments[0].Value as CustomAttributeArgument[];
+                if (args == null)
+                {
+                    //Argument is null
+                    yield return null;
+                }
+                else if (args.Length == 0)
+                {
+                    //Apparently the user saw reason to pass an empty array.
+                    yield return propDef.Name;
+                }
+                else
+                {
+                    //Multiple arguments have been passed.
+                    foreach (var arg in args)
+                    {
+                        yield return (string)arg.Value;
+                    }
+                }
+            }
+        }

 		/// <summary>
 		/// Weaves notifiers into the property.  This is where the magic happens.
@@ -251,7 +258,7 @@
 		/// <param name="notifyPropertyNames">The notify property names.</param>
 		protected static void InsertNotificationsIntoProperty(PropertyDefinition propDef, MethodReference notifyTarget, IEnumerable<string> notifyPropertyNames) {

-			if (propDef.SetMethod == null)
+            if (propDef.SetMethod == null)
 				//This is a read-only property
 				return;
 			else if (propDef.SetMethod.Body == null) {
@@ -259,37 +266,37 @@
 				throw new InvalidNotifierException();
 			}

-			var methodBody = propDef.SetMethod.Body;
+            var methodBody = propDef.SetMethod.Body;

 			//Retrieve an IL writer
 			var msil = methodBody.GetILProcessor();

-			//Insert a Nop before the first instruction (like... at the beginning).
-			var begin = msil.Create(OpCodes.Nop);
-			msil.InsertBefore(methodBody.Instructions[0], begin);
-
-			//Call the notification target method for
-			foreach (var notifyPropertyName in notifyPropertyNames) {
+            //Insert a Nop before the first instruction (like... at the beginning).
+            var begin = msil.Create(OpCodes.Nop);
+            msil.InsertBefore(methodBody.Instructions[0], begin);
+
+            //Call the notification target method for
+            foreach (var notifyPropertyName in notifyPropertyNames) {

 				var beginInstructions = new Instruction[0];
 				var endInstructions = new Instruction[0];

-				//Load the value of the property name to be passed to the notify target onto the stack.
-				var propertyName = notifyPropertyName == null ?
+                //Load the value of the property name to be passed to the notify target onto the stack.
+                var propertyName = notifyPropertyName == null ?
 					msil.Create(OpCodes.Ldnull) :
 					msil.Create(OpCodes.Ldstr, notifyPropertyName);

-				//Emit a call to the notify target
+                //Emit a call to the notify target
 				var callNotifyTarget = msil.Create(OpCodes.Call, notifyTarget);
 				switch (notifyTarget.Parameters.Count) {
 					case 0:
-						endInstructions = new[] {
-							msil.Create(OpCodes.Ldarg_0),
-							msil.Create(OpCodes.Call, notifyTarget),
-							msil.Create(OpCodes.Nop)
-						};
-						break;
+                        endInstructions = new[] {
+                            msil.Create(OpCodes.Ldarg_0),
+                            msil.Create(OpCodes.Call, notifyTarget),
+                            msil.Create(OpCodes.Nop)
+                        };
+                        break;
 					case 1:
 						endInstructions = new[] {
 							msil.Create(OpCodes.Ldarg_0),
@@ -343,7 +350,7 @@
 				var returnPoints = methodBody.Instructions.Where(a => a.OpCode == OpCodes.Ret).ToArray();
 				foreach (var instruction in returnPoints) {

-					InsertBefore(msil, endInstructions, instruction);
+                    InsertBefore(msil, endInstructions, instruction);
 					var branches = methodBody.Instructions.Where(a => a.OpCode == OpCodes.Br_S && a.Operand == instruction).ToArray();
 					var branchTarget = endInstructions[0];

@@ -354,8 +361,8 @@

 			}
 		}
-
-		protected static void InsertAfter(ILProcessor ilProcessor, IEnumerable<Instruction> instructions, Instruction startPoint) {
+
+        protected static void InsertAfter(ILProcessor ilProcessor, IEnumerable<Instruction> instructions, Instruction startPoint) {
 			var currentInstruction = startPoint;
 			foreach (var instruction in instructions) {
 				ilProcessor.InsertAfter(currentInstruction, instruction);
@@ -376,4 +383,4 @@
 			}
 		}
 	}
-}+}


Fixed unit testing.

Fixed unit testing.

--- Microsoft.Web.Administration/FileContext.cs
+++ Microsoft.Web.Administration/FileContext.cs
@@ -155,10 +155,9 @@

                 if (_document != null)
                 {
-                    using (var stream = File.Open(FileName, FileMode.Open, FileAccess.Write, FileShare.None))
-                    using (var reader = XmlWriter.Create(stream))
-                    {
-                        _document.Save(reader);
+                    using (var stream = File.Open(FileName, FileMode.Create, FileAccess.Write, FileShare.None))
+                    {
+                        _document.Save(stream);
                     }
                 }
             }
@@ -420,9 +419,8 @@
         private void LoadDocument(string file, string location)
         {
             using (var stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
-            using (var reader = XmlReader.Create(stream))
-            {
-                _document = XDocument.Load(reader, LoadOptions.SetLineInfo);
+            {
+                _document = XDocument.Load(stream, LoadOptions.SetLineInfo);
             }

             if (Root == null)
@@ -551,9 +549,8 @@

             File.WriteAllText(file, "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration></configuration>");
             using (var stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
-            using (var reader = XmlReader.Create(stream))
-            {
-                _document = XDocument.Load(reader, LoadOptions.SetLineInfo);
+            {
+                _document = XDocument.Load(stream, LoadOptions.SetLineInfo);
             }

             return Root;


commenting

commenting

--- MockHttp.Desktop/FileSystemResponseStore.cs
+++ MockHttp.Desktop/FileSystemResponseStore.cs
@@ -75,13 +75,16 @@
                 Query = query,
                 ContentFileName = fileName + ".content.json"
             };
-
+
+            // just read the entire content stream as a string and serialize it
+            // we are assuming all content is json for the time being
             var content = await response.Content.ReadAsStringAsync();
             using (var contentWriter = new StreamWriter(Path.Combine(folderPath, info.ContentFileName), false))
             {
                 contentWriter.Write(content);
             }

+            // now serialize the response object and its meta-data
             var json = JsonConvert.SerializeObject(info, Formatting.Indented, new HttpResponseMessageConverter());
             using (var responseWriter = new StreamWriter(Path.Combine(folderPath, fileName + ".response.json"), false))
             {


Fixed a crash with Applying the Equalizer

--- MusicPlayer.Apple/Playback/AVMediaPlayer.cs
+++ MusicPlayer.Apple/Playback/AVMediaPlayer.cs
@@ -46,7 +46,6 @@
 		{
 			State = (Math.Abs (player.Rate) < float.Epsilon) ? PlaybackState.Paused : PlaybackState.Playing;
 			Console.WriteLine($"State Changed {CurrentSongId} - {State}");
-			StateChanged?.Invoke (State);
 		}

 		void OnFinished (AVPlayerItem item)
@@ -107,7 +106,8 @@

 		public override async void ApplyEqualizer (Equalizer.Band [] bands)
 		{
-			await AVPlayerEqualizer.Shared.ApplyEqualizer (bands);
+			if(IsPlayerItemValid)
+				await AVPlayerEqualizer.Shared.ApplyEqualizer (bands,player?.CurrentItem);
 		}

 		public override double CurrentTimeSeconds () => player?.CurrentTimeSeconds() ?? 0;