本文整理汇总了C#中IPackageFile.GetStream方法的典型用法代码示例。如果您正苦于以下问题:C# IPackageFile.GetStream方法的具体用法?C# IPackageFile.GetStream怎么用?C# IPackageFile.GetStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackageFile
的用法示例。
在下文中一共展示了IPackageFile.GetStream方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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";
}
示例2: Process
internal static string Process(IPackageFile file, IPropertyProvider propertyProvider)
{
using (var stream = file.GetStream())
{
return Process(stream, propertyProvider, throwIfNotFound: false);
}
}
示例3: 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);
}
}
示例4: GetXml
private static XElement GetXml(IPackageFile file, IProjectSystem projectSystem)
{
using (Stream stream = file.GetStream())
{
var content = Preprocessor.Process(file, projectSystem);
return XElement.Parse(content);
}
}
示例5: 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;
}
示例6: 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;
}
示例7: SaveAssemblyFile
private void SaveAssemblyFile(string installPath, IPackageFile file)
{
var targetPath = installPath.AppendPath(file.Path);
Directory.CreateDirectory(targetPath.ParentDirectory());
using (Stream outputStream = File.Create(targetPath)){
file.GetStream().CopyTo(outputStream);
}
}
示例8: UpdateFile
protected virtual void UpdateFile(string exePath, IPackageFile file)
{
using (Stream fromStream = file.GetStream(), toStream = File.Create(exePath))
{
fromStream.CopyTo(toStream);
}
}
示例9: CopyFileToLocation
void CopyFileToLocation(FileSystemInfoBase target, IPackageFile x)
{
var targetPath = Path.Combine(target.FullName, x.EffectivePath);
var fi = fileSystem.GetFileInfo(targetPath);
if (fi.Exists) fi.Delete();
var dir = fileSystem.GetDirectoryInfo(Path.GetDirectoryName(targetPath));
if (!dir.Exists) dir.Create();
using (var inf = x.GetStream())
using (var of = fi.Open(FileMode.CreateNew, FileAccess.Write)) {
log.Debug("Writing {0} to app directory", targetPath);
inf.CopyTo(of);
}
}
示例10: InstallFile
/// <summary>
/// Installs a new package file
/// </summary>
/// <param name="package">
/// The package being installed
/// </param>
/// <param name="file">
/// The file to install
/// </param>
private void InstallFile(IPackage package, IPackageFile file)
{
// map the package file to its deployment location (or suppress it)
var path = GetFullPath(file);
if (path == null)
Log.Trace("Skipping file {0}", file);
else
{
Log.Trace("Extracting file {0} to {1}", file, path);
// extract the package file and stamp it with the package date
ExtractFile(file.GetStream(), path);
File.SetLastWriteTimeUtc(
path,
(package.Published ?? DateTimeOffset.UtcNow).UtcDateTime
);
}
}
示例11: ContentEquals
internal static bool ContentEquals(IPackageFile targetFile, string fullPath)
{
bool isEqual;
using (var dependencyFileStream = targetFile.GetStream())
using (var fileContentsStream = File.OpenRead(fullPath))
{
isEqual = dependencyFileStream.ContentEquals(fileContentsStream);
}
return isEqual;
}
示例12: ExtractToSymbols
private string ExtractToSymbols(IPackage package, IPackageFile symbolFile)
{
var path = symbolsPathResolver.GetSymbolsPath(package, symbolFile);
EnsureDirectory(path);
using (var file = File.Open(path, FileMode.OpenOrCreate))
symbolFile.GetStream().CopyTo(file);
return path;
}
示例13: UpdateFile
private static void UpdateFile(string newFilePath, IPackageFile file)
{
EnsureDirectory(newFilePath);
using (Stream fromStream = file.GetStream(), toStream = File.Create(newFilePath))
{
fromStream.CopyTo(toStream);
}
}
示例14: UpdateFile
private bool UpdateFile(string exePath, IPackageFile file)
{
using (Stream fromStream = file.GetStream())
{
if (fromStream == null)
{
return false;
}
using (Stream toStream = this.filesystemAccessor.GetWriteStream(exePath))
{
if (toStream == null)
{
return false;
}
fromStream.CopyTo(toStream);
return true;
}
}
}
示例15: UnpackFile
private void UnpackFile(string fileOut, IPackageFile file)
{
var stream = File.OpenWrite(fileOut);
file.GetStream().CopyTo(stream);
}