Ejemplo n.º 1
0
        private CFileInfo Get_File_Info(string filePath)
        {
            bool isDir = CCommon.IsDir(filePath);

            CFileInfo file_info = new CFileInfo();

            file_info.name = System.IO.Path.GetFileName(filePath);

            file_info.extOrDir = System.IO.Path.GetExtension(filePath);
            if (isDir)
            {
                file_info.extOrDir = "Dir";
            }

            if (!isDir)
            {
                file_info.size = new FileInfo(filePath).Length;
            }
            return(file_info);
        }
Ejemplo n.º 2
0
        string prepareItemLine(int idx, bool needSizeForFolder = false)
        {
            string    currentItemFullName = directoryItems[idx];
            CFileInfo fInfo = Get_File_Info(currentItemFullName);

            string name = System.IO.Path.GetFileNameWithoutExtension(fInfo.name);

            if (name.Length > 22)
            {
                name = name.Substring(0, 19) + "...";
            }
            while (name.Length < 22)
            {
                name += " ";
            }

            string ext = fInfo.extOrDir;

            if (ext.StartsWith("."))
            {
                ext = ext.Remove(0, 1);
            }
            while (ext.Length < 3)
            {
                ext += " ";
            }

            string size = fInfo.size.ToString();

            if (needSizeForFolder & CCommon.IsDir(currentItemFullName))
            {
                size = CCommon.GetFolderSizeInBytes(currentItemFullName).ToString();
            }

            return(name + " " + ext + " " + String.Format("{0,10}", size));
        }