コード例 #1
0
        // ReSharper disable once UnusedParameter.Local
        private string ShiftProgram(Editor doc, ShiftViewModel shift)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();
            var num = Convert.ToDouble(ShiftViewModel.Instance.DiffValues.X);
            var num2 = Convert.ToDouble(ShiftViewModel.Instance.DiffValues.Y);
            var num3 = Convert.ToDouble(ShiftViewModel.Instance.DiffValues.Z);
            var regex = new Regex(ShiftRegex, RegexOptions.IgnoreCase);
            var matchCollection = regex.Matches(doc.Text);
            var count = matchCollection.Count;
           
            var num5 = (double)((count > 0) ? (100 / count) : count);
            foreach (Match match in regex.Matches(doc.Text))
            {
                // ReSharper disable UnusedVariable
                 var num6 = Convert.ToDouble(match.Groups[3].Value) + num;

                var num7 = Convert.ToDouble(match.Groups[4].Value) + num2;

                var num8 = Convert.ToDouble(match.Groups[5].Value) + num3;
                // ReSharper restore UnusedVariable
                switch (RobotType)
                {
                    case Typlanguage.KUKA:
                        doc.ReplaceAll();
                        break;

                    case Typlanguage.ABB:
                        doc.ReplaceAll();
                        break;
                }
            }
            Thread.Sleep(500);
            stopwatch.Stop();
            Console.WriteLine("{0}ms to parse shift", stopwatch.ElapsedMilliseconds);
            return doc.Text;
        }
コード例 #2
0
 public ShiftClass ShiftProgram(IEditorDocument doc, ShiftViewModel shift)
 {
     ShiftClass result;
     if (doc is KukaViewModel)
     {
         var kukaViewModel = doc as KukaViewModel;
         var shiftClass = new ShiftClass
         {
             Source = ShiftProgram(kukaViewModel.Source, shift)
         };
         if (!string.IsNullOrEmpty(kukaViewModel.Data.Text))
         {
             shiftClass.Data = ShiftProgram(kukaViewModel.Data, shift);
         }
         result = shiftClass;
     }
     else
     {
         var shiftClass = new ShiftClass
         {
             Source = ShiftProgram(doc.TextBox, shift)
         };
         result = shiftClass;
     }
     return result;
 }