/// <summary> /// Calls CaseInsensitiveComparer.Compare /// </summary> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 01/21/08 AF 10.0 N/A Created // int IComparer.Compare(object x, object y) { CentronIIEDLFile xEDL = (CentronIIEDLFile)x; CentronIIEDLFile yEDL = (CentronIIEDLFile)y; if (xEDL == null && yEDL == null) { return(0); } else if (xEDL == null && yEDL != null) { return(-1); } else if (xEDL != null && yEDL == null) { return(1); } else { return(xEDL.FileName.CompareTo(yEDL.FileName)); } } //end Compare
}//end CentronIIEDLFileCollection /// <summary> /// Method is used to refresh the collection of EDL files /// </summary> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 01/21/08 AF 10.0 N/A Created // 01/29/08 MAH 10.0 Added try catch block so that if (or when) we encounter a file // that appears to be an EDL file but cannot be opened, the // file will not be added to the list rather than throwing an exception // and invalidating the list of EDL files public void Refresh() { CentronIIEDLFile objEDLFile; DirectoryInfo objDir; //clear the collection InnerList.Clear(); //Create a directory info object based on the directory objDir = new DirectoryInfo(m_strDirectory); //Go through the list of edl files in the directory foreach (FileInfo objFile in objDir.GetFiles()) { if (EDLFile.IsEDLFile(objFile.FullName)) { try { //Create a new EDLFile from the File info object objEDLFile = new CentronIIEDLFile(objFile.FullName); //Add the EDL File to the collection InnerList.Add(objEDLFile); } catch { // Do nothing - for some reason we thought we found a valid EDL file but were unable // to actually read the file. The net result is that, since the file cannot be read, it // will not appear in the list of valid EDL files } } } //Sort list IComparer myComparer = new CentronIIEDLFileComparer(); InnerList.Sort(myComparer); }//end Refresh