Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Open Points: 150 Time: 14:11 - Apr 01, 2009
nithia
Trying to wite a windows service in C# which will monitor directories based on the config file and do some updates the database and move the files.
Categories:
Add Categories
When adding more than one category, separate them with commas.
discord
Date:: Nov 02, 2009
Time:: 15:28
nithia, Here is a stripped down service template I have. The actual file processing would be handle by the FileProcess class, I haven't included it due to the fact it would require a lot changes for customization to what you may need. Hope this helps. using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.ServiceModel; using System.ServiceProcess; using System.Threading; using System.IO; namespace FileService { public class FileProcessService : ServiceBase { const string BASE_THREAD_NAME = "FileService"; private EventWaitHandle _stopThread = null; private string _runningThreadName; public FileProcessService() { Initialize(); } protected virtual void Initialize() { if (_stopThread == null) _stopThread = new ManualResetEvent(false); else _stopThread.Reset(); Thread t = new Thread(new ThreadStart(StartService)); t.Name = BASE_THREAD_NAME; _runningThreadName = t.Name; t.Start(); } protected override void OnStart(string[] args) { base.OnStart(args); } protected override void OnStop() { base.OnStop(); StopService(); } protected override void OnShutdown() { base.OnShutdown(); } protected void StartService() { while (!_stopThread.WaitOne(500, true)) { FileProcess.Instance.ProcessFiles(); //This class would be a singleton class responsible for processing the files. } } public void StopService() { _stopThread.Set(); FileProcess.Instance.StopProcessing(); } private void InitializeComponent() { this.ServiceName = "FileProcessor"; } } }
Time:: 15:33
nithia, FYI, the FileProcessor class would be responsible for iterating the directory/directories. It also would read the config file to get the directory/directories that need to be processed.
admin
Date:: Dec 15, 2009
Time:: 10:41
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points. The Quomon Team
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
popup
how can open in onload page on open popup
EL NOBRE DEL GRUPO ALGUIEN LO SABE??
where can buy any trusted and security guild wars 2 gold?Thank you!
my window has not start because some memory shirnk f deive to e drive so ther...
You have 100 characters to use
Rank
Expert
Points
1.
9829
2.
6493
3.
5596
4.
4773
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software