P
Peter Webb
If Nicholas Paldino reads this, please don't have an apoplectic fit.
Other professionals with weak stomachs may want to look away.
My problem was that I needed to set up some files that the user can read,
write and delete. There are 20 of these, all xml, about 30k each.
I couldn't work out where I could read them from when the package is first
installed or run. Nor could I understand either of Mr Paldino's suggestions.
So used Plan B. I wrote a small program to basically read in all each xml
files, map double quotes to single quote, slashes to pipes, and end of lines
to tildes, and write them out to a text file, preceded by String
Filename[counter]=" and terminated by ";
This gave me a single valid line of C# code in a text file, which I cut and
paste into my source.
Its 623,060 characters long. FWIW, it starts:
filename[0] = "Default configuration"; filecontents[0] = "<?xml
version='1.0' encoding='utf-8'?>~<saveStructure
xmlns:xsi='http:||www.w3.org|2001|XMLSchema-instance'
xmlns:xsd='http:||www.w3.org|2001|XMLSchema'>~ <alist>~ <textaslot>~
<clickarea>~ <Location>~ <X>404<|X>~
At runtime I just reverse the substitutions and write the 20 strings out to
20 files with the appropriate names. Works a treat, and is virtually
instantaneous to do.
The IDE accepts this just fine. It does warn me that the program contains an
extremely long line (623,060 is extremely long?) and the UI may may be slow,
which it is, but only if the line is on the screen. I stick it at the end
after a bunch of blank lines so its no problem.
Now, a puritan may argue that this is actually 40 C# statements concatenated
together, which is true, but one of the String statements is 53k long, and
unless there is something about carriage returns and strings I don't know,
cannot be any shorter.
So, how many of you so-called "experts" have ever written a line of C# which
is even 53k long, let alone 623,060 characters long? Huh?
Which brings me to my question about isolated storage.
Its working just fine for me, and thankyou to whoever suggested it. It did
seem to suffer from one problem, which is that it is only available to the
runtime. This meant I had to write some basic file management functionality
within my app for debugging purposes - clearing directories and files, for
example.
I don't want to have to do this again for the next project I decide to
undertake.
It seems that most people who use isolated storage to hold a file system
would have similar requirements during development.
Has anybody developed/provided a basic file management UI for isolated
storage that I can cut and paste into my code with a conditional assembly
flag, or is there perhaps something that can run externally that can help?
Thanks
Peter Webb
(author of longest C# statement ever)
Other professionals with weak stomachs may want to look away.
My problem was that I needed to set up some files that the user can read,
write and delete. There are 20 of these, all xml, about 30k each.
I couldn't work out where I could read them from when the package is first
installed or run. Nor could I understand either of Mr Paldino's suggestions.
So used Plan B. I wrote a small program to basically read in all each xml
files, map double quotes to single quote, slashes to pipes, and end of lines
to tildes, and write them out to a text file, preceded by String
Filename[counter]=" and terminated by ";
This gave me a single valid line of C# code in a text file, which I cut and
paste into my source.
Its 623,060 characters long. FWIW, it starts:
filename[0] = "Default configuration"; filecontents[0] = "<?xml
version='1.0' encoding='utf-8'?>~<saveStructure
xmlns:xsi='http:||www.w3.org|2001|XMLSchema-instance'
xmlns:xsd='http:||www.w3.org|2001|XMLSchema'>~ <alist>~ <textaslot>~
<clickarea>~ <Location>~ <X>404<|X>~
At runtime I just reverse the substitutions and write the 20 strings out to
20 files with the appropriate names. Works a treat, and is virtually
instantaneous to do.
The IDE accepts this just fine. It does warn me that the program contains an
extremely long line (623,060 is extremely long?) and the UI may may be slow,
which it is, but only if the line is on the screen. I stick it at the end
after a bunch of blank lines so its no problem.
Now, a puritan may argue that this is actually 40 C# statements concatenated
together, which is true, but one of the String statements is 53k long, and
unless there is something about carriage returns and strings I don't know,
cannot be any shorter.
So, how many of you so-called "experts" have ever written a line of C# which
is even 53k long, let alone 623,060 characters long? Huh?
Which brings me to my question about isolated storage.
Its working just fine for me, and thankyou to whoever suggested it. It did
seem to suffer from one problem, which is that it is only available to the
runtime. This meant I had to write some basic file management functionality
within my app for debugging purposes - clearing directories and files, for
example.
I don't want to have to do this again for the next project I decide to
undertake.
It seems that most people who use isolated storage to hold a file system
would have similar requirements during development.
Has anybody developed/provided a basic file management UI for isolated
storage that I can cut and paste into my code with a conditional assembly
flag, or is there perhaps something that can run externally that can help?
Thanks
Peter Webb
(author of longest C# statement ever)