Пример #1
0
        public AboutHost Get()
        {
            var a = new AboutHost {
                Version                = typeof(AboutHost).GetTypeInfo().Assembly.GetName().Version,
                OSDescription          = RuntimeInformation.OSDescription,
                Is64BitOperatingSystem = RuntimeInformation.OSArchitecture == Architecture.X64,
                Is64BitProcess         = RuntimeInformation.ProcessArchitecture == Architecture.X64,
                ProcessorCount         = Environment.ProcessorCount,
#if !NETSTANDARD1_6
                WorkingSet = Environment.WorkingSet,
#endif
                ConnectedUserCount = _sessionManager.GetUsers().Count()
            };

            var memoryInfo = _systemInfo.GetMemoryInformation();

            a.TotalVirtualMemory  = memoryInfo.TotalVirtualMemory;
            a.FreeVirtualMemory   = memoryInfo.FreeVirtualMemory;
            a.TotalPhysicalMemory = memoryInfo.TotalPhysicalMemory;
            a.FreePhysicalMemory  = memoryInfo.FreePhysicalMemory;

            a.VideoCards = _systemInfo.GetVideoControllerInformation().Select(ci =>
                                                                              new VideoCardInfo()
            {
                VideoCardName  = ci.VideoCardName,
                VideoRAM       = ci.VideoRAM,
                VideoProcessor = ci.VideoProcessor
            }).ToArray();

            var latest = _interpManager.Interpreters.Latest();

            a.Interpreters = _interpManager.Interpreters.Select(x => x.Id == latest.Id ? Invariant($"[{x.Id}] {x.Name} ({Resources.Default})") : Invariant($"[{x.Id}] {x.Name}")).ToArray();
            return(a);
        }