private void LoadDateContentsDateTime() { if (!Directory.Exists(Properties.Settings.Default.EntryPath)) { throw new DirectoryNotFoundException(); } contentsList.Clear(); var pathList = Directory.GetFiles(Properties.Settings.Default.EntryPath, "*.doentry"); foreach (var path in pathList) { Dictionary <string, object> entry = Plist.readPlist(path) as Dictionary <string, object>; var created = (DateTime)entry["Creation Date"]; var createdKey = new DateTime(created.Year, created.Month, created.Day); var uuid = (string)entry["UUID"]; if (!contentsList.Keys.Contains(createdKey)) { contentsList.Add(createdKey, new List <string>() { uuid }); } else { contentsList[createdKey].Add(uuid); } } }
public static DayOneContent ReadContents(string path) { var entry = Plist.readPlist(path) as Dictionary <string, object>; return(ReadContents(entry)); }
public static void SaveDayOneContent(string path, DayOneContent content) { var entry = new Dictionary <string, object>(); entry.Add("Activity", content.Activity); entry.Add("Creation Date", content.CreationDate); var creator = new Dictionary <string, object>(); entry.Add("Creator", creator); creator.Add("Device Agent", content.DeviceAgent); creator.Add("Generation Date", content.GenerationDate); creator.Add("Host Name", content.HostName); creator.Add("OS Agent", content.OsAgent); creator.Add("Software Agent", content.SoftwareAgent); entry.Add("Entry Text", content.EntryText); entry.Add("Ignore Step Count", content.IgnoreStepCount); var location = new Dictionary <string, object>(); entry.Add("Location", location); location.Add("Administrative Area", content.AdministrativeArea); location.Add("Country", content.Country); location.Add("Latitude", content.Latitude); location.Add("Locality", content.Locality); location.Add("Longitude", content.Longitude); location.Add("Place Name", content.PlaceName); var region = new Dictionary <string, object>(); location.Add("Region", region); var center = new Dictionary <string, object>(); region.Add("Center", center); center.Add("Latitude", content.CenterLatitude); center.Add("Longitude", content.CenterLongitude); region.Add("Radius", content.Radius); entry.Add("Starred", content.Starred); entry.Add("Step Count", content.StepCount); entry.Add("Time Zone", content.TimeZone); entry.Add("UUID", content.UUID); //var weather = new Dictionary<string, object>(); //entry.Add("Weather", weather); //weather.Add("Celsius", content.Celsius); //weather.Add("Description", content.Description); //weather.Add("Fahrenheit", content.Fahrenheit); //weather.Add("IconName", content.IconName); //weather.Add("Pressure MB", content.PressureMB); //weather.Add("Relative Humidity", content.RelativeHumidity); //weather.Add("Service", content.Service); //weather.Add("Sunrise Date", content.SunriseDate); //weather.Add("Sunset Date", content.SunsetDate); //weather.Add("Visibility KM", content.VisibilityKM); //weather.Add("Wind Bearing", content.WindBearing); //weather.Add("Wind Chill Celsius", content.WindChillCelsius); //weather.Add("Wind Speed KPH", content.WindSpeedKPH); Plist.writeXml(entry, path); }
public static DayOneContent ReadContents(byte[] data) { var entry = Plist.readPlist(data) as Dictionary <string, object>; return(ReadContents(entry)); }