示例#1
0
        private async Task <Dictionary <string, List <SLMessage> > > GetMessagesForGroupIDs(Dictionary <string, List <string> > groupsIDsForSubareas)
        {
            Dictionary <string, List <SLMessage> > messagesForGroups = new Dictionary <string, List <SLMessage> >();
            HashSet <string> groupsIDs = new HashSet <string>();

            foreach (KeyValuePair <string, List <string> > groupsIDsForSubarea in groupsIDsForSubareas)
            {
                foreach (string groupID in groupsIDsForSubarea.Value)
                {
                    if (!groupsIDs.Contains(groupID))
                    {
                        groupsIDs.Add(groupID);
                        List <SLMessage> messages = await slWebApiClient.GroupsHistoryAsync(groupID);

                        messagesForGroups.Add(groupID, messages);
                    }
                }
            }
            return(messagesForGroups);
        }
示例#2
0
        private async Task <bool> BuildWasPosted(int messageUid, string channelID)
        {
            List <SLMessage> messages = await slWebApiClient.GroupsHistoryAsync(channelID);

            int uID = 0;

            foreach (SLMessage message in messages)
            {
                if (message.text.StartsWith(cBuildStartLine))
                {
                    string[] parts  = message.text.Split(new char[] { ' ' });
                    string   uidStr = parts[0].Substring(cBuildStartLine.Length - 1, parts[0].Length - cBuildStartLine.Length);
                    Int32.TryParse(uidStr, out uID);
                    if (uID != 0)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }