예제 #1
0
        public HmiData(string filename)
        {
            FileStream fs;

            m_filename = filename;
            using (fs = File.OpenRead(m_filename))
            {
                byte[] b = new byte[fs.Length];
                if (fs.Read(b, 0, (int)fs.Length) == fs.Length)
                {
                    int    offset          = 0;
                    byte[] xValveGroupDate = new byte[xValveGroup.DataSizeof];
                    if (fs.Length == xValveGroup.DataSizeof * GROUPS_NUM + password.Length)
                    {
                        Array.Copy(b, offset, password, 0, PASSWORD_MAX_LENTH + 1);
                        offset += password.Length;
                        for (int i = 0; i < GROUPS_NUM; i++)
                        {
                            Array.Copy(b, offset, xValveGroupDate, 0, xValveGroup.DataSizeof);
                            xGroup[i] = new xValveGroup(xValveGroupDate);
                            offset   += xValveGroup.DataSizeof;
                        }
                        m_loaded = true;
                    }
                }
            }
        }
예제 #2
0
 public HmiData()
 {
     for (int i = 0; i < PASSWORD_MAX_LENTH; i++)
     {
         password[i] = (byte)'1';
     }
     password[PASSWORD_MAX_LENTH] = 0;
     for (int i = 0; i < GROUPS_NUM; i++)
     {
         xGroup[i] = new xValveGroup();
     }
 }