public virtual void Serialize(SyncItem item, Stream outputStream) { using (var writer = new StreamWriter(outputStream)) { item.Serialize(writer); } }
public void SaveItem(SyncItem syncItem) { Assert.ArgumentNotNull(syncItem, "syncItem"); var newPath = GetPhysicalSyncItemPath(syncItem); var parentPath = Path.GetDirectoryName(newPath); if (parentPath != null) { Directory.CreateDirectory(parentPath); } using (new WatcherDisabler(_watcher)) { using (var fileStream = File.Open(newPath, FileMode.Create, FileAccess.Write, FileShare.Write)) { using (var writer = new StreamWriter(fileStream)) { syncItem.Serialize(writer); } } } _index.UpdateIndexes(syncItem); }
private static void WriteResultsToFile(Stream stream, SyncItem syncItem) { TruncateFile(stream); using (TextWriter writer = new StreamWriter(stream)) { syncItem.Serialize(writer); } }
public static void SaveSyncItem(SyncItem item, string path) { using (var fileStream = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None)) { using (var writer = new StreamWriter(fileStream)) { item.Serialize(writer); } } }
public void CreateItem(SyncItem syncItem) { var newPath = PathUtils.GetFilePath(new ItemReference(syncItem.DatabaseName, syncItem.ItemPath).ToString()); var parentPath = Path.GetDirectoryName(newPath); Directory.CreateDirectory(parentPath); using (var fileStream = File.Open(newPath, FileMode.CreateNew, FileAccess.Write, FileShare.Write)) { using (var writer = new StreamWriter(fileStream)) { syncItem.Serialize(writer); } } _innerItems.Add(syncItem); }
public static SyncItem Clone(this SyncItem item) { using (var ms = new MemoryStream()) { using (var writer = new StreamWriter(ms)) { item.Serialize(writer); writer.Flush(); ms.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(ms)) { return(SyncItem.ReadItem(new Tokenizer(reader))); } } } }
public void SaveItem(SyncItem syncItem) { Assert.ArgumentNotNull(syncItem, "syncItem"); var newPath = GetPhysicalSyncItemPath(syncItem); var parentPath = Path.GetDirectoryName(newPath); if (parentPath != null) Directory.CreateDirectory(parentPath); using (new WatcherDisabler(_watcher)) { using (var fileStream = File.Open(newPath, FileMode.Create, FileAccess.Write, FileShare.Write)) { using (var writer = new StreamWriter(fileStream)) { syncItem.Serialize(writer); } } } _index.UpdateIndexes(syncItem); }