public static void Initialize(CQLog log) { if (!File.Exists("config.json")) { FileStream configFile = new FileStream("config.json", FileMode.OpenOrCreate); StreamReader reader = new StreamReader( System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("vip.popop.pcr.GHelper.Resources.default.json") ); StreamWriter writer = new StreamWriter(configFile); string defaultJson = reader.ReadToEnd(); writer.Write(defaultJson); Config = JsonConvert.DeserializeObject <Configuration>(defaultJson); reader.Close(); writer.Close(); configFile.Close(); } else { FileStream configFileO = new FileStream("config.json", FileMode.Open); StreamReader configReader = new StreamReader(configFileO); Config = JsonConvert.DeserializeObject <Configuration>(configReader.ReadToEnd()); configReader.Close(); configReader.Dispose(); configFileO.Close(); } Event_GroupMessage.ClearHandler(); Event_PrivateMessage.ClearHandler(); accountManager = new Account { logger = log }; accountManager.OnInitialize(); if (Config.IsPhonographEnabled) { phonograph = new Phonograph { Client = (Phonograph.ClientType)Enum.Parse(typeof(Phonograph.ClientType), Config.Phonograph.Platform), IsWithLink = Config.Phonograph.WithLink }; phonograph.OnInitialize(); } if (Config.IsRepeaterEnabled) { repeater = new Repeater { repeatChance = Config.Repeater.RepeatChance, cooldown = Config.Repeater.Cooldown, banWords = Config.Repeater.BanWords }; repeater.OnInitialize(); } if (Config.IsSleepHelperEnabled) { sleepHelper = new SleepHelper { }; sleepHelper.OnInitialize(); } if (Config.IsLinkGeneratorEnabled) { linkGenerator = new LinkGenerator { }; linkGenerator.OnInitialize(); } if (Config.IsSoloEnabled) { solo = new Solo { validSpan = Config.Solo.ValidSpan, checkTime = Config.Solo.CheckTime, maxStack = Config.Solo.MaxStack }; solo.OnInitialize(); } if (Config.IsForestEnabled) { forest = new Forest() { Logger = log }; forest.OnInitialize(); } //letTheyOut = new LetThemOut { //}; //letTheyOut.OnInitialize(); }