private static void InternalSiteSort() { if (VoteSites.Count < 2) { return; } var list = VoteSites.Values.ToList(); VoteSites.Clear(); list.Sort(InternalSiteSort); list.ForEach(s => VoteSites.Add(s.UID, s)); list.Clear(); }
private static void CMInvoke() { if (VoteSites.Count != 0) { return; } var sites = new List <IVoteSite>(); SiteTypes.ForEach( type => VitaNexCore.TryCatch( () => { var site = type.CreateInstance <IVoteSite>(); if (site == null) { return; } if (site.Name == "Vita-Nex") { site.Enabled = true; } sites.Add(site); CMOptions.ToConsole( "Created site ({0}) '{1}', '{2}'", site.GetType().Name, site.Name, site.Enabled ? "Enabled" : "Disabled"); }, CMOptions.ToConsole)); sites.ForEach( s => { if (!VoteSites.ContainsKey(s.UID)) { VoteSites.Add(s.UID, s); } else { VoteSites[s.UID] = s; } }); InternalSiteSort(); }