protected virtual void LoadMetadata() { if (m_uri == null) { return; } try { using (var ps = WinShell.PropertyStore.Open(m_uri.LocalPath, false)) { // See if timezone and precision info are included int precision = 0; TimeZoneTag tz = null; foreach (var pair in MetaTag.Extract(ps.GetValue(s_pkComment) as string)) { if (pair.Key.Equals("datePrecision", StringComparison.OrdinalIgnoreCase)) { if (!int.TryParse(pair.Value, out precision)) { precision = 0; } } if (pair.Key.Equals("timezone", StringComparison.OrdinalIgnoreCase)) { if (!TimeZoneTag.TryParse(pair.Value, out tz)) { tz = null; } } } // Get the date the photo or video was taken. { object date = ps.GetValue(s_pkDateTaken); if (date == null) { date = ps.GetValue(s_pkDateEncoded); } if (date != null && date is DateTime) { var dt = new DateTag((DateTime)date, tz, precision); dt = dt.ResolveTimeZone(TimeZoneInfo.Local); var ci = CultureInfo.CurrentCulture; // Use my preferred format if US English string format = ci.Name.Equals(c_usCultureName, StringComparison.Ordinal) ? c_usOverrideDateFormat : ci.DateTimeFormat.FullDateTimePattern; m_dateTaken = dt.ToString(format, ci); } } var tags = new List <string>(); // Get title string title = ps.GetValue(s_pkTitle) as string; if (!string.IsNullOrEmpty(title)) { tags.Add(title); } // Get keywords var keywords = ps.GetValue(s_pkKeywords) as IEnumerable <string>; if (keywords != null) { tags.AddRange(keywords); } if (tags.Count > 0) { Tags = tags; } } } catch (Exception err) { Debug.WriteLine(err.ToString()); } }