public GroupsLeaver(string userNick, string nameGroup, string pathGroup, string typeGroup, string usersPath) { this.NameGroup = nameGroup; this.UserNick = userNick; this.PathGroup = pathGroup; this.TypeGroup = typeGroup; this.UsersPath = usersPath; needChat = new PersonChat(); }
private async Task <GroupInformation> CreateChat(string namePerson, string typeGroup) { var nameChat = $"{namePerson} {user.Nickname}"; PersonChat personChat = new PersonChat(new string[] { namePerson, user.Nickname }, nameChat); WriteNewPerson(Path.Combine(messenger.Server.UsersPath, user.Nickname, "peopleChatsBeen.json"), personChat); WriteNewPerson(Path.Combine(messenger.Server.UsersPath, namePerson, "peopleChatsBeen.json"), personChat); var path = Path.Combine(messenger.Server.PeopleChatsPath, nameChat); FileMaster.CreateDirectory(path); await AddData(Path.Combine(path, "users.json"), user.Nickname); await AddData(Path.Combine(path, "users.json"), namePerson); return(new GroupInformation(true, typeGroup, nameChat, path)); }
private async void WriteNewPerson(string path, PersonChat personChat) { await FileMaster.UpdateFile(path, FileMaster.AddData(personChat)); }