public BubbleGroupCache(string guid, string name, DisaThumbnail photo, List <DisaParticipant> participants) { Guid = guid; Name = name; Photo = photo; Participants = participants; }
public TypingContainer(bool typing, bool available, bool isAudio, DisaThumbnail photo) { Typing = typing; Available = available; IsAudio = isAudio; Photo = photo; }
public BubbleGroupCache(string guid, string name, DisaThumbnail photo, List<DisaParticipant> participants) { Guid = guid; Name = name; Photo = photo; Participants = participants; }
public static DisaThumbnail CreatePartyBitmap(Service service, string name, DisaThumbnail big, string bigName, DisaThumbnail small1, string small1Name, DisaThumbnail small2, string small2Name) { return(PlatformImplementation.CreatePartyBitmap(service, name, big, bigName, small1, small1Name, small2, small2Name)); }
public static DisaThumbnail CreatePartyBitmap(Service service, string name, DisaThumbnail big, string bigName, DisaThumbnail small1, string small1Name, DisaThumbnail small2, string small2Name) { return PlatformImplementation.CreatePartyBitmap(service, name, big, bigName, small1, small1Name, small2, small2Name); }
public abstract DisaThumbnail CreatePartyBitmap(Service service, string name, DisaThumbnail big, string bigName, DisaThumbnail small1, string small1Name, DisaThumbnail small2, string small2Name);
public override DisaThumbnail CreatePartyBitmap(Service service, string name, DisaThumbnail big, string bigName, DisaThumbnail small1, string small1Name, DisaThumbnail small2, string small2Name) { throw new NotImplementedException(); }
public static void StitchPartyPhoto(BubbleGroup bubbleGroup, Action <DisaThumbnail> result) { Action <DisaParticipant[]> doIt = participants => { if (participants == null || !participants.Any()) { result(null); return; } DisaThumbnail firstImage = null; string firstName = null; var firstImageFetched = false; DisaThumbnail secondImage = null; string secondName = null; var secondImageFetched = false; DisaThumbnail thirdImage = null; string thirdName = null; var thirdImageFetched = false; Action pushIfAllFetched = () => { if (firstImageFetched && secondImageFetched && thirdImageFetched) { result(Platform.CreatePartyBitmap(bubbleGroup.Service, bubbleGroup.ID, firstImage, firstName, secondImage, secondName, thirdImage, thirdName)); } }; var random = participants.ToList(); if (random.Count > 0) { firstName = random[0].Name; try { bubbleGroup.Service.GetBubbleGroupPartyParticipantPhoto(random[0], result2 => { if (result2 != null && result2.Failed) { result2 = null; } firstImageFetched = true; firstImage = result2; pushIfAllFetched(); }); } catch { firstImageFetched = true; pushIfAllFetched(); } } else { firstImageFetched = true; pushIfAllFetched(); } if (random.Count > 1) { secondName = random[1].Name; try { bubbleGroup.Service.GetBubbleGroupPartyParticipantPhoto(random[1], result2 => { if (result2 != null && result2.Failed) { result2 = null; } secondImageFetched = true; secondImage = result2; pushIfAllFetched(); }); } catch { secondImageFetched = true; pushIfAllFetched(); } } else { secondImageFetched = true; pushIfAllFetched(); } if (random.Count > 2) { thirdName = random[2].Name; try { bubbleGroup.Service.GetBubbleGroupPartyParticipantPhoto(random[2], result2 => { if (result2 != null && result2.Failed) { result2 = null; } thirdImageFetched = true; thirdImage = result2; pushIfAllFetched(); }); } catch { thirdImageFetched = true; pushIfAllFetched(); } } else { thirdImageFetched = true; pushIfAllFetched(); } }; try { if (bubbleGroup.IsParticipantsSetFromService) { doIt(bubbleGroup.Participants.ToArray()); } else { bubbleGroup.Service.GetBubbleGroupPartyParticipants(bubbleGroup, participants => { doIt(participants); }); } } catch { result(null); } }
internal static IEnumerable <BubbleGroupCache> Load() { var location = GetLocation(); if (!File.Exists(location)) { yield break; } lock (BubbleGroupNamesLock) { using (var xmlReader = XmlReader.Create(location)) { while (true) { bool read; try { read = xmlReader.Read(); } catch { Utils.DebugPrint( "Failed to read bubble group names in. Something must've corrupt. Nuking file."); File.Delete(location); yield break; } if (!read) { break; } if (!xmlReader.IsStartElement()) { continue; } switch (xmlReader.Name) { case "BubbleGroupName": var name = xmlReader["Name"]; var guid = xmlReader["Guid"]; DisaThumbnail photo = null; var encodedPhoto = xmlReader["Photo"]; if (encodedPhoto != null) { using (var ms = new MemoryStream(Convert.FromBase64String(encodedPhoto))) { photo = Serializer.Deserialize <DisaThumbnail>(ms); } } var encodedParticipants = xmlReader["Participants"]; List <DisaParticipant> participants = null; if (encodedParticipants != null) { using (var ms = new MemoryStream(Convert.FromBase64String(encodedParticipants))) { participants = Serializer.Deserialize <List <DisaParticipant> >(ms); } } yield return(new BubbleGroupCache(guid, name, photo, participants)); break; } } } } }