-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOriginalGameImageData.cs
104 lines (90 loc) · 3.7 KB
/
OriginalGameImageData.cs
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HtmlExporterPlugin
{
class OriginalGameImageData
{
public string CoverImageFile { get; set; } = String.Empty;
public string BackgroundImageFile { get; set; } = String.Empty;
public string IconImageFile { get; set; } = String.Empty;
public long CoverImageSize { get; set; } = -1;
public long BackgroundImageSize { get; set; } = -1;
public long IconImageSize { get; set; } = 0;
public DateTime IconImageLastWriteTime { get; set; } = DateTime.FromFileTimeUtc(0);
public DateTime CoverImageLastWriteTime { get; set; } = DateTime.FromFileTimeUtc(0);
public DateTime BackgroundImageLastWriteTime { get; set; } = DateTime.FromFileTimeUtc(0);
public OriginalGameImageData()
{
}
public void SetCoverImageData(string CoverImageFilename)
{
CoverImageFile = Path.GetFileName(CoverImageFilename);
if (File.Exists(CoverImageFilename))
{
FileInfo info = new FileInfo(CoverImageFilename);
CoverImageSize = info.Length;
CoverImageLastWriteTime = info.LastWriteTime;
}
else
{
CoverImageSize = -1;
CoverImageLastWriteTime = DateTime.FromFileTimeUtc(0);
}
}
public void SetBackgroundImageData(string BackgroundImageFilename)
{
BackgroundImageFile = Path.GetFileName(BackgroundImageFilename);
if (File.Exists(BackgroundImageFilename))
{
FileInfo info = new FileInfo(BackgroundImageFilename);
BackgroundImageSize = info.Length;
BackgroundImageLastWriteTime = info.LastWriteTime;
}
else
{
BackgroundImageSize = -1;
BackgroundImageLastWriteTime = DateTime.FromFileTimeUtc(0);
}
}
public void SetIconImageData (string IconImageFilename)
{
IconImageFile = Path.GetFileName(IconImageFilename);
if (File.Exists(IconImageFilename))
{
FileInfo info = new FileInfo(IconImageFilename);
IconImageSize = info.Length;
IconImageLastWriteTime = info.LastWriteTime;
}
else
{
IconImageSize = -1;
IconImageLastWriteTime = DateTime.FromFileTimeUtc(0);
}
}
public void SetAllData(string CoverImageFilename, string BackgroundImageFilename, string IconImageFilename)
{
SetIconImageData(IconImageFilename);
SetBackgroundImageData(BackgroundImageFilename);
SetCoverImageData(CoverImageFilename);
}
public bool CoverImageSame(string filename)
{
DateTime LastWriteTime = File.Exists(filename) ? new FileInfo(filename).LastWriteTime : DateTime.FromFileTimeUtc(0);
return LastWriteTime.Equals(CoverImageLastWriteTime);
}
public bool BackgroundImageSame(string filename)
{
DateTime LastWriteTime = File.Exists(filename) ? new FileInfo(filename).LastWriteTime : DateTime.FromFileTimeUtc(0);
return LastWriteTime.Equals(BackgroundImageLastWriteTime);
}
public bool IconImageSame(string filename)
{
DateTime LastWriteTime = File.Exists(filename) ? new FileInfo(filename).LastWriteTime : DateTime.FromFileTimeUtc(0);
return LastWriteTime.Equals(IconImageLastWriteTime);
}
}
}