Reorganise code for better overview.

Reorganise code for better overview.

--- ChangeDatabase.cs
+++ ChangeDatabase.cs
@@ -26,11 +26,11 @@
 using RhinoCycles.Database;
 using RhinoCycles.Shaders;
 using sdd = System.Diagnostics.Debug;
-using CQMaterial = Rhino.Render.ChangeQueue.Material;
-using CQMesh = Rhino.Render.ChangeQueue.Mesh;
+using CqMaterial = Rhino.Render.ChangeQueue.Material;
+using CqMesh = Rhino.Render.ChangeQueue.Mesh;
 using CqGroundPlane = Rhino.Render.ChangeQueue.GroundPlane;
 using CqLight = Rhino.Render.ChangeQueue.Light;
-using Skylight = Rhino.Render.ChangeQueue.Skylight;
+using CqSkylight = Rhino.Render.ChangeQueue.Skylight;
 using CQLinearWorkflow = Rhino.Render.ChangeQueue.LinearWorkflow;
 using CclLight = ccl.Light;
 using CclMesh = ccl.Mesh;
@@ -40,15 +40,39 @@
 {
 	public class ChangeDatabase : ChangeQueue
 	{
-
 		/// <summary>
 		/// Reference to the Cycles render engine C# level implementation.
 		/// </summary>
-		RenderEngine RenderEngine { get; set; }
+		private readonly RenderEngine m_render_engine;

 		private ViewInfo m_current_view_info;

-		private readonly ObjectShaderDatabase ObjectShaderDb;
+		#region DATABASES
+
+		/// <summary>
+		/// Database responsible for keeping track of objects/meshes and their shaders.
+		/// </summary>
+		private readonly ObjectShaderDatabase m_object_shader_db;
+
+		/// <summary>
+		/// Database responsible for all material shaders
+		/// </summary>
+		private readonly ShaderDatabase m_shader_db = new ShaderDatabase();
+
+		/// <summary>
+		/// Database responsible for keeping track of objects and meshes and their relations between
+		/// Rhino and Cycles.
+		/// </summary>
+		private readonly ObjectDatabase m_object_db = new ObjectDatabase();
+
+		/// <summary>
+		/// The database responsible for keeping track of light changes and the relations between Rhino
+		/// and Cycles lights and their shaders.
+		/// </summary>
+		private readonly LightDatabase m_light_db = new LightDatabase();
+
+		#endregion
+

 		/// <summary>
 		/// Constructor for our changequeue implementation
@@ -59,8 +83,8 @@
 		/// <param name="view">Reference to the RhinoView for which this queue is created.</param>
 		internal ChangeDatabase(Guid pluginId, RenderEngine engine, uint doc, RhinoView view) : base(pluginId, doc, view)
 		{
-			RenderEngine = engine;
-			ObjectShaderDb = new ObjectShaderDatabase(ObjectDb);
+			m_render_engine = engine;
+			m_object_shader_db = new ObjectShaderDatabase(m_object_db);
 		}

@@ -72,8 +96,8 @@
 		/// <param name="createPreviewEventArgs">preview event arguments</param>
 		internal ChangeDatabase(Guid pluginId, RenderEngine engine, CreatePreviewEventArgs createPreviewEventArgs) : base(pluginId, createPreviewEventArgs)
 		{
-			RenderEngine = engine;
-			ObjectShaderDb = new ObjectShaderDatabase(ObjectDb);
+			m_render_engine = engine;
+			m_object_shader_db = new ObjectShaderDatabase(m_object_db);
 		}

 		public void UploadLinearWorkflowChanges()
@@ -96,18 +120,15 @@
 		/// </summary>
 		public void UploadObjectShaderChanges()
 		{
-			foreach (var obshad in ShaderDb.ObjectShaderChanges)
-			{
-
-				var cob = ObjectDb.FindObjectRelation(obshad.Id);
-
-				//if(mesh!=null) mesh.ReplaceShader(new_shader);
-
+			foreach (var obshad in m_shader_db.ObjectShaderChanges)
+			{
+
+				var cob = m_object_db.FindObjectRelation(obshad.Id);
 				if(cob!=null)
 				{
 					// get shaders
-					var new_shader = ShaderDb.GetShaderFromHash(obshad.NewShaderHash);
-					var old_shader = ShaderDb.GetShaderFromHash(obshad.OldShaderHash);
+					var new_shader = m_shader_db.GetShaderFromHash(obshad.NewShaderHash);
+					var old_shader = m_shader_db.GetShaderFromHash(obshad.OldShaderHash);
 					if (new_shader != null)
 					{
 						if (cob.Mesh != null) cob.Mesh.ReplaceShader(new_shader);
@@ -119,7 +140,7 @@
 					}
 					cob.TagUpdate();
 				}
-				ObjectShaderDb.ReplaceShaderRelation(obshad.OldShaderHash, obshad.NewShaderHash, obshad.Id);
+				m_object_shader_db.ReplaceShaderRelation(obshad.OldShaderHash, obshad.NewShaderHash, obshad.Id);
 			}
 		}

@@ -129,20 +150,19 @@
 			{
 				Plugin.ApplyGammaToTextures(Gamma);

-
 				if (m_current_background_shader != null)
 				{
 					m_current_background_shader.Reset();
-					RenderEngine.Session.Scene.Background.Shader = m_current_background_shader.GetShader();
-				}
-
-				foreach (var tup in ShaderDb.AllShaders)
+					m_render_engine.Session.Scene.Background.Shader = m_current_background_shader.GetShader();
+				}
+
+				foreach (var tup in m_shader_db.AllShaders)
 				{
 					var matsh = tup.Item1 as CyclesShader;
 					if (matsh != null)
 					{
 						matsh.Gamma = Gamma;
-						RenderEngine.RecreateMaterialShader(matsh, tup.Item2);
+						m_render_engine.RecreateMaterialShader(matsh, tup.Item2);
 						tup.Item2.Tag();
 					}

@@ -150,14 +170,14 @@
 					if (lgsh != null)
 					{
 						lgsh.Gamma = Gamma;
-						RenderEngine.ReCreateSimpleEmissionShader(tup.Item2, lgsh);
+						m_render_engine.ReCreateSimpleEmissionShader(tup.Item2, lgsh);
 						tup.Item2.Tag();
 					}

 				}

-				RenderEngine.Session.Scene.Film.Exposure = Gamma;
-				RenderEngine.Session.Scene.Film.Update();
+				m_render_engine.Session.Scene.Film.Exposure = Gamma;
+				m_render_engine.Session.Scene.Film.Update();
 			}
 		}

@@ -166,9 +186,9 @@
 		/// </summary>
 		public void UploadDynamicObjectTransforms()
 		{
-			foreach (var cot in ObjectDb.ObjectTransforms)
-			{
-				var cob = ObjectDb.FindObjectRelation(cot.Id);
+			foreach (var cot in m_object_db.ObjectTransforms)
+			{
+				var cob = m_object_db.FindObjectRelation(cot.Id);
 				if (cob == null) continue;

 				cob.Transform = cot.Transform;
@@ -183,9 +203,9 @@
 		public void UploadMeshChanges()
 		{
 			// handle mesh deletes first
-			foreach (var mesh_delete in ObjectDb.MeshesToDelete)
-			{
-				var cobs = ObjectDb.GetCyclesObjectsForGuid(mesh_delete);
+			foreach (var mesh_delete in m_object_db.MeshesToDelete)
+			{
+				var cobs = m_object_db.GetCyclesObjectsForGuid(mesh_delete);

 				foreach (var cob in cobs)
 				{
@@ -199,38 +219,38 @@
 			}

 			var curmesh = 0;
-			var totalmeshes = ObjectDb.MeshChanges.Count;
-			foreach (var mesh_change in ObjectDb.MeshChanges)
+			var totalmeshes = m_object_db.MeshChanges.Count;
+			foreach (var mesh_change in m_object_db.MeshChanges)
 			{
 				var cycles_mesh = mesh_change.Value;
 				var mid = mesh_change.Key;

-				var me = ObjectDb.FindMeshRelation(mid);
+				var me = m_object_db.FindMeshRelation(mid);

 				// newme true if we have to upload new mesh data
 				var newme = me == null;

-				if (RenderEngine.CancelRender) return;
+				if (m_render_engine.CancelRender) return;

 				// lets find the shader for this, or use 0 if none found.
 				uint shid;
-				var matid = ObjectShaderDb.FindRenderHashForMeshId(cycles_mesh.MeshId);
+				var matid = m_object_shader_db.FindRenderHashForMeshId(cycles_mesh.MeshId);
 				try
 				{
 					// @todo check this is correct naming and dictionary to query from
-					shid = ShaderDb.GetShaderIdForMatId(matid);
+					shid = m_shader_db.GetShaderIdForMatId(matid);
 				}
 				catch (Exception)
 				{
 					shid = 0;
 				}

-				var shader = RenderEngine.Client.Scene.ShaderFromSceneId(shid);
+				var shader = m_render_engine.Client.Scene.ShaderFromSceneId(shid);

 				// creat a new mesh to upload mesh data to
 				if (newme)
 				{
-					me = new CclMesh(RenderEngine.Client, shader);
+					me = new CclMesh(m_render_engine.Client, shader);
 				}
 				else
 				{
@@ -243,7 +263,7 @@
 					cycles_mesh.verts.Length, cycles_mesh.faces.Length, shid);

 				// set progress, but without rendering percentage (hence the -1.0f)
-				RenderEngine.SetProgress(RenderEngine.RenderWindow, stat, -1.0f);
+				m_render_engine.SetProgress(m_render_engine.RenderWindow, stat, -1.0f);

 				// upload, if we get false back we were signalled to stop rendering by user
 				if (!UploadMeshData(me, cycles_mesh)) return;
@@ -253,7 +273,7 @@
 				if (!newme) me.ReplaceShader(shader);

 				// don't forget to record this new mesh
-				if(newme) ObjectDb.RecordObjectMeshRelation(cycles_mesh.MeshId, me);
+				if(newme) m_object_db.RecordObjectMeshRelation(cycles_mesh.MeshId, me);
 				//RecordShaderRelation(shader, cycles_mesh.MeshId);

 				curmesh++;
@@ -270,16 +290,16 @@
 		{
 			// set raw vertex data
 			me.SetVerts(ref cyclesMesh.verts);
-			if (RenderEngine.CancelRender) return false;
+			if (m_render_engine.CancelRender) return false;
 			// set the triangles
 			me.SetVertTris(ref cyclesMesh.faces, cyclesMesh.vertex_normals != null);
-			if (RenderEngine.CancelRender) return false;
+			if (m_render_engine.CancelRender) return false;
 			// set vertex normals
 			if (cyclesMesh.vertex_normals != null)
 			{
 				me.SetVertNormals(ref cyclesMesh.vertex_normals);
 			}
-			if (RenderEngine.CancelRender) return false;
+			if (m_render_engine.CancelRender) return false;
 			// set uvs
 			if (cyclesMesh.uvs != null)
 			{
@@ -296,21 +316,21 @@
 			ClearLinearWorkflow();
 			ClearBackground();
 			ClearViewChanges();
-			LightDb.ClearLights();
-			ShaderDb.ClearShaders();
-			ShaderDb.ClearObjectShaderChanges();
-			ObjectDb.ClearObjectsChanges();
-			ObjectDb.ClearMeshes();
-			ObjectDb.ClearDynamicObjectTransforms();
+			m_light_db.ClearLights();
+			m_shader_db.ClearShaders();
+			m_shader_db.ClearObjectShaderChanges();
+			m_object_db.ClearObjectsChanges();
+			m_object_db.ClearMeshes();
+			m_object_db.ClearDynamicObjectTransforms();
 		}

 		public bool HasChanges()
 		{
 			return
 				m_cq_view_changes.Any() ||
-				LightDb.HasChanges() ||
-				ShaderDb.HasChanges() ||
-				ObjectDb.HasChanges() ||
+				m_light_db.HasChanges() ||
+				m_shader_db.HasChanges() ||
+				m_object_db.HasChanges() ||
 				LinearWorkflowHasChanged ||
 				GammaHasChanged;
 		}
@@ -435,10 +455,10 @@
 		/// <param name="view"></param>
 		private void UploadCamera(CyclesView view)
 		{
-			var scene = RenderEngine.Session.Scene;
-			RenderEngine.RenderDimension = new Size(view.Width, view.Height);
-			var size = RenderEngine.RenderDimension;
-			RenderEngine.UnsetRenderSize();
+			var scene = m_render_engine.Session.Scene;
+			m_render_engine.RenderDimension = new Size(view.Width, view.Height);
+			var size = m_render_engine.RenderDimension;
+			m_render_engine.UnsetRenderSize();

 			var ha = size.Width > size.Height ? view.Horizontal: view.Vertical;

@@ -452,8 +472,8 @@
 			scene.Camera.Fov = angle;
 			if (view.Projection == CameraType.Orthographic || view.TwoPoint) scene.Camera.SetViewPlane(view.Viewplane.Left, view.Viewplane.Right, view.Viewplane.Top, view.Viewplane.Bottom);
 			else if(view.Projection == CameraType.Perspective) scene.Camera.ComputeAutoViewPlane();
-			scene.Camera.SensorHeight = RenderEngine.Settings.SensorHeight;
-			scene.Camera.SensorWidth = RenderEngine.Settings.SensorWidth;
+			scene.Camera.SensorHeight = m_render_engine.Settings.SensorHeight;
+			scene.Camera.SensorWidth = m_render_engine.Settings.SensorWidth;
 			scene.Camera.Update();
 		}

@@ -553,7 +573,7 @@
 		/// </summary>
 		/// <param name="deleted"></param>
 		/// <param name="added"></param>
-		protected override void ApplyMeshChanges(Guid[] deleted, List<CQMesh> added)
+		protected override void ApplyMeshChanges(Guid[] deleted, List<CqMesh> added)
 		{
 			//System.Diagnostics.Debug.WriteLine("ChangeDatabase ApplyMeshChanges, deleted {0}, added {1}", deleted.Length, added.Count);

@@ -563,7 +583,7 @@
 				if (!(from mesh in added where mesh.Id() == guid select mesh).Any())
 				{
 					//System.Diagnostics.Debug.WriteLine("Deleting {0}", guid);
-					ObjectDb.DeleteMesh(guid);
+					m_object_db.DeleteMesh(guid);
 				}
 			}

@@ -610,7 +630,7 @@

 					var meshid = new Tuple<Guid, int>(meshguid, mesh_index);

-					var crc = ObjectShaderDb.FindRenderHashForMeshId(meshid);
+					var crc = m_object_shader_db.FindRenderHashForMeshId(meshid);
 					if (crc == uint.MaxValue) crc = 0;

 					// now we have everything we need
@@ -626,7 +646,7 @@
 						matid = crc
 					};
 					mesh_index++;
-					ObjectDb.AddMesh(cycles_mesh);
+					m_object_db.AddMesh(cycles_mesh);
 				}
 			}
 		}
@@ -655,9 +675,9 @@

 			foreach (var d in deleted)
 			{
-				var cob = ObjectDb.FindObjectRelation(d);
+				var cob = m_object_db.FindObjectRelation(d);
 				var delob = new CyclesObject {cob = cob};
-				ObjectDb.AddObjectDelete(delob);
+				m_object_db.AddObjectDelete(delob);
 				//System.Diagnostics.Debug.WriteLine("Deleted MI {0}", d);
 			}
 			foreach (var a in addedOrChanged)
@@ -682,17 +702,15 @@
 					NewShaderHash = a.MaterialId
 				};

-				ShaderDb.AddObjectMaterialChange(shaderchange);
-
-				ObjectShaderDb.RecordRenderHashRelation(a.MaterialId, meshid, a.InstanceId);
-				ObjectDb.RecordObjectIdMeshIdRelation(a.InstanceId, meshid);
-				ObjectDb.AddNewOrUpdateObject(ob);
+				m_shader_db.AddObjectMaterialChange(shaderchange);
+
+				m_object_shader_db.RecordRenderHashRelation(a.MaterialId, meshid, a.InstanceId);
+				m_object_db.RecordObjectIdMeshIdRelation(a.InstanceId, meshid);
+				m_object_db.AddNewOrUpdateObject(ob);
 			}
 		}

 		#region SHADERS
-
-		private readonly ShaderDatabase ShaderDb = new ShaderDatabase();

 		/// <summary>
 		/// Handle RenderMaterial - will queue new shader if necessary
@@ -700,18 +718,37 @@
 		/// <param name="mat"></param>
 		private void HandleRenderMaterial(RenderMaterial mat)
 		{
-			if (ShaderDb.HasShader(mat.RenderHash)) return;
+			if (m_shader_db.HasShader(mat.RenderHash)) return;

 			//System.Diagnostics.Debug.WriteLine("Add new material with RenderHash {0}", mat.RenderHash);
 			var sh = Plugin.CreateCyclesShader(mat.TopLevelParent as RenderMaterial, Gamma);
-			ShaderDb.AddShader(sh);
-		}
+			m_shader_db.AddShader(sh);
+		}
+
+		private void HandleMaterialChangeOnObject(RenderMaterial mat, uint obid)
+		{
+			var oldhash = m_object_shader_db.FindRenderHashForObjectId(obid);
+			// skip if no change in renderhash
+			if (oldhash != mat.RenderHash)
+			{
+				var o = new CyclesObjectShader(obid)
+				{
+					NewShaderHash = mat.RenderHash,
+					OldShaderHash = oldhash
+				};
+
+				//System.Diagnostics.Debug.WriteLine("CQMat.Id: {0} meshinstanceid: {1}", mat.Id, obid);
+
+				m_shader_db.AddObjectMaterialChange(o);
+			}
+		}
+

 		/// <summary>
 		/// Handle changes in materials to create (or re-use) shaders.
 		/// </summary>
 		/// <param name="mats">List of <c>CQMaterial</c></param>
-		protected override void ApplyMaterialChanges(List<CQMaterial> mats)
+		protected override void ApplyMaterialChanges(List<CqMaterial> mats)
 		{
 			// list of material hashes
 			var distinct_mats = new List<uint>();
@@ -733,7 +770,7 @@
 			// list over material hashes, check if they exist. Create if new
 			foreach (var distinct in distinct_mats)
 			{
-				var existing = ShaderDb.GetShaderFromHash(distinct);
+				var existing = m_shader_db.GetShaderFromHash(distinct);
 				if (existing == null)
 				{
 					var rm = MaterialFromId(distinct);
@@ -748,17 +785,17 @@
 		public void UploadShaderChanges()
 		{
 			// map shaders. key is RenderHash
-			foreach (var shader in ShaderDb.ShaderChanges)//m_cq_shaders)
-			{
-				//if (CancelRender) return;
+			foreach (var shader in m_shader_db.ShaderChanges)//m_cq_shaders)
+			{
+				if (m_render_engine.CancelRender) return;

 				// create a cycles shader
-				var sh = RenderEngine.CreateMaterialShader(shader);
-				ShaderDb.RecordRhCclShaderRelation(shader.Id, sh);
-				ShaderDb.Add(shader, sh);
+				var sh = m_render_engine.CreateMaterialShader(shader);
+				m_shader_db.RecordRhCclShaderRelation(shader.Id, sh);
+				m_shader_db.Add(shader, sh);
 				// add the new shader to scene
-				var scshid = RenderEngine.Client.Scene.AddShader(sh);
-				ShaderDb.RecordCclShaderSceneId(shader.Id, scshid);
+				var scshid = m_render_engine.Client.Scene.AddShader(sh);
+				m_shader_db.RecordCclShaderSceneId(shader.Id, scshid);

 				sh.Tag();
 			}
@@ -766,8 +803,90 @@

 		#endregion SHADERS

-
-		private readonly ObjectDatabase ObjectDb = new ObjectDatabase();
+		#region GROUNDPLANE
+
+		/// <summary>
+		/// Record Guid of our groundplane object.
+		/// </summary>
+		private readonly Tuple<Guid, int> m_groundplane_guid = new Tuple<Guid, int>(new Guid("306690EC-6E86-4676-B55B-1A50066D7432"), 0);
+
+		private const uint GROUNDPLANE_MESHINSTANCEID = 1;
+
+		/// <summary>
+		/// Get the ground plane object ID
+		/// </summary>
+		public Tuple<Guid, int> GroundPlaneId
+		{
+			get
+			{
+				return m_groundplane_guid;
+			}
+		}
+
+		/// <summary>
+		/// Get the mesh instance id for ground plane
+		/// </summary>
+		public uint GroundPlaneMeshInstanceId
+		{
+			get
+			{
+				return GROUNDPLANE_MESHINSTANCEID;
+			}
+		}
+
+		/// <summary>
+		/// True if ground plane has been initialised
+		/// </summary>
+		public bool GroundPlaneInitialised { get; set; }
+
+		public void InitialiseGroundPlane(CqGroundPlane gp)
+		{
+			GroundPlaneInitialised = true;
+			var gpid = GroundPlaneId;
+			var altitude = (float)(gp.Enabled ? gp.Altitude : 0.0);
+			var vertices = new[]
+			{
+				 10000.0f, -10000.0f, 0.0f,
+				 10000.0f,  10000.0f, 0.0f,
+				-10000.0f,  10000.0f, 0.0f,
+				-10000.0f, -10000.0f, 0.0f
+			};
+			var findices = new[]
+			{
+				0, 1, 2,
+				0, 2, 3
+			};
+			var cmuv = new[]
+			{
+				1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
+				1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f
+			};
+
+			var cycles_mesh = new CyclesMesh
+				{
+					MeshId = gpid,
+					verts = vertices,
+					faces = findices,
+					uvs = cmuv,
+					vertex_normals = null,
+					matid = gp.MaterialId
+				};
+
+			var t = Transform.Translate(0.0f, 0.0f, altitude);
+			var cycles_object = new CyclesObject
+			{
+				matid = gp.MaterialId,
+				obid = GroundPlaneMeshInstanceId,
+				meshid = gpid,
+				Transform = t,
+				Visible = gp.Enabled
+			};
+
+			m_object_db.AddMesh(cycles_mesh);
+			m_object_shader_db.RecordRenderHashRelation(gp.MaterialId, gpid, GroundPlaneMeshInstanceId);
+			m_object_db.RecordObjectIdMeshIdRelation(GroundPlaneMeshInstanceId, gpid);
+			m_object_db.AddNewOrUpdateObject(cycles_object);
+		}
 		/// <summary>
 		/// Handle ground plane changes.
 		/// </summary>
@@ -787,7 +906,7 @@
 				Transform = t,
 				Visible = gp.Enabled
 			};
-			ObjectDb.AddNewOrUpdateObject(cycles_object);
+			m_object_db.AddNewOrUpdateObject(cycles_object);

 			var mat = MaterialFromId(gp.MaterialId);
 			HandleRenderMaterial(mat);
@@ -797,23 +916,7 @@
 			HandleMaterialChangeOnObject(mat, obid);
 		}

-		private void HandleMaterialChangeOnObject(RenderMaterial mat, uint obid)
-		{
-			var oldhash = ObjectShaderDb.FindRenderHashForObjectId(obid);
-			// skip if no change in renderhash
-			if (oldhash != mat.RenderHash)
-			{
-				var o = new CyclesObjectShader(obid)
-				{
-					NewShaderHash = mat.RenderHash,
-					OldShaderHash = oldhash
-				};
-
-				//System.Diagnostics.Debug.WriteLine("CQMat.Id: {0} meshinstanceid: {1}", mat.Id, obid);
-
-				ShaderDb.AddObjectMaterialChange(o);
-			}
-		}
+		#endregion

 		/// <summary>
 		/// Handle dynamic object transforms
@@ -825,36 +928,30 @@
 			{
 				//System.Diagnostics.Debug.WriteLine("DynObXform {0}", dot.MeshInstanceId);
 				var cot = new CyclesObjectTransform(dot.MeshInstanceId, CclXformFromRhinoXform(dot.Transform));
-				ObjectDb.AddDynamicObjectTransform(cot);
+				m_object_db.AddDynamicObjectTransform(cot);
 			}
 		}

 		#region LIGHT & SUN

 		/// <summary>
-		/// The database responsible for keeping track of light changes and the relations between Rhino
-		/// and Cycles lights and their shaders.
-		/// </summary>
-		private readonly LightDatabase LightDb = new LightDatabase();
-
-		/// <summary>
 		/// Upload all light changes to the Cycles render engine
 		/// </summary>
 		public void UploadLightChanges()
 		{

 			/* new light shaders and lights. */
-			foreach (var l in LightDb.AddLights)
-			{
-				if (RenderEngine.CancelRender) return;
-
-				var lgsh = RenderEngine.CreateSimpleEmissionShader(l);
-				RenderEngine.Client.Scene.AddShader(lgsh);
-				ShaderDb.Add(l, lgsh);
-
-				if (RenderEngine.CancelRender) return;
-
-				var light = new CclLight(RenderEngine.Client, RenderEngine.Client.Scene, lgsh)
+			foreach (var l in m_light_db.AddLights)
+			{
+				if (m_render_engine.CancelRender) return;
+
+				var lgsh = m_render_engine.CreateSimpleEmissionShader(l);
+				m_render_engine.Client.Scene.AddShader(lgsh);
+				m_shader_db.Add(l, lgsh);
+
+				if (m_render_engine.CancelRender) return;
+
+				var light = new CclLight(m_render_engine.Client, m_render_engine.Client.Scene, lgsh)
 				{
 					Type = l.Type,
 					Size = l.Size,
@@ -885,14 +982,14 @@
 				}

 				light.TagUpdate();
-				LightDb.RecordLightRelation(l.Id, light);
+				m_light_db.RecordLightRelation(l.Id, light);
 			}

 			// update existing ones
-			foreach (var l in LightDb.UpdateLights)
-			{
-				var existing_l = LightDb.ExistingLight(l.Id);
-				RenderEngine.ReCreateSimpleEmissionShader(existing_l.Shader, l);
+			foreach (var l in m_light_db.UpdateLights)
+			{
+				var existing_l = m_light_db.ExistingLight(l.Id);
+				m_render_engine.ReCreateSimpleEmissionShader(existing_l.Shader, l);
 				existing_l.Type = l.Type;
 				existing_l.Size = l.Size;
 				existing_l.Location = l.Co;
@@ -935,7 +1032,7 @@

 				//System.Diagnostics.Debug.WriteLine("light {0} == {1} == {2} ({3})", light.Id, cl.Id, lg.Id, light.ChangeType);

-				LightDb.AddLight(cl);
+				m_light_db.AddLight(cl);
 			}
 		}

@@ -945,7 +1042,7 @@
 			{
 				var cl = Plugin.ConvertLight(light, Gamma);
 				//System.Diagnostics.Debug.WriteLine("dynlight {0} @ {1}", light.Id, light.Location);
-				LightDb.AddLight(cl);
+				m_light_db.AddLight(cl);
 			}
 		}

@@ -956,8 +1053,8 @@
 		protected override void ApplySunChanges(Rhino.Geometry.Light sun)
 		{
 			var cl = Plugin.ConvertLight(sun, Gamma);
-			cl.Id = RenderEngine.SunId;
-			LightDb.AddLight(cl);
+			cl.Id = m_render_engine.SunId;
+			m_light_db.AddLight(cl);
 			//System.Diagnostics.Debug.WriteLine("Sun {0} {1} {2}", sun.Id, sun.Intensity, sun.Diffuse);
 		}

@@ -983,7 +1080,7 @@
 		public void UploadEnvironmentChanges()
 		{
 			if(BackgroundHasChanged)
-				RenderEngine.RecreateBackgroundShader();
+				m_render_engine.RecreateBackgroundShader();
 		}

 		/// <summary>
@@ -992,7 +1089,7 @@
 		public void UploadObjectChanges()
 		{
 			// first delete objects
-			foreach (var ob in ObjectDb.DeletedObjects)
+			foreach (var ob in m_object_db.DeletedObjects)
 			{
 				if (ob.cob != null)
 				{
@@ -1006,26 +1103,26 @@
 			}

 			// now combine objects and meshes, creating new objects when necessary
-			foreach (var ob in ObjectDb.NewOrUpdatedObjects)
+			foreach (var ob in m_object_db.NewOrUpdatedObjects)
 			{
 				// mesh for this object id
-				var mesh = ObjectDb.FindMeshRelation(ob.meshid);
+				var mesh = m_object_db.FindMeshRelation(ob.meshid);

 				// hmm, no mesh. Oh well, lets get on with the next
 				if (mesh == null) continue;

 				// see if we already have an object here.
 				// update it, otherwise create new one
-				var cob = ObjectDb.FindObjectRelation(ob.obid);
+				var cob = m_object_db.FindObjectRelation(ob.obid);

 				var newcob = cob == null;

 				// new object, so lets create it and record necessary stuff about it
 				if (newcob)
 				{
-					cob = new CclObject(RenderEngine.Client);
-					ObjectDb.RecordObjectRelation(ob.obid, cob);
-					ObjectDb.RecordObjectIdMeshIdRelation(ob.obid, ob.meshid);
+					cob = new CclObject(m_render_engine.Client);
+					m_object_db.RecordObjectRelation(ob.obid, cob);
+					m_object_db.RecordObjectIdMeshIdRelation(ob.obid, ob.meshid);
 				}

 				// set mesh reference and other stuff
@@ -1040,7 +1137,7 @@
 		/// Handle skylight changes
 		/// </summary>
 		/// <param name="skylight">New skylight information</param>
-		protected override void ApplySkylightChanges(Skylight skylight)
+		protected override void ApplySkylightChanges(CqSkylight skylight)
 		{
 			//System.Diagnostics.Debug.WriteLine("{0}", skylight);
 			m_cq_background.skylight_enabled =  skylight.Enabled;
@@ -1103,7 +1200,7 @@
 		/// </summary>
 		protected override void NotifyEndUpdates()
 		{
-			RenderEngine.Flush = true;
+			m_render_engine.Flush = true;
 		}

 		protected override void NotifyDynamicUpdatesAreAvailable()
@@ -1112,92 +1209,17 @@
 			//System.Diagnostics.Debug.WriteLine("dyn changes...");
 		}

+		/// <summary>
+		/// Tell ChangeQueue we want baking for
+		/// - Decals
+		/// - ProceduralTextures
+		/// - MultipleMappingChannels
+		/// </summary>
+		/// <returns></returns>
 		protected override BakingFunctions BakeFor()
 		{
 			return BakingFunctions.Decals | BakingFunctions.ProceduralTextures | BakingFunctions.MultipleMappingChannels;
 		}

-		/// <summary>
-		/// Record Guid of our groundplane object.
-		/// </summary>
-		private readonly Tuple<Guid, int> m_groundplane_guid = new Tuple<Guid, int>(new Guid("306690EC-6E86-4676-B55B-1A50066D7432"), 0);
-
-		private const uint GROUNDPLANE_MESHINSTANCEID = 1;
-
-		/// <summary>
-		/// Get the ground plane object ID
-		/// </summary>
-		public Tuple<Guid, int> GroundPlaneId
-		{
-			get
-			{
-				return m_groundplane_guid;
-			}
-		}
-
-		/// <summary>
-		/// Get the mesh instance id for ground plane
-		/// </summary>
-		public uint GroundPlaneMeshInstanceId
-		{
-			get
-			{
-				return GROUNDPLANE_MESHINSTANCEID;
-			}
-		}
-
-		/// <summary>
-		/// True if ground plane has been initialised
-		/// </summary>
-		public bool GroundPlaneInitialised { get; set; }
-
-		public void InitialiseGroundPlane(CqGroundPlane gp)
-		{
-			GroundPlaneInitialised = true;
-			var gpid = GroundPlaneId;
-			var altitude = (float)(gp.Enabled ? gp.Altitude : 0.0);
-			var vertices = new[]
-			{
-				 10000.0f, -10000.0f, 0.0f,
-				 10000.0f,  10000.0f, 0.0f,
-				-10000.0f,  10000.0f, 0.0f,
-				-10000.0f, -10000.0f, 0.0f
-			};
-			var findices = new[]
-			{
-				0, 1, 2,
-				0, 2, 3
-			};
-			var cmuv = new[]
-			{
-				1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
-				1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f
-			};
-
-			var cycles_mesh = new CyclesMesh
-				{
-					MeshId = gpid,
-					verts = vertices,
-					faces = findices,
-					uvs = cmuv,
-					vertex_normals = null,
-					matid = gp.MaterialId
-				};
-
-			var t = Transform.Translate(0.0f, 0.0f, altitude);
-			var cycles_object = new CyclesObject
-			{
-				matid = gp.MaterialId,
-				obid = GroundPlaneMeshInstanceId,
-				meshid = gpid,
-				Transform = t,
-				Visible = gp.Enabled
-			};
-
-			ObjectDb.AddMesh(cycles_mesh);
-			ObjectShaderDb.RecordRenderHashRelation(gp.MaterialId, gpid, GroundPlaneMeshInstanceId);
-			ObjectDb.RecordObjectIdMeshIdRelation(GroundPlaneMeshInstanceId, gpid);
-			ObjectDb.AddNewOrUpdateObject(cycles_object);
-		}
 	}
 }


add MediaType#Text partial wildcard static property

--- Core/MediaType.cs
+++ Core/MediaType.cs
@@ -669,6 +669,13 @@
         }

         /// <summary>
+        /// A wildcard media type for all text media types.
+        /// </summary>
+        public static MediaType Text
+        {
+            get { return "text/*"; }
+        }
+        /// <summary>
         /// The media type for plain text content.
         /// </summary>
         public static MediaType PlainText


add logoutrequesttest

add logoutrequesttest

--- test/SamlOida.Test/MessageHandler/MessageFactory/LogoutRequestFactoryTests.cs
+++ test/SamlOida.Test/MessageHandler/MessageFactory/LogoutRequestFactoryTests.cs
@@ -17,7 +17,6 @@
             _logoutRequestFactory = new LogoutRequestFactory();
         }

-        /* TODO
         [Fact]
         public void ShouldCreateMessage()
         {
@@ -29,23 +28,25 @@

             var xmlDocument = _logoutRequestFactory.CreateMessage(options, authnRequestMessage);

-            // TODO
-            // COPY PASTE FROM AuthnRequestFactory
             XmlNamespaceManager mgr = new XmlNamespaceManager(xmlDocument.NameTable);
-            mgr.AddNamespjace("samlp", "urn:oasis:names:tc:SAML:2.0:protocol");
+            mgr.AddNamespace("samlp", "urn:oasis:names:tc:SAML:2.0:protocol");
             mgr.AddNamespace("saml", "urn:oasis:names:tc:SAML:2.0:assertion");

-            var authnRequestNode = xmlDocument.SelectSingleNode("/samlp:AuthnRequest", mgr);
-            var issuerNode = xmlDocument.SelectSingleNode("/samlp:AuthnRequest/saml:Issuer", mgr);
+            var logoutResponseNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest", mgr);
+            var issuerNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest/saml:Issuer", mgr);
+            var nameIDNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest/saml:NameID", mgr);
+            var sessionIndexNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest/samlp:SessionIndex", mgr);

-            Assert.NotNull(authnRequestNode);
+            Assert.NotNull(logoutResponseNode);
             Assert.NotNull(issuerNode);
+            Assert.NotNull(nameIDNode);
+            Assert.NotNull(sessionIndexNode);

-            Assert.Equal("test", authnRequestNode.Attributes["AssertionConsumerServiceURL"].Value);
-            Assert.Equal("", authnRequestNode.Attributes["Destination"].Value);
-            Assert.Equal("2.0", authnRequestNode.Attributes["Version"].Value);
-
-    }
-    */
+            Assert.Equal("", logoutResponseNode.Attributes["Destination"].Value);
+            Assert.Equal("2.0", logoutResponseNode.Attributes["Version"].Value);
+
+            Assert.Equal("test", nameIDNode.InnerText);
+
+        }
     }
 }


