reduces redundant code

reduces redundant code

--- Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs
+++ Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs
@@ -56,6 +56,8 @@
             }
         }

+        private bool HasProfileAndIsInitialized => activeProfile != null && IsInitialized;
+
         /// <summary>
         /// The active profile of the Mixed Reality Toolkit which controls which services are active and their initial configuration.
         /// *Note configuration is used on project initialization or replacement, changes to properties while it is running has no effect.
@@ -137,7 +139,7 @@
         /// <inheritdoc />
         public bool RegisterService<T>(T serviceInstance) where T : IMixedRealityService
         {
-            return RegisterServiceInternal<T>(serviceInstance);
+            return RegisterServiceInternal(serviceInstance);
         }

         /// <inheritdoc />
@@ -891,129 +893,60 @@

         private void InitializeAllServices()
         {
+            // Initialize all systems
+            ExecuteOnAllServices(service => service.Initialize());
+        }
+
+        private void ResetAllServices()
+        {
+            // Reset all systems
+            ExecuteOnAllServices(service => service.Reset());
+        }
+
+        private void EnableAllServices()
+        {
+            // Enable all systems
+            ExecuteOnAllServices(service => service.Enable());
+        }
+
+        private void UpdateAllServices()
+        {
+            // Update all systems
+            ExecuteOnAllServices(service => service.Update());
+        }
+
+        private void DisableAllServices()
+        {
+            // Disable all systems
+            ExecuteOnAllServices(service => service.Disable());
+        }
+
+        private void DestroyAllServices()
+        {
+            if (!ExecuteOnAllServices(service => service.Destroy())) { return; }
+
+            activeSystems.Clear();
+            registeredMixedRealityServices.Clear();
+        }
+
+        private bool ExecuteOnAllServices(Action<IMixedRealityService> execute)
+        {
             // If the Mixed Reality Toolkit is not configured, stop.
-            if (activeProfile == null) { return; }
-
-            // Initialize all systems
+            if (!HasProfileAndIsInitialized) { return false; }
+
             foreach (var system in activeSystems)
             {
-                system.Value.Initialize();
-            }
-
-            // Initialize all registered runtime services
+                execute(system.Value);
+            }
+
+            activeSystems.Clear();
+
             foreach (var service in registeredMixedRealityServices)
             {
-                service.Item2.Initialize();
-            }
-        }
-
-        private void ResetAllServices()
-        {
-            // If the Mixed Reality Toolkit is not configured, stop.
-            if (activeProfile == null) { return; }
-
-            // If the Mixed Reality Toolkit is not initialized, stop.
-            if (!IsInitialized) { return; }
-
-            // Reset all systems
-            foreach (var system in activeSystems)
-            {
-                system.Value.Reset();
-            }
-
-            // Reset all registered runtime services
-            foreach (var service in registeredMixedRealityServices)
-            {
-                service.Item2.Reset();
-            }
-        }
-
-        private void EnableAllServices()
-        {
-            // If the Mixed Reality Toolkit is not configured, stop.
-            if (activeProfile == null) { return; }
-
-            // If the Mixed Reality Toolkit is not initialized, stop.
-            if (!IsInitialized) { return; }
-
-            // Enable all systems
-            foreach (var system in activeSystems)
-            {
-                system.Value.Enable();
-            }
-
-            // Reset all registered runtime services
-            foreach (var service in registeredMixedRealityServices)
-            {
-                service.Item2.Enable();
-            }
-        }
-
-        private void UpdateAllServices()
-        {
-            // If the Mixed Reality Toolkit is not configured, stop.
-            if (activeProfile == null) { return; }
-
-            // If the Mixed Reality Toolkit is not initialized, stop.
-            if (!IsInitialized) { return; }
-
-            // Update all systems
-            foreach (var system in activeSystems)
-            {
-                system.Value.Update();
-            }
-
-            // Update all registered runtime services
-            foreach (var service in registeredMixedRealityServices)
-            {
-                service.Item2.Update();
-            }
-        }
-
-        private void DisableAllServices()
-        {
-            // If the Mixed Reality Toolkit is not configured, stop.
-            if (activeProfile == null) { return; }
-
-            // If the Mixed Reality Toolkit is not initialized, stop.
-            if (!IsInitialized) { return; }
-
-            // Disable all systems
-            foreach (var system in activeSystems)
-            {
-                system.Value.Disable();
-            }
-
-            // Disable all registered runtime services
-            foreach (var service in registeredMixedRealityServices)
-            {
-                service.Item2.Disable();
-            }
-        }
-
-        private void DestroyAllServices()
-        {
-            // If the Mixed Reality Toolkit is not configured, stop.
-            if (activeProfile == null) { return; }
-
-            // If the Mixed Reality Toolkit is not initialized, stop.
-            if (!IsInitialized) { return; }
-
-            // Destroy all systems
-            foreach (var system in activeSystems)
-            {
-                system.Value.Destroy();
-            }
-
-            activeSystems.Clear();
-
-            // Destroy all registered runtime services
-            foreach (var service in registeredMixedRealityServices)
-            {
-                service.Item2.Destroy();
-            }
-
-            registeredMixedRealityServices.Clear();
+                execute(service.Item2);
+            }
+
+            return true;
         }

         #endregion Multiple Service Management
@@ -1064,10 +997,9 @@
         {
             if (!CanGetService(interfaceType)) { return null; }

-            IMixedRealityService serviceInstance = null;
-
             if (IsCoreSystem(interfaceType))
             {
+                IMixedRealityService serviceInstance;
                 if (activeSystems.TryGetValue(interfaceType, out serviceInstance))
                 {
                     if (CheckServiceMatch(interfaceType, serviceName, interfaceType, serviceInstance))


Modified to display dialog when a wrong folder where an excel file is selected instead of pass the error message on the console window in the Unity editor. (Better to understand what was went to wrong)

--- Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs
+++ Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs
@@ -1,7 +1,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 ///
 /// ExcelMachineEditor.cs
-///
+///
 /// (c)2014 Kim, Hyoun Woo
 ///
 ///////////////////////////////////////////////////////////////////////////////
@@ -63,15 +63,19 @@
                 int index = path.IndexOf("Assets");
                 if (index >= 0)
                 {
-                    // set relative path
+                    // set relative path
                     machine.excelFilePath = path.Substring(index);

-                    // pass absolute path
+                    // pass absolute path
                     machine.SheetNames = new ExcelQuery(path).GetSheetNames();
                 }
                 else
                 {
-                    Debug.LogErrorFormat("Wrong folder is selected. Set a folder under the 'Assets' folder! {0}", path);
+                  EditorUtility.DisplayDialog("Error",
+                      @"Wrong folder is selected.
+                        Set a folder under the 'Assets' folder! \n
+                        The excel file should be anywhere under  the 'Assets' folder", "OK");
+                  return;
                 }
             }
         }
@@ -189,7 +193,7 @@
         List<string> titleList = titles.ToList();

         if (machine.HasHeadColumn() && reimport == false)
-        {
+        {
             var headerDic = machine.HeaderColumnList.ToDictionary(header => header.name);

             // collect non changed header columns
@@ -241,9 +245,9 @@
         sp.className = machine.WorkSheetName;
         sp.dataClassName = machine.WorkSheetName + "Data";
         sp.worksheetClassName = machine.WorkSheetName;
-
+
         // where the imported excel file is.
-        sp.importedFilePath = machine.excelFilePath;
+        sp.importedFilePath = machine.excelFilePath;

         // path where the .asset file will be created.
         string path = Path.GetDirectoryName(machine.excelFilePath);
@@ -252,7 +256,7 @@
         sp.assetPostprocessorClass = machine.WorkSheetName + "AssetPostprocessor";
         sp.template = GetTemplate("PostProcessor");

-        // write a script to the given folder.
+        // write a script to the given folder.
         using (var writer = new StreamWriter(TargetPathForAssetPostProcessorFile(machine.WorkSheetName)))
         {
             writer.Write(new NewScriptGenerator(sp).ToString());


minigame4 scene and initiation

minigame4 scene and initiation

--- Assets/Scripts/MixDryIngredients/MixIngredientsMinigame.cs
+++ Assets/Scripts/MixDryIngredients/MixIngredientsMinigame.cs
@@ -80,6 +80,7 @@

     public bool AddIngredient(Ingredient i) {
 		if (i.ingredientName == ingredientsNeeded[currentIngredient].ingredient) {
+            AkSoundEngine.PostEvent("Correct_Ingredient", i.gameObject);
 			SCORE += 10;
 		} else {
 			Camera.main.GetComponent<Animator>().Play("CameraShake");


CookieAuthentication login issue fixed

CookieAuthentication login issue fixed

There was no way to login with CookieAuthentication because auth cookie hasn't been set. So there was always redirect to login page.

Why?
Unlike FormsAuthentication, which actually sets the cookies when you write your authentication code, AuthenticationManager creates an AuthenticationResponseGrant or AuthenticationResponseRevoke object.

So the authentication cookies are not set at the time of calling authentication.SignIn(authProperties, claimsIdentity); They're called later, so ending the response using Response.Redirect will kill the thread before the cookies get added onto the response object. By changing the endResponse parameter to false, the cookies get applied to the response object as expected.

--- Bonobo.Git.Server/Security/CookieAuthenticationProvider.cs
+++ Bonobo.Git.Server/Security/CookieAuthenticationProvider.cs
@@ -45,7 +45,7 @@
             HttpContext.Current.GetOwinContext().Authentication.SignIn(identity);
             if (!String.IsNullOrEmpty(returnUrl))
             {
-                HttpContext.Current.Response.Redirect(returnUrl);
+                HttpContext.Current.Response.Redirect(returnUrl, false);
             }
         }

@@ -54,4 +54,4 @@
             HttpContext.Current.GetOwinContext().Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);
         }
     }
-}+}


LibraryDatabaseManager tests now deletes test folder when finished

--- Bookling/Bookling.UnitTests/LibraryDatabaseManagerTests.cs
+++ Bookling/Bookling.UnitTests/LibraryDatabaseManagerTests.cs
@@ -45,6 +45,12 @@
 				Environment.SpecialFolder.MyDocuments) + "{0}Bookling-Tests{0}",
 			                                    Path.DirectorySeparatorChar);
 			Directory.CreateDirectory (configFolderString);
+		}
+
+		[TestFixtureTearDown]
+		public void DeleteConfigFolder ()
+		{
+			Directory.Delete (configFolderString);
 		}

 		[SetUp]


fix bug.

fix bug.

--- CSharpGL.Objects/SceneElements/PointSpriteStringElement.cs
+++ CSharpGL.Objects/SceneElements/PointSpriteStringElement.cs
@@ -44,7 +44,6 @@
         public uint[] texture = new uint[1];
         uint[] vao = new uint[1];
         public ShaderProgram shaderProgram;
-        private mat4 currentMVP;
         public const string strMVP = "MVP";
         public const string strpointSize = "pointSize";
         public const string strtextColor = "textColor";
@@ -263,36 +262,63 @@
                     }
                 }
                 gContentBitmap.Dispose();
