📄 conafilesystem.cs
字号:
// 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_CANCELLED
// ECONA_FAILED_TIMEOUT
// ECONA_UNKNOWN_ERROR_DEVICE
// ECONA_NOT_INITIALIZED
// ECONA_NOT_ENOUGH_MEMORY
// ECONA_UNKNOWN_ERROR
// ECONA_FOLDER_PATH_TOO_LONG
// ECONA_FOLDER_NAME_INVALID_DEVICE
// ECONA_FOLDER_NO_PERMISSION
//
[DllImport("ConnAPI", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int CONAGetFileInfo(
int hFSHandle,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFileName,
System.IntPtr pFileInfo,
[MarshalAs(UnmanagedType.LPWStr)] string pstrTargetPath
);
//=========================================================
//=========================================================
// CONADeleteFile
//
// Description:
// CONADeleteFile deletes a file from the device's folder.
// Note: No rollback option! Deleted data cannot be restored!
//
// Parameters:
// hFSHandle [in] File System handle
// pstrFileName [in] File name
// pstrTargetPath [in] Target path. If the path is NULL,
// the 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_FILE_NOT_FOUND
// ECONA_FILE_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 CONADeleteFile(
int hFSHandle,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFileName,
[MarshalAs(UnmanagedType.LPWStr)] string pstrTargetPath
);
//=========================================================
//=========================================================
// CONAMoveFile
//
// Description:
// CONAMoveFile copy file to target folder on PC or Device
// from Device or PC source folder and removes a file from
// the source folder on the Device or PC.
//
// Note: No rollback option! If an error occurs during the
// execution of the command (e.g. connection lost: file from
// target folder will be deleted if it is changed), the
// changes that have been already made are not cancelled.
//
// If the current folder is used, the path to the device's
// source or target folder does not need to be set. PC side
// path can also include the target/source file name. If path
// to device's target or source folder is given, it cannot
// include file name.
//
//
// Parameters:
// hFSHandle [in] File System handle
//
// dwOptions [in] Direction options:
// CONA_DIRECT_PHONE_TO_PC: Moves a file from the device to the PC.
// CONA_DIRECT_PC_TO_PHONE: Moves a file from the PC to the device.
// CONA_DIRECT_PHONE_TO_PHONE: Moves a file inside the device.
// Other option:
// CONA_OVERWRITE: Moves the file even if the target folder
// contains a file of the same name. The file will be replaced.
//
// pstrFileName [in] File name. With direction options:
// CONA_DIRECT_PC_TO_PHONE and CONA_DIRECT_PHONE_TO_PC: The value can
// be NULL, if the file name is given with the PC path.
// CONA_DIRECT_PHONE_TO_PHONE: The value must include the file name.
//
// pstrSourcePath [in] Source folder path. With direction options:
// CONA_DIRECT_PHONE_TO_PHONE and CONA_DIRECT_PHONE_TO_PC: The value
// can be NULL, if the current folder folder is used.
// CONA_DIRECT_PC_TO_PHONE: The value can also include the source
// file name. (See *1)
//
// pstrTargetPath [in] Target (destination) folder path. With direction options:
// CONA_DIRECT_PHONE_TO_PC and CONA_DIRECT_PHONE_TO_PHONE: The value
// can also include the target file name. (See *1).
// CONA_DIRECT_PC_TO_PHONE: The value can be NULL, if the current
// folder folder is used.
//
// *1) If the path is given without a file name, the last chracter must be
// a backslash ('\'). Otherwise the Connectivity API will assume that path
// includes the target/source file name.
//
// 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_NO_PERMISSION_ON_PC
// ECONA_FOLDER_NAME_INVALID
// ECONA_FILE_TOO_BIG_DEVICE
// ECONA_FILE_NAME_INVALID
// ECONA_FILE_NAME_TOO_LONG
// ECONA_FILE_NOT_FOUND
// ECONA_FILE_ALREADY_EXIST
// ECONA_FILE_COPYRIGHT_PROTECTED
// ECONA_FILE_NO_PERMISSION
// ECONA_FILE_NO_PERMISSION_ON_PC
// ECONA_FILE_BUSY
// ECONA_FILE_TYPE_NOT_SUPPORTED
// ECONA_FILE_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 CONAMoveFile(
int hFSHandle,
int iOptions,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFileName,
[MarshalAs(UnmanagedType.LPWStr)] string pstrSourcePath,
[MarshalAs(UnmanagedType.LPWStr)] string pstrTargetPath
);
//=========================================================
//=========================================================
// CONACopyFile
//
// Description:
// CONACopyFile copy file to target folder on PC or Device
// from Device or PC source folder
//
// If current folder is used, path to device folder do not
// need to set. Current folder can be used for source and
// target location. PC side path can also include the
// target/source file name. If path to device's target or
// source folder is given, it cannot include file name.
//
// Note: No rollback option! If an error occurs during the
// execution of the command (e.g. connection lost: file from
// target folder will be deleted if it is changed), the
// changes that have been already made are not cancelled.
//
//
// Parameters:
// hFSHandle [in] File System handle
//
// dwOptions [in] Direction options:
// CONA_DIRECT_PHONE_TO_PC: Copies a file from the device to the PC.
// CONA_DIRECT_PC_TO_PHONE: Copies a file from the PC to the device.
// CONA_DIRECT_PHONE_TO_PHONE: Copies a file inside the device.
// Other options:
// CONA_RENAME: Renames the file if the same named
// file is already exists in the target folder.
// CONA_OVERWRITE: Copies the file even if the target folder
// contains a file of the same name. The file will be replaced.
//
// pstrFileName [in] File name. With direction options:
// CONA_DIRECT_PC_TO_PHONE and CONA_DIRECT_PHONE_TO_PC: The value can
// be NULL, if the file name is given with the PC path.
// CONA_DIRECT_PHONE_TO_PHONE: The value must include the file name.
//
// pstrSourcePath [in] Source folder path. With direction options:
// CONA_DIRECT_PHONE_TO_PHONE and CONA_DIRECT_PHONE_TO_PC: The value
// can be NULL, if the current folder folder is used.
// CONA_DIRECT_PC_TO_PHONE: The value can also include the source
// file name. (See *1)
//
// pstrTargetPath [in] Target (destination) folder path. With direction options:
// CONA_DIRECT_PHONE_TO_PC and CONA_DIRECT_PHONE_TO_PHONE: The value
// can also include the target file name. (See *1).
// CONA_DIRECT_PC_TO_PHONE: The value can be NULL, if the current
// folder folder is used.
//
// *1) If the path is given without a file name, the last chracter must be
// a backslash ('\'). Otherwise the Connectivity API will assume that path
// includes the target/source file name.
//
// 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_NO_PERMISSION_ON_PC
// ECONA_FOLDER_NAME_INVALID
// ECONA_FILE_TOO_BIG_DEVICE
// ECONA_FILE_NAME_INVALID
// ECONA_FILE_NAME_TOO_LONG
// ECONA_FILE_NOT_FOUND
// ECONA_FILE_ALREADY_EXIST
// ECONA_FILE_COPYRIGHT_PROTECTED
// ECONA_FILE_NO_PERMISSION
// ECONA_FILE_NO_PERMISSION_ON_PC
// ECONA_FILE_BUSY
// ECONA_FILE_TYPE_NOT_SUPPORTED
// 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 CONACopyFile(
int hFSHandle,
int iOptions,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFileName,
[MarshalAs(UnmanagedType.LPWStr)] string pstrSourcePath,
[MarshalAs(UnmanagedType.LPWStr)] string pstrTargetPath
);
//=========================================================
//=========================================================
// CONARenameFile
//
// Description:
// CONARenameFile renames the given file.
//
// Parameters:
// hFSHandle [in] File System handle.
// pstrFileName [in] Target file name.
// pstrNewFileName [in] New file name.
// pstrTargetPath [in] Target path. If the path is NULL,
// the 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_MEMORY_FULL
// ECONA_CURRENT_FOLDER_NOT_FOUND
// ECONA_FOLDER_PATH_TOO_LONG
// ECONA_FILE_NAME_INVALID
// ECONA_FILE_NAME_TOO_LONG
// ECONA_FILE_NOT_FOUND
// ECONA_FILE_ALREADY_EXIST
// ECONA_FILE_COPYRIGHT_PROTECTED
// ECONA_FILE_NO_PERMISSION
// ECONA_FILE_BUSY
// ECONA_FILE_TYPE_NOT_SUPPORTED
// ECONA_FILE_EXIST
// ECONA_NOT_SUPPORTED_DEVICE
// 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 CONARenameFile(
int hFSHandle,
[MarshalAs(UnmanagedType.LPWStr)] string pstrFileName,
[MarshalAs(UnmanagedType.LPWStr)] string pstrNewFileName,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -