Re: Help with Filesystem
On 17 November 2010 11:13, David Boccabella dav...@shamirlens.com.auwrote: Hi folks I have a NETMF project I am trying to work on – but the code from C# Framework 4.1 should work. My target is an SD card and I do not have any database capabilities like SQL.. In the old VB6 days you could create random files, and by defining the record length you could easily move from one record to the next. But I am at loss to find a similar type of functionality in C#. I can understand that to do this I will need to create a class, and serialise that class before storing the object on the disk.. But moving to a particular record has gotten me stuck. The only way I can see at the moment is to use the RecordLength * RecordNum and then SEEK to that byte location on the disk file. What level are you working at with the SD card? low-level SPI, secure or FAT file system? It's a 512 byte block, so you probably want your record to use a multiple of that, or pad it up. (memory's cheap) My memory space is also small so I cannot load the file into memory and move through it as a collection. Any suggestions/advice. Many thanks Dave [image: cid:image002.jpg@01CAF8CB.4090A030] [image: cid:image003.jpg@01CAF8CB.4090A030] *David Boccabella IT Manager* *Shamir Australia Pty Ltd.* | 1/23 Luke St. Lytton, QLD, 4178 P.O. Box 3346, Tingalpa DC 4173 P: 1300-553-465 | M: 0433-808-525 | F: 1300-554-075 www.shamirlens.com.au http://www.shamir.co.il/ -- Meski Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills image001.jpgimage002.jpg
Re: Help with Filesystem
You're a man of multiple hats, I see :) Looks easy them. Why don't you just go with the seek(recno * recsize) you proposed? (I'd still pad it to the natural blocksize though) Mike On 17 November 2010 13:21, David Boccabella davidboccabe...@anubis-systems.com wrote: I am using the SD card with a FAT file system. Many thanks Dave David J. Boccabella Proprietor Anubis Systems Phone: 0433 808 525 Fax: 3200 0085 Email: davidboccabe...@anubis-systems.com boo...@cvsol.com This e-mail and it's contents is confidential to Anubis Systems. This e-mail, any attachments, or any part of can not be reproduced without the express written permission of Anubis Systems *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *mike smith *Sent:* Wednesday, 17 November 2010 12:06 PM *To:* ozDotNet *Subject:* Re: Help with Filesystem On 17 November 2010 11:13, David Boccabella dav...@shamirlens.com.au wrote: Hi folks I have a NETMF project I am trying to work on – but the code from C# Framework 4.1 should work. My target is an SD card and I do not have any database capabilities like SQL.. In the old VB6 days you could create random files, and by defining the record length you could easily move from one record to the next. But I am at loss to find a similar type of functionality in C#. I can understand that to do this I will need to create a class, and serialise that class before storing the object on the disk.. But moving to a particular record has gotten me stuck. The only way I can see at the moment is to use the RecordLength * RecordNum and then SEEK to that byte location on the disk file. What level are you working at with the SD card? low-level SPI, secure or FAT file system? It's a 512 byte block, so you probably want your record to use a multiple of that, or pad it up. (memory's cheap) My memory space is also small so I cannot load the file into memory and move through it as a collection. Any suggestions/advice. Many thanks Dave [image: cid:image002.jpg@01CAF8CB.4090A030] [image: cid:image003.jpg@01CAF8CB.4090A030] *David Boccabella IT Manager* *Shamir Australia Pty Ltd.* | 1/23 Luke St. Lytton, QLD, 4178 P.O. Box 3346, Tingalpa DC 4173 P: 1300-553-465 | M: 0433-808-525 | F: 1300-554-075 www.shamirlens.com.au http://www.shamir.co.il/ -- Meski Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills -- Meski Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills image001.jpgimage002.jpg
RE: Help with Filesystem
Ok. So it’s a calculate and SEEK I just remember the old (and simple) VB6 system of defining a record and then just using GET and PUT to handle it, and was hoping that there was a ‘modern’ way to do it. Take Care Dave David J. Boccabella Proprietor Anubis Systems Phone: 0433 808 525 Fax: 3200 0085 Email: mailto:boo...@cvsol.com davidboccabe...@anubis-systems.com This e-mail and it's contents is confidential to Anubis Systems. This e-mail, any attachments, or any part of can not be reproduced without the express written permission of Anubis Systems From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of mike smith Sent: Wednesday, 17 November 2010 12:33 PM To: ozDotNet Subject: Re: Help with Filesystem You're a man of multiple hats, I see :) Looks easy them. Why don't you just go with the seek(recno * recsize) you proposed? (I'd still pad it to the natural blocksize though) Mike On 17 November 2010 13:21, David Boccabella davidboccabe...@anubis-systems.com wrote: I am using the SD card with a FAT file system. Many thanks Dave David J. Boccabella Proprietor Anubis Systems Phone: 0433 808 525 Fax: 3200 0085 Email: mailto:boo...@cvsol.com davidboccabe...@anubis-systems.com This e-mail and it's contents is confidential to Anubis Systems. This e-mail, any attachments, or any part of can not be reproduced without the express written permission of Anubis Systems From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of mike smith Sent: Wednesday, 17 November 2010 12:06 PM To: ozDotNet Subject: Re: Help with Filesystem On 17 November 2010 11:13, David Boccabella dav...@shamirlens.com.au wrote: Hi folks I have a NETMF project I am trying to work on – but the code from C# Framework 4.1 should work. My target is an SD card and I do not have any database capabilities like SQL.. In the old VB6 days you could create random files, and by defining the record length you could easily move from one record to the next. But I am at loss to find a similar type of functionality in C#. I can understand that to do this I will need to create a class, and serialise that class before storing the object on the disk.. But moving to a particular record has gotten me stuck. The only way I can see at the moment is to use the RecordLength * RecordNum and then SEEK to that byte location on the disk file. What level are you working at with the SD card? low-level SPI, secure or FAT file system? It's a 512 byte block, so you probably want your record to use a multiple of that, or pad it up. (memory's cheap) My memory space is also small so I cannot load the file into memory and move through it as a collection. Any suggestions/advice. Many thanks Dave cid:image002.jpg@01CAF8CB.4090A030 cid:image003.jpg@01CAF8CB.4090A030 David Boccabella IT Manager Shamir Australia Pty Ltd. | 1/23 Luke St. Lytton, QLD, 4178 P.O. Box 3346, Tingalpa DC 4173 P: 1300-553-465 | M: 0433-808-525 | F: 1300-554-075 http://www.shamir.co.il/ www.shamirlens.com.au -- Meski Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills -- Meski Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills image001.jpgimage002.jpg
Re: Help with Filesystem
If you don't mind using the Microsoft.VisualBasic namespace (and assembly, but not Microsoft.VisualBasic.Compatibility), the FileSystem module is still available to you in C#, with FileOpen, FileClose, FileGet and FilePut, with RecordLength and RecordNumber parameters. -- Regards, Mark Hurd, B.Sc.(Ma.)(Hons.) On 17 November 2010 13:11, David Boccabella davidboccabe...@anubis-systems.com wrote: Ok. So it’s a calculate and SEEK I just remember the old (and simple) VB6 system of defining a record and then just using GET and PUT to handle it, and was hoping that there was a ‘modern’ way to do it. Take Care Dave
RE: Help with Filesystem
Thanks guys. I'll have a look but my target is the NETMF and I'm not sure how much space I will have spare after the other code is developed. Currently I'm reading up on BinaryReaders and putting a byte array into a structure. If my structure is all numerics (ints) or char[] then there should not be too much issue. It's strings that seem to be the sticking points with structures due to the overhead's or lengths and padding.. Again thanks for all of your input. Dave David J. Boccabella Proprietor Anubis Systems Phone: 0433 808 525 Fax: 3200 0085 Email: mailto:boo...@cvsol.com davidboccabe...@anubis-systems.com This e-mail and it's contents is confidential to Anubis Systems. This e-mail, any attachments, or any part of can not be reproduced without the express written permission of Anubis Systems From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Ian Thomas Sent: Wednesday, 17 November 2010 1:54 PM To: 'ozDotNet' Subject: RE: Help with Filesystem Yes, as Mark points out, a lot of the VB6 stuff was migrated to .NET (long ago). There is quite a bit of helpful info in the language help, on MSDN (plus the VB6 to VB.NET Wizard, etc). _ Ian Thomas Victoria Park, Western Australia _ From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Mark Hurd Sent: Wednesday, November 17, 2010 11:48 AM To: ozDotNet Subject: Re: Help with Filesystem If you don't mind using the Microsoft.VisualBasic namespace (and assembly, but not Microsoft.VisualBasic.Compatibility), the FileSystem module is still available to you in C#, with FileOpen, FileClose, FileGet and FilePut, with RecordLength and RecordNumber parameters. -- Regards, Mark Hurd, B.Sc.(Ma.)(Hons.)