using NeDvachAPI.DBControllers; using NeDvachAPI.Models; namespace NeDvachAPI.BufferControllers { public class BufferFill { public static bool FillBuffer(string board) //method to get buffer of information, which is being ran while API is started { List Previews = DBchat.ThreadsList(board); APIThreadBuffer.WriteThreadPreviewsBuffer(Previews); Console.WriteLine("Adding OP-posts to buffer"); for (int threadId = 1; threadId <= Previews.Count; threadId++) { APIThreadBuffer.AppendThreadsBuffer(DBchat.PostsList(board, threadId)); } Console.WriteLine($@"Buffering threads {1} to {Previews.Count}."); for (int preview = 0; preview < Previews.Count; preview++) { int targetLength = APIThreadBuffer.GetThreadLength(preview); for (int lastofthree = targetLength- 2; lastofthree <= targetLength; lastofthree ++) { APIThreadBuffer.AppendToThreadPreviews(preview,APIThreadBuffer.GetSinglePost(preview,lastofthree)); } } return true; } } }