/// <summary> /// 获取SP的错误吗 /// </summary> private void GetSPlogViewCode() { if (!File.Exists(logViewPaht)) { //MessageBox.Show("Can not find SP path."); return; } string cnText_sp = XDCUnity.ReadIniData("DevFail", txt_Code.Text.Trim(), "", logViewPaht); string enText_sp = XDCUnity.ReadIniData("DevFail_ENG", txt_Code.Text.Trim(), "", logViewPaht); lbl_SP_CN.Text = cnText_sp; lbl_SP_EN.Text = enText_sp; }
private void ProcessInitialGroupBox(Control.ControlCollection artControls, string argSection, string argKeyAppendText) { CurrentIniPath = XDCUnity.CurrentPath + @"\Config\Server\" + ProtocolString + "\\" + CurrentHost + "\\CommonConfig.ini"; string flag = string.Empty; foreach (Control item in artControls) { flag = string.Empty; if (item.GetType().Name == "CheckBox") { flag = XDCUnity.ReadIniData(argSection, ((CheckBox)item).Text + argKeyAppendText, "", CurrentIniPath); if (flag.Equals("1")) { ((CheckBox)item).Checked = true; } else { ((CheckBox)item).Checked = false; } } } }
private static void FindFinalFS(ref List <ParsRowView> rowViewList, ref List <TemplateView> TvList, ref bool isFoundFS_x, string msgCurrentFieldContent) { string[] gsGroup = msgCurrentFieldContent.Split(XDCSplictorChar.GS); if (gsGroup.Length > 1) { //GS情况 FindFinalGS(ref rowViewList, ref TvList, msgCurrentFieldContent); //SetFS_GS_(ref rowViewList, TvList, "GS", gsGroup); } else { #region 正是当前要找的FS int currentContentIndex = 0; foreach (TemplateView tvItem in TvList) { if (tvItem.FieldName == "ICC data objects (and Further ICC data objects) requested by Central") { #region 生成IC卡数据提示行 ParsRowView ic = new ParsRowView(); ic.FieldName = "IC"; ic.FieldComment = tvItem.FieldName; rowViewList.Add(ic); #endregion string tempvalueAll = msgCurrentFieldContent.Substring(currentContentIndex, msgCurrentFieldContent.Length - currentContentIndex); string tempAll = tempvalueAll; string key = "tagMeaning"; bool isFirst = true; string sub_4 = tempAll.Substring(0, 4); string sub_2 = tempAll.Substring(0, 2); string tagIniPath = XDCUnity.CurrentPath + @"\Config\Protocol\TagList.ini"; string tagMeaning = XDCUnity.ReadIniData(sub_4, key, "", tagIniPath); int currentLen = -1; string tagName = string.Empty; while (tempAll.Length > 0) { if (!isFirst) { ParsRowView tg = new ParsRowView(); tg.FieldName = "TG"; rowViewList.Add(tg); } isFirst = false; sub_4 = tempAll.Substring(0, 4); sub_2 = tempAll.Substring(0, 2); tagMeaning = XDCUnity.ReadIniData(sub_4, key, "", tagIniPath); currentLen = -1; tagName = string.Empty; if (!string.IsNullOrEmpty(tagMeaning)) { currentLen = 4; tagName = sub_4; } else { //长度为4的tag找不到,找长度为2的。 tagMeaning = XDCUnity.ReadIniData(sub_2, key, "", tagIniPath); if (string.IsNullOrEmpty(tagMeaning)) { break; } currentLen = 2; tagName = sub_2; } #region 增加行 //tagName tempAll = tempAll.Substring(currentLen, tempAll.Length - currentLen); ParsRowView prv_tagName = new ParsRowView(); prv_tagName.FieldName = "TagName"; prv_tagName.FieldComment = tagMeaning; prv_tagName.FieldValue = tagName; rowViewList.Add(prv_tagName); //tagLen string len = tempAll.Substring(0, 2); tempAll = tempAll.Substring(2, tempAll.Length - 2); ParsRowView prv_tagLen = new ParsRowView(); prv_tagLen.FieldName = "ValueLength"; prv_tagLen.FieldComment = "Hex"; prv_tagLen.FieldValue = len; rowViewList.Add(prv_tagLen); //tagValue int valueLen = Convert.ToInt32(len, 16); string value = tempAll.Substring(0, valueLen * 2); tempAll = tempAll.Substring(valueLen * 2, tempAll.Length - valueLen * 2); ParsRowView prv_tagValue = new ParsRowView(); prv_tagValue.FieldName = "Value"; prv_tagValue.FieldComment = ""; prv_tagValue.FieldValue = value; rowViewList.Add(prv_tagValue); #endregion } } else { #region MyRegion ParsRowView prv = new ParsRowView(); prv.FieldName = tvItem.FieldName; //加上prv.FieldName == "GS**"的判断,解决显示GS**行而内容又为空的情况。edit by frde 20160106 if (/*(prv.FieldName == "GS" || prv.FieldName == "GS**")*/ prv.FieldName.StartsWith("GS") /* && msgCurrentFieldContent.Length == currentContentIndex*/) { break; } try { if (tvItem.FieldSize <= 0) { prv.FieldValue = msgCurrentFieldContent.Substring(currentContentIndex, msgCurrentFieldContent.Length - currentContentIndex); } else { prv.FieldValue = msgCurrentFieldContent.Substring(currentContentIndex, tvItem.FieldSize); } } catch { prv.FieldValue = ""; } if (tvItem.FieldValue != null) { if (string.IsNullOrEmpty(prv.FieldValue)) { prv.FieldComment = ""; } else if (tvItem.FieldValue.ContainsKey(prv.FieldValue)) { prv.FieldComment = tvItem.FieldValue[prv.FieldValue]; } else if (tvItem.FieldValue.ContainsKey("*")) { prv.FieldComment = tvItem.FieldValue["*"]; } else { bool isFind = false; foreach (KeyValuePair <string, string> kvpItem in tvItem.FieldValue) { //&运算 if (kvpItem.Key.Contains("&")) { try { isFind = true; string ampValue = kvpItem.Key.Substring(0, kvpItem.Key.IndexOf("&")); string ampOperator = kvpItem.Key.Substring(kvpItem.Key.IndexOf("&") + 5, kvpItem.Key.Length - kvpItem.Key.IndexOf("&") - 5); int ampResult = int.Parse(prv.FieldValue) & int.Parse(ampOperator); if (ampResult.ToString() == ampValue) { prv.FieldComment += kvpItem.Value + ";"; } } catch { prv.FieldComment = ""; } } } if (!isFind) { prv.FieldComment = "UnKnow Value"; } } } else { prv.FieldComment = ""; } rowViewList.Add(prv); if (tvItem.FieldSize <= 0) { currentContentIndex += msgCurrentFieldContent.Length - currentContentIndex; } else { currentContentIndex += tvItem.FieldSize; } #endregion } } TvList.Clear(); #endregion } TvList.Clear(); isFoundFS_x = false; }