private void AssignFromFileToTag(string temp, cTag i) { string[] split = System.Text.RegularExpressions.Regex.Split(temp, ","); try { DataRow dr; dr = Repository.Instance.Tag_Data_Table.NewRow(); dr["ID"] = split[0]; dr["GroupNo"] = split[1]; dr["Description"] = split[2]; dr["Unit"] = split[4]; dr["Resolution"] = split[7]; dr["InputCH"] = split[8]; dr["Address_bit"] = split[9]; dr["RangeMin"] = split[12]; dr["RangeMax"] = split[13]; Repository.Instance.Tag_Data_Table.Rows.Add(dr); i.AlrOffValue = false; i.Index = split[0]; i.grno = split[1]; i.Description = split[2]; i.Unit = split[4]; // 예외처리를 해줘야함 if (split[7] == "") { split[7] = "0"; } i.resolution = Convert.ToSingle(split[7]); i.Address = split[8]; i.bit_address = split[9]; //i.Min = Convert.ToSingle(split[12]); //i.Max = Convert.ToSingle(split[13]); /* * i.LoLimit = Convert.ToSingle(split[14]); * i.HiLimit = Convert.ToSingle(split[15]); * i.LoLo = Convert.ToBoolean(split[24]); * i.Lo = Convert.ToBoolean(split[25]); * i.Hi = Convert.ToBoolean(split[26]); * i.HiHi = Convert.ToBoolean(split[27]); * i.LoLoLimit = Convert.ToSingle(split[29]); * i.HiHiLimit = Convert.ToSingle(split[30]); */ return; } catch (Exception e) { MessageBox.Show(e.Message, "Abort"); throw e; } }
public TagManager(Repository rep) { directory = Application.StartupPath; // ---------------------------------------------------------------------------------------- // 파일을 읽어서 List에 넣기 // cTag에 저장하기 // 항상 동작하면서 cTag에 있는 값을 해당되는 통신방식에 맞게 값을 읽어오고 주기적으로 쓴다 // ---------------------------------------------------------------------------------------- //cTag 초기화 tt = new cTag[TSize]; for (int i = 0; i < TSize; i++) { tt[i] = new cTag(); } #region FAULT_STATUS_초기화 for (int nFileNo = 14; nFileNo <= 21; nFileNo++) { for (int nBit = 0; nBit <= 15; nBit++) { if (FAULT_STATUS[nFileNo, nBit, 0] == null) { FAULT_STATUS[nFileNo, nBit, 0] = "0"; } } } for (int nFileNo = 46; nFileNo <= 48; nFileNo++) { for (int nBit = 0; nBit <= 15; nBit++) { if (FAULT_STATUS[nFileNo, nBit, 0] == null) { FAULT_STATUS[nFileNo, nBit, 0] = "0"; } } } #endregion //Read_AlarmData(ref tt); }