コード例 #1
0
        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;
        }
コード例 #2
0
        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));
                }
            }
        }
コード例 #3
0
 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;
 }
コード例 #4
0
 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
     });
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 public FolderTreeNode(FileContainerHttpClient service, FileContainerItem item)
     : base(service, item, "Resources/Folder.ico")
 {
 }
コード例 #7
0
 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;
 }
コード例 #8
0
 public FileTreeNode(FileContainerHttpClient service, FileContainerItem item)
     : base(service, item, "Resources/File.png")
 {
 }