private void Read(BinaryReader br, Archive parent) { Num = br.ReadUInt32(); Size = br.ReadUInt32(); Checksum = br.ReadUInt64(); Table1count = br.ReadUInt32(); Table2count = br.ReadUInt32(); Table3count = br.ReadUInt32(); // read tables for (int i = 0; i < Table1count; i++) { var entry = new ArchiveItem(br, parent); if (!FileInfo.ContainsKey(entry.NameHash64)) { FileInfo.Add(entry.NameHash64, entry); } else { // TODO } } for (int i = 0; i < Table2count; i++) { Offsets.Add(new OffsetEntry(br, i)); } for (int i = 0; i < Table3count; i++) { Dependencies.Add(new HashEntry(br, i)); } }
/// <summary> /// Sets the large file SHA1 header. /// </summary> /// <param name="fileInfo">The file info dictionary.</param> /// <param name="value">The SHA1 checksum of the file.</param> public static void SetLargeFileSha1(this FileInfo fileInfo, string value) { if (!string.IsNullOrWhiteSpace(value)) { fileInfo.Add("large_file_sha1", value); } }
/// <summary> /// Sets the last modified date to the file info dictionary. /// </summary> /// <param name="fileInfo">The file info dictionary.</param> /// <param name="value">The date value to set.</param> public static void SetLastModified(this FileInfo fileInfo, DateTime value) { if (value != DateTime.MinValue) { fileInfo.Add("src_last_modified_millis", value.ToEpoch().ToString()); } }
/// <summary> /// Sets the content disposition to the file info dictionary. /// </summary> /// <param name="fileInfo">The file info dictionary.</param> /// <param name="value">The date value to set.</param> public static void SetContentDisposition(this FileInfo fileInfo, ContentDispositionHeaderValue value) { if (value != null) { fileInfo.Add("b2-content-disposition", value.ToString()); } }
List <string> ConstructShuffleTrainFiles(string file) { List <string> trainFiles = new FileInfo(file).Directory.GetFiles(new FileInfo(file).Name + ".shuffle*").Select(o => o.FullName).ToList(); if (File.Exists(file)) { trainFiles.Add(file); } trainFiles.Sort(); return(trainFiles); }
public void MaximumItemsAllowed() { Assert.Throws <InvalidOperationException>(() => { var list = new FileInfo(); for (int i = 0; i < FileInfo.MaximumFileInfoItemsAllowed + 1; i++) { list.Add(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); } }); }