def parse_root_file(uid, fd, cascreader):
    """Returns an array of format [TYPE, ID, CKEY, EXTRA...],
    Type = one of NAMED_FILE, ID_FILE, ID_INDEXED_FILE
    Id = depends on type. NAMED:"strname", ID:"id", ID_INDEXED:("id","index")
    Ckey = that file's ckey
    Extra = uid specific data 
        d3: extra is the "directory" that the file is in
    """
    from PyCASC.rootfiles import parse_d3_root, parse_wow_root, parse_mndx_root, parse_warcraft3_root, parse_hearthstone_root, parse_ow_root
    if uid in ['hsb']:
        return parse_hearthstone_root(fd)
    elif uid in ['w3']:
        return parse_warcraft3_root(fd)
    elif uid in ['d3']:
        return parse_d3_root(fd, cascreader)
    elif uid in ['hero', 's2']:
        return parse_mndx_root(fd)
    elif uid in ['pro']:
        return parse_ow_root(fd)
    elif uid in ['wow']:
        return parse_wow_root(fd)
    else:
        with open(f'{uid}.rootfile', 'wb+') as f:
            f.write(fd)
        raise Exception(
            f"Don't know how to read root file for {uid}. Dumped contents to {uid}.rootfile"
            )
