📄 conafilesystem.cs
字号:
//=========================================================
//=========================================================
// CONARenameFolder
//
// Description:
// CONARenameFolder renames a folder on the device. Only an
// empty folder can be renamed at the moment.
//
// Parameters:
// hFSHandle [in] File System handle
// pstrFolderName [in] Folder name string.
// pstrFolderNameNew [in] Folder's new name string.
// pstrTargetPath [in] Target path. If the path is NULL,
// current folder is used.
//
// Return values:
// CONA_OK
// ECONA_INVALID_HANDLE
// ECONA_INVALID_PARAMETER
// ECONA_CONNECTION_BUSY
// ECONA_CONNECTION_LOST
// ECONA_INVALID_DATA_DEVICE
// ECONA_CURRENT_FOLDER_NOT_FOUND
// ECONA_FOLDER_PATH_TOO_LONG
// ECONA_FOLDER_ALREADY_EXIST
// ECONA_FOLDER_NOT_FOUND
// ECONA_FOLDER_NOT_EMPTY
// ECONA_FOLDER_NO_PERMISSION
// ECONA_CANCELLED
// ECONA_FAILED_TIMEOUT
// ECONA_UNKNOWN_ERROR_DEVICE
// ECONA_NOT_INITIALIZED
// ECONA_UNKNOWN_ERROR
//
[DllImport("ConnAPI", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int CONARenameFolder(
int hFSHandle,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFolderName,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFolderNameNew,
[MarshalAs(UnmanagedType.LPWStr)] string pstrTargetPath
);
//=========================================================
//
//=========================================================
// CONAGetFolderInfo
//
// Description:
// CONAGetFolderInfo sets required information to
// CONAPI_FOLDER_CONTENT structure. The Connectivity API-user
// MUST initialize the CONAPI_FOLDER_CONTENT structure before
// calling this function!
//
// When option CONA_GET_FOLDER_INFO is used, it adds the next
// data to CONAPI_FOLDER_CONTENT structure:
// CONAPI_FOLDER_INFO2 structure from target folder. The
// number of files and folders in target folder and total
// size of folder content are not set.
//
// When option CONA_GET_FOLDER_CONTENT is used, it adds the
// next data to CONAPI_FOLDER_CONTENT structure:
// CONAPI_FOLDER_INFO2 structure from target folder. The
// number of files and folders in target folder and total
// size of folder content are not set.
// CONAPI_FILE_INFO structure(s) from file(s), which
// are in target folder.
// CONAPI_FOLDER_CONTENT structure(s) from sub folder(s),
// which are in target folder. Every structure includes
// only CONAPI_FOLDER_INFO2 structure.
//
// When option CONA_GET_FOLDER_AND_SUB_FOLDERS_CONTENT is used,
// it adds the next data to CONAPI_FOLDER_CONTENT structure:
// CONAPI_FILE_INFO structure(s) from file(s), which
// are in target folder.
// CONAPI_FOLDER_CONTENT structure(s) from sub folder(s),
// which are in target folder. Every structure includes
// CONAPI_FOLDER_INFO2 structure. If sub folder(s) contain
// file(s) or/and folder(s) those are also included.
//
// Allocated memory must be freed by calling the
// CONAFreeFolderContentStructure function.
//
//
// Parameters:
// hFSHandle [in] File System handle
// dwOptions [in] Get folder info options:
// CONAPI_ALLOW_TO_USE_CACHE: If the cached folder data
// is available, it will be used. This value is
// optional and can be used with other values.
// CONA_COMPARE_AND_UPDATE_IF_NEEDED: Compare given folder
// content structure and returns one of the value:
// CONA_OK: Structure is not updated because it
// is up-to-date.
// CONA_OK_UPDATED_MEMORY_VALUES: Structure is updated
// because of free, used and total memory values
// are updated.
// CONA_OK_UPDATED_MEMORY_AND_FILES: Structure is
// updated because of file(s) and memory values
// are updated.
// CONA_OK_UPDATED: Structure is updated, unknown reason.
// This value is optional and can be used with other values.
// The next values must be used one at a time:
// CONA_GET_FOLDER_INFO
// CONA_GET_FOLDER_CONTENT
// CONA_GET_FOLDER_AND_SUB_FOLDERS_CONTENT
// pstrFolderName [in] Name of target folder or drive. This value
// can be NULL. If target folder is device’s root folder, value
// must include an empty string or NULL and target (or the
// current folder) path must be “\\”.
// pstrTargetPath [in] Target path. If the path is NULL or empty
// string, the current folder is used.
// pFolderContent [out] Pointer of the CONAPI_FOLDER_CONTENT
// structure. Connectivity API-user MUST initializes structure
// before of call this function!
// pFSFolderInfoNotify [in] Pointer to a callback function. The
// Connectivity API calls this function only when option
// CONA_GET_FOLDER_AND_SUB_FOLDERS_CONTENT is used. This value
// is option and must be NULL if not used.
//
// Return values:
// CONA_OK
// CONA_OK_UPDATED_MEMORY_VALUES
// CONA_OK_UPDATED_MEMORY_AND_FILES
// CONA_OK_UPDATED
// ECONA_INVALID_HANDLE
// ECONA_INVALID_PARAMETER
// ECONA_INVALID_POINTER
// ECONA_CONNECTION_BUSY
// ECONA_CONNECTION_LOST
// ECONA_INVALID_DATA_DEVICE
// ECONA_CURRENT_FOLDER_NOT_FOUND
// ECONA_FOLDER_NOT_FOUND
// ECONA_FOLDER_PATH_TOO_LONG
// ECONA_FOLDER_NAME_INVALID
// ECONA_FOLDER_NO_PERMISSION
// ECONA_CANCELLED
// ECONA_FAILED_TIMEOUT
// ECONA_UNKNOWN_ERROR_DEVICE
// ECONA_NOT_INITIALIZED
// ECONA_NOT_ENOUGH_MEMORY
// ECONA_UNKNOWN_ERROR
//
[DllImport("ConnAPI", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int CONAGetFolderInfo(
int hFSHandle,
int iOptions,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFolderName,
[MarshalAs(UnmanagedType.LPWStr)] string pstrTargetPath,
System.IntPtr pFolderContent,
[MarshalAs(UnmanagedType.FunctionPtr)] CONADefinitions.FSFolderInfoCallbackDelegate pFSFolderInfoNotify
);
//=========================================================
//
//=========================================================
// CONAMoveFolder
//
// Description:
// CONAMoveFolder moves a folder from the source folder to destination folder.
//
// If the device is supporting move a folder function, CONAPI_FS_EXTENDED_OPERATIONS
// value is set in CONAPI_DEVICE_GEN_INFO structure. For more details, see
// CONAGetDeviceInfo function of Device Management API. NOTE: This function is
// not supported with all devices!
//
// Note: The function stops when the first error occurs. No rollback option!
// All moved items stay in destination folder if the error occurs.
//
// Parameters:
// hFSHandle [in] File System handle
// dwOptions [in] Option:
// CONA_DIRECT_PHONE_TO_PHONE: Moves a folder inside the
// device. Must be used.
// CONA_RENAME: Renames the folder if the same
// named folder is already exists in the destination path.
// pstrSource [in] The path to source folder to be moved. If value
// inludes only the source folder name, the current folder path is used.
// pstrDestination [in] The path where the folder is to be moved. If the
// destination path ends with path separator ('\'), it is assumed that
// destination folder is exist and source folder to be moved to
// destination folder. Otherwise, it is assumed that destionation folder
// is not to exist and content of source folder to be moved to created
// destination folder.
// pParam [in] Reserved for future use. Must be NULL.
//
//
// Return values:
// CONA_OK
// ECONA_INVALID_HANDLE
// ECONA_INVALID_PARAMETER
// ECONA_INVALID_POINTER
// ECONA_CONNECTION_BUSY
// ECONA_CONNECTION_LOST
// ECONA_INVALID_DATA_DEVICE
// ECONA_MEMORY_FULL
// ECONA_CURRENT_FOLDER_NOT_FOUND
// ECONA_FOLDER_PATH_TOO_LONG
// ECONA_FOLDER_NOT_FOUND
// ECONA_FOLDER_NO_PERMISSION
// ECONA_FOLDER_NAME_INVALID
// ECONA_FOLDER_ALREADY_EXIST
// ECONA_CANCELLED
// ECONA_NOTHING_TO_CANCEL
// ECONA_FAILED_TIMEOUT
// ECONA_NOT_SUPPORTED_DEVICE
// ECONA_UNKNOWN_ERROR_DEVICE
// ECONA_NOT_INITIALIZED
// ECONA_NOT_ENOUGH_MEMORY
// ECONA_UNKNOWN_ERROR
//
[DllImport("ConnAPI", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int FunctionCONAMoveFolder(
int hFSHandle,
int iOptions,
[MarshalAs(UnmanagedType.LPWStr)] string pstrSource,
[MarshalAs(UnmanagedType.LPWStr)] string pstrDestination,
System.IntPtr pParam
);
//=========================================================
//
//=========================================================
// CONACopyFolder
//
// Description:
// CONACopyFolder copies a folder from the source folder to destination folder.
//
// If the device is supporting copy a folder function, CONAPI_FS_EXTENDED_OPERATIONS
// value is set in CONAPI_DEVICE_GEN_INFO structure. For more details, see
// CONAGetDeviceInfo function of Device Management API. NOTE: This function is
// not supported with all devices!
//
// Note: The function stops when the first error occurs. No rollback option!
// All copied items stay in destination folder if the error occurs.
//
// Parameters:
// hFSHandle [in] File System handle
// dwOptions [in] Options:
// CONA_DIRECT_PHONE_TO_PHONE: Copies the folder inside the
// device. Must be used.
// CONA_RENAME: Renames the folder if the same
// named folder is already exists in the destination path.
// pstrSource [in] The path to the source folder to be copied. If value
// inludes only the source folder name, the current folder path is used.
// pstrDestination [in] The path where the folder is to be copied. If the
// destination path ends with path separator ('\'), it is assumed that
// destination folder is exists and source folder to be copied to
// destination folder. Otherwise, it is assumed that destionation folder
// is not to exist and content of source folder to be copied to created
// destination folder.
// pParam [in] Reserved for future use. Must be NULL.
//
// Return values:
// CONA_OK
// ECONA_INVALID_HANDLE
// ECONA_INVALID_PARAMETER
// ECONA_INVALID_POINTER
// ECONA_CONNECTION_BUSY
// ECONA_CONNECTION_LOST
// ECONA_MEMORY_FULL
// ECONA_CURRENT_FOLDER_NOT_FOUND
// ECONA_FOLDER_PATH_TOO_LONG
// ECONA_FOLDER_NOT_FOUND
// ECONA_FOLDER_NO_PERMISSION
// ECONA_FOLDER_NAME_INVALID
// ECONA_FOLDER_ALREADY_EXIST
// ECONA_CANCELLED
// ECONA_NOTHING_TO_CANCEL
// ECONA_FAILED_TIMEOUT
// ECONA_NOT_SUPPORTED_DEVICE
// ECONA_UNKNOWN_ERROR_DEVICE
// ECONA_NOT_INITIALIZED
// ECONA_NOT_ENOUGH_MEMORY
// ECONA_UNKNOWN_ERROR
//
[DllImport("ConnAPI", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int CONACopyFolder(
int hFSHandle,
int iOptions,
[MarshalAs(UnmanagedType.LPWStr)] string pstrSource,
[MarshalAs(UnmanagedType.LPWStr)] string pstrDestination,
System.IntPtr pParam
);
//=========================================================
//
//=========================================================
// CONAGetFileInfo
//
// Description:
// CONAGetFileInfo returns the file data in CONAPI_FILE_INFO
// structure. If the cached file data is available that will be used.
// Allocated memory MUST be freed by calling the
// CONAFreeFileInfoStructure function.
//
// Parameters:
// hFSHandle [in] File System handle
// pstrFileName [in] File name
// pFileInfo [out] Pointer to the structure receiving
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -