• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IPackageFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPackageFile的典型用法代码示例。如果您正苦于以下问题:C# IPackageFile类的具体用法?C# IPackageFile怎么用?C# IPackageFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPackageFile类属于命名空间,在下文中一共展示了IPackageFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Process

 internal static string Process(IPackageFile file, IPropertyProvider propertyProvider)
 {
     using (var stream = file.GetStream())
     {
         return Process(stream, propertyProvider, throwIfNotFound: false);
     }
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:7,代码来源:Preprocessor.cs


示例2: CopyPackageFileToPath

 private async Task CopyPackageFileToPath(string installPath, IPackageFile packageFile)
 {
     using (var fileStream = File.Create(Path.Combine(installPath, Path.GetFileName(packageFile.Path))))
     {
         await packageFile.GetStream().CopyToAsync(fileStream);
     }
 }
开发者ID:ibebbs,项目名称:OneCog.SemanticLogging.Service.Utility,代码行数:7,代码来源:Installer.cs


示例3: PowerShellConsole

 public PowerShellConsole(IPackage package, IProcess process, IFileSystem fileSystem, IPackageFile packageFile)
 {
     this.fileSystem = fileSystem;
     this.package = package;
     this.process = process;
     this.packageFile = packageFile;
 }
开发者ID:alexfalkowski,项目名称:NuGet.AdvancedPackagingTool,代码行数:7,代码来源:PowerShellConsole.cs


示例4: CreateIssue

 private static PackageIssue CreateIssue(IPackageFile file)
 {
     return new PackageIssue(
         AnalysisResources.WinRTObsoleteTitle,
         String.Format(CultureInfo.CurrentCulture, AnalysisResources.WinRTObsoleteDescription, file.Path),
         AnalysisResources.WinRTObsoleteSolution);
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:7,代码来源:WinRTNameIsObsoleteRule.cs


示例5: ConvertWithTwoFilesInDifferentFolders

        public void ConvertWithTwoFilesInDifferentFolders()
        {
            // Arrange
            var files = new IPackageFile[] {
                CreatePackageFile(@"content\one.txt"),
                CreatePackageFile(@"lib\two.dll")
            };

            // Act
            var root = PathToTreeConverter.Convert(files);

            // Assert
            Assert.NotNull(root);
            AssertItem(root, "", 2);

            var contentNode = root.Children.ElementAt(0);
            AssertItem(contentNode, "content", 1);

            var libNode = root.Children.ElementAt(1);
            AssertItem(libNode, "lib", 1);

            var firstChild = contentNode.Children.ElementAt(0);
            AssertItem(firstChild, "one.txt", 0);

            var secondChild = libNode.Children.ElementAt(0);
            AssertItem(secondChild, "two.dll", 0);
        }
开发者ID:argsv,项目名称:NuGetGallery,代码行数:27,代码来源:PathToTreeConverterFacts.cs


示例6: CheckFile

        private static string CheckFile(string url, IPackageFile file)
        {
            var binary = new BinaryStoreManager();
            var symbol = new SymbolStoreManager();

            var name = Path.ChangeExtension(Path.GetFileName(file.Path), "pdb");
            var compressedName = name.Substring(0, name.Length - 1) + '_';

            string hash;

            using (var stream = file.GetStream())
                hash = binary.ReadPdbHash(stream);

            byte[] buffer;

            try
            {
                using (var client = new WebClient())
                    buffer = client.DownloadData(string.Format("{0}/{1}/{2}/{3}", url, name, hash, compressedName));
            }
            catch (WebException exception)
            {
                return ((HttpWebResponse)exception.Response).StatusCode.ToString();
            }

            //using (var stream = new MemoryStream(buffer))
            //    if (symbol.ReadHash(stream) != hash)
            //        return "MISMATCHED";

            return "FOUND";
        }
开发者ID:xuanvu,项目名称:SymbolSource.Community,代码行数:31,代码来源:SymbolServerChecker.cs


示例7: CreatePackageIssue

 private static PackageIssue CreatePackageIssue(IPackageFile file)
 {
     return new PackageIssue(
         AnalysisResources.MisplacedInitScriptTitle,
         String.Format(CultureInfo.CurrentCulture, AnalysisResources.MisplacedInitScriptDescription, file.Path),
         AnalysisResources.MisplacedInitScriptSolution);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:InitScriptNotUnderToolsRule.cs


示例8: TransformFile

 public void TransformFile(IPackageFile file, string targetPath, IProjectSystem projectSystem)
 {
     if (!projectSystem.FileExists(targetPath)) {
         using (Stream stream = Process(file, projectSystem).AsStream()) {
             projectSystem.AddFile(targetPath, stream);
         }
     }
 }
开发者ID:jacksonh,项目名称:nuget,代码行数:8,代码来源:Preprocessor.cs


示例9: GetXml

 private static XElement GetXml(IPackageFile file, IProjectSystem projectSystem)
 {
     using (Stream stream = file.GetStream())
     {
         var content = Preprocessor.Process(file, projectSystem);
         return XElement.Parse(content);
     }
 }
开发者ID:monoman,项目名称:NugetCracker,代码行数:8,代码来源:XmlTransfomer.cs


示例10: PackageFile

        private PackageFile(IPackageFile file, string name, PackageFolder parent, PackageViewModel viewModel)
            : base(name, parent, viewModel)
        {
            if (file == null) {
                throw new ArgumentNullException("file");
            }

            _file = file;
        }
开发者ID:grendello,项目名称:nuget,代码行数:9,代码来源:PackageFile.cs


示例11: ZipPackageAssemblyReference

        public ZipPackageAssemblyReference(IPackageFile file)
            : base(file)
        {
            Debug.Assert(Path.StartsWith("lib", StringComparison.OrdinalIgnoreCase), "path doesn't start with lib");

            // Get rid of the lib folder            
            string path = Path.Substring(3).Trim(System.IO.Path.DirectorySeparatorChar);

            _targetFramework = VersionUtility.ParseFrameworkFolderName(path);
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:10,代码来源:ZipPackageAssemblyReference.cs


示例12: ResolvePath

 private static string ResolvePath(IPackageFile packageFile)
 {
     var physicalPackageFile = packageFile as PhysicalPackageFile;
     // For PhysicalPackageFiles, we want to filter by SourcePaths, the path on disk. The Path value maps to the TargetPath
     if (physicalPackageFile == null)
     {
         return packageFile.Path;
     }
     return physicalPackageFile.SourcePath;
 }
开发者ID:secretGeek,项目名称:choco,代码行数:10,代码来源:NugetPack.cs


示例13: VerifySigned

 private static bool VerifySigned(IPackageFile packageFile)
 {
     bool result;
     using (Stream stream = packageFile.GetStream())
     {
         System.IO.StreamReader streamReader = new System.IO.StreamReader(stream);
         string text = streamReader.ReadToEnd();
         result = (text.IndexOf("# SIG # Begin signature block", StringComparison.OrdinalIgnoreCase) > -1 && text.IndexOf("# SIG # End signature block", StringComparison.OrdinalIgnoreCase) > -1);
     }
     return result;
 }
开发者ID:modulexcite,项目名称:DnxTools,代码行数:11,代码来源:PowerShellScriptIsSignedRule.cs


示例14: Build

        public IAddInfo Build(IPackageFile directoryInfo, IEnumerable<IPackageEntry> includeFiles)
        {
            var addInfo = new AddInfo();

            var items = directoryInfo.Entries.ToArray();

            addInfo.Binaries = includeFiles
                .Select(b => BuildBinaryInfo(addInfo, items, b))
                .ToArray();

            return addInfo;
        }
开发者ID:bleissem,项目名称:SymbolSource.Community,代码行数:12,代码来源:AddInfoBuilder.cs


示例15: TransformFile

        public void TransformFile(IPackageFile file, string targetPath, IProjectSystem projectSystem)
        {
            // Get the xml fragment
            XElement xmlFragment = GetXml(file, projectSystem);

            XDocument transformDocument = XmlUtility.GetOrCreateDocument(xmlFragment.Name, projectSystem, targetPath);

            // Do a merge
            transformDocument.Root.MergeWith(xmlFragment, _nodeActions);

            projectSystem.AddFile(targetPath, transformDocument.Save);
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:12,代码来源:XmlTransfomer.cs


示例16: Build

        public IAddInfo Build(IPackageFile directoryInfo)
        {
            var addInfo = new AddInfo();

            var items = directoryInfo.Entries.ToArray();

            addInfo.Binaries = items
                .Where(f => f.FullPath.EndsWith("exe", StringComparison.InvariantCultureIgnoreCase) || f.FullPath.EndsWith("dll", StringComparison.InvariantCultureIgnoreCase))
                .Select(b => BuildBinaryInfo(addInfo, items, b))
                .ToArray();

            return addInfo;
        }
开发者ID:xuanvu,项目名称:SymbolSource.Community,代码行数:13,代码来源:AddInfoBuilder.cs


示例17: PerformXdtTransform

        private static void PerformXdtTransform(IPackageFile file, string targetPath, IProjectSystem projectSystem)
        {
            if (projectSystem.FileExists(targetPath))
            {
                string content = Preprocessor.Process(file, projectSystem);

                try
                {
                    using (var transformation = new XmlTransformation(content, isTransformAFile: false, logger: null))
                    {
                        using (var document = new XmlTransformableDocument())
                        {
                            document.PreserveWhitespace = true;

                            // make sure we close the input stream immediately so that we can override 
                            // the file below when we save to it.
                            using (var inputStream = projectSystem.OpenFile(targetPath))
                            {
                                document.Load(inputStream);
                            }

                            bool succeeded = transformation.Apply(document);
                            if (succeeded)
                            {
                                using (var memoryStream = new MemoryStream())
                                {
                                    // save the result into a memoryStream first so that if there is any
                                    // exception during document.Save(), the original file won't be truncated.
                                    document.Save(memoryStream);
                                    memoryStream.Seek(0, SeekOrigin.Begin);
                                    using (var fileStream = projectSystem.CreateFile(targetPath))
                                    {
                                        memoryStream.CopyTo(fileStream);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception exception)
                {
                    throw new InvalidDataException(
                        String.Format(
                            CultureInfo.CurrentCulture, 
                            NuGetResources.XdtError + " " + exception.Message,
                            targetPath, 
                            projectSystem.ProjectName), 
                        exception);
                }
            }
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:51,代码来源:XdtTransformer.cs


示例18: GetConfigurationFileAsBytes

        private static byte[] GetConfigurationFileAsBytes(IPackageFile agentConfigurationFile)
        {
            var agentConfigurationFileStream = agentConfigurationFile.GetStream();

            byte[] configBytes;

            using (var memoryStream = new MemoryStream())
            {
                agentConfigurationFileStream.CopyTo(memoryStream);
                configBytes = memoryStream.ToArray();
                memoryStream.Close();
            }
            return configBytes;
        }
开发者ID:repne,项目名称:DeployD,代码行数:14,代码来源:AgentConfigurationDownloader.cs


示例19: ConvertWithOneFile

        public void ConvertWithOneFile()
        {
            // Arrange
            var files = new IPackageFile[] {
                CreatePackageFile(@"one.txt")
            };

            // Act
            var root = PathToTreeConverter.Convert(files);

            // Assert
            Assert.NotNull(root);
            AssertItem(root, "", 1);
            AssertItem(root.Children.ElementAt(0), "one.txt", 0);
        }
开发者ID:argsv,项目名称:NuGetGallery,代码行数:15,代码来源:PathToTreeConverterFacts.cs


示例20: PackageFile

        private PackageFile(IPackageFile file, string name, PackageFolder parent, PackageViewModel viewModel)
            : base(name, parent, viewModel)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            _file = file;

            var physicalFile = file as PhysicalPackageFile;
            if (physicalFile != null)
            {
                WatchPhysicalFile(physicalFile);
            }
            ReplaceCommand = new RelayCommand(Replace, () => !viewModel.IsInEditFileMode);
        }
开发者ID:BreeeZe,项目名称:NuGetPackageExplorer,代码行数:17,代码来源:PackageFile.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPackageFileService类代码示例发布时间:2022-05-24
下一篇:
C# IPackage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap