示例#1
0
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    _cpuCounter.NextValue(); //Always 0
                    var avatar = level.GetPlayerAvatar();
                    var mail   = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(avatar.GetId());
                    mail.SetSenderAvatarId(avatar.GetId());
                    mail.SetSenderName(avatar.GetAvatarName());
                    mail.SetIsNew(2);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(1526735450);
                    mail.SetAllianceName("UCS Server Information");
                    mail.SetMessage(@"Online Players: " + ResourcesManager.GetOnlinePlayers().Count +
                                    "\nIn Memory Players: " + ResourcesManager.GetInMemoryLevels().Count +
                                    "\nConnected Players: " + ResourcesManager.GetConnectedClients().Count +
                                                                                    //"\nUCS Ram: " + (Process.GetCurrentProcess().WorkingSet64 / 1048576) + "MB/" + //Unknown yet how to get properly
                                    "\nServer Ram: " + PerformanceInfo.GetPhysicalAvailableMemoryInMiB() + "MB/" + Performances.GetTotalMemory() + "MB" +
                                    "\nServer CPU " + _cpuCounter.NextValue() + "%" //Match Taskmanager
                                    );

                    mail.SetSenderLevel(avatar.GetAvatarLevel());
                    mail.SetSenderLeagueId(avatar.GetLeagueId());

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    p.Send();
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
示例#2
0
        public override void Execute(Level level)
        {
            if (level.Avatar.AccountPrivileges >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_PerfFormattedData_PerfOS_Processor");
                    var cpuTimes = searcher.Get()
                                   .Cast <ManagementObject>()
                                   .Select(mo => new
                    {
                        Name  = mo["Name"],
                        Usage = mo["PercentProcessorTime"]
                    }
                                           )
                                   .ToList();
                    var query         = cpuTimes.Where(x => x.Name.ToString() == "_Total").Select(x => x.Usage);
                    var CPUParcentage = query.SingleOrDefault();
                    RAMUsage       = PerformanceInfo.GetTotalMemoryInMiB() - PerformanceInfo.GetPhysicalAvailableMemoryInMiB();
                    DriveLetter    = Path.GetPathRoot(Directory.GetCurrentDirectory());
                    DiskSpace      = new DriveInfo(DriveLetter.Substring(0, DriveLetter.Length - 2));
                    TotalFreeSpace = DiskSpace.TotalFreeSpace / 1073741824;
                    TotalDiskSize  = DiskSpace.TotalSize / 1073741824;
                    DiskspaceUsed  = TotalDiskSize - TotalFreeSpace;
                    ClientAvatar avatar = level.Avatar;
                    var          mail   = new AllianceMailStreamEntry();
                    mail.ID = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
                    mail.SetSender(avatar);
                    mail.IsNew             = 2;
                    mail.AllianceId        = 0;
                    mail.AllianceBadgeData = 1526735450;
                    mail.AllianceName      = "UCS Server Information";
                    mail.Message           = @"Online Players: " + ResourcesManager.m_vOnlinePlayers.Count +
                                             "\nIn Memory Players: " + ResourcesManager.m_vInMemoryLevels.Count +
                                             "\nConnected Players: " + ResourcesManager.GetConnectedClients().Count +
                                             "\nTotal System CPU Usage: " + CPUParcentage + "%" +
                                             "\nServer RAM: " + Performances.GetUsedMemory() + "% / " + Performances.GetTotalMemory() + "MB" +
                                             "\nTotal Server Ram Usage: " + RAMUsage + "MB / " + Performances.GetTotalMemory() + "MB" +
                                             "\nServer Disk Space Used: " + Math.Round(DiskspaceUsed, 2) + "GB / " + Math.Round(TotalDiskSize, 2) + "GB";

                    var p = new AvatarStreamEntryMessage(level.Client);
                    p.SetAvatarStreamEntry(mail);
                    Processor.Send(p);
                }
            }
            else
            {
                SendCommandFailedMessage(level.Client);
            }
        }
        public override void Execute(Level level)
        {
            if (level.Avatar.AccountPrivileges >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    ClientAvatar avatar = level.Avatar;
                    var          mail   = new AllianceMailStreamEntry();
                    mail.ID = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
                    mail.SetSender(avatar);
                    mail.IsNew             = 2;
                    mail.AllianceId        = 0;
                    mail.AllianceBadgeData = 1526735450;
                    mail.AllianceName      = "UCS Server Information";
                    mail.Message           = @"Online Players: " + ResourcesManager.m_vOnlinePlayers.Count +
                                             "\nIn Memory Players: " + ResourcesManager.m_vInMemoryLevels.Count +
                                             "\nConnected Players: " + ResourcesManager.GetConnectedClients().Count +
                                             "\nServer Ram: " + Performances.GetUsedMemory() + "% / " + Performances.GetTotalMemory() + "MB";

                    var p = new AvatarStreamEntryMessage(level.Client);
                    p.SetAvatarStreamEntry(mail);
                    Processor.Send(p);
                }
            }
            else
            {
                SendCommandFailedMessage(level.Client);
            }
        }
示例#4
0
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    var avatar = level.GetPlayerAvatar();
                    var mail   = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(avatar.GetId());
                    mail.SetSenderAvatarId(avatar.GetId());
                    mail.SetSenderName(avatar.GetAvatarName());
                    mail.SetIsNew(2);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(1526735450);
                    mail.SetAllianceName("UCS Server Information");
                    mail.SetMessage(@"Online Players: " + ResourcesManager.GetOnlinePlayers().Count +
                                    "\nIn Memory Players: " + ResourcesManager.GetInMemoryLevels().Count +
                                    "\nConnected Players: " + ResourcesManager.GetConnectedClients().Count +
                                    "\nServer Ram: " + Performances.GetUsedMemory() + "% / " + Performances.GetTotalMemory() + "MB"
                                    );

                    mail.SetSenderLevel(avatar.GetAvatarLevel());
                    mail.SetSenderLeagueId(avatar.GetLeagueId());

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketProcessor.Send(p);
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }