public override string ToString() { StringBuilder builder = new StringBuilder(); builder.AppendLine($"Computer type: {Name}"); builder.AppendLine("Current configuration:"); builder.AppendLine($" CPU: {Cpus.ToStatus()}"); builder.AppendLine($" Storage: {Hards.ToStatus()}"); builder.AppendLine($" RAM: {Rams.ToStatus()}"); builder.AppendLine($" GPU: {Gpus.ToStatus()}"); builder.AppendLine($" Network: {Networks.ToStatus()}"); builder.AppendLine($" Wireless: {Wirelesses.ToStatus()}"); builder.AppendLine($" Sources: {Sources.ToStatus()}"); builder.AppendLine($" Motherboard: {Motherboard}"); string motherboardLoad = GetMotherboardLoadString(); builder.AppendLine($"Motherboard configuration: {motherboardLoad}"); int currentLoad = GetSourceLoad(); int maximumLoad = MaximumSourceLoad(); float percentageLoad = (float)currentLoad / maximumLoad; builder.AppendLine($"Current source load: {currentLoad}/{maximumLoad} - {percentageLoad:00.##}"); return(builder.ToString()); }
private int GetSourceLoad() { return(Rams.Select(x => x.LoadUsage).Sum() + Hards.Select(x => x.LoadUsage).Sum() + Cpus.Select(x => x.LoadUsage).Sum() + Gpus.Select(x => x.LoadUsage).Sum() + Networks.Select(x => x.LoadUsage).Sum() + Wirelesses.Select(x => x.LoadUsage).Sum() + Motherboard.LoadUsage); }