示例#1
0
 public static BrailleCell GetInstance(string hexStr)
 {
     if (String.IsNullOrEmpty(hexStr) || hexStr.Length > 2)
     {
         throw new ArgumentException("參數錯誤: 不是有效的十六進位字串值!");
     }
     return(GetInstance(StrHelper.HexStrToByte(hexStr)));
 }
示例#2
0
 /// <summary>
 /// 建構函式。
 /// </summary>
 /// <param name="hexStr">十六進位的字串,不可加 '0x' 或 'H'。</param>
 private BrailleCell(string hexStr)
 {
     if (String.IsNullOrEmpty(hexStr) || hexStr.Length > 2)
     {
         throw new ArgumentException("參數錯誤: 不是有效的十六進位字串值!");
     }
     m_Value = StrHelper.HexStrToByte(hexStr);
 }
示例#3
0
        /// <summary>
        /// 把指定的點字字串(16進位)轉成 BrailleCell 物件,並加入點字串列中。
        /// </summary>
        /// <param name="brCode">欲加入串列的點字碼 16 進位字串。</param>
        public void AddCell(string brCode)
        {
            if (String.IsNullOrEmpty(brCode))
            {
                return;
            }

            for (int i = 0; i < brCode.Length; i += 2)
            {
                string      s     = brCode.Substring(i, 2);
                byte        aByte = StrHelper.HexStrToByte(s);
                BrailleCell cell  = BrailleCell.GetInstance(aByte);
                m_CellList.Add(cell);
            }
        }
示例#4
0
        /// <summary>
        /// 將十六進位的點字碼字串轉成對應的點字物件,並加入點字串列。
        /// </summary>
        /// <param name="brCodes">十六進位的點字碼字串。此字串的長度應為 2 的倍數。</param>
        /// <returns></returns>
        public void Add(string brCodes)
        {
            if (String.IsNullOrEmpty(brCodes))
            {
                return; // 忽略空的點字碼(因為呼叫端可能常常會傳入空的點字碼)
            }

            for (int i = 0; i < brCodes.Length; i += 2)
            {
                string      s     = brCodes.Substring(i, 2);
                byte        aByte = StrHelper.HexStrToByte(s);
                BrailleCell cell  = BrailleCell.GetInstance(aByte);
                m_Cells.Add(cell);
            }
        }