private HttpResponseMessage UploadDocument(IEnumerable<FileContainer> containers, FileContainerItem agentLogs, MemoryStream ms) { var upl = _fcClient.UploadFileAsync(containers.ElementAt(0).Id, agentLogs.Path, ms, new System.Threading.CancellationToken()); var uplResponse = upl.Result; return uplResponse; }
protected void AddItem(FileContainerItem item, int level) { // Find the folder that contains the path of the requested item (which can itself be a file or folder). var folderPath = item.ItemType == ContainerItemType.Folder ? item.Path : item.Path.Substring(0, item.Path.LastIndexOf(PathSeparator)); var containingFolder = this.Children.SingleOrDefault(f => string.Equals(f.Name, folderPath.Split(PathSeparator)[level], StringComparison.OrdinalIgnoreCase)); if (containingFolder == null) { // There is no containing folder yet, create one for the current item. containingFolder = new FolderTreeNode(this.Service, item); this.Children.Add(containingFolder); } // Check if the containing folder matches the requested folder path entirely. if (!string.Equals(containingFolder.FullPath, folderPath, StringComparison.OrdinalIgnoreCase)) { // We don't have a full match yet, go deeper. containingFolder.AddItem(item, level + 1); } else { // We have a full match so we have the folder hierarchy done. // If we're adding a file, add it to the containing folder. if (item.ItemType == ContainerItemType.File) { containingFolder.Children.Add(new FileTreeNode(this.Service, item)); } } }
public ContainerItemTreeNode(FileContainerHttpClient service, FileContainerItem item, string icon) : base(service, item.Path, icon, false) { this.Item = item; this.DateCreated = item.DateCreated; this.DateLastModified = item.DateLastModified; this.Size = item.FileLength; }
private static ContainerItem ConvertToContainerItem(FileContainerItem x) { return(new ContainerItem { ItemType = (ItemType)(int)x.ItemType, Path = x.Path, FileLength = x.FileLength, ContainerId = x.ContainerId, ScopeIdentifier = x.ScopeIdentifier }); }
private List <KeyValuePair <String, String> > AppendItemQueryString(String itemPath, Guid scopeIdentifier, Boolean includeDownloadTickets = false, Boolean isShallow = false) { List <KeyValuePair <String, String> > collection = new List <KeyValuePair <String, String> >(); if (!String.IsNullOrEmpty(itemPath)) { itemPath = FileContainerItem.EnsurePathFormat(itemPath); collection.Add(QueryParameters.ItemPath, itemPath); } if (includeDownloadTickets) { collection.Add(QueryParameters.includeDownloadTickets, "true"); } if (isShallow) { collection.Add(QueryParameters.isShallow, "true"); } collection.Add(QueryParameters.ScopeIdentifier, scopeIdentifier.ToString()); return(collection); }
public FolderTreeNode(FileContainerHttpClient service, FileContainerItem item) : base(service, item, "Resources/Folder.ico") { }
private static StreamReader DownloadAgentLog(FileContainerItem agentLogs, HttpClientHandler handler) { var httpClient = new HttpClient(handler); var reader = new StreamReader(new GZipStream(httpClient.GetStreamAsync(agentLogs.ContentLocation).Result, CompressionMode.Decompress), Encoding.UTF8); return reader; }
public FileTreeNode(FileContainerHttpClient service, FileContainerItem item) : base(service, item, "Resources/File.png") { }