473,626 Members | 3,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best way to handle multiple operating modes in C#

1 New Member
Hello all,

I'm writing a c# console program that's going to be run as a service but I want it to have the ability to handle arguments and run in a certain way. The program is supposed to monitor several different types of servers and update a SQL database with vital information. Several of the servers are different and require special considerations within the program. The easiest way for me to accomplish this is with arguments against the program when it is run. So here's my problem. What's the best way to handle multiple arguments?

lets say my arguments are thus:

/exchange
/cluster
/dc
/sql
/fileserver
etc,

and i want to do different things depending on which arguments are encountered. So, lets say a server is a clustered exchange server then it would be /exchange and /cluster. now, i could use an if statement but it gets a little complicated once i start getting more than a couple arguments...

I thought of assigning each argument a value and then adding them together to get my run mode like so:

/exchange is value 1
/cluster is value 2
/dc is value 4
/sql is value 8
/fileserver is value 16

so an exchange cluster would be a value of 3 or a clustered sql fileserver would be 26, etc

the problem with that is programatically deciding which path the program should take once the value is determined. since not all the arguments are designed to handle servers.

so i ask for advice from the all the gurus here. What's the best way to handle multiple operating modes?
Dec 26 '07 #1
0 970

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2385
by: Karthikesh Raju | last post by:
Hi All, i am wondering about the best way to read in a configuration file that goes like: ########### source_dir = '/home/karthik/Projects/python' data_dir = '/home/karthik/Projects/data'
8
3552
by: Grant Edwards | last post by:
Perhaps I'm doing something wrong: the struct module docs say it's IEE 754, but I can't figure out how to get it to handle NaN values correctly (either packing or unpacking). >>> x = float('nan') >>> struct.pack("<f",x) Traceback (most recent call last): File "<stdin>", line 1, in ? SystemError: frexp() result out of range
3
4710
by: Razvan | last post by:
Hello, Can somebody recommend me a Java Script scroller that can scroll an i-frame ? I tried the Tigra scroller (www.softcomplex.com/products/tigra_scroller/) but sometimes it does not appear at all on my web page (www.mihaiu.name). It doesn't seem to be reliable...
2
1475
by: Gaurav Vaish | last post by:
Hi, How can I accomplish multiple authentication modes in one application? I have the following scenario: - A company, X, has some employees - Those on rolls have an AD account - Those not, have an account that's managed in a separate DB
10
1314
by: Steve Franks | last post by:
Hi all, I've spent the past several months developing my ASP.NET 2.0 web site using Beta 2, and its working great. Even though 2.0 beta 2 has a Go Live license, I have not deployed to production yet. It is a brand new web site so I want to wait and just deploy with the final release of 2.0 now that it is coming in just a couple weeks.
12
3736
by: Aaron Smith | last post by:
What is the best way to handle data in a multiple user environment? We have forms that will allow users to add edit and delete data from a table on SQL server. The data could be edited on multiple machines at the same time. How do you keep the dataset constantly updated with changes made to the data? I'm playing with just calling the fill method, but it seems pretty unstable at times. Especially when deleting records, they don't seem to...
9
2535
by: Jacek Dziedzic | last post by:
Hi! I often find that my programs need to store information on "current mode of something" with two or at most several mutually exclusive "modes" to choose from, e.g. - datafile: is it in a) read-only mode or b) write-only mode, - a function picking points a) above, b) below or c) contained on a plane in 3D, etc.
32
5640
by: David Isaac | last post by:
I have no experience with database applications. This database will likely hold only a few hundred items, including both textfiles and binary files. I would like a pure Python solution to the extent reasonable. Suggestions? Thank you, Alan Isaac
2
2150
by: sabbadin12 | last post by:
Hi, I'm going to work on an application that uses a postgreSQL database so that it can uses SQLServer 2005. I think I solved most problems on the programming side, but I still have some doubts on the DB side regarding how to handle the creation of the db schema on sqlserver and how to handle the every day dba work. 1) should I try to use an ER tool like Embarcadero and have its logical model be the master copy ? (i did some tests, it...
0
8269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8512
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5576
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
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 we have to send another system
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.