internal Storage(int storageID, Interop.Storage.StorageArea storageType, Interop.Storage.StorageState storagestate, string rootDirectory, Interop.Storage.StorageDevice devicetype, string fstype, string fsuuid, bool primary, int flags) { Id = storageID; _storagetype = storageType; RootDirectory = rootDirectory; _state = storagestate; _devicetype = devicetype; _fstype = fstype; _fsuuid = fsuuid; _primary = primary; _flags = flags; information_set = true; Interop.Storage.ErrorCode err = Interop.Storage.StorageGetTotalSpace(Id, out _totalSpace); if (err != Interop.Storage.ErrorCode.None) { Log.Warn(LogTag, string.Format("Failed to get total storage space for storage Id: {0}. err = {1}", Id, err)); } s_stateChangedEventCallback = (id, state, userData) => { if (id == Id) { _state = state; s_stateChangedEventHandler?.Invoke(this, EventArgs.Empty); } }; }
internal Storage(int storageID, Interop.Storage.StorageArea storageType, Interop.Storage.StorageState storagestate, string rootDirectory) { Id = storageID; StorageType = (StorageArea)storageType; RootDirectory = rootDirectory; _state = storagestate; Interop.Storage.ErrorCode err = Interop.Storage.StorageGetTotalSpace(Id, out _totalSpace); if (err != Interop.Storage.ErrorCode.None) { Log.Warn(LogTag, string.Format("Failed to get total storage space for storage Id: {0}. err = {1}", Id, err)); } s_stateChangedEventCallback = (id, state, userData) => { if (id == Id) { _state = state; s_stateChangedEventHandler?.Invoke(this, EventArgs.Empty); } }; }