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

C# Blob类代码示例

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

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



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

示例1: PutAsync

        public async Task<Hash> PutAsync(long id, SemanticVersion version, IPackage package)
        {
            #region Preconditions

            if (package == null) throw new ArgumentNullException(nameof(package));

            #endregion

            var key = id.ToString() + "/" + version.ToString();

            using (var ms = new MemoryStream())
            {
                await package.ZipToStreamAsync(ms).ConfigureAwait(false);

                var hash = Hash.ComputeSHA256(ms, leaveOpen: true);

                var blob = new Blob(ms) {
                    ContentType = "application/zip"
                };

                await bucket.PutAsync(key, blob).ConfigureAwait(false);

                return hash;
            }
        }
开发者ID:carbon,项目名称:Platform,代码行数:25,代码来源:PackageStore.cs


示例2: EncryptedContent

 /// <summary>
 /// Create an EncryptedContent where all the values are unspecified.
 /// </summary>
 ///
 public EncryptedContent()
 {
     this.algorithmType_ = net.named_data.jndn.encrypt.algo.EncryptAlgorithmType.NONE;
     this.keyLocator_ = new KeyLocator();
     this.initialVector_ = new Blob();
     this.payload_ = new Blob();
 }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:11,代码来源:EncryptedContent.cs


示例3: ComputeGrid

    public bool[][] ComputeGrid(Blob[] blobs)
    {
        int sizeX = (int)(_gridBound.rect.width / GridStep) + 1;
        int sizeY = (int)(_gridBound.rect.height / GridStep) + 1;

        var grid = new bool[sizeY][];
        for (int i = 0; i < sizeY; i++)
            grid[i] = new bool[sizeX];

        for (int i = 0; i < sizeY; i++)
            for (int j = 0; j < sizeX; j++)
            {
                float y = _gridBound.offsetMin.y + i * GridStep;
                float x = _gridBound.offsetMin.x + j * GridStep;
                var pos = new Vector2(x, y);

                float totalWeigth = 0;
                foreach (Blob blob in blobs)
                {
                    float distance = Vector2.Distance(pos, blob.transform.position);

                    float weight = blob.WeightFunction(distance);
                    if (weight < 0)
                        weight = 0;

                    totalWeigth += weight;
                }

                grid[i][j] = totalWeigth > WeightThreshold;
            }

        return grid;
    }
开发者ID:ReMinoer,项目名称:MarchingCube,代码行数:33,代码来源:MarchingSquareRenderer.cs


示例4: testData

        public static void testData() { 
            byte[] origData = new byte[1024];
			for (int i = 0; i < origData.Length; i++) {
				origData[i] = (byte)i;
			}
			
			{
				
                Blob blob = new Blob(origData, "application/octet-stream");
				Debug.Assert(origData.Length == blob.getSize());

				for (int i = 0; i < origData.Length; i++) {
					Debug.Assert(origData[i] == blob.getData()[i]);
				}
			}
			
			Data data = new Data(origData, "application/octet-stream");
			Blob blob2 = data.getBinary();
			
			byte[] newData = blob2.getData();
			
			if (newData.Length == origData.Length);
			for (int i = 0; i < origData.Length; i++) {
                Debug.Assert(newData[i] == origData[i]);
			}

        }
开发者ID:juehv,项目名称:uscxml,代码行数:27,代码来源:RunTests.cs


示例5: VenueMapNotFoundViewModel

 public VenueMapNotFoundViewModel(Blob blob, FourOhFourReason reason)
 {
     Reason = reason;
     Blob = blob;
     Month = string.Empty;
     Year = DateTime.Now.Year.ToString();
 }
开发者ID:RHMGLtd,项目名称:sourcecode,代码行数:7,代码来源:VenueMapNotFoundViewModel.cs


示例6: ToGitObject

        public IStorableObject ToGitObject(Repository repo, string sha)
        {
            using (GitObjectReader objectReader = new GitObjectReader(Content))
              {
            IStorableObject obj;
            switch (Type)
            {
              case ObjectType.Commit:
              obj = new Commit(repo, sha);
              break;
            case ObjectType.Tree:
              obj = new Tree(repo, sha);
              break;
            case ObjectType.Blob:
              obj = new Blob(repo, sha);
              break;
            case ObjectType.Tag:
              obj = new Tag(repo, sha);
              break;
            default:
              throw new NotImplementedException();
            }

            obj.Deserialize(objectReader);
            return obj;
              }
        }
