All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
106 lines
2.2 KiB
C#
106 lines
2.2 KiB
C#
using System;
|
|
|
|
namespace Decal.Adapter.Wrappers;
|
|
|
|
public class CoordsObject
|
|
{
|
|
private double myNorthSouth;
|
|
|
|
private double myEastWest;
|
|
|
|
public double NorthSouth => myNorthSouth;
|
|
|
|
public double EastWest => myEastWest;
|
|
|
|
public CoordsObject(double northSouth, double eastWest)
|
|
{
|
|
myNorthSouth = northSouth;
|
|
myEastWest = eastWest;
|
|
}
|
|
|
|
public double DistanceToCoords(CoordsObject destination)
|
|
{
|
|
if (destination == null)
|
|
{
|
|
throw new ArgumentNullException("destination");
|
|
}
|
|
double num = myNorthSouth - destination.myNorthSouth;
|
|
double num2 = myEastWest - destination.myEastWest;
|
|
return Math.Sqrt(num * num + num2 * num2);
|
|
}
|
|
|
|
public double AngleToCoords(CoordsObject destination)
|
|
{
|
|
return 180.0 / Math.PI * AngleToCoordsRadians(destination);
|
|
}
|
|
|
|
public double AngleToCoordsRadians(CoordsObject destination)
|
|
{
|
|
if (destination == null)
|
|
{
|
|
throw new ArgumentNullException("destination");
|
|
}
|
|
double num = Math.Atan2(destination.myEastWest - myEastWest, destination.myNorthSouth - myNorthSouth);
|
|
if (num < 0.0)
|
|
{
|
|
num += Math.PI * 2.0;
|
|
}
|
|
return num;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return ToString("0.0");
|
|
}
|
|
|
|
public string ToString(string numberFormat)
|
|
{
|
|
return Math.Abs(myNorthSouth).ToString(numberFormat) + ((myNorthSouth >= 0.0) ? "N" : "S") + ", " + Math.Abs(myEastWest).ToString(numberFormat) + ((myEastWest >= 0.0) ? "E" : "W");
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is CoordsObject)
|
|
{
|
|
CoordsObject coordsObject = (CoordsObject)obj;
|
|
if (coordsObject.myNorthSouth == myNorthSouth)
|
|
{
|
|
return coordsObject.myEastWest == myEastWest;
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public bool Equals(CoordsObject obj)
|
|
{
|
|
if (obj == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (obj.myNorthSouth == myNorthSouth)
|
|
{
|
|
return obj.myEastWest == myEastWest;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return myNorthSouth.GetHashCode() ^ myEastWest.GetHashCode();
|
|
}
|
|
|
|
public static bool operator ==(CoordsObject a, CoordsObject b)
|
|
{
|
|
if (object.Equals(a, null))
|
|
{
|
|
return object.Equals(b, null);
|
|
}
|
|
return a.Equals(b);
|
|
}
|
|
|
|
public static bool operator !=(CoordsObject a, CoordsObject b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
}
|