Witam mam problem z uzyskaniem wartości TRUE bo obiekt zwraca mi do return wartość NULL a nie powinien i nie wiem dlaczego skoro wszystkie parametry ma wypełnione danymi.
Kod wygląda następująco:
internal class UpdateXml{
.....
internal UpdateXml(Version version, Uri uri, string fileName, string md5, string description, string launchArgs)
{
this.version = version;
this.uri = uri;
this.fileName = fileName;
this.md5 = md5;
this.description = description;
this.launchArgs = launchArgs;
}
internal static UpdateXml Parse(Uri location, string appID)
{
Version version = null;
string url = "", fileName = "", md5 = "", description = "", launchArgs = "";
UpdateXml arg = null;
try
{
XmlDocument doc = new XmlDocument();
doc.Load(location.AbsoluteUri);
XmlNode node = doc.DocumentElement.SelectSingleNode("//update[@appId='" + appID + "']");
if (node == null)
{
return null;
}
version = Version.Parse(node["version"].InnerText);
url = node["url"].InnerText;
fileName = node["fileName"].InnerText;
md5 = node["md5"].InnerText;
description = node["description"].InnerText;
launchArgs = node["launchArgs"].InnerText;
//Tu zamieniłem z tego return na zmienna arg bo był błąd CS0321 ale teraz mam dalej zwracaną wartość na NULL nie wiem co zrobić?
arg = new UpdateXml(version, new Uri(url), fileName, md5, description, launchArgs);
return arg;
//return new UpdateXml(version, new Uri(url), fileName, md5, description, launchArgs);
}
catch { return null; }
}
}