Nicolas_Menant
Mar 20, 2008Employee
Structure FileTransferContext and file_data
Hi,
i try to create an windows API to retrieve an external class from a BIGIP, update it and then upload it again on the box.
I have something that seems strange:
in the SDK for the structure FileTransferContext it says that file_data is of type char[]
or when i try to compile my code it says: cannot implicity convert type 'string' to 'byte[]'.
When i did the download of the file i had to make an explicit cast (char) FTC.file_data[j] to make it work.
Is it possible the SDK is wrong or am i missing something (which is quite possible since i have developped anything since a long long time)
Thanks for your help!
Here is part of my code:
iControl.SystemConfigSyncFileTransferContext FTC = new iControl.SystemConfigSyncFileTransferContext();
int exit = 0;
int i, j;
string element;
for (i = 0; i < listBox_class.Items.Count; i++)
{
element = "\""+listBox_class.Items[\i].ToString()+"\",\n";
FTC.file_data = new byte[element.Length];
for (j = 0; j < element.Length; j++)
FTC.file_data[j] = (byte)((int)element[j]);
if (j == 0)
FTC.chain_type = iControl.CommonFileChainType.FILE_FIRST_AND_LAST;
else if (j == (element.Length - 1))
FTC.chain_type = iControl.CommonFileChainType.FILE_MIDDLE;
else
FTC.chain_type = iControl.CommonFileChainType.FILE_LAST;
element = element.Remove(0);
my_interface.SystemConfigSync.upload_file(filename, FTC);
}
Another question:
When i use upload_file, it looks like it appends the new data to the existing file, is it possible to make it overwrite the previous file ? or do i have to delete the file before doing the upload ?
Thanks