Exemplo n.º 1
0
        private void DisplayPage()
        {
            lvResultsInAudio.Items.Clear();
            lvResultsInAudio.BeginUpdate();

            //foreach (Hit hit in hits)
            int len = pageSize + pageSize * pageNum;

            if (len > hits.Count)
            {
                len = hits.Count;
            }
            for (int i = pageSize * pageNum; i < len; i++)
            {
                try
                {
                    string ext = hits[i].Get("type");
                    if (!lvResultsInAudio.SmallImageList.Images.ContainsKey(ext)) //if a key with that ext doesn't exist
                    {
                        if (Win32Helper.PathExist(hits[i].Get("path")))
                        {
                            Icon ic = Win32Helper.Extract(hits[i].Get("path"));
                            if (ic != null)
                            {
                                lvResultsInAudio.SmallImageList.Images.Add(ext, ic);
                            }
                        }
                    }
                    string         size = hits[i].Get("size").TrimStart('0');
                    ListViewItemEx item = new ListViewItemEx(new string[] { hits[i].Get("name"), hits[i].Get("path"), size == "" ? "0" : size, hits[i].Get("length"), DateTime.ParseExact(hits[i].Get("cdate"), "yyyyMMdd", null).ToString("dd/MM/yyyy"), hits[i].Get("title"), hits[i].Get("album"), hits[i].Get("artist"), hits[i].Get("comment"), hits[i].Get("track"), hits[i].Get("genre"), hits[i].Get("year"), GlobalData.FileTypes[hits[i].Get("type")] });
                    // PaintListViewItem(ref item, i);
                    item.ImageKey = ext;
                    lvResultsInAudio.Items.Add(item);
                }
                catch (Exception ex) {
                 #if Log
                    Console.WriteLine(ex);
#endif
                }
            }

            //set the colors
            Color c1 = Color.FromArgb(247, 247, 247);
            Color c2 = Color.White;
            int   ii = 0;
            foreach (ListViewItem lvi in lvResultsInAudio.Items)
            {
                foreach (ListViewItem.ListViewSubItem lvsi in lvi.SubItems)
                {
                    lvsi.BackColor = (ii & 1) == 0 ? c1 : c2;
                }
                ii++;
            }

            lvResultsInAudio.EndUpdate();
            lPageNumber.Text = "Results " + pageSize * pageNum + " - " + len + " " + queryStatistics;
        }
