Initial commit: Complete open-source Decal rebuild
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>
This commit is contained in:
commit
d1442e3747
1382 changed files with 170725 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class AcceptTradeEventArgs : EventArgs
|
||||
{
|
||||
private int mTargetId;
|
||||
|
||||
public int TargetId => mTargetId;
|
||||
|
||||
internal AcceptTradeEventArgs(int TargetId)
|
||||
{
|
||||
mTargetId = TargetId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class AccountCharInfo : MarshalByRefObject
|
||||
{
|
||||
private int myIndex;
|
||||
|
||||
private CharacterFilter myFilter;
|
||||
|
||||
public string Name => myFilter.get_AccountCharName(myIndex);
|
||||
|
||||
public int Id => myFilter.get_AccountCharID(myIndex);
|
||||
|
||||
public int Index => myIndex;
|
||||
|
||||
internal AccountCharInfo(CharacterFilter filter, int index)
|
||||
{
|
||||
myFilter = filter;
|
||||
myIndex = index;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum AddRemoveEventType
|
||||
{
|
||||
Add,
|
||||
Delete
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class AddTradeItemEventArgs : EventArgs
|
||||
{
|
||||
private int mItemId;
|
||||
|
||||
private int mSideId;
|
||||
|
||||
public int ItemId => mItemId;
|
||||
|
||||
public int SideId => mSideId;
|
||||
|
||||
internal AddTradeItemEventArgs(int ItemId, int SideId)
|
||||
{
|
||||
mItemId = ItemId;
|
||||
mSideId = SideId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class AllegianceInfoWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private AllegianceInfo myAllegianceInfo;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
public int Id => myAllegianceInfo.GUID;
|
||||
|
||||
public int Gender => myAllegianceInfo.Gender;
|
||||
|
||||
public int Leadership => myAllegianceInfo.Leadership;
|
||||
|
||||
public int Loyalty => myAllegianceInfo.Loyalty;
|
||||
|
||||
public string Name => myAllegianceInfo.Name;
|
||||
|
||||
public int Race => myAllegianceInfo.Race;
|
||||
|
||||
public int Rank => myAllegianceInfo.Rank;
|
||||
|
||||
public int ParentId => myAllegianceInfo.TreeParent;
|
||||
|
||||
public int Type => myAllegianceInfo.Type;
|
||||
|
||||
public double Unknown => myAllegianceInfo.Unknown;
|
||||
|
||||
public long XP => myAllegianceInfo.XP_64;
|
||||
|
||||
internal AllegianceInfoWrapper(AllegianceInfo info)
|
||||
{
|
||||
myAllegianceInfo = info;
|
||||
}
|
||||
|
||||
~AllegianceInfoWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myAllegianceInfo != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myAllegianceInfo);
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
protected void EnforceDisposedOnce()
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("AllegianceInfoWrapper");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ApproachVendorEventArgs : EventArgs
|
||||
{
|
||||
private int mMerchantId;
|
||||
|
||||
private Vendor vendor;
|
||||
|
||||
public int MerchantId => mMerchantId;
|
||||
|
||||
public Vendor Vendor => vendor;
|
||||
|
||||
internal ApproachVendorEventArgs(int MerchantId, Vendor ven)
|
||||
{
|
||||
mMerchantId = MerchantId;
|
||||
vendor = ven;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class AttributeInfoWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private AttributeInfo myAttribInfo;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
public int Base => myAttribInfo.Base;
|
||||
|
||||
public int Buffed => myAttribInfo.Buffed;
|
||||
|
||||
public int Creation => myAttribInfo.Creation;
|
||||
|
||||
public int Exp => myAttribInfo.Exp;
|
||||
|
||||
public string Name => myAttribInfo.Name;
|
||||
|
||||
internal AttributeInfoWrapper(AttributeInfo info)
|
||||
{
|
||||
myAttribInfo = info;
|
||||
}
|
||||
|
||||
~AttributeInfoWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myAttribInfo != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myAttribInfo);
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
protected void EnforceDisposedOnce()
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("AttributeInfoWrapper");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum AttributeType
|
||||
{
|
||||
CurrentStrength = 1,
|
||||
CurrentEndurance,
|
||||
CurrentQuickness,
|
||||
CurrentCoordination,
|
||||
CurrentFocus,
|
||||
CurrentSelf,
|
||||
BaseStrength,
|
||||
BaseEndurance,
|
||||
BaseQuickness,
|
||||
BaseCoordination,
|
||||
BaseFocus,
|
||||
BaseSelf
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum Augmentations
|
||||
{
|
||||
ReinforcementLugians = 218,
|
||||
BleearghFortitude = 219,
|
||||
OswaldEnchancement = 220,
|
||||
SiraluunBlessing = 221,
|
||||
EnduringCalm = 222,
|
||||
SteadfastWill = 223,
|
||||
CiandraEssence = 224,
|
||||
YoshiEssence = 225,
|
||||
JibrilEssence = 226,
|
||||
CeldisethEssence = 227,
|
||||
KogaEssence = 228,
|
||||
ShadowSeventhMule = 229,
|
||||
MightSeventhMule = 230,
|
||||
ClutchMiser = 231,
|
||||
EnduringEnchantment = 232,
|
||||
CriticalProtection = 233,
|
||||
QuickLearner = 234,
|
||||
CiandraFortune = 235,
|
||||
CharmedSmith = 236,
|
||||
InnateRenewal = 237,
|
||||
ArchmageEndurance = 238,
|
||||
BladeTurner = 240,
|
||||
ArrowTurner = 241,
|
||||
MaceTurner = 242,
|
||||
CausticEnhancement = 243,
|
||||
FieryEnchancment = 244,
|
||||
IcyEnchancement = 245,
|
||||
LightningEnhancement = 246,
|
||||
InfusedCreature = 294,
|
||||
InfusedItem = 295,
|
||||
InfusedLife = 296,
|
||||
InfusedWar = 297,
|
||||
EyeRemorseless = 298,
|
||||
HandRemorseless = 299,
|
||||
MasterSteelCircle = 300,
|
||||
MasterFocusedEyed = 301,
|
||||
MasterFiveFoldPath = 302,
|
||||
FrenzySlayer = 309,
|
||||
IronSkinInvincible = 310,
|
||||
JackOfAllTrades = 326,
|
||||
InfusedVoid = 328,
|
||||
[Obsolete("Use InfusedVoid")]
|
||||
UnknownAug1 = 328,
|
||||
[Obsolete("Not an aug")]
|
||||
UnknownAug2 = 329,
|
||||
[Obsolete("Not an aug")]
|
||||
UnknownAug3 = 330,
|
||||
[Obsolete("Not an aug")]
|
||||
UnknownAug4 = 331,
|
||||
[Obsolete("Not an aug")]
|
||||
UnknownAug5 = 332,
|
||||
AuraValor = 333,
|
||||
AuraProtection = 334,
|
||||
AuraGlory = 335,
|
||||
AuraTemperance = 336,
|
||||
AuraSurge = 337,
|
||||
[Obsolete("Not an aug")]
|
||||
UnknownAug6 = 337,
|
||||
AuraAethericVision = 338,
|
||||
AuraManaFlow = 339,
|
||||
AuraManaInfusion = 340,
|
||||
[Obsolete("Use AuraManaInfusion")]
|
||||
UnknownAug7 = 340,
|
||||
AuraVitality = 341,
|
||||
[Obsolete("Use AuraVitality")]
|
||||
UnknownAug8 = 341,
|
||||
AuraPurity = 342,
|
||||
AuraCraftsman = 343,
|
||||
AuraSpecialization = 344,
|
||||
AuraWorld = 365
|
||||
}
|
||||
29
Managed/Decal.Adapter/Decal.Adapter.Wrappers/Background.cs
Normal file
29
Managed/Decal.Adapter/Decal.Adapter.Wrappers/Background.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using Decal.Interop.Render;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class Background : HudRenderTarget
|
||||
{
|
||||
private HUDBackground internalBackground;
|
||||
|
||||
internal HUDBackground Underlying => internalBackground;
|
||||
|
||||
internal Background(HUDBackground background)
|
||||
: base(background)
|
||||
{
|
||||
internalBackground = background;
|
||||
}
|
||||
|
||||
public Background Clone()
|
||||
{
|
||||
return new Background(internalBackground.Clone());
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
internalBackground = null;
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
16
Managed/Decal.Adapter/Decal.Adapter.Wrappers/BoolValueKey.cs
Normal file
16
Managed/Decal.Adapter/Decal.Adapter.Wrappers/BoolValueKey.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public enum BoolValueKey
|
||||
{
|
||||
Lockable = 201326592,
|
||||
Inscribable = 201326593,
|
||||
Open = 2,
|
||||
Locked = 3,
|
||||
HookVisibility = 24,
|
||||
UnlimitedUses = 63,
|
||||
CanBeSold = 69,
|
||||
Retained = 91,
|
||||
Ivoryable = 99,
|
||||
Dyeable = 100,
|
||||
AwayFromKeyboard = 110
|
||||
}
|
||||
229
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ButtonWrapper.cs
Normal file
229
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ButtonWrapper.cs
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Inject;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ButtonWrapper : ControlWrapperBase<ButtonClass>
|
||||
{
|
||||
private EventHandler<ControlEventArgs> evtClick;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtCancel;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtDestroy;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtHit;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtUnhit;
|
||||
|
||||
private int myBackground;
|
||||
|
||||
public Color Matte
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.ColorFromBGR(base.Control.Matte);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.Matte = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public int Background
|
||||
{
|
||||
get
|
||||
{
|
||||
return myBackground;
|
||||
}
|
||||
set
|
||||
{
|
||||
myBackground = value;
|
||||
base.Control.SetBackground(myBackground);
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Click
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtClick == null)
|
||||
{
|
||||
base.Control.Accepted += ClickEvent;
|
||||
}
|
||||
evtClick = (EventHandler<ControlEventArgs>)Delegate.Combine(evtClick, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtClick = (EventHandler<ControlEventArgs>)Delegate.Remove(evtClick, value);
|
||||
if (evtClick == null)
|
||||
{
|
||||
base.Control.Accepted -= ClickEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Canceled
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtCancel == null)
|
||||
{
|
||||
base.Control.Canceled += CanceledEvent;
|
||||
}
|
||||
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Combine(evtCancel, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Remove(evtCancel, value);
|
||||
if (evtCancel == null)
|
||||
{
|
||||
base.Control.Canceled -= CanceledEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Destroy
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy += DestroyEvent;
|
||||
}
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Hit
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtHit == null)
|
||||
{
|
||||
base.Control.Hit += HitEvent;
|
||||
}
|
||||
evtHit = (EventHandler<ControlEventArgs>)Delegate.Combine(evtHit, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtHit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtHit, value);
|
||||
if (evtHit == null)
|
||||
{
|
||||
base.Control.Hit -= HitEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Unhit
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtUnhit == null)
|
||||
{
|
||||
base.Control.Unhit += UnhitEvent;
|
||||
}
|
||||
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Combine(evtUnhit, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtUnhit, value);
|
||||
if (evtUnhit == null)
|
||||
{
|
||||
base.Control.Unhit -= UnhitEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (evtClick != null)
|
||||
{
|
||||
evtClick = (EventHandler<ControlEventArgs>)Delegate.Remove(evtClick, evtClick);
|
||||
base.Control.Accepted -= ClickEvent;
|
||||
}
|
||||
if (evtCancel != null)
|
||||
{
|
||||
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Remove(evtCancel, evtCancel);
|
||||
base.Control.Canceled -= CanceledEvent;
|
||||
}
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
if (evtHit != null)
|
||||
{
|
||||
evtHit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtHit, evtHit);
|
||||
base.Control.Hit -= HitEvent;
|
||||
}
|
||||
if (evtUnhit != null)
|
||||
{
|
||||
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtUnhit, evtUnhit);
|
||||
base.Control.Unhit -= UnhitEvent;
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public void SetImages(int released, int pressed)
|
||||
{
|
||||
SetImages(0, released, pressed);
|
||||
}
|
||||
|
||||
public void SetImages(int module, int released, int pressed)
|
||||
{
|
||||
base.Control.SetImages(module, released, pressed);
|
||||
}
|
||||
|
||||
private void ClickEvent(int ID)
|
||||
{
|
||||
if (evtClick != null)
|
||||
{
|
||||
evtClick(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void UnhitEvent(int ID)
|
||||
{
|
||||
if (evtUnhit != null)
|
||||
{
|
||||
evtUnhit(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void HitEvent(int ID)
|
||||
{
|
||||
if (evtHit != null)
|
||||
{
|
||||
evtHit(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyEvent(int ID)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void CanceledEvent(int ID)
|
||||
{
|
||||
if (evtCancel != null)
|
||||
{
|
||||
evtCancel(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ByAllFilter.cs
Normal file
16
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ByAllFilter.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByAllFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByAll();
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
|
||||
{
|
||||
ven.ByAll();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByCategoryFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
private int category;
|
||||
|
||||
public int Category
|
||||
{
|
||||
get
|
||||
{
|
||||
return category;
|
||||
}
|
||||
set
|
||||
{
|
||||
category = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ByCategoryFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public ByCategoryFilter(int category)
|
||||
{
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByCategory(category);
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
|
||||
{
|
||||
ven.ByCategory(category);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByContainerFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
private int container;
|
||||
|
||||
public int Container
|
||||
{
|
||||
get
|
||||
{
|
||||
return container;
|
||||
}
|
||||
set
|
||||
{
|
||||
container = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ByContainerFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public ByContainerFilter(int container)
|
||||
{
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByContainer(container);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByInventoryFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByInventory();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByLandscapeFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByLandscape();
|
||||
}
|
||||
}
|
||||
39
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ByNameFilter.cs
Normal file
39
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ByNameFilter.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByNameFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
private string name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return name;
|
||||
}
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ByNameFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public ByNameFilter(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByName(name);
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
|
||||
{
|
||||
ven.ByName(name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByNameSubStringFilter : ByNameFilter
|
||||
{
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByNameSubstring(base.Name);
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
|
||||
{
|
||||
ven.ByNameSubstring(base.Name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByObjectClassFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
private ObjectClass objClass;
|
||||
|
||||
public ObjectClass ObjectClass
|
||||
{
|
||||
get
|
||||
{
|
||||
return objClass;
|
||||
}
|
||||
set
|
||||
{
|
||||
objClass = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ByObjectClassFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public ByObjectClassFilter(ObjectClass objClass)
|
||||
{
|
||||
this.objClass = objClass;
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByObjectClass((eObjectClass)objClass);
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
|
||||
{
|
||||
ven.ByObjectClass((eObjectClass)objClass);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ByOwnerFilter : WorldObjectCollectionFilter
|
||||
{
|
||||
private int owner;
|
||||
|
||||
public int Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
set
|
||||
{
|
||||
owner = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ByOwnerFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public ByOwnerFilter(int owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
internal override void ApplyFilter(WorldIterator wi)
|
||||
{
|
||||
wi.ByOwner(owner);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum CastEventType
|
||||
{
|
||||
Untargetted,
|
||||
Targetted
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeEnchantmentsEventArgs : EventArgs
|
||||
{
|
||||
private AddRemoveEventType myType;
|
||||
|
||||
private EnchantmentWrapper myEnchantment;
|
||||
|
||||
public AddRemoveEventType Type => myType;
|
||||
|
||||
public EnchantmentWrapper Enchantment => myEnchantment;
|
||||
|
||||
internal ChangeEnchantmentsEventArgs(AddRemoveEventType type, EnchantmentWrapper enchantment)
|
||||
{
|
||||
myType = type;
|
||||
myEnchantment = enchantment;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeExperienceEventArgs : EventArgs
|
||||
{
|
||||
private PlayerXPEventType myType;
|
||||
|
||||
private int myAmount;
|
||||
|
||||
public PlayerXPEventType Type => myType;
|
||||
|
||||
public int Amount => myAmount;
|
||||
|
||||
internal ChangeExperienceEventArgs(PlayerXPEventType type, int amount)
|
||||
{
|
||||
myType = type;
|
||||
myAmount = amount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeFellowshipEventArgs : EventArgs
|
||||
{
|
||||
private FellowshipEventType myType;
|
||||
|
||||
private int myId;
|
||||
|
||||
public FellowshipEventType Type => myType;
|
||||
|
||||
public int Id => myId;
|
||||
|
||||
internal ChangeFellowshipEventArgs(FellowshipEventType type, int Id)
|
||||
{
|
||||
myType = type;
|
||||
myId = Id;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeObjectEventArgs : EventArgs
|
||||
{
|
||||
private WorldObject myChangedObject;
|
||||
|
||||
private WorldChangeType myChangeType;
|
||||
|
||||
public WorldObject Changed => myChangedObject;
|
||||
|
||||
public WorldChangeType Change => myChangeType;
|
||||
|
||||
internal ChangeObjectEventArgs(WorldObject changedObject, Decal.Interop.Filters.WorldChangeType changeType)
|
||||
{
|
||||
myChangedObject = changedObject;
|
||||
myChangeType = (WorldChangeType)changeType;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeOptionEventArgs : EventArgs
|
||||
{
|
||||
private int myOption;
|
||||
|
||||
private int myValue;
|
||||
|
||||
public int Option => myOption;
|
||||
|
||||
public int Value => myValue;
|
||||
|
||||
internal ChangeOptionEventArgs(int option, int value)
|
||||
{
|
||||
myOption = option;
|
||||
myValue = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangePlayerEventArgs : EventArgs
|
||||
{
|
||||
private PlayerModifyEventType myType;
|
||||
|
||||
private int myStat;
|
||||
|
||||
public PlayerModifyEventType Type => myType;
|
||||
|
||||
public int Stat => myStat;
|
||||
|
||||
internal ChangePlayerEventArgs(PlayerModifyEventType type, int Stat)
|
||||
{
|
||||
myType = type;
|
||||
myStat = Stat;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangePortalModeEventArgs : EventArgs
|
||||
{
|
||||
private PortalEventType myType;
|
||||
|
||||
public PortalEventType Type => myType;
|
||||
|
||||
internal ChangePortalModeEventArgs(PortalEventType type)
|
||||
{
|
||||
myType = type;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeSettingsFlagsEventArgs : EventArgs
|
||||
{
|
||||
private int mySettings;
|
||||
|
||||
public int Settings => mySettings;
|
||||
|
||||
internal ChangeSettingsFlagsEventArgs(int settings)
|
||||
{
|
||||
mySettings = settings;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeShortcutEventArgs : EventArgs
|
||||
{
|
||||
private AddRemoveEventType myType;
|
||||
|
||||
private int mySlot;
|
||||
|
||||
private int myObjectId;
|
||||
|
||||
public AddRemoveEventType Type => myType;
|
||||
|
||||
public int Slot => mySlot;
|
||||
|
||||
public int ObjectId => myObjectId;
|
||||
|
||||
internal ChangeShortcutEventArgs(AddRemoveEventType type, int Slot, int ObjectId)
|
||||
{
|
||||
myType = type;
|
||||
mySlot = Slot;
|
||||
myObjectId = ObjectId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeSpellbarEventArgs : EventArgs
|
||||
{
|
||||
private AddRemoveEventType myType;
|
||||
|
||||
private int myTab;
|
||||
|
||||
private int mySlot;
|
||||
|
||||
private int mySpellId;
|
||||
|
||||
public AddRemoveEventType Type => myType;
|
||||
|
||||
public int Tab => myTab;
|
||||
|
||||
public int Slot => mySlot;
|
||||
|
||||
public int SpellId => mySpellId;
|
||||
|
||||
internal ChangeSpellbarEventArgs(AddRemoveEventType type, int Tab, int Slot, int SpellId)
|
||||
{
|
||||
myType = type;
|
||||
myTab = Tab;
|
||||
mySlot = Slot;
|
||||
mySpellId = SpellId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChangeVitalEventArgs : EventArgs
|
||||
{
|
||||
private CharFilterVitalType myType;
|
||||
|
||||
private int myAmount;
|
||||
|
||||
public CharFilterVitalType Type => myType;
|
||||
|
||||
public int Amount => myAmount;
|
||||
|
||||
internal ChangeVitalEventArgs(CharFilterVitalType type, int amount)
|
||||
{
|
||||
myType = type;
|
||||
myAmount = amount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum CharFilterAttributeType
|
||||
{
|
||||
Strength = 1,
|
||||
Endurance,
|
||||
Quickness,
|
||||
Coordination,
|
||||
Focus,
|
||||
Self
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public enum CharFilterIndex
|
||||
{
|
||||
Vassals,
|
||||
Enchantments,
|
||||
Vitals,
|
||||
Attributes,
|
||||
Skills,
|
||||
Characters,
|
||||
Spells,
|
||||
Augmentations,
|
||||
EffectiveAttributes,
|
||||
EffectiveVitals,
|
||||
EffectiveSkills
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum CharFilterSkillType
|
||||
{
|
||||
Axe = 1,
|
||||
Bow = 2,
|
||||
Crossbow = 3,
|
||||
Dagger = 4,
|
||||
Mace = 5,
|
||||
MeleeDefense = 6,
|
||||
MissileDefense = 7,
|
||||
Spear = 9,
|
||||
Staff = 10,
|
||||
Sword = 11,
|
||||
ThrownWeapons = 12,
|
||||
Unarmed = 13,
|
||||
ArcaneLore = 14,
|
||||
MagicDefense = 15,
|
||||
ManaConversion = 16,
|
||||
ItemTinkering = 18,
|
||||
AssessPerson = 19,
|
||||
Deception = 20,
|
||||
Healing = 21,
|
||||
Jump = 22,
|
||||
Lockpick = 23,
|
||||
Run = 24,
|
||||
AssessCreature = 27,
|
||||
WeaponTinkering = 28,
|
||||
ArmorTinkering = 29,
|
||||
MagicItemTinkering = 30,
|
||||
CreatureEnchantment = 31,
|
||||
ItemEnchantment = 32,
|
||||
LifeMagic = 33,
|
||||
WarMagic = 34,
|
||||
Leadership = 35,
|
||||
Loyalty = 36,
|
||||
Fletching = 37,
|
||||
Alchemy = 38,
|
||||
Cooking = 39,
|
||||
Salvaging = 40,
|
||||
TwoHandedCombat = 41,
|
||||
Gearcraft = 42,
|
||||
VoidMagic = 43,
|
||||
HeavyWeapons = 44,
|
||||
LightWeapons = 45,
|
||||
FinesseWeapons = 46,
|
||||
MissileWeapons = 47,
|
||||
Shield = 48,
|
||||
DualWield = 49,
|
||||
Recklessness = 50,
|
||||
SneakAttack = 51,
|
||||
DirtyFighting = 52,
|
||||
Summoning = 54
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum CharFilterVitalType
|
||||
{
|
||||
Health = 2,
|
||||
Stamina = 4,
|
||||
Mana = 6
|
||||
}
|
||||
1173
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CharacterFilter.cs
Normal file
1173
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CharacterFilter.cs
Normal file
File diff suppressed because it is too large
Load diff
135
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CheckBoxWrapper.cs
Normal file
135
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CheckBoxWrapper.cs
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class CheckBoxWrapper : ControlWrapperBase<CheckboxClass>
|
||||
{
|
||||
private EventHandler<ControlEventArgs> evtDestroy;
|
||||
|
||||
private EventHandler<CheckBoxChangeEventArgs> evtChange;
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.Checked;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.Checked = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool RightToLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.RightToLeft;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.RightToLeft = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color TextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.ColorFromBGR(base.Control.TextColor);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.TextColor = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<CheckBoxChangeEventArgs> Change
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtChange == null)
|
||||
{
|
||||
base.Control.Change += ChangeEvent;
|
||||
}
|
||||
evtChange = (EventHandler<CheckBoxChangeEventArgs>)Delegate.Combine(evtChange, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtChange = (EventHandler<CheckBoxChangeEventArgs>)Delegate.Remove(evtChange, value);
|
||||
if (evtChange == null)
|
||||
{
|
||||
base.Control.Change -= ChangeEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Destroy
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy += DestroyEvent;
|
||||
}
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (evtChange != null)
|
||||
{
|
||||
evtChange = (EventHandler<CheckBoxChangeEventArgs>)Delegate.Remove(evtChange, evtChange);
|
||||
base.Control.Change -= ChangeEvent;
|
||||
}
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void ChangeEvent(int ID, bool Checked)
|
||||
{
|
||||
if (evtChange != null)
|
||||
{
|
||||
evtChange(this, new CheckBoxChangeEventArgs(ID, Checked));
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyEvent(int ID)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public sealed class ChoiceDataIndexer : IDisposable
|
||||
{
|
||||
private Choice myControl;
|
||||
|
||||
public object this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((dynamic)(IChoice)myControl).get_Data(index);
|
||||
}
|
||||
set
|
||||
{
|
||||
((dynamic)(IChoice)myControl).set_Data(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
internal ChoiceDataIndexer(Choice control)
|
||||
{
|
||||
myControl = control;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Marshal.ReleaseComObject(myControl);
|
||||
myControl = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public sealed class ChoiceTextIndexer : IDisposable
|
||||
{
|
||||
private Choice myControl;
|
||||
|
||||
public string this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((dynamic)(IChoice)myControl).get_Text(index);
|
||||
}
|
||||
set
|
||||
{
|
||||
((dynamic)(IChoice)myControl).set_Text(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
internal ChoiceTextIndexer(Choice control)
|
||||
{
|
||||
myControl = control;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
myControl = null;
|
||||
}
|
||||
}
|
||||
191
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ChoiceWrapper.cs
Normal file
191
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ChoiceWrapper.cs
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
using System;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ChoiceWrapper : ControlWrapperBase<ChoiceClass>
|
||||
{
|
||||
private EventHandler<ControlEventArgs> evtDropDown;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtDestroy;
|
||||
|
||||
private EventHandler<IndexChangeEventArgs> evtChange;
|
||||
|
||||
private ChoiceTextIndexer myTextIndex;
|
||||
|
||||
private ChoiceDataIndexer myDataIndex;
|
||||
|
||||
public int Count => base.Control.ChoiceCount;
|
||||
|
||||
public int DropLines
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.DropLines;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.DropLines = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Dropped
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.Dropped;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.Dropped = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Selected
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.Selected;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.Selected = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ChoiceTextIndexer Text => myTextIndex;
|
||||
|
||||
public ChoiceDataIndexer Data => myDataIndex;
|
||||
|
||||
public event EventHandler<ControlEventArgs> DropDown
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDropDown == null)
|
||||
{
|
||||
base.Control.DropDown += DropDownEvent;
|
||||
}
|
||||
evtDropDown = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDropDown, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDropDown = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDropDown, value);
|
||||
if (evtDropDown == null)
|
||||
{
|
||||
base.Control.DropDown -= DropDownEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Destroy
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy += DestroyEvent;
|
||||
}
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<IndexChangeEventArgs> Change
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtChange == null)
|
||||
{
|
||||
base.Control.Change += ChangeEvent;
|
||||
}
|
||||
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Combine(evtChange, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Remove(evtChange, value);
|
||||
if (evtChange == null)
|
||||
{
|
||||
base.Control.Change -= ChangeEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public override void Initialize(object control)
|
||||
{
|
||||
base.Initialize(control);
|
||||
myTextIndex = new ChoiceTextIndexer(base.Control);
|
||||
myDataIndex = new ChoiceDataIndexer(base.Control);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (evtDropDown != null)
|
||||
{
|
||||
evtDropDown = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDropDown, evtDropDown);
|
||||
base.Control.DropDown -= DropDownEvent;
|
||||
}
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
if (evtChange != null)
|
||||
{
|
||||
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Remove(evtChange, evtChange);
|
||||
base.Control.Change -= ChangeEvent;
|
||||
}
|
||||
myTextIndex.Dispose();
|
||||
myDataIndex.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public void Add(string display, object data)
|
||||
{
|
||||
base.Control.AddChoice(display, data);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
base.Control.Clear();
|
||||
}
|
||||
|
||||
public void Remove(int index)
|
||||
{
|
||||
base.Control.RemoveChoice(index);
|
||||
}
|
||||
|
||||
private void DropDownEvent(int ID)
|
||||
{
|
||||
if (evtDropDown != null)
|
||||
{
|
||||
evtDropDown(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeEvent(int ID, int Index)
|
||||
{
|
||||
if (evtChange != null)
|
||||
{
|
||||
evtChange(this, new IndexChangeEventArgs(ID, Index));
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyEvent(int ID)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CombatState.cs
Normal file
12
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CombatState.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum CombatState
|
||||
{
|
||||
Peace = 1,
|
||||
Melee = 2,
|
||||
Missile = 4,
|
||||
Magic = 8
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Inject;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public static class ControlRegistry
|
||||
{
|
||||
private static Dictionary<Type, Type> myWrappers;
|
||||
|
||||
static ControlRegistry()
|
||||
{
|
||||
if (myWrappers == null)
|
||||
{
|
||||
myWrappers = new Dictionary<Type, Type>();
|
||||
RegisterControls(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
}
|
||||
|
||||
public static void RegisterControls(Assembly assembly)
|
||||
{
|
||||
Type[] types = assembly.GetTypes();
|
||||
foreach (Type type in types)
|
||||
{
|
||||
try
|
||||
{
|
||||
Type baseType = type.BaseType;
|
||||
if (!(baseType == null) && baseType.IsGenericType && baseType.GetGenericTypeDefinition() == typeof(ControlWrapperBase<>))
|
||||
{
|
||||
Type key = baseType.GetGenericArguments()[0];
|
||||
myWrappers.Add(key, type);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.WriteLine("RegisterControls: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static IControlWrapper CreateInstance(IControl control)
|
||||
{
|
||||
Util.WriteLine("Creating wrapper for: " + control.GetType());
|
||||
Type value;
|
||||
IControlWrapper controlWrapper = ((!myWrappers.TryGetValue(control.GetType(), out value)) ? new ControlWrapper() : ((IControlWrapper)Activator.CreateInstance(value)));
|
||||
controlWrapper.Initialize(control);
|
||||
return controlWrapper;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
using Decal.Interop.Inject;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ControlWrapper : ControlWrapperBase<IControl>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Inject;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public abstract class ControlWrapperBase<T> : MarshalByRefObject, IControlWrapper, IDisposable where T : class
|
||||
{
|
||||
private T myControl;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public object Underlying => myControl;
|
||||
|
||||
public int Id => ((IControl)myControl).ID;
|
||||
|
||||
public int ChildCount => ((IControl)myControl).ChildCount;
|
||||
|
||||
protected bool Disposed => isDisposed;
|
||||
|
||||
protected T Control => myControl;
|
||||
|
||||
~ControlWrapperBase()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public virtual void Initialize(object control)
|
||||
{
|
||||
myControl = control as T;
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public object ChildById(int id)
|
||||
{
|
||||
return ((dynamic)(IControl)myControl).get_Child(id, ePositionType.ePositionByID);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public object ChildByIndex(int index)
|
||||
{
|
||||
return ((dynamic)(IControl)myControl).get_Child(index, ePositionType.ePositionByIndex);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myControl != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myControl);
|
||||
myControl = null;
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
}
|
||||
106
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CoordsObject.cs
Normal file
106
Managed/Decal.Adapter/Decal.Adapter.Wrappers/CoordsObject.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class CreateObjectEventArgs : EventArgs
|
||||
{
|
||||
private WorldObject myNewObject;
|
||||
|
||||
public WorldObject New => myNewObject;
|
||||
|
||||
internal CreateObjectEventArgs(WorldObject newObject)
|
||||
{
|
||||
myNewObject = newObject;
|
||||
}
|
||||
}
|
||||
289
Managed/Decal.Adapter/Decal.Adapter.Wrappers/D3DObj.cs
Normal file
289
Managed/Decal.Adapter/Decal.Adapter.Wrappers/D3DObj.cs
Normal file
|
|
@ -0,0 +1,289 @@
|
|||
using Decal.Interop.D3DService;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class D3DObj : GenericDisposableWrapper<CD3DObj>
|
||||
{
|
||||
public int Color
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.color;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.color = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Color2
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.color2;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.color2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Autoscale
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.autoscale;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.autoscale = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DrawBackface
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.drawBackface;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.drawBackface = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float HBounce
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.hBounce;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.hBounce = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PBounce
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.pBounce;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.pBounce = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PFade
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.pFade;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.pFade = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float POrbit
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.pOrbit;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.pOrbit = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PSpin
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.pSpin;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.pSpin = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float ROrbit
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.rOrbit;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.rOrbit = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float ScaleX
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.scaleX;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.scaleX = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float ScaleY
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.scaleY;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.scaleY = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float ScaleZ
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.scaleZ;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.scaleZ = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.visible;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.visible = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float AnimationPhaseOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Wrapped.AnimationPhaseOffset;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Wrapped.AnimationPhaseOffset = value;
|
||||
}
|
||||
}
|
||||
|
||||
public D3DObj(CD3DObj obj)
|
||||
: base(obj)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Dispose(bool userCalled)
|
||||
{
|
||||
base.Dispose(userCalled);
|
||||
}
|
||||
|
||||
public void Scale(float factor)
|
||||
{
|
||||
base.Wrapped.SetScale(factor);
|
||||
}
|
||||
|
||||
public void OrientToCamera(bool verticalTilt)
|
||||
{
|
||||
base.Wrapped.OrientToCamera(verticalTilt);
|
||||
}
|
||||
|
||||
public void OrientToCoords(float lat, float lng, float alt, bool verticalTilt)
|
||||
{
|
||||
base.Wrapped.OrientToCoords(lat, lng, alt, verticalTilt);
|
||||
}
|
||||
|
||||
public void OrientToObject(int guid, float fractHeight, bool verticalTilt)
|
||||
{
|
||||
base.Wrapped.OrientToObject(guid, fractHeight, verticalTilt);
|
||||
}
|
||||
|
||||
public void OrientToPlayer(bool verticalTilt)
|
||||
{
|
||||
base.Wrapped.OrientToPlayer(verticalTilt);
|
||||
}
|
||||
|
||||
public void Anchor(float lat, float lng, float alt)
|
||||
{
|
||||
base.Wrapped.AnchorToCoords(lat, lng, alt);
|
||||
}
|
||||
|
||||
public void Anchor(int id, float height, float dx, float dy, float dz)
|
||||
{
|
||||
base.Wrapped.AnchorToObject(id, height, dx, dy, dz);
|
||||
}
|
||||
|
||||
public void SetText(string text)
|
||||
{
|
||||
SetText(D3DTextType.Text2D, text, "Arial", 0);
|
||||
}
|
||||
|
||||
public void SetText(string text, string fontName)
|
||||
{
|
||||
SetText(D3DTextType.Text2D, text, fontName, 0);
|
||||
}
|
||||
|
||||
public void SetText(string text, string fontName, int options)
|
||||
{
|
||||
SetText(D3DTextType.Text2D, text, fontName, options);
|
||||
}
|
||||
|
||||
public void SetText(D3DTextType type, string text, string fontName, int options)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case D3DTextType.Text2D:
|
||||
base.Wrapped.Set2DText(text, fontName, options);
|
||||
break;
|
||||
case D3DTextType.Text3D:
|
||||
base.Wrapped.Set3DText(text, fontName, options);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetIcon(int id)
|
||||
{
|
||||
base.Wrapped.SetIcon(id);
|
||||
}
|
||||
|
||||
public void SetIcon(string fileName)
|
||||
{
|
||||
base.Wrapped.SetIconFromFile(fileName);
|
||||
}
|
||||
|
||||
public void SetIcon(int module, int res)
|
||||
{
|
||||
base.Wrapped.SetIconFromResource(module, res);
|
||||
}
|
||||
|
||||
public void SetShape(D3DShape shape)
|
||||
{
|
||||
base.Wrapped.SetShape((eShape)shape);
|
||||
}
|
||||
|
||||
public void SetShape(string fileName)
|
||||
{
|
||||
base.Wrapped.SetShapeFromFile(fileName);
|
||||
}
|
||||
|
||||
public void SetShape(int module, int res)
|
||||
{
|
||||
base.Wrapped.SetShapeFromResource(module, res);
|
||||
}
|
||||
}
|
||||
86
Managed/Decal.Adapter/Decal.Adapter.Wrappers/D3DService.cs
Normal file
86
Managed/Decal.Adapter/Decal.Adapter.Wrappers/D3DService.cs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
using Decal.Interop.D3DService;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class D3DService : GenericDisposableWrapper<CService>
|
||||
{
|
||||
internal D3DService(CService obj)
|
||||
: base(obj)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Dispose(bool userCalled)
|
||||
{
|
||||
base.Dispose(userCalled);
|
||||
}
|
||||
|
||||
public D3DObj NewD3DObj()
|
||||
{
|
||||
return new D3DObj(base.Wrapped.NewD3DObj());
|
||||
}
|
||||
|
||||
public D3DObj PointToObject(int guid, int color)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.PointToObject(guid, color));
|
||||
}
|
||||
|
||||
public D3DObj PointToCoords(float lat, float lng, float alt, int color)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.PointToCoords(lat, lng, alt, color));
|
||||
}
|
||||
|
||||
public D3DObj MarkObjectWithIcon(int guid, int icon)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkObjectWithIcon(guid, icon));
|
||||
}
|
||||
|
||||
public D3DObj MarkObjectWithShape(int guid, D3DShape shape, int color)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkObjectWithShape(guid, (eShape)shape, color));
|
||||
}
|
||||
|
||||
public D3DObj MarkObjectWithShapeFromFile(int guid, string filename, int color)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkObjectWithShapeFromFile(guid, filename, color));
|
||||
}
|
||||
|
||||
public D3DObj MarkObjectWith2DText(int guid, string szText, string szFont, int options)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkObjectWith2DText(guid, szText, szFont, options));
|
||||
}
|
||||
|
||||
public D3DObj MarkObjectWith3DText(int guid, string szText, string szFont, int options)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkObjectWith3DText(guid, szText, szFont, options));
|
||||
}
|
||||
|
||||
public D3DObj MarkCoordsWithIcon(float lat, float lng, float alt, int icon)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkCoordsWithIcon(lat, lng, alt, icon));
|
||||
}
|
||||
|
||||
public D3DObj MarkCoordsWithIconFromFile(float lat, float lng, float alt, string file)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkCoordsWithIconFromFile(lat, lng, alt, file));
|
||||
}
|
||||
|
||||
public D3DObj MarkCoordsWithShape(float lat, float lng, float alt, D3DShape shape, int color)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkCoordsWithShape(lat, lng, alt, (eShape)shape, color));
|
||||
}
|
||||
|
||||
public D3DObj MarkCoordsWithShapeFromFile(float lat, float lng, float alt, string file, int color)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkCoordsWithShapeFromFile(lat, lng, alt, file, color));
|
||||
}
|
||||
|
||||
public D3DObj MarkCoordsWith2DText(float lat, float lng, float alt, string szText, string szFont, int options)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkCoordsWith2DText(lat, lng, alt, szText, szFont, options));
|
||||
}
|
||||
|
||||
public D3DObj MarkCoordsWith3DText(float lat, float lng, float alt, string szText, string szFont, int options)
|
||||
{
|
||||
return new D3DObj(base.Wrapped.MarkCoordsWith3DText(lat, lng, alt, szText, szFont, options));
|
||||
}
|
||||
}
|
||||
12
Managed/Decal.Adapter/Decal.Adapter.Wrappers/D3DShape.cs
Normal file
12
Managed/Decal.Adapter/Decal.Adapter.Wrappers/D3DShape.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public enum D3DShape
|
||||
{
|
||||
HorizontalArrow,
|
||||
VerticalArrow,
|
||||
Ring,
|
||||
Cylinder,
|
||||
Sphere,
|
||||
Cube,
|
||||
TiltedCube
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public enum D3DTextType
|
||||
{
|
||||
Text2D,
|
||||
Text3D
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class DeathEventArgs : EventArgs
|
||||
{
|
||||
private string myText;
|
||||
|
||||
public string Text => myText;
|
||||
|
||||
internal DeathEventArgs(string text)
|
||||
{
|
||||
myText = text;
|
||||
}
|
||||
}
|
||||
84
Managed/Decal.Adapter/Decal.Adapter.Wrappers/DecalWrapper.cs
Normal file
84
Managed/Decal.Adapter/Decal.Adapter.Wrappers/DecalWrapper.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Core;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class DecalWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
internal static Guid IID_IDISPATCH = new Guid("{00020400-0000-0000-C000-000000000046}");
|
||||
|
||||
internal static Guid IID_IUNKNOWN = new Guid("{00000000-0000-0000-C000-000000000046}");
|
||||
|
||||
private DecalCore myDecal;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public DecalCore Underlying => myDecal;
|
||||
|
||||
public IntPtr Hwnd => new IntPtr(myDecal.HWND);
|
||||
|
||||
public bool Focus => myDecal.Focus;
|
||||
|
||||
internal DecalWrapper(DecalCore decal)
|
||||
{
|
||||
myDecal = decal;
|
||||
}
|
||||
|
||||
~DecalWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myDecal != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myDecal);
|
||||
myDecal = null;
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
public object GetObject(string path)
|
||||
{
|
||||
return GetObject(path, IID_IDISPATCH);
|
||||
}
|
||||
|
||||
public object GetObject(string path, string iid)
|
||||
{
|
||||
return GetObject(path, new Guid(iid));
|
||||
}
|
||||
|
||||
public object GetObject(string path, Guid iid)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((dynamic)(IDecalCore)myDecal).get_Object(path, ref iid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.WriteLine("Exception for {0} during get_Object: {1}", path, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string MapPath(string path)
|
||||
{
|
||||
return myDecal.MapPath(path);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class DeclineTradeEventArgs : EventArgs
|
||||
{
|
||||
private int mTraderId;
|
||||
|
||||
public int TraderId => mTraderId;
|
||||
|
||||
internal DeclineTradeEventArgs(int TraderId)
|
||||
{
|
||||
mTraderId = TraderId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public enum DoubleValueKey
|
||||
{
|
||||
SlashProt = 167772160,
|
||||
PierceProt = 167772161,
|
||||
BludgeonProt = 167772162,
|
||||
AcidProt = 167772163,
|
||||
LightningProt = 167772164,
|
||||
FireProt = 167772165,
|
||||
ColdProt = 167772166,
|
||||
Heading = 167772167,
|
||||
ApproachDistance = 167772168,
|
||||
SalvageWorkmanship = 167772169,
|
||||
Scale = 167772170,
|
||||
Variance = 167772171,
|
||||
AttackBonus = 167772172,
|
||||
Range = 167772173,
|
||||
DamageBonus = 167772174,
|
||||
ManaRateOfChange = 5,
|
||||
MeleeDefenseBonus = 29,
|
||||
ManaTransferEfficiency = 87,
|
||||
HealingKitRestoreBonus = 100,
|
||||
ManaStoneChanceDestruct = 137,
|
||||
ManaCBonus = 144,
|
||||
MissileDBonus = 149,
|
||||
MagicDBonus = 150,
|
||||
ElementalDamageVersusMonsters = 152
|
||||
}
|
||||
81
Managed/Decal.Adapter/Decal.Adapter.Wrappers/EchoFilter2.cs
Normal file
81
Managed/Decal.Adapter/Decal.Adapter.Wrappers/EchoFilter2.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using Decal.Adapter.NetParser;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Filters;
|
||||
using Decal.Interop.Net;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class EchoFilter2 : GenericDisposableWrapper<Decal.Interop.Filters.EchoFilter2>
|
||||
{
|
||||
private event EventHandler<NetworkMessageEventArgs> serverDispatch;
|
||||
|
||||
private event EventHandler<NetworkMessageEventArgs> clientDispatch;
|
||||
|
||||
public event EventHandler<NetworkMessageEventArgs> ServerDispatch
|
||||
{
|
||||
add
|
||||
{
|
||||
serverDispatch += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
serverDispatch -= value;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<NetworkMessageEventArgs> ClientDispatch
|
||||
{
|
||||
add
|
||||
{
|
||||
clientDispatch += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
clientDispatch -= value;
|
||||
}
|
||||
}
|
||||
|
||||
public EchoFilter2(Decal.Interop.Filters.EchoFilter2 obj)
|
||||
: base(obj)
|
||||
{
|
||||
base.Wrapped.EchoClient += onEchoClient;
|
||||
base.Wrapped.EchoServer += onEchoServer;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool userCalled)
|
||||
{
|
||||
if (userCalled && base.Wrapped != null)
|
||||
{
|
||||
base.Wrapped.EchoClient -= onEchoClient;
|
||||
base.Wrapped.EchoServer -= onEchoServer;
|
||||
}
|
||||
base.Dispose(userCalled);
|
||||
}
|
||||
|
||||
private void onEchoServer(IMessage2 pMsg)
|
||||
{
|
||||
try
|
||||
{
|
||||
Message message = null;
|
||||
Util.SafeFireEvent(args: new NetworkMessageEventArgs((!(pMsg is MessageWrapper messageWrapper)) ? new Message(pMsg, MessageDirection.Inbound) : messageWrapper.Wrapped), sender: this, eventHandler: this.serverDispatch);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.WriteLine("Exception in onEchoServer {0}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void onEchoClient(IMessage2 pMsg)
|
||||
{
|
||||
try
|
||||
{
|
||||
Message message = null;
|
||||
Util.SafeFireEvent(args: new NetworkMessageEventArgs((!(pMsg is MessageWrapper messageWrapper)) ? new Message(pMsg, MessageDirection.Inbound) : messageWrapper.Wrapped), sender: this, eventHandler: this.clientDispatch);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.WriteLine("Exception in onEchoClient {0}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class EnchantmentWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private Enchantment myEnchantment;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
public double Adjustment => myEnchantment.Adjustment;
|
||||
|
||||
public int Affected => myEnchantment.Affected;
|
||||
|
||||
public int AffectedMask => myEnchantment.AffectedMask;
|
||||
|
||||
public double Duration => myEnchantment.Duration;
|
||||
|
||||
public int Family => myEnchantment.Family;
|
||||
|
||||
public int Layer => myEnchantment.Layer;
|
||||
|
||||
public int SpellId => myEnchantment.SpellID;
|
||||
|
||||
public int TimeRemaining => myEnchantment.TimeRemaining;
|
||||
|
||||
public DateTime Expires => DateTime.Now.AddSeconds(TimeRemaining);
|
||||
|
||||
internal EnchantmentWrapper(Enchantment enchant)
|
||||
{
|
||||
myEnchantment = enchant;
|
||||
}
|
||||
|
||||
~EnchantmentWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myEnchantment != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myEnchantment);
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
protected void EnforceDisposedOnce()
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("EnchantmentWrapper");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class EndTradeEventArgs : EventArgs
|
||||
{
|
||||
private int mReasonId;
|
||||
|
||||
public int ReasonId => mReasonId;
|
||||
|
||||
internal EndTradeEventArgs(int ReasonId)
|
||||
{
|
||||
mReasonId = ReasonId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class EnterTradeEventArgs : EventArgs
|
||||
{
|
||||
private int mTraderId;
|
||||
|
||||
private int mTradeeId;
|
||||
|
||||
public int TraderId => mTraderId;
|
||||
|
||||
public int TradeeId => mTradeeId;
|
||||
|
||||
internal EnterTradeEventArgs(int TraderId, int TradeeId)
|
||||
{
|
||||
mTraderId = TraderId;
|
||||
mTradeeId = TradeeId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class FailToAddTradeItemEventArgs : EventArgs
|
||||
{
|
||||
private int mItemId;
|
||||
|
||||
private int mReasonId;
|
||||
|
||||
public int ItemId => mItemId;
|
||||
|
||||
public int ReasonId => mReasonId;
|
||||
|
||||
internal FailToAddTradeItemEventArgs(int ItemId, int ReasonId)
|
||||
{
|
||||
mItemId = ItemId;
|
||||
mReasonId = ReasonId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum FellowshipEventType
|
||||
{
|
||||
Create,
|
||||
Quit,
|
||||
Dismiss,
|
||||
Recruit,
|
||||
Disband
|
||||
}
|
||||
23
Managed/Decal.Adapter/Decal.Adapter.Wrappers/FontWeight.cs
Normal file
23
Managed/Decal.Adapter/Decal.Adapter.Wrappers/FontWeight.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum FontWeight
|
||||
{
|
||||
Black = 900,
|
||||
Bold = 700,
|
||||
DemiBold = 600,
|
||||
DoNotCare = 0,
|
||||
ExtraBold = 800,
|
||||
ExtraLight = 200,
|
||||
Heavy = 900,
|
||||
Light = 300,
|
||||
Medium = 500,
|
||||
Normal = 400,
|
||||
Regular = 400,
|
||||
SemiBold = 600,
|
||||
Thin = 100,
|
||||
UltraBold = 800,
|
||||
UltraLight = 200
|
||||
}
|
||||
19
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HookIndexer.cs
Normal file
19
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HookIndexer.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public sealed class HookIndexer<IndexType> : MarshalByRefObject where IndexType : struct, IConvertible
|
||||
{
|
||||
private hookIndexType myIndex;
|
||||
|
||||
private IIndexedValueProvider myWrap;
|
||||
|
||||
public int this[IndexType item] => myWrap.GetIndexedObject(myIndex, item.ToInt32(CultureInfo.InvariantCulture));
|
||||
|
||||
internal HookIndexer(IIndexedValueProvider wrap, hookIndexType index)
|
||||
{
|
||||
myIndex = index;
|
||||
myWrap = wrap;
|
||||
}
|
||||
}
|
||||
540
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HooksWrapper.cs
Normal file
540
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HooksWrapper.cs
Normal file
|
|
@ -0,0 +1,540 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Core;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public sealed class HooksWrapper : MarshalByRefObject, IIndexedValueProvider, IDisposable
|
||||
{
|
||||
private IACHooks myHooks;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public IACHooks Underlying => myHooks;
|
||||
|
||||
public int BusyState => myHooks.BusyState;
|
||||
|
||||
public int BusyStateId => myHooks.BusyStateID;
|
||||
|
||||
public bool ChatState => myHooks.ChatState;
|
||||
|
||||
public CombatState CombatMode => (CombatState)myHooks.CombatMode;
|
||||
|
||||
public int CommandInterpreter => myHooks.CommandInterpreter;
|
||||
|
||||
public int CurrentSelection
|
||||
{
|
||||
get
|
||||
{
|
||||
return myHooks.CurrentSelection;
|
||||
}
|
||||
set
|
||||
{
|
||||
myHooks.CurrentSelection = value;
|
||||
}
|
||||
}
|
||||
|
||||
public double Heading
|
||||
{
|
||||
get
|
||||
{
|
||||
return myHooks.HeadingDegrees;
|
||||
}
|
||||
set
|
||||
{
|
||||
FaceHeading(value, bUnknown: true);
|
||||
}
|
||||
}
|
||||
|
||||
public double HeadingRadians
|
||||
{
|
||||
get
|
||||
{
|
||||
return myHooks.HeadingRadians;
|
||||
}
|
||||
set
|
||||
{
|
||||
RadianFaceHeading(value, bUnknown: true);
|
||||
}
|
||||
}
|
||||
|
||||
public int Landcell => myHooks.Landcell;
|
||||
|
||||
public double LocationX => myHooks.LocationX;
|
||||
|
||||
public double LocationY => myHooks.LocationY;
|
||||
|
||||
public double LocationZ => myHooks.LocationZ;
|
||||
|
||||
public int MaxSelectedStackCount => myHooks.MaxSelectedStackCount;
|
||||
|
||||
public int OpenedContainer => myHooks.OpenedContainer;
|
||||
|
||||
public int PointerState => myHooks.PointerState;
|
||||
|
||||
public int PreviousSelection
|
||||
{
|
||||
get
|
||||
{
|
||||
return myHooks.PreviousSelection;
|
||||
}
|
||||
set
|
||||
{
|
||||
myHooks.PreviousSelection = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle Region3D
|
||||
{
|
||||
get
|
||||
{
|
||||
tagRECT aC3DRegionRect = myHooks.AC3DRegionRect;
|
||||
return new Rectangle(aC3DRegionRect.left, aC3DRegionRect.top, aC3DRegionRect.right, aC3DRegionRect.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle RegionWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
tagRECT aCWindowRect = myHooks.ACWindowRect;
|
||||
return new Rectangle(aCWindowRect.left, aCWindowRect.top, aCWindowRect.right, aCWindowRect.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
public int SelectedStackCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return myHooks.SelectedStackCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
myHooks.SelectedStackCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int VendorId => myHooks.VendorID;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<AttributeType> Attribute => new HookIndexer<AttributeType>(this, hookIndexType.Attribute);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<AttributeType> AttributeClicks => new HookIndexer<AttributeType>(this, hookIndexType.AttributeClicks);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<AttributeType> AttributeStart => new HookIndexer<AttributeType>(this, hookIndexType.AttributeStart);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<AttributeType> AttributeTotalXP => new HookIndexer<AttributeType>(this, hookIndexType.AttributeTotalXP);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<int> Misc => new HookIndexer<int>(this, hookIndexType.Misc);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<SkillType> Skill => new HookIndexer<SkillType>(this, hookIndexType.Skill);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<SkillType> SkillClicks => new HookIndexer<SkillType>(this, hookIndexType.SkillClicks);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<SkillType> SkillFreePoints => new HookIndexer<SkillType>(this, hookIndexType.SkillFreePoints);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<SkillType> SkillTotalXP => new HookIndexer<SkillType>(this, hookIndexType.SkillTotalXP);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<SkillType> SkillTrainLevel => new HookIndexer<SkillType>(this, hookIndexType.SkillTrainLevel);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<VitalType> Vital => new HookIndexer<VitalType>(this, hookIndexType.Vital);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<VitalType> VitalClicks => new HookIndexer<VitalType>(this, hookIndexType.VitalClicks);
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public HookIndexer<VitalType> VitalTotalXP => new HookIndexer<VitalType>(this, hookIndexType.VitalTotalXP);
|
||||
|
||||
internal HooksWrapper(ACHooks hooks)
|
||||
{
|
||||
myHooks = hooks;
|
||||
}
|
||||
|
||||
~HooksWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myHooks != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myHooks);
|
||||
myHooks = null;
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
public void AddChatText(string text, int color)
|
||||
{
|
||||
AddChatText(text, color, 0);
|
||||
}
|
||||
|
||||
public void AddChatText(string text, int color, int target)
|
||||
{
|
||||
myHooks.AddChatText(text, color, target);
|
||||
}
|
||||
|
||||
public void AddChatTextRaw(string text, int color)
|
||||
{
|
||||
AddChatTextRaw(text, color, 0);
|
||||
}
|
||||
|
||||
public void AddChatTextRaw(string text, int color, int target)
|
||||
{
|
||||
myHooks.AddChatTextRaw(text, color, target);
|
||||
}
|
||||
|
||||
public void AddStatusText(string text)
|
||||
{
|
||||
myHooks.AddStatusText(text);
|
||||
}
|
||||
|
||||
public void ApplyItem(int useThis, int onThis)
|
||||
{
|
||||
myHooks.ApplyItem(useThis, onThis);
|
||||
}
|
||||
|
||||
public void AutoWield(int item)
|
||||
{
|
||||
myHooks.AutoWield(item);
|
||||
}
|
||||
|
||||
public void AutoWield(int item, int slot, int explic, int notexplic)
|
||||
{
|
||||
myHooks.AutoWieldEx(item, slot, explic, notexplic);
|
||||
}
|
||||
|
||||
public void AutoWield(int item, int slot, int explic, int notexplic, int zero1, int zero2)
|
||||
{
|
||||
myHooks.AutoWieldRaw(item, slot, explic, notexplic, zero1, zero2);
|
||||
}
|
||||
|
||||
public void CastSpell(int spellId, int objectId)
|
||||
{
|
||||
myHooks.CastSpell(spellId, objectId);
|
||||
}
|
||||
|
||||
public void DropItem(int objectId)
|
||||
{
|
||||
myHooks.DropItem(objectId);
|
||||
}
|
||||
|
||||
public bool FaceHeading(double heading, bool bUnknown)
|
||||
{
|
||||
return myHooks.FaceHeading((float)heading, bUnknown);
|
||||
}
|
||||
|
||||
public bool RadianFaceHeading(double heading, bool bUnknown)
|
||||
{
|
||||
if (heading < 0.0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("heading");
|
||||
}
|
||||
if (heading > Math.PI * 10.0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("heading");
|
||||
}
|
||||
double num = heading * 180.0 / Math.PI;
|
||||
return myHooks.FaceHeading((float)num, bUnknown);
|
||||
}
|
||||
|
||||
public void FellowshipRecruit(int lObjectID)
|
||||
{
|
||||
myHooks.FellowshipRecruit(lObjectID);
|
||||
}
|
||||
|
||||
public void FellowshipGrantLeader(int lObjectID)
|
||||
{
|
||||
myHooks.FellowshipGrantLeader(lObjectID);
|
||||
}
|
||||
|
||||
public void FellowshipSetOpen(bool IsOpen)
|
||||
{
|
||||
myHooks.FellowshipSetOpen(IsOpen);
|
||||
}
|
||||
|
||||
public void FellowshipQuit()
|
||||
{
|
||||
myHooks.FellowshipQuit();
|
||||
}
|
||||
|
||||
public void FellowshipDisband()
|
||||
{
|
||||
myHooks.FellowshipDisband();
|
||||
}
|
||||
|
||||
public void FellowshipDismiss(int lObjectID)
|
||||
{
|
||||
myHooks.FellowshipDismiss(lObjectID);
|
||||
}
|
||||
|
||||
public void GiveItem(int lObject, int lDestination)
|
||||
{
|
||||
myHooks.GiveItem(lObject, lDestination);
|
||||
}
|
||||
|
||||
public void RequestId(int objectId)
|
||||
{
|
||||
CoreManager.Current.IDQueue.AddToQueueForCaller(objectId, Assembly.GetCallingAssembly(), DateTime.MaxValue);
|
||||
}
|
||||
|
||||
public void InvokeChatParser(string text)
|
||||
{
|
||||
myHooks.InvokeChatParser(text);
|
||||
}
|
||||
|
||||
public bool IsValidObject(int objectId)
|
||||
{
|
||||
return myHooks.IsValidObject(objectId);
|
||||
}
|
||||
|
||||
public void Logout()
|
||||
{
|
||||
myHooks.Logout();
|
||||
}
|
||||
|
||||
public void MoveItem(int objectId, int packId, int slot, bool stack)
|
||||
{
|
||||
myHooks.MoveItem(objectId, packId, slot, stack);
|
||||
}
|
||||
|
||||
public void MoveItem(int objectId, int destinationId)
|
||||
{
|
||||
myHooks.MoveItemEx(objectId, destinationId);
|
||||
}
|
||||
|
||||
public void MoveItem(int objectId, int destinationId, int moveFlags)
|
||||
{
|
||||
myHooks.MoveItemExRaw(objectId, destinationId, moveFlags);
|
||||
}
|
||||
|
||||
public void SalvagePanelAdd(int objectId)
|
||||
{
|
||||
myHooks.SalvagePanelAdd(objectId);
|
||||
}
|
||||
|
||||
public void SalvagePanelSalvage()
|
||||
{
|
||||
myHooks.SalvagePanelSalvage();
|
||||
}
|
||||
|
||||
public void SelectItem(int objectId)
|
||||
{
|
||||
myHooks.SelectItem(objectId);
|
||||
}
|
||||
|
||||
public void SetAutorun(bool on)
|
||||
{
|
||||
myHooks.SetAutorun(on);
|
||||
}
|
||||
|
||||
public void SetCombatMode(CombatState newMode)
|
||||
{
|
||||
myHooks.SetCombatMode((int)newMode);
|
||||
}
|
||||
|
||||
public void SetCursorPosition(int x, int y)
|
||||
{
|
||||
myHooks.SetCursorPosition(x, y);
|
||||
}
|
||||
|
||||
public void SetIdleTime(double timeout)
|
||||
{
|
||||
myHooks.SetIdleTime(timeout);
|
||||
}
|
||||
|
||||
public void SpellTabAdd(int tab, int index, int spellId)
|
||||
{
|
||||
myHooks.SpellTabAdd(tab, index, spellId);
|
||||
}
|
||||
|
||||
public void SpellTabDelete(int tab, int spellId)
|
||||
{
|
||||
myHooks.SpellTabDelete(tab, spellId);
|
||||
}
|
||||
|
||||
public void TradeAccept()
|
||||
{
|
||||
myHooks.TradeAccept();
|
||||
}
|
||||
|
||||
public void TradeAdd(int objectId)
|
||||
{
|
||||
myHooks.TradeAdd(objectId);
|
||||
}
|
||||
|
||||
public IntPtr PhysicsObject(int objectId)
|
||||
{
|
||||
return new IntPtr(myHooks.GetPhysicsObjectPtr(objectId));
|
||||
}
|
||||
|
||||
public IntPtr WeenieObject(int objectId)
|
||||
{
|
||||
return new IntPtr(myHooks.GetWeenieObjectPtr(objectId));
|
||||
}
|
||||
|
||||
public void TradeDecline()
|
||||
{
|
||||
myHooks.TradeDecline();
|
||||
}
|
||||
|
||||
public void TradeReset()
|
||||
{
|
||||
myHooks.TradeReset();
|
||||
}
|
||||
|
||||
public void TradeEnd()
|
||||
{
|
||||
myHooks.TradeEnd();
|
||||
}
|
||||
|
||||
public IntPtr UIElementLookup(UIElementType pUIElementType)
|
||||
{
|
||||
return new IntPtr(myHooks.UIElementLookup((int)pUIElementType));
|
||||
}
|
||||
|
||||
public void UIElementMove(UIElementType pUIElementType, int x, int y)
|
||||
{
|
||||
myHooks.UIElementMove((int)pUIElementType, x, y);
|
||||
}
|
||||
|
||||
public void UIElementResize(UIElementType pUIElementType, int width, int height)
|
||||
{
|
||||
myHooks.UIElementResize((int)pUIElementType, width, height);
|
||||
}
|
||||
|
||||
public Rectangle UIElementRegion(UIElementType pUIElementType)
|
||||
{
|
||||
tagRECT tagRECT = myHooks.UIElementRegionRect((int)pUIElementType);
|
||||
return new Rectangle(tagRECT.left, tagRECT.top, 1 + tagRECT.right - tagRECT.left, 1 + tagRECT.bottom - tagRECT.top);
|
||||
}
|
||||
|
||||
public void UseItem(int objectId, int useState)
|
||||
{
|
||||
myHooks.UseItem(objectId, useState);
|
||||
}
|
||||
|
||||
public void UseItem(int objectId, int useState, int useMethod)
|
||||
{
|
||||
myHooks.UseItemRaw(objectId, useState, useMethod);
|
||||
}
|
||||
|
||||
public void VendorBuyAll()
|
||||
{
|
||||
myHooks.VendorBuyAll();
|
||||
}
|
||||
|
||||
public void VendorAddBuyList(int templateId, int count)
|
||||
{
|
||||
myHooks.VendorBuyListAdd(templateId, count);
|
||||
}
|
||||
|
||||
public void VendorClearBuyList()
|
||||
{
|
||||
myHooks.VendorBuyListClear();
|
||||
}
|
||||
|
||||
public void VendorSellAll()
|
||||
{
|
||||
myHooks.VendorSellAll();
|
||||
}
|
||||
|
||||
public void VendorAddSellList(int itemId)
|
||||
{
|
||||
myHooks.VendorSellListAdd(itemId);
|
||||
}
|
||||
|
||||
public void VendorClearSellList()
|
||||
{
|
||||
myHooks.VendorSellListClear();
|
||||
}
|
||||
|
||||
public void AddSkillExperience(SkillType skill, int experience)
|
||||
{
|
||||
myHooks.AddSkillExp((eSkill)skill, experience);
|
||||
}
|
||||
|
||||
public void AddAttributeExperience(AttributeType attrib, int experience)
|
||||
{
|
||||
myHooks.AddAttributeExp((eAttribute)attrib, experience);
|
||||
}
|
||||
|
||||
public void AddVitalExperience(VitalType vital, int experience)
|
||||
{
|
||||
myHooks.AddVitalExp((eVital)vital, experience);
|
||||
}
|
||||
|
||||
int IIndexedValueProvider.GetIndexedObject(hookIndexType index, int item)
|
||||
{
|
||||
int result = 0;
|
||||
switch (index)
|
||||
{
|
||||
case hookIndexType.Attribute:
|
||||
result = ((dynamic)myHooks).get_Attribute(item);
|
||||
break;
|
||||
case hookIndexType.AttributeClicks:
|
||||
result = ((dynamic)myHooks).get_AttributeClicks((eAttribute)item);
|
||||
break;
|
||||
case hookIndexType.AttributeStart:
|
||||
result = ((dynamic)myHooks).get_AttributeStart((eAttribute)item);
|
||||
break;
|
||||
case hookIndexType.AttributeTotalXP:
|
||||
result = ((dynamic)myHooks).get_AttributeTotalXP((eAttribute)item);
|
||||
break;
|
||||
case hookIndexType.Skill:
|
||||
result = ((dynamic)myHooks).get_Skill(item);
|
||||
break;
|
||||
case hookIndexType.SkillClicks:
|
||||
result = ((dynamic)myHooks).get_SkillClicks((eSkill)item);
|
||||
break;
|
||||
case hookIndexType.SkillFreePoints:
|
||||
result = ((dynamic)myHooks).get_SkillFreePoints((eSkill)item);
|
||||
break;
|
||||
case hookIndexType.SkillTotalXP:
|
||||
result = ((dynamic)myHooks).get_SkillTotalXP((eSkill)item);
|
||||
break;
|
||||
case hookIndexType.SkillTrainLevel:
|
||||
result = (int)((dynamic)myHooks).get_SkillTrainLevel((eSkill)item);
|
||||
break;
|
||||
case hookIndexType.Vital:
|
||||
result = ((dynamic)myHooks).get_Vital(item);
|
||||
break;
|
||||
case hookIndexType.VitalClicks:
|
||||
result = ((dynamic)myHooks).get_VitalClicks((eVital)item);
|
||||
break;
|
||||
case hookIndexType.VitalTotalXP:
|
||||
result = ((dynamic)myHooks).get_VitalTotalXP((eVital)item);
|
||||
break;
|
||||
case hookIndexType.Misc:
|
||||
result = ((dynamic)myHooks).get_Misc(item);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
75
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HostBase.cs
Normal file
75
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HostBase.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public abstract class HostBase : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private HooksWrapper myInternalHooks;
|
||||
|
||||
private DecalWrapper myInternalDecal;
|
||||
|
||||
private RenderServiceWrapper myInternalRender;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
protected bool IsDisposed => isDisposed;
|
||||
|
||||
protected DecalWrapper MyDecal
|
||||
{
|
||||
get
|
||||
{
|
||||
return myInternalDecal;
|
||||
}
|
||||
set
|
||||
{
|
||||
myInternalDecal = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected RenderServiceWrapper MyRender
|
||||
{
|
||||
get
|
||||
{
|
||||
return myInternalRender;
|
||||
}
|
||||
set
|
||||
{
|
||||
myInternalRender = value;
|
||||
}
|
||||
}
|
||||
|
||||
~HostBase()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed && disposing)
|
||||
{
|
||||
if (myInternalHooks != null)
|
||||
{
|
||||
myInternalHooks.Dispose();
|
||||
}
|
||||
if (myInternalDecal != null)
|
||||
{
|
||||
myInternalDecal.Dispose();
|
||||
}
|
||||
if (myInternalRender != null)
|
||||
{
|
||||
myInternalRender.Dispose();
|
||||
}
|
||||
}
|
||||
myInternalHooks = null;
|
||||
myInternalDecal = null;
|
||||
myInternalRender = null;
|
||||
isDisposed = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class HotkeyEventArgs : EventArgs
|
||||
{
|
||||
private string myTitle;
|
||||
|
||||
private bool myEat;
|
||||
|
||||
public string Title => myTitle;
|
||||
|
||||
public bool Eat
|
||||
{
|
||||
get
|
||||
{
|
||||
return myEat;
|
||||
}
|
||||
set
|
||||
{
|
||||
myEat = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal HotkeyEventArgs(string Title, bool Eat)
|
||||
{
|
||||
myTitle = Title;
|
||||
myEat = Eat;
|
||||
}
|
||||
}
|
||||
133
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HotkeySystem.cs
Normal file
133
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HotkeySystem.cs
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.DHS;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class HotkeySystem : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private Decal.Interop.DHS.HotkeySystem myHKS;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
private EventHandler<HotkeyEventArgs> mHotkey;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Decal.Interop.DHS.HotkeySystem Underlying => myHKS;
|
||||
|
||||
public event EventHandler<HotkeyEventArgs> Hotkey
|
||||
{
|
||||
add
|
||||
{
|
||||
mHotkey = (EventHandler<HotkeyEventArgs>)Delegate.Combine(mHotkey, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
mHotkey = (EventHandler<HotkeyEventArgs>)Delegate.Remove(mHotkey, value);
|
||||
}
|
||||
}
|
||||
|
||||
internal HotkeySystem(Decal.Interop.DHS.HotkeySystem hks)
|
||||
{
|
||||
myHKS = hks;
|
||||
myHKS.HotkeyEvent += myHKS_HotkeyEvent;
|
||||
}
|
||||
|
||||
~HotkeySystem()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed && disposing && myHKS != null)
|
||||
{
|
||||
myHKS.HotkeyEvent -= myHKS_HotkeyEvent;
|
||||
}
|
||||
if (myHKS != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myHKS);
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
public void AddHotkey(string szPlugin, HotkeyWrapper hotkey)
|
||||
{
|
||||
if (hotkey == null)
|
||||
{
|
||||
throw new ArgumentNullException("hotkey");
|
||||
}
|
||||
AddHotkey(szPlugin, hotkey.Underlying);
|
||||
}
|
||||
|
||||
public void AddHotkey(string szPlugin, string szTitle, string szDescription)
|
||||
{
|
||||
Hotkey hotkey = new HotkeyClass();
|
||||
hotkey.EventTitle = szTitle;
|
||||
hotkey.EventDescription = szDescription;
|
||||
AddHotkey(szPlugin, hotkey);
|
||||
Marshal.ReleaseComObject(hotkey);
|
||||
}
|
||||
|
||||
public void AddHotkey(string plugin, string title, string description, int virtualKey, bool altState, bool controlState, bool shiftState)
|
||||
{
|
||||
Hotkey hotkey = new HotkeyClass();
|
||||
hotkey.EventTitle = title;
|
||||
hotkey.EventDescription = description;
|
||||
hotkey.VirtualKey = virtualKey;
|
||||
hotkey.AltState = altState;
|
||||
hotkey.ControlState = controlState;
|
||||
hotkey.ShiftState = shiftState;
|
||||
AddHotkey(plugin, hotkey);
|
||||
Marshal.ReleaseComObject(hotkey);
|
||||
}
|
||||
|
||||
private void AddHotkey(string szPlugin, Hotkey hotkey)
|
||||
{
|
||||
if (hotkey == null)
|
||||
{
|
||||
throw new ArgumentNullException("hotkey");
|
||||
}
|
||||
myHKS.AddHotkey(szPlugin, hotkey);
|
||||
}
|
||||
|
||||
public void DeleteHotkey(string plugin, string hotkeyName)
|
||||
{
|
||||
myHKS.DeleteHotkey(plugin, hotkeyName);
|
||||
}
|
||||
|
||||
public bool Exists(string hotkeyName)
|
||||
{
|
||||
return myHKS.QueryHotkey(hotkeyName);
|
||||
}
|
||||
|
||||
public HotkeyWrapper GetHotkey(string plugin, string hotkeyName)
|
||||
{
|
||||
Hotkey hotkey = myHKS.QueryHotkeyEx(plugin, hotkeyName);
|
||||
HotkeyWrapper result = null;
|
||||
if (hotkey != null)
|
||||
{
|
||||
result = new HotkeyWrapper(hotkey);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void myHKS_HotkeyEvent(string szTitle, ref bool Eat)
|
||||
{
|
||||
if (mHotkey != null)
|
||||
{
|
||||
HotkeyEventArgs e = new HotkeyEventArgs(szTitle, Eat);
|
||||
mHotkey(this, e);
|
||||
Eat = e.Eat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.DHS;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class HotkeyWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private Hotkey myHotkey;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Hotkey Underlying => myHotkey;
|
||||
|
||||
public bool AltState => myHotkey.AltState;
|
||||
|
||||
public bool ControlState => myHotkey.ControlState;
|
||||
|
||||
public bool ShiftState => myHotkey.ShiftState;
|
||||
|
||||
public int VirtualKey => myHotkey.VirtualKey;
|
||||
|
||||
public string Title => myHotkey.EventTitle;
|
||||
|
||||
public string Description => myHotkey.EventDescription;
|
||||
|
||||
internal HotkeyWrapper(Hotkey hotkey)
|
||||
{
|
||||
myHotkey = hotkey;
|
||||
}
|
||||
|
||||
public HotkeyWrapper(string title, string description)
|
||||
: this(new HotkeyClass())
|
||||
{
|
||||
myHotkey.EventTitle = title;
|
||||
myHotkey.EventDescription = description;
|
||||
}
|
||||
|
||||
public HotkeyWrapper(string title, string description, int virtualKey, bool altState, bool controlState, bool shiftState)
|
||||
: this(title, description)
|
||||
{
|
||||
myHotkey.VirtualKey = virtualKey;
|
||||
myHotkey.AltState = altState;
|
||||
myHotkey.ControlState = controlState;
|
||||
myHotkey.ShiftState = shiftState;
|
||||
}
|
||||
|
||||
~HotkeyWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myHotkey != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myHotkey);
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
protected void EnforceDisposedOnce()
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("HotkeyWrapper");
|
||||
}
|
||||
}
|
||||
}
|
||||
86
Managed/Decal.Adapter/Decal.Adapter.Wrappers/Hud.cs
Normal file
86
Managed/Decal.Adapter/Decal.Adapter.Wrappers/Hud.cs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Render;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class Hud : HudRenderScalable
|
||||
{
|
||||
private HUDView internalView;
|
||||
|
||||
internal HUDView Underlying => internalView;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return internalView.Enabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
internalView.Enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Id => internalView.ID;
|
||||
|
||||
public float Angle
|
||||
{
|
||||
get
|
||||
{
|
||||
return internalView.Angle;
|
||||
}
|
||||
set
|
||||
{
|
||||
internalView.Angle = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Alpha
|
||||
{
|
||||
get
|
||||
{
|
||||
return internalView.Alpha;
|
||||
}
|
||||
set
|
||||
{
|
||||
internalView.Alpha = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal event EventHandler Disposing;
|
||||
|
||||
internal Hud(HUDView view)
|
||||
: base(view)
|
||||
{
|
||||
internalView = view;
|
||||
}
|
||||
|
||||
public void SetBackground(Background background)
|
||||
{
|
||||
if (background != null)
|
||||
{
|
||||
internalView.SetBackground(background.Underlying);
|
||||
return;
|
||||
}
|
||||
throw new ArgumentNullException("background");
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing && this.Disposing != null)
|
||||
{
|
||||
this.Disposing(this, new EventArgs());
|
||||
}
|
||||
Marshal.ReleaseComObject(internalView);
|
||||
internalView = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Core;
|
||||
using Decal.Interop.Render;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class HudRenderScalable : HudRenderTarget
|
||||
{
|
||||
private IRenderScalable myScalable;
|
||||
|
||||
public Rectangle ScaleRect => Util.toRectangle(myScalable.ScaleRect);
|
||||
|
||||
public float ScaleFactor
|
||||
{
|
||||
get
|
||||
{
|
||||
return myScalable.ScaleFactor;
|
||||
}
|
||||
set
|
||||
{
|
||||
myScalable.ScaleFactor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Scaling
|
||||
{
|
||||
get
|
||||
{
|
||||
return myScalable.Scaling;
|
||||
}
|
||||
set
|
||||
{
|
||||
myScalable.Scaling = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
protected HudRenderScalable(IRenderScalable newTarget)
|
||||
: base(newTarget)
|
||||
{
|
||||
myScalable = newTarget;
|
||||
}
|
||||
|
||||
public void ScaleTo(Rectangle rect)
|
||||
{
|
||||
tagRECT pArea = Util.toTagRECT(rect);
|
||||
myScalable.ScaleTo(ref pArea);
|
||||
}
|
||||
}
|
||||
380
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HudRenderTarget.cs
Normal file
380
Managed/Decal.Adapter/Decal.Adapter.Wrappers/HudRenderTarget.cs
Normal file
|
|
@ -0,0 +1,380 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Core;
|
||||
using Decal.Interop.Render;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class HudRenderTarget : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private IRenderTarget myTarget;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
private Rectangle areaRect;
|
||||
|
||||
private bool inRender;
|
||||
|
||||
private bool inText;
|
||||
|
||||
public bool Lost => myTarget.Lost;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Rectangle Constraint
|
||||
{
|
||||
get
|
||||
{
|
||||
Rectangle region = Region;
|
||||
return new Rectangle(0, 0, region.Width, region.Height);
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle Region
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.toRectangle(myTarget.Region);
|
||||
}
|
||||
set
|
||||
{
|
||||
tagRECT pVal = Util.toTagRECT(value);
|
||||
myTarget.Region = pVal;
|
||||
areaRect.Width = value.Width;
|
||||
areaRect.Height = value.Height;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public object UnsafeSurface => myTarget.GetSurface();
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public tagRECT UnsafeRegion
|
||||
{
|
||||
get
|
||||
{
|
||||
return myTarget.Region;
|
||||
}
|
||||
set
|
||||
{
|
||||
myTarget.Region = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool IsDisposed => isDisposed;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
protected HudRenderTarget(IRenderTarget newTarget)
|
||||
{
|
||||
if (newTarget == null)
|
||||
{
|
||||
throw new ArgumentNullException("newTarget");
|
||||
}
|
||||
myTarget = newTarget;
|
||||
tagRECT region = myTarget.Region;
|
||||
areaRect = new Rectangle(0, 0, region.right - region.left, region.bottom - region.top);
|
||||
}
|
||||
|
||||
~HudRenderTarget()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void BeginRender()
|
||||
{
|
||||
BeginRender(enableTextureFilter: false);
|
||||
}
|
||||
|
||||
public void BeginRender(bool enableTextureFilter)
|
||||
{
|
||||
if (!inRender)
|
||||
{
|
||||
myTarget.BeginRender(enableTextureFilter);
|
||||
inRender = true;
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'BeginRender' when already rendering");
|
||||
}
|
||||
|
||||
public void EndRender()
|
||||
{
|
||||
if (inRender)
|
||||
{
|
||||
myTarget.EndRender();
|
||||
inRender = false;
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'EndRender' without a previous call to 'BeginRender'");
|
||||
}
|
||||
|
||||
public void BeginText(string fontName, int pixelHeight)
|
||||
{
|
||||
BeginText(fontName, pixelHeight, FontWeight.Normal, italic: false);
|
||||
}
|
||||
|
||||
public void BeginText(string fontName, int pixelHeight, FontWeight weight, bool italic)
|
||||
{
|
||||
UnsafeBeginText(fontName, pixelHeight, (int)weight, italic);
|
||||
}
|
||||
|
||||
public void WriteText(string text)
|
||||
{
|
||||
WriteText(text, Color.Black, WriteTextFormats.None, areaRect);
|
||||
}
|
||||
|
||||
public void WriteText(string text, Color color)
|
||||
{
|
||||
WriteText(text, color, WriteTextFormats.None, areaRect);
|
||||
}
|
||||
|
||||
public void WriteText(string text, Color color, WriteTextFormats format, Rectangle region)
|
||||
{
|
||||
UnsafeWriteText(Util.toTagRECT(region), color.ToArgb(), (int)format, text);
|
||||
}
|
||||
|
||||
public void WriteText(string text, int color, WriteTextFormats format, Rectangle region)
|
||||
{
|
||||
UnsafeWriteText(Util.toTagRECT(region), color, (int)format, text);
|
||||
}
|
||||
|
||||
public void EndText()
|
||||
{
|
||||
if (inRender && inText)
|
||||
{
|
||||
myTarget.EndText();
|
||||
inText = false;
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'EndText' without a previous call to 'BeginText'");
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Clear(areaRect);
|
||||
}
|
||||
|
||||
public void Clear(Rectangle clearArea)
|
||||
{
|
||||
UnsafeClear(Util.toTagRECT(clearArea));
|
||||
}
|
||||
|
||||
public void DrawPortalImage(int portalFile, Rectangle destinationArea)
|
||||
{
|
||||
UnsafeDrawPortalImage(portalFile, Util.toTagRECT(destinationArea));
|
||||
}
|
||||
|
||||
public void DrawPortalImage(int portalFile, int alpha, Rectangle srcArea, Rectangle destinationArea)
|
||||
{
|
||||
UnsafeDrawPortalImage(portalFile, alpha, Util.toTagRECT(srcArea), Util.toTagRECT(destinationArea));
|
||||
}
|
||||
|
||||
public void DrawPortalImage(int portalFile, Rectangle srcArea, Rectangle destinationArea)
|
||||
{
|
||||
UnsafeDrawPortalImage(portalFile, 255, Util.toTagRECT(srcArea), Util.toTagRECT(destinationArea));
|
||||
}
|
||||
|
||||
public void TilePortalImage(int portalFile, Rectangle destinationArea)
|
||||
{
|
||||
UnsafeTilePortalImage(portalFile, Util.toTagRECT(destinationArea));
|
||||
}
|
||||
|
||||
public void TilePortalImage(int portalFile, Rectangle srcArea, Rectangle destinationArea)
|
||||
{
|
||||
UnsafeTilePortalImage(portalFile, Util.toTagRECT(srcArea), Util.toTagRECT(destinationArea));
|
||||
}
|
||||
|
||||
public void DrawImage(Image image, Rectangle destinationRegion)
|
||||
{
|
||||
DrawImage(image, destinationRegion, Color.Cyan.ToArgb());
|
||||
}
|
||||
|
||||
public void DrawImage(Image image, Rectangle destinationRegion, Color colorKey)
|
||||
{
|
||||
DrawImage(image, destinationRegion, colorKey.ToArgb());
|
||||
}
|
||||
|
||||
public void DrawImage(Image image, Rectangle destinationRegion, int colorKey)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
throw new ArgumentNullException("image");
|
||||
}
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
image.Save((Stream)memoryStream, ImageFormat.Bmp);
|
||||
byte[] buffer = memoryStream.GetBuffer();
|
||||
IntPtr zero = IntPtr.Zero;
|
||||
int num = buffer.Length;
|
||||
zero = Marshal.AllocCoTaskMem(num);
|
||||
try
|
||||
{
|
||||
Marshal.Copy(buffer, 0, zero, num);
|
||||
if (zero != IntPtr.Zero)
|
||||
{
|
||||
UnsafeDrawImage(zero, num, Util.toTagRECT(destinationRegion), colorKey);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeCoTaskMem(zero);
|
||||
memoryStream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void Fill(Color color)
|
||||
{
|
||||
Fill(areaRect, color);
|
||||
}
|
||||
|
||||
public void Fill(Rectangle fillArea, Color color)
|
||||
{
|
||||
Fill(fillArea, color.ToArgb());
|
||||
}
|
||||
|
||||
public void Fill(Rectangle fillArea, int color)
|
||||
{
|
||||
UnsafeFill(Util.toTagRECT(fillArea), color);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeBeginText(string fontName, int pixelHeight, int weight, bool italic)
|
||||
{
|
||||
if (inRender && !inText)
|
||||
{
|
||||
myTarget.BeginText(fontName, pixelHeight, weight, italic);
|
||||
inText = true;
|
||||
return;
|
||||
}
|
||||
if (inRender && inText)
|
||||
{
|
||||
throw new RenderViolationException("Cannot call 'BeginText' when already rendering text");
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'BeginText' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeWriteText(tagRECT region, int color, int format, string text)
|
||||
{
|
||||
if (inRender && inText)
|
||||
{
|
||||
myTarget.WriteText(ref region, color, format, text);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'WriteText' outside of a BeginText/EndText block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeClear(tagRECT clearArea)
|
||||
{
|
||||
if (!inRender)
|
||||
{
|
||||
myTarget.Clear(ref clearArea);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("MUST call 'Clear' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeDrawPortalImage(int portalFile, tagRECT destinationArea)
|
||||
{
|
||||
if (inRender)
|
||||
{
|
||||
myTarget.DrawPortalImage(portalFile, ref destinationArea);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'DrawPortalImage' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeDrawPortalImage(int portalFile, int alpha, tagRECT srcArea, tagRECT destinationArea)
|
||||
{
|
||||
if (inRender)
|
||||
{
|
||||
myTarget.DrawPortalImageEx(portalFile, alpha, ref srcArea, ref destinationArea);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'DrawPortalImageEx' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeTilePortalImage(int portalFile, tagRECT destinationArea)
|
||||
{
|
||||
if (inRender)
|
||||
{
|
||||
myTarget.TilePortalImage(portalFile, ref destinationArea);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'TilePortalImage' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeTilePortalImage(int portalFile, tagRECT srcArea, tagRECT destinationArea)
|
||||
{
|
||||
if (inRender)
|
||||
{
|
||||
myTarget.TilePortalImageEx(portalFile, ref srcArea, ref destinationArea);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'TilePortalImageEx' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeDrawImage(IntPtr buffer, int size, tagRECT destinationRegion, int colorKey)
|
||||
{
|
||||
if (inRender)
|
||||
{
|
||||
myTarget.DrawImage((int)buffer, size, ref destinationRegion, colorKey);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("Cannot call 'DrawImage' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeFill(tagRECT fillArea, int color)
|
||||
{
|
||||
if (!inRender)
|
||||
{
|
||||
myTarget.Fill(ref fillArea, color);
|
||||
return;
|
||||
}
|
||||
throw new RenderViolationException("MUST call 'Fill' outside of a BeginRender/EndRender block");
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void UnsafeSetSurface(object pSurface)
|
||||
{
|
||||
myTarget.SetSurface(pSurface);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myTarget != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myTarget);
|
||||
}
|
||||
myTarget = null;
|
||||
isDisposed = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public interface IControlWrapper
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
object Underlying { get; }
|
||||
|
||||
int Id { get; }
|
||||
|
||||
int ChildCount { get; }
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
void Initialize(object control);
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
object ChildById(int id);
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
object ChildByIndex(int index);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
using System.Collections;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public interface IIndexedProvider<IndexType>
|
||||
{
|
||||
object GetIndexedObject(IndexType index, int item);
|
||||
|
||||
IEnumerator GetEnumerator(IndexType index);
|
||||
|
||||
int Count(IndexType index);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
internal interface IIndexedValueProvider
|
||||
{
|
||||
int GetIndexedObject(hookIndexType index, int item);
|
||||
}
|
||||
14
Managed/Decal.Adapter/Decal.Adapter.Wrappers/IViewHandler.cs
Normal file
14
Managed/Decal.Adapter/Decal.Adapter.Wrappers/IViewHandler.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System.Reflection;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public interface IViewHandler
|
||||
{
|
||||
ViewWrapper DefaultView { get; }
|
||||
|
||||
BindingFlags BindingFlags { get; }
|
||||
|
||||
void LoadView(string name, string resource);
|
||||
|
||||
ViewWrapper GetView(string name);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public sealed class IndexedCollection<InternalIndexType, IndexType, RType> : MarshalByRefObject, IEnumerable<RType>, IEnumerable where InternalIndexType : struct, IConvertible where IndexType : struct, IConvertible
|
||||
{
|
||||
private InternalIndexType myDataType;
|
||||
|
||||
private IIndexedProvider<InternalIndexType> myWrap;
|
||||
|
||||
public RType this[IndexType index] => (RType)myWrap.GetIndexedObject(myDataType, index.ToInt32(CultureInfo.InvariantCulture));
|
||||
|
||||
public int Count => myWrap.Count(myDataType);
|
||||
|
||||
internal IndexedCollection(IIndexedProvider<InternalIndexType> wrap, InternalIndexType data)
|
||||
{
|
||||
myDataType = data;
|
||||
myWrap = wrap;
|
||||
}
|
||||
|
||||
IEnumerator<RType> IEnumerable<RType>.GetEnumerator()
|
||||
{
|
||||
return (IEnumerator<RType>)myWrap.GetEnumerator(myDataType);
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return myWrap.GetEnumerator(myDataType);
|
||||
}
|
||||
}
|
||||
56
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ListColumn.cs
Normal file
56
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ListColumn.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using System.Drawing;
|
||||
using Decal.Adapter.Support;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ListColumn
|
||||
{
|
||||
private ListWrapper myList;
|
||||
|
||||
private int rowIndex;
|
||||
|
||||
private int colIndex;
|
||||
|
||||
public object this[int subVal]
|
||||
{
|
||||
get
|
||||
{
|
||||
return myList.get_Data(rowIndex, colIndex, subVal);
|
||||
}
|
||||
set
|
||||
{
|
||||
myList.set_Data(rowIndex, colIndex, subVal, ref value);
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.ColorFromBGR(myList.get_Color(rowIndex, colIndex));
|
||||
}
|
||||
set
|
||||
{
|
||||
myList.set_Color(rowIndex, colIndex, Util.ColorToBGR(value));
|
||||
}
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return myList.get_ColWidth(colIndex);
|
||||
}
|
||||
set
|
||||
{
|
||||
myList.set_ColWidth(colIndex, value);
|
||||
}
|
||||
}
|
||||
|
||||
internal ListColumn(ListWrapper list, int row, int col)
|
||||
{
|
||||
myList = list;
|
||||
rowIndex = row;
|
||||
colIndex = col;
|
||||
}
|
||||
}
|
||||
29
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ListRow.cs
Normal file
29
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ListRow.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ListRow
|
||||
{
|
||||
private ListWrapper myList;
|
||||
|
||||
private int rowIndex;
|
||||
|
||||
private int colCount;
|
||||
|
||||
public ListColumn this[int column]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (column >= 0 && column < colCount)
|
||||
{
|
||||
return new ListColumn(myList, rowIndex, column);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
internal ListRow(ListWrapper list, int row)
|
||||
{
|
||||
myList = list;
|
||||
rowIndex = row;
|
||||
colCount = myList.ColCount;
|
||||
}
|
||||
}
|
||||
194
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ListWrapper.cs
Normal file
194
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ListWrapper.cs
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
using System;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ListWrapper : ControlWrapperBase<ListClass>
|
||||
{
|
||||
private EventHandler<ControlEventArgs> evtDestroy;
|
||||
|
||||
private EventHandler<ListSelectEventArgs> evtSelect;
|
||||
|
||||
public ListRow this[int row]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (row >= 0 && row < base.Control.Count)
|
||||
{
|
||||
return new ListRow(this, row);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AutoScroll
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.AutoScroll;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.AutoScroll = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int RowEstimate
|
||||
{
|
||||
set
|
||||
{
|
||||
base.Control.RowEstimate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int ScrollPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.ScrollPosition;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.ScrollPosition = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int RowCount => base.Control.Count;
|
||||
|
||||
public int ColCount => base.Control.CountCols;
|
||||
|
||||
public event EventHandler<ControlEventArgs> Destroy
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy += DestroyEvent;
|
||||
}
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ListSelectEventArgs> Selected
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtSelect == null)
|
||||
{
|
||||
base.Control.Change += SelectEvent;
|
||||
}
|
||||
evtSelect = (EventHandler<ListSelectEventArgs>)Delegate.Combine(evtSelect, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtSelect = (EventHandler<ListSelectEventArgs>)Delegate.Remove(evtSelect, value);
|
||||
if (evtSelect == null)
|
||||
{
|
||||
base.Control.Change -= SelectEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
if (evtSelect != null)
|
||||
{
|
||||
evtSelect = (EventHandler<ListSelectEventArgs>)Delegate.Remove(evtSelect, evtSelect);
|
||||
base.Control.Change -= SelectEvent;
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
internal int AddRow()
|
||||
{
|
||||
return base.Control.AddRow();
|
||||
}
|
||||
|
||||
internal object get_Data(int row, int col, int subVal)
|
||||
{
|
||||
return ((dynamic)base.Control).get_Data(col, row, subVal);
|
||||
}
|
||||
|
||||
internal void set_Data(int row, int col, int subVal, ref object val)
|
||||
{
|
||||
((dynamic)base.Control).set_Data(col, row, subVal, val);
|
||||
}
|
||||
|
||||
internal int get_Color(int row, int col)
|
||||
{
|
||||
return ((dynamic)base.Control).get_Color(col, row);
|
||||
}
|
||||
|
||||
internal void set_Color(int row, int col, int color)
|
||||
{
|
||||
((dynamic)base.Control).set_Color(col, row, color);
|
||||
}
|
||||
|
||||
internal int get_ColWidth(int col)
|
||||
{
|
||||
return ((dynamic)base.Control).get_ColumnWidth(col);
|
||||
}
|
||||
|
||||
internal void set_ColWidth(int col, int width)
|
||||
{
|
||||
((dynamic)base.Control).set_ColumnWidth(col, width);
|
||||
}
|
||||
|
||||
public ListRow Add()
|
||||
{
|
||||
return new ListRow(this, AddRow());
|
||||
}
|
||||
|
||||
public ListRow Insert(int row)
|
||||
{
|
||||
base.Control.InsertRow(row);
|
||||
return new ListRow(this, row);
|
||||
}
|
||||
|
||||
public void JumpToPosition(int row)
|
||||
{
|
||||
base.Control.JumpToPosition(row);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
base.Control.Clear();
|
||||
}
|
||||
|
||||
public void Delete(int index)
|
||||
{
|
||||
base.Control.DeleteRow(index);
|
||||
}
|
||||
|
||||
private void SelectEvent(int ID, int Col, int Row)
|
||||
{
|
||||
if (evtSelect != null)
|
||||
{
|
||||
evtSelect(new ListColumn(this, Row, Col), new ListSelectEventArgs(ID, Row, Col));
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyEvent(int ID)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class LoginEventArgs : EventArgs
|
||||
{
|
||||
private int myId;
|
||||
|
||||
public int Id => myId;
|
||||
|
||||
internal LoginEventArgs(int Id)
|
||||
{
|
||||
myId = Id;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class LogoffEventArgs : EventArgs
|
||||
{
|
||||
private LogoffEventType myType;
|
||||
|
||||
public LogoffEventType Type => myType;
|
||||
|
||||
internal LogoffEventArgs(LogoffEventType type)
|
||||
{
|
||||
myType = type;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum LogoffEventType
|
||||
{
|
||||
Requested,
|
||||
Authorized
|
||||
}
|
||||
108
Managed/Decal.Adapter/Decal.Adapter.Wrappers/LongValueKey.cs
Normal file
108
Managed/Decal.Adapter/Decal.Adapter.Wrappers/LongValueKey.cs
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public enum LongValueKey
|
||||
{
|
||||
Type = 218103808,
|
||||
Icon = 218103809,
|
||||
Container = 218103810,
|
||||
Landblock = 218103811,
|
||||
ItemSlots = 218103812,
|
||||
PackSlots = 218103813,
|
||||
StackCount = 218103814,
|
||||
StackMax = 218103815,
|
||||
AssociatedSpell = 218103816,
|
||||
SlotLegacy = 218103817,
|
||||
Wielder = 218103818,
|
||||
WieldingSlot = 218103819,
|
||||
Monarch = 218103820,
|
||||
Coverage = 218103821,
|
||||
EquipableSlots = 218103822,
|
||||
EquipType = 218103823,
|
||||
IconOutline = 218103824,
|
||||
MissileType = 218103825,
|
||||
UsageMask = 218103826,
|
||||
HouseOwner = 218103827,
|
||||
HookMask = 218103828,
|
||||
HookType = 218103829,
|
||||
Model = 218103830,
|
||||
Flags = 218103831,
|
||||
CreateFlags1 = 218103832,
|
||||
CreateFlags2 = 218103833,
|
||||
Category = 218103834,
|
||||
Behavior = 218103835,
|
||||
MagicDef = 218103836,
|
||||
SpecialProps = 218103837,
|
||||
SpellCount = 218103838,
|
||||
WeapSpeed = 218103839,
|
||||
EquipSkill = 218103840,
|
||||
DamageType = 218103841,
|
||||
MaxDamage = 218103842,
|
||||
Unknown10 = 218103843,
|
||||
Unknown100000 = 218103844,
|
||||
Unknown800000 = 218103845,
|
||||
Unknown8000000 = 218103846,
|
||||
PhysicsDataFlags = 218103847,
|
||||
ActiveSpellCount = 218103848,
|
||||
IconOverlay = 218103849,
|
||||
IconUnderlay = 218103850,
|
||||
Species = 2,
|
||||
Burden = 5,
|
||||
EquippedSlots = 10,
|
||||
RareId = 17,
|
||||
Value = 19,
|
||||
TotalValue = 20,
|
||||
SkillCreditsAvail = 24,
|
||||
CreatureLevel = 25,
|
||||
RestrictedToToD = 26,
|
||||
ArmorLevel = 28,
|
||||
Rank = 30,
|
||||
Bonded = 33,
|
||||
NumberFollowers = 35,
|
||||
Unenchantable = 36,
|
||||
LockpickDifficulty = 38,
|
||||
Deaths = 43,
|
||||
WandElemDmgType = 45,
|
||||
MinLevelRestrict = 86,
|
||||
MaxLevelRestrict = 87,
|
||||
LockpickSkillBonus = 88,
|
||||
AffectsVitalId = 89,
|
||||
AffectsVitalAmt = 90,
|
||||
HealKitSkillBonus = 90,
|
||||
UsesTotal = 91,
|
||||
UsesRemaining = 92,
|
||||
DateOfBirth = 98,
|
||||
Workmanship = 105,
|
||||
Spellcraft = 106,
|
||||
CurrentMana = 107,
|
||||
MaximumMana = 108,
|
||||
LoreRequirement = 109,
|
||||
RankRequirement = 110,
|
||||
PortalRestrictions = 111,
|
||||
Gender = 113,
|
||||
Attuned = 114,
|
||||
SkillLevelReq = 115,
|
||||
ManaCost = 117,
|
||||
Age = 125,
|
||||
XPForVPReduction = 129,
|
||||
Material = 131,
|
||||
WieldReqType = 158,
|
||||
WieldReqAttribute = 159,
|
||||
WieldReqValue = 160,
|
||||
SlayerSpecies = 166,
|
||||
NumberItemsSalvagedFrom = 170,
|
||||
NumberTimesTinkered = 171,
|
||||
DescriptionFormat = 172,
|
||||
PagesUsed = 174,
|
||||
PagesTotal = 175,
|
||||
ActivationReqSkillId = 176,
|
||||
GemSettingQty = 177,
|
||||
GemSettingType = 178,
|
||||
Imbued = 179,
|
||||
Heritage = 188,
|
||||
FishingSkill = 192,
|
||||
KeysHeld = 193,
|
||||
ElementalDmgBonus = 204,
|
||||
CleaveType = 263,
|
||||
ArmorSet = 265,
|
||||
Slot = 231735296
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class MoveObjectEventArgs : EventArgs
|
||||
{
|
||||
private WorldObject myMovedObject;
|
||||
|
||||
public WorldObject Moved => myMovedObject;
|
||||
|
||||
internal MoveObjectEventArgs(WorldObject movedObject)
|
||||
{
|
||||
myMovedObject = movedObject;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using Decal.Interop.Net;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public sealed class NetServiceHost : HostBase
|
||||
{
|
||||
private NetService myService;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public NetService Underlying => myService;
|
||||
|
||||
public DecalWrapper Decal
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.MyDecal == null)
|
||||
{
|
||||
base.MyDecal = new DecalWrapper(myService.Decal);
|
||||
}
|
||||
return base.MyDecal;
|
||||
}
|
||||
}
|
||||
|
||||
public HooksWrapper Actions => CoreManager.Current.Actions;
|
||||
|
||||
internal NetServiceHost(NetService svc)
|
||||
{
|
||||
myService = svc;
|
||||
base.MyDecal = new DecalWrapper(myService.Decal);
|
||||
}
|
||||
|
||||
public object GetComFilter(string progId)
|
||||
{
|
||||
return ((dynamic)(INetService)myService).get_FilterVB(progId);
|
||||
}
|
||||
|
||||
public object GetComFilter(Guid clsid, Guid riid)
|
||||
{
|
||||
return ((dynamic)(INetService)myService).get_Filter(ref clsid, ref riid);
|
||||
}
|
||||
}
|
||||
117
Managed/Decal.Adapter/Decal.Adapter.Wrappers/NotebookWrapper.cs
Normal file
117
Managed/Decal.Adapter/Decal.Adapter.Wrappers/NotebookWrapper.cs
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
using System;
|
||||
using Decal.Interop.Controls;
|
||||
using Decal.Interop.Inject;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class NotebookWrapper : ControlWrapperBase<NotebookClass>
|
||||
{
|
||||
private EventHandler<ControlEventArgs> evtDestroy;
|
||||
|
||||
private EventHandler<IndexChangeEventArgs> evtChange;
|
||||
|
||||
private PageTextIndexer myPageIndex;
|
||||
|
||||
public int ActiveTab
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.ActiveTab;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.ActiveTab = value;
|
||||
}
|
||||
}
|
||||
|
||||
public PageTextIndexer PageText => myPageIndex;
|
||||
|
||||
public event EventHandler<ControlEventArgs> Destroy
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy += DestroyEvent;
|
||||
}
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<IndexChangeEventArgs> Change
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtChange == null)
|
||||
{
|
||||
base.Control.Change += ChangeEvent;
|
||||
}
|
||||
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Combine(evtChange, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Remove(evtChange, value);
|
||||
if (evtChange == null)
|
||||
{
|
||||
base.Control.Change -= ChangeEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize(object control)
|
||||
{
|
||||
base.Initialize(control);
|
||||
myPageIndex = new PageTextIndexer(base.Control);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
if (evtChange != null)
|
||||
{
|
||||
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Remove(evtChange, evtChange);
|
||||
base.Control.Change -= ChangeEvent;
|
||||
}
|
||||
if (myPageIndex != null)
|
||||
{
|
||||
myPageIndex.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public void AddPage(string text, IControl control)
|
||||
{
|
||||
base.Control.AddPage(text, control);
|
||||
}
|
||||
|
||||
private void ChangeEvent(int ID, int Index)
|
||||
{
|
||||
if (evtChange != null)
|
||||
{
|
||||
evtChange(this, new IndexChangeEventArgs(ID, Index));
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyEvent(int ID)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
49
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ObjectClass.cs
Normal file
49
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ObjectClass.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public enum ObjectClass
|
||||
{
|
||||
Unknown,
|
||||
MeleeWeapon,
|
||||
Armor,
|
||||
Clothing,
|
||||
Jewelry,
|
||||
Monster,
|
||||
Food,
|
||||
Money,
|
||||
Misc,
|
||||
MissileWeapon,
|
||||
Container,
|
||||
Gem,
|
||||
SpellComponent,
|
||||
Key,
|
||||
Portal,
|
||||
TradeNote,
|
||||
ManaStone,
|
||||
Plant,
|
||||
BaseCooking,
|
||||
BaseAlchemy,
|
||||
BaseFletching,
|
||||
CraftedCooking,
|
||||
CraftedAlchemy,
|
||||
CraftedFletching,
|
||||
Player,
|
||||
Vendor,
|
||||
Door,
|
||||
Corpse,
|
||||
Lifestone,
|
||||
HealingKit,
|
||||
Lockpick,
|
||||
WandStaffOrb,
|
||||
Bundle,
|
||||
Book,
|
||||
Journal,
|
||||
Sign,
|
||||
Housing,
|
||||
Npc,
|
||||
Foci,
|
||||
Salvage,
|
||||
Ust,
|
||||
Services,
|
||||
Scroll,
|
||||
NumObjectClasses
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public sealed class PageTextIndexer : IDisposable
|
||||
{
|
||||
private NotebookClass myControl;
|
||||
|
||||
public string this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((dynamic)myControl).get_PageText(index);
|
||||
}
|
||||
set
|
||||
{
|
||||
((dynamic)myControl).set_PageText(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
internal PageTextIndexer(NotebookClass control)
|
||||
{
|
||||
myControl = control;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
myControl = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum PlayerModifyEventType
|
||||
{
|
||||
Skill,
|
||||
Attribute,
|
||||
Vital,
|
||||
Statistic,
|
||||
Allegiance,
|
||||
Augmentation
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum PlayerXPEventType
|
||||
{
|
||||
Total,
|
||||
Unassigned
|
||||
}
|
||||
149
Managed/Decal.Adapter/Decal.Adapter.Wrappers/PluginHost.cs
Normal file
149
Managed/Decal.Adapter/Decal.Adapter.Wrappers/PluginHost.cs
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Xml;
|
||||
using Decal.Interop.Core;
|
||||
using Decal.Interop.Inject;
|
||||
using Decal.Interop.Render;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public sealed class PluginHost : HostBase
|
||||
{
|
||||
private IPluginSite2 mySite;
|
||||
|
||||
private IPluginSite myOldSite;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public IPluginSite2 Underlying => mySite;
|
||||
|
||||
public DecalWrapper Decal
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.MyDecal == null)
|
||||
{
|
||||
base.MyDecal = new DecalWrapper(mySite.Decal);
|
||||
}
|
||||
return base.MyDecal;
|
||||
}
|
||||
}
|
||||
|
||||
public HooksWrapper Actions => CoreManager.Current.Actions;
|
||||
|
||||
public RenderServiceWrapper Render
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.MyRender == null)
|
||||
{
|
||||
base.MyRender = new RenderServiceWrapper((RenderService)GetObject("services\\DecalRender.RenderService"));
|
||||
}
|
||||
return base.MyRender;
|
||||
}
|
||||
}
|
||||
|
||||
internal PluginHost(PluginSite2 pSite)
|
||||
{
|
||||
mySite = pSite;
|
||||
base.MyDecal = new DecalWrapper(mySite.Decal);
|
||||
myOldSite = (IPluginSite)mySite.PluginSite;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = base.IsDisposed;
|
||||
if (myOldSite != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myOldSite);
|
||||
myOldSite = null;
|
||||
}
|
||||
if (mySite != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(mySite);
|
||||
mySite = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
public object GetObject(string path)
|
||||
{
|
||||
return ((dynamic)mySite).get_Object(path);
|
||||
}
|
||||
|
||||
public int GetKeyboardMapping(string name)
|
||||
{
|
||||
return myOldSite.QueryKeyboardMap(name);
|
||||
}
|
||||
|
||||
internal static void LoadViewHandler(IViewHandler handler)
|
||||
{
|
||||
if (ViewWrapper.ScanViews(handler))
|
||||
{
|
||||
ViewWrapper.ScanControls(handler);
|
||||
ViewWrapper.ScanReferences(handler);
|
||||
}
|
||||
}
|
||||
|
||||
public ViewHandler LoadViewHandler(Type handlerType)
|
||||
{
|
||||
ViewHandler obj = (ViewHandler)Activator.CreateInstance(handlerType, this);
|
||||
LoadViewHandler(obj);
|
||||
obj.LoadComplete();
|
||||
return obj;
|
||||
}
|
||||
|
||||
public ViewWrapper LoadViewResource(string resourcePath)
|
||||
{
|
||||
Assembly callingAssembly = Assembly.GetCallingAssembly();
|
||||
return LoadViewResource(resourcePath, callingAssembly);
|
||||
}
|
||||
|
||||
public ViewWrapper LoadViewResource(string resourcePath, Assembly resourceAssembly)
|
||||
{
|
||||
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0022: Expected O, but got Unknown
|
||||
if (null == resourceAssembly)
|
||||
{
|
||||
throw new ArgumentNullException("resourceAssembly");
|
||||
}
|
||||
Stream manifestResourceStream = resourceAssembly.GetManifestResourceStream(resourcePath);
|
||||
XmlDocument val = new XmlDocument();
|
||||
val.Load(manifestResourceStream);
|
||||
return LoadView(((XmlNode)val).OuterXml);
|
||||
}
|
||||
|
||||
public ViewWrapper LoadView(XmlElement viewSchema)
|
||||
{
|
||||
if (viewSchema == null)
|
||||
{
|
||||
throw new ArgumentNullException("viewSchema");
|
||||
}
|
||||
return LoadView(((XmlNode)viewSchema).OuterXml);
|
||||
}
|
||||
|
||||
public ViewWrapper LoadView(string viewSchema)
|
||||
{
|
||||
View view = myOldSite.LoadView(viewSchema);
|
||||
if (view != null)
|
||||
{
|
||||
return new ViewWrapper(view);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ComFilter(string progId)
|
||||
{
|
||||
return ((dynamic)mySite).get_Object("services\\DecalNet.NetService\\" + progId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public enum PortalEventType
|
||||
{
|
||||
EnterPortal,
|
||||
ExitPortal
|
||||
}
|
||||
211
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ProgressWrapper.cs
Normal file
211
Managed/Decal.Adapter/Decal.Adapter.Wrappers/ProgressWrapper.cs
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ProgressWrapper : ControlWrapperBase<ProgressClass>
|
||||
{
|
||||
private EventHandler<ControlEventArgs> evtDestroy;
|
||||
|
||||
private string alignment;
|
||||
|
||||
private Color borderColor;
|
||||
|
||||
private int borderWidth;
|
||||
|
||||
private bool drawText;
|
||||
|
||||
private Color faceColor;
|
||||
|
||||
private Color fillColor;
|
||||
|
||||
private int maxValue;
|
||||
|
||||
private string preText;
|
||||
|
||||
private string postText;
|
||||
|
||||
private Color textColor;
|
||||
|
||||
public string Alignment
|
||||
{
|
||||
get
|
||||
{
|
||||
return alignment;
|
||||
}
|
||||
set
|
||||
{
|
||||
alignment = value;
|
||||
base.Control.Alignment = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color BorderColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return borderColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
base.Control.BorderColor = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public int BorderWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return borderWidth;
|
||||
}
|
||||
set
|
||||
{
|
||||
borderWidth = value;
|
||||
base.Control.BorderWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DrawText
|
||||
{
|
||||
get
|
||||
{
|
||||
return drawText;
|
||||
}
|
||||
set
|
||||
{
|
||||
drawText = value;
|
||||
base.Control.DecalDrawText = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color FaceColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return faceColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
faceColor = value;
|
||||
base.Control.FaceColor = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public Color FillColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return fillColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
fillColor = value;
|
||||
base.Control.FillColor = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
maxValue = value;
|
||||
base.Control.MaxValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string PostText
|
||||
{
|
||||
get
|
||||
{
|
||||
return postText;
|
||||
}
|
||||
set
|
||||
{
|
||||
postText = value;
|
||||
base.Control.PostText = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string PreText
|
||||
{
|
||||
get
|
||||
{
|
||||
return preText;
|
||||
}
|
||||
set
|
||||
{
|
||||
preText = value;
|
||||
base.Control.PreText = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color TextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return textColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
textColor = value;
|
||||
base.Control.TextColor = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Destroy
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy += DestroyEvent;
|
||||
}
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && evtDestroy != null)
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void DestroyEvent(int ID)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Controls;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class PushButtonWrapper : ControlWrapperBase<PushButtonClass>
|
||||
{
|
||||
private EventHandler<ControlEventArgs> evtClick;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtCancel;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtDestroy;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtHit;
|
||||
|
||||
private EventHandler<ControlEventArgs> evtUnhit;
|
||||
|
||||
public Color FaceColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.ColorFromBGR(base.Control.FaceColor);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.FaceColor = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public Color TextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.ColorFromBGR(base.Control.TextColor);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.TextColor = Util.ColorToBGR(value);
|
||||
}
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Control.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Control.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Click
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtClick == null)
|
||||
{
|
||||
base.Control.Accepted += ClickEvent;
|
||||
}
|
||||
evtClick = (EventHandler<ControlEventArgs>)Delegate.Combine(evtClick, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtClick = (EventHandler<ControlEventArgs>)Delegate.Remove(evtClick, value);
|
||||
if (evtClick == null)
|
||||
{
|
||||
base.Control.Accepted -= ClickEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Canceled
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtCancel == null)
|
||||
{
|
||||
base.Control.Canceled += CanceledEvent;
|
||||
}
|
||||
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Combine(evtCancel, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Remove(evtCancel, value);
|
||||
if (evtCancel == null)
|
||||
{
|
||||
base.Control.Canceled -= CanceledEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Destroy
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy += DestroyEvent;
|
||||
}
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
|
||||
if (evtDestroy == null)
|
||||
{
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Hit
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtHit == null)
|
||||
{
|
||||
base.Control.Hit += HitEvent;
|
||||
}
|
||||
evtHit = (EventHandler<ControlEventArgs>)Delegate.Combine(evtHit, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtHit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtHit, value);
|
||||
if (evtHit == null)
|
||||
{
|
||||
base.Control.Hit -= HitEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ControlEventArgs> Unhit
|
||||
{
|
||||
add
|
||||
{
|
||||
if (evtUnhit == null)
|
||||
{
|
||||
base.Control.Unhit += UnhitEvent;
|
||||
}
|
||||
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Combine(evtUnhit, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtUnhit, value);
|
||||
if (evtUnhit == null)
|
||||
{
|
||||
base.Control.Unhit -= UnhitEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (evtClick != null)
|
||||
{
|
||||
evtClick = (EventHandler<ControlEventArgs>)Delegate.Remove(evtClick, evtClick);
|
||||
base.Control.Accepted -= ClickEvent;
|
||||
}
|
||||
if (evtCancel != null)
|
||||
{
|
||||
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Remove(evtCancel, evtCancel);
|
||||
base.Control.Canceled -= CanceledEvent;
|
||||
}
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
|
||||
base.Control.Destroy -= DestroyEvent;
|
||||
}
|
||||
if (evtHit != null)
|
||||
{
|
||||
evtHit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtHit, evtHit);
|
||||
base.Control.Hit -= HitEvent;
|
||||
}
|
||||
if (evtUnhit != null)
|
||||
{
|
||||
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtUnhit, evtUnhit);
|
||||
base.Control.Unhit -= UnhitEvent;
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void ClickEvent(int ID)
|
||||
{
|
||||
if (evtClick != null)
|
||||
{
|
||||
evtClick(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void UnhitEvent(int ID)
|
||||
{
|
||||
if (evtUnhit != null)
|
||||
{
|
||||
evtUnhit(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void HitEvent(int ID)
|
||||
{
|
||||
if (evtHit != null)
|
||||
{
|
||||
evtHit(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyEvent(int ID)
|
||||
{
|
||||
if (evtDestroy != null)
|
||||
{
|
||||
evtDestroy(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
|
||||
private void CanceledEvent(int ID)
|
||||
{
|
||||
if (evtCancel != null)
|
||||
{
|
||||
evtCancel(this, new ControlEventArgs(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ReleaseObjectEventArgs : EventArgs
|
||||
{
|
||||
private WorldObject mWO;
|
||||
|
||||
public WorldObject Released => mWO;
|
||||
|
||||
internal ReleaseObjectEventArgs(WorldObject releasedObject)
|
||||
{
|
||||
mWO = releasedObject;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Adapter.Support;
|
||||
using Decal.Interop.Core;
|
||||
using Decal.Interop.Inject;
|
||||
using Decal.Interop.Render;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class RenderServiceWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private RenderService internalRender;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
private EventHandler myDeviceLost;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public object UnsafeDevice => internalRender.Device;
|
||||
|
||||
internal event EventHandler DeviceLost
|
||||
{
|
||||
add
|
||||
{
|
||||
myDeviceLost = (EventHandler)Delegate.Combine(myDeviceLost, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
myDeviceLost = (EventHandler)Delegate.Combine(myDeviceLost, value);
|
||||
}
|
||||
}
|
||||
|
||||
internal RenderServiceWrapper(RenderService render)
|
||||
{
|
||||
internalRender = render;
|
||||
internalRender.DeviceLost += internalRender_DeviceLost;
|
||||
}
|
||||
|
||||
~RenderServiceWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
private void internalRender_DeviceLost()
|
||||
{
|
||||
if (myDeviceLost != null)
|
||||
{
|
||||
myDeviceLost(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void myHUD_Disposing(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is Hud hud)
|
||||
{
|
||||
RemoveHud(hud);
|
||||
hud.Disposing -= myHUD_Disposing;
|
||||
}
|
||||
}
|
||||
|
||||
public Background CreateBackground(Rectangle region)
|
||||
{
|
||||
return UnsafeCreateBackground(Util.toTagRECT(region));
|
||||
}
|
||||
|
||||
public Hud CreateHud(Rectangle region)
|
||||
{
|
||||
return UnsafeCreateHud(Util.toTagRECT(region));
|
||||
}
|
||||
|
||||
public void RemoveHud(Hud hud)
|
||||
{
|
||||
if (hud == null)
|
||||
{
|
||||
throw new ArgumentNullException("hud");
|
||||
}
|
||||
internalRender.RemoveHUD(hud.Underlying);
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Background UnsafeCreateBackground(tagRECT pRegion)
|
||||
{
|
||||
return new Background(internalRender.CreateBackground(ref pRegion));
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Hud UnsafeCreateHud(tagRECT pRegion)
|
||||
{
|
||||
Hud hud = new Hud(internalRender.CreateHUD(ref pRegion));
|
||||
hud.Disposing += myHUD_Disposing;
|
||||
return hud;
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Background EncapsulateBackground(tagPOINT coordinates, object surface)
|
||||
{
|
||||
return new Background(internalRender.EncapsulateBackground(ref coordinates, surface));
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Hud EncapsulateHud(tagPOINT coordinates, object surface)
|
||||
{
|
||||
return new Hud(internalRender.EncapsulateHUD(ref coordinates, surface));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed && disposing)
|
||||
{
|
||||
internalRender.DeviceLost -= internalRender_DeviceLost;
|
||||
}
|
||||
if (internalRender != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(internalRender);
|
||||
}
|
||||
internalRender = null;
|
||||
isDisposed = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class ResetTradeEventArgs : EventArgs
|
||||
{
|
||||
private int mTraderId;
|
||||
|
||||
public int TraderId => mTraderId;
|
||||
|
||||
internal ResetTradeEventArgs(int TraderId)
|
||||
{
|
||||
mTraderId = TraderId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
public class SettingsEventArgs : EventArgs
|
||||
{
|
||||
private int mySetting;
|
||||
|
||||
public int Setting => mySetting;
|
||||
|
||||
internal SettingsEventArgs(int Setting)
|
||||
{
|
||||
mySetting = Setting;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Filters;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class SkillInfoWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private SkillInfo mySkillInfo;
|
||||
|
||||
private TrainingType myTraining;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
public int Base => mySkillInfo.Base;
|
||||
|
||||
public int Bonus => mySkillInfo.Bonus;
|
||||
|
||||
public int Buffed => mySkillInfo.Buffed;
|
||||
|
||||
public int Current => mySkillInfo.Current;
|
||||
|
||||
public int XP => mySkillInfo.Exp;
|
||||
|
||||
public string Formula => mySkillInfo.Formula;
|
||||
|
||||
public int Increment => mySkillInfo.Increment;
|
||||
|
||||
public bool Known => mySkillInfo.Known;
|
||||
|
||||
public string Name => mySkillInfo.Name;
|
||||
|
||||
public string ShortName => mySkillInfo.ShortName;
|
||||
|
||||
public TrainingType Training => myTraining;
|
||||
|
||||
internal SkillInfoWrapper(SkillInfo info)
|
||||
{
|
||||
mySkillInfo = info;
|
||||
switch (info.Training)
|
||||
{
|
||||
case eTrainingType.eTrainUnusable:
|
||||
myTraining = TrainingType.Unusable;
|
||||
break;
|
||||
case eTrainingType.eTrainUntrained:
|
||||
myTraining = TrainingType.Untrained;
|
||||
break;
|
||||
case eTrainingType.eTrainTrained:
|
||||
myTraining = TrainingType.Trained;
|
||||
break;
|
||||
case eTrainingType.eTrainSpecialized:
|
||||
myTraining = TrainingType.Specialized;
|
||||
break;
|
||||
default:
|
||||
myTraining = TrainingType.Unusable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
~SkillInfoWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (mySkillInfo != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(mySkillInfo);
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
protected void EnforceDisposedOnce()
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("SkillInfoWrapper");
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue