public Modpack(Stream modpackStream)
{
using (Stream stream = modpackStream)
using (XmlReader xml = XmlReader.Create(stream))
{
xml.ReadToFollowing("AA2Modpack");
xml.MoveToFirstAttribute();
Revision = xml.ReadContentAsInt();
if (Revision != CurrentRev)
throw new ArgumentException("Modpack supplied is invalid or not supported.");
xml.ReadToFollowing("title");
Name = xml.ReadElementContentAsString();
xml.ReadToFollowing("description");
Description = xml.ReadElementContentAsString();
xml.ReadToFollowing("authors");
Authors = xml.ReadElementContentAsString();
xml.ReadToFollowing("version");
Version = xml.ReadElementContentAsInt();
while (xml.ReadToFollowing("mod"))
{
xml.ReadToFollowing("name");
string name = xml.ReadElementContentAsString();
xml.ReadToFollowing("url");
Uri uri = new Uri(xml.ReadElementContentAsString());
Mods.Add(new ModDL(name, uri));
}
}
}