-                //contentBitmap.Save("PointSpriteFontElement-contentBitmap.png");
+                contentBitmap.Save("PointSpriteStringElement-contentBitmap.png");
+                System.Drawing.Bitmap bmp = null;
+                if (totalLength * fontSize > maxRowWidth * fontResource.FontHeight)// 超过1行能显示的内容
+                {
+                    bmp = (System.Drawing.Bitmap)contentBitmap.GetThumbnailImage(
+                        maxRowWidth, maxRowWidth, null, IntPtr.Zero);
+                }
+                else//只在一行内即可显示所有字符
+                {
+                    if (totalLength >= fontResource.FontHeight)
+                    {
+                        bmp = (System.Drawing.Bitmap)contentBitmap.GetThumbnailImage(
+                            totalLength * this.fontSize / this.resource.FontHeight,
+                            totalLength * this.fontSize / this.resource.FontHeight,
+                            null, IntPtr.Zero);
+
+                    }
+                    else
+                    {
+                        bmp = (System.Drawing.Bitmap)contentBitmap.GetThumbnailImage(
+                            fontSize, fontSize, null, IntPtr.Zero);
+                    }
+                }
+                contentBitmap.Dispose();
+                contentBitmap = bmp;
+                contentBitmap.Save("PointSpriteStringElement-contentBitmap-scaled.png");
             }

             // step 4: get texture's size
             int targetTextureWidth;
             {

-                //	Get the maximum texture size supported by OpenGL.
-                int[] textureMaxSize = { 0 };
-                GL.GetInteger(GetTarget.MaxTextureSize, textureMaxSize);
-
-                //	Find the target width and height sizes, which is just the highest
-                //	posible power of two that'll fit into the image.
-
-                targetTextureWidth = textureMaxSize[0];
-                //System.Drawing.Bitmap bitmap = contentBitmap;
-                int scaledWidth = 8 * contentBitmap.Width * fontSize / fontResource.FontHeight;
-
-                for (int size = 1; size <= textureMaxSize[0]; size *= 2)
-                {
-                    if (scaledWidth < size)
-                    {
-                        targetTextureWidth = size / 2;
-                        break;
-                    }
-                    if (scaledWidth == size)
-                        targetTextureWidth = size;
-                }
-
-                this.textureWidth = targetTextureWidth;
+                ////	Get the maximum texture size supported by OpenGL.
+                //int[] textureMaxSize = { 0 };
+                //GL.GetInteger(GetTarget.MaxTextureSize, textureMaxSize);
+
+                ////	Find the target width and height sizes, which is just the highest
+                ////	posible power of two that'll fit into the image.
+
+                //targetTextureWidth = textureMaxSize[0];
+                ////System.Drawing.Bitmap bitmap = contentBitmap;
+                //int scaledWidth = 8 * contentBitmap.Width * fontSize / fontResource.FontHeight;
+
+                //for (int size = 1; size <= textureMaxSize[0]; size *= 2)
+                //{
+                //    if (scaledWidth < size)
+                //    {
+                //        targetTextureWidth = size / 2;
+                //        break;
+                //    }
+                //    if (scaledWidth == size)
+                //        targetTextureWidth = size;
+                //}
+
+                //this.textureWidth = targetTextureWidth;
+                this.textureWidth = contentBitmap.Width;
+                targetTextureWidth = contentBitmap.Width;
             }

             // step 5: scale contentBitmap to right size
@@ -448,8 +474,6 @@

         void IMVP.UpdateMVP(mat4 mvp)
         {
-            this.currentMVP = mvp;
-
             GL.Enable(GL.GL_VERTEX_PROGRAM_POINT_SIZE);
             GL.Enable(GL.GL_POINT_SPRITE_ARB);
             //GL.TexEnv(GL.GL_POINT_SPRITE_ARB, GL.GL_COORD_REPLACE_ARB, GL.GL_TRUE);//TODO: test TexEnvi()
@@ -467,7 +491,8 @@

             shaderProgram.SetUniformMatrix4(strMVP, mvp.to_array());
             //shaderProgram.SetUniform(PointSpriteStringElement.strpointSize, this.PointSize);
-            shaderProgram.SetUniform(PointSpriteStringElement.strpointSize, textureWidth / 10.0f);
+            //shaderProgram.SetUniform(PointSpriteStringElement.strpointSize, textureWidth / 10.0f);
+            shaderProgram.SetUniform(PointSpriteStringElement.strpointSize, this.textureWidth/1.0f);
             shaderProgram.SetUniform(PointSpriteStringElement.strtex, this.texture[0]);
             shaderProgram.SetUniform(PointSpriteStringElement.strtextColor, this.textColor.x, this.textColor.y, this.textColor.z);
             //shaderProgram.SetUniform(PointSpriteStringElement.strtextColor, (float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());


Set the github request useragent to clientid

--- Code/SimpleAuthentication.ExtraProviders/GitHubProvider.cs
+++ Code/SimpleAuthentication.ExtraProviders/GitHubProvider.cs
@@ -79,10 +79,10 @@
             }

             return new AccessToken
-                   {
-                       PublicToken = accessTokenResult.AccessToken
-                       //ExpiresOn = DateTime.UtcNow.AddSeconds(accessTokenResult.ExpiresIn)
-                   };
+            {
+                PublicToken = accessTokenResult.AccessToken
+                //ExpiresOn = DateTime.UtcNow.AddSeconds(accessTokenResult.ExpiresIn)
+            };
         }

         protected override UserInformation RetrieveUserInformation(AccessToken accessToken)
@@ -105,6 +105,9 @@
                 restRequest.AddParameter(AccessTokenKey, accessToken.PublicToken);

                 var restClient = RestClientFactory.CreateRestClient("https://api.github.com");
+
+                restClient.UserAgent = PublicApiKey;
+
                 TraceSource.TraceVerbose("Retrieving user information. GitHub Endpoint: {0}",
                                          restClient.BuildUri(restRequest).AbsoluteUri);


arrumando um "bug"

arrumando um "bug"


update

update

--- src/ZZLogger.cs
+++ src/ZZLogger.cs
@@ -177,6 +177,19 @@
             _Logger.WriteLog("TRACE", cModules_Name, "" + msg, objs);
         }

+        public static void Debug(string cModules_Name,string temp ,object msg, params object[] objs)
+        {
+            if (!DebugEnabled) {
+                return;
+            }
+
+            if (_Logger == null) {
+                ZZLogger.getInstance();
+            }
+
+            _Logger.WriteLog("DEBUG" , cModules_Name+temp , "" + msg , objs);
+        }
+
         public static void Debug(string cModules_Name, object msg, params object[] objs)
         {
             if (!DebugEnabled) {


Tweaked trilateration control margins to stop it dropping off the bottom of the form

--- EDDiscovery/Trilateration/TrilaterationControl.Designer.cs
+++ EDDiscovery/Trilateration/TrilaterationControl.Designer.cs
@@ -43,6 +43,8 @@
             this.labelCoordinateZ = new System.Windows.Forms.Label();
             this.panelImplementation = new System.Windows.Forms.Panel();
             this.labelAlgorithm = new System.Windows.Forms.Label();
+            this.radioButtonAlgorithmJs = new ExtendedControls.RadioButtonCustom();
+            this.radioButtonAlgorithmCsharp = new ExtendedControls.RadioButtonCustom();
             this.toolTipAlgorithm = new System.Windows.Forms.ToolTip(this.components);
             this.wantedContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
             this.removeFromWantedSystemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -55,7 +57,12 @@
             this.toolStripButtonRemoveAll = new System.Windows.Forms.ToolStripButton();
             this.toolStripButtonMap = new System.Windows.Forms.ToolStripButton();
             this.panel_controls = new System.Windows.Forms.Panel();
+            this.textBox_status = new ExtendedControls.TextBoxBorder();
             this.labelstpos = new System.Windows.Forms.Label();
+            this.textBoxSystemName = new ExtendedControls.TextBoxBorder();
+            this.textBoxCoordinateX = new ExtendedControls.TextBoxBorder();
+            this.textBoxCoordinateY = new ExtendedControls.TextBoxBorder();
+            this.textBoxCoordinateZ = new ExtendedControls.TextBoxBorder();
             this.splitContainerCustom1 = new ExtendedControls.SplitContainerCustom();
             this.splitContainerCustom2 = new ExtendedControls.SplitContainerCustom();
             this.dataViewScroller_Distances = new ExtendedControls.DataViewScrollerPanel();
@@ -71,13 +78,6 @@
             this.dataGridViewClosestSystems = new System.Windows.Forms.DataGridView();
             this.Source = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumnClosestSystemsSystem = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.textBox_status = new ExtendedControls.TextBoxBorder();
-            this.textBoxSystemName = new ExtendedControls.TextBoxBorder();
-            this.textBoxCoordinateX = new ExtendedControls.TextBoxBorder();
-            this.textBoxCoordinateY = new ExtendedControls.TextBoxBorder();
-            this.textBoxCoordinateZ = new ExtendedControls.TextBoxBorder();
-            this.radioButtonAlgorithmJs = new ExtendedControls.RadioButtonCustom();
-            this.radioButtonAlgorithmCsharp = new ExtendedControls.RadioButtonCustom();
             this.trilatContextMenu.SuspendLayout();
             this.panelImplementation.SuspendLayout();
             this.wantedContextMenu.SuspendLayout();
@@ -185,6 +185,42 @@
             this.labelAlgorithm.TabIndex = 2;
             this.labelAlgorithm.Text = "Algorithm:";
             //
+            // radioButtonAlgorithmJs
+            //
+            this.radioButtonAlgorithmJs.AutoSize = true;
+            this.radioButtonAlgorithmJs.FontNerfReduction = 0.5F;
+            this.radioButtonAlgorithmJs.Location = new System.Drawing.Point(3, 27);
+            this.radioButtonAlgorithmJs.MouseOverColor = System.Drawing.Color.CornflowerBlue;
+            this.radioButtonAlgorithmJs.Name = "radioButtonAlgorithmJs";
+            this.radioButtonAlgorithmJs.RadioButtonColor = System.Drawing.Color.Gray;
+            this.radioButtonAlgorithmJs.RadioButtonInnerColor = System.Drawing.Color.White;
+            this.radioButtonAlgorithmJs.SelectedColor = System.Drawing.Color.DarkBlue;
+            this.radioButtonAlgorithmJs.SelectedColorRing = System.Drawing.Color.Black;
+            this.radioButtonAlgorithmJs.Size = new System.Drawing.Size(37, 17);
+            this.radioButtonAlgorithmJs.TabIndex = 1;
+            this.radioButtonAlgorithmJs.Text = "JS";
+            this.toolTipAlgorithm.SetToolTip(this.radioButtonAlgorithmJs, "Original algoritthm from ed-systems, written in Javascript (slower)");
+            this.radioButtonAlgorithmJs.UseVisualStyleBackColor = true;
+            //
+            // radioButtonAlgorithmCsharp
+            //
+            this.radioButtonAlgorithmCsharp.AutoSize = true;
+            this.radioButtonAlgorithmCsharp.Checked = true;
+            this.radioButtonAlgorithmCsharp.FontNerfReduction = 0.5F;
+            this.radioButtonAlgorithmCsharp.Location = new System.Drawing.Point(3, 44);
+            this.radioButtonAlgorithmCsharp.MouseOverColor = System.Drawing.Color.CornflowerBlue;
+            this.radioButtonAlgorithmCsharp.Name = "radioButtonAlgorithmCsharp";
+            this.radioButtonAlgorithmCsharp.RadioButtonColor = System.Drawing.Color.Gray;
+            this.radioButtonAlgorithmCsharp.RadioButtonInnerColor = System.Drawing.Color.White;
+            this.radioButtonAlgorithmCsharp.SelectedColor = System.Drawing.Color.DarkBlue;
+            this.radioButtonAlgorithmCsharp.SelectedColorRing = System.Drawing.Color.Black;
+            this.radioButtonAlgorithmCsharp.Size = new System.Drawing.Size(39, 17);
+            this.radioButtonAlgorithmCsharp.TabIndex = 0;
+            this.radioButtonAlgorithmCsharp.TabStop = true;
+            this.radioButtonAlgorithmCsharp.Text = "C#";
+            this.toolTipAlgorithm.SetToolTip(this.radioButtonAlgorithmCsharp, "Algorithm from ed-systems rewritten to C# (fast, experimental)");
+            this.radioButtonAlgorithmCsharp.UseVisualStyleBackColor = true;
+            //
             // wantedContextMenu
             //
             this.wantedContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -218,7 +254,7 @@
             this.toolStripButtonMap});
             this.toolStrip1.Location = new System.Drawing.Point(0, 0);
             this.toolStrip1.Name = "toolStrip1";
-            this.toolStrip1.Size = new System.Drawing.Size(1030, 25);
+            this.toolStrip1.Size = new System.Drawing.Size(924, 25);
             this.toolStrip1.TabIndex = 23;
             this.toolStrip1.Text = "toolStrip1";
             //
@@ -297,8 +333,19 @@
             this.panel_controls.Dock = System.Windows.Forms.DockStyle.Top;
             this.panel_controls.Location = new System.Drawing.Point(0, 25);
             this.panel_controls.Name = "panel_controls";