refactor tests to reflect various behaviors being tested separately

--- test/Spring/Spring.Core.Tests/Collections/Generic/LinkedHashDictionaryTest.cs
+++ test/Spring/Spring.Core.Tests/Collections/Generic/LinkedHashDictionaryTest.cs
@@ -24,46 +24,80 @@

 namespace Spring.Collections.Generic
 {
-	/// <summary>
-	/// This class contains tests for LinkedHashDictionary
-	/// </summary>
-	/// <author>Zbynek Vyskovsky, kvr@centrum.cz</author>
-	[TestFixture]
-	public class LinkedHashDictionaryTest
-	{
-		[Test]
-		public void			TestSunnyDay()
-		{
-			IDictionary<int, string> td = new LinkedHashDictionary<int, string>();
-			td.Add(0, "a");
-			td.Add(1, "b");
-			td.Add(2, "c");
-			td.Add(1, "b2");
-			td.Add(3, "d");
-			td.Add(4, "e");
-			Assert.IsTrue(td.ContainsKey(0));
-			Assert.IsTrue(td.ContainsKey(1));
-			Assert.IsTrue(td.ContainsKey(2));
-			Assert.IsTrue(td.ContainsKey(3));
-			Assert.IsTrue(td.ContainsKey(4));
-			Assert.AreEqual("a", td[0]);
-			Assert.AreEqual("b2", td[1]);
-			int[] keys = td.Keys.ToArray();
-			Assert.AreEqual(5, keys.Length);
-			Assert.AreEqual(0, keys[0]);
-			Assert.AreEqual(1, keys[1]);
-			Assert.AreEqual(2, keys[2]);
-			Assert.AreEqual(3, keys[3]);
-			Assert.AreEqual(4, keys[4]);
-			td.Remove(3);
-			td.Remove(2);
-			Assert.AreEqual(3, td.Count);
-			td.Remove(1);
-			Assert.AreEqual(2, td.Count);
-			td.Remove(4);
-			td.Remove(0);
-			Assert.AreEqual(0, td.Count);
-			Assert.AreEqual(0, td.Keys.Count);
-		}
-	}
+    /// <summary>
+    /// This class contains tests for LinkedHashDictionary
+    /// </summary>
+    /// <author>Zbynek Vyskovsky, kvr@centrum.cz</author>
+    [TestFixture]
+    public class LinkedHashDictionaryTest
+    {
+        private IDictionary<int, string> _testDictionary;
+
+        [SetUp]
+        public void Setup()
+        {
+            _testDictionary = new LinkedHashDictionary<int, string>();
+            _testDictionary.Add(0, "a");
+            _testDictionary.Add(1, "b");
+            _testDictionary.Add(2, "c");
+            _testDictionary.Add(3, "d");
+            _testDictionary.Add(4, "e");
+        }
+
+        [Test]
+        public void CanAddEntries()
+        {
+            Assert.IsTrue(_testDictionary.ContainsKey(0));
+            Assert.IsTrue(_testDictionary.ContainsKey(1));
+            Assert.IsTrue(_testDictionary.ContainsKey(2));
+            Assert.IsTrue(_testDictionary.ContainsKey(3));
+            Assert.IsTrue(_testDictionary.ContainsKey(4));
+        }
+
+        [Test]
+        public void AddAtExistingIndexOverwritesEntry()
+        {
+            _testDictionary.Add(1, "b2");
+            Assert.AreEqual("b2", _testDictionary[1]);
+        }
+
+        [Test]
+        public void CanAccessValuesByIndex()
+        {
+            Assert.AreEqual("a", _testDictionary[0]);
+            Assert.AreEqual("b", _testDictionary[1]);
+        }
+
+        /// <summary>
+        /// Determines whether this instance [can retreive keys].
+        /// </summary>
+        [Test]
+        public void CanRetreiveKeys()
+        {
+            int[] keys = _testDictionary.Keys.ToArray();
+            Assert.AreEqual(5, keys.Length);
+            Assert.AreEqual(0, keys[0]);
+            Assert.AreEqual(1, keys[1]);
+            Assert.AreEqual(2, keys[2]);
+            Assert.AreEqual(3, keys[3]);
+            Assert.AreEqual(4, keys[4]);
+        }
+
+        [Test]
+        public void CanRemoveEntriesByIndex()
+        {
+            _testDictionary.Remove(3);
+            _testDictionary.Remove(2);
+            Assert.AreEqual(3, _testDictionary.Count);
+
+            _testDictionary.Remove(1);
+            Assert.AreEqual(2, _testDictionary.Count);
+
+            _testDictionary.Remove(4);
+            _testDictionary.Remove(0);
+            Assert.AreEqual(0, _testDictionary.Count);
+            Assert.AreEqual(0, _testDictionary.Keys.Count);
+        }
+
+    }
 }


