コード例 #1
0
ファイル: QueueGamer.cs プロジェクト: Rogachev99/PUBG
 public QueueGamer(ConnectedClient <IMessage> client, DataOfAccount data)
 {
     NickName  = data.NickName;
     Password  = data.Password;
     Client    = client;
     AddInRoom = false;
 }
コード例 #2
0
ファイル: QueueController.cs プロジェクト: Rogachev99/PUBG
 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);
 }