C# Class Objectivity.Test.Automation.Common.Helpers.FilesHelper

Class for handling downloading files
显示文件 Open project: ObjectivityBSS/Test.Automation Class Usage Examples

Public Properties

Property Type Description
Separator char

Public Methods

Method Description
CopyFile ( double waitTime, string oldName, string newName, string workingDirectory ) : string

Copy the file and check if file was copied with given timeout, shorten the name of file if needed be removing "_".

CopyFile ( double waitTime, string oldName, string newName, string oldSubFolder, string newSubFolder ) : string

Copy the file and check if file was copied with given timeout, shorten the name of file if needed be removing "_".

CountFiles ( string folder ) : int

Counts the files.

CountFiles ( string folder, System.IO.FileType type ) : int

Counts the files of given type.

GetAllFiles ( string folder ) : ICollection

Gets all files from folder.

GetAllFiles ( string folder, string postfixFilesName ) : ICollection

Gets all files from folder, use postfixFilesName in search pattern.

GetAllFilesFromAllSubFolders ( string folder ) : ICollection

Gets all files from all sub folders.

GetAllFilesFromAllSubFolders ( string folder, string postfixFilesName ) : ICollection

Gets all files from all sub folders, use postfixFilesName in search pattern.

GetFileByName ( string folder, string fileName ) : FileInfo

Get file by its name in given folder

GetFilesOfGivenType ( string folder, System.IO.FileType type ) : ICollection

Gets the files of given type.

GetFilesOfGivenType ( string folder, System.IO.FileType type, string postfixFilesName ) : ICollection

Gets the files of given type, use postfixFilesName in search pattern.

GetFilesOfGivenTypeFromAllSubFolders ( string folder, System.IO.FileType type ) : ICollection

Gets the files of given type from all sub folders.

GetFilesOfGivenTypeFromAllSubFolders ( string folder, System.IO.FileType type, string postfixFilesName ) : ICollection

Gets the files of given type from all sub folders, use postfixFilesName in search pattern.

GetFolder ( string appConfigValue, string currentFolder ) : string

Gets the folder from app.config as value of given key.

GetLastFile ( string folder ) : FileInfo

Gets the last file.

GetLastFile ( string folder, System.IO.FileType type ) : FileInfo

Gets the last file of given type.

RenameFile ( double waitTime, string oldName, string newName, string subFolder ) : string

Rename the file and check if file was renamed with given timeout, shorten the name of file if needed be removing "_".

RenameFile ( string oldName, string newName, string subFolder, System.IO.FileType type ) : string

Rename the file of given type and check if file was renamed with ShortTimeout, shorten the name of file if needed be removing "_".

ReturnFileExtension ( System.IO.FileType type ) : string

Returns the file extension.

WaitForFile ( double waitTime, int filesNumber, string folder ) : void

Waits for file for given timeout till number of files increase in sub folder.

WaitForFile ( int filesNumber, string folder ) : void

Waits for file with LongTimeout till number of files increase in sub folder.

WaitForFileOfGivenName ( double waitTime, string filesName, string folder ) : void

Waits for file with given name with given timeout.

WaitForFileOfGivenName ( string filesName, string folder ) : void

Waits for file of given name with LongTimeout

WaitForFileOfGivenType ( System.IO.FileType type, double waitTime, int filesNumber, string folder ) : void

Waits for file of given type for given timeout till number of files increase in sub folder.

WaitForFileOfGivenType ( System.IO.FileType type, int filesNumber, string folder ) : void

Waits for file of given type for LongTimeout till number of files increase in sub folder.

Method Details

CopyFile() public static method

Copy the file and check if file was copied with given timeout, shorten the name of file if needed be removing "_".
public static CopyFile ( double waitTime, string oldName, string newName, string workingDirectory ) : string
waitTime double Timeout for checking if file was removed
oldName string The old name.
newName string The new name.
workingDirectory string The working folder.
return string

CopyFile() public static method

Copy the file and check if file was copied with given timeout, shorten the name of file if needed be removing "_".
public static CopyFile ( double waitTime, string oldName, string newName, string oldSubFolder, string newSubFolder ) : string
waitTime double Timeout for checking if file was removed
oldName string The old name.
newName string The new name.
oldSubFolder string The old subFolder.
newSubFolder string The new subFolder.
return string

CountFiles() public static method

Counts the files.
public static CountFiles ( string folder ) : int
folder string The folder.
return int

CountFiles() public static method

Counts the files of given type.
public static CountFiles ( string folder, System.IO.FileType type ) : int
folder string The folder.
type System.IO.FileType The type.
return int

GetAllFiles() public static method

Gets all files from folder.
public static GetAllFiles ( string folder ) : ICollection
folder string The folder.
return ICollection

GetAllFiles() public static method

Gets all files from folder, use postfixFilesName in search pattern.
public static GetAllFiles ( string folder, string postfixFilesName ) : ICollection
folder string The folder.
postfixFilesName string Postfix name of files for search pattern.
return ICollection

GetAllFilesFromAllSubFolders() public static method

