Skip updating versions if can't get versions

It should also fix failing unit tests on TeamCity

--- src/TeamCityConsole/Commands/ResolveDependencyCommand.cs
+++ src/TeamCityConsole/Commands/ResolveDependencyCommand.cs
@@ -58,12 +58,15 @@
                 await ResolveDependencies(_dependencyConfig.BuildConfigId, dependenciesOptions.Tag);

             var buildConfig = await _client.BuildConfigs.GetByConfigurationId(_dependencyConfig.BuildConfigId);
-            _majorVersion = GetVersionFromXml(buildConfig, ParameterName.MajorVersion);
-            _minorVersion = GetVersionFromXml(buildConfig, ParameterName.MinorVersion);
-
-            UpdateAssemblyVersion();
-            UpdateBuildVersion();
-            UpdateVersionIncVersion();
+            _majorVersion = buildConfig.Parameters[ParameterName.MajorVersion]?.Value;
+            _minorVersion = buildConfig.Parameters[ParameterName.MinorVersion]?.Value;
+
+            if (!String.IsNullOrEmpty(_majorVersion) || !String.IsNullOrEmpty(_minorVersion))
+            {
+                UpdateAssemblyVersion();
+                UpdateBuildVersion();
+                UpdateVersionIncVersion();
+            }

             //only writes the file if changes were made to the config.
             if (_dependencyConfig.Equals(dependencyConfig) == false || dependenciesOptions.Force)
@@ -236,19 +239,7 @@
                 yield return path + Path.DirectorySeparatorChar + fileName;
             }
         }
-
-        private string GetVersionFromXml(BuildConfig buildConfig, string versionPart)
-        {
-            foreach (var prop in buildConfig.Parameters.Property)
-            {
-                if (prop.Name == versionPart)
-                {
-                    return prop.Value;
-                }
-            }
-            return "";
-        }
-
+
         private string GetSolutionDirectory()
         {
             var solutionDirectoryName = Directory.GetParent(Directory.GetCurrentDirectory()).Parent?.Parent?.FullName;  //src folder


Change doctype - default suggestion none when no matching alias.

--- src/Umbraco.Web.UI/umbraco/dialogs/ChangeDocType.aspx.cs
+++ src/Umbraco.Web.UI/umbraco/dialogs/ChangeDocType.aspx.cs
@@ -149,7 +149,7 @@
                     ddl.DataValueField = "Alias";
                     ddl.DataTextField = "Name";
                     ddl.DataBind();
-                    ddl.Items.Add(new ListItem("<" + global::umbraco.ui.Text("changeDocType", "none") + ">", string.Empty));
+                    ddl.Items.Insert(0, new ListItem("<" + global::umbraco.ui.Text("changeDocType", "none") + ">", string.Empty));

                     // Set default selection to be one with matching alias
                     var alias = ((HiddenField)ri.FindControl("Alias")).Value;


Fix TestLogCustomEventNotSerializableMP test on .NET Core

--- src/XMakeBuildEngine/UnitTests/BackEnd/TaskHost_Tests.cs
+++ src/XMakeBuildEngine/UnitTests/BackEnd/TaskHost_Tests.cs
@@ -821,12 +821,16 @@
         /// </summary>
         internal class MyCustomBuildEventArgsNotSerializable : CustomBuildEventArgs
         {
+            //  If binary serialization is not available, then we use a simple serializer which relies on a default constructor.  So to test
+            //  what happens for an event that's not serializable, don't include a default constructor.
+#if FEATURE_BINARY_SERIALIZATION
             /// <summary>
             /// Default constructor
             /// </summary>
             public MyCustomBuildEventArgsNotSerializable() : base()
             {
             }
+#endif

             /// <summary>
             /// Constructor which takes a message


Update CompatBot/Commands/Misc.cs

Update CompatBot/Commands/Misc.cs

Co-Authored-By: Ilya <1c7a5db18cf7db90640dd7447411e11e3018f178@users.noreply.github.com>

--- CompatBot/Commands/Misc.cs
+++ CompatBot/Commands/Misc.cs
@@ -26,7 +26,7 @@
             "Yah!", "Ja", "Umu!", "Make it so", "Sure thing",
             "Certainly", "Of course", "Definitely", "Indeed",
             "Much yes", "Make it so", "Consider it done", "Totally", "You bet",
-            "Sure", "Yup", "Yep", "Okie dokie", "Certainly", "Yarp",
+            "Yup", "Yep", "Certainly", "Yarp",

             // 20
             "Maybe", "I don't know", "I don't care", "Who cares", "Maybe yes, maybe not",


split Update steps

split Update steps

--- src/Interface.cs
+++ src/Interface.cs
@@ -284,113 +284,28 @@

 		public void Update(){
-			lock (Interface.CurrentInterface.RenderMutex) {
-				if (mouseRepeatCount > 0) {
-					int mc = mouseRepeatCount;
-					mouseRepeatCount -= mc;
-					for (int i = 0; i < mc; i++) {
-						FocusedWidget.onMouseClick (this, new MouseButtonEventArgs (Mouse.X, Mouse.Y, MouseButton.Left, true));
-					}
-				}
-				#if MEASURE_TIME
-				layoutTime.Reset ();
-				guTime.Reset ();
-				drawingTime.Reset ();
-				updateTime.Restart ();
-				#endif
-
-				#if MEASURE_TIME
-				layoutTime.Start ();
-				#endif
-				//Debug.WriteLine ("======= Layouting queue start =======");
-				int queueCount = 0;
-				LayoutingQueueItem lqi = null;
-
-				lock (Interface.LayoutingQueue)
-					queueCount = Interface.LayoutingQueue.Count;
-
-				while (queueCount > 0) {
-					lock (Interface.LayoutingQueue)
-						lqi = Interface.LayoutingQueue.Dequeue ();
-					if (lqi!=null)
-						lqi.ProcessLayouting ();
-					lock (Interface.LayoutingQueue)
-						queueCount = Interface.LayoutingQueue.Count;
-				}
-
-
-				#if MEASURE_TIME
-				layoutTime.Stop ();
-				#endif
-
-				//Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
-				//final redraw clips should be added only when layout is completed among parents,
-				//that's why it take place in a second pass
-				GraphicObject[] gotr = null;
-				gotr = new GraphicObject[gobjsToRedraw.Count];
-				gobjsToRedraw.CopyTo (gotr);
-				gobjsToRedraw.Clear ();
-
-				foreach (GraphicObject p in gotr) {
-					try {
-						p.IsQueuedForRedraw = false;
-						p.Parent.RegisterClip (p.LastPaintedSlot);
-						p.Parent.RegisterClip (p.getSlot());
-					} catch (Exception ex) {
-						Debug.WriteLine ("Error Register Clip: " + ex.ToString ());
-					}
-				}
-
-				#if MEASURE_TIME
-				updateTime.Stop ();
-				drawingTime.Start ();
-				#endif
-
-				using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
-					using (ctx = new Context (surf)){
-
-
-						if (clipping.count > 0) {
-							//Link.draw (ctx);
-							clipping.clearAndClip(ctx);
-
-							for (int i = GraphicObjects.Count -1; i >= 0 ; i--){
-								GraphicObject p = GraphicObjects[i];
-								if (!p.Visible)
-									continue;
-								if (!clipping.intersect (p.Slot))
-									continue;
-								ctx.Save ();
-
-								p.Paint (ref ctx);
-
-								ctx.Restore ();
-							}
-
-							#if DEBUG_CLIP_RECTANGLE
-							clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5));
-							#endif
-
-							if (IsDirty)
-								DirtyRect += clipping.Bounds;
-							else
-								DirtyRect = clipping.Bounds;
-							IsDirty = true;
-
-							DirtyRect.Left = Math.Max (0, DirtyRect.Left);
-							DirtyRect.Top = Math.Max (0, DirtyRect.Top);
-							DirtyRect.Width = Math.Min (ClientRectangle.Width - DirtyRect.Left, DirtyRect.Width);
-							DirtyRect.Height = Math.Min (ClientRectangle.Height - DirtyRect.Top, DirtyRect.Height);
-
-							clipping.Reset ();
-						}
-
-						#if MEASURE_TIME
-						drawingTime.Stop ();
-						#endif
-						//surf.WriteToPng (@"/mnt/data/test.png");
-					}
-				}
+			if (mouseRepeatCount > 0) {
+				int mc = mouseRepeatCount;
+				mouseRepeatCount -= mc;
+				for (int i = 0; i < mc; i++) {
+					FocusedWidget.onMouseClick (this, new MouseButtonEventArgs (Mouse.X, Mouse.Y, MouseButton.Left, true));
+				}
+			}
+			#if MEASURE_TIME
+			guTime.Reset ();
+			updateTime.Restart ();
+			#endif
+
+
+			processLayouting ();
+
+			clippingRegistration ();
+
+			processDrawing ();
+
+			#if MEASURE_TIME
+			updateTime.Stop ();
+			#endif
 			//			if (ToolTip.isVisible) {
 			//				ToolTip.panel.processkLayouting();
 			//				if (ToolTip.panel.layoutIsValid)
@@ -408,8 +323,102 @@
 			//			Debug.WriteLine("UPDATE: {0} ticks \t, {1} ms",
 			//				updateTime.ElapsedTicks,
 				//				updateTime.ElapsedMilliseconds);
-			}
-		}
+		}
+		void processLayouting(){
+			#if MEASURE_TIME
+			layoutTime.Restart();
+			#endif
+
+			//Debug.WriteLine ("======= Layouting queue start =======");
+			int queueCount = 0;
+			LayoutingQueueItem lqi = null;
+
+			lock (Interface.LayoutingQueue)
+				queueCount = Interface.LayoutingQueue.Count;
+
+			while (queueCount > 0) {
+				lock (Interface.LayoutingQueue)
+					lqi = Interface.LayoutingQueue.Dequeue ();
+				if (lqi!=null)
+					lqi.ProcessLayouting ();
+				lock (Interface.LayoutingQueue)
+					queueCount = Interface.LayoutingQueue.Count;
+			}
+			#if MEASURE_TIME
+			layoutTime.Stop ();
+			#endif
+		}
+		void clippingRegistration(){
+			//Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
+			//final redraw clips should be added only when layout is completed among parents,
+			//that's why it take place in a second pass
+			lock (Interface.CurrentInterface.RenderMutex) {
+				GraphicObject[] gotr = null;
+				gotr = new GraphicObject[gobjsToRedraw.Count];
+				gobjsToRedraw.CopyTo (gotr);
+				gobjsToRedraw.Clear ();
+
+				foreach (GraphicObject p in gotr) {
+					try {
+						p.IsQueuedForRedraw = false;
+						p.Parent.RegisterClip (p.LastPaintedSlot);
+						p.Parent.RegisterClip (p.getSlot ());
+					} catch (Exception ex) {
+						Debug.WriteLine ("Error Register Clip: " + ex.ToString ());
+					}
+				}
+			}
+		}
+		void processDrawing(){
+			#if MEASURE_TIME
+			drawingTime.Restart();
+			#endif
+			using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
+				using (ctx = new Context (surf)){
+
+
+					if (clipping.count > 0) {
+						//Link.draw (ctx);
+						clipping.clearAndClip(ctx);
+
+						for (int i = GraphicObjects.Count -1; i >= 0 ; i--){
+							GraphicObject p = GraphicObjects[i];
+							if (!p.Visible)
+								continue;
+							if (!clipping.intersect (p.Slot))
+								continue;
+							ctx.Save ();
+
+							p.Paint (ref ctx);
+
+							ctx.Restore ();
+						}
+
+						#if DEBUG_CLIP_RECTANGLE
+						clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5));
+						#endif
+						lock (Interface.CurrentInterface.RenderMutex) {
+							if (IsDirty)
+								DirtyRect += clipping.Bounds;
+							else
+								DirtyRect = clipping.Bounds;
+							IsDirty = true;
+
+							DirtyRect.Left = Math.Max (0, DirtyRect.Left);
+							DirtyRect.Top = Math.Max (0, DirtyRect.Top);
+							DirtyRect.Width = Math.Min (ClientRectangle.Width - DirtyRect.Left, DirtyRect.Width);
+							DirtyRect.Height = Math.Min (ClientRectangle.Height - DirtyRect.Top, DirtyRect.Height);
+						}
+						clipping.Reset ();
+					}
+					//surf.WriteToPng (@"/mnt/data/test.png");
+				}
+			}
+			#if MEASURE_TIME
+			drawingTime.Stop ();
+			#endif
+		}
+
 		public Rectangles clipping {
 			get { return _redrawClip; }
 			set { _redrawClip = value; }
@@ -466,14 +475,17 @@

 		public void ProcessResize(Rectangle bounds){
-			clientRectangle = bounds;
-
-			int stride = 4 * ClientRectangle.Width;
-			int bmpSize = Math.Abs (stride) * ClientRectangle.Height;
-			bmp = new byte[bmpSize];
-
-			foreach (GraphicObject g in GraphicObjects)
-				g.RegisterForLayouting (LayoutingType.All);
+			lock (RenderMutex) {
+				clientRectangle = bounds;
+
+				int stride = 4 * ClientRectangle.Width;
+				int bmpSize = Math.Abs (stride) * ClientRectangle.Height;
+				bmp = new byte[bmpSize];
+
+				foreach (GraphicObject g in GraphicObjects)
+					g.RegisterForLayouting (LayoutingType.All);
+				clipping.AddRectangle (clientRectangle);
+			}
 		}

 		XCursor cursor = XCursor.Default;


Delete Encrypt.cs

Delete Encrypt.cs

--- src/wp/Encrypt.cs
+++ src/wp/Encrypt.cs
@@ -1,45 +0,0 @@
-/*
-	MIT License
-*/
-
-using System;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-using Microsoft.Phone.Info;
-using System.IO.IsolatedStorage;
-using System.Windows.Resources;
-using System.IO;
-using System.Diagnostics;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
-    public class Encrypt : BaseCommand
-    {
-        public void getKeyDetails(string notused)
-        {
-
-            string res = String.Format("\"getKey\":\"{0}\"",
-                                        this.platform);
-
-            res = "{" + res + "}";
-            //Debug.WriteLine("Result::" + res);
-            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, res));
-        }
-
-        public string platform
-        {
-            get
-            {
-                return Environment.OSVersion.Platform.ToString();
-            }
-        }
-
-    }
-}


