/// <summary> /// Überprüft, ob der Name ein valider Dateiname ist. /// </summary> public static bool IsValidFilename(string filename) { if (filename == "" || !filename.ToLower().EndsWith(".pdf")) { return(false); } NamePattern namePattern = Factory.GetNamePattern(); if (!namePattern.IsNormalizedInstrument(filename)) { return(false); } filename = filename.Split('\\').Last(); filename = filename.Substring(0, filename.Length - 4); string[] result = filename.Split('#'); if (result.Length == 3) { try { Convert.ToInt32(result[2]); return(true); } catch { return(false); } } if (result.Length <= 3) { return(true); } return(false); }
/// <summary> /// Speichert das NamePattern Objekt. /// </summary> /// <param name="namePattern">NamePattern Instanz</param> public static void NamePattern(NamePattern namePattern) { Store(ConfigObj.NamePatternPath, namePattern); }
public NameNormalizer() { config = Config.GetInstance(); namePattern = Factory.GetNamePattern(); }