Adding "AND" clause identical to WHERE. #52

--- DataCore/Query.cs
+++ DataCore/Query.cs
@@ -137,6 +137,16 @@
             return this;
         }

+        public Query<T> And(Expression<Func<T, bool>> clause)
+        {
+            return Where(clause);
+        }
+
+        public Query<T> And(string clause)
+        {
+            return Where(clause);
+        }
+
         public Query<T> Or(Expression<Func<T, bool>> clause)
         {
             var newExpression = Expression.Lambda(new QueryVisitor().Visit(clause));
@@ -144,6 +154,13 @@
             var query = ExpressionHelper.GetQueryFromExpression(_translator, newExpression.Body, Parameters);

             SqlWhere = string.IsNullOrEmpty(SqlWhere) ? query : string.Concat("(", SqlWhere, ") OR (", query, ")");
+
+            return this;
+        }
+
+        public Query<T> Or(string clause)
+        {
+            SqlWhere = string.IsNullOrEmpty(SqlWhere) ? clause : string.Concat("(", SqlWhere, ") OR (", clause, ")");

             return this;
         }


1439: EditableTextLine

1439: EditableTextLine

--- src/PixelFarm/PaintLab.RenderTree.TextSurface/1.2_Lines/0_EditableTextLine.cs
+++ src/PixelFarm/PaintLab.RenderTree.TextSurface/1.2_Lines/0_EditableTextLine.cs
@@ -43,29 +43,21 @@
             dbugLineTotalCount++;
 #endif
         }
