public void Remove(DbRemoteTree remoteTree) { if (remoteTree.Type == RemoteType.dir) { Dirs.Remove(remoteTree); } else { Items.Remove(remoteTree); } }
public int Add(DbRemoteTree remoteTree) { var items = remoteTree.Type == RemoteType.dir ? Dirs : Items; items.Add(remoteTree); if (remoteTree.Type == RemoteType.dir) { return(items.Count - 1); } return(Dirs.Count + items.Count - 1); }
public int GetSortIndex(DbRemoteTree remoteTree) { var items = remoteTree.Type == RemoteType.dir ? Dirs : Items; items.Sort((x, y) => string.Compare(x.Name, y.Name)); int index = items.FindIndex(m => m.uuid == remoteTree.uuid); if (remoteTree.Type == RemoteType.dir) { return(index); } return(index + Dirs.Count); }