RenderingInfoReader.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // RenderingInfoReader.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using Microsoft.Xna.Framework;
  13. using Microsoft.Xna.Framework.Content;
  14. using Microsoft.Xna.Framework.Graphics;
  15. using TRead = MovipaLibrary.RenderingInfo;
  16. #endregion
  17. namespace MovipaLibrary
  18. {
  19. /// <summary>
  20. /// This class restores the xnb file converted by the content pipeline
  21. /// to the value of RenderingInfoReader.
  22. /// This ContentTypeReader must be the same as the runtime
  23. /// specified in ContentTypeWriter that was used to write the xnb
  24. /// whose type is RenderingInfoReader.
  25. ///
  26. /// ContentPipelineで変換されたxnbファイルをRenderingInfoReaderの値に復元します。
  27. /// このContentTypeReaderはRenderingInfoReader型のxnbを書き込む際に使用した
  28. /// ContentTypeWriterで指定されたランタイムと同じである必要があります。
  29. /// </summary>
  30. public class RenderingInfoReader : ContentTypeReader<TRead>
  31. {
  32. /// <summary>
  33. /// Reads RenderingInfo from the xnb file.
  34. ///
  35. /// xnbファイルからRenderingInfoを読み込みます。
  36. /// </summary>
  37. protected override TRead Read(ContentReader input, TRead existingInstance)
  38. {
  39. TRead info = new TRead();
  40. // Reads AnimationInfo.
  41. //
  42. // AnimationInfoを読み込みます。
  43. AnimationInfoReader.ReadAnimationInfo(input, info);
  44. // Reads RenderingInfo.
  45. //
  46. // RenderingInfoを読み込みます。
  47. info.Format = input.ReadString();
  48. info.TotalTexture = input.ReadUInt32();
  49. info.TotalFrame = input.ReadUInt32();
  50. info.ImageSize = input.ReadObject<Point>();
  51. info.FrameRate = input.ReadUInt32();
  52. return info;
  53. }
  54. }
  55. }