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>
154 lines
2.6 KiB
C#
154 lines
2.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Decal.Interop.Filters;
|
|
|
|
namespace Decal.Adapter.Wrappers;
|
|
|
|
public class WorldObjectCollection : GenericDisposableWrapper<WorldIterator>, IEnumerable<WorldObject>, IEnumerable
|
|
{
|
|
public class Iterator : IEnumerator<WorldObject>, IDisposable, IEnumerator
|
|
{
|
|
private WorldObjectCollection collection;
|
|
|
|
private WorldObject current;
|
|
|
|
public WorldObject Current
|
|
{
|
|
get
|
|
{
|
|
if (current == null)
|
|
{
|
|
MoveNext();
|
|
}
|
|
return current;
|
|
}
|
|
}
|
|
|
|
object IEnumerator.Current
|
|
{
|
|
get
|
|
{
|
|
if (current == null)
|
|
{
|
|
MoveNext();
|
|
}
|
|
return current;
|
|
}
|
|
}
|
|
|
|
internal Iterator(WorldObjectCollection collection)
|
|
{
|
|
this.collection = collection;
|
|
Reset();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
collection = null;
|
|
}
|
|
|
|
public bool MoveNext()
|
|
{
|
|
Decal.Interop.Filters.WorldObject ppObject = null;
|
|
bool num = collection.Wrapped.Next(ref ppObject);
|
|
if (num && ppObject != null)
|
|
{
|
|
current = collection.wf.GetCachedWorldObject(ppObject);
|
|
}
|
|
return num;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
collection.Wrapped.Reset();
|
|
}
|
|
}
|
|
|
|
private WorldObject current;
|
|
|
|
private WorldFilter wf;
|
|
|
|
private IEnumerator<WorldObject> myEnum;
|
|
|
|
public int Count => base.Wrapped.Count;
|
|
|
|
public int Quantity => base.Wrapped.Quantity;
|
|
|
|
public WorldObject First
|
|
{
|
|
get
|
|
{
|
|
using IEnumerator<WorldObject> enumerator = GetEnumerator();
|
|
return enumerator.Current;
|
|
}
|
|
}
|
|
|
|
[Obsolete("Use Enumerators")]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
public WorldObject Current
|
|
{
|
|
get
|
|
{
|
|
if (myEnum == null)
|
|
{
|
|
myEnum = GetEnumerator();
|
|
}
|
|
return myEnum.Current;
|
|
}
|
|
}
|
|
|
|
internal WorldObjectCollection(WorldFilter wf, WorldIterator obj)
|
|
: base(obj)
|
|
{
|
|
this.wf = wf;
|
|
}
|
|
|
|
public void SetFilter(WorldObjectCollectionFilter filter)
|
|
{
|
|
filter?.ApplyFilter(base.Wrapped);
|
|
}
|
|
|
|
protected override void Dispose(bool userCalled)
|
|
{
|
|
if (myEnum != null)
|
|
{
|
|
myEnum.Dispose();
|
|
myEnum = null;
|
|
}
|
|
base.Dispose(userCalled);
|
|
}
|
|
|
|
[Obsolete("Use Enumerators")]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
public bool MoveNext()
|
|
{
|
|
if (myEnum == null)
|
|
{
|
|
myEnum = GetEnumerator();
|
|
}
|
|
return myEnum.MoveNext();
|
|
}
|
|
|
|
[Obsolete("Use Enumerators")]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
public void Reset()
|
|
{
|
|
if (myEnum != null)
|
|
{
|
|
myEnum.Dispose();
|
|
myEnum = null;
|
|
}
|
|
}
|
|
|
|
public IEnumerator<WorldObject> GetEnumerator()
|
|
{
|
|
return new Iterator(this);
|
|
}
|
|
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return new Iterator(this);
|
|
}
|
|
}
|