virtual public TimeZoneObservance?GetObservance(IDateTime dt) { if (Parent == null) { throw new Exception("Cannot call GetObservance() on a TimeZoneInfo whose Parent property is null."); } // Normalize date/time values within this time zone to a UTC value. DateTime normalizedDt = dt.Value; if (string.Equals(dt.TZID, TZID)) { dt = new iCalDateTime(OffsetTo.ToUTC(dt.Value)); normalizedDt = OffsetTo.ToUTC(normalizedDt); } // Let's evaluate our time zone observances to find the // observance that applies to this date/time value. IEvaluator parentEval = Parent.GetService(typeof(IEvaluator)) as IEvaluator; if (parentEval != null) { // Evaluate the date/time in question. parentEval.Evaluate(Start, DateUtil.GetSimpleDateTimeData(Start), normalizedDt, true); foreach (IPeriod period in m_Evaluator.Periods) { if (period.Contains(dt)) { return(new TimeZoneObservance(period, this)); } } } return(null); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode( ) { int hash = 13; if (TimeZoneName != null) { hash = (hash * 7) + TimeZoneName.GetHashCode( ); } if (OffsetFrom != null) { hash = (hash * 7) + OffsetFrom.GetHashCode( ); } if (OffsetTo != null) { hash = (hash * 7) + OffsetTo.GetHashCode( ); } return(hash); }
private void WriteRelocationTable(ref OffsetTo <byte[]> relocationTable) { mWriter.SeekBegin(mPositionBase + relocationTable.Offset); mWriter.Write(relocationTable.Value); }