Add Member cache to MemberList

Add Member cache to MemberList

--- src/hfm/Metadata.cs
+++ src/hfm/Metadata.cs
@@ -1040,9 +1040,11 @@
         /// Count of the number of specs in _memberSpecs
         int _specCount;
         /// Member ids
-        int[] _members;
+        int[] _ids;
         /// Parent ids
-        int[] _parents;
+        int[] _parentIds;
+        /// Member objects
+        Member[] _members;

         /// Returns the n-th Member in the list
@@ -1052,20 +1054,26 @@
                     throw new IndexOutOfRangeException(string.Format("Invalid index {0} for MemberList; " +
                                 "value must be between 0 and {1}", i, Count - 1));
                 }
-                return _dimension.GetMember(_members[i], _parents != null ?
-                        _parents[i] : Member.NOT_USED);
+                if(_members == null) {
+                    _members = new Member[Count];
+                }
+                if(_members[i] == null) {
+                    _members[i] = _dimension.GetMember(_ids[i], _parentIds != null ?
+                            _parentIds[i] : Member.NOT_USED);
+                }
+                return _members[i];
             }
         }
         /// Returns the number of members in the list
-        public int Count { get { return _members.Length; } }
+        public int Count { get { return _ids.Length; } }
         /// Returns the dimension to which this member list relates
         public Dimension Dimension { get { return _dimension; } }
         /// Returns the member ids of the members corresponding to the member
         /// specification.
-        public int[] MemberIds { get { return _members; } }
+        public int[] MemberIds { get { return _ids; } }
         /// Returns the parent ids of the members corresponding to the member
         /// specification.
-        public int[] ParentIds { get { return _parents; } }
+        public int[] ParentIds { get { return _parentIds; } }

         /// <summary>
@@ -1104,7 +1112,7 @@
                                 "The member specification '{0}' is not valid", spec));
                 }
             }
-            if(_members == null || _members.Length == 0) {
+            if(_ids == null || _ids.Length == 0) {
                 throw new ArgumentException("No members were added to the member list");
             }
         }
@@ -1112,7 +1120,7 @@

         public IEnumerator<Member> GetEnumerator()
         {
-            return IterateMembers(_members, _parents).GetEnumerator();
+            return IterateMembers(_ids, _parentIds).GetEnumerator();
         }

@@ -1233,19 +1241,19 @@
         /// set. If no current member ids exist, this creates them.
         protected void AddIds(int[] members, int[] parents)
         {
-            if(_members == null) {
-                _members = members;
-                _parents = parents;
-            }
-            else if(_parents == null) {
-                _members = _members.Union(members).ToArray();
+            if(_ids == null) {
+                _ids = members;
+                _parentIds = parents;
+            }
+            else if(_parentIds == null) {
+                _ids = _ids.Union(members).ToArray();
             }
             else {
                 // Need to keep unique combos of member + parent
-                var combined = IterateMembers(_members, _parents).
+                var combined = IterateMembers(_ids, _parentIds).
                                     Union(IterateMembers(members, parents));
-                _members = combined.Select(m => m.Id).ToArray();
-                _parents = combined.Select(m => m.ParentId).ToArray();
+                _ids = combined.Select(m => m.Id).ToArray();
+                _parentIds = combined.Select(m => m.ParentId).ToArray();
             }
         }


Converted Calls to new format

Converted Calls to new format

--- Source/QIRC/QIRC.cs
+++ Source/QIRC/QIRC.cs
@@ -60,11 +60,11 @@
         {
             /// Load the settings of the Bot
             PluginManager.Load();
-            PluginManager.OnLoad();
+            PluginManager.Invoke("Load");
             Settings.Load();

             /// Call OnAwake
-            PluginManager.OnAwake();
+            PluginManager.Invoke("Awake");

             /// Connect to the IRC
             ircThread = new Thread(Connect);
@@ -117,7 +117,7 @@

             /// Connect to IRC
             client.ConnectAsync();
-            PluginManager.OnConnect(host, port, client.User.Nick, useSSL);
+            PluginManager.Invoke("Connect", host, port, client.User.Nick, useSSL);

             /// Set isConnected to false, which is funny since the function is named Connect, but hey!
             isConnected = false;


Tweak weave's runtime structuring so it doesn't nest so agressively. Gathers at the same level should have the same level of nesting in the runtime, to avoid massively long paths.

--- inklecate/ParsedHierarchy/Weave.cs
+++ inklecate/ParsedHierarchy/Weave.cs
@@ -252,7 +252,7 @@
             // by name so that it isn't stepped into automatically, but only via
             // a divert from a loose end.
             else {
-                currentContainer.AddToNamedContentOnly (gatherContainer);
+                _rootContainer.AddToNamedContentOnly (gatherContainer);
             }

             // Consume loose ends: divert them to this gather


Even more suppressions

Even more suppressions

--- Core/GlobalSuppressions.cs
+++ Core/GlobalSuppressions.cs
@@ -7,15 +7,43 @@

 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Common Practices and Code Improvements", "RECS0063:Warns when a culture-aware 'StartsWith' call is used by default.", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Core.StringHelper.NeglectStart(System.String,System.String,System.Boolean,System.Globalization.CultureInfo)~System.String")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Common Practices and Code Improvements", "RECS0063:Warns when a culture-aware 'StartsWith' call is used by default.", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Core.StringHelper.EnsureStart(System.String,System.String,System.Boolean,System.Globalization.CultureInfo)~System.String")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Dynamic.Utils.Helpers.CommonNode``1(``0,``0,System.Func{``0,``0})~``0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Lazy`1.CachingNoneMode(System.Func{`0},System.Collections.Generic.HashSet{System.Threading.Thread})~`0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Lazy`1.NoneMode(System.Func{`0},System.Collections.Generic.HashSet{System.Threading.Thread})~`0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Lazy`1.PublicationOnlyMode(System.Func{`0})~`0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.CreateGroupJoinIterator``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,System.Collections.Generic.IEnumerable{``1},``3},System.Collections.Generic.IEqualityComparer{``2})~System.Collections.Generic.IEnumerable{``3}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.CreateJoinIterator``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``1,``3},System.Collections.Generic.IEqualityComparer{``2})~System.Collections.Generic.IEnumerable{``3}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.SelectExtracted``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Int32,``1})~System.Collections.Generic.IEnumerable{``1}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.SelectManyExtracted``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Collections.Generic.IEnumerable{``1}})~System.Collections.Generic.IEnumerable{``1}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.SelectManyExtracted``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Int32,System.Collections.Generic.IEnumerable{``1}})~System.Collections.Generic.IEnumerable{``1}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.SelectManyExtracted``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Collections.Generic.IEnumerable{``1}},System.Func{``0,``1,``2})~System.Collections.Generic.IEnumerable{``2}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.SelectManyExtracted``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Int32,System.Collections.Generic.IEnumerable{``1}},System.Func{``0,``1,``2})~System.Collections.Generic.IEnumerable{``2}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.SkipWhileExtracted``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Int32,System.Boolean})~System.Collections.Generic.IEnumerable{``0}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.TakeWhileExtracted``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Int32,System.Boolean})~System.Collections.Generic.IEnumerable{``0}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Enumerable.WhereExtracted``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Int32,System.Boolean})~System.Collections.Generic.IEnumerable{``0}")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Expressions.DebugViewWriter.VisitExpressions``1(System.Char,System.Char,System.Collections.Generic.IList{``0},System.Action{``0})")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Expressions.ExpressionTransformer.VisitList``1(System.Collections.ObjectModel.ReadOnlyCollection{``0},System.Func{``0,``0})~System.Collections.Generic.IList{``0}")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Expressions.ExpressionVisitor.Visit``1(System.Collections.ObjectModel.ReadOnlyCollection{``0},System.Func{``0,``0})~System.Collections.ObjectModel.ReadOnlyCollection{``0}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Expressions.Extensions.OnFieldOrProperty(System.Reflection.MemberInfo,System.Action{System.Reflection.FieldInfo},System.Action{System.Reflection.PropertyInfo})")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Expressions.Extensions.OnFieldOrProperty``1(System.Reflection.MemberInfo,System.Func{System.Reflection.FieldInfo,``0},System.Func{System.Reflection.PropertyInfo,``0})~``0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Expressions.Interpreter.LabelInfo.CommonNode``1(``0,``0,System.Func{``0,``0})~``0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Linq.Lookup`2.ApplyResultSelector``1(System.Func{`0,System.Collections.Generic.IEnumerable{`1},``0})~System.Collections.Generic.IEnumerable{``0}")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Progress`1.#ctor(System.Action{`0})")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Threading.CancellationTokenSource.Register(System.Action,System.Boolean)~System.Threading.CancellationTokenRegistration")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Threading.CancellationTokenSource.RunCallback(System.Boolean,System.Action,System.Collections.Generic.List{System.Exception}@)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action,System.Boolean,System.Threading.Tasks.Task@)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.Extensions.SkipItemsExtracted``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0},System.Int32)~System.Collections.Generic.IEnumerable{``0}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.Extensions.TakeItemsExtracted``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0},System.Int32)~System.Collections.Generic.IEnumerable{``0}")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.Specialized.AVLTree`2.AVLNode.AddExtracted(Theraot.Collections.Specialized.AVLTree`2.AVLNode`0@,`0,System.Comparison{`0},Theraot.Collections.Specialized.AVLTree`2.AVLNode`0)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.Specialized.AVLTree`2.AVLNode.AddNonDuplicateExtracted(Theraot.Collections.Specialized.AVLTree`2.AVLNode`0@,`0,`1,System.Comparison{`0},Theraot.Collections.Specialized.AVLTree`2.AVLNode`0)~System.Boolean")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.Specialized.AVLTree`2.AVLNode.Get(Theraot.Collections.Specialized.AVLTree`2.AVLNode`0,`0,System.Comparison{`0})~Theraot.Collections.Specialized.AVLTree`2.AVLNode`0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.Specialized.AVLTree`2.AVLNode.GetOrAddExtracted(Theraot.Collections.Specialized.AVLTree`2.AVLNode`0@,`0,System.Func{`0,`1},System.Comparison{`0},Theraot.Collections.Specialized.AVLTree`2.AVLNode`0,System.Boolean@)~Theraot.Collections.Specialized.AVLTree`2.AVLNode`0")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.Specialized.AVLTree`2.AVLNode.Remove(Theraot.Collections.Specialized.AVLTree`2.AVLNode`0@,`0,System.Comparison{`0})~System.Boolean")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.BucketCore.Do(System.Int32@,System.Object@,System.Object@,Theraot.Collections.ThreadSafe.DoAction)~System.Boolean")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.BucketCore.DoEnsureSize(System.Int32@,System.Object@,System.Object@,System.Func{System.Object})")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.BucketCore.DoMayDecrement(System.Int32@,System.Object@,System.Object@,Theraot.Collections.ThreadSafe.DoAction)~System.Boolean")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.BucketCore.DoMayIncrement(System.Int32@,System.Object@,System.Object@,System.Func{System.Object},Theraot.Collections.ThreadSafe.DoAction)~System.Boolean")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.FixedSizeBucket`1.UpdateInternal(System.Int32,System.Func{`0,`0},System.Predicate{`0},System.Boolean@)~System.Boolean")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.SafeDictionary`2.AddNew(`0,System.Predicate{`0},`1)")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.SafeDictionary`2.AddOrUpdate(`0,`1,System.Func{`0,`1,`1},System.Boolean@)~`1")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CC0031:Check for null before calling a delegate", Justification = "<Pendiente>", Scope = "member", Target = "~M:Theraot.Collections.ThreadSafe.SafeDictionary`2.Set(`0,System.Predicate{`0},`1)")]
