static void Main(string[] args) { Console.Title = "IVCheckingQueue"; Console.OutputEncoding = System.Text.Encoding.GetEncoding(866); FileExists(DomainConfigFile); Config = DomainConfig.ReadFromJson(DomainConfigFile); if (Config.FocusSize == 0) { Config.FocusSize = 25; DomainConfig.WriteToJson(Config, DomainConfigFile); } var thr = new System.Threading.Thread(BackgroudProcessing) { IsBackground = true }; thr.Start(); while (Domains.Count == 0) { Thread.Sleep(25); } Console.Clear(); while (true) { int i = 0; foreach (var d in FocusedDomains) { ++i; Console.Write($"{i}.".PadRight(4)); PrintDomain(d); } Console.WriteLine(); Console.WriteLine($"{Config.userName} is #{Domains.FindIndex(_x => _x.Authors.Contains(Config.userName)) + 1}"); if (!String.IsNullOrEmpty(Config.userNameSecond)) { Console.WriteLine($"{Config.userNameSecond} is #{Domains.FindIndex(_x => _x.Authors.Contains(Config.userNameSecond)) + 1}"); } Thread.Sleep(Config.UpdateTime * 1000); Console.Clear(); } }
public static void WriteToJson(DomainConfig data, string pathFile) { var jsonString = data.ToJson(); System.IO.File.WriteAllText(pathFile, jsonString); }