コード例 #1
0
 public void Merge(VocaloidMotionData data)
 {
     if (data.MotionFrames != null)
     {
         MotionFrames.AddRange(data.MotionFrames);
     }
     if (data.MorphFrames != null)
     {
         MorphFrames.AddRange(data.MorphFrames);
     }
     if (data.CameraFrames != null)
     {
         CameraFrames.AddRange(data.CameraFrames);
     }
     if (data.LightFrames != null)
     {
         LightFrames.AddRange(data.LightFrames);
     }
     if (data.ShadowFrames != null)
     {
         ShadowFrames.AddRange(data.ShadowFrames);
     }
     if (data.PropertyFrames != null)
     {
         PropertyFrames.AddRange(data.PropertyFrames);
     }
 }
コード例 #2
0
        /// <summary>
        /// VMDを読み込む
        /// </summary>
        /// <returns>EndOfStreamExceptionが発生した場合 true を返す</returns>
        public bool Read(BinaryReader reader)
        {
            try
            {
                byte[] bChar = reader.ReadBytes(HEADER_LENGTH);
                header = new string(Encoding.GetChars(bChar));
                int eosPos = header.IndexOf('\0');
                if (eosPos >= 0)
                {
                    header = header.Remove(eosPos);
                }

                bChar     = reader.ReadBytes(MODEL_NAME_LENGTH);
                ModelName = new string(Encoding.GetChars(bChar));
                eosPos    = ModelName.IndexOf('\0');
                if (eosPos >= 0)
                {
                    ModelName = ModelName.Remove(eosPos);
                }

                uint len = reader.ReadUInt32();
                for (int i = 0; i < len; i++)
                {
                    MotionFrames.Add(new VmdMotionFrameData(reader));
                }

                len = reader.ReadUInt32();
                for (int i = 0; i < len; i++)
                {
                    MorphFrames.Add(new VmdMorphFrameData(reader));
                }

                //camera
                len = reader.ReadUInt32();
                for (int i = 0; i < len; i++)
                {
                    CameraFrames.Add(new VmdCameraFrameData(reader));
                }

                //light
                len = reader.ReadUInt32();
                for (int i = 0; i < len; i++)
                {
                    LightFrames.Add(new VmdLightFrameData(reader));
                }

                //self shadow
                len = reader.ReadUInt32();
                for (int i = 0; i < len; i++)
                {
                    ShadowFrames.Add(new VmdShadowFrameData(reader));
                }

                len = reader.ReadUInt32();
                for (int i = 0; i < len; i++)
                {
                    PropertyFrames.Add(new VmdPropertyFrameData(reader));
                }
                return(false);
            }
            catch (EndOfStreamException)
            {
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }