public static void SerializeSnapshot(Dictionary<string, string> data, SyncTarget syncTarget) { var id = Guid.NewGuid().ToString(); Directory.CreateDirectory(Path.Combine(syncTarget.AConfig, id)); new DirectoryInfo(syncTarget.AConfig).Attributes |= FileAttributes.Hidden; Directory.CreateDirectory(Path.Combine(syncTarget.BConfig, id)); new DirectoryInfo(syncTarget.BConfig).Attributes |= FileAttributes.Hidden; var fileName = Path.Combine(syncTarget.AConfig, id, "snapshot"); using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) { var serializer = new DataContractJsonSerializer(data.GetType()); serializer.WriteObject(fs, data); } }
public Synchronizer(SyncTarget syncTarget) { this.syncTarget = syncTarget; }
public Snapshot(SyncTarget syncTarget, string id) { this.syncTarget = syncTarget; this.Id = id; }