本文整理汇总了C#中IPackageFile类的典型用法代码示例。如果您正苦于以下问题:C# IPackageFile类的具体用法?C# IPackageFile怎么用?C# IPackageFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPackageFile类属于命名空间,在下文中一共展示了IPackageFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
internal static string Process(IPackageFile file, IPropertyProvider propertyProvider)
{
using (var stream = file.GetStream())
{
return Process(stream, propertyProvider, throwIfNotFound: false);
}
}
示例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);
}
}
示例3: PowerShellConsole
public PowerShellConsole(IPackage package, IProcess process, IFileSystem fileSystem, IPackageFile packageFile)
{
this.fileSystem = fileSystem;
this.package = package;
this.process = process;
this.packageFile = packageFile;
}
示例4: CreateIssue
private static PackageIssue CreateIssue(IPackageFile file)
{
return new PackageIssue(
AnalysisResources.WinRTObsoleteTitle,
String.Format(CultureInfo.CurrentCulture, AnalysisResources.WinRTObsoleteDescription, file.Path),
AnalysisResources.WinRTObsoleteSolution);
}
示例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);
}
示例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";
}
示例7: CreatePackageIssue
private static PackageIssue CreatePackageIssue(IPackageFile file)
{
return new PackageIssue(
AnalysisResources.MisplacedInitScriptTitle,
String.Format(CultureInfo.CurrentCulture, AnalysisResources.MisplacedInitScriptDescription, file.Path),
AnalysisResources.MisplacedInitScriptSolution);
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}