private void DownloadLatestACR()
{
// Download the latest ACR patch.
Program.LogEvent(string.Format("Downloading latest ACR patch..."));
WebClient downloader = new WebClient();
wcDownloader.DownloadFile(PatchURL, "patch.xml");
// Load the patch document.
XDocument PatchDoc = XDocument.Load("patch.xml");
// Load servers.
ServerList = PatchDoc.Root.Element("servers").Elements().ToDictionary(el => (int)el.Attribute("id"), el => (string)el.Attribute("url"));
if (ServerList.Count == 0) throw new Exception("No download servers found. Contact the technical administrator.");
Program.LogEvent(string.Format("Found {0} servers.", ServerList.Count));
// Parse module dependency/ADL resoures.
List<XElement> resources = PatchDoc.Root.Element("module_externs").Elements().ToList();
for (int i = 0; i < resources.Count; i++) ADLResources.Add(new ADLResource(resources[i]));
if (ADLResources.Count == 0) throw new Exception("No resources found. Contact the technical administrator.");
Program.LogEvent(string.Format("Loaded {0} resource entries.", ADLResources.Count));
// Update ADL resources.
string DownloadFolder = GetHomeSubfolder("staging\\client");
foreach (ADLResource resource in ADLResources)
{
resource.Update(NWN2HomePath, DownloadFolder, ServerList);
}
}