Esempio n. 1
0
        public String renderFileFromIndex(TreeIndex index)
        {
            switch (index.type)
            {
            case IndexTypes.Page: {
                String content = File.ReadAllText(index.path);
                content = parseLinks(content, index);
                String result = CommonMark.CommonMarkConverter.Convert(content);
                return(result);
            }

            case IndexTypes.Module: {
                FuncParser parser = new FuncParser(index.path);
                String     result = "";
                result += CommonMark.CommonMarkConverter.Convert(parseLinks(parser.head, index));    // Add head
                String classlist = "";
                foreach (TreeIndex i in index.content)
                {
                    if (i.type == IndexTypes.Class)
                    {
                        classlist += $"- *class* [**{i.label}**]([[{i.tree_path}]]) ";
                    }
                }
                result += CommonMark.CommonMarkConverter.Convert(parseLinks(classlist, index));    // Add classes


                foreach (TreeIndex i in index.content)
                {
                    if (i.type == IndexTypes.Function)
                    {
                        result += CommonMark.CommonMarkConverter.Convert(parseLinks(parser.functions[i.label], index));
                    }
                }

                return(result);
            }

            case IndexTypes.Class: {
                FuncParser parser = new FuncParser(index.path);
                String     result = "";
                result += CommonMark.CommonMarkConverter.Convert(parseLinks(parser.head, index));    // Add head

                foreach (TreeIndex i in index.content)
                {
                    if (i.type == IndexTypes.Function)
                    {
                        result += CommonMark.CommonMarkConverter.Convert(parseLinks(parser.functions[i.label], index));
                    }
                }

                return(result);
            }

            case IndexTypes.Function: {     // This will never be called by the exporter - just for the in-app display
                FuncParser parser = new FuncParser(index.path);
                return(CommonMark.CommonMarkConverter.Convert(parseLinks(parser.functions[index.label], index)));
            }
            }
            return("");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Please pass 2 arguments: the source PDF file, and the result CSV file");
                Console.ReadLine();
                return;
            }
            var model  = Converter.Convert(args[0]);
            var result = FuncParser.Parse(model, KeyOffset, ValueOffset, DelimeterOffset).Skip(1); //skip report indo
            var models = ModelConverter.ConvertDictionaryToModels(result);

            File.WriteAllText(args[1], FormatCsv(models));
        }
Esempio n. 3
0
        public void openFile(String _filename, String _label, IndexTypes _type)
        {
            saveFile();
            setText("");
            filename = _filename;
            type     = _type;
            label    = _label;

            switch (type)
            {
            case IndexTypes.Page:
            {
                String content = File.ReadAllText(filename);
                setText(content);
                break;
            }

            case IndexTypes.Module:
            {
                parser = new FuncParser(filename);
                setText(parser.head);
                break;
            }

            case IndexTypes.Class:
            {
                parser = new FuncParser(filename);
                setText(parser.head);
                break;
            }

            case IndexTypes.Function:
            {
                parser = new FuncParser(filename);
                setText(parser.functions[label]);
                break;
            }
            }
        }
Esempio n. 4
0
        public void saveFile()
        {
            switch (type)
            {
            case IndexTypes.Page:
            {
                String content = getText();
                File.WriteAllText(filename, content);
                break;
            }

            case IndexTypes.Module:
            {
                parser      = new FuncParser(filename);
                parser.head = getText();
                parser.reSave();
                break;
            }

            case IndexTypes.Class:
            {
                parser      = new FuncParser(filename);
                parser.head = getText();
                parser.reSave();
                break;
            }

            case IndexTypes.Function:
            {
                parser = new FuncParser(filename);
                parser.functions[label] = getText();
                parser.reSave();
                break;
            }
            }
        }