コード例 #1
0
        bool ReadYamlManifest(WorkbookDocument document)
        {
            var manifestCell = document.FirstCell as YamlMetadataCell;

            if (manifestCell == null)
            {
                return(false);
            }

            Read(new StringReader(manifestCell.Buffer.Value));

            document.RemoveCell(manifestCell);

            return(true);
        }
コード例 #2
0
        bool ReadLegacyJsonManifest(WorkbookDocument document)
        {
            var manifestCell = document.FirstCell as CodeCell;

            if (manifestCell?.LanguageName != "json")
            {
                return(false);
            }

            ReadProperties(LegacyJsonWorkbookDocumentManifest.Read(manifestCell.Buffer.Value));

            document.RemoveCell(manifestCell);

            return(true);
        }
コード例 #3
0
        public void Read(WorkbookDocument document)
        {
            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            try {
                if (ReadYamlManifest(document) || ReadLegacyJsonManifest(document))
                {
                    return;
                }
            } catch (Exception e) when(!(e is InvalidManifestException))
            {
                throw new InvalidManifestException(e);
            }

            throw new InvalidManifestException();
        }
コード例 #4
0
        public WorkbookPage(WorkbookPackage workbook, params AgentType [] platformTargets)
        {
            if (workbook == null)
            {
                throw new ArgumentNullException(nameof(workbook));
            }

            Workbook = workbook;
            Manifest.PlatformTargets = platformTargets.ToImmutableArray();
            Contents = new WorkbookDocument();

            TableOfContents = new TableOfContentsNode();

            TreeNode = new WorkbookTitledNode(this)
            {
                FileName     = ".workbook",
                Children     = TableOfContents.Children,
                IsSelectable = true
            };
        }