From cc8e24461c625400143677956bdffb9268d8050b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 21 Sep 2017 15:50:05 +0200 Subject: analytics plugin --- .../wp8/PhoneHelpers.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 StoneIsland/plugins/cordova-plugin-google-analytics/wp8/PhoneHelpers.cs (limited to 'StoneIsland/plugins/cordova-plugin-google-analytics/wp8/PhoneHelpers.cs') 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; + } + } + } +} -- cgit v1.2.3-70-g09d2