Example #1
0
        public static void ExportRPY(string po, string rpy, string outfile)
        {
            // 1
            Node nodoPo = NodeFactory.FromFile(po); // Po

            nodoPo.Transform <Po2Binary, BinaryFormat, Po>();

            Node nodoOr = NodeFactory.FromFile(rpy); // BinaryFormat


            // 2
            IConverter <BinaryFormat, Rpy> TextConverter = new BinaryFormat2Rpy
            {
                PoFix = nodoPo.GetFormatAs <Po>()
            };
            Node nodoRpy = nodoOr.Transform(TextConverter);

            // 3
            IConverter <Rpy, BinaryFormat> RpyConverter = new Rpy2BinaryFormat {
            };
            Node nodoFile = nodoRpy.Transform(RpyConverter);

            //3
            nodoFile.Stream.WriteTo(outfile);
        }
Example #2
0
        private static void ImportRpyFix(Node po, Node rpy, string path)
        {
            Console.WriteLine("Importing " + po + "...");

            var outFolder = path + Path.DirectorySeparatorChar + "out";

            if (!Directory.Exists(outFolder))
            {
                Directory.CreateDirectory(outFolder);
            }

            var file = outFolder + Path.DirectorySeparatorChar + rpy.Name;

            if (File.Exists(file))
            {
                File.Delete(file);
            }

            var textConverter = new BinaryFormat2Rpy
            {
                PoFix = po.GetFormatAs <Po>()
            };

            rpy.TransformWith(textConverter).TransformWith(new Rpy2BinaryFormat());
            rpy.Stream.WriteTo(file);
        }
Example #3
0
        private static void ExportRpy(Node rpy, string path, string mapFile = "")
        {
            var rpyConverter = new BinaryFormat2Rpy();

            if (!string.IsNullOrWhiteSpace(mapFile))
            {
                rpyConverter.CharactersFile = mapFile;
            }

            rpy.TransformWith(rpyConverter).TransformWith(new Rpy2Po());

            Console.WriteLine("Exporting " + rpy + "...");
            var file = path.Remove(path.Length - 4);

            rpy.TransformWith(new Po2Binary()).Stream.WriteTo(file + ".po");
        }