private void SetupPublic(ChatRoom room) { if (Core.InvokeRequired) { Core.RunInCoreAsync(() => SetupPublic(room)); return; } room.NextPublish = Core.TimeNow; TempLocation.Search(room.RoomID, room, Search_FoundRoom); }
void DownloadFile(SharedFile file) { SharedFile existing = null; Local.Files.LockReading(() => existing = Local.Files.Where(s => Utilities.MemCompare(s.Hash, file.Hash)).FirstOrDefault()); // just add new targets if we already have this file if (existing != null) { if (existing.Completed) { return; } existing.Sources = existing.Sources.Union(file.Sources).ToList(); file = existing; } else { Local.Files.SafeAdd(file); } // if downloading form another client of self if (file.ClientID != Core.Network.Local.ClientID) { file.ClientID = Core.Network.Local.ClientID; Core.RunInGuiThread(GuiCollectionUpdate, Core.UserID); } Core.RunInCoreAsync(() => { if (file.Sources.Count > 0) { OpTransfer transfer = StartTransfer(file.Sources[0], file); file.Sources.ForEach(s => transfer.AddPeer(s)); } TempLocation.Search(file.FileID, file, Search_FoundLocation); }); RunSave = true; file.FileStatus = "Incomplete"; Core.RunInGuiThread(GuiFileUpdate, file); }