I made a program that simulates an assembly line using the XNA 4.0. I made a 3D model, and divided it into 5 positions - start, 3 workstations, and end. These positions represent the places on the model that (in real life) would be covered by some type of sensors. Whenever an object gets to one of these positions, it triggers a method that is binded to that specific position (like "Stop", "Start", "Increment/Decrement Counter"...).
This program has to be able to load a file that describes the behavior of the entire assembly line - meaning, this file has to tell the program when and which method will be triggered (for now it is only Start/Stop methods). To do this, I created a method that serializes the class that contains bool
variables (these variables determine if the position will be "active" or not - if the value is true
then the object will trigger the binded method, if it is false
then it will simply pass that position, without any additional actions being performed).
This is the problem I'm having: My method successfully serializes the class, and creates the .xml file, but if I load this file as Content, it gives me the following error "There was an error while deserializing intermediate XML. Cannot find type "Postavke.PostavkeStanice"."
This is the code of my class:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
using System.Xml;
namespace Postavke
{
public class PostavkeStanice
{
public bool radnaStanica1_Stanje;
public bool radnaStanica2_Stanje;
public bool radnaStanica3_Stanje;
public bool kraj_Stanje;
MemoryStream ms = new MemoryStream();
public void ClassToXML()
{
XmlTextWriter pisac = new XmlTextWriter(ms, Encoding.UTF8);
pisac.Formatting = Formatting.Indented;
IntermediateSerializer.Serialize(pisac, this, "Postavke.xml");
}
public string XMLToXNA()
{
ms.Seek(0, SeekOrigin.Begin);
TextReader citac = new StreamReader(ms);
return citac.ReadToEnd();
}
}
}
Since this class is a part of Game Library, I set the dependencies so that the Game library gets compiled before the main project. When I run the code I get the fore mentioned error. Can you tell me what I'm doing wrong Thank you