private StreamWriterWithInfo GetTextAppenderStreamWriter(string key, bool isJson) { if (streamWriters.ContainsKey(key)) { return(streamWriters[key]); } StreamWriterWithInfo sw = new StreamWriterWithInfo(key, true, isJson); streamWriters.Add(key, sw); return(sw); }
protected virtual bool AppendToTextFile(string fileLocation, string text, bool isJson) { try { lock (lockObjectDownload) { StreamWriterWithInfo sw = GetTextAppenderStreamWriter(fileLocation, isJson); sw.WriteLine(text); } return(true); } catch (IOException ex) when((ex.HResult & 0xFFFF) == 0x27 || (ex.HResult & 0xFFFF) == 0x70) { Logger.Error("Downloader:AppendToTextFile: {0}", ex); shellService.ShowError(ex, Resources.DiskFull); crawlerService.StopCommand.Execute(null); return(false); } catch { return(false); } }