public void SendFile(string path, Tuple <FileProcessedHandler, object> processed) { if (Core.InvokeRequired) { Core.RunInCoreAsync(() => SendFile(path, processed)); return; } // add to share list SharedFile file = new SharedFile(Core.Network.Local.ClientID); file.Name = Path.GetFileName(path); file.SystemPath = path; file.Completed = true; file.Sources.Add(Core.Network.Local); file.FileStatus = "Processing..."; file.Processed = processed; // so user can see hash progress Local.Files.SafeAdd(file); Core.RunInGuiThread(GuiFileUpdate, file); ProcessFiles.Enqueue(() => ProcessFile(file)); }
/// <remarks> /// This method is thread safe. /// </remarks> public void QueueSync(ChatModel chatModel) { Trace.Call(chatModel); if (chatModel == null) { throw new ArgumentNullException("chatModel"); } WorkerQueue.Enqueue(delegate { SyncWorker(chatModel); }); }
public void MarkforHash(LocalFile file, string path, uint project, string dir) { HashPack pack = new HashPack(file, path, project, dir); lock (HashFiles.Pending) if (HashFiles.Pending.Any(p => ((HashPack)p.Param2).File == file)) { return; } file.Info.Size = new FileInfo(path).Length; // set so we can get hash status HashFiles.Enqueue(() => HashFile(pack), pack); }
public void OpenFile(ulong user, SharedFile file) { if (!File.Exists(GetFilePath(file))) { return; } // check if already exists, if it does open if (file.SystemPath != null && File.Exists(file.SystemPath)) { Process.Start(file.SystemPath); return; } OpenFiles.Enqueue(() => OpenFile(file)); }
/// <remarks> /// This method is thread safe. /// </remarks> public void QueueAdd(ChatModel chatModel) { Trace.Call(chatModel); if (chatModel == null) { throw new ArgumentNullException("chatModel"); } var chatKey = GetChatKey(chatModel); lock (SyncWaitQueue) { SyncWaitQueue.Add(chatKey, new AutoResetEvent(false)); #if LOG4NET Logger.Debug("QueueAdd() <" + chatKey + "> created sync lock"); #endif } WorkerQueue.Enqueue(delegate { AddWorker(chatModel); }); }
private void rasterizeChunk(Chunk chunk) { float distance = player.GetDistance(chunk.Position); renderQueue.Enqueue(distance, new RasterizeWorker(chunk)); }
private void generateChunk(Chunk chunk) { float distance = player.GetDistance(chunk.Position); generateQueue.Enqueue(distance, new GenerateWorker(chunk, world)); }
public IActionResult Calculate(Calculation calculation) { workerQueue.Enqueue((token) => CalculateInternal(calculation)); return(Ok()); }
public void Write(LogContent logDoc) { _localLogQueue.Enqueue(logDoc); }