private void ExtractRawBits(Asset.AssetObjectInfo obj, string outputPath) { if (Path.GetFileName(outputPath) == "") { string name = (gID++) + "_" + obj.PathID.ToString(); outputPath = outputPath + "/" + name; } if (Path.GetExtension(outputPath) == "") { outputPath += ".raw"; } outputPath = AssetToolUtility.FixOuputPath(outputPath); if (!Directory.Exists(Path.GetDirectoryName(outputPath))) { Directory.CreateDirectory(Path.GetDirectoryName(outputPath)); } var bytes = obj.data; var fs = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write); fs.Write(bytes, 0, bytes.Length); fs.Flush(); fs.Dispose(); }
private void extractOnlyRawText(Asset.AssetObjectInfo objinfo, TypeTree typeTree, string outputPath) { if (typeTree != null) { SerializeObject sobj = new SerializeObject(typeTree, objinfo.data); ExtractRawText(sobj, outputPath); } }
private void extractRawTextOrRawBits(Asset.AssetObjectInfo objinfo, TypeTree typeTree, string outputPath) { if (typeTree != null) { extractOnlyRawText(objinfo, typeTree, outputPath); } else { extractOnlyRawBits(objinfo, typeTree, outputPath); } }
private void ExtractAuto(Asset.AssetObjectInfo objinfo, TypeTree typeTree, string outputPath) { if (typeTree != null) { SerializeObject sobj = new SerializeObject(typeTree, objinfo.data); ISerializeObjectExtrator extrator; if (mObjectExtratorDic.TryGetValue(typeTree.type, out extrator)) { extrator.Extract(sobj, outputPath); } else { extractOnlyRawText(objinfo, typeTree, outputPath); } } else { extractOnlyRawBits(objinfo, typeTree, outputPath); } }
private void extractOnlyRawBits(Asset.AssetObjectInfo objinfo, TypeTree typeTree, string outputPath) { string name = ""; if (typeTree != null && Path.GetFileName(outputPath) == "") { try { SerializeObject sobj = new SerializeObject(typeTree, objinfo.data); var nameProperty = sobj.FindProperty("m_Name"); if (nameProperty != null) { name = nameProperty.Value as string; outputPath += "/" + name; } } catch { Debug.LogError("Can't Create SerializeObject.TypeVerion:{0},TypeClassID:{1},TypeName:{2}", typeTree.version, objinfo.classID, typeTree.type); } } ExtractRawBits(objinfo, outputPath); }
public void ExtractObjct(Asset.AssetObjectInfo obj, TypeTree typeTree, string outputPath, ExtractMode mode = ExtractMode.Auto) { outputPath = outputPath + "\\" + AssetToolUtility.ClassIDToClassName(obj.classID) + "\\"; switch (mode) { case ExtractMode.Auto: ExtractAuto(obj, typeTree, outputPath); break; case ExtractMode.OnlyRawBits: extractOnlyRawBits(obj, typeTree, outputPath); break; case ExtractMode.OnlyRawText: extractOnlyRawText(obj, typeTree, outputPath); break; case ExtractMode.RawTextOrRawBits: extractRawTextOrRawBits(obj, typeTree, outputPath); break; } }