Example #1
0
        private void SaveData(string path)
        {

            XRefMap xref = Microsoft.DocAsCode.Common.YamlUtility.Deserialize<XRefMap>(path);
            foreach (var spec in xref.References)
            {
                uidt t = new uidt();
                t.uid = spec["uid"];
                t.objectStr = Newtonsoft.Json.JsonConvert.SerializeObject(spec);
                db.uidts.Add(t);
                db.SaveChanges();
            }
        }
Example #2
0
        static XRefMap BuildXRefMap(ModuleDefinition module, string baseUrl)
        {
            var map = new XRefMap
            {
                BaseUrl    = baseUrl,
                References = module.Types
                             .Select(CreateXRefSpec)
                             .Where(spec => spec != null)
                             .ToList()
            };

            return(map);
        }
Example #3
0
        private int SaveData(TextReader reader)
        {
            XRefMap xrefMap = YamlUtility.Deserialize <XRefMap>(reader);

            foreach (var spec in xrefMap.References)
            {
                XRefSpecObject xrefSpec = new XRefSpecObject();
                xrefSpec.Uid          = spec["uid"];
                xrefSpec.HashedUid    = MD5Encryption.CalculateMD5Hash(xrefSpec.Uid);
                xrefSpec.XRefSpecJson = JsonUtility.Serialize(spec);
                _db.XRefSpecObjects.Add(xrefSpec);
            }
            _db.SaveChanges();
            return(0);
        }
Example #4
0
        private static void Execute(string inputAssemblyPath, Uri baseUrl, FileInfo outputYamlPath)
        {
            ExtractMetadataOptions      options    = new ExtractMetadataOptions();
            AssemblyFileInputParameters parameters = new AssemblyFileInputParameters(options, inputAssemblyPath);

            string[]    assemblyPaths = Enumerable.Repeat(inputAssemblyPath, 1).ToArray();
            Compilation compilation   = CreateCompilationFromAssembly(assemblyPaths);

            (_, IAssemblySymbol assembly) = GetAssemblyFromAssemblyComplation(compilation, assemblyPaths).First();
            RoslynSourceFileBuildController controller = new RoslynSourceFileBuildController(compilation, assembly);
            MetadataItem         metadata      = controller.ExtractMetadata(parameters);
            Queue <MetadataItem> metadataItems = new Queue <MetadataItem>();

            metadataItems.Enqueue(metadata);
            XRefMap refMap = new XRefMap
            {
                BaseUrl    = baseUrl.AbsoluteUri,
                References = new List <XRefSpec>()
            };

            while (metadataItems.Count > 0)
            {
                MetadataItem item = metadataItems.Dequeue();
                foreach (MetadataItem metadataItem in item.Items ?? Enumerable.Empty <MetadataItem>())
                {
                    metadataItems.Enqueue(metadataItem);
                }

                switch (item.Type)
                {
                case MemberType.Assembly:
                case MemberType.AttachedEvent:
                case MemberType.AttachedProperty:
                case MemberType.Toc:
                    continue;
                }

                refMap.References.Add(new XRefSpec
                {
                    Uid       = item.Name,
                    Name      = item.DisplayNames.GetLanguageProperty(SyntaxLanguage.Default, null),
                    Href      = SandcastleHelper.GetFileName(item.CommentId) + ".htm",
                    CommentId = item.CommentId
                });
            }
            refMap.Sort();
            YamlUtility.Serialize(outputYamlPath.FullName, refMap);
        }
Example #5
0
        public static XRefMap GetXrefMap(string path)
        {
            XRefMap xref = YamlUtility.Deserialize <XRefMap>(path);

            return(xref);
        }