示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }