本文整理汇总了C#中BlobHandle类的典型用法代码示例。如果您正苦于以下问题:C# BlobHandle类的具体用法?C# BlobHandle怎么用?C# BlobHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlobHandle类属于命名空间,在下文中一共展示了BlobHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveVhdAndAssertContent
protected void SaveVhdAndAssertContent(BlobHandle destination, FileInfo localFile, int? numThread, string storageKey, bool overwrite, bool deleteBlob, bool deleteLocal)
{
try
{
Console.WriteLine("Downloading a VHD from {0} to {1}...", destination.Blob.Uri.ToString(), localFile.FullName);
DateTime startTime = DateTime.Now;
VhdDownloadContext result = vmPowershellCmdlets.SaveAzureVhd(destination.Blob.Uri, localFile, numThread, storageKey, overwrite);
Console.WriteLine("Downloading completed in {0} seconds.", (DateTime.Now - startTime).TotalSeconds);
string calculateMd5Hash = CalculateContentMd5(File.OpenRead(result.LocalFilePath.FullName));
Assert.IsTrue(VerifyMD5hash(destination, calculateMd5Hash));
if (deleteBlob)
{
destination.Blob.Delete();
}
if (deleteLocalFileIfPassed && deleteLocal)
{
File.Delete(localFile.FullName);
}
}
catch (Exception e)
{
if (deleteLocalFileIfFailed && deleteLocal)
{
File.Delete(localFile.FullName);
}
Assert.Fail(e.InnerException.ToString());
}
}
示例2: Initialize
public void Initialize()
{
pass = true;
testStartTime = DateTime.Now;
storageAccountKey = vmPowershellCmdlets.GetAzureStorageAccountKey(defaultAzureSubscription.CurrentStorageAccountName);
// Set the source blob
blobHandle = Utilities.GetBlobHandle(vhdBlobLocation, storageAccountKey.Primary);
}
示例3: FormatAssemblyInfo
private static AssemblyReferenceInformation FormatAssemblyInfo(this MetadataReader metadataReader, string name, StringHandle cultureHandle, BlobHandle publicKeyTokenHandle, Version version)
{
var culture = cultureHandle.IsNil
? "neutral"
: metadataReader.GetString(cultureHandle);
var publicKeyToken = publicKeyTokenHandle.IsNil
? "null"
: metadataReader.FormatPublicKeyToken(publicKeyTokenHandle);
return new AssemblyReferenceInformation(name, version, culture, publicKeyToken);
}
示例4: SaveVhd
protected static void SaveVhd(BlobHandle destination, FileInfo locFile, string storageKey, int? numThread = null, bool overwrite = false)
{
try
{
Console.WriteLine("Downloading a VHD from {0} to {1}...", destination.Blob.Uri.ToString(), locFile.FullName);
DateTime startTime = DateTime.Now;
vmPowershellCmdlets.SaveAzureVhd(destination.Blob.Uri, locFile, numThread, storageKey, overwrite);
Console.WriteLine("Downloading completed in {0} seconds.", (DateTime.Now - startTime).TotalSeconds);
}
catch (Exception e)
{
Assert.Fail(e.InnerException.ToString());
}
}
示例5: ImportDefinition
internal ImportDefinition(
ImportDefinitionKind kind,
BlobHandle alias = default(BlobHandle),
AssemblyReferenceHandle assembly = default(AssemblyReferenceHandle),
Handle typeOrNamespace = default(Handle))
{
Debug.Assert(
typeOrNamespace.IsNil ||
typeOrNamespace.Kind == HandleKind.Blob ||
typeOrNamespace.Kind == HandleKind.TypeDefinition ||
typeOrNamespace.Kind == HandleKind.TypeReference ||
typeOrNamespace.Kind == HandleKind.TypeSpecification);
_kind = kind;
_alias = alias;
_assembly = assembly;
_typeOrNamespace = typeOrNamespace;
}
示例6: CreateRuntimeAssemblyNameFromMetadata
private static RuntimeAssemblyName CreateRuntimeAssemblyNameFromMetadata(
MetadataReader reader,
StringHandle name,
Version version,
StringHandle culture,
BlobHandle publicKeyOrToken,
AssemblyFlags assemblyFlags)
{
AssemblyNameFlags assemblyNameFlags = AssemblyNameFlags.None;
if (0 != (assemblyFlags & AssemblyFlags.PublicKey))
assemblyNameFlags |= AssemblyNameFlags.PublicKey;
if (0 != (assemblyFlags & AssemblyFlags.Retargetable))
assemblyNameFlags |= AssemblyNameFlags.Retargetable;
int contentType = ((int)assemblyFlags) & 0x00000E00;
assemblyNameFlags |= (AssemblyNameFlags)contentType;
return new RuntimeAssemblyName(
name.GetString(reader),
version,
culture.GetString(reader),
assemblyNameFlags,
reader.GetBlobContent(publicKeyOrToken).ToArray()
);
}
示例7: AddCustomDebugInformation
public void AddCustomDebugInformation(EntityHandle parent, GuidHandle kind, BlobHandle value)
{
_customDebugInformationTable.Add(new CustomDebugInformationRow
{
Parent = (uint)CodedIndex.ToHasCustomDebugInformation(parent),
Kind = kind,
Value = value
});
}
示例8: AddLocalConstant
public LocalConstantHandle AddLocalConstant(StringHandle name, BlobHandle signature)
{
_localConstantTable.Add(new LocalConstantRow
{
Name = name,
Signature = signature
});
return MetadataTokens.LocalConstantHandle(_localConstantTable.Count);
}
示例9: AddDocument
public DocumentHandle AddDocument(BlobHandle name, GuidHandle hashAlgorithm, BlobHandle hash, GuidHandle language)
{
_documentTable.Add(new DocumentRow
{
Name = name,
HashAlgorithm = hashAlgorithm,
Hash = hash,
Language = language
});
return MetadataTokens.DocumentHandle(_documentTable.Count);
}
示例10: AddAssemblyFile
public void AddAssemblyFile(
StringHandle name,
BlobHandle hashValue,
bool containsMetadata)
{
_fileTable.Add(new FileTableRow
{
FileName = name,
Flags = containsMetadata ? 0u : 1u,
HashValue = hashValue
});
}
示例11: AddMethodDefinition
public MethodDefinitionHandle AddMethodDefinition(
MethodAttributes attributes,
MethodImplAttributes implAttributes,
StringHandle name,
BlobHandle signature,
int bodyOffset,
ParameterHandle paramList)
{
_methodDefTable.Add(new MethodRow
{
Flags = (ushort)attributes,
ImplFlags = (ushort)implAttributes,
Name = name,
Signature = signature,
BodyOffset = bodyOffset,
ParamList = (uint)MetadataTokens.GetRowNumber(paramList)
});
return MetadataTokens.MethodDefinitionHandle(_methodDefTable.Count);
}
示例12: GetBlobReader
public BlobReader GetBlobReader(BlobHandle handle)
{
return BlobHeap.GetBlobReader(handle);
}
示例13: GetBlobBytes
public byte[] GetBlobBytes(BlobHandle handle)
{
return BlobHeap.GetBytes(handle);
}
示例14: AssertContentMD5
private void AssertContentMD5(string destination, bool deleteBlob)
{
string downloadedFile = DownloadToFile(destination);
var calculateMd5Hash = CalculateContentMd5(File.OpenRead(downloadedFile));
BlobUri blobUri2;
Assert.IsTrue(BlobUri.TryParseUri(new Uri(destination), out blobUri2));
var blobHandle = new BlobHandle(blobUri2, storageAccountKey.Primary);
Assert.AreEqual(calculateMd5Hash, blobHandle.Blob.Properties.ContentMD5);
if (deleteBlob)
{
blobHandle.Blob.Delete();
}
}
示例15: AddFieldDefinition
public void AddFieldDefinition(
FieldAttributes attributes,
StringHandle name,
BlobHandle signature)
{
_fieldTable.Add(new FieldDefRow
{
Flags = (ushort)attributes,
Name = name,
Signature = signature
});
}