niedziela, 18 marca 2018

A class that specifies the properties and attributes of the file (C++ Builder)

#include <vcl.h>
#include <System.hpp>
#include <classes.hpp>

class info_File
{
private:
TListBox *tLBox;
TSystemTime time_System1;
TSystemTime time_System2;
UnicodeString file_Name;
UnicodeString directory_Name;
UnicodeString drive_Symbol;
UnicodeString extract_File;
UnicodeString extract_Path;
UnicodeString start_Date;
int size_Byte;
int number_Attr;
UnicodeString last_Modification;
TSearchRec rec_Info;
public:
info_File(TListBox *tempLBox,UnicodeString file)
{
file_Name=file;
tLBox=tempLBox;
}
UnicodeString write_file_Name()
{

return file_Name;
}
UnicodeString write_directory_Name()
{
directory_Name=ExtractFileDir(file_Name);
return directory_Name;
}
UnicodeString write_drive_Symbol()
{
   drive_Symbol=ExtractFileDrive(file_Name);
   return drive_Symbol;
}
UnicodeString write_extract_File()
{
extract_File=ExtractFileExt(file_Name);
return extract_File;
}
UnicodeString write_extract_Path()
{
extract_Path=ExtractRelativePath(GetCurrentDir(),file_Name);
return extract_Path;
}
int write_size_Byte()
{
size_Byte=rec_Info.Size;
return size_Byte;
}

int write_number_Attribute()
{
number_Attr=rec_Info.Attr;
return number_Attr;
}
UnicodeString write_start_Date()
{
FileTimeToSystemTime(&(rec_Info.FindData.ftCreationTime),&time_System1);
SystemTimeToTzSpecificLocalTime(NULL,&time_System1,&time_System2);
start_Date=DateTimeToStr(SystemTimeToDateTime(time_System2));
return start_Date;
}
UnicodeString write_last_Modification()
{
last_Modification=DateTimeToStr(FileDateToDateTime(rec_Info.Time));
return last_Modification;
}
void RAPORT()
{
tLBox->Items->Add("File name: "+write_file_Name());
tLBox->Items->Add("Directory name: "+write_directory_Name());
tLBox->Items->Add("Drive: "+write_drive_Symbol());
tLBox->Items->Add("Extract file: "+write_extract_File());
tLBox->Items->Add("Path: "+write_extract_Path());
tLBox->Items->Add("Bytes: - "+IntToStr(write_size_Byte()));
tLBox->Items->Add("Attributes: "+IntToStr(write_number_Attribute()));
tLBox->Items->Add("Start job: "+write_start_Date());
tLBox->Items->Add("Last modification: "+write_last_Modification());

}




};

Brak komentarzy:

Prześlij komentarz