Beispiel #1
0
        public void Write(TextWriter textWriter, bool writeTimestamp = true)
        {
            if (textWriter == null)
            {
                throw new ArgumentNullException(nameof(textWriter));
            }

            WriteCommon(textWriter);

            var fieldDelim = ' ';

            using (var nameEnumerator = FieldsNames.GetEnumerator())
                using (var valueEnumerator = FieldsValues.GetEnumerator())
                {
                    while (nameEnumerator.MoveNext() && valueEnumerator.MoveNext())
                    {
                        var name  = nameEnumerator.Current;
                        var value = valueEnumerator.Current;

                        textWriter.Write(fieldDelim);
                        fieldDelim = ',';
                        textWriter.Write(LineProtocolSyntax.EscapeName(name));
                        textWriter.Write('=');
                        textWriter.Write(LineProtocolSyntax.FormatValue(value));
                    }
                }

            if (!writeTimestamp)
            {
                return;
            }

            WriteTimestamp(textWriter);
        }
Beispiel #2
0
 private void  SetFields()
 {
     foreach (var fieldInfo in type.GetFields(BindingFlags.Instance |
                                              BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
     {
         Field field = new Field(fieldInfo);
         Fields.Add(field);
         FieldsNames.Add(field.GetName());
     }
 }
Beispiel #3
0
        public async ValueTask WriteAsync(TextWriter textWriter, bool writeTimestamp = true)
        {
            if (textWriter == null)
            {
                throw new ArgumentNullException(nameof(textWriter));
            }

            await WriteCommonAsync(textWriter);

            var fieldDelim = ' ';

            using (var nameEnumerator = FieldsNames.GetEnumerator())
            {
                using var valueEnumerator = FieldsValues.GetEnumerator();
                while (nameEnumerator.MoveNext() && valueEnumerator.MoveNext())
                {
                    var name  = nameEnumerator.Current;
                    var value = valueEnumerator.Current;

                    await textWriter.WriteAsync(fieldDelim);

                    fieldDelim = ',';
                    await textWriter.WriteAsync(LineProtocolSyntax.EscapeName(name));

                    await textWriter.WriteAsync('=');

                    await textWriter.WriteAsync(LineProtocolSyntax.FormatValue(value));
                }
            }

            if (!writeTimestamp)
            {
                return;
            }

            await WriteTimestampAsync(textWriter);
        }
Beispiel #4
0
 public void userEnligne()
 {
     FieldsNames.Add("ID");
     FieldsNames.Add("Enligne");
     UpdateRecord(ID, Enligne);
 }