/// <summary> /// This method adds the given file to the list of data sources to be joined /// together. In doing so, the file will be opened and the load profile data /// will be extracted. /// </summary> /// <param name="strFileName" type="string"> /// </param> /// <returns> /// True if the given file was successfully opened, the load profile data was /// extracted, and the file was added to the list of data sources. False is /// returned if the file could not be added to the data source list. /// </returns> /// <remarks> /// Revision History /// MM/DD/YY Who Version Issue# Description /// -------- --- ------- ------------- ----------------------------------- /// 08/26/08 MAH 9.50 Created /// 11/25/09 AF 2.30.22 Changed the catch to quiet a compiler warning /// </remarks> public override Boolean AddContributor(String strFileName) { Boolean boolSuccess = false; HHFFile hhfFile = null; try { if (MIF.IsMeterImageFile(strFileName)) { hhfFile = new MIF(strFileName); } else if (MV90_HHF.IsMV90HHFFile(strFileName)) { hhfFile = new MV90_HHF(strFileName); } if (hhfFile != null) { LoadProfileDataSource newContributor = new LoadProfileDataSource(hhfFile); m_lstDataSources.Add(newContributor); // We are successful only after we have added the file to the list of // contributors boolSuccess = true; // Everytime a new data source is added we need to clear all of the // cached properties so that they can be recalculated when requested FlushCachedValues(); } } // If, for any reason we could not read the load profile data simply throw the // error so that the caller can catch it but also close the HHF file so that we // do not leave open file handles laying around. catch (Exception) { throw; } finally { if (hhfFile != null) { hhfFile.Close(); } } return(boolSuccess); }
/// <summary> /// /// </summary> /// <param name="x" type="Itron.Metering.Datafiles.LoadProfileContributor"> /// </param> /// <param name="y" type="Itron.Metering.Datafiles.LoadProfileContributor"> /// </param> /// <returns> /// A int value... /// </returns> /// <remarks> /// Revision History /// MM/DD/YY Who Version Issue# Description /// -------- --- ------- ------ --------------------------------------------- /// 08/25/08 mah 9.50.00 Created /// /// </remarks> protected static int CompareStartTime(LoadProfileDataSource x, LoadProfileDataSource y) { if (x == null) { if (y == null) { // If x is null and y is null, they're // equal. return(0); } else { // If x is null and y is not null, y // is greater. return(-1); } } else { // If x is not null... // if (y == null) // ...and y is null, x is greater. { return(1); } else { // ...and y is not null, compare the timestampts of the two items // int retval = x.ProfileStartTime.CompareTo(y.ProfileStartTime); return(retval); } } }