protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = base.ExportYAMLRoot(container); node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion)); node.Add(WidthName, Width); node.Add(HeightName, Height); node.Add(CompleteImageSizeName, CompleteImageSize); node.Add(TextureFormatName, (int)TextureFormat); node.Add(MipCountName, MipCount); node.Add(IsReadableName, IsReadable); if (IsReadStreamingMipmaps(container.ExportVersion)) { node.Add(StreamingMipmapsName, StreamingMipmaps); } if (IsReadStreamingMipmapsPriority(container.ExportVersion)) { node.Add(StreamingMipmapsPriorityName, StreamingMipmapsPriority); } node.Add(AlphaIsTransparencyName, GetAlphaIsTransparency(container.Version, container.Flags)); node.Add(ImageCountName, ImageCount); node.Add(TextureDimensionName, (int)TextureDimension); node.Add(TextureSettingsName, TextureSettings.ExportYAML(container)); node.Add(LightmapFormatName, (int)LightmapFormat); node.Add(ColorSpaceName, (int)ColorSpace); IReadOnlyList <byte> imageData = GetExportImageData(); node.Add(ImageDataName, imageData.Count); node.Add(TypelessdataName, imageData.ExportYAML()); StreamingInfo streamData = new StreamingInfo(true); node.Add(StreamDataName, streamData.ExportYAML(container)); return(node); }
public async Task <IActionResult> Music(IFormFile file, int roomid, string owner) { var ismusic = true; try { var f = new UploadFIle(file, ismusic); if (f.CheckIfExcelFile()) { await f.WriteFile(); } var streaminginfo = new StreamingInfo { FileName = f.Name, Owner = owner, RoomID = roomid, FileOgName = f.OriginalName }; if (!Streaming.Instance.StreamingQue.ContainsKey(streaminginfo.RoomID)) { await Streaming.Instance.AddRoom(streaminginfo.RoomID); } Streaming.Instance.EnQue(streaminginfo.RoomID, streaminginfo, ismusic); var info = new StreamingQueInfo(Streaming.Instance.StreamingQue[roomid]); await _hubContext.Clients.Group($"{roomid}").SendAsync("StreamingQueInfo", info); return(Ok()); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }
public override void ExportBinary(IExportContainer container, Stream stream) { if (IsReadLoadType(container.Version)) { if (FSBResource.CheckIntegrity(File)) { byte[] data = FSBResource.GetContent(File); stream.Write(data, 0, data.Length); } else { Logger.Log(LogType.Warning, LogCategory.Export, $"Can't export '{ValidName}' because data can't be read from resources file '{FSBResource.Source}'"); } } else { if (IsReadStreamingInfo(container.Version) && LoadType == AudioClipLoadType.Streaming && m_audioData == null) { if (StreamingInfo.CheckIntegrity(File)) { byte[] data = StreamingInfo.GetContent(File); stream.Write(data, 0, data.Length); } else { Logger.Log(LogType.Warning, LogCategory.Export, $"Can't export '{ValidName}' because resources file '{StreamingInfo.Path}' hasn't been found"); } } else { stream.Write(m_audioData, 0, m_audioData.Length); } } }
protected sealed override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = base.ExportYAMLRoot(container); if (HasColorSpace(container.ExportVersion)) { node.Add(ColorSpaceName, (int)ColorSpace); } node.Add(FormatName, (int)Format); node.Add(WidthName, Width); node.Add(HeightName, Height); node.Add(DepthName, Depth); node.Add(MipCountName, MipCount); node.Add(DataSizeName, DataSize); node.Add(TextureSettingsName, TextureSettings.ExportYAML(container)); node.Add(IsReadableName, IsReadable); IReadOnlyList <byte> imageData = GetImageData(container.Version); node.Add(ImageDataName, imageData.Count); node.Add(TypelessdataName, imageData.ExportYAML()); StreamingInfo streamData = new StreamingInfo(true); node.Add(StreamDataName, streamData.ExportYAML(container)); return(node); }
public Texture2DArray(ObjectReader reader) : base(reader) { m_Width = reader.ReadInt32(); m_Height = reader.ReadInt32(); m_Depth = reader.ReadInt32(); m_TextureFormat = (TextureFormat)reader.ReadInt32(); m_MipCount = reader.ReadInt32(); m_DataSize = reader.ReadUInt32(); m_TextureSettings = new GLTextureSettings(reader); m_ColorSpace = reader.ReadInt32(); m_IsReadable = reader.ReadBoolean(); reader.AlignStream(); var image_data_size = reader.ReadInt32(); if (image_data_size == 0) { m_StreamData = new StreamingInfo(reader); } if (!string.IsNullOrEmpty(m_StreamData?.path)) { image_data = new ResourceReader(m_StreamData.path, assetsFile, m_StreamData.offset, (int)m_StreamData.size); } else { image_data = new ResourceReader(reader, reader.BaseStream.Position, image_data_size); } }
public Texture2D(AssetInfo assetInfo) : base(assetInfo) { TextureSettings = new TextureSettings(assetInfo.AssetFile); if (IsReadStreamData) { StreamData = new StreamingInfo(); } }
private static byte[] GetDataOfs(StreamingInfo m_StreamData, SerializedFile assetsFile, int ofs, int len) { ResourceReader resourceReader; if (!string.IsNullOrEmpty(m_StreamData?.path)) { resourceReader = new ResourceReader(m_StreamData.path, assetsFile, m_StreamData.offset + (long)ofs, len); return(resourceReader.GetData()); } else { //resourceReader = new ResourceReader(reader, reader.BaseStream.Position, image_data_size); throw new Exception("embedded image data not supported"); } }
private void metroButtonOpen_Click(object sender, EventArgs e) { var fileBrowser = new OpenFileDialog { Filter = @"(*.bin)|*.bin" }; if (fileBrowser.ShowDialog() != DialogResult.OK) { return; } streamingInfo = new StreamingInfo(); playback.OpenFile(fileBrowser.FileName, ref streamingInfo); metroTextBox_totalSamples.Text = streamingInfo.SamplesPerChannel.ToString(); channels = streamingInfo.Channels; channelCount = channels.Length; string fmt = "采样率:{0} 流盘总时间:{1}ms 流盘文件时间长度:{2}ms"; metroLabelStripStatus.Text = string.Format(fmt, streamingInfo.SampleRate, TimeSpan.FromMilliseconds(streamingInfo.StreamingTime), TimeSpan.FromMilliseconds(streamingInfo.AcquisitionTime)); playback.FrameLength = int.Parse(metroTextBox_frameLength.Text); playbackBuffer = new double[channelCount, playback.FrameLength]; measurementBuffer = new double[playback.FrameLength]; metroButton_stopPlay.Enabled = true; metroButton_startPlay.Enabled = true; metroButton_open.Enabled = false; trackBar1.Enabled = true; metroTextBox_frameLength.Enabled = false; //设置tarckBar最大值为文件长度总时间,以毫秒为单位 trackBar1.Maximum = streamingInfo.AcquisitionTime; trackBar1.Value = 0; metroLabel_frameTimeStamp.Text = @"00:00:00:000000"; if (aitask == null) { aitask = new JYPXIE69848HAITask(0); } dataGridView1.Columns.Clear(); dataGridView1.Rows.Clear(); timer2FistRun = true; rowNumber = 0; }
public bool CheckAssetIntegrity() { if (IsReadLoadType(File.Version)) { return(FSBResource.CheckIntegrity(File)); } else if (IsReadStreamingInfo(File.Version)) { if (LoadType == AudioClipLoadType.Streaming) { if (m_audioData == null) { return(StreamingInfo.CheckIntegrity(File)); } } } return(true); }
public bool CheckAssetIntegrity() { if (HasLoadType(File.Version)) { return FSBResource.CheckIntegrity(File); } else if (HasStreamingInfo(File.Version)) { if (LoadType == AudioClipLoadType.Streaming) { if (AudioData == null) { return StreamingInfo.CheckIntegrity(File); } } } return true; }
protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = base.ExportYAMLRoot(container); node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion)); node.Add(SubMeshesName, GetSubMeshes(container.Version).ExportYAML(container)); node.Add(ShapesName, GetShapes(container.Version).ExportYAML(container)); node.Add(BindPoseName, GetBindPoses(container.Version).ExportYAML(container)); node.Add(BoneNameHashesName, GetBoneNameHashes(container.Version).ExportYAML(true)); node.Add(RootBoneNameHashName, RootBoneNameHash); if (IsReadBonesAABB(container.ExportVersion)) { node.Add(BonesAABBName, GetBonesAABB(container.Version).ExportYAML(container)); node.Add(VariableBoneCountWeightsName, GetVariableBoneCountWeights(container.Version).ExportYAML(container)); } node.Add(MeshCompressionName, (byte)MeshCompression); node.Add(IsReadableName, IsReadable); node.Add(KeepVerticesName, KeepVertices); node.Add(KeepIndicesName, KeepIndices); node.Add(IndexFormatName, (int)IndexFormat); node.Add(IndexBufferName, GetIndexBuffer(container.Version, container.Platform).ExportYAML()); node.Add(SkinName, GetSkin(container.Version).ExportYAML(container)); node.Add(VertexDataName, GetVertexData(container.Version).ExportYAML(container)); node.Add(CompressedMeshName, CompressedMesh.ExportYAML(container)); node.Add(LocalAABBName, LocalAABB.ExportYAML(container)); node.Add(MeshUsageFlagsName, MeshUsageFlags); node.Add(BakedConvexCollisionMeshName, GetBakedConvexCollisionMesh(container.Version).ExportYAML()); node.Add(BakedTriangleCollisionMeshName, GetBakedTriangleCollisionMesh(container.Version).ExportYAML()); if (IsReadMeshOptimizationFlags(container.ExportVersion, container.ExportFlags)) { node.Add(MeshOptimizationFlagsName, (int)GetMeshOptimizationFlags(container.Version, container.Flags)); } else { node.Add(MeshOptimizedName, GetMeshOptimized(container.Version, container.Flags)); } if (IsReadStreamData(container.ExportVersion)) { StreamingInfo streamData = new StreamingInfo(true); node.Add(StreamDataName, streamData.ExportYAML(container)); } return(node); }
private void buttonOpen_Click(object sender, EventArgs e) { var fileBrowser = new OpenFileDialog { Filter = @"(*.bin)|*.bin" }; if (fileBrowser.ShowDialog() != DialogResult.OK) { return; } streamingInfo = new StreamingInfo(); playback.OpenFile(fileBrowser.FileName, ref streamingInfo); textBox_totalSamples.Text = streamingInfo.SamplesPerChannel.ToString(); channels = streamingInfo.Channels; channelCount = channels.Length; string fmt = "采样率:{0} 流盘总时间:{1}ms 流盘文件时间长度:{2}ms"; lable_stripStatus.Text = string.Format(fmt, streamingInfo.SampleRate, TimeSpan.FromMilliseconds(streamingInfo.StreamingTime), TimeSpan.FromMilliseconds(streamingInfo.AcquisitionTime)); playback.FrameLength = int.Parse(textBox_frameLength.Text); playbackBuffer = new double[channelCount, playback.FrameLength]; button_stopPlay.Enabled = true; button_startPlay.Enabled = true; button_open.Enabled = false; trackBar1.Enabled = true; textBox_frameLength.Enabled = false; trackBar1.Maximum = 10000; trackBar1.Value = 0; lable_frameTimeStamp.Text = @"00:00:00:000000"; if (playback.FrameLength < playback.TotalLength) { readyForNext = true; } else { readyForNext = false; MessageBox.Show("Playback frame length is long than total sample length."); } }
public IReadOnlyList <byte> GetAudioData() { if (IsReadLoadType(File.Version)) { return(FSBResource.GetContent(File) ?? new byte[0]); } else { if (IsReadStreamingInfo(File.Version)) { if (LoadType == AudioClipLoadType.Streaming) { if (m_audioData == null) { return(StreamingInfo.GetContent(File) ?? new byte[0]); } } } return(m_audioData); } }
public IReadOnlyList <byte> GetAudioData() { if (HasLoadType(File.Version)) { return(FSBResource.GetContent(File) ?? Array.Empty <byte>()); } else { if (HasStreamingInfo(File.Version)) { if (LoadType == AudioClipLoadType.Streaming) { if (AudioData == null) { return(StreamingInfo.GetContent(File) ?? Array.Empty <byte>()); } } } return(AudioData); } }
public override void Read(AssetStream stream) { base.Read(stream); if (IsReadLoadType(stream.Version)) { LoadType = (AudioClipLoadType)stream.ReadInt32(); Channels = stream.ReadInt32(); Frequency = stream.ReadInt32(); BitsPerSample = stream.ReadInt32(); Length = stream.ReadSingle(); if (IsReadIsTrackerFormat(stream.Version)) { IsTrackerFormat = stream.ReadBoolean(); } if (IsReadAmbisonic(stream.Version)) { Ambisonic = stream.ReadBoolean(); } if (IsAlignTrackerFormat(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsReadAudioClipFlags(stream.Version)) { AudioClipFlags = stream.ReadInt32(); } if (IsReadFSBResourceFirst(stream.Version)) { FSBResource.Read(stream); } SubsoundIndex = stream.ReadInt32(); PreloadAudioData = stream.ReadBoolean(); LoadInBackground = stream.ReadBoolean(); Legacy3D = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); if (!IsReadFSBResourceFirst(stream.Version)) { FSBResource.Read(stream); } if (IsReadType(stream.Version)) { Type = (FMODSoundType)stream.ReadInt32(); } if (IsReadCompressionFormat(stream.Version)) { CompressionFormat = (AudioCompressionFormat)stream.ReadInt32(); } stream.AlignStream(AlignType.Align4); } else { if (IsReadDecompressOnLoadFirst(stream.Version)) { DecompressOnLoad = stream.ReadBoolean(); } Format = (FMODSoundFormat)stream.ReadInt32(); if (IsReadType(stream.Version)) { Type = (FMODSoundType)stream.ReadInt32(); } if (IsReadLength(stream.Version)) { Length = stream.ReadSingle(); Frequency = stream.ReadInt32(); Size = stream.ReadInt32(); } if (IsReadDecompressOnLoadSecond(stream.Version)) { DecompressOnLoad = stream.ReadBoolean(); } if (IsRead3D(stream.Version)) { Legacy3D = stream.ReadBoolean(); } if (IsReadUseHardware(stream.Version)) { UseHardware = stream.ReadBoolean(); } if (IsAlignBools(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsStreamInt32(stream.Version)) { Stream = stream.ReadInt32(); } if (IsReadStreamingInfo(stream.Version)) { if (Stream == 2) { string resImageName = $"{File.Name}.resS"; StreamingInfo.Read(stream, resImageName); } else { m_audioData = stream.ReadByteArray(); stream.AlignStream(AlignType.Align4); } } else { m_audioData = stream.ReadByteArray(); if (IsAlignAudioData(stream.Version)) { stream.AlignStream(AlignType.Align4); } } if (IsReadDecompressOnLoadThird(stream.Version)) { DecompressOnLoad = stream.ReadBoolean(); } if (IsReadStream(stream.Version)) { if (!IsStreamInt32(stream.Version)) { Stream = stream.ReadBoolean() ? 1 : 0; } } } }
public override void Read(AssetReader reader) { base.Read(reader); if (IsReadLoadType(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); Channels = reader.ReadInt32(); Frequency = reader.ReadInt32(); BitsPerSample = reader.ReadInt32(); Length = reader.ReadSingle(); if (IsReadIsTrackerFormat(reader.Version)) { IsTrackerFormat = reader.ReadBoolean(); } if (IsReadAmbisonic(reader.Version)) { Ambisonic = reader.ReadBoolean(); } if (IsAlignTrackerFormat(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsReadAudioClipFlags(reader.Version)) { AudioClipFlags = reader.ReadInt32(); } if (IsReadFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } SubsoundIndex = reader.ReadInt32(); PreloadAudioData = reader.ReadBoolean(); LoadInBackground = reader.ReadBoolean(); Legacy3D = reader.ReadBoolean(); reader.AlignStream(AlignType.Align4); if (!IsReadFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } if (IsReadType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (IsReadCompressionFormat(reader.Version)) { CompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } reader.AlignStream(AlignType.Align4); #if UNIVERSAL if (IsReadEditorResource(reader.Flags)) { EditorResource.Read(reader); if (IsReadCompressionFormat(reader.Version)) { EditorCompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } } #endif } else { if (IsReadDecompressOnLoadFirst(reader.Version)) { DecompressOnLoad = reader.ReadBoolean(); } Format = (FMODSoundFormat)reader.ReadInt32(); if (IsReadType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (IsReadLength(reader.Version)) { Length = reader.ReadSingle(); Frequency = reader.ReadInt32(); Size = reader.ReadInt32(); } if (IsReadDecompressOnLoadSecond(reader.Version)) { DecompressOnLoad = reader.ReadBoolean(); } if (IsRead3D(reader.Version)) { Legacy3D = reader.ReadBoolean(); } if (IsReadUseHardware(reader.Version)) { UseHardware = reader.ReadBoolean(); } if (IsAlignBools(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsStreamInt32(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); } if (IsReadStreamingInfo(reader.Version)) { bool isInnerData = true; if (LoadType == AudioClipLoadType.Streaming) { using (ResourcesFile res = File.Collection.FindResourcesFile(File, StreamingFileName)) { isInnerData = res == null; } } if (isInnerData) { m_audioData = reader.ReadByteArray(); reader.AlignStream(AlignType.Align4); } else { StreamingInfo.Read(reader, StreamingFileName); } } else { m_audioData = reader.ReadByteArray(); if (IsAlignAudioData(reader.Version)) { reader.AlignStream(AlignType.Align4); } } if (IsReadDecompressOnLoadThird(reader.Version)) { DecompressOnLoad = reader.ReadBoolean(); } if (IsReadStream(reader.Version)) { if (!IsStreamInt32(reader.Version)) { LoadType = reader.ReadBoolean() ? AudioClipLoadType.CompressedInMemory : AudioClipLoadType.DecompressOnLoad; } } } }
protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = base.ExportYAMLRoot(container); node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion)); if (HasLODData(container.ExportVersion)) { node.Add(LODDataName, LODData.ExportYAML(container)); } else { if (HasUse16bitIndices(container.ExportVersion)) { node.Add(Use16BitIndicesName, Use16BitIndices); } if (IsIndexBufferFirst(container.ExportVersion)) { node.Add(IndexBufferName, IndexBuffer.ExportYAML()); } node.Add(SubMeshesName, SubMeshes.ExportYAML(container)); } if (HasBlendShapes(container.ExportVersion)) { if (HasBlendChannels(container.ExportVersion)) { node.Add(ShapesName, Shapes.ExportYAML(container)); } else { node.Add(ShapesName, BlendShapes.ExportYAML(container)); node.Add(ShapeVerticesName, ShapeVertices.ExportYAML(container)); } } if (HasBindPose(container.ExportVersion)) { if (IsBindPoseFirst(container.ExportVersion)) { node.Add(BindPoseName, BindPose.ExportYAML(container)); } } if (HasBoneNameHashes(container.ExportVersion)) { node.Add(BoneNameHashesName, BoneNameHashes.ExportYAML(true)); node.Add(RootBoneNameHashName, RootBoneNameHash); } if (HasBonesAABB(container.ExportVersion)) { node.Add(BonesAABBName, BonesAABB.ExportYAML(container)); node.Add(VariableBoneCountWeightsName, VariableBoneCountWeights.ExportYAML(container)); } if (HasMeshCompression(container.ExportVersion)) { node.Add(MeshCompressionName, (byte)MeshCompression); } if (HasStreamCompression(container.ExportVersion)) { node.Add(StreamCompressionName, StreamCompression); } if (HasIsReadable(container.ExportVersion)) { node.Add(IsReadableName, IsReadable); node.Add(KeepVerticesName, KeepVertices); node.Add(KeepIndicesName, KeepIndices); } if (HasIndexFormat(container.ExportVersion)) { node.Add(IndexFormatName, (int)IndexFormat); } if (!HasLODData(container.ExportVersion)) { if (!IsIndexBufferFirst(container.ExportVersion)) { node.Add(IndexBufferName, IndexBuffer.ExportYAML()); } } if (HasVertexData(container.ExportVersion)) { if (!IsOnlyVertexData(container.ExportVersion)) { if (MeshCompression != MeshCompression.Off) { node.Add(VerticesName, Vertices.ExportYAML(container)); } } } else { node.Add(VerticesName, Vertices.ExportYAML(container)); } if (HasSkin(container.ExportVersion)) { node.Add(SkinName, Skin.ExportYAML(container)); } if (HasBindPose(container.ExportVersion)) { if (!IsBindPoseFirst(container.ExportVersion)) { node.Add(BindPoseName, BindPose.ExportYAML(container)); } } if (HasVertexData(container.ExportVersion)) { if (IsOnlyVertexData(container.ExportVersion)) { node.Add(VertexDataName, VertexData.ExportYAML(container)); } else { if (MeshCompression == MeshCompression.Off) { node.Add(VertexDataName, VertexData.ExportYAML(container)); } else { node.Add(UVName, UV.ExportYAML(container)); node.Add(UV1Name, UV1.ExportYAML(container)); node.Add(TangentsName, Tangents.ExportYAML(container)); node.Add(NormalsName, Normals.ExportYAML(container)); node.Add(ColorsName, Colors.ExportYAML(container)); } } } else { node.Add(UVName, UV.ExportYAML(container)); if (HasUV1(container.ExportVersion)) { node.Add(UV1Name, UV1.ExportYAML(container)); } if (HasTangentSpace(container.ExportVersion)) { node.Add(TangentSpaceName, Tangents.ExportYAML(container)); } else { node.Add(TangentsName, Tangents.ExportYAML(container)); node.Add(NormalsName, Normals.ExportYAML(container)); } } if (HasCompressedMesh(container.ExportVersion)) { node.Add(CompressedMeshName, CompressedMesh.ExportYAML(container)); } node.Add(LocalAABBName, LocalAABB.ExportYAML(container)); if (!HasVertexData(container.ExportVersion)) { node.Add(ColorsName, Colors.ExportYAML(container)); } if (HasCollisionTriangles(container.ExportVersion)) { node.Add(CollisionTrianglesName, CollisionTriangles.ExportYAML(true)); node.Add(CollisionVertexCountName, CollisionVertexCount); } if (HasMeshUsageFlags(container.ExportVersion)) { node.Add(MeshUsageFlagsName, MeshUsageFlags); } if (HasCollision(container.ExportVersion)) { node.Add(BakedConvexCollisionMeshName, CollisionData.BakedConvexCollisionMesh.ExportYAML()); node.Add(BakedTriangleCollisionMeshName, CollisionData.BakedTriangleCollisionMesh.ExportYAML()); } if (HasMeshMetrics(container.ExportVersion)) { node.Add(MeshMetricsName + "[0]", MeshMetrics[0]); node.Add(MeshMetricsName + "[1]", MeshMetrics[1]); } if (HasMeshOptimization(container.ExportVersion, container.ExportFlags)) { if (IsMeshOptimizationFlags(container.ExportVersion)) { node.Add(MeshOptimizationFlagsName, (int)MeshOptimizationFlags); } else { node.Add(MeshOptimizedName, MeshOptimized); } } if (HasStreamData(container.ExportVersion)) { StreamingInfo streamData = new StreamingInfo(true); node.Add(StreamDataName, streamData.ExportYAML(container)); } return(node); }
public override void Read(AssetReader reader) { base.Read(reader); if (HasLoadType(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); Channels = reader.ReadInt32(); Frequency = reader.ReadInt32(); BitsPerSample = reader.ReadInt32(); Length = reader.ReadSingle(); if (HasIsTrackerFormat(reader.Version)) { IsTrackerFormat = reader.ReadBoolean(); } if (HasAmbisonic(reader.Version)) { Ambisonic = reader.ReadBoolean(); } if (IsAlignTrackerFormat(reader.Version)) { reader.AlignStream(); } if (HasAudioClipFlags(reader.Version)) { AudioClipFlags = reader.ReadInt32(); } if (IsFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } SubsoundIndex = reader.ReadInt32(); PreloadAudioData = reader.ReadBoolean(); LoadInBackground = reader.ReadBoolean(); Legacy3D = reader.ReadBoolean(); reader.AlignStream(); if (!IsFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } if (HasType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (HasCompressionFormat(reader.Version)) { CompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } reader.AlignStream(); #if UNIVERSAL if (HasEditorResource(reader.Flags)) { EditorResource.Read(reader); if (HasCompressionFormat(reader.Version)) { EditorCompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } } #endif } else { int decompressionOrder = GetDecompressOnLoadOrder(reader.Version); if (decompressionOrder == 1) { DecompressOnLoad = reader.ReadBoolean(); } Format = (FMODSoundFormat)reader.ReadInt32(); if (HasType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (HasLength(reader.Version)) { Length = reader.ReadSingle(); Frequency = reader.ReadInt32(); Size = reader.ReadInt32(); } if (decompressionOrder == 2) { DecompressOnLoad = reader.ReadBoolean(); } if (Has3D(reader.Version)) { Legacy3D = reader.ReadBoolean(); } if (HasUseHardware(reader.Version)) { UseHardware = reader.ReadBoolean(); } if (IsAlignBools(reader.Version)) { reader.AlignStream(); } if (IsStreamInt32(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); } if (HasStreamingInfo(reader.Version)) { bool isInnerData = LoadType == AudioClipLoadType.Streaming ? File.Collection.FindResourceFile(StreamingFileName) == null : true; if (isInnerData) { AudioData = reader.ReadByteArray(); reader.AlignStream(); } else { StreamingInfo.Read(reader, StreamingFileName); } } else { AudioData = reader.ReadByteArray(); if (IsAlignAudioData(reader.Version)) { reader.AlignStream(); } } if (decompressionOrder == 3) { DecompressOnLoad = reader.ReadBoolean(); } if (HasStream(reader.Version)) { if (!IsStreamInt32(reader.Version)) { LoadType = reader.ReadBoolean() ? AudioClipLoadType.CompressedInMemory : AudioClipLoadType.DecompressOnLoad; } } } }
public Texture2D(ObjectReader reader) : base(reader) { m_Width = reader.ReadInt32(); m_Height = reader.ReadInt32(); var m_CompleteImageSize = reader.ReadInt32(); if (version[0] >= 2020) //2020.1 and up { var m_MipsStripped = reader.ReadInt32(); } m_TextureFormat = (TextureFormat)reader.ReadInt32(); if (version[0] < 5 || (version[0] == 5 && version[1] < 2)) //5.2 down { m_MipMap = reader.ReadBoolean(); } else { m_MipCount = reader.ReadInt32(); } if (version[0] > 2 || (version[0] == 2 && version[1] >= 6)) //2.6.0 and up { var m_IsReadable = reader.ReadBoolean(); } if (version[0] >= 2020) //2020.1 and up { var m_IsPreProcessed = reader.ReadBoolean(); } if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up { var m_IgnoreMasterTextureLimit = reader.ReadBoolean(); } if (version[0] >= 3) //3.0.0 - 5.4 { if (version[0] < 5 || (version[0] == 5 && version[1] <= 4)) { var m_ReadAllowed = reader.ReadBoolean(); } } if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 2)) //2018.2 and up { var m_StreamingMipmaps = reader.ReadBoolean(); } reader.AlignStream(); if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 2)) //2018.2 and up { var m_StreamingMipmapsPriority = reader.ReadInt32(); } var m_ImageCount = reader.ReadInt32(); var m_TextureDimension = reader.ReadInt32(); m_TextureSettings = new GLTextureSettings(reader); if (version[0] >= 3) //3.0 and up { var m_LightmapFormat = reader.ReadInt32(); } if (version[0] > 3 || (version[0] == 3 && version[1] >= 5)) //3.5.0 and up { var m_ColorSpace = reader.ReadInt32(); } var image_data_size = reader.ReadInt32(); if (image_data_size == 0 && ((version[0] == 5 && version[1] >= 3) || version[0] > 5))//5.3.0 and up { m_StreamData = new StreamingInfo(reader); } ResourceReader resourceReader; if (!string.IsNullOrEmpty(m_StreamData?.path)) { resourceReader = new ResourceReader(m_StreamData.path, assetsFile, m_StreamData.offset, (int)m_StreamData.size); } else { resourceReader = new ResourceReader(reader, reader.BaseStream.Position, image_data_size); } image_data = resourceReader; }