/// <summary> /// Création d'une définition d'un thème natal /// </summary> public NatalChartDefinition() { BirthDate = new DateDefinition(); HouseSystem = Astro.HouseSystem.Placidus; Planets = new List <Planet>(); SetDefaultPlanets(); }
/// <summary> /// Conversion d'une DateDefinition en date Julien /// </summary> public static JulianDay ToJulianDay(this IEphemerisProvider provider, DateDefinition date, DateCalendar calendar = DateCalendar.Gregorian) { if (provider == null) { throw new ArgumentNullException("provider"); } if (date == null) { throw new ArgumentNullException("date"); } return(provider.ToJulianDay(date.ToDateTimeOffset(), calendar)); }
void Deserialize(DateDefinition date, XmlReader reader) { while (reader.Read()) { while (reader.IsStartElement()) { try { switch (reader.Name) { case "date": var matchD = Regex.Match(reader.ReadElementContentAsString(), @"(?<y>\d{4})-(?<m>\d{1,2})-(?<d>\d{1,2})"); if (matchD.Success) { date.Year = int.Parse(matchD.Groups["y"].Value); date.Month = int.Parse(matchD.Groups["m"].Value); date.Day = int.Parse(matchD.Groups["d"].Value); } break; case "time": var matchT = Regex.Match(reader.ReadElementContentAsString(), @"(?<h>\d{1,2}):(?<m>\d{1,2})(:(?<s>\d{1,2}))?(\.(?<l>\d{1,4}))?"); if (matchT.Success) { date.Hour = int.Parse(matchT.Groups["h"].Value); date.Minute = int.Parse(matchT.Groups["m"].Value); date.Second = String.IsNullOrWhiteSpace(matchT.Groups["s"].Value) ? 0 : int.Parse(matchT.Groups["s"].Value); date.MilliSecond = String.IsNullOrWhiteSpace(matchT.Groups["l"].Value) ? 0 : int.Parse(matchT.Groups["l"].Value); } break; case "timezone": String content = reader.ReadElementContentAsString(); if (!String.IsNullOrWhiteSpace(content) && TimeZoneProvider != null) { date.TimeZone = TimeZoneProvider.FindTimeZone(content); } break; case "utc-offset": if (date.TimeZone == null) { date.UtcOffset = TimeSpan.FromHours(Double.Parse(reader.ReadElementContentAsString(), System.Globalization.CultureInfo.InvariantCulture)); } else { reader.Read(); } break; case "daylight": DayLightDefinition dld; if (Enum.TryParse <DayLightDefinition>(reader.ReadElementContentAsString(), true, out dld)) { date.DayLight = dld; } break; default: reader.Read(); break; } } catch { reader.Read(); throw; } } } }