/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Storage.FileSystem.FileSystemInfoWrapper"/> class. /// </summary> /// <param name="original">original internal instance.</param> protected FileSystemInfoWrapper(FileSystemInfo original) { this.original = original; #if __MonoCS__ this.fsType = FSTypeCreator.GetType(new UnixDriveInfo(Path.GetPathRoot(this.original.FullName)).DriveFormat); #else this.fsType = FSTypeCreator.GetType(new DriveInfo(Path.GetPathRoot(this.original.FullName)).DriveFormat); #endif }
/// <summary> /// Convert the specified originalDate based on fsType to the documented limits of the fs type. /// </summary> /// <param name="originalDate">Original date.</param> /// <param name="fsType">File system type.</param> /// <returns>Fitting datetime</returns> public static DateTime Convert(DateTime originalDate, FSType fsType) { #if __MonoCS__ // https://bugzilla.xamarin.com/show_bug.cgi?id=23933 originalDate = originalDate < new DateTime(1972, 1, 1) ? new DateTime(1972, 1, 1) : originalDate; #endif switch(fsType) { case FSType.NTFS: return LimitDateTime(originalDate, new DateTime(1601, 1, 1), new DateTime(5000, 1, 1)); case FSType.ext2: goto case FSType.ext3; case FSType.ext3: return LimitDateTime(originalDate, new DateTime(1901, 12, 15), new DateTime(2038, 1, 18)); case FSType.ext4: return LimitDateTime(originalDate, new DateTime(1901, 12, 15), new DateTime(2514, 4, 25)); case FSType.FAT12: goto case FSType.FAT32X; case FSType.FAT16: goto case FSType.FAT32X; case FSType.FAT16B: goto case FSType.FAT32X; case FSType.FAT16X: goto case FSType.FAT32X; case FSType.FAT32: goto case FSType.FAT32X; case FSType.FAT32X: return LimitDateTime(originalDate, new DateTime(1980, 1, 1), new DateTime(2099, 12, 31)); case FSType.HFS_Plus: return LimitDateTime(originalDate, new DateTime(1904, 1, 1), new DateTime(2040, 2, 6)); case FSType.reiserfs: goto case FSType.ext3; case FSType.zfs: goto case FSType.Unkown; case FSType.Unkown: return originalDate; default: goto case FSType.Unkown; } }