示例#1
0
        private Node ReadNode()
        {
            reader.BeginReadMessage();
            var result = new Node();

            while (reader.State == ProtobufReaderState.Field)
            {
                switch (reader.FieldNumber)
                {
                case 1:
                    result.Id = reader.ReadSInt64();
                    break;

                case 2:
                    result.Keys = reader.ReadPackedInt64Array().Cast <uint>().ToList();
                    break;

                case 3:
                    result.Values = reader.ReadPackedInt64Array().Cast <uint>().ToList();
                    break;

                case 4:
                    result.Info = ReadInfo();
                    break;

                case 8:
                    result.Lat = reader.ReadSInt64();
                    break;

                case 9:
                    result.Lon = reader.ReadSInt64();
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }
            reader.EndReadMessage();
            return(result);
        }
示例#2
0
        private Way ReadWay()
        {
            reader.BeginReadMessage();
            var result = new Way();

            while (reader.State == ProtobufReaderState.Field)
            {
                switch (reader.FieldNumber)
                {
                case 1:
                    result.Id = reader.ReadSInt64();
                    break;

                case 2:
                    result.Keys = reader.ReadPackedInt64Array();
                    break;

                case 3:
                    result.Values = reader.ReadPackedInt64Array();
                    break;

                case 4:
                    result.Info = ReadInfo();
                    break;

                case 8:
                    result.Refs = reader.ReadPackedSInt64Array();
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }
            reader.EndReadMessage();
            return(result);
        }