Files
DDUtility/DDUtilityApp/LOGPARSER/DATA/LogFile.cs
2025-03-07 11:57:24 +09:00

87 lines
2.0 KiB
C#

using System;
using System.IO;
using System.Windows.Forms.DataVisualization.Charting;
using DDUtilityApp.DATA;
using JWH.DATA;
namespace DDUtilityApp.LOGPARSER.DATA
{
/// <summary>
/// 로그 파일 정보
/// </summary>
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,
}
}