This repository has been archived on 2023-06-30. You can view files and clone it, but cannot push or open issues or pull requests.
2chBackAPI/APIThreadBuffer.cs

38 lines
1.1 KiB
C#
Raw Normal View History

2022-11-25 12:37:26 +10:00
namespace NeDvachAPI
{
public class APIThreadBuffer
{
private static List<Post> ThreadsPrewievs;
private static List<Post>[] Threads = new List<Post>[0];
public static void WriteThreadPreviewsBuffer(List<Post> OPPostsToWrite) //add list of OP-posts and last post to buffer
{
ThreadsPrewievs = OPPostsToWrite;
}
public static List<Post> GetOPPosts()
{
return ThreadsPrewievs;
}
public static void WriteThreadsBuffer(List<Post> ThreadToAdd) //add thread's posts from DB to buffer
{
Threads = Threads.Append(ThreadToAdd).ToArray();
}
public static List<Post> GetThread(int threadId)
{
if (threadId < Threads.Length + 1 & threadId != 0)
{
;
return Threads[threadId - 1];
}
else return null;
}
public static void RefreshThread(int threadId)
{
Threads[threadId - 1] = DBchat.PostsList("b", threadId);
}
}
}