Example #1
0
        public DataManager()
        {
            _SQLWrapper       = new SQLWrapper();
            _MTGPriceParser   = new MTGPriceParser();
            _FormatParser     = new FormatParser();
            _DataFilter       = new DataFilter();
            _ApplicationState = new MTGUtils.AppState();

            log                = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            Sets               = _SQLWrapper.GetSetList();
            CurrentCard        = null;
            CurrentPricePoints = null;
            CurrentFormat      = null;
        }
Example #2
0
        /* Get Modern format. May need to parse from HTML or just from the appstate. */
        public List <MTGSet> RetrieveModernFormat()
        {
            _ApplicationState.GetModernFormat(ref CurrentFormat);

            if (CurrentFormat == null || CurrentFormat.FormatListLastUpdate.CompareTo(DateTime.Today) < 0)
            {
                // Need to update the format.
                URLFetcher Fetcher = new URLFetcher(_FormatParser.ModernURL);
                string     ret     = Fetcher.Fetch();
                CurrentFormat = _FormatParser.ParseFormat(ret, _FormatParser.ModernFormatName);
                if (CurrentFormat == null)
                {
                    return(null);
                }
            }

            _ApplicationState.UpdateModernFormat(CurrentFormat);
            return(ConvertStringsToSets(CurrentFormat.Sets));
        }
Example #3
0
        public MTGFormat ParseFormat(string HTMLIn, string FormatName)
        {
            MTGFormat ret = new MTGFormat(FormatName);

            ret.FormatListLastUpdate = DateTime.Today;
            if (string.Compare(FormatName, StandardFormatName, true) == 0)
            {
                ret.Sets = ParseStandard(HTMLIn);
            }
            else if (string.Compare(FormatName, ModernFormatName, true) == 0)
            {
                ret.Sets = ParseModern(HTMLIn);
            }
            else
            {
                log.Error("FormatParser::ParseFormat() supplied unexpected format name '" + FormatName + "'");
                return(null);
            }

            return(ret);
        }
Example #4
0
 public void GetModernFormat(ref MTGFormat Format)
 {
     Format = AppData.ModernFormat;
 }
Example #5
0
 public void UpdateModernFormat(MTGFormat Format)
 {
     AppData.ModernFormat = Format;
 }
Example #6
0
 public void GetStandardFormat(ref MTGFormat Format)
 {
     Format = AppData.StandardFormat;
 }
Example #7
0
 public void UpdateStandardFormat(MTGFormat Format)
 {
     AppData.StandardFormat = Format;
 }