Exemplo n.º 1
0
        private void CheckDeviceLevWin()
        {
            //CPU
            int    processorCount     = SystemInfo.processorCount;
            int    processorFrequency = SystemInfo.processorFrequency;
            string processorType      = SystemInfo.processorType;

            JW.Common.Log.LogD("处理器{0}:核心{1:D}:频率:{2:D}", processorType, processorCount, processorFrequency);

            // 显卡的供应商
            string graphicsDeviceVendor   = UnityEngine.SystemInfo.graphicsDeviceVendor;
            int    graphicsDeviceVendorID = UnityEngine.SystemInfo.graphicsDeviceVendorID;
            string graphicsDeviceName     = UnityEngine.SystemInfo.graphicsDeviceName;
            string graphicsDeviceVersion  = UnityEngine.SystemInfo.graphicsDeviceVersion;
            //int graphicsDeviceID = UnityEngine.SystemInfo.graphicsDeviceID;
            int graphicsMemorySize = UnityEngine.SystemInfo.graphicsMemorySize;
            //bool graphicsMultiThreaded = UnityEngine.SystemInfo.graphicsMultiThreaded;
            int graphicsShaderLevel = UnityEngine.SystemInfo.graphicsShaderLevel;
            int maxTextureSize      = UnityEngine.SystemInfo.maxTextureSize;

            JW.Common.Log.LogD("显卡供应商{0}:版本:{1}:名称:{2}:显存:{3:D}:Max纹理:{4:D}:Shader等级:{5:D}", graphicsDeviceVendor + "ID=" + graphicsDeviceVendorID.ToString(), graphicsDeviceVersion, graphicsDeviceName, graphicsMemorySize, maxTextureSize, graphicsShaderLevel);

            if (graphicsMemorySize > 2000)
            {
                _deviceLevel = DeviceLevel.Highend;
            }
            else
            {
                _deviceLevel = DeviceLevel.Lowend;
            }
        }
Exemplo n.º 2
0
        public void LoadDevice(DeviceLevel strDeviceLevelName, Dictionary <string, string> dicDrivers, Control cDataCode = null, Control cWeight = null)
        {
            try
            {
                foreach (KeyValuePair <string, string> item in dicDrivers)
                {
                    switch (item.Key)
                    {
                    case "Scanner":
                        LoadScannerDevice(strDeviceLevelName, item.Value, cDataCode);
                        break;

                    case "Scale":
                        LoadScaleDevice(strDeviceLevelName, item.Value, cWeight);
                        break;

                    case "CashDrawer":
                        LoadCashDrawerDevice(strDeviceLevelName, item.Value);
                        break;

                    case "Printer":
                        LoadPosPrinterDevice(strDeviceLevelName, item.Value);
                        break;
                    }
                }
                ClaimPosCommon();
            }
            catch (Exception ex)
            {
                sMessengeError = ex.Message;
            }
        }
Exemplo n.º 3
0
 public void LoadScaleDevice(DeviceLevel strDeviceLevelName, string strScaleName, Control cWeight = null)
 {
     try
     {
         OpenDevice(ref _posCommonScale, strScaleName, Convert.ToString(strDeviceLevelName));
         CurrentPosThread = new Thread(new ThreadStart(() =>
         {
             if (_Scale == null)
             {
                 if (_posCommonScale != null)
                 {
                     _Scale                    = (Scale)_posCommonScale;
                     _Scale.DataEvent         += new DataEventHandler(_Scale_DataEvent);
                     _Scale.StatusUpdateEvent += new StatusUpdateEventHandler(_Scale_StatusUpdateEvent);
                     //_Scale.StatusNotify = StatusNotify.Enabled;
                 }
             }
         }));
         CurrentPosThread.IsBackground = true;
         CurrentPosThread.Start();
         if (_cDataWeight == null)
         {
             _cDataWeight = cWeight;
         }
     }
     catch (Exception ex)
     {
         sMessengeError = ex.Message;
     }
 }
Exemplo n.º 4
0
 public void LoadScannerDevice(DeviceLevel strDeviceLevelName, string strScannerName, Control cDataCode = null)
 {
     try
     {
         OpenDevice(ref _posCommonScanner, strScannerName, Convert.ToString(strDeviceLevelName));
         if (_Scanner == null)
         {
             if (_posCommonScanner != null)
             {
                 _Scanner            = (Scanner)_posCommonScanner;
                 _Scanner.DataEvent += new DataEventHandler(_Scanner_DataEvent);
                 _Scanner.DecodeData = true;
             }
         }
         if (_cDataCode == null)
         {
             _cDataCode = cDataCode;
         }
     }
     catch (Exception ex)
     {
         //sMessengeError = ex.Message;
         throw ex;
     }
 }