开发者ID:skinny,项目名称:dotgit,代码行数:27,代码来源:Undeltified.cs


示例7: GetWithPrefix

 public HashSet<string> GetWithPrefix(string prefix, int maxSize)
 {
     Blob<HashSet<KeyValuePair<string, string>>> rootBlob = new Blob<HashSet<KeyValuePair<string, string>>>(dir.GetBlobReference("root"));
     HashSet<KeyValuePair<string, string>> set = rootBlob.Get();
     set.RemoveWhere((p) => p.Key.StartsWith(prefix));
     return new HashSet<string>(set.Select((p) => p.Value));
 }
开发者ID:ismaelbelghiti,项目名称:Tigwi,代码行数:7,代码来源:PrefixTreeBlob.cs


示例8: ListFilesInSpecificFolder

        //List all files in a specific folder(for example, folder name:  a/b/c). return the list of blob info.
        public List<Blob> ListFilesInSpecificFolder(string container, string folderName)
        {
            BlobStorage blobStorage = new BlobStorage(container);
            //Add prefix before listing all files
            string blobPrefix = folderName + "/";
            if (string.IsNullOrEmpty(folderName) || string.IsNullOrWhiteSpace(folderName))
            {
                blobPrefix = null;
            }
            //Not to list the files in subfolder
            bool useFlatBlobListing = false;
            var blobs = blobStorage.Container.ListBlobs(blobPrefix, useFlatBlobListing, BlobListingDetails.None);
            //To get all files
            var files = blobs.Where(b => b as CloudBlobDirectory == null).ToList();

            var list = new List<Blob>();
            foreach (var file in files)
            {
                var blob = new Blob();
                //To get blob info
                blob.Name = Path.GetFileName(file.Uri.ToString());
                blob.Uri = file.Uri.ToString();
                list.Add(blob);
            }
            return list;
        }
开发者ID:RogerDong,项目名称:3NET-Project,代码行数:27,代码来源:Service1.svc.cs


示例9: ListFoldersInRootOfContainer

 //List all foders in the root of the container
 public List<Blob> ListFoldersInRootOfContainer(string container)
 {
     BlobStorage blobStorage = new BlobStorage(container);
     string blobPrefix = null;
     //Not to list the files in subfolder
     bool useFlatBlobListing = false;
     var blobs = blobStorage.Container.ListBlobs(blobPrefix, useFlatBlobListing, BlobListingDetails.None);
     //To get all the directory
     var folders = blobs.Where(b => b as CloudBlobDirectory != null).ToList();
     var list = new List<Blob>();
     string folderName;
     foreach (var folder in folders)
     {
         var blob = new Blob();
         //Get the folder name
         folderName = folder.Uri.ToString();
         folderName = folderName.Substring(0, folderName.Length - 1);
         folderName = folderName.Substring(folderName.LastIndexOf("/") + 1);
         //Assign the folder name and Uri
         blob.Name = folderName;
         blob.Uri = folder.Uri.ToString();
         list.Add(blob);
     }
     //Return the list
     return list;
 }
开发者ID:RogerDong,项目名称:3NET-Project,代码行数:27,代码来源:Service1.svc.cs


示例10: BlobStream

 internal BlobStream(ConnectPackageCreationParameters connectPackageParameters, Blob blob)
 {
     _connectPackageParameters = connectPackageParameters;
     _blob = blob;
     _length = blob.ContentLength;
     _canWrite = true;
 }
开发者ID:marteaga,项目名称:healthvault-azurestorage,代码行数:7,代码来源:BlobStream.cs


