private static void UpdateMountPoint( Client.ServerWide.Operations.MountPointUsage mountPointUsage, string databaseName, DrivesUsage drivesUsage) { var mountPoint = mountPointUsage.DiskSpaceResult.DriveName; var usage = drivesUsage.Items.FirstOrDefault(x => x.MountPoint == mountPoint); if (usage == null) { usage = new MountPointUsage { MountPoint = mountPoint, VolumeLabel = mountPointUsage.DiskSpaceResult.VolumeLabel, FreeSpace = mountPointUsage.DiskSpaceResult.TotalFreeSpaceInBytes, TotalCapacity = mountPointUsage.DiskSpaceResult.TotalSizeInBytes }; drivesUsage.Items.Add(usage); } usage.VolumeLabel = mountPointUsage.DiskSpaceResult.VolumeLabel; usage.FreeSpace = mountPointUsage.DiskSpaceResult.TotalFreeSpaceInBytes; usage.TotalCapacity = mountPointUsage.DiskSpaceResult.TotalSizeInBytes; var existingDatabaseUsage = usage.Items.FirstOrDefault(x => x.Database == databaseName); if (existingDatabaseUsage == null) { existingDatabaseUsage = new DatabaseDiskUsage { Database = databaseName }; usage.Items.Add(existingDatabaseUsage); } existingDatabaseUsage.Size += mountPointUsage.UsedSpace; existingDatabaseUsage.TempBuffersSize += mountPointUsage.UsedSpaceByTempBuffers; }
private static void UpdateMountPoint(StorageConfiguration storageConfiguration, Client.ServerWide.Operations.MountPointUsage mountPointUsage, string databaseName, DrivesUsage drivesUsage) { var mountPoint = mountPointUsage.DiskSpaceResult.DriveName; var usage = drivesUsage.Items.FirstOrDefault(x => x.MountPoint == mountPoint); if (usage == null) { usage = new MountPointUsage { MountPoint = mountPoint, }; drivesUsage.Items.Add(usage); } usage.VolumeLabel = mountPointUsage.DiskSpaceResult.VolumeLabel; usage.FreeSpace = mountPointUsage.DiskSpaceResult.TotalFreeSpaceInBytes; usage.TotalCapacity = mountPointUsage.DiskSpaceResult.TotalSizeInBytes; usage.IsLowSpace = StorageSpaceMonitor.IsLowSpace(new Size(usage.FreeSpace, SizeUnit.Bytes), new Size(usage.TotalCapacity, SizeUnit.Bytes), storageConfiguration, out string _); var existingDatabaseUsage = usage.Items.FirstOrDefault(x => x.Database == databaseName); if (existingDatabaseUsage == null) { existingDatabaseUsage = new DatabaseDiskUsage { Database = databaseName }; usage.Items.Add(existingDatabaseUsage); } existingDatabaseUsage.Size += mountPointUsage.UsedSpace; existingDatabaseUsage.TempBuffersSize += mountPointUsage.UsedSpaceByTempBuffers; }