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


C# Stream.ToHexString方法代碼示例

本文整理匯總了C#中System.Stream.ToHexString方法的典型用法代碼示例。如果您正苦於以下問題:C# Stream.ToHexString方法的具體用法?C# Stream.ToHexString怎麽用?C# Stream.ToHexString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Stream的用法示例。


在下文中一共展示了Stream.ToHexString方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReadHighestIndexedProjectionStreamSequenceAsync

        public Task<int> ReadHighestIndexedProjectionStreamSequenceAsync(Stream stream)
        {
            lock (_projectionIndexes)
            {
                List<long> projection;

                if (_projectionIndexes.TryGetValue(stream.ToHexString(), out projection))
                    return Task.FromResult(projection.Count);
            }

            return Task.FromResult(0);
        }
開發者ID:promontis,項目名稱:Even,代碼行數:12,代碼來源:InMemoryStore.cs

示例2: ReadIndexedProjectionStreamAsync

        public Task ReadIndexedProjectionStreamAsync(Stream stream, int initialSequence, int count, Action<IPersistedRawEvent> readCallback, CancellationToken ct)
        {
            lock (_projectionIndexes)
            {
                List<long> projection;

                if (_projectionIndexes.TryGetValue(stream.ToHexString(), out projection))
                {
                    IEnumerable<PersistedRawEvent> events;

                    lock (_events)
                    {
                        events = from s in projection
                                 join e in _events on s equals e.GlobalSequence
                                 orderby e.GlobalSequence
                                 select e;

                        if (initialSequence > 0)
                            events = events.Skip(initialSequence - 1);

                        if (count >= 0)
                            events = events.Take(count);

                        events = events.ToList();
                    }

                    foreach (var e in events)
                    {
                        if (ct.IsCancellationRequested)
                            break;

                        readCallback(e);
                    }
                }
            }

            return Unit.GetCompletedTask();
        }
開發者ID:promontis,項目名稱:Even,代碼行數:38,代碼來源:InMemoryStore.cs

示例3: ReadHighestIndexedProjectionGlobalSequenceAsync

        public Task<long> ReadHighestIndexedProjectionGlobalSequenceAsync(Stream stream)
        {
            lock (_projectionIndexes)
            {
                List<long> projection;

                if (_projectionIndexes.TryGetValue(stream.ToHexString(), out projection))
                    return Task.FromResult(projection.LastOrDefault());
            }

            return Task.FromResult(0L);
        }
開發者ID:promontis,項目名稱:Even,代碼行數:12,代碼來源:InMemoryStore.cs

示例4: ReadProjectionCheckpointAsync

        public Task<long> ReadProjectionCheckpointAsync(Stream stream)
        {
            lock (_projectionCheckpoints)
            {
                long checkpoint;

                if (_projectionCheckpoints.TryGetValue(stream.ToHexString(), out checkpoint))
                    return Task.FromResult(checkpoint);
            }

            return Task.FromResult(0L);
        }
開發者ID:promontis,項目名稱:Even,代碼行數:12,代碼來源:InMemoryStore.cs

示例5: WriteProjectionCheckpointAsync

        public Task WriteProjectionCheckpointAsync(Stream stream, long globalSequence)
        {
            lock (_projectionCheckpoints)
            {
                _projectionCheckpoints[stream.ToHexString()] = globalSequence;
            }

            return Unit.GetCompletedTask();
        }
開發者ID:promontis,項目名稱:Even,代碼行數:9,代碼來源:InMemoryStore.cs

示例6: WriteProjectionIndexAsync

        public Task WriteProjectionIndexAsync(Stream stream, int expectedSequence, IReadOnlyCollection<long> globalSequences)
        {
            lock (_projectionIndexes)
            {
                List<long> projection;

                var key = stream.ToHexString();

                if (!_projectionIndexes.TryGetValue(key, out projection))
                    _projectionIndexes.Add(key, projection = new List<long>());

                if (projection.Count != expectedSequence)
                    throw new UnexpectedStreamSequenceException();

                if (globalSequences.Intersect(projection).Any())
                    throw new DuplicatedEntryException();

                lock (_events)
                {
                    projection.AddRange(globalSequences);
                }
            }

            return Unit.GetCompletedTask();
        }
開發者ID:promontis,項目名稱:Even,代碼行數:25,代碼來源:InMemoryStore.cs

示例7: ClearProjectionIndexAsync

        public Task ClearProjectionIndexAsync(Stream stream)
        {
            var key = stream.ToHexString();

            lock (_projectionCheckpoints)
            {
                if (_projectionCheckpoints.ContainsKey(key))
                    _projectionCheckpoints.Remove(key);
            }

            lock (_projectionIndexes)
            {
                if (_projectionIndexes.ContainsKey(key))
                    _projectionIndexes.Remove(key);
            }

            return Unit.GetCompletedTask();
        }
開發者ID:promontis,項目名稱:Even,代碼行數:18,代碼來源:InMemoryStore.cs


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