Example #1
0
        private void WriteDuration(TextWriter writer, IMessage value)
        {
            // TODO: Same as for WriteTimestamp
            int  nanos   = (int)value.Descriptor.Fields[Duration.NanosFieldNumber].Accessor.GetValue(value);
            long seconds = (long)value.Descriptor.Fields[Duration.SecondsFieldNumber].Accessor.GetValue(value);

            writer.Write(ProtobufAdapter.DurationToText(seconds, nanos, DiagnosticOnly));
        }
Example #2
0
        private void WriteTimestamp(TextWriter writer, IMessage value)
        {
            // TODO: In the common case where this *is* using the built-in Timestamp type, we could
            // avoid all the reflection at this point, by casting to Timestamp. In the interests of
            // avoiding subtle bugs, don't do that until we've implemented DynamicMessage so that we can prove
            // it still works in that case.
            int  nanos   = (int)value.Descriptor.Fields[Timestamp.NanosFieldNumber].Accessor.GetValue(value);
            long seconds = (long)value.Descriptor.Fields[Timestamp.SecondsFieldNumber].Accessor.GetValue(value);

            writer.Write(ProtobufAdapter.TimestampToText(seconds, nanos, DiagnosticOnly));
        }
Example #3
0
        private void WriteFieldMask(TextWriter writer, IMessage value)
        {
            var paths = (IList <string>)value.Descriptor.Fields[FieldMask.PathsFieldNumber].Accessor.GetValue(value);

            writer.Write(ProtobufAdapter.FieldMaskToText(paths, DiagnosticOnly));
        }