internal static Dictionary <string, object> ComputeLegacyAppState() { // Used by CrashReport and HandledException report. // Getting lots of stuff here. Some things like "DeviceId" require manifest-level authorization so skipping // those for now, see http://msdn.microsoft.com/en-us/library/ff769509%28v=vs.92%29.aspx#BKMK_Capabilities return(new Dictionary <string, object> { { "app_version", Crittercism.AppVersion }, // RemainingChargePercent returns an integer in [0,100] #if WINDOWS_PHONE { "battery_level", Windows.Phone.Devices.Power.Battery.GetDefault().RemainingChargePercent / 100.0 }, { "carrier", DeviceNetworkInformation.CellularMobileOperator }, { "device_total_ram_bytes", DeviceExtendedProperties.GetValue("DeviceTotalMemory") }, { "memory_usage", DeviceExtendedProperties.GetValue("ApplicationCurrentMemoryUsage") }, { "memory_usage_peak", DeviceExtendedProperties.GetValue("ApplicationPeakMemoryUsage") }, { "on_cellular_data", DeviceNetworkInformation.IsCellularDataEnabled }, { "on_wifi", DeviceNetworkInformation.IsWiFiEnabled }, { "orientation", DisplayProperties.NativeOrientation.ToString() }, #endif { "disk_space_free", StorageHelper.AvailableFreeSpace() }, // skipping "name" for device name as it requires manifest approval { "locale", CultureInfo.CurrentCulture.Name }, // all counters below in bytes { "reported_at", TimeUtils.GMTDateString(DateTime.UtcNow) } }); }
internal static string JsonDateToGMTDateString(JToken json) { // json that IsJsonDate converted to GMTDateString . string answer = ""; switch (json.Type) { case JTokenType.Date: answer = TimeUtils.GMTDateString((DateTime)((JValue)json).Value); break; case JTokenType.String: // Assume json was already an GMTDateString answer = (string)((JValue)json).Value; break; } return(answer); }
internal Breadcrumb(BreadcrumbType breadcrumbType, Object data) : this(TimeUtils.GMTDateString(DateTime.UtcNow), breadcrumbType, data) { }