-            this.panel_controls.Size = new System.Drawing.Size(1030, 74);
+            this.panel_controls.Size = new System.Drawing.Size(924, 74);
             this.panel_controls.TabIndex = 24;
+            //
+            // textBox_status
+            //
+            this.textBox_status.BorderColor = System.Drawing.Color.Transparent;
+            this.textBox_status.BorderColorScaling = 0.5F;
+            this.textBox_status.BorderStyle = System.Windows.Forms.BorderStyle.None;
+            this.textBox_status.Location = new System.Drawing.Point(102, 4);
+            this.textBox_status.Name = "textBox_status";
+            this.textBox_status.ReadOnly = true;
+            this.textBox_status.Size = new System.Drawing.Size(167, 13);
+            this.textBox_status.TabIndex = 21;
             //
             // labelstpos
             //
@@ -309,6 +356,53 @@
             this.labelstpos.TabIndex = 20;
             this.labelstpos.Text = "Current Status:";
             //
+            // textBoxSystemName
+            //
+            this.textBoxSystemName.BorderColor = System.Drawing.Color.Transparent;
+            this.textBoxSystemName.BorderColorScaling = 0.5F;
+            this.textBoxSystemName.BorderStyle = System.Windows.Forms.BorderStyle.None;
+            this.textBoxSystemName.Location = new System.Drawing.Point(72, 25);
+            this.textBoxSystemName.Name = "textBoxSystemName";
+            this.textBoxSystemName.ReadOnly = true;
+            this.textBoxSystemName.Size = new System.Drawing.Size(178, 13);
+            this.textBoxSystemName.TabIndex = 1;
+            //
+            // textBoxCoordinateX
+            //
+            this.textBoxCoordinateX.BorderColor = System.Drawing.Color.Transparent;
+            this.textBoxCoordinateX.BorderColorScaling = 0.5F;
+            this.textBoxCoordinateX.Location = new System.Drawing.Point(165, 46);
+            this.textBoxCoordinateX.Name = "textBoxCoordinateX";
+            this.textBoxCoordinateX.ReadOnly = true;
+            this.textBoxCoordinateX.Size = new System.Drawing.Size(60, 20);
+            this.textBoxCoordinateX.TabIndex = 6;
+            this.textBoxCoordinateX.Text = "?";
+            this.textBoxCoordinateX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            //
+            // textBoxCoordinateY
+            //
+            this.textBoxCoordinateY.BorderColor = System.Drawing.Color.Transparent;
+            this.textBoxCoordinateY.BorderColorScaling = 0.5F;
+            this.textBoxCoordinateY.Location = new System.Drawing.Point(245, 46);
+            this.textBoxCoordinateY.Name = "textBoxCoordinateY";
+            this.textBoxCoordinateY.ReadOnly = true;
+            this.textBoxCoordinateY.Size = new System.Drawing.Size(60, 20);
+            this.textBoxCoordinateY.TabIndex = 8;
+            this.textBoxCoordinateY.Text = "?";
+            this.textBoxCoordinateY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            //
+            // textBoxCoordinateZ
+            //
+            this.textBoxCoordinateZ.BorderColor = System.Drawing.Color.Transparent;
+            this.textBoxCoordinateZ.BorderColorScaling = 0.5F;
+            this.textBoxCoordinateZ.Location = new System.Drawing.Point(325, 46);
+            this.textBoxCoordinateZ.Name = "textBoxCoordinateZ";
+            this.textBoxCoordinateZ.ReadOnly = true;
+            this.textBoxCoordinateZ.Size = new System.Drawing.Size(60, 20);
+            this.textBoxCoordinateZ.TabIndex = 10;
+            this.textBoxCoordinateZ.Text = "?";
+            this.textBoxCoordinateZ.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            //
             // splitContainerCustom1
             //
             this.splitContainerCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -324,8 +418,9 @@
             // splitContainerCustom1.Panel2
             //
             this.splitContainerCustom1.Panel2.Controls.Add(this.dataViewScroller_Wanted);
-            this.splitContainerCustom1.Size = new System.Drawing.Size(993, 449);
-            this.splitContainerCustom1.SplitterDistance = 541;
+            this.splitContainerCustom1.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 0, 50);
+            this.splitContainerCustom1.Size = new System.Drawing.Size(892, 521);
+            this.splitContainerCustom1.SplitterDistance = 484;
             this.splitContainerCustom1.TabIndex = 25;
             //
             // splitContainerCustom2
@@ -342,8 +437,9 @@
             // splitContainerCustom2.Panel2
             //
             this.splitContainerCustom2.Panel2.Controls.Add(this.richTextBox_History);
-            this.splitContainerCustom2.Size = new System.Drawing.Size(541, 449);
-            this.splitContainerCustom2.SplitterDistance = 276;
+            this.splitContainerCustom2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 0, 50);
+            this.splitContainerCustom2.Size = new System.Drawing.Size(484, 521);
+            this.splitContainerCustom2.SplitterDistance = 317;
             this.splitContainerCustom2.TabIndex = 0;
             //
             // dataViewScroller_Distances
@@ -355,7 +451,7 @@
             this.dataViewScroller_Distances.Location = new System.Drawing.Point(0, 0);
             this.dataViewScroller_Distances.Name = "dataViewScroller_Distances";
             this.dataViewScroller_Distances.ScrollBarWidth = 20;
-            this.dataViewScroller_Distances.Size = new System.Drawing.Size(541, 276);
+            this.dataViewScroller_Distances.Size = new System.Drawing.Size(484, 317);
             this.dataViewScroller_Distances.TabIndex = 0;
             this.dataViewScroller_Distances.VerticalScrollBarDockRight = true;
             //
@@ -370,13 +466,13 @@
             this.vScrollBarCustom1.FlatStyle = System.Windows.Forms.FlatStyle.System;
             this.vScrollBarCustom1.HideScrollBar = false;
             this.vScrollBarCustom1.LargeChange = 1;
-            this.vScrollBarCustom1.Location = new System.Drawing.Point(521, 21);
+            this.vScrollBarCustom1.Location = new System.Drawing.Point(464, 21);
             this.vScrollBarCustom1.Maximum = 0;
             this.vScrollBarCustom1.Minimum = 0;
             this.vScrollBarCustom1.MouseOverButtonColor = System.Drawing.Color.Green;
             this.vScrollBarCustom1.MousePressedButtonColor = System.Drawing.Color.Red;
             this.vScrollBarCustom1.Name = "vScrollBarCustom1";
-            this.vScrollBarCustom1.Size = new System.Drawing.Size(20, 255);
+            this.vScrollBarCustom1.Size = new System.Drawing.Size(20, 296);
             this.vScrollBarCustom1.SliderColor = System.Drawing.Color.DarkGray;
             this.vScrollBarCustom1.SmallChange = 1;
             this.vScrollBarCustom1.TabIndex = 1;
@@ -401,7 +497,7 @@
             this.dataGridViewDistances.Location = new System.Drawing.Point(0, 0);
             this.dataGridViewDistances.Name = "dataGridViewDistances";
             this.dataGridViewDistances.ScrollBars = System.Windows.Forms.ScrollBars.None;
-            this.dataGridViewDistances.Size = new System.Drawing.Size(521, 276);
+            this.dataGridViewDistances.Size = new System.Drawing.Size(464, 317);
             this.dataGridViewDistances.TabIndex = 0;
             this.dataGridViewDistances.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewDistances_CellClick);
             this.dataGridViewDistances.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewDistances_CellEndEdit);
@@ -452,7 +548,7 @@
             this.richTextBox_History.Name = "richTextBox_History";
             this.richTextBox_History.ScrollBarWidth = 20;
             this.richTextBox_History.ShowLineCount = false;
-            this.richTextBox_History.Size = new System.Drawing.Size(541, 169);
+            this.richTextBox_History.Size = new System.Drawing.Size(484, 150);
             this.richTextBox_History.TabIndex = 0;
             //
             // dataViewScroller_Wanted
@@ -464,7 +560,7 @@
             this.dataViewScroller_Wanted.Location = new System.Drawing.Point(0, 0);
             this.dataViewScroller_Wanted.Name = "dataViewScroller_Wanted";
             this.dataViewScroller_Wanted.ScrollBarWidth = 20;
-            this.dataViewScroller_Wanted.Size = new System.Drawing.Size(448, 449);
+            this.dataViewScroller_Wanted.Size = new System.Drawing.Size(404, 471);
             this.dataViewScroller_Wanted.TabIndex = 0;
             this.dataViewScroller_Wanted.VerticalScrollBarDockRight = true;
             //
@@ -479,13 +575,13 @@
             this.vScrollBarCustom2.FlatStyle = System.Windows.Forms.FlatStyle.System;
             this.vScrollBarCustom2.HideScrollBar = false;
             this.vScrollBarCustom2.LargeChange = 0;
-            this.vScrollBarCustom2.Location = new System.Drawing.Point(428, 21);
+            this.vScrollBarCustom2.Location = new System.Drawing.Point(384, 21);
             this.vScrollBarCustom2.Maximum = -1;
             this.vScrollBarCustom2.Minimum = 0;
             this.vScrollBarCustom2.MouseOverButtonColor = System.Drawing.Color.Green;
             this.vScrollBarCustom2.MousePressedButtonColor = System.Drawing.Color.Red;
             this.vScrollBarCustom2.Name = "vScrollBarCustom2";
-            this.vScrollBarCustom2.Size = new System.Drawing.Size(20, 428);
+            this.vScrollBarCustom2.Size = new System.Drawing.Size(20, 450);
             this.vScrollBarCustom2.SliderColor = System.Drawing.Color.DarkGray;
             this.vScrollBarCustom2.SmallChange = 1;
             this.vScrollBarCustom2.TabIndex = 14;
@@ -523,7 +619,7 @@
             this.dataGridViewClosestSystems.ReadOnly = true;
             this.dataGridViewClosestSystems.RowHeadersVisible = false;
             this.dataGridViewClosestSystems.ScrollBars = System.Windows.Forms.ScrollBars.None;
-            this.dataGridViewClosestSystems.Size = new System.Drawing.Size(428, 449);
+            this.dataGridViewClosestSystems.Size = new System.Drawing.Size(384, 471);
             this.dataGridViewClosestSystems.TabIndex = 13;
             this.dataGridViewClosestSystems.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridViewClosestSystems_CellMouseClick);
             //
@@ -540,100 +636,6 @@
             this.dataGridViewTextBoxColumnClosestSystemsSystem.MinimumWidth = 100;
             this.dataGridViewTextBoxColumnClosestSystemsSystem.Name = "dataGridViewTextBoxColumnClosestSystemsSystem";
             this.dataGridViewTextBoxColumnClosestSystemsSystem.ReadOnly = true;
