public PLUser getCurrentUser() { if (m_currentUser == null || m_currentUser.Name.Equals(PLUser.USER_UNKNOWN)) { if (playlistMode == PlaylistMode.PlexNative) { m_currentUser = m_PlexPlaylistCreator.currentUser; } else { var elements = getElementList(PLCommands.USERGetCurrent, DIRECTORY); if (elements.Count() > 0) { m_currentUser = new PLUser() { Name = attributeValue(elements.First(), KEY) }; } else { m_currentUser = null; } } m_currentUser = m_currentUser ?? new PLUser() { Name = PLUser.USER_UNKNOWN }; } return(m_currentUser); }
public bool deleteCurrentUser(string _user) { if (!String.IsNullOrEmpty(_user) && !_user.Equals(PLUser.USER_UNKNOWN) && playlistMode == PlaylistMode.ChannelMusicPlaylist) { String commandUrl = this.makeUrl(PLCommands.USERDelete, new Dictionary <string, string> { { USER, _user } }); XElement elementRoot = Utils.elementFromURL(commandUrl); m_currentUser = null; this.getCurrentUser(); return(true); } return(false); }
public bool setCurrentUser(string _newUser) { if (!String.IsNullOrEmpty(_newUser) && !_newUser.Equals(PLUser.USER_UNKNOWN) && !_newUser.Equals(currentUser.Name)) { if (playlistMode == PlaylistMode.PlexNative) { if (!m_PlexPlaylistCreator.setCurrentUser(_newUser)) { return(false); } } else { String commandUrl = this.makeUrl(PLCommands.USERSetCurrent, new Dictionary <string, string> { { USER, _newUser } }); XElement elementRoot = Utils.elementFromURL(commandUrl); } m_currentUser = null; this.getCurrentUser(); return(true); } return(false); }