Ejemplo n.º 1
0
		public override void Get(FieldDescriptor ds_, IDataReader dr_)
		{
			switch( ds_.Pos )
			{
				case 0: dr_.AsMessage( Vals??(Vals = new OptFields())); break;
				case 1: dr_.AsMessage( Reps??(Reps = new RepFields())); break;
				case 2: { var _f2_= new OptFields(); dr_.AsMessage(_f2_); _lots.Add(_f2_); } break;
				case 3: Tags = dr_.AsString(); break;
			}
		}
Ejemplo n.º 2
0
		public OptFields AddLots(OptFields i) { return _lots.Add(i); }
Ejemplo n.º 3
0
 public int SingleValuesJsonTests(int seed)
 {
     var opts = CreateSingle(seed);
     var sts = opts.ToString();
     if (Mode == 0) return sts.Length;
     var optz = new OptFields();
     optz.MergeFrom(sts);
     Assert.That(opts.Equals(optz), "JSON single values encode-decode");
     return sts.Length;
 }
Ejemplo n.º 4
0
 protected OptFields CreateSingle(int i)
 {
     var opts = new OptFields
     {
         I32 = 7 + i,
         I64 = -5 - i,
         Bln = true,
         Bts = new byte[3] { 0x97, (byte)i, 0x77 },
         Str = "hello world",
         Chr = 'Z',
         Si32 = -19,
         Si64 = -33,
         Ui32 = 42,
         Ui64 = 0x4FFFFFFFF4,
         Cur = new Currency(101.202 + i),
         Dat = new DateTime(2011 + i % 32, 9, 29, 11, 22, 33),
         Dbl = 98765.04321D - i,
         Flt = 12345.67F,
         Dec = new Decimal(-435.908),
         Enu = Colors.Green,
         F32 = 2789498423,
         F64 = 0xFFFFFFFFFFFFFFFF
     };
     return opts;
 }
Ejemplo n.º 5
0
 public int SingleValuesProtoTests(int seed)
 {
     var opts = CreateSingle(seed);
     var bto = opts.ToByteArray();
     if (Mode == 0) return bto.Length;
     var optz = new OptFields();
     optz.MergeFrom(bto);
     Assert.That(opts.Equals(optz), "PB single values encode-decode");
     return bto.Length;
 }