- Timestamp:
- 11/27/08 17:05:05 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r838 r842 7 7 using HeuristicLab.Hive.Contracts; 8 8 using HeuristicLab.Core; 9 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 10 using System.Resources; 11 using System.Reflection; 9 12 10 13 namespace HeuristicLab.Hive.Server.Core { … … 17 20 int nrOfJobs = 1; 18 21 22 IClientAdapter clientAdapter; 23 ResourceManager rm; 24 19 25 public ClientCommunicator() { 26 clientAdapter = ServiceLocator.GetClientAdapter(); 27 rm = new ResourceManager("HiveServerMessages.resx", Assembly.GetExecutingAssembly()); 28 20 29 jobs = new LinkedList<long>(); 21 30 for (long i = 0; i < nrOfJobs; i++) { … … 27 36 28 37 public Response Login(ClientInfo clientInfo) { 29 if (clients == null)30 clients = new List<ClientInfo>();31 32 clients.Add(clientInfo);33 34 38 Response response = new Response(); 35 39 response.Success = true; 36 response.StatusMessage = "Client with GUID " + clientInfo.ClientId + " successuflly logged in"; 40 41 ICollection<ClientInfo> allClients = clientAdapter.GetAllClients(); 42 foreach (ClientInfo client in allClients) { 43 if (client.ClientId.Equals(clientInfo.ClientId)) { 44 if (client.State != State.offline) { 45 response.Success = false; 46 response.StatusMessage = rm.GetString("UserAllreadyOnline"); 47 break; 48 } else 49 break; // searching for clients can be stopped, because it was found and it's state is offline 50 } 51 } 52 53 if (response.Success) { 54 clientAdapter.UpdateClient(clientInfo); 55 response.Success = true; 56 response.StatusMessage = rm.GetString("LoginSuccess"); 57 } 37 58 38 59 return response;
Note: See TracChangeset
for help on using the changeset viewer.