Пример #1
0
        /// <summary>
        /// Calls CaseInsensitiveComparer.Compare
        /// </summary>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 06/14/07 RDB         N/A	   Created
        int IComparer.Compare(object x, object y)
        {
            ProtocolFile xPF = (ProtocolFile)x;
            ProtocolFile yPF = (ProtocolFile)y;

            return(string.Compare(xPF.Name, yPF.Name, StringComparison.Ordinal));
        } //end Compare
Пример #2
0
        }//end ProtocolFileCollection

        /// <summary>
        /// Refreshes the contents of the protocol file collection
        /// </summary>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 06/14/07 RDB         N/A	   Created
        public void Refresh()
        {
            //Local variables
            ProtocolFile  objPF;
            DirectoryInfo objDir;

            //clear the current collection
            InnerList.Clear();

            //Create a directory info object based on the directory
            objDir = new DirectoryInfo(m_strDirectory);

            //Go through the list of protocol files in the directory
            foreach (FileInfo objFile in objDir.GetFiles("*.dnp"))
            {
                //Create a new protocol file from the File info object
                objPF              = new ProtocolFile(objFile.FullName);
                objPF.Name         = objFile.Name;
                objPF.Type         = ProtocolFile.eProtocolType.DNP_3;
                objPF.LastModified = objFile.LastWriteTime;

                //Add the protocol file to the collection
                InnerList.Add(objPF);
            }
            foreach (FileInfo objFile in objDir.GetFiles("*.pds"))
            {
                //Create a new protocol file from the File info object
                objPF              = new ProtocolFile(objFile.FullName);
                objPF.Name         = objFile.Name;
                objPF.Type         = ProtocolFile.eProtocolType.PDS;
                objPF.LastModified = objFile.LastWriteTime;

                //Add the protocol file to the collection
                InnerList.Add(objPF);
            }
            foreach (FileInfo objFile in objDir.GetFiles("*.mbu"))
            {
                //Create a new protocol file from the File info object
                objPF              = new ProtocolFile(objFile.FullName);
                objPF.Name         = objFile.Name;
                objPF.Type         = ProtocolFile.eProtocolType.Modbus;
                objPF.LastModified = objFile.LastWriteTime;

                //Add the protocol file to the collection
                InnerList.Add(objPF);
            }
            foreach (FileInfo objFile in objDir.GetFiles("*.ie2"))
            {
                //Create a new protocol file from the File info object
                objPF              = new ProtocolFile(objFile.FullName);
                objPF.Name         = objFile.Name;
                objPF.Type         = ProtocolFile.eProtocolType.IEC_60870_5_102;
                objPF.LastModified = objFile.LastWriteTime;

                //Add the protocol file to the collection
                InnerList.Add(objPF);
            }
            foreach (FileInfo objFile in objDir.GetFiles("*.i2p"))
            {
                //Create a new protocol file from the File info object
                objPF              = new ProtocolFile(objFile.FullName);
                objPF.Name         = objFile.Name;
                objPF.Type         = ProtocolFile.eProtocolType.IEC_60870_5_102_Plus;
                objPF.LastModified = objFile.LastWriteTime;

                //Add the protocol file to the collection
                InnerList.Add(objPF);
            }

            //sort protocol files
            ProtocolFileComparer comparer = new ProtocolFileComparer();

            InnerList.Sort(comparer);
        }//end Refresh