当前位置: 首页>>代码示例>>C#>>正文


C# Item.DownloadFile方法代码示例

本文整理汇总了C#中System.Item.DownloadFile方法的典型用法代码示例。如果您正苦于以下问题:C# Item.DownloadFile方法的具体用法?C# Item.DownloadFile怎么用?C# Item.DownloadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Item的用法示例。


在下文中一共展示了Item.DownloadFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDataBlob

        private BlobCommand GetDataBlob(Item item)
        {
            var bytes = new byte[item.ContentLength];
            BlobCommand blob = null;
            try
            {
                var str = item.DownloadFile();
                str.Read(bytes, 0, bytes.Length);
                str.Close();

                var id = _MarkID++;
                blob = BlobCommand.BuildBlob(bytes, id);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine();
                Console.Error.WriteLine("Warning: Unable to fetch file '{0}'{1}{2}", item.ServerItem, Environment.NewLine, ex);
                Console.Error.WriteLine();
            }
            return blob;
        }
开发者ID:Spiralis,项目名称:tfs-fast-export,代码行数:21,代码来源:TfsChangeSet.cs

示例2: GetStreamFromItem

 private Stream GetStreamFromItem(Item item)
 {
     var stream = item.DownloadFile();
     if (!item.ServerItem.EndsWith(".refresh"))
         return stream;
     string path = new StreamReader(stream).ReadToEnd().TrimEnd('\r', '\n');
     return new FileStream(path, FileMode.Open);
 }
开发者ID:kocubinski,项目名称:TfsPackage,代码行数:8,代码来源:ElPackager.cs

示例3: Download

        private byte[] Download(Item item1)
        {
            using (var stream = item1.DownloadFile())
            {
                using (var memStream = new MemoryStream())
                {
                    stream.CopyTo(memStream);

                    return memStream.ToArray();
                }
            }
        }
开发者ID:peschuster,项目名称:tfs-statistics,代码行数:12,代码来源:TfsAnalytics.cs

示例4: ViewFile

        public void ViewFile(Item theItem)
        {
            if (theItem != null && string.IsNullOrEmpty(theItem.ServerItem))
                return;

            var filename = Path.Combine(Path.GetTempPath(), Path.GetFileName(theItem.ServerItem));

            try
            {
                theItem.DownloadFile(filename);

                Process.Start(filename);
            }
            finally
            {
                File.Delete(filename);
            }
        }
开发者ID:Vooban,项目名称:vooban.tfs.commitmonitor,代码行数:18,代码来源:SourceControlProject.cs

示例5: SearchInFileContent

        private static List<string> SearchInFileContent(Item file)
        {
            // results contains the file path and all ocurrences
            List<string> results = new List<string>();
            // ocurrences contains the lines where
            List<string> occurrences = new List<string>();

            StreamReader streamReader = new StreamReader(file.DownloadFile(), Encoding.Default);

            string line = streamReader.ReadLine();
            int lineIndex = 0;

            while (!streamReader.EndOfStream)
            {
                if (searchPatterns.Any(item => line.IndexOf(item, StringComparison.OrdinalIgnoreCase) > 0))
                {
                    occurrences.Add(string.Format("Line {0}: {1}", lineIndex, line.Trim()));
                }

                line = streamReader.ReadLine();
                lineIndex++;
            }

            if (occurrences.Count > 0)
            {
                results.Add(file.ServerItem);
                results.AddRange(occurrences.Select(item => string.Format("\t{0}", item)).ToList());
            }

            return results;
        }
开发者ID:JulioGold,项目名称:TFSFileContentSearch-cli,代码行数:31,代码来源:Program.cs

示例6: GetDataBlob

		private BlobCommand GetDataBlob(Item item)
		{
			var bytes = new byte[item.ContentLength];
			var str = item.DownloadFile();
			str.Read(bytes, 0, bytes.Length);
			str.Close();

			var id = _MarkID++;
			var blob = BlobCommand.BuildBlob(bytes, id);
			return blob;
		}
开发者ID:viceroypenguin,项目名称:tfs-fast-export,代码行数:11,代码来源:TfsChangeSet.cs

示例7: GetTfsFile

 private static string GetTfsFile(Item file)
 {
     string result;
     if (_downloadedItems.TryGetValue(file.ItemId, out result))
     {
         return result;
     }
     else
     {
         result = System.IO.Path.GetTempFileName();
         file.DownloadFile(result);
         return result;
     }
 }
开发者ID:mareek,项目名称:TFSToolBox,代码行数:14,代码来源:MainWindow.xaml.cs

示例8: GetPackageDependenciesFromRepositoriesConfig

        private IEnumerable<PackageDependency> GetPackageDependenciesFromRepositoriesConfig(TeamProject teamProject, Item repository)
        {
            List<PackageDependency> repositoryDependencies = new List<PackageDependency>();

            Stream repoFileStream = repository.DownloadFile();
            XDocument repoXml = XDocument.Load(repoFileStream);
            IEnumerable<string> relativePackageConfigPaths = configInterpreter.GetRelativePackagesConfigPathsFromRepositoriesConfig(repoXml);
            string repositoriesConfigServerPath = repository.ServerItem;
            int repositoriesConfigLength = repositoriesConfigFileName.Length;
            string packageConfigFolderServerPath = repositoriesConfigServerPath.Remove(repositoriesConfigServerPath.Length - repositoriesConfigLength, repositoriesConfigLength);

            foreach (string packageConfigPathRelativeToRepositoriesConfig in relativePackageConfigPaths)
            {
                // navigate to the folder server path for the repositories.config file
                string repositoryNodeServerItem = tfsServerPathTranslator.GetServerPath(packageConfigFolderServerPath, packageConfigPathRelativeToRepositoriesConfig);
                Item packageConfig = teamProject.VersionControlServer.GetItem(repositoryNodeServerItem);
                if (packageConfig != null)
                {
                    Stream packagesConfigStream = packageConfig.DownloadFile();
                    XDocument packagesConfigXml = XDocument.Load(packagesConfigStream);
                    IEnumerable<PackageDependency> packageDependencies = configInterpreter.GetPackageDependenciesFromPackagesConfig(packagesConfigXml);
                    foreach (PackageDependency packageDependency in packageDependencies)
                    {
                        if (repositoryDependencies.Where(dp => dp.Id == packageDependency.Id && dp.VersionSpec == packageDependency.VersionSpec).FirstOrDefault() == null)
                            repositoryDependencies.Add(packageDependency);
                    }
                }
            }
            
            return repositoryDependencies;
        }
开发者ID:ChrisMissal,项目名称:NuGet.Analyze,代码行数:31,代码来源:TfsRepositoryWalker.cs


注:本文中的System.Item.DownloadFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。