Beispiel #1
0
        /// <summary>
        /// На уровыень выше
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bLvlUp_Click(object sender, RoutedEventArgs e)
        {
            int curPathLength = CurrentPath.Length;
            // Определяем количество слэшей в пути
            string pattern    = "\\";
            int    slashCount = new Regex(Regex.Escape(pattern)).Matches(CurrentPath).Count;

            // MessageBox.Show(amount.ToString()); C:/Work/folder - 2

            // C:/ Если слэш один и путь состоит из названия диска - Показываем диски
            if ((slashCount <= 1) && (curPathLength <= 3))
            {
                GetAddDrivesToListBox();
            }
            // C:/Work Если слэш один, но это верхняя папка на диске
            else if ((slashCount <= 1) && (curPathLength > 3))
            {
                // находим слэш и удаляем знаки до конца строки C:/Work -> C:/
                int slashZnak = CurrentPath.IndexOf('\\') + 1;
                CurrentPath = CurrentPath.Remove(slashZnak);

                GetItemsToListBox();
            }
            //C:/Work/folder если Слэшей больше одного
            else
            {
                // показываем путь отняв последний слэш C:/Work/folder -> C:/Work/folder
                int position = currentPath.LastIndexOf('\\'); // где в последний раз находили слэш - +1
                CurrentPath = CurrentPath.Remove(position);
                GetItemsToListBox();
            }
        }
Beispiel #2
0
            private string ComputeEnvVar()
            {
                Debug.Assert(MiscHelpers.IsAnEnvVarPath(CurrentPath));
                Debug.Assert(CurrentPath[0] == MiscHelpers.ENVVAR_PERCENT);
                var indexClose = CurrentPath.IndexOf(MiscHelpers.ENVVAR_PERCENT, 1);

                Debug.Assert(indexClose > 1);
                return(CurrentPath.Substring(0, indexClose + 1));
            }
Beispiel #3
0
            private string ComputeEnvironmentVariable()
            {
                //Debug.Assert(MiscHelpers.IsAnEnvVarPath(CurrentPath));
                //Debug.Assert(CurrentPath[0] == MiscHelpers.ENVVAR_PERCENT);

                var indexClose = CurrentPath.IndexOf(MiscHelpers.EnvironmentVariablePercent, 1);

                //Debug.Assert(indexClose > 1);

                return(CurrentPath.Substring(0, indexClose + 1));
            }
Beispiel #4
0
 public bool CheckPathDestination()
 {
     //if we reached the destination tile
     if (CurrentPath.IndexOf(CurrentTile) == 0)
     {
         IsMoving = false;
         //GetComponent<Animation>().CrossFade("idle");
         //EventManager.TriggerEvent(cEvents.DESTINATION_REACHED);
         DestinationReached();
         return(true);
     }
     else
     {
         //curTile becomes the next one
         CurrentTile = CurrentPath[CurrentPath.IndexOf(CurrentTile) - 1];
         NextTilePos = GetWorldTilePos(CurrentTile.GridTile);
         return(false);
     }
 }
Beispiel #5
0
        /// <summary>
        /// Subroutines each have an individual header file
        /// </summary>
        /// <param name="cntxt"></param>
        void GenerateSubroutines()
        {
            foreach (List <Point> pl in CurrentPath)
            {
                CurrentPathIndex = CurrentPath.IndexOf(pl);
                BindableCodeTemplate tmpl;
                StringBuilder        sb = new StringBuilder();
                Bind(ref sb, _context.Templates.Header_Template);

                // add start of path
                Bind(ref sb, PathStartTemplate());

                // now generate points in path
                PathFragment points = new PathFragment(pl);
                //(_context.UseRotaryTable)
                //? MapToCylindricalList(pl) : MapToCartesianList(pl);
                if (!_context.UseAbsoluteMoves)
                {
                    points = OffsetList(points);
                }
                // loop round points in list
                foreach (Cartesian coord in points)
                {
                    CurrentPoint = coord;
                    tmpl         = (coord is Cartesian)
                         ?_context.Templates.XY_Point_Template
                         :_context.Templates.RA_Point_Template;

                    Bind(ref sb, tmpl);
                }
                // add end of path
                Bind(ref sb, PathEndTemplate());

                // now deal with name
                tmpl             = _context.Templates.SubFilenameTemplate;
                tmpl.DataContext = _context;
                Code.Add(new GcodeFile(tmpl.Text, sb.ToString()));
            }
        }