2026-01-26 18:56:53 +09:00

67 lines
3.2 KiB
C#

/*
* Copyright (c) 2022 LG Electronics Inc.
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
*/
using Aurora.Api;
using Aurora.View;
using PropertyTools.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AuroraUIComponent.Sequence
{
public class CsvLogSetting : NotifyPropertyChangedBase, ISettingItem
{
public class LogItem : NotifyPropertyChangedBase
{
private bool _Enable = false; // 활성화 여부
public bool Enable { get => _Enable; set => SetProperty(ref _Enable, value); }
private string _LogDir = string.Empty; // DataPath 하위 폴더명
public string LogDir { get => _LogDir; set => SetProperty(ref _LogDir, value); }
private string _Name = string.Empty; // Log Name
public string Name { get => _Name; set => SetProperty(ref _Name, value); }
private string _Prefix = string.Empty; // 로그 이름 prefix
public string Prefix { get => _Prefix; set => SetProperty(ref _Prefix, value); }
private string _Postfix = string.Empty; // 로그 이름 postfix
public string Postfix { get => _Postfix; set => SetProperty(ref _Postfix, value); }
private int _MaxFileSizeInMB = -1; // 최대 파일 크기 (MB)
public int MaxFileSizeInMB { get => _MaxFileSizeInMB; set { SetProperty(ref _MaxFileSizeInMB, value < 1024 ? value : 1024); } } /// Max 제한 1GB
private int _MaxLogCount = -1; // 최대 로그 개수
public int MaxLogCount { get => _MaxLogCount; set { SetProperty(ref _MaxLogCount, value); } }
private int _MaxTimeIntervalInMinute = -1;
public int MaxTimeIntervalInMinute { get => _MaxTimeIntervalInMinute; set => SetProperty(ref _MaxTimeIntervalInMinute, value); }
private bool _ReUseFileIfExist = false;
public bool ReUseFileIfExist { get => _ReUseFileIfExist; set => SetProperty(ref _ReUseFileIfExist, value); }
// 저장하는 대신 폴더의 마지막 날짜를 get하는 것으로 변경. 세팅으로 저장하면 save 상황에서 무한루프...
//private string _LastFileName = string.Empty;
//public string LastFileName { get => _LastFileName; set => SetProperty(ref _LastFileName, value); }
public void Copy(LogItem setting)
{
this.Enable = setting.Enable;
this.Name = setting.Name;
this.LogDir = setting.LogDir;
this.Prefix = setting.Prefix;
this.Postfix = setting.Postfix;
this.MaxFileSizeInMB = setting.MaxFileSizeInMB;
this.MaxLogCount = setting.MaxLogCount;
this.MaxTimeIntervalInMinute = setting.MaxTimeIntervalInMinute;
this.ReUseFileIfExist = setting.ReUseFileIfExist;
//this.LastFileName = setting.LastFileName;
}
}
[DisplayName("LogItem")]
public ObservableCollection<LogItem> Items { get; set; } = new ObservableCollection<LogItem>();
}
}