-        public int RunCount
-        {
-            get { return _runs.Count; }
-        }
+        //
+        public int RunCount => _runs.Count;
+        //
         /// <summary>
         /// first run node
         /// </summary>
-        public LinkedListNode<EditableRun> First
-        {
-            get { return _runs.First; }
-        }
+        public LinkedListNode<EditableRun> First => _runs.First;
+        //
         /// <summary>
         /// last run node
         /// </summary>
-        public LinkedListNode<EditableRun> Last
-        {
-            get { return _runs.Last; }
-        }
-
-        RootGraphic Root
-        {
-            get { return this.OwnerElement.Root; }
-        }
+        public LinkedListNode<EditableRun> Last => _runs.Last;
+        //
+        RootGraphic Root => this.OwnerElement.Root;
+        //
         public IEnumerable<EditableRun> GetTextRunIter()
         {
             foreach (EditableRun r in _runs)
@@ -168,13 +160,9 @@
                 }
             }
         }
-        public EditableTextFlowLayer OwnerFlowLayer
-        {
-            get
-            {
-                return this.EditableFlowLayer;
-            }
-        }
+        //
+        public EditableTextFlowLayer OwnerFlowLayer => this.EditableFlowLayer;
+        //
         public bool EndWithLineBreak
         {
             get
@@ -198,41 +186,18 @@
         {
             return y >= _lineTop && y < (_lineTop + _actualLineHeight);
         }
-        public int LineTop
-        {
-            get
-            {
-                return _lineTop;
-            }
-        }
-        public int ActualLineHeight
-        {
-            get
-            {
-                return _actualLineHeight;
-            }
-        }
-        public int ActualLineWidth
-        {
-            get
-            {
-                return _actualLineWidth;
-            }
-        }
-        public Rectangle ActualLineArea
-        {
-            get
-            {
-                return new Rectangle(0, _lineTop, _actualLineWidth, _actualLineHeight);
-            }
-        }
-        public Rectangle ParentLineArea
-        {
-            get
-            {
-                return new Rectangle(0, _lineTop, this.EditableFlowLayer.OwnerRenderElement.Width, _actualLineHeight);
-            }
-        }
+        //
+        public int Top => _lineTop;
+        public int LineTop => _lineTop;
+        //
+        public int ActualLineWidth => _actualLineWidth;
+        //
+        public int ActualLineHeight => _actualLineHeight;
+        //
+        public Rectangle ActualLineArea => new Rectangle(0, _lineTop, _actualLineWidth, _actualLineHeight);
+        //
+        public Rectangle ParentLineArea => new Rectangle(0, _lineTop, this.EditableFlowLayer.OwnerRenderElement.Width, _actualLineHeight);
+        //
         internal IEnumerable<EditableRun> GetVisualElementForward(EditableRun startVisualElement)
         {
             if (startVisualElement != null)
@@ -275,14 +240,11 @@
                 return charCount;
             }
         }
-        public int LineBottom
-        {
-            get
-            {
-                return _lineTop + _actualLineHeight;
-            }
-        }
-
+        //
+
+        //
+        public int LineBottom => _lineTop + _actualLineHeight;
+        //
         internal int LineWidth
         {
             get
@@ -299,17 +261,9 @@
             }
         }

-        public int Top
-        {
-            get
-            {
-                return _lineTop;
-            }
-        }
-
         public void SetTop(int linetop)
         {
-            this._lineTop = linetop;
+            _lineTop = linetop;
         }
 #if DEBUG
         public override string ToString()
@@ -325,45 +279,22 @@
             }
         }
 #endif
-        public int LineNumber
-        {
-            get
-            {
-                return _currentLineNumber;
-            }
-        }
+        //
+        public int LineNumber => _currentLineNumber;
+        //
         internal void SetLineNumber(int value)
         {
             this._currentLineNumber = value;
         }
-        bool IsFirstLine
-        {
-            get
-            {
-                return _currentLineNumber == 0;
-            }
-        }
-        bool IsLastLine
-        {
-            get
-            {
-                return _currentLineNumber == EditableFlowLayer.LineCount - 1;
-            }
-        }
-        bool IsSingleLine
-        {
-            get
-            {
-                return IsFirstLine && IsLastLine;
-            }
-        }
-        public bool IsBlankLine
-        {
-            get
-            {
-                return RunCount == 0;
-            }
-        }
+        //
+        bool IsFirstLine => _currentLineNumber == 0;
+        //
+        bool IsLastLine => _currentLineNumber == EditableFlowLayer.LineCount - 1;
+        //
+        bool IsSingleLine => IsFirstLine && IsLastLine;
+        //
+        public bool IsBlankLine => RunCount == 0;
+        //
         public EditableTextLine Next
         {
             get
@@ -407,13 +338,9 @@
                 }
             }
         }
-        public bool NeedArrange
-        {
-            get
-            {
-                return (_lineFlags & LINE_CONTENT_ARRANGED) == 0;
-            }
-        }
+        //
+        public bool NeedArrange => (_lineFlags & LINE_CONTENT_ARRANGED) == 0;
+
         internal void ValidateContentArrangement()
         {
             _lineFlags |= LINE_CONTENT_ARRANGED;
@@ -432,13 +359,8 @@
                 curNode = curNode.Next;
             }
         }
