Esempio n. 1
0
 public FilePath(string path, byte[] pathRaw, string lastHash, long lastModifiedTime, long?missingSince)
 {
     this.Path             = PathEncoder.GetPath(path, pathRaw);
     this.PathRaw          = pathRaw;
     this.LastHash         = lastHash;
     this.LastModifiedTime = lastModifiedTime;
     this.MissingSince     = missingSince;
 }
Esempio n. 2
0
 /// <summary>
 /// Overrides the value of <paramref name="path"/> if <paramref name="pathRaw"/> is not <c>null</c>.
 /// </summary>
 /// <param name="path">The (possibly lossy) decoded path.</param>
 /// <param name="pathRaw">The raw byte encoding of <paramref name="path"/>, or <c>null</c> if <paramref name="path"/> is found to round-trip.</param>
 /// <returns>The original path.</returns>
 public static string GetPath(string path, byte[] pathRaw) =>
 pathRaw == null ? path : PathEncoder.Decode(pathRaw);
Esempio n. 3
0
 /// <summary>
 /// Converts a (possibly invalid) unicode string into a raw byte encoding without any consideration for unicode validation rules.
 /// Returns <c>null</c> if <see cref="Encoding.UTF8"/> will round-trip the value.
 /// </summary>
 /// <param name="path">The string containing the raw operating system path.</param>
 /// <returns><c>null</c>, if the path can be round-tripped; the raw byte encoding of <paramref name="path"/>, otherwise.</returns>
 public static byte[] GetPathRaw(string path) =>
 path != null && path != Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(path))
         ? PathEncoder.Encode(path)
         : null;
Esempio n. 4
0
 public FilePath(string path, string lastHash, long lastModifiedTime, long?missingSince)
     : this(path, null, lastHash, lastModifiedTime, missingSince)
 {
     this.PathRaw = PathEncoder.GetPathRaw(path);
 }