2024-01-13 05:24:12 +01:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
2020-05-09 20:45:43 +02:00
|
|
|
namespace GodotTools.IdeMessaging
|
2019-07-18 04:08:24 +02:00
|
|
|
{
|
2020-05-09 20:45:43 +02:00
|
|
|
public readonly struct GodotIdeMetadata
|
2019-07-18 04:08:24 +02:00
|
|
|
{
|
|
|
|
public int Port { get; }
|
|
|
|
public string EditorExecutablePath { get; }
|
|
|
|
|
2020-05-09 20:45:43 +02:00
|
|
|
public const string DefaultFileName = "ide_messaging_meta.txt";
|
|
|
|
|
2019-07-18 04:08:24 +02:00
|
|
|
public GodotIdeMetadata(int port, string editorExecutablePath)
|
|
|
|
{
|
|
|
|
Port = port;
|
|
|
|
EditorExecutablePath = editorExecutablePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool operator ==(GodotIdeMetadata a, GodotIdeMetadata b)
|
|
|
|
{
|
|
|
|
return a.Port == b.Port && a.EditorExecutablePath == b.EditorExecutablePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool operator !=(GodotIdeMetadata a, GodotIdeMetadata b)
|
|
|
|
{
|
|
|
|
return !(a == b);
|
|
|
|
}
|
|
|
|
|
2024-01-13 05:24:12 +01:00
|
|
|
public override bool Equals([NotNullWhen(true)] object? obj)
|
2019-07-18 04:08:24 +02:00
|
|
|
{
|
2022-08-24 14:15:33 +02:00
|
|
|
return obj is GodotIdeMetadata metadata && metadata == this;
|
2019-07-18 04:08:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool Equals(GodotIdeMetadata other)
|
|
|
|
{
|
|
|
|
return Port == other.Port && EditorExecutablePath == other.EditorExecutablePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
|
|
|
unchecked
|
|
|
|
{
|
|
|
|
return (Port * 397) ^ (EditorExecutablePath != null ? EditorExecutablePath.GetHashCode() : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|