Compare commits

..

No commits in common. "3c7828c270b0f7da91b8dd5fd705d76ca1e32f63" and "85dc7bdff4548f4d52b18fd133ea804f01431a5d" have entirely different histories.

View file

@ -59,12 +59,9 @@ namespace AFCExplorer
{ {
if (fn == "." || fn == "..") continue; if (fn == "." || fn == "..") continue;
afc.afc_get_file_info(afcHandle, path + fn, out ReadOnlyCollection<string> fileInfo).ThrowOnError(); afc.afc_get_file_info(afcHandle, path + fn, out ReadOnlyCollection<string> fileInfo).ThrowOnError();
Dictionary<string, string> fileInfoD = new Dictionary<string, string>(); string readableSize = FormatBytes(ulong.Parse(fileInfo[1]));
for (int i = 0; i < fileInfo.Count; i += 2) fileInfoD.Add(fileInfo[i], fileInfo[i+1]); string readableType = fileInfo[7] == "S_IFDIR" ? "Directory" : "File";
//MessageBox.Show(string.Join("\n", fileInfo)); int unixSeconds = (int)(((long.Parse(fileInfo[9]) / 1000) / 1000) / 1000);
string readableSize = FormatBytes(ulong.Parse(fileInfoD["st_size"]));
string readableType = ReadableTypes[fileInfoD["st_ifmt"]];
int unixSeconds = (int)(((long.Parse(fileInfoD["st_mtime"]) / 1000) / 1000) / 1000);
string readableTime = DateTimeOffset.FromUnixTimeSeconds(unixSeconds).DateTime.ToString(); string readableTime = DateTimeOffset.FromUnixTimeSeconds(unixSeconds).DateTime.ToString();
afcDirectory.Add(new AFCFileType(fn, readableType, readableTime, readableSize)); afcDirectory.Add(new AFCFileType(fn, readableType, readableTime, readableSize));
} }
@ -362,12 +359,5 @@ namespace AFCExplorer
return string.Format("{0:0.##} {1}", dblSByte, Suffix[i]); return string.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
} }
public static Dictionary<string, string> ReadableTypes = new Dictionary<string, string>
{
{ "S_IFDIR", "Directory" },
{ "S_IFREG", "File" },
{ "S_IFLNK", "Symbolic Link" },
};
} }
} }