473,408 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

File Watcher +Win Service

Hi all.
I'm developing a Windows Explorer like app.

I have my own repository to store the files and a bd where i keep the path
to each file.

I have to watch the repository all time to avoid modifications by other
people. So that, i'm using a win service in wich i implement a file watcher.

I have two basic questions:

1) I'm implementig methods to restore the information in the bd if someome
delete, rename or move a file in my repository. The problem i have is that
the file watcher
throws more than one event for example if someone moves a file. So, how can
i know which other events are waiting in the queue (and eventually how can i
acces and navigate to this queue) or is there another way to restore the
changes made to any file on my repository ??

2) My app also can modify the files in the repository, so, i don't want in
these case the file watcher perform the restore actions !! how can i differ
the changes made by my app or somebody else ?? is there any way to ask if my
app is running or something like that ??

Any suggestions are welcome !!

regards !!

Marcelo López
Inforcorp. Uruguay. Latin America.
Nov 15 '05 #1
4 1427
Hello i guest that a better protection for your files it's to put the folder
protected with access only to a user that you control, start your app with
that user account, and you will be the only one with the permision to chage
the files because only that user can access that folder and chage the files.

--
Bela Istok
MVP C#
Caracas, Venezuela
"Marcelo López" <t-********@infocorp.com.uy> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
Hi all.
I'm developing a Windows Explorer like app.

I have my own repository to store the files and a bd where i keep the path
to each file.

I have to watch the repository all time to avoid modifications by other
people. So that, i'm using a win service in wich i implement a file watcher.
I have two basic questions:

1) I'm implementig methods to restore the information in the bd if someome
delete, rename or move a file in my repository. The problem i have is that
the file watcher
throws more than one event for example if someone moves a file. So, how can i know which other events are waiting in the queue (and eventually how can i acces and navigate to this queue) or is there another way to restore the
changes made to any file on my repository ??

2) My app also can modify the files in the repository, so, i don't want in
these case the file watcher perform the restore actions !! how can i differ the changes made by my app or somebody else ?? is there any way to ask if my app is running or something like that ??

Any suggestions are welcome !!

regards !!

Marcelo López
Inforcorp. Uruguay. Latin America.

Nov 15 '05 #2
OK, it seems to be an interesting solution.
So that, i'd like to get more information, because i never have worked with
permissions and users in C#.
What happens if someones access the directory using for example the Win
Explorer ?? Could the administrator give himself the same permissions that
my application and delete or move the files protected ??

My requirement is to " avoid modifications on my files by somebody else "
when my app is running or not.
If the solution you are giving to me satisfy it, it is more than welcome !!!
If the answer is YES, i'd like to get more information about creating an app
user and managing its permissions on my app start, etc.

Regards !!!

Marcelo
"Bela Istok" <be****@hotmail.com> wrote in message
news:OQ**************@TK2MSFTNGP11.phx.gbl...
Hello i guest that a better protection for your files it's to put the folder protected with access only to a user that you control, start your app with
that user account, and you will be the only one with the permision to chage the files because only that user can access that folder and chage the files.
--
Bela Istok
MVP C#
Caracas, Venezuela
"Marcelo López" <t-********@infocorp.com.uy> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
Hi all.
I'm developing a Windows Explorer like app.

I have my own repository to store the files and a bd where i keep the path to each file.

I have to watch the repository all time to avoid modifications by other
people. So that, i'm using a win service in wich i implement a file watcher.

I have two basic questions:

1) I'm implementig methods to restore the information in the bd if someome delete, rename or move a file in my repository. The problem i have is that the file watcher
throws more than one event for example if someone moves a file. So, how

can
i know which other events are waiting in the queue (and eventually how can i
acces and navigate to this queue) or is there another way to restore the
changes made to any file on my repository ??

2) My app also can modify the files in the repository, so, i don't want
in these case the file watcher perform the restore actions !! how can i

differ
the changes made by my app or somebody else ?? is there any way to ask

if my
app is running or something like that ??

Any suggestions are welcome !!

regards !!

Marcelo López
Inforcorp. Uruguay. Latin America.


Nov 15 '05 #3
Using windows explorer they would get an error trying to write to the
directory. However, an administrator will always be able to bypass this.
(note that an admin could also stop your service and mess with the files as
well). However, an admin would have to explicitly take control of the
directory, so it wouldn't be an accident.

So, you can't keep an admin from doing it no matter what. But you can make
it hard:
Create the directory and make it owned by your app user
Give your app user full control, remove everyone else
Make sure that the permissions from parents are not inherited

No only that user can access the directory.

"Marcelo López" <t-********@infocorp.com.uy> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
OK, it seems to be an interesting solution.
So that, i'd like to get more information, because i never have worked with permissions and users in C#.
What happens if someones access the directory using for example the Win
Explorer ?? Could the administrator give himself the same permissions that
my application and delete or move the files protected ??

My requirement is to " avoid modifications on my files by somebody else "
when my app is running or not.
If the solution you are giving to me satisfy it, it is more than welcome !!! If the answer is YES, i'd like to get more information about creating an app user and managing its permissions on my app start, etc.

Regards !!!

Marcelo
"Bela Istok" <be****@hotmail.com> wrote in message
news:OQ**************@TK2MSFTNGP11.phx.gbl...
Hello i guest that a better protection for your files it's to put the folder
protected with access only to a user that you control, start your app with
that user account, and you will be the only one with the permision to

chage
the files because only that user can access that folder and chage the

files.

