Question

Second Year Software Engineering student here. I want to make a file managing system for a C# notetaking app, every note will be represented by a file and will display a small preview of it, furthermore all notes should be query-able, rearrangeable and editable, the whole system it self should be portable to other platforms too.

I had to drop a simple implementation based on the file system although it might be simple and reliable, querying, editing and previewing all have to be done through the OS it self and then updated into the UI, making the app more depended and rooted to its platform, loading up the entire file is not that recourse friendly either (there is always storage.getfilesAsync but it don't provide much more than a list of paths)

The next logic step was to look at SQLite, while it surely has all the managing tools I wanted it kinda feels like an overkill and is a third party solution so I don’t get into all the fuzz installing it and tuning it, I thought there should a simpler built in alternative to it.

So Looked into Implementing a Directory file on XML, my idea was to put a small preview of the Note on each element, the file path that represented it and misc metadata like date. This way I would just load up my directory file that has all the Previews and addresses on it and It would just open each file dynamically based on its saved path when the user wanted it.

This implementation looks almost perfect to me:

• Its lightweight in terms of resource use,

• The xml can be ported and send to other platforms easily providing a backbone of my file system to other platforms

• Its a very simple built-in one file solution compared to sqlite.

To top this all up, C# has LinQ, it allows the user to treat the XML file like if it was a database, it pretty much gives the ability to write sql queries against it, which to me looks pretty awesome and incredible useful for my usecase.

But, I like to question everything, and its part of the reason why im here, please tell me what you think about this implementation:

  • Are there any pitfalls?
  • Is there an even better way than this ?
  • Are implementations like this an often sight in the Industry ?
Was it helpful?

Solution

I figured it out, i was over complicating the whole thing, i will just append the metadata on the filename, this way when i call StorageFolder.GetfilesAsync() i will get all the folder-paths and then extract the metadata from them, best part is that This getfoldersasync Function does not open up a stream against them.

After that i can always save them to an IENUMARABLE list that can be easily turned into xml that will be used for cross server/platform comms

Licensed under: CC-BY-SA with attribution
scroll top