public async Task<PageItem> GetContent(string cat, bool offline)
{
try
{
if (offline)
{
var catId = int.Parse(cat);
var ctx = DataContext.Instance;
var data = (await ctx.Content.GetItems())
.First(x => x.CatId == catId);
var result = _mapper.Map<PageItem>(data);
result.Tab1 = ReplaceImages(result.Tab1);
result.Tab2 = ReplaceImages(result.Tab2);
result.Tab3 = ReplaceImages(result.Tab3);
result.FavUrl = $"{cat}";
return result;
}
else
{
//return $"{BaseUrl}content.php?cat={cat}&tab={tab}";
var da = new LoadDataAdapter();
var json = await da.GetJson(Settings.GetContent(cat));
var data = JsonConvert.DeserializeObject<PageItem>(json, new JsonBooleanConverter());
data.FavUrl = cat;
return data;
}
}
catch (Exception ex)
{
throw new ArgumentNullException("Ошибка загрузки.", ex);
}
}
#if NET20
// NET 20 specific
#endif
<TargetFrameworks>netstandard1.3;netstandard2.1;net45;net46;net472;netcoreapp1;netcoreapp2;netcoreapp3;netcoreapp3.1</TargetFrameworks>
https://github.com/vkorotenko/NAddressParser/blob/...