Ejemplo n.º 1
0
        private void ListContents(string path)
        {
            try
            {
                string[] folders = PMFAT.GetFolders(path);
                string[] files   = PMFAT.GetFiles(path);

                CLI.WriteLine("Showing contents of directory \"" + path + "\"");

                // draw folders
                for (int i = 0; i < folders.Length; i++)
                {
                    CLI.WriteLine(folders[i], Color.Yellow);
                }

                // draw files
                for (int i = 0; i < files.Length; i++)
                {
                    Cosmos.System.FileSystem.Listing.DirectoryEntry attr = PMFAT.GetFileInfo(path + files[i]);
                    if (attr != null)
                    {
                        CLI.Write(files[i], Color.White);
                        CLI.SetCursorPos(30, CLI.CursorY);
                        CLI.WriteLine(attr.mSize.ToString() + " BYTES", Color.Gray);
                    }
                    else
                    {
                        CLI.WriteLine("Error retrieiving file info", Color.Red);
                    }
                }

                CLI.WriteLine("");
                CLI.Write("Total folders: " + folders.Length.ToString());
                CLI.WriteLine("        Total files: " + files.Length.ToString());
            }
            catch (Exception ex) { }
        }