Example #1
0
        private static string GetRelativeTime(ItemInfo item)
        {
            try
            {
                DateTime time;

                try
                {
                    time = XmlConvert.ToDateTime(item.Modified,
                        XmlDateTimeSerializationMode.RoundtripKind);
                }
                catch (FormatException)
                {
                    time = DateTime.ParseExact(item.Modified,
                        "ddd, dd MMM yyyy HH:mm:ss 'GMT'",
                        CultureInfo.InvariantCulture);
                }

                return time.ToRelative();
            }
            catch
            {
                return item.Modified;
            }
        }
Example #2
0
 private static string GetTitle(ItemInfo item)
 {
     try
     {
         return System.IO.Path
             .GetFileName(item.Path);
     }
     catch (ArgumentException)
     {
         return item.Path;
     }
 }
Example #3
0
        public MetaListItemInfo(string basePath, ItemInfo item)
        {
            if (basePath == null) throw new ArgumentNullException("basePath");
            if (item == null) throw new ArgumentNullException("item");

            _item = item;
            _path = new Uri(new Uri(basePath),
                item.Path).ToString();

            Title = GetTitle(item);
            Notes = GetRelativeTime(item);
            Icon = ThemeData.GetImage(item.IsDir
                ? "folder" : "entry");
        }