Esempio n. 1
0
        public static string GetAppVersion()
        {
            try
            {
                var data = ApplicationManifestHelper.Read();

                Version version;
                if (Version.TryParse(data.Version, out version))
                {
                    return(version.ToString());
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(default(Version).ToString());
        }
Esempio n. 2
0
        public static Version GetAppVersion()
        {
            try
            {
                var data = ApplicationManifestHelper.Read();

                Version version;
                if (Version.TryParse(data.Version, out version))
                {
                    return(version);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(default(Version));

            //try
            //{
            //	var doc = XDocument.Load("WMAppManifest.xml");
            //	var xAttribute = doc.Descendants("App").First().Attribute("Version");
            //	if (xAttribute != null)
            //	{
            //		var version = xAttribute.Value;
            //		if (!string.IsNullOrEmpty(version))
            //		{
            //			Version result;
            //			if (Version.TryParse(version, out result))
            //			{
            //				return result;
            //			}
            //		}
            //	}
            //}
            //// ReSharper disable EmptyGeneralCatchClause
            //catch
            //// ReSharper restore EmptyGeneralCatchClause
            //{
            //}
            //return default(Version);
        }