// 書き出す
        public void WriteToBuf(Buf b, ValueType type)
        {
            switch (type)
            {
            case ValueType.Int:
                b.WriteInt(IntValue);
                break;

            case ValueType.Int64:
                b.WriteInt64(Int64Value);
                break;

            case ValueType.Data:
                b.WriteInt((uint)Data.Length);
                b.Write(Data);
                break;

            case ValueType.Str:
                b.WriteStr(StrValue.Trim());
                break;

            case ValueType.UniStr:
                byte[] data = Str.Utf8Encoding.GetBytes(StrValue.Trim());
                b.WriteInt((uint)data.Length + 1);
                b.Write(data);
                b.WriteByte(0);
                break;
            }
        }
        public Buf SaveToBuf()
        {
            Buf b = new Buf();

            b.WriteInt64((ulong)this.TimeStamp.Ticks);
            b.WriteInt((uint)this.EntryList.Count);

            foreach (FullRouteIPInfoEntry e in this.EntryList)
            {
                b.WriteInt(e.From);
                b.WriteInt(e.To);
                b.WriteStr(e.Registry);
                b.WriteInt(e.Assigned);
                b.WriteStr(e.Country2);
                b.WriteStr(e.Country3);
                b.WriteStr(e.CountryFull);
            }

            b.Write(Secure.HashSHA1(b.ByteData));

            b.SeekToBegin();

            return(b);
        }