Exemplo n.º 5
0
        // 根据内存和CPU判断机型档次
        static void InitDeviceLevelByCPURAM()
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                if (Math.Round(SystemInfo.systemMemorySize / 1000f) >= 4 && SystemInfo.processorCount >= 4 &&
                    SystemInfo.processorFrequency >= 1500)
                {
                    device_level = DeviceLevel.LEVEL_1;
                }
                else if ((Math.Round(SystemInfo.systemMemorySize / 1000f) >= 3 && SystemInfo.processorCount >= 4 &&
                          SystemInfo.processorFrequency >= 1500) &&
                         (Math.Round(SystemInfo.systemMemorySize / 1000f) <= 4 && SystemInfo.processorCount <= 8 &&
                          SystemInfo.processorFrequency >= 1500))
                {
                    device_level = DeviceLevel.LEVEL_2;
                }
                else if ((Math.Round(SystemInfo.systemMemorySize / 1000f) >= 2 && SystemInfo.processorCount >= 4 &&
                          SystemInfo.processorFrequency >= 1500) &&
                         (Math.Round(SystemInfo.systemMemorySize / 1000f) <= 3 && SystemInfo.processorCount <= 8 &&
                          SystemInfo.processorFrequency >= 1500))
                {
                    device_level = DeviceLevel.LEVEL_3;
                }
                else
                {
                    device_level = DeviceLevel.LEVEL_L;
                }
            }

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
            }
        }
Exemplo n.º 6
0
 public void LoadDevice(DeviceLevel strDeviceLevelName, string strScannerName, string strScaleName, string strCashDrawerName, string strPosPrinterName, Control cDataCode = null, Control cWeight = null)
 {
     try
     {
         LoadScannerDevice(strDeviceLevelName, strScannerName, cDataCode);
         LoadScaleDevice(strDeviceLevelName, strScaleName, cWeight);
         LoadCashDrawerDevice(strDeviceLevelName, strCashDrawerName);
         LoadPosPrinterDevice(strDeviceLevelName, strPosPrinterName);
         ClaimPosCommon();
     }
     catch (Exception ex)
     {
         sMessengeError = ex.Message;
     }
 }
Exemplo n.º 7
0
    public static void LoadDeviceLevel(DropDownList fddl)
    {
        fddl.Items.Clear();
        DeviceLevel dc = new DeviceLevel();
        IList<DeviceLevelInfo> dicList = dc.GetDeviceLevel();
        foreach (DeviceLevelInfo dic in dicList)
        {
            ListItem ddlone = new ListItem(dic.NAME, dic.ID.ToString());
            fddl.Items.Add(ddlone);
        }

        ListItem ddltwo = new ListItem("请选择", "0");
        ddltwo.Selected = true;
        fddl.Items.Add(ddltwo);
    }
Exemplo n.º 8
0
    public static void LoadDeviceLevel(DropDownList fddl)
    {
        fddl.Items.Clear();
        DeviceLevel             dc      = new DeviceLevel();
        IList <DeviceLevelInfo> dicList = dc.GetDeviceLevel();

        foreach (DeviceLevelInfo dic in dicList)
        {
            ListItem ddlone = new ListItem(dic.NAME, dic.ID.ToString());
            fddl.Items.Add(ddlone);
        }

        ListItem ddltwo = new ListItem("请选择", "0");

        ddltwo.Selected = true;
        fddl.Items.Add(ddltwo);
    }
Exemplo n.º 9
0
 public void LoadPosPrinterDevice(DeviceLevel strDeviceLevelName, string strPosPrinterName)
 {
     try
     {
         OpenDevice(ref _posCommonPrinter, strPosPrinterName, Convert.ToString(strDeviceLevelName));
         if (_PosPrinter == null)
         {
             if (_posCommonPrinter != null)
             {
                 _PosPrinter = (PosPrinter)_posCommonPrinter;
             }
         }
     }
     catch (Exception ex)
     {
         sMessengeError = ex.Message;
     }
 }
