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;
         }
     }
 }
Пример #2
0
 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);
     }
 }
        public bool UpdateScreenCategory(ScreenCategory data)
        {
            bool          updated = false;
            SqlConnection con     = new SqlConnection(connectionString);
            SqlCommand    cmd     = new SqlCommand("ScreenCategory_Update", con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@GUID", data.GUID);
            cmd.Parameters.AddWithValue("@ScreenCategoryName", data.ScreenCategoryName);
            cmd.Parameters.AddWithValue("@Icon", data.Icon);
            cmd.Parameters.AddWithValue("@UpDatedDate", data.UpDatedDate);
            cmd.Parameters.AddWithValue("@UpDatedBy", data.UpDatedBy);

            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
                updated = true;
            }
            catch (Exception e)
            {
                string error = e.Message;
                updated = false;
            }
            finally
            {
                con.Close();
            }
            return(updated);
        }
    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 AddCategory(ScreenCategory screen)
 {
     if (!Application.isPlaying)
     {
         this.m_screenCategory.Add(screen);
         this.m_localPosition.Add(base.transform.localPosition);
         this.m_localScale.Add(base.transform.localScale);
         this.m_localRotation.Add(base.transform.localRotation);
     }
 }
Пример #6
0
        public ActionResult EditScreenCategoryForm(string GUID)
        {
            ScreenCategory data = new ScreenCategory();

            if (!string.IsNullOrEmpty(GUID))
            {
                data = da.GetAllScreenCategoryByGUID(GUID);
            }
            return(PartialView("EditScreenCategoryForm", data));
        }
        public ScreenCategory GetAllScreenCategoryByGUID(string GUID)
        {
            ScreenCategory        mdl  = new ScreenCategory();
            List <ScreenCategory> list = this.GetAllScreenCategorys();

            list = list.Where(a => (!string.IsNullOrEmpty(GUID)) ? a.GUID == GUID : true).ToList();
            if (list != null)
            {
                mdl = list.First();
            }
            return(mdl);
        }
    public int GetIndex()
    {
        ScreenCategory screen = PlatformSettings.Screen;
        int            num    = 0;
        int            num2   = 4 - screen;

        for (int i = 1; i < this.m_screenCategory.Count; i++)
        {
            int num4 = ((ScreenCategory)this.m_screenCategory[i]) - screen;
            if ((num4 >= 0) && (num4 < num2))
            {
                num  = i;
                num2 = num4;
            }
        }
        return(num);
    }
Пример #9
0
 public ActionResult EditScreenCategory(ScreenCategory data)
 {
     if (Session["UserInfo"] != null)
     {
         SystemUser userInfo = (SystemUser)Session["UserInfo"];
         if (!string.IsNullOrEmpty(data.GUID))
         {
             data.UpDatedDate = DateTime.Now.ToString("dd/MM/yyyy hh:mm tt");
             data.UpDatedBy   = userInfo.GUID;
             bool updated = da.UpdateScreenCategory(data);
             if (updated)
             {
                 return(Json("Success", JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json("Fail", JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             data.GUID        = Guid.NewGuid().ToString();
             data.CreatedDate = DateTime.Now.ToString("dd/MM/yyyy hh:mm tt");
             data.CreatedBy   = userInfo.GUID;
             data.UpDatedDate = DateTime.Now.ToString("dd/MM/yyyy hh:mm tt");
             data.UpDatedBy   = userInfo.GUID;
             data.Status      = 1;
             bool added = da.AddScreenCategory(data);
             if (added)
             {
                 return(Json("Success", JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json("Fail", JsonRequestBehavior.AllowGet));
             }
         }
     }
     else
     {
         return(RedirectToAction("SessionTimeOut", "Error"));
     }
 }
    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 GetScreenSetting(ScreenCategory screen)
    {
        switch (screen)
        {
        case ScreenCategory.Phone:
            return(!this.PhoneSetting.WasSet ? this.GetScreenSetting(ScreenCategory.Tablet) : this.Phone);

        case ScreenCategory.MiniTablet:
            return(!this.MiniTabletSetting.WasSet ? this.GetScreenSetting(ScreenCategory.Tablet) : this.MiniTablet);

        case ScreenCategory.Tablet:
            return(!this.TabletSetting.WasSet ? this.GetScreenSetting(ScreenCategory.PC) : this.Tablet);

        case ScreenCategory.PC:
            if (!this.PCSetting.WasSet)
            {
                break;
            }
            return(this.PC);
        }
        Debug.LogError("Could not find screen dependent value");
        return(default(T));
    }
Пример #12
0
 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;
 }
Пример #13
0
 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;
 }
Пример #14
0
 public void AddCategory(ScreenCategory screen)
 {
     Class272.Enum20[] enumArray1 = new Class272.Enum20[] { Class272.Enum20.ValueType };
     object[]          objArray1  = new object[] { screen };
     base.method_9("AddCategory", enumArray1, objArray1);
 }