2017-09-14 21:14:22 +00:00
|
|
|
/* [MS-CFB] 2.6.4 (Unicode 3.0.1 case conversion) */
|
2017-08-09 06:50:59 +00:00
|
|
|
function find(cfb/*:CFBContainer*/, path/*:string*/)/*:?CFBEntry*/ {
|
2017-09-14 21:14:22 +00:00
|
|
|
//return cfb.find(path);
|
|
|
|
var UCFullPaths/*:Array<string>*/ = cfb.FullPaths.map(function(x) { return x.toUpperCase(); });
|
|
|
|
var UCPaths/*:Array<string>*/ = UCFullPaths.map(function(x) { var y = x.split("/"); return y[y.length - (x.slice(-1) == "/" ? 2 : 1)]; });
|
|
|
|
var k/*:boolean*/ = false;
|
|
|
|
if(path.charCodeAt(0) === 47 /* "/" */) { k = true; path = UCFullPaths[0].slice(0, -1) + path; }
|
|
|
|
else k = path.indexOf("/") !== -1;
|
|
|
|
var UCPath/*:string*/ = path.toUpperCase();
|
|
|
|
var w/*:number*/ = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath);
|
|
|
|
if(w !== -1) return cfb.FileIndex[w];
|
|
|
|
|
|
|
|
UCPath = UCPath.replace(chr0,'').replace(chr1,'!');
|
|
|
|
for(w = 0; w < UCFullPaths.length; ++w) {
|
|
|
|
if(UCFullPaths[w].replace(chr0,'').replace(chr1,'!') == UCPath) return cfb.FileIndex[w];
|
|
|
|
if(UCPaths[w].replace(chr0,'').replace(chr1,'!') == UCPath) return cfb.FileIndex[w];
|
|
|
|
}
|
|
|
|
return null;
|
2017-08-09 06:50:59 +00:00
|
|
|
}
|