134 lines
3 KiB
C#
134 lines
3 KiB
C#
using System;
|
|
|
|
namespace Questionable.Model.Questing;
|
|
|
|
public class ExcelRef
|
|
{
|
|
public enum EType
|
|
{
|
|
None,
|
|
Key,
|
|
RowId,
|
|
RawString
|
|
}
|
|
|
|
private readonly string? _stringValue;
|
|
|
|
private readonly uint? _rowIdValue;
|
|
|
|
public EType Type { get; }
|
|
|
|
public ExcelRef(string value)
|
|
{
|
|
_stringValue = value;
|
|
_rowIdValue = null;
|
|
Type = EType.Key;
|
|
}
|
|
|
|
public ExcelRef(uint value)
|
|
{
|
|
_stringValue = null;
|
|
_rowIdValue = value;
|
|
Type = EType.RowId;
|
|
}
|
|
|
|
private ExcelRef(string? stringValue, uint? rowIdValue, EType type)
|
|
{
|
|
_stringValue = stringValue;
|
|
_rowIdValue = rowIdValue;
|
|
Type = type;
|
|
}
|
|
|
|
public static ExcelRef FromKey(string value)
|
|
{
|
|
return new ExcelRef(value, null, EType.Key);
|
|
}
|
|
|
|
public static ExcelRef FromRowId(uint rowId)
|
|
{
|
|
return new ExcelRef(null, rowId, EType.RowId);
|
|
}
|
|
|
|
public static ExcelRef FromSheetValue(string value)
|
|
{
|
|
return new ExcelRef(value, null, EType.RawString);
|
|
}
|
|
|
|
public string AsKey()
|
|
{
|
|
int num = ((Type == EType.Key) ? 50157888 : 50157889);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 50157888;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 2:
|
|
goto IL_0049;
|
|
case 0:
|
|
return _stringValue;
|
|
case 1:
|
|
throw _202A_206D_200F_202D_202D_206E_202B_206A_206B_200E_206A_206D_200B_202B_200F_202D_206D_200F_200E_202D_202A_206F_206D_200F_206B_200F_202A_206A_206B_202E_200B_206C_202B_206B_200C_202D_206D_202D_202D_202E_202E();
|
|
}
|
|
continue;
|
|
IL_0049:
|
|
num = 50157889;
|
|
}
|
|
}
|
|
|
|
public uint AsRowId()
|
|
{
|
|
int num = ((Type == EType.RowId) ? 565255808 : 565255811);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 565255809;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 0:
|
|
goto IL_0049;
|
|
case 1:
|
|
return _rowIdValue.Value;
|
|
case 2:
|
|
throw _202A_206D_200F_202D_202D_206E_202B_206A_206B_200E_206A_206D_200B_202B_200F_202D_206D_200F_200E_202D_202A_206F_206D_200F_206B_200F_202A_206A_206B_202E_200B_206C_202B_206B_200C_202D_206D_202D_202D_202E_202E();
|
|
}
|
|
continue;
|
|
IL_0049:
|
|
num = 565255811;
|
|
}
|
|
}
|
|
|
|
public string AsRawString()
|
|
{
|
|
int num = ((Type == EType.RawString) ? (-1382216459) : (-1382216460));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1382216459;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
return _stringValue;
|
|
case 1:
|
|
throw _202A_206D_200F_202D_202D_206E_202B_206A_206B_200E_206A_206D_200B_202B_200F_202D_206D_200F_200E_202D_202A_206F_206D_200F_206B_200F_202A_206A_206B_202E_200B_206C_202B_206B_200C_202D_206D_202D_202D_202E_202E();
|
|
case 2:
|
|
goto IL_0054;
|
|
}
|
|
continue;
|
|
IL_0054:
|
|
num = -1382216460;
|
|
}
|
|
}
|
|
|
|
static InvalidOperationException _202A_206D_200F_202D_202D_206E_202B_206A_206B_200E_206A_206D_200B_202B_200F_202D_206D_200F_200E_202D_202A_206F_206D_200F_206B_200F_202A_206A_206B_202E_200B_206C_202B_206B_200C_202D_206D_202D_202D_202E_202E()
|
|
{
|
|
return new InvalidOperationException();
|
|
}
|
|
}
|