I'm creating a program that can essentially download files multiple locations, and send them to multip开发者_开发知识库le locations, based on paths that users enter. These can be either Network Paths/Local Paths, HTTP paths or FTP paths.
Rather than download from one of the source locations, then send to each target, and repeat, I'd like to be able to download files from all the locations that they enter, and concat them into one filelist which should make the program a bit faster.
Would this be easy to do in C#.NET? The bit that concerns me is that from my experience, the file 'variables' that each file is stored in when downloaded is different between the different path types - i.e. FtpWebRequest stores downloaded files differently than a simple network path check does.
Thanks
Yes, it is easy.
I should really leave the answer at that tbh ;)
What you want to do is some kind of base class or interface that defines the abstracrt methods that will get the files from a specific type of location and path. You then inherit from this to provide the actual functionality.
You can then construct your collection of sources and just iterate through them tellign them to get the files. the point is that each item in the collectino could work differently, but they would all use the same method signature to start the work.
The same approach will work for the sending also.
精彩评论