|
using System;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Runtime.Serialization;
namespace Trestan
{
[Serializable]
public sealed class Configuration
{
private static Configuration instance = null;
private Configuration()
{
}
public static Configuration Instance
{
get
{
if (instance == null)
{
instance = (Configuration)Utility.TDeSerialize("test.dat");
}
if (instance == null)
{
instance = new Configuration();
}
return instance;
}
}
int serverPort = 8000;
public int ServerPort
{
get { return serverPort; }
set { serverPort = value; }
}
int chatPort = 6055;
public int ChatPort
{
get { return chatPort; }
set { chatPort = value; }
}
string serverIP = "localhost";
public string ServerIP
{
get { return serverIP; }
set { serverIP = value; }
}
UserInfo currentUser = new UserInfo();
public UserInfo CurrentUser
{
get { return currentUser; }
set { currentUser = value; }
}
public void Save()
{
Utility.TSerialize(this, "test.dat");
}
}
[Serializable]
[DataContract]
public class UserInfo
{
protected int userID = 0;
[DataMember()]
public int UserID
{
get { return userID; }
set { userID = value; }
}
protected string userName;
[DataMember()]
public string UserName
{
get { return userName; }
set { userName = value; }
}
protected bool moderator = false;
[DataMember()]
public bool Moderator
{
get { return moderator; }
set { moderator = value; }
}
protected bool pending = false;
[DataMember()]
public bool Pending
{
get { return pending; }
set { pending = value; }
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.