public Mustache_doc_itm[] Mustache__subs(String key) { if (String_.Eq(key, "is_dir")) return Mustache_doc_itm_.Ary__bool(is_dir); else if (String_.Eq(key, "dir_cmd_exists")) return Mustache_doc_itm_.Ary__bool(Bry_.Len_gt_0(dir_cmd)); else if (String_.Eq(key, "is_core_xowa")) return Mustache_doc_itm_.Ary__bool(is_core_xowa); else if (String_.Eq(key, "subs")) return subs; return Mustache_doc_itm_.Ary__empty; }
private static void New_subs(Io_url owner_dir, List_adp list, IoItmList subs, byte[] dir_cmd) { subs.Sort(); int len = subs.Len(); int list_total = list.Len(); byte[] owner_dir_bry = owner_dir.RawBry(); for (int i = 0; i < len; ++i) { IoItm_base src = (IoItm_base) subs.Get_at(i); Xow_import_doc trg = null; if (src.Type_dir()) { byte[] trg_url = src.Url().RawBry(); trg = new Xow_import_doc( Bool_.Y, Bool_.N, list_total + i, owner_dir_bry, trg_url, Bry_.new_u8(src.Url().NameAndExt_noDirSpr()), Bry_.Empty, Bry_.Empty, dir_cmd, Ary_empty); } else { IoItmFil src_as_fil = (IoItmFil) src; String size_str = Io_size_.To_str(src_as_fil.Size(), "#,###"); boolean is_xowa_core = gplx.xowa.wikis.data.Xow_db_file__core_.Is_core_fil_name( owner_dir.NameOnly(), src.Url().NameAndExt()); trg = new Xow_import_doc( Bool_.N, is_xowa_core, list_total + i, owner_dir_bry, src.Url().RawBry(), Bry_.new_u8(src.Name()), Bry_.new_u8(src_as_fil.ModifiedTime().XtoStr_fmt("yyyy-MM-dd")), Bry_.new_u8(size_str), dir_cmd, Ary_empty); } list.Add(trg); } }
public static Xow_import_doc New(IoItmDir owner_dir, byte[] dir_cmd) { List_adp sub_list = List_adp_.New(); New_subs(owner_dir.Url(), sub_list, owner_dir.SubDirs(), dir_cmd); New_subs(owner_dir.Url(), sub_list, owner_dir.SubFils(), Bry_.Empty); Xow_import_doc[] subs = (Xow_import_doc[]) sub_list.To_ary_and_clear(Xow_import_doc.class); return new Xow_import_doc( Bool_.Y, Bool_.N, 0, owner_dir.Url().OwnerDir().RawBry(), owner_dir.Url().RawBry(), Bry_.new_u8(owner_dir.Name()), Bry_.Empty, Bry_.Empty, dir_cmd, subs); }