-            //
-            // textBox_status
-            //
-            this.textBox_status.BorderColor = System.Drawing.Color.Transparent;
-            this.textBox_status.BorderColorScaling = 0.5F;
-            this.textBox_status.BorderStyle = System.Windows.Forms.BorderStyle.None;
-            this.textBox_status.Location = new System.Drawing.Point(102, 4);
-            this.textBox_status.Name = "textBox_status";
-            this.textBox_status.ReadOnly = true;
-            this.textBox_status.Size = new System.Drawing.Size(167, 13);
-            this.textBox_status.TabIndex = 21;
-            //
-            // textBoxSystemName
-            //
-            this.textBoxSystemName.BorderColor = System.Drawing.Color.Transparent;
-            this.textBoxSystemName.BorderColorScaling = 0.5F;
-            this.textBoxSystemName.BorderStyle = System.Windows.Forms.BorderStyle.None;
-            this.textBoxSystemName.Location = new System.Drawing.Point(72, 25);
-            this.textBoxSystemName.Name = "textBoxSystemName";
-            this.textBoxSystemName.ReadOnly = true;
-            this.textBoxSystemName.Size = new System.Drawing.Size(178, 13);
-            this.textBoxSystemName.TabIndex = 1;
-            //
-            // textBoxCoordinateX
-            //
-            this.textBoxCoordinateX.BorderColor = System.Drawing.Color.Transparent;
-            this.textBoxCoordinateX.BorderColorScaling = 0.5F;
-            this.textBoxCoordinateX.Location = new System.Drawing.Point(165, 46);
-            this.textBoxCoordinateX.Name = "textBoxCoordinateX";
-            this.textBoxCoordinateX.ReadOnly = true;
-            this.textBoxCoordinateX.Size = new System.Drawing.Size(60, 20);
-            this.textBoxCoordinateX.TabIndex = 6;
-            this.textBoxCoordinateX.Text = "?";
-            this.textBoxCoordinateX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            //
-            // textBoxCoordinateY
-            //
-            this.textBoxCoordinateY.BorderColor = System.Drawing.Color.Transparent;
-            this.textBoxCoordinateY.BorderColorScaling = 0.5F;
-            this.textBoxCoordinateY.Location = new System.Drawing.Point(245, 46);
-            this.textBoxCoordinateY.Name = "textBoxCoordinateY";
-            this.textBoxCoordinateY.ReadOnly = true;
-            this.textBoxCoordinateY.Size = new System.Drawing.Size(60, 20);
-            this.textBoxCoordinateY.TabIndex = 8;
-            this.textBoxCoordinateY.Text = "?";
-            this.textBoxCoordinateY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            //
-            // textBoxCoordinateZ
-            //
-            this.textBoxCoordinateZ.BorderColor = System.Drawing.Color.Transparent;
-            this.textBoxCoordinateZ.BorderColorScaling = 0.5F;
-            this.textBoxCoordinateZ.Location = new System.Drawing.Point(325, 46);
-            this.textBoxCoordinateZ.Name = "textBoxCoordinateZ";
-            this.textBoxCoordinateZ.ReadOnly = true;
-            this.textBoxCoordinateZ.Size = new System.Drawing.Size(60, 20);
-            this.textBoxCoordinateZ.TabIndex = 10;
-            this.textBoxCoordinateZ.Text = "?";
-            this.textBoxCoordinateZ.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            //
-            // radioButtonAlgorithmJs
-            //
-            this.radioButtonAlgorithmJs.AutoSize = true;
-            this.radioButtonAlgorithmJs.FontNerfReduction = 0.5F;
-            this.radioButtonAlgorithmJs.Location = new System.Drawing.Point(3, 27);
-            this.radioButtonAlgorithmJs.MouseOverColor = System.Drawing.Color.CornflowerBlue;
-            this.radioButtonAlgorithmJs.Name = "radioButtonAlgorithmJs";
-            this.radioButtonAlgorithmJs.RadioButtonColor = System.Drawing.Color.Gray;
-            this.radioButtonAlgorithmJs.RadioButtonInnerColor = System.Drawing.Color.White;
-            this.radioButtonAlgorithmJs.SelectedColor = System.Drawing.Color.DarkBlue;
-            this.radioButtonAlgorithmJs.SelectedColorRing = System.Drawing.Color.Black;
-            this.radioButtonAlgorithmJs.Size = new System.Drawing.Size(37, 17);
-            this.radioButtonAlgorithmJs.TabIndex = 1;
-            this.radioButtonAlgorithmJs.Text = "JS";
-            this.toolTipAlgorithm.SetToolTip(this.radioButtonAlgorithmJs, "Original algoritthm from ed-systems, written in Javascript (slower)");
-            this.radioButtonAlgorithmJs.UseVisualStyleBackColor = true;
-            //
-            // radioButtonAlgorithmCsharp
-            //
-            this.radioButtonAlgorithmCsharp.AutoSize = true;
-            this.radioButtonAlgorithmCsharp.Checked = true;
-            this.radioButtonAlgorithmCsharp.FontNerfReduction = 0.5F;
-            this.radioButtonAlgorithmCsharp.Location = new System.Drawing.Point(3, 44);
-            this.radioButtonAlgorithmCsharp.MouseOverColor = System.Drawing.Color.CornflowerBlue;
-            this.radioButtonAlgorithmCsharp.Name = "radioButtonAlgorithmCsharp";
-            this.radioButtonAlgorithmCsharp.RadioButtonColor = System.Drawing.Color.Gray;
-            this.radioButtonAlgorithmCsharp.RadioButtonInnerColor = System.Drawing.Color.White;
-            this.radioButtonAlgorithmCsharp.SelectedColor = System.Drawing.Color.DarkBlue;
-            this.radioButtonAlgorithmCsharp.SelectedColorRing = System.Drawing.Color.Black;
-            this.radioButtonAlgorithmCsharp.Size = new System.Drawing.Size(39, 17);
-            this.radioButtonAlgorithmCsharp.TabIndex = 0;
-            this.radioButtonAlgorithmCsharp.TabStop = true;
-            this.radioButtonAlgorithmCsharp.Text = "C#";
-            this.toolTipAlgorithm.SetToolTip(this.radioButtonAlgorithmCsharp, "Algorithm from ed-systems rewritten to C# (fast, experimental)");
-            this.radioButtonAlgorithmCsharp.UseVisualStyleBackColor = true;
             //
             // TrilaterationControl
             //
@@ -643,7 +645,7 @@
             this.Controls.Add(this.panel_controls);
             this.Controls.Add(this.toolStrip1);
             this.Name = "TrilaterationControl";
-            this.Size = new System.Drawing.Size(1030, 562);
+            this.Size = new System.Drawing.Size(924, 681);
             this.trilatContextMenu.ResumeLayout(false);
             this.panelImplementation.ResumeLayout(false);
             this.panelImplementation.PerformLayout();


ドロップ履歴：表示とソートの改善

ドロップ履歴：表示とソートの改善

＋難易度を * 以外にすると落ちる不具合の修正

--- ElectronicObserver/Window/Dialog/DialogDropRecordViewer.cs
+++ ElectronicObserver/Window/Dialog/DialogDropRecordViewer.cs
@@ -151,6 +151,14 @@
 			return sb.ToString();
 		}

+		private string GetMapString( int serialID, bool insertEnemyFleetName = true ) {
+			return GetMapString( serialID >> 24 & 0xFF, serialID >> 16 & 0xFF, serialID >> 8 & 0xFF, ( serialID & 1 ) != 0, (sbyte)( ( serialID >> 1 & 0x7F ) << 1 ) >> 1, insertEnemyFleetName );
+		}
+
+		private int GetMapSerialID( int maparea, int mapinfo, int cell, bool isboss, int difficulty = -1 ) {
+			return ( maparea & 0xFF ) << 24 | ( mapinfo & 0xFF ) << 16 | ( cell & 0xFF ) << 8 | ( difficulty & 0x7F ) << 1 | ( isboss ? 1 : 0 );
+		}
+

 		private void ButtonRun_Click( object sender, EventArgs e ) {

@@ -191,7 +199,7 @@
 				DropView_Date.Width = 150;
 				DropView_Date.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
 				DropView_Map.HeaderText = "海域";
-				DropView_Map.Width = 120;
+				DropView_Map.Width = 240;
 				DropView_Map.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
 				DropView_Rank.HeaderText = "ランク";
 				DropView_Rank.Width = 40;
@@ -351,7 +359,7 @@
 								continue;
 							break;
 					}
-					if ( difficulty != MapAny && int.Parse( difficulty ) != r.Difficulty )
+					if ( difficulty != MapAny && difficulty != Constants.GetDifficulty( r.Difficulty ) )
 						continue;

@@ -360,7 +368,7 @@
 						string key;

 						if ( priorityContent == 2 ) {
-							key = GetMapString( r.MapAreaID, r.MapInfoID, r.CellID, r.IsBossNode, difficulty == MapAny ? -1 : r.Difficulty, false );
+							key = GetMapSerialID( r.MapAreaID, r.MapInfoID, r.CellID, r.IsBossNode, difficulty == MapAny ? -1 : r.Difficulty ).ToString( "X8" );

 						} else {
 							key = GetContentString( r, priorityShip < priorityItem && priorityShip < 2, priorityShip >= priorityItem && priorityItem < 2 );
@@ -440,6 +448,8 @@
 							Constants.GetWinRank( r.Rank )
 							);

+						row.Cells[3].Tag = GetMapSerialID( r.MapAreaID, r.MapInfoID, r.CellID, r.IsBossNode, r.Difficulty );
+
 						rows.AddLast( row );

@@ -449,7 +459,7 @@
 						string key;

 						if ( priorityContent == 2 ) {
-							key = GetMapString( r.MapAreaID, r.MapInfoID, r.CellID, r.IsBossNode, difficulty == MapAny ? -1 : r.Difficulty, false );
+							key = GetMapSerialID( r.MapAreaID, r.MapInfoID, r.CellID, r.IsBossNode, difficulty == MapAny ? -1 : r.Difficulty ).ToString( "X8" );

 						} else {
 							key = GetContentString( r, priorityShip < priorityItem && priorityShip < 2, priorityShip >= priorityItem && priorityItem < 2 );
@@ -492,9 +502,16 @@
 					foreach ( var c in counts ) {
 						var row = (DataGridViewRow)origin.Clone();

+						string name = c.Key;
+
+						int serialID = 0;
+						if ( int.TryParse( name, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out serialID ) )
+							name = GetMapString( serialID );
+
+
 						row.SetValues(
 							c.Value[0],
-							c.Key,
+							name,
 							c.Value[1],
 							c.Value[2],
 							c.Value[3]
@@ -503,18 +520,20 @@

 						if ( priorityContent == 2 ) {
 							row.Cells[0].Tag = allcounts[c.Key][0];
+							row.Cells[1].Tag = serialID;
 							row.Cells[2].Tag = allcounts[c.Key][1];
 							row.Cells[3].Tag = allcounts[c.Key][2];
 							row.Cells[4].Tag = allcounts[c.Key][3];

 						} else {
 							row.Cells[0].Tag = ( (double)c.Value[0] / Math.Max( allcountssum[0], 1 ) );
+							row.Cells[1].Tag = serialID;
 							row.Cells[2].Tag = ( (double)c.Value[1] / Math.Max( allcountssum[1], 1 ) );
 							row.Cells[3].Tag = ( (double)c.Value[2] / Math.Max( allcountssum[2], 1 ) );
 							row.Cells[4].Tag = ( (double)c.Value[3] / Math.Max( allcountssum[3], 1 ) );

 						}
-
+
 						rows.AddLast( row );
 					}

@@ -567,6 +586,27 @@
 						e.SortResult = 1;

 					e.Handled = true;
+
+				} else if ( e.Column.Index == DropView_Name.Index ) {
+					var cell1 = DropView[e.Column.Index, e.RowIndex1];
+					var cell2 = DropView[e.Column.Index, e.RowIndex2];
+
+					if ( cell1.Tag is int ) {		//serialID
+						e.SortResult = (int)cell1.Tag - (int)cell2.Tag;
+						e.Handled = true;
+					}
+				}
+
+			} else {
+
+				if ( e.Column.Index == DropView_Map.Index ) {
+					var cell1 = DropView[e.Column.Index, e.RowIndex1];
+					var cell2 = DropView[e.Column.Index, e.RowIndex2];
+
+					if ( cell1.Tag is int ) {		//serialID
+						e.SortResult = (int)cell1.Tag - (int)cell2.Tag;
+						e.Handled = true;
+					}
 				}
 			}


refactoring

refactoring

