internal static EntryInfoBase Parse(string info, string parentPath) { EntryInfoBase entry = null; //parse line Match match = EntryInfoBase.GetMatch(info); if (match == null)//failed { throw new ArgumentException(string.Format("Parsing error:{0}", info)); } else { //Parsing attribute string name = match.Groups["name"].Value; string permission = match.Groups["permission"].Value; //Parsing time DateTime time; try { time = DateTime.Parse(match.Groups["timestamp"].Value); } catch (Exception) { time = new DateTime(); } //Check is file or directory string dir = match.Groups["dir"].Value; if (!string.IsNullOrEmpty(dir) && dir != "-") { entry = new DirectoryEntryInfo(name, time, permission, parentPath); } else { long size = 0; try { size = Convert.ToInt64(match.Groups["size"].Value); } catch (Exception) { } //Parsing extension string extension = null; int i = name.LastIndexOf("."); if (i >= 0 && i < name.Length - 1) { extension = name.Substring(i + 1); } entry = new FileEntryInfo(name, time, size, extension, permission, parentPath); } } return(entry); }