示例#1
0
        public static KNXDataType GetDPTType(string sizeInBit)
        {
            KNXDataType type = KNXDataType.Bit1;

            switch (sizeInBit)
            {
            case "1":
                type = KNXDataType.Bit1;
                break;

            case "2":
                type = KNXDataType.Bit2;
                break;

            case "4":
                type = KNXDataType.Bit4;
                break;

            case "8":
                type = KNXDataType.Bit8;
                break;

            case "16":
                type = KNXDataType.Bit16;
                break;

            case "24":
                type = KNXDataType.Bit24;
                break;

            case "32":
                type = KNXDataType.Bit32;
                break;

            case "48":
                type = KNXDataType.Bit48;
                break;

            case "64":
                type = KNXDataType.Bit64;
                break;

            case "80":
                type = KNXDataType.Bit80;
                break;

            case "112":
                type = KNXDataType.Bit112;
                break;

            default:
                MessageBox.Show(ResourceMng.GetString("Message41"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }

            return(type);
        }
示例#2
0
        /// <summary>
        /// 删除文件夹及其子
        /// </summary>
        /// <param name="folderName"></param>
        public static void DeleteFolder(string folderName)
        {
            // 可靠删除,先重命名文件夹,然后在后台删除
            var deleteFolder = folderName + DateTime.Now.Ticks;

            if (Directory.Exists(folderName))
            {
                try
                {
                    Directory.Move(folderName, deleteFolder);
                    Directory.Delete(deleteFolder, true);
                }
                catch (Exception)
                {
                    MessageBox.Show(folderName + ResourceMng.GetString("Message40"));
                }
            }
        }
示例#3
0
        public static KNXDataType GetKnxDataType(string objectSize)
        {
            KNXDataType type = KNXDataType.Bit1;

            switch (objectSize)
            {
            case "1 Bit":
                type = KNXDataType.Bit1;
                break;

            case "2 Bit":
                type = KNXDataType.Bit2;
                break;

            case "3 Bit":
                type = KNXDataType.Bit3;
                break;

            case "4 Bit":
                type = KNXDataType.Bit4;
                break;

            case "5 Bit":
                type = KNXDataType.Bit5;
                break;

            case "6 Bit":
                type = KNXDataType.Bit6;
                break;

            case "7 Bit":
                type = KNXDataType.Bit7;
                break;

            case "1 Byte":
                type = KNXDataType.Bit8;
                break;

            case "2 Bytes":
                type = KNXDataType.Bit16;
                break;

            case "3 Bytes":
                type = KNXDataType.Bit24;
                break;

            case "4 Bytes":
                type = KNXDataType.Bit32;
                break;

            case "6 Bytes":
                type = KNXDataType.Bit48;
                break;

            case "8 Bytes":
                type = KNXDataType.Bit64;
                break;

            case "10 Bytes":
                type = KNXDataType.Bit80;
                break;

            case "14 Bytes":
                type = KNXDataType.Bit112;
                break;

            default:
                type = KNXDataType.None;
                MessageBox.Show(ResourceMng.GetString("Message41"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }

            return(type);
        }