34 lines
720 B
Swift
34 lines
720 B
Swift
|
//
|
||
|
// StorageInfo.swift
|
||
|
// Befund
|
||
|
//
|
||
|
// Created by Irakli Abetschkhrischwili on 21.05.22.
|
||
|
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
extension Core.Models.System
|
||
|
{
|
||
|
public struct StorageInfo
|
||
|
{
|
||
|
public var total: Double = 0.0
|
||
|
public var free: Double = 0.0
|
||
|
public var used: Double = 0.0
|
||
|
|
||
|
/**
|
||
|
* Returns storage info as percent
|
||
|
*/
|
||
|
public func GetStoragePercent() -> Double
|
||
|
{
|
||
|
if(self.free > 0.0 && self.total > 0.0)
|
||
|
{
|
||
|
return (self.free / self.total)
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return 0.0
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|