Beispiel #1
0
        }//end MV90HHFFileCollection

        /// <summary>
        /// Method is used to refresh the collection of MV90 HHF's
        /// </summary>
        /// <remarks>
        /// Revision History
        /// MM/DD/YY who Version Issue# Description
        /// -------- --- ------- ------ ---------------------------------------
        /// 06/06/07 RDB         N/A	Created
        /// 07/27/07 MAH		Removed filters based on file extensions - all files will be examined
        /// </remarks>
        public void Refresh()
        {
            //Local variables
            MV90_HHF      objMV90HHF;
            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 hhf files in the directory
            foreach (FileInfo objFile in objDir.GetFiles())
            {
                if (MV90_HHF.IsMV90HHFFile(objFile.FullName))
                {
                    //Create a new MV90_HHF from the File info object
                    objMV90HHF = new MV90_HHF(objFile.FullName);

                    //Add the MV90_HHF to the collection
                    InnerList.Add(objMV90HHF);
                }
            }

            //Sort list
            IComparer myComparer = new MV90_HHFComparer();

            InnerList.Sort(myComparer);
        }//end Refresh
        /// <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);
        }
Beispiel #3
0
        int IComparer.Compare(object x, object y)
        {
            MV90_HHF xHHF = (MV90_HHF)x;
            MV90_HHF yHHF = (MV90_HHF)y;

            if (xHHF == null && yHHF == null)
            {
                return(0);
            }
            else if (xHHF == null && yHHF != null)
            {
                return(-1);
            }
            else if (xHHF != null && yHHF == null)
            {
                return(1);
            }
            else
            {
                return(xHHF.FileName.CompareTo(yHHF.FileName));
            }
        } //end Compare