当前位置: 首页>>代码示例>>C#>>正文


C# ObjectReader.ReadInt64方法代码示例

本文整理汇总了C#中Roslyn.Utilities.ObjectReader.ReadInt64方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectReader.ReadInt64方法的具体用法?C# ObjectReader.ReadInt64怎么用?C# ObjectReader.ReadInt64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Roslyn.Utilities.ObjectReader的用法示例。


在下文中一共展示了ObjectReader.ReadInt64方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeserializeSourceText

        private SourceText DeserializeSourceText(ObjectReader reader, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            // REVIEW: why IDE services doesnt care about checksumAlgorithm?
            var checksumAlgorithm = (SourceHashAlgorithm)reader.ReadInt32();
            var webName = reader.ReadString();
            var encoding = webName == null ? null : Encoding.GetEncoding(webName);

            var kind = (SerializationKinds)reader.ReadInt32();
            if (kind == SerializationKinds.MemoryMapFile)
            {
                var name = reader.ReadString();
                var size = reader.ReadInt64();

                var tempService = _workspaceServices.GetService<ITemporaryStorageService>() as ITemporaryStorageService2;
                var storage = tempService.AttachTemporaryTextStorage(name, size, encoding, cancellationToken);

                return storage.ReadText(cancellationToken);
            }

            // TODO: should include version info here as well?

            var textService = _workspaceServices.GetService<ITextFactoryService>();
            using (var textReader = new StringReader(reader.ReadString()))
            {
                return textService.CreateText(textReader, encoding, cancellationToken);
            }
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:29,代码来源:Serializer_Asset.cs

示例2: GetTemporaryStorage

        private void GetTemporaryStorage(
            ObjectReader reader, SerializationKinds kind, out ITemporaryStreamStorage storage, out long length, CancellationToken cancellationToken)
        {
            if (kind == SerializationKinds.Bits)
            {
                storage = _storageService.CreateTemporaryStreamStorage(cancellationToken);
                using (var stream = SerializableBytes.CreateWritableStream())
                {
                    CopyByteArrayToStream(reader, stream, cancellationToken);

                    length = stream.Length;

                    stream.Position = 0;
                    storage.WriteStream(stream, cancellationToken);
                }

                return;
            }

            if (kind == SerializationKinds.MemoryMapFile)
            {
                var service2 = _storageService as ITemporaryStorageService2;
                Contract.ThrowIfNull(service2);

                var name = reader.ReadString();
                var size = reader.ReadInt64();

                storage = service2.AttachTemporaryStreamStorage(name, size, cancellationToken);
                length = size;

                return;
            }

            throw ExceptionUtilities.UnexpectedValue(kind);
        }
开发者ID:natidea,项目名称:roslyn,代码行数:35,代码来源:AbstractReferenceSerializationService.cs

示例3: Deserialize

        private static AnalyzerTelemetryInfo Deserialize(ObjectReader reader, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var compilationStartActionsCount = reader.ReadInt32();
            var compilationEndActionsCount = reader.ReadInt32();
            var compilationActionsCount = reader.ReadInt32();
            var syntaxTreeActionsCount = reader.ReadInt32();
            var semanticModelActionsCount = reader.ReadInt32();
            var symbolActionsCount = reader.ReadInt32();
            var syntaxNodeActionsCount = reader.ReadInt32();
            var codeBlockStartActionsCount = reader.ReadInt32();
            var codeBlockEndActionsCount = reader.ReadInt32();
            var codeBlockActionsCount = reader.ReadInt32();
            var operationActionsCount = reader.ReadInt32();
            var operationBlockActionsCount = reader.ReadInt32();
            var operationBlockStartActionsCount = reader.ReadInt32();
            var operationBlockEndActionsCount = reader.ReadInt32();
            var executionTime = new TimeSpan(reader.ReadInt64());

            return new AnalyzerTelemetryInfo()
            {
                CompilationStartActionsCount = compilationStartActionsCount,
                CompilationEndActionsCount = compilationEndActionsCount,
                CompilationActionsCount = compilationActionsCount,

                SyntaxTreeActionsCount = syntaxTreeActionsCount,
                SemanticModelActionsCount = semanticModelActionsCount,
                SymbolActionsCount = symbolActionsCount,
                SyntaxNodeActionsCount = syntaxNodeActionsCount,

                CodeBlockStartActionsCount = codeBlockStartActionsCount,
                CodeBlockEndActionsCount = codeBlockEndActionsCount,
                CodeBlockActionsCount = codeBlockActionsCount,

                OperationActionsCount = operationActionsCount,
                OperationBlockStartActionsCount = operationBlockStartActionsCount,
                OperationBlockEndActionsCount = operationBlockEndActionsCount,
                OperationBlockActionsCount = operationBlockActionsCount,

                ExecutionTime = executionTime
            };
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:43,代码来源:DiagnosticResultSerializer.cs


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