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


C# ObjectWriter.WriteString方法代码示例

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


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

示例1: WriteTo

 internal void WriteTo(ObjectWriter writer)
 {
     writer.WriteString(Name);
     writer.WriteString(ContainerDisplayName);
     writer.WriteString(FullyQualifiedContainerName);
     writer.WriteByte((byte)Kind);
     writer.WriteInt32(Span.Start);
     writer.WriteInt32(Span.Length);
     writer.WriteUInt16(ParameterCount);
     writer.WriteUInt16(TypeParameterCount);
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:11,代码来源:DeclaredSymbolInfo.cs

示例2: SerializeDocumentSnapshotInfo

        public void SerializeDocumentSnapshotInfo(DocumentChecksumObjectInfo info, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            SerializeDocumentId(info.Id, writer, cancellationToken);

            writer.WriteString(info.Name);
            writer.WriteValue(info.Folders.ToArray());
            writer.WriteInt32((int)info.SourceCodeKind);
            writer.WriteString(info.FilePath);
            writer.WriteBoolean(info.IsGenerated);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:12,代码来源:Serializer_Asset.cs

示例3: SerializeProjectSnapshotInfo

        public void SerializeProjectSnapshotInfo(ProjectChecksumObjectInfo info, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            SerializeProjectId(info.Id, writer, cancellationToken);

            // TODO: figure out a way to send version info over as well
            // info.Version.WriteTo(writer);

            writer.WriteString(info.Name);
            writer.WriteString(info.AssemblyName);
            writer.WriteString(info.Language);
            writer.WriteString(info.FilePath);
            writer.WriteString(info.OutputFilePath);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:15,代码来源:Serializer_Asset.cs

示例4: SerializeChecksumObjectWithChildrenAsync

        public async Task SerializeChecksumObjectWithChildrenAsync(ChecksumObjectWithChildren checksumObject, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteString(checksumObject.Kind);
            checksumObject.Checksum.WriteTo(writer);

            writer.WriteInt32(checksumObject.Children.Length);
            foreach (var child in checksumObject.Children)
            {
                var checksum = child as Checksum;
                if (checksum != null)
                {
                    writer.WriteByte(ChecksumKind);
                    checksum.WriteTo(writer);
                    continue;
                }

                var checksumCollection = child as ChecksumCollection;
                if (checksumCollection != null)
                {
                    writer.WriteByte(ChecksumCollectionKind);
                    await SerializeChecksumObjectWithChildrenAsync(checksumCollection, writer, cancellationToken).ConfigureAwait(false);
                    continue;
                }

                throw ExceptionUtilities.UnexpectedValue(child);
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:29,代码来源:Serializer_ChecksumObjectWithChildren.cs

示例5: SerializeChecksumWithChildren

        public void SerializeChecksumWithChildren(ChecksumWithChildren checksums, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var kind = checksums.GetWellKnownSynchronizationKind();
            writer.WriteString(kind);
            checksums.Checksum.WriteTo(writer);

            writer.WriteInt32(checksums.Children.Count);
            foreach (var child in checksums.Children)
            {
                var checksum = child as Checksum;
                if (checksum != null)
                {
                    writer.WriteByte(ChecksumKind);
                    checksum.WriteTo(writer);
                    continue;
                }

                var checksumCollection = child as ChecksumCollection;
                if (checksumCollection != null)
                {
                    writer.WriteByte(ChecksumWithChildrenKind);
                    SerializeChecksumWithChildren(checksumCollection, writer, cancellationToken);
                    continue;
                }

                throw ExceptionUtilities.UnexpectedValue(child);
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:30,代码来源:Serializer_ChecksumWithChildren.cs

示例6: WriteTo

        public static void WriteTo(this BitArray bitArray, ObjectWriter writer)
        {
            // Our serialization format doesn't round-trip bit arrays of non-byte lengths
            Contract.ThrowIfTrue(bitArray.Length % 8 != 0);

            writer.WriteString(SerializationFormat);
            writer.WriteInt32(bitArray.Length / 8);

            // This will hold the byte that we will write out after we process every 8 bits. This is
            // LSB, so we push bits into it from the MSB.
            byte b = 0;

            for (var i = 0; i < bitArray.Length; i++)
            {
                if (bitArray[i])
                {
                    b = (byte)(0x80 | b >> 1);
                }
                else
                {
                    b >>= 1;
                }

                if ((i + 1) % 8 == 0)
                {
                    // End of a byte, write out the byte
                    writer.WriteByte(b);
                }
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:30,代码来源:BitArrayUtilities.cs

示例7: WriteTo

 public void WriteTo(ObjectWriter writer)
 {
     writer.WriteString(SerializationFormat);
     writer.WriteBoolean(_isCaseSensitive);
     writer.WriteInt32(_hashFunctionCount);
     _bitArray.WriteTo(writer);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:7,代码来源:BloomFilter_Serialization.cs

示例8: SerializeOptionSet

        // this is temporary solution until option is supported in compiler layer natively
        // this won't serialize all options but some we pre-selected
        public void SerializeOptionSet(OptionSet options, string language, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteString(language);

            var serializationService = GetOptionsSerializationService(language);
            serializationService.WriteTo(options, writer, cancellationToken);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:11,代码来源:Serializer_OptionSet.cs

示例9: CreateChecksumFromStreamWriter

 private static Checksum CreateChecksumFromStreamWriter(string kind, Action<ObjectWriter, CancellationToken> writer)
 {
     using (var stream = SerializableBytes.CreateWritableStream())
     using (var objectWriter = new ObjectWriter(stream))
     {
         objectWriter.WriteString(kind);
         writer(objectWriter, CancellationToken.None);
         return Checksum.Create(stream);
     }
 }
开发者ID:otawfik-ms,项目名称:roslyn,代码行数:10,代码来源:CustomAsset.cs

示例10: SerializeSourceText

        public void SerializeSourceText(ITemporaryStorageWithName storage, SourceText text, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteInt32((int)text.ChecksumAlgorithm);
            writer.WriteString(text.Encoding?.WebName);

            // TODO: refactor this part in its own abstraction (Bits) that has multiple sub types
            //       rather than using enums
            if (storage != null && storage.Name != null)
            {
                writer.WriteInt32((int)SerializationKinds.MemoryMapFile);
                writer.WriteString(storage.Name);
                writer.WriteInt64(storage.Size);
                return;
            }

            writer.WriteInt32((int)SerializationKinds.Bits);
            writer.WriteString(text.ToString());
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:20,代码来源:Serializer_Asset.cs

示例11: SerializeSolutionSnapshotInfo

        public void SerializeSolutionSnapshotInfo(SolutionChecksumObjectInfo info, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            SerializeSolutionId(info.Id, writer, cancellationToken);

            // TODO: figure out a way to send version info over as well.
            //       right now, version get updated automatically, so 2 can't be exactly match
            // info.Version.WriteTo(writer);
            writer.WriteString(info.FilePath);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:11,代码来源:Serializer_Asset.cs

示例12: SerializeCompilationOptions

        public void SerializeCompilationOptions(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var language = options.Language;

            // TODO: once compiler team adds ability to serialize compilation options to ObjectWriter directly, we won't need this.
            writer.WriteString(language);

            var service = GetOptionsSerializationService(language);
            service.WriteTo(options, writer, cancellationToken);
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:12,代码来源:Serializer_Asset.cs

示例13: WriteTo

        public static void WriteTo(this BitArray bitArray, ObjectWriter writer)
        {
            // TODO : think about a way to use pool for byte array.
            // BitArray will internally allocate another int array. probably need to drop BitArray usage.
            var bytes = new byte[(bitArray.Length + 7) / 8];
            bitArray.CopyTo(bytes, 0);

            writer.WriteString(SerializationFormat);
            writer.WriteInt32(bytes.Length);

            for (var i = 0; i < bytes.Length; i++)
            {
                writer.WriteByte(bytes[i]);
            }
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:15,代码来源:BitArrayUtilities.cs

示例14: WriteCompilationOptionsTo

        protected void WriteCompilationOptionsTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteInt32((int)options.OutputKind);
            writer.WriteBoolean(options.ReportSuppressedDiagnostics);
            writer.WriteString(options.ModuleName);
            writer.WriteString(options.MainTypeName);
            writer.WriteString(options.ScriptClassName);
            writer.WriteInt32((int)options.OptimizationLevel);
            writer.WriteBoolean(options.CheckOverflow);

            // REVIEW: is it okay this being not part of snapshot?
            writer.WriteString(options.CryptoKeyContainer);
            writer.WriteString(options.CryptoKeyFile);

            writer.WriteValue(options.CryptoPublicKey.ToArray());
            writer.WriteBoolean(options.DelaySign.HasValue);
            if (options.DelaySign.HasValue)
            {
                writer.WriteBoolean(options.DelaySign.Value);
            }

            writer.WriteInt32((int)options.Platform);
            writer.WriteInt32((int)options.GeneralDiagnosticOption);

            writer.WriteInt32(options.WarningLevel);

            // REVIEW: I don't think there is a guarantee on ordering of elements in the immutable dictionary.
            //         unfortunately, we need to sort them to make it deterministic
            writer.WriteInt32(options.SpecificDiagnosticOptions.Count);
            foreach (var kv in options.SpecificDiagnosticOptions.OrderBy(o => o.Key))
            {
                writer.WriteString(kv.Key);
                writer.WriteInt32((int)kv.Value);
            }

            writer.WriteBoolean(options.ConcurrentBuild);
            writer.WriteBoolean(options.Deterministic);
            writer.WriteBoolean(options.PublicSign);

            // REVIEW: What should I do with these. we probably need to implement either out own one
            //         or somehow share these as service....
            //
            // XmlReferenceResolver xmlReferenceResolver
            // SourceReferenceResolver sourceReferenceResolver
            // MetadataReferenceResolver metadataReferenceResolver
            // AssemblyIdentityComparer assemblyIdentityComparer
            // StrongNameProvider strongNameProvider
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:50,代码来源:AbstractOptionsSerializationService.cs

示例15: Serialize

        public static void Serialize(ObjectWriter writer, DiagnosticAnalysisResultMap<string, DiagnosticAnalysisResultBuilder> result, CancellationToken cancellationToken)
        {
            var diagnosticSerializer = new DiagnosticDataSerializer(VersionStamp.Default, VersionStamp.Default);

            var analysisResult = result.AnalysisResult;

            writer.WriteInt32(analysisResult.Count);
            foreach (var kv in analysisResult)
            {
                writer.WriteString(kv.Key);

                Serialize(writer, diagnosticSerializer, kv.Value.SyntaxLocals, cancellationToken);
                Serialize(writer, diagnosticSerializer, kv.Value.SemanticLocals, cancellationToken);
                Serialize(writer, diagnosticSerializer, kv.Value.NonLocals, cancellationToken);

                diagnosticSerializer.WriteTo(writer, kv.Value.Others, cancellationToken);
            }

            var telemetryInfo = result.TelemetryInfo;

            writer.WriteInt32(telemetryInfo.Count);
            foreach (var kv in telemetryInfo)
            {
                writer.WriteString(kv.Key);
                Serialize(writer, kv.Value, cancellationToken);
            }

            var exceptions = result.Exceptions;

            writer.WriteInt32(exceptions.Count);
            foreach (var kv in exceptions)
            {
                writer.WriteString(kv.Key);
                diagnosticSerializer.WriteTo(writer, kv.Value, cancellationToken);
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:36,代码来源:DiagnosticResultSerializer.cs


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