Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            #if !DEBUG_
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            string initfolder = Config_.AppSettings.Settings["initialfolder"].Value;
            if (initfolder != null)
                fbd.SelectedPath = initfolder;

            if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;

            Config_.AppSettings.Settings["initialfolder"].Value = fbd.SelectedPath;
            Config_.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");

            RootDirectory_ = new DSDir(fbd.SelectedPath);
            #else
            RootDirectory_ = new DSDir("D:/Asztal/temp");
            #endif
            ChartDrawer_ = new PieChartDrawer(RootDirectory_);
            CurrentDirectory_ = RootDirectory_;
            System.Diagnostics.Debug.WriteLine(DSDirHelper.PrintDSDir(CurrentDirectory_));

            ChartDrawer_.DrawChart(panel1);
            ChartDrawer_.DrawLegend(dataGridView1);
        }
Exemple #2
0
        public DSDir(string path, DSDir parent = null)
        {
            System.Diagnostics.Debug.WriteLine("scanning: " + path);
            Subdirs = new List<DSDir>();
            Files = new List<DSFile>();
            this.Parent = parent;
            if (parent == null)
            {
                this.Basepath = path;
                this.Shortpath = "";
            }
            else
            {
                this.Basepath = parent.Basepath;
                this.Shortpath = path.Substring(this.Basepath.Length);
            }

            string[] subdirs_list = Directory.GetDirectories(path);
            string[] files_list = Directory.GetFiles(path);
            foreach (var f in files_list)
            {
                this.Files.Add(new DSFile(f));
            }
            foreach (var sd in subdirs_list)
            {
                this.Subdirs.Add(new DSDir(sd, this));
            }

            FilesSize = 0;
            foreach (var f in Files)
            {
                FilesSize += f.size;
            }
            SubdirectoriesSize = 0;
            foreach (var sd in Subdirs)
            {
                SubdirectoriesSize += sd.Size;
            }
        }
Exemple #3
0
 private void RefreshCurrentDir(DSDir newDir)
 {
     CurrentDirectory_ = newDir;
     ChartDrawer_.CurrentDirectory = CurrentDirectory_;
 }
Exemple #4
0
        private void OpenFolder(DSDir dir)
        {
            if (dir == null)
                return;
            if (!Directory.Exists(dir.Path))
                return;

            try
            {
                Process.Start(dir.Path);
            }
            catch (Exception)
            {

            }
        }
Exemple #5
0
 private void NavigateDown(DSDir directory)
 {
     RefreshCurrentDir(directory);
     ChartDrawer_.DrawChart(panel1);
     ChartDrawer_.DrawLegend(dataGridView1);
 }
Exemple #6
0
 static List<string> PrintDDir_inner(DSDir dir)
 {
     List<string> retval = new List<string>();
     retval.Add("<folder " + dir.Path + " - " + SizeToString(dir.Size)+ ">");
     foreach (var d in dir.Subdirs)
     {
         List<string> dlist = PrintDDir_inner(d);
         foreach (var line in dlist)
         {
             retval.Add(Delim + line);
         }
     }
     retval.Add("</folder>");
     return retval;
 }
Exemple #7
0
 public static string PrintDSDir(DSDir dir)
 {
     string outstr = "";
     List<string> print_inner = PrintDDir_inner(dir);
     foreach (var line in print_inner)
     {
         outstr = outstr + line + "\n";
     }
     return outstr;
 }