Exemplo n.º 1
0
        /// <summary>
        /// Returns network profile information about the client's identity.
        /// </summary>
        /// <param name="IncludeThumbnailImage">If true, the returned profile information will include thumbnail image.</param>
        /// <returns>network profile information about the client's identity.</returns>
        public IdentityNetworkProfileInformation GetIdentityNetworkProfileInformation(bool IncludeThumbnailImage)
        {
            log.Trace("(IncludeThumbnailImage:{0})", IncludeThumbnailImage);

            IdentityNetworkProfileInformation res = new IdentityNetworkProfileInformation()
            {
                IdentityPublicKey = ProtocolHelper.ByteArrayToByteString(keys.PublicKey),
                IsHosted          = false,
                IsOnline          = false,
                Latitude          = location.GetLocationTypeLatitude(),
                Longitude         = location.GetLocationTypeLongitude(),
                Name      = name != null ? name : "",
                Type      = type != null ? type : "",
                Version   = version.ToByteString(),
                ExtraData = extraData != null ? extraData : ""
            };

            if (IncludeThumbnailImage && (thumbnailImage != null))
            {
                res.ThumbnailImage = ProtocolHelper.ByteArrayToByteString(thumbnailImage);
            }
            else
            {
                res.ThumbnailImage = ProtocolHelper.ByteArrayToByteString(new byte[0]);
            }

            log.Trace("(-)");
            return(res);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs a search query on the profile server's hosted identities.
        /// </summary>
        /// <param name="NameFilter">Name filter of the search query, or null if name filtering is not required.</param>
        /// <param name="TypeFilter">Type filter of the search query, or null if type filtering is not required.</param>
        /// <param name="LocationFilter">Location filter of the search query, or null if location filtering is not required.</param>
        /// <param name="Radius">If <paramref name="LocationFilter"/> is not null, this is the radius of the target area.</param>
        /// <param name="IncludeImages">If set to true, the search results should include images.</param>
        /// <returns>List of hosted profiles that match the given criteria.</returns>
        public List <IdentityNetworkProfileInformation> SearchQuery(string NameFilter, string TypeFilter, GpsLocation LocationFilter, int Radius, bool IncludeImages)
        {
            log.Trace("(NameFilter:'{0}',TypeFilter:'{1}',LocationFilter:'{2}',Radius:{3},IncludeImages:{4})", NameFilter, TypeFilter, LocationFilter, Radius, IncludeImages);

            List <IdentityNetworkProfileInformation> res = new List <IdentityNetworkProfileInformation>();

            foreach (IdentityClient client in hostedIdentities)
            {
                if (client.MatchesSearchQuery(NameFilter, TypeFilter, LocationFilter, Radius))
                {
                    IdentityNetworkProfileInformation info = client.GetIdentityNetworkProfileInformation(IncludeImages);
                    res.Add(info);
                }
            }

            log.Trace("(-):*.Count={0}", res.Count);
            return(res);
        }