Gets all files from all sub folders.
public static GetAllFilesFromAllSubFolders ( string folder ) : ICollection
folder string The folder.
return ICollection

GetAllFilesFromAllSubFolders() public static method

Gets all files from all sub folders, use postfixFilesName in search pattern.
public static GetAllFilesFromAllSubFolders ( string folder, string postfixFilesName ) : ICollection
folder string The folder.
postfixFilesName string Postfix name of files for search pattern.
return ICollection

GetFileByName() public static method

Get file by its name in given folder
public static GetFileByName ( string folder, string fileName ) : FileInfo
folder string The folder
fileName string The file name
return System.IO.FileInfo

GetFilesOfGivenType() public static method

Gets the files of given type.
public static GetFilesOfGivenType ( string folder, System.IO.FileType type ) : ICollection
folder string The folder.
type System.IO.FileType The type.
return ICollection

GetFilesOfGivenType() public static method

Gets the files of given type, use postfixFilesName in search pattern.
public static GetFilesOfGivenType ( string folder, System.IO.FileType type, string postfixFilesName ) : ICollection
folder string The folder.
type System.IO.FileType The type of files.
postfixFilesName string Postfix name of files for search pattern.
return ICollection

GetFilesOfGivenTypeFromAllSubFolders() public static method

Gets the files of given type from all sub folders.
public static GetFilesOfGivenTypeFromAllSubFolders ( string folder, System.IO.FileType type ) : ICollection
folder string The folder.
type System.IO.FileType The type of files.
return ICollection

GetFilesOfGivenTypeFromAllSubFolders() public static method

Gets the files of given type from all sub folders, use postfixFilesName in search pattern.
public static GetFilesOfGivenTypeFromAllSubFolders ( string folder, System.IO.FileType type, string postfixFilesName ) : ICollection
folder string The folder.
type System.IO.FileType The type of files.
postfixFilesName string Postfix name of files for search pattern.
return ICollection

GetFolder() public static method

Gets the folder from app.config as value of given key.
public static GetFolder ( string appConfigValue, string currentFolder ) : string
appConfigValue string The application configuration value.
currentFolder string Directory where assembly files are located
return string

GetLastFile() public static method

Gets the last file.
public static GetLastFile ( string folder ) : FileInfo
folder string The folder.
return System.IO.FileInfo

GetLastFile() public static method

Gets the last file of given type.
public static GetLastFile ( string folder, System.IO.FileType type ) : FileInfo
folder string The folder.
type System.IO.FileType The type of file.
return System.IO.FileInfo

RenameFile() public static method

Rename the file and check if file was renamed with given timeout, shorten the name of file if needed be removing "_".
public static RenameFile ( double waitTime, string oldName, string newName, string subFolder ) : string
waitTime double Timeout for checking if file was removed
oldName string The old name.
newName string The new name.
subFolder string The subFolder.
return string

RenameFile() public static method

Rename the file of given type and check if file was renamed with ShortTimeout, shorten the name of file if needed be removing "_".
public static RenameFile ( string oldName, string newName, string subFolder, System.IO.FileType type ) : string
oldName string The old name.
newName string The new name.
subFolder string The subFolder.
type System.IO.FileType The type of file.
return string

ReturnFileExtension() public static method

Returns the file extension.
public static ReturnFileExtension ( System.IO.FileType type ) : string
type System.IO.FileType The type.
return string

WaitForFile() public static method

Waits for file for given timeout till number of files increase in sub folder.
public static WaitForFile ( double waitTime, int filesNumber, string folder ) : void
waitTime double Wait timeout
filesNumber int The initial files number.
folder string The folder.
return void

WaitForFile() public static method

Waits for file with LongTimeout till number of files increase in sub folder.
public static WaitForFile ( int filesNumber, string folder ) : void
filesNumber int The initial files number.
folder string The folder.
return void

WaitForFileOfGivenName() public static method

Waits for file with given name with given timeout.
public static WaitForFileOfGivenName ( double waitTime, string filesName, string folder ) : void
waitTime double Wait timeout
filesName string Name of the files.
folder string The folder.
return void

WaitForFileOfGivenName() public static method

Waits for file of given name with LongTimeout
public static WaitForFileOfGivenName ( string filesName, string folder ) : void
filesName string Name of the files.
folder string The folder.
return void

WaitForFileOfGivenType() public static method

Waits for file of given type for given timeout till number of files increase in sub folder.
public static WaitForFileOfGivenType ( System.IO.FileType type, double waitTime, int filesNumber, string folder ) : void
type System.IO.FileType The type of file.
waitTime double Wait timeout
filesNumber int The initial files number.
folder string The folder.
return void

WaitForFileOfGivenType() public static method

Waits for file of given type for LongTimeout till number of files increase in sub folder.
public static WaitForFileOfGivenType ( System.IO.FileType type, int filesNumber, string folder ) : void
type System.IO.FileType The type.
filesNumber int The files number.
folder string The folder.
return void

Property Details

Separator public_oe static_oe property

Directory separator
public static char Separator
return char