Example #1
0
 public static string LoadName(Stream stream)
 {
     try
     {
         BinaryReader reader = new BinaryReader(stream);
         return reader.ReadNameA4();
     }
     catch
     {
         return null;
     }
 }
Example #2
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            m_Name = reader.ReadNameA4();
            m_ControllerSize = reader.ReadUInt32();
            m_Controller = new ControllerConstant(stream);

            int tosSize = reader.ReadInt32();
            m_TOS = new List<KeyValuePair<uint, string>>(tosSize);
            for (int i = 0; i < tosSize; i++)
            {
                m_TOS.Add(new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadNameA4()));
            }

            int numClips = reader.ReadInt32();
            m_AnimationClips = new List<PPtr<AnimationClip>>(numClips);
            for (int i = 0; i < numClips; i++)
            {
                m_AnimationClips.Add(new PPtr<AnimationClip>(stream, file));
            }
        }
Example #3
0
 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     name = reader.ReadNameA4();
     nameHash = reader.ReadUInt32();
     frameIndex = reader.ReadInt32();
     frameCount = reader.ReadInt32();
 }
Example #4
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            m_Name = reader.ReadNameA4();

            int numSubMeshes = reader.ReadInt32();
            m_SubMeshes = new List<SubMesh>(numSubMeshes);
            for (int i = 0; i < numSubMeshes; i++)
            {
                m_SubMeshes.Add(new SubMesh(stream));
            }

            m_Shapes = new BlendShapeData(stream);

            int numBones = reader.ReadInt32();
            m_BindPose = new List<Matrix>(numBones);
            for (int i = 0; i < numBones; i++)
            {
                m_BindPose.Add(reader.ReadMatrix());
            }

            int numHashes = reader.ReadInt32();
            m_BoneNameHashes = new List<uint>(numHashes);
            for (int i = 0; i < numHashes; i++)
            {
                m_BoneNameHashes.Add(reader.ReadUInt32());
            }

            m_RootBoneNameHash = reader.ReadUInt32();
            m_MeshCompression = reader.ReadByte();
            m_StreamCompression = reader.ReadByte();
            m_IsReadable = reader.ReadBoolean();
            m_KeepVertices = reader.ReadBoolean();
            m_KeepIndices = reader.ReadBoolean();
            reader.BaseStream.Position += 3;

            int numIndexBytes = reader.ReadInt32();
            m_IndexBuffer = reader.ReadBytes(numIndexBytes);
            if ((numIndexBytes & 3) > 0)
            {
                reader.BaseStream.Position += 4 - (numIndexBytes & 3);
            }

            int numInfluences = reader.ReadInt32();
            m_Skin = new List<BoneInfluence>(numInfluences);
            for (int i = 0; i < numInfluences; i++)
            {
                m_Skin.Add(new BoneInfluence(stream));
            }

            m_VertexData = new VertexData(stream);
            m_CompressedMesh = new CompressedMesh(stream);
            m_LocalAABB = new AABB(stream);
            m_MeshUsageFlags = reader.ReadInt32();
        }
Example #5
0
 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     m_Name = reader.ReadNameA4();
     m_Format = reader.ReadInt32();
     m_Type = reader.ReadInt32();
     m_3D = reader.ReadBoolean();
     m_UseHardware = reader.ReadBoolean();
     reader.ReadBytes(2);
     m_Stream = reader.ReadInt32();
     m_AudioData = reader.ReadBytes(reader.ReadInt32());
 }
Example #6
0
 public AssetBundleScriptInfo(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     className = reader.ReadNameA4();
     nameSpace = reader.ReadNameA4();
     assemblyName = reader.ReadNameA4();
     hash = reader.ReadUInt32();
 }
Example #7
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            m_Name = reader.ReadNameA4();

            int numObjects = reader.ReadInt32();
            m_PreloadTable = new List<PPtr<Object>>(numObjects);
            for (int i = 0; i < numObjects; i++)
            {
                PPtr<Object> objPtr = new PPtr<Object>(stream);
                if (objPtr.m_FileID == 0)
                {
                    Component comp = file.FindComponent(objPtr.m_PathID, false);
                    if (comp == null)
                    {
                        comp = new NotLoaded(file, objPtr.m_PathID, 0, 0);
                    }
                    objPtr = new PPtr<Object>(comp);
                }
                m_PreloadTable.Add(objPtr);
            }

            int numContainerEntries = reader.ReadInt32();
            m_Container = new List<KeyValuePair<string, AssetInfo>>(numContainerEntries);
            for (int i = 0; i < numContainerEntries; i++)
            {
                m_Container.Add
                (
                    new KeyValuePair<string, AssetInfo>
                    (
                        reader.ReadNameA4(), new AssetInfo(file, stream)
                    )
                );
            }

            m_MainAsset = new AssetInfo(file, stream);

            int numScriptComps = reader.ReadInt32();
            m_ScriptCompatibility = new AssetBundleScriptInfo[numScriptComps];
            for (int i = 0; i < numScriptComps; i++)
            {
                m_ScriptCompatibility[i] = new AssetBundleScriptInfo(stream);
            }

            int numClassComps = reader.ReadInt32();
            m_ClassCompatibility = new KeyValuePair<int, uint>[numClassComps];
            for (int i = 0; i < numClassComps; i++)
            {
                m_ClassCompatibility[i] = new KeyValuePair<int, uint>
                (
                    reader.ReadInt32(), reader.ReadUInt32()
                );
            }

            m_RuntimeCompatibility = reader.ReadUInt32();
        }
Example #8
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            m_Name = reader.ReadNameA4();
            m_AvatarSize = reader.ReadUInt32();
            m_Avatar = new AvatarConstant(stream);

            int numTOS = reader.ReadInt32();
            m_TOS = new List<KeyValuePair<uint, string>>(numTOS);
            for (int i = 0; i < numTOS; i++)
            {
                m_TOS.Add(new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadNameA4()));
            }
        }
Example #9
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            m_Name = reader.ReadNameA4();
            m_Shader = new PPtr<Shader>(stream, file);

            int numShaderKeywords = reader.ReadInt32();
            m_ShaderKeywords = new List<string>(numShaderKeywords);
            for (int i = 0; i < numShaderKeywords; i++)
            {
                m_ShaderKeywords.Add(reader.ReadNameA4());
            }

            m_CustomRenderQueue = reader.ReadInt32();
            m_SavedProperties = new UnityPropertySheet(file, stream);
        }
Example #10
0
 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     m_Name = reader.ReadNameA4();
     m_Rect = new Rectf(stream);
     m_Offset = reader.ReadVector2();
     m_Border = reader.ReadVector4();
     m_PixelsToUnits = reader.ReadSingle();
     m_Extrude = reader.ReadUInt32();
     m_RD = new SpriteRenderData(file, stream);
 }
Example #11
0
 public string[] GetAssetNames(bool filter)
 {
     string[] assetNames = new string[Parser.Cabinet.Components.Count];
     using (BinaryReader reader = new BinaryReader(File.OpenRead(Parser.FilePath)))
     {
         Stream stream = reader.BaseStream;
         for (int i = 0; i < Parser.Cabinet.Components.Count; i++)
         {
             NotLoaded comp = Parser.Cabinet.Components[i] as NotLoaded;
             if (comp == null)
             {
                 Component subfile = Parser.Cabinet.Components[i];
                 assetNames[i] = AssetCabinet.ToString(subfile);
                 continue;
             }
             if (comp.Name == null)
             {
                 stream.Position = comp.offset;
                 switch (comp.classID1)
                 {
                 case UnityClassID.AssetBundle:
                 case UnityClassID.Avatar:
                 case UnityClassID.Mesh:
                     if (!filter)
                     {
                         comp.Name = reader.ReadNameA4();
                     }
                     break;
                 case UnityClassID.AudioClip:
                 case UnityClassID.AnimationClip:
                 case UnityClassID.AnimatorController:
                 case UnityClassID.AnimatorOverrideController:
                 case UnityClassID.Cubemap:
                 case UnityClassID.Material:
                 case UnityClassID.Shader:
                 case UnityClassID.Sprite:
                 case UnityClassID.TextAsset:
                 case UnityClassID.Texture2D:
                     comp.Name = reader.ReadNameA4();
                     break;
                 case UnityClassID.MonoScript:
                     comp.Name = comp.pathID + " / " + reader.ReadNameA4();
                     break;
                 case UnityClassID.Animator:
                 case UnityClassID.EllipsoidParticleEmitter:
                 case UnityClassID.Light:
                 case UnityClassID.ParticleAnimator:
                 case UnityClassID.ParticleRenderer:
                 case UnityClassID.ParticleSystem:
                 case UnityClassID.ParticleSystemRenderer:
                     comp.Name = GetNameFromGameObject(filter, stream);
                     break;
                 default:
                     if ((int)comp.classID1 <= -1 && comp.classID2 == UnityClassID.MonoBehaviour)
                     {
                         comp.Name = GetNameFromGameObject(filter, stream);
                         if (comp.Name == null)
                         {
                             comp.Name = MonoBehaviour.LoadName(stream);
                         }
                     }
                     break;
                 case UnityClassID.AudioListener:
                 case UnityClassID.AudioSource:
                 case UnityClassID.BoxCollider:
                 case UnityClassID.Camera:
                 case UnityClassID.CapsuleCollider:
                 case UnityClassID.FlareLayer:
                 case UnityClassID.LinkToGameObject:
                 case UnityClassID.LinkToGameObject223:
                 case UnityClassID.LinkToGameObject225:
                 case UnityClassID.MeshCollider:
                 case UnityClassID.MeshFilter:
                 case UnityClassID.MeshRenderer:
                 case UnityClassID.MultiLink:
                 case UnityClassID.Projector:
                 case UnityClassID.Rigidbody:
                 case UnityClassID.SkinnedMeshRenderer:
                 case UnityClassID.SphereCollider:
                 case UnityClassID.SpriteRenderer:
                 case UnityClassID.Transform:
                     if (!filter)
                     {
                         comp.Name = GetNameFromGameObject(true, stream);
                     }
                     break;
                 case UnityClassID.GameObject:
                     if (!filter || IsVirtualAnimator(comp))
                     {
                         comp.Name = GameObject.LoadName(stream);
                     }
                     break;
                 }
             }
             assetNames[i] = comp.Name != null ? comp.Name : comp.pathID.ToString();
         }
     }
     return assetNames;
 }