@@ -334,4 +362,5 @@
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0108:Warns about static fields in generic types", Justification = "<Pendiente>", Scope = "member", Target = "~F:Theraot.Core.TypeHelper.ValueTypeRecursiveInfo`1._result")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0108:Warns about static fields in generic types", Justification = "<Pendiente>", Scope = "member", Target = "~P:System.Threading.Tasks.Task`1.ContinuationConvertion")]
 [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancies in Symbol Declarations", "RECS0096:Type parameter is never used", Justification = "<Pendiente>", Scope = "type", Target = "~T:System.Collections.ObjectModel.ReadOnlyDictionary`2")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancies in Symbol Declarations", "RECS0096:Type parameter is never used", Justification = "<Pendiente>", Scope = "type", Target = "~T:Theraot.Threading.Needles.WeakNeedle`1")]
 #endif


Added ability to grab mouse in GameState

--- System/GameState.cs
+++ System/GameState.cs
@@ -18,6 +18,7 @@
     {
         HashSet<GameView> views;
         private ExclusiveGameViewProperty exclusiveView;
+        private bool mouseGrabbed = false;

         public Music BackgroundMusic
         {
@@ -36,6 +37,24 @@
         public ExclusiveGameViewProperty ExclusiveView
         {
             get => exclusiveView;
+        }
+
+        /// <summary>
+        /// Whether or not the mouse is locked in this GameState
+        /// </summary>
+        public bool MouseGrabbed
+        {
+            set
+            {
+                if(StateManager.ActiveState == this)
+                    Application.Window.SetMouseCursorGrabbed(value);
+
+                mouseGrabbed = value;
+            }
+            get
+            {
+                return mouseGrabbed;
+            }
         }

         public StateApplication Application
@@ -218,15 +237,21 @@
         /// </summary>
         public void Activate()
         {
+            Activated();
             StateManager.SetActive(Name);
         }

-        public virtual void Deactivated()
-        {
-
-        }
-
-        public virtual void Activated()
+        public virtual void OnDeactivated()
+        {
+
+        }
+
+        internal void Activated()
+        {
+            Application.Window.SetMouseCursorGrabbed(mouseGrabbed);
+        }
+
+        public virtual void OnActivated()
         {

         }


Basic example refractoring

Basic example refractoring

--- Examples/Examples.cs
+++ Examples/Examples.cs
@@ -65,15 +65,22 @@
         {
             Console.WriteLine("**MS I/O Examples**");

-            // Ms Data Files implment IDispoable making using statements an excellent way to manage resources
+            // Ms Data Files implement IDispoable making using statements an excellent way to manage resources
             using (MsDataFile dataFile = new ThermoRawFile("Resources/ThermoRawFileMS1MS2.raw", true))
-            {
-                int counter = 0;
-                foreach (MsScan scan in dataFile.OfType<MsnScan>())
+            {
+                Console.WriteLine("{0,-4} {1} {2,-5} {3,-5} {4,-10} {5,-3} {6} {7}", "Scan #", "Msn Order", "Retention Time", "Polarity", "Spectrum", "MzAnalyzer", "DataType", "MzRange");
+                foreach (MsScan scan in dataFile)
                 {
-                    Console.WriteLine("Scan #{0} MSn Order: {1} Time: {2:f3} Polarity: {3} Spectrum: {4} M/Z Analyzer: {5} type: {6}", scan.SpectrumNumber, scan.MsnOrder, scan.RetentionTime, scan.Polarity, scan.Spectrum, scan.MzAnalyzer, scan.GetType());
-                }
-                Console.WriteLine(counter);
+                    Console.WriteLine("{0,-4} {1} {2,-5:F4} {3,-5} {4,-10} {5,-3} {6} {7}",
+                        scan.SpectrumNumber,
+                        scan.MsnOrder,
+                        scan.RetentionTime,
+                        scan.Polarity,
+                        scan.Spectrum,
+                        scan.MzAnalyzer,
+                        scan.GetType(),
+                        scan.MzRange);
+                }
             }
         }


Stopped the GUI thread allocating all the threads.

--- Demos/Philosophers/Main.cs
+++ Demos/Philosophers/Main.cs
@@ -333,11 +333,15 @@
     {
         this.GoButton.Enabled = false;
         stopwatch.Start();
-        foreach (var sprite in sprites)
-        {
-            var p = sprite as Phil;
-            if (p != null) p.GetALife();
-        }
+        System.Threading.Tasks.Task.Factory.StartNew(
+            () =>
+            {
+                foreach (var sprite in sprites)
+                {
+                    var p = sprite as Phil;
+                    if (p != null) p.GetALife();
+                }
+            });
     }

@@ -517,7 +521,7 @@

       public async Task getalifeAsync()
       {
-          Thread.CurrentThread.IsBackground = true;
+          //Thread.CurrentThread.IsBackground = true;
           bool foodleft = true;
           //await Task.Yield();
           while (foodleft)


Add a couple of friend assemblies

Add a couple of friend assemblies

--- src/AssemblyInfo.cs
+++ src/AssemblyInfo.cs
@@ -10,3 +10,6 @@
 [assembly: AssemblyDescription ("D-Bus IPC protocol library and CLR binding")]
 [assembly: AssemblyCopyright ("Copyright (C) Alp Toker")]
 [assembly: AssemblyCompany ("NDesk")]
+
+[assembly: InternalsVisibleTo ("dbus-monitor")]
+[assembly: InternalsVisibleTo ("dbus-daemon")]


Added map for image view model

Added map for image view model

--- src/Blog/Startup.cs
+++ src/Blog/Startup.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+using System.Collections.Generic;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
@@ -15,13 +12,15 @@
 using Microsoft.AspNetCore.Mvc;
 using Blog.Models.Data;
 using Blog.ViewModels;
-using Sakura.AspNetCore.Mvc;
 using Blog.Service;
 using Microsoft.AspNetCore.Routing;
 using Newtonsoft.Json.Serialization;
 using Blog.ViewModels.ControlPanelViewModels;
 using Blog.Controllers;
 using Blog.Models.AccountViewModels;
+using Sakura.AspNetCore;
+using Blog.ViewModels.PostViewModels;
+using Blog.Models.Entities;

 namespace Blog
 {
@@ -125,9 +124,10 @@
                 config.CreateMap<Post, PostViewModel>().ReverseMap();
                 config.CreateMap<Tag, TagViewModel>().ReverseMap();
                 config.CreateMap<Category, CategoryViewModel>().ReverseMap();
-                config.CreateMap<PostCreateViewModel, Post>();
+                config.CreateMap<CreatePostViewModel, Post>();
                 config.CreateMap<Post, PostControlPanelViewModel>().ReverseMap();
                 config.CreateMap<BlogUser, UserControlPanelViewModel>().ReverseMap();
+                config.CreateMap<Image, ImageViewModel>().ReverseMap();
             });


创建Core

创建Core

初始化miniORM的核心类

--- Core.cs
+++ Core.cs
@@ -12,7 +12,7 @@
     public abstract class BaseEntity
     {
         /// <summary>
-        /// 抽象方法
+        /// 实现将数据库字段映射到对象中字段
         /// </summary>
         /// <param name="reader"></param>
         internal abstract void SetEntity(IDataReader reader, Dictionary<string, int> lowerFields);


Bugfixes #FIX: Fixed invalid ContentRefs to virtual default content file paths spamming File.Exist calls, which slowed down debugging sessions significantly.

--- Duality/ContentProvider.cs
+++ Duality/ContentProvider.cs
@@ -435,7 +435,7 @@
 		}
 		private static Resource LoadContent(string path)
 		{
-			if (string.IsNullOrEmpty(path) || !File.Exists(path)) return null;
+			if (string.IsNullOrEmpty(path) || IsDefaultContentPath(path) || !File.Exists(path)) return null;

 			Log.Core.Write("Loading Resource '{0}'...", path);
 			Log.Core.PushIndent();


Fix global tool to report about missing configuration file or missing build script

--- source/Nuke.GlobalTool/Program.cs
+++ source/Nuke.GlobalTool/Program.cs
@@ -7,6 +7,7 @@
 using System.IO;
 using System.Linq;
 using System.Reflection;
+using System.Reflection.Metadata;
 using JetBrains.Annotations;
 using Nuke.Common;
 using Nuke.Common.Tooling;
@@ -57,11 +58,15 @@
                 return (int) commandHandler.Invoke(obj: null, commandArguments);
             }

-            if (buildScript == null)
+            if (rootDirectory == null || buildScript == null)
             {
-                if (UserConfirms($"Could not find {Constants.ConfigurationFileName} file. Do you want to setup a build?"))
-                    return Setup(new string[0], rootDirectory, buildScript: null);
-                return 0;
+                var missingFile = rootDirectory == null
+                    ? Constants.ConfigurationFileName
+                    : "build.ps1/sh";
+
+                return UserConfirms($"Could not find {missingFile} file. Do you want to setup a build?")
+                    ? Setup(new string[0], rootDirectory, buildScript: null)
+                    : 0;
             }

             // TODO: docker


Updated comments

Updated comments

--- DynamicSettings/IniFile.cs
+++ DynamicSettings/IniFile.cs
@@ -1,22 +1,36 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Diagnostics;

 namespace Ini
 {
+    /// <summary>
+    /// Holds the data of an .ini file
+    /// </summary>
     class IniFile
     {
+        /// <summary>
+        /// List of the sections in the file
+        /// </summary>
         List<IniSection> _sectionList = new List<IniSection>();

+        /// <summary>
+        /// Load data from a string
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns>Whether loading was successful</returns>
         public bool LoadFromString(string str)
         {
             try
             {
+                //create a StringReader to read the data
                 using (StringReader reader = new StringReader(str))
                 {
                     string line;
                     string section = "";

+                    //read until the end
                     while ((line = reader.ReadLine()) != null)
                     {
                         if (line[0] == '[')
@@ -32,59 +46,74 @@
                     reader.Close();
                 }
             }
-            catch (Exception)
-            {
+            catch (Exception e)
+            {
+                //log the exception
+                Trace.WriteLine(e.ToString());
                 return false;
             }

             return true;
         }

+        /// <summary>
+        /// Load data from a file
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns>Whether loading was successful</returns>
         public bool LoadFromFile(string path)
         {
+            //check if the file exists
             if (!File.Exists(path))
                 return false;

             try
             {
+                //create a StreamReader to read the data
                 using(StreamReader reader = new StreamReader(path))
                 {
                     string line;
                     string section = "";

                     while (!reader.EndOfStream)
-                    {
-                        line = reader.ReadLine();
-
-                        if (!string.IsNullOrEmpty(line))
-                        {
-                            if (line[0] == '[')
-                            {
-                                section = line.Remove(0, 1).Split(']')[0];
-                                AddSection(section);
-                            }
-                            else
-                            {
-                                if (line[0] != ';')
-                                {
-                                    string[] stringArray = line.Split(new char[] { '=', ';' });
-
-                                    if (stringArray.Length > 0)
-                                        this[section].AddKey(new IniKey(stringArray));
-                                }
-                            }
+                    {
+                        line = reader.ReadLine();
+
+                        if (!string.IsNullOrEmpty(line))
+                        {
+                            if (line[0] == '[')
+                            {
+                                section = line.Remove(0, 1).Split(']')[0];
+                                AddSection(section);
+                            }
+                            else
+                            {
+                                if (line[0] != ';')
+                                {
+                                    string[] stringArray = line.Split(new char[] { '=', ';' });
+
+                                    if (stringArray.Length > 0)
+                                        this[section].AddKey(new IniKey(stringArray));
+                                }
+                            }
                         }
                     }
                 }
             }
-            catch(Exception)
-            {
+            catch (Exception e)
+            {
+                //log the exception
+                Trace.WriteLine(e.ToString());
                 return false;
             }

             return true;
         }

+        /// <summary>
+        /// Saves data to a string
+        /// </summary>
+        /// <returns>Data string</returns>
         public string SaveToString()
         {
             try
@@ -92,24 +121,30 @@
                 using (StringWriter writer = new StringWriter())
                 {
                     foreach (IniSection section in _sectionList)
-                    {
+                    {
                         writer.WriteLine("[" + section.name + "]");

                         for (int i = 0; i < section.ToArray().Length; i++)
-                            writer.WriteLine(section.ToArray()[i]);
-
+                            writer.WriteLine(section.ToArray()[i]);
+
                         writer.WriteLine();
                     }

                     return writer.ToString();
                 }
             }
-            catch (Exception)
-            {
+            catch (Exception e)
+            {
+                //log the exception
+                Trace.WriteLine(e.ToString());
                 return "";
             }
         }

+        /// <summary>
+        /// Saves data to a file
+        /// </summary>
+        /// <param name="path"></param>
         public void SaveToFile(string path)
         {
             try
@@ -117,26 +152,34 @@
                 using(StreamWriter writer = new StreamWriter(path))
                 {
                     foreach(IniSection section in _sectionList)
-                    {
+                    {
                         writer.WriteLine("[" + section.name + "]");

                         for (int i = 0; i < section.ToArray().Length; i++)
-                            writer.WriteLine(section.ToArray()[i]);
-
+                            writer.WriteLine(section.ToArray()[i]);
+
                         writer.WriteLine();
                     }

                     writer.Close();
                 }
             }
-            catch(Exception)
-            {
+            catch(Exception e)
+            {
+                //log the exception
+                Trace.WriteLine(e.ToString());
                 return;
             }
         }

+        /// <summary>
+        /// Adds a new section
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns>Whether a new section was added</returns>
         public bool AddSection(string name)
         {
+            //check if a section of the same name already exists
             if (!SectionExists(name))
             {
                 _sectionList.Add(new IniSection(name));
@@ -146,11 +189,21 @@
                 return false;
         }

+        /// <summary>
+        /// Removes a section
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns>Whether the section was removed</returns>
         public bool RemoveSection(string name)
         {
             return _sectionList.Remove(_sectionList.Find(section => section.name == name));
         }

+        /// <summary>
+        /// Checks if a section exists
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns>Whether the section exists</returns>
         public bool SectionExists(string name)
         {
             return _sectionList.Find(section => section.name == name) != null;
@@ -180,6 +233,12 @@
             }
         }

+        /// <summary>
+        /// Gets a key
+        /// </summary>
+        /// <param name="name"></param>
+        /// <param name="section"></param>
+        /// <returns>The key found</returns>
         public IniKey GetKey(string name, string section="")
         {
             if (section != "")
@@ -196,6 +255,10 @@
             return null;
         }

+        /// <summary>
+        /// Gets an array of the sections
+        /// </summary>
+        /// <returns>Array of sections</returns>
         public IniSection[] GetSections()
         {
             return _sectionList.ToArray();


Cleanup.

Cleanup.

--- Editor/InterloperWindow.cs
+++ Editor/InterloperWindow.cs
@@ -4,7 +4,6 @@
 using System;
 using System.Reflection;
 using System.Linq;
-using LunraGames;
 using Newtonsoft.Json;
 using LunraGames.Reflection;

@@ -43,14 +42,14 @@
 		InterloperWindow()
 		{
 			Settings = JsonConvert.DeserializeObject<Preferences>(EditorPrefs.GetString (Strings.SettingsKey, JsonConvert.SerializeObject(new Preferences())));
-			if (!EditorApplication.isPlayingOrWillChangePlaymode) InterloperWindow.IsDirty = true;
+			if (!EditorApplication.isPlayingOrWillChangePlaymode) IsDirty = true;
 			EditorApplication.update += InterloperUpdate;
 		}

 		[MenuItem ("Window/Lunra Games/Interloper")]
 		static void Init ()
 		{
-			var window = EditorWindow.GetWindow(typeof (InterloperWindow), false, "Interloper") as InterloperWindow;
+			var window = GetWindow(typeof (InterloperWindow), false, "Interloper") as InterloperWindow;
 			window.Show();
 		}

@@ -273,22 +272,6 @@
 				}
 			}
 			GUILayout.EndScrollView();
-		}
-
-		void DrawQueryResult(MethodEntry entry)
-		{
-			if (GUILayout.Button(entry.FullName))
-			{
-
-			}
-		}
-
-		void DrawQueryResult(FieldEntry entry)
-		{
-			if (GUILayout.Button(entry.FullName))
-			{
-
-			}
 		}

 		void InterloperUpdate()


Error message tweaks

Error message tweaks

--- src/ServerBus.cs
+++ src/ServerBus.cs
@@ -61,6 +61,7 @@

 			conns.Add (conn);
 			conn.Register (Path, this);
+			//((ExportObject)conn.RegisteredObjects[Path]).Registered = false;
 		}

 		public void RemoveConnection (Connection conn)
@@ -104,10 +105,7 @@
 				Names.Remove (name);

 			foreach (string name in namesToDisown)
-				//NameOwnerChanged (name, Caller.UniqueName, String.Empty);
 				NameOwnerChanged (name, ((ServerConnection)conn).UniqueName, String.Empty);
-
-			//NameOwnerChanged (Caller.UniqueName, Caller.UniqueName, String.Empty);

 			// FIXME: Unregister earlier?
 			conn.Unregister (Path);
@@ -140,7 +138,7 @@
 				throw new ArgumentException (String.Format ("Cannot acquire a name starting with ':' such as \"{0}\"", name), "name");

 			if (name == DBusBusName)
-				throw new ArgumentException (String.Format ("Connection \"{0}\" is not allowed to own the name \"{1}\" because it is reserved for D-Bus' use only", Caller.UniqueName, name), "name");
+				throw new ArgumentException (String.Format ("Connection \"{0}\" is not allowed to own the name \"{1}\" because it is reserved for D-Bus' use only", Caller.UniqueName ?? "(inactive)", name), "name");

 			// TODO: Policy delegate support

@@ -260,11 +258,10 @@
 			if (Names.ContainsKey (name))
 				return StartReply.AlreadyRunning;

-			StartProcessNamed (name);
+			if (!StartProcessNamed (name))
+				throw new BusException ("org.freedesktop.DBus.Error.Spawn.ServiceNotFound", "The name {0} was not provided by any .service files", name);
+
 			return StartReply.Success;
-
-			//return StartReply.Success;
-			//throw new NotSupportedException ();
 		}

 		Dictionary<string, string> activationEnv = new Dictionary<string, string> ();
@@ -293,8 +290,8 @@
 		//public uint GetConnectionUnixUser (string connection_name)
 		public uint GetConnectionUnixUser (string name)
 		{
-			//if (name == DBusBusName)
-			//	return 0;
+			if (name == DBusBusName)
+				return (uint)Process.GetCurrentProcess ().Id;

 			Connection c;
 			if (!Names.TryGetValue (name, out c))
@@ -445,7 +442,7 @@

 			uint pid;
 			if (!c.Transport.TryGetPeerPid (out pid))
-				throw new BusException ("org.freedesktop.DBus.Error.Failed", "Could not determine PID for '{0}'", connection_name);
+				throw new BusException ("org.freedesktop.DBus.Error.UnixProcessIdUnknown", "Could not determine PID for '{0}'", connection_name);

 			return pid;
 		}
@@ -463,12 +460,11 @@
 		}

 		Dictionary<string, string> services = new Dictionary<string, string> ();
-
+		public string svcPath = "/usr/share/dbus-1/services";
 		public void ScanServices ()
 		{
 			services.Clear ();

-			string svcPath = "/usr/share/dbus-1/services";
 			string[] svcs = Directory.GetFiles (svcPath, "*.service");
 			foreach (string svc in svcs) {
 				string fname = System.IO.Path.Combine (svcPath, svc);
@@ -483,6 +479,8 @@
 							name = ln.Remove (0, 5);
 					}

+					// TODO: use XdgNet
+					// TODO: Validate names and trim strings
 					if (name != null && cmd != null)
 						services[name] = cmd;
 				}
@@ -490,22 +488,25 @@
 		}

 		public bool allowActivation = false;
-		void StartProcessNamed (string name)
-		{
-			Console.WriteLine ("Start " + name);
+		bool StartProcessNamed (string name)
+		{
+			Console.Error.WriteLine ("Start " + name);

 			if (!allowActivation)
-				return;
+				return false;

 			string cmd;
 			if (!services.TryGetValue (name, out cmd))
-				return;
+				return false;

 			try {
 				StartProcess (cmd);
 			} catch (Exception e) {
 				Console.Error.WriteLine (e);
-			}
+				return false;
+			}
+
+			return true;
 		}

 		void StartProcess (string fname)
@@ -542,19 +543,11 @@
 		}

 		bool shouldDump = false;
-		//bool shouldDump = true;
-
-		//bool isHelloed = false;
-		//bool isConnected = true;
+
 		override internal void HandleMessage (Message msg)
 		{
-			//Console.Error.WriteLine ("Message!");
-
 			if (!isConnected)
 				return;
-
-			Server.CurrentMessageConnection = this;
-			Server.CurrentMessage = msg;

 			if (msg == null) {
 				Console.Error.WriteLine ("Disconnected!");
@@ -574,33 +567,38 @@
 				return;
 			}

-			if (shouldDump) {
-				MessageDumper.WriteComment ("Handling:", Console.Out);
-				MessageDumper.WriteMessage (msg, Console.Out);
-			}
-
-			if (UniqueName != null)
-				msg.Header[FieldCode.Sender] = UniqueName;
-
-			object fieldValue = msg.Header[FieldCode.Destination];
-			if (fieldValue != null) {
-				if ((string)fieldValue == "org.freedesktop.DBus") {
-
-					// Workaround for our daemon only listening on a single path
-					if (msg.Header.MessageType == NDesk.DBus.MessageType.MethodCall)
-						msg.Header[FieldCode.Path] = ServerBus.Path;
-
-					base.HandleMessage (msg);
-					//return;
-				}
-			}
-			//base.HandleMessage (msg);
-
-			Server.SBus.HandleMessage (msg);
-
-			// TODO: we ought to make sure these are cleared in other cases above too!
-			Server.CurrentMessageConnection = null;
-			Server.CurrentMessage = null;
+			Server.CurrentMessageConnection = this;
+			Server.CurrentMessage = msg;
+
+			try {
+				if (shouldDump) {
+					MessageDumper.WriteComment ("Handling:", Console.Out);
+					MessageDumper.WriteMessage (msg, Console.Out);
+				}
+
+				if (UniqueName != null)
+					msg.Header[FieldCode.Sender] = UniqueName;
+
+				object fieldValue = msg.Header[FieldCode.Destination];
+				if (fieldValue != null) {
+					if ((string)fieldValue == "org.freedesktop.DBus") {
+
+						// Workaround for our daemon only listening on a single path
+						if (msg.Header.MessageType == NDesk.DBus.MessageType.MethodCall)
+							msg.Header[FieldCode.Path] = ServerBus.Path;
+
+						base.HandleMessage (msg);
+						//return;
+					}
+				}
+				//base.HandleMessage (msg);
+
+				Server.SBus.HandleMessage (msg);
+			} finally {
+				// TODO: we ought to make sure these are cleared in other cases above too!
+				Server.CurrentMessageConnection = null;
+				Server.CurrentMessage = null;
+			}
 		}

 		override internal uint Send (Message msg)
@@ -656,7 +654,7 @@

 		~ServerConnection ()
 		{
-			Console.Error.WriteLine ("Good! ~ServerConnection () for {0}", UniqueName);
+			Console.Error.WriteLine ("Good! ~ServerConnection () for {0}", UniqueName ?? "(inactive)");
 		}
 	}


Added back in missing program test functions

--- TVGLTest/Program.cs
+++ TVGLTest/Program.cs
@@ -94,15 +94,13 @@
                 dir = new DirectoryInfo("../../../TestFiles");
             }
             var fileNames = dir.GetFiles("*");
-            //Casing = 17
-            //SquareSupport = 70
-            for (var i = 0; i < fileNames.Count(); i++)
+            //Casing = 18
+            //SquareSupport = 75
+            for (var i = 18; i < fileNames.Count(); i++)
             {
                 //var filename = FileNames[i];
                 var filename = fileNames[i].FullName;
                 Console.WriteLine("Attempting: " + filename);
-
-                var justfile = fileNames[i].Name;
                 Stream fileStream;
                 List<TessellatedSolid> ts;
                 if (!File.Exists(filename)) continue;
@@ -110,14 +108,9 @@
                     ts = IO.Open(fileStream, filename);
                 if (!ts.Any()) continue;
                 Presenter.ShowAndHang(ts);
-                var casing = ts[0];
-                List<TessellatedSolid> negativeSolids;
-                List<TessellatedSolid> positiveSolids;
-                var d = (casing.XMax + casing.XMin)/2;
-                TVGL.Boolean_Operations.Slice.OnFlat(casing, new Flat(d,new []{1.0,0.0,0.0}),
-                                        out positiveSolids, out negativeSolids);
-                Presenter.ShowAndHang(positiveSolids);
-                Presenter.ShowAndHang(negativeSolids);
+
+                //Put your test function here
+                TestSilhouette(ts[0]);
             }
             Console.WriteLine("Completed.");
         }
@@ -225,8 +218,6 @@
             //var originalTS = new Solid[] { ts };
         }

-
-
         public static void TestVoxelization(TessellatedSolid ts)
         {
             var stopWatch = new Stopwatch();
@@ -261,5 +252,119 @@
             //    ts.Volume, vsInt.Volume, stopWatch.Elapsed.TotalSeconds);
             //PresenterShowAndHang(new Solid[] { vsInt });
         }
+
+        public static void TestSegmentation(TessellatedSolid ts)
+        {
+            var obb = MinimumEnclosure.OrientedBoundingBox(ts);
+            var startTime = DateTime.Now;
+
+            var averageNumberOfSteps = 500;
+
+            //Do the average # of slices slices for each direction on a box (l == w == h).
+            //Else, weight the average # of slices based on the average obb distance
+            var obbAverageLength = (obb.Dimensions[0] + obb.Dimensions[1] + obb.Dimensions[2]) / 3;
+            //Set step size to an even increment over the entire length of the solid
+            var stepSize = obbAverageLength / averageNumberOfSteps;
+
+            foreach (var direction in obb.Directions)
+            {
+                Dictionary<int, double> stepDistances;
+                Dictionary<int, double> sortedVertexDistanceLookup;
+                var segments = DirectionalDecomposition.UniformDirectionalSegmentation(ts, direction,
+                    stepSize, out stepDistances, out sortedVertexDistanceLookup);
+                //foreach (var segment in segments)
+                //{
+                //    var vertexLists = segment.DisplaySetup(ts);
+                //    Presenter.ShowVertexPathsWithSolid(vertexLists, new List<TessellatedSolid>() { ts });
+                //}
+            }
+
+            // var segments = AreaDecomposition.UniformDirectionalSegmentation(ts, obb.Directions[2].multiply(-1), stepSize);
+            var totalTime = DateTime.Now - startTime;
+            Debug.WriteLine(totalTime.TotalMilliseconds + " Milliseconds");
+            //CheckAllObjectTypes(ts, segments);
+        }
+
+        private static void CheckAllObjectTypes(TessellatedSolid ts, IEnumerable<DirectionalDecomposition.DirectionalSegment> segments)
+        {
+            var faces = new HashSet<PolygonalFace>(ts.Faces);
+            var vertices = new HashSet<Vertex>(ts.Vertices);
+            var edges = new HashSet<Edge>(ts.Edges);
+
+
+            foreach (var face in faces)
+            {
+                face.Color = new Color(KnownColors.Gray);
+            }
+
+            foreach (var segment in segments)
+            {
+                foreach (var face in segment.ReferenceFaces)
+                {
+                    faces.Remove(face);
+                }
+                foreach (var edge in segment.ReferenceEdges)
+                {
+                    edges.Remove(edge);
+                }
+                foreach (var vertex in segment.ReferenceVertices)
+                {
+                    vertices.Remove(vertex);
+                }
+            }
+
+            ts.HasUniformColor = false;
+            //Turn the remaining faces red
+            foreach (var face in faces)
+            {
+                face.Color = new Color(KnownColors.Red);
+            }
+            Presenter.ShowAndHang(ts);
+
+            //Make sure that every face, edge, and vertex is accounted for
+            //Assert.That(!edges.Any(), "edges missed");
+            //Assert.That(!faces.Any(), "faces missed");
+            //Assert.That(!vertices.Any(), "vertices missed");
+        }
+
+        public static void TestSilhouette(TessellatedSolid ts)
+        {
+            var silhouette = TVGL.Silhouette.Run(ts, new[] { 0.5, 0.0, 0.5 });
+            Presenter.ShowAndHang(silhouette);
+        }
+
+        private static void TestOBB(string InputDir)
+        {
+            var di = new DirectoryInfo(InputDir);
+            var fis = di.EnumerateFiles();
+            var numVertices = new List<int>();
+            var data = new List<double[]>();
+            foreach (var fileInfo in fis)
+            {
+                try
+                {
+                    var ts = IO.Open(fileInfo.Open(FileMode.Open), fileInfo.Name);
+                    foreach (var tessellatedSolid in ts)
+                    {
+                        List<double> times, volumes;
+                        MinimumEnclosure.OrientedBoundingBox_Test(tessellatedSolid, out times, out volumes);//, out VolumeData2);
+                        data.Add(new[] { tessellatedSolid.ConvexHull.Vertices.Count(), tessellatedSolid.Volume,
+                            times[0], times[1],times[2], volumes[0],  volumes[1], volumes[2] });
+                    }
+                }
+                catch { }
+            }
+            // TVGLTest.ExcelInterface.PlotEachSeriesSeperately(VolumeData1, "Edge", "Angle", "Volume");
+            TVGLTest.ExcelInterface.CreateNewGraph(new[] { data }, "", "Methods", "Volume", new[] { "PCA", "ChanTan" });
+        }
+
+        private static void TestSimplify(TessellatedSolid ts)
+        {
+            ts.Simplify(.9);
+            Debug.WriteLine("number of vertices = " + ts.NumberOfVertices);
+            Debug.WriteLine("number of edges = " + ts.NumberOfEdges);
+            Debug.WriteLine("number of faces = " + ts.NumberOfFaces);
+            TVGL.Presenter.ShowAndHang(ts);
+        }
     }
 }


