public static InovanceDoc LoadDocument(int plcindex) { InovanceDoc m_Doc; XmlSerializer xmlSerializer = new XmlSerializer(typeof(InovanceDoc)); FileStream fsReader = null; try { fsReader = File.OpenRead(@".//Parameter/InovanceDoc" + plcindex.ToString() + ".xml"); m_Doc = (InovanceDoc)xmlSerializer.Deserialize(fsReader); fsReader.Close(); m_Doc.m_scanDictionary = m_Doc.m_ScanDataList.ToDictionary(p => p.strName); m_Doc.ipAddress = IPAddress.Parse(m_Doc.stripAddress); m_Doc.nplcindex = plcindex; } catch (Exception ex) { if (fsReader != null) { fsReader.Close(); } m_Doc = new InovanceDoc(); MessageBox.Show(ex.Message); } return(m_Doc); }
public static void LoadData(int plcindex) { m_inovanceDoc[plcindex] = InovanceDoc.LoadDocument(plcindex); m_inovanceAPI[plcindex] = new InovanceModbusAPI(); }