using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.Synchronization.Local
{
///
/// Represents an SQLite to SQLite file synchronizer.
///
public class LocalDBSynchronizer
{
///
/// Synchronizes the specified master and slave SQLite files.
///
/// The master SQLite file.
/// The slave SQLite file.
///
public static List Synchronize(String masterSQLiteFile, String slaveSQLiteFile)
{
using (LocalDBComparer comparer = new LocalDBComparer(new SQLiteDataBase(masterSQLiteFile), new SQLiteDataBase(slaveSQLiteFile)))
{
var diffs = comparer.Compare();
foreach (var diff in diffs)
{
diff.Commit();
}
return diffs;
}
}
///
/// Synchronizes the specified master and slave SQLite files asynchronously.
///
/// The master SQLite file.
/// The slave SQLite file.
///
public static Task> SynchronizeAsync(String masterSQLiteFile, String slaveSQLiteFile)
{
return Task.Factory.StartNew>(() => { return Synchronize(masterSQLiteFile, slaveSQLiteFile); });
}
}
}