public void storeTask(SkTaskModel recognitionTask) { if (!Exist(recognitionTask)) { lock (TaskDb) { using (StreamWriter sw = File.AppendText(this.TaskDbFilePath)) { sw.WriteLine($"{recognitionTask.Path}; {recognitionTask.AudioUrl}; {recognitionTask.TaskId}"); TaskDb.Add(recognitionTask.Path, recognitionTask); sw.Flush(); } } } }
private void loadTasksDbFile() { if (!new FileInfo(this.TaskDbFilePath).Exists) { log.Warning($"Task file {this.TaskDbFilePath} not exists"); return; } SkTaskModel[] tasks = File.ReadAllLines(this.TaskDbFilePath) .Select(SplitAndFill) .ToArray(); foreach (SkTaskModel t in tasks) { TaskDb.Add(t.Path, t); } }