/// <summary> /// Open a file from Content Key /// </summary> /// <param name="key">Content Key of the file</param> /// <returns>Loaded file</returns> public Stream OpenCKey(CKey key) { if (EncodingHandler != null && EncodingHandler.TryGetEncodingEntry(key, out EncodingHandler.CKeyEntry entry)) { return(OpenEKey(entry.EKey)); } if (CreateArgs.Online) { return(new BLTEStream(this, NetHandle.OpenData(key))); } Debugger.Log(0, "ContainerHandler", $"Missing encoding entry for CKey {key.ToHexString()}\n"); return(null); }
/// <summary> /// Open a file from Content Key /// </summary> /// <param name="key">Content Key of the file</param> /// <returns>Loaded file</returns> public Stream OpenCKey(CKey key) { if (EncodingHandler != null && EncodingHandler.TryGetEncodingEntry(key, out EncodingHandler.CKeyEntry entry)) { return(OpenEKey(entry.EKey)); } if (CreateArgs.Online) { using (var stream = NetHandle.OpenData(key)) { if (stream != null) { var ms = new MemoryStream(); stream.CopyTo(ms); ms.Position = 0; return(new BLTEStream(this, ms)); } } } Debugger.Log(0, "ContainerHandler", $"Missing encoding entry for CKey {key.ToHexString()}\n"); return(null); }