예제 #1
0
        public override object Deserialize(TextReader tr)
        {
            var offsetString = tr.ReadToEnd();
            var offset       = new UtcOffset(offsetString);

            return(offset);
        }
예제 #2
0
        public void MergeFrom(DateTime other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Year != 0)
            {
                Year = other.Year;
            }
            if (other.Month != 0)
            {
                Month = other.Month;
            }
            if (other.Day != 0)
            {
                Day = other.Day;
            }
            if (other.Hours != 0)
            {
                Hours = other.Hours;
            }
            if (other.Minutes != 0)
            {
                Minutes = other.Minutes;
            }
            if (other.Seconds != 0)
            {
                Seconds = other.Seconds;
            }
            if (other.Nanos != 0)
            {
                Nanos = other.Nanos;
            }
            switch (other.TimeOffsetCase)
            {
            case TimeOffsetOneofCase.UtcOffset:
                if (UtcOffset == null)
                {
                    UtcOffset = new global::Google.Protobuf.WellKnownTypes.Duration();
                }
                UtcOffset.MergeFrom(other.UtcOffset);
                break;

            case TimeOffsetOneofCase.TimeZone:
                if (TimeZone == null)
                {
                    TimeZone = new global::Google.Type.TimeZone();
                }
                TimeZone.MergeFrom(other.TimeZone);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
예제 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Year != 0)
            {
                hash ^= Year.GetHashCode();
            }
            if (Month != 0)
            {
                hash ^= Month.GetHashCode();
            }
            if (Day != 0)
            {
                hash ^= Day.GetHashCode();
            }
            if (Hours != 0)
            {
                hash ^= Hours.GetHashCode();
            }
            if (Minutes != 0)
            {
                hash ^= Minutes.GetHashCode();
            }
            if (Seconds != 0)
            {
                hash ^= Seconds.GetHashCode();
            }
            if (Nanos != 0)
            {
                hash ^= Nanos.GetHashCode();
            }
            if (timeOffsetCase_ == TimeOffsetOneofCase.UtcOffset)
            {
                hash ^= UtcOffset.GetHashCode();
            }
            if (timeOffsetCase_ == TimeOffsetOneofCase.TimeZone)
            {
                hash ^= TimeZone.GetHashCode();
            }
            hash ^= (int)timeOffsetCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #4
0
 public override string ToString()
 {
     return(Name +
            (HasUtcOffset ? " UTC" + UtcOffset.ToString("+#;-#") : "") +
            (HasLatLongCoordinates ? " " + Latitude + ";" + Longitude : ""));
 }
예제 #5
0
 public override int GetHashCode()
 {
     return(Year ^ (Month << 28) ^ (Day << 22) ^ (Hour << 14) ^ (Minute << 8) ^ (Second << 6) ^ UtcOffset.GetHashCode());
 }