천호석
2023-05-15 0de38c0ebeb49d545ae1d2267f2b932392bd583c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using SA_LTT.Base;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace SA_LTT.Info.EquipmentInfo
{
    public class EquipmentInfo : XmlManager<EquipmentInfo>
    {
        readonly string _fileName = "EquipmentInfo.xml";
        readonly string _filePath = @"Equipment\";
 
        public DateTime EnergyDropCheckDate { get; set; }
        public DateTime AttenuatorCalDate { get; set; }
 
        public EquipmentInfo()
        {
            EnergyDropCheckDate = DateTime.Now;
            AttenuatorCalDate = DateTime.Now;
        }
        
        public void Refresh()
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(Equipment.infoFilePath + _filePath);
 
            if (directoryInfo.Exists == false)
            {
                directoryInfo.Create();
            }
 
            FileInfo fileInfo = new FileInfo(directoryInfo.FullName + _fileName);
 
            if (fileInfo.Exists == false)
            {
                SaveFile(fileInfo.FullName, this);
            }
            else
            {
                EquipmentInfo equipmentInfo = new EquipmentInfo();
 
                equipmentInfo = ReadFile(fileInfo.FullName);
 
                Copy(equipmentInfo);
            }
        }
 
        public void SetEnergyDropCheckDate()
        {
            EnergyDropCheckDate = DateTime.Now;
 
            SaveFile(Equipment.infoFilePath + _filePath + _fileName, this);
        }
 
        public void SetAttenuatorCalDate()
        {
            AttenuatorCalDate = DateTime.Now;
            SaveFile(Equipment.infoFilePath + _filePath + _fileName, this);
        }
    }
}