Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Windows Phone WMAppManifest reader that doesn't waste cycles reading the file every time you need to access a value. Usage: var version = ApplicationInfo.Version.
public static class ApplicationInfo
{
#region Private Members
const string AppManifestName = "WMAppManifest.xml";
const string AppNodeName = "App";
#endregion
#region Properties
public static string Title { get; private set; }
public static string Version { get; private set; }
public static string Author { get; private set; }
public static string Description { get; private set; }
#endregion
static ApplicationInfo()
{
try
{
var settings = new XmlReaderSettings { XmlResolver = new XmlXapResolver() };
using (var rdr = XmlReader.Create(AppManifestName, settings))
{
rdr.ReadToDescendant(AppNodeName);
if (!rdr.IsStartElement())
{
throw new FormatException(AppManifestName + " is missing " + AppNodeName);
}
Title = rdr.GetAttribute("Title");
Version = rdr.GetAttribute("Version");
Author = rdr.GetAttribute("Author");
Description = rdr.GetAttribute("Description");
}
}
catch (Exception)
{
;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.