Beispiel #1
0
        protected virtual void WriteTo(ObjectWriter writer)
        {
            writer.WriteValue(_messageProvider);
            writer.WriteUInt32((uint)_errorCode);
            writer.WriteInt32((int)_effectiveSeverity);
            writer.WriteInt32((int)_defaultSeverity);

            int count = _arguments.Length;

            writer.WriteUInt32((uint)count);

            if (count > 0)
            {
                foreach (var arg in _arguments)
                {
                    writer.WriteString(arg.ToString());
                }
            }
        }
Beispiel #2
0
 public static Checksum Create <T>(WellKnownSynchronizationKind kind, T value, ISerializerService serializer)
 {
     using (var stream = SerializableBytes.CreateWritableStream())
         using (var objectWriter = new ObjectWriter(stream))
         {
             objectWriter.WriteInt32((int)kind);
             serializer.Serialize(value, objectWriter, CancellationToken.None);
             return(Create(stream));
         }
 }
Beispiel #3
0
            public void WriteTo(ObjectWriter writer)
            {
                Id.WriteTo(writer);

                writer.WriteString(Name);
                writer.WriteValue(Folders.ToArray());
                writer.WriteInt32((int)SourceCodeKind);
                writer.WriteString(FilePath);
                writer.WriteBoolean(IsGenerated);
            }
Beispiel #4
0
        public static Checksum Create(WellKnownSynchronizationKind kind, IObjectWritable @object)
        {
            using (var stream = SerializableBytes.CreateWritableStream())
                using (var objectWriter = new ObjectWriter(stream))
                {
                    objectWriter.WriteInt32((int)kind);
                    @object.WriteTo(objectWriter);

                    return(Create(stream));
                }
        }
        void IObjectWritable.WriteTo(ObjectWriter writer)
        {
            writer.WriteType(_resourceSource);
            writer.WriteString(_nameOfLocalizableResource);
            var length = _formatArguments.Length;

            writer.WriteInt32(length);
            for (int i = 0; i < length; i++)
            {
                writer.WriteString(_formatArguments[i]);
            }
        }
Beispiel #6
0
        // TODO: WriteAsync?
        internal void WriteTo(ObjectWriter writer)
        {
            writer.WriteString(SerializationFormat);
            this.Version.WriteTo(writer);

            writer.WriteInt32(this.projectToProjectsItReferencesMap.Count);

            foreach (var id in this.projectToProjectsItReferencesMap.Keys.OrderBy(p => p.Id))
            {
                var project = this.Solution.GetProject(id);
                if (project != null && !string.IsNullOrEmpty(project.FilePath))
                {
                    ImmutableHashSet <ProjectId> projRefs;
                    if (this.projectToProjectsItReferencesMap.TryGetValue(id, out projRefs))
                    {
                        var referencedProjects = projRefs.OrderBy(r => r.Id)
                                                 .Select(r => this.Solution.GetProject(r))
                                                 .Where(p => p != null && !string.IsNullOrEmpty(p.FilePath))
                                                 .ToList();

                        writer.WriteInt32(referencedProjects.Count);
                        writer.WriteString(project.FilePath);

                        if (referencedProjects.Count > 0)
                        {
                            // project references
                            foreach (var referencedProject in referencedProjects)
                            {
                                writer.WriteString(referencedProject.FilePath);
                            }
                        }

                        continue;
                    }
                }

                // invalid project
                writer.WriteInt32(-1);
            }
        }
Beispiel #7
0
        public static Checksum Create(WellKnownSynchronizationKind kind, IEnumerable <Checksum> checksums)
        {
            using var stream = SerializableBytes.CreateWritableStream();
            using var writer = new ObjectWriter(stream);
            writer.WriteInt32((int)kind);

            foreach (var checksum in checksums)
            {
                checksum.WriteTo(writer);
            }

            return(Create(stream));
        }
Beispiel #8
0
        public static Checksum Create(WellKnownSynchronizationKind kind, ImmutableArray <byte> bytes)
        {
            using var stream = SerializableBytes.CreateWritableStream();
            using var writer = new ObjectWriter(stream);
            writer.WriteInt32((int)kind);

            for (var i = 0; i < bytes.Length; i++)
            {
                writer.WriteByte(bytes[i]);
            }

            return(Create(stream));
        }
Beispiel #9
0
 internal void WriteTo(ObjectWriter writer)
 {
     writer.WriteInt64(_utcLastModified.ToBinary());
     writer.WriteInt32(_localIncrement);
     writer.WriteInt32(_globalIncrement);
 }
Beispiel #10
0
 public void WriteTo(ObjectWriter writer)
 {
     writer.WriteInt64(Data1);
     writer.WriteInt64(Data2);
     writer.WriteInt32(Data3);
 }