Ejemplo n.º 1
0
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="fs"></param>
        /// <param name="fh"></param>
        /// <param name="parent"></param>
        /// <param name="name"></param>
        internal File(FileSystem fs, FileHandle fh, Directory parent, string name)
        {
            this._fs        = fs;
            this._handle    = fh;
            this._struct    = fh.GetStruct();
            this._parentDir = parent;

            if (name == null)
            {
                if (_struct.Name.HasValue)
                {
                    this.Name = _struct.Name.Value.GetName();
                }
            }
            else
            {
                this.Name = name;
            }

            if (_struct.Metadata.HasValue)
            {
                var m = _struct.Metadata.Value;

                this.Address = m.Address;

                this.Type              = m.type;
                this.Size              = m.Size;
                this.CreationTime      = epoch.AddSeconds(m.CRTime);
                this.LastWriteTime     = epoch.AddSeconds(m.MTime);
                this.LastAccessTime    = epoch.AddSeconds(m.ATime);
                this.MetadataWriteTime = epoch.AddSeconds(m.CTime);
            }

            this.FileSystem = this._fs;
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Callback function that is called for each file name during directory walk. (FileSystem.WalkDirectories)
 /// </summary>
 /// <param name="file">
 ///     The file struct.
 /// </param>
 /// <param name="directoryPath">
 ///     The directory path.
 /// </param>
 /// <param name="dataPtr">
 ///     Pointer to data that is passed to the callback function each time.
 /// </param>
 /// <returns>
 ///     Value to control the directory walk.
 /// </returns>
 private static WalkReturnEnum FindFiles_DirectoryWalkCallback(
     ref TSK_FS_FILE file,
     string directoryPath,
     IntPtr dataPtr)
 {
     FilePaths.Add(string.Format("{0}{1}", directoryPath, file.Name));
     return(WalkReturnEnum.Continue);
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     Callback function that is called for each file name during directory walk. (FileSystem.WalkDirectories)
 /// </summary>
 /// <param name="file">
 ///     The file struct.
 /// </param>
 /// <param name="directoryPath">
 ///     The directory path.
 /// </param>
 /// <param name="dataPtr">
 ///     Pointer to data that is passed to the callback function each time.
 /// </param>
 /// <returns>
 ///     Value to control the directory walk.
 /// </returns>
 private static WalkReturnEnum FileCount_DirectoryWalkCallback(
     ref TSK_FS_FILE file,
     string directoryPath,
     IntPtr dataPtr)
 {
     if (file.Name.ToString().Contains("jpg"))
     {
         jpgFileCount++;
     }
     allFileCount++;
     return(WalkReturnEnum.Continue);
 }