--- FAManagementStudio/ViewModels/AdditionalDbInfoViewModel.cs
+++ FAManagementStudio/ViewModels/AdditionalDbInfoViewModel.cs
@@ -11,50 +11,49 @@
     {
         public AdditionalDbInfoViewModel() { }
         public string DisplayName { get; }
-        public IEnumerable<IAddtionalDbInfo> Content { get; }
-        public AdditionalDbInfoViewModel(string name, IEnumerable<IAddtionalDbInfo> content)
+        public AdditionalDbInfoViewModel(string name)
         {
             DisplayName = name;
-            Content = content;
         }
     }

     public class AdditionalDbInfoControl : ViewModelBase
     {
         public object CurrentContent { get; private set; }
-        public List<AdditionalDbInfoViewModel> ContentList { get; } = new List<AdditionalDbInfoViewModel>();
+        public List<AdditionalDbInfoViewModel> ContentList { get; } = new List<AdditionalDbInfoViewModel> {
+            new AdditionalDbInfoViewModel("Triggers") ,new AdditionalDbInfoViewModel("Indexs"),
+            new AdditionalDbInfoViewModel("Domains"), new AdditionalDbInfoViewModel("Procedures")};
         public ICommand ContentChange { get; }
+        private DbViewModel _db;
         public AdditionalDbInfoControl(DbViewModel db)
         {
             ContentChange = new RelayCommand<string>(x => ChangeContent(x));
-
-            RefrechData(db);
-
+            _db = db;
+            CurrentContent = ContentList;
             RaisePropertyChanged(nameof(CurrentContent));
-        }
-
-        public void RefrechData(DbViewModel db)
-        {
-            ContentList.Clear();
-
-            ContentList.Add(new AdditionalDbInfoViewModel("Trigger", db.Triggers));
-            ContentList.Add(new AdditionalDbInfoViewModel("Index", db.Indexes));
-            ContentList.Add(new AdditionalDbInfoViewModel("Domain", db.Domains));
-            ContentList.Add(new AdditionalDbInfoViewModel("Procedures", db.Procedures));
-
-            CurrentContent = ContentList;
         }

         public void ChangeContent(string target)
         {
-            var item = ContentList.Find(x => x.DisplayName == target);
-            if (item == null)
+            if (string.IsNullOrEmpty(target))
             {
                 CurrentContent = ContentList;
             }
-            else
+            else if (target == "Triggers")
             {
-                CurrentContent = item.Content;
+                CurrentContent = _db.Triggers;
+            }
+            else if (target == "Indexs")
+            {
+                CurrentContent = _db.Indexes;
+            }
+            else if (target == "Domains")
+            {
+                CurrentContent = _db.Domains;
+            }
+            else if (target == "Procedures")
+            {
+                CurrentContent = _db.Procedures;
             }
             RaisePropertyChanged(nameof(CurrentContent));
         }


Return task not void

Return task not void

--- GenericFunctionExternalConfig/OMSToSlack/AlertProcessor.cs
+++ GenericFunctionExternalConfig/OMSToSlack/AlertProcessor.cs
@@ -2,6 +2,7 @@
 using OMSToSlack.Models;
 using System;
 using System.Linq;
+using System.Threading.Tasks;

 namespace OMSToSlack
 {
@@ -16,7 +17,7 @@
             _configHelper = new ConfigHelper(context);
         }

-        public async void ProcessAlert(Alert alert)
+        public async Task ProcessAlert(Alert alert)
         {
             var alertConfig = _configHelper.GetAlertConfig(alert);


Bugfix: No more trailing # in titles

Bugfix: No more trailing # in titles

--- GitHubServices/BusinessLogic/TagPageCreator/Domain/Page.cs
+++ GitHubServices/BusinessLogic/TagPageCreator/Domain/Page.cs
@@ -10,7 +10,9 @@

         public Page(string title, string filePath)
         {
-            Title = title;
+            if (title.EndsWith("#"))
+                title = title.Substring(0, title.Length - 1);
+            Title = title.Trim();
             FilePath = filePath.Replace("\\", "/");
             Path = System.IO.Path.GetDirectoryName(filePath).Replace("\\", "/");
         }


deadcode

deadcode

--- AddOns/AngelicVerifierNull/AngelicVerifierNull/Program.cs
+++ AddOns/AngelicVerifierNull/AngelicVerifierNull/Program.cs
@@ -304,6 +304,7 @@
                     Stats.stop("dead.code");
                 }

+

                 Stats.numAssertsAfterAliasAnalysis= CountAsserts(prog);

@@ -782,6 +783,7 @@
                     if (inconsistent.Count != 0)
                     {
                         Debug.Assert(inconsistent.Contains(constraintId));
+                        Console.WriteLine("Hard constraint inconsistenct detected: ", inconsistent.Print());
                         // drop asserts
                         PrintAndSuppressAssert(instr, pendingTraces.Where(tup => inconsistent.Contains(tup.Key)).Select(tup => tup.Value));
                         // drop traces
@@ -806,7 +808,7 @@
         {
             // only consider the given entrypoint
             var blocked = false;
-            if (!instr.InBlockingMode())
+            if (!instr.InBlockingMode() && entrypoint != null)
             {
                 blocked = true;
                 instr.BlockAllButThis(entrypoint);
@@ -1133,6 +1135,9 @@

             var instr = new AvnInstrumentation(harnessInstrumentation);
             prog = instr.run(prog);
+
+            // dead code
+            RelaxEnvironmentConstraints(instr, null);

             Stats.resume("round.robin");
             //Run Corral in a round robin manner to remove simple procedures/find shallow bugs


don't need this anymore

don't need this anymore

--- App/StackExchange.DataExplorer/Views/Shared/Master.cshtml
+++ App/StackExchange.DataExplorer/Views/Shared/Master.cshtml
@@ -12,7 +12,7 @@
     @Html.Raw(AssetPackager.LinkCss("sitecss"))
     @RenderSection("additionalStyles", required: false)

-razor
+


Default .Net Core 2.x to 2.1 as all other versions are now unsupported.

--- AudioWorks/src/AudioWorks.Extensibility/RuntimeChecker.cs
+++ AudioWorks/src/AudioWorks.Extensibility/RuntimeChecker.cs
@@ -37,9 +37,9 @@
                 StringComparison.Ordinal))
                 return $"net{GetFrameworkVersion()}";

-            // .NET Core 2.x didn't report the version correctly. Assume they are v2.0
+            // .NET Core 2.x didn't report the version correctly. Assume they are v2.1
             var version = Version.Parse(RuntimeInformation.FrameworkDescription.Substring(RuntimeInformation.FrameworkDescription.LastIndexOf(' ')));
-            return version.Major == 4 ? "netcoreapp2.0" : $"netcoreapp{version.ToString(2)}";
+            return version.Major == 4 ? "netcoreapp2.1" : $"netcoreapp{version.ToString(2)}";
 #else
             var version = Version.Parse(RuntimeInformation.FrameworkDescription.Substring(RuntimeInformation.FrameworkDescription.LastIndexOf(' ')));
             return $"netcoreapp{version.ToString(2)}";


OpenTK Backend Tweaks #CHANGE: Failing with an explicit exception when attempting to invoke OpenGL functionality without having a context.

--- Backend/DefaultOpenTK/Backend/Graphics/GraphicsBackend.cs
+++ Backend/DefaultOpenTK/Backend/Graphics/GraphicsBackend.cs
@@ -16,6 +16,8 @@
 	[DontSerialize]
 	public class GraphicsBackend : IGraphicsBackend, IVertexUploader
 	{
+		private static readonly Version MinOpenGLVersion = new Version(2, 1);
+
 		private static GraphicsBackend activeInstance = null;
 		public static GraphicsBackend ActiveInstance
 		{
@@ -687,6 +689,9 @@

 		public static void LogOpenGLSpecs()
 		{
+			// Accessing OpenGL functionality requires context. Don't get confused by AccessViolationExceptions, fail better instead.
+			GraphicsContext.Assert();
+
 			try
 			{
 				CheckOpenGLErrors();
@@ -706,7 +711,7 @@
 					Version version;
 					if (Version.TryParse(token[i], out version))
 					{
-						if (version.Major < 2 && version.Minor < 1)
+						if (version.Major < MinOpenGLVersion.Major && version.Minor < MinOpenGLVersion.Minor)
 						{
 							Log.Core.WriteWarning("The detected OpenGL version {0} appears to be lower than the required minimum. OpenGL 2.1 or higher is required to run Duality applications.");
 						}
@@ -727,6 +732,9 @@
 		/// <returns>True, if an error occurred, false if not.</returns>
 		public static bool CheckOpenGLErrors(bool silent = false, [CallerMemberName] string callerInfoMember = null, [CallerFilePath] string callerInfoFile = null, [CallerLineNumber] int callerInfoLine = -1)
 		{
+			// Accessing OpenGL functionality requires context. Don't get confused by AccessViolationExceptions, fail better instead.
+			GraphicsContext.Assert();
+
 			ErrorCode error;
 			bool found = false;
 			while ((error = GL.GetError()) != ErrorCode.NoError)


start Cap Bank Analytic Engine on Service Start

--- Source/Applications/openXDA/openXDA/ExtensibleDisturbanceAnalysisEngine.cs
+++ Source/Applications/openXDA/openXDA/ExtensibleDisturbanceAnalysisEngine.cs
@@ -282,6 +282,7 @@
         private int m_meterTaskCount;

         private EventEmailEngine m_eventEmailEngine;
+        private CapBankAnalyticEngine m_capBankAnalyticEngine;

         private bool m_stopped;
         private bool m_disposed;
@@ -452,6 +453,10 @@
             // Setup new email engine to send emails when an event occurs
             if ((object)m_eventEmailEngine == null)
                 m_eventEmailEngine = new EventEmailEngine();
+
+            // Setup new CapBank Analytic engine to Analyze Capacitor Banks when an event occurs
+            if ((object)m_capBankAnalyticEngine == null)
+                m_capBankAnalyticEngine = new CapBankAnalyticEngine();

             // Setup new file processor to monitor the watch directories
             if ((object)m_fileProcessor == null)
@@ -1554,6 +1559,9 @@
             ProcessMeterDataSet(state.MeterDataSet);
             OnStatusMessage($"Finished processing file '{filePath}'.");

+            // Send data set to CapBank Analytic engine for processing
+            m_capBankAnalyticEngine.Process(state.MeterDataSet);
+
             // Send data set to email engine for processing
             m_eventEmailEngine.Process(state.MeterDataSet);
         }


更新进度时清空消息

更新进度时清空消息

--- Install4ibas.UI/FormControl/InstallationProgressControl.cs
+++ Install4ibas.UI/FormControl/InstallationProgressControl.cs
@@ -87,6 +87,7 @@
             {
                 if (e.ScheduleValue > 0 && e.ScheduleValue <= 100) this.progressBar.Value = e.ScheduleValue;
                 this.lab_Schedule.Text = e.Message;
+                this.lab_Msg.Text = "";
             }
             Application.DoEvents();
         }


Reversing order of IDisposables.

Reversing order of IDisposables.

--- Source/Container/Machine.Container/Plugins/Disposition/DisposablePlugin.cs
+++ Source/Container/Machine.Container/Plugins/Disposition/DisposablePlugin.cs
@@ -28,8 +28,10 @@
     {
       IDisposable disposable = activation.Instance as IDisposable;
       if (disposable == null) return;
+      /* Get Reader Lock */
       if (!_disposables.Contains(disposable))
       {
+        /* Get Writer Lock */
         _disposables.Add(disposable);
       }
     }
@@ -38,6 +40,7 @@
     {
       IDisposable disposable = deactivation.Instance as IDisposable;
       if (disposable == null) return;
+      /* Get Writer Lock */
       disposable.Dispose();
       _disposables.Remove(disposable);
     }
@@ -46,6 +49,8 @@
     #region IDisposable Members
     public override void Dispose()
     {
+      /* Get Writer Lock */
+      _disposables.Reverse();
       while (_disposables.Count > 0)
       {
         _disposables[0].Dispose();


fix schedule access last time

fix schedule access last time

--- JoinRpg.WebPortal.Managers/Schedule/SchedulePageManager.cs
+++ JoinRpg.WebPortal.Managers/Schedule/SchedulePageManager.cs
@@ -183,9 +183,13 @@

             bool HasAccess(ProjectField roomField)
             {
+                if (roomField.IsPublic)
+                {
+                    return true;
+                }
                 if (CurrentUserAccessor.UserIdOrDefault is null)
                 {
-                    return roomField.IsPublic;
+                    return false;
                 }
                 if (project.HasMasterAccess(CurrentUserAccessor.UserId))
                 {


Fixed long delay at the end of CSU due to a database timeout when attempting to fix the node table format.

--- Source/Tools/ConfigurationSetupUtility/Screens/SetupCompleteScreen.xaml.cs
+++ Source/Tools/ConfigurationSetupUtility/Screens/SetupCompleteScreen.xaml.cs
@@ -234,8 +234,11 @@
                         // Always make sure that all three needed roles are available for each defined node(s) in the database
                         ValidateSecurityRoles();

-                        // Convert node table to new format (i.e., columns to connection settings string), if nedded
-                        ConvertNodeTableFormat();
+                        if (migrate)
+                        {
+                            // Convert node table to new format (i.e., columns to connection settings string), if needed
+                            ConvertNodeTableFormat();
+                        }

                         // Remove old configuration file settings
                         try


Whoops, forgot to check in the updated unit test.

--- SubtextSolution/UnitTests.Subtext/Framework/Syndication/OpmlWriterTests.cs
+++ SubtextSolution/UnitTests.Subtext/Framework/Syndication/OpmlWriterTests.cs
@@ -32,8 +32,7 @@
             opml.Write(blogs, writer, urlHelper.Object);

             //assert
-            string expected =
-                @"<opml version=""1.0"">
+            const string expected = @"<opml version=""1.0"">
 	<head>
 		<title>A Subtext Community</title>
 	</head>


Changes types in CTransform

Changes types in CTransform

--- ValveResourceFormat/Resource/ResourceTypes/NTROSerialization/CTransform.cs
+++ ValveResourceFormat/Resource/ResourceTypes/NTROSerialization/CTransform.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Numerics;

 namespace ValveResourceFormat.ResourceTypes.NTROSerialization
 {
@@ -7,10 +8,9 @@
     /// </summary>
     public class CTransform
     {
-        /// <summary>
-        /// Gets the matrix values.
-        /// </summary>
-        public float[] Values { get; }
+        public Quaternion Q { get; }
+        public Vector3 P { get; }
+        public float Scale { get; } // TODO: Unconfirmed? resourceinfo appears to not print this field at all

         /// <summary>
         /// Initializes a new instance of the <see cref="CTransform"/> class.
@@ -25,23 +25,15 @@
         /// <param name="field7">Eighth item of the matrix.</param>
         public CTransform(float field0, float field1, float field2, float field3, float field4, float field5, float field6, float field7)
         {
-            Values = new[]
-            {
-                field0,
-                field1,
-                field2,
-                field3,
-                field4,
-                field5,
-                field6,
-                field7,
-            };
+            Q = new Quaternion(field4, field5, field6, field7);
+            P = new Vector3(field0, field1, field2);
+            Scale = field3;
         }

         public override string ToString()
         {
             // http://stackoverflow.com/a/15085178/2200891
-            return string.Format("q={{{0:F2}, {1:F2}, {2:F2}; w={3}}} p={{{4:F2}, {5:F2}, {6}}}", Values[4], Values[5], Values[6], Values[7].ToString("F2"), Values[0], Values[1], Values[2].ToString("F2"));
+            return string.Format("q={{{0:F2}, {1:F2}, {2:F2}; w={3}}} p={{{4:F2}, {5:F2}, {6}}}", Q.X, Q.Y, Q.Z, Q.W.ToString("F2"), P.X, P.Y, P.Z.ToString("F2"));
         }
     }
 }


Apply code review

Apply code review

--- WindowsAzurePowershell/src/Management.Utilities/Common/SubscriptionData.cs
+++ WindowsAzurePowershell/src/Management.Utilities/Common/SubscriptionData.cs
@@ -18,6 +18,7 @@
     using System.Security.Cryptography.X509Certificates;
     using System.ServiceModel;
     using System.ServiceModel.Channels;
+    using Microsoft.WindowsAzure.Management.Utilities.CloudService;
     using Microsoft.WindowsAzure.Storage;
     using Microsoft.WindowsAzure.Storage.Auth;
     using ServiceManagement;
@@ -50,7 +51,10 @@
             string serviceEndpoint = string.IsNullOrEmpty(ServiceEndpoint) ?
                 Microsoft.WindowsAzure.Management.Utilities.Common.ConfigurationConstants.ServiceManagementEndpoint :
                 ServiceEndpoint;
-            IServiceManagement channel = ServiceManagementHelper.CreateServiceManagementChannel<IServiceManagement>(serviceBinding, new Uri(ServiceEndpoint), Certificate);
+            IServiceManagement channel = ServiceManagementHelper.CreateServiceManagementChannel<IServiceManagement>(
+                serviceBinding,
+                new Uri(ServiceEndpoint),
+                Certificate);

             return GetCurrentStorageAccount(channel);
         }
@@ -90,12 +94,15 @@
                 var storageServiceKeys = channel.GetStorageKeys(
                     subscriptionData.SubscriptionId,
                     subscriptionData.CurrentStorageAccount);
-
+
                 if (storageService != null && storageServiceKeys != null)
                 {
                     currentStorage = new CloudStorageAccount(new StorageCredentials(
                         storageService.ServiceName,
-                        storageServiceKeys.StorageServiceKeys.Primary), true);
+                        storageServiceKeys.StorageServiceKeys.Primary),
+                        new Uri(storageService.StorageServiceProperties.Endpoints[0]),
+                        new Uri(storageService.StorageServiceProperties.Endpoints[1]),
+                        new Uri(storageService.StorageServiceProperties.Endpoints[2]));
                 }
             }


doc: help text update

doc: help text update

--- nautilus/DeployCommand.cs
+++ nautilus/DeployCommand.cs
@@ -16,7 +16,7 @@
         [Option('w', "wait", Required = false, HelpText = "Specifies whether to wait for each deployment to complete before exiting.")]
         public bool Wait { get; set; }

-        [Option('f', "force", Required = false, HelpText = "Specifies whether to force redeployment of releases to this machine.")]
+        [Option('f', "force", Required = false, HelpText = "Specifies whether to force redeployment of releases to the target machine.")]
         public bool Force { get; set; }

         [Option('o', "nonce", Required = false, HelpText = "An arbritrary value to ensure that a deploy is only run once.  If the specified value matches a value previously used, this deploy will be prevented. The value is stored in an environment variable (NAUTILUS_NONCE) on the local machine.")]


Refactor

Refactor

--- BotSample/EmotionBotApi/Controllers/MessagesController.cs
+++ BotSample/EmotionBotApi/Controllers/MessagesController.cs
@@ -19,25 +19,26 @@
         /// </summary>
         public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
         {
-            if (activity.Type == ActivityTypes.Message)
-            {
-                ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
-                // calculate something for us to return
-                int length = (activity.Text ?? string.Empty).Length;
+            if (activity.Type != ActivityTypes.Message)
+                return Request.CreateResponse(HttpStatusCode.OK);
+            if (string.IsNullOrWhiteSpace(activity.Text))
+                return Request.CreateResponse(HttpStatusCode.OK);

-                // return our reply to the user
-                Activity reply = activity.CreateReply($"You sent {activity.Text} which was {length} characters");
-                await connector.Conversations.ReplyToActivityAsync(reply);
-            }
-            else
-            {
-                HandleSystemMessage(activity);
-            }
-            var response = Request.CreateResponse(HttpStatusCode.OK);
-            return response;
+            var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
+
+            var echoMessage = $"You sent \"{activity.Text}\".";
+            await Reply(connector, activity, echoMessage);
+
+            return Request.CreateResponse(HttpStatusCode.OK);
         }

-        private Activity HandleSystemMessage(Activity message)
+        static async Task Reply(ConnectorClient connector, Activity activity, string message)
+        {
+            var reply = activity.CreateReply(message);
+            await connector.Conversations.ReplyToActivityAsync(reply);
+        }
+
+        Activity HandleSystemMessage(Activity message)
         {
             if (message.Type == ActivityTypes.DeleteUserData)
             {


2365: GlyphFitOurline

2365: GlyphFitOurline

--- a_mini/projects/PixelFarm/Typography/Typography.AutoFit/GlyphFitOutline.cs
+++ a_mini/projects/PixelFarm/Typography/Typography.AutoFit/GlyphFitOutline.cs
@@ -1,23 +1,23 @@
 //MIT, 2017, WinterDev
 using System;
 using System.Collections.Generic;
+using Typography.OpenFont;
 using Poly2Tri;
 namespace Typography.Rendering
 {

     public class GlyphFitOutline
     {
-        //this class store result of poly2tri
-

         List<GlyphTriangle> _triangles = new List<GlyphTriangle>();
+        List<GlyphContour> _contours;
         Polygon _polygon;
         List<GlyphBone> bones;
         List<GlyphBone> boneList2;

         internal GlyphFitOutline(Polygon polygon, List<GlyphContour> contours)
         {
-            this.Contours = contours;
+            this._contours = contours;
             this._polygon = polygon;
             foreach (DelaunayTriangle tri in polygon.Triangles)
             {
@@ -27,7 +27,7 @@

             Analyze();
         }
-        internal List<GlyphContour> Contours { get; set; }
+

         void Analyze()
         {
@@ -165,513 +165,315 @@
         {
             return bones;
         }
+
+
+        //=======================================================================================
+        /// <summary>
+        /// read fitting output
+        /// </summary>
+        /// <param name="tx">glyph translator</param>
+        public void ReadOutput(IGlyphTranslator tx, float pxScale)
+        {
+            //TODO: review here
+            //
+            //-----------------------------------------------------------
+            //create fit contour
+            //this version use only Agg's vertical hint only ****
+            //(ONLY vertical fitting , NOT apply horizontal fit)
+            //-----------------------------------------------------------
+            //create outline
+            //then create
+            List<GlyphContour> contours = this._contours;
+            int j = contours.Count;
+            for (int i = 0; i < j; ++i)
+            {
+                //new contour
+                contours[i].ClearAllAdjustValues();
+            }
+
+#if DEBUG
+            s_dbugAffectedPoints.Clear();
+            s_dbugAff2.Clear();
+#endif
+            List<List<Point2d>> genPointList = new List<List<Point2d>>();
+            for (int i = 0; i < j; ++i)
+            {
+                //new contour
+                List<Point2d> genPoints = new List<Point2d>();
+                GenerateNewFitPoints(genPoints,
+                    contours[i], pxScale,
+                    false, true, false);
+                genPointList.Add(genPoints);
+            }
+
+            //-------------
+            tx.BeginRead(j);
+            for (int i = 0; i < j; ++i)
+            {
+                GenerateFitOutput(tx, genPointList[i], contours[i]);
+            }
+            tx.EndRead();
+            //-------------
+        }
+        const int GRID_SIZE = 1;
+        const float GRID_SIZE_25 = 1f / 4f;
+        const float GRID_SIZE_50 = 2f / 4f;
+        const float GRID_SIZE_75 = 3f / 4f;
+
+        const float GRID_SIZE_33 = 1f / 3f;
+        const float GRID_SIZE_66 = 2f / 3f;
+
+
+        static float RoundToNearestY(GlyphPoint2D p, float org, bool useHalfPixel)
+        {
+            float floo_int = (int)org;//floor
+            float remaining = org - floo_int;
+            if (useHalfPixel)
+            {
+                if (remaining > GRID_SIZE_66)
+                {
+                    return (floo_int + 1f);
+                }
+                else if (remaining > (GRID_SIZE_33))
+                {
+                    return (floo_int + 0.5f);
+                }
+                else
+                {
+                    return floo_int;
+                }
+            }
+            else
+            {
+                if (remaining > GRID_SIZE_50)
+                {
+                    return (floo_int + 1f);
+                }
+                else
+                {
+                    //we we move this point down
+                    //the upper part point may affect the other(lower side)
+                    //1.horizontal edge
+
+                    EdgeLine h_edge = p.horizontalEdge;
+                    EdgeLine matching_anotherSide = h_edge.GetMatchingOutsideEdge();
+                    if (matching_anotherSide != null)
+                    {
+                        Poly2Tri.TriangulationPoint a_p = matching_anotherSide.p;
+                        Poly2Tri.TriangulationPoint a_q = matching_anotherSide.q;
+                        if (a_p != null && a_p.userData is GlyphPoint2D)
+                        {
+                            GlyphPoint2D a_glyph_p = (GlyphPoint2D)a_p.userData;
+                            a_glyph_p.AdjustedY = -remaining;
+#if DEBUG
+                            if (!s_dbugAff2.ContainsKey(a_glyph_p))
+                            {
+                                s_dbugAff2.Add(a_glyph_p, true);
+                                s_dbugAffectedPoints.Add(a_glyph_p);
+                            }
+
+#endif
+                        }
+                        if (a_q != null && a_q.userData is GlyphPoint2D)
+                        {
+                            GlyphPoint2D a_glyph_q = (GlyphPoint2D)a_q.userData;
+                            a_glyph_q.AdjustedY = -remaining;
+#if DEBUG
+                            if (!s_dbugAff2.ContainsKey(a_glyph_q))
+                            {
+                                s_dbugAff2.Add(a_glyph_q, true);
+                                s_dbugAffectedPoints.Add(a_glyph_q);
+                            }
+
+#endif
+                        }
+                    }
+
+                    return floo_int;
+                }
+            }
+        }
+        static float RoundToNearestX(float org)
+        {
+            float actual1 = org;
+            float integer1 = (int)(actual1);//lower
+            float floatModulo = actual1 - integer1;
+
+            if (floatModulo >= (GRID_SIZE_50))
+            {
+                return (integer1 + 1);
+            }
+            else
+            {
+                return integer1;
+            }
+        }
+        struct Point2d
+        {
+            public float x;
+            public float y;
+            public Point2d(float x, float y)
+            {
+
+                this.x = x;
+                this.y = y;
+            }
+#if DEBUG
+            public override string ToString()
+            {
+                return "(" + x + "," + y + ")";
+            }
+#endif
+        }
+#if DEBUG
+        public static List<GlyphPoint2D> s_dbugAffectedPoints = new List<GlyphPoint2D>();
+        public static Dictionary<GlyphPoint2D, bool> s_dbugAff2 = new Dictionary<GlyphPoint2D, bool>();
+
+#endif
+
+
+        static void GenerateNewFitPoints(
+            List<Point2d> genPoints,
+            GlyphContour contour,
+            float pixelScale,
+            bool x_axis,
+            bool y_axis,
+            bool useHalfPixel)
+        {
+            List<GlyphPoint2D> flattenPoints = contour.flattenPoints;
+
+            int j = flattenPoints.Count;
+            //merge 0 = start
+            //double prev_px = 0;
+            //double prev_py = 0;
+            double p_x = 0;
+            double p_y = 0;
+            double first_px = 0;
+            double first_py = 0;
+
+            //---------------
+            //1st round for value adjustment
+            //---------------
+
+            //find adjust y
+
+            {
+                GlyphPoint2D p = flattenPoints[0];
+                p_x = p.x * pixelScale;
+                p_y = p.y * pixelScale;
+
+                if (y_axis && p.isPartOfHorizontalEdge && p.isUpperSide) //TODO: review here
+                {
+                    //vertical fitting, fit p_y to grid
+                    //adjust if p is not part of curve
+                    switch (p.kind)
+                    {
+                        case PointKind.LineStart:
+                        case PointKind.LineStop:
+                            p_y = RoundToNearestY(p, (float)p_y, useHalfPixel);
+                            break;
+                    }
+
+                }
+                if (x_axis && p.IsPartOfVerticalEdge && p.IsLeftSide)
+                {
+                    //horizontal fitting, fix p_x to grid
+                    float new_x = RoundToNearestX((float)p_x);
+                    p_x = new_x;
+                    //adjust right-side vertical edge
+                    EdgeLine rightside = p.GetMatchingVerticalEdge();
+                }
+                //tx.MoveTo((float)p_x, (float)p_y);
+                genPoints.Add(new Point2d((float)p_x, (float)p_y));
+                //-------------
+                first_px = p_x;
+                first_py = p_y;
+            }
+
+            for (int i = 1; i < j; ++i)
+            {
+                //all merge point is polygon point
+                GlyphPoint2D p = flattenPoints[i];
+                p_x = p.x * pixelScale;
+                p_y = p.y * pixelScale;
+
+
+                if (y_axis && p.isPartOfHorizontalEdge && p.isUpperSide)  //TODO: review here
+                {
+                    //vertical fitting, fit p_y to grid
+                    p_y = RoundToNearestY(p, (float)p_y, useHalfPixel);
+                }
+
+                if (x_axis && p.IsPartOfVerticalEdge && p.IsLeftSide)
+                {
+                    //horizontal fitting, fix p_x to grid
+                    float new_x = RoundToNearestX((float)p_x);
+                    p_x = new_x;
+                }
+
+                genPoints.Add(new Point2d((float)p_x, (float)p_y));
+            }
+        }
+
+
+        static void GenerateFitOutput(IGlyphTranslator tx,
+            List<Point2d> genPoints,
+            GlyphContour contour)
+        {
+
+            int j = genPoints.Count;
+            //merge 0 = start
+            //double prev_px = 0;
+            //double prev_py = 0;
+            float first_px = 0;
+            float first_py = 0;
+            //---------------
+            //1st round for value adjustment
+            //---------------
+
+            //find adjust y
+            List<GlyphPoint2D> flattenPoints = contour.flattenPoints;
+            //---------------
+            if (j != flattenPoints.Count)
+            {
+                throw new NotSupportedException();
+            }
+            //---------------
+            for (int i = 0; i < j; ++i)
+            {
+                GlyphPoint2D glyphPoint = flattenPoints[i];
+                Point2d p = genPoints[i];
+
+                if (glyphPoint.AdjustedY != 0)
+                {
+                    if (i == 0)
+                    {
+                        //first point
+                        tx.MoveTo(first_px = p.x, first_py = (float)(p.y + glyphPoint.AdjustedY));
+                    }
+                    else
+                    {
+                        tx.LineTo(p.x, (float)(p.y + glyphPoint.AdjustedY));
+                    }
+                }
+                else
+                {
+                    if (i == 0)
+                    {
+                        //first point
+                        tx.MoveTo(first_px = p.x, first_py = p.y);
+                    }
+                    else
+                    {
+                        tx.LineTo(p.x, p.y);
+                    }
+                }
+            }
+            //close
+            //tx.LineTo(first_px, first_py);
+            tx.CloseContour();
+        }
+
     }

-
-
-    static class MyMath
-    {
-
-        /// <summary>
-        /// Convert degrees to radians
-        /// </summary>
-        /// <param name="degrees">An angle in degrees</param>
-        /// <returns>The angle expressed in radians</returns>
-        public static double DegreesToRadians(double degrees)
-        {
-            const double degToRad = System.Math.PI / 180.0f;
-            return degrees * degToRad;
-        }
-
-    }
-
-    public enum BoneDirection : byte
-    {
-        /// <summary>
-        /// 0 degree direction (horizontal left to right)
-        /// </summary>
-        D0,
-        D45,
-        D90,
-        D135,
-        D180,
-        D225,
-        D270,
-        D315
-    }
-    /// <summary>
-    /// a line that connects between centroid of 2 GlyphTriangle(p => q)
-    /// </summary>
-    public class GlyphBone
-    {
-        public readonly GlyphTriangle p, q;
-        public readonly double boneLength;
-
-        public GlyphBone(GlyphTriangle p, GlyphTriangle q)
-        {
-            this.p = p;
-            this.q = q;
-
-            double dy = q.CentroidY - p.CentroidY;
-            double dx = q.CentroidX - p.CentroidX;
-            this.boneLength = Math.Sqrt(
-                (dy * dy) + (dx * dx)
-                );
-        }
-        public double SlopAngle { get; private set; }
-        public bool IsLongBone { get; set; }
-
-        public LineSlopeKind SlopKind { get; private set; }
-
-        static void CalculateMidPoint(EdgeLine e, out double midX, out double midY)
-        {
-            midX = (e.x0 + e.x1) / 2;
-            midY = (e.y0 + e.y1) / 2;
-        }
-
-        public void Analyze()
-        {
-
-            //
-            //p => (x0,y0)
-            //q => (x1,y1)
-            //line move from p to q
-            //...
-            //tasks:
-            //1. find slop angle
-            //2. find slope kind
-
-
-
-            //check if q is upper or lower when compare with p
-            //check if q is on left side or right side of p
-            //then we know the direction
-            //....
-            //p
-            double x0 = p.CentroidX;
-            double y0 = p.CentroidY;
-            //q
-            double x1 = q.CentroidX;
-            double y1 = q.CentroidY;
-
-            if (x1 == x0)
-            {
-                this.SlopKind = LineSlopeKind.Vertical;
-                SlopAngle = 1;
-            }
-            else
-            {
-                SlopAngle = Math.Abs(Math.Atan2(Math.Abs(y1 - y0), Math.Abs(x1 - x0)));
-                if (SlopAngle > _85degreeToRad)
-                {
-                    SlopKind = LineSlopeKind.Vertical;
-                }
-                else if (SlopAngle < _8degreeToRad) //_15degreeToRad
-                {
-                    SlopKind = LineSlopeKind.Horizontal;
-                }
-                else
-                {
-                    SlopKind = LineSlopeKind.Other;
-                }
-            }
-            //--------------------------------------
-            //for p and q, count number of outside edge
-            //if outsideEdgeCount of triangle >=2 -> this triangle is tip part
-
-            int p_outsideEdgeCount = OutSideEdgeCount(p);
-            int q_outsideEdgeCount = OutSideEdgeCount(q);
-            bool p_isTip = false;
-            bool q_isTip = false;
-
-            if (p_outsideEdgeCount >= 2)
-            {
-                //tip bone
-                p_isTip = true;
-            }
-            if (q_outsideEdgeCount >= 2)
-            {
-                //tipbone
-                q_isTip = true;
-            }
-            //--------------------------------------
-            //p_isTip && q_isTip is possible eg. dot or dot of  i etc.
-            //--------------------------------------
-            //find matching side:
-            //the bone connects between triangle p and q (via centroid)
-            //
-            if (p.e0.IsOutside)
-            {
-                //find matching side on q
-                MarkMatchingEdge(p.e0, q);
-            }
-            if (p.e1.IsOutside)
-            {
-                //find matching side on q
-                MarkMatchingEdge(p.e1, q);
-            }
-            if (p.e2.IsOutside)
-            {
-                //find matching side on q
-                MarkMatchingEdge(p.e2, q);
-            }
-
-
-            if (q.e0.IsOutside)
-            {
-                //find matching side on q
-                MarkMatchingEdge(q.e0, p);
-            }
-            if (q.e1.IsOutside)
-            {
-                //find matching side on q
-                MarkMatchingEdge(q.e1, p);
-            }
-            if (q.e2.IsOutside)
-            {
-                //find matching side on q
-                MarkMatchingEdge(q.e2, p);
-            }
-        }
-        static void MarkMatchingEdge(EdgeLine targetEdge, GlyphTriangle q)
-        {
-
-            EdgeLine matchingEdgeLine;
-            int matchingEdgeSideNo;
-            if (FindMatchingOuterSide(targetEdge, q, out matchingEdgeLine, out matchingEdgeSideNo))
-            {
-                //assign matching edge line
-                //mid point of each edge
-                //p-triangle's edge midX,midY
-                double pe_midX, pe_midY;
-                CalculateMidPoint(targetEdge, out pe_midX, out pe_midY);
-                //q-triangle's edge midX,midY
-                double qe_midX, qe_midY;
-                CalculateMidPoint(matchingEdgeLine, out qe_midX, out qe_midY);
-
-                if (targetEdge.SlopKind == LineSlopeKind.Vertical)
-                {
-                    //TODO: review same side edge (Fan shape)
-                    if (pe_midX < qe_midX)
-                    {
-                        targetEdge.IsLeftSide = true;
-                        if (matchingEdgeLine.IsOutside && matchingEdgeLine.SlopKind == LineSlopeKind.Vertical)
-                        {
-                            targetEdge.AddMatchingOutsideEdge(matchingEdgeLine);
-                        }
-                    }
-                    else
-                    {
-                        //matchingEdgeLine.IsLeftSide = true;
-                        if (matchingEdgeLine.IsOutside && matchingEdgeLine.SlopKind == LineSlopeKind.Vertical)
-                        {
-                            targetEdge.AddMatchingOutsideEdge(matchingEdgeLine);
-                        }
-                    }
-                }
-                else if (targetEdge.SlopKind == LineSlopeKind.Horizontal)
-                {
-                    //TODO: review same side edge (Fan shape)
-
-                    if (pe_midY > qe_midY)
-                    {
-                        //p side is upper , q side is lower
-                        if (targetEdge.SlopKind == LineSlopeKind.Horizontal)
-                        {
-                            targetEdge.IsUpper = true;
-                            if (matchingEdgeLine.IsOutside && matchingEdgeLine.SlopKind == LineSlopeKind.Horizontal)
-                            {
-                                targetEdge.AddMatchingOutsideEdge(matchingEdgeLine);
-                            }
-                        }
-                    }
-                    else
-                    {
-                        if (matchingEdgeLine.SlopKind == LineSlopeKind.Horizontal)
-                        {
-                            // matchingEdgeLine.IsUpper = true;
-                            if (matchingEdgeLine.IsOutside && matchingEdgeLine.SlopKind == LineSlopeKind.Horizontal)
-                            {
-                                targetEdge.AddMatchingOutsideEdge(matchingEdgeLine);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        static bool FindMatchingOuterSide(EdgeLine compareEdge, GlyphTriangle another, out EdgeLine result, out int edgeIndex)
-        {
-            //compare by radian of edge line
-            double compareSlope = Math.Abs(compareEdge.SlopAngle);
-            double diff0 = double.MaxValue;
-            double diff1 = double.MaxValue;
-            double diff2 = double.MaxValue;
-
-            diff0 = Math.Abs(Math.Abs(another.e0.SlopAngle) - compareSlope);
-
-            diff1 = Math.Abs(Math.Abs(another.e1.SlopAngle) - compareSlope);
-
-            diff2 = Math.Abs(Math.Abs(another.e2.SlopAngle) - compareSlope);
-
-            //find min
-            int minDiffSide = FindMinIndex(diff0, diff1, diff2);
-            if (minDiffSide > -1)
-            {
-                edgeIndex = minDiffSide;
-                switch (minDiffSide)
-                {
-                    default: throw new NotSupportedException();
-                    case 0:
-                        result = another.e0;
-                        break;
-                    case 1:
-                        result = another.e1;
-                        break;
-                    case 2:
-                        result = another.e2;
-                        break;
-                }
-                return true;
-            }
-            else
-            {
-                edgeIndex = -1;
-                result = null;
-                return false;
-            }
-        }
-        static int FindMinIndex(double d0, double d1, double d2)
-        {
-            unsafe
-            {
-                double* tmpArr = stackalloc double[3];
-                tmpArr[0] = d0;
-                tmpArr[1] = d1;
-                tmpArr[2] = d2;
-
-                int minAt = -1;
-                double currentMin = double.MaxValue;
-                for (int i = 0; i < 3; ++i)
-                {
-                    double d = tmpArr[i];
-                    if (d < currentMin)
-                    {
-                        currentMin = d;
-                        minAt = i;
-                    }
-                }
-                return minAt;
-            }
-        }
-        /// <summary>
-        /// count number of outside edge
-        /// </summary>
-        /// <param name="t"></param>
-        /// <returns></returns>
-        static int OutSideEdgeCount(GlyphTriangle t)
-        {
-            int n = 0;
-            n += t.e0.IsOutside ? 1 : 0;
-            n += t.e1.IsOutside ? 1 : 0;
-            n += t.e2.IsOutside ? 1 : 0;
-            return n;
-        }
-        static readonly double _85degreeToRad = MyMath.DegreesToRadians(85);
-        static readonly double _15degreeToRad = MyMath.DegreesToRadians(15);
-        static readonly double _8degreeToRad = MyMath.DegreesToRadians(8);
-        static readonly double _90degreeToRad = MyMath.DegreesToRadians(90);
-        public override string ToString()
-        {
-            return p + " -> " + q;
-        }
-    }
-
-    public class GlyphTriangle
-    {
-
-
-        DelaunayTriangle _tri;
-        public EdgeLine e0;
-        public EdgeLine e1;
-        public EdgeLine e2;
-
-        //centroid of edge mass
-        double centroidX;
-        double centroidY;
-
-        public GlyphTriangle(DelaunayTriangle tri)
-        {
-            this._tri = tri;
-            TriangulationPoint p0 = _tri.P0;
-            TriangulationPoint p1 = _tri.P1;
-            TriangulationPoint p2 = _tri.P2;
-            e0 = new EdgeLine(p0, p1);
-            e1 = new EdgeLine(p1, p2);
-            e2 = new EdgeLine(p2, p0);
-            tri.Centroid2(out centroidX, out centroidY);
-
-            e0.IsOutside = tri.EdgeIsConstrained(tri.FindEdgeIndex(tri.P0, tri.P1));
-            e1.IsOutside = tri.EdgeIsConstrained(tri.FindEdgeIndex(tri.P1, tri.P2));
-            e2.IsOutside = tri.EdgeIsConstrained(tri.FindEdgeIndex(tri.P2, tri.P0));
-        }
-
-        public double CentroidX
-        {
-            get { return centroidX; }
-        }
-        public double CentroidY
-        {
-            get { return centroidY; }
-        }
-        public bool IsConnectedWith(GlyphTriangle anotherTri)
-        {
-            DelaunayTriangle t2 = anotherTri._tri;
-            if (t2 == this._tri)
-            {
-                throw new NotSupportedException();
-            }
-            //else
-            return this._tri.N0 == t2 ||
-                   this._tri.N1 == t2 ||
-                   this._tri.N2 == t2;
-        }
-
-#if DEBUG
-        public override string ToString()
-        {
-            return this._tri.ToString();
-        }
-#endif
-    }
-
-    public enum LineSlopeKind : byte
-    {
-        Vertical,
-        Horizontal,
-        Other
-    }
-
-    /// <summary>
-    /// edge of GlyphTriangle
-    /// </summary>
-    public class EdgeLine
-    {
-
-        public double x0;
-        public double y0;
-        public double x1;
-        public double y1;
-
-        static readonly double _85degreeToRad = MyMath.DegreesToRadians(85);
-        static readonly double _15degreeToRad = MyMath.DegreesToRadians(15);
-        static readonly double _90degreeToRad = MyMath.DegreesToRadians(90);
-
-        public TriangulationPoint p;
-        public TriangulationPoint q;
-
-        Dictionary<EdgeLine, bool> matchingEdges;
-
-        public EdgeLine(TriangulationPoint p, TriangulationPoint q)
-        {
-            this.p = p;
-            this.q = q;
-
-            x0 = p.X;
-            y0 = p.Y;
-            x1 = q.X;
-            y1 = q.Y;
-            //-------------------
-            if (x1 == x0)
-            {
-                this.SlopKind = LineSlopeKind.Vertical;
-                SlopAngle = 1;
-            }
-            else
-            {
-                SlopAngle = Math.Abs(Math.Atan2(Math.Abs(y1 - y0), Math.Abs(x1 - x0)));
-                if (SlopAngle > _85degreeToRad)
-                {
-                    SlopKind = LineSlopeKind.Vertical;
-                }
-                else if (SlopAngle < _15degreeToRad)
-                {
-                    SlopKind = LineSlopeKind.Horizontal;
-                }
-                else
-                {
-                    SlopKind = LineSlopeKind.Other;
-                }
-            }
-        }
-        public LineSlopeKind SlopKind
-        {
-            get;
-            private set;
-        }
-        public bool IsOutside
-        {
-            get;
-            internal set;
-        }
-        public double SlopAngle
-        {
-            get;
-            private set;
-        }
-        public bool IsUpper
-        {
-            get;
-            internal set;
-        }
-        public bool IsLeftSide
-        {
-            get;
-            internal set;
-        }
-
-        public override string ToString()
-        {
-            return SlopKind + ":" + x0 + "," + y0 + "," + x1 + "," + y1;
-        }
-
-        public EdgeLine GetMatchingOutsideEdge()
-        {
-            if (matchingEdges == null) { return null; }
-
-            if (matchingEdges.Count == 1)
-            {
-                foreach (EdgeLine line in matchingEdges.Keys)
-                {
-                    return line;
-                }
-                return null;
-            }
-            else
-            {
-                return null;
-            }
-
-        }
-        public void AddMatchingOutsideEdge(EdgeLine edgeLine)
-        {
-#if DEBUG
-            if (edgeLine == this) { throw new NotSupportedException(); }
-#endif
-            if (matchingEdges == null)
-            {
-                matchingEdges = new Dictionary<EdgeLine, bool>();
-            }
-            if (!matchingEdges.ContainsKey(edgeLine))
-            {
-                matchingEdges.Add(edgeLine, true);
-            }
-#if DEBUG
-            if (matchingEdges.Count > 1)
-            {
-
-            }
-#endif
-        }
-    }
-
 }


Fix delete result

Fix delete result

--- Salesforce.Core/SalesforceClient.cs
+++ Salesforce.Core/SalesforceClient.cs
@@ -108,7 +108,7 @@
 			// Delete the row from the data source.
 			var request = new DeleteRequest (@object);
 			var response = await self.ProcessAsync (request);
-			return response.StatusCode != System.Net.HttpStatusCode.NoContent;
+			return response.StatusCode == System.Net.HttpStatusCode.NoContent;
 		}

 		public static bool Delete (this SalesforceClient self, SObject @object)


Extract PlatingHistory functionality for reuse in Part History

--- Library/Providers/MatterControl/PlatingHistoryContainer.cs
+++ Library/Providers/MatterControl/PlatingHistoryContainer.cs
@@ -32,20 +32,33 @@
 using System.IO;
 using System.Linq;
 using MatterHackers.Agg.Image;
+using MatterHackers.Agg.Platform;
 using MatterHackers.DataConverters3D;
 using MatterHackers.Localizations;
 using MatterHackers.MatterControl.DataStorage;

 namespace MatterHackers.MatterControl.Library
 {
-	public class PlatingHistoryContainer : LibraryContainer, ILibraryWritableContainer
+	public class PlatingHistoryContainer : HistoryContainerBase
 	{
 		public PlatingHistoryContainer()
 		{
+			this.Name = "Plating History".Localize();
+			this.FullPath = ApplicationDataStorage.Instance.PlatingDirectory;
+		}
+	}
+
+	public class HistoryContainerBase : LibraryContainer, ILibraryWritableContainer
+	{
+		public HistoryContainerBase()
+		{
 			this.ChildContainers = new List<ILibraryContainerLink>();
 			this.Items = new List<ILibraryItem>();
-			this.Name = "Plating History".Localize();
 		}
+
+		public string FullPath { get; protected set; }
+
+		public int PageSize { get; set; } = 25;

 		public event EventHandler<ItemChangedEventArgs> ItemContentChanged;

@@ -74,8 +87,8 @@
 		public override void Load()
 		{
 			// Select the 25 most recent files and project onto FileSystemItems
-			var recentFiles = new DirectoryInfo(ApplicationDataStorage.Instance.PlatingDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime);
-			Items = recentFiles.Take(25).Select(f => new SceneReplacementFileItem(f.FullName)).ToList<ILibraryItem>();
+			var recentFiles = new DirectoryInfo(this.FullPath).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime);
+			Items = recentFiles.Take(this.PageSize).Select(f => new SceneReplacementFileItem(f.FullName)).ToList<ILibraryItem>();
 		}

 		public void Move(IEnumerable<ILibraryItem> items, ILibraryWritableContainer targetContainer)


Minor cleanup

Minor cleanup

--- api/test/BellRichM.Identity.Api.Test/Exceptions/CreateRoleExceptionSpec.cs
+++ api/test/BellRichM.Identity.Api.Test/Exceptions/CreateRoleExceptionSpec.cs
@@ -17,14 +17,10 @@
         protected static CreateRoleException createRoleException;
         protected static Exception thrownException;
         Establish context = () =>
-        {
             createRoleException = new CreateRoleException("code");
-        };

         Because of = () =>
-        {
               thrownException = Catch.Exception(() => createRoleException.GetObjectData(null, new StreamingContext()));
-        };

     	It should_throw_expected_exception = () =>
 			thrownException.ShouldBeOfExactType<ArgumentNullException>();