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);
    }
    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 T GetOSSetting(OSCategory os)
    {
        switch (os)
        {
        case OSCategory.PC:
            if (!this.PCSetting.WasSet)
            {
                break;
            }
            return(this.PC);

        case OSCategory.Mac:
            return(!this.MacSetting.WasSet ? this.GetOSSetting(OSCategory.PC) : this.Mac);

        case OSCategory.iOS:
            return(!this.iOSSetting.WasSet ? this.GetOSSetting(OSCategory.PC) : this.iOS);

        case OSCategory.Android:
            return(!this.AndroidSetting.WasSet ? this.GetOSSetting(OSCategory.PC) : this.Android);
        }
        Debug.LogError("Could not find OS dependent value");
        return(default(T));
    }
 private static void SetAndroidSettings()
 {
     PlatformSettings.s_os = OSCategory.Android;
     PlatformSettings.s_input = InputCategory.Touch;
 }
 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;
 }
 private static void SetAndroidSettings()
 {
     s_os    = OSCategory.Android;
     s_input = InputCategory.Touch;
 }