Пример #1
0
 public QueueGamer(ConnectedClient <IMessage> client, DataOfAccount data)
 {
     NickName  = data.NickName;
     Password  = data.Password;
     Client    = client;
     AddInRoom = false;
 }
Пример #2
0
 public QueueController(ConnectedClient <IMessage> client, DataOfAccount data)
 {
     this.client             = client;
     client.Controler        = this;
     client.EventEndSession += Handler_EndSession;
     client.SendMessage(new RequestJoinToQueue());
     gamer = new QueueGamer(client, data);
 }
Пример #3
0
 private static bool RecordInFile(string nameFile, DataOfAccount data)
 {
     using (FileStream fs = new FileStream(nameFile, FileMode.OpenOrCreate))
     {
         formatter.Serialize(fs, data);
         return(true);
     }
 }
Пример #4
0
 public void AddData(DataOfAccount addData)
 {
     QuantityKills      += addData.QuantityKills;
     QuantityBattles    += addData.QuantityBattles;
     QuantityDeaths     += addData.QuantityDeaths;
     TimeInGame_Seconds += addData.TimeInGame_Seconds;
     TimeInGame_Minutes += addData.TimeInGame_Minutes;
     TimeInGame_Hours   += addData.TimeInGame_Hours;
     TimeInGame_Days    += addData.TimeInGame_Days;
 }
Пример #5
0
        private static bool CheckPassword(string Login, string Password)
        {
            DataOfAccount data = ReadData(CreatePathByLogin(Login));

            if (data.Password == Password)
            {
                return(true);
            }

            return(false);
        }
Пример #6
0
 public static bool AddToStatistic(DataOfAccount achievements)
 {
     try
     {
         string        Path     = CreatePathByLogin(achievements.NickName);
         DataOfAccount mainData = ReadData(Path);
         mainData.AddData(achievements);
         if (RecordInFile(Path, mainData))
         {
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         Log.AddNewRecord(e.ToString());
         return(false);
     }
 }
Пример #7
0
        public static bool CreateAccount(string Login, string Password)
        {
            try
            {
                string Path = CreatePathByLogin(Login);
                CreateFileForAccount(Path);
                //инициализируем ее стандартными данными
                DataOfAccount emptyAccount = new DataOfAccount(Login, Password, 0, 0, 0, new TimeSpan());
                //записываем
                if (!RecordInFile(Path, emptyAccount))
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception e)
            {
                Log.AddNewRecord(e.ToString());
                return(false);
            }
        }
Пример #8
0
 /// <summary>
 /// получает данные о клиенте и записывает их в поле data
 /// </summary>
 private void InitializeDataAboutClient(string login, string password)
 {
     //получаем данные об аккаунте
     data = BDAccounts.GetDataOfAccount(login, password);
 }