public static TikTok Prase(string line) { string[] words = line.Split('\t'); string org = words[0]; int len = Convert.ToInt32(words[1]); string hash = words[2]; Audience aud = (Audience)Enum.Parse(typeof(Audience), words[3]); TikTok tikTok = new TikTok(org, len, hash, aud); return tikTok; }
public static void Intializer() { TikTok tiktok1 = new TikTok("Lora", 4, "Note10", Audience.World); TikTok tiktok2 = new TikTok("james", 29, "SunSet", Audience.Special); TikTok tikTok3 = new TikTok("Rogy", 19, "Funny", Audience.Special); TikTok tikTok4 = new TikTok("Qusai", 19, "Playstation", Audience.Group); TikTok tikTok5 = new TikTok("Sara", 28, "Centennial", Audience.World); TIKTOKS.Add(tiktok1); TIKTOKS.Add(tiktok2); TIKTOKS.Add(tikTok3); TIKTOKS.Add(tikTok4); TIKTOKS.Add(tikTok5); }
static TikTokManger() { TIKTOKS = new List<TikTok>(); TextReader reader = new StreamReader(FILENAME); int linesCount = File.ReadAllLines(FILENAME).Length; for (int i = 0; i < linesCount; i++) { string line = reader.ReadLine(); if (line != null) { TIKTOKS.Add(TikTok.Prase(line)); } } }