示例#1
0
        public IAssetBundle Read(string filename, int filterindex)
        {
            if (filterindex < 0)
            {
                // Excel can open virtually any text-based file formats,
                // but it could take incredibly long time if the file is not suitable for a table.
                // If a user opened an unknown file with disfr using "All files" file types,
                // assuming it is an XLIFF, but it was actually not,
                // disfr's automatic file detection scheme eventually passes the file to this method
                // (unless another reader accepted it), and the file could occupy Excel for long,
                // causing disfr to appear as though it hung up.
                // I think we should avoid such a behaviour.
                if (!PrimaryExtensions.Any(ext => filename.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase)))
                {
                    return(null);
                }
            }

            var full_pathname = Path.GetFullPath(filename);

            return(LoaderAssetBundle.Create(
                       ReaderManager.FriendlyFilename(filename),
                       () => ReadAssets(full_pathname)));
        }
示例#2
0
 public IAssetBundle Read(string filename, int filterindex)
 {
     return(LoaderAssetBundle.Create(
                ReaderManager.FriendlyFilename(filename),
                () => ReadAsset(filename, filterindex < 0)));
 }