Added back-door for setting Priority as the raw int value.

--- TaskService/Task.cs
+++ TaskService/Task.cs
@@ -3302,7 +3302,9 @@

 		private int GetPriorityAsInt(ProcessPriorityClass value)
 		{
-			var p = 7;
+			// Check for back-door case where exact value is being passed and cast to ProcessPriorityClass
+			if ((int)value <= 10 && value >= 0) return (int)value;
+			int p = 7;
 			switch (value)
 			{
 				case ProcessPriorityClass.AboveNormal:


Car and Cdr

Car and Cdr


Added unit tests in ForceTests.cs: * ArithmeticOperators * ComparisonAndEqualityOperators * CompareToIsImplemented * CompareToThrowsOnTypeMismatch * CompareToThrowsOnNull * EqualsIsImplemented * EqualsReturnsFalseOnTypeMismatch * EqualsReturnsFalseOnNull

--- Tests/ForceTests.cs
+++ Tests/ForceTests.cs
@@ -1,4 +1,5 @@
-using NUnit.Framework;
+using System;
+using NUnit.Framework;

 namespace UnitsNet.Tests.net35
 {
@@ -10,29 +11,100 @@
         [Test]
         public void NewtonToForceUnits()
         {
-            Force oneNewton = Force.FromNewtons(1);
-
-            Assert.AreEqual(1E-3, oneNewton.Kilonewtons);
-            Assert.AreEqual(1, oneNewton.Newtons);
-            Assert.AreEqual(1E5, oneNewton.Dyne);
-            Assert.AreEqual(0.10197, oneNewton.KilogramForce, Delta);
-            Assert.AreEqual(0.10197, oneNewton.KiloPonds, Delta);
-            Assert.AreEqual(0.22481, oneNewton.PoundForce, Delta);
-            Assert.AreEqual(7.2330, oneNewton.Poundal, Delta);
+            Force newton = Force.FromNewtons(1);
+            Assert.AreEqual(1E-3, newton.Kilonewtons);
+            Assert.AreEqual(1, newton.Newtons);
+            Assert.AreEqual(1E5, newton.Dyne);
+            Assert.AreEqual(0.10197, newton.KilogramForce, Delta);
+            Assert.AreEqual(0.10197, newton.KiloPonds, Delta);
+            Assert.AreEqual(0.22481, newton.PoundForce, Delta);
+            Assert.AreEqual(7.2330, newton.Poundal, Delta);
         }

         [Test]
         public void ForceUnitsRoundTrip()
         {
+            Force newton = Force.FromNewtons(1);
+            Assert.AreEqual(1, Force.FromNewtons(newton.Newtons).Newtons, Delta);
+            Assert.AreEqual(1, Force.FromKilonewtons(newton.Kilonewtons).Newtons, Delta);
+            Assert.AreEqual(1, Force.FromKilogramForce(newton.KilogramForce).Newtons, Delta);
+            Assert.AreEqual(1, Force.FromDyne(newton.Dyne).Newtons, Delta);
+            Assert.AreEqual(1, Force.FromKiloPonds(newton.KiloPonds).Newtons, Delta);
+            Assert.AreEqual(1, Force.FromPoundForce(newton.PoundForce).Newtons, Delta);
+            Assert.AreEqual(1, Force.FromPoundal(newton.Poundal).Newtons, Delta);
+        }
+
+        [Test]
+        public void ArithmeticOperators()
+        {
+            Force newton = Force.FromNewtons(1);
+            Assert.AreEqual(-1, -newton.Newtons, Delta);
+            Assert.AreEqual(2, (newton + newton).Newtons, Delta);
+            Assert.AreEqual(1, (Force.FromNewtons(2) - newton).Newtons, Delta);
+            Assert.AreEqual(10, (newton*10).Newtons, Delta);
+            Assert.AreEqual(10, (10*newton).Newtons, Delta);
+            Assert.AreEqual(2, (Force.FromNewtons(10)/5).Newtons, Delta);
+        }
+
+        [Test]
+        public void ComparisonAndEqualityOperators()
+        {
             Force oneNewton = Force.FromNewtons(1);
+            Force twoNewtons = Force.FromNewtons(2);

-            Assert.AreEqual(1, Force.FromNewtons(oneNewton.Newtons).Newtons, Delta);
-            Assert.AreEqual(1, Force.FromKilonewtons(oneNewton.Kilonewtons).Newtons, Delta);
-            Assert.AreEqual(1, Force.FromKilogramForce(oneNewton.KilogramForce).Newtons, Delta);
-            Assert.AreEqual(1, Force.FromDyne(oneNewton.Dyne).Newtons, Delta);
-            Assert.AreEqual(1, Force.FromKiloPonds(oneNewton.KiloPonds).Newtons, Delta);
-            Assert.AreEqual(1, Force.FromPoundForce(oneNewton.PoundForce).Newtons, Delta);
-            Assert.AreEqual(1, Force.FromPoundal(oneNewton.Poundal).Newtons, Delta);
+            Assert.True(oneNewton < twoNewtons);
+            Assert.True(oneNewton <= twoNewtons);
+            Assert.True(twoNewtons > oneNewton);
+            Assert.True(twoNewtons >= oneNewton);
+            Assert.True(oneNewton == oneNewton);
+            Assert.True(oneNewton != twoNewtons);
+        }
+
+        [Test]
+        public void CompareToIsImplemented()
+        {
+            Force newton = Force.FromNewtons(1);
+            Assert.AreEqual(0, newton.CompareTo(newton));
+            Assert.Greater(newton.CompareTo(Force.Zero), 0);
+            Assert.Less(Force.Zero.CompareTo(newton), 0);
+        }
+
+        [Test]
+        [ExpectedException(typeof(ArgumentException))]
+        public void CompareToThrowsOnTypeMismatch()
+        {
+            Force newton = Force.FromNewtons(1);
+            newton.CompareTo(new object());
+        }
+
+        [Test]
+        [ExpectedException(typeof(ArgumentNullException))]
+        public void CompareToThrowsOnNull()
+        {
+            Force newton = Force.FromNewtons(1);
+            newton.CompareTo(null);
+        }
+
+        [Test]
+        public void EqualsIsImplemented()
+        {
+            Force newton = Force.FromNewtons(1);
+            Assert.IsTrue(newton.Equals(Force.FromNewtons(1)));
+            Assert.IsFalse(newton.Equals(Force.Zero));
+        }
+
+        [Test]
+        public void EqualsReturnsFalseOnTypeMismatch()
+        {
+            Force newton = Force.FromNewtons(1);
+            Assert.IsFalse(newton.Equals(new object()));
+        }
+
+        [Test]
+        public void EqualsReturnsFalseOnNull()
+        {
+            Force newton = Force.FromNewtons(1);
+            Assert.IsFalse(newton.Equals(null));
         }
     }
 }


Fixes bug resolving resolution for warmup internal feeds

--- Engine/AlgorithmManager.cs
+++ Engine/AlgorithmManager.cs
@@ -653,13 +653,16 @@
                 }

                 // rewrite internal feed requests
