/// <summary> /// Installs the exit handler. /// </summary> /// <returns>The exit handler.</returns> /// <param name="type">Type.</param> /// <param name="id">Identifier.</param> /// <param name="position">Position.</param> /// <param name="cb">Callback</param> /// <param name="data">Data.</param> public int InstallExitHandler(uint type, uint id, ContextInfoLocation position, IFFCallBack cb, object data) { return(InstallHandler(type, id, GenericChunkIds.CI_EXITHANDLER, position, cb, data)); }
/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="T:IffParse.Lists.ContextInfoNode"/> class. /// </summary> /// <param name="id">Identifier.</param> /// <param name="type">Type.</param> /// <param name="identifier">Identifier.</param> /// <param name="dataSize">Data size.</param> /// <param name="callback">Callback.</param> public ContextInfoNode(UInt32 id, UInt32 type, UInt32 identifier, UInt64 dataSize, IFFCallBack callback) { this.Id = id; this.Type = type; this.Identifier = identifier; this.PurgeCallBack = callback; if (dataSize > 0) { this.Data = new byte[dataSize]; this.DataSize = dataSize; } else { this.Data = null; } }