diff options
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-google-analytics/wp8/PhoneHelpers.cs')
| -rw-r--r-- | StoneIsland/plugins/cordova-plugin-google-analytics/wp8/PhoneHelpers.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-google-analytics/wp8/PhoneHelpers.cs b/StoneIsland/plugins/cordova-plugin-google-analytics/wp8/PhoneHelpers.cs new file mode 100644 index 00000000..4bf4f895 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-google-analytics/wp8/PhoneHelpers.cs @@ -0,0 +1,30 @@ +using System; +using System.Xml; + +namespace UniversalAnalyticsPlugin +{ + internal static class Helpers + { + public static string GetAppAttribute(string attributeName) + { + try + { + XmlReaderSettings xmlReaderSettings = new XmlReaderSettings(); + xmlReaderSettings.XmlResolver = new XmlXapResolver(); + using (XmlReader xmlReader = XmlReader.Create("WMAppManifest.xml", xmlReaderSettings)) + { + xmlReader.ReadToDescendant("App"); + if (!xmlReader.IsStartElement()) + { + throw new FormatException("WMAppManifest.xml is missing"); + } + return xmlReader.GetAttribute(attributeName); + } + } + catch + { + return null; + } + } + } +} |