-                var minResolution = algorithm.SubscriptionManager.Subscriptions.Min(x => x.Resolution);
+                var minResolution = algorithm.SubscriptionManager.Subscriptions.Where(x => !x.IsInternalFeed).Min(x => x.Resolution);
                 foreach (var request in historyRequests)
                 {
                     Security security;
                     if (algorithm.Securities.TryGetValue(request.Symbol, out security) && security.SubscriptionDataConfig.IsInternalFeed)
                     {
-                        request.Resolution = minResolution;
+                        if (request.Resolution < minResolution)
+                        {
+                            request.Resolution = minResolution;
+                        }
                     }
                 }


try threaded

try threaded

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


attempt to fix #97;

attempt to fix #97;

this combined with the other little fixes should make channel joining more snappy when the client is chugging through a lot on its queue

--- slimCat/Services/CommandService.cs
+++ slimCat/Services/CommandService.cs
@@ -31,6 +31,7 @@
     using Microsoft.Practices.Prism.Regions;
     using Microsoft.Practices.Unity;
     using Models;
+    using Models.Api;
     using SimpleJson;
     using Utilities;
     using ViewModels;
@@ -54,6 +55,7 @@
         private readonly object locker = new object();

         private readonly IChannelManager manager;
+
         private readonly string[] noisyTypes;

         private readonly Queue<IDictionary<string, object>> que = new Queue<IDictionary<string, object>>();
