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.