~mindsharing~ (C# snippets, Parse some lod files)
#2


struct tItem
{
public int ItemID;
public string Name;
public string Description;

public cItem(int ItemID, string Name, string Description )
{
this.ItemID = ItemID;
this.Name = Name;
this.Description = Description;
}
}

class ItemReader
{
public cItem[] ReadFile(string FileName)
{

List data = new List();

using( BinaryReader b = new BinaryReader( File.Open( FileName, FileMode.Open ) ) )
{
int lastID = b.ReadInt32();

while( b.BaseStream.Position data.Add( new cItem ( b.ReadInt32(),
new string( b.ReadChars( b.ReadInt32() ) ),
new string( b.ReadChars( b.ReadInt32() ) ) ) );

}

return data;
}
}

 

I think thats a little easier Wink



Messages In This Thread
[No subject] - by ILAn12346 - 05-25-2012, 04:14 AM
[No subject] - by Wizatek - 05-25-2012, 06:43 PM
[No subject] - by ILAn12346 - 05-25-2012, 09:24 PM
[No subject] - by Wizatek - 05-25-2012, 09:48 PM
[No subject] - by ILAn12346 - 05-25-2012, 10:03 PM
[No subject] - by someone - 05-26-2012, 01:07 PM
[No subject] - by Wizatek - 05-26-2012, 02:38 PM
[No subject] - by Reza - 05-31-2012, 05:41 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)