public void Save(FileTransferQueue queue) { var str = JsonConvert.SerializeObject(queue.FlushItems(), Formatting.Indented, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }); using (var writer = new StreamWriter(GetFullPath(queue.Name))) { writer.Write(str); } }
/// <summary> /// Try to send currently queued items /// </summary> public void ApplyQueue() { foreach (var item in fileQueue.FlushItems()) { try { ApplyItem(item); } catch (FileSystemException ex) { Log.Error(string.Format("Cannot send item ({0}): issue in file system.", item), ex); NotifyEvent(NotificationType.Error, item); } catch (Exception ex) { Log.Error(string.Format("Cannot send item ({0}): not managed issue.", item), ex); NotifyEvent(NotificationType.Error, item); } } }