當前位置: 首頁>>代碼示例>>C#>>正文


C# BlobHandle類代碼示例

本文整理匯總了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());
            }
        }
開發者ID:redwater,項目名稱:azure-sdk-tools,代碼行數:32,代碼來源:AzureVhdTest.cs

示例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);            
        }
開發者ID:kangyangthu,項目名稱:azure-sdk-tools,代碼行數:9,代碼來源:SaveAzureVhdTest.cs

示例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);
        }
開發者ID:AlexGhiondea,項目名稱:dotnet-apiport,代碼行數:12,代碼來源:MetadataReaderExtensions.cs

示例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());
     }
 }
開發者ID:EmmaZhu,項目名稱:azure-sdk-tools,代碼行數:14,代碼來源:AzureVhdTest.cs

示例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;
        }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:18,代碼來源:ImportDefinition.cs

示例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()
                );
        }
開發者ID:nattress,項目名稱:corert,代碼行數:24,代碼來源:MetadataReaderExtensions.Ecma.cs

示例7: AddCustomDebugInformation

 public void AddCustomDebugInformation(EntityHandle parent, GuidHandle kind, BlobHandle value)
 {
     _customDebugInformationTable.Add(new CustomDebugInformationRow
     {
         Parent = (uint)CodedIndex.ToHasCustomDebugInformation(parent),
         Kind = kind,
         Value = value
     });
 }
開發者ID:tzetang,項目名稱:corefx,代碼行數:9,代碼來源:MetadataBuilder.Tables.cs

示例8: AddLocalConstant

        public LocalConstantHandle AddLocalConstant(StringHandle name, BlobHandle signature)
        {
            _localConstantTable.Add(new LocalConstantRow
            {
                Name = name,
                Signature = signature
            });

            return MetadataTokens.LocalConstantHandle(_localConstantTable.Count);
        }
開發者ID:tzetang,項目名稱:corefx,代碼行數:10,代碼來源:MetadataBuilder.Tables.cs

示例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);
        }
開發者ID:tzetang,項目名稱:corefx,代碼行數:12,代碼來源:MetadataBuilder.Tables.cs

示例10: AddAssemblyFile

 public void AddAssemblyFile(
     StringHandle name,
     BlobHandle hashValue,
     bool containsMetadata)
 {
     _fileTable.Add(new FileTableRow
     {
         FileName = name,
         Flags = containsMetadata ? 0u : 1u,
         HashValue = hashValue
     });
 }
開發者ID:tzetang,項目名稱:corefx,代碼行數:12,代碼來源:MetadataBuilder.Tables.cs

示例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);
        }
開發者ID:tzetang,項目名稱:corefx,代碼行數:20,代碼來源:MetadataBuilder.Tables.cs

示例12: GetBlobReader

 public BlobReader GetBlobReader(BlobHandle handle)
 {
     return BlobHeap.GetBlobReader(handle);
 }
開發者ID:SamuelEnglard,項目名稱:corefx,代碼行數:4,代碼來源:MetadataReader.cs

示例13: GetBlobBytes

 public byte[] GetBlobBytes(BlobHandle handle)
 {
     return BlobHeap.GetBytes(handle);
 }
開發者ID:SamuelEnglard,項目名稱:corefx,代碼行數:4,代碼來源:MetadataReader.cs

示例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();
            }
        }
開發者ID:bielawb,項目名稱:azure-sdk-tools,代碼行數:17,代碼來源:AddAzureVhdTest.cs

示例15: AddFieldDefinition

 public void AddFieldDefinition(
     FieldAttributes attributes,
     StringHandle name,
     BlobHandle signature)
 {
     _fieldTable.Add(new FieldDefRow
     {
         Flags = (ushort)attributes,
         Name = name,
         Signature = signature
     });
 }
開發者ID:tzetang,項目名稱:corefx,代碼行數:12,代碼來源:MetadataBuilder.Tables.cs


注:本文中的BlobHandle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。