private static void authentication_call(ClientConfig config, string eventName)
        {
            _PMClient.Authentication authObject = new _PMClient.Authentication ();
            authObject.ClientName = config.ClientName;
            authObject.ClientPassword = config.ClientPassword;
            authObject.ClientToken = config.ClientToken;
            authObject.ClientAuthenticated = false;

            PurpleNetwork.ToServer (eventName, authObject);
        }
        public static void AuthenticateSwitch(ClientConfig config)
        {
            _PMClient.Authentication authObject = new _PMClient.Authentication ();
            authObject.ClientName = config.ClientName;
            authObject.ClientToken = config.ClientToken;
            authObject.ServerSwitchToken = config.ServerSwitchToken;
            authObject.ClientAuthenticated = false;

            PurpleNetwork.ToServer ("client_authenticate_switch", authObject);		// TODO: function calls - Server side
        }
        private void connect_to_server(ClientConfig configObject)
        {
            currentClientConfig = configObject;
            Handler.Base.register_base_handler ();

            PurpleNetwork.ConnectToServer (currentClientConfig.ServerHost, currentClientConfig.ServerPassword,
                                           currentClientConfig.ServerPort);
        }
 public static void SwitchServer(ClientConfig configObject)
 {
     Instance.switch_server (configObject);
 }
 public static void Connect(ClientConfig configObject)
 {
     Instance.connect_to_server (configObject);
 }
 // START UP /////////////////////////
 protected PurpleClient()
 {
     currentClientConfig = new ClientConfig ();
     currentClientConfig.Load ();
 }
 private void switch_server(ClientConfig configObject)
 {
     currentClientConfig = configObject;
     PurpleNetwork.SwitchServer (currentClientConfig.ServerHost, currentClientConfig.ServerPassword,
                                 currentClientConfig.ServerPort);
 }
 public static void Logout(ClientConfig config)
 {
     authentication_call(config, "client_logout");
 }
 public static void GenerateToken(ClientConfig config)
 {
     authentication_call(config, "client_generate_token");
 }
 public static void Authenticate(ClientConfig config)
 {
     authentication_call(config, "client_authenticate");
 }