当前位置: 首页>>代码示例>>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;未经允许,请勿转载。