public void Add(IList <string> path, GroupSettingsItem item) { string fullCurrentPath = String.Empty; GroupSettingsContainer itemDirectory = FindItemDirectory(path); if (NameScan(itemDirectory, item.Name, item.Type)) { throw new ArgumentException("Element has already been"); } itemDirectory.Items.Add(item); SaveGroupTree(); }
public void Delete(IList <string> path, string name, GroupTreeTypeEnum type) { string fullCurrentPath = String.Empty; GroupSettingsContainer itemDirectory = FindItemDirectory(path); GroupSettingsItem itemForDelete = itemDirectory.Items.FirstOrDefault(it => it.Name == name && it.Type == type); if (itemForDelete == null) { throw new DirectoryNotFoundException(); } itemDirectory.Items.Remove(itemForDelete); SaveGroupTree(); }
public void Rename(IList <string> path, string oldName, GroupTreeTypeEnum type, string newName) { string fullCurrentPath = String.Empty; GroupSettingsContainer itemDirectory = FindItemDirectory(path); GroupSettingsItem itemForRename = itemDirectory.Items.FirstOrDefault(it => it.Name == oldName && it.Type == type); if (itemForRename == null) { throw new DirectoryNotFoundException(); } if (NameScan(itemDirectory, newName, type)) { throw new ArgumentException("Element has already been"); } itemForRename.Name = newName; SaveGroupTree(); }
public void Copy(IList <string> path, string name, GroupTreeTypeEnum type, IList <string> otherPath) { string fullCurrentPath = String.Empty; GroupSettingsContainer itemDirectoryFrom = FindItemDirectory(path); GroupSettingsContainer itemDirectoryTo = FindItemDirectory(otherPath); GroupSettingsItem itemForCopy = itemDirectoryFrom.Items.FirstOrDefault(it => it.Name == name && it.Type == type); if (itemForCopy == null) { throw new DirectoryNotFoundException(); } if (NameScan(itemDirectoryTo, itemForCopy.Name, itemForCopy.Type)) { throw new ArgumentException("Element has already been"); } itemDirectoryTo.Items.Add(itemForCopy); SaveGroupTree(); }