public int Add(CFolder cf)
 {
     return(List.Add(cf));
 }
        public int Add(string name)
        {
            CFolder cf = new CFolder(name);

            return(List.Add(cf));
        }
 public long Add2(CFolder cf)
 {
     List.Add(cf);
     return(cf.Size);
 }
Пример #4
0
        private void Search()
        {
            try
            {
                string[] kws = GetKeywords(Keyword);

                switch (SP.ST)
                {
                case SearchType.Root:
                {
                    for (int i = 0; i < Root.Collection.Count; i++)
                    {
                        ArrayList temp1 = new ArrayList();
                        temp1.Add(i);
                        for (int j = 0; j < Root.Collection[i].Count; j++)
                        {
                            ArrayList temp2 = (ArrayList)temp1.Clone();
                            temp2.Add(j);
                            OnSearchResultItemAdd(null, new SearchResultItemEventArgs(new SearchResultItem(MatchKeyword(kws, Root.Collection[i][j].Name.ToLower()), temp2, true)));
                            SearchFolder(temp2, Root.Collection[i][j].Folders, Root.Collection[i][j].Files, kws);
                        }
                    }
                }
                break;

                case SearchType.Collection:
                {
                    int index = int.Parse(SP.Position[1].ToString());
                    for (int j = 0; j < Root.Collection[index].Count; j++)
                    {
                        ArrayList temp = (ArrayList)SP.Position.Clone();
                        temp.Add(j);
                        OnSearchResultItemAdd(null, new SearchResultItemEventArgs(new SearchResultItem(MatchKeyword(kws, Root.Collection[index][j].Name.ToLower()), temp, true)));
                        SearchFolder(temp, Root.Collection[index][j].Folders, Root.Collection[index][j].Files, kws);
                    }
                }
                break;

                default:
                {
                    int       index1 = int.Parse(SP.Position[1].ToString());
                    int       index2 = int.Parse(SP.Position[2].ToString());
                    ArrayList temp   = new ArrayList();

                    for (int k = 0; k < SP.Position.Count; k++)
                    {
                        temp.Add(SP.Position[k]);
                    }

                    temp.RemoveAt(0);
                    temp.RemoveAt(0);
                    temp.RemoveAt(0);
                    CFolder folder = Root.Collection[index1][index2];
                    for (int i = 0; i < temp.Count; i++)
                    {
                        folder = folder.Folders[(int)temp[i]];
                    }

                    SearchFolder(SP.Position, folder.Folders, folder.Files, kws);
                }
                break;
                }

                OnSearchFinished(this, new EventArgs());
            }
            catch { }
        }