Win8 - Class Tools
If you are new to windows 8 programming and having trouble grasping some of the new concepts in the new windows 8 API’s then you have come to the right place! In this article I will supply you with some basic concept descriptions but most important a library that can / may help your development.
One of the main new features of windows 8 API's is the sandbox concepts that limits the programmers to only work with specific files and folders. So where you in older windows systems have access to almost any file / data stored on the system, now you can only access a very basic set of folders, and have to ask the user for permission each time you need anything other than these basic folders. The API simply doesn’t allow you to just open any file e.g. "c:\\Test.xml".
Just like in previous versions, in the API there’s a set of basic functions that you can combine to open, read, write streams, and then there’s some features that builds on top of that. But because the security have been tightened that much you can no longer just do stuff like [
So what can you do?
Well most people jump right to google (or some other search engine) and start browsing for "how to do this" guides and examples. Perhaps ending up asking questions on different forums. And that’s actually very fine! Better to learn from others than doing trial and error :-) And in this article I’m not aiming to change the API or get people to act different. What I am trying, is to give an alternative to learning the new API. The thing I try is to give you a new possibility to doing the windows 8 stuff.
My work with this particular library is to make it easy to use the new sand box environment! The concept will be to give you a set of functions where you specify Where to get the data, and what file to get. That's it...
So let’s look at my API.
The core mechanism is...
You have these locations to pick from.
- Local storage
- Install directory
To open a file for reading you just do like this:
To write a file you just do.
It's that simple :-)
So how about serializing data?
In previous versions of windows and .Net it was very simple, and it kind of still are. Especially when you use my file methods. Then you can in one line get a file stream to write to, and in 4-5 lines serialize to that file. Well I went a step beyond that!
This is a relatively simple class called "Test" that just inherits from my interface "ISavable" and that interface has NO implementation requirements. So you can add the interface to any existing class just by adding the keyword.
The first line gets a writable file stream, the second XML serializes (Writes it to xml format) the instance into the file. That's it you’re done! You now have an xml file that contains the whole instance...
And to extract it again is just as simple..
So how come is it that simple when the Microsoft API is not?
That's a good question! It's because the MS API aims to give you all the functionality that you could ever need. Not just the most simple and basic functionality. And trying to give you every possibility will make things harder to do in a simple way. Personally I thing they have done a very good job, and any experienced programmer that has had the time to learn the API's may not need anything else.
But if you are a relatively new programmer, or just need a fast way to write some code that work then this collection of stuff is very great!
So where do I get the lib to try?
Right here - Download -
Full path link:
The library is in principle free and you can use / try it as long as you like... But if you think this article was useful I will be very glad to receive donations to fund my further development! Any amounts will be accepted with gratitude!