Ejemplo n.º 1
0
        private UILoadMenu() : base()
        {
            _saves   = new ItemsHolder(new RectangleF(512 + 256 + 32, 512 + 256 + 192, 512 + 64, 64), 1, 256 + 32, LoadLocked);
            _btnBack = new Button(new Vector2(Globals.ButtonXPos, Globals.BackButtonPosY), "BACK", null, Globals.ChangeWindowTo, "Main", type: ButtonType.back);
            _btnLoad = new Button(new Vector2(Globals.ButtonXPos + 1024 + 256, 64), "LOAD", null, Globals.ChangeWindowTo, "Main", ButtonType.small);

            List <string> paths = CustomSearcher.GetDirectories(Directory.GetCurrentDirectory() + "/Save", "*");

            if (paths.Count > 0)
            {
                for (int i = 0; i < paths.Count; i++)
                {
                    string[] directories = paths[i].Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
                    _saves.Items.Add(new ListItemLoad(i, _saves.Boundary, directories[directories.Length - 2] + "/" + directories[directories.Length - 1] + "/" + directories[directories.Length - 1] + ".png", directories[directories.Length - 1]));
                }
            }
        }
Ejemplo n.º 2
0
        public void Search(string directory)
        {
            _path = Path.Combine(_path, directory);

            _directories = CustomSearcher.GetDirectories(_path, "*");
            _files       = CustomSearcher.GetFiles(_path, "*");

            foreach (string dir in _directories.Reverse <string>())
            {
                try
                {
                    Directory.GetDirectories(dir);
                }
                catch (Exception)
                {
                    _directories.Remove(dir);
                }
            }

            _foldersFiles.Items.Clear();

            if (Path.GetPathRoot(_path) != _path)
            {
                _foldersFiles.Items.Add(new ListItemFileFolder(0, _foldersFiles.Boundary, "…"));

                for (int x = 0; x < _directories.Count; x++)
                {
                    _foldersFiles.Items.Add(new ListItemFileFolder(x + 1, _foldersFiles.Boundary, Path.GetFileName(_directories[x])));
                }
                for (int x = 0; x < _files.Count; x++)
                {
                    _foldersFiles.Items.Add(new ListItemFileFolder(x + 1 + _directories.Count, _foldersFiles.Boundary, Path.GetFileName(_files[x]), false, FileFolder.file));
                }
            }
            else
            {
                for (int x = 0; x < _directories.Count; x++)
                {
                    _foldersFiles.Items.Add(new ListItemFileFolder(x, _foldersFiles.Boundary, Path.GetFileName(_directories[x])));
                }
            }

            _foldersFiles.Reset();
            _block.ChangeText(_path);
        }