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>
74 lines
2.3 KiB
C#
74 lines
2.3 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading;
|
|
using Decal.Interop.Net;
|
|
|
|
namespace Decal.DecalNet
|
|
{
|
|
[ComVisible(true)]
|
|
[Guid("15631E36-55CB-4D16-ADE7-74D9F8A5F4B6")]
|
|
[ClassInterface(ClassInterfaceType.None)]
|
|
[ComSourceInterfaces(typeof(IWebRequestEvents))]
|
|
[ProgId("DecalNet.WebRequest")]
|
|
public class WebRequestImpl : IWebRequest
|
|
{
|
|
public event IWebRequestEvents_BeginEventHandler Begin;
|
|
public event IWebRequestEvents_EndEventHandler End;
|
|
|
|
public void Get(string strURL)
|
|
{
|
|
Begin?.Invoke();
|
|
ThreadPool.QueueUserWorkItem(_ =>
|
|
{
|
|
try
|
|
{
|
|
using (var client = new WebClient())
|
|
{
|
|
string result = client.DownloadString(strURL);
|
|
End?.Invoke(200, result);
|
|
}
|
|
}
|
|
catch (WebException ex)
|
|
{
|
|
int code = 0;
|
|
if (ex.Response is HttpWebResponse resp)
|
|
code = (int)resp.StatusCode;
|
|
End?.Invoke(code, ex.Message);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
End?.Invoke(0, ex.Message);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void Post(string strURL, string strPostData)
|
|
{
|
|
Begin?.Invoke();
|
|
ThreadPool.QueueUserWorkItem(_ =>
|
|
{
|
|
try
|
|
{
|
|
using (var client = new WebClient())
|
|
{
|
|
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
|
|
string result = client.UploadString(strURL, strPostData);
|
|
End?.Invoke(200, result);
|
|
}
|
|
}
|
|
catch (WebException ex)
|
|
{
|
|
int code = 0;
|
|
if (ex.Response is HttpWebResponse resp)
|
|
code = (int)resp.StatusCode;
|
|
End?.Invoke(code, ex.Message);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
End?.Invoke(0, ex.Message);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|