473,505 Members | 15,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looking for proper way to code this

Is there a better way to break this out a bit?

static void Main(string[] args)
{
try
{
int rc1;
ROBOFTPAUTOMATIONLib.Automate RoboFTPSession = new
ROBOFTPAUTOMATIONLib.Automate();
RoboFTPSession = new Automate();
rc1 = RoboFTPSession.RoboStartSession("PUC-FTP", 1, 0, "");
rc1 = RoboFTPSession.RoboSendCommand("FTPLOGON \"ftp.xxxxxx.com\"
/user=xxxxx /pw=xxxxxx", 10 * 10);
rc1 = RoboFTPSession.RoboSendCommand("CHGDIR \"C:\\\"", 100 * 10);
rc1 = RoboFTPSession.RoboSendCommand("FTPCD \"test\"", 100 * 10);
rc1 = RoboFTPSession.RoboSendCommand("SENDFILE \"*.txt\"", 10000000
* 10);
rc1 = RoboFTPSession.RoboSendCommand("FTPLOGOFF", 10 * 10);
rc1 = RoboFTPSession.RoboSendCommand("STOP", 10 * 10);
}
catch(Exception)
{

}

}

Jan 12 '06 #1
2 1328
Not really. The best I think you could do is change the variable name
from RoboFTPSession to ftp, and that should make it look a little better.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<df********@hotmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Is there a better way to break this out a bit?

static void Main(string[] args)
{
try
{
int rc1;
ROBOFTPAUTOMATIONLib.Automate RoboFTPSession = new
ROBOFTPAUTOMATIONLib.Automate();
RoboFTPSession = new Automate();
rc1 = RoboFTPSession.RoboStartSession("PUC-FTP", 1, 0, "");
rc1 = RoboFTPSession.RoboSendCommand("FTPLOGON \"ftp.xxxxxx.com\"
/user=xxxxx /pw=xxxxxx", 10 * 10);
rc1 = RoboFTPSession.RoboSendCommand("CHGDIR \"C:\\\"", 100 * 10);
rc1 = RoboFTPSession.RoboSendCommand("FTPCD \"test\"", 100 * 10);
rc1 = RoboFTPSession.RoboSendCommand("SENDFILE \"*.txt\"", 10000000
* 10);
rc1 = RoboFTPSession.RoboSendCommand("FTPLOGOFF", 10 * 10);
rc1 = RoboFTPSession.RoboSendCommand("STOP", 10 * 10);
}
catch(Exception)
{

}

}

Jan 12 '06 #2
df********@hotmail.com <df********@hotmail.com> wrote:
Is there a better way to break this out a bit?


Well, you could encapsulate a command and whatever the second parameter
is into a struct or class, then have a list of them:

RoboCommand[] commands = new RoboCommand[]
{
new RoboCommand ("FTPLOGON \"ftp.xxxxxx.com\" [...]", 10*10),
new RoboCommand ("CHGDIR ....", 100*10),
new RoboCommand ("FTPCD ....", 100*10),
etc
}

foreach (RoboCommand command : commands)
{
RoboFtpSession.RoboSendCommand (command.Name,
command.OtherParameter);
}

(Depending on exactly what RoboFtpSession is, you could change that to
just command.Send() perhaps.)

Also, you're not using the value of the rc1 variable, so I'd get rid of
it.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
3027
by: Chris Lott | last post by:
I already use and am happy with a variety of text editors (vim, emacs, ultraedit, jedit, Homesite) depending on my needs, but I would like recommendations for a PHP specific IDE that will run on...
8
1206
by: Jonathan Gennick | last post by:
Once again, I find myself looking to contact contributors to the Python Cookbook, this time for chapter 2. If you know how to contact any of the people listed below, please contact me at...
46
12494
by: vvk4 | last post by:
I have an excel spreadsheet that I need to parse. I was thinking of saving this as a CSV file. And then reading the file using C. The actual in EXCEL looks like: a,b a"b a","b a,",b In CSV...
1
2566
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am...
2
1383
by: mathieu | last post by:
Hello there, I am looking for the proper structure for the following problem. I would like to read in memory a file that has the following structure: k1, v1 k2, v2 k3, v3 k4 / k1, v11
6
1433
by: Jonathan Wood | last post by:
If you're an experienced C#/ASP.NET developer looking for projects that you can do from your own location, I may be able to provide you with some work. For more info, please visit...
0
1144
by: krzysztof.konopko | last post by:
I know that the informations I provide may seem limited but maybe someone has solved similar problem. I am new in design patterns and I am quite confused who should control whom, how to configure...
12
1578
by: alexander | last post by:
hi, can someone point me to a good JS tutorial? (it may be in German or English) regards alex
12
2623
by: Rex | last post by:
Hello, I am a PHP newbie looking for a PHP editor I can use with a WYSIWYG interface for HTML (e.g. like Dreamweaver or Frontpage). I'm running Vista. I am having installation problems with both...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.