Sorry Hari, it seems my previous post was not clear. My suggestion is not to
worry about users deleting your files. If they do, fallback to hardcoded
defaults in your application so you don't rely on the input files being
there.
Now if you really need to cater for that scenario, here are some random
suggestions (I've never had to do that myself):
1. Mark the files as ReadOnly. If you need to change that setting when your
app is running, change it and then change it back when your app exits. Look
up System.IO.FileAttributes.ReadOnly for this.
2. Mark the files as system files or as Hidden (same as 1,
System.IO.FileAttributes.Hidden)
3. Instead of using files, use the registry as your store which is harder
for the user to mess with.
4. And a more radical approach, embed the input files in the assembly. On
startup check to see if the files are on the system and if they are not,
extract them from your assembly and use them. This was discussed recently in
a different context but the principle is the same (look at Alex Feinman's
contribution):
http://groups-beta.google.com/group/...28bba550894d45
Cheers
Daniel
--
http://www.danielmoth.com/Blog/
"Hari" <(E-Mail Removed)> wrote in message
news:9DAAA3C5-D98F-4140-B78C-(E-Mail Removed)...
> Whenever Mr.Daniel is there, we, developers are confident.
>
> Could you please elaborate on denying access to particular folders/files?
>
> "Daniel Moth" wrote:
>
>> Generally speaking, I'd treat that scenario the same as if a user deleted
>> your exe. How will your app work then? In any case, you should have
>> default
>> values for anything you read from a file, registry or wherever. At
>> startup,
>> try to obtain the input and when it fails your code falls back to the
>> hardcoded default(s).
>>
>> Cheers
>> Daniel
>> --
>> http://www.danielmoth.com/Blog/
>>
>>
>> "Hari" <(E-Mail Removed)> wrote in message
>> news
3EB382D-6B45-4D5A-AFE8-(E-Mail Removed)...
>> > hi,
>> >
>> > my pocket pc application generates some output files and it also make
>> > use
>> > of
>> > some configurable input files(both text files). After starting my
>> > program,
>> > if any user deletes my input files/output files, my application will
>> > not
>> > work
>> > smoothly and anything unexpected can happen.
>> >
>> > it may be similar to complaining to Microsoft that Windows is not
>> > working
>> > properly, after deleting the entire Windows system directory?
>> >
>> > Still, I search for an answer. How can we stop the user from deleting
>> > or
>> > modifying all our application's files. Or how to deny access to our
>> > application's folder?
>> >
>> > I wish t know, how all other developers have tackled this situation?
>> >
>> > Regards,
>> > hari
>>
>>
>>