-        internal bool IsLocalSuspendLineRearrange
-        {
-            get
-            {
-                return (this._lineFlags & LOCAL_SUSPEND_LINE_REARRANGE) != 0;
-            }
-        }
+
+        internal bool IsLocalSuspendLineRearrange => (_lineFlags & LOCAL_SUSPEND_LINE_REARRANGE) != 0;

         internal void InvalidateLineLayout()
         {


Fix WorkingSet{64} on Linux to be bytes, not pages

--- src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
+++ src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
@@ -117,7 +117,7 @@
                 ProcessName = procFsStat.comm,
                 BasePriority = (int)procFsStat.nice,
                 VirtualBytes = (long)procFsStat.vsize,
-                WorkingSet = procFsStat.rss,
+                WorkingSet = procFsStat.rss * Environment.SystemPageSize,
                 SessionId = procFsStat.session,

                 // We don't currently fill in the other values.


Update code actions baseline for CSharpCodeActions integration test

--- src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
+++ src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpCodeActions.cs
@@ -491,6 +491,13 @@
                 "Generate nested class 'Stream'",
                 "Generate new type...",
                 "Remove unused variable",
+                "Configure or Suppress issues",
+                "Configure CS0168 severity",
+                "None",
+                "Silent",
+                "Suggestion",
+                "Warning",
+                "Error",
                 "Suppress CS0168",
                 "in Source"
             };
@@ -531,6 +538,13 @@
                 "Generate nested class 'Foober'",
                 "Generate new type...",
                 "Goober - using N;",
+                "Configure or Suppress issues",
+                "Configure CS0168 severity",
+                "None",
+                "Silent",
+                "Suggestion",
+                "Warning",
+                "Error",
                 "Suppress CS0168",
                 "in Source",
             };
@@ -566,6 +580,13 @@
                 "Introduce local constant for all occurrences of '2'",
                 "Extract Method",
                 generateImplicitTitle,
+                "Configure or Suppress issues",
+                "Configure CS0612 severity",
+                "None",
+                "Silent",
+                "Suggestion",
+                "Warning",
+                "Error",
                 "Suppress CS0612",
                 "in Source",
             };


Improved error message in CollectionBinding

--- UnityUI/Binding/CollectionBinding.cs
+++ UnityUI/Binding/CollectionBinding.cs
@@ -141,10 +141,11 @@
         private void BindCollection()
         {
             // Bind view model.
-            var viewModelCollectionProperty = viewModel.GetType().GetProperty(viewModelPropertyName);
+            var viewModelType = viewModel.GetType();
+            var viewModelCollectionProperty = viewModelType.GetProperty(viewModelPropertyName);
             if (viewModelCollectionProperty == null)
             {
-                throw new ApplicationException("Expected property " + viewModelPropertyName + ", not it wasn't found on type.");
+                throw new ApplicationException("Expected property " + viewModelPropertyName + ", but it wasn't found on type " + viewModelType.Name + ".");
             }

             // Get value from view model.


Avoid throwing exception in static constructor

VisualStudioInstanceFactory failures now occur in a context where they
are reported as test failures instead of test runner crashes.

--- src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs
+++ src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs
@@ -35,20 +35,16 @@
         /// </summary>
         private static bool _firstLaunch = true;

-        static VisualStudioInstanceFactory()
-        {
-            var majorVsProductVersion = VsProductVersion.Split('.')[0];
-
-            if (int.Parse(majorVsProductVersion) < 15)
-            {
-                throw new PlatformNotSupportedException("The Visual Studio Integration Test Framework is only supported on Visual Studio 15.0 and later.");
-            }
-        }
-
         public VisualStudioInstanceFactory()
         {
             AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolveHandler;
             AppDomain.CurrentDomain.FirstChanceException += FirstChanceExceptionHandler;
+
+            var majorVsProductVersion = VsProductVersion.Split('.')[0];
+            if (int.Parse(majorVsProductVersion) < 15)
+            {
+                throw new PlatformNotSupportedException("The Visual Studio Integration Test Framework is only supported on Visual Studio 15.0 and later.");
+            }
         }

         private static void FirstChanceExceptionHandler(object sender, FirstChanceExceptionEventArgs eventArgs)


Stay on the STA thread when launching instances of Visual Studio

This change ensures tests stay on the main thread, which has the COM message
filter installed that deals with certain IPC delays. DTE operations from
other threads are not able to gracefully recover from certain failure
conditions.

--- src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs
+++ src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs
@@ -109,7 +109,7 @@
             try
             {
                 bool shouldStartNewInstance = ShouldStartNewInstance(requiredPackageIds);
-                await UpdateCurrentlyRunningInstanceAsync(requiredPackageIds, shouldStartNewInstance).ConfigureAwait(false);
+                await UpdateCurrentlyRunningInstanceAsync(requiredPackageIds, shouldStartNewInstance).ConfigureAwait(true);

                 return new VisualStudioInstanceContext(_currentlyRunningInstance, this);
             }
@@ -170,7 +170,7 @@
                 }

                 // We wait until the DTE instance is up before we're good
