Esempio n. 1
0
        /// <returns>返回结果为MB</returns>
        public double Site_SpaceUsed_Get(DeveloperInfo developerInfo, string siteName)
        {
            double directorySpaceUsed = 0;

            string developerPhysicalPath = Path.Combine(DeveloperConfig.SystemPhysicalPath, developerInfo.LoginName);
            string sitePhysicalPath = Path.Combine(developerPhysicalPath, siteName);
            string webPhysicalPath = Path.Combine(sitePhysicalPath, "IISSite");
            string logPhysicalPath = Path.Combine(sitePhysicalPath, "IISLog");

            FileSizeHelper fileSizeHelper = new FileSizeHelper();
            directorySpaceUsed += fileSizeHelper.GetDirectorySpaceUsed(webPhysicalPath);
            directorySpaceUsed += fileSizeHelper.GetDirectorySpaceUsed(logPhysicalPath);

            double result = directorySpaceUsed * 1.0 / 1048576;
            return result;
        }
Esempio n. 2
0
        /// <returns>返回结果为MB</returns>
        public int DB_SpaceUsed_Get(DeveloperInfo developerInfo, string siteName)
        {
            long directorySpaceUsed = 0;

            string developerPhysicalPath = Path.Combine(DeveloperConfig.SystemPhysicalPath, developerInfo.LoginName);
            string sitePhysicalPath = Path.Combine(developerPhysicalPath, siteName);
            string dbPhysicalPath = Path.Combine(sitePhysicalPath, "DB");

            FileSizeHelper fileSizeHelper = new FileSizeHelper();
            directorySpaceUsed += fileSizeHelper.GetDirectorySpaceUsed(dbPhysicalPath);

            return (int)Math.Ceiling(directorySpaceUsed * 1.0 / 1048576);
        }