Example #12
0
 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     m_Name = reader.ReadNameA4();
     m_Width = reader.ReadInt32();
     m_Height = reader.ReadInt32();
     m_CompleteImageSize = reader.ReadInt32();
     m_TextureFormat = (TextureFormat)reader.ReadInt32();
     m_MipMap = reader.ReadBoolean();
     m_isReadable = reader.ReadBoolean();
     m_ReadAllowed = reader.ReadBoolean();
     reader.ReadByte();
     m_ImageCount = reader.ReadInt32();
     m_TextureDimension = reader.ReadInt32();
     m_TextureSettings = new GLTextureSettings(stream);
     m_LightmapFormat = reader.ReadInt32();
     m_ColorSpace = reader.ReadInt32();
     int size = reader.ReadInt32();
     image_data = reader.ReadBytes(size);
     reader.ReadBytes(4 - size & 3);
 }
Example #13
0
 public static string LoadName(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     return reader.ReadNameA4();
 }
Example #14
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            m_Name = reader.ReadNameA4();
            m_Script = reader.ReadNameA4();
            m_PathName = reader.ReadNameA4();

            int numDependencies = reader.ReadInt32();
            m_Dependencies = new List<PPtr<Shader>>(numDependencies);
            for (int i = 0; i < numDependencies; i++)
            {
                m_Dependencies.Add(new PPtr<Shader>(stream, file));
            }

            m_ShaderIsBaked = reader.ReadBoolean();
            reader.ReadBytes(3);
        }
Example #15
0
        public static string LoadName(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            int numComponents = reader.ReadInt32();
            for (int i = 0; i < numComponents; i++)
            {
                reader.ReadInt32();
                new PPtr<Component>(stream);
            }

            reader.ReadUInt32();
            return reader.ReadNameA4();
        }
Example #16
0
 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     name = reader.ReadNameA4();
 }
Example #17
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            int numComponents = reader.ReadInt32();
            m_Component = new List<KeyValuePair<UnityClassID, PPtr<Component>>>(numComponents);
            for (int i = 0; i < numComponents; i++)
            {
                m_Component.Add
                (
                    new KeyValuePair<UnityClassID, PPtr<Component>>
                    (
                        (UnityClassID)reader.ReadInt32(),
                        new PPtr<Component>(stream, file)
                    )
                );
            }

            m_Layer = reader.ReadUInt32();
            m_Name = reader.ReadNameA4();
            m_Tag = reader.ReadUInt16();
            m_isActive = reader.ReadBoolean();
        }
Example #18
0
 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     m_Name = reader.ReadNameA4();
     m_ExecutionOrder = reader.ReadInt32();
     m_PropertiesHash = reader.ReadUInt32();
     m_ClassName = reader.ReadNameA4();
     m_Namespace = reader.ReadNameA4();
     m_AssemblyName = reader.ReadNameA4();
     m_IsEditorScript = reader.ReadBoolean();
 }