@@ -352,19 +354,31 @@

                 var workingData = que.Dequeue();

-                var toInvoke = InterpretCommand(workingData);
-                if (toInvoke != null)
-                    toInvoke.Invoke(workingData);
-
+                Invoke(workingData);
                 DoAction();
             }
         }

         private void EnqueueAction(IDictionary<string, object> data)
         {
+            var command = data.Get(Constants.Arguments.Command);
+
+            // try and prioritize these commands as they will impact the flow of channel joining
+            if (command == Commands.ChannelJoin || command == Commands.ChannelInitialize)
+            {
+                Invoke(data);
+                return;
+            }
+
             que.Enqueue(data);
-
             DoAction();
+        }
+
+        private void Invoke(IDictionary<string, object> command)
+        {
+            var toInvoke = InterpretCommand(command);
+            if (toInvoke != null)
+                toInvoke.Invoke(command);
         }

         private void ErrorCommand(IDictionary<string, object> command)


Added support to parse WebAuthenticationBroker form post response (to overcome 2k query string limit)

--- source/Client/AuthorizeResponse.cs
+++ source/Client/AuthorizeResponse.cs
@@ -14,6 +14,7 @@
         {
             AuthorizationCode,
             Token,
+            FormPost,
             Error
         };

@@ -102,19 +103,23 @@
             var queryParameters = new Dictionary<string, string>();
             string[] fragments = null;

+            // fragment encoded
             if (Raw.Contains("#"))
             {
                 fragments = Raw.Split('#');
                 ResponseType = ResponseTypes.Token;
             }
