public StorageInfo(FileInfo fileInfo)
 {
     m_sName         = Path.GetFileName(fileInfo.Name);
     m_lSizeBytes    = fileInfo.Length;
     m_oLastModified = fileInfo.LastWriteTime;
     m_enDataFlags   = StorageInfoFlags.All;
 }
        public virtual StorageInfo[] QueryStorageInfo(string path, string sFilter, StorageInfoFlags dataFlags, bool withSubDirs = false)
        {
            string[] BLOBs = QueryStorage(path, sFilter);

            List <StorageInfo> storagesInfo = new List <StorageInfo>();

            for (int i = 0; i < BLOBs.Length; i++)
            {
                storagesInfo.Add(GetStorageInfo(Path.Combine(path, BLOBs[i]), dataFlags));
            }

            if (withSubDirs)
            {
                string[] subDirs = QuerySubDirs(String.Empty, true);

                foreach (var subdir in subDirs)
                {
                    StorageInfo[] subDirsStoragesInfo =
                        QueryStorageInfo(subdir, sFilter, StorageInfoFlags.Size | StorageInfoFlags.LastModified);

                    foreach (StorageInfo storageInfo in subDirsStoragesInfo)
                    {
                        storagesInfo.Add(new StorageInfo(
                                             Path.Combine(subdir, storageInfo.Name),
                                             storageInfo.SizeBytes,
                                             storageInfo.CRC32,
                                             storageInfo.LastModified,
                                             storageInfo.DataFlags));
                    }
                }
            }

            return(storagesInfo.ToArray());
        }
        public virtual StorageInfo GetStorageInfo(string filePath, StorageInfoFlags enDataFlags)
        {
            string localFileName = CalculateLocalPath(filePath);

            FileInfo fileInfo = new FileInfo(localFileName);

            long     lSizeBytes    = 0;
            int      nCRC32        = 0;
            DateTime oLastModified = DateTime.Now;

            if (fileInfo.Exists)
            {
                if (StorageInfo.FlagSet(enDataFlags, StorageInfoFlags.Size))
                {
                    lSizeBytes = fileInfo.Length;
                }

                if (StorageInfo.FlagSet(enDataFlags, StorageInfoFlags.LastModified))
                {
                    oLastModified = fileInfo.LastWriteTime;
                }
            }

            string      fileName    = Path.GetFileName(filePath);
            StorageInfo storageInfo = new StorageInfo(
                fileName,
                lSizeBytes,
                nCRC32,
                oLastModified,
                enDataFlags);

            return(storageInfo);
        }
 public StorageInfo(
     string sName,
     long lSizeBytes,
     int nCRC32,
     DateTime oLastModified,
     StorageInfoFlags enDataFlags)
 {
     m_sName         = sName;
     m_lSizeBytes    = lSizeBytes;
     m_nCRC32        = nCRC32;
     m_oLastModified = oLastModified;
     m_enDataFlags   = enDataFlags;
 }
        public StorageInfo GetStorageInfo(string fileName, StorageInfoFlags dataFlags)
        {
            string filePath = GetRelativeFilePath(fileName);

            return(m_StorageService.GetStorageInfo(filePath, dataFlags));
        }
 public StorageInfo[] QueryStorageInfo(string path, string sFilter, StorageInfoFlags dataFlags, bool withSubDirs = false)
 {
     return(m_StorageService.QueryStorageInfo(m_RelativePath, sFilter, dataFlags, withSubDirs));
 }
 public static bool FlagSet(
     StorageInfoFlags enFlags,
     StorageInfoFlags enFlagMask)
 {
     return((enFlags & enFlagMask) > 0);
 }