Esempio n. 1
0
        private static OrbResponse OnExecuteRequest(string alias, OrbClientInfo clientInfo, OrbRequestArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return(null);
            }

            OrbRequest  request  = GetRequest(alias, client);
            OrbResponse response = null;

            if (request != null)
            {
                ManualResetEvent reset = new ManualResetEvent(false);
                request.ResetEvent = reset;

                new RequestSyncTimer(client, request, args).Start();
                reset.WaitOne();

                response = request.Response;
            }

            return(response);
        }
Esempio n. 2
0
        private static OrbResponse OnExecuteRequest(string alias, OrbClientInfo clientInfo, OrbRequestArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return(null);
            }

            OrbResponse response = null;

            try
            {
                OrbRequest request = GetRequest(alias, client);

                if (request != null)
                {
                    ManualResetEvent reset = new ManualResetEvent(false);
                    request.ResetEvent = reset;

                    new RequestSyncTimer(client, request, args).Start();
                    reset.WaitOne();

                    response = request.Response;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception occurred for OrbServer request {0}\nMessage: {1}", alias, e.Message);
            }

            return(response);
        }
Esempio n. 3
0
        private static void OnExecuteCommand(string alias, OrbClientInfo clientInfo, OrbCommandArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return;
            }

            OrbCommand command = GetCommand(alias, client);

            if (command != null)
            {
                new CommandSyncTimer(client, command, args).Start();
            }
        }
Esempio n. 4
0
        private static bool CanConnectionAccess(OrbClientState client, OrbRegistryEntry entry)
        {
            bool authorized = false;

            if (entry.RequiresLogin)
            {
                if (client.OnlineMobile != null)
                {
                    authorized = IsAccessAllowed(client.OnlineMobile, entry.RequiredLevel);
                }
            }
            else
            {
                authorized = IsAccessAllowed(client.Account, entry.RequiredLevel);
            }

            return(authorized);
        }
Esempio n. 5
0
        private static OrbCommand GetCommand(string alias, OrbClientState client)
        {
            OrbRegistryEntry entry   = (OrbRegistryEntry)m_Registry[alias];
            OrbCommand       command = null;

            if (entry != null)
            {
                if (CanConnectionAccess(client, entry))
                {
                    try
                    {
                        command = (OrbCommand)Activator.CreateInstance(entry.Type);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("OrbServer Exception: " + e.Message);
                    }
                }
            }

            return(command);
        }
Esempio n. 6
0
        private static OrbRequest GetRequest(string alias, OrbClientState client)
        {
            OrbRegistryEntry entry   = (OrbRegistryEntry)m_Registry[alias];
            OrbRequest       request = null;

            if (entry != null)
            {
                if (CanConnectionAccess(client, entry))
                {
                    try
                    {
                        request = (OrbRequest)Activator.CreateInstance(entry.Type);
                    }
                    catch (Exception e)
                    {
                        Misc.ExceptionLogging.WriteLine(e);
                    }
                }
            }

            return(request);
        }
Esempio n. 7
0
        private static void OnExecuteCommand(string alias, OrbClientInfo clientInfo, OrbCommandArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return;
            }

            try
            {
                OrbCommand command = GetCommand(alias, client);

                if (command != null)
                {
                    new CommandSyncTimer(client, command, args).Start();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception occurred for OrbServer command {0}\nMessage: {1}", alias, e.Message);
            }
        }
Esempio n. 8
0
			public CommandSyncTimer(OrbClientState client, OrbCommand command, OrbCommandArgs args) : base(TimeSpan.FromMilliseconds(20.0), TimeSpan.FromMilliseconds(20.0))
			{
				m_Client = client;
				m_Command = command;
				m_Args = args;
			}
Esempio n. 9
0
			public RequestSyncTimer(OrbClientState client, OrbRequest request, OrbRequestArgs args) : base(TimeSpan.FromMilliseconds(20.0), TimeSpan.FromMilliseconds(20.0))
			{
				m_Client = client;
				m_Request = request;
				m_Args = args;
			}
Esempio n. 10
0
		private static bool CanConnectionAccess(OrbClientState client, OrbRegistryEntry entry)
		{
			bool authorized = false;

			if(entry.RequiresLogin)
			{
				if(client.OnlineMobile != null)
				{
					authorized = IsAccessAllowed(client.OnlineMobile, entry.RequiredLevel);
				}
			}
			else
			{
				authorized = IsAccessAllowed(client.Account, entry.RequiredLevel);
			}

			return authorized;
		}
Esempio n. 11
0
		private static OrbCommand GetCommand(string alias, OrbClientState client)
		{
			OrbRegistryEntry entry = (OrbRegistryEntry)m_Registry[alias];
			OrbCommand command = null;

			if(entry != null)
			{
				if(CanConnectionAccess(client, entry))
				{
					try
					{
						command = (OrbCommand)Activator.CreateInstance(entry.Type);
					}
					catch(Exception e)
					{
						Console.WriteLine("OrbServer Exception: " + e.Message);
					}
				}
			}

			return command;
		}
Esempio n. 12
0
 public CommandSyncTimer(OrbClientState client, OrbCommand command, OrbCommandArgs args) : base(TimeSpan.FromMilliseconds(20.0), TimeSpan.FromMilliseconds(20.0))
 {
     m_Client  = client;
     m_Command = command;
     m_Args    = args;
 }
Esempio n. 13
0
 public RequestSyncTimer(OrbClientState client, OrbRequest request, OrbRequestArgs args) : base(TimeSpan.FromMilliseconds(20.0), TimeSpan.FromMilliseconds(20.0))
 {
     m_Client  = client;
     m_Request = request;
     m_Args    = args;
 }