private static FileEntry ReadFileEntry(this BinaryReader br, IHashService _hashService) { var fileEntry = new FileEntry { NameHash64 = br.ReadUInt64(), Timestamp = DateTime.FromFileTime(br.ReadInt64()), NumInlineBufferSegments = br.ReadUInt32(), SegmentsStart = br.ReadUInt32(), SegmentsEnd = br.ReadUInt32(), ResourceDependenciesStart = br.ReadUInt32(), ResourceDependenciesEnd = br.ReadUInt32(), SHA1Hash = br.ReadBytes(20) }; var _nameStr = _hashService?.Get(fileEntry.NameHash64); // x-platform support if (System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) { if (!string.IsNullOrEmpty(_nameStr) && _nameStr.Contains('\\')) { _nameStr = _nameStr.Replace('\\', Path.DirectorySeparatorChar); } } fileEntry.SetNameStr(_nameStr); return(fileEntry); }
private PackageImport ReadImport(Package04ImportHeader r, bool readAsHash) { // needs header offset //Debug.Assert(BaseStream.Position == r.offset); var import = new PackageImport() { Flags = (InternalEnums.EImportFlags)(r.sync ? 0b1 : 0b0) }; if (readAsHash) { import.Hash = _reader.ReadUInt64(); import.DepotPath = _hashService.Get(import.Hash); } else { var bytes = _reader.ReadBytes(r.size); import.DepotPath = Encoding.UTF8.GetString(bytes.ToArray()); import.Hash = FNV1A64HashAlgorithm.HashString(import.DepotPath); if (CollectData) { DataCollection.RawImportList.Add(import.DepotPath); } } return(import); }
private void Read(BinaryReader br, IHashService hashService) { NameHash64 = br.ReadUInt64(); _nameStr = hashService?.Get(NameHash64); // x-platform support if (System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) { if (!string.IsNullOrEmpty(_nameStr) && _nameStr.Contains('\\')) { _nameStr = _nameStr.Replace('\\', Path.DirectorySeparatorChar); } } Timestamp = DateTime.FromFileTime(br.ReadInt64()); NumInlineBufferSegments = br.ReadUInt32(); SegmentsStart = br.ReadUInt32(); SegmentsEnd = br.ReadUInt32(); ResourceDependenciesStart = br.ReadUInt32(); ResourceDependenciesEnd = br.ReadUInt32(); SHA1Hash = br.ReadBytes(20); if (!string.IsNullOrEmpty(_nameStr)) { Name = _nameStr; } else { Name = NameHash64.ToString(); } }
private static Dependency ReadDependency(this BinaryReader br, IHashService _hashService) { var d = new Dependency() { Hash = br.ReadUInt64(), }; d.HashStr = _hashService?.Get(d.Hash); return(d); }
private string GetNameString() { var _nameStr = _hashService?.Get(NameHash64); // x-platform support if (System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) { if (!string.IsNullOrEmpty(_nameStr) && _nameStr.Contains('\\')) { _nameStr = _nameStr.Replace('\\', Path.DirectorySeparatorChar); } } return(_nameStr); }
private void Read(BinaryReader br, IHashService hashService) { Hash = br.ReadUInt64(); HashStr = hashService?.Get(Hash); }