Crisis.Ionic.Zip.ZipEntry.SetEntryTimes C# (CSharp) Method

SetEntryTimes() public method

Sets the NTFS Creation, Access, and Modified times for the given entry.

When adding an entry from a file or directory, the Creation, Access, and Modified times for the given entry are automatically set from the filesystem values. When adding an entry from a stream or string, the values are implicitly set to DateTime.Now. The application may wish to set these values to some arbitrary value, before saving the archive, and can do so using the various setters. If you want to set all of the times, this method is more efficient.

The values you set here will be retrievable with the , CreationTime and properties.

When this method is called, if both and are false, then the EmitTimesInWindowsFormatWhenSaving flag is automatically set.

DateTime values provided here without a DateTimeKind are assumed to be Local Time.

public SetEntryTimes ( System.DateTime created, System.DateTime accessed, System.DateTime modified ) : void
created System.DateTime the creation time of the entry.
accessed System.DateTime the last access time of the entry.
modified System.DateTime the last modified time of the entry.
return void
        public void SetEntryTimes(DateTime created, DateTime accessed, DateTime modified)
        {
            _ntfsTimesAreSet = true;
            if (created == _zeroHour && created.Kind == _zeroHour.Kind) created = _win32Epoch;
            if (accessed == _zeroHour && accessed.Kind == _zeroHour.Kind) accessed = _win32Epoch;
            if (modified == _zeroHour && modified.Kind == _zeroHour.Kind) modified = _win32Epoch;
            _Ctime = created.ToUniversalTime();
            _Atime = accessed.ToUniversalTime();
            _Mtime = modified.ToUniversalTime();
            _LastModified = _Mtime;
            if (!_emitUnixTimes && !_emitNtfsTimes)
                _emitNtfsTimes = true;
            _metadataChanged = true;
        }
ZipEntry