-                dte = await IntegrationHelper.WaitForNotNullAsync(() => IntegrationHelper.TryLocateDteForProcess(hostProcess)).ConfigureAwait(false);
+                dte = await IntegrationHelper.WaitForNotNullAsync(() => IntegrationHelper.TryLocateDteForProcess(hostProcess)).ConfigureAwait(true);
             }
             else
             {
@@ -184,7 +184,7 @@
                 Debug.Assert(_currentlyRunningInstance != null);

                 hostProcess = _currentlyRunningInstance.HostProcess;
-                dte = await IntegrationHelper.WaitForNotNullAsync(() => IntegrationHelper.TryLocateDteForProcess(hostProcess)).ConfigureAwait(false);
+                dte = await IntegrationHelper.WaitForNotNullAsync(() => IntegrationHelper.TryLocateDteForProcess(hostProcess)).ConfigureAwait(true);
                 supportedPackageIds = _currentlyRunningInstance.SupportedPackageIds;
                 installationPath = _currentlyRunningInstance.InstallationPath;


Simplify

Simplify

--- src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs
+++ src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs
@@ -70,67 +70,92 @@
             var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();

             var root = await semanticModel.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
-            var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
-
-            // If the identifier was escaped in the file, we'll have to do a more involved search
-            var lookForEscapedIdentifiers = info.ProbablyContainsEscapedIdentifier(identifier);
+
+            // If the identifier was escaped in the file then we'll have to do a more involved search that actually
+            // walks the root and checks all identifier tokens.
+            //
+            // otherwise, we can use the text of the document to quickly find candidates and test those directly.
+            var sourceText = !info.ProbablyContainsEscapedIdentifier(identifier)
+                ? await document.GetTextAsync(cancellationToken).ConfigureAwait(false)
+                : null;

             var normalizedIdentifier = syntaxFacts.IsCaseSensitive ? identifier : identifier.ToLowerInvariant();
             var entry = GetEntry(semanticModel);

             return entry.IdentifierCache.GetOrAdd(normalizedIdentifier,
-                key => GetIdentifierTokensWithText(syntaxFacts, root, text, key, lookForEscapedIdentifiers, cancellationToken));
-        }
-
+                key => GetIdentifierTokensWithText(syntaxFacts, root, sourceText, key, cancellationToken));
+        }
+
+        /// <param name="sourceText">Text for the document being examined.  If not null, we are searching for an
+        /// unescaped identifier, and we can just scan the text directly looking for hits.  If null, we're searching for
+        /// escaped identifiers and we have to walk the root directly looking at every token</param>
         [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", AllowCaptures = false)]
         private static ImmutableArray<SyntaxToken> GetIdentifierTokensWithText(
             ISyntaxFactsService syntaxFacts,
             SyntaxNode root,
-            SourceText sourceText,
+            SourceText? sourceText,
             string identifier,
-            bool lookForEscapedIdentifiers,
             CancellationToken cancellationToken)
         {
-            if (lookForEscapedIdentifiers)
+            using var _ = ArrayBuilder<SyntaxToken>.GetInstance(out var result);
+
+            if (sourceText == null)
             {
                 // identifier is escaped.  Have to actually walk the entire tree to find matching tokens.
-
-                using var _ = ArrayBuilder<SyntaxToken>.GetInstance(out var result);
-                foreach (var token in root.DescendantTokens(descendIntoTrivia: true))
-                {
-                    if (IsMatch(token))
-                        result.Add(token);
-                }
-
-                return result.ToImmutable();
+                Recurse(root);
             }
             else
             {
                 // identifier is not escaped.  we can scan through the raw text of the file looking for matches.
-
-                using var _ = ArrayBuilder<SyntaxToken>.GetInstance(out var result);

                 var index = 0;
                 while ((index = sourceText.IndexOf(identifier, index, syntaxFacts.IsCaseSensitive)) >= 0)
                 {
                     cancellationToken.ThrowIfCancellationRequested();

-                    var nextIndex = index + identifier.Length;
-
                     var token = root.FindToken(index, findInsideTrivia: true);
                     var span = token.Span;
                     if (span.Start == index && span.Length == identifier.Length && IsMatch(token))
                         result.Add(token);

+                    var nextIndex = index + identifier.Length;
                     nextIndex = Math.Max(nextIndex, token.SpanStart);
                     index = nextIndex;
                 }
-
-                return result.ToImmutable();
-            }
+            }
+
+            return result.ToImmutable();

             bool IsMatch(SyntaxToken token)
                 => !token.IsMissing && syntaxFacts.IsIdentifier(token) && syntaxFacts.TextMatch(token.ValueText, identifier);
+
+            void Recurse(SyntaxNode node)
+            {
+                cancellationToken.ThrowIfCancellationRequested();
+                foreach (var child in node.ChildNodesAndTokens())
+                {
+                    if (child.IsNode)
+                    {
+                        Recurse(child.AsNode()!);
+                    }
+                    else if (child.IsToken)
+                    {
+                        var token = child.AsToken();
+                        if (IsMatch(token))
+                            result.Add(token);
+
+                        if (token.HasStructuredTrivia)
+                        {
+                            // structured trivia can only be leading trivia
+                            foreach (var trivia in token.LeadingTrivia)
+                            {
+                                if (trivia.HasStructure)
+                                    Recurse(trivia.GetStructure());
+                            }
+                        }
+                    }
+                }
+            }
         }

         public static IEnumerable<SyntaxToken> GetConstructorInitializerTokens(


Fix bug with clearing ids

Fix bug with clearing ids

--- CardsAndSymbols/ImageCache.cs
+++ CardsAndSymbols/ImageCache.cs
@@ -64,6 +64,7 @@
             if (flags.HasFlag(ImageCacheFlags.ClearIds))
             {
                 this.idToFileName.Clear();
+                this.nextId = 0;
             }

             if (flags.HasFlag(ImageCacheFlags.ClearFiles))


Fix tests

Fix tests

--- Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/System.FileSystem/DiskManagerTest.cs
+++ Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/System.FileSystem/DiskManagerTest.cs
@@ -56,16 +56,16 @@
             Assert.IsTrue(xDi.TotalSize == xDi.TotalFreeSpace, "DiskManager.Format (quick) failed TotalFreeSpace is not the same of TotalSize");

             /* Let's try to create a new file on the Root Directory */
-            File.Create(@"0:\newFile.txt");
+            File.Create(@"1:\newFile.txt");

-            Assert.IsTrue(File.Exists(@"0:\newFile.txt") == true, "Failed to create new file after disk format");
+            Assert.IsTrue(File.Exists(@"1:\newFile.txt") == true, "Failed to create new file after disk format");

             mDebugger.Send("END TEST");

             mDebugger.Send("Testing if you can create directories");

-            Directory.CreateDirectory(@"0:\SYS\");
-            Assert.IsTrue(Directory.GetDirectories(@"0:\SYS\").Length == 0, "Can create a directory and its content is emtpy");
+            Directory.CreateDirectory(@"1:\SYS\");
+            Assert.IsTrue(Directory.GetDirectories(@"1:\SYS\").Length == 0, "Can create a directory and its content is emtpy");

             mDebugger.Send("END TEST");


added missing scale update for scale handles when handle size changes

--- Assets/MRTK/SDK/Experimental/Features/UX/BoundsControl/Visuals/ScaleHandles.cs
+++ Assets/MRTK/SDK/Experimental/Features/UX/BoundsControl/Visuals/ScaleHandles.cs
@@ -147,6 +147,7 @@
         protected override void UpdateColliderBounds(Transform handle, Vector3 visualSize)
         {
             var invScale = config.HandleSize / visualSize.x;
+            GetVisual(handle).transform.localScale = new Vector3(invScale, invScale, invScale);
             BoxCollider collider = handle.gameObject.GetComponent<BoxCollider>();
             Vector3 colliderSize = visualSize * invScale;
             collider.size = colliderSize;


Updated hashes for MacOS 11 / ARM

Updated hashes for MacOS 11 / ARM


Implement SettingsPanelViewModel

Implement SettingsPanelViewModel

--- ViewModels/SettingsPanelViewModel.cs
+++ ViewModels/SettingsPanelViewModel.cs
@@ -1,8 +1,27 @@
 using System;
+using System.ComponentModel;

 namespace clipman.ViewModels
 {
-    class SettingsPanelViewModel
+    class SettingsPanelViewModel : INotifyPropertyChanged
     {
+        private Settings.Settings settings;
+        public Settings.Settings Settings
+        {
+            get { return settings; }
+            private set { settings = value; RaisePropertyChanged("Settings"); }
+        }
+
+        public SettingsPanelViewModel(Settings.Settings settings)
+        {
+            this.Settings = settings;
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public void RaisePropertyChanged(string property)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
+        }
     }
 }


[FastCGI] Clean up Responder, use modern features

--- src/Mono.WebServer.FastCgi/Responder.cs
+++ src/Mono.WebServer.FastCgi/Responder.cs
@@ -30,13 +30,12 @@
 using System;
 using System.Collections.Generic;
 using Mono.FastCgi;
-using System.Text;

 namespace Mono.WebServer.FastCgi
 {
 	public class Responder : MarshalByRefObject, IResponder
 	{
-		private static string error500 =
+		const string error500 =
 			"Status: 500 Internal Server Error\r\n" +
 			"Content-Type: text/html; charset=utf-8\r\n" +
 			"Connection: close\r\n\r\n" +
@@ -56,7 +55,7 @@
 			"	</body>\r\n" +
 			"</html>\r\n";

-		private ResponderRequest request;
+		readonly ResponderRequest request;

 		public Responder (ResponderRequest request)
 		{


Now passing in PostgreSQL, this RDBMS has a different precision.

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@4439

--- src/NHibernate.Test/HQL/HQLFunctions.cs
+++ src/NHibernate.Test/HQL/HQLFunctions.cs
@@ -743,7 +743,11 @@
 				string hql = "select cast(a.BodyWeight As Double) from Animal a";
 				IList l = s.CreateQuery(hql).List();
 				Assert.AreEqual(1, l.Count);
-				Assert.AreEqual(1.3f, l[0]);
+
+				if(Dialect is PostgreSQLDialect)
+					Assert.AreEqual(1.29999995231628d, l[0]);
+				else
+					Assert.AreEqual(1.3f, l[0]);
 			}
 		}


*** empty log message ***

*** empty log message ***

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@41

--- src/NHibernate/Type/IAssociationType.cs
+++ src/NHibernate/Type/IAssociationType.cs
@@ -44,6 +44,9 @@
 	/// </summary>
 	public interface IAssociationType {

+		/// <summary>
+		/// The foreign key directionality of this association
+		/// </summary>
 		ForeignKeyType ForeignKeyType { get; }

 	}


Fixes concurrent bug

Fixes concurrent bug


This was probably a bad copy-paste

This was probably a bad copy-paste


Reformat XLRow

Reformat XLRow

--- ClosedXML/Excel/Rows/XLRow.cs
+++ ClosedXML/Excel/Rows/XLRow.cs
@@ -1,8 +1,7 @@
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.Linq;
-using System.Drawing;
-

 namespace ClosedXML.Excel
 {
@@ -15,7 +14,7 @@
         private Boolean _isHidden;
         private Int32 _outlineLevel;

-        #endregion
+        #endregion Private fields

         #region Constructor

@@ -44,7 +43,7 @@
             _height = row._height;
             IsReference = row.IsReference;
             if (IsReference)
-				SubscribeToShiftedRows((range, rowShifted) => this.WorksheetRangeShiftedRows(range, rowShifted));
+                SubscribeToShiftedRows((range, rowShifted) => this.WorksheetRangeShiftedRows(range, rowShifted));

             _collapsed = row._collapsed;
             _isHidden = row._isHidden;
@@ -53,7 +52,7 @@
             SetStyle(row.GetStyleId());
         }

-        #endregion
+        #endregion Constructor

         public Boolean IsReference { get; private set; }

@@ -108,6 +107,7 @@
         #region IXLRow Members

         private Boolean _loading;
+
         public Boolean Loading
         {
             get { return IsReference ? Worksheet.Internals.RowsCollection[RowNumber()].Loading : _loading; }
@@ -121,6 +121,7 @@
         }

         public Boolean HeightChanged { get; private set; }
+
         public Double Height
         {
             get { return IsReference ? Worksheet.Internals.RowsCollection[RowNumber()].Height : _height; }
@@ -291,7 +292,7 @@
                         foreach (IXLRichString rt in c.RichText)
                         {
                             String formattedString = rt.Text;
-                            var arr = formattedString.Split(new[] {Environment.NewLine}, StringSplitOptions.None);
+                            var arr = formattedString.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                             Int32 arrCount = arr.Count();
                             for (Int32 i = 0; i < arrCount; i++)
                             {
@@ -305,7 +306,7 @@
                     else
                     {
                         String formattedString = c.GetFormattedString();
-                        var arr = formattedString.Split(new[] {Environment.NewLine}, StringSplitOptions.None);
+                        var arr = formattedString.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                         Int32 arrCount = arr.Count();
                         for (Int32 i = 0; i < arrCount; i++)
                         {
@@ -338,7 +339,7 @@
                     }
                 }
                 else
-                    thisHeight = c.Style.Font.GetHeight( fontCache);
+                    thisHeight = c.Style.Font.GetHeight(fontCache);

                 if (thisHeight >= maxHeight)
                 {
@@ -520,15 +521,15 @@
         IXLRangeRow IXLRow.CopyTo(IXLCell target)
         {
             using (var asRange = AsRange())
-                using (var copy = asRange.CopyTo(target))
-                    return copy.Row(1);
+            using (var copy = asRange.CopyTo(target))
+                return copy.Row(1);
         }

         IXLRangeRow IXLRow.CopyTo(IXLRangeBase target)
         {
             using (var asRange = AsRange())
-                using (var copy = asRange.CopyTo(target))
-                    return copy.Row(1);
+            using (var copy = asRange.CopyTo(target))
+                return copy.Row(1);
         }

         public IXLRow CopyTo(IXLRow row)
@@ -581,7 +582,7 @@
             return Row(FirstCellUsed(includeFormats), LastCellUsed(includeFormats));
         }

-        #endregion
+        #endregion IXLRow Members

         public override XLRange AsRange()
         {
@@ -676,7 +677,7 @@
             return RowShift(step * -1);
         }

-        #endregion
+        #endregion XLRow Above

         #region XLRow Below

@@ -700,7 +701,7 @@
             return RowShift(step);
         }

-        #endregion
+        #endregion XLRow Below

         public new Boolean IsEmpty()
         {
@@ -724,6 +725,5 @@
         {
             return false;
         }
-
     }
 }


[KMS] Equip (26)

[KMS] Equip (26)

--- WzComparerR2.Common/CharaSim/Gear.cs
+++ WzComparerR2.Common/CharaSim/Gear.cs
@@ -95,6 +95,10 @@
                 return 0;
             }
             if (this.GetBooleanValue(GearPropType.onlyUpgrade))
+            {
+                return 0;
+            }
+            if (this.type == GearType.machineEngine || this.type == GearType.machineArms || this.type == GearType.machineLegs || this.type == GearType.machineBody || this.type == GearType.machineTransistors || this.type == GearType.dragonMask || this.type == GearType.dragonPendant || this.type == GearType.dragonWings || this.type == GearType.dragonTail)
             {
                 return 0;
             }


Improved (says me) documentation for IDomainRepositoryFactory

--- Highway/src/Highway.Data.EntityFramework/Factories/IDomainRepositoryFactory.cs
+++ Highway/src/Highway.Data.EntityFramework/Factories/IDomainRepositoryFactory.cs
@@ -7,7 +7,6 @@
     /// </summary>
     public interface IDomainRepositoryFactory
     {
-
         /// <summary>
         /// Creates a repository for the specified <see cref="IDomain"/>
         /// </summary>
@@ -16,9 +15,9 @@
         IRepository Create<T>() where T : class, IDomain;

         /// <summary>
-        /// Creates a repository for the specified <see cref="IDomain"/>
+        /// Creates a repository for the specified <paramref name="type"/>
         /// </summary>
-        /// <param name="T">Domain for repository</param>
+        /// <param name="type">Type for repository.</param>
         /// <returns><see cref="IRepository"/></returns>
         IRepository Create(Type type);
     }


Re-added formatting directive

Re-added formatting directive

--- CmcLibNet.Export/XMLWriter.cs
+++ CmcLibNet.Export/XMLWriter.cs
@@ -35,10 +35,6 @@

         private void PrepareXmlFile(string fileName)
         {
-            // create a new XMLWriterSettings and some starting elements
-            // note that the state of the writer is left open.
-            //XmlWriterSettings xws = new XmlWriterSettings();
-            //xws.Indent = true;
             _xtw = new XmlTextWriter(fileName, System.Text.Encoding.UTF8);
             _xtw.Formatting = Formatting.Indented;
             _xtw.WriteStartDocument();


Fixed no-chrome mode.

Fixed no-chrome mode.

--- src/Neptunium/View/AppShellView.xaml.cs
+++ src/Neptunium/View/AppShellView.xaml.cs
@@ -100,7 +100,7 @@
                 topAppBar.Visibility = Visibility.Collapsed;
                 bottomAppBar.Visibility = Visibility.Collapsed;

-                RootSplitView.Visibility = Visibility.Collapsed;
+                RootSplitView.DisplayMode = SplitViewDisplayMode.Overlay;
             }
             else
             {
@@ -109,7 +109,19 @@
                 topAppBar.Visibility = Visibility.Visible;
                 bottomAppBar.Visibility = Visibility.Visible;

-                RootSplitView.Visibility = Visibility.Visible;
+                //todo remember splitview state instead of trying to guess below.
+                if (Window.Current.Bounds.Width >= 720)
+                {
+                    if (Window.Current.Bounds.Width >= 1080)
+                    {
+                        RootSplitView.DisplayMode = SplitViewDisplayMode.Inline;
+                        RootSplitView.IsPaneOpen = true;
+                    }
+                    else
+                    {
+                        RootSplitView.DisplayMode = SplitViewDisplayMode.CompactInline;
+                    }
+                }
             }
         }


Update documentation

Update documentation

--- Src/WHampson.Cascara/TypeUtils.cs
+++ Src/WHampson.Cascara/TypeUtils.cs
@@ -22,24 +22,39 @@
 #endregion

 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;

 namespace WHampson.Cascara
 {
+    ///
+    /// Convenience class for miscellaneous tasks related to data types.
+    ///
     internal static class TypeUtils
     {
-        // Checks whether the given type stems from a generic type.
-        // Taken from https://stackoverflow.com/questions/74616#1075059
+        ///
+        /// Checks whether a given type can be assigned to some generic type.
+        ///
+        /// <remarks>
+        /// Adapted from code found at https://stackoverflow.com/questions/74616#1075059
+        /// </remarks>
+        /// <param name="givenType">
+        /// The type to check whether it can be assigned to
+        /// <paramref name="genericType"/>.
+        /// </param>
+        /// <param name="genericType">
+        /// The generic type.
+        /// </param>
+        /// <returns>
+        /// True if the <paramref name="givenType"/> can be assigned to
+        /// the <paramref name="genericType"/>,
+        /// False otherwise.
+        /// </returns>
         public static bool IsAssignableToGenericType(Type givenType, Type genericType)
         {
             Type[] interfaceTypes = givenType.GetInterfaces();

-            foreach (Type typ in interfaceTypes)
+            foreach (Type type in interfaceTypes)
             {
-                if (typ.IsGenericType && typ.GetGenericTypeDefinition() == genericType)
+                if (type.IsGenericType && type.GetGenericTypeDefinition() == genericType)
                 {
                     return true;
                 }


Remove dead code (thanks PVS-Studio)

Remove dead code (thanks PVS-Studio)

--- XmlSchemaClassGenerator/TypeModel.cs
+++ XmlSchemaClassGenerator/TypeModel.cs
@@ -497,11 +497,11 @@
             {{
                 return this.{0};
             }}
-            {1}set
+            set
             {{
                 this.{0} = value;
             }}
-        }}", backingFieldName, (privateSetter ? "private " : string.Empty));
+        }}", backingFieldName);
             }
         }


fixed unsupported cast

fixed unsupported cast

--- MasDev.Common/MasDev.Common.Data.NHibernate/Source/NHibernateBaseRepository.cs
+++ MasDev.Common/MasDev.Common.Data.NHibernate/Source/NHibernateBaseRepository.cs
@@ -242,8 +242,8 @@
 				if (!typeof(IUndeletableModel).IsAssignableFrom (typeof(T)))
 					return UnfilteredQuery;

-				var queryable = (IQueryable<IUndeletableModel>)_uow.Session.Query<T> ();
-				return queryable.Where (model => !model.IsDeleted).Cast<T> ();
+				var queryable = _uow.Session.Query<T> ();
+				return queryable.Where (m => !((IUndeletableModel)m).IsDeleted);
 			}
 		}


The tests trim left zeros only if the value is only containing numbers

--- PART/Source/CprBroker/DBR.Tests/DiversionComparison/DiversionComparisonTest.cs
+++ PART/Source/CprBroker/DBR.Tests/DiversionComparison/DiversionComparisonTest.cs
@@ -12,6 +12,7 @@
 using System.Linq;
 using System.Net.Sockets;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;

 namespace CprBroker.Tests.DBR.DiversionComparison
@@ -283,7 +284,8 @@
                     var name = p.Prop;
                     var value = p.Value;

-                    value = value.TrimStart('0');
+                    if (Regex.Match(value, @"\A0[0-9]*\Z").Success)
+                        value = value.TrimStart('0');
                     if (value.Equals("0")) //STATUSHAENSTART is null in the database but emulated data has 0 as value.
                         value = "";


Prevent hang during keyboard switching on Wasta Linux

This fixes https://jira.sil.org/browse/LT-17012.

--- PalasoUIWindowsForms/Keyboarding/Linux/CombinedIbusKeyboardSwitchingAdaptor.cs
+++ PalasoUIWindowsForms/Keyboarding/Linux/CombinedIbusKeyboardSwitchingAdaptor.cs
@@ -52,13 +52,16 @@
 				bldr.AppendFormat (" -variant {0}", variant);
 			if (!String.IsNullOrEmpty(option))
 				bldr.AppendFormat (" -option {0}", option);
-			//Console.WriteLine ("DEBUG: about to call \"{0} {1}\"", startInfo.FileName, bldr.ToString ());
+			//Console.WriteLine("DEBUG SetXkbLayout({0},{1},{2}): about to call \"{3} {4}\"", layout, variant, option, startInfo.FileName, bldr.ToString());
 			startInfo.Arguments = bldr.ToString();
 			startInfo.UseShellExecute = false;
 			startInfo.CreateNoWindow = true;
 			using (var process = Process.Start(startInfo))
 			{
-				process.WaitForExit();
+				// Allow 0.3 seconds for the process -- measured at less than 0.1 seconds from command line.
+				// (See https://jira.sil.org/browse/LT-17012 for why we need a timeout here.)  Keyboard
+				// switching appears to work okay even when the process hangs and the timeout takes place.
+				process.WaitForExit(300);
 				process.Close();
 			}


Fix a bug where Data-Types are not set in the Base-classes on ClassChanged in the CombinedNode.

--- SmaSTraDesigner/code/local/SmaSTraDesigner/BusinessLogic/nodes/CombinedNode.cs
+++ SmaSTraDesigner/code/local/SmaSTraDesigner/BusinessLogic/nodes/CombinedNode.cs
@@ -43,6 +43,9 @@
         /// <param name="newValue">The new value.</param>
         protected override void OnClassChanged(NodeClass oldValue, NodeClass newValue)
         {
+            //Do not forget to call super to set DATA.
+            base.OnClassChanged(oldValue, newValue);
+
             if (newValue != null && oldValue != newValue)
             {
                 //First update the Input nodes as Size:


Fix material change null reference exception

--- Source/HelixToolkit.SharpDX.Shared/Core/Abstract/MaterialGeometryRenderCore.cs
+++ Source/HelixToolkit.SharpDX.Shared/Core/Abstract/MaterialGeometryRenderCore.cs
@@ -171,6 +171,12 @@
                 return false;
             }
         }
+
+        protected override void OnDetach()
+        {
+            materialVariables = null;
+            base.OnDetach();
+        }
         /// <summary>
         /// <see cref="RenderCoreBase{TModelStruct}.GetModelConstantBufferDescription"/>
         /// </summary>


change quick look name

change quick look name

--- Terradue.OpenSearch.DataAnalyzer/Terradue/OpenSearch/DataAnalyzer/LocalData.cs
+++ Terradue.OpenSearch.DataAnalyzer/Terradue/OpenSearch/DataAnalyzer/LocalData.cs
@@ -129,10 +129,10 @@
                                 geometryFromProperties = true;
                                 propertiesTable += "
" + kv.Key + "	" + kv.Value + "
";
                                 break;
-                            case "quicklook_url":
+                            case "image_url":
                                 var file = kv.Value;
                                 if(file.StartsWith("file://")){
-                                    log.Debug("Found quicklook url : " + kv.Value);
+                                    log.Debug("Found image url : " + kv.Value);

                                     var filePath = file.Substring(7);//skip 'file://'
                                     var f = new System.IO.FileInfo(filePath);
@@ -185,7 +185,7 @@
                                         log.Debug("Error : " + e.Message + " - " + e.StackTrace);
                                     }
                                 } else {
-                                    log.Debug("Found quicklook url : " + kv.Value);
+                                    log.Debug("Found image url : " + kv.Value);
                                     //test it is a valid url
                                     var uri = new UriBuilder(kv.Value);
                                     propertiesTable += "

";


change way of generating base64 image

change way of generating base64 image

--- Terradue.OpenSearch.DataAnalyzer/Terradue/OpenSearch/DataAnalyzer/LocalData.cs
+++ Terradue.OpenSearch.DataAnalyzer/Terradue/OpenSearch/DataAnalyzer/LocalData.cs
@@ -151,16 +151,36 @@

                                     try{
                                         //if file < 64kb, include it in the summary table in base64 image encoded
-                                        System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Jpeg;
-                                        System.Drawing.Image image = System.Drawing.Image.FromFile(filePath);
-                                        using (MemoryStream ms = new MemoryStream()){
-                                            // Convert Image to byte[]
-                                            image.Save(ms, format);
-
-                                            // Convert byte[] to Base64 String
-                                            string base64String = Convert.ToBase64String(ms.ToArray());
-                                            propertiesTable += "

";
+                                        string htmlformat;
+                                        switch(filePath.Substring(filePath.LastIndexOf(".") + 1).ToLower()){
+                                            case "jpeg":
+                                            case "jpg":
+                                                htmlformat = "image/jpeg";
+                                                break;
+                                            case "png":
+                                                htmlformat = "image/png";
+                                                break;
+                                            case "tiff":
+                                                htmlformat = "image/tiff";
+                                                break;
+                                            case "bmp":
+                                                htmlformat = "image/bmp";
+                                                break;
+                                            case "gif":
+                                                htmlformat = "image/gif";
+                                                break;
+                                            case "ico":
+                                                htmlformat = "image/x-icon";
+                                                break;
+                                            default:
+                                                htmlformat = "image/jpeg";
+                                                break;
                                         }
+
+                                        // Convert byte[] to Base64 String
+                                        string base64String = Convert.ToBase64String(File.ReadAllBytes(filePath));
+                                        propertiesTable += "

";
+
                                     }catch(Exception e){
                                         log.Debug("Error : " + e.Message + " - " + e.StackTrace);
                                     }


Made some debug commands server side only.

--- UnityProject/Assets/IngameDebugConsole/Scripts/DebugLogUnitystationCommands.cs
+++ UnityProject/Assets/IngameDebugConsole/Scripts/DebugLogUnitystationCommands.cs
@@ -1,9 +1,13 @@
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using UnityEngine.Networking;

 namespace IngameDebugConsole
 {
+	/// <summary>
+	/// Contains all the custom defined commands for the IngameDebugLogger
+	/// </summary>
 	public class DebugLogUnitystationCommands
 	{
 		[ConsoleMethod("suicide", "kill yo' self")]
@@ -21,38 +25,47 @@
 			}
 		}

-		[ConsoleMethod("damage-self", "Usage:\ndamage-self <bodyPart> <brute amount> <burn amount>\nExample: damage-self LeftArm 40 20")]
+		[ConsoleMethod("damage-self", "Server only cmd.\nUsage:\ndamage-self <bodyPart> <brute amount> <burn amount>\nExample: damage-self LeftArm 40 20.Insert")]
 		public static void RunDamageSelf(string bodyPartString, int burnDamage, int bruteDamage)
 		{
-
-
+			if (CustomNetworkManager.Instance._isServer == false)
+			{
+				Logger.LogError("Can only execute command from server.", Category.DebugConsole);
+				return;
+			}
+
 			bool success = BodyPartType.TryParse(bodyPartString, true, out BodyPartType bodyPart);
+			if(success == false)
+			{
+				Logger.LogError("Invalid body part '" + bodyPartString + "'", Category.DebugConsole);
+				return;
+			}

-			if (success)
+			bool playerSpawned = (PlayerManager.LocalPlayer != null);
+			if (playerSpawned == false)
 			{
-				bool playerSpawned = (PlayerManager.LocalPlayer != null);
-				if (!playerSpawned)
-				{
-					Logger.LogError("Cannot damage player. Player has not spawned.", Category.DebugConsole);
+				Logger.LogError("Cannot damage player. Player has not spawned.", Category.DebugConsole);
+				return;
+			}

-				}
-				else
-				{
-					Logger.Log("Debugger inflicting " + burnDamage + " burn damage and " + bruteDamage + " brute damage on " + bodyPart + " of " + PlayerManager.LocalPlayer.name, Category.DebugConsole);
-					HealthBodyPartMessage.Send(PlayerManager.LocalPlayer, PlayerManager.LocalPlayer, bodyPart, burnDamage, bruteDamage);
-				}
-			}
-			else
-			{
-				Logger.LogError("Invalid body part '"+ bodyPartString+ "'", Category.DebugConsole);
-			}
+			Logger.Log("Debugger inflicting " + burnDamage + " burn damage and " + bruteDamage + " brute damage on " + bodyPart + " of " + PlayerManager.LocalPlayer.name, Category.DebugConsole);
+			HealthBodyPartMessage.Send(PlayerManager.LocalPlayer, PlayerManager.LocalPlayer, bodyPart, burnDamage, bruteDamage);
 		}

-		[ConsoleMethod("restart-round", "restarts the round")]
+		[ConsoleMethod("restart-round", "restarts the round. Server only cmd.")]
 		public static void RunRestartRound()
 		{
-				Logger.Log("Round restart triggered by DebugConsole.", Category.DebugConsole);
-				GameManager.Instance.RestartRound();
+
+			if (CustomNetworkManager.Instance._isServer == false)
+			{
+				Logger.LogError("Can only execute command from server.", Category.DebugConsole);
+				return;
+			}
+
+
+			Logger.Log("Triggered round restart from DebugConsole.", Category.DebugConsole);
+			GameManager.Instance.RestartRound();
+
 		}

 	}


Attempt at staggering NetworkObject awake messages so not to cause physics spike

--- UnityProject/Assets/Scripts/Managers/SubSceneManager/SubSceneManager.Server.cs
+++ UnityProject/Assets/Scripts/Managers/SubSceneManager/SubSceneManager.Server.cs
@@ -145,20 +145,12 @@
 	/// <param name="connToAdd"></param>
 	void AddObserverToAllObjects(NetworkConnection connToAdd, Scene sceneContext)
 	{
-		//Need to do matrices first:
+		//Activate the matrices on the client first
 		foreach (var m in MatrixManager.Instance.ActiveMatrices)
 		{
 			if (m.Matrix.gameObject.scene == sceneContext)
 			{
 				m.Matrix.GetComponentInParent<NetworkIdentity>().AddPlayerObserver(connToAdd);
-			}
-		}
-		//Now for all the items:
-		foreach (var n in NetworkIdentity.spawned)
-		{
-			if (n.Value.gameObject.scene == sceneContext)
-			{
-				n.Value.AddPlayerObserver(connToAdd);
 			}
 		}

@@ -166,12 +158,13 @@

 		StartCoroutine(
 			SyncPlayerData(connToAdd.clientOwnedObjects.ElementAt(0).gameObject,
+				connToAdd,
 				sceneContext.name));
 	}

 	/// Sync init data with specific scenes
 	/// staggered over multiple frames
-	public IEnumerator SyncPlayerData(GameObject playerGameObject, string sceneName)
+	public IEnumerator SyncPlayerData(GameObject playerGameObject, NetworkConnection connToAdd, string sceneName)
 	{
 		Logger.LogFormat("SyncPlayerData. This server sending a bunch of sync data to new " +
 		                 "client {0} for scene {1}", Category.Connections, playerGameObject, sceneName);
@@ -179,6 +172,26 @@
 		var sceneContext = SceneManager.GetSceneByName(sceneName);

 		yield return WaitFor.EndOfFrame;
+
+		//Now start all of the networked objects on those matrices we
+		//activated earlier. We are doing it here in the coroutine
+		//so we can stagger the awake updates on the client
+		//This should avoid massive spike in Physics2D when the colliders
+		//come active. We do this in lots of 20 every frame
+		int objCount = 0;
+		foreach (var n in NetworkIdentity.spawned)
+		{
+			if (n.Value.gameObject.scene == sceneContext)
+			{
+				n.Value.AddPlayerObserver(connToAdd);
+				objCount += 1;
+				if (objCount >= 20)
+				{
+					objCount = 0;
+					yield return WaitFor.EndOfFrame;
+				}
+			}
+		}

 		//TileChange Data
 		TileChangeManager[] tcManagers = FindObjectsOfType<TileChangeManager>();
@@ -202,11 +215,20 @@
 		yield return WaitFor.EndOfFrame;

 		//All transforms
+		objCount = 0;
 		CustomNetTransform[] scripts = FindObjectsOfType<CustomNetTransform>();
 		for (var i = 0; i < scripts.Length; i++)
 		{
 			if(scripts[i].gameObject.scene != sceneContext) continue;
 			scripts[i].NotifyPlayer(playerGameObject);
+			//Again we are trying to limit physics 2d spikes on the client
+			//20 notifys a frame:
+			objCount += 1;
+			if (objCount >= 20)
+			{
+				objCount = 0;
+				yield return WaitFor.EndOfFrame;
+			}
 		}

 		yield return WaitFor.EndOfFrame;
@@ -229,7 +251,6 @@
 			{
 				equipment.NotifyPlayer(playerGameObject);
 			}
-			yield return WaitFor.EndOfFrame;
 		}

 		yield return WaitFor.EndOfFrame;


Chromeless: adding unsnapping on dragging when maximized

--- WebBrowserEngine/ChromiumFX/HTMEngine.ChromiumFX/WPF/ChromiumFxControl.xaml.cs
+++ WebBrowserEngine/ChromiumFX/HTMEngine.ChromiumFX/WPF/ChromiumFxControl.xaml.cs
@@ -21,6 +21,7 @@
         private bool _Dragging = false;
         private BrowserWidgetMessageInterceptor _ChromeWidgetMessageInterceptor;
         private Region _DraggableRegion = null;
+        private Rectangle _Rectange = new Rectangle(0,0,0,0);
         private bool _Listenning;
         private IDisposableMouseEvents _listener;

@@ -49,6 +50,13 @@

                 return current;
             });
+
+            _Rectange = args.Regions.Select(r => r.Bounds).Aggregate(_Rectange, (current, bounds) =>
+                new Rectangle(  Math.Min(current.X, bounds.X),
+                                Math.Min(current.Y, bounds.Y),
+                                Math.Max(current.X + current.Size.Width, bounds.X + bounds.Width),
+                                Math.Max(current.Y + current.Size.Height, bounds.X + bounds.Height))
+            );
         }

         private IntPtr _BrowserHandle;
