예제 #1
0
 public void Remove(DbRemoteTree remoteTree)
 {
     if (remoteTree.Type == RemoteType.dir)
     {
         Dirs.Remove(remoteTree);
     }
     else
     {
         Items.Remove(remoteTree);
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }