CgwMonitorManage.SmcError.ErrorInfo.GetProperties C# (CSharp) Method

GetProperties() public method

识别所有标识符“{标识名称}{序号}”
public GetProperties ( string errDesc ) : List
errDesc string 带格式的错误描述,需要补充参数
return List
        public List<SignStruct> GetProperties(string errDesc)
        {
            List<SignStruct> signDictionary = new List<SignStruct>();

            string pattern = @"\{[a-z,A-Z]+\}\s*\{[0-9]+\}";
            MatchCollection result = Regex.Matches(errDesc, pattern, RegexOptions.None);

            for (int i = 0; i < result.Count; i++)
            {
                string str = result[i].Value;
                string[] tempString = str.Split('{');

                // 对应标识符“{标识名称}{序号}”中的标识名称
                string sign = tempString[1].Substring(0, tempString[1].Length - 1);

                // 对应标识符“{标识名称}{序号}”中的序号
                string num = tempString[2].Substring(0, tempString[2].Length - 1);

                SignStruct signObject = new SignStruct(sign, num, result[i].Value);
                signDictionary.Add(signObject);
            }

            return signDictionary;
        }