AdvancedLogParser.InfoGather.IdentifyLogins C# (CSharp) Method

IdentifyLogins() public static method

public static IdentifyLogins ( ) : void
return void
        public static void IdentifyLogins()
        {
            currentLoader.status.Text = "Identifying players...";
            Application.DoEvents();
            foreach (Log thisLog in Logs.RecentLogins.Values)
            {
                try
                {
                    if (!Servers.List.Keys.Contains(thisLog.ServerId))
                    {
                        Server srv = new Server() { ServerId = thisLog.ServerId };
                        Servers.List.Add(thisLog.ServerId, srv);
                    }
                    Server currentServer = Servers.List[thisLog.ServerId];

                    if (thisLog.EventDescription.Contains("Dungeon Master:"))
                    {
                        Player dm = Players.ListByPlayerId[Characters.List[thisLog.CharacterId].PlayerId];
                        Characters.List[thisLog.CharacterId].IsDMAvatar = true;
                        if (!currentServer.RecentDMs.Contains(dm))
                        {
                            currentServer.RecentDMs.Add(dm);
                        }
                    }
                    else
                    {
                        Character character = Characters.List[thisLog.CharacterId];
                        if (!currentServer.RecentCharacters.Contains(character))
                        {
                            currentServer.RecentCharacters.Add(character);
                        }

                        Player player = Players.ListByPlayerId[Characters.List[thisLog.CharacterId].PlayerId];
                        if (!currentServer.RecentPlayers.Contains(player))
                        {
                            currentServer.RecentPlayers.Add(player);
                        }
                    }
                }
                catch { }
            }
            foreach (Server server in Servers.List.Values)
            {
                foreach (Character ch in server.RecentCharacters)
                {
                    if (ch.IsDMAvatar)
                    {
                        server.RecentCharacters.Remove(ch);
                    }
                }
            }
        }

Usage Example

Beispiel #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            InfoGather.DatabasePassword = ConfigurationSettings.AppSettings["DatabasePassword"];
            InfoGather.DatabaseSchema   = ConfigurationSettings.AppSettings["DatabaseSchema"];
            InfoGather.DatabaseServer   = ConfigurationSettings.AppSettings["DatabaseServer"];
            InfoGather.DatabasePort     = ConfigurationSettings.AppSettings["DatabasePort"];
            InfoGather.DatabaseUser     = ConfigurationSettings.AppSettings["DatabaseUser"];
            InfoGather.BuildConnectionString();
            Players.ListByPlayerId = new Dictionary <uint, Player>();
            Players.ListByKey      = new Dictionary <string, Player>();
            Characters.List        = new Dictionary <uint, Character>();
            Logs.AdvancementAlerts = new Dictionary <uint, Log>();
            Logs.DeathAlerts       = new Dictionary <uint, Log>();
            Logs.EnforcementAlerts = new Dictionary <uint, Log>();
            Logs.RecentLogins      = new Dictionary <uint, Log>();
            Servers.List           = new Dictionary <uint, Server>();
            if (InfoGather.GetPlayers())
            {
                InfoGather.GetCharacters();
                InfoGather.CountBankValue();
                InfoGather.CountpChestValue();
                InfoGather.GetAlerts();
                InfoGather.GetLogins();
                InfoGather.IdentifyLogins();
                InfoGather.GetDMTime();
                InfoGather.currentLoader.Close();
                InfoGather.currentLoader.Dispose();
                if (ServerFocus >= 0)
                {
                    foreach (Server srv in Servers.List.Values)
                    {
                        if (srv.ServerId == Math.Abs(ServerFocus))
                        {
                            Application.Run(new ServerView(srv));
                        }
                    }
                }
                else
                {
                    foreach (Server srv in Servers.List.Values)
                    {
                        new ServerView(srv).Show();
                    }
                    new ServerView(null).Show();
                    Application.Run(new PrimaryDisplay());
                }
            }
        }