Exemplo n.º 10
0
 public void LoadCashDrawerDevice(DeviceLevel strDeviceLevelName, string strCashDrawerName)
 {
     try
     {
         OpenDevice(ref _posCommonCashDrawer, strCashDrawerName, Convert.ToString(strDeviceLevelName));
         if (_CashDrawer == null)
         {
             if (_posCommonCashDrawer != null)
             {
                 _CashDrawer = (CashDrawer)_posCommonCashDrawer;
                 _CashDrawer.DeviceEnabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         sMessengeError = ex.Message;
     }
 }
Exemplo n.º 11
0
        // 根据GPU平台判定机型档次
        static void InitDeviceLevelByGPU()
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                // 高通骁龙
                if (SystemInfo.graphicsDeviceVendor == "Qualcomm")
                {
                    if (SystemInfo.graphicsDeviceName.StartsWith("Adreno"))
                    {
                        // 高通骁龙
                        if (SystemInfo.graphicsDeviceName.CompareTo("Adreno (TM) 530") >= 0)
                        {
                            // 基线骁龙820
                            device_level = DeviceLevel.LEVEL_1;
                        }
                        else if (SystemInfo.graphicsDeviceName.CompareTo("Adreno (TM) 506") >= 0)
                        {
                            // 基线骁龙625
                            device_level = DeviceLevel.LEVEL_2;
                        }
                        else
                        {
                            device_level = DeviceLevel.LEVEL_3;
                        }
                    }
                }

                // ARM Mali
                if (SystemInfo.graphicsDeviceVendor == "ARM")
                {
                    if (SystemInfo.graphicsDeviceName.StartsWith("Mali-G"))
                    {
                        // G系列
                        if (SystemInfo.graphicsDeviceName.CompareTo("Mali-G71") >= 0)
                        {
                            // 基线海思960
                            device_level = DeviceLevel.LEVEL_1;
                        }
                        else
                        {
                            device_level = DeviceLevel.LEVEL_2;
                        }
                    }
                    else if (SystemInfo.graphicsDeviceName.StartsWith("Mali-T"))
                    {
                        // T系列
                        if (SystemInfo.graphicsDeviceName.CompareTo("Mali-T830") >= 0)
                        {
                            // 基线海思650
                            device_level = DeviceLevel.LEVEL_2;
                        }
                        else
                        {
                            device_level = DeviceLevel.LEVEL_3;
                        }
                    }
                    else
                    {
                        device_level = DeviceLevel.LEVEL_3;
                    }
                }

                // IMG PowerVR
                if (SystemInfo.graphicsDeviceVendor == "IMG")
                {
                    if (SystemInfo.graphicsDeviceName.StartsWith("PowerVR"))
                    {
                        if (SystemInfo.graphicsDeviceName == "PowerVR 7XTP")
                        {
                            //基线联发科x30
                            device_level = DeviceLevel.LEVEL_1;
                        }

                        if (SystemInfo.graphicsDeviceName == "PowerVR G6200" ||
                            SystemInfo.graphicsDeviceName == "PowerVR GE8320")
                        {
                            device_level = DeviceLevel.LEVEL_2;
                        }
                    }
                }
            }

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                // 苹果设备根据处理器型号进行机型划分, A10以上为1档,A9以上为2档,A8以上为3档(为覆盖更多以A7敢归类为3档)
                if (SystemInfo.deviceModel.StartsWith("iPhone"))
                {
                    if (SystemInfo.deviceModel.CompareTo("iPhone9") >= 0)
                    {
                        // 基线iPhone7以上
                        device_level = DeviceLevel.LEVEL_1;
                    }
                    else if (SystemInfo.deviceModel.CompareTo("iPhone8") >= 0)
                    {
                        //基线iPhone6s/Plus以上
                        device_level = DeviceLevel.LEVEL_2;
                    }
                    else if (SystemInfo.deviceModel.CompareTo("iPhone6") >= 0)
                    {
                        // 基线iPhone5s以上
                        device_level = DeviceLevel.LEVEL_3;
                    }
                }

                if (SystemInfo.deviceModel.StartsWith("iPad"))
                {
                    if (SystemInfo.deviceModel.CompareTo("iPad6,7") >= 0)
                    {
                        // iPad Pro 12.9
                        device_level = DeviceLevel.LEVEL_1;
                    }
                    else if (SystemInfo.deviceModel.CompareTo("iPad6") >= 0)
                    {
                        // iPad Pro 9.7
                        device_level = DeviceLevel.LEVEL_2;
                    }
                    else if (SystemInfo.deviceModel.CompareTo("iPad4") >= 0)
                    {
                        device_level = DeviceLevel.LEVEL_3;
                    }
                }
            }
        }