Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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);
     }
 }