public void DeleteDocument(string parentSubPath, ProjectItemType type, string documentName)
        {
            var fileName = "";

            if (type == ProjectItemType.Page)
            {
                fileName = $"{documentName}.{Constants.ProjectItemFileExtensions.Page}";
            }
            if (type == ProjectItemType.Workflow)
            {
                fileName = $"{documentName}.{Constants.ProjectItemFileExtensions.Workflow}";
            }
            var filePath = Path.Combine(Path.GetDirectoryName(_projectFilePath), parentSubPath, fileName);

            if (!File.Exists(filePath))
            {
                throw new ArgumentException($"A {type.ToString()} named '{fileName}' does not exist in this directory and cannot be deleted!");
            }

            _cmdProcessor.Execute(DeleteDocumentCommand.Create(_outputService, _projectFilePath, parentSubPath, fileName));

            ProjectItemChanged?.Invoke(new ProjectItemChangedArgs
            {
                ItemType      = type,
                Change        = ProjectItemChange.Delete,
                ItemName      = documentName,
                ParentSubPath = parentSubPath
            });
        }
示例#2
0
        /// <summary>
        /// Builds properties collection for configuration file.
        /// </summary>
        private static Dictionary <string, string> BuildConfigProperties(
            ProjectItemType type,
            CopyToOutputDirectory copyToOutput)
        {
            Dictionary <string, string> properties = new Dictionary <string, string>();

            properties["BuildAction"]  = type.ToString();
            properties["CopyToOutput"] = copyToOutput.ToString();
            return(properties);
        }
示例#3
0
        public override string ToString( )
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Name: " + _name);
            sb.AppendLine("Uid: " + _uid.ToString());
            sb.AppendLine("Type: " + _itemType.ToString());
            sb.AppendLine("DbType: " + _dbObjectType.ToString());
            sb.AppendLine("IsConnected: " + _isConnectedItem.ToString());
            sb.AppendLine("ParentFolder: " + _parentFolder);
            sb.AppendLine("RelativeFolder: " + _relativeFolder);
            sb.AppendLine("Extension: " + _extension.ToString());
            if (_connectionSpec != null)
            {
                sb.AppendLine("Connection: " + _connectionSpec.Server + "@" + _connectionSpec.Database + " as " + _connectionSpec.CurrentUsername);
            }
            return(sb.ToString());
        }
示例#4
0
        public override string ToString( )
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("ItemType:" + ItemType.ToString());
            sb.AppendLine("IsPopulated:" + IsPopulated.ToString());
            if (Item != null)
            {
                sb.AppendLine("Item:");
                sb.AppendLine(Item.ToString());
            }

            if (Project != null)
            {
                sb.AppendLine("Project:");
                sb.AppendLine(Project.ToString());
            }

            return(sb.ToString());
        }
示例#5
0
		/// <summary>
		/// Builds properties collection for configuration file.
		/// </summary>
		private static Dictionary<string, string> BuildConfigProperties(
			ProjectItemType type,
			CopyToOutputDirectory copyToOutput)
		{
			Dictionary<string, string> properties = new Dictionary<string, string>();
			properties["BuildAction"] = type.ToString();
			properties["CopyToOutput"] = copyToOutput.ToString();
			return properties;
		}