Inheritance: ReferenceReader
Exemple #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());
        }
Exemple #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());
        }
 public static ReferenceReader GetReader(ProjectLayoutReference zReference)
 {
     if (zReference == null)
     {
         return(null);
     }
     if (zReference.RelativePath.StartsWith(CardMakerConstants.GOOGLE_REFERENCE +
                                            CardMakerConstants.GOOGLE_REFERENCE_SPLIT_CHAR))
     {
         var zReader = new GoogleReferenceReader(zReference);
         if (!CardMakerInstance.GoogleCredentialsInvalid)
         {
             return(zReader);
         }
     }
     return(new CSVReferenceReader(zReference));
 }
 public static ReferenceReader GetReader(ProjectLayoutReference zReference)
 {
     if (zReference == null)
     {
         return null;
     }
     ReferenceReader zReader;
     if (zReference.RelativePath.StartsWith(CardMakerConstants.GOOGLE_REFERENCE +
                                                    CardMakerConstants.GOOGLE_REFERENCE_SPLIT_CHAR))
     {
         zReader = new GoogleReferenceReader(zReference);
         if (!CardMakerInstance.GoogleCredentialsInvalid)
         {
             return zReader;
         }
     }
     return new CSVReferenceReader(zReference);
 }
        public static ReferenceReader GetReader(ProjectLayoutReference zReference)
        {
            if (zReference == null)
            {
                return(null);
            }
            if (zReference.RelativePath.StartsWith(GoogleSpreadsheetReference.GOOGLE_REFERENCE +
                                                   GoogleSpreadsheetReference.GOOGLE_REFERENCE_SPLIT_CHAR))
            {
                var zReader = new GoogleReferenceReader(zReference);
                return(CardMakerInstance.GoogleCredentialsInvalid ? null : zReader);
            }

            if (zReference.RelativePath.StartsWith(ExcelSpreadsheetReference.EXCEL_REFERENCE +
                                                   ExcelSpreadsheetReference.EXCEL_REFERENCE_SPLIT_CHAR))
            {
                return(new ExcelReferenceReader(zReference));
            }
            return(new CSVReferenceReader(zReference));
        }