public void Serialize(DataStorage.FileHeader header, Stream output) { if (header.Version == 2) { this.NameHash = FNV.Hash64(this.Name); this.DataHash = FNV.Hash64(this.Data, 0, this.Data.Length); output.WriteValueU64(this.NameHash); output.WriteValueU64(this.DataHash); } output.WriteStringU16(this.Name); output.WriteValueS32(this.Data.Length); output.Write(this.Data, 0, this.Data.Length); }
private static void LoadVO(string file, ICollection <ExtractableItem> items, IEnumerable <string> audioEvents) { if (!file.EndsWith(".pck")) { return; } string filename = Path.GetFileName(file); // A temporary way to distinguish VO banks and SFX banks if (!filename.Contains("_")) { return; } string locale = filename.Substring(0, filename.IndexOf("_", StringComparison.InvariantCulture)); Dictionary <ulong, string> mappings = new (); foreach (var audioEvent in audioEvents) { if (audioEvent.StartsWith("VO_")) { mappings[FNV.Hash64($"{locale}\\{audioEvent}".ToLowerInvariant())] = audioEvent; } } try { PckFile64 package = new (file); List <ArchiveEntry> entries = package.GetEntries(); foreach (ArchiveEntry archiveEntry in entries) { string name = mappings.ContainsKey(archiveEntry.ID) ? mappings[archiveEntry.ID] : archiveEntry.Name; items.Add(new ExtractableItem(archiveEntry, name)); } } catch (Exception exception) { Console.Error.WriteLine(exception); throw new Exception($"An error has ocurred while opening {file}, no files will be loaded from this archive!"); } }
public async Task DeleteKeyAsync(string key) { var proxy = ServiceProxy.Create <IServiceFabricDictionary>(FNV.Hash64(key), this.uri); await proxy.DeleteKeyAsync(key); }
public async Task <IKeyValueEntity> GetKeyAsync(string key) { var proxy = ServiceProxy.Create <IServiceFabricDictionary>(FNV.Hash64(key), this.uri); return(await proxy.GetKeyAsync(key)); }
public async Task AddKeyAsync(string key, string value) { var proxy = ServiceProxy.Create <IServiceFabricDictionary>(FNV.Hash64(key), this.uri); await proxy.AddKeyAsync(key, value); }