| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- unit DirectoryService;
- interface
- uses
- Classes, SysUtils;
- type
- TDirectoryService = class
- private
- public
- function GetUserDir: string;
- function GetHeadImageDir: string;
- function GetCustomFaceDir: string;
- function GetReceivedFaceDir: string;
- function GetCacheFaceDir: string;
- function GetDownloadFileDir: string;
- function GetFileExtImagesDir: string;
- function GetUserInformationDir: string;
- function GetBackgroundDir: string;
- class function GetService: TDirectoryService; static;
- end;
- implementation
- uses
- UsersService, Forms, RealICQUtility, CurrentContentService;
- var
- ADirectoryService: TDirectoryService;
- function TDirectoryService.GetUserDir: string;
- var
- FilePath: string;
- ALoginName: string;
- begin
- FilePath := ExtractFilePath(Application.ExeName) + 'Users\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- ALoginName := TRealICQUtility.ClearCenterServerID(TCurrentContentService.GetService.GetMe.LoginName);
- FilePath := FilePath + ALoginName + '\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetDownloadFileDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetUserDir + 'DownloadFiles\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetFileExtImagesDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetUserDir + 'FileExtImages\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetCacheFaceDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetCustomFaceDir + 'CacheFaces\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetReceivedFaceDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetUserDir + 'ReceivedFaces\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetCustomFaceDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetUserDir + 'MyFaces\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetBackgroundDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetUserDir + 'BackGroundImages\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetHeadImageDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetUserDir + 'HeadImages\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- function TDirectoryService.GetUserInformationDir: String;
- var
- FilePath: string;
- begin
- FilePath := GetUserDir + 'UserInformations\';
- if not DirectoryExists(FilePath) then CreateDir(FilePath);
- Result := FilePath;
- end;
- class function TDirectoryService.GetService: TDirectoryService;
- begin
- if ADirectoryService = nil then
- ADirectoryService := TDirectoryService.Create;
- Result := ADirectoryService;
- end;
- initialization
- finalization
- if ADirectoryService <> nil then
- FreeAndNil(ADirectoryService);
- end.
|