public static FolderDescriptor ToFolderDescriptor(this string str) { List<string> parts = str.Split('_').ToList(); FolderDescriptor returnFolderDescriptor = new FolderDescriptor(); int idx = 0; while (idx < parts.Count) { parts[idx] = parts[idx].Replace('!', ' '); idx++; } returnFolderDescriptor.Date = parts.GetKeyValue(0); returnFolderDescriptor.FullName = parts.GetKeyValue(1); List<string> locationParts = parts.GetKeyValue(2).Split(' ').ToList(); returnFolderDescriptor.Location = locationParts.GetKeyValue(0); returnFolderDescriptor.LocationCounty = locationParts.GetKeyValue(1); returnFolderDescriptor.Type = parts.GetKeyValue(3); returnFolderDescriptor.MiscInner = parts.GetKeyValue(4); returnFolderDescriptor.MiscOuter = parts.GetKeyValue(5); return returnFolderDescriptor; }
public static string MakeSourceRef(FolderDescriptor fdesc, string misc) { List<string> nameParts = fdesc.FullName.Split(' ').ToList(); string sourceRef = ""; switch (fdesc.Type.ToLower()) { case "will": sourceRef = fdesc.Date + nameParts.GetKeyValue(0) + nameParts.GetKeyValue(1) + "Will"; break; case "deed": sourceRef = fdesc.Date + nameParts.GetKeyValue(0) + nameParts.GetKeyValue(1) + "Deed"; break; case "bond": sourceRef = fdesc.Date + nameParts.GetKeyValue(1) + nameParts.GetKeyValue(3) + "Bond"; break; default: sourceRef = fdesc.Date + nameParts.GetKeyValue(0) + nameParts.GetKeyValue(1) + "Misc" + misc; break; } return sourceRef; }