Exemplo n.º 2
0
        private void DisplayPage()
        {
            if (hits != null)
            {
                lvResultsInEmail.Items.Clear();
                lvResultsInEmail.BeginUpdate();

                int len = pageSize + pageSize * pageNum;
                if (len > hits.Count)
                {
                    len = hits.Count;
                }
                for (int i = pageSize * pageNum; i < len; i++)
                {
                    try
                    {
                        ListViewItemEx item = new ListViewItemEx(new string[] { hits[i].Get("subject"), hits[i].Get("from"), hits[i].Get("to") });// DateTime.ParseExact(hits[i].Get("date"), "yyyyMMdd", null).ToString("dd/MM/yyyy") });
                        lvResultsInEmail.Items.Add(item);
                    }
                    catch (Exception ex)
                    {
#if Log
                        Console.WriteLine(ex);
#endif
                    }
                }

                //set the colors
                Color c1 = Color.FromArgb(247, 247, 247);
                Color c2 = Color.White;
                int   ii = 0;
                foreach (ListViewItem lvi in lvResultsInEmail.Items)
                {
                    foreach (ListViewItem.ListViewSubItem lvsi in lvi.SubItems)
                    {
                        lvsi.BackColor = (ii & 1) == 0 ? c1 : c2;
                    }
                    ii++;
                }

                lvResultsInEmail.EndUpdate();
                lPageNumber.Text = "Results " + pageSize * pageNum + " - " + len + " " + queryStatistics;
            }
        }
        private void DisplayPage()
        {
            lvResultsInDocuments.Items.Clear();
            lvResultsInDocuments.BeginUpdate();

            int index = pageSize + pageSize * pageNum;

            if (index > hits.Count)
            {
                index = hits.Count;
            }
            for (int i = pageSize * pageNum; i < index; i++)
            {
                try
                {
                    string         size = hits[i].Get("size").TrimStart('0');
                    ListViewItemEx item = new ListViewItemEx(new string[] { hits[i].Get("name"), hits[i].Get("path"), size == "" ? "0" : size, DateTime.ParseExact(hits[i].Get("cdate"), "yyyyMMdd", null).ToString("dd/MM/yyyy"), hits[i].Get("companyname"), hits[i].Get("filedesc"), hits[i].Get("filever"), GlobalData.FileTypes[hits[i].Get("type")] });

                    string ext = hits[i].Get("type");
                    if (ext == ".exe" || ext == ".ico" || ext == "") //if exe or ico we must extract the icon
                    {
                        if (Win32Helper.PathExist(hits[i].Get("path")))
                        {
                            Icon ic = Win32Helper.Extract(hits[i].Get("path"));
                            if (ic != null)
                            {
                                lvResultsInDocuments.SmallImageList.Images.Add(ext, ic);
                            }
                        }
                        item.ImageIndex = lvResultsInDocuments.SmallImageList.Images.Count - 1;
                    }
                    else
                    {
                        if (!lvResultsInDocuments.SmallImageList.Images.ContainsKey(ext)) //if a key with that ext doesn't exist
                        {
                            if (Win32Helper.PathExist(hits[i].Get("path")))
                            {
                                Icon ic = Win32Helper.Extract(hits[i].Get("path"));
                                if (ic != null)
                                {
                                    lvResultsInDocuments.SmallImageList.Images.Add(ext, ic);
                                }
                            }
                        }
                        item.ImageKey = ext;
                    }
                    lvResultsInDocuments.Items.Add(item);
                }
                catch (Exception ex) {
                #if Log
                    Console.WriteLine(ex);
#endif
                }
            }
            //set the colors
            Color c1 = Color.FromArgb(247, 247, 247);
            Color c2 = Color.White;
            int   ii = 0;
            foreach (ListViewItem lvi in lvResultsInDocuments.Items)
            {
                foreach (ListViewItem.ListViewSubItem lvsi in lvi.SubItems)
                {
                    lvsi.BackColor = (ii & 1) == 0 ? c1 : c2;
                }
                ii++;
            }

            lvResultsInDocuments.EndUpdate();
            lPageNumber.Text = "Results " + pageSize * pageNum + " - " + index + " " + queryStatistics;
        }
        private void DisplayPage()
        {
            lvResultsInPicture.Items.Clear();
            lvResultsInPicture.BeginUpdate();

            //foreach (Hit hit in hits)
            int len = pageSize + pageSize * pageNum;
            if (len > hits.Count) len = hits.Count;
            for (int i = pageSize * pageNum; i < len; i++)
            {
                try
                {
                    string size = hits[i].Get("size").TrimStart('0');
                    ListViewItemEx item = new ListViewItemEx(new string[] { hits[i].Get("name"), hits[i].Get("path"), size == "" ? "0" : size, DateTime.ParseExact(hits[i].Get("cdate"), "yyyyMMdd", null).ToString("dd/MM/yyyy"), hits[i].Get("width") + " x " + hits[i].Get("height"), hits[i].Get("hres"), hits[i].Get("vres"), GlobalData.FileTypes[hits[i].Get("type")] });

                    string ext = hits[i].Get("type");
                    if (ext == ".exe" || ext == ".ico" || ext == "")
                    {
                        if (Win32Helper.PathExist(hits[i].Get("path")))
                        {
                            Icon ic = Win32Helper.Extract(hits[i].Get("path"));
                            if (ic != null)
                                lvResultsInPicture.SmallImageList.Images.Add(ext, ic);
                        }
                        item.ImageIndex = lvResultsInPicture.SmallImageList.Images.Count - 1;
                    }
                    else
                    {
                        if (!lvResultsInPicture.SmallImageList.Images.ContainsKey(ext)) //if a key with that ext doesn't exist
                        {
                            if (Win32Helper.PathExist(hits[i].Get("path")))
                            {
                                Icon ic = Win32Helper.Extract(hits[i].Get("path"));
                                if (ic != null)
                                    lvResultsInPicture.SmallImageList.Images.Add(ext, ic);
                            }
                        }
                        item.ImageKey = ext;
                    }

                    lvResultsInPicture.Items.Add(item);
                }
                catch (Exception ex) {
                #if Log
            Console.WriteLine(ex);
            #endif
                }
            }

            //set the colors
            Color c1 = Color.FromArgb(247, 247, 247);
            Color c2 = Color.White;
            int ii = 0;
            foreach (ListViewItem lvi in lvResultsInPicture.Items)
            {
                foreach (ListViewItem.ListViewSubItem lvsi in lvi.SubItems)
                    lvsi.BackColor = (ii & 1) == 0 ? c1 : c2;
                ii++;
            }

            lvResultsInPicture.EndUpdate();
            lPageNumber.Text = "Results " + pageSize * pageNum + " - " + len + " " + queryStatistics;
        }
        private void DisplayPage()
        {
            if (hits != null)
            {
                lvResultsInEmail.Items.Clear();
                lvResultsInEmail.BeginUpdate();

                int len = pageSize + pageSize * pageNum;
                if (len > hits.Count) len = hits.Count;
                for (int i = pageSize * pageNum; i < len; i++)
                {
                    try
                    {

                        ListViewItemEx item = new ListViewItemEx(new string[] { hits[i].Get("subject"), hits[i].Get("from"), hits[i].Get("to") });// DateTime.ParseExact(hits[i].Get("date"), "yyyyMMdd", null).ToString("dd/MM/yyyy") });
                        lvResultsInEmail.Items.Add(item);
                    }
                    catch (Exception ex)
                    {
            #if Log
            Console.WriteLine(ex);
            #endif
                    }
                }

                //set the colors
                Color c1 = Color.FromArgb(247, 247, 247);
                Color c2 = Color.White;
                int ii = 0;
                foreach (ListViewItem lvi in lvResultsInEmail.Items)
                {
                    foreach (ListViewItem.ListViewSubItem lvsi in lvi.SubItems)
                        lvsi.BackColor = (ii & 1) == 0 ? c1 : c2;
                    ii++;
                }

                lvResultsInEmail.EndUpdate();
                lPageNumber.Text = "Results " + pageSize * pageNum + " - " + len + " " + queryStatistics;
            }
        }