CgwMonitorManage.T28181.T28181VideoMonitor.GetResourceType C# (CSharp) Method

GetResourceType() public method

获取资源类型
public GetResourceType ( string deviceId ) : string
deviceId string 设备编码
return string
        public string GetResourceType(string deviceId)
        {
            String gDevTypeValue = "";

            if (deviceId.Length < 20)
            {
                gDevTypeValue = CgwConst.RESOURCE_TYPE_DIR;
                return gDevTypeValue;
            }
            int subDevType;
            bool TempBool = int.TryParse(deviceId.Substring(10, 3), out subDevType); //先判断是否可转换为int,否则类型设置为CgwConst.RESOURCE_TYPE_CAMERA。
            if (!TempBool)
            {
                gDevTypeValue = CgwConst.RESOURCE_TYPE_CAMERA;
                return gDevTypeValue;
            }

            if (subDevType >= CgwConst.DEVICE_TYPE_MAIN_START
                && subDevType <= CgwConst.DEVICE_TYPE_MAIN_END)
            {
                if (platformType == "huawei")
                {
                    gDevTypeValue = CgwConst.RESOURCE_TYPE_MAIN;
                }
                else
                {
                    gDevTypeValue = CgwConst.RESOURCE_TYPE_DIR;
                }
            }
            else if (subDevType == CgwConst.DEVICE_TYPE_CAMERA
                || subDevType == CgwConst.DEVICE_TYPE_NET_CAMERA)
            {
                gDevTypeValue = CgwConst.RESOURCE_TYPE_CAMERA;
            }
            else if (subDevType == CgwConst.DEVICE_TYPE_ALARM_IN)
            {
                gDevTypeValue = CgwConst.RESOURCE_TYPE_ALARM_IN;
            }
            else if (subDevType == CgwConst.DEVICE_TYPE_ALARM_OUT)
            {
                gDevTypeValue = CgwConst.RESOURCE_TYPE_ALARM_OUT;
            }
            else if (subDevType >= CgwConst.DEVICE_TYPE_PLAT_DEV_START
                && subDevType <= CgwConst.DEVICE_TYPE_PLAT_DEV_END)
            {
                gDevTypeValue = CgwConst.RESOURCE_TYPE_PLAT_DEV;
            }
            else if (subDevType == CgwConst.DEVICE_TYPE_ORG)
            {
                gDevTypeValue = CgwConst.RESOURCE_TYPE_DIR;
            }

            return gDevTypeValue;
        }