public void ReadFromConfig(ConfigFile config) { this.name = config.Get("Emulation.DeviceName", this.name.ToString()); string str1 = config.Get("Emulation.OSCategory", this.os.ToString()); string str2 = config.Get("Emulation.InputCategory", this.input.ToString()); string str3 = config.Get("Emulation.ScreenCategory", this.screen.ToString()); string str4 = config.Get("Emulation.ScreenDensityCategory", this.screenDensity.ToString()); Log.ConfigFile.Print("Reading Emulated Device: " + this.name + " from " + config.GetPath()); try { this.os = (OSCategory) Enum.Parse(typeof (OSCategory), str1); this.input = (InputCategory) Enum.Parse(typeof (InputCategory), str2); this.screen = (ScreenCategory) Enum.Parse(typeof (ScreenCategory), str3); this.screenDensity = (ScreenDensityCategory) Enum.Parse(typeof (ScreenDensityCategory), str4); } catch (ArgumentException ex) { string format = "Could not parse {0} in {1} as a valid device!"; object[] objArray = new object[2]; int index1 = 0; string str5 = this.name; objArray[index1] = (object) str5; int index2 = 1; string path = config.GetPath(); objArray[index2] = (object) path; // Blizzard.Log.Warning(format, objArray); } }
private static void RecomputeDeviceSettings() { if (!EmulateMobileDevice()) { s_os = OSCategory.PC; s_input = InputCategory.Mouse; s_screen = ScreenCategory.PC; s_screenDensity = ScreenDensityCategory.High; s_os = OSCategory.PC; int systemMemorySize = SystemInfo.systemMemorySize; if (systemMemorySize < 500) { Debug.LogWarning("Low Memory Warning: Device has only " + systemMemorySize + "MBs of system memory"); s_memory = MemoryCategory.Low; } else if (systemMemorySize < 0x3e8) { s_memory = MemoryCategory.Low; } else if (systemMemorySize < 0x5dc) { s_memory = MemoryCategory.Medium; } else { s_memory = MemoryCategory.High; } } }
private static bool EmulateMobileDevice() { ConfigFile config = new ConfigFile(); if (!config.FullLoad(Vars.GetClientConfigPath())) { Blizzard.Log.Warning("Failed to read DeviceEmulation from client.config"); return(false); } DevicePreset preset = new DevicePreset(); preset.ReadFromConfig(config); if (preset.name == "No Emulation") { return(false); } if (!config.Get("Emulation.emulateOnDevice", false)) { return(false); } s_os = preset.os; s_input = preset.input; s_screen = preset.screen; s_screenDensity = preset.screenDensity; Log.DeviceEmulation.Print("Emulating an " + preset.name, new object[0]); return(true); }
private T GetScreenDensitySetting(ScreenDensityCategory input) { switch (input) { case ScreenDensityCategory.Normal: if (this.NormalScreenDensitySetting.WasSet) { return(this.NormalScreenDensity); } break; case ScreenDensityCategory.High: return(!this.HighScreenDensitySetting.WasSet ? this.GetScreenDensitySetting(ScreenDensityCategory.Normal) : this.HighScreenDensity); } Debug.LogError("Could not find screen density dependent value"); return(default(T)); }
public void ReadFromConfig(ConfigFile config) { this.name = config.Get("Emulation.DeviceName", this.name.ToString()); string str = config.Get("Emulation.OSCategory", this.os.ToString()); string str2 = config.Get("Emulation.InputCategory", this.input.ToString()); string str3 = config.Get("Emulation.ScreenCategory", this.screen.ToString()); string str4 = config.Get("Emulation.ScreenDensityCategory", this.screenDensity.ToString()); Log.ConfigFile.Print("Reading Emulated Device: " + this.name + " from " + config.GetPath(), new object[0]); try { this.os = (OSCategory)((int)Enum.Parse(typeof(OSCategory), str)); this.input = (InputCategory)((int)Enum.Parse(typeof(InputCategory), str2)); this.screen = (ScreenCategory)((int)Enum.Parse(typeof(ScreenCategory), str3)); this.screenDensity = (ScreenDensityCategory)((int)Enum.Parse(typeof(ScreenDensityCategory), str4)); } catch (ArgumentException) { object[] args = new object[] { this.name, config.GetPath() }; Blizzard.Log.Warning("Could not parse {0} in {1} as a valid device!", args); } }
private static void RecomputeDeviceSettings() { if (PlatformSettings.EmulateMobileDevice()) return; PlatformSettings.s_os = OSCategory.PC; PlatformSettings.s_input = InputCategory.Mouse; PlatformSettings.s_screen = ScreenCategory.PC; PlatformSettings.s_screenDensity = ScreenDensityCategory.High; PlatformSettings.s_os = OSCategory.PC; int systemMemorySize = SystemInfo.systemMemorySize; if (systemMemorySize < 500) { Debug.LogWarning((object) ("Low Memory Warning: Device has only " + (object) systemMemorySize + "MBs of system memory")); PlatformSettings.s_memory = MemoryCategory.Low; } else if (systemMemorySize < 1000) PlatformSettings.s_memory = MemoryCategory.Low; else if (systemMemorySize < 1500) PlatformSettings.s_memory = MemoryCategory.Medium; else PlatformSettings.s_memory = MemoryCategory.High; }
private static bool EmulateMobileDevice() { ConfigFile config = new ConfigFile(); if (!config.FullLoad(Vars.GetClientConfigPath())) { Debug.LogWarning("Failed to read DeviceEmulation from client.config"); return false; } DevicePreset devicePreset = new DevicePreset(); devicePreset.ReadFromConfig(config); if (devicePreset.name == "No Emulation" || !config.Get("Emulation.emulateOnDevice", false)) return false; PlatformSettings.s_os = devicePreset.os; PlatformSettings.s_input = devicePreset.input; PlatformSettings.s_screen = devicePreset.screen; PlatformSettings.s_screenDensity = devicePreset.screenDensity; Log.DeviceEmulation.Print("Emulating an " + devicePreset.name); return true; }