-
Notifications
You must be signed in to change notification settings - Fork 2
/
FuiImageInfo.cs
88 lines (74 loc) · 2.5 KB
/
FuiImageInfo.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
using System.Collections.Generic;
using FuiEditor.Utils;
namespace FuiEditor
{
class FuiImageInfo
{
public static readonly int NativeSize = 32;
private int descriptor;
private int attribute;
private int imageWidth;
private int imageHeight;
private int imageOffset;
private int imageSize;
private int unkOffset;
private int unk_0x1C;
public FuiImageInfo()
{
}
public void Read(byte[] filedata, int startIndex)
{
descriptor = FuiUtils.ToInt32(filedata, startIndex + 0);
attribute = FuiUtils.ToInt32(filedata, startIndex + 4);
imageWidth = FuiUtils.ToInt32(filedata, startIndex + 8);
imageHeight = FuiUtils.ToInt32(filedata, startIndex + 12);
imageOffset = FuiUtils.ToInt32(filedata, startIndex + 16);
imageSize = FuiUtils.ToInt32(filedata, startIndex + 20);
unkOffset = FuiUtils.ToInt32(filedata, startIndex + 24);
unk_0x1C = FuiUtils.ToInt32(filedata, startIndex + 28);
}
public byte[] ToByteArray()
{
List<byte> byteList = new List<byte>();
byteList.AddRange(FuiUtils.GetBytes(descriptor));
byteList.AddRange(FuiUtils.GetBytes(attribute));
byteList.AddRange(FuiUtils.GetBytes(imageWidth));
byteList.AddRange(FuiUtils.GetBytes(imageHeight));
byteList.AddRange(FuiUtils.GetBytes(imageOffset));
byteList.AddRange(FuiUtils.GetBytes(ImageSize));
byteList.AddRange(FuiUtils.GetBytes(unkOffset));
byteList.AddRange(FuiUtils.GetBytes(unk_0x1C));
return byteList.ToArray();
}
public int ImageOffset
{
get => imageOffset;
set => imageOffset = value;
}
public int ImageSize
{
get => imageSize;
set => imageSize = value;
}
public int Width
{
get => imageWidth;
set => imageWidth = value;
}
public int Height
{
get => imageHeight;
set => imageHeight = value;
}
public int Descriptor
{
get => descriptor;
set => descriptor = value;
}
public int Attribute
{
get => attribute;
set => attribute = value;
}
}
}