示例#1
0
 /// <summary>
 ///     Constructs a new StringID from a length, a set, and an index.
 /// </summary>
 /// <param name="length">The length of the string.</param>
 /// <param name="set">The set the stringID belongs to.</param>
 /// <param name="index">The index of the stringID within the set.</param>
 /// <param name="layout">The layout of the stringID.</param>
 public StringID(int length, int set, int index, StringIDLayout layout)
 {
     var shiftedLength = (int) ((length & CreateMask(layout.LengthSize)) << layout.LengthStart);
     var shiftedSet = (int) ((set & CreateMask(layout.SetSize)) << layout.SetStart);
     var shiftedIndex = (int) ((index & CreateMask(layout.IndexSize)) << layout.IndexStart);
     _value = (uint) (shiftedLength | shiftedSet | shiftedIndex);
 }
 /// <summary>
 /// Constructs a new LengthBasedStringIDResolver.
 /// </summary>
 /// <param name="strings">The IndexedStringTable to reference to get string lengths.</param>
 public LengthBasedStringIDResolver(IndexedStringTable strings)
 {
     _strings = strings;
     IDLayout = new StringIDLayout(24, 0, 8); // TODO: is it necessary to make this a build option?
 }
 public StringIDSetResolver(StringIDLayout idLayout)
 {
     IDLayout = idLayout;
 }
示例#4
0
 /// <summary>
 ///     Gets the index of the string within the set.
 /// </summary>
 /// <param name="layout">The stringID layout to use to parse the index.</param>
 /// <returns>The index portion of the stringID.</returns>
 public int GetIndex(StringIDLayout layout)
 {
     return (int) ((Value >> layout.IndexStart) & CreateMask(layout.IndexSize));
 }
示例#5
0
 /// <summary>
 ///     Constructs a new StringID from a set and an index.
 /// </summary>
 /// <param name="set">The set the stringID belongs to.</param>
 /// <param name="index">The index of the stringID within the set.</param>
 /// <param name="layout">The layout of the stringID.</param>
 public StringID(int set, int index, StringIDLayout layout)
     : this(0, set, index, layout)
 {
 }
示例#6
0
 /// <summary>
 ///     Gets the set that the stringID belongs to.
 /// </summary>
 /// <param name="layout">The stringID layout to use to parse the set.</param>
 /// <returns>The set portion of the stringID.</returns>
 public int GetSet(StringIDLayout layout)
 {
     return (int) ((Value >> layout.SetStart) & CreateMask(layout.SetSize));
 }
示例#7
0
 /// <summary>
 ///     Gets the length portion of the stringID. Can be 0 for some games.
 /// </summary>
 /// <param name="layout">The stringID layout to use to parse the length.</param>
 /// <returns>The length portion of the stringID.</returns>
 public int GetLength(StringIDLayout layout)
 {
     return (int) ((Value >> layout.LengthStart) & CreateMask(layout.LengthSize));
 }