visual studio 2012 - Remote File to Variables (C#) -
i attempting create reader type of file used old toontown online. patcher.ver
. have tried reading variables dictionary page hosted at, cannot seem work!
webrequest request = webrequest.create(form1.patcherbaseurl + "/patcher.ver"); webresponse response = request.getresponse(); stream data = response.getresponsestream(); string html = string.empty; using (streamreader sr = new streamreader(data)) { html = sr.readtoend(); var dic = file.readalllines(html) .select(l => l.split(new[] { '=' })) .todictionary(s => s[0].trim(), s => s[1].trim()); string patchverstrserver = dic["patcher_version_string_server"];
this code attempting use. keep getting exceptions "illegal characters in path"
the file trying read located at: http://dolimg.com/toontown/uk/patcher.ver
thanks if can help! new c# , couldn't seem find related this.
try code below. there lines in html commented out used skip these lines
webrequest request = webrequest.create(form1.patcherbaseurl + "/patcher.ver"); webresponse response = request.getresponse(); stream data = response.getresponsestream(); string html = string.empty; using (streamreader sr = new streamreader(data)) { html = sr.readtoend(); var dic = html .split (new[] { '\n', '\r' }, stringsplitoptions.removeemptyentries) .where (line => !line.startswith("#")) // skip commented out lines .select(line => line.split(new[] { '=' }, 2)) // beware: values have spaces .todictionary(token => token[0].trim(), token => token[1].trim()); string patchverstrserver = dic["patcher_version_string_server"]; }
Comments
Post a Comment