--
Bela Istok
MVP C#
Caracas, Venezuela
"Marcelo López" <t-********@infocorp.com.uy> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
Hi all.
I'm developing a Windows Explorer like app.

I have my own repository to store the files and a bd where i keep the path to each file.

I have to watch the repository all time to avoid modifications by other people. So that, i'm using a win service in wich i implement a file

watcher.

I have two basic questions:

1) I'm implementig methods to restore the information in the bd if someome delete, rename or move a file in my repository. The problem i have is that the file watcher
throws more than one event for example if someone moves a file. So, how can
i know which other events are waiting in the queue (and eventually how can
i
acces and navigate to this queue) or is there another way to restore

the changes made to any file on my repository ??

2) My app also can modify the files in the repository, so, i don't

want in these case the file watcher perform the restore actions !! how can i

differ
the changes made by my app or somebody else ?? is there any way to ask

if
my
app is running or something like that ??

Any suggestions are welcome !!

regards !!

Marcelo López
Inforcorp. Uruguay. Latin America.



Nov 15 '05 #4
OK, it sounds good.

Where can i get a tutorial or similar to learn about creating users
programatically, asigning permissons, etc with C# ?

I have to do it when the user installs my app.

I'll be pleased for that.
"Philip Rieck" <st***@mckraken.com> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
Using windows explorer they would get an error trying to write to the
directory. However, an administrator will always be able to bypass this.
(note that an admin could also stop your service and mess with the files as well). However, an admin would have to explicitly take control of the
directory, so it wouldn't be an accident.

So, you can't keep an admin from doing it no matter what. But you can make it hard:
Create the directory and make it owned by your app user
Give your app user full control, remove everyone else
Make sure that the permissions from parents are not inherited

No only that user can access the directory.

"Marcelo López" <t-********@infocorp.com.uy> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
OK, it seems to be an interesting solution.
So that, i'd like to get more information, because i never have worked

with
permissions and users in C#.
What happens if someones access the directory using for example the Win
Explorer ?? Could the administrator give himself the same permissions that
my application and delete or move the files protected ??

My requirement is to " avoid modifications on my files by somebody else " when my app is running or not.
If the solution you are giving to me satisfy it, it is more than welcome

!!!
If the answer is YES, i'd like to get more information about creating an

app
user and managing its permissions on my app start, etc.

Regards !!!

Marcelo
"Bela Istok" <be****@hotmail.com> wrote in message
news:OQ**************@TK2MSFTNGP11.phx.gbl...
Hello i guest that a better protection for your files it's to put the

folder
protected with access only to a user that you control, start your app with that user account, and you will be the only one with the permision to

chage
the files because only that user can access that folder and chage the

files.

--
Bela Istok
MVP C#
Caracas, Venezuela
"Marcelo López" <t-********@infocorp.com.uy> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
> Hi all.
> I'm developing a Windows Explorer like app.
>
> I have my own repository to store the files and a bd where i keep
the path
> to each file.
>
> I have to watch the repository all time to avoid modifications by other > people. So that, i'm using a win service in wich i implement a file
watcher.
>
> I have two basic questions:
>
> 1) I'm implementig methods to restore the information in the bd if

someome
> delete, rename or move a file in my repository. The problem i have
is that
> the file watcher
> throws more than one event for example if someone moves a file. So, how can
> i know which other events are waiting in the queue (and eventually
how can
i
> acces and navigate to this queue) or is there another way to restore the > changes made to any file on my repository ??
>
> 2) My app also can modify the files in the repository, so, i don't

want
in
> these case the file watcher perform the restore actions !! how can i
differ
> the changes made by my app or somebody else ?? is there any way to

ask if
my
> app is running or something like that ??
>
> Any suggestions are welcome !!
>
> regards !!
>
> Marcelo López
> Inforcorp. Uruguay. Latin America.
>
>



Nov 15 '05 #5

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

Similar topics

2
by: Marcelo López | last post by:
Hi all. I'm developing a Windows Explorer like app. I have my own repository to store the files and a bd where i keep the path to each file. I have to watch the repository all time to avoid...
9
by: Paul | last post by:
Hi, VB.NET is saying the file I am creating is in use by another process and won't complete its task of moving the file to the specified destination folder. Here is my code (the main bit...
3
by: Ron Vecchi | last post by:
Hi all, Can someone point me in the direction on this one, resources or examples. I am writing a Windows Service to monitor a folder. When I file is modified within the folder or any subfolders...
2
by: Jack David | last post by:
Using the code below I am able to monitor a single directory for a new file and then kick-off a process to deal with the file. The question is??? How would I modify this code to be able to monitor...
1
by: Stuart Ferguson | last post by:
I am currently writing a Windows service which monitors multiple folders and processes the files in them accordingly. The folders to be monitored are stored in a string array. I can think of 2...
2
by: Guy_B | last post by:
Hi I am using the filesystem watcher to pick up files as they are dropped into a folder - the files are output file from another system and I have no control over that. When 'watcher raises the...
2
by: TwistedPair | last post by:
All, This is sort of a continuation of a previous post of mine. The code below basically reads a registry key to get a path to a folder and it watches for files created in that folder (only...
1
by: =?Utf-8?B?QXZp?= | last post by:
Hi I have an interesting issue, I hope someone can shead light on: I have a 2 server "web farm" with a web app that produces image files. To ensure synchronization of content on both machines,...
6
by: Andy B | last post by:
What would i use to look for changes in a file every minute?
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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
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...

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.