@@ -90,6 +98,7 @@
                     break;

                 case NativeMethods.WindowsMessage.WM_LBUTTONDBLCLK:
+                    _Dragging = false;
                     if (!IsInDragRegion(GetPoint(message.LParam)))
                         break;

@@ -191,11 +200,15 @@
             return Window.PointToScreen(point);
         }

+        private System.Windows.Point RealPixelsToWpf(double x, double y)
+        {
+            return Window.PointToScreen(new System.Windows.Point(x, y));
+        }
+
         private void DragInit(System.Windows.Point point)
         {
             _Dragging = true;
             var off = RealPixelsToWpf(point);
-
             _DragOffset = new System.Windows.Point(Window.Left - off.X, Window.Top - off.Y);
         }

@@ -205,8 +218,36 @@
                 return;

             var off = RealPixelsToWpf(point);
+
+            if (MinimizeIfNeeded(point))
+                return;
+
             Window.Left = _DragOffset.X + off.X;
             Window.Top = _DragOffset.Y + off.Y;
+        }
+
+        private bool MinimizeIfNeeded(System.Windows.Point point)
+        {
+            if (Window.WindowState != WindowState.Maximized)
+                return false;
+
+            var width = RealPixelsToWpf(_Rectange.Width, 0).X;
+            var screenWith = SystemParameters.WorkArea.Width;
+            var x = point.X - width / 2;
+            if (x < 0)
+            {
+                x = 0;
+            }
+            else if (x + width > screenWith)
+            {
+                x = screenWith - width;
+            }
+            Window.Top = 0;
+            Window.Left = x;
+            Window.WindowState = WindowState.Normal;
+
+            _DragOffset = new System.Windows.Point(Window.Left - point.X, Window.Top - point.Y);
+            return true;
         }

         private void Window_Closed(object sender, System.EventArgs e)


