Example #1
0
        public void ExportFiles(string path)
        {
            //export TOC
            string fileName = Path.Combine(path, "toc.yml");

            YamlHelper.ExportDocument(fileName, "TableOfContent", this.TOCStructure);

            //build group pages
            BuildGroupPages();

            //export group pages
            YamlHelper.ExportDocument(Path.Combine(path, this.ProjectUid + ".yml"), "ClassicDynamicsNavReference", this.ProjectPage);

            foreach (PageViewModel objTypePage in this.ObjectTypePages)
            {
                YamlHelper.ExportDocument(Path.Combine(path, objTypePage.Items[0].Uid + ".yml"), "ClassicDynamicsNavReference", objTypePage);
            }
        }
Example #2
0
        protected void ExportObjectDocumentation(string destFolderName, ApplicationObject appObject)
        {
            IElement rootElement = appObject.RootElement;
            IEnumerable <IElement> codeElementList = rootElement.GetSubElements(ElementType.Procedure);

            string objectName = rootElement.GetStringProperty(PropertyType.Name);
            string objectType = appObject.ElementTypeInfo.Name;
            int    objectId   = rootElement.Id;

            PageViewModel doc = new PageViewModel();

            doc.Items = new List <ItemViewModel>();

            ItemViewModel obj = new ItemViewModel();

            obj.Id       = objectType + objectId.ToString();
            obj.Uid      = UidHelpers.GetObjectUid(this.ProjectUid, objectType, obj.Id);
            obj.Name     = objectName;
            obj.Type     = objectType;
            obj.ObjectId = objectId;
            obj.ItemType = ItemType.Object;
            doc.Items.Add(obj);

            //write object documentation


            //write table fields and keys
            if (objectType == "Table")
            {
                obj.Fields = new List <FieldViewModel>();
                IEnumerable <IElement> fieldList = rootElement.GetSubElements(ElementType.Field);
                foreach (IElement fieldElement in fieldList)
                {
                    AddFieldDocumentation(doc, obj, fieldElement);
                }

                obj.Keys = new List <KeyViewModel>();
                IEnumerable <IElement> keyList = rootElement.GetSubElements(ElementType.Key);
                bool primaryKey = true;
                foreach (IElement keyElement in keyList)
                {
                    AddKeyDocumentation(doc, obj, keyElement, primaryKey);
                    primaryKey = false;
                }
            }

            if (objectType == "Page")
            {
                string sourceTable = rootElement.GetStringProperty(PropertyType.SourceTable);
                if (!String.IsNullOrWhiteSpace(sourceTable))
                {
                    sourceTable       = sourceTable.Replace("Table", "");
                    obj.SourceTableId = sourceTable;

                    ObjectLinkCache sourceTableLink = GetDataTypeLink("Table", sourceTable);
                    if (sourceTableLink != null)
                    {
                        obj.SourceTableName = sourceTableLink.Name;
                        obj.SourceTableUid  = sourceTableLink.Uid;
                    }
                    ;

                    if (String.IsNullOrEmpty(obj.SourceTableName))
                    {
                        obj.SourceTableName = "Table " + sourceTable;
                    }
                }


                obj.Fields = new List <FieldViewModel>();
                IEnumerable <IElement> fieldList = rootElement.GetSubElements(ElementType.Control);
                foreach (IElement fieldElement in fieldList)
                {
                    AddPageFieldDocumentation(doc, obj, fieldElement);
                }
            }

            //write procedures
            foreach (IElement element in codeElementList)
            {
                AddProcedureDocumentation(doc, obj, element);
            }

            //export document
            YamlHelper.ExportDocument(Path.Combine(destFolderName, obj.Uid + ".yml"), "ClassicDynamicsNavReference", doc);

            //add object to TOC
            TOCBuilder.AddObject(obj);
        }