|
Member 4664921 wrote: When you refer to lists I'm assuming you mean Generics?
Well, a generic list is always best, but generics is far more than list classes.
But, if you store the list, surely it's always out of date, and if you rescan to make sure it's up to date, you may as well rebuild the list ?
Depending on how many different things you want to search on, a dictionary where the key is the search term could be a good idea.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
That is a good point about the list being out of date. In most scenarios that would be true. The app I'm building is targeted towards a really small user base where the list of potential files is pretty static meaning that the persisted data is going to be correct for the majority of the time bearing in mind the small list of file types the app will deal with.
That said I used this model for the FoxPro version of the app due to the scanning process being pretty slow. If it could be sped up it would indeed make more sense to rescan each time the app was loaded and present a fresh set of data to the user. Also in future versions I plan to add in some functionality that could take seconds to process each file meaning the persistence of data might still be a good idea in that scenario.
One major consideration here is also whether to scan the whole machine or limit the scope of the scan to a single drive in the machine or even a single directory on a drive.
As for the making sure its up-to-date ... I haven't got that far in my planning!!
I'm going to have a read up in more depth about generics and dictionaries, do you have any good links on those topics?
Thanks so much for your input on this, much appreciated.
James.
|
|
|
|
|
I would suggest that perhaps you need to show the old data while another thread scans for new data to bring it up to date.
Generics just means being able to specify a type as an argument, so you can build one class and use it in a typesafe way for many classes. A dictionary is a hashtable, so it has two arguments, a key and a value. This allows you to look up items by any key you like, instead of an index. You can then iterate over the keys until you find a match, then use the key to look up your value.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Having read a little on the topics and idea's you've mentioned it seem like I should:
store the file system recursion results in a generic list with all the values for each file
store the look up information in generic dictionaries, I'll need to use a few dictionaries it seems as the current FoxPro look ups contain about 5 items. I'll need 5 dictionaries that all share keys in order to tie them back together coherantly.
|
|
|
|
|
Yes, if you make your core object a class, then you'll be storing references, so it won't be expensive to build 5 dictionaries.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Gotcha ...
I know this may seem ridiculous to someone with your experience but bear with me!
I'm assuming you mean creating a class that defines an object (the core object in the shape of a generic list of files) and all the dictionaries within that same object.
Honestly, I'm still a bit unsure what *exactly* an object is. I've used them, and made them but to say that I truly understand the limits of their application would be an overstatement in the extreme!!
I need an OOP for dummies book.
|
|
|
|
|
Member 4664921 wrote: I'm assuming you mean creating a class that defines an object (the core object in the shape of a generic list of files) and all the dictionaries within that same object.
Correct
An object ( a class ) is really just a combination of properties and methods that work on those properties, that work together to define a single concept, such as a database record, a file entry, or whatever.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Sometimes I surprise myself!
Coming from a FoxPro background (ie: not true OOP as I understand it) I had a vague concept in my mind that you could draw a direct comparison to a computer programming based "Object" as something akin to an object in the real world. Every distinct "thing" in the real world is an object and each have properties (such as size, colour, smell etc ...). However, I guess through lack of reading, that the lines between my understanding of what exactly were/are the differences between a class and an Object were still fuzzy. Your brief clarification has been extremely helpful.
Also getting "into" something like .NET and C# at this stage is no mean feat. I'm still reeling in terms of learning just how BIG the .NET framework is.
Anyway, thank you for this great input. Lots of thinking to do!
Regards,
James.
|
|
|
|
|
np - glad to help
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm currently making a game (as always) and can't seem to make a Projectile class work right. Can someone just explain the concept of it. I really just don't understand how you get a sprite from the class. (?)
- I love D-flat!
- Need. More. Code.
modified on Saturday, February 23, 2008 5:26 PM
|
|
|
|
|
MasterSharp wrote: I really just don't understand how you get a sprite from the class. (?)
However you like. You either store an image ( or sequence of images ) statically in the class ( and an image index if you're using a sequence ), or whatever. Are you using DirectX ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Oh sorry, XNA.
- I love D-flat!
- Need. More. Code.
|
|
|
|
|
I see...
- I love D-flat!
- Need. More. Code.
|
|
|
|
|
Hi all,
i was wandering, if it is possible to create a picture of a loaded Form ?
Janko
|
|
|
|
|
You mean a Screen Capture? Click the button on your keyboard that says PrtScn, or something that would mean Print Screen. Then open up your favorite image editing software and paste it in. MSPaint works well.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I mean doing it programaticaly (in code)
|
|
|
|
|
There are a number of articles on this site on screen capture, I know Nish has one.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Well what i am looking for, is the possibility to draw a form into image without displaying it...
|
|
|
|
|
Yes, the form class apears to have a 'DrawToBitmap' method that you could use.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
OMG i must have been blind :P
TY
|
|
|
|
|
Use the DrawToBitmap method of the form.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
I need a free obfuscator so no one can see my C# code.
any recommendations?
Thanks
|
|
|
|
|
|
|
If you've got Visual Studio Professional or above then you've got a Community Edition obfuscator in there.
|
|
|
|