|
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.IO;
namespace ExtendedWebGallery
{
[DefaultPropertyAttribute("Name")]
public class CPropDir : CProp
{
private string _dir;
private int _FileCount;
[CategoryAttribute("File Information"), DescriptionAttribute("DirName"), ReadOnly(true)]
public string DirName
{
get
{
return _dir;
}
set
{
_dir = value;
}
}
[CategoryAttribute("File Information"), DescriptionAttribute("FileCount"), ReadOnly(true)]
public int FileCount
{
get
{
return _FileCount;
}
set
{
_FileCount = value;
}
}
public CPropDir()
{
}
public override void setfile(string filename)
{
if (Directory.Exists(filename))
{
DirName = filename;//fi.Name;
base.setfile(filename);
Lenght = 0;
FileCount = 0;
string[] files = Directory.GetFiles(filename);
// Count Directory size
foreach (string filepath in files)
{
FileInfo fi = new FileInfo(filepath);
//Lenght += fi.Length; // Wrong, count only files
FileCount++;
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm an electronic engeneer form Genoa.
I like very much dotnet and C#. I've developed some works like an html gallery generator, a graphic formula viewer (user defined), a webcam grabber and html gallery generator, a little framework for image processing, an image resizer, elaboration in batch and some other application tool.
Actually I'm working in VC++ 6 MFC, but I hope that my future is .net !!!
Some of my works are downloadable at:
http://www.solchiere.it
Lorenzo Banderali