int version() { string versionFile = "version.xpv"; int version; if (!File.Exists(versionFile)) { using (StreamWriter sw = new StreamWriter(versionFile)) { sw.WriteLine("0"); } } using (StreamReader sr = new StreamReader(path)) { version = Convert.ToInt32(sr.ReadLine()); sr.Dispose(); } return version; } int checkUpdates() { int lines = 0; WebClient wc = new WebClient(); using (StreamReader sr = new StreamReader(wc.OpenRead("http://127.0.0.1/patches/version.txt"))) { while (sr.ReadLine() != null) { lines++; } } return lines; } string GetPatch(int version) { WebClient wc = new WebClient(); using (StreamReader sr = new StreamReader(wc.OpenRead("http://127.0.0.1/patches/version.txt"))) { for (int i = 0; i < version; i++) { sr.ReadLine(); } return sr.ReadLine().Substring(2); } }
using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)