/// <summary> /// Creates a new ArchiveFileInfo object representing a file within /// an archive in a specified path. /// </summary> /// <param name="archiveInfo">An object representing the archive /// containing the file.</param> /// <param name="filePath">The path to the file within the archive. /// Usually, this is a simple file name, but if the archive contains /// a directory structure this may include the directory.</param> protected ArchiveFileInfo(ArchiveInfo archiveInfo, string filePath) { if (filePath == null) { throw new ArgumentNullException("filePath"); } Archive = archiveInfo; name = System.IO.Path.GetFileName(filePath); path = System.IO.Path.GetDirectoryName(filePath); attributes = FileAttributes.Normal; lastWriteTime = DateTime.MinValue; }
/// <summary> /// Initializes a new instance of the ArchiveFileInfo class with /// serialized data. /// </summary> /// <param name="info">The SerializationInfo that holds the serialized /// object data about the exception being thrown.</param> /// <param name="context">The StreamingContext that contains contextual /// information about the source or destination.</param> protected ArchiveFileInfo(SerializationInfo info, StreamingContext context) : base(info, context) { archiveInfo = (ArchiveInfo)info.GetValue( "archiveInfo", typeof(ArchiveInfo)); name = info.GetString("name"); path = info.GetString("path"); initialized = info.GetBoolean("initialized"); exists = info.GetBoolean("exists"); archiveNumber = info.GetInt32("archiveNumber"); attributes = (FileAttributes)info.GetValue( "attributes", typeof(FileAttributes)); lastWriteTime = info.GetDateTime("lastWriteTime"); length = info.GetInt64("length"); }