public static TrackedFiles Load(string path) { var trackedFiles = new TrackedFiles(path); XElement doc = XDocument.Load(path).Element("document"); doc.Element("files").Elements("file").Select( e => new SyncFileInfo { FtpDetail = e.GetSonValue("ftpdetail"), LocalDetail = e.GetSonValue("localdetail"), LocalPath = e.GetSonValue("localpath"), }) .ToList() .ForEach(f => trackedFiles.Files.Add(f)); doc.Element("directories").Elements("directory") .Select(e => new SyncDirInfo { FtpPath = e.GetSonValue("ftppath"), LocalPath = e.GetSonValue("localpath") }) .ToList() .ForEach(d => trackedFiles._oldDirectories.Add(d)); return(trackedFiles); }
public FtpClient(string trackedFilesPath, Configuration configuration) { _configuration = configuration; _trackedFiles = TrackedFiles.TryLoad(trackedFilesPath); _credentials = new NetworkCredential(configuration.Username, configuration.Password); _conflictResolver = new ConflictResolver(_configuration); }
public static TrackedFiles Load(string path) { var trackedFiles = new TrackedFiles(path); XElement doc = XDocument.Load(path).Element("document"); doc.Element("files").Elements("file").Select( e => new SyncFileInfo { FtpDetail = e.GetSonValue("ftpdetail"), LocalDetail = e.GetSonValue("localdetail"), LocalPath = e.GetSonValue("localpath"), }) .ToList() .ForEach(f => trackedFiles.Files.Add(f)); doc.Element("directories").Elements("directory") .Select(e => new SyncDirInfo { FtpPath = e.GetSonValue("ftppath"), LocalPath = e.GetSonValue("localpath") }) .ToList() .ForEach(d => trackedFiles._oldDirectories.Add(d)); return trackedFiles; }