Po0ka
Member
I am trying to deserialize a "Type" value from a serialized class, but in the core i have there are no Type for GenericReader.
Only these:
INFOS:
-class Stuff:
contains some stuffs, including a Type variable.
-listOfStuffs:
a List<Stuff>.
-Main class:
contains the list that contains stuffs, in it i serialize all the list, and deserialize all the list.
-To serialize my classes i do:
in a for loop.
-To gather it back, i did this:
a for loop going from 0 to X, each time it finds a thing to read, it does:
-Which means i have a constructor in the class Stuff like so:
But the code above is wrong, as i don't have the appropriate way to obtain that desired Type.
At first i considered a string variable so i can easily save it, but things got complicated and well, yea.
Thanks.
Only these:
Code:
public abstract string ReadString();
public abstract DateTime ReadDateTime();
public abstract TimeSpan ReadTimeSpan();
public abstract DateTime ReadDeltaTime();
public abstract decimal ReadDecimal();
public abstract long ReadLong();
public abstract ulong ReadULong();
public abstract int ReadInt();
public abstract uint ReadUInt();
public abstract short ReadShort();
public abstract ushort ReadUShort();
public abstract double ReadDouble();
public abstract float ReadFloat();
public abstract char ReadChar();
public abstract byte ReadByte();
public abstract sbyte ReadSByte();
public abstract bool ReadBool();
public abstract int ReadEncodedInt();
public abstract IPAddress ReadIPAddress();
public abstract Point3D ReadPoint3D();
public abstract Point2D ReadPoint2D();
public abstract Rectangle2D ReadRect2D();
public abstract Rectangle3D ReadRect3D();
public abstract Map ReadMap();
public abstract Item ReadItem();
public abstract Mobile ReadMobile();
public abstract BaseGuild ReadGuild();
public abstract T ReadItem<T>() where T : Item;
public abstract T ReadMobile<T>() where T : Mobile;
public abstract T ReadGuild<T>() where T : BaseGuild;
public abstract ArrayList ReadItemList();
public abstract ArrayList ReadMobileList();
public abstract ArrayList ReadGuildList();
public abstract List<Item> ReadStrongItemList();
public abstract List<T> ReadStrongItemList<T>() where T : Item;
public abstract List<Mobile> ReadStrongMobileList();
public abstract List<T> ReadStrongMobileList<T>() where T : Mobile;
public abstract List<BaseGuild> ReadStrongGuildList();
public abstract List<T> ReadStrongGuildList<T>() where T : BaseGuild;
public abstract Race ReadRace();
public abstract bool End();
INFOS:
-class Stuff:
contains some stuffs, including a Type variable.
-listOfStuffs:
a List<Stuff>.
-Main class:
contains the list that contains stuffs, in it i serialize all the list, and deserialize all the list.
-To serialize my classes i do:
Code:
writer.Write( listOfStuffs.Get(i) );
-To gather it back, i did this:
a for loop going from 0 to X, each time it finds a thing to read, it does:
Code:
Stuff s = new Stuff( reader );
listOfStuffs.Add( s );
-Which means i have a constructor in the class Stuff like so:
Code:
public Stuff( GenericReader reader )
{
variableType = (Type)reader.ReadEncodedInt(); //wrong... no idea what i can use.
}
But the code above is wrong, as i don't have the appropriate way to obtain that desired Type.
At first i considered a string variable so i can easily save it, but things got complicated and well, yea.
Thanks.