Mo changes
This commit is contained in:
@@ -171,12 +171,13 @@ public:
|
||||
private:
|
||||
_SiaRenterAllowance _currentAllowance;
|
||||
std::shared_ptr<_CSiaFileTree> _fileTree;
|
||||
SiaCurrency _storageterabytemonth;
|
||||
|
||||
private:
|
||||
void Refresh(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig);
|
||||
|
||||
public:
|
||||
CSiaError<_SiaApiErrorCode> CalculateEstimatedStorage(const SiaCurrency& funds, SiaCurrency& resultGb) const;
|
||||
CSiaError<_SiaApiErrorCode> CalculateEstimatedStorage(const SiaCurrency& funds, SiaCurrency& resultInBytes) const;
|
||||
CSiaError<_SiaApiErrorCode> DownloadFile(const SString& siaPath, const SString& location) const;
|
||||
CSiaError<_SiaApiErrorCode> FileExists(const SString& siaPath, bool& exists) const;
|
||||
_SiaRenterAllowance GetAllowance() const;
|
||||
|
@@ -182,15 +182,6 @@ inline static SString SiaCurrencyToHastingsString(const SiaCurrency& value)
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static SString SiaCurrencyToGB(const SiaCurrency& value)
|
||||
{
|
||||
ttmath::Conv conv;
|
||||
conv.base = 10;
|
||||
conv.round = 3;
|
||||
|
||||
return value.ToWString(conv);
|
||||
}
|
||||
|
||||
inline static Hastings SiaCurrencyToHastings(const SiaCurrency& currency)
|
||||
{
|
||||
ttmath::Parser<SiaCurrency> parser;
|
||||
@@ -203,6 +194,35 @@ inline static Hastings SiaCurrencyToHastings(const SiaCurrency& currency)
|
||||
return parser.stack[0].value.ToString(conv);
|
||||
}
|
||||
|
||||
inline static SString SiaCurrencyToGB(const SiaCurrency& value)
|
||||
{
|
||||
ttmath::Conv conv;
|
||||
conv.base = 10;
|
||||
conv.round = 3;
|
||||
|
||||
return value.ToWString(conv);
|
||||
}
|
||||
inline static SString BytesToFriendlyDisplay(const SiaCurrency& bytes)
|
||||
{
|
||||
SString units[] = { "B", "KB", "MB", "GB", "TB", "PB" };
|
||||
SString readableunit = "B";
|
||||
SiaCurrency readablesize = bytes;
|
||||
for (const auto& unit : units)
|
||||
{
|
||||
if (readablesize < 1000)
|
||||
{
|
||||
readableunit = unit;
|
||||
break;
|
||||
}
|
||||
readablesize /= 1000;
|
||||
}
|
||||
ttmath::Conv conv;
|
||||
conv.scient_from = 256;
|
||||
conv.base = 10;
|
||||
conv.round = 2;
|
||||
return readablesize.ToWString(conv) + ' ' + readableunit;
|
||||
}
|
||||
|
||||
BOOL SIADRIVE_EXPORTABLE RetryAction(std::function<BOOL()> func, std::uint16_t retryCount, const DWORD& retryDelay);
|
||||
|
||||
BOOL SIADRIVE_EXPORTABLE RetryDeleteFileIfExists(const SString& filePath);
|
||||
|
Reference in New Issue
Block a user