Delete ImportAllegroFiles.cs

Delete ImportAllegroFiles.cs

--- ImportAllegroFiles.cs
+++ ImportAllegroFiles.cs
@@ -1,216 +0,0 @@
-//Synchronous template
-//-----------------------------------------------------------------------------------
-// PCB-Investigator Automation Script
-// Created on 11.04.2016
-// Autor Fabio.Gruber
-//
-// Import gerber and excellon file output from Cadence Allegro (tools defined as comments beginning with ; and much more information like tolerance and quantity).
-// It checks for unit MM or MILS.
-// To use the script configurate the leading and trailing digits at the script begin.
-//-----------------------------------------------------------------------------------
-// GUID newScript_635954556024364499
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using PCBI.Plugin;
-using PCBI.Plugin.Interfaces;
-using System.Windows.Forms;
-using System.Drawing;
-using PCBI.Automation;
-using System.IO;
-using System.Drawing.Drawing2D;
-using PCBI.MathUtils;
-
-namespace PCBIScript
-{
-    public class PScript : IPCBIScript
-    {
-        public PScript()
-        {
-        }
-
-        IPCBIWindow Parent;
-        bool stop = false;
-
-        public void Execute(IPCBIWindow parent)
-        {
-            //import excellon file output from Cadence Allegro (tools defined as comments)
-            //insert digits for reading inner values of drill file (most no information in drill files, you can have a look on your gerber files to identify it).
-            //If you load gerber and drill together there is a auto scaling implemented.
-            int LeadingDigits = 2;
-            int TrailingDigits = 4;
-		bool UseMils = true;
-
-
-            Parent = parent;
-            IFilter filter = new IFilter(parent);
-            if (!parent.JobIsLoaded)
-            {
-                filter.CreateAndLoadEmptyJob(Path.GetTempPath(), "GerberImport", "step");
-
-            }
-            stop = false;
-		bool TryAutoSize = false;
-
-            string DrillHeader = "Format  : " + LeadingDigits + "." + TrailingDigits + " / Absolute / INCH / Trailing*" + Environment.NewLine;
-            DrillHeader += "Contents: Thru / Drill / Plated*" + Environment.NewLine;
-            //   DrillHeader += "M48**" + Environment.NewLine;
-            DrillHeader += "FMAT,1*" + Environment.NewLine;
-            DrillHeader += "INCH,TZ*" + Environment.NewLine;
-            DrillHeader += "ICI,OFF*";
-
-		ILayer drillLayer =null;
-
-            System.Windows.Forms.OpenFileDialog of = new System.Windows.Forms.OpenFileDialog();
-            of.Multiselect = true;
-            if (of.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-            {
- 		  PCB_Investigator.PCBIWindows.PCBIWorkingDialog working = new PCB_Investigator.PCBIWindows.PCBIWorkingDialog();
-                working.CanCancel(true);
-                working.CancelPressed += working_CancelPressed;
-                working.SetStatusText("Parsing files...");
-                working.ShowWorkingDlgAsThread();
-                double counter = 1;
-                double stepOneFile = 100f / of.FileNames.Length;
-                foreach (string FileName in of.FileNames)
-                {
-                    if (stop) break;
-                    working.SetStatusPercent((int)counter);
-                    FileStream gfs = new System.IO.FileStream(FileName, FileMode.Open);
-                    StreamReader gsr = new System.IO.StreamReader(gfs, Encoding.UTF8);
-                    string GerberFile = gsr.ReadToEnd();
-                    gsr.Close();
-                    gfs.Close();
-                    string fullPath = Path.GetTempPath() + Path.GetFileName(FileName);
-
-                    counter += stepOneFile;
-
-                    if (File.Exists(fullPath))
-                    {
-                        try
-                        {
-                            File.Delete(fullPath);
-                            System.Threading.Thread.Sleep(1000); //file delete takes some time...
-                        }
-                        catch
-                        { }
-                    }
-
-                    FileStream writeGerberFS = new System.IO.FileStream(fullPath, FileMode.OpenOrCreate);
-                    StreamWriter GerberWriterSW = new StreamWriter(writeGerberFS, Encoding.UTF8);
-                    if (GerberFile.StartsWith("G"))
-                    {
-                        GerberWriterSW.WriteLine(GerberFile);
-                        GerberWriterSW.Flush();
-                        GerberWriterSW.Close();
-                        IPCBIWindow.LoadInformation loadInfo = new IPCBIWindow.LoadInformation();
-                        Parent.LoadData(fullPath, out loadInfo);
-                    }
-                    else if (GerberFile.StartsWith(";")) //most files out of cadance start with ;
-                    {
-                        GerberWriterSW.WriteLine(DrillHeader);
-
-                        foreach (string s in GerberFile.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
-                        {
-                            //z.B. Tooldef. bzw. commentarte
-                            //z.B. ;   Holesize 1. = 16.000000 Tolerance = +0.000000/-0.000000 PLATED MILS Quantity = 57
-                            if (s.StartsWith(";")) //nur wenn keine tooldef dann check Holesize def
-                            {
-                                #region check for tool definition in comment
-                                int indexHolesize = s.IndexOf("Holesize");
-                                if (indexHolesize > 0)
-                                {
-                                    bool containsMil = s.Contains("MILS");
-                                    bool containsMM = s.Contains("MM");
-
-                                    //check = nach holesize
-                                    StringBuilder digitsOfDiameter = new StringBuilder();
-                                    bool started = false;
-                                    for (int i = indexHolesize + 9; i < s.Length; i++)
-                                    {
-                                        #region get diameter of holesize
-                                        if (s[i] == '=')
-                                        {
-                                            if (started) break;
-                                            started = true;
-                                        }
-                                        else
-                                            if (started)
-                                            {
-                                                if (char.IsNumber(s[i]) || s[i] == '.')
-                                                {
-                                                    digitsOfDiameter.Append(s[i]);
-                                                }
-                                                else if (s[i] == ' ' && digitsOfDiameter.Length == 0)
-                                                { }
-                                                else //anderer Parameter gestartet...
-                                                    break;
-                                            }
-                                        #endregion
-                                    }
-
-                                    if (digitsOfDiameter.Length > 0)
-                                    {
-                                        if (containsMM && !containsMil)
-                                        {
-                                            double diameterTool = ParseHeader(digitsOfDiameter.ToString(), true) / 1000;
-                                            GerberWriterSW.WriteLine(s.Substring(1, 3) + "C" + diameterTool.ToString().Replace(",", "."));
-                                        }
-                                        else
-                                            GerberWriterSW.WriteLine(s.Substring(1, 3) + "C" + digitsOfDiameter.ToString());
-                                    }
-                                }
-                                else GerberWriterSW.WriteLine(s);
-                                #endregion
-                            }
-                        }
-
-                        GerberWriterSW.WriteLine(GerberFile);
-                        GerberWriterSW.Flush();
-                        GerberWriterSW.Close();
-                        IStep step = parent.GetCurrentStep();
-				working.DoClose();
-			    MessageBox.Show("Parameter"+  Environment.NewLine+"Leading "+LeadingDigits+" Trailing "+TrailingDigits+  Environment.NewLine+"Unit "+(UseMils?"mils":"mm")+  Environment.NewLine ,"Drill Setup");
-				IMatrix matrix = parent.GetMatrix();
-
-            		   if (matrix != null) matrix.DelateLayer(System.IO.Path.GetFileName( fullPath), false);
-
-			   string drillLayername = step.AddGerberLayer(fullPath, true, PCBI.ImportOptions.FormatTypes.Excellon1, LeadingDigits, TrailingDigits, UseMils , TryAutoSize );
-
-                        drillLayer = step.GetLayer(drillLayername);
-                        Dictionary<double, int> diameterShapeList = new Dictionary<double, int>();
-
-  }
-                }
-                working.DoClose();
-
-            }
-            parent.UpdateControlsAndResetView();
-
-		if(drillLayer!=null)
-		drillLayer.EnableLayer(true);
-
-        }
-        void working_CancelPressed()
-        {
-            stop = true;
-        }
-        private double ParseHeader(string s, bool inMM)
-        {
-            try
-            {
-                double num = double.Parse(s, System.Globalization.NumberStyles.Any );
-                if (inMM)
-                {
-                    return IMath.MM2Mils(num)/1000;
-                }
-                return num;
-            }
-            catch
-            {
-                return 1;//default size
-            }
-        }
-    }
-}


Engine: Updated metric weights with latest mergetop results


fixed nullpointer bug

fixed nullpointer bug

--- EAAddinFramework/EAWrappers/Model.cs
+++ EAAddinFramework/EAWrappers/Model.cs
@@ -1550,8 +1550,8 @@
 		//get the node with the name "ea_guid"
 		XmlNode EAGuidNode = xmlIdGuid.SelectSingleNode(formatXPath("//ea_guid"));

-		string Object_ID = ObjectIDNode.InnerText;
-		string ea_guid = EAGuidNode.InnerText;
+		string Object_ID = ObjectIDNode != null ? ObjectIDNode.InnerText: string.Empty;
+		string ea_guid = EAGuidNode != null ? EAGuidNode.InnerText : string.Empty;

 		return new KeyValuePair<string, string>(Object_ID, ea_guid);
 	}


Fix the bug that GetCommits ignores branch

--- NGitLab/NGitLab/Impl/RepositoryClient.cs
+++ NGitLab/NGitLab/Impl/RepositoryClient.cs
@@ -73,7 +73,7 @@
             var param = new List<string>();

             if (!string.IsNullOrEmpty(branch))
-                param.Add($"ref={System.Web.HttpUtility.UrlEncode(branch)}");
+                param.Add($"ref_name={System.Web.HttpUtility.UrlEncode(branch)}");

             if (perPage != 20)
                 param.Add($"perPage={perPage}");


added attribute completion and object initializer completion tests

--- tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs
+++ tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs
@@ -202,6 +202,47 @@
             ContainsCompletions(completions.Select(c => c.CompletionText), Array.Empty<string>());
         }

