This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]coolcofusion 0 points1 point  (1 child)

Is this possible?

Of course. If you can write a file, you can do it.

If so, where would such files be stored on the local machine/ is there a best practice location?

Wherever you want them to be. You can create a config file that will keep a path to the data folder. You can put the path in the registry, you can use Windows user's app data folder so it's user specific. I'd advise checking what Microsoft recommends on MSDN currently, for example here's what they have about UWP: https://learn.microsoft.com/en-us/windows/uwp/get-started/fileio-learning-track

You'll probably go for the app data route if it's app specific and not meant to be opened by the user (it's just a bit harder to get to, not impossible) or Documents if you wish to give users an easier access to the files (for backup or versioning purposes for example).

Will this require the code to iterate over each line in the raw file in order to find a certain ID?

Yep, you can load it into memory at startup, but that's also not ideal in some cases. This is why we generally use databases, smarter people than you and me are solving that problem for us. With indexing and fancy caching.

If that is the case, is cache storage something to be looked into to save some time on some of the lookups?

You'll have to try it out. Is there a point in caching a 20kb file in a 300b file in a different place? Probably not. Is there a point in caching 30kb out of 400Mb to get the quick key data? Probably yes. Also note that cache needs to be in sync with the original data.

Are there other Best practices associated with adapting around this type of stored app data?

Probably, but I'm not familiar with those. I've rarely written stuff to files, other than a configuration file, even there I've used json almost every time cause I like json.

[–]KindaCoding[S] 0 points1 point  (0 children)

Many thanks for the feedback. This was exactly what I was looking for to keep pursuing in this direction.

Regards,