Exemple #1
0
        public Form3(string ar, string tag, string watido)
        {
            iDo             = watido;
            MaximizeBox     = false;
            FormBorderStyle = FormBorderStyle.Fixed3D;
            InitializeComponent();
            fi = new WorkWithFiles();
            ImageList imageListSmall = new ImageList();

            imageListSmall.Images.Add(Bitmap.FromFile("C:\\file.ico"));
            imageListSmall.Images.Add(Bitmap.FromFile("C:\\papka.ico"));
            imageListSmall.Images.Add(Bitmap.FromFile("C:\\Hard-Drive.png"));
            imageListSmall.ImageSize = new Size(32, 32);
            listView1.LargeImageList = imageListSmall;
            fi = new WorkWithFiles();
            if (tag == "file")
            {
                fi.setP(Path.GetDirectoryName(ar));
            }
            else
            {
                fi.obnull();
            }
            updateList();
        }
Exemple #2
0
        protected void updateList()
        {
            if (fi.getP() == "" || fi.getP().Length <= 2)
            {
                listView1.Items.Clear();
                DriveInfo[] drives = DriveInfo.GetDrives();
                foreach (DriveInfo i in drives)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.ImageIndex = 2;
                    lvi.Text       = i.Name;
                    lvi.Tag        = "directory";
                    listView1.Items.Add(lvi);
                }
                fi.obnull();
                richTextBox1.Text = "DISKS";
                return;
            }
            try
            {
                listView1.Items.Clear();

                DirectoryInfo   dInf = new DirectoryInfo(fi.getP());
                DirectoryInfo[] dMas = dInf.GetDirectories();
                FileInfo[]      fMas = dInf.GetFiles();

                foreach (DirectoryInfo i in dMas)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.ImageIndex = 1;
                    lvi.Text       = i.Name;
                    lvi.Tag        = "directory";
                    listView1.Items.Add(lvi);
                }

                foreach (FileInfo i in fMas)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.ImageIndex = 0;
                    lvi.Text       = i.Name;
                    lvi.Tag        = "file";
                    listView1.Items.Add(lvi);
                }
                richTextBox1.Text = fi.getP();
            }
            catch (Exception) { }
        }
Exemple #3
0
 public void obnullFi()
 {
     fi.obnull();
 }