powerfun-unity/Assets/Scripts/Devices/Ble/BleHwInterfaceError.cs
2021-06-04 13:22:59 +08:00

78 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ble
{
public class BleHwInterfaceError
{
public int? Code { get; }
// Token: 0x170005C4 RID: 1476
// (get) Token: 0x06001FEE RID: 8174 RVA: 0x00085E0B File Offset: 0x0008400B
public string Domain { get; }
// Token: 0x170005C5 RID: 1477
// (get) Token: 0x06001FEF RID: 8175 RVA: 0x00085E13 File Offset: 0x00084013
public string Description { get; }
// Token: 0x06001FF0 RID: 8176 RVA: 0x00085E1B File Offset: 0x0008401B
public BleHwInterfaceError(int? code, string domain, string description)
{
this.Code = code;
this.Domain = domain;
this.Description = description;
}
// Token: 0x06001FF1 RID: 8177 RVA: 0x00085E38 File Offset: 0x00084038
public BleHwInterfaceError(string description) : this(null, null, description)
{
}
// Token: 0x06001FF2 RID: 8178 RVA: 0x00085E58 File Offset: 0x00084058
public override string ToString()
{
int? code = this.Code;
if (code != null && this.Domain == "WclBleGattClientErrorDomain")
{
string str = "BleHWPluginError:\n";
code = this.Code;
return str + ((code != null) ? code.GetValueOrDefault().ToString() : null) + "\n-Description: " + this.Description;
}
code = this.Code;
if (code != null && this.Domain != null)
{
return string.Format("BleHWPluginError:\n-Domain: {0}\n-Code: {1}\n-Description: {2}", this.Domain, this.Code, this.Description);
}
return "BleHWPluginError:-Description: " + this.Description;
}
// Token: 0x06001FF3 RID: 8179 RVA: 0x00085F08 File Offset: 0x00084108
public static BleHwInterfaceError ParseFromString(string message)
{
string[] array = (message != null) ? message.Split(new char[]
{
'|'
}, 3, StringSplitOptions.RemoveEmptyEntries) : null;
if (array == null || array.Length == 0)
{
return null;
}
int value;
if (array.Length == 3 && int.TryParse(array[1], out value))
{
return new BleHwInterfaceError(new int?(value), array[0], array[2]);
}
return new BleHwInterfaceError(message);
}
// Token: 0x06001FF4 RID: 8180 RVA: 0x00085F64 File Offset: 0x00084164
public override int GetHashCode()
{
return (this.Code.GetHashCode() * 397 ^ ((this.Domain != null) ? this.Domain.GetHashCode() : 0)) * 397 ^ ((this.Description != null) ? this.Description.GetHashCode() : 0);
}
}
}