[SOLVED] XML Importer failure

Hi guys
Sorry in advance for my bad english level.

This week I had a big pb.I had a link to the file, and delete it …
I make backup all the week but, my serialize method doesnt exist now.

I remember my try hard for a successful.

Serialize method

using (XmlWriter writer = XmlWriter.Create(fileName))
            {
                    IntermediateSerializer.Serialize(writer, level.renderer._lightListEmitter, null);
            }

My XML file

<?xml version="1.0" encoding="UTF-8"?>
-<XnaContent xmlns:Generic="System.Collections.Generic">
-<Asset Type="Generic:List[Setting.LightEmitter]">
+<Item>
-<Item>
<name>InStory</name>
-<_LightList>
-<Item>
<Createposition>576 384 100</Createposition>
<position>576 384 100</position>
<color>0 0 255</color>
<normal>1 0 0</normal>
<corrector>1</corrector>
<Lenght>768 768</Lenght>
<AxisZ>1</AxisZ>
<InvDir>false</InvDir>
<theta>0</theta>
<renderer>0</renderer>
<nameOfEngine Null="true"/>
<radius>0</radius>
<bounds>768 768</bounds>
<intensity>1</intensity>
<extend>1 1 1</extend>
<additiveblendBool>true</additiveblendBool>
<isFullScreen>false</isFullScreen>
<is_Selectioned>false</is_Selectioned>
<Id_Light>0</Id_Light>
<select>true</select>
<technique>0</technique>
</Item>
</_LightList>
<ID_>0</ID_>
<MaxLight>1</MaxLight>
<MaxLightAutorisation>10</MaxLightAutorisation>
<technique>0</technique>
</Item>
-<Item>
<name>Layer</name>
-<_LightList>
-<Item>
<Createposition>768 384 100</Createposition>
<position>768 384 100</position>
<color>0 0 255</color>
<normal>1 0 0</normal>
<corrector>1</corrector>
<Lenght>768 768</Lenght>
<AxisZ>1</AxisZ>
<InvDir>false</InvDir>
<theta>0</theta>
<renderer>0</renderer>
<nameOfEngine Null="true"/>
<radius>0</radius>
<bounds>768 768</bounds>
<intensity>1</intensity>
<extend>1 1 1</extend>
<additiveblendBool>false</additiveblendBool>
<isFullScreen>true</isFullScreen>
<is_Selectioned>false</is_Selectioned>
<Id_Light>0</Id_Light>
<select>true</select>
<technique>0</technique>
</Item>
-<Item>
<Createposition>768 704 100</Createposition>
<position>768 704 100</position>
<color>0 0 255</color>
<normal>1 0 0</normal>
<corrector>1</corrector>
<Lenght>768 768</Lenght>
<AxisZ>1</AxisZ>
<InvDir>false</InvDir>
<theta>0</theta>
<renderer>0</renderer>
<nameOfEngine Null="true"/>
<radius>0</radius>
<bounds>768 768</bounds>
<intensity>1</intensity>
<extend>1 1 1</extend>
<additiveblendBool>true</additiveblendBool>
<isFullScreen>false</isFullScreen>
<is_Selectioned>false</is_Selectioned>
<Id_Light>1</Id_Light>
<select>true</select>
<technique>0</technique>
</Item>
</_LightList>
<ID_>1</ID_>
<MaxLight>2</MaxLight>
<MaxLightAutorisation>10</MaxLightAutorisation>
<technique>0</technique>
</Item>
</Asset>
</XnaContent>

I have create a library, add my dll into my project reference.
I use [ContentSerializerIgnore].
I load like that

string filename = string.Format("C:/NSOMSettings/Light/light{0}", levelIndex); //Light C:/NSOMSettings/
            if (System.IO.File.Exists(filename))
            {
                    renderer._lightListEmitter = game.Content.Load<List<LightEmitter>>(filename);
            }

But now no light0.xnb was created :frowning:

Before my mistake it works perfectly :confused:

If you want more information, let me known.

Thank you in advance

Please mind your language there, there are young users on here too.

yes sorry, edit.
thx

1 Like

Really sorry for my language, I write as I speak french.

Its ok, in the content.mgcb I need to reference my dll.

Now I serialize like that

XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;
            XmlDocument doc = new XmlDocument();

            using (XmlWriter writer = XmlWriter.Create(fileName, settings))
            {
                IntermediateSerializer.Serialize(writer, level.renderer._lightListEmitter, fileName);

                doc.Save(writer);
            }

else the schema is wrong when i open my file with VS. I don’t no why :confused:

thx

Howdy,

I haven’t started with the framework yet but have run into problems with windows file permissions when creating files! Make sure you can access the directory. I know the general System.IO struggles when you need to create a directory within a directory. Might seem like a low tech guess but that’s where i’d start!

Good luck!