private void ReadMonoBehaviours(PrefabMetadata metadata, string content) { var documents = content.Split(new string[] { "--- !u!114" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 1; i < documents.Length; i++) { var document = documents[i]; var monoBehaviour = new MonoBehaviourMetadata(); var script = new ScriptMetadata { FileId = ReadFileId(document, ScriptFileIdRegex), Guid = ReadString(document, ScriptGuidRegex, "guid") }; script.FullName = m_scriptMetadataService.GetFullNameByFileId(script.FileId); if (String.IsNullOrEmpty(script.FullName)) { script.FullName = MetaFileService.GetFileNameByGuid(script.Guid); } monoBehaviour.Script = script; metadata.MonoBehaviours.Add(monoBehaviour); } }
private static void ReadMaterials(PrefabMetadata metadata, string content) { var documents = content.Split(new string[] { "type: 2}" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < documents.Length - 1; i++) { var document = documents[i]; document = FixMaterialRegex.Replace(document, ", type: 2}"); var material = new MaterialMetadata { FileId = ReadFileId(document, MaterialFileIdRegex), Guid = ReadString(document, MaterialGuidRegex, "guid") }; material.FullName = Path.GetFileNameWithoutExtension(MetaFileService.GetFileNameByGuid(material.Guid)); metadata.Materials.Add(material); } }