Analysis: various warnings fixed

Fixes the following CA warnings:

- [CA1024](http://msdn.microsoft.com/en-us/library/ms182181.aspx)
- [CA1045](http://msdn.microsoft.com/en-us/library/ms182146.aspx)
- [CA1051](http://msdn.microsoft.com/en-us/library/ms182141.aspx)
- [CA1500](http://msdn.microsoft.com/en-us/library/ms182216.aspx)
- [CA1304](http://msdn.microsoft.com/en-us/library/ms182189.aspx)
- [CA1305](http://msdn.microsoft.com/en-us/library/ms182190.aspx)
- [CA1307](http://msdn.microsoft.com/en-us/library/bb386080.aspx)