private static int HandlePropertyChunk(IFFParser iff, object userData) { int err; var cn = iff.GetCurrentContext(); var ci = new ContextInfoNode(cn.Id, cn.Type, GenericChunkIds.CI_PROPCHUNK, cn.Size, null); if (ci != null) { var buffer = new byte[cn.Size]; err = iff.BufferChunk((int)cn.Size, ref buffer); if (err >= 0) { ci.Data = buffer; err = iff.StoreContextInfo(ci, ContextInfoLocation.Prop); if (err >= 0) { return(1); } } ci.Dispose(); } else { err = (int)ParserStatus.OutOfMemory; } return(err); }
/// <summary> /// Purges the context info node. /// </summary> /// <returns>The context info node.</returns> /// <param name="contextInfoNode">Context info node.</param> protected int PurgeContextInfoNode(ContextInfoNode contextInfoNode) { if (contextInfoNode.PurgeCallBack != null) { return(contextInfoNode.PurgeCallBack(this, contextInfoNode)); } contextInfoNode.Dispose(); return(0); }
/// <summary> /// Install a handler node into the current context /// </summary> /// <returns></returns> private int InstallHandler(uint type, uint id, uint identifier, ContextInfoLocation position, IFFCallBack callbackHandler, object data) { int err; var ci = new ContextInfoNode(id, type, identifier, 0, null); if (ci != null) { var ch = new ChunkHandler { ChunkHandlerCallBack = callbackHandler, UserData = data }; ci.ChunkHandler = ch; err = StoreContextInfo(ci, position); if (err < 0) { ci.Dispose(); } return(err); } return(0); }