Share via


XFileManager.CreateSaveObject(String,XFileFormat) Method (Microsoft.DirectX.Direct3D)

Creates a save object.

Definition

Visual Basic Public Function CreateSaveObject( _
    ByVal fileName As String, _
    ByVal fileFormat As XFileFormat _
) As XFileSaveObject
C# public XFileSaveObject CreateSaveObject(
    string fileName,
    XFileFormat fileFormat
);
C++ public:
XFileSaveObjectCreateSaveObject(
    StringLeave SitefileName,
    XFileFormat fileFormat
);
JScript public function CreateSaveObject(
    fileName : String,
    fileFormat : XFileFormat
) : XFileSaveObject;

Parameters

fileName System.String
A StringLeave Site instance that contains the name of the file to use for saving data.
fileFormat Microsoft.DirectX.Direct3D.XFileFormat
Format to use when saving the XFile (.x file). This value can be one of the XFileFormat enumerated vales. See Remarks.

Return Value

Microsoft.DirectX.Direct3D.XFileSaveObject
An XFileSaveObject instance that represents the created save object.

Remarks

The object should be disposed immediately when it is no longer needed.

To create data objects and to save templates or data, use methods of the XFileSaveObject after using this method.

The default value for the file format is Binary. File format values can be combined in a logical or to create compressed text or binary files. If a file is specified as both binary (0) and text (1), it is saved as a text file, because the value is indistinguishable from the text file format value (0 + 1 = 1). If a file is specified as text and compressed, it is first written out as text and then compressed. However, because compressed text files are not as efficient as binary text files, specifying binary and compressed is recommended in most cases. Setting a file to be compressed without specifying a format results in a binary compressed file.

Exceptions

GraphicsException

If a parameter is invalid, the GraphicsException.ErrorCode member contains the XFileErrorCodes.BadValue enumerated value. If the file is invalid, GraphicsException.ErrorCode contains the XFileErrorCodes.BadFile enumerated value. If the memory allocation failed, GraphicsException.ErrorCode contains the XFileErrorCodes.BadAlloc enumerated value.

See Also