packages/Windows API Code Pack 1.1/source/Samples/DirectX/CS/UtilitiesLibrary/MeshLoader/XMeshLoader.XDataObject.cs
/// <summary>
/// Registers a given object in the factory's object cache
/// </summary>
/// <param name="uuid">The object's UUID, if present, null otherwise.</param>
/// <param name="dataObject">The data object itself.</param>
/// <remarks>The object's name will be used as the object key if no UUID is present.
/// Note: the object dictionary will only ever contain the object
/// most recently seen with a given name and/or UUID.  Ideally,
/// a .x file will not use the same name for two different objects,
/// and the specification is not clear on whether that's legal and
/// if so, how to resolve duplicates (especially when it's possible
/// to infer the correct object based on the expected type of object).
/// In this implementation, however, no attempt is made to resolve
/// duplicates intelligently; this may lead to the failure to populate
/// some particular piece of the object tree, when a most recent
/// object of a given name or UUID is not of the expected type.</remarks>
Registers a given object in the factory's object cache
Registers a given object in the factory ' s object cache
private void RegisterObject(string uuid, XDataObject dataObject)
            {
                if (uuid != null)
                {
#if DEBUG
                    if (objectDictionary.ContainsKey(uuid))
                    {
                        Debug.WriteLine(string.Format("Key {0} already present", uuid));
                    }
#endif
                    objectDictionary[uuid] = dataObject;
                }
                if (!string.IsNullOrEmpty(dataObject.Name))
                {
#if DEBUG
                    if (objectDictionary.ContainsKey(dataObject.Name))
                    {
                        Debug.WriteLine(string.Format("Key {0} already present", dataObject.Name));
                    }
#endif
                    objectDictionary[dataObject.Name] = dataObject;
                }
            }
private void RegisterObject ( string uuid , XDataObject dataObject ) { if ( uuid != null ) { if DEBUG if ( objectDictionary . ContainsKey ( uuid ) ) { Debug . WriteLine ( string . Format ( " " , uuid ) ) ; } endif objectDictionary [ uuid ] = dataObject ; } if ( ! string . IsNullOrEmpty ( dataObject . Name ) ) { if DEBUG if ( objectDictionary . ContainsKey ( dataObject . Name ) ) { Debug . WriteLine ( string . Format ( " " , dataObject . Name ) ) ; } endif objectDictionary [ dataObject . Name ] = dataObject ; } }
Registers a given object in the factory's object cache
Registers a given object in the factory ' s object cache
uuid
string
The object's UUID, if present, null otherwise.
The object ' s UUID if present null otherwise .
dataObject
XDataObject
The data object itself.
The data object itself .
remarks
The object's name will be used as the object key if no UUID is present.
Note: the object dictionary will only ever contain the object
most recently seen with a given name and/or UUID.  Ideally,
a .x file will not use the same name for two different objects,
and the specification is not clear on whether that's legal and
if so, how to resolve duplicates (especially when it's possible
to infer the correct object based on the expected type of object).
In this implementation, however, no attempt is made to resolve
duplicates intelligently; this may lead to the failure to populate
some particular piece of the object tree, when a most recent
object of a given name or UUID is not of the expected type.
The object ' s name will be used as the object key if no UUID is present . Note : the object dictionary will only ever contain the object most recently seen with a given name and / or UUID . Ideally a . x file will not use the same name for two different objects and the specification is not clear on whether that ' s legal and if so how to resolve duplicates ( especially when it ' s possible to infer the correct object based on the expected type of object ) . In this implementation however no attempt is made to resolve duplicates intelligently ; this may lead to the failure to populate some particular piece of the object tree when a most recent object of a given name or UUID is not of the expected type .