using System; using System.IO; namespace ICSharpCode.SharpZipLib.Tar { // Token: 0x02000036 RID: 54 public class TarEntry : ICloneable { // Token: 0x060001BD RID: 445 RVA: 0x0000A960 File Offset: 0x00009960 private TarEntry() { this.header = new TarHeader(); } // Token: 0x060001BE RID: 446 RVA: 0x0000A973 File Offset: 0x00009973 public TarEntry(byte[] headerBuffer) { this.header = new TarHeader(); this.header.ParseBuffer(headerBuffer); } // Token: 0x060001BF RID: 447 RVA: 0x0000A992 File Offset: 0x00009992 public TarEntry(TarHeader header) { if (header == null) { throw new ArgumentNullException("header"); } this.header = (TarHeader)header.Clone(); } // Token: 0x060001C0 RID: 448 RVA: 0x0000A9BC File Offset: 0x000099BC public object Clone() { return new TarEntry { file = this.file, header = (TarHeader)this.header.Clone(), Name = this.Name }; } // Token: 0x060001C1 RID: 449 RVA: 0x0000AA00 File Offset: 0x00009A00 public static TarEntry CreateTarEntry(string name) { TarEntry tarEntry = new TarEntry(); TarEntry.NameTarHeader(tarEntry.header, name); return tarEntry; } // Token: 0x060001C2 RID: 450 RVA: 0x0000AA20 File Offset: 0x00009A20 public static TarEntry CreateEntryFromFile(string fileName) { TarEntry tarEntry = new TarEntry(); tarEntry.GetFileTarHeader(tarEntry.header, fileName); return tarEntry; } // Token: 0x060001C3 RID: 451 RVA: 0x0000AA44 File Offset: 0x00009A44 public override bool Equals(object obj) { TarEntry tarEntry = obj as TarEntry; return tarEntry != null && this.Name.Equals(tarEntry.Name); } // Token: 0x060001C4 RID: 452 RVA: 0x0000AA6E File Offset: 0x00009A6E public override int GetHashCode() { return this.Name.GetHashCode(); } // Token: 0x060001C5 RID: 453 RVA: 0x0000AA7B File Offset: 0x00009A7B public bool IsDescendent(TarEntry toTest) { if (toTest == null) { throw new ArgumentNullException("toTest"); } return toTest.Name.StartsWith(this.Name); } // Token: 0x17000058 RID: 88 // (get) Token: 0x060001C6 RID: 454 RVA: 0x0000AA9C File Offset: 0x00009A9C public TarHeader TarHeader { get { return this.header; } } // Token: 0x17000059 RID: 89 // (get) Token: 0x060001C7 RID: 455 RVA: 0x0000AAA4 File Offset: 0x00009AA4 // (set) Token: 0x060001C8 RID: 456 RVA: 0x0000AAB1 File Offset: 0x00009AB1 public string Name { get { return this.header.Name; } set { this.header.Name = value; } } // Token: 0x1700005A RID: 90 // (get) Token: 0x060001C9 RID: 457 RVA: 0x0000AABF File Offset: 0x00009ABF // (set) Token: 0x060001CA RID: 458 RVA: 0x0000AACC File Offset: 0x00009ACC public int UserId { get { return this.header.UserId; } set { this.header.UserId = value; } } // Token: 0x1700005B RID: 91 // (get) Token: 0x060001CB RID: 459 RVA: 0x0000AADA File Offset: 0x00009ADA // (set) Token: 0x060001CC RID: 460 RVA: 0x0000AAE7 File Offset: 0x00009AE7 public int GroupId { get { return this.header.GroupId; } set { this.header.GroupId = value; } } // Token: 0x1700005C RID: 92 // (get) Token: 0x060001CD RID: 461 RVA: 0x0000AAF5 File Offset: 0x00009AF5 // (set) Token: 0x060001CE RID: 462 RVA: 0x0000AB02 File Offset: 0x00009B02 public string UserName { get { return this.header.UserName; } set { this.header.UserName = value; } } // Token: 0x1700005D RID: 93 // (get) Token: 0x060001CF RID: 463 RVA: 0x0000AB10 File Offset: 0x00009B10 // (set) Token: 0x060001D0 RID: 464 RVA: 0x0000AB1D File Offset: 0x00009B1D public string GroupName { get { return this.header.GroupName; } set { this.header.GroupName = value; } } // Token: 0x060001D1 RID: 465 RVA: 0x0000AB2B File Offset: 0x00009B2B public void SetIds(int userId, int groupId) { this.UserId = userId; this.GroupId = groupId; } // Token: 0x060001D2 RID: 466 RVA: 0x0000AB3B File Offset: 0x00009B3B public void SetNames(string userName, string groupName) { this.UserName = userName; this.GroupName = groupName; } // Token: 0x1700005E RID: 94 // (get) Token: 0x060001D3 RID: 467 RVA: 0x0000AB4B File Offset: 0x00009B4B // (set) Token: 0x060001D4 RID: 468 RVA: 0x0000AB58 File Offset: 0x00009B58 public DateTime ModTime { get { return this.header.ModTime; } set { this.header.ModTime = value; } } // Token: 0x1700005F RID: 95 // (get) Token: 0x060001D5 RID: 469 RVA: 0x0000AB66 File Offset: 0x00009B66 public string File { get { return this.file; } } // Token: 0x17000060 RID: 96 // (get) Token: 0x060001D6 RID: 470 RVA: 0x0000AB6E File Offset: 0x00009B6E // (set) Token: 0x060001D7 RID: 471 RVA: 0x0000AB7B File Offset: 0x00009B7B public long Size { get { return this.header.Size; } set { this.header.Size = value; } } // Token: 0x17000061 RID: 97 // (get) Token: 0x060001D8 RID: 472 RVA: 0x0000AB8C File Offset: 0x00009B8C public bool IsDirectory { get { if (this.file != null) { return Directory.Exists(this.file); } return this.header != null && (this.header.TypeFlag == 53 || this.Name.EndsWith("/")); } } // Token: 0x060001D9 RID: 473 RVA: 0x0000ABDC File Offset: 0x00009BDC public void GetFileTarHeader(TarHeader header, string file) { if (header == null) { throw new ArgumentNullException("header"); } if (file == null) { throw new ArgumentNullException("file"); } this.file = file; string text = file; if (text.IndexOf(Environment.CurrentDirectory) == 0) { text = text.Substring(Environment.CurrentDirectory.Length); } text = text.Replace(Path.DirectorySeparatorChar, '/'); while (text.StartsWith("/")) { text = text.Substring(1); } header.LinkName = string.Empty; header.Name = text; if (Directory.Exists(file)) { header.Mode = 1003; header.TypeFlag = 53; if (header.Name.Length == 0 || header.Name[header.Name.Length - 1] != '/') { header.Name += "/"; } header.Size = 0L; } else { header.Mode = 33216; header.TypeFlag = 48; header.Size = new FileInfo(file.Replace('/', Path.DirectorySeparatorChar)).Length; } header.ModTime = global::System.IO.File.GetLastWriteTime(file.Replace('/', Path.DirectorySeparatorChar)).ToUniversalTime(); header.DevMajor = 0; header.DevMinor = 0; } // Token: 0x060001DA RID: 474 RVA: 0x0000AD28 File Offset: 0x00009D28 public TarEntry[] GetDirectoryEntries() { if (this.file == null || !Directory.Exists(this.file)) { return new TarEntry[0]; } string[] fileSystemEntries = Directory.GetFileSystemEntries(this.file); TarEntry[] array = new TarEntry[fileSystemEntries.Length]; for (int i = 0; i < fileSystemEntries.Length; i++) { array[i] = TarEntry.CreateEntryFromFile(fileSystemEntries[i]); } return array; } // Token: 0x060001DB RID: 475 RVA: 0x0000AD80 File Offset: 0x00009D80 public void WriteEntryHeader(byte[] outBuffer) { this.header.WriteHeader(outBuffer); } // Token: 0x060001DC RID: 476 RVA: 0x0000AD8E File Offset: 0x00009D8E public static void AdjustEntryName(byte[] buffer, string newName) { TarHeader.GetNameBytes(newName, buffer, 0, 100); } // Token: 0x060001DD RID: 477 RVA: 0x0000AD9C File Offset: 0x00009D9C public static void NameTarHeader(TarHeader header, string name) { if (header == null) { throw new ArgumentNullException("header"); } if (name == null) { throw new ArgumentNullException("name"); } bool flag = name.EndsWith("/"); header.Name = name; header.Mode = (flag ? 1003 : 33216); header.UserId = 0; header.GroupId = 0; header.Size = 0L; header.ModTime = DateTime.UtcNow; header.TypeFlag = (flag ? 53 : 48); header.LinkName = string.Empty; header.UserName = string.Empty; header.GroupName = string.Empty; header.DevMajor = 0; header.DevMinor = 0; } // Token: 0x040000F8 RID: 248 private string file; // Token: 0x040000F9 RID: 249 private TarHeader header; } }