Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. public static Provider ParseFile(string p_fileName, bool p_useCache = true)
  2.         {
  3.             if (p_useCache && AnimationBinaryParser.CreatecacheBinary() && AnimationBinaryParser._CachedBinary.ContainsKey(p_fileName))
  4.             {
  5.                 return AnimationBinaryParser._CachedBinary[p_fileName];
  6.             }
  7.             byte[] binary = ResourceManager.GetBinary(p_fileName);
  8.             MemoryStream memoryStream = new MemoryStream(binary);
  9.             BinaryReader binaryReader = new BinaryReader(memoryStream);
  10.             int num = binaryReader.ReadInt32();
  11.             Provider provider = new Provider(num);
  12.             for (int i = 0; i < num; i++)
  13.             {
  14.                 binaryReader.ReadByte();
  15.                 int num2 = binaryReader.ReadInt32();
  16.                 Vector3[] array = new Vector3[46];
  17.                 for (int j = 0; j < num2; j++)
  18.                 {
  19.                     if (j >= 46)
  20.                     {
  21.                         binaryReader.ReadSingle();
  22.                         binaryReader.ReadSingle();
  23.                         binaryReader.ReadSingle();
  24.                     }
  25.                     else
  26.                     {
  27.                         array[j].x = binaryReader.ReadSingle();
  28.                         array[j].y = -binaryReader.ReadSingle();
  29.                         array[j].z = binaryReader.ReadSingle();
  30.                     }
  31.                 }
  32.                 provider.Add(array, i);
  33.             }
  34.             binaryReader.Close();
  35.             memoryStream.Close();
  36.             if (p_useCache)
  37.             {
  38.                 AnimationBinaryParser._CachedBinary.Add(p_fileName, provider);
  39.             }
  40.             return provider;
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement