/// <summary>
        /// Gets Chinese Year<br />
        /// 获得农历年
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="traditionalChineseCharacters"></param>
        /// <returns></returns>
        public static string GetChineseYear(DateTime dt, bool traditionalChineseCharacters = false)
        {
            var hzNumP = traditionalChineseCharacters ? HZNUMZ : HZNUMS;

            var year    = dt.Year.ToString().ToCharArray();
            var yearStr = new string[year.Length];

            for (var i = 0; i < year.Length; i++)
            {
                yearStr[i] = hzNumP[NumericConverter.ToInt32(year[i])];
            }
            return($"{string.Join("", yearStr)}年");
        }
Exemple #2
0
        public object GetValue(byte formatByte, ValueInfo valueInfo, byte[] contentBytes)
        {
            if (formatByte == 0xd3)
            {
                return(NumericConverter.ToInt64(contentBytes));
            }

            if ((formatByte & 0x80) == 0)
            {
                return((int)formatByte);
            }
            if ((formatByte & 0xe0) == 0xe0)
            {
                return((int)(formatByte | 0xffffff00));
            }

            var number = NumericConverter.ToInt32(contentBytes);

            return(ExpandNegativeInteger(formatByte, number));
        }