Database.cs Error?

12/12/2009 19:08 Andrew.A#1
Well I get my friends playing my server and I'm getting this alot. This therefore isn't saving them. They also DC alot but maybe thats more to do with my conenction.
[Only registered and activated users can see links. Click Here To Register...]
and inside line 1183 is the save char region.
12/13/2009 00:32 Tw3ak#2
I won't tell ya how to fix it but i'll point you in the right direction :)
The problem is the reader in the source is flawed because the reader doesn't always close when reading/writing info so it starts throwin errors when it tries to read or write info to a persons character and it can't because it hasn't closed after reading/writing a previous file. This is the bug i was laughin about on darksideco and posted about it a week or 2 back in this same source, Because people would play hours and log off or dc'd and reconnected and had lost everything they did because the reader didn't save anything.
12/13/2009 05:18 InfamousNoone#3
A filestream to the character files as Tw3ak said isn't being closed. It's good practice to close all streams when you're done with them unless documentation says otherwise. If your using a short lived stream and don't wish to call Close() you can do something like this:

Code:
using (StreamReader rdr = new StreamReader(...))
{
// code here, after this scope is executed,
// the rdr variable will be disposed and no longer be accessible
}