示例11: AttachBlobs

        public void AttachBlobs()
        {
            Blob blob = new Blob(IOHelper.CreateTempFile("This is just a note.")).SetFilename("note1.txt");
            Entity result = client.Operation("Blob.Attach")
                                  .SetInput(blob)
                                  .SetParameter("document", blobContainer.Path)
                                  .Execute()
                                  .Result;
            Assert.True(result is Blob);
            Assert.Equal("This is just a note.", IOHelper.ReadText(((Blob)result).File));

            BlobList blobs = new BlobList();
            blobs.Add(new Blob(IOHelper.CreateTempFile("This is another note.")).SetFilename("note2.txt"));
            blobs.Add(Blob.FromFile("Puppy.docx"));

            result = client.Operation("Blob.Attach")
                           .SetInput(blobs)
                           .SetParameter("document", blobContainer.Path)
                           .SetParameter("xpath", "files:files")
                           .Execute()
                           .Result;
            Assert.True(result is BlobList);
            Assert.Equal(2, blobs.Count);
            Assert.Equal("This is another note.", IOHelper.ReadText(blobs[0].File));
            Assert.True(IOHelper.AreFilesEqual("Puppy.docx", blobs[1].File.FullName));
        }
开发者ID:nuxeo,项目名称:nuxeo-dotnet-client,代码行数:26,代码来源:BlobUpload.cs


示例12: FourOhFourViewModel

 public FourOhFourViewModel(FourOhFourReason reason, Blob blob)
 {
     Reason = reason;
     Blob = blob;
     Month = string.Empty;
     Year = DateTime.Now.Year.ToString(); 
 }
开发者ID:RHMGLtd,项目名称:sourcecode,代码行数:7,代码来源:FourOhFourViewModel.cs


示例13: Equals

        public override bool Equals(Blob blob)
        {
            var sb = blob as StreamBlob;
            if (sb != null)
            {
                if (_stream == sb._stream) return true;
                var fsa = _stream as FileStream;
                if (fsa == null) return false;
                var fsb = sb._stream as FileStream;
                if (fsb == null) return false;
                try
                {
                    return fsa.Name.Equals(fsb.Name);
                }
                catch
                {
                    return false;
                }
            }

            var fb = blob as FileBlob;
            if (fb == null) return false;

            var fs = _stream as FileStream;
            if (fs == null) return false;
            try
            {
                return fb.Filename.Equals(fs.Name);
            }
            catch
            {
                return false;
            }
        }
开发者ID:bittercoder,项目名称:Lob,代码行数:34,代码来源:StreamBlob.cs


