예제 #1
0
 public static FromServerListProvider Get()
 {
     if (provider == null)
     {
         provider = new FromServerListProvider();
     }
     return(provider);
 }
예제 #2
0
        static void Main(string[] args)
        {
            GetInput();
            var currentConfig = ClientConfiguration.GetCurrentConfiguration();
            FromServerListProvider       provider           = FromServerListProvider.Get();
            TcpCommunicator              communicator       = new TcpCommunicator(currentConfig, provider);
            IFileDroppedHandler          handler            = new FileDroppedHandler(communicator, new FileDroppedFilter(provider));
            IDropBoxServerMessageHandler fileListerner      = new DropBoxServerMessageHandler(currentConfig, communicator);
            DroppedFileWatcher           droppedFileWatcher = new DroppedFileWatcher(currentConfig.GetHomeDirectory(), "*");

            droppedFileWatcher.StartWatching();
            droppedFileWatcher.DirectoryDiff.Subscribe(async x => await handler.Handle(x.FilePath));
            Task.Factory.StartNew(() => fileListerner.InitAsync());
            Task.Factory.StartNew(() => fileListerner.Start());
            Console.ReadKey();
        }