//Создание нового пользователя методом занесения данных в формате JSON в виде массива private void createUser_Click(object sender, RoutedEventArgs e) { if (IsExistUserName(username.Text)) { MessageBox.Show("The user with such username has been already existed!", "InvalidRegistration"); } else { OriginInitiating(); massiveCapacity++; newUserNext = new ClassUser[massiveCapacity]; if (newUser != null) { for (int i = 0; i < newUser.Length; i++) { newUserNext[i] = newUser[i]; } } int randNumber = rand.Next(idCapacity); while (IsExistId(randNumber)) { randNumber = rand.Next(idCapacity); } newUserNext[massiveCapacity - 1] = new ClassUser(randNumber, UserWindow.GetMd5Hash(hash, username.Text), UserWindow.GetMd5Hash(hash, password.Text), Int32.Parse(balance.Text), GetNewImagePath()); jsonItem = JsonMapper.ToJson(newUserNext); File.WriteAllText("UserBiblio.json", jsonItem.ToString()); newUser = newUserNext; MessageBoxResult result = MessageBox.Show("You have been successfully registrated!", "ValidRegistration", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { nav.Navigate(new Uri("EnterTheCabinet.xaml", UriKind.RelativeOrAbsolute)); } } }