public static cSnSet DataStrToClass(string data) { if (data.IndexOf("C~") == 0) { data = data.Substring(2); } cSnSet mSnSet = new cSnSet(); try { string[] tempStr = data.Split('~'); int index = 0; mSnSet.id = tempStr[index++]; mSnSet.MachineIndex = Num.IntParse(tempStr[index++]); for (int i = 0; i < mSnSet.SnCodeSet.Length; i++) { mSnSet.SnCodeSet[i].FengSu = Num.IntParse(tempStr[index++]); mSnSet.SnCodeSet[i].IsDanLen = Num.BoolParse(tempStr[index++]); mSnSet.SnCodeSet[i].IsKuaiJian = Num.BoolParse(tempStr[index++]); mSnSet.SnCodeSet[i].MoShi = Num.IntParse(tempStr[index++]); mSnSet.SnCodeSet[i].NeiJiNeng = Num.IntParse(tempStr[index++]); mSnSet.SnCodeSet[i].NengLi = Num.IntParse(tempStr[index++]); mSnSet.SnCodeSet[i].PinLv = Num.IntParse(tempStr[index++]); } } catch { } return(mSnSet); }
public static cSnSet DataXmlToClass(string id) { cSnSet mSnSet = new cSnSet(); mSnSet = (cSnSet)cXml.readXml(string.Format("{0}{1}.xml", frmMideaSn.SnIdDirectory, id), typeof(cSnSet), mSnSet); return(mSnSet); }
private void DataFileToFrm(string id, int index) { try { cSnSet tmpSnSet = new cSnSet(); tmpSnSet = (cSnSet)cXml.readXml(string.Format("{0}{1}.xml", SnIdDirectory, id), typeof(cSnSet), tmpSnSet); mSnSet.SnCodeSet[index] = tmpSnSet.SnCodeSet[index]; tmpSnSet = null; switch (modeJiQi) { case 0: break; case 1: case 2: case 3: cbbMoshi.SelectedIndex = mSnSet.SnCodeSet[index].MoShi; cbbFengSu.SelectedIndex = mSnSet.SnCodeSet[index].FengSu; cbbNengJi.SelectedIndex = mSnSet.SnCodeSet[index].NeiJiNeng; txtPinLv.Text = mSnSet.SnCodeSet[index].PinLv.ToString(); chkKuaiJian.Checked = mSnSet.SnCodeSet[index].IsKuaiJian; chkDanLen.Checked = false; txtNengLi.Text = ""; break; case 4: case 7: cbbMoshi.SelectedIndex = mSnSet.SnCodeSet[index].MoShi; cbbFengSu.SelectedIndex = mSnSet.SnCodeSet[index].FengSu; chkKuaiJian.Checked = mSnSet.SnCodeSet[index].IsKuaiJian; txtPinLv.Text = ""; chkDanLen.Checked = false; txtNengLi.Text = ""; break; case 5: cbbMoshi.SelectedIndex = mSnSet.SnCodeSet[index].MoShi; cbbFengSu.SelectedIndex = mSnSet.SnCodeSet[index].FengSu; chkDanLen.Checked = mSnSet.SnCodeSet[index].IsDanLen; chkKuaiJian.Checked = false; txtPinLv.Text = ""; txtNengLi.Text = ""; break; case 6: cbbMoshi.SelectedIndex = mSnSet.SnCodeSet[index].MoShi; cbbFengSu.SelectedIndex = mSnSet.SnCodeSet[index].FengSu; chkDanLen.Checked = false; chkKuaiJian.Checked = false; txtPinLv.Text = ""; txtNengLi.Text = mSnSet.SnCodeSet[index].NengLi.ToString(); break; } } catch (Exception exc) { cMain.WriteErrorToLog("FrmMideaSn:DataFileToFrm:" + exc.ToString()); } }
public static string DataClassToStr(cSnSet snSet) { string ss = ""; ss = ss + snSet.id + "~"; ss = ss + snSet.MachineIndex.ToString() + "~"; for (int i = 0; i < snSet.SnCodeSet.Length; i++) { ss = ss + snSet.SnCodeSet[i].FengSu.ToString() + "~"; ss = ss + snSet.SnCodeSet[i].IsDanLen.ToString() + "~"; ss = ss + snSet.SnCodeSet[i].IsKuaiJian.ToString() + "~"; ss = ss + snSet.SnCodeSet[i].MoShi.ToString() + "~"; ss = ss + snSet.SnCodeSet[i].NeiJiNeng.ToString() + "~"; ss = ss + snSet.SnCodeSet[i].NengLi.ToString() + "~"; ss = ss + snSet.SnCodeSet[i].PinLv.ToString() + "~"; } return(ss); }
public static void DataClassToXml(cSnSet mSnSet) { cXml.saveXml(string.Format("{0}{1}.xml", frmMideaSn.SnIdDirectory, mSnSet.id), typeof(cSnSet), mSnSet); }