コード例 #1
0
        public bool Add(Connection Connection)
        {
            if (Clients == null)
            {
                return(false);
            }
            if (Contains(Connection))
            {
                return(false);
            }
            if (Connection.Key.Length == 0)
            {
                return(false);
            }

            List <string> Result = Keys.Get(Connection.Key);

            if (Result == null)
            {
                Result = new List <string>();
            }

            Result.Add(Connection.GUID);

            if (Result.Count == 1)
            {
                if (!Keys.Addb(Connection.Key, Result))
                {
                    return(false);
                }
            }

            return(Clients.Addb(Connection.GUID, Connection));
        }
コード例 #2
0
        public List <Connection> Get(string Key, bool Devices)
        {
            if (Keys == null)
            {
                return(null);
            }
            if ((Key == null) || Key.Length == 0)
            {
                return(null);
            }

            List <string>     Result  = Keys.Get(Key);
            List <Connection> Matches = new List <Connection>();

            if (Result == null)
            {
                Result = new List <string>();
            }

            foreach (string Guid in Result)
            {
                Connection Match = Clients.Get(Guid);

                if (Match == null)
                {
                    continue;
                }
                if (Match.Device != Devices)
                {
                    continue;
                }

                Matches.Add(Match);
            }

            return(Matches);
        }