public void Publish(string logicalTablePath) { if (logicalTablePath.Equals("cout", StringComparison.OrdinalIgnoreCase)) { return; } if (Configuration.ShouldPublish) { Trace.WriteLine($"PUBLISH: {logicalTablePath}"); foreach (StreamAttributes item in LocalProvider.Enumerate(logicalTablePath, EnumerateTypes.File, true)) { using (Stream target = RemoteProvider.OpenWrite(item.Path)) { using (Stream source = LocalProvider.OpenRead(item.Path)) { source.CopyTo(target); } } } Trace.WriteLine($"Done with PUBLISH: {logicalTablePath}"); } }
public IEnumerable <StreamAttributes> Enumerate(string underLogicalPath, EnumerateTypes types, bool recursive) { // Track item paths we've already returned HashSet <string> pathsSeen = new HashSet <string>(StringComparer.OrdinalIgnoreCase); // Return all local items first foreach (StreamAttributes item in LocalProvider.Enumerate(underLogicalPath, types, recursive)) { pathsSeen.Add(item.Path); yield return(item); } // Return remote items which we didn't already return seeing locally foreach (StreamAttributes remoteItem in RemoteProvider.Enumerate(underLogicalPath, types, recursive)) { if (pathsSeen.Add(remoteItem.Path)) { yield return(remoteItem); } } }