private static void LoadSystemProperties(MetadataSystemInformationUnit system, metsTypeMetsHdrAgent metsSystemAgent) { if (metsSystemAgent.name != null && LooksLikeSystemName(metsSystemAgent.name)) { system.Name = metsSystemAgent.name; } string type = metsSystemAgent.note?.FirstOrDefault(LooksLikeSystemType); if (type != null) { system.Type = type; } // Find first occurance of a version number defined before Type. That's probably the version ... string version = metsSystemAgent.note?.TakeWhile(n => !n.Equals(type)) .FirstOrDefault(LooksLikeSystemVersion); if (version != null) { system.Version = version; } // Find first occurance of a version number defined after Type. That's probably the type-version ... string typeVersion = metsSystemAgent.note?.SkipWhile(n => !n.Equals(type)).FirstOrDefault(LooksLikeSystemTypeVersion); if (typeVersion != null && MetsTranslationHelper.IsSystemTypeNoark5(system.Type)) { system.TypeVersion = typeVersion; } }
private static string[] GetSystemPropertiesNotes(MetadataSystemInformationUnit system) { var notes = new List <string>(); if (!string.IsNullOrEmpty(system.Version)) { notes.Add(system.Version); } if (!string.IsNullOrEmpty(system.Type) && MetsTranslationHelper.IsValidSystemType(system.Type)) { notes.Add(system.Type); } if (!string.IsNullOrEmpty(system.TypeVersion) && MetsTranslationHelper.IsSystemTypeNoark5(system.Type)) { notes.Add(system.TypeVersion); } return(notes.Any() ? notes.ToArray() : null); }
private static bool LooksLikeSystemType(string possibleSystemType) { return(MetsTranslationHelper.IsValidSystemType(possibleSystemType)); }