public void CreateGeometryDataTypeFromShortAndFullNameReturnTheSameType() { Assert.AreEqual( BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound("GeometryData"), BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound( "DeltaEngine.Graphics.Geometry+GeometryData")); }
private void InitializeGameTriggers(XmlData trigger) { var triggerType = BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound(trigger.Name); Triggers.Add( Trigger.GenerateTriggerFromType(triggerType, trigger.Name, trigger.Value) as GameTrigger); }
private static IEnumerable <object> LoadComponents(Entity entity, BinaryReader reader, byte[] versionBytes) { int count = reader.ReadByte(); if (count == 255) { count = reader.ReadInt32(); } var components = new List <object>(count); var arrayElementType = (ArrayElementType)reader.ReadByte(); if (arrayElementType == ArrayElementType.AllTypesAreNull) { return(components); } if (arrayElementType == ArrayElementType.AllTypesAreDifferent) { LoadComponentsOfDifferentTypes(components, reader, count, versionBytes); } else { Type elementType = arrayElementType == ArrayElementType.AllTypesAreTypes ? typeof(Type) : BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound(reader.ReadString()); LoadComponentsOfTheSameType(components, reader, count, elementType, versionBytes); } return(components); }
public void CreateTypeFromShortName() { Assert.IsNotNull(BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound("Int32")); Assert.IsNotNull(BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound("Material")); Assert.Throws <TypeLoadException>( () => BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound("abc535")); }
private static void LoadNextComponent(List <object> components, BinaryReader reader, byte[] versionBytes) { var name = reader.ReadString(); Type elementType = BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound(name); bool isNotNull = reader.ReadBoolean(); if (isNotNull) { components.Add(LoadComponent(elementType, reader, versionBytes)); } }
protected static Trigger[] ParseTriggers(XmlData command) { var triggers = new Trigger[command.Children.Count]; for (int index = 0; index < command.Children.Count; index++) { var trigger = command.Children[index]; var type = BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound(trigger.Name); if (type == null) { throw new Trigger.UnableToCreateTriggerTypeIsUnknown(trigger.Name); //ncrunch: no coverage } triggers[index] = Trigger.GenerateTriggerFromType(type, trigger.Name, trigger.Value) as Trigger; } return(triggers); }
public void CreateTypeFromFullName() { Assert.IsNotNull( BinaryDataExtensions.GetTypeFromShortNameOrFullNameIfNotFound( "DeltaEngine.Content.Material")); }