12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //------------------------------------------------------------
- // Game Framework
- // Copyright © 2013-2021 loyalsoft. All rights reserved.
- // Homepage: http://www.game7000.com/
- // Feedback: http://www.game7000.com/
- //------------------------------------------------------------
- using System.Runtime.InteropServices;
- namespace GameFramework.FileSystem
- {
- internal sealed partial class FileSystem : IFileSystem
- {
- /// <summary>
- /// 块数据。
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- private struct BlockData
- {
- public static readonly BlockData Empty = new BlockData(0, 0);
- private readonly int m_StringIndex;
- private readonly int m_ClusterIndex;
- private readonly int m_Length;
- public BlockData(int clusterIndex, int length)
- : this(-1, clusterIndex, length)
- {
- }
- public BlockData(int stringIndex, int clusterIndex, int length)
- {
- m_StringIndex = stringIndex;
- m_ClusterIndex = clusterIndex;
- m_Length = length;
- }
- public bool Using
- {
- get
- {
- return m_StringIndex >= 0;
- }
- }
- public int StringIndex
- {
- get
- {
- return m_StringIndex;
- }
- }
- public int ClusterIndex
- {
- get
- {
- return m_ClusterIndex;
- }
- }
- public int Length
- {
- get
- {
- return m_Length;
- }
- }
- public BlockData Free()
- {
- return new BlockData(m_ClusterIndex, (int)GetUpBoundClusterOffset(m_Length));
- }
- }
- }
- }
|