Exemplo n.º 1
0
        private void RefreshServerData()
        {
            long memory     = 0;
            long memoryMax  = 0;
            long storage    = 0;
            long storageMax = 0;

            try
            {
                ServerProcess?.Refresh();
                memory    = ServerProcess?.PrivateMemorySize64 ?? 0;
                memoryMax = ServerProcess?.VirtualMemorySize64 ?? 0;
                DriveInfo driveInfo = new DriveInfo(Directory.GetDirectoryRoot(Path.GetDirectoryName(Runner.MinecraftServerFolder)));
                storage    = driveInfo.TotalSize - driveInfo.TotalFreeSpace;
                storageMax = driveInfo.TotalSize;
            }
            catch (Exception e)
            {
                Console.Write(string.Format("Hit Exception during RefreshServerData = {0}", e));
            }

            Data.Memory     = memory;
            Data.MemoryMax  = memoryMax;
            Data.Storage    = storage;
            Data.StorageMax = storageMax;
        }