+        [Theory]
+        [InlineData("dummy.cs")]
+        [InlineData("dummy.csx")]
+        public async Task Returns_attribute_without_attribute_suffix(string filename)
+        {
+            const string source =
+                @"using System;
+
+                    public class BarAttribute : Attribute {}
+
+                    [B$$
+                    public class Foo {}";
+
+            var completions = await FindCompletionsAsync(filename, source);
+            ContainsCompletions(completions.Select(c => c.CompletionText).Take(1), "Bar");
+        }
+
+        [Theory]
+        [InlineData("dummy.cs")]
+        [InlineData("dummy.csx")]
+        public async Task Returns_members_in_object_initializer_context(string filename)
+        {
+            const string source =
+                @"public class MyClass1 {
+                        public string Foo {get; set;}
+                  }
+
+                    public class MyClass2 {
+
+                        public MyClass2()
+                        {
+                            var c = new MyClass1 {
+                             F$$
+                        }
+                    }
+                ";
+
+            var completions = await FindCompletionsAsync(filename, source);
+            ContainsCompletions(completions.Select(c => c.CompletionText), "Foo");
+        }
+
         private void ContainsCompletions(IEnumerable<string> completions, params string[] expected)
         {
             if (!completions.SequenceEqual(expected))


Improved documentation

Improved documentation

--- Easy.Common/ThreadLocalDisposable.cs
+++ Easy.Common/ThreadLocalDisposable.cs
@@ -5,7 +5,8 @@
     using System.Threading;

     /// <summary>
-    /// A class similar to <see cref="ThreadLocal{T}"/> with the ability to dispose the <typeparamref name="T"/>.
+    /// A class similar to <see cref="ThreadLocal{T}"/> with the ability to dispose
+    /// all the underlying <typeparamref name="T"/>s.
     /// <para><see href="http://stackoverflow.com/a/7670762/1226568"/>.</para>
     /// </summary>
     public sealed class ThreadLocalDisposable<T> : IDisposable where T : IDisposable


encode bom

encode bom

--- Ior/Core/IorClient.cs
+++ Ior/Core/IorClient.cs
@@ -1,7 +1,11 @@
 using System;
+using System.IO;
 using System.Net.Http;
 using System.Net;
 using System.Net.Http.Headers;
+using System.Net.Mime;
+using System.Text;
+using NLog;
 using Swensen.Utils;
 using System.Threading;

@@ -10,6 +14,8 @@
     /// A light wrapper around our underlying http client.
     /// </summary>
     public class IorClient {
+        private static readonly Logger log = LogManager.GetCurrentClassLogger();
+
         private readonly string defaultRequestContentType;
         private readonly string proxyServer;

@@ -37,21 +43,38 @@
                 request.Headers.Add(header.Key, header.Value);

             if (requestModel.Method != HttpMethod.Get) {
-                var content = new StringContent(requestModel.Body);
-                foreach (var header in requestModel.ContentHeaders) {
-                    content.Headers.Remove(header.Key);
-                    if (!String.Equals(header.Key, "content-type", StringComparison.OrdinalIgnoreCase))
-                        request.Headers.Add(header.Key, header.Value);
+                //default content-type: http://mattryall.net/blog/2008/03/default-content-type
+                string textCt;
+                requestModel.ContentHeaders.TryGetValue("Content-Type", out textCt);
+                textCt = textCt.IsBlank() ? defaultRequestContentType : textCt; //then try settings supplied
+                textCt = textCt.IsBlank() ? "application/octet-stream" : textCt; // then try w3 spec default
+
+                //get encoding
+                var ct = new ContentType(textCt);
+                var encoding = Encoding.GetEncoding("ISO-8859-1"); //w3 default
+                try {
+                    //todo: move to validation and have no fallback if INVALID charset is given
+                    encoding = Encoding.GetEncoding(ct.CharSet);
+                } catch {
+                    log.Warn("charset={0} not supported, falling back on {0}", ct.CharSet, encoding.WebName);
                 }

-                //default content-type: http://mattryall.net/blog/2008/03/default-content-type
-                content.Headers.Remove("Content-Type");
-                string ct;
-                requestModel.ContentHeaders.TryGetValue("Content-Type", out ct);
-                ct = ct.IsBlank() ? defaultRequestContentType : ct; //then try settings supplied
-                ct = ct.IsBlank() ? "application/octet-stream" : ct; // then try w3 spec default
-                content.Headers.Add("Content-Type", ct);
+                //write content w/ BOM
+                var memStream = new MemoryStream();
+                var bom = encoding.GetPreamble();
+                memStream.Write(bom, 0, bom.Length);
+                var contentBytes = encoding.GetBytes(requestModel.Body);
+                memStream.Write(contentBytes, 0, contentBytes.Length);
+                var content = new ByteArrayContent(memStream.ToArray());

+                foreach (var header in requestModel.ContentHeaders) {
+                    content.Headers.Remove(header.Key); //remove defaults
+                    if (String.Equals(header.Key, "content-type", StringComparison.OrdinalIgnoreCase))
+                        content.Headers.Add(header.Key, textCt);
+                    else
+                        content.Headers.Add(header.Key, header.Value);
+                }
+
                 request.Content = content;
             }


初始化小球位置(beta)

初始化小球位置(beta)

--- AIAlgorithmPlatform/2008/demo/MolecularThermalmotion/Game.cs
+++ AIAlgorithmPlatform/2008/demo/MolecularThermalmotion/Game.cs
@@ -28,7 +28,7 @@

         CollisionDetectionEngine CDE = new CollisionDetectionEngine();

-        int moleculeNum = 30;
+        int moleculeNum = 4;
         public int MoleculeNum
         {
             get { return moleculeNum; }
@@ -170,13 +170,28 @@
             Material material = (Material)gameWindows.viewport.Resources["ER_Vector___Glossy_Yellow___MediumMR2"];
             Material specularMaterial = new SpecularMaterial(new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)), 1024);

-            for (int i = 0; i < moleculeNum; i++)
+            //定义二维数组，分别存放molelecule的数量，和x,y,z的坐标
+           double[,] moleculePositionSet = new double[moleculeNum,3];
+           moleculePositionSet[0, 0] = 0;
+           moleculePositionSet[0, 1] = 0;
+           moleculePositionSet[0, 2] = 8;
+           moleculePositionSet[1, 0] = 4.8;
+           moleculePositionSet[1, 1] = 0;
+           moleculePositionSet[1, 2] = 0;
+           moleculePositionSet[2, 0] = -2;
+           moleculePositionSet[2, 1] = 4;
+           moleculePositionSet[2, 2] = 0;
+           moleculePositionSet[3, 0] = -2;
+           moleculePositionSet[3, 1] = -4;
+           moleculePositionSet[3, 2] = 0;
+
+            for (int i = 0;( i < moleculeNum) ; i++)
             {
                 //创建并初始化molecule的属性
                 Molecule molecule = new Molecule()
                 {
-                    position = new Point3D(GetRandomInRange(positionRange), GetRandomInRange(positionRange), GetRandomInRange(positionRange)),
-
+                    //position = new Point3D(GetRandomInRange(positionRange), GetRandomInRange(positionRange), GetRandomInRange(positionRange)),
+                    position = new Point3D(moleculePositionSet[i,0], moleculePositionSet [i,1], moleculePositionSet[i,2]),
                     //currentVelocity = new Vector3D(GetRandomInRange(velocityRange), GetRandomInRange(velocityRange), GetRandomInRange(velocityRange)),
                     mass = 1,
                     radius = radius
@@ -197,11 +212,15 @@
                 MoleculeSet.Add(molecule);
             }

+
+
             {
                 ModelVisual3D moleculeSetModel = new ModelVisual3D();
                 moleculeSetModel.Content = moleculeModel3DGroup;
                 gameWindows.model.Children.Add(moleculeSetModel);
             }
+
+

             //设置白球
             whiteBall = MoleculeSet[0];


packet processing for Echo server is delegated to TCP;

--- examples/TCP/Echo.cs
+++ examples/TCP/Echo.cs
@@ -112,7 +112,7 @@
 // TCP instance, and pass the TCP instance to the application.
 // That is, instead of a "main" function, we have a slightly different
 // interface.
-public class Pax_Echo_Server : IActive, IPacketProcessor {
+public class Pax_Echo_Server : PacketMonitor, IActive {
   bool verbose = false;

   // FIXME currently no way of assigning defaults to Pax parameters in a wiring.json file?
@@ -157,12 +157,9 @@
     Console.WriteLine("Stopped TCP");
   }

-  public void packetHandler (object sender, CaptureEventArgs e) {
-    // FIXME how to indicate if we don't want to register a handler?
-  }
-  public ForwardingDecision process_packet (int in_port, ref Packet packet) {
-    // FIXME how to indicate if we don't want to register a handler?
-    return null;
+  override public ForwardingDecision process_packet (int in_port, ref Packet packet) {
+    // NOTE we assume that 'tcp' inherits from PacketMonitor.
+    return ((PacketMonitor)tcp).process_packet(in_port, ref packet);
   }
 }


Kinda working zoomy boi

Kinda working zoomy boi

--- ThomasEditor/utils/graph/GraphControl.xaml.cs
+++ ThomasEditor/utils/graph/GraphControl.xaml.cs
@@ -38,6 +38,9 @@
         double prevMouseX = 0;
         double prevMouseY = 0;

+        enum ManipulateMode { All, Vertical, Horizontal};
+        ManipulateMode currentMode = ManipulateMode.All;
+
         public GraphControl()
         {
             InitializeComponent();
@@ -53,6 +56,7 @@

             this.MouseWheel += GraphControl_MouseWheel;
             this.KeyDown += GraphControl_KeyDown;
+            this.KeyUp += GraphControl_KeyUp;

             translateTransform = new TranslateTransform(0, 0);
             TransformGroup group = new TransformGroup();
@@ -67,12 +71,28 @@

         }

+        private void GraphControl_KeyUp(object sender, KeyEventArgs e)
+        {
+            switch (e.Key)
+            {
+                case Key.LeftShift:
+                case Key.LeftCtrl:
+                    currentMode = ManipulateMode.All;
+                    break;
+            }
+        }
+
         private void GraphControl_KeyDown(object sender, KeyEventArgs e)
         {
             switch (e.Key)
             {
-                case Key.Delete:
-                    gridSpacing -= 1;
+                case Key.LeftShift:
+                    currentMode = ManipulateMode.Vertical;
+                    Cursor = Cursors.SizeNS;
+                    break;
+                case Key.LeftCtrl:
+                    currentMode = ManipulateMode.Horizontal;
+                    Cursor = Cursors.SizeWE;
                     break;
             }

@@ -118,9 +138,9 @@
         {
             Point pos = e.GetPosition(this);
             double delta = e.Delta * 0.01;
-            if(scaleTransform.ScaleX + delta > 1 && scaleTransform.ScaleX + delta < 15)
+            if(scaleTransform.ScaleX + delta > 1 && scaleTransform.ScaleX + delta < 15 && (currentMode == ManipulateMode.Horizontal || currentMode == ManipulateMode.All))
                 scaleTransform.ScaleX += delta;
-            if (scaleTransform.ScaleY + delta > 1 && scaleTransform.ScaleY + delta < 15)
+            if (scaleTransform.ScaleY + delta > 1 && scaleTransform.ScaleY + delta < 15 && (currentMode == ManipulateMode.Vertical || currentMode == ManipulateMode.All))
                 scaleTransform.ScaleY += delta;

@@ -139,14 +159,10 @@
             if(points.Count > 0)
                 start.StartPoint = points[0].p;

-
-            double zoomX = (Math.Round(scaleTransform.ScaleX * 0.5) * 2);
-            double zoomY = (Math.Round(scaleTransform.ScaleX * 0.5) * 2);
-            if (zoomX == 0) zoomX = 1;
-            if (zoomY == 0) zoomY = 1;
-
-            int dynamicGridSpacingX = (int)(gridSpacing / zoomX);
-            int dynamicGridSpacingY = (int)(gridSpacing / zoomY);
+
+
+            int dynamicGridSpacingX = (int)(gridSpacing / scaleTransform.ScaleX);
+            int dynamicGridSpacingY = (int)(gridSpacing / scaleTransform.ScaleY);

             double width = RenderSize.Width != 0 ? RenderSize.Width : 1000;
             double height = RenderSize.Height != 0 ? RenderSize.Height : 1000;
@@ -156,63 +172,68 @@

             int startY = (int)(Math.Round((-translateTransform.Y) / dynamicGridSpacingY) * dynamicGridSpacingY) - dynamicGridSpacingY;
             int endY = (int)(Math.Round(((-translateTransform.Y + height)) / dynamicGridSpacingY) * dynamicGridSpacingY) + dynamicGridSpacingY;
-
             drawingContext.PushTransform(new ScaleTransform(1, -1));
+

             drawingContext.DrawRectangle(Brushes.Gray, null,
                 new Rect(startX - gridSpacing, startY - gridSpacing,
                 Math.Abs(endX-startX) + gridSpacing, Math.Abs(endY-startY) + gridSpacing));
             //grid
+
+            double largestScale = (scaleTransform.ScaleX + scaleTransform.ScaleY)/2;
+

-            for (int x = startX; x < endX; x+= (int)(gridSpacing/zoomX)) // x-axis
-            {
-                drawingContext.DrawLine(new Pen(Brushes.DimGray, 1.0/zoomX), new Point(x, startY), new Point(x, endY));
-
-                if(x != 0)
+            for (int x = startX; x < endX; x+= dynamicGridSpacingX) // x-axis
+            {
+                drawingContext.DrawLine(new Pen(Brushes.DimGray, 1.0/scaleTransform.ScaleX), new Point(x, startY), new Point(x, endY));
+                drawingContext.PushTransform(new ScaleTransform(scaleTransform.ScaleY, scaleTransform.ScaleX));
+                if (x != 0)
                 {

                     FormattedText ft = new FormattedText((x / (float)gridSpacing).ToString(),
                         CultureInfo.GetCultureInfo("en-us"),
                         FlowDirection.LeftToRight,
                         new Typeface("Verdana"),
-                        10.0/zoomX, System.Windows.Media.Brushes.Black);
+                       12/ Math.Pow(largestScale, 2), System.Windows.Media.Brushes.Black);
                     ft.TextAlignment = TextAlignment.Center;
-                    drawingContext.DrawText(ft, new System.Windows.Point(x, 5.0/zoomX));
-                }
-
+                    drawingContext.DrawText(ft, new System.Windows.Point(x/scaleTransform.ScaleY, 1.0/ scaleTransform.ScaleX));
+                }
+                drawingContext.PushTransform(new ScaleTransform(1 / scaleTransform.ScaleY, 1 / scaleTransform.ScaleX));
+
             }

-            for (int y = startY; y < endY; y+= (int)(gridSpacing/zoomY)) //y-axis
-            {
-                drawingContext.DrawLine(new Pen(Brushes.DimGray, 1.0 / zoomY), new Point(startX, y), new Point(endX, y));
-
+            for (int y = startY; y < endY; y+= (int)(gridSpacing/ scaleTransform.ScaleY)) //y-axis
+            {
+                drawingContext.DrawLine(new Pen(Brushes.DimGray, 1.0 / scaleTransform.ScaleY), new Point(startX, y), new Point(endX, y));
+                drawingContext.PushTransform(new ScaleTransform(scaleTransform.ScaleY, scaleTransform.ScaleX));
                 if (y != 0)
                 {
                     FormattedText ft = new FormattedText((-y / (float)gridSpacing).ToString(),
                          CultureInfo.GetCultureInfo("en-us"),
                          FlowDirection.LeftToRight,
                          new Typeface("Verdana"),
-                         10.0/zoomY, System.Windows.Media.Brushes.Black);
+                         12/Math.Pow(largestScale, 2), System.Windows.Media.Brushes.Black);
                     ft.TextAlignment = TextAlignment.Right;
-                    drawingContext.DrawText(ft, new System.Windows.Point(-10.0/zoomY, y-7.5/zoomY));
-                }
-                else
-                {
-                    FormattedText ft = new FormattedText("0",
-                         CultureInfo.GetCultureInfo("en-us"),
-                         FlowDirection.LeftToRight,
-                         new Typeface("Verdana"),
-                         10.0/zoomY, System.Windows.Media.Brushes.Black);
-                    ft.TextAlignment = TextAlignment.Right;
-                    drawingContext.DrawText(ft, new System.Windows.Point(-10.0/zoomY, 5.0/zoomY));
-                }
-
-            }
-
-
+                    drawingContext.DrawText(ft, new System.Windows.Point(-1.0/ scaleTransform.ScaleY, (y/ scaleTransform.ScaleX)));
+                }
+                //else
+                //{
+                //    FormattedText ft = new FormattedText("0",
+                //         CultureInfo.GetCultureInfo("en-us"),
+                //         FlowDirection.LeftToRight,
+                //         new Typeface("Verdana"),
+                //         1.0/ avgScale, System.Windows.Media.Brushes.Black);
+                //    ft.TextAlignment = TextAlignment.Right;
+                //    drawingContext.DrawText(ft, new System.Windows.Point(-1.0/ scaleTransform.ScaleY, 2.0/ scaleTransform.ScaleX));
+                //}
+                  drawingContext.PushTransform(new ScaleTransform(1 / scaleTransform.ScaleY, 1 / scaleTransform.ScaleX));
+
+            }
+          //  drawingContext.PushTransform(new ScaleTransform(1/scaleTransform.ScaleY, 1/scaleTransform.ScaleX));
+
             //axis
-            drawingContext.DrawLine(new Pen(Brushes.Black, 1.0 / zoomX), new Point(startX, 0), new Point(endX, 0));
-            drawingContext.DrawLine(new Pen(Brushes.Black, 1.0 / zoomY), new Point(0, startY), new Point(0, endY));
+            drawingContext.DrawLine(new Pen(Brushes.Black, 1.0 / largestScale), new Point(startX, 0), new Point(endX, 0));
+            drawingContext.DrawLine(new Pen(Brushes.Black, 1.0 / largestScale), new Point(0, startY), new Point(0, endY));

             //unselected points

@@ -543,8 +564,8 @@

         private void MainWindow_MouseMove(object sender, MouseEventArgs e)
         {
-
-            Cursor = Cursors.Arrow;
+            if(currentMode == ManipulateMode.All)
+                Cursor = Cursors.Arrow;
             CustomPoint over = GetPointAt(e.GetPosition(this));
             if (over != null || selectedPoint != null)
             {


Address review - update log message

Address review - update log message

--- ToolBox/SmartInsider/SmartInsiderConverter.cs
+++ ToolBox/SmartInsider/SmartInsiderConverter.cs
@@ -249,7 +249,7 @@

                 if (processedFile.Exists)
                 {
-                    Log.Trace($"SmartInsiderConverter.WriteToFile(): Writing to existing file: {finalFile.FullName}");
+                    Log.Trace($"SmartInsiderConverter.WriteToFile(): Writing from existing processed contents to file: {finalFile.FullName}");
                     fileContents = File.ReadAllLines(processedFile.FullName)
                         .Select(x => (T)CreateSmartInsiderInstance<T>(x))
                         .ToList();


cleaning up in unhandled exception handling

--- src/Mandolin.Console/Program.cs
+++ src/Mandolin.Console/Program.cs
@@ -32,12 +32,18 @@

         private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
         {
-            Console.WriteLine("FATAL ERROR");
-            if (e.IsTerminating)
+            var message = string.Format("(Mandolin) Unhandled exception: {0}", e.ExceptionObject);
+            try
             {
-                Console.WriteLine("Terminating Mandolin");
+                Console.WriteLine(message);
             }
-            Console.WriteLine(e.ExceptionObject);
+            finally
+            {
+                if (e.IsTerminating)
+                {
+                    Environment.FailFast(message);
+                }
+            }
         }
     }
 }


clean dead code

clean dead code


Handling CommandInvocationException.

Handling CommandInvocationException.

--- UltimaRX.Proxy/InjectionApi/CommandHandler.cs
+++ UltimaRX.Proxy/InjectionApi/CommandHandler.cs
@@ -24,7 +24,7 @@
         {
             if (commands.ContainsKey(command.Name))
             {
-                throw new CommandInvocationException($"Command {command.Name} already exists.");
+                throw new InvalidOperationException($"Command {command.Name} already exists.");
             }

             commands = commands.Add(command.Name, command);
@@ -41,33 +41,42 @@

         public void Invoke(string commandInvocationSyntax)
         {
-            var firstSpaceIndex = commandInvocationSyntax.IndexOf(' ');
-            if (firstSpaceIndex < 0)
+            try
             {
-                Command command;
-                string commandName = commandInvocationSyntax.Substring(1, commandInvocationSyntax.Length - 1);
+                var firstSpaceIndex = commandInvocationSyntax.IndexOf(' ');
+                if (firstSpaceIndex < 0)
+                {
+                    Command command;
+                    string commandName = commandInvocationSyntax.Substring(1, commandInvocationSyntax.Length - 1);

-                if (!commands.TryGetValue(commandName, out command))
-                    throw new CommandInvocationException($"Unknown command name {commandInvocationSyntax}");
+                    if (!commands.TryGetValue(commandName, out command))
+                        throw new CommandInvocationException($"Unknown command name {commandInvocationSyntax}");

-                command.Invoke();
+                    command.Invoke();
+                }
+                else
+                {
+                    Command command;
+
+                    var commandName = commandInvocationSyntax.Substring(1, firstSpaceIndex - 1);
+
+                    if (!commands.TryGetValue(commandName, out command))
+                        throw new CommandInvocationException($"Unknown command name {commandInvocationSyntax}");
+
+                    if (firstSpaceIndex + 1 >= commandInvocationSyntax.Length)
+                        throw new CommandInvocationException($"No parameters for command specified {commandInvocationSyntax}");
+
+                    var parameters = commandInvocationSyntax.Substring(firstSpaceIndex + 1,
+                        commandInvocationSyntax.Length - firstSpaceIndex - 1);
+
+                    command.Invoke(parameters);
+                }
+
             }
-            else
+            catch (CommandInvocationException ex)
             {
-                Command command;
-
-                var commandName = commandInvocationSyntax.Substring(1, firstSpaceIndex - 1);
-
-                if (!commands.TryGetValue(commandName, out command))
-                    throw new CommandInvocationException($"Unknown command name {commandInvocationSyntax}");
-
-                if (firstSpaceIndex + 1 >= commandInvocationSyntax.Length)
-                    throw new CommandInvocationException($"No parameters for command specified {commandInvocationSyntax}");
-
-                var parameters = commandInvocationSyntax.Substring(firstSpaceIndex + 1,
-                    commandInvocationSyntax.Length - firstSpaceIndex - 1);
-
-                command.Invoke(parameters);
+                Program.Console.Error(ex.Message);
+                return;
             }
         }


refactor regional requisition to check if a requisition is approved

--- Web/ViewModelBinder/RequestViewModelBinder.cs
+++ Web/ViewModelBinder/RequestViewModelBinder.cs
@@ -54,7 +54,7 @@
             if (regionalRequest.UserProfile != null)
                 regionalRequestViewModel.RequestedBy = regionalRequest.UserProfile.FirstName + " " +
                                                        regionalRequest.UserProfile.LastName;
-            if (regionalRequest.UserProfile1 != null)
+            if (regionalRequest.UserProfile1 != null && regionalRequest.Status == (int) Cats.Models.Constant.RegionalRequestStatus.Approved)
                 regionalRequestViewModel.ApprovedBy = regionalRequest.UserProfile1.FirstName + " " +
                                                       regionalRequest.UserProfile1.LastName;
             return regionalRequestViewModel;


Removed redundant code

Removed redundant code

--- GeoCodeFile/run.csx
+++ GeoCodeFile/run.csx
@@ -8,14 +8,6 @@
 public struct LatLong {
             public double Lat;
             public double Long;
-}
-
-public class AddressEntry {
-    public string AddressLine1 {get;set;}
-    public string AddressLine2 {get;set;}
-    public string AddressLine3 {get;set;}
-    public string AddressLine4 {get;set;}
-    public string PostCode {get;set;}
 }

 public static void Run(CloudBlockBlob myBlob, out string outputBlob,  out string outputSbMsg, TraceWriter log)


修改超时时间 捕捉超时异常

修改超时时间
捕捉超时异常

--- Sample/SimpleClient/Main.cs
+++ Sample/SimpleClient/Main.cs
@@ -8,8 +8,15 @@
 		public static void Load()
 		{
 			Console.WriteLine("load");
-			var task = Session<UTF8StringRequest>.Connect(new Session.Settings("localhost", 12306), 0);
-			task.Wait();
+			var task = Session<UTF8StringRequest>.Connect(new Session.Settings("localhost", 12306), 3000);
+			try
+			{
+				task.Wait();
+			}
+			catch (Exception e)
+			{
+				Console.WriteLine(e.ToString());
+			}
 			s = task.Result;
 			UTF8StringRequest request = new UTF8StringRequest();
 			Console.OnInput += (text) =>


Revise DialogWindow top padding

Revise DialogWindow top padding

--- SetupWizard/DialogWindow.cs
+++ SetupWizard/DialogWindow.cs
@@ -49,7 +49,9 @@
 			this.AlwaysOnTopOfMain = true;
 			this.MinimumSize = new Vector2(200, 200);
 			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
-			this.Padding = new BorderDouble(ApplicationController.Instance.Theme.DefaultContainerPadding);
+
+			var defaultPadding = ApplicationController.Instance.Theme.DefaultContainerPadding;
+			this.Padding = new BorderDouble(defaultPadding, defaultPadding, defaultPadding, 2);
 		}

 		public static void Close(Type type)


Cookies are now cleared when logging in.

--- SharedSource/Facebook/FB.cs
+++ SharedSource/Facebook/FB.cs
@@ -86,6 +86,7 @@
             {
                 InvalidateData();
                 _web.Finish();
+                _web.ClearCookies();
             },
             (url, error, state) => _web.Finish());
 #else
@@ -112,6 +113,7 @@
                 display = "popup",
                 response_type = "token"
             });
+            _web.ClearCookies();
             _web.Navigate(uri, onError: LoginNavigationError, state: callback, startedCallback: LoginNavigationStarted);
             if (_onHideUnity != null)
                 Dispatcher.InvokeOnAppThread(() => { _onHideUnity(true); });


Generate sharpmake solution with vs2019.

--- Sharpmake.Main.sharpmake.cs
+++ Sharpmake.Main.sharpmake.cs
@@ -29,7 +29,7 @@
             result.Add(
                 new Target(
                     Platform.anycpu,
-                    DevEnv.vs2017,
+                    DevEnv.vs2019,
                     Optimization.Debug | Optimization.Release,
                     framework: DotNetFramework.v4_7_2
                 )