示例#1
0
        /// <summary>
        /// Adds the given item to the solution
        /// </summary>
        /// <param name="path">New path of the item</param>
        /// <param name="item">The item to add</param>
        protected void AddItem(string path, IOnDisk item)
        {
            if (ItemExists(path))
            {
                throw new ArgumentException(Properties.Resources.Project_ItemExistsAtPath, nameof(path));
            }

            var parentDir = FixPath(Path.GetDirectoryName(path));

            if (!string.IsNullOrEmpty(parentDir) && !DirectoryExists(parentDir))
            {
                CreateDirectory(parentDir);
            }

            var fixedPath = FixPath(path);

            Items.Add(fixedPath, item);
            ItemAdded?.Invoke(this, new ItemAddedEventArgs(fixedPath));
        }
示例#2
0
 public new void AddItem(string path, IOnDisk item)
 {
     base.AddItem(path, item);
 }