forked from Hitachi-Momoka/krkrfgformat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPictureInfo.cs
184 lines (168 loc) · 4.62 KB
/
PictureInfo.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace Li.Text
{
public class PictureInfo
{
[JsonProperty(PropertyName = "layer_type")]
public int LayerType
{
get;
set;
}
[JsonProperty(PropertyName = "name")]
public string Name
{
get;
set;
}
[JsonProperty(PropertyName = "left")]
public int Left
{
get;
set;
}
[JsonProperty(PropertyName = "top")]
public int Top
{
get;
set;
}
[JsonProperty(PropertyName = "width")]
public int Width
{
get;
set;
}
[JsonProperty(PropertyName = "height")]
public int Height
{
get;
set;
}
[JsonProperty(PropertyName = "type")]
public int Type
{
get;
set;
}
[JsonProperty(PropertyName = "opacity")]
public int Opacity
{
get;
set;
}
[JsonProperty(PropertyName = "visible")]
public int Visible
{
get;
set;
}
[JsonProperty(PropertyName = "layer_id")]
public int LayerId
{
get;
set;
}
[JsonProperty(PropertyName = "group_layer_id")]
public int GroupLayerId
{
get;
set;
}
[JsonProperty(PropertyName = "base")]
public int Base
{
get;
set;
}
[JsonProperty(PropertyName = "images")]
public int Images
{
get;
set;
}
public PictureInfo()
{
LayerType = 0;
Name = string.Empty;
Left = 0;
Top = 0;
Width = 0;
Height = 0;
Type = 0;
Opacity = 0;
Visible = 0;
LayerId = 0;
GroupLayerId = 0;
Base = 0;
Images = 0;
}
public PictureInfo(string readline)
{
List<string> list = new List<string>();
if (readline != string.Empty)
{
string text = string.Empty;
for (int i = 0; i < readline.Length; i++)
{
if (readline[i] != '\t')
{
text += readline[i].ToString();
}
else
{
if (text == string.Empty)
{
list.Add("0");
text = string.Empty;
continue;
}
list.Add(text);
text = string.Empty;
}
if (list.Count == 13)
{
break;
}
}
}
if (list.Count < 13)
{
throw new Exception("txt文件内容格式错误");
}
LayerType = Convert.ToInt32(list[0]);
Name = list[1];
Left = Convert.ToInt32(list[2]);
Top = Convert.ToInt32(list[3]);
Width = Convert.ToInt32(list[4]);
Height = Convert.ToInt32(list[5]);
Type = Convert.ToInt32(list[6]);
Opacity = Convert.ToInt32(list[7]);
Visible = Convert.ToInt32(list[8]);
LayerId = Convert.ToInt32(list[9]);
GroupLayerId = Convert.ToInt32(list[10]);
Base = Convert.ToInt32(list[11]);
Images = Convert.ToInt32(list[12]);
}
public override string ToString()
{
string tmp = "";
tmp += (this.LayerType + "\t");
tmp += (this.Name + "\t");
tmp += (this.Left + "\t");
tmp += (this.Top + "\t");
tmp += (this.Width + "\t");
tmp += (this.Height + "\t");
tmp += (this.Type + "\t");
tmp += (this.Opacity + "\t");
tmp += (this.Visible + "\t");
tmp += (this.LayerId + "\t");
tmp += (this.GroupLayerId + "\t");
tmp += (this.Base + "\t");
tmp += (this.Images + "\t");
return tmp;
}
}
}