Inheritance: ReferenceReader
Ejemplo n.º 1
0
        /// <summary>
        /// Gets the reference reader based on the type
        /// </summary>
        /// <param name="eReferenceType">The type of reference to get the reader for</param>
        /// <param name="zProgressReporter">ProgressReporter for the Reader to use</param>
        /// <returns>Reference reader (defaults to null)</returns>
        public static ReferenceReader GetDefineReader(ReferenceType eReferenceType, IProgressReporter zProgressReporter)
        {
            ReferenceReader zReferenceReader = null;

            switch (eReferenceType)
            {
            case ReferenceType.CSV:
                zReferenceReader = new CSVReferenceReader();
                break;

            case ReferenceType.Google:
                zReferenceReader = new GoogleReferenceReader();
                break;

            case ReferenceType.Excel:
                zReferenceReader = new ExcelReferenceReader();
                break;
            }

            if (zReferenceReader != null)
            {
                zReferenceReader.ProgressReporter = zProgressReporter;
            }
            return(zReferenceReader.Initialize());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the reference reader based on the reference relative path.
        /// NOTE: this uses a constructor that passes in the reference
        /// </summary>
        /// <param name="zReference">The reference to get the reader for</param>
        /// <param name="zProgressReporter">ProgressReporter for the Reader to use</param>
        /// <returns>Reference reader (defaults to CSV)</returns>
        public static ReferenceReader GetReader(ProjectLayoutReference zReference, IProgressReporter zProgressReporter)
        {
            if (zReference == null)
            {
                return(null);
            }
            ReferenceReader zReferenceReader = null;

            if (zReference.RelativePath.StartsWith(GoogleSpreadsheetReference.GOOGLE_REFERENCE +
                                                   GoogleSpreadsheetReference.GOOGLE_REFERENCE_SPLIT_CHAR))
            {
                zReferenceReader = new GoogleReferenceReader(zReference);
            }
            if (zReference.RelativePath.StartsWith(ExcelSpreadsheetReference.EXCEL_REFERENCE +
                                                   ExcelSpreadsheetReference.EXCEL_REFERENCE_SPLIT_CHAR))
            {
                zReferenceReader = new ExcelReferenceReader(zReference);
            }
            if (null == zReferenceReader)
            {
                zReferenceReader = new CSVReferenceReader(zReference);
            }

            zReferenceReader.ProgressReporter = zProgressReporter;
            return(zReferenceReader.Initialize());
        }