Пример #1
0
 public ConceptualGroup(string groupName, string groupId)
     : base(groupName, groupId)
 {
     _fileVersion     = new Version(1, 0, 0, 0);
     _projectTitle    = "ProjectTitle";
     _projectName     = "ProjectName";
     _documentId      = Guid.NewGuid();
     _projectId       = Guid.NewGuid();
     _repositoryId    = Guid.NewGuid();
     _freshnessDate   = DateTime.Today;
     _freshnessFormat = "D";
     _changeHistory   = ConceptualChangeHistory.Show;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConceptualGroup"/> class with
 /// parameters copied from the specified argument, a copy constructor.
 /// </summary>
 /// <param name="source">
 /// An instance of the <see cref="ConceptualGroup"/> class specifying the initial
 /// properties and states for this newly created instance.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// If the <paramref name="source"/> is <see langword="null"/>.
 /// </exception>
 public ConceptualGroup(ConceptualGroup source)
     : base(source)
 {
     _documentId      = source._documentId;
     _projectId       = source._projectId;
     _repositoryId    = source._repositoryId;
     _projectName     = source._projectName;
     _projectTitle    = source._projectTitle;
     _docWriter       = source._docWriter;
     _docEditor       = source._docEditor;
     _docManager      = source._docManager;
     _fileVersion     = source._fileVersion;
     _freshnessFormat = source._freshnessFormat;
     _freshnessDate   = source._freshnessDate;
     _topicSource     = source._topicSource;
     _topicContent    = source._topicContent;
     _changeHistory   = source._changeHistory;
 }
        /// <summary>
        /// This specifies the main conceptual XSL transform file and related information.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void OnTransformsItem(string keyword, XPathNavigator navigator)
        {
            string transform = _style.GetTransform(BuildEngineType.Conceptual);

            if (String.IsNullOrEmpty(transform))
            {
                throw new BuildException("A document transformer is required.");
            }

            //<transform file="%DXROOT%\Presentation\Vs2005\transforms\main_conceptual.xsl">
            //<argument key="metadata" value="true" />
            //<argument key="languages">
            //    <language label="VisualBasic" name="VisualBasic" style="vb" />
            //    <language label="CSharp" name="CSharp" style="cs" />
            //    <language label="ManagedCPlusPlus" name="ManagedCPlusPlus" style="cpp" />
            //    <language label="JSharp" name="JSharp" style="cs" />
            //    <language label="JScript" name="JScript" style="cs" />
            //</argument>
            //<argument key="RTMReleaseDate" value="June 2007" />
            //</transform>
            XmlWriter xmlWriter = navigator.InsertAfter();

            // For now, lets simply write the default...
            xmlWriter.WriteStartElement("transform");   // start - transform
            xmlWriter.WriteAttributeString("file", transform);

            xmlWriter.WriteStartElement("argument");    // start - argument/metadata
            xmlWriter.WriteAttributeString("key", "metadata");
            xmlWriter.WriteAttributeString("value", "true");
            xmlWriter.WriteEndElement();                // end - argument/metadata

            xmlWriter.WriteStartElement("argument");    // start - argument/languages
            xmlWriter.WriteAttributeString("key", "languages");

            WriteSyntaxTypes(xmlWriter, false);

            xmlWriter.WriteEndElement();                // end - argument/languages

            if (_settings.ShowUpdatedDate)
            {
                xmlWriter.WriteStartElement("argument");    // start - argument/RTMReleaseDate
                xmlWriter.WriteAttributeString("key", "RTMReleaseDate");
                xmlWriter.WriteAttributeString("value", DateTime.Now.ToString());
                xmlWriter.WriteEndElement();                // end - argument/RTMReleaseDate
            }

            //You can use the optional changeHistoryOptions argument to control display of freshness date and Change History sections.
            //If value='showDefaultFreshnessDate', all topics have a freshness date; default date is from 'defaultFreshnessDate' shared content item.
            //if value='omit', freshness date and Change History sections are omitted from all topics.
            //<argument key="changeHistoryOptions" value="omit" />
            ConceptualChangeHistory changeHistory = _group.ChangeHistory;

            switch (changeHistory)
            {
            case ConceptualChangeHistory.Show:
                // do nothing, this is the default.
                break;

            case ConceptualChangeHistory.Hide:
                xmlWriter.WriteStartElement("argument");     // start - argument/changeHistoryOptions
                xmlWriter.WriteAttributeString("key", "changeHistoryOptions");
                xmlWriter.WriteAttributeString("value", "omit");
                xmlWriter.WriteEndElement();             // end - argument/changeHistoryOptions
                break;

            case ConceptualChangeHistory.ShowFreshnessDate:
                xmlWriter.WriteStartElement("argument");     // start - argument/changeHistoryOptions
                xmlWriter.WriteAttributeString("key", "changeHistoryOptions");
                xmlWriter.WriteAttributeString("value", "showDefaultFreshnessDate");
                xmlWriter.WriteEndElement();             // end - argument/changeHistoryOptions
                break;
            }

            xmlWriter.WriteEndElement();                // end - transform

            xmlWriter.Close();
            navigator.DeleteSelf();
        }
Пример #4
0
        protected override void OnReadPropertyGroupXml(XmlReader reader)
        {
            string startElement = reader.Name;

            Debug.Assert(String.Equals(startElement, "propertyGroup"));
            Debug.Assert(String.Equals(reader.GetAttribute("name"), "Conceptual"));

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "property", StringComparison.OrdinalIgnoreCase))
                    {
                        string tempText = null;
                        switch (reader.GetAttribute("name").ToLower())
                        {
                        case "documentid":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _documentId = new Guid(tempText);
                            }
                            break;

                        case "projectid":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _projectId = new Guid(tempText);
                            }
                            break;

                        case "repositoryid":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _repositoryId = new Guid(tempText);
                            }
                            break;

                        case "projectname":
                            _projectName = reader.ReadString();
                            break;

                        case "projecttitle":
                            _projectTitle = reader.ReadString();
                            break;

                        case "documentwriter":
                            _docWriter = reader.ReadString();
                            break;

                        case "documenteditor":
                            _docEditor = reader.ReadString();
                            break;

                        case "documentmanager":
                            _docManager = reader.ReadString();
                            break;

                        case "fileversion":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _fileVersion = new Version(tempText);
                            }
                            break;

                        case "freshnessformat":
                            _freshnessFormat = reader.ReadString();
                            break;

                        case "freshnessdate":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _freshnessDate = DateTime.Parse(tempText);
                            }
                            break;

                        case "changehistory":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _changeHistory = (ConceptualChangeHistory)Enum.Parse(
                                    typeof(ConceptualChangeHistory), tempText, true);
                            }
                            break;

                        default:
                            // Should normally not reach here...
                            throw new NotImplementedException(reader.GetAttribute("name"));
                        }
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, startElement, StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }