/// <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> /// A load profile contributor starts with a data source. In this case /// the data source in an HHF file. Therefore, in order to construct a new /// contributor object you must pass in an HHF file object. Note that it could /// be either a MIF file or an MV-90 HHF file. /// </summary> /// <remarks> /// Revision History /// MM/DD/YY Who Version Issue# Description /// -------- --- ------- ------ --------------------------------------------- /// 08/25/08 mah 9.50.00 Created /// /// </remarks> public LoadProfileDataSource(HHFFile hhf) { FileName = hhf.FileName; UnitID = hhf.DeviceID; if (hhf.ContainsLPData) { LPData = hhf.LPData; DSTEnabled = hhf.DSTEnabled; ReadTime = hhf.TimeOfRead; } else { LPData = null; } }