static internal T StreamHandler <T>(string basePath, ValidYear year, ValidLunarMonth month, Func <ValidYear, ValidLunarMonth, Stream, T> method) { string path = Helpers.CombinePath(basePath, year, month); using (Stream s = File.OpenRead(path)) { return(method(year, month, s)); } }
public ILunarSolarCalendarMonthDetailed GetMonthDataDetailed(ValidYear year, ValidLunarMonth month) { try { return(StreamDeligate <ILunarSolarCalendarMonthDetailed>( year, month, Deserialize <LunarSolarCalendarMonthDetailed> )); } catch (Exception e) when(ExpectedExceptionPredicate(e)) { var monthsInYear = GetYear(year).Count(); throw new SolarLunarName.SharedTypes.Exceptions.MonthDoesNotExistException(year, month, monthsInYear); } }
protected override T StreamDeligate <T>(ValidYear year, ValidLunarMonth month, Func <Stream, T> method) { string path = Helpers.CombinePath(_basePath, year, month); return(StreamDeligate <T>(path, method)); }
public ILunarSolarCalendarMonth GetMonthData(ValidYear year, ValidLunarMonth month) => throw new NotImplementedException();
protected abstract T StreamDeligate <T>(ValidYear year, ValidLunarMonth month, Func <Stream, T> method);
static public Uri CombinePath(string baseUrl, ValidYear year, ValidLunarMonth month) { var path = $"{baseUrl}/{year}/{month}/index.json"; return(new Uri(path)); }
protected override T StreamDeligate <T>(ValidYear year, ValidLunarMonth month, Func <Stream, T> method) { Uri uri = Helpers.CombinePath(_baseUrl, year, month); return(StreamDeligate <T>(uri, method)); }
static internal string CombinePath(string basePath, ValidYear year, ValidLunarMonth month) { var path = Path.Combine(basePath, (string)year, (string)month, "index.json"); return(path); }