public static bool ExistsGroup(string from, string name) { if (LocaleSystem.ValidateGroupName(name)) { FileInfo fi = new FileInfo(LocaleSystem.GetDirectoryString(from) + name + ".tsv"); return(fi.Exists); } return(false); }
public static void DeleteGroup(string from, string name) { if (LocaleSystem.ValidateGroupName(name)) { FileInfo fi = new FileInfo(LocaleSystem.GetDirectoryString(from) + name + ".tsv"); if (fi.Exists) { fi.Delete(); } } }
public static void CreateGroup(string from, string name) { if (LocaleSystem.ValidateGroupName(name)) { DirectoryInfo dir = LocaleSystem.GetDirectory(from); if (!dir.Exists) { dir.Create(); } FileInfo fi = new FileInfo(LocaleSystem.GetDirectoryString(from) + name + ".tsv"); if (!fi.Exists) { fi.Create().Close(); } } }
/// <summary> /// Checks and returns parts /// </summary> /// <param name="text">text to parse</param> /// <param name="groupName">returned group name</param> /// <param name="name">returned locale name</param> /// <returns>true if well-formed</returns> public bool ExtractGroupAndName(string text, out string groupName, out string name) { groupName = ""; name = ""; bool result = false; try { string[] split = text.Split('.'); if (split.Length > 1) { LocaleSystem.ValidateGroupName(split[0]); LocaleElement.ValidateName(String.Join(".", split, 1, split.Length - 1)); groupName = split[0]; name = String.Join(".", split, 1, split.Length - 1); result = true; } } catch { } return(result); }