示例14: WritePEImage

        private static void WritePEImage(
            Stream peStream, 
            MetadataBuilder metadataBuilder, 
            BlobBuilder ilBuilder, 
            MethodDefinitionHandle entryPointHandle,
            Blob mvidFixup = default(Blob),
            byte[] privateKeyOpt = null)
        {
            var peBuilder = new ManagedPEBuilder(
                entryPointHandle.IsNil ? PEHeaderBuilder.CreateLibraryHeader() : PEHeaderBuilder.CreateExecutableHeader(),
                new MetadataRootBuilder(metadataBuilder),
                ilBuilder,
                entryPoint: entryPointHandle,
                flags: CorFlags.ILOnly | (privateKeyOpt != null ? CorFlags.StrongNameSigned : 0),
                deterministicIdProvider: content => s_contentId);

            var peBlob = new BlobBuilder();

            var contentId = peBuilder.Serialize(peBlob);

            if (!mvidFixup.IsDefault)
            {
                new BlobWriter(mvidFixup).WriteGuid(contentId.Guid);
            }

            if (privateKeyOpt != null)
            {
                peBuilder.Sign(peBlob, content => SigningUtilities.CalculateRsaSignature(content, privateKeyOpt));
            }

            peBlob.WriteContentTo(peStream);
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:32,代码来源:PEBuilderTests.cs


示例15: EndTurnAction

 public void EndTurnAction(Blob blob)
 {
     if (blob.Damage >= blob.InitialDamage + DamageReducedEveryTurn)
     {
         blob.Damage -= DamageReducedEveryTurn;
     }
 }
开发者ID:HouseBreaker,项目名称:SoftUni-Exams,代码行数:7,代码来源:AggressiveBehavior.cs


示例16: KeyLocator

 /// <summary>
 /// Create a new KeyLocator with default values.
 /// </summary>
 ///
 public KeyLocator()
 {
     this.type_ = net.named_data.jndn.KeyLocatorType.NONE;
     this.keyData_ = new Blob();
     this.keyName_ = new ChangeCounter(new Name());
     this.changeCount_ = 0;
 }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:11,代码来源:KeyLocator.cs


示例17: Get

		public IBlob Get(Uri uri)
		{
			IBlob blob = null;

			var options = new BlobRequestOptions { BlobListingDetails = BlobListingDetails.Metadata };

			var container = getContainer();
			var target = container.GetBlobReference(uri.ToString());

			try
			{
				target.FetchAttributes();
				blob = new Blob(target.Properties.ContentMD5, target.Properties.ETag)
					{ Content = target.DownloadByteArray(), ContentType = target.Properties.ContentType, };

				foreach (var key in target.Metadata.AllKeys)
				{
					blob.Metdata.Add(new KeyValuePair<string, string>(key, target.Metadata[key]));
				}
			}
			catch (StorageClientException s)
			{
				this.WriteErrorMessage(string.Format("An error occurred retrieving the blob from {0}", uri), s);
				blob = null;
			}

			return blob;
		}
开发者ID:smhinsey,项目名称:Euclid,代码行数:28,代码来源:AzureBlobStorage.cs


示例18: Interest

 /// <summary>
 /// Create a new Interest with the given name and interest lifetime and "none"
 /// for other values.
 /// </summary>
 ///
 /// <param name="name">The name for the interest.</param>
 /// <param name="interestLifetimeMilliseconds"></param>
 public Interest(Name name, double interestLifetimeMilliseconds)
 {
     this.name_ = new ChangeCounter(new Name());
     this.minSuffixComponents_ = -1;
     this.maxSuffixComponents_ = -1;
     this.keyLocator_ = new ChangeCounter(
             new KeyLocator());
     this.exclude_ = new ChangeCounter(new Exclude());
     this.childSelector_ = -1;
     this.mustBeFresh_ = true;
     this.interestLifetimeMilliseconds_ = -1;
     this.nonce_ = new Blob();
     this.getNonceChangeCount_ = 0;
     this.lpPacket_ = null;
     this.linkWireEncoding_ = new Blob();
     this.linkWireEncodingFormat_ = null;
     this.link_ = new ChangeCounter(null);
     this.selectedDelegationIndex_ = -1;
     this.defaultWireEncoding_ = new SignedBlob();
     this.getDefaultWireEncodingChangeCount_ = 0;
     this.changeCount_ = 0;
     if (name != null)
         name_.set(new Name(name));
     interestLifetimeMilliseconds_ = interestLifetimeMilliseconds;
 }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:32,代码来源:Interest.cs


示例19: PutAsync

        public async Task<Hash> PutAsync(long id, SemanticVersion version, IPackage package)
        {
            var key = prefix + id.ToString() + "/" + version.ToString();

            using (var ms = new MemoryStream())
            {
                await package.ZipToStreamAsync(ms).ConfigureAwait(false);

                ms.Position = 0;

                var hash = Hash.ComputeSHA256(ms, leaveOpen: true);

                var secret = SecretKey.Derive(password, hash.Data);

                using (var protector = new AesProtector(secret))
                {
                    using (var packageStream = protector.EncryptStream(ms))
                    {
                        var blob = new Blob(packageStream) {
                            ContentType = "application/zip"
                        };

                        await bucket.PutAsync(key, blob).ConfigureAwait(false);
                    }
                }

                return hash;
            }
        }
开发者ID:carbon,项目名称:Platform,代码行数:29,代码来源:ProtectedPackageStore.cs


示例20: HmacWithSha256Signature

 /// <summary>
 /// Create a new HmacWithSha256Signature with default values.
 /// </summary>
 ///
 public HmacWithSha256Signature()
 {
     this.signature_ = new Blob();
     this.keyLocator_ = new ChangeCounter(
             new KeyLocator());
     this.changeCount_ = 0;
 }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:11,代码来源:HmacWithSha256Signature.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# BlobAnalyse类代码示例发布时间:2022-05-24
下一篇:
C# BlendMode类代码示例发布时间: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