/// <summary> /// Verify if we have the latest version of the server using version.xml /// If the file of the latest is not found, DownloaderBox is launched /// </summary> private void VerifyVersion() { XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load("http://" + hostAddress + "/version.xml"); } catch (Exception e) { MessageBox.Show("XML de MAJ non trouvé !"); return; } const string dataDir = "Data"; DirectoryInfo mpqInfo = new DirectoryInfo(Path.Combine(_wowDir, dataDir)); FileInfo[] mpqFiles = mpqInfo.GetFiles("patch-*.mpq", SearchOption.TopDirectoryOnly); XmlNodeList nodeList = xmlDoc.GetElementsByTagName("version"); XmlNode lastNode = nodeList[0]; FileInfo lastNodeInfo = new FileInfo(lastNode.InnerText); try { FileInfo contains = mpqFiles.First(fileInfo => fileInfo.Name == lastNode.InnerText); } catch (Exception e) { DownloaderBox dlBox = new DownloaderBox(); dlBox.Show(this); dlBox.Download(nodeList, mpqFiles, Path.Combine(_wowDir, dataDir)); } }
/// <summary> /// Verify if we have the latest version of the server using version.xml /// If the file of the latest is not found, DownloaderBox is launched /// </summary> private void VerifyVersion() { XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load("http://"+ hostAddress + "/version.xml"); } catch (Exception e) { MessageBox.Show("XML de MAJ non trouvé !"); return; } const string dataDir = "Data"; DirectoryInfo mpqInfo = new DirectoryInfo(Path.Combine(_wowDir, dataDir)); FileInfo[] mpqFiles = mpqInfo.GetFiles("patch-*.mpq", SearchOption.TopDirectoryOnly); XmlNodeList nodeList = xmlDoc.GetElementsByTagName("version"); XmlNode lastNode = nodeList[0]; FileInfo lastNodeInfo = new FileInfo(lastNode.InnerText); try { FileInfo contains = mpqFiles.First(fileInfo => fileInfo.Name == lastNode.InnerText); } catch (Exception e) { DownloaderBox dlBox = new DownloaderBox(); dlBox.Show(this); dlBox.Download(nodeList, mpqFiles, Path.Combine(_wowDir, dataDir)); } }