/// <summary> /// Seek an async handler by its associated queue file full path or raw name. /// </summary> /// <param name="queueName">queue file full path or raw name</param> /// <returns>An async handler if found; and null or nothing if none is found</returns> public virtual THandler SeekByQueue(string queueName) { THandler h = null; if (queueName == null || queueName.Length == 0) { return(null); } char[] empty = { ' ', '\t', '\r', '\n' }; queueName = queueName.Trim(empty); switch (System.Environment.OSVersion.Platform) { case PlatformID.Win32S: case PlatformID.Win32NT: case PlatformID.Win32Windows: case PlatformID.WinCE: case PlatformID.Xbox: queueName = queueName.ToLower(); break; default: break; } lock (m_cs) { string rawName; string appName; unsafe { appName = new string((sbyte *)ClientCoreLoader.GetClientWorkDirectory()); } foreach (CClientSocket cs in m_dicSocketHandler.Keys) { if (!cs.ClientQueue.Available) { continue; } if (cs.ClientQueue.Secure) { rawName = queueName + "_" + appName + "_1.mqc"; } else { rawName = queueName + "_" + appName + "_0.mqc"; } string queueFileName = cs.ClientQueue.QueueFileName; int len = queueFileName.Length; int lenRaw = rawName.Length; if (lenRaw > len) { continue; } int pos = queueFileName.LastIndexOf(rawName); //queue file name with full path if (pos == 0) { return(m_dicSocketHandler[cs]); } //queue raw name only if ((pos + lenRaw) == len) { return(m_dicSocketHandler[cs]); } } } return(h); }