Isolated Storage

J

Jon Berry

I'm executing an external process from my C# app.

It uses a typical command line type interface:

program.exe inputfile outputfile

I want the outputfile stored in IsolatedStorage.

Is there anyway to do this without re-reading
the file and re-writing it?

I really like the idea of IsolatedStorage for these
files, but if that won't work is it OK to just store
them in a directory next to my executable?

I thought I read somewhere that this could cause
a security exception?

Where else should I be storing user files?

Thanks,

Jon
 
M

Michael Nemtsev

Hello Jon,

JB> I'm executing an external process from my C# app.
JB> It uses a typical command line type interface:
JB> program.exe inputfile outputfile
JB> I want the outputfile stored in IsolatedStorage.
JB> Is there anyway to do this without re-reading
JB> the file and re-writing it?

Do you mean doesn't put files in storage and keep only references?

JB> I really like the idea of IsolatedStorage for these files, but if
JB> that won't work is it OK to just store them in a directory next to
JB> my executable?

and where i'd like to keep them otherwise?

JB> I thought I read somewhere that this could cause
JB> a security exception?
JB> Where else should I be storing user files?

Which files? Settings or what? You can encrypt/secure them

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

You could try to first create a file in isolated storage, get it's name,
and then use the name to make the external program overwrite the file.

I don't know if it's possible, and it kind of breaks the "Isolated" in
"IsolatedStorage".

If it can't be done that way, you can create a temporary file using the
name from System.IO.Path.GetTempFileName(). That way you won't have it
in your program directory.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

It may very well be as you think.

The IsolatedStorageFileStream inherits the Name property from the
FileStream class. I don't know if this is the physical path of the file
or just a local name inside the isolated storage.
 
J

Jon Berry

JB> I want the outputfile stored in IsolatedStorage.
JB> Is there anyway to do this without re-reading
JB> the file and re-writing it?

Do you mean doesn't put files in storage and keep only references?

I wanted to put the files in IsolatedStorage.
I was just trying to avoid the extra write to the hard drive.
Thus avoiding the need to delete the temporary files generated by the
external process after they are put in IsolatedStorage.
JB> I really like the idea of IsolatedStorage for these files, but if
JB> that won't work is it OK to just store them in a directory next to
JB> my executable?

and where i'd like to keep them otherwise?

I just found Application.LocalUserAppDataPath
I guess that's the next best solution.
JB> I thought I read somewhere that this could cause
JB> a security exception?
JB> Where else should I be storing user files?

Which files? Settings or what? You can encrypt/secure them

No, they are tweaked out media files. They are not really meant to be used
by other programs.
The user should not really need to access the files directly.

The point I was trying to make was that I read somewhere that
non-administrator user
may not be able to write to the "Program Files" directory. True?

Jon
 
J

Jon Berry

Göran Andersson said:
If it can't be done that way, you can create a temporary file using the
name from System.IO.Path.GetTempFileName(). That way you won't have it in
your program directory.

Thanks, I might just end up using this temp file dealio.

If I do, will I need to programmatically delete the files or is this done
for me?

Jon
 
W

warlord

Jon Berry said:
Thanks, I might just end up using this temp file dealio.

If I do, will I need to programmatically delete the files or is this done
for me?

No you need to handle this yourself too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top