Example #1
0
    static void Main( )
    {
        string path = Path.Combine(Directory.GetCurrentDirectory() , "ArchiveUsers.xml");
        UserCollection listOfUsers = new UserCollection()
        {
            Users = new List<User>() {new User("maria_9578", "mariaPos"),
        new User("kaloyan.dimitrov", "koko8754"),
        new User("metodi_48", "metodiA"),
        new User("porimia.banana", "bananaM8"),
        new User("kompana_bora", "boraBora"),
        new User("ivan_ivanov", "van4o4o4o")}
        };
        XmlSerializer xmlSer = new XmlSerializer(typeof(UserCollection));
        TextWriter txtW = new StreamWriter(path);

        xmlSer.Serialize(txtW , listOfUsers);

        txtW.Close();
        Application.EnableVisualStyles();
        Application.Run(new ChatServerForm());
    }
Example #2
0
        protected override void Setup()
        {
            // 初始化Game Server
            log4net.GlobalContext.Properties["Photon:ApplicationLogPath"] = Path.Combine(this.ApplicationRootPath, "log");
            log4net.GlobalContext.Properties["LogFileName"] = "ChatServer";

            var configFileInfo = new FileInfo(Path.Combine(this.BinaryPath, "log4net.config"));

            if (configFileInfo.Exists)
            {
                LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance);
                XmlConfigurator.ConfigureAndWatch(configFileInfo);
            }

            Log.Info("Chat Server is running....");

            Users = new UserCollection();
            Users.AddUser(1, "111111", "arthur", "arthur pai");
            Users.AddUser(2, "111111", "ken", "ken chang");
            Users.AddUser(3, "111111", "jet", "jec chou");
            Users.AddUser(4, "111111", "angel", "angel shu");
        }