Exemplo n.º 1
0
 public File(string name, string path, FileCategoryEnum category)
 {
     if (string.IsNullOrEmpty(name)) throw new ArgumentException("File must have a name node.");
     if (string.IsNullOrEmpty(path)) throw new ArgumentException("File must have a path node.");
     if (category == FileCategoryEnum.unknown) throw new ArgumentException("File must have a category attribute.");
     this.name = name;
     this.path = path;
     this.category = category;
 }
Exemplo n.º 2
0
 public File(string name, string path, DateTime?createTime, DateTime?modifyTime, DateTime?accessTime,
             Int64?dataSize, Int64?diskSize, FileAccess[] fileAccess, Linkage[] linkage, Inode inode,
             Checksum[] checksum, string ident, FileCategoryEnum category, FileSystemTypeEnum type,
             string fileType)
     : this(name, path, createTime, modifyTime, accessTime, dataSize, diskSize, fileAccess, linkage, inode,
            checksum, category)
 {
     this.ident    = string.IsNullOrEmpty(ident) ? "0" : ident;
     fstype        = type;
     this.fileType = fileType;
 }
Exemplo n.º 3
0
        public File(string name, string path, DateTime? createTime, DateTime? modifyTime, DateTime? accessTime,
            Int64? dataSize, Int64? diskSize, FileAccess[] fileAccess, Linkage[] linkage, Inode inode,
            Checksum[] checksum, string ident, FileCategoryEnum category, FileSystemTypeEnum type,
            string fileType)
            : this(name, path, createTime, modifyTime, accessTime, dataSize, diskSize, fileAccess, linkage, inode,
			       checksum, category)
        {
            this.ident = string.IsNullOrEmpty(ident) ? "0" : ident;
            fstype = type;
            this.fileType = fileType;
        }
Exemplo n.º 4
0
 public File(string name, string path, DateTime?createTime, DateTime?modifyTime, DateTime?accessTime,
             Int64?dataSize, Int64?diskSize, FileAccess[] fileAccess, Linkage[] linkage, Inode inode,
             Checksum[] checksum, FileCategoryEnum category)
     : this(name, path, category)
 {
     this.createTime = createTime;
     this.modifyTime = modifyTime;
     this.accessTime = accessTime;
     this.dataSize   = dataSize;
     this.diskSize   = diskSize;
     this.fileAccess = fileAccess;
     this.linkage    = linkage;
     this.inode      = inode;
     this.checksum   = checksum;
 }
Exemplo n.º 5
0
 public File(string name, string path, DateTime? createTime, DateTime? modifyTime, DateTime? accessTime,
     Int64? dataSize, Int64? diskSize, FileAccess[] fileAccess, Linkage[] linkage, Inode inode,
     Checksum[] checksum, FileCategoryEnum category)
     : this(name, path, category)
 {
     this.createTime = createTime;
     this.modifyTime = modifyTime;
     this.accessTime = accessTime;
     this.dataSize = dataSize;
     this.diskSize = diskSize;
     this.fileAccess = fileAccess;
     this.linkage = linkage;
     this.inode = inode;
     this.checksum = checksum;
 }
Exemplo n.º 6
0
        public (string dir, string file) GetFileName(int id, FileCategoryEnum fileCategory, string extension)
        {
            const int            totalLength    = 6;
            const int            chunkSize      = 2;
            string               paddedFileName = id.ToString().PadLeft(6, '0');
            IEnumerable <string> result         = Enumerable.Range(0, totalLength / chunkSize)
                                                  .Select(i => paddedFileName.Substring(i * chunkSize, chunkSize));
            var fileName = Path.Combine(result.ToArray()) + extension;

            var filePath = Path.Combine(
                _settings.BaseAppFolder,
                _settings.BaseFilesFolder,
                Enum.GetName(typeof(FileCategoryEnum), fileCategory),
                fileName);

            return(Path.GetDirectoryName(filePath), Path.GetFileName(filePath));
        }
Exemplo n.º 7
0
 public File(string name, string path, FileCategoryEnum category)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentException("File must have a name node.");
     }
     if (string.IsNullOrEmpty(path))
     {
         throw new ArgumentException("File must have a path node.");
     }
     if (category == FileCategoryEnum.unknown)
     {
         throw new ArgumentException("File must have a category attribute.");
     }
     this.name     = name;
     this.path     = path;
     this.category = category;
 }