public long GetDirectorySize(string path) { path = CanonicalPath(path); IFsrmQuota dirQutoa = this.GetDirectoryFsrmQuota(path); dirQutoa.RefreshUsageProperties(); int retires = 400; // FsrmQuotaFlags_StatusRebuilding = 0x00020000 while ((dirQutoa.QuotaFlags & 0x00020000) != 0) { if (--retires < 0) { throw new TimeoutException(string.Format(CultureInfo.InvariantCulture, "Quota for dir '{0}' is still in StatusRebuilding state.", path)); } dirQutoa.RefreshUsageProperties(); Thread.Sleep(10); } // FsrmQuotaFlags_StatusIncomplete = 0x00010000 if ((dirQutoa.QuotaFlags & 0x00010000) != 0) { this.quotaManager.Scan(path); dirQutoa.RefreshUsageProperties(); } dirQutoa.RefreshUsageProperties(); return((long)(decimal)dirQutoa.QuotaUsed); }
/// <summary> /// Gets the directory quota limit. /// </summary> /// <param name="path">The path.</param> /// <returns>Quota limit in bytes.</returns> public long GetDirectoryQuota(string path) { IFsrmQuota dirQutoa = this.GetDirectoryFsrmQuota(path); dirQutoa.RefreshUsageProperties(); return((long)(decimal)dirQutoa.QuotaLimit); }