Exemple #1
0
        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);
            }
        }
Exemple #2
0
 public Synchronizer(SyncTarget syncTarget)
 {
     this.syncTarget = syncTarget;
 }
Exemple #3
0
 public Snapshot(SyncTarget syncTarget, string id)
 {
     this.syncTarget = syncTarget;
     this.Id = id;
 }