Fixes DailyFx missing Symbol

Fixes DailyFx missing Symbol

We didn't assign a symbol to DailyFx objects, so we needed to get the bar with Get<T> which was not possible in python.

--- Common/Data/Custom/DailyFx.cs
+++ Common/Data/Custom/DailyFx.cs
@@ -165,6 +165,8 @@

             foreach (var dailyfx in dailyfxList)
             {
+                dailyfx.Symbol = config.Symbol;
+
                 // Custom data format without settings in market hours are assumed UTC.
                 dailyfx.Time = dailyfx.DisplayDate.Date.AddHours(dailyfx.DisplayTime.TimeOfDay.TotalHours);


renew token error message

renew token error message

--- Controllers/HomeController.cs
+++ Controllers/HomeController.cs
@@ -76,38 +76,69 @@

                 var token = await _visualstudio.RefreshAccessCode(infos.RefreshToken);

-                infos.AccessToken = token.access_token;
-                infos.RefreshToken = token.refresh_token;
-                await _azureTableManager.UpdateRow(infos);
+                if (string.IsNullOrEmpty(token.Error))
+                {
+                    infos.AccessToken = token.access_token;
+                    infos.RefreshToken = token.refresh_token;

-                _visualstudio.access_token = infos.AccessToken;
-                var changeset = await _visualstudio.GetLatestChangesets(infos.VSO_Url);
+                    var repositoryName = infos.VSO_Url.Substring(1 + infos.VSO_Url.LastIndexOf('/'));

-                if (changeset.count > 0)
-                {
-                    string user = changeset.value.FirstOrDefault().checkedInBy.displayName;
-                    string time = "";
-                    var diff = (DateTime.Now - changeset.value.FirstOrDefault().createdDate);
+                    await _azureTableManager.UpdateRow(infos);

-                    if (diff.TotalDays >= 1)
+                    _visualstudio.access_token = infos.AccessToken;
+                    var changeset = await _visualstudio.GetLatestChangesets(infos.VSO_Url);
+
+                    if (changeset != null && changeset.count > 0)
                     {
-                        time = $"{(int)diff.TotalDays} days";
+                        var message = !string.IsNullOrEmpty(changeset.value.FirstOrDefault().comment) ? $"'{changeset.value.FirstOrDefault().comment}' " : "";
+                        string user = changeset.value.FirstOrDefault().checkedInBy.displayName;
+                        string time = "";
+                        var diff = (DateTime.Now - changeset.value.FirstOrDefault().createdDate);
+
+                        if (diff.TotalDays >= 1)
+                        {
+                            time = $"{(int)diff.TotalDays} days";
+                        }
+                        else if (diff.TotalHours >= 1)
+                        {
+                            time = $"{(int)diff.TotalHours} hours";
+                        }
+                        else if (diff.TotalMinutes >= 1)
+                        {
+                            time = $"{(int)diff.TotalMinutes} minutes";
+                        }
+
+                        result = new LametricMessage();
+                        result.frames.Add(new Frame()
+                        {
+                            icon = "#9672",
+                            text = repositoryName
+                        });
+                        result.frames.Add(new Frame()
+                        {
+                            icon = "#9672",
+                            text = $"{user} checked in {message}{time} ago"
+                        });
                     }
-                    else if (diff.TotalHours >= 1)
+                    else if (!string.IsNullOrEmpty(changeset.ErrorDescription))
                     {
-                        time = $"{(int)diff.TotalHours} hours";
+                        result = new LametricMessage();
+                        result.frames.Add(new Frame()
+                        {
+                            icon = "#9672",
+                            text = changeset.ErrorDescription
+                        });
                     }
-                    else if (diff.TotalMinutes >= 1)
+                    else
                     {
-                        time = $"{(int)diff.TotalMinutes} minutes";
+                        // unable to refresh access token
+                        result = new LametricMessage();
+                        result.frames.Add(new Frame()
+                        {
+                            icon = "#9672",
+                            text = "no changesets... yet!"
+                        });
                     }
-
-                    result = new LametricMessage();
-                    result.frames.Add(new Frame()
-                    {
-                        icon = "#9672",
-                        text = $"{user} checked in {time} ago"
-                    });
                 }
                 else
                 {
@@ -115,10 +146,10 @@
                     result.frames.Add(new Frame()
                     {
                         icon = "#9672",
-                        text = $"no changesets yet!"
+                        text = $"unable to refresh access token {token.Error} {token.ErrorDescription}"
                     });
-
                 }
+
             }
             catch (Exception e)
             {


new icon

new icon

--- Controllers/HomeController.cs
+++ Controllers/HomeController.cs
@@ -105,7 +105,7 @@
                     result = new LametricMessage();
                     result.frames.Add(new Frame()
                     {
-                        icon = "1",
+                        icon = "#9672",
                         text = $"{user} checked in {time} ago"
                     });
                 }
@@ -114,7 +114,7 @@
                     result = new LametricMessage();
                     result.frames.Add(new Frame()
                     {
-                        icon = "a4297",
+                        icon = "#9672",
                         text = $"no changesets yet!"
                     });


update

update

--- ZingExplorer/ZingExplorerSampling.cs
+++ ZingExplorer/ZingExplorerSampling.cs
@@ -327,7 +327,7 @@
             //maximum number of schedules per iteration = c1 + c2^d.
             // c1 = ZingerConfiguration.MaxSchedulesPerIteration.
             // c2 = 3 as we found that to work the best.
-            int maxSchedulesPerIteration = ZingerConfiguration.MaxSchedulesPerIteration + (int)Math.Pow(3, ZingerConfiguration.zBoundedSearch.IterativeCutoff);
+            int maxSchedulesPerIteration = ZingerConfiguration.MaxSchedulesPerIteration + (int)Math.Pow(1.3, ZingerConfiguration.zBoundedSearch.IterativeCutoff);
             int delayBudget = 0;
             Stack<TraversalInfo> searchStack = new Stack<TraversalInfo>();
             //frontier