Nav

C# Code Example, Omnipressent

Omnipressent was an experiment I worked on, the idea was to use various services like vnc and file transfers to give the impression that multiple computers were one system. Allowing users to drag files from one desktop to another or take control of the speakers on another computer. To make the development manageable I couldn't write each service from scratch so I worked out a way of wrapping services others had developed and coming up with a constant way of passing messages to them and even allowing services to pass messages between each other.Below is the OmniService class that any service we want to use in our program needs to extend. Mainly it needs to provide a way of getting messages and sending messages.

Last but not least the Hub class. The Hub class actually took a lot of work. I tried developing this project before and the whole thing became too unwieldy to continue and I had to find a new route. The Hub is the controller (In the MVC sense) for the whole program. It's pretty small but it took a lot of planning and re-planning to get it that small and if I wasn't coding this whole thing by myself I probably wouldn't have put so much time into making this so small but I needed it to be manageable. I replaced the old controller with more of a message router and by doing that reduced a lot of code I had to write. Any startup functions I needed were outsourced to a script that ran, a happy byproduct of the way messages worked was they could be stored in a text file, essentially creating a scripting language with no extra effort.