Ejemplo n.º 1
0
        private static IAssetBundle ReadXliff(string filename, Stream file, Flavour flavour, ZipArchiveEntry entry = null)
        {
            var parser = new XliffParser();

            parser.Filename = filename;
            parser.Flavour  = flavour;
            parser.ZipEntry = entry;
            return(parser.Read(file));
        }
Ejemplo n.º 2
0
        private static IEnumerable <IAsset> ReadXliff(string filename, Stream file, ref Flavour flavour, ZipArchiveEntry entry)
        {
            var parser = new XliffParser();

            parser.Filename = filename;
            parser.Flavour  = flavour;
            parser.ZipEntry = entry;
            var assets = parser.Read(file);

            flavour = parser.Flavour;
            return(assets);
        }
Ejemplo n.º 3
0
        /// <summary>Parses an xliff (root) element into an asset bundle.</summary>
        /// <param name="xliff">An XML element that is supposed to be an xliff element.</param>
        /// <param name="filename">The (full path) name of the file <paramref name="xliff"/> was taken from.</param>
        /// <param name="flavour">The flavour of XLIFF to assume.</param>
        /// <returns>An asset bundle from <see cref="xliff"/>.</returns>
        /// <remarks>The returned bundle's <see cref="IAssetBundle.CanRefresh"/> will be false.</remarks>
        public IAssetBundle Parse(XElement xliff, string filename, Flavour flavour = Flavour.Auto)
        {
            if (xliff == null)
            {
                throw new ArgumentNullException("xliff");
            }
            if (filename == null)
            {
                throw new ArgumentNullException("filename");
            }
            var parser = new XliffParser();

            parser.Filename = filename;
            parser.Flavour  = flavour;
            var assets = parser.Parse(xliff);

            if (assets == null)
            {
                throw new ArgumentException("Not a valid <xliff> element", "xliff");
            }
            return(new SimpleAssetBundle(assets, ReaderManager.FriendlyFilename(filename)));
        }