|
I found an ftp client class from this site and I used the List Function which is as follows:
public ArrayList List()
{
Byte[] bytes = new Byte[512];
string file_list = "";
long bytesgot = 0;
int msecs_passed = 0;
ArrayList list = new ArrayList();
Connect();
OpenDataSocket();
SendCommand("LIST");
ReadResponse();
//FILIPE MADUREIRA.
//Added response 125
switch(response)
{
case 125:
case 150:
break;
default:
CloseDataSocket();
throw new Exception(responseStr);
}
ConnectDataSocket(); // #######################################
while(data_sock.Available < 1)
{
System.Threading.Thread.Sleep(50);
msecs_passed += 50;
// this code is just a fail safe option
// so the code doesn't hang if there is
// no data comming.
if (msecs_passed > (timeout / 10))
{
//CloseDataSocket();
//throw new Exception("Timed out waiting on server to respond.");
//FILIPE MADUREIRA.
//If there are no files to list it gives timeout.
//So I wait less time and if no data is received, means that there are no files
break;//Maybe there are no files
}
}
while(data_sock.Available > 0)
{
bytesgot = data_sock.Receive(bytes, bytes.Length, 0);
file_list += Encoding.ASCII.GetString(bytes, 0, (int)bytesgot);
System.Threading.Thread.Sleep(50); // *shrug*, sometimes there is data comming but it isn't there yet.
}
CloseDataSocket();
ReadResponse();
if (response != 226)
throw new Exception(responseStr);
foreach(string f in file_list.Split('\n'))
{
if (f.Length > 0 && !Regex.Match(f, "^total").Success)
list.Add(f.Substring(0, f.Length - 1));
}
return list;
}
But everytime I get files from ftp using this function it includes a date plus other characters plus the name of the file itself.
For example: I want to get all the files inside a certain folder in ftp. The filenames of which are Text1.txt, Text2.txt and Text3.txt. Yet when i tried to retrieve its files using this function, it returns
08-29-07 06:42PM 0 Test1.txt
08-29-07 06:42PM 0 Test2.txt
08-29-07 06:42PM 0 Test2.txt
My question is, how can i retrieve files from ftp returning only the original filenames which are Text1.txt, Text2.txt and Text3.txt.
Thanks
|
|
|
|
|
toink toink wrote: 08-29-07 06:42PM 0 Test1.txt
08-29-07 06:42PM 0 Test2.txt
08-29-07 06:42PM 0 Test2.txt
You may need to parse the output of the FTP process.
|
|
|
|
|
Hi,
I have a strongly typed list that contains a collection of objects, which I can bind to, however I also need to be able to bind to a child object contained in the list, and bind it the gridview.
Does anyone know how to do this?
Regards
Paul Custance
|
|
|
|
|
Hi all,
I need to move a sprite exactly 100 pixels every second regardless of the framerate. Any help would be great ..thx.
|
|
|
|
|
pokabot wrote: I need to move a sprite exactly 100 pixels every second regardless of the framerate
The simple answer is to obtain the current framerate and move the sprite by 100/framerate but what happens if the framerate falls below 1 FPS?
|
|
|
|
|
You could just use a heartbeat timer.
|
|
|
|
|
All games work this way, they move the sprites based on time passed, and render as many frames as the processor lets them. So, the key answer is, don't write any code that changes any values just because a render event has occured.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
So .. am i right in thinking if i fix the framerate to 60fps and then every loop move the sprite 100 / amount of ms passed then if any time is left draw the frame?
|
|
|
|
|
you need an accurate timer (there is one in DXUtils class in DirectX SDK) and define your move formula depend on time and speed just like X=Vt+X0 for example if X0=0 and V=100px/sec then in 2Sec it would be 200px or in 0.01 sec it would be just 1px so it does not depend on the framerate
you can take two approach depends on your need
1- X0 would be always zero so after 10 sec you pass the 10sec to formula
2-use time Elapsed method (use in most games) you can calculate the elapsed time using the timer
and the previuos position would be X0.
for example if X0=0 and V=100px/Sec after one sec X=100px and after 1.5 sec from beginning it would be X0=100px ,V=100px/sec,ElapsedTime=0.5 sec X=100*0.5+100=150px
and if you are doing it in the 3D you must define each speed for every dimension or calculate them thruogh total speed using math
and ofcourse you involve acceleration too.
hope the post would be useful
|
|
|
|
|
please help me I want to know how to save the data of my streamwriter to the file I am saving in a directory from the savefiledialog.
I get the file to save with the right ext but the data does not.
|
|
|
|
|
I think the SaveFileDialog is just used to visually select the location and the name of the file to be saved. After that you write the contents of the file on the disk "by hand" using the class "StreamWriter" or "File" or whatever.
|
|
|
|
|
yes I know but how can I parse the values in my streamwriter to that file that Im saving from the savedialog?
|
|
|
|
|
Have you checked out Intellisense? SaveFileDialog exposes a property called FileName . Alternatively, you can call the OpenFile method on the SaveFileDialog instance.
Cheers,
Vıkram.
Be yourself, no matter what they say.
- Sting, Englishman in New York.
|
|
|
|
|
Is Binary Serialization what you need?
|
|
|
|
|
i want to get all the dll's of my project.
my project is in "d:\visual\source"
can you tell me where i make change that i get all the dll of this project
Situ
|
|
|
|
|
Hello,
Do you mean getting the filenames from this path?
If Yes:
string[] allDlls=null;
string searchPath = @"d:\visual\source";
if(System.IO.Directory.Exists(searchPath))
{
allDlls = System.IO.Directory.GetFiles(searchPath,"*.dll");
}
All the best,
Martin
|
|
|
|
|
Hi,
have a look at the Process class, its GetCurrentProcess method and Modules property.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Is it necessary for the table field to be ole in order to show the pic into crystal report.i am storing the path in the database, but not being able to retrieve the corresponding pic.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
sonia,
don't repeat your question within a day with different subject/header.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
sorry sir, if u please provide the answer.Actually i was in urgent need of it.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
sonia,
i never do this type of work.I m not sure that following link is helpful for u
First Example
and
Second Example
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
can't i put the image type control at design time reason is i am using other fields in the same report . i don;t want to put the image control at run time
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
you can try Googling
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Dear all,
I got this project that was written originally on .NET framework 1.1. I converted the project with Visual C# 2005 Express , and it compiles just fine. However, when I want to run it I get a .NET framework initialization error , telling me that I need 1.1 in order to run the application. I though 1.1 was , without any restrictions, backwards compatible. How can I fix this without re-writing the entire code.
cheers,
|
|
|
|
|
You rebuilt the app using VS 2005 and *that* binary asks for v1.1?
Have you tried running it through the debugger yet?
Cheers,
Vıkram.
Be yourself, no matter what they say.
- Sting, Englishman in New York.
|
|
|
|