Exemple #1
0
        public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, string path)
        {
            if (IsDisposed)
            {
                timeStamp = default;
                return(ResultFs.PreconditionViolation.Log());
            }

            return(GetFileTimeStampRawImpl(out timeStamp, path));
        }
Exemple #2
0
        public Result GetFileTimeStamp(out FileTimeStampRaw timeStamp, U8Span path)
        {
            timeStamp = default;

            Result rc = FindFileSystem(out FileSystemAccessor fileSystem, out U8Span subPath, path);

            if (rc.IsFailure())
            {
                return(rc);
            }

            return(fileSystem.GetFileTimeStampRaw(out timeStamp, subPath));
        }
Exemple #3
0
        public FileTimeStampRaw GetFileTimeStampRaw(string path)
        {
            path = PathTools.Normalize(path);
            string localPath = ResolveLocalPath(path);

            FileTimeStampRaw timeStamp = default;

            timeStamp.Created  = new DateTimeOffset(File.GetCreationTime(localPath)).ToUnixTimeSeconds();
            timeStamp.Accessed = new DateTimeOffset(File.GetLastAccessTime(localPath)).ToUnixTimeSeconds();
            timeStamp.Modified = new DateTimeOffset(File.GetLastWriteTime(localPath)).ToUnixTimeSeconds();

            return(timeStamp);
        }
        public Result GetFileTimeStamp(out FileTimeStampRaw timeStamp, string path)
        {
            timeStamp = default;

            Result rc = FindFileSystem(path.AsSpan(), out FileSystemAccessor fileSystem, out ReadOnlySpan <char> subPath);

            if (rc.IsFailure())
            {
                return(rc);
            }

            return(fileSystem.GetFileTimeStampRaw(out timeStamp, subPath.ToString()));
        }
Exemple #5
0
        public FileTimeStampRaw GetFileTimeStampRaw(string path)
        {
            string localPath = ResolveLocalPath(PathTools.Normalize(path));

            if (!GetFileInfo(localPath).Exists)
            {
                ThrowHelper.ThrowResult(ResultFs.PathNotFound);
            }

            FileTimeStampRaw timeStamp = default;

            timeStamp.Created  = new DateTimeOffset(File.GetCreationTime(localPath)).ToUnixTimeSeconds();
            timeStamp.Accessed = new DateTimeOffset(File.GetLastAccessTime(localPath)).ToUnixTimeSeconds();
            timeStamp.Modified = new DateTimeOffset(File.GetLastWriteTime(localPath)).ToUnixTimeSeconds();

            return(timeStamp);
        }
Exemple #6
0
 protected virtual Result GetFileTimeStampRawImpl(out FileTimeStampRaw timeStamp, string path)
 {
     timeStamp = default;
     return(ResultFs.NotImplemented.Log());
 }