none
Microsoft Sync Framework 文件同步,远程目录的同步 怎样做呢? RRS feed

  • 问题

  • Microsoft Sync Framework 文件同步,帮助文档上面说明是支持远程目录,但是对于远程目录的文件同步我应该怎样编程呢
    2014年10月20日 6:37

答案

  • 你好:

    我没有接触过这方便的东西,但是看了一下文档,本地文件同步和远程文件同步区别应该不大,建议你看一下MSDN上的文章和实例代码:

    https://code.msdn.microsoft.com/File-Synchronization-516e3ad7

    http://msdn.microsoft.com/en-us/sync/bb887623

    string firstLocation = @"\\sourcemachine\sourceshare";
        string secondLocation = @"\\sourcemachine2\sourceshare2";
    
        FileSyncProvidor firstProvider = new FileSyncProvider(firstLocation);
        FileSyncProvidor secondProvider = new FileSyncProvider(secondLocation);
    
        SyncOrchestrator orchestrator = new SyncOrchestrator();
        orchestrator.LocalProvider = firstProvider;
        orchestrator.RemoteProvider = secondProvider;
        orchestrator.Direction = SyncDirectionOrder.DownloadAndUpload;
    
    orchestrator.Synchronize();

    这段示例代码是网上找到的,你可以试一下看看。

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年10月21日 2:13
    版主

全部回复

  • 你好:

    我没有接触过这方便的东西,但是看了一下文档,本地文件同步和远程文件同步区别应该不大,建议你看一下MSDN上的文章和实例代码:

    https://code.msdn.microsoft.com/File-Synchronization-516e3ad7

    http://msdn.microsoft.com/en-us/sync/bb887623

    string firstLocation = @"\\sourcemachine\sourceshare";
        string secondLocation = @"\\sourcemachine2\sourceshare2";
    
        FileSyncProvidor firstProvider = new FileSyncProvider(firstLocation);
        FileSyncProvidor secondProvider = new FileSyncProvider(secondLocation);
    
        SyncOrchestrator orchestrator = new SyncOrchestrator();
        orchestrator.LocalProvider = firstProvider;
        orchestrator.RemoteProvider = secondProvider;
        orchestrator.Direction = SyncDirectionOrder.DownloadAndUpload;
    
    orchestrator.Synchronize();

    这段示例代码是网上找到的,你可以试一下看看。

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年10月21日 2:13
    版主
  • 你好, 请问你还有远程同步目录的资料吗
    我有个问题 远程同步的时候文件夹不需要配置权限的吗 
    2016年11月24日 11:28