+            // query string encoded
             else if (Raw.Contains("?"))
             {
                 fragments = Raw.Split('?');
                 ResponseType = ResponseTypes.AuthorizationCode;
             }
+            // form encoded
             else
             {
-                throw new InvalidOperationException("Malformed callback URL");
+                fragments = new string[] { "", Raw };
+                ResponseType = ResponseTypes.FormPost;
             }

             if (Raw.Contains(OAuth2Constants.Error))
@@ -127,7 +132,7 @@
             foreach (var param in qparams)
             {
                 var parts = param.Split('=');
-
+
                 if (parts.Length == 2)
                 {
                     Values.Add(parts[0], parts[1]);


Format source

Format source

--- source/Remoting.Server/FormMain.cs
+++ source/Remoting.Server/FormMain.cs
@@ -50,8 +50,8 @@
                 ChannelServices.RegisterChannel(httpChannel, false);

                 RemotingConfiguration.RegisterWellKnownServiceType(
-                  typeof(Remoting.Interface.ICommand),
-                  "RemotingExample/Command.soap", WellKnownObjectMode.SingleCall);
+                    typeof(Remoting.Interface.ICommand),
+                    "RemotingExample/Command.soap", WellKnownObjectMode.SingleCall);

                 Command command = new Command();
                 RemotingServices.Marshal(command, "RemotingExample/Command.soap");


fixing tests

fixing tests

--- UnitTests/Class1.cs
+++ UnitTests/Class1.cs
@@ -1,4 +1,5 @@
 using IntranetGJAK.Controllers;
+using Microsoft.AspNet.Http;
 using Microsoft.AspNet.Mvc;
 using Microsoft.Extensions.PlatformAbstractions;
 using Serilog;
@@ -21,7 +22,14 @@
         [Fact]
         public void IndexNotLoggedInRedirects()
         {
-            var home = new HomeController();
+            var home = new HomeController()
+            {
+                ActionContext = new ActionContext
+                {
+                    HttpContext = new HttpContext() //FIX use https://github.com/nsubstitute/NSubstitute
+                }
+            };
+
             var result = home.Index();
             Assert.NotNull(result);
             Assert.IsType<RedirectToActionResult>(result);


fix for 'lg' command

fix for 'lg' command

--- Versionr/Program.cs
+++ Versionr/Program.cs
@@ -357,6 +357,10 @@

                 try
                 {
+					// because lewis broke 'lg' on purpose
+					if (args.Count() > 0 && args[0] == "lg" && invokedVerbInstance is Commands.LogVerbOptions)
+						((Commands.LogVerbOptions)invokedVerbInstance).Jrunting = true;
+
 					Commands.BaseCommand command = ((VerbOptionBase)invokedVerbInstance).GetCommand();
 					VerbOptionBase baseOptions = invokedVerbInstance as VerbOptionBase;
                     if (baseOptions != null)


rip GUI Ordner

rip GUI Ordner

--- GUI/GamePage.xaml.cs
+++ GUI/GamePage.xaml.cs
@@ -1,165 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using KINECTmania.GameLogic;
-using KINECTmania.kinectProcessing;
-using Microsoft.Kinect;
-
-
-namespace KINECTmania.GUI
-{
-
-    /// <summary>
-    /// Interaktionslogik für GamePage.xaml
-    /// </summary>
-    public partial class GamePage : Page, Menu
-    {
-        public event EventHandler<MenuStateChanged> RaiseMenuStateChanged;
-        private System.Windows.Threading.DispatcherTimer countdownTimer;
-        private int secondsBeforeGameStarts = 5;
-        private Song currentSong;
-        private bool isLive = false;
-
-        public GamePage()
-        {
-            InitializeComponent();
-            countdownTimer = new System.Windows.Threading.DispatcherTimer(); //This timer will realize a countdown before the game starts, similiar to a "ready, set go!" before the start of a race
-            countdownTimer.Tick += new EventHandler(countdownTimer_Tick);
-            countdownTimer.Interval = new TimeSpan(0, 0, 1); //Timespan(hours, minutes, seconds)
-        }
-
-        #region Event handling
-
-        public void setPublisherMenuStateChanged(Menu g)
-        {
-            if (g != null)
-            {
-                g.RaiseMenuStateChanged += HandleMenuStateChanged;
-            }
-            else
-            {
-                throw new NullReferenceException("Error: The given menu is null!");
-            }
-        }
-
-        public void setSongLoadedPublisher(SongLoadedPublisher sp)
-        {
-            if (sp != null)
-            {
-                sp.RaiseSongLoaded += HandleSongLoaded;
-                Console.WriteLine("Info: Song sucessfully handed over to GamePage!");
-            }
-            else
-            {
-                throw new NullReferenceException("Error: The given SongLoadedPublisher is null!");
-            }
-        }
-
-        void HandleMenuStateChanged(object sender, MenuStateChanged e)
-        {
-            if (e.MenuState == 3)
-            {
-                countdownTimer.Start();
-                KinectDataInput kdi = new KinectDataInput(); //Mach mal den Kinect Stream feddich
-                kdi.Start(); //starte den Kinect Stream
-            }
-        }
-
-        void HandleSongLoaded(object sender, SongLoaded s)
-        {
-            this.currentSong = s.LoadedSong;
-        }
-
-        private void countdownTimer_Tick(object sender, EventArgs e)
-        {
-            countdownTimer.Stop();
-            switch (secondsBeforeGameStarts)
-            {
-                case 5:
-                    {
-                        CountdownDisplayer5.Visibility = Visibility.Visible;
-                        Console.Write("Info: Game starts in 5... ");
-                        break;
-                    }
-                case 4:
-                    {
-                        CountdownDisplayer5.Visibility = Visibility.Hidden;
-                        CountdownDisplayer4.Visibility = Visibility.Visible;
-                        Console.Write("4... ");
-                        break;
-                    }
-                case 3:
-                    {
-                        CountdownDisplayer4.Visibility = Visibility.Hidden;
-                        CountdownDisplayer3.Visibility = Visibility.Visible;
-                        Console.Write("3... ");
-                        break;
-                    }
-                case 2:
-                    {
-                        CountdownDisplayer3.Visibility = Visibility.Hidden;
-                        CountdownDisplayer2.Visibility = Visibility.Visible;
-                        Console.Write("2... ");
-                        break;
-                    }
-                case 1:
-                    {
-                        CountdownDisplayer2.Visibility = Visibility.Hidden;
-                        CountdownDisplayer1.Visibility = Visibility.Visible;
-                        Console.WriteLine("1... ");
-                        break;
-
-                    }
-                default:
-                    {
-                        CountdownDisplayer1.Visibility = Visibility.Hidden;
-                        Console.WriteLine("Info: Game starts now!");
-                        playGame();
-                        break;
-                    }
-            }
-            secondsBeforeGameStarts -= 1;
-
-            countdownTimer.Interval = new TimeSpan(0, 0, 1);
-            if (secondsBeforeGameStarts != -1){
-                countdownTimer.Start();
-            }
-        }
-
-        public virtual void OnRaiseMenuStateChanged(MenuStateChanged e)
-        {
-            RaiseMenuStateChanged?.Invoke(this, e);
-        }
-
-        #endregion
-
-        private void playGame() //Called by an ebent handler (countdownTimer_Tick)
-        {
-            while (isLive)
-            {
-                isLive = checkIfStillLive();
-            }
-        }
-
-        private bool checkIfStillLive()
-        {
-            int eventsRecieved = 0;
-            if (currentSong.Notes.Count == eventsRecieved)
-            {
-                return true;
-            }
-            return false;
-        }
-    }
-}


Added comments on how to set up the Standard Unity shader

--- GUI/GraphicsUtils.cs
+++ GUI/GraphicsUtils.cs
@@ -115,6 +115,16 @@
         public static MaterialWrapper no_z_material = new MaterialWrapper("GUI/Text Shader");
         public static MaterialWrapper diffuse_material = new MaterialWrapper("Diffuse");
         public static MaterialWrapper standard_material = new MaterialWrapper("Standard");
+        //how to set the Standard shader up to be transparent, glossy, shaded and emitting
+        //renderer.material.SetColor("_Color", color);
+        //renderer.material.SetColor("_EmissionColor", color_emission);
+        //renderer.material.SetFloat("_GlossMapScale", 1f);
+        //renderer.material.SetFloat("_Metallic", 0f);
+        //renderer.material.SetFloat("_Mode", 3f);
+        //renderer.material.SetFloat("_ZWrite", 1f);
+        //renderer.material.EnableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A");
+        //renderer.material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
+        //renderer.material.EnableKeyword("_EMISSION");

         static Camera GLBeginWorld(out float far, MaterialWrapper mat = null)
         {


Fixed disabled "Upload"-item bug

Fixed disabled "Upload"-item bug

--- nUpdate.Administration/UI/Dialogs/ProjectDialog.cs
+++ nUpdate.Administration/UI/Dialogs/ProjectDialog.cs
@@ -992,7 +992,7 @@
                         if (packagesList.SelectedItems[0].Group == packagesList.Groups[1])
                         {
                             uploadButton.Enabled = true;
-                            uploadToolStripMenuItem.Enabled = false;
+                            uploadToolStripMenuItem.Enabled = true;
                         }
                         break;
                 }


EveXml: Added CharacterId to bookmarks call

--- EveLib.EveXml/Character.cs
+++ EveLib.EveXml/Character.cs
@@ -979,7 +979,7 @@
         /// <returns>Task<EveXmlResponse<Bookmarks>>.</returns>
         public Task<EveXmlResponse<Bookmarks>> GetBookmarksAsync() {
             const string relPath = "/char/Bookmarks.xml.aspx";
-            return requestAsync<Bookmarks>(relPath, ApiKey);
+            return requestAsync<Bookmarks>(relPath, ApiKey, "characterId", CharacterId);
         }
     }
 }


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/Ext.cs
+++ websocket-sharp/Ext.cs
@@ -234,21 +234,6 @@
              : stream.ToByteArray ();
     }

