Skip to content

Commit 1f8dbbb

Browse files
committed
Implemented Region, fixed Weather
1 parent d28308a commit 1f8dbbb

33 files changed

Lines changed: 2422 additions & 8 deletions
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.IO;
7+
using System.Xml.Linq;
8+
using ESPSharp.Enums;
9+
using ESPSharp.Enums.Flags;
10+
using ESPSharp.Interfaces;
11+
using ESPSharp.Subrecords;
12+
using ESPSharp.SubrecordCollections;
13+
using ESPSharp.DataTypes;
14+
15+
namespace ESPSharp.DataTypes
16+
{
17+
public partial class RegionGrass : IESPSerializable, ICloneable<RegionGrass>, IReferenceContainer
18+
{
19+
public FormID Form { get; set; }
20+
public Byte[] Unknown { get; set; }
21+
22+
public RegionGrass()
23+
{
24+
Form = new FormID();
25+
Unknown = new byte[4];
26+
}
27+
28+
public RegionGrass(FormID Form, Byte[] Unknown)
29+
{
30+
this.Form = Form;
31+
this.Unknown = Unknown;
32+
}
33+
34+
public RegionGrass(RegionGrass copyObject)
35+
{
36+
Form = copyObject.Form.Clone();
37+
Unknown = (Byte[])copyObject.Unknown.Clone();
38+
}
39+
40+
public void ReadBinary(ESPReader reader)
41+
{
42+
try
43+
{
44+
Form.ReadBinary(reader);
45+
Unknown = reader.ReadBytes(4);
46+
}
47+
catch
48+
{
49+
return;
50+
}
51+
}
52+
53+
public void WriteBinary(ESPWriter writer)
54+
{
55+
Form.WriteBinary(writer);
56+
if (Unknown == null)
57+
writer.Write(new byte[4]);
58+
else
59+
writer.Write(Unknown);
60+
}
61+
62+
public void WriteXML(XElement ele, ElderScrollsPlugin master)
63+
{
64+
XElement subEle;
65+
66+
ele.TryPathTo("Form", true, out subEle);
67+
Form.WriteXML(subEle, master);
68+
69+
ele.TryPathTo("Unknown", true, out subEle);
70+
subEle.Value = Unknown.ToHex();
71+
}
72+
73+
public void ReadXML(XElement ele, ElderScrollsPlugin master)
74+
{
75+
XElement subEle;
76+
77+
if (ele.TryPathTo("Form", false, out subEle))
78+
{
79+
Form.ReadXML(subEle, master);
80+
}
81+
82+
if (ele.TryPathTo("Unknown", false, out subEle))
83+
{
84+
Unknown = subEle.ToBytes();
85+
}
86+
}
87+
88+
public RegionGrass Clone()
89+
{
90+
return new RegionGrass(this);
91+
}
92+
}
93+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<#@ template debug="false" hostspecific="false" language="C#" #>
2+
<#@ output extension=".cs" #>
3+
<#
4+
DataTypeTemplate template = new DataTypeTemplate();
5+
template.ClassName = "RegionGrass";
6+
7+
DataTypeField tempField;
8+
9+
tempField =
10+
new DataTypeField(
11+
typeof(FormID),
12+
"Form",
13+
"Form"
14+
);
15+
template.Fields.Add(tempField);
16+
17+
tempField =
18+
new DataTypeField(
19+
typeof(byte[]),
20+
"Unknown",
21+
"Unknown"
22+
);
23+
tempField.byteCount = 4;
24+
template.Fields.Add(tempField);
25+
#>
26+
<#@ include file="DataTypeTemplate.t4" once="true" #>

0 commit comments

Comments
 (0)