quick fix

This commit is contained in:
shinichi
2020-10-02 15:53:50 +02:00
parent eb2738168b
commit 09db19246e

View File

@@ -20,7 +20,7 @@ namespace Server
private SaveData saveData; private SaveData saveData;
private string username = null; private string username = null;
private DateTime sessionStart; private DateTime sessionStart;
private const string fileName = "userInfo.dat"; private string fileName;
@@ -32,6 +32,7 @@ namespace Server
this.communication = communication; this.communication = communication;
this.tcpClient = tcpClient; this.tcpClient = tcpClient;
this.stream = this.tcpClient.GetStream(); this.stream = this.tcpClient.GetStream();
this.fileName = Directory.GetCurrentDirectory() + "/userInfo.dat";
stream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnRead), null); stream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnRead), null);
} }
@@ -176,7 +177,8 @@ namespace Server
newUsers(username, password); newUsers(username, password);
Console.WriteLine("true"); Console.WriteLine("true");
return true; return true;
} else }
else
{ {
Console.WriteLine("file exists, located at " + Path.GetFullPath(fileName)); Console.WriteLine("file exists, located at " + Path.GetFullPath(fileName));
string[] usernamesPasswords = File.ReadAllLines(fileName); string[] usernamesPasswords = File.ReadAllLines(fileName);