private RaygunMessage CreateMessage(Exception exception, IList <string> tags, IDictionary userCustomData) { object deviceName; DeviceExtendedProperties.TryGetValue("DeviceName", out deviceName); var message = RaygunMessageBuilder.New .SetEnvironmentDetails() .SetMachineName(deviceName.ToString()) .SetExceptionDetails(exception) .SetClientDetails() .SetVersion() .SetUser(User) .Build(); if (tags != null) { message.Details.Tags = tags; } if (userCustomData != null) { message.Details.UserCustomData = userCustomData; } return(message); }
public string GetUniqueIdentifier() { if (MogadeConfiguration.Data.UniqueIdStrategy == UniqueIdStrategy.DeviceId) { object raw; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out raw) && raw != null) { var bytes = (byte[])raw; var sb = new StringBuilder(bytes.Length * 2); for (var i = 0; i < bytes.Length; ++i) { sb.Append(bytes[i].ToString("X2")); } return(sb.ToString()); } } else if (MogadeConfiguration.Data.UniqueIdStrategy == UniqueIdStrategy.UserId) { object anid; if (UserExtendedProperties.TryGetValue("ANID", out anid) && anid != null) { return(anid.ToString()); } } else if (MogadeConfiguration.Data.UniqueIdStrategy == UniqueIdStrategy.UserId2) { object anid; if (UserExtendedProperties.TryGetValue("ANID", out anid) && anid != null) { return(anid.ToString().Substring(2, 32)); } } return(_configuration.UniqueIdentifier); }
/// <summary> /// Initializes a new instance of the <see cref="Xamarin.Forms.Labs.Display"/> class. /// </summary> /// <remarks> /// To get accurate display reading application should enable ID_CAP_IDENTITY_DEVICE on app manifest. /// </remarks> public Display() { object physicalScreenResolutionObject; if (DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out physicalScreenResolutionObject)) { var physicalScreenResolution = (System.Windows.Size)physicalScreenResolutionObject; this.Height = (int)physicalScreenResolution.Height; this.Width = (int)physicalScreenResolution.Width; } else { var scaleFactor = Application.Current.Host.Content.ScaleFactor; this.Height = (int)(Application.Current.Host.Content.ActualHeight * scaleFactor); this.Width = (int)(Application.Current.Host.Content.ActualWidth * scaleFactor); } object rawDpiX, rawDpiY; if (DeviceExtendedProperties.TryGetValue("RawDpiX", out rawDpiX)) { this.Xdpi = (double)rawDpiX; } if (DeviceExtendedProperties.TryGetValue("RawDpiY", out rawDpiY)) { this.Ydpi = (double)rawDpiY; } this.FontManager = new FontManager(this); }
public string GetDeviceId() { if (_deviceIdRead) { return(_deviceId); } try { object deviceId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out deviceId)) { _deviceId = deviceId.ToString(); } else { InternalTrace(Entry.CreateError("Retrieve user id failed. The capability ID_CAP_IDENTITY_DEVICE is required for this.")); } } catch (Exception ex) { InternalTrace(Entry.CreateError("GetDeviceId failed! " + ex.Message)); } _deviceIdRead = true; return(_deviceId); }
protected RaygunMessage BuildMessage(Exception exception, IList <string> tags, IDictionary userCustomData) { exception = StripWrapperExceptions(exception); object deviceName; DeviceExtendedProperties.TryGetValue("DeviceName", out deviceName); string version = _callingAssembly != null ? new AssemblyName(_callingAssembly.FullName).Version.ToString() : "Not supplied"; if (!String.IsNullOrWhiteSpace(ApplicationVersion)) { version = ApplicationVersion; } var message = RaygunMessageBuilder.New .SetEnvironmentDetails() .SetMachineName(deviceName.ToString()) .SetExceptionDetails(exception) .SetClientDetails() .SetVersion(version) .SetTags(tags) .SetUserCustomData(userCustomData) .SetUser(UserInfo ?? (!String.IsNullOrEmpty(User) ? new RaygunIdentifierMessage(User) : null)) .Build(); return(message); }
// NOTE: to get a result requires ID_CAP_IDENTITY_USER // to be added to the capabilities of the WMAppManifest // this will then warn users in marketplace public static string GetWindowsLiveAnonymousID() { string result = string.Empty; object anid; if (UserExtendedProperties.TryGetValue("ANID", out anid)) { if (anid != null && anid.ToString().Length >= (ANIDLength + ANIDOffset)) { result = anid.ToString().Substring(ANIDOffset, ANIDLength); } } if (result == string.Empty) { object uniqueId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { byte[] buf = uniqueId as byte[]; StringBuilder hex = new StringBuilder(buf.Length * 2); for (int i = 0; i < buf.Length; i++) // <-- use for loop is faster than foreach { hex.Append(buf[i].ToString("X2")); // <-- ToString is faster than AppendFormat } result = hex.ToString(); } } return(result); }
public static void Log(string class_name, string message, string tag, string hash) { string manufacturer = DeviceStatus.DeviceManufacturer; string devicename = DeviceStatus.DeviceName; string firmware = DeviceStatus.DeviceFirmwareVersion; string device_hardware = DeviceStatus.DeviceHardwareVersion; long device_ram = DeviceStatus.DeviceTotalMemory; long app_mem = DeviceStatus.ApplicationCurrentMemoryUsage; long app_max_mem = DeviceStatus.ApplicationPeakMemoryUsage; object device_id_hash; DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out device_id_hash); byte[] device_id = new byte[20]; device_id = (byte[])device_id_hash; string device_id_str = Convert.ToBase64String(device_id); #if DEBUG System.Diagnostics.Debug.WriteLine(manufacturer + " msg: " + message); #else WebMethodErrorLogging wm = new WebMethodErrorLogging(); string url = "http://eminence.webatu.com/errorlogs/diagnostics.php"; string post = "application=musicyoutube" + "&deviceid=" + HttpUtility.UrlEncode(device_id_str) + "&devicemanu=" + manufacturer + "&devicemodel=" + devicename + "&errorclass=" + class_name + "&message=" + message + "&classhash=" + hash + "&tags=" + tag; //post = HttpUtility.UrlEncode(post); wm.POST_LOG(url, post); #endif }
static ResolutionUtility() { FilenameSuffixWVGA = ".WVGA"; FilenameSuffixWXGA = ".WXGA"; FilenameSuffix720p = ".720p"; FilenameSuffix1080p = ".1080p"; #if WP7 ScreenResolution = ScreenResolution.WVGA; #else // Look for the PhysicalScreenResolution value introduced in WP8 GDR3 object value; if (DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out value) && value is Size) { Size size = (Size)value; switch ((int)size.Width) { case 480: default: ScreenResolution = ScreenResolution.WVGA; break; case 768: ScreenResolution = ScreenResolution.WXGA; break; case 720: ScreenResolution = ScreenResolution.HD720p; break; case 1080: ScreenResolution = ScreenResolution.HD1080p; break; } } else { switch (Application.Current.Host.Content.ScaleFactor) { case 100: default: ScreenResolution = ScreenResolution.WVGA; break; case 150: ScreenResolution = ScreenResolution.HD720p; break; case 160: ScreenResolution = ScreenResolution.WXGA; break; } } #endif Log.Main.Info("Current device screen resolution: " + ScreenResolution); }
public RaygunEnvironmentMessage() { Locale = CultureInfo.CurrentCulture.DisplayName; OSVersion = Environment.OSVersion.Platform + " " + Environment.OSVersion.Version; object deviceName; DeviceExtendedProperties.TryGetValue("DeviceName", out deviceName); DeviceName = deviceName.ToString(); DateTime now = DateTime.Now; UtcOffset = TimeZoneInfo.Local.GetUtcOffset(now).TotalHours; if (Application.Current != null && Application.Current.RootVisual != null) { WindowBoundsWidth = Application.Current.RootVisual.RenderSize.Width; WindowBoundsHeight = Application.Current.RootVisual.RenderSize.Height; PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { CurrentOrientation = frame.Orientation.ToString(); } } try { ApplicationCurrentMemoryUsage = DeviceStatus.ApplicationCurrentMemoryUsage; ApplicationMemoryUsageLimit = DeviceStatus.ApplicationMemoryUsageLimit; ApplicationPeakMemoryUsage = DeviceStatus.ApplicationPeakMemoryUsage; DeviceTotalMemory = DeviceStatus.DeviceTotalMemory; } catch (Exception e) { Debug.WriteLine("Faild to get device memory information: {0}", e.Message); } try { DeviceFirmwareVersion = DeviceStatus.DeviceFirmwareVersion; DeviceHardwareVersion = DeviceStatus.DeviceHardwareVersion; DeviceManufacturer = DeviceStatus.DeviceManufacturer; } catch (Exception e) { Debug.WriteLine("Failed to get device information: {0}", e.Message); } try { IsolatedStorageAvailableFreeSpace = IsolatedStorageFile.GetUserStoreForApplication().AvailableFreeSpace; } catch (Exception e) { Debug.WriteLine("Failed to get isolated storage memory: {0}", e.Message); } }
private static Size GetPhysicalScreenSize() { object obj; if (!DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out obj)) { return(default(Size)); } return((Size)obj); }
public static string GetApplicationPeakMemoryUsage() { string result = string.Empty; object property; if (DeviceExtendedProperties.TryGetValue("ApplicationPeakMemoryUsage", out property)) { result = property.ToString(); } return(result); }
public static string GetDeviceTotalMemory() { string result = string.Empty; object property; if (DeviceExtendedProperties.TryGetValue("DeviceTotalMemory", out property)) { result = property.ToString(); } return(result); }
public static string GetDeviceFirmwareVersion() { string result = string.Empty; object property; if (DeviceExtendedProperties.TryGetValue("DeviceFirmwareVersion", out property)) { result = property.ToString(); } return(result); }
private static String getLegacyValue(String key) { Object value; if (DeviceExtendedProperties.TryGetValue(key, out value)) { return((String)value); } return(null); }
public static string GetManufacturer() { var result = string.Empty; object manufacturer; if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out manufacturer)) { result = manufacturer.ToString(); } return(result); }
private static string GetPhoneUniqueId() { object uniqueId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { var result = (byte[])uniqueId; return(Convert.ToBase64String(result)); } return("unknown"); }
/// <summary> /// Gets the value associated with the specified property name. /// </summary> /// <param name="propertyName">The property name.</param> /// <returns>The value for the specified property name.</returns> /// <typeparam name="T">The return type.</typeparam> public T GetDeviceProperty <T>(string propertyName) { object value; if (DeviceExtendedProperties.TryGetValue(propertyName, out value)) { return((T)value); } return(default(T)); }
public static byte[] GetDeviceUniqueID() { byte[] result = null; object uniqueId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { result = (byte[])uniqueId; } return(result); }
/// <summary> /// Get Device Unique Id /// windows phone system does't have any api can get imei /// </summary> /// <returns>Unique Id</returns> public string GetDeviceUniqueId() { object uniqueId; var hexString = string.Empty; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { hexString = BitConverter.ToString((byte[])uniqueId).Replace("-", string.Empty); } return(hexString); }
public static string GetDeviceModel() { string model = null; object theModel; if (DeviceExtendedProperties.TryGetValue("DeviceName", out theModel)) { model = theModel as string; } return(model); }
public static string DeviceName() { string result = string.Empty; object deviceName; if (DeviceExtendedProperties.TryGetValue("DeviceName", out deviceName)) { result = deviceName.ToString(); } return(result); }
private string getUniqueDeviceId() { byte[] result = null; object uniqueId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { result = (byte[])uniqueId; } return(Convert.ToBase64String(result)); }
private string GetDeviceUniqueID() { string result = string.Empty; object uniqueId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { result = Convert.ToBase64String((byte[])uniqueId); } return(result); }
public static string GetDeviceName() { string result = string.Empty; object property; if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out property)) { result = property.ToString(); } return(result); }
//OBS: requires ID_CAP_IDENTITY_DEVICE private string DeviceProperties(string key) { string valueProperties = string.Empty; object obj = null; if (DeviceExtendedProperties.TryGetValue(key, out obj)) { valueProperties = obj as string; } return(valueProperties); }
public static string GetDeviceUniqueID() { byte[] result = null; object uniqueId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { result = (byte[])uniqueId; } return(Convert.ToBase64String(result, 0, result.Length)); }
//Note: to get a result requires ID_CAP_IDENTITY_DEVICE /// <summary> /// Gets the device unique ID. /// </summary> /// <returns></returns> public static string GetDeviceUniqueID() { string result = null; object uniqueId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) { result = System.Convert.ToBase64String((byte[])uniqueId); } return(result); }
private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e) { if (!_unityStartedLoading) { _unityStartedLoading = true; UnityApp.SetLoadedCallback(() => { Dispatcher.BeginInvoke(Unity_Loaded); }); int physicalWidth, physicalHeight; object physicalResolution; var content = Application.Current.Host.Content; var nativeWidth = (int)Math.Floor(content.ActualWidth * content.ScaleFactor / 100.0 + 0.5); var nativeHeight = (int)Math.Floor(content.ActualHeight * content.ScaleFactor / 100.0 + 0.5); if (DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out physicalResolution)) { var resolution = (System.Windows.Size)physicalResolution; physicalWidth = (int)resolution.Width; physicalHeight = (int)resolution.Height; } else { physicalWidth = nativeWidth; physicalHeight = nativeHeight; } UnityApp.SetNativeResolution(nativeWidth, nativeHeight); UnityApp.SetRenderResolution(physicalWidth, physicalHeight); UnityPlayer.UnityApp.SetOrientation((int)Orientation); DrawingSurfaceBackground.SetBackgroundContentProvider(UnityApp.GetBackgroundContentProvider()); DrawingSurfaceBackground.SetBackgroundManipulationHandler(UnityApp.GetManipulationHandler()); if (isShowAds == 1) { bannerAd = new AdView { Format = AdFormats.Banner, AdUnitID = "ca-app-pub-6844968633010430/8322003504" }; bannerAd.FailedToReceiveAd += OnFailedToReceiveAd; bannerAd.ReceivedAd += OnReceivedAd; AdRequest adRequest = new AdRequest(); //adRequest.ForceTesting = true;//here rem here adGridAdmob.Children.Add(bannerAd); bannerAd.LoadAd(adRequest);//hinh nh cai nay thua. Can kiem tra lai // toanstt_Refresh_admob(); } } }
public static String GetDeviceModel() { object model; if (DeviceExtendedProperties.TryGetValue("DeviceName", out model)) { return(model.ToString()); } else { return("Unknown"); } }
public static String GetDeviceManufacturer() { object manufacturer; if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out manufacturer)) { return(manufacturer.ToString()); } else { return("Unknown"); } }