- Migrate DB to v2 (Channel)

- Add channel selection to DBViewer
This commit is contained in:
Infi
2024-05-22 19:25:36 +02:00
parent 6e0dd15ac0
commit 88fbb24ff0
8 changed files with 176 additions and 32 deletions
+17 -14
View File
@@ -12,45 +12,48 @@ using Lumina.Excel.GeneratedSheets;
namespace ChatTwo;
internal class SortCode {
internal class SortCode
{
internal ChatType Type { get; }
internal ChatSource Source { get; }
[BsonCtor] // Used by LegacyMessageImporter
public SortCode(ChatType type, ChatSource source) {
public SortCode(ChatType type, ChatSource source)
{
Type = type;
Source = source;
}
internal SortCode(uint raw) {
internal SortCode(uint raw)
{
Type = (ChatType)(raw >> 16);
Source = (ChatSource)(raw & 0xFFFF);
}
internal uint Encode() {
internal uint Encode()
{
return ((uint) Type << 16) | (uint) Source;
}
private bool Equals(SortCode other) {
private bool Equals(SortCode other)
{
return Type == other.Type && Source == other.Source;
}
public override bool Equals(object? obj) {
if (ReferenceEquals(null, obj)) {
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj))
return false;
}
if (ReferenceEquals(this, obj)) {
if (ReferenceEquals(this, obj))
return true;
}
return obj.GetType() == GetType() && Equals((SortCode) obj);
}
public override int GetHashCode() {
unchecked {
return ((int) Type * 397) ^ (int) Source;
}
public override int GetHashCode()
{
unchecked { return ((int) Type * 397) ^ (int) Source; }
}
}