Example #1
0
        static void ImportFolder(string xmlFolder, string evtFolder, string outFolder)
        {
            EvtBinaryConverter converter = new EvtBinaryConverter();

            foreach (var file in Directory.GetFiles(xmlFolder, "*.xml"))
            {
                string filename = Path.GetFileNameWithoutExtension(file);

                // Validate that there is an original EVT file per XML
                string evtFile = Path.Combine(evtFolder, filename + ".evt");
                if (!File.Exists(evtFile))
                {
                    continue;
                }

                // Read the EVT to get the subfiles / java classes
                Node evt = NodeFactory.FromFile(evtFile);
                evt.Transform <NodeContainerFormat>(true, converter);
                PrintTree(evt, 0);

                // Import the java classes from the xml
                XDocument xml = XDocument.Load(file, LoadOptions.PreserveWhitespace);
                ImportEvtChildrenFromXml(evt, xml);

                // Write the evt back
                string outFile = Path.Combine(outFolder, filename + ".evt");
                evt.Transform <BinaryFormat>(true, converter);
                evt.GetFormatAs <BinaryFormat>().Stream.WriteTo(outFile);
            }
        }
Example #2
0
        static void ExportFolder(string folder, string output, bool saveClasses)
        {
            EvtBinaryConverter converter = new EvtBinaryConverter();

            foreach (var file in Directory.GetFiles(folder, "*.evt"))
            {
                Node node = NodeFactory.FromFile(file);
                node.Transform <NodeContainerFormat>(true, converter);

                PrintTree(node, 0);

                if (saveClasses)
                {
                    SaveTreeIntoFiles(node, output);
                }

                string outPath = Path.Combine(output, node.Name.Replace(".evt", ".xml"));
                ExportEvtChildrenIntoXml(node).Save(outPath);
            }
        }