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; }
/* 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)); }
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); }
public void GetModernFormat(ref MTGFormat Format) { Format = AppData.ModernFormat; }
public void UpdateModernFormat(MTGFormat Format) { AppData.ModernFormat = Format; }
public void GetStandardFormat(ref MTGFormat Format) { Format = AppData.StandardFormat; }
public void UpdateStandardFormat(MTGFormat Format) { AppData.StandardFormat = Format; }