Started non anime version of website support

This commit is contained in:
BOT Alex 2023-05-29 04:13:13 +02:00
parent 4b15ca21a8
commit 4b9c515959
2 changed files with 10 additions and 3 deletions

View File

@ -126,12 +126,14 @@
List<Post> posts = new List<Post>(); List<Post> posts = new List<Post>();
private Random random = new Random(); private Random random = new Random();
const int numImages = 211; const bool useFoodImages = true;
const int numImagesAnime = 399;
const int numImages = 399;
Post GetRandomPost() Post GetRandomPost()
{ {
int selectedPostNum; int selectedPostNum;
reselect: reselect:
selectedPostNum = random.Next(1, numImages); selectedPostNum = random.Next(1, (useFoodImages) ? numImages : numImagesAnime);
if (LoadedImages.Contains(selectedPostNum)) if (LoadedImages.Contains(selectedPostNum))
goto reselect; goto reselect;
@ -143,9 +145,14 @@
return selectedPost; return selectedPost;
} }
string GetImage(int imageIndex) string GetImage(int imageIndex)
{ {
if (!useFoodImages)
return $@"\images\AnimeImages\AnimeImage ({imageIndex}).jpeg"; return $@"\images\AnimeImages\AnimeImage ({imageIndex}).jpeg";
else
return $@"\images\Non-AnimeImages\Food ({imageIndex}).jpeg";
} }
protected override void OnAfterRender(bool firstRender) protected override void OnAfterRender(bool firstRender)

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB