- Added some more types to the XmlImporter conversion list.

This commit is contained in:
SND\eagleeyestudios_cp 2012-10-02 22:13:26 +00:00 committed by Konstantin Koch
parent 3a5b123c49
commit e011a8fc1f
2 changed files with 12 additions and 5 deletions

View File

@ -58,7 +58,7 @@ namespace ANX.Framework.Content.Pipeline.Importer
return result;
}
private Type GetType(string typeString)
private static Type GetType(string typeString)
{
//TODO: Implement custom assembly path checking
//Check every assembly in the current working dir for type
@ -151,7 +151,7 @@ namespace ANX.Framework.Content.Pipeline.Importer
return result;
}
private object XmlContentToObject(XElement item)
public static object XmlContentToObject(XElement item)
{
if (!item.HasAttributes && !item.HasElements) // String
{
@ -164,7 +164,14 @@ namespace ANX.Framework.Content.Pipeline.Importer
var type = GetType(typeString);
if (type == typeof(Single))
return Convert.ToSingle(item.Value);
if (type == typeof(Int32))
return Convert.ToInt32(item.Value);
if (type == typeof(Int64))
return Convert.ToInt64(item.Value);
if (type == typeof(Double))
return Convert.ToDouble(item.Value);
if (type == typeof(Boolean))
return Convert.ToBoolean(item.Value);
throw new NotSupportedException("Sorry, conversion of type \"" + type + "\" is currently not supported.");
}
throw new NotSupportedException("Conversion of nested stuff is not supported! If you have the time, go ahead and implement it! :P");

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -12,6 +12,7 @@
<AssemblyName>AnxSampleBrowser</AssemblyName>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>veröffentlichen\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@ -24,7 +25,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>