for i, needed in enumerate(hierarchy): #if True: for obj_id in needed_dependencies: obj = in_xml.obj_map[obj_id] assert obj.id not in out_xml.obj_map if obj.type != needed: continue print("added object:", obj.name, obj.type) out_xml._root.append(obj._xml_node) #for obj in needed_dependencies: with open(out_res_modded, "wb") as f: out_res.write(f) with open(out_xml_modded, "wb") as f: out_xml._tree.write(f) print("saved as:") print(out_res_modded) print(out_xml_modded)
out = "test.res" sub_sections = [b"RXET", b"PRCS"] for filename in files: if not filename.endswith(".res"): continue path = os.path.join(dir, filename) with open(path, "rb") as f: arc = BWArchive(f) with open(out, "wb") as f: arc.write(f) with open(path, "rb") as f: test1 = f.read() with open(out, "rb") as f: test2 = f.read() print(path, out) print(test1 == test2) print(len(test1), len(test2)) #assert test1 == test2 for i, values in enumerate(zip(test1, test2)): c1, c2 = values if c1 != c2: