internal static MacTelemetryDetails CreateTelemetryDetails() { var result = new MacTelemetryDetails(); SysCtl("hw.machine", out result.arch); SysCtl("hw.cpufamily", out result.family); SysCtl("hw.cpufrequency", out result.freq); var attrs = NSFileManager.DefaultManager.GetFileSystemAttributes("/"); result.size = attrs.Size; result.freeSize = attrs.FreeSize; result.osType = GetMediaType("/"); try { var login = GetLoginTime(); if (login != DateTimeOffset.MinValue) { var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero); var timeSinceEpoch = DateTimeOffset.UtcNow - epoch; var loginSinceEpoch = login - epoch; result.sinceLogin = timeSinceEpoch - loginSinceEpoch; } } catch (Exception e) { LoggingService.LogError("Error getting logintime", e); result.sinceLogin = TimeSpan.Zero; } return(result); }
internal static MacTelemetryDetails CreateTelemetryDetails() { var result = new MacTelemetryDetails(); SysCtl("hw.machine", out result.arch); SysCtl("hw.cpufamily", out result.family); SysCtl("hw.cpufrequency", out result.freq); var attrs = NSFileManager.DefaultManager.GetFileSystemAttributes("/"); result.size = attrs.Size; result.freeSize = attrs.FreeSize; result.osType = GetMediaType("/"); var login = GetLoginTime(); if (login != DateTime.MinValue) { var epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); var timeSinceEpoch = DateTime.UtcNow - epoch; var loginSinceEpoch = login - epoch; result.sinceLogin = timeSinceEpoch - loginSinceEpoch; } return(result); }
internal static MacTelemetryDetails CreateTelemetryDetails() { var result = new MacTelemetryDetails(); Interop.SysCtl("hw.machine", out result.arch); Interop.SysCtl("hw.cpufamily", out result.family); Interop.SysCtl("hw.cpufrequency", out result.freq); Interop.SysCtl("hw.physicalcpu", out result.coreCount); Interop.SysCtl("hw.model", out result.model); var attrs = NSFileManager.DefaultManager.GetFileSystemAttributes("/"); result.size = attrs.Size; result.freeSize = attrs.FreeSize; result.osType = GetMediaType("/"); var screenList = new List <ScreenDetails>(); foreach (var s in NSScreen.Screens) { var details = new ScreenDetails { PointWidth = (float)s.Frame.Width, PointHeight = (float)s.Frame.Height, BackingScaleFactor = (float)s.BackingScaleFactor, PixelWidth = (float)(s.Frame.Width * s.BackingScaleFactor), PixelHeight = (float)(s.Frame.Height * s.BackingScaleFactor) }; screenList.Add(details); } result.screens = screenList.ToArray(); result.graphicsDetails = GetGraphicsDetails(); try { var login = GetLoginTime(); if (login != DateTimeOffset.MinValue) { var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero); var timeSinceEpoch = DateTimeOffset.UtcNow - epoch; var loginSinceEpoch = login - epoch; result.sinceLogin = timeSinceEpoch - loginSinceEpoch; } } catch (Exception e) { LoggingService.LogError("Error getting logintime", e); result.sinceLogin = TimeSpan.Zero; } return(result); }