示例#1
0
        private void ShowAnItem(int i)
        {
            int    idx      = start + i;
            string itemLine = prepareItemLine(idx);
            bool   isSelect = (idx) == current;

            bool isDir  = CCommon.IsDir(directoryItems[idx]);
            bool isFile = CCommon.IsFile(directoryItems[idx]);

            ConsoleColor tmp = Console.ForegroundColor;

            if (isDir)
            {
                Console.ForegroundColor = ConsoleColor.White;
            }
            if (isFile)
            {
                Console.ForegroundColor = ConsoleColor.Green;
            }

            ShowLineInPosition(left + 1, top + 4 + i, itemLine, isSelect);
            if (isSelect)
            {
                ShowItemInfo(idx);
            }
            Console.ForegroundColor = tmp;
        }
示例#2
0
        private void ShowItemInfo(int itemIdx)
        {
            string item = directoryItems[itemIdx];

            if (item == "...")
            {
                CCommon.ShowLineInPosition(left + 1, top + height - 3, new string(' ', width - 2), ConsoleColor.DarkBlue, ConsoleColor.White);
                return;
            }

            string itemInfoLine = "";

            if (CCommon.IsDir(item))
            {
                long dirSize       = CCommon.GetFolderSizeInBytes(item);
                long numberOfFiles = CCommon.GetNumberOfFilesInFolder(item);
                itemInfoLine = $"size: {dirSize}  num of files: {numberOfFiles}";
            }

            if (CCommon.IsFile(item))
            {
                FileInfo fileInfo = new FileInfo(item);
                long     fileSize = fileInfo.Length;
                itemInfoLine = $"size: {fileSize}";
            }

            itemInfoLine = itemInfoLine.PadRight(width - 2, ' ');
            CCommon.ShowLineInPosition(left + 1, top + height - 3, itemInfoLine, ConsoleColor.DarkBlue, ConsoleColor.White);
        }
示例#3
0
        public void ShowSizeOfCurrentItem()
        {
            string currentLine       = prepareItemLine(current, true);
            int    lineNumberInPanel = current - start;
            bool   isDir             = CCommon.IsDir(directoryItems[lineNumberInPanel]);
            bool   isFile            = CCommon.IsFile(directoryItems[lineNumberInPanel]);

            ConsoleColor tmp = Console.ForegroundColor;

            if (isDir)
            {
                Console.ForegroundColor = ConsoleColor.White;
            }
            if (isFile)
            {
                Console.ForegroundColor = ConsoleColor.Green;
            }
            ShowLineInPosition(left + 1, top + 4 + lineNumberInPanel, currentLine, true);
            Console.ForegroundColor = tmp;
        }