-    /// <summary>
-    /// Determines whether the specified string contains any of characters in
-    /// the specified array of <see cref="char"/>.
-    /// </summary>
-    /// <returns>
-    /// <c>true</c> if <paramref name="value"/> contains any of characters in
-    /// <paramref name="anyOf"/>; otherwise, <c>false</c>.
-    /// </returns>
-    /// <param name="value">
-    /// A <see cref="string"/> to test.
-    /// </param>
-    /// <param name="anyOf">
-    /// An array of <see cref="char"/> that contains one or more characters to
-    /// seek.
-    /// </param>
     internal static bool Contains (this string value, params char[] anyOf)
     {
       return anyOf != null && anyOf.Length > 0


Refactored a few for Ext.cs

Refactored a few for Ext.cs

--- websocket-sharp/Ext.cs
+++ websocket-sharp/Ext.cs
@@ -831,7 +831,12 @@
       result = null;

       var uri = uriString.ToUri ();
-      if (uri == null || !uri.IsAbsoluteUri) {
+      if (uri == null) {
+        message = "An invalid URI string: " + uriString;
+        return false;
+      }
+
+      if (!uri.IsAbsoluteUri) {
         message = "Not an absolute URI: " + uriString;
         return false;
       }
@@ -848,12 +853,12 @@
       }

       var port = uri.Port;
-      if (port > 65535) {
-        message = "The port part is greater than 65535: " + uriString;
+      if (port == 0) {
+        message = "The port part is zero: " + uriString;
         return false;
       }

-      result = port > 0
+      result = port != -1
                ? uri
                : new Uri (
                    String.Format (


small refactorings and tests with processing workitems asynchronously

--- src/microwf.AspNetCoreEngine/Services/JobQueueService.cs
+++ src/microwf.AspNetCoreEngine/Services/JobQueueService.cs
@@ -1,6 +1,5 @@
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
@@ -104,8 +103,9 @@
             LogHelper.SerializeObject(item)
           );

-          TriggerResult triggerResult = await ProcessItemAsync(item);
-          await this.HandleTriggerResult(triggerResult, item);
+          // Process item async, do not await it.
+          // Task.Run(() => this.ProcessItemInternal(item)).ConfigureAwait(false);
+          await this.ProcessItemInternal(item);
         }
         catch (Exception ex)
         {
@@ -189,6 +189,12 @@
       }
     }

+    private async Task ProcessItemInternal(WorkItem item)
+    {
+      TriggerResult triggerResult = await ProcessItemAsync(item);
+      await this.HandleTriggerResult(triggerResult, item);
+    }
+
     private async Task<TriggerResult> ProcessItemAsync(WorkItem item)
     {
       _logger.LogTrace("Processing work item {WorkItem}", item);


IVの生成周りをシンプルなものに修正しました。

IVの生成周りをシンプルなものに修正しました。

Qiitaにて再びご指摘があり、IV ( Initilization Vector )
は、素直にAesManagedにつくらせるよう修正しました。

--- FileEncryptSample/Form1.cs
+++ FileEncryptSample/Form1.cs
@@ -194,15 +194,15 @@
 					*/

 					aes.Key = bufferKey;
-					// Initilization Vector
-					aes.IV = salt;
+					// IV ( Initilization Vector ) は、AesManagedにつくらせる
+					aes.GenerateIV();

 					//Encryption interface.
 					ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, aes.IV);

 					using (CryptoStream cse = new CryptoStream(outfs, encryptor, CryptoStreamMode.Write))
-					{	// IV = salt
-						outfs.Write(salt, 0, 16);	//ファイル先頭に埋め込む
+					{
+						outfs.Write(aes.IV, 0, 16);	// IVをファイル先頭に埋め込む
 						using (DeflateStream ds = new DeflateStream(cse, CompressionMode.Compress))	//圧縮
 						{
 							using (FileStream fs = new FileStream(FilePath, FileMode.Open, FileAccess.Read))


Stability correction on concurrent access on client collection.

--- GnatMQ/MqttBroker.cs
+++ GnatMQ/MqttBroker.cs
@@ -155,10 +155,13 @@
             this.publisherManager.Stop();

             // close connection with all clients
+			lock (clients)
+			{
             foreach (MqttClient client in this.clients)
             {
                 client.Close();
             }
+        }
         }

         /// <summary>
@@ -167,6 +170,8 @@
         /// <param name="client">Client to close</param>
         private void CloseClient(MqttClient client)
         {
+			lock (clients)
+			{
             if (this.clients.Contains(client))
             {
                 // if client is connected and it has a will message
@@ -206,6 +211,7 @@
                 this.clients.Remove(client);
             }
         }
+		}

         void commLayer_ClientConnected(object sender, MqttClientConnectedEventArgs e)
         {
@@ -217,8 +223,11 @@
             e.Client.MqttMsgUnsubscribeReceived += Client_MqttMsgUnsubscribeReceived;
             e.Client.ConnectionClosed += Client_ConnectionClosed;

+			lock (clients)
+			{
             // add client to the collection
             this.clients.Add(e.Client);
+			}

             // start client threads
             e.Client.Open();
@@ -463,6 +472,8 @@
         /// <returns>Reference to client</returns>
         private MqttClient GetClient(string clientId)
         {
+			lock (this.clients)
+			{
             var query = from c in this.clients
                         where c.ClientId == clientId
                         select c;
@@ -471,3 +482,4 @@
         }
     }
 }
+}


added simple apdu command

added simple apdu command

--- HelloWord/Program.cs
+++ HelloWord/Program.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Text;
 using PCSC;
+using PCSC.Iso7816;

 namespace HelloWord
 {
@@ -13,100 +14,109 @@

-            //var contextFactory = ContextFactory.Instance;
+            var contextFactory = ContextFactory.Instance;

-            var cardContext = new SCardContext();
-            cardContext.Establish(SCardScope.System);
-
-
-            SCardMonitor monitor = new SCardMonitor(cardContext, SCardScope.System);
+            SCardMonitor monitor = new SCardMonitor(contextFactory, SCardScope.System);
             // Point the callback function(s) to the pre-defined method MyCardInsertedMethod.
             monitor.CardInserted += new CardInsertedEvent(CardInsertEventHandler);
             // Start to monitor the reader
             monitor.Start("ACS CCID USB Reader 0");

+            Console.ReadKey();
+        }

-            using (cardContext)
-            {
-                var readerNames = cardContext.GetReaders();
-                readerNames
-                    .ToList()
-                    .ForEach(readerName => Console.WriteLine(readerName));
-
-                readerNames
-                    .ToList()
-                    .ForEach(readerName =>
-                    {
-                        using (var reader = new SCardReader(cardContext))
-                        {
-
-
-
-                            var cardError = reader.Connect(readerName, SCardShareMode.Shared, SCardProtocol.Any);
-                            if (cardError == SCardError.Success)
-                            {
-                                string[] names;
-                                SCardProtocol proto;
-                                SCardState state;
-                                byte[] atr;
-
-                                var sc = reader.Status(
-                                            out readerNames, // contains the reader name(s)
-                                            out state, // contains the current state (flags)
-                                            out proto, // contains the currently used communication protocol
-                                            out atr); //
-
-
-                                Console.WriteLine("Connected with protocol {0} in state {1}", proto, state);
-                                Console.WriteLine("Card ATR: {0}", BitConverter.ToString(atr));
-                            }
-                            else
-                            {
-                                Console.WriteLine("Error message: {0}\n", SCardHelper.StringifyError(cardError));
-                            }
-                        }
-                    });
-                Console.ReadKey();
-            }
-
-        }

         static void CardInsertEventHandler(object sender, PCSC.CardStatusEventArgs e)
         {

-            Console.WriteLine("Reader name: {0}\nCard ART: {1}", e.ReaderName, BitConverter.ToString(e.Atr));
-            //using (var reader = new SCardReader(cardContext))
-            //{
+            var cardContext = ContextFactory.Instance.Establish(SCardScope.System);
+            var readerName = e.ReaderName;
+            var readerNames = cardContext.GetReaders();
+
+            Console.WriteLine("Reader name: {0}\nCard ART: {1}", readerName, BitConverter.ToString(e.Atr));
+
+            using (var reader = new SCardReader(cardContext))
+            {
+                var cardError = reader.Connect(readerName, SCardShareMode.Shared, SCardProtocol.Any);
+                if (cardError == SCardError.Success)
+                {
+                    string[] names;
+                    SCardProtocol proto;
+                    SCardState state;
+                    byte[] atr;
+
+                    var sc = reader.Status(
+                                out readerNames, // contains the reader name(s)
+                                out state, // contains the current state (flags)
+                                out proto, // contains the currently used communication protocol
+                                out atr); //

-
-            //    var cardError = reader.Connect(readerName, SCardShareMode.Shared, SCardProtocol.Any);
-            //    if (cardError == SCardError.Success)
-            //    {
-            //        string[] names;
-            //        SCardProtocol proto;
-            //        SCardState state;
-            //        byte[] atr;
-
-            //        var sc = reader.Status(
-            //                    out readerNames, // contains the reader name(s)
-            //                    out state, // contains the current state (flags)
-            //                    out proto, // contains the currently used communication protocol
-            //                    out atr); //
+                    Console.WriteLine("Connected with protocol {0} in state {1}", proto, state);
+                    Console.WriteLine("Card ATR: {0}", BitConverter.ToString(atr));

-            //        Console.WriteLine("Connected with protocol {0} in state {1}", proto, state);
-            //        Console.WriteLine("Card ATR: {0}", BitConverter.ToString(atr));
-            //    }
-            //    else
-            //    {
-            //        Console.WriteLine("Error message: {0}\n", SCardHelper.StringifyError(cardError));
-            //    }
-            //}
+                    var apdu = new CommandApdu(IsoCase.Case4Short, reader.ActiveProtocol)
+                    {
+                        CLA = 0x00,
+                        Instruction = InstructionCode.SelectFile,
+                        P1 = 0x04,
+                        P2 = 0x0C,
+                        Data = new byte[] {
+                                        0xA0,
+                                        0x00,
+                                        0x00,
+                                        0x02,
+                                        0x47,
+                                        0x10,
+                                        0x01
+                                    }// We don't know the ID tag size
+                    };

+                    sc = reader.BeginTransaction();

-            //Console.WriteLine("Connected with protocol {0} in state {1}", proto, state);
-            //Console.WriteLine("Card ATR: {0}", BitConverter.ToString(atr));
+                    if (sc != SCardError.Success)
+                    {
+                        Console.WriteLine("Could not begin transaction.");
+                        Console.ReadKey();
+                        return;
+                    }
+
+                    Console.WriteLine("Retrieving the UID .... ");
+
+                    var receivePci = new SCardPCI(); // IO returned protocol control information.
+                    var sendPci = SCardPCI.GetPci(reader.ActiveProtocol);
+
+                    var receiveBuffer = new byte[256];
+                    var command = apdu.ToArray();
+
+                    sc = reader.Transmit(
+                        sendPci, // Protocol Control Information (T0, T1 or Raw)
+                        command, // command APDU
+                        receivePci, // returning Protocol Control Information
+                        ref receiveBuffer); // data buffer
+
+                    if (sc != SCardError.Success)
+                    {
+                        Console.WriteLine("Error: " + SCardHelper.StringifyError(sc));
+                    }
+
+                    var responseApdu = new ResponseApdu(receiveBuffer, IsoCase.Case2Short, reader.ActiveProtocol);
+                    Console.Write("SW1: {0:X2}, SW2: {1:X2}\nUid: {2}",
+                        responseApdu.SW1,
+                        responseApdu.SW2,
+                        responseApdu.HasData ? BitConverter.ToString(responseApdu.GetData()) : "No uid received");
+
+                    reader.EndTransaction(SCardReaderDisposition.Leave);
+                    reader.Disconnect(SCardReaderDisposition.Reset);
+
+                    Console.ReadKey();
+                }
+                else
+                {
+                    Console.WriteLine("Error message: {0}\n", SCardHelper.StringifyError(cardError));
+                }
+            }
         }
     }
 }