8.1 load
- Use the DirectXFileCreate function to create
an IDirectXFile object. - If templates are present in the DirectX file that you will load, use the
IDirectXFile::RegisterTemplates method to register those templates. - Use the IDirectXFile::CreateEnumObject method
to create an IDirectXFileEnumObject enumerator object. - Loop through the objects in the file. For each object, perform the following steps.
- Use the IDirectXFileEnumObject::GetNextDataObject
method to retrieve each IDirectXFileData object. - Use the IDirectXFileData::GetType method to
retrieve the data's type. - Load the data using the
IDirectXFileData::GetData method. - If the object has optional members, retrieve the optional members by calling the
IDirectXFileData::GetNextObject method. - Release the IDirectXFileData object.
- Use the IDirectXFileEnumObject::GetNextDataObject
- Release the IDirectXFileEnumObject object.
- Release the IDirectXFile object.
8.2 save
- Use the DirectXFileCreate function to create
an IDirectXFile object. - Use the IDirectXFile::RegisterTemplates method
to inform the DirectX file system about any templates that you will use. - Use the IDirectXFile::CreateSaveObject method
to create an IDirectXFileSaveObject object. - Use the IDirectXFileSaveObject::SaveTemplates
method to save templates, if desired. - Loop through the objects to save. For each top-level object, perform the following steps.
o Use the
IDirectXFileSaveObject::CreateDataObject method to create an
IDirectXFileData object as a top-level object in the file. If the top-level data object has optional
child objects, add them to the object by using the appropriate method from the next step.
o Each
IDirectXFileData object can have optional child objects if its template allows it. The child objects can
be any of the three types of objects: IDirectXFileData,
IDirectXFileDataReference, or
IDirectXFileBinary. Loop through the objects you need to save, adding each optional child member
to the object list in the manner appropriate to its type, as illustrated in the following steps. Then, if the object type is Data, call the
IDirectXFileSaveObject::CreateDataObject method to create an
IDirectXFileData object, and then call the IDirectXFileData::AddDataObject method
to add it as a child of the object. If the object type is Data Reference, call the
IDirectXFileData::AddDataReference method to create and add the data reference object as a child
of the object. Or, if the object type is Binary, call the IDirectXFileData::AddBinaryObject method
to create and add the binary object as a child of the object.
o Call the
IDirectXFileSaveObject::SaveData method to save the data object and its children.
o Release the
IDirectXFileData object.
- Release the IDirectXFileSaveObject object.
- Release the IDirectXFile object.