using System; using System.IO; using System.Windows.Forms.DataVisualization.Charting; using DDUtilityApp.DATA; using JWH.DATA; namespace DDUtilityApp.LOGPARSER.DATA { /// /// 로그 파일 정보 /// public class LogFile : DataTableBase { private string m_FullName = string.Empty; public Account Account { get; set; } = null; public string FullName { get { return this.m_FullName; } set { this.m_FullName = value; this.DirectoryName = Path.GetDirectoryName(value); this.FileName = Path.GetFileName(value); this.Name = Path.GetFileNameWithoutExtension(value); this.Extension = Path.GetExtension(value); } } public string DirectoryName { get; private set; } public string FileName { get; private set; } public string Name { get; private set; } public string Extension { get; private set; } public long Length { get; set; } public DateTime CreationTime { get; set; } public DateTime LastAccessTime { get; set; } public DateTime LastWriteTime { get; set; } public string DestFullName { get; set; } public LogFile() { } public LogFile(string fullName) { this.FullName = fullName; } public string GetFileSize(FileSizeType format = FileSizeType.Auto) { int index = 0; int nFormat = (int)format; double value = this.Length; for (index = 0; index < nFormat; index++) { if (format == FileSizeType.Auto && value < 1024) break; value /= 1024; } return $"{value.ToString("N2")} {(FileSizeType)index}"; } } public enum FileSizeType { Bt = 0, KB = 1, MB = 2, GB = 3, TB = 4, Auto = 9, } }