Dungeons2SkinLoader.exePE analysis report - Nothing conclusive
Run integrity
sample ranThe guest staged the sample and launched it, so what follows describes this file rather than an empty desktop.
Nothing conclusive
4/100
31 points short of the suspicious line at 35.
Why this verdict
- 4 supporting capabilities in one unsigned binary: file discovery, process discovery, registry query, system information
Model reading
Evidence ledger above, row by row. Published verdict rests on this column and on nothing to its right.
Reads this report's derived findings, never the sample itself.
A model reading exists for this scan and is shown to the submitter and to staff only. It is a second opinion about evidence the score already priced, it is worth no points, and on a public page it would stand beside the verdict with no grounding a stranger could check.
Analysis layers
Detection signatures
3 detected| Severity | Detection | Evidence | Layer |
|---|---|---|---|
| MED |
.NET source: Decrypts an embedded payload at runtime
MITRE T1140
|
- | dynamic |
| MED |
Ransomware-related strings
MITRE T1486
|
string
.crypt
matched string
|
static |
| INFO |
.NET managed assembly (decompiled)
|
- | static |
What the tests returned
8 testsEach test this run performed and what it returned. A test that was not performed says so rather than reading as a negative result.
| Test | Result |
|---|---|
| Persistence mechanisms | none established at runtime |
| Cross-process injection | none observed |
| Payloads written to disk | none observed |
| Network connections | not tested - internet was disabled |
| Behavioural rule matches (Sigma) | none observed |
| Known-malicious hash (reputation sources) | no source reported this file |
| Local anti-virus engine | reported no detection |
| Anti-analysis / evasion checks | not measured on this run - no in-process API monitor reported in, so the runtime anti-debug and anti-VM calls were never watched |
Absence of an observation is not proof of absence - see Coverage for what this run could and could not test.
Arguing against malice
- The local anti-virus engine reported no detection.
- No reputation source reported this file as malicious.
How much weight this carries
Observed. Observed at runtime and attributed to this sample by one layer. The one fact that decided it: the sample ran for 132s and no malicious behaviour was observed.
Structure
What the file is made of: headers, imports, how it was built and whether it was signed.
Sections & resources
How the file is laid out in memory, and what is embedded in it: section roles, access rights, entropy and every resource entry.
Signatures & packing
What matched and what is hidden: signature rules, detected capabilities, family attribution, packer detection, unpacked payloads and recovered configuration.
Strings
The readable content: embedded secrets, flagged strings and everything extraction recovered.
Code
What the sample would execute: the emulated API call sequence, and the disassembled entry point.
Antivirus engine
no signature matchedNothing in the signature set below matched this file. That is one engine's negative answer against one signature set on one day, and it is not a verdict. A signature engine only recognises what has already been named and published, so a file nobody has named yet scans exactly like a file that is harmless. What this file does when it runs is the stronger evidence; read the behaviour sections for that.
This run did not record which signature set answered, so the result above cannot be tied to a named set or reproduced against one. Recording the set began part way through this platform's history, and this scan predates it.
Local ML assessment
no model scoreThis scan ran before the local classifier was installed on this host, so no model score was produced for it. Submitting the same file again produces one.
Structural rules of thumb, not a model. 2 cheap static signals fired, for 25 of 100 on a rule-of-thumb scale that is deliberately left out of the verdict score: the packing, entropy and signing cards on this report already price the same facts, and counting them a second time under a machine-learning heading would charge one piece of evidence twice.
- very few imports
- unsigned executable
- .NET managed binary (no obfuscator signature matched)
Secrets & malicious strings
1 flagged stringFlagged string categories
| Indicator | Found in | Evidence from the sample |
|---|---|---|
| .crypt | raw bytes | present in the file bytes only |
Security mitigations
partial posture.NET managed
| Assembly | Dungeons2SkinLoader 0.0.0.0 |
|---|---|
| Streams | #~ #Strings #US #GUID #Blob |
| P/Invoke | 0 unmanaged import(s) |
| Resources | md2data.bin, font.ttf |
Sections
3 sections · the file's memory layout| Section | Virtual addr | Raw size | Virtual size | Access | Entropy |
|---|---|---|---|---|---|
|
.textEP
Executable code
|
0x2000 |
3.2 MB
|
3.2 MB
|
EXECUTEREAD
|
2.6449
|
|
.rsrc
Resources
|
0x340000 |
8.5 KB
|
8.4 KB
|
READ
|
7.1031
|
|
.reloc
Base relocations
|
0x344000 |
512.0 B
|
12.0 B
|
READ
|
0.1019
|
Imports
1 funcs / 1 DLLRuntime call marks need the in-guest monitor, which did not arm on this run.
Open the imports pageBinary metadata
what the headers declare about this build| Resource langs | NEU |
|---|---|
| Debug info | no |
| TLS callbacks | no |
Code signing
UnsignedThis binary carries no Authenticode signature. Unsigned executables are a weak suspicious signal - most legitimate vendor software is signed.
Resources
Everything the binary carries inside it: icons, bitmaps, cursors, dialogs, string tables, the manifest and the version block. Select an entry to preview it and take a copy.
Resources
Resource Hacker viewSelect a resource from the tree to inspect its language, size, RVA offset, MD5, entropy and detected content signature - like opening the binary in Resource Hacker.
| Type | Group Icon |
|---|---|
| Name / ID | 32512 |
| Language | NEU |
| Size | 104.0 B |
| RVA offset | 0x341f40 |
| Content signature | Icon |
| MD5 | 4c2d31552a2a5ed137d1c8081cdbb607 |
| Entropy | 2.586 |
| Type | Icon |
|---|---|
| Name / ID | 2 |
| Language | NEU |
| Size | 498.0 B |
| RVA offset | 0x3404c8 |
| Content signature | PNG |
| MD5 | 266de7ba025bd49815fc527e752b6d31 |
| Entropy | 7.493 |
| Type | Icon |
|---|---|
| Name / ID | 3 |
| Language | NEU |
| Size | 746.0 B |
| RVA offset | 0x3406c0 |
| Content signature | PNG |
| MD5 | 2f862b04187ed8511c9e038aa9a19ed4 |
| Entropy | 7.572 |
| Type | Icon |
|---|---|
| Name / ID | 4 |
| Language | NEU |
| Size | 855.0 B |
| RVA offset | 0x3409b0 |
| Content signature | PNG |
| MD5 | 6c53f0fdc51a79a138aa0a90a56145c8 |
| Entropy | 7.694 |
| Type | Icon |
|---|---|
| Name / ID | 5 |
| Language | NEU |
| Size | 1.0 KB |
| RVA offset | 0x340d08 |
| Content signature | PNG |
| MD5 | 844b998e4a628f9942f94d500052b320 |
| Entropy | 7.76 |
| Type | Icon |
|---|---|
| Name / ID | 6 |
| Language | NEU |
| Size | 1.2 KB |
| RVA offset | 0x341120 |
| Content signature | PNG |
| MD5 | 29d4ec9ff2930994faafb442575095c1 |
| Entropy | 7.772 |
| Type | Icon |
|---|---|
| Name / ID | 7 |
| Language | NEU |
| Size | 1.3 KB |
| RVA offset | 0x3415f8 |
| Content signature | PNG |
| MD5 | f720c55b97e76dfe0abdb1562eb60dbb |
| Entropy | 7.522 |
| Type | Icon |
|---|---|
| Name / ID | 8 |
| Language | NEU |
| Size | 989.0 B |
| RVA offset | 0x341b60 |
| Content signature | PNG |
| MD5 | b1666fe8d78088c5a57b59949e003c1c |
| Entropy | 4.455 |
| Type | Manifest |
|---|---|
| Name / ID | 1 |
| Language | NEU |
| Size | 490.0 B |
| RVA offset | 0x341fa8 |
| Content signature | XML manifest |
| MD5 | a19a2658ba69030c6ac9d11fd7d7e3c1 |
| Entropy | 5.001 |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
| Type | Version Info |
|---|---|
| Name / ID | 1 |
| Language | NEU |
| Size | 628.0 B |
| RVA offset | 0x340250 |
| Content signature | Version Info |
| MD5 | 410d5b67147b49db374c5dbedb61a472 |
| Entropy | 3.203 |
| FileVersion | 0.0.0.0 |
|---|---|
| InternalName | Dungeons2SkinLoader.exe |
| LegalCopyright | |
| ProductVersion | 0.0.0.0 |
| FileDescription | |
| Assembly Version | 0.0.0.0 |
| OriginalFilename | Dungeons2SkinLoader.exe |
Similar samples
22 related samplesRanked by fuzzy hash (TLSH distance - lower is closer) and ssdeep similarity, plus an identical import table and functions shared once library code is removed. A near-identical neighbour is usually the same build; a variant is the same family rebuilt or repacked.
| Relation | Sample | Verdict | Why it matched |
|---|---|---|---|
| related | EndcordInstaller.exe | Malicious | identical import table (imphash) |
| related | VM.v2.1.exe | Malicious | identical import table (imphash) |
| related | AlyxMP-Setup.exe | Suspicious | identical import table (imphash) |
| related | SpyTeam.exe | Suspicious | identical import table (imphash) |
| related | IronCrownSetup (2).exe | Malicious | identical import table (imphash) |
| related | XIAOMI BOOTLOADER TOOL.exe | Suspicious | identical import table (imphash) |
| related | Capri-Setup.exe | Malicious | identical import table (imphash) |
| related | XWorm V3.1.exe | Malicious | identical import table (imphash) |
| related | Capri-Setup.exe | Malicious | identical import table (imphash) |
| related | M4R7HGroup.exe | Suspicious | identical import table (imphash) |
| related | Capri-Setup.exe | Malicious | identical import table (imphash) |
| related | cr-keygen.exe | Malicious | identical import table (imphash) |
| related | WeMod Geometry Dash Setup.exe | No threats detected | identical import table (imphash) |
| related | MetaDataStringEditor.exe | No threats detected | identical import table (imphash) |
| related | dotnet_b64_3des_cbc_to_404keylo… | Malicious | identical import table (imphash) |
| related | Server.exe | Malicious | identical import table (imphash) |
| related | ZuLauncher.exe | Suspicious | identical import table (imphash) |
| related | START.exe | Suspicious | identical import table (imphash) |
| related | CrackPotassium.exe | Malicious | identical import table (imphash) |
| related | Bind Remover.exe | Malicious | identical import table (imphash) |
| related | svchost_update.exe | Malicious | identical import table (imphash) |
| related | dfsvc.exe | No threats detected | identical import table (imphash) |
Capability detection
21 capabilitiesThe capability analysis reports a limitation on this class of file: (internal) .NET file limitation.
Read what follows as the capabilities of the code that could be read, not of the file as a whole.
| Capability | Namespace |
|---|---|
| read file in .NET | host-interaction/file-system/read |
| write file in .NET | host-interaction/file-system/write |
| create or open registry key | - |
| access .NET resource | executable/resource |
| create directory | host-interaction/file-system/create |
| get common file path | host-interaction/file-system |
| check if file exists | host-interaction/file-system/exists |
| get disk information | host-interaction/hardware/storage |
| query or enumerate registry value | host-interaction/registry |
| query or enumerate registry key | host-interaction/registry |
| find data using regex in .NET | data-manipulation/regex |
| enumerate drives | host-interaction/file-system |
| get file size | host-interaction/file-system/meta |
| find process by name | host-interaction/process/list |
| check if directory exists | host-interaction/file-system/exists |
| delete file | host-interaction/file-system/delete |
| manipulate console buffer | host-interaction/console |
| manipulate unmanaged memory in .NET | host-interaction/memory |
| copy file | host-interaction/file-system/copy |
| compiled to the .NET platform | runtime/dotnet |
Signature matches
0 findings · 3 file properties · 0 scoredThese say what the file IS or holds - bitness, subsystem, an overlay, an embedded macro stream, which compiler built it. Ordinary files match several, and none of them carry weight in the score.
No signature rule identified a threat in this file.
Extracted strings
showing 200 of 364- !This program cannot be run in DOS mode.
- .text
- `.rsrc
- @.reloc
- Alex
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Alex/T_Alex_Skin_PreOrder.uasset,B
- ENonePF_B8G8R8A8T_Alex_Skin_PreOrder/Game/Spicewood/Art/Characters/Player/Skins/Alex/T_Alex_Skin_PreOrder
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Alex/T_Alex_Preorder_Skin_MRES.uasset0
- JNonePF_BC7T_Alex_Preorder_Skin_MRES/Game/Spicewood/Art/Characters/Player/Skins/Alex/T_Alex_Preorder_Skin_MRES
- PF_BC7
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Alex/T_Alex_Skin_PreOrder_Skin_Icon.uasset=
- ONonePF_DXT5T_Alex_Skin_PreOrder_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Alex/T_Alex_Skin_PreOrder_Skin_Icon
- PF_DXT5
- Darian
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Darian/T_Darian_Skin.uasset
- @NonePF_B8G8R8A8T_Darian_Skin/Game/Spicewood/Art/Characters/Player/Skins/Darian/T_Darian_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Darian/T_Darian_MRES.uasset
- @NonePF_BC7T_Darian_MRES/Game/Spicewood/Art/Characters/Player/Skins/Darian/T_Darian_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Darian/T_Darian_Skin_Icon.uasset%
- ENonePF_DXT5T_Darian_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Darian/T_Darian_Skin_Icon
- Eshe
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Eshe/T_Eshe_Skin.uasset
- <NonePF_B8G8R8A8T_Eshe_Skin/Game/Spicewood/Art/Characters/Player/Skins/Eshe/T_Eshe_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Eshe/T_Eshe_MRES.uasset
- <NonePF_BC7T_Eshe_MRES/Game/Spicewood/Art/Characters/Player/Skins/Eshe/T_Eshe_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Eshe/T_Eshe_Skin_Icon.uasset
- ANonePF_DXT5T_Eshe_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Eshe/T_Eshe_Skin_Icon
- Esperanza
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Esperanza/T_Esperanza_Skin.uasset-B
- FNonePF_B8G8R8A8T_Esperanza_Skin/Game/Spicewood/Art/Characters/Player/Skins/Esperanza/T_Esperanza_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Esperanza/T_Esperanza_MRES.uasset
- FNonePF_BC7T_Esperanza_MRES/Game/Spicewood/Art/Characters/Player/Skins/Esperanza/T_Esperanza_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Esperanza/T_Esperanza_Skin_Icon.uasset-
- KNonePF_DXT5T_Esperanza_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Esperanza/T_Esperanza_Skin_Icon
- Greta
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Greta/T_Greta_Skin.uasset
- >NonePF_B8G8R8A8T_Greta_Skin/Game/Spicewood/Art/Characters/Player/Skins/Greta/T_Greta_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Greta/T_Greta_MRES.uasset
- >NonePF_BC7T_Greta_MRES/Game/Spicewood/Art/Characters/Player/Skins/Greta/T_Greta_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Greta/T_Greta_Skin_Icon.uasset%
- CNonePF_DXT5T_Greta_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Greta/T_Greta_Skin_Icon
- Healer
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin.uasset
- @NonePF_B8G8R8A8T_Healer_Skin/Game/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_MRES.uasset
- @NonePF_B8G8R8A8T_Healer_MRES/Game/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin_Icon.uasset%
- ENonePF_DXT5T_Healer_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin_Icon
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin_Deluxe.uasset,B
- GNonePF_B8G8R8A8T_Healer_Skin_Deluxe/Game/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin_Deluxe
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin_Deluxe_Icon.uasset5
- LNonePF_DXT5T_Healer_Skin_Deluxe_Icon/Game/Spicewood/Art/Characters/Player/Skins/Healer/T_Healer_Skin_Deluxe_Icon
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Javier/T_Javier_Skin.uasset
- @NonePF_B8G8R8A8T_Javier_Skin/Game/Spicewood/Art/Characters/Player/Skins/Javier/T_Javier_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Javier/T_Javier_MRES.uasset
- @NonePF_BC7T_Javier_MRES/Game/Spicewood/Art/Characters/Player/Skins/Javier/T_Javier_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Javier/T_Javier_Skin_Icon.uasset%
- ENonePF_DXT5T_Javier_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Javier/T_Javier_Skin_Icon
- Nuru
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Nuru/T_Nuru_Skin.uasset
- <NonePF_B8G8R8A8T_Nuru_Skin/Game/Spicewood/Art/Characters/Player/Skins/Nuru/T_Nuru_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Nuru/T_Nuru_MRES.uasset
- <NonePF_BC7T_Nuru_MRES/Game/Spicewood/Art/Characters/Player/Skins/Nuru/T_Nuru_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Nuru/T_Nuru_Skin_Icon.uasset
- ANonePF_DXT5T_Nuru_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Nuru/T_Nuru_Skin_Icon
- PizzaChef
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/PizzaChef/T_PizzaChef_Skin.uasset-B
- FNonePF_B8G8R8A8T_PizzaChef_Skin/Game/Spicewood/Art/Characters/Player/Skins/PizzaChef/T_PizzaChef_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/PizzaChef/T_PizzaChef_MRES.uasset-B
- FNonePF_B8G8R8A8T_PizzaChef_MRES/Game/Spicewood/Art/Characters/Player/Skins/PizzaChef/T_PizzaChef_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/PizzaChef/T_PizzaChef_Skin_Icon.uasset-
- KNonePF_DXT5T_PizzaChef_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/PizzaChef/T_PizzaChef_Skin_Icon
- Qamar
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Qamar/T_Qamar_Skin.uasset
- >NonePF_B8G8R8A8T_Qamar_Skin/Game/Spicewood/Art/Characters/Player/Skins/Qamar/T_Qamar_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Qamar/T_Qamar_MRES.uasset
- >NonePF_BC7T_Qamar_MRES/Game/Spicewood/Art/Characters/Player/Skins/Qamar/T_Qamar_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Qamar/T_Qamar_Skin_Icon.uasset%
- CNonePF_DXT5T_Qamar_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Qamar/T_Qamar_Skin_Icon
- Ranger
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin.uasset
- @NonePF_B8G8R8A8T_Ranger_Skin/Game/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_MRES.uasset
- @NonePF_B8G8R8A8T_Ranger_MRES/Game/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin_Icon.uasset%
- ENonePF_DXT5T_Ranger_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin_Icon
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin_Deluxe.uasset,B
- GNonePF_B8G8R8A8T_Ranger_Skin_Deluxe/Game/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin_Deluxe
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin_Deluxe_Icon.uasset5
- LNonePF_DXT5T_Ranger_Skin_Deluxe_Icon/Game/Spicewood/Art/Characters/Player/Skins/Ranger/T_Ranger_Skin_Deluxe_Icon
- Steve
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Steve/T_Steve_Skin_PreOrder.uasset,B
- GNonePF_B8G8R8A8T_Steve_Skin_PreOrder/Game/Spicewood/Art/Characters/Player/Skins/Steve/T_Steve_Skin_PreOrder
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Steve/T_Steve_PreOrder_Skin_MRES.uasset0
- LNonePF_BC7T_Steve_PreOrder_Skin_MRES/Game/Spicewood/Art/Characters/Player/Skins/Steve/T_Steve_PreOrder_Skin_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Steve/T_Steve_Skin_PreOrder_Skin_Icon.uasset=
- QNonePF_DXT5T_Steve_Skin_PreOrder_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Steve/T_Steve_Skin_PreOrder_Skin_Icon
- Tank
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin.uasset
- <NonePF_B8G8R8A8T_Tank_Skin/Game/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_MRES.uasset
- <NonePF_B8G8R8A8T_Tank_MRES/Game/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin_Icon.uasset
- ANonePF_DXT5T_Tank_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin_Icon
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin_Deluxe.uasset$B
- CNonePF_B8G8R8A8T_Tank_Skin_Deluxe/Game/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin_Deluxe
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin_Deluxe_Icon.uasset-
- HNonePF_DXT5T_Tank_Skin_Deluxe_Icon/Game/Spicewood/Art/Characters/Player/Skins/Tank/T_Tank_Skin_Deluxe_Icon
- Valorie
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin.uasset%B
- BNonePF_B8G8R8A8T_Valorie_Skin/Game/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_MRES.uasset%B
- BNonePF_B8G8R8A8T_Valorie_MRES/Game/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin_Icon.uasset-
- GNonePF_DXT5T_Valorie_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin_Icon
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin_Deluxe.uasset4B
- INonePF_B8G8R8A8T_Valorie_Skin_Deluxe/Game/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin_Deluxe
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin_Deluxe_Icon.uasset5
- NNonePF_DXT5T_Valorie_Skin_Deluxe_Icon/Game/Spicewood/Art/Characters/Player/Skins/Valorie/T_Valorie_Skin_Deluxe_Icon
- Violet
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Violet/T_Violet_Skin.uasset
- {llir
- @NonePF_B8G8R8A8T_Violet_Skin/Game/Spicewood/Art/Characters/Player/Skins/Violet/T_Violet_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Violet/T_Violet_MRES.uasset
- @NonePF_BC7T_Violet_MRES/Game/Spicewood/Art/Characters/Player/Skins/Violet/T_Violet_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/Violet/T_Violet_Skin_Icon.uasset%
- ENonePF_DXT5T_Violet_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/Violet/T_Violet_Skin_Icon
- _Brown
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Brown/T_Brown_Skin.uasset
- ?NonePF_B8G8R8A8T_Brown_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Brown/T_Brown_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Brown/T_Brown_MRES.uasset
- ?NonePF_BC7T_Brown_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Brown/T_Brown_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Brown/T_Brown_Skin_Icon.uasset%
- DNonePF_DXT5T_Brown_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Brown/T_Brown_Skin_Icon
- _Gray
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Gray/T_Gray_Skin.uasset
- =NonePF_B8G8R8A8T_Gray_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Gray/T_Gray_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Gray/T_Gray_MRES.uasset
- =NonePF_BC7T_Gray_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Gray/T_Gray_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Gray/T_Gray_Skin_Icon.uasset%
- BNonePF_DXT5T_Gray_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Gray/T_Gray_Skin_Icon
- _Green
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Green/T_Green_Skin.uasset
- ?NonePF_B8G8R8A8T_Green_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Green/T_Green_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Green/T_Green_MRES.uasset
- ?NonePF_BC7T_Green_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Green/T_Green_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Green/T_Green_Skin_Icon.uasset%
- DNonePF_DXT5T_Green_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Green/T_Green_Skin_Icon
- _Mint
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Mint/T_Mint_Skin.uasset
- =NonePF_B8G8R8A8T_Mint_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Mint/T_Mint_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Mint/T_Mint_MRES.uasset
- =NonePF_BC7T_Mint_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Mint/T_Mint_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Mint/T_Mint_Skin_Icon.uasset%
- BNonePF_DXT5T_Mint_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Mint/T_Mint_Skin_Icon
- _Pink
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Pink/T_Pink_Skin.uasset
- =NonePF_B8G8R8A8T_Pink_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Pink/T_Pink_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Pink/T_Pink_MRES.uasset
- =NonePF_BC7T_Pink_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Pink/T_Pink_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Pink/T_Pink_Skin_Icon.uasset%
- BNonePF_DXT5T_Pink_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Pink/T_Pink_Skin_Icon
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Plum/T_Plum_Skin.uasset
- =NonePF_B8G8R8A8T_Plum_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Plum/T_Plum_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Plum/T_Plum_MRES.uasset
- =NonePF_BC7T_Plum_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Plum/T_Plum_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Plum/T_Plum_Skin_Icon.uasset%
- BNonePF_DXT5T_Plum_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Plum/T_Plum_Skin_Icon
- _Purple
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Purple/T_Purple_Skin.uasset$B
- ANonePF_B8G8R8A8T_Purple_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Purple/T_Purple_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Purple/T_Purple_MRES.uasset
- ANonePF_BC7T_Purple_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Purple/T_Purple_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Purple/T_Purple_Skin_Icon.uasset%
- FNonePF_DXT5T_Purple_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Purple/T_Purple_Skin_Icon
- _Silver
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Silver/T_Silver_Skin.uasset$B
- ANonePF_B8G8R8A8T_Silver_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Silver/T_Silver_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Silver/T_Silver_MRES.uasset
- ANonePF_BC7T_Silver_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Silver/T_Silver_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Silver/T_Silver_Skin_Icon.uasset%
- FNonePF_DXT5T_Silver_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Silver/T_Silver_Skin_Icon
- _Yellow
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Yellow/T_Yellow_Skin.uasset$B
- ANonePF_B8G8R8A8T_Yellow_Skin/Game/Spicewood/Art/Characters/Player/Skins/_Yellow/T_Yellow_Skin
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Yellow/T_Yellow_MRES.uasset
- ANonePF_BC7T_Yellow_MRES/Game/Spicewood/Art/Characters/Player/Skins/_Yellow/T_Yellow_MRES
- Dungeons/Content/Spicewood/Art/Characters/Player/Skins/_Yellow/T_Yellow_Skin_Icon.uasset%
- FNonePF_DXT5T_Yellow_Skin_Icon/Game/Spicewood/Art/Characters/Player/Skins/_Yellow/T_Yellow_Skin_Icon
- Dungeons/Content/Spicewood/Art/Characters/Player/Master/SK_Player_Master.uassetK
- |+.fL{oj
- =J_HeadJ_HipJ_L_ArmJ_L_EyebrowJ_L_EyeIrisJ_L_EyePupilJ_L_FootJ_L_HandJ_L_LegJ_L_WeaponJ_L_Weapon1J_L_Weapon1ScaleJ_L_Weapon2J_L_Weapon2ScaleJ_L_Weapon3J_L_Weapon3ScaleJ_L_WeaponScaleJ_MouthJ_NeckJ_R_ArmJ_R_EyebrowJ_R_EyeIrisJ_R_EyePupilJ_R_FootJ_R_HandJ_R_LegJ_R_WeaponJ_RootJ_ShouldersJ_SocketJ_SocketSwordJ_SpineMaterial_AnimCurveMetaDataSK_Player_Master/Game/Spicewood/Art/Characters/Player/Master/SK_Player_Master
- C/Game/Spicewood/Art/Characters/Player/Master/Player_Master_Skeleton/Game/Spicewood/Art/Characters/Player/Skins/Valorie/MI_Valorie_Skin
- daDA
- gaDA
- b>[aDA0
- AsaDAc
- .BKaD
- BtW.Bv
- jwMA
No strings match this filter.
Stack and decoded strings were not recovered: no reason was recorded. Only literal strings present in the file are listed above.
Disassembly
entry point · x86 · 60 insns (listing capped)Nothing in this view
This sample produced no results for this part of the static analysis.
AI security review
advisory, not scoredReview of this assembly has not run
Reports stored before this section existed carry no reading, and one is not written after the fact. Rescanning the sample produces it.
Decompiled .NET source
1 finding C# 40 types · 6213 linesDecompiled from IL. Every type defined in the assembly is listed below; on a merged or packed sample some of it belongs to a bundled library rather than to the author. Behaviour review and the AI layer read only the author's own types.
| Severity | Behavior detected in source | MITRE |
|---|---|---|
| med | Decrypts an embedded payload at runtime | T1140 |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Microsoft.Win32;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Dungeons2SkinLoader;
internal static class App
{
public const string Name = "Dungeons 2 Skin Loader";
public const string Author = "Poyraz Captain";
public const string Version = "1.0.0";
public static string DataDir
{
get
{
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string text = Path.Combine(folderPath, "Dungeons 2 Skin Loader");
Directory.CreateDirectory(text);
return text;
}
}
public static GameData LoadData()
{
using Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("md2data.bin");
return GameData.Load(s);
}
[STAThread]
private static int Main(string[] args)
{
if (args.Length > 0 && args[0] == "--cli")
{
return Cli.Run(args);
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run((Form)(object)new MainForm());
return 0;
}
}
public enum FaceMode
{
Drawn,
Game,
Blink
}
public class Pkg
{
public byte[] ChunkId;
public string Path;
public byte[] Data;
public int PixelOffset;
public List<byte[]> Imports;
}
public class Hero
{
public string Name;
public bool Deluxe;
public Pkg Skin;
public Pkg Mres;
public Pkg Icon;
public Bitmap Original;
public string Key => Name + (Deluxe ? "|1" : "|0");
public string Display
{
get
{
string text = (Name.StartsWith("_") ? (Name.Substring(1) + " (starter)") : Name);
if (text == "PizzaChef")
{
text = "Pizza Chef";
}
if (!Deluxe)
{
return text;
}
return text + " (Deluxe)";
}
}
}
public class Geo
{
public float[] Pos;
public float[] Uv;
public ushort[] Tris;
public float[] Nrm;
}
public class GameData
{
public ulong UtocSize;
public ulong ContainerId;
public byte[] Key;
public List<Hero> Heroes = new List<Hero>();
public Pkg[] Mesh = new Pkg[2];
public byte[][] Remap;
public Dictionary<int, int> Blink = new Dictionary<int, int>();
public Dictionary<int, Point> BlinkOuter = new Dictionary<int, Point>();
public float[] IconCam;
public Geo[] IconGeo = new Geo[2];
public byte[] MresBody;
public byte[] MresHead;
public static GameData Load(Stream s)
{
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Expected O, but got Unknown
BinaryReader binaryReader = new BinaryReader(s);
if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "MD2S")
{
throw new InvalidDataException("bad data file");
}
uint num = binaryReader.ReadUInt32();
GameData gameData = new GameData();
gameData.UtocSize = binaryReader.ReadUInt64();
gameData.ContainerId = binaryReader.ReadUInt64();
gameData.Key = binaryReader.ReadBytes(32);
int num2 = binaryReader.ReadInt32();
for (int i = 0; i < num2; i++)
{
Hero hero = new Hero();
hero.Name = Str(binaryReader);
hero.Deluxe = binaryReader.ReadByte() != 0;
hero.Skin = ReadPkg(binaryReader, hasOffset: true);
hero.Mres = ReadPkg(binaryReader, hasOffset: true);
hero.Icon = ReadPkg(binaryReader, hasOffset: true);
gameData.Heroes.Add(hero);
}
for (int j = 0; j < 2; j++)
{
gameData.Mesh[j] = ReadPkg(binaryReader, hasOffset: false);
}
int num3 = binaryReader.ReadInt32();
gameData.Remap = new byte[num3][];
for (int k = 0; k < num3; k++)
{
gameData.Remap[k] = binaryReader.ReadBytes(4);
}
int num4 = binaryReader.ReadInt32();
for (int l = 0; l < num4; l++)
{
byte[] array = binaryReader.ReadBytes(4);
gameData.Blink[array[0] * 8 + array[1]] = array[2] * 8 + array[3];
}
for (int m = 0; m < 2; m++)
{
Geo geo = new Geo();
int num5 = binaryReader.ReadInt32();
geo.Pos = Floats(binaryReader, num5 * 3);
geo.Uv = Floats(binaryReader, num5 * 2);
int num6 = binaryReader.ReadInt32();
geo.Tris = new ushort[num6 * 3];
for (int n = 0; n < num6 * 3; n++)
{
geo.Tris[n] = binaryReader.ReadUInt16();
}
geo.Nrm = Floats(binaryReader, num6 * 3);
gameData.IconGeo[m] = geo;
}
gameData.MresBody = binaryReader.ReadBytes(16);
gameData.MresHead = binaryReader.ReadBytes(16);
if (num >= 2)
{
foreach (Hero hero2 in gameData.Heroes)
{
hero2.Original = new Bitmap((Stream)new MemoryStream(binaryReader.ReadBytes(binaryReader.ReadInt32())));
}
}
if (num >= 3)
{
int num7 = binaryReader.ReadInt32();
for (int num8 = 0; num8 < num7; num8++)
{
byte[] array2 = binaryReader.ReadBytes(4);
gameData.BlinkOuter[array2[0] * 8 + array2[1]] = new Point(array2[2], array2[3]);
}
int n2 = binaryReader.ReadInt32();
gameData.IconCam = Floats(binaryReader, n2);
}
return gameData;
}
private static string Str(BinaryReader r)
{
int count = r.ReadUInt16();
return Encoding.UTF8.GetString(r.ReadBytes(count));
}
private static float[] Floats(BinaryReader r, int n)
{
float[] array = new float[n];
for (int i = 0; i < n; i++)
{
array[i] = r.ReadSingle();
}
return array;
}
private static Pkg ReadPkg(BinaryReader r, bool hasOffset)
{
Pkg pkg = new Pkg();
pkg.ChunkId = r.ReadBytes(12);
pkg.Path = Str(r);
pkg.Data = r.ReadBytes(r.ReadInt32());
if (hasOffset)
{
pkg.PixelOffset = r.ReadInt32();
}
int num = r.ReadInt32();
pkg.Imports = new List<byte[]>();
for (int i = 0; i < num; i++)
{
pkg.Imports.Add(r.ReadBytes(8));
}
return pkg;
}
public Hero FindHero(string key)
{
return Heroes.FirstOrDefault((Hero h) => h.Key == key);
}
}
public class Img
{
public int W;
public int H;
public byte[] P;
public Img(int w, int h)
{
W = w;
H = h;
P = new byte[w * h * 4];
}
public Img Clone()
{
Img img = new Img(W, H);
Buffer.BlockCopy(P, 0, img.P, 0, P.Length);
return img;
}
public int Idx(int x, int y)
{
return (y * W + x) * 4;
}
public byte A(int x, int y)
{
return P[Idx(x, y) + 3];
}
public void Get(int x, int y, byte[] c)
{
Buffer.BlockCopy(P, Idx(x, y), c, 0, 4);
}
public byte[] Get(int x, int y)
{
byte[] array = new byte[4];
Get(x, y, array);
return array;
}
public void Set(int x, int y, byte[] c)
{
Buffer.BlockCopy(c, 0, P, Idx(x, y), 4);
}
public Img Crop(int x0, int y0, int w, int h)
{
Img img = new Img(w, h);
for (int i = 0; i < h; i++)
{
Buffer.BlockCopy(P, Idx(x0, y0 + i), img.P, img.Idx(0, i), w * 4);
}
return img;
}
public void Paste(Img s, int x0, int y0)
{
for (int i = 0; i < s.H; i++)
{
Buffer.BlockCopy(s.P, s.Idx(0, i), P, Idx(x0, y0 + i), s.W * 4);
}
}
public static Img FromFile(string path)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
using FileStream fileStream = File.OpenRead(path);
Bitmap val = new Bitmap((Stream)fileStream);
try
{
Img img = new Img(((Image)val).Width, ((Image)val).Height);
for (int i = 0; i < ((Image)val).Height; i++)
{
for (int j = 0; j < ((Image)val).Width; j++)
{
Color pixel = val.GetPixel(j, i);
int num = img.Idx(j, i);
img.P[num] = pixel.R;
img.P[num + 1] = pixel.G;
img.P[num + 2] = pixel.B;
img.P[num + 3] = pixel.A;
}
}
return img;
}
finally
{
((IDisposable)val)?.Dispose();
}
}
public Bitmap ToBitmap()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
Bitmap val = new Bitmap(W, H, (PixelFormat)2498570);
for (int i = 0; i < H; i++)
{
for (int j = 0; j < W; j++)
{
int num = Idx(j, i);
val.SetPixel(j, i, Color.FromArgb(P[num + 3], P[num], P[num + 1], P[num + 2]));
}
}
return val;
}
public void AlphaComposite(Img src)
{
for (int i = 0; i < P.Length; i += 4)
{
int num = src.P[i + 3];
int num2 = P[i + 3];
int num3 = num2 * (255 - num);
int num4 = num * 255 + num3;
if (num4 == 0)
{
P[i] = (P[i + 1] = (P[i + 2] = (P[i + 3] = 0)));
continue;
}
long num5 = (long)num * 255L * 255 * 128 / num4;
long num6 = 32640 - num5;
for (int j = 0; j < 3; j++)
{
long num7 = src.P[i + j] * num5 + P[i + j] * num6 + 16384;
P[i + j] = (byte)((num7 >> 8) + num7 >> 8 >> 7);
}
int num8 = num4 + 128;
P[i + 3] = (byte)((num8 >> 8) + num8 >> 8);
}
}
}
public static class Converter
{
public const int Outer = 64;
private static readonly int[][] ARMS = new int[4][]
{
new int[2] { 40, 16 },
new int[2] { 40, 32 },
new int[2] { 32, 48 },
new int[2] { 48, 48 }
};
private static readonly int[][] OVERLAYS = new int[5][]
{
new int[4] { 0, 32, 0, 16 },
new int[4] { 16, 32, 16, 16 },
new int[4] { 40, 32, 40, 16 },
new int[4] { 0, 48, 16, 48 },
new int[4] { 48, 48, 32, 48 }
};
public static Img To64(Img im)
{
if (im.W == 64 && im.H == 32)
{
Img img = new Img(64, 64);
img.Paste(im, 0, 0);
img.Paste(MirrorLimb(im.Crop(0, 16, 16, 16)), 16, 48);
img.Paste(MirrorLimb(im.Crop(40, 16, 16, 16)), 32, 48);
return img;
}
if (im.W != 64 || im.H != 64)
{
throw new InvalidDataException("A Minecraft skin must be 64x64 (or old-style 64x32) pixels; this image is " + im.W + "x" + im.H + ".");
}
return im.Clone();
}
private static Img MirrorLimb(Img l)
{
Img img = new Img(16, 16);
int[][] array = new int[6][]
{
new int[6] { 4, 0, 4, 4, 4, 0 },
new int[6] { 8, 0, 4, 4, 8, 0 },
new int[6] { 4, 4, 4, 12, 4, 4 },
new int[6] { 12, 4, 4, 12, 12, 4 },
new int[6] { 0, 4, 4, 12, 8, 4 },
new int[6] { 8, 4, 4, 12, 0, 4 }
};
int[][] array2 = array;
foreach (int[] array3 in array2)
{
for (int j = 0; j < array3[3]; j++)
{
for (int k = 0; k < array3[2]; k++)
{
img.Set(array3[4] + k, array3[5] + j, l.Get(array3[0] + array3[2] - 1 - k, array3[1] + j));
}
}
}
return img;
}
public static bool IsSlim(Img im)
{
if (im.A(50, 16) == 0)
{
return im.A(54, 20) == 0;
}
return false;
}
private static void ArmToSlim(Img s, int u, int v)
{
Img img = s.Crop(u, v, 16, 16);
Img img2 = new Img(16, 16);
int[] array = new int[3] { 0, 1, 3 };
int[] array2 = new int[3] { 0, 2, 3 };
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 3; j++)
{
img2.Set(4 + j, i, img.Get(4 + array[j], i));
img2.Set(7 + j, i, img.Get(8 + array[j], i));
}
}
for (int k = 4; k < 16; k++)
{
for (int l = 0; l < 4; l++)
{
img2.Set(l, k, img.Get(l, k));
img2.Set(7 + l, k, img.Get(8 + l, k));
}
for (int m = 0; m < 3; m++)
{
img2.Set(4 + m, k, img.Get(4 + array[m], k));
img2.Set(11 + m, k, img.Get(12 + array2[m], k));
}
}
s.Paste(img2, u, v);
}
private static double Lum(byte[] p)
{
return 0.3 * (double)(int)p[0] + 0.59 * (double)(int)p[1] + 0.11 * (double)(int)p[2];
}
public static List<int> DetectEyes(Img skin64)
{
List<int> list = DetectEyesIn(skin64.Crop(8, 8, 8, 8));
if (list.Count == 0)
{
list = (from v in DetectEyesIn(skin64.Crop(40, 8, 8, 8))
select v + 64).ToList();
}
return list;
}
private static List<int> DetectEyesIn(Img f)
{
List<double> list = new List<double>();
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
if (f.A(j, i) != 0)
{
list.Add(Lum(f.Get(j, i)));
}
}
}
list.Sort();
double num = ((list.Count > 0) ? list[list.Count / 2] : 128.0);
HashSet<int> dark = new HashSet<int>();
for (int k = 2; k < 5; k++)
{
for (int l = 1; l < 7; l++)
{
if (f.A(l, k) != 0 && Lum(f.Get(l, k)) < Math.Min(70.0, num * 0.45))
{
dark.Add(l * 8 + k);
}
}
}
return (from p in dark
where dark.Contains((7 - p / 8) * 8 + p % 8)
orderby p
select p).ToList();
}
private static byte[] FillOrNull(Img f, HashSet<int> eyes, int col, int row)
{
int[][] array = new int[6][]
{
new int[2] { 1, 0 },
new int[2] { -1, 0 },
new int[2] { 0, 1 },
new int[2] { 0, -1 },
new int[2] { 2, 0 },
new int[2] { -2, 0 }
};
int[][] array2 = array;
foreach (int[] array3 in array2)
{
int num = col + array3[0];
int num2 = row + array3[1];
if (num >= 0 && num < 8 && num2 >= 0 && num2 < 8 && !eyes.Contains(num * 8 + num2) && f.A(num, num2) != 0)
{
return f.Get(num, num2);
}
}
return null;
}
private static byte[] FillColour(Img f, HashSet<int> eyes, int col, int row)
{
int[][] array = new int[6][]
{
new int[2] { 1, 0 },
new int[2] { -1, 0 },
new int[2] { 0, 1 },
new int[2] { 0, -1 },
new int[2] { 2, 0 },
new int[2] { -2, 0 }
};
int[][] array2 = array;
foreach (int[] array3 in array2)
{
int num = col + array3[0];
int num2 = row + array3[1];
if (num >= 0 && num < 8 && num2 >= 0 && num2 < 8 && !eyes.Contains(num * 8 + num2) && f.A(num, num2) != 0)
{
return f.Get(num, num2);
}
}
return f.Get(col, row);
}
private static byte[] Darkest(byte[] a, byte[] b)
{
if (a[0] + a[1] + a[2] > b[0] + b[1] + b[2])
{
return b;
}
return a;
}
public static Img Convert(GameData gd, Img user, FaceMode mode, ICollection<int> eyePixels, GameFace gameFace = null, int? lidColor = null, int? lidColor2 = null)
{
Img s = To64(user);
if (!IsSlim(s))
{
int[][] aRMS = ARMS;
foreach (int[] array in aRMS)
{
ArmToSlim(s, array[0], array[1]);
}
}
int[][] oVERLAYS = OVERLAYS;
foreach (int[] array2 in oVERLAYS)
{
Img img = s.Crop(array2[2], array2[3], 16, 16);
img.AlphaComposite(s.Crop(array2[0], array2[1], 16, 16));
s.Paste(img, array2[2], array2[3]);
}
Img img2 = s.Clone();
byte[][] remap = gd.Remap;
foreach (byte[] array3 in remap)
{
s.Set(array3[0], array3[1], img2.Get(array3[2], array3[3]));
}
Img face = s.Crop(8, 8, 8, 8);
Img img3 = s.Crop(40, 8, 8, 8);
byte[] array4 = new byte[4];
for (int l = 0; l < 8; l++)
{
for (int m = 0; m < 8; m++)
{
s.Set(m, l, array4);
}
}
byte b = 0;
Func<int, int, byte[]> func = (int x, int y) => face.Get(x, y);
List<Tuple<int, int, byte[]>> list = new List<Tuple<int, int, byte[]>>();
list.Add(Tuple.Create(6, 5, func(2, 4)));
list.Add(Tuple.Create(7, 5, func(5, 4)));
list.Add(Tuple.Create(6, 6, func(1, 4)));
list.Add(Tuple.Create(7, 6, func(6, 4)));
list.Add(Tuple.Create(3, 7, Darkest(func(1, 3), func(2, 3))));
list.Add(Tuple.Create(4, 7, Darkest(func(5, 3), func(6, 3))));
list.Add(Tuple.Create(6, 7, func(3, 6)));
list.Add(Tuple.Create(7, 7, func(4, 6)));
List<Tuple<int, int, byte[]>> list2 = list;
foreach (Tuple<int, int, byte[]> item in list2)
{
s.Set(item.Item1, item.Item2, new byte[4]
{
item.Item3[0],
item.Item3[1],
item.Item3[2],
b
});
}
if (mode == FaceMode.Game)
{
GameFace gameFace2 = gameFace ?? GameFace.Auto(face, eyePixels);
Action<int, int, int?> action = delegate(int x, int y, int? v)
{
s.Set(x, y, v.HasValue ? new byte[4]
{
(byte)(v.Value >> 16),
(byte)(v.Value >> 8),
(byte)v.Value,
255
} : new byte[4]);
};
action(6, 5, gameFace2.Iris);
action(7, 5, gameFace2.Iris);
action(6, 6, gameFace2.White);
action(7, 6, gameFace2.White);
action(3, 7, gameFace2.Brow);
action(4, 7, gameFace2.Brow);
action(6, 7, null);
action(7, 7, null);
if (eyePixels != null)
{
HashSet<int> hashSet = new HashSet<int>(eyePixels.Where((int e) => e < 64));
foreach (int item2 in hashSet)
{
s.Set(8 + item2 / 8, 8 + item2 % 8, FillColour(face, hashSet, item2 / 8, item2 % 8));
}
HashSet<int> hashSet2 = new HashSet<int>(from e in eyePixels
where e >= 64
select e - 64);
foreach (int item3 in hashSet2)
{
s.Set(40 + item3 / 8, 8 + item3 % 8, FillOrNull(img3, hashSet2, item3 / 8, item3 % 8) ?? array4);
}
}
}
foreach (Point value in gd.BlinkOuter.Values)
{
s.Set(value.X, value.Y, array4);
}
if (mode == FaceMode.Blink && eyePixels != null)
{
Func<int?, byte[]> func2 = (int? v) => (!v.HasValue) ? null : new byte[4]
{
(byte)(v.Value >> 16),
(byte)(v.Value >> 8),
(byte)v.Value,
255
};
byte[] lidL = func2(lidColor);
byte[] lidR = func2(lidColor2) ?? lidL;
Func<int, byte[]> func3 = (int col) => (col >= 4) ? lidR : lidL;
HashSet<int> hashSet3 = new HashSet<int>(eyePixels.Where((int e) => e < 64 && gd.Blink.ContainsKey(e)));
foreach (int item4 in hashSet3)
{
int num = item4 / 8;
int num2 = item4 % 8;
int num3 = gd.Blink[item4];
byte[] array5 = func(num, num2);
s.Set(num3 / 8, num3 % 8, new byte[4]
{
array5[0],
array5[1],
array5[2],
255
});
s.Set(8 + num, 8 + num2, func3(num) ?? FillColour(face, hashSet3, num, num2));
}
HashSet<int> hashSet4 = new HashSet<int>(from e in eyePixels
where e >= 64 && gd.BlinkOuter.ContainsKey(e - 64)
select e - 64);
foreach (int item5 in hashSet4)
{
int num4 = item5 / 8;
int num5 = item5 % 8;
Point point = gd.BlinkOuter[item5];
byte[] array6 = img3.Get(num4, num5);
if (array6[3] != 0)
{
s.Set(point.X, point.Y, new byte[4]
{
array6[0],
array6[1],
array6[2],
255
});
s.Set(40 + num4, 8 + num5, func3(num4) ?? FillOrNull(img3, hashSet4, num4, num5) ?? array4);
}
}
}
Img img4 = face.Clone();
img4.AlphaComposite(img3);
s.Paste(img4, 56, 20);
return s;
}
}
public class GameFace
{
public int? Iris;
public int? White;
public int? Brow;
public int? Mouth;
public GameFace Clone()
{
return (GameFace)MemberwiseClone();
}
public string Serialize()
{
return "g=" + string.Join(",", new int?[4] { Iris, White, Brow, Mouth }.Select((int? v) => (!v.HasValue) ? "-" : v.Value.ToString("x6")));
}
public static GameFace Parse(string s)
{
if (s == null || !s.StartsWith("g="))
{
return null;
}
string[] array = s.Substring(2).Split(new char[1] { ',' });
if (array.Length != 4)
{
return null;
}
Func<string, int?> func = (string x) => (!(x == "-")) ? new int?(Convert.ToInt32(x, 16)) : null;
GameFace gameFace = new GameFace();
gameFace.Iris = func(array[0]);
gameFace.White = func(array[1]);
gameFace.Brow = func(array[2]);
gameFace.Mouth = func(array[3]);
return gameFace;
}
private static int Rgb(byte[] c)
{
return (c[0] << 16) | (c[1] << 8) | c[2];
}
private static double Lum(byte[] c)
{
return 0.3 * (double)(int)c[0] + 0.59 * (double)(int)c[1] + 0.11 * (double)(int)c[2];
}
public static GameFace Auto(Img face, ICollection<int> eyes)
{
HashSet<int> hashSet = new HashSet<int>((eyes ?? ((ICollection<int>)new int[0])).Where((int e) => e < 64));
Dictionary<int, int> dictionary = new Dictionary<int, int>();
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
byte[] array = face.Get(j, i);
if (array[3] != 0)
{
int key = Rgb(array);
dictionary.TryGetValue(key, out var value);
dictionary[key] = value + 1;
}
}
}
int num = ((dictionary.Count > 0) ? dictionary.OrderByDescending((KeyValuePair<int, int> kv) => kv.Value).First().Key : 12615776);
byte[] c = new byte[4]
{
(byte)(num >> 16),
(byte)(num >> 8),
(byte)num,
255
};
double num2 = Lum(c);
GameFace gameFace = new GameFace();
if (hashSet.Count > 0)
{
int num3 = hashSet.OrderBy((int x) => x).First();
gameFace.Iris = Rgb(face.Get(num3 / 8, num3 % 8));
}
else
{
byte[] array2 = face.Get(2, 4);
byte[] array3 = face.Get(5, 4);
byte[] c2 = ((Lum(array2) <= Lum(array3)) ? array2 : array3);
gameFace.Iris = ((Lum(c2) < num2 - 40.0) ? Rgb(c2) : 1973790);
}
byte[] array4 = face.Get(1, 4);
bool flag = Lum(array4) > 200.0 && Math.Max(array4[0], Math.Max(array4[1], array4[2])) - Math.Min(array4[0], Math.Min(array4[1], array4[2])) < 30;
gameFace.White = ((flag && !hashSet.Contains(12)) ? Rgb(array4) : 16053492);
byte[] array5 = null;
int[] array6 = new int[4] { 1, 2, 5, 6 };
foreach (int num4 in array6)
{
byte[] array7 = face.Get(num4, 3);
if (array7[3] != 0 && !hashSet.Contains(num4 * 8 + 3) && Lum(array7) < num2 - 50.0 && (array5 == null || Lum(array7) < Lum(array5)))
{
array5 = array7;
}
}
gameFace.Brow = ((array5 != null) ? new int?(Rgb(array5)) : null);
gameFace.Mouth = null;
return gameFace;
}
}
public static class Renderer
{
private static double[,] Rot(double ax, double ay, double az, double deg)
{
double num = deg * Math.PI / 180.0;
double num2 = Math.Cos(num);
double num3 = Math.Sin(num);
return new double[3, 3]
{
{
num2 + ax * ax * (1.0 - num2),
ax * ay * (1.0 - num2) - az * num3,
ax * az * (1.0 - num2) + ay * num3
},
{
ay * ax * (1.0 - num2) + az * num3,
num2 + ay * ay * (1.0 - num2),
ay * az * (1.0 - num2) - ax * num3
},
{
az * ax * (1.0 - num2) - ay * num3,
az * ay * (1.0 - num2) + ax * num3,
num2 + az * az * (1.0 - num2)
}
};
}
private static double[,] Mul(double[,] a, double[,] b)
{
double[,] array = new double[3, 3];
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
array[i, j] += a[i, k] * b[k, j];
}
}
}
return array;
}
public static Img Render(Geo g, Img tex, int size, int ss = 3, double yaw = -22.0, double pitch = -14.0, double fill = 0.845)
{
double[,] array = Mul(Rot(1.0, 0.0, 0.0, pitch), Rot(0.0, 0.0, 1.0, yaw));
int num = g.Pos.Length / 3;
int num2 = size * ss;
double[] array2 = new double[num];
double[] array3 = new double[num];
double[] array4 = new double[num];
double num3 = 1000000000.0;
double num4 = -1000000000.0;
double num5 = 1000000000.0;
double num6 = -1000000000.0;
for (int i = 0; i < num; i++)
{
double num7 = g.Pos[i * 3];
double num8 = g.Pos[i * 3 + 1];
double num9 = g.Pos[i * 3 + 2];
array2[i] = array[0, 0] * num7 + array[0, 1] * num8 + array[0, 2] * num9;
array3[i] = 0.0 - (array[2, 0] * num7 + array[2, 1] * num8 + array[2, 2] * num9);
array4[i] = 0.0 - (array[1, 0] * num7 + array[1, 1] * num8 + array[1, 2] * num9);
num3 = Math.Min(num3, array3[i]);
num4 = Math.Max(num4, array3[i]);
num5 = Math.Min(num5, array2[i]);
num6 = Math.Max(num6, array2[i]);
}
double num10 = fill * (double)num2 / (num4 - num3);
double num11 = (num6 + num5) / 2.0;
for (int j = 0; j < num; j++)
{
array2[j] = (array2[j] - num11) * num10 + (double)num2 / 2.0;
array3[j] = (array3[j] - num3) * num10 + (double)num2 * (1.0 - fill) / 2.0;
}
return Raster(g, tex, size, ss, array, array2, array3, array4);
}
public static Img RenderIcon(Geo g, Img tex, int size, float[] cam, double extraYaw = 0.0, int ss = 3)
{
if (cam == null)
{
return Render(g, tex, size, ss, -22.0 + extraYaw);
}
double[,] array = Mul(Mul(Rot(1.0, 0.0, 0.0, cam[1]), Rot(0.0, 1.0, 0.0, cam[2])), Rot(0.0, 0.0, 1.0, (double)cam[0] + extraYaw));
int num = g.Pos.Length / 3;
int num2 = size * ss;
double num3 = 40.0 + 400.0 * (double)(1f - Math.Max(0f, Math.Min(1f, cam[3])));
double num4 = (double)(cam[4] * (float)num2) / 36.0;
double[] array2 = new double[num];
double[] array3 = new double[num];
double[] array4 = new double[num];
for (int i = 0; i < num; i++)
{
double num5 = g.Pos[i * 3];
double num6 = g.Pos[i * 3 + 1];
double num7 = (double)g.Pos[i * 3 + 2] - 16.0;
double num8 = array[0, 0] * num5 + array[0, 1] * num6 + array[0, 2] * num7;
double num9 = array[1, 0] * num5 + array[1, 1] * num6 + array[1, 2] * num7;
double num10 = array[2, 0] * num5 + array[2, 1] * num6 + array[2, 2] * num7;
double num11 = num3 / (num3 - num9);
array2[i] = num8 * num11 * num4 + (double)num2 / 2.0 + (double)(cam[5] * (float)num2);
array3[i] = (0.0 - num10) * num11 * num4 + (double)num2 / 2.0 + (double)(cam[6] * (float)num2);
array4[i] = 0.0 - num9;
}
return Raster(g, tex, size, ss, array, array2, array3, array4);
}
private static Img Raster(Geo g, Img tex, int size, int ss, double[,] M, double[] sx, double[] sy, double[] dp)
{
int num = size * ss;
double num2 = -0.5;
double num3 = 0.7;
double num4 = 0.55;
double num5 = Math.Sqrt(num2 * num2 + num3 * num3 + num4 * num4);
num2 /= num5;
num3 /= num5;
num4 /= num5;
float[] array = new float[num * num * 4];
double[] array2 = new double[num * num];
for (int i = 0; i < array2.Length; i++)
{
array2[i] = double.PositiveInfinity;
}
int num6 = g.Tris.Length / 3;
for (int j = 0; j < num6; j++)
{
double num7 = g.Nrm[j * 3];
double num8 = g.Nrm[j * 3 + 1];
double num9 = g.Nrm[j * 3 + 2];
double num10 = M[1, 0] * num7 + M[1, 1] * num8 + M[1, 2] * num9;
if (num10 <= 0.02)
{
continue;
}
double num11 = M[0, 0] * num7 + M[0, 1] * num8 + M[0, 2] * num9;
double num12 = M[2, 0] * num7 + M[2, 1] * num8 + M[2, 2] * num9;
double num13 = 0.55 + 0.45 * Math.Max(num11 * num2 + num10 * num3 + num12 * num4, 0.0);
int num14 = g.Tris[j * 3];
int num15 = g.Tris[j * 3 + 1];
int num16 = g.Tris[j * 3 + 2];
double num17 = sx[num14];
double num18 = sx[num15];
double num19 = sx[num16];
double num20 = sy[num14];
double num21 = sy[num15];
double num22 = sy[num16];
double num23 = (num21 - num22) * (num17 - num19) + (num19 - num18) * (num20 - num22);
if (Math.Abs(num23) < 1E-09)
{
continue;
}
int num24 = Math.Max(0, (int)Math.Min(num17, Math.Min(num18, num19)));
int num25 = Math.Min(num - 1, (int)Math.Max(num17, Math.Max(num18, num19)) + 1);
int num26 = Math.Max(0, (int)Math.Min(num20, Math.Min(num21, num22)));
int num27 = Math.Min(num - 1, (int)Math.Max(num20, Math.Max(num21, num22)) + 1);
for (int k = num26; k <= num27; k++)
{
for (int l = num24; l <= num25; l++)
{
double num28 = (double)l + 0.5;
double num29 = (double)k + 0.5;
double num30 = ((num21 - num22) * (num28 - num19) + (num19 - num18) * (num29 - num22)) / num23;
double num31 = ((num22 - num20) * (num28 - num19) + (num17 - num19) * (num29 - num22)) / num23;
double num32 = 1.0 - num30 - num31;
if (num30 < -0.0001 || num31 < -0.0001 || num32 < -0.0001)
{
continue;
}
double num33 = num30 * dp[num14] + num31 * dp[num15] + num32 * dp[num16];
int num34 = k * num + l;
if (!(num33 >= array2[num34]))
{
double num35 = num30 * (double)g.Uv[num14 * 2] + num31 * (double)g.Uv[num15 * 2] + num32 * (double)g.Uv[num16 * 2];
double num36 = num30 * (double)g.Uv[num14 * 2 + 1] + num31 * (double)g.Uv[num15 * 2 + 1] + num32 * (double)g.Uv[num16 * 2 + 1];
int x = Math.Max(0, Math.Min(tex.W - 1, (int)(num35 / 64.0 * (double)tex.W)));
int y = Math.Max(0, Math.Min(tex.H - 1, (int)(num36 / 64.0 * (double)tex.H)));
int num37 = tex.Idx(x, y);
if (tex.P[num37 + 3] > 127)
{
array2[num34] = num33;
array[num34 * 4] = (float)((double)(int)tex.P[num37] * num13);
array[num34 * 4 + 1] = (float)((double)(int)tex.P[num37 + 1] * num13);
array[num34 * 4 + 2] = (float)((double)(int)tex.P[num37 + 2] * num13);
array[num34 * 4 + 3] = 255f;
}
}
}
}
}
Img img = new Img(size, size);
for (int m = 0; m < size; m++)
{
for (int n = 0; n < size; n++)
{
double num38 = 0.0;
double num39 = 0.0;
double num40 = 0.0;
double num41 = 0.0;
for (int num42 = 0; num42 < ss; num42++)
{
for (int num43 = 0; num43 < ss; num43++)
{
int num44 = ((m * ss + num42) * num + n * ss + num43) * 4;
double num45 = (double)array[num44 + 3] / 255.0;
num38 += (double)array[num44] * num45;
num39 += (double)array[num44 + 1] * num45;
num40 += (double)array[num44 + 2] * num45;
num41 += num45;
}
}
int num46 = img.Idx(n, m);
if (num41 > 0.0)
{
img.P[num46] = (byte)Math.Min(255.0, num38 / num41 + 0.5);
img.P[num46 + 1] = (byte)Math.Min(255.0, num39 / num41 + 0.5);
img.P[num46 + 2] = (byte)Math.Min(255.0, num40 / num41 + 0.5);
}
img.P[num46 + 3] = (byte)Math.Min(255.0, num41 * 255.0 / (double)(ss * ss) + 0.5);
}
}
return img;
}
}
public static class Encoders
{
public static byte[] Bgra(Img s)
{
byte[] array = new byte[s.W * s.H * 4];
for (int i = 0; i < array.Length; i += 4)
{
array[i] = s.P[i + 2];
array[i + 1] = s.P[i + 1];
array[i + 2] = s.P[i];
array[i + 3] = s.P[i + 3];
}
return array;
}
public static byte[] Bc3(Img im)
{
MemoryStream memoryStream = new MemoryStream();
int[,] array = new int[16, 4];
for (int i = 0; i < im.H; i += 4)
{
for (int j = 0; j < im.W; j += 4)
{
for (int k = 0; k < 16; k++)
{
int num = im.Idx(j + k % 4, i + k / 4);
for (int l = 0; l < 4; l++)
{
array[k, l] = im.P[num + l];
}
}
Alpha(array, memoryStream);
Colour(array, memoryStream);
}
}
return memoryStream.ToArray();
}
private static void Alpha(int[,] b, Stream o)
{
int num = 0;
int num2 = 255;
for (int i = 0; i < 16; i++)
{
num = Math.Max(num, b[i, 3]);
num2 = Math.Min(num2, b[i, 3]);
}
o.WriteByte((byte)num);
o.WriteByte((byte)num2);
ulong num3 = 0uL;
if (num != num2)
{
int[] array = new int[8] { num, num2, 0, 0, 0, 0, 0, 0 };
for (int j = 1; j < 7; j++)
{
array[j + 1] = ((7 - j) * num + j * num2) / 7;
}
for (int k = 0; k < 16; k++)
{
int num4 = 0;
int num5 = int.MaxValue;
for (int l = 0; l < 8; l++)
{
int num6 = Math.Abs(b[k, 3] - array[l]);
if (num6 < num5)
{
num5 = num6;
num4 = l;
}
}
num3 |= (ulong)((long)num4 << 3 * k);
}
}
for (int m = 0; m < 6; m++)
{
o.WriteByte((byte)(num3 >> 8 * m));
}
}
private static int To565(int r, int g, int b)
{
return ((r * 31 + 127) / 255 << 11) | ((g * 63 + 127) / 255 << 5) | ((b * 31 + 127) / 255);
}
private static int[] From565(int v)
{
return new int[3]
{
((v >> 11) & 0x1F) * 255 / 31,
((v >> 5) & 0x3F) * 255 / 63,
(v & 0x1F) * 255 / 31
};
}
private static void Colour(int[,] b, Stream o)
{
double num = 0.0;
double num2 = 0.0;
double num3 = 0.0;
for (int i = 0; i < 16; i++)
{
num += (double)b[i, 0];
num2 += (double)b[i, 1];
num3 += (double)b[i, 2];
}
num /= 16.0;
num2 /= 16.0;
num3 /= 16.0;
double[,] array = new double[3, 3];
for (int j = 0; j < 16; j++)
{
double[] array2 = new double[3]
{
(double)b[j, 0] - num,
(double)b[j, 1] - num2,
(double)b[j, 2] - num3
};
for (int k = 0; k < 3; k++)
{
for (int l = 0; l < 3; l++)
{
array[k, l] += array2[k] * array2[l];
}
}
}
double num4 = 1.0;
double num5 = 1.0;
double num6 = 1.0;
for (int m = 0; m < 16; m++)
{
double num7 = array[0, 0] * num4 + array[0, 1] * num5 + array[0, 2] * num6;
double num8 = array[1, 0] * num4 + array[1, 1] * num5 + array[1, 2] * num6;
double num9 = array[2, 0] * num4 + array[2, 1] * num5 + array[2, 2] * num6;
double num10 = Math.Sqrt(num7 * num7 + num8 * num8 + num9 * num9);
if (num10 < 1E-09)
{
break;
}
num4 = num7 / num10;
num5 = num8 / num10;
num6 = num9 / num10;
}
int num11 = 0;
int num12 = 0;
double num13 = 1000000000.0;
double num14 = -1000000000.0;
for (int n = 0; n < 16; n++)
{
double num15 = ((double)b[n, 0] - num) * num4 + ((double)b[n, 1] - num2) * num5 + ((double)b[n, 2] - num3) * num6;
if (num15 < num13)
{
num13 = num15;
num11 = n;
}
if (num15 > num14)
{
num14 = num15;
num12 = n;
}
}
int num16 = To565(b[num12, 0], b[num12, 1], b[num12, 2]);
int num17 = To565(b[num11, 0], b[num11, 1], b[num11, 2]);
if (num16 < num17)
{
int num18 = num16;
num16 = num17;
num17 = num18;
}
uint num19 = 0u;
if (num16 != num17)
{
int[] array3 = From565(num16);
int[] array4 = From565(num17);
int[][] array5 = new int[4][]
{
array3,
array4,
new int[3],
new int[3]
};
for (int num20 = 0; num20 < 3; num20++)
{
array5[2][num20] = (2 * array3[num20] + array4[num20]) / 3;
array5[3][num20] = (array3[num20] + 2 * array4[num20]) / 3;
}
for (int num21 = 0; num21 < 16; num21++)
{
int num22 = 0;
long num23 = long.MaxValue;
for (int num24 = 0; num24 < 4; num24++)
{
long num25 = 0L;
for (int num26 = 0; num26 < 3; num26++)
{
long num27 = b[num21, num26] - array5[num24][num26];
num25 += num27 * num27;
}
if (num25 < num23)
{
num23 = num25;
num22 = num24;
}
}
num19 |= (uint)(num22 << 2 * num21);
}
}
BinaryWriter binaryWriter = new BinaryWriter(o);
binaryWriter.Write((ushort)num16);
binaryWriter.Write((ushort)num17);
binaryWriter.Write(num19);
}
}
public class SkinSlot
{
public string HeroKey;
public string ImagePath;
public FaceMode Mode;
public List<int> Eyes = new List<int>();
public GameFace Face;
public int? LidColor;
public int? LidColor2;
}
public static class ModBuilder
{
public const string ModName = "zzz_Dungeons2SkinLoader_P";
public static readonly string[] LegacyNames = new string[1] { "zzz_CustomSkin_P" };
private static byte[] Patch(byte[] tmpl, int off, byte[] data)
{
byte[] array = (byte[])tmpl.Clone();
Buffer.BlockCopy(data, 0, array, off, data.Length);
return array;
}
public static byte[] MresData(GameData gd)
{
byte[] array = new byte[4096];
int num = 0;
for (int i = 0; i < 16; i++)
{
int num2 = 0;
while (num2 < 16)
{
Buffer.BlockCopy((i < 4 && num2 < 8) ? gd.MresHead : gd.MresBody, 0, array, num, 16);
num2++;
num += 16;
}
}
return array;
}
public static Dictionary<string, byte[]> Build(GameData gd, IList<SkinSlot> slots, bool layers, Action<string> log, bool includeMesh = true)
{
List<Tuple<byte[], byte[]>> chunks = new List<Tuple<byte[], byte[]>>();
List<Tuple<string, int>> paths = new List<Tuple<string, int>>();
List<List<byte[]>> imports = new List<List<byte[]>>();
Action<Pkg, byte[]> action = delegate(Pkg p, byte[] data)
{
if (!chunks.Any((Tuple<byte[], byte[]> c) => c.Item1.SequenceEqual(p.ChunkId)))
{
paths.Add(Tuple.Create(p.Path, chunks.Count));
chunks.Add(Tuple.Create(p.ChunkId, data));
imports.Add(p.Imports);
}
};
Geo g = gd.IconGeo[(!layers) ? 1u : 0u];
foreach (SkinSlot slot in slots)
{
Hero hero = gd.FindHero(slot.HeroKey);
if (hero == null)
{
throw new InvalidDataException("Unknown hero " + slot.HeroKey);
}
Img img = Converter.Convert(gd, Img.FromFile(slot.ImagePath), slot.Mode, slot.Eyes, slot.Face, slot.LidColor, slot.LidColor2);
action(hero.Skin, Patch(hero.Skin.Data, hero.Skin.PixelOffset, Encoders.Bgra(img)));
action(hero.Mres, Patch(hero.Mres.Data, hero.Mres.PixelOffset, MresData(gd)));
Img im = Renderer.RenderIcon(g, img, 256, gd.IconCam);
action(hero.Icon, Patch(hero.Icon.Data, hero.Icon.PixelOffset, Encoders.Bc3(im)));
log?.Invoke(hero.Display + " <- " + Path.GetFileName(slot.ImagePath));
}
Pkg pkg = gd.Mesh[(!layers) ? 1u : 0u];
action(pkg, pkg.Data);
ulong num = BitConverter.ToUInt64(SHA1.Create().ComputeHash(Encoding.ASCII.GetBytes("zzz_Dungeons2SkinLoader_P")), 0);
byte[] item = ContainerHeader(num, chunks.Select((Tuple<byte[], byte[]> c) => c.Item1.Take(8).ToArray()).ToList(), imports);
byte[] array = new byte[12];
Buffer.BlockCopy(BitConverter.GetBytes(num), 0, array, 0, 8);
array[11] = 6;
chunks.Add(Tuple.Create(array, item));
Dictionary<string, byte[]> dictionary = WriteContainer(gd.Key, chunks, paths);
dictionary["zzz_Dungeons2SkinLoader_P.pak"] = EmptyPak();
return dictionary;
}
private static byte[] FStr(string s)
{
byte[] bytes = Encoding.ASCII.GetBytes(s + "\0");
byte[] array = new byte[4 + bytes.Length];
Buffer.BlockCopy(BitConverter.GetBytes(bytes.Length), 0, array, 0, 4);
Buffer.BlockCopy(bytes, 0, array, 4, bytes.Length);
return array;
}
private static byte[] ContainerHeader(ulong cid, List<byte[]> pkgs, List<List<byte[]>> imps)
{
int count = pkgs.Count;
byte[] array = new byte[16 * count];
List<byte> list = new List<byte>();
for (int i = 0; i < count; i++)
{
int num = 16 * i;
int count2 = imps[i].Count;
int num2 = 16 * count + list.Count;
foreach (byte[] item in imps[i])
{
list.AddRange(item);
}
Buffer.BlockCopy(BitConverter.GetBytes(count2), 0, array, num, 4);
Buffer.BlockCopy(BitConverter.GetBytes((count2 > 0) ? (num2 - num) : 0), 0, array, num + 4, 4);
}
byte[] array2 = array.Concat(list).ToArray();
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
binaryWriter.Write(1232028526);
binaryWriter.Write(5);
binaryWriter.Write(cid);
binaryWriter.Write(count);
foreach (byte[] pkg in pkgs)
{
binaryWriter.Write(pkg);
}
binaryWriter.Write(array2.Length);
binaryWriter.Write(array2);
binaryWriter.Write(0);
binaryWriter.Write(0);
binaryWriter.Write(0);
binaryWriter.Write(0);
binaryWriter.Write(0);
long value = memoryStream.Length + 16;
binaryWriter.Write(value);
binaryWriter.Write(4L);
binaryWriter.Write(0);
return memoryStream.ToArray();
}
private static byte[] DirIndex(string mount, List<Tuple<string, int>> paths)
{
List<string> strings = new List<string>();
Dictionary<string, int> sidx = new Dictionary<string, int>();
Func<string, int> S = delegate(string x)
{
if (!sidx.TryGetValue(x, out var value3))
{
value3 = strings.Count;
sidx[x] = value3;
strings.Add(x);
}
return value3;
};
List<uint[]> dirs = new List<uint[]> { new uint[4] { 4294967295u, 4294967295u, 4294967295u, 4294967295u } };
List<uint[]> list = new List<uint[]>();
Func<int, string, int> func = delegate(int di, string name)
{
for (uint num2 = dirs[di][1]; num2 != uint.MaxValue; num2 = dirs[(int)num2][2])
{
if (strings[(int)dirs[(int)num2][0]] == name)
{
return (int)num2;
}
}
dirs.Add(new uint[4]
{
(uint)S(name),
4294967295u,
dirs[di][1],
4294967295u
});
dirs[di][1] = (uint)(dirs.Count - 1);
return dirs.Count - 1;
};
foreach (Tuple<string, int> path in paths)
{
string[] array = path.Item1.Split(new char[1] { '/' });
int num = 0;
for (int i = 0; i < array.Length - 1; i++)
{
num = func(num, array[i]);
}
list.Add(new uint[3]
{
(uint)S(array[^1]),
dirs[num][3],
(uint)path.Item2
});
dirs[num][3] = (uint)(list.Count - 1);
}
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
binaryWriter.Write(FStr(mount));
binaryWriter.Write(dirs.Count);
foreach (uint[] item in dirs)
{
uint[] array2 = item;
foreach (uint value in array2)
{
binaryWriter.Write(value);
}
}
binaryWriter.Write(list.Count);
foreach (uint[] item2 in list)
{
uint[] array3 = item2;
foreach (uint value2 in array3)
{
binaryWriter.Write(value2);
}
}
binaryWriter.Write(strings.Count);
foreach (string item3 in strings)
{
binaryWriter.Write(FStr(item3));
}
return memoryStream.ToArray();
}
private static ulong ChunkHash(ulong seed, byte[] data)
{
ulong num = ((seed != 0) ? seed : 14695981039346656037uL);
foreach (byte b in data)
{
num = (num * 1099511628211L) ^ b;
}
return num;
}
private static byte[] Aes(byte[] key, byte[] data)
{
AesManaged aesManaged = new AesManaged();
aesManaged.Mode = CipherMode.ECB;
aesManaged.Padding = PaddingMode.None;
aesManaged.KeySize = 256;
aesManaged.Key = key;
using AesManaged aesManaged2 = aesManaged;
using ICryptoTransform cryptoTransform = aesManaged2.CreateEncryptor();
return cryptoTransform.TransformFinalBlock(data, 0, data.Length);
}
private static byte[] Pad16(byte[] d)
{
byte[] array = new byte[(d.Length + 15) / 16 * 16];
Buffer.BlockCopy(d, 0, array, 0, d.Length);
return array;
}
private static void Be5(BinaryWriter w, long v)
{
for (int num = 4; num >= 0; num--)
{
w.Write((byte)(v >> 8 * num));
}
}
private static void Le(BinaryWriter w, long v, int n)
{
for (int i = 0; i < n; i++)
{
w.Write((byte)(v >> 8 * i));
}
}
private static Dictionary<string, byte[]> WriteContainer(byte[] key, List<Tuple<byte[], byte[]>> chunks, List<Tuple<string, int>> paths)
{
MemoryStream memoryStream = new MemoryStream();
List<long[]> list = new List<long[]>();
List<long[]> list2 = new List<long[]>();
long num = 0L;
foreach (Tuple<byte[], byte[]> chunk in chunks)
{
byte[] item = chunk.Item2;
list.Add(new long[2] { num, item.Length });
for (int i = 0; i < Math.Max(item.Length, 1); i += 65536)
{
int num2 = Math.Min(65536, item.Length - i);
byte[] array = new byte[num2];
Buffer.BlockCopy(item, i, array, 0, num2);
list2.Add(new long[3] { memoryStream.Length, num2, num2 });
byte[] array2 = Aes(key, Pad16(array));
memoryStream.Write(array2, 0, array2.Length);
}
num += (item.Length + 65536 - 1) / 65536 * 65536;
}
byte[] array3 = Aes(key, Pad16(DirIndex("../../../", paths)));
int num3;
int nseeds;
for (num3 = (nseeds = chunks.Count); chunks.Select((Tuple<byte[], byte[]> c) => ChunkHash(0uL, c.Item1) % (ulong)nseeds).Distinct().Count() < num3; nseeds++)
{
}
int[] array4 = new int[nseeds];
for (int j = 0; j < num3; j++)
{
array4[(uint)(ChunkHash(0uL, chunks[j].Item1) % (ulong)nseeds)] = -j - 1;
}
byte[] array5 = new byte[144];
Buffer.BlockCopy(Encoding.ASCII.GetBytes("-==--==--==--==-"), 0, array5, 0, 16);
array5[16] = 8;
int[] array6 = new int[9] { 144, 0, 0, 12, 0, 32, 65536, 0, 1 };
array6[1] = num3;
array6[2] = list2.Count;
array6[7] = array3.Length;
int[] array7 = array6;
for (int k = 0; k < array7.Length; k++)
{
Buffer.BlockCopy(BitConverter.GetBytes(array7[k]), 0, array5, 20 + 4 * k, 4);
}
Buffer.BlockCopy(chunks[num3 - 1].Item1, 0, array5, 56, 8);
array5[80] = 10;
Buffer.BlockCopy(BitConverter.GetBytes(nseeds), 0, array5, 84, 4);
Buffer.BlockCopy(BitConverter.GetBytes(ulong.MaxValue), 0, array5, 88, 8);
MemoryStream memoryStream2 = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter(memoryStream2);
binaryWriter.Write(array5);
foreach (Tuple<byte[], byte[]> chunk2 in chunks)
{
binaryWriter.Write(chunk2.Item1);
}
foreach (long[] item2 in list)
{
Be5(binaryWriter, item2[0]);
Be5(binaryWriter, item2[1]);
}
int[] array8 = array4;
foreach (int value in array8)
{
binaryWriter.Write(value);
}
foreach (long[] item3 in list2)
{
Le(binaryWriter, item3[0], 5);
Le(binaryWriter, item3[1], 3);
Le(binaryWriter, item3[2], 3);
binaryWriter.Write((byte)0);
}
binaryWriter.Write(array3);
SHA1 sHA = SHA1.Create();
foreach (Tuple<byte[], byte[]> chunk3 in chunks)
{
binaryWriter.Write(sHA.ComputeHash(chunk3.Item2));
binaryWriter.Write(0);
}
Dictionary<string, byte[]> dictionary = new Dictionary<string, byte[]>();
dictionary["zzz_Dungeons2SkinLoader_P.utoc"] = memoryStream2.ToArray();
dictionary["zzz_Dungeons2SkinLoader_P.ucas"] = memoryStream.ToArray();
return dictionary;
}
private static byte[] EmptyPak()
{
SHA1 sHA = SHA1.Create();
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
binaryWriter.Write(1);
binaryWriter.Write(FStr("/"));
binaryWriter.Write(0);
byte[] array = new byte[8];
int num = FStr("../../../").Length + 4 + 8 + 4 + 16 + 20 + 4 + 16 + 20 + 4 + 4;
long num2 = num;
long value = num2 + array.Length;
MemoryStream memoryStream2 = new MemoryStream();
BinaryWriter binaryWriter2 = new BinaryWriter(memoryStream2);
binaryWriter2.Write(FStr("../../../"));
binaryWriter2.Write(0);
binaryWriter2.Write(0uL);
binaryWriter2.Write(1);
binaryWriter2.Write(num2);
binaryWriter2.Write((long)array.Length);
binaryWriter2.Write(sHA.ComputeHash(array));
binaryWriter2.Write(1);
binaryWriter2.Write(value);
binaryWriter2.Write(memoryStream.Length);
binaryWriter2.Write(sHA.ComputeHash(memoryStream.ToArray()));
binaryWriter2.Write(0);
binaryWriter2.Write(0);
byte[] array2 = memoryStream2.ToArray();
MemoryStream memoryStream3 = new MemoryStream();
BinaryWriter binaryWriter3 = new BinaryWriter(memoryStream3);
binaryWriter3.Write(array2);
binaryWriter3.Write(array);
binaryWriter3.Write(memoryStream.ToArray());
binaryWriter3.Write(new byte[16]);
binaryWriter3.Write((byte)0);
binaryWriter3.Write(1517228769);
binaryWriter3.Write(11);
binaryWriter3.Write(0L);
binaryWriter3.Write((long)array2.Length);
binaryWriter3.Write(sHA.ComputeHash(array2));
binaryWriter3.Write(new byte[160]);
return memoryStream3.ToArray();
}
}
public static class Game
{
public enum State
{
None,
Current,
Old
}
public const string Exe = "Dungeons-Win64-Shipping";
public const string Marker = "Dungeons2SkinLoader.txt";
public static List<string> Candidates()
{
List<string> list = new List<string>();
try
{
using RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Valve\\Steam");
string text = ((registryKey != null) ? (registryKey.GetValue("SteamPath") as string) : null);
if (text != null)
{
list.Add(text.Replace('/', '\\'));
string path = Path.Combine(text, "steamapps\\libraryfolders.vdf");
if (File.Exists(path))
{
foreach (Match item in Regex.Matches(File.ReadAllText(path), "\"path\"\\s+\"(.+?)\""))
{
list.Add(item.Groups[1].Value.Replace("\\\\", "\\"));
}
}
}
}
catch
{
}
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo driveInfo in drives)
{
list.Add(Path.Combine(driveInfo.Name, "SteamLibrary"));
list.Add(Path.Combine(driveInfo.Name, "Program Files (x86)\\Steam"));
}
return list.Select((string l) => Path.Combine(l, "steamapps\\common\\Minecraft Dungeons II")).Distinct<string>(StringComparer.OrdinalIgnoreCase).ToList();
}
public static string Paks(string game)
{
return Path.Combine(game, "Dungeons\\Content\\Paks");
}
public static bool IsGame(string game)
{
return File.Exists(Path.Combine(Paks(game), "Dungeons-Windows.utoc"));
}
public static string Find()
{
return Candidates().FirstOrDefault(IsGame);
}
public static bool VersionMatches(GameData gd, string game)
{
string text = Path.Combine(Paks(game), "Dungeons-Windows.utoc");
if (new FileInfo(text).Length != (long)gd.UtocSize)
{
return false;
}
using FileStream fileStream = File.OpenRead(text);
byte[] array = new byte[64];
fileStream.Read(array, 0, array.Length);
return BitConverter.ToUInt64(array, 56) == gd.ContainerId;
}
public static bool Running()
{
return Process.GetProcessesByName("Dungeons-Win64-Shipping").Length > 0;
}
public static string ModDir(string game)
{
return Path.Combine(Paks(game), "~mods");
}
public static List<string> ModFiles(string game)
{
List<string> list = new List<string>();
string[] array = new string[2]
{
ModDir(game),
Paks(game)
};
foreach (string text in array)
{
if (!Directory.Exists(text))
{
continue;
}
foreach (string item in new string[1] { "zzz_Dungeons2SkinLoader_P" }.Concat(ModBuilder.LegacyNames))
{
string[] array2 = new string[4] { ".pak", ".utoc", ".ucas", ".sig" };
foreach (string text2 in array2)
{
string text3 = Path.Combine(text, item + text2);
if (File.Exists(text3))
{
list.Add(text3);
}
}
}
string text4 = Path.Combine(text, "Dungeons2SkinLoader.txt");
if (File.Exists(text4))
{
list.Add(text4);
}
}
return list;
}
public static State Detect(string game, out string version)
{
version = null;
List<string> list = ModFiles(game);
if (list.Count == 0)
{
return State.None;
}
string path = Path.Combine(ModDir(game), "Dungeons2SkinLoader.txt");
if (File.Exists(path))
{
string[] array = File.ReadAllLines(path);
foreach (string text in array)
{
if (text.StartsWith("version="))
{
version = text.Substring(8).Trim();
}
}
}
if (!File.Exists(Path.Combine(ModDir(game), "zzz_Dungeons2SkinLoader_P.utoc")) || !(version == "1.0.0") || list.Any((string f) => ModBuilder.LegacyNames.Any((string n) => Path.GetFileName(f).StartsWith(n))))
{
return State.Old;
}
return State.Current;
}
public static bool Installed(string game)
{
string version;
return Detect(game, out version) != State.None;
}
public static int Install(string game, Dictionary<string, byte[]> files, IEnumerable<string> heroes)
{
int result = Uninstall(game);
string text = ModDir(game);
Directory.CreateDirectory(text);
foreach (KeyValuePair<string, byte[]> file in files)
{
File.WriteAllBytes(Path.Combine(text, file.Key), file.Value);
}
File.WriteAllLines(Path.Combine(text, "Dungeons2SkinLoader.txt"), new string[4]
{
"Dungeons 2 Skin Loader by Poyraz Captain - cosmetic skin mod",
"version=1.0.0",
"installed=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
"heroes=" + string.Join(", ", heroes)
});
return result;
}
public static int Uninstall(string game)
{
List<string> list = ModFiles(game);
foreach (string item in list)
{
File.Delete(item);
}
return list.Count;
}
}
internal static class Cli
{
public static int Run(string[] args)
{
GameData gd = App.LoadData();
string text = args[1];
bool flag = args.Contains("--flat");
bool flag2 = args.Contains("--nomesh");
List<SkinSlot> list = new List<SkinSlot>();
foreach (string item in from x in args.Skip(2)
where !x.StartsWith("--")
select x)
{
string[] array = item.Split(new char[1] { '|' });
SkinSlot skinSlot = new SkinSlot();
skinSlot.HeroKey = array[0] + "|" + array[1];
skinSlot.ImagePath = array[2];
SkinSlot skinSlot2 = skinSlot;
skinSlot2.Mode = ((array[3] == "game") ? FaceMode.Game : ((array[3] == "blink") ? FaceMode.Blink : FaceMode.Drawn));
if (array.Length > 4 && array[4].Trim() != "")
{
skinSlot2.Eyes = (from e in array[4].Split(new char[1] { ' ' })
select int.Parse(e.Split(new char[1] { '.' })[0]) * 8 + int.Parse(e.Split(new char[1] { '.' })[1])).ToList();
}
else if (skinSlot2.Mode != 0)
{
skinSlot2.Eyes = Converter.DetectEyes(Converter.To64(Img.FromFile(skinSlot2.ImagePath)));
}
list.Add(skinSlot2);
}
Dictionary<string, byte[]> dictionary = ModBuilder.Build(gd, list, !flag, Console.WriteLine, !flag2);
if (args.Contains("--export"))
{
if (File.Exists(text))
{
File.Delete(text);
}
using (ZipArchive zipArchive = ZipFile.Open(text, ZipArchiveMode.Create))
{
foreach (KeyValuePair<string, byte[]> item2 in dictionary)
{
using Stream stream = zipArchive.CreateEntry(item2.Key).Open();
stream.Write(item2.Value, 0, item2.Value.Length);
}
foreach (KeyValuePair<string, string> item3 in FriendScripts.Files(list.Select((SkinSlot s) => gd.FindHero(s.HeroKey).Display)))
{
using StreamWriter streamWriter = new StreamWriter(zipArchive.CreateEntry(item3.Key).Open());
streamWriter.Write(item3.Value);
}
}
Console.WriteLine("exported " + text);
return 0;
}
if (args.Contains("--install"))
{
int num = Game.Install(text, dictionary, list.Select((SkinSlot s) => gd.FindHero(s.HeroKey).Display));
Console.WriteLine("installed to " + Game.ModDir(text) + " (removed " + num + " old files)");
return 0;
}
Directory.CreateDirectory(text);
foreach (KeyValuePair<string, byte[]> item4 in dictionary)
{
File.WriteAllBytes(Path.Combine(text, item4.Key), item4.Value);
}
Console.WriteLine("wrote " + text);
return 0;
}
}
public static class Theme
{
public static readonly Color Bg = Color.FromArgb(7, 9, 15);
public static readonly Color Panel = Color.FromArgb(12, 16, 26);
public static readonly Color Card = Color.FromArgb(20, 27, 43);
public static readonly Color CardHi = Color.FromArgb(29, 39, 62);
public static readonly Color Line = Color.FromArgb(38, 52, 82);
public static readonly Color Text = Color.FromArgb(234, 240, 255);
public static readonly Color Dim = Color.FromArgb(134, 150, 184);
public static readonly Color Accent = Color.FromArgb(56, 142, 255);
public static readonly Color AccentHi = Color.FromArgb(98, 170, 255);
public static readonly Color AccentDeep = Color.FromArgb(22, 82, 180);
public static readonly Color Gold = Color.FromArgb(246, 190, 70);
public static readonly Color Warn = Color.FromArgb(240, 184, 72);
public static readonly Color Bad = Color.FromArgb(236, 98, 92);
public static readonly Color Blue = Color.FromArgb(120, 184, 255);
public static readonly Color OnAccent = Color.FromArgb(255, 255, 255);
private static PrivateFontCollection pfc;
private static FontFamily pixel;
private static bool pixelTried;
public static bool Square = true;
public static Font F(float size, FontStyle st = 0)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
return new Font("Segoe UI", size, st);
}
public static Font Semi(float size)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new Font("Segoe UI Semibold", size);
}
public static Font P(float size)
{
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
if (!pixelTried)
{
pixelTried = true;
try
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("font.ttf");
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
IntPtr intPtr = Marshal.AllocCoTaskMem(array.Length);
Marshal.Copy(array, 0, intPtr, array.Length);
pfc = new PrivateFontCollection();
pfc.AddMemoryFont(intPtr, array.Length);
pixel = ((FontCollection)pfc).Families[0];
}
catch
{
pixel = null;
}
}
if (pixel == null)
{
return Semi(size);
}
return new Font(pixel, size, (FontStyle)0);
}
public static Color Lerp(Color a, Color b, float t)
{
t = Math.Max(0f, Math.Min(1f, t));
return Color.FromArgb((int)((float)(int)a.A + (float)(b.A - a.A) * t), (int)((float)(int)a.R + (float)(b.R - a.R) * t), (int)((float)(int)a.G + (float)(b.G - a.G) * t), (int)((float)(int)a.B + (float)(b.B - a.B) * t));
}
public static Color Shade(Color c, float k)
{
if (!(k < 0f))
{
return Lerp(c, Color.FromArgb(c.A, 255, 255, 255), k);
}
return Lerp(c, Color.FromArgb(c.A, 0, 0, 0), 0f - k);
}
public static GraphicsPath Round(RectangleF r, float rad)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
GraphicsPath val = new GraphicsPath();
float num = rad * 2f;
if (Square || num <= 0f)
{
val.AddRectangle(new RectangleF((float)Math.Round(r.X), (float)Math.Round(r.Y), (float)Math.Round(r.Width), (float)Math.Round(r.Height)));
return val;
}
val.AddArc(r.X, r.Y, num, num, 180f, 90f);
val.AddArc(r.Right - num, r.Y, num, num, 270f, 90f);
val.AddArc(r.Right - num, r.Bottom - num, num, num, 0f, 90f);
val.AddArc(r.X, r.Bottom - num, num, num, 90f, 90f);
val.CloseFigure();
return val;
}
public static void Hq(Graphics g)
{
g.SmoothingMode = (SmoothingMode)3;
g.TextRenderingHint = (TextRenderingHint)3;
g.InterpolationMode = (InterpolationMode)7;
g.PixelOffsetMode = (PixelOffsetMode)4;
}
public static void Bevel(Graphics g, RectangleF r, Color face, bool pressed)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
Rectangle rectangle = Rectangle.Round(r);
Color color = Shade(face, 0.28f);
Color color2 = Shade(face, -0.35f);
if (pressed)
{
Color color3 = color;
color = color2;
color2 = color3;
}
SolidBrush val = new SolidBrush(color);
try
{
g.FillRectangle((Brush)(object)val, rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, 2);
g.FillRectangle((Brush)(object)val, rectangle.X + 2, rectangle.Y + 2, 2, rectangle.Height - 4);
}
finally
{
((IDisposable)val)?.Dispose();
}
SolidBrush val2 = new SolidBrush(color2);
try
{
g.FillRectangle((Brush)(object)val2, rectangle.X + 2, rectangle.Bottom - 4, rectangle.Width - 4, 2);
g.FillRectangle((Brush)(object)val2, rectangle.Right - 4, rectangle.Y + 2, 2, rectangle.Height - 4);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Color.Black, 2f);
try
{
g.DrawRectangle(val3, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
}
public class AnimControl : Control
{
private static readonly Timer clock;
private static readonly List<AnimControl> live;
protected float hover;
protected float press;
protected float extra;
protected float hoverT;
protected float pressT;
protected float extraT;
static AnimControl()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
Timer val = new Timer();
val.Interval = 15;
clock = val;
live = new List<AnimControl>();
clock.Tick += delegate
{
AnimControl[] array = live.ToArray();
foreach (AnimControl animControl in array)
{
animControl.Step();
}
};
clock.Start();
}
public AnimControl()
{
((Control)this).SetStyle((ControlStyles)139282, true);
live.Add(this);
EventHandler value = delegate
{
live.Remove(this);
};
((Component)this).Disposed += value;
}
protected virtual void Step()
{
bool flag = false;
flag |= Ease(ref hover, hoverT, 0.22f);
flag |= Ease(ref press, pressT, 0.35f);
if (flag | Ease(ref extra, extraT, 0.14f))
{
((Control)this).Invalidate();
}
}
protected static bool Ease(ref float v, float t, float k)
{
if (Math.Abs(v - t) < 0.004f)
{
if (v == t)
{
return false;
}
v = t;
return true;
}
v += (t - v) * k;
return true;
}
protected override void OnMouseEnter(EventArgs e)
{
((Control)this).OnMouseEnter(e);
if (((Control)this).Enabled)
{
hoverT = 1f;
}
}
protected override void OnMouseLeave(EventArgs e)
{
((Control)this).OnMouseLeave(e);
hoverT = 0f;
pressT = 0f;
}
protected override void OnMouseDown(MouseEventArgs e)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
((Control)this).OnMouseDown(e);
if (((Control)this).Enabled && (int)e.Button == 1048576)
{
pressT = 1f;
}
}
protected override void OnMouseUp(MouseEventArgs e)
{
((Control)this).OnMouseUp(e);
pressT = 0f;
}
protected void PaintParentBg(Graphics g)
{
g.Clear((((Control)this).Parent != null) ? ((Control)this).Parent.BackColor : Theme.Panel);
}
}
public enum BtnKind
{
Primary,
Secondary
}
public class TactileButton : AnimControl
{
public BtnKind Kind;
public string Glyph;
private PointF rippleAt;
private float ripple = 1f;
public TactileButton(string text, BtnKind kind = BtnKind.Secondary, string glyph = null)
{
((Control)this).Text = text;
Kind = kind;
Glyph = glyph;
((Control)this).Cursor = Cursors.Hand;
((Control)this).Height = 44;
((Control)this).Width = 160;
((Control)this).Font = Theme.P((Kind == BtnKind.Primary) ? 14f : 12.5f);
}
protected override void Step()
{
base.Step();
if (ripple < 1f)
{
ripple = Math.Min(1f, ripple + 0.045f);
((Control)this).Invalidate();
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
rippleAt = e.Location;
ripple = 0f;
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Expected O, but got Unknown
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
Color a;
Color b;
Color color;
Color color2;
if (Kind == BtnKind.Primary)
{
a = Theme.Accent;
b = Theme.AccentHi;
color = Theme.OnAccent;
color2 = Theme.AccentDeep;
}
else
{
a = Theme.Card;
b = Theme.CardHi;
color = Theme.Text;
color2 = Color.FromArgb(4, 6, 11);
}
float num = 4f;
float num2 = num * 0.8f * press;
GraphicsPath val = Theme.Round(new RectangleF(1f, 1f + num, ((Control)this).Width - 3, (float)((Control)this).Height - num - 2f), 10f);
try
{
SolidBrush val2 = new SolidBrush(color2);
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
RectangleF r = new RectangleF(1f, 1f + num2, ((Control)this).Width - 3, (float)((Control)this).Height - num - 2f);
Color color3 = Theme.Shade(Theme.Lerp(a, b, hover), -0.12f * press);
GraphicsPath val3 = Theme.Round(r, 10f);
try
{
SolidBrush val4 = new SolidBrush(color3);
try
{
graphics.FillPath((Brush)(object)val4, val3);
}
finally
{
((IDisposable)val4)?.Dispose();
}
Theme.Bevel(graphics, r, color3, press > 0.5f);
if (hover > 0.02f && Kind != 0)
{
Pen val5 = new Pen(Color.FromArgb((int)(200f * hover), Theme.Accent), 2f);
try
{
graphics.DrawRectangle(val5, r.X + 1f, r.Y + 1f, r.Width - 2f, r.Height - 2f);
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
if (ripple < 1f)
{
graphics.SetClip(val3);
float num3 = 20f + ripple * (float)((Control)this).Width;
SolidBrush val6 = new SolidBrush(Color.FromArgb((int)(80f * (1f - ripple)), 255, 255, 255));
try
{
graphics.FillEllipse((Brush)(object)val6, rippleAt.X - num3, rippleAt.Y - num3, 2f * num3, 2f * num3);
}
finally
{
((IDisposable)val6)?.Dispose();
}
graphics.ResetClip();
}
}
finally
{
((IDisposable)val3)?.Dispose();
}
string text = ((Glyph != null) ? (Glyph + " ") : "") + ((Control)this).Text;
SizeF sizeF = graphics.MeasureString(text, ((Control)this).Font);
SolidBrush val7 = new SolidBrush(color);
try
{
graphics.DrawString(text, ((Control)this).Font, (Brush)(object)val7, ((float)((Control)this).Width - sizeF.Width) / 2f, r.Y + (r.Height - sizeF.Height) / 2f);
}
finally
{
((IDisposable)val7)?.Dispose();
}
}
}
public class OptionCard : AnimControl
{
public string Title;
public string Desc;
public bool Checked
{
get
{
return extraT > 0.5f;
}
set
{
extraT = (value ? 1 : 0);
((Control)this).Invalidate();
}
}
public event EventHandler Picked;
public OptionCard(string t, string d)
{
Title = t;
Desc = d;
((Control)this).Height = 74;
((Control)this).Cursor = Cursors.Hand;
}
protected override void OnClick(EventArgs e)
{
((Control)this).OnClick(e);
if (this.Picked != null)
{
this.Picked(this, e);
}
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Expected O, but got Unknown
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Expected O, but got Unknown
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Expected O, but got Unknown
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
RectangleF r = new RectangleF(1f, 1f + 1.5f * press, ((Control)this).Width - 3, ((Control)this).Height - 4);
GraphicsPath val = Theme.Round(r, 11f);
try
{
SolidBrush val2 = new SolidBrush(Theme.Lerp(Theme.Lerp(Theme.Card, Theme.CardHi, hover * 0.7f), Color.FromArgb(22, 38, 72), extra));
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Lerp(Theme.Lerp(Theme.Line, Theme.Dim, hover * 0.5f), Theme.Accent, extra), 1f + extra);
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
float num = r.Y + r.Height / 2f;
SolidBrush val4 = new SolidBrush(Theme.Bg);
try
{
graphics.FillRectangle((Brush)(object)val4, 17f, num - 10f, 20f, 20f);
}
finally
{
((IDisposable)val4)?.Dispose();
}
Pen val5 = new Pen(Theme.Lerp(Theme.Dim, Theme.Accent, extra), 2f);
try
{
graphics.DrawRectangle(val5, 17f, num - 10f, 20f, 20f);
}
finally
{
((IDisposable)val5)?.Dispose();
}
float num2 = (float)Math.Round(10f * extra * (1f + 0.25f * (float)Math.Sin(Math.PI * (double)extra)));
if (num2 > 0.5f)
{
SolidBrush val6 = new SolidBrush(Theme.Accent);
try
{
graphics.FillRectangle((Brush)(object)val6, 27f - num2 / 2f, num - num2 / 2f, num2, num2);
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
SolidBrush val7 = new SolidBrush(Theme.Text);
try
{
graphics.DrawString(Title, Theme.P(14.3f), (Brush)(object)val7, 52f, r.Y + 10f);
}
finally
{
((IDisposable)val7)?.Dispose();
}
SolidBrush val8 = new SolidBrush(Theme.Dim);
try
{
graphics.DrawString(Desc, Theme.F(9f, (FontStyle)0), (Brush)(object)val8, new RectangleF(52f, r.Y + 33f, ((Control)this).Width - 62, 36f));
}
finally
{
((IDisposable)val8)?.Dispose();
}
}
}
public class SlotCard : AnimControl
{
public SkinSlot Slot;
public Hero Hero;
public Bitmap Custom;
public string ModeText;
public string FileName;
public bool Selected
{
get
{
return extraT > 0.5f;
}
set
{
extraT = (value ? 1 : 0);
((Control)this).Invalidate();
}
}
public SlotCard()
{
((Control)this).Height = 132;
((Control)this).Cursor = Cursors.Hand;
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Expected O, but got Unknown
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
RectangleF r = new RectangleF(2f, 3f + 1.5f * press, ((Control)this).Width - 5, ((Control)this).Height - 9);
GraphicsPath val = Theme.Round(r, 12f);
try
{
SolidBrush val2 = new SolidBrush(Theme.Lerp(Theme.Lerp(Theme.Card, Theme.CardHi, hover * 0.6f), Color.FromArgb(22, 38, 72), extra));
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Lerp(Theme.Lerp(Theme.Line, Theme.Dim, hover * 0.4f), Theme.Accent, extra), 1f + 1.2f * extra);
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
float num = 78f;
float num2 = r.X + 12f;
float num3 = r.Y + 34f;
SolidBrush val4 = new SolidBrush(Theme.Text);
try
{
graphics.DrawString((Hero != null) ? Hero.Display : "?", Theme.P(14.3f), (Brush)(object)val4, num2, r.Y + 8f);
}
finally
{
((IDisposable)val4)?.Dispose();
}
SolidBrush val5 = new SolidBrush(Theme.Lerp(Theme.Dim, Theme.Accent, extra));
try
{
graphics.DrawString(ModeText, Theme.F(8.5f, (FontStyle)0), (Brush)(object)val5, r.Right - 12f - graphics.MeasureString(ModeText, Theme.F(8.5f, (FontStyle)0)).Width, r.Y + 11f);
}
finally
{
((IDisposable)val5)?.Dispose();
}
if (Hero != null && Hero.Original != null)
{
graphics.DrawImage((Image)(object)Hero.Original, num2, num3, num, num);
}
DrawArrow(graphics, num2 + num + 8f, num3 + num / 2f, 34f, Theme.Lerp(Theme.Dim, Theme.Accent, 0.35f + 0.65f * Math.Max(extra, hover)));
if (Custom != null)
{
graphics.DrawImage((Image)(object)Custom, num2 + num + 50f, num3, num, num);
}
SolidBrush val6 = new SolidBrush(Theme.Dim);
try
{
graphics.DrawString(FileName, Theme.F(8f, (FontStyle)0), (Brush)(object)val6, new RectangleF(num2 + 2f * num + 58f, num3 + 24f, r.Right - (num2 + 2f * num + 64f), 40f));
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
public static void DrawArrow(Graphics g, float x, float cy, float w, Color c)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
Pen val = new Pen(c, 4f);
val.StartCap = (LineCap)1;
val.EndCap = (LineCap)1;
val.LineJoin = (LineJoin)0;
Pen val2 = val;
try
{
g.DrawLine(val2, x, cy, x + w, cy);
g.DrawLines(val2, new PointF[3]
{
new PointF(x + w - 9f, cy - 8f),
new PointF(x + w, cy),
new PointF(x + w - 9f, cy + 8f)
});
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
}
public class SwapBanner : AnimControl
{
public Hero Hero;
public Func<int, double, Bitmap> RenderCustom;
public double Yaw = -22.0;
private int dragX;
private bool dragging;
private Bitmap cache;
private double cacheYaw = double.NaN;
private int cacheSize;
private float nudge;
public void Refresh3D()
{
cache = null;
extraT = 1f;
extra = 0f;
((Control)this).Invalidate();
}
public SwapBanner()
{
((Control)this).Height = 340;
((Control)this).Cursor = Cursors.SizeWE;
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
dragging = true;
dragX = e.X;
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
dragging = false;
}
protected override void OnMouseMove(MouseEventArgs e)
{
((Control)this).OnMouseMove(e);
if (dragging)
{
Yaw -= (double)(e.X - dragX) * 0.9;
dragX = e.X;
((Control)this).Invalidate();
}
}
protected override void Step()
{
base.Step();
nudge += 0.06f;
if (hover > 0.01f || extra < 0.99f)
{
((Control)this).Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Expected O, but got Unknown
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Expected O, but got Unknown
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
RectangleF rectangleF = new RectangleF(0f, 0f, ((Control)this).Width - 1, ((Control)this).Height - 1);
GraphicsPath val = Theme.Round(rectangleF, 16f);
try
{
LinearGradientBrush val2 = new LinearGradientBrush(rectangleF, Color.FromArgb(22, 32, 56), Color.FromArgb(10, 13, 22), 90f);
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Line);
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
int num = Math.Min(((Control)this).Height - 76, (((Control)this).Width - 130) / 2);
float num2 = (float)((Control)this).Width / 2f;
float num3 = (num2 - 45f - (float)num) / 2f + 12f;
float num4 = num2 + 45f + (num2 - 45f - (float)num) / 2f - 12f;
float num5 = 62f;
SolidBrush val4 = new SolidBrush(Theme.Dim);
try
{
graphics.DrawString("GAME'S HERO", Theme.P(11.7f), (Brush)(object)val4, num3, 12f);
}
finally
{
((IDisposable)val4)?.Dispose();
}
SolidBrush val5 = new SolidBrush(Theme.Text);
try
{
graphics.DrawString((Hero != null) ? Hero.Display : "", Theme.P(19.5f), (Brush)(object)val5, num3, 28f);
}
finally
{
((IDisposable)val5)?.Dispose();
}
SolidBrush val6 = new SolidBrush(Theme.Accent);
try
{
graphics.DrawString("YOUR SKIN", Theme.P(11.7f), (Brush)(object)val6, num4, 12f);
}
finally
{
((IDisposable)val6)?.Dispose();
}
SolidBrush val7 = new SolidBrush(Theme.Dim);
try
{
graphics.DrawString("drag to turn it around", Theme.F(9.5f, (FontStyle)0), (Brush)(object)val7, num4, 32f);
}
finally
{
((IDisposable)val7)?.Dispose();
}
float[] array = new float[2] { num3, num4 };
foreach (float num6 in array)
{
SolidBrush val8 = new SolidBrush(Color.FromArgb(70, 0, 0, 0));
try
{
graphics.FillEllipse((Brush)(object)val8, num6 + (float)num * 0.22f, num5 + (float)num * 0.93f, (float)num * 0.56f, (float)num * 0.07f);
}
finally
{
((IDisposable)val8)?.Dispose();
}
}
if (Hero != null && Hero.Original != null)
{
graphics.DrawImage((Image)(object)Hero.Original, num3, num5, (float)num, (float)num);
}
float num7 = (float)Math.Sin(nudge) * 3f * hover;
SlotCard.DrawArrow(graphics, num2 - 30f + num7, num5 + (float)num / 2f, 60f, Theme.Accent);
if (RenderCustom != null)
{
if (cache == null || cacheYaw != Yaw || cacheSize != num)
{
cache = RenderCustom(num, Yaw);
cacheYaw = Yaw;
cacheSize = num;
}
if (cache != null)
{
float num8 = 0.9f + 0.1f * extra;
float num9 = (float)num * num8;
graphics.DrawImage((Image)(object)cache, num4 + ((float)num - num9) / 2f, num5 + ((float)num - num9), num9, num9);
}
}
}
}
public class FacePicker : AnimControl
{
private const int Cell = 30;
public Img Face;
public Img Hat;
public int[] EyeLayer = new int[2];
public HashSet<int> Eyes = new HashSet<int>();
public bool Numbered = true;
private int hot = -1;
public event EventHandler Changed;
public FacePicker()
{
((Control)this).Width = (((Control)this).Height = 242);
((Control)this).Cursor = Cursors.Hand;
}
public static int Side(int code)
{
if (code % 64 / 8 >= 4)
{
return 1;
}
return 0;
}
protected override void OnMouseMove(MouseEventArgs e)
{
((Control)this).OnMouseMove(e);
int num = Code(e);
if (num != hot)
{
hot = num;
((Control)this).Invalidate();
}
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
hot = -1;
((Control)this).Invalidate();
}
private int Code(MouseEventArgs e)
{
int num = e.X / 30;
int num2 = e.Y / 30;
if (num >= 0 && num <= 7 && num2 >= 1 && num2 <= 6)
{
return num * 8 + num2;
}
return -1;
}
protected override void OnMouseClick(MouseEventArgs e)
{
int num = Code(e);
if (num >= 0)
{
if (!Eyes.Remove(num) & !Eyes.Remove(num + 64))
{
Eyes.Add(num + EyeLayer[Side(num)] * 64);
}
((Control)this).Invalidate();
if (this.Changed != null)
{
this.Changed(this, EventArgs.Empty);
}
}
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Expected O, but got Unknown
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Expected O, but got Unknown
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Expected O, but got Unknown
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
if (Face == null)
{
return;
}
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
Rectangle rectangle = new Rectangle(j * 30 + 1, i * 30 + 1, 29, 29);
byte[] array = Face.Get(j, i);
byte[] array2 = ((Hat != null) ? Hat.Get(j, i) : new byte[4]);
Color color = ((array2[3] > 127) ? Color.FromArgb(array2[0], array2[1], array2[2]) : ((array[3] == 0) ? Theme.Card : Color.FromArgb(array[0], array[1], array[2])));
if (i < 1 || i > 6)
{
color = Theme.Lerp(color, Theme.Bg, 0.65f);
}
graphics.SmoothingMode = (SmoothingMode)3;
SolidBrush val = new SolidBrush(color);
try
{
graphics.FillRectangle((Brush)(object)val, rectangle);
}
finally
{
((IDisposable)val)?.Dispose();
}
if (array2[3] > 127)
{
Pen val2 = new Pen(Color.FromArgb(70, 255, 255, 255));
try
{
graphics.DrawRectangle(val2, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
int num = j * 8 + i;
if (num == hot)
{
SolidBrush val3 = new SolidBrush(Color.FromArgb(70, 255, 255, 255));
try
{
graphics.FillRectangle((Brush)(object)val3, rectangle);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
bool flag = Eyes.Contains(num);
bool flag2 = Eyes.Contains(num + 64);
if (!flag && !flag2)
{
continue;
}
Pen val4 = new Pen(flag2 ? Theme.Gold : Theme.Accent, 3f);
try
{
graphics.DrawRectangle(val4, rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 5, rectangle.Height - 5);
}
finally
{
((IDisposable)val4)?.Dispose();
}
if (!Numbered)
{
continue;
}
graphics.SmoothingMode = (SmoothingMode)4;
RectangleF rectangleF = new RectangleF(rectangle.Right - 15, rectangle.Y - 3, 16f, 16f);
SolidBrush val5 = new SolidBrush(flag2 ? Theme.Gold : Theme.Accent);
try
{
graphics.FillRectangle((Brush)(object)val5, rectangleF);
}
finally
{
((IDisposable)val5)?.Dispose();
}
string text = (Side(num) + 1).ToString();
Font val6 = Theme.F(7.5f, (FontStyle)1);
try
{
SizeF sizeF = graphics.MeasureString(text, val6);
SolidBrush val7 = new SolidBrush(Theme.OnAccent);
try
{
graphics.DrawString(text, val6, (Brush)(object)val7, rectangleF.X + (16f - sizeF.Width) / 2f, rectangleF.Y + (16f - sizeF.Height) / 2f);
}
finally
{
((IDisposable)val7)?.Dispose();
}
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
}
}
}
public class Segmented : AnimControl
{
public string[] Options;
public int Index
{
get
{
return (int)Math.Round(extraT);
}
set
{
extraT = value;
((Control)this).Invalidate();
}
}
public event EventHandler Picked;
public Segmented(params string[] o)
{
Options = o;
((Control)this).Height = 34;
((Control)this).Width = 260;
((Control)this).Cursor = Cursors.Hand;
}
protected override void OnMouseClick(MouseEventArgs e)
{
((Control)this).OnMouseClick(e);
int num = Math.Min(Options.Length - 1, e.X * Options.Length / ((Control)this).Width);
if (num != Index)
{
Index = num;
if (this.Picked != null)
{
this.Picked(this, EventArgs.Empty);
}
}
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
RectangleF r = new RectangleF(1f, 1f, ((Control)this).Width - 3, ((Control)this).Height - 3);
GraphicsPath val = Theme.Round(r, 9f);
try
{
SolidBrush val2 = new SolidBrush(Theme.Card);
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Lerp(Theme.Line, Theme.Dim, hover * 0.5f));
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
float num = r.Width / (float)Options.Length;
GraphicsPath val4 = Theme.Round(new RectangleF(r.X + 3f + extra * num, r.Y + 3f + press, num - 6f, r.Height - 6f), 7f);
try
{
SolidBrush val5 = new SolidBrush(Theme.Accent);
try
{
graphics.FillPath((Brush)(object)val5, val4);
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
finally
{
((IDisposable)val4)?.Dispose();
}
for (int i = 0; i < Options.Length; i++)
{
SizeF sizeF = graphics.MeasureString(Options[i], Theme.P(12.3f));
float t = 1f - Math.Min(1f, Math.Abs(extra - (float)i));
SolidBrush val6 = new SolidBrush(Theme.Lerp(Theme.Text, Theme.OnAccent, t));
try
{
graphics.DrawString(Options[i], Theme.P(12.3f), (Brush)(object)val6, r.X + (float)i * num + (num - sizeF.Width) / 2f, r.Y + (r.Height - sizeF.Height) / 2f);
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
}
}
public class HeroPicker : AnimControl
{
public class Item
{
public Hero H;
public bool Used;
}
public List<Item> Items = new List<Item>();
public Item Selected;
public event EventHandler Picked;
public HeroPicker()
{
((Control)this).Height = 56;
((Control)this).Cursor = Cursors.Hand;
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
RectangleF r = new RectangleF(1f, 1f + 1.5f * press, ((Control)this).Width - 3, ((Control)this).Height - 4);
GraphicsPath val = Theme.Round(r, 11f);
try
{
SolidBrush val2 = new SolidBrush(Theme.Lerp(Theme.Card, Theme.CardHi, hover));
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Lerp(Theme.Line, Theme.Accent, hover * 0.7f));
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
if (Selected != null && Selected.H.Original != null)
{
graphics.DrawImage((Image)(object)Selected.H.Original, r.X + 6f, r.Y + 3f, 46f, 46f);
}
SolidBrush val4 = new SolidBrush(Theme.Text);
try
{
graphics.DrawString((Selected != null) ? Selected.H.Display : "Choose a hero", Theme.P(15.6f), (Brush)(object)val4, r.X + 58f, r.Y + 14f);
}
finally
{
((IDisposable)val4)?.Dispose();
}
SolidBrush val5 = new SolidBrush(Theme.Lerp(Theme.Dim, Theme.Text, hover));
try
{
graphics.FillPolygon((Brush)(object)val5, new PointF[3]
{
new PointF(((Control)this).Width - 30, r.Y + 22f),
new PointF(((Control)this).Width - 16, r.Y + 22f),
new PointF(((Control)this).Width - 23, r.Y + 30f)
});
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
protected override void OnClick(EventArgs e)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
((Control)this).OnClick(e);
ContextMenuStrip val = new ContextMenuStrip();
((ToolStrip)val).Renderer = (ToolStripRenderer)(object)new DarkRenderer();
((ToolStrip)val).BackColor = Theme.Card;
((ToolStrip)val).ForeColor = Theme.Text;
((Control)val).Font = Theme.F(10.5f, (FontStyle)0);
((ToolStrip)val).ImageScalingSize = new Size(44, 44);
((Control)val).MaximumSize = new Size(((Control)this).Width + 60, 600);
ContextMenuStrip val2 = val;
foreach (Item item2 in Items)
{
Item item = item2;
ToolStripMenuItem val3 = new ToolStripMenuItem(item2.H.Display + (item2.Used ? " · has a custom skin" : ""));
((ToolStripItem)val3).ForeColor = (item2.Used ? Theme.Dim : Theme.Text);
((ToolStripItem)val3).Image = (Image)(object)item2.H.Original;
((ToolStripItem)val3).ImageScaling = (ToolStripItemImageScaling)1;
((ToolStripItem)val3).Font = ((item2 == Selected) ? Theme.F(10.5f, (FontStyle)1) : Theme.F(10.5f, (FontStyle)0));
ToolStripMenuItem val4 = val3;
((ToolStripItem)val4).Click += delegate
{
Selected = item;
((Control)this).Invalidate();
if (this.Picked != null)
{
this.Picked(this, EventArgs.Empty);
}
};
((ToolStrip)val2).Items.Add((ToolStripItem)(object)val4);
}
((ToolStripDropDown)val2).Show((Control)(object)this, new Point(0, ((Control)this).Height));
}
}
internal class DarkRenderer : ToolStripProfessionalRenderer
{
public DarkRenderer()
: base((ProfessionalColorTable)(object)new DarkColors())
{
((ToolStripProfessionalRenderer)this).RoundedEdges = false;
}
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
{
e.TextColor = ((ToolStripItemRenderEventArgs)e).Item.ForeColor;
((ToolStripProfessionalRenderer)this).OnRenderItemText(e);
}
}
internal class DarkColors : ProfessionalColorTable
{
public override Color MenuItemSelected => Theme.CardHi;
public override Color MenuItemBorder => Theme.Accent;
public override Color ToolStripDropDownBackground => Theme.Card;
public override Color MenuBorder => Theme.Line;
public override Color ImageMarginGradientBegin => Theme.Panel;
public override Color ImageMarginGradientMiddle => Theme.Panel;
public override Color ImageMarginGradientEnd => Theme.Panel;
}
public class Toast : AnimControl
{
private Timer life;
private Color col;
public Toast()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
Timer val = new Timer();
val.Interval = 4200;
life = val;
col = Theme.Accent;
base..ctor();
((Control)this).Visible = false;
((Control)this).Height = 48;
Timer obj = life;
EventHandler eventHandler = delegate
{
life.Stop();
extraT = 0f;
};
obj.Tick += eventHandler;
}
public void Show(string text, Color c)
{
((Control)this).Text = text;
col = c;
((Control)this).Visible = true;
((Control)this).BringToFront();
extra = 0f;
extraT = 1f;
life.Stop();
life.Start();
((Control)this).Invalidate();
}
protected override void Step()
{
base.Step();
if (extraT == 0f && extra < 0.02f && ((Control)this).Visible)
{
((Control)this).Visible = false;
}
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
float num = extra;
float num2 = (1f - num) * 18f;
RectangleF r = new RectangleF(1f, 1f + num2, ((Control)this).Width - 3, ((Control)this).Height - 3);
GraphicsPath val = Theme.Round(r, 22f);
try
{
SolidBrush val2 = new SolidBrush(Color.FromArgb((int)(250f * num), Theme.Lerp(col, Color.Black, 0.6f)));
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Color.FromArgb((int)(255f * num), col), 1.6f);
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
SolidBrush val4 = new SolidBrush(Color.FromArgb((int)(255f * num), Theme.Text));
try
{
SizeF sizeF = graphics.MeasureString(((Control)this).Text, Theme.Semi(10.5f));
graphics.DrawString(((Control)this).Text, Theme.Semi(10.5f), (Brush)(object)val4, ((float)((Control)this).Width - sizeF.Width) / 2f, r.Y + (r.Height - sizeF.Height) / 2f);
}
finally
{
((IDisposable)val4)?.Dispose();
}
}
}
public class ToggleSwitch : AnimControl
{
public bool On
{
get
{
return extraT > 0.5f;
}
set
{
extraT = (value ? 1 : 0);
((Control)this).Invalidate();
}
}
public event EventHandler Toggled;
public ToggleSwitch()
{
((Control)this).Width = 46;
((Control)this).Height = 26;
((Control)this).Cursor = Cursors.Hand;
}
protected override void OnClick(EventArgs e)
{
((Control)this).OnClick(e);
On = !On;
if (this.Toggled != null)
{
this.Toggled(this, e);
}
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
RectangleF r = new RectangleF(1f, 2f, ((Control)this).Width - 3, ((Control)this).Height - 5);
GraphicsPath val = Theme.Round(r, r.Height / 2f);
try
{
SolidBrush val2 = new SolidBrush(Theme.Lerp(Theme.Lerp(Theme.Card, Theme.CardHi, hover), Theme.Accent, extra));
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Lerp(Theme.Line, Theme.AccentDeep, extra));
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
float num = r.Height - 6f - 2f * press;
float num2 = r.X + 3f + extra * (r.Width - num - 6f);
SolidBrush val4 = new SolidBrush(Theme.Text);
try
{
graphics.FillRectangle((Brush)(object)val4, (float)Math.Round(num2), r.Y + 3f + press, num, num);
}
finally
{
((IDisposable)val4)?.Dispose();
}
Pen val5 = new Pen(Color.Black, 2f);
try
{
graphics.DrawRectangle(val5, (float)Math.Round(num2), r.Y + 3f + press, num, num);
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
}
public class Swatch : AnimControl
{
public int Rgb;
public Func<Img> SkinSource;
public string Title = "Choose a colour";
public event EventHandler ColorChanged;
public Swatch()
{
((Control)this).Width = 44;
((Control)this).Height = 30;
((Control)this).Cursor = Cursors.Hand;
}
protected override void OnClick(EventArgs e)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
((Control)this).OnClick(e);
if (!((Control)this).Enabled)
{
return;
}
Img skinTexture = null;
try
{
if (SkinSource != null)
{
skinTexture = SkinSource();
}
}
catch
{
}
ColorPickerDialog colorPickerDialog = new ColorPickerDialog(Rgb, skinTexture, Title);
try
{
if ((int)((Form)colorPickerDialog).ShowDialog((IWin32Window)(object)((Control)this).FindForm()) == 1)
{
Rgb = colorPickerDialog.Rgb;
((Control)this).Invalidate();
if (this.ColorChanged != null)
{
this.ColorChanged(this, EventArgs.Empty);
}
}
}
finally
{
((IDisposable)colorPickerDialog)?.Dispose();
}
}
protected override void OnEnabledChanged(EventArgs e)
{
((Control)this).OnEnabledChanged(e);
((Control)this).Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
Graphics graphics = e.Graphics;
PaintParentBg(graphics);
Theme.Hq(graphics);
RectangleF r = new RectangleF(1f, 1f + 1.5f * press, ((Control)this).Width - 3, ((Control)this).Height - 4);
Color color = Color.FromArgb((Rgb >> 16) & 0xFF, (Rgb >> 8) & 0xFF, Rgb & 0xFF);
if (!((Control)this).Enabled)
{
color = Theme.Lerp(color, Theme.Bg, 0.75f);
}
GraphicsPath val = Theme.Round(r, 7f);
try
{
SolidBrush val2 = new SolidBrush(color);
try
{
graphics.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Lerp(Theme.Line, Theme.Text, hover), 1.5f);
try
{
graphics.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
public class StatusLine : Control
{
public string[] Parts = new string[0];
public Color Dot = Color.FromArgb(88, 206, 110);
public Color Ink = Theme.Accent;
public StatusLine()
{
((Control)this).SetStyle((ControlStyles)141314, true);
((Control)this).BackColor = Color.Transparent;
}
public void Set(Color dot, params string[] parts)
{
Dot = dot;
Parts = parts;
((Control)this).Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
Graphics g = e.Graphics;
g.TextRenderingHint = (TextRenderingHint)3;
List<Tuple<string, Color>> list = new List<Tuple<string, Color>>();
list.Add(Tuple.Create("■", Dot));
for (int i = 0; i < Parts.Length; i++)
{
if (i > 0)
{
list.Add(Tuple.Create("■", Dot));
}
list.Add(Tuple.Create(Parts[i], Ink));
}
float num = ((Control)this).Width;
List<float> list2 = list.Select((Tuple<string, Color> p) => g.MeasureString(p.Item1, ((Control)this).Font).Width + 6f).ToList();
num -= list2.Sum();
for (int j = 0; j < list.Count; j++)
{
bool flag = list[j].Item1 == "■";
Font val = ((!flag) ? ((Font)null) : new Font(((Control)this).Font.FontFamily, ((Control)this).Font.Size * 0.6f));
try
{
SolidBrush val2 = new SolidBrush(list[j].Item2);
try
{
Font val3 = val ?? ((Control)this).Font;
SizeF sizeF = g.MeasureString(list[j].Item1, val3);
g.DrawString(list[j].Item1, val3, (Brush)(object)val2, num + (flag ? ((list2[j] - sizeF.Width) / 2f) : 0f), ((float)((Control)this).Height - sizeF.Height) / 2f);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
num += list2[j];
}
}
}
public class Section : Label
{
public Section(string t)
{
((Control)this).Text = t.ToUpperInvariant();
((Control)this).Font = Theme.P(13f);
((Control)this).ForeColor = Theme.Dim;
((Control)this).AutoSize = true;
((Label)this).UseCompatibleTextRendering = true;
}
}
internal class DoubleBufferedPanel : Panel
{
public DoubleBufferedPanel()
{
((Control)this).DoubleBuffered = true;
((Control)this).ResizeRedraw = true;
}
}
internal class ClipHost : DoubleBufferedPanel
{
public readonly Panel Inner;
public ClipHost(Panel inner, Color bg)
{
ClipHost clipHost = this;
Inner = inner;
((Control)this).BackColor = bg;
((ScrollableControl)inner).AutoScroll = true;
((Control)this).Controls.Add((Control)(object)inner);
EventHandler eventHandler = delegate
{
((Control)inner).Bounds = new Rectangle(0, 0, ((Control)clipHost).Width + SystemInformation.VerticalScrollBarWidth, ((Control)clipHost).Height + SystemInformation.HorizontalScrollBarHeight);
};
((Control)this).Resize += eventHandler;
}
}
public class MainForm : Form
{
private GameData gd;
private string gameDir;
private List<SkinSlot> slots;
private bool layers;
private int current;
private Dictionary<SkinSlot, Img> texCache;
private Dictionary<SkinSlot, Bitmap> thumbCache;
private Panel listPanel;
private Panel editor;
private Panel header;
private List<SlotCard> cards;
private SwapBanner banner;
private HeroPicker heroPicker;
private OptionCard[] modeCards;
private FacePicker picker;
private Panel eyePanel;
private Panel gamePanel;
private Label eyeInfo;
private ToggleSwitch[] gfOn;
private Swatch[] gfCol;
private int partsTop;
private Segmented[] eyeSeg;
private Label[] eyeLbl;
private ToggleSwitch lidOn;
private ToggleSwitch lidSplit;
private Swatch lidCol;
private Swatch lidCol2;
private Panel lidRow;
private Label lidLbl;
private Label lidLbl2;
private Label fileLabel;
private Label emptyHint;
private StatusLine statusPill;
private PictureBox flatTex;
private CheckBox layersBox;
private Toast toast;
private bool loading;
private int lastLayerSlot;
private static readonly string[] HeroOrder = new string[15]
{
"Darian", "Eshe", "Greta", "Javier", "Nuru", "Violet", "Qamar", "Esperanza", "Healer", "Ranger",
"Tank", "Valorie", "PizzaChef", "Steve", "Alex"
};
private SkinSlot Current
{
get
{
if (current < 0 || current >= slots.Count)
{
return null;
}
return slots[current];
}
}
private string ConfigPath => Path.Combine(App.DataDir, "config.txt");
public MainForm()
{
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
DragEventHandler val = null;
slots = new List<SkinSlot>();
layers = true;
current = -1;
texCache = new Dictionary<SkinSlot, Img>();
thumbCache = new Dictionary<SkinSlot, Bitmap>();
cards = new List<SlotCard>();
lastLayerSlot = -2;
((Form)this)..ctor();
((Control)this).Text = "Dungeons 2 Skin Loader - by Poyraz Captain";
((Control)this).BackColor = Theme.Bg;
((Control)this).ForeColor = Theme.Text;
((Control)this).Font = Theme.F(9.5f, (FontStyle)0);
((Form)this).ClientSize = new Size(1300, 840);
((Control)this).MinimumSize = new Size(1140, 780);
((Form)this).StartPosition = (FormStartPosition)1;
try
{
((Form)this).Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
}
catch
{
}
((Control)this).DoubleBuffered = true;
((Control)this).AllowDrop = true;
((Control)this).DragEnter += (DragEventHandler)delegate(object s, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = (DragDropEffects)1;
}
};
if (val == null)
{
val = (DragEventHandler)delegate(object s, DragEventArgs e)
{
string[] array = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in array)
{
AddSkin(file);
}
};
}
((Control)this).DragDrop += val;
gd = App.LoadData();
BuildUi();
LoadConfig();
DetectGame(Game.Find());
RebuildCards();
Select((slots.Count <= 0) ? (-1) : 0);
}
private void BuildUi()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected O, but got Unknown
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Expected O, but got Unknown
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Expected O, but got Unknown
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Expected O, but got Unknown
//IL_0593: Unknown result type (might be due to invalid IL or missing references)
//IL_059a: Expected O, but got Unknown
//IL_073b: Unknown result type (might be due to invalid IL or missing references)
//IL_0742: Expected O, but got Unknown
//IL_07db: Unknown result type (might be due to invalid IL or missing references)
//IL_07e2: Expected O, but got Unknown
//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0904: Expected O, but got Unknown
//IL_0aa4: Unknown result type (might be due to invalid IL or missing references)
//IL_0aab: Expected O, but got Unknown
//IL_0aef: Unknown result type (might be due to invalid IL or missing references)
//IL_0af6: Expected O, but got Unknown
//IL_0c14: Unknown result type (might be due to invalid IL or missing references)
//IL_0c1b: Expected O, but got Unknown
//IL_0da1: Unknown result type (might be due to invalid IL or missing references)
//IL_0da8: Expected O, but got Unknown
//IL_0e6b: Unknown result type (might be due to invalid IL or missing references)
//IL_0e72: Expected O, but got Unknown
//IL_0f5d: Unknown result type (might be due to invalid IL or missing references)
//IL_0f64: Expected O, but got Unknown
//IL_0ff4: Unknown result type (might be due to invalid IL or missing references)
//IL_0ffb: Expected O, but got Unknown
//IL_1087: Unknown result type (might be due to invalid IL or missing references)
//IL_108e: Expected O, but got Unknown
//IL_11d6: Unknown result type (might be due to invalid IL or missing references)
//IL_11dd: Expected O, but got Unknown
//IL_135c: Unknown result type (might be due to invalid IL or missing references)
//IL_1363: Expected O, but got Unknown
DoubleBufferedPanel doubleBufferedPanel = new DoubleBufferedPanel();
((Control)doubleBufferedPanel).Dock = (DockStyle)1;
((Control)doubleBufferedPanel).Height = 92;
((Control)doubleBufferedPanel).BackColor = Theme.Panel;
header = (Panel)(object)doubleBufferedPanel;
((Control)header).Paint += (PaintEventHandler)delegate(object s, PaintEventArgs e)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Expected O, but got Unknown
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Expected O, but got Unknown
Graphics graphics = e.Graphics;
Theme.Hq(graphics);
LinearGradientBrush val23 = new LinearGradientBrush(((Control)header).ClientRectangle, Color.FromArgb(16, 40, 86), Theme.Panel, 0f);
try
{
graphics.FillRectangle((Brush)(object)val23, ((Control)header).ClientRectangle);
}
finally
{
((IDisposable)val23)?.Dispose();
}
if (((Form)this).Icon != null)
{
Icon val24 = new Icon(((Form)this).Icon, 64, 64);
try
{
graphics.DrawIcon(val24, new Rectangle(22, 18, 56, 56));
}
finally
{
((IDisposable)val24)?.Dispose();
}
}
SolidBrush val25 = new SolidBrush(Theme.Text);
try
{
graphics.DrawString("Dungeons 2 Skin Loader", Theme.P(27.3f), (Brush)(object)val25, 88f, 8f);
}
finally
{
((IDisposable)val25)?.Dispose();
}
string text = "by Poyraz Captain";
SolidBrush val26 = new SolidBrush(Color.Black);
try
{
graphics.DrawString(text, Theme.P(19f), (Brush)(object)val26, 93f, 49f);
}
finally
{
((IDisposable)val26)?.Dispose();
}
SolidBrush val27 = new SolidBrush(Theme.Gold);
try
{
graphics.DrawString(text, Theme.P(19f), (Brush)(object)val27, 91f, 47f);
}
finally
{
((IDisposable)val27)?.Dispose();
}
SizeF sizeF = graphics.MeasureString(text, Theme.P(19f));
SolidBrush val28 = new SolidBrush(Theme.Dim);
try
{
graphics.DrawString("· your own Minecraft skins on the heroes · cosmetic only", Theme.F(9.5f, (FontStyle)0), (Brush)(object)val28, 93f + sizeF.Width + 4f, 55f);
}
finally
{
((IDisposable)val28)?.Dispose();
}
Pen val29 = new Pen(Theme.Line);
try
{
graphics.DrawLine(val29, 0, ((Control)header).Height - 1, ((Control)header).Width, ((Control)header).Height - 1);
}
finally
{
((IDisposable)val29)?.Dispose();
}
};
StatusLine statusLine = new StatusLine();
((Control)statusLine).Height = 30;
((Control)statusLine).Width = 420;
((Control)statusLine).Font = Theme.P(13.7f);
((Control)statusLine).Anchor = (AnchorStyles)9;
statusPill = statusLine;
LinkLabel help = MakeLink("How it works", ShowHelp);
LinkLabel change = MakeLink("Change game folder", PickGameFolder);
((Control)header).Controls.AddRange((Control[])(object)new Control[3]
{
statusPill,
(Control)help,
(Control)change
});
((Control)header).Resize += delegate
{
((Control)statusPill).Location = new Point(((Control)header).Width - ((Control)statusPill).Width - 24, 16);
((Control)change).Location = new Point(((Control)header).Width - ((Control)change).Width - 24, 56);
((Control)help).Location = new Point(((Control)change).Left - ((Control)help).Width - 18, 56);
};
DoubleBufferedPanel doubleBufferedPanel2 = new DoubleBufferedPanel();
((Control)doubleBufferedPanel2).Dock = (DockStyle)2;
((Control)doubleBufferedPanel2).Height = 86;
((Control)doubleBufferedPanel2).BackColor = Theme.Panel;
DoubleBufferedPanel bottom = doubleBufferedPanel2;
((Control)bottom).Paint += (PaintEventHandler)delegate(object s, PaintEventArgs e)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
Pen val22 = new Pen(Theme.Line);
try
{
e.Graphics.DrawLine(val22, 0, 0, ((Control)bottom).Width, 0);
}
finally
{
((IDisposable)val22)?.Dispose();
}
};
CheckBox val = new CheckBox();
((Control)val).Text = "3D outer layers (jacket, sleeves, pants)";
((Control)val).AutoSize = true;
val.Checked = true;
((Control)val).ForeColor = Theme.Text;
((Control)val).Location = new Point(26, 22);
((Control)val).Font = Theme.F(10f, (FontStyle)0);
((Control)val).Cursor = Cursors.Hand;
layersBox = val;
layersBox.CheckedChanged += delegate
{
if (!loading)
{
layers = layersBox.Checked;
thumbCache.Clear();
SaveConfig();
RefreshCards();
banner.Refresh3D();
}
};
Label val2 = new Label();
((Control)val2).Text = "Applies to every hero; skins without outer-layer pixels look the same.";
((Control)val2).AutoSize = true;
((Control)val2).ForeColor = Theme.Dim;
((Control)val2).Location = new Point(45, 48);
((Control)val2).Font = Theme.F(8.5f, (FontStyle)0);
Label val3 = val2;
TactileButton tactileButton = new TactileButton("Install to game", BtnKind.Primary, "⬇");
((Control)tactileButton).Width = 250;
((Control)tactileButton).Height = 54;
((Control)tactileButton).Anchor = (AnchorStyles)9;
TactileButton install = tactileButton;
TactileButton tactileButton2 = new TactileButton("Uninstall mod");
((Control)tactileButton2).Width = 180;
((Control)tactileButton2).Height = 54;
((Control)tactileButton2).Anchor = (AnchorStyles)9;
TactileButton remove = tactileButton2;
TactileButton tactileButton3 = new TactileButton("Export for a friend", BtnKind.Secondary, "⇪");
((Control)tactileButton3).Width = 246;
((Control)tactileButton3).Height = 54;
((Control)tactileButton3).Anchor = (AnchorStyles)9;
TactileButton export = tactileButton3;
TactileButton[] array = new TactileButton[3] { install, remove, export };
foreach (TactileButton tactileButton4 in array)
{
((Control)tactileButton4).BackColor = Theme.Panel;
}
((Control)install).Click += delegate
{
Install();
};
((Control)remove).Click += delegate
{
RemoveMod();
};
((Control)export).Click += delegate
{
Export();
};
((Control)bottom).Controls.AddRange((Control[])(object)new Control[5]
{
(Control)layersBox,
(Control)val3,
install,
remove,
export
});
((Control)bottom).Resize += delegate
{
((Control)install).Location = new Point(((Control)bottom).Width - 274, 16);
((Control)remove).Location = new Point(((Control)install).Left - 192, 16);
((Control)export).Location = new Point(((Control)remove).Left - 258, 16);
};
DoubleBufferedPanel doubleBufferedPanel3 = new DoubleBufferedPanel();
((Control)doubleBufferedPanel3).Dock = (DockStyle)3;
((Control)doubleBufferedPanel3).Width = 380;
((Control)doubleBufferedPanel3).BackColor = Theme.Panel;
DoubleBufferedPanel left = doubleBufferedPanel3;
((Control)left).Paint += (PaintEventHandler)delegate(object s, PaintEventArgs e)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
Pen val21 = new Pen(Theme.Line);
try
{
e.Graphics.DrawLine(val21, ((Control)left).Width - 1, 0, ((Control)left).Width - 1, ((Control)left).Height);
}
finally
{
((IDisposable)val21)?.Dispose();
}
};
Section section = new Section("Your skins");
((Control)section).Location = new Point(22, 18);
Section section2 = section;
Label val4 = new Label();
((Control)val4).Text = "game's hero → your skin";
((Control)val4).AutoSize = true;
((Control)val4).ForeColor = Theme.Dim;
((Control)val4).Location = new Point(160, 20);
((Control)val4).Font = Theme.F(8.5f, (FontStyle)0);
Label val5 = val4;
DoubleBufferedPanel doubleBufferedPanel4 = new DoubleBufferedPanel();
((Control)doubleBufferedPanel4).BackColor = Theme.Panel;
listPanel = (Panel)(object)doubleBufferedPanel4;
ClipHost clipHost = new ClipHost(listPanel, Theme.Panel);
((Control)clipHost).Location = new Point(12, 42);
ClipHost listHost = clipHost;
TactileButton tactileButton5 = new TactileButton("Add skin", BtnKind.Primary, "+");
((Control)tactileButton5).Height = 52;
TactileButton add = tactileButton5;
TactileButton tactileButton6 = new TactileButton("Remove");
((Control)tactileButton6).Width = 112;
((Control)tactileButton6).Height = 52;
TactileButton del = tactileButton6;
array = new TactileButton[2] { add, del };
foreach (TactileButton tactileButton7 in array)
{
((Control)tactileButton7).BackColor = Theme.Panel;
}
((Control)add).Click += delegate
{
BrowseAdd();
};
((Control)del).Click += delegate
{
RemoveSlot();
};
Label val6 = new Label();
((Control)val6).Text = "No skins yet.\r\n\r\nClick \"Add skin\" or drop skin\r\nPNG files anywhere on this window.";
((Control)val6).ForeColor = Theme.Dim;
((Control)val6).AutoSize = false;
val6.TextAlign = (ContentAlignment)32;
((Control)val6).Font = Theme.F(10.5f, (FontStyle)0);
emptyHint = val6;
((Control)left).Controls.AddRange((Control[])(object)new Control[6]
{
(Control)section2,
(Control)val5,
(Control)emptyHint,
(Control)listHost,
add,
del
});
((Control)left).Resize += delegate
{
((Control)listHost).Size = new Size(((Control)left).Width - 20, ((Control)left).Height - 42 - 80);
((Control)add).Location = new Point(18, ((Control)left).Height - 68);
((Control)add).Width = ((Control)left).Width - 36 - 124;
((Control)del).Location = new Point(((Control)left).Width - 18 - 112, ((Control)left).Height - 68);
((Control)emptyHint).Bounds = new Rectangle(12, 120, ((Control)left).Width - 24, 140);
foreach (SlotCard card in cards)
{
((Control)card).Width = ((Control)listHost).Width - 4;
}
};
DoubleBufferedPanel doubleBufferedPanel5 = new DoubleBufferedPanel();
((Control)doubleBufferedPanel5).BackColor = Theme.Bg;
editor = (Panel)(object)doubleBufferedPanel5;
ClipHost clipHost2 = new ClipHost(editor, Theme.Bg);
((Control)clipHost2).Dock = (DockStyle)5;
ClipHost editorHost = clipHost2;
int num = 22;
int X = 30;
SwapBanner swapBanner = new SwapBanner();
((Control)swapBanner).Location = new Point(X, num);
((Control)swapBanner).BackColor = Theme.Bg;
banner = swapBanner;
banner.RenderCustom = delegate(int size, double yaw)
{
SkinSlot skinSlot8 = Current;
Img img = ((skinSlot8 != null) ? Tex(skinSlot8) : null);
return (img == null) ? null : Renderer.RenderIcon(gd.IconGeo[(!layers) ? 1u : 0u], img, size, gd.IconCam, yaw + 22.0, 2).ToBitmap();
};
((Control)editor).Controls.Add((Control)(object)banner);
num += ((Control)banner).Height + 24;
ControlCollection controls = ((Control)editor).Controls;
Section section3 = new Section("Skin image");
((Control)section3).Location = new Point(X, num);
controls.Add((Control)(object)section3);
num += 26;
PictureBox val7 = new PictureBox();
((Control)val7).Location = new Point(X, num);
((Control)val7).Size = new Size(112, 112);
val7.SizeMode = (PictureBoxSizeMode)4;
((Control)val7).BackColor = Theme.Card;
flatTex = val7;
TactileButton tactileButton8 = new TactileButton("Choose PNG…");
((Control)tactileButton8).Location = new Point(X + 130, num);
((Control)tactileButton8).Width = 180;
((Control)tactileButton8).BackColor = Theme.Bg;
TactileButton tactileButton9 = tactileButton8;
((Control)tactileButton9).Click += delegate
{
ChangeImage();
};
Label val8 = new Label();
((Control)val8).Location = new Point(X + 130, num + 56);
((Control)val8).AutoSize = false;
((Control)val8).Width = 380;
((Control)val8).Height = 56;
((Control)val8).ForeColor = Theme.Dim;
fileLabel = val8;
((Control)editor).Controls.AddRange((Control[])(object)new Control[3]
{
(Control)flatTex,
tactileButton9,
(Control)fileLabel
});
num += 134;
ControlCollection controls2 = ((Control)editor).Controls;
Section section4 = new Section("Hero to replace");
((Control)section4).Location = new Point(X, num);
controls2.Add((Control)(object)section4);
num += 26;
HeroPicker heroPicker = new HeroPicker();
((Control)heroPicker).Location = new Point(X, num);
((Control)heroPicker).Width = 380;
((Control)heroPicker).BackColor = Theme.Bg;
this.heroPicker = heroPicker;
this.heroPicker.Picked += delegate
{
SkinSlot cur = Current;
if (!loading && cur != null && this.heroPicker.Selected != null)
{
string key = this.heroPicker.Selected.H.Key;
SkinSlot skinSlot7 = slots.FirstOrDefault((SkinSlot o) => o != cur && o.HeroKey == key);
if (skinSlot7 != null)
{
skinSlot7.HeroKey = cur.HeroKey;
}
cur.HeroKey = key;
Changed();
}
};
Label val9 = new Label();
((Control)val9).Location = new Point(X + 396, num + 10);
((Control)val9).AutoSize = false;
((Control)val9).Width = 260;
((Control)val9).Height = 40;
((Control)val9).ForeColor = Theme.Dim;
((Control)val9).Text = "In the game, pick this hero in the Locker to wear your skin.";
Label heroHint = val9;
((Control)editor).Controls.AddRange((Control[])(object)new Control[2]
{
this.heroPicker,
(Control)heroHint
});
num += 78;
ControlCollection controls3 = ((Control)editor).Controls;
Section section5 = new Section("Face");
((Control)section5).Location = new Point(X, num);
controls3.Add((Control)(object)section5);
num += 26;
modeCards = new OptionCard[3]
{
new OptionCard("As drawn", "Your face exactly as in the skin. No animation."),
new OptionCard("Game face", "The game's own animated eyes and brows (blinking, looking around), coloured from your skin."),
new OptionCard("Blinking eyes", "Your own eye pixels blink in place, without moving. Choose them below.")
};
for (int k = 0; k < 3; k++)
{
OptionCard optionCard = modeCards[k];
int mode = k;
((Control)optionCard).Location = new Point(X, num);
((Control)optionCard).BackColor = Theme.Bg;
optionCard.Picked += delegate
{
SkinSlot skinSlot6 = Current;
if (skinSlot6 != null)
{
skinSlot6.Mode = (FaceMode)mode;
if ((skinSlot6.Mode == FaceMode.Blink || skinSlot6.Mode == FaceMode.Game) && skinSlot6.Eyes.Count == 0)
{
AutoEyes(skinSlot6.Mode == FaceMode.Blink);
}
Changed();
}
};
((Control)editor).Controls.Add((Control)(object)optionCard);
num += 82;
}
partsTop = num + 6;
Panel val10 = new Panel();
((Control)val10).Location = new Point(X, partsTop);
((Control)val10).Size = new Size(600, 176);
((Control)val10).BackColor = Theme.Bg;
gamePanel = val10;
Label val11 = new Label();
((Control)val11).Text = "The game draws animated eyes and brows over the face. Both eyes always share one colour. Switch parts off or click a colour to change it.";
((Control)val11).Location = new Point(0, 0);
((Control)val11).Size = new Size(600, 38);
((Control)val11).ForeColor = Theme.Dim;
Label gTitle = val11;
((Control)gamePanel).Controls.Add((Control)(object)gTitle);
string[] array2 = new string[3] { "Eyes (irises)", "Eye whites", "Eyebrows" };
gfOn = new ToggleSwitch[3];
gfCol = new Swatch[3];
for (int l = 0; l < 3; l++)
{
int i = l;
int num2 = 44 + l * 38;
ToggleSwitch[] array3 = gfOn;
int num3 = l;
ToggleSwitch toggleSwitch = new ToggleSwitch();
((Control)toggleSwitch).Location = new Point(0, num2);
((Control)toggleSwitch).BackColor = Theme.Bg;
array3[num3] = toggleSwitch;
Swatch[] array4 = gfCol;
int num4 = l;
Swatch swatch = new Swatch();
((Control)swatch).Location = new Point(58, num2 - 2);
((Control)swatch).BackColor = Theme.Bg;
array4[num4] = swatch;
Label val12 = new Label();
((Control)val12).Text = array2[l];
((Control)val12).Location = new Point(114, num2 + 3);
((Control)val12).AutoSize = true;
((Control)val12).ForeColor = Theme.Text;
((Control)val12).Font = Theme.F(10f, (FontStyle)0);
Label val13 = val12;
gfOn[l].Toggled += delegate
{
GameFaceEdited(i);
};
gfCol[l].ColorChanged += delegate
{
gfOn[i].On = true;
GameFaceEdited(i);
};
((Control)gamePanel).Controls.AddRange((Control[])(object)new Control[3]
{
gfOn[l],
gfCol[l],
(Control)val13
});
}
TactileButton tactileButton10 = new TactileButton("Auto colours");
((Control)tactileButton10).Location = new Point(300, 44);
((Control)tactileButton10).Width = 150;
((Control)tactileButton10).BackColor = Theme.Bg;
TactileButton tactileButton11 = tactileButton10;
((Control)tactileButton11).Click += delegate
{
SkinSlot skinSlot5 = Current;
if (skinSlot5 != null)
{
skinSlot5.Face = null;
Changed();
}
};
((Control)gamePanel).Controls.Add((Control)(object)tactileButton11);
for (int m = 0; m < 3; m++)
{
gfCol[m].SkinSource = CurrentSkinImage;
gfCol[m].Title = "Colour: " + array2[m];
}
((Control)editor).Controls.Add((Control)(object)gamePanel);
Panel val14 = new Panel();
((Control)val14).Location = new Point(X, partsTop);
((Control)val14).Size = new Size(600, 290);
((Control)val14).BackColor = Theme.Bg;
eyePanel = val14;
FacePicker facePicker = new FacePicker();
((Control)facePicker).Location = new Point(0, 0);
((Control)facePicker).BackColor = Theme.Bg;
picker = facePicker;
picker.Changed += delegate
{
SkinSlot skinSlot4 = Current;
if (skinSlot4 != null)
{
skinSlot4.Eyes = picker.Eyes.OrderBy((int v) => v).ToList();
Changed();
}
};
eyeSeg = new Segmented[2];
eyeLbl = (Label[])(object)new Label[2];
for (int n = 0; n < 2; n++)
{
int side = n;
Label[] array5 = eyeLbl;
int num5 = n;
Label val15 = new Label();
((Control)val15).Text = ((n == 0) ? "Eye 1 (left)" : "Eye 2 (right)");
((Control)val15).Location = new Point(264, 64 + n * 42 + 8);
((Control)val15).AutoSize = true;
((Control)val15).ForeColor = Theme.Text;
((Control)val15).Font = Theme.P(12.3f);
val15.UseCompatibleTextRendering = true;
array5[num5] = val15;
Segmented[] array6 = eyeSeg;
int num6 = n;
Segmented segmented = new Segmented("Face layer", "Outer layer");
((Control)segmented).Location = new Point(370, 64 + n * 42);
((Control)segmented).Width = 230;
((Control)segmented).BackColor = Theme.Bg;
array6[num6] = segmented;
eyeSeg[n].Picked += delegate
{
SkinSlot skinSlot3 = Current;
if (skinSlot3 != null)
{
picker.EyeLayer[side] = eyeSeg[side].Index;
skinSlot3.Eyes = (from v in skinSlot3.Eyes.Select((int v) => (FacePicker.Side(v) != side) ? v : (v % 64 + eyeSeg[side].Index * 64)).Distinct()
orderby v
select v).ToList();
Changed();
}
};
}
Panel val16 = new Panel();
((Control)val16).Location = new Point(264, 152);
((Control)val16).Size = new Size(360, 72);
((Control)val16).BackColor = Theme.Bg;
lidRow = val16;
ToggleSwitch toggleSwitch2 = new ToggleSwitch();
((Control)toggleSwitch2).Location = new Point(0, 4);
((Control)toggleSwitch2).BackColor = Theme.Bg;
lidOn = toggleSwitch2;
Swatch swatch2 = new Swatch();
((Control)swatch2).Location = new Point(56, 2);
((Control)swatch2).BackColor = Theme.Bg;
lidCol = swatch2;
Label val17 = new Label();
((Control)val17).Text = "Eyelid colour (what the eye closes to)";
((Control)val17).Location = new Point(108, 8);
((Control)val17).AutoSize = true;
((Control)val17).ForeColor = Theme.Text;
lidLbl = val17;
ToggleSwitch toggleSwitch3 = new ToggleSwitch();
((Control)toggleSwitch3).Location = new Point(0, 42);
((Control)toggleSwitch3).BackColor = Theme.Bg;
lidSplit = toggleSwitch3;
Swatch swatch3 = new Swatch();
((Control)swatch3).Location = new Point(56, 40);
((Control)swatch3).BackColor = Theme.Bg;
lidCol2 = swatch3;
Label val18 = new Label();
((Control)val18).Text = "Different colour for each eye";
((Control)val18).Location = new Point(108, 46);
((Control)val18).AutoSize = true;
((Control)val18).ForeColor = Theme.Text;
lidLbl2 = val18;
Action applyLid = delegate
{
SkinSlot skinSlot2 = Current;
if (skinSlot2 != null && !loading)
{
skinSlot2.LidColor = (lidOn.On ? new int?(lidCol.Rgb) : null);
skinSlot2.LidColor2 = ((lidOn.On && lidSplit.On) ? new int?(lidCol2.Rgb) : null);
Changed();
}
};
lidOn.Toggled += delegate
{
applyLid();
};
lidSplit.Toggled += delegate
{
if (lidSplit.On)
{
lidOn.On = true;
}
applyLid();
};
lidCol.ColorChanged += delegate
{
lidOn.On = true;
applyLid();
};
lidCol2.ColorChanged += delegate
{
lidOn.On = true;
lidSplit.On = true;
applyLid();
};
((Control)lidRow).Controls.AddRange((Control[])(object)new Control[6]
{
lidOn,
lidCol,
(Control)lidLbl,
lidSplit,
lidCol2,
(Control)lidLbl2
});
lidCol.SkinSource = (lidCol2.SkinSource = CurrentSkinImage);
lidCol.Title = "Eyelid colour";
lidCol2.Title = "Eyelid colour, eye 2 (right)";
Label val19 = new Label();
((Control)val19).Location = new Point(264, 0);
((Control)val19).Width = 320;
((Control)val19).Height = 60;
((Control)val19).ForeColor = Theme.Dim;
((Control)val19).Text = "Click the face pixels that are the eyes (they get a green frame). Each chosen pixel squashes shut on the game's blink, then reopens.\r\n\r\nThe dimmed top and bottom rows can't blink.";
eyeInfo = val19;
TactileButton tactileButton12 = new TactileButton("Auto-detect");
((Control)tactileButton12).Location = new Point(264, 232);
((Control)tactileButton12).Width = 144;
((Control)tactileButton12).BackColor = Theme.Bg;
TactileButton tactileButton13 = tactileButton12;
TactileButton tactileButton14 = new TactileButton("Clear");
((Control)tactileButton14).Location = new Point(420, 232);
((Control)tactileButton14).Width = 100;
((Control)tactileButton14).BackColor = Theme.Bg;
TactileButton tactileButton15 = tactileButton14;
((Control)tactileButton13).Click += delegate
{
AutoEyes();
Changed();
};
((Control)tactileButton15).Click += delegate
{
SkinSlot skinSlot = Current;
if (skinSlot != null)
{
skinSlot.Eyes.Clear();
Changed();
}
};
((Control)eyePanel).Controls.AddRange((Control[])(object)new Control[9]
{
picker,
(Control)eyeInfo,
eyeSeg[0],
eyeSeg[1],
(Control)eyeLbl[0],
(Control)eyeLbl[1],
(Control)lidRow,
tactileButton13,
tactileButton15
});
((Control)editor).Controls.Add((Control)(object)eyePanel);
ControlCollection controls4 = ((Control)editor).Controls;
Label val20 = new Label();
((Control)val20).Location = new Point(X, num + 520);
((Control)val20).Height = 16;
((Control)val20).Width = 4;
((Control)val20).BackColor = Theme.Bg;
controls4.Add((Control)(object)val20);
((Control)editorHost).Resize += delegate
{
int num7 = Math.Max(560, ((Control)editorHost).Width - 2 * X);
((Control)banner).Width = num7;
OptionCard[] array7 = modeCards;
foreach (OptionCard optionCard2 in array7)
{
((Control)optionCard2).Width = num7;
}
((Control)eyePanel).Width = num7;
((Control)eyeInfo).Width = Math.Max(200, num7 - 272);
((Control)gamePanel).Width = num7;
((Control)gTitle).Width = num7;
((Control)heroHint).Width = Math.Max(160, num7 - 400);
};
Toast toast = new Toast();
((Control)toast).Width = 620;
((Control)toast).BackColor = Theme.Bg;
this.toast = toast;
((Control)this).Controls.Add((Control)(object)this.toast);
((Control)this).Controls.Add((Control)(object)editorHost);
((Control)this).Controls.Add((Control)(object)left);
((Control)this).Controls.Add((Control)(object)bottom);
((Control)this).Controls.Add((Control)(object)header);
EventHandler eventHandler = delegate
{
((Control)this.toast).Location = new Point(380 + (((Form)this).ClientSize.Width - 380 - ((Control)this.toast).Width) / 2, ((Form)this).ClientSize.Height - 86 - ((Control)this.toast).Height - 16);
};
((Control)this).Resize += eventHandler;
eventHandler(null, null);
}
private LinkLabel MakeLink(string t, Action a)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
LinkLabel val = new LinkLabel();
((Control)val).Text = t;
((Control)val).AutoSize = true;
val.LinkColor = Theme.Blue;
val.ActiveLinkColor = Theme.Text;
val.LinkBehavior = (LinkBehavior)2;
((Control)val).Font = Theme.F(9.5f, (FontStyle)0);
((Control)val).BackColor = Color.Transparent;
((Control)val).Anchor = (AnchorStyles)9;
LinkLabel val2 = val;
val2.LinkClicked += (LinkLabelLinkClickedEventHandler)delegate
{
a();
};
return val2;
}
private string SkinName(SkinSlot s)
{
string path = s.ImagePath + ".name";
if (!File.Exists(path))
{
return Path.GetFileName(s.ImagePath);
}
return File.ReadAllText(path);
}
private static string ModeText(FaceMode m)
{
return m switch
{
FaceMode.Game => "game face",
FaceMode.Blink => "blinking eyes",
_ => "face as drawn",
};
}
private Img Tex(SkinSlot s)
{
if (!texCache.TryGetValue(s, out var value))
{
try
{
value = Converter.Convert(gd, Img.FromFile(s.ImagePath), s.Mode, s.Eyes, s.Face, s.LidColor, s.LidColor2);
}
catch
{
value = null;
}
texCache[s] = value;
}
return value;
}
private Bitmap Thumb(SkinSlot s)
{
if (!thumbCache.TryGetValue(s, out var value))
{
Img img = Tex(s);
value = ((img == null) ? null : Renderer.RenderIcon(gd.IconGeo[(!layers) ? 1u : 0u], img, 160, gd.IconCam, 0.0, 2).ToBitmap());
thumbCache[s] = value;
}
return value;
}
private void RebuildCards()
{
((Control)listPanel).SuspendLayout();
foreach (SlotCard card in cards)
{
((Component)(object)card).Dispose();
}
cards.Clear();
((Control)listPanel).Controls.Clear();
for (int i = 0; i < slots.Count; i++)
{
int idx = i;
SlotCard slotCard2 = new SlotCard();
slotCard2.Slot = slots[i];
((Control)slotCard2).Width = ((Control)listPanel).Parent.Width - 4;
((Control)slotCard2).Location = new Point(0, i * 138);
((Control)slotCard2).BackColor = Theme.Panel;
SlotCard slotCard3 = slotCard2;
((Control)slotCard3).Click += delegate
{
Select(idx);
};
cards.Add(slotCard3);
((Control)listPanel).Controls.Add((Control)(object)slotCard3);
}
((Control)listPanel).ResumeLayout();
RefreshCards();
((Control)emptyHint).Visible = slots.Count == 0;
}
private void RefreshCards()
{
foreach (SlotCard card in cards)
{
card.Hero = gd.FindHero(card.Slot.HeroKey);
card.Custom = Thumb(card.Slot);
card.ModeText = ModeText(card.Slot.Mode);
card.FileName = SkinName(card.Slot);
card.Selected = card.Slot == Current;
((Control)card).Invalidate();
}
}
private void Select(int i)
{
loading = true;
current = i;
SkinSlot s = Current;
((Control)editor).Parent.Visible = s != null;
if (s != null)
{
try
{
flatTex.Image = (Image)(object)Img.FromFile(s.ImagePath).ToBitmap();
}
catch
{
flatTex.Image = null;
}
((Control)fileLabel).Text = SkinName(s) + "\r\nAny Minecraft skin works: 64x64 or old 64x32, classic or slim arms.";
heroPicker.Items.Clear();
heroPicker.Selected = null;
foreach (Hero h2 in from h in gd.Heroes
orderby h.Name.StartsWith("_"), h.Name, h.Deluxe
select h)
{
HeroPicker.Item item = new HeroPicker.Item();
item.H = h2;
List<SkinSlot> source = slots;
Func<SkinSlot, bool> predicate = (SkinSlot o) => o != s && o.HeroKey == h2.Key;
item.Used = source.Any(predicate);
HeroPicker.Item item2 = item;
heroPicker.Items.Add(item2);
if (h2.Key == s.HeroKey)
{
heroPicker.Selected = item2;
}
}
((Control)heroPicker).Invalidate();
for (int j = 0; j < 3; j++)
{
modeCards[j].Checked = s.Mode == (FaceMode)j;
}
((Control)gamePanel).Visible = s.Mode == FaceMode.Game;
((Control)eyePanel).Visible = s.Mode == FaceMode.Blink || s.Mode == FaceMode.Game;
((Control)eyePanel).Top = partsTop + ((s.Mode == FaceMode.Game) ? (((Control)gamePanel).Height + 8) : 0) + ((ScrollableControl)editor).AutoScrollPosition.Y;
((Control)gamePanel).Top = partsTop + ((ScrollableControl)editor).AutoScrollPosition.Y;
((Control)eyeInfo).Text = ((s.Mode == FaceMode.Game) ? "Your own drawn eyes (blue frames) are hidden, so only the game's eyes show. Click pixels to add or remove them." : "Click the eye pixels: left half = eye 1, right half = eye 2. Pick each eye's layer: face (blue) or the outer hat layer (gold).");
if (s.Mode == FaceMode.Game)
{
GameFace gameFace = s.Face ?? GameFace.Auto(Converter.To64(Img.FromFile(s.ImagePath)).Crop(8, 8, 8, 8), s.Eyes);
int?[] array = new int?[3] { gameFace.Iris, gameFace.White, gameFace.Brow };
GameFace gameFace2 = GameFace.Auto(Converter.To64(Img.FromFile(s.ImagePath)).Crop(8, 8, 8, 8), s.Eyes);
int[] array2 = new int[3]
{
gameFace2.Iris ?? 1973790,
gameFace2.White ?? 16053492,
gameFace2.Brow ?? 3811872
};
for (int k = 0; k < 3; k++)
{
gfOn[k].On = array[k].HasValue;
gfCol[k].Rgb = array[k] ?? array2[k];
((Control)gfCol[k]).Enabled = array[k].HasValue;
((Control)gfCol[k]).Invalidate();
}
}
try
{
Img img = Converter.To64(Img.FromFile(s.ImagePath));
picker.Face = img.Crop(8, 8, 8, 8);
picker.Hat = img.Crop(40, 8, 8, 8);
}
catch
{
picker.Face = null;
picker.Hat = null;
}
bool flag = s.Mode == FaceMode.Blink;
Panel obj3 = lidRow;
Segmented obj4 = eyeSeg[0];
Segmented obj5 = eyeSeg[1];
Label obj6 = eyeLbl[0];
bool flag3 = (((Control)eyeLbl[1]).Visible = flag);
bool flag5 = (((Control)obj6).Visible = flag3);
bool flag7 = (((Control)obj5).Visible = flag5);
bool visible = (((Control)obj4).Visible = flag7);
((Control)obj3).Visible = visible;
picker.Numbered = flag;
for (int l = 0; l < 2; l++)
{
int sd = l;
List<int> list = s.Eyes.Where((int v) => FacePicker.Side(v) == sd).ToList();
if (list.Count > 0)
{
picker.EyeLayer[sd] = ((list[0] >= 64) ? 1 : 0);
}
else if (current != lastLayerSlot)
{
picker.EyeLayer[sd] = 0;
}
eyeSeg[sd].Index = picker.EyeLayer[sd];
}
lastLayerSlot = current;
lidOn.On = s.LidColor.HasValue;
lidSplit.On = s.LidColor2.HasValue;
lidCol.Rgb = s.LidColor ?? AutoLid(s, 0);
((Control)lidCol).Invalidate();
lidCol2.Rgb = s.LidColor2 ?? s.LidColor ?? AutoLid(s, 1);
((Control)lidCol2).Invalidate();
((Control)lidLbl).Text = (lidSplit.On ? "Eyelid colour, eye 1 (left)" : "Eyelid colour (what the eye closes to)");
((Control)lidLbl2).Text = (lidSplit.On ? "Eyelid colour, eye 2 (right)" : "Different colour for each eye");
((Control)lidCol2).Visible = lidSplit.On;
((Control)lidLbl2).Left = (lidSplit.On ? 108 : 56);
picker.Eyes = new HashSet<int>(s.Eyes);
((Control)picker).Invalidate();
banner.Hero = gd.FindHero(s.HeroKey);
banner.Refresh3D();
}
loading = false;
RefreshCards();
}
private Img CurrentSkinImage()
{
SkinSlot skinSlot = Current;
if (skinSlot == null)
{
return null;
}
return Converter.To64(Img.FromFile(skinSlot.ImagePath));
}
private int AutoLid(SkinSlot s, int side = -1)
{
try
{
Img img = Converter.To64(Img.FromFile(s.ImagePath));
foreach (int item in s.Eyes.Where((int v) => side < 0 || FacePicker.Side(v) == side))
{
int num2 = ((item >= 64) ? 40 : 8);
int num3 = item % 64;
int num4 = num3 / 8;
int num5 = num3 % 8;
int[] array = new int[4] { 1, -1, 2, -2 };
foreach (int num6 in array)
{
int num7 = num4 + num6;
if (num7 >= 0 && num7 <= 7 && !s.Eyes.Contains(item - num3 + num7 * 8 + num5))
{
byte[] array2 = img.Get(num2 + num7, 8 + num5);
if (array2[3] != 0)
{
return (array2[0] << 16) | (array2[1] << 8) | array2[2];
}
}
}
}
byte[] array3 = img.Get(11, 12);
return (array3[0] << 16) | (array3[1] << 8) | array3[2];
}
catch
{
return 13144176;
}
}
private void GameFaceEdited(int k)
{
SkinSlot skinSlot = Current;
if (skinSlot != null && !loading)
{
GameFace gameFace = new GameFace();
Func<int, int?> func = (int i) => (!gfOn[i].On) ? null : new int?(gfCol[i].Rgb);
gameFace.Iris = func(0);
gameFace.White = func(1);
gameFace.Brow = func(2);
gameFace.Mouth = null;
skinSlot.Face = gameFace;
Changed();
}
}
private void Changed()
{
if (Current != null)
{
texCache.Clear();
thumbCache.Clear();
SaveConfig();
Select(current);
}
}
private void BrowseAdd()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
OpenFileDialog val = new OpenFileDialog();
((FileDialog)val).Filter = "Minecraft skin (*.png)|*.png";
val.Multiselect = true;
((FileDialog)val).Title = "Choose Minecraft skin PNG files";
OpenFileDialog val2 = val;
try
{
if ((int)((CommonDialog)val2).ShowDialog((IWin32Window)(object)this) == 1)
{
string[] fileNames = ((FileDialog)val2).FileNames;
foreach (string file in fileNames)
{
AddSkin(file);
}
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
private void AddSkin(string file)
{
Img skin;
try
{
skin = Converter.To64(Img.FromFile(file));
}
catch (Exception ex)
{
Msg("That file can't be used as a skin:\r\n\r\n" + ex.Message, warn: true);
return;
}
HashSet<string> used = new HashSet<string>(slots.Select((SkinSlot s) => s.HeroKey));
string text = HeroOrder.Select((string n) => n + "|0").Concat(gd.Heroes.Select((Hero h) => h.Key)).FirstOrDefault((string k) => !used.Contains(k) && gd.FindHero(k) != null);
if (text == null)
{
Msg("Every hero already has a custom skin. Remove one first.", warn: true);
return;
}
string text2 = Path.Combine(App.DataDir, "skins");
Directory.CreateDirectory(text2);
string text3 = Path.Combine(text2, Guid.NewGuid().ToString("N").Substring(0, 12) + ".png");
File.Copy(file, text3);
File.WriteAllText(text3 + ".name", Path.GetFileName(file));
SkinSlot skinSlot = new SkinSlot();
skinSlot.HeroKey = text;
skinSlot.ImagePath = text3;
SkinSlot skinSlot2 = skinSlot;
List<int> list = Converter.DetectEyes(skin);
if (list.Count > 0)
{
skinSlot2.Mode = FaceMode.Blink;
skinSlot2.Eyes = list;
}
slots.Add(skinSlot2);
SaveConfig();
RebuildCards();
Select(slots.Count - 1);
((ScrollableControl)listPanel).ScrollControlIntoView((Control)(object)cards[cards.Count - 1]);
toast.Show("Added " + Path.GetFileName(file) + " as " + gd.FindHero(text).Display + ". Install when you're ready!", Theme.Blue);
}
private void ChangeImage()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
SkinSlot skinSlot = Current;
if (skinSlot == null)
{
return;
}
OpenFileDialog val = new OpenFileDialog();
((FileDialog)val).Filter = "Minecraft skin (*.png)|*.png";
((FileDialog)val).Title = "Choose a Minecraft skin PNG";
OpenFileDialog val2 = val;
try
{
if ((int)((CommonDialog)val2).ShowDialog((IWin32Window)(object)this) == 1)
{
try
{
Converter.To64(Img.FromFile(((FileDialog)val2).FileName));
}
catch (Exception ex)
{
Msg("That file can't be used as a skin:\r\n\r\n" + ex.Message, warn: true);
return;
}
File.Copy(((FileDialog)val2).FileName, skinSlot.ImagePath, overwrite: true);
File.WriteAllText(skinSlot.ImagePath + ".name", Path.GetFileName(((FileDialog)val2).FileName));
skinSlot.Eyes.Clear();
if (skinSlot.Mode == FaceMode.Blink)
{
AutoEyes();
}
Changed();
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
private void AutoEyes(bool warn = true)
{
SkinSlot skinSlot = Current;
if (skinSlot != null)
{
try
{
skinSlot.Eyes = Converter.DetectEyes(Converter.To64(Img.FromFile(skinSlot.ImagePath)));
}
catch
{
}
if (skinSlot.Eyes.Count == 0 && warn)
{
toast.Show("Couldn't spot the eyes automatically. Click them on the face grid.", Theme.Warn);
}
}
}
private void RemoveSlot()
{
SkinSlot skinSlot = Current;
if (skinSlot != null)
{
slots.Remove(skinSlot);
texCache.Remove(skinSlot);
thumbCache.Remove(skinSlot);
try
{
File.Delete(skinSlot.ImagePath);
File.Delete(skinSlot.ImagePath + ".name");
}
catch
{
}
SaveConfig();
RebuildCards();
Select(Math.Min(current, slots.Count - 1));
toast.Show("Skin removed. Click \"Install to game\" to apply.", Theme.Dim);
}
}
private void SaveConfig()
{
List<string> list = new List<string>();
list.Add("layers=" + (layers ? 1 : 0));
List<string> list2 = list;
foreach (SkinSlot slot in slots)
{
list2.Add(string.Join("|", slot.HeroKey, slot.ImagePath, slot.Mode.ToString(), string.Join(" ", slot.Eyes.Select((int e) => e / 8 + "." + e % 8)), (slot.Face != null) ? slot.Face.Serialize() : "", slot.LidColor.HasValue ? ("lid=" + slot.LidColor.Value.ToString("x6") + (slot.LidColor2.HasValue ? ("," + slot.LidColor2.Value.ToString("x6")) : "")) : ""));
}
File.WriteAllLines(ConfigPath, list2);
File.WriteAllText(Path.Combine(App.DataDir, "gamefolder.txt"), gameDir ?? "");
}
private void LoadConfig()
{
loading = true;
if (File.Exists(ConfigPath))
{
string[] array = File.ReadAllLines(ConfigPath);
foreach (string text in array)
{
if (text.StartsWith("layers="))
{
layers = text.EndsWith("1");
continue;
}
string[] array2 = text.Split(new char[1] { '|' });
if (array2.Length < 5 || !File.Exists(array2[2]))
{
continue;
}
SkinSlot skinSlot = new SkinSlot();
skinSlot.HeroKey = array2[0] + "|" + array2[1];
skinSlot.ImagePath = array2[2];
SkinSlot skinSlot2 = skinSlot;
if (Enum.TryParse<FaceMode>(array2[3], out var result))
{
skinSlot2.Mode = result;
}
if (array2.Length > 5)
{
skinSlot2.Face = GameFace.Parse(array2[5]);
}
if (array2.Length > 6 && array2[6].StartsWith("lid="))
{
string[] array3 = array2[6].Substring(4).Split(new char[1] { ',' });
skinSlot2.LidColor = Convert.ToInt32(array3[0], 16);
if (array3.Length > 1)
{
skinSlot2.LidColor2 = Convert.ToInt32(array3[1], 16);
}
}
if (array2[4].Trim() != "")
{
skinSlot2.Eyes = (from e in array2[4].Split(new char[1] { ' ' })
select int.Parse(e.Split(new char[1] { '.' })[0]) * 8 + int.Parse(e.Split(new char[1] { '.' })[1])).ToList();
}
if (gd.FindHero(skinSlot2.HeroKey) != null)
{
slots.Add(skinSlot2);
}
}
}
layersBox.Checked = layers;
string path = Path.Combine(App.DataDir, "gamefolder.txt");
if (File.Exists(path))
{
string text2 = File.ReadAllText(path).Trim();
if (text2 != "" && Game.IsGame(text2))
{
gameDir = text2;
}
}
loading = false;
}
private void DetectGame(string found)
{
if (gameDir == null)
{
gameDir = found;
}
Color dot = Color.FromArgb(88, 206, 110);
if (gameDir == null)
{
statusPill.Set(Theme.Bad, "Game not found", "set the folder below");
}
else if (!Game.VersionMatches(gd, gameDir))
{
statusPill.Set(Theme.Warn, "Different game version");
}
else
{
string version;
switch (Game.Detect(gameDir, out version))
{
case Game.State.Current:
statusPill.Set(dot, "Game found", "skins installed");
break;
case Game.State.Old:
statusPill.Set(Theme.Warn, "Old version installed", "install to update");
break;
default:
statusPill.Set(dot, "Game found", "ready");
break;
}
}
SaveConfig();
}
private void PickGameFolder()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Invalid comparison between Unknown and I4
FolderBrowserDialog val = new FolderBrowserDialog();
val.Description = "Select the \"Minecraft Dungeons II\" folder (the one that contains Dungeons.exe).";
FolderBrowserDialog val2 = val;
try
{
if ((int)((CommonDialog)val2).ShowDialog((IWin32Window)(object)this) == 1)
{
if (!Game.IsGame(val2.SelectedPath))
{
Msg("That folder doesn't look like Minecraft Dungeons II. Pick the folder that contains Dungeons.exe.", warn: true);
return;
}
gameDir = val2.SelectedPath;
DetectGame(null);
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
private bool ReadyForGame()
{
if (gameDir == null)
{
Msg("Minecraft Dungeons II wasn't found. Use \"Change game folder\" at the top right.", warn: true);
return false;
}
if (Game.Running())
{
Msg("Close Minecraft Dungeons II first, then try again.", warn: true);
return false;
}
return true;
}
private Dictionary<string, byte[]> BuildMod()
{
((Control)this).Cursor = Cursors.WaitCursor;
try
{
return ModBuilder.Build(gd, slots, layers, null);
}
finally
{
((Control)this).Cursor = Cursors.Default;
}
}
private void Install()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Invalid comparison between Unknown and I4
if (slots.Count == 0)
{
Msg("Add at least one skin first.", warn: true);
}
else
{
if (!ReadyForGame() || (!Game.VersionMatches(gd, gameDir) && (int)MessageBox.Show((IWin32Window)(object)this, "Your game is a different version than this app was made for (probably a game update).\r\n\r\nThe mod may not load, or could look broken. You can always remove it again with \"Uninstall mod\".\r\n\r\nInstall anyway?", "Dungeons 2 Skin Loader", (MessageBoxButtons)4, (MessageBoxIcon)48) != 6))
{
return;
}
try
{
int num = Game.Install(gameDir, BuildMod(), slots.Select((SkinSlot s) => gd.FindHero(s.HeroKey).Display));
DetectGame(null);
toast.Show(((num > 0) ? "✔ Replaced the previous install. " : "✔ ") + "Installed " + slots.Count + " skin" + ((slots.Count == 1) ? "" : "s") + "! Pick the hero in the Locker.", Theme.Accent);
}
catch (UnauthorizedAccessException)
{
Msg("Windows didn't allow writing to the game folder. Try running the app as administrator.", warn: true);
}
catch (Exception ex2)
{
Msg("Install failed:\r\n\r\n" + ex2.Message, warn: true);
}
}
}
private void RemoveMod()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Invalid comparison between Unknown and I4
if (!ReadyForGame())
{
return;
}
if (!Game.Installed(gameDir))
{
toast.Show("The mod isn't installed. The game is using its normal skins.", Theme.Dim);
}
else if ((int)MessageBox.Show((IWin32Window)(object)this, "Remove the skin mod from the game? Your skins stay in this app, so you can install them again later.", "Dungeons 2 Skin Loader", (MessageBoxButtons)4, (MessageBoxIcon)32) == 6)
{
try
{
Game.Uninstall(gameDir);
DetectGame(null);
toast.Show("Mod removed. The game is back to its normal skins.", Theme.Accent);
}
catch (Exception ex)
{
Msg("Couldn't remove the mod:\r\n\r\n" + ex.Message, warn: true);
}
}
}
private void Export()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
if (slots.Count == 0)
{
Msg("Add at least one skin first.", warn: true);
return;
}
SaveFileDialog val = new SaveFileDialog();
((FileDialog)val).Filter = "Zip file (*.zip)|*.zip";
((FileDialog)val).FileName = "Dungeons2SkinLoader_skins.zip";
((FileDialog)val).Title = "Save the mod for a friend";
SaveFileDialog val2 = val;
try
{
if ((int)((CommonDialog)val2).ShowDialog((IWin32Window)(object)this) != 1)
{
return;
}
try
{
Dictionary<string, byte[]> dictionary = BuildMod();
if (File.Exists(((FileDialog)val2).FileName))
{
File.Delete(((FileDialog)val2).FileName);
}
using (ZipArchive zipArchive = ZipFile.Open(((FileDialog)val2).FileName, ZipArchiveMode.Create))
{
foreach (KeyValuePair<string, byte[]> item in dictionary)
{
using Stream stream = zipArchive.CreateEntry(item.Key).Open();
stream.Write(item.Value, 0, item.Value.Length);
}
foreach (KeyValuePair<string, string> item2 in FriendScripts.Files(slots.Select((SkinSlot s) => gd.FindHero(s.HeroKey).Display)))
{
using StreamWriter streamWriter = new StreamWriter(zipArchive.CreateEntry(item2.Key).Open());
streamWriter.Write(item2.Value);
}
}
toast.Show("Saved " + Path.GetFileName(((FileDialog)val2).FileName) + " - your friend unzips it and runs INSTALL.bat", Theme.Accent);
}
catch (Exception ex)
{
Msg("Export failed:\r\n\r\n" + ex.Message, warn: true);
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
private void ShowHelp()
{
Msg("How it works\r\n\r\n1. Add Minecraft skin PNGs (drag them in or click \"Add skin\").\r\n2. For each one, pick the hero it replaces and how the face should behave.\r\n3. Close the game and click \"Install to game\".\r\n4. In the game, pick that hero in the Locker.\r\n\r\nOnly the look of the heroes changes; gameplay is untouched, and only players who installed the mod see your skins. To see each other's skins, friends need the same mod (\"Export for a friend\").\r\n\r\n\"Uninstall mod\" puts everything back to normal. After a game update the mod may stop loading until the app is updated.\r\n\r\nInstalling again always replaces the previous install (older versions included), so there are never two copies.\r\n\r\nDungeons 2 Skin Loader 1.0.0 - made by Poyraz Captain. Fan-made; not affiliated with Mojang or Microsoft.", warn: false);
}
private void Msg(string t, bool warn)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
MessageBox.Show((IWin32Window)(object)this, t, "Dungeons 2 Skin Loader", (MessageBoxButtons)0, (MessageBoxIcon)(warn ? 48 : 64));
}
}
internal static class FriendScripts
{
public static Dictionary<string, string> Files(IEnumerable<string> heroes)
{
string text = string.Join(",", from n in new string[1] { "zzz_Dungeons2SkinLoader_P" }.Concat(ModBuilder.LegacyNames)
select "'" + n + "'");
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary["install.ps1"] = string.Join("\r\n", "# Dungeons 2 Skin Loader 1.0.0 by Poyraz Captain - installs / removes the skin mod", "$ErrorActionPreference = 'Stop'", "$steam = (Get-ItemProperty 'HKCU:\\Software\\Valve\\Steam' -ErrorAction SilentlyContinue).SteamPath", "$libs = @()", "if ($steam) { $libs += $steam; $vdf = Join-Path $steam 'steamapps\\libraryfolders.vdf'", " if (Test-Path $vdf) { $libs += (Select-String -Path $vdf -Pattern '\"path\"\\s+\"(.+)\"' | ForEach-Object { $_.Matches[0].Groups[1].Value -replace '\\\\\\\\','\\' }) } }", "$game = $libs | ForEach-Object { Join-Path $_ 'steamapps\\common\\Minecraft Dungeons II' } | Where-Object { Test-Path $_ } | Select-Object -First 1", "if (-not $game) { Write-Host 'Could not find Minecraft Dungeons II in your Steam libraries.'; exit 1 }", "if (Get-Process Dungeons-Win64-Shipping -ErrorAction SilentlyContinue) { Write-Host 'Close the game first, then run this again.'; exit 1 }", "$paks = Join-Path $game 'Dungeons\\Content\\Paks'", "$mods = Join-Path $paks '~mods'", "New-Item -ItemType Directory -Force $mods | Out-Null", "$here = Split-Path -Parent $MyInvocation.MyCommand.Path", "# remove any earlier install (older versions used other file names)", "$removed = 0", "foreach ($dir in $mods, $paks) { foreach ($n in " + text + ") { foreach ($ext in 'pak','utoc','ucas','sig') {", " $f = Join-Path $dir \"$n.$ext\"; if (Test-Path $f) { [IO.File]::Delete($f); $removed++ } } }", " $m = Join-Path $dir 'Dungeons2SkinLoader.txt'; if (Test-Path $m) { [IO.File]::Delete($m) } }", "if ($args[0] -eq 'uninstall') { Write-Host \"Custom skins removed ($removed files).\"; exit 0 }", "if ($removed -gt 0) { Write-Host \"Removed the previous install ($removed files).\" }", "Copy-Item (Join-Path $here 'zzz_Dungeons2SkinLoader_P.*') $mods -Force", "Set-Content (Join-Path $mods 'Dungeons2SkinLoader.txt') @('Dungeons 2 Skin Loader by Poyraz Captain', 'version=1.0.0', ('installed=' + (Get-Date -Format 'yyyy-MM-dd HH:mm')), 'heroes=" + string.Join(", ", heroes).Replace("'", "''") + "')", "Write-Host \"Custom skins installed to $mods\"");
dictionary["INSTALL.bat"] = "@echo off\r\npowershell -NoProfile -ExecutionPolicy Bypass -File \"%~dp0install.ps1\"\r\npause\r\n";
dictionary["UNINSTALL.bat"] = "@echo off\r\npowershell -NoProfile -ExecutionPolicy Bypass -File \"%~dp0install.ps1\" uninstall\r\npause\r\n";
dictionary["README.txt"] = "Dungeons 2 Skin Loader 1.0.0 by Poyraz Captain - custom skins for Minecraft Dungeons II (cosmetic only)\r\n\r\nChanges how these heroes look on your PC:\r\n " + string.Join(", ", heroes) + "\r\n\r\nInstall: close the game, extract this zip, double-click INSTALL.bat\r\n (an older install of this mod is detected and replaced automatically)\r\nRemove: close the game, double-click UNINSTALL.bat\r\n\r\nNothing about gameplay changes; only players who install this see the skins.\r\nFan-made; not affiliated with Mojang or Microsoft.\r\n";
return dictionary;
}
}
public class Canvas : Panel
{
public Canvas()
{
((Control)this).DoubleBuffered = true;
((Control)this).ResizeRedraw = true;
}
}
public class ColorPickerDialog : Form
{
private const int SkinScale = 5;
private int rgb;
private int original;
private float h;
private float s;
private float v;
private Img skin;
private Canvas field;
private Canvas hueBar;
private Canvas preview;
private Canvas skinView;
private Canvas palette;
private TextBox hex;
private Label rgbLabel;
private Label hoverLabel;
private Bitmap fieldBmp;
private float fieldHue;
private int hoverX;
private int hoverY;
private List<int> skinColours;
private bool updatingHex;
public int Rgb => rgb;
public ColorPickerDialog(int start, Img skinTexture, string title)
{
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Expected O, but got Unknown
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Expected O, but got Unknown
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Expected O, but got Unknown
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Expected O, but got Unknown
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Expected O, but got Unknown
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Expected O, but got Unknown
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Expected O, but got Unknown
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Expected O, but got Unknown
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Expected O, but got Unknown
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Expected O, but got Unknown
//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Expected O, but got Unknown
//IL_044f: Unknown result type (might be due to invalid IL or missing references)
//IL_0459: Expected O, but got Unknown
//IL_046a: Unknown result type (might be due to invalid IL or missing references)
//IL_0471: Expected O, but got Unknown
//IL_056b: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Expected O, but got Unknown
//IL_060c: Unknown result type (might be due to invalid IL or missing references)
//IL_0616: Expected O, but got Unknown
//IL_0627: Unknown result type (might be due to invalid IL or missing references)
//IL_062e: Expected O, but got Unknown
//IL_0674: Unknown result type (might be due to invalid IL or missing references)
//IL_067b: Expected O, but got Unknown
//IL_0665: Unknown result type (might be due to invalid IL or missing references)
//IL_066c: Expected O, but got Unknown
KeyEventHandler val = null;
MouseEventHandler val2 = null;
MouseEventHandler val3 = null;
MouseEventHandler val4 = null;
MouseEventHandler val5 = null;
MouseEventHandler val6 = null;
MouseEventHandler val7 = null;
fieldHue = -1f;
hoverX = -1;
hoverY = -1;
skinColours = new List<int>();
((Form)this)..ctor();
rgb = (original = start);
skin = skinTexture;
ToHsv(start, out h, out s, out v);
((Control)this).Text = title;
((Control)this).BackColor = Theme.Bg;
((Control)this).ForeColor = Theme.Text;
((Control)this).Font = Theme.F(9.5f, (FontStyle)0);
((Form)this).FormBorderStyle = (FormBorderStyle)3;
bool maximizeBox = (((Form)this).MinimizeBox = false);
((Form)this).MaximizeBox = maximizeBox;
((Form)this).ShowInTaskbar = false;
((Form)this).StartPosition = (FormStartPosition)4;
((Form)this).KeyPreview = true;
((Form)this).ClientSize = new Size((skin != null) ? 760 : 420, 470);
if (val == null)
{
val = (KeyEventHandler)delegate(object o, KeyEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
if ((int)e.KeyCode == 27)
{
((Form)this).DialogResult = (DialogResult)2;
((Form)this).Close();
}
else if ((int)e.KeyCode == 13 && !((Control)hex).Focused)
{
Accept();
}
};
}
((Control)this).KeyDown += val;
Canvas canvas = new Canvas();
((Control)canvas).Location = new Point(20, 20);
((Control)canvas).Size = new Size(240, 240);
((Control)canvas).Cursor = Cursors.Cross;
field = canvas;
((Control)field).Paint += new PaintEventHandler(PaintField);
if (val2 == null)
{
val2 = (MouseEventHandler)delegate(object o, MouseEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)e.Button == 1048576)
{
s = Clamp((float)e.X / 239f);
v = Clamp(1f - (float)e.Y / 239f);
FromHsv();
}
};
}
MouseEventHandler val8 = val2;
((Control)field).MouseDown += val8;
((Control)field).MouseMove += val8;
Canvas canvas2 = new Canvas();
((Control)canvas2).Location = new Point(272, 20);
((Control)canvas2).Size = new Size(26, 240);
((Control)canvas2).Cursor = Cursors.Hand;
hueBar = canvas2;
((Control)hueBar).Paint += new PaintEventHandler(PaintHue);
if (val3 == null)
{
val3 = (MouseEventHandler)delegate(object o, MouseEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)e.Button == 1048576)
{
h = Clamp((float)e.Y / 239f) * 360f;
FromHsv();
}
};
}
MouseEventHandler val9 = val3;
((Control)hueBar).MouseDown += val9;
((Control)hueBar).MouseMove += val9;
Canvas canvas3 = new Canvas();
((Control)canvas3).Location = new Point(312, 20);
((Control)canvas3).Size = new Size(90, 72);
preview = canvas3;
((Control)preview).Paint += new PaintEventHandler(PaintPreview);
Canvas canvas4 = preview;
if (val4 == null)
{
val4 = (MouseEventHandler)delegate(object o, MouseEventArgs e)
{
if (e.Y < 36)
{
SetRgb(original);
}
};
}
((Control)canvas4).MouseClick += val4;
Label val10 = new Label();
((Control)val10).Text = "HEX";
((Control)val10).Location = new Point(312, 104);
((Control)val10).AutoSize = true;
((Control)val10).ForeColor = Theme.Dim;
((Control)val10).Font = Theme.F(8.5f, (FontStyle)1);
Label val11 = val10;
TextBox val12 = new TextBox();
((Control)val12).Location = new Point(312, 124);
((Control)val12).Width = 90;
((Control)val12).BackColor = Theme.Card;
((Control)val12).ForeColor = Theme.Text;
((TextBoxBase)val12).BorderStyle = (BorderStyle)1;
((Control)val12).Font = new Font("Consolas", 11f);
val12.CharacterCasing = (CharacterCasing)1;
((TextBoxBase)val12).MaxLength = 7;
hex = val12;
((Control)hex).TextChanged += delegate
{
if (!updatingHex)
{
string text = ((Control)hex).Text.Trim().TrimStart(new char[1] { '#' });
if (text.Length == 6 && int.TryParse(text, NumberStyles.HexNumber, null, out var result))
{
ToHsv(result, out h, out s, out v);
rgb = result;
Refresh2(setHex: false);
}
}
};
Label val13 = new Label();
((Control)val13).Location = new Point(312, 158);
((Control)val13).AutoSize = true;
((Control)val13).ForeColor = Theme.Dim;
((Control)val13).Font = Theme.F(9f, (FontStyle)0);
rgbLabel = val13;
Label val14 = new Label();
((Control)val14).Text = "COLOURS IN THIS SKIN";
((Control)val14).Location = new Point(20, 276);
((Control)val14).AutoSize = true;
((Control)val14).ForeColor = Theme.Dim;
((Control)val14).Font = Theme.F(8.5f, (FontStyle)1);
Label val15 = val14;
Canvas canvas5 = new Canvas();
((Control)canvas5).Location = new Point(20, 298);
((Control)canvas5).Size = new Size(382, 88);
((Control)canvas5).Cursor = Cursors.Hand;
palette = canvas5;
((Control)palette).Paint += new PaintEventHandler(PaintPalette);
Canvas canvas6 = palette;
if (val5 == null)
{
val5 = (MouseEventHandler)delegate(object o, MouseEventArgs e)
{
int num5 = e.Y / 22 * 17 + e.X / 22;
if (num5 >= 0 && num5 < skinColours.Count)
{
SetRgb(skinColours[num5]);
}
};
}
((Control)canvas6).MouseClick += val5;
if (skin != null)
{
Dictionary<int, int> dictionary = new Dictionary<int, int>();
for (int i = 0; i < skin.H; i++)
{
for (int j = 0; j < skin.W; j++)
{
byte[] array = skin.Get(j, i);
if (array[3] >= 128)
{
int key = (array[0] << 16) | (array[1] << 8) | array[2];
dictionary.TryGetValue(key, out var value);
dictionary[key] = value + 1;
}
}
}
skinColours = (from kv in dictionary
orderby kv.Value descending
select kv.Key).Take(68).ToList();
}
if (skin != null)
{
Label val16 = new Label();
((Control)val16).Text = "PICK FROM THE SKIN (click any pixel)";
((Control)val16).Location = new Point(420, 12);
((Control)val16).AutoSize = true;
((Control)val16).ForeColor = Theme.Dim;
((Control)val16).Font = Theme.F(8.5f, (FontStyle)1);
Label val17 = val16;
Canvas canvas7 = new Canvas();
((Control)canvas7).Location = new Point(420, 32);
((Control)canvas7).Size = new Size(320, 320);
((Control)canvas7).Cursor = Cursors.Cross;
skinView = canvas7;
((Control)skinView).Paint += new PaintEventHandler(PaintSkin);
Canvas canvas8 = skinView;
if (val6 == null)
{
val6 = (MouseEventHandler)delegate(object o, MouseEventArgs e)
{
int num3 = e.X / 5;
int num4 = e.Y / 5;
if (num3 != hoverX || num4 != hoverY)
{
hoverX = num3;
hoverY = num4;
((Control)skinView).Invalidate();
UpdateHover();
}
};
}
((Control)canvas8).MouseMove += val6;
((Control)skinView).MouseLeave += delegate
{
hoverX = (hoverY = -1);
((Control)skinView).Invalidate();
UpdateHover();
};
Canvas canvas9 = skinView;
if (val7 == null)
{
val7 = (MouseEventHandler)delegate(object o, MouseEventArgs e)
{
int num = e.X / 5;
int num2 = e.Y / 5;
if (num >= 0 && num2 >= 0 && num <= 63 && num2 <= 63)
{
byte[] array2 = skin.Get(num, num2);
if (array2[3] >= 128)
{
SetRgb((array2[0] << 16) | (array2[1] << 8) | array2[2]);
}
}
};
}
((Control)canvas9).MouseClick += val7;
Label val18 = new Label();
((Control)val18).Location = new Point(420, 358);
((Control)val18).AutoSize = true;
((Control)val18).ForeColor = Theme.Dim;
hoverLabel = val18;
((Control)this).Controls.AddRange((Control[])(object)new Control[3]
{
(Control)val17,
(Control)skinView,
(Control)hoverLabel
});
}
TactileButton tactileButton = new TactileButton("Use this colour", BtnKind.Primary);
((Control)tactileButton).Location = new Point(((Form)this).ClientSize.Width - 200, ((Form)this).ClientSize.Height - 62);
((Control)tactileButton).Width = 180;
((Control)tactileButton).BackColor = Theme.Bg;
TactileButton tactileButton2 = tactileButton;
TactileButton tactileButton3 = new TactileButton("Cancel");
((Control)tactileButton3).Location = new Point(((Form)this).ClientSize.Width - 320, ((Form)this).ClientSize.Height - 62);
((Control)tactileButton3).Width = 108;
((Control)tactileButton3).BackColor = Theme.Bg;
TactileButton tactileButton4 = tactileButton3;
((Control)tactileButton2).Click += delegate
{
Accept();
};
((Control)tactileButton4).Click += delegate
{
((Form)this).DialogResult = (DialogResult)2;
((Form)this).Close();
};
((Control)this).Controls.AddRange((Control[])(object)new Control[10]
{
(Control)field,
(Control)hueBar,
(Control)preview,
(Control)val11,
(Control)hex,
(Control)rgbLabel,
(Control)val15,
(Control)palette,
tactileButton2,
tactileButton4
});
Refresh2(setHex: true);
}
private void Accept()
{
((Form)this).DialogResult = (DialogResult)1;
((Form)this).Close();
}
private static float Clamp(float x)
{
return Math.Max(0f, Math.Min(1f, x));
}
private void SetRgb(int c)
{
rgb = c;
ToHsv(c, out h, out s, out v);
Refresh2(setHex: true);
}
private void FromHsv()
{
rgb = HsvToRgb(h, s, v);
Refresh2(setHex: true);
}
private void Refresh2(bool setHex)
{
if (setHex)
{
updatingHex = true;
((Control)hex).Text = "#" + rgb.ToString("X6");
updatingHex = false;
}
((Control)rgbLabel).Text = "R " + ((rgb >> 16) & 0xFF) + " G " + ((rgb >> 8) & 0xFF) + " B " + (rgb & 0xFF);
((Control)field).Invalidate();
((Control)hueBar).Invalidate();
((Control)preview).Invalidate();
((Control)palette).Invalidate();
}
private void UpdateHover()
{
if (hoverLabel != null)
{
if (hoverX < 0 || hoverY < 0 || hoverX > 63 || hoverY > 63)
{
((Control)hoverLabel).Text = "";
return;
}
byte[] array = skin.Get(hoverX, hoverY);
((Control)hoverLabel).Text = ((array[3] < 128) ? ("(" + hoverX + ", " + hoverY + ") transparent") : ("(" + hoverX + ", " + hoverY + ") #" + ((array[0] << 16) | (array[1] << 8) | array[2]).ToString("X6")));
}
}
private void PaintField(object o, PaintEventArgs e)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
if (fieldBmp == null || fieldHue != h)
{
fieldHue = h;
if (fieldBmp != null)
{
((Image)fieldBmp).Dispose();
}
fieldBmp = new Bitmap(240, 240);
for (int i = 0; i < 240; i++)
{
for (int j = 0; j < 240; j++)
{
int num = HsvToRgb(h, (float)j / 239f, 1f - (float)i / 239f);
fieldBmp.SetPixel(j, i, Color.FromArgb((num >> 16) & 0xFF, (num >> 8) & 0xFF, num & 0xFF));
}
}
}
Graphics graphics = e.Graphics;
graphics.DrawImageUnscaled((Image)(object)fieldBmp, 0, 0);
graphics.SmoothingMode = (SmoothingMode)4;
float num2 = s * 239f;
float num3 = (1f - v) * 239f;
graphics.SmoothingMode = (SmoothingMode)3;
Pen val = new Pen(Color.Black, 3f);
try
{
graphics.DrawRectangle(val, num2 - 6f, num3 - 6f, 12f, 12f);
}
finally
{
((IDisposable)val)?.Dispose();
}
Pen val2 = new Pen(Color.White, 1f);
try
{
graphics.DrawRectangle(val2, num2 - 6f, num3 - 6f, 12f, 12f);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
private void PaintHue(object o, PaintEventArgs e)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
Graphics graphics = e.Graphics;
for (int i = 0; i < 240; i++)
{
int num = HsvToRgb((float)i / 239f * 360f, 1f, 1f);
Pen val = new Pen(Color.FromArgb((num >> 16) & 0xFF, (num >> 8) & 0xFF, num & 0xFF));
try
{
graphics.DrawLine(val, 0, i, 26, i);
}
finally
{
((IDisposable)val)?.Dispose();
}
}
float num2 = h / 360f * 239f;
graphics.SmoothingMode = (SmoothingMode)4;
Pen val2 = new Pen(Color.Black, 3f);
try
{
graphics.DrawRectangle(val2, 1f, num2 - 3f, 23f, 6f);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Color.White, 1.5f);
try
{
graphics.DrawRectangle(val3, 1f, num2 - 3f, 23f, 6f);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
private void PaintPreview(object o, PaintEventArgs e)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
Graphics graphics = e.Graphics;
graphics.Clear(Theme.Bg);
SolidBrush val = new SolidBrush(ToColor(original));
try
{
graphics.FillRectangle((Brush)(object)val, 0, 0, 90, 36);
}
finally
{
((IDisposable)val)?.Dispose();
}
SolidBrush val2 = new SolidBrush(ToColor(rgb));
try
{
graphics.FillRectangle((Brush)(object)val2, 0, 36, 90, 36);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(Theme.Line);
try
{
graphics.DrawRectangle(val3, 0, 0, 89, 71);
}
finally
{
((IDisposable)val3)?.Dispose();
}
SolidBrush val4 = new SolidBrush(Color.FromArgb(160, 0, 0, 0));
try
{
graphics.FillRectangle((Brush)(object)val4, 2, 2, 42, 14);
graphics.FillRectangle((Brush)(object)val4, 2, 38, 34, 14);
}
finally
{
((IDisposable)val4)?.Dispose();
}
Font val5 = Theme.F(7.5f, (FontStyle)1);
try
{
SolidBrush val6 = new SolidBrush(Color.White);
try
{
graphics.DrawString("BEFORE", val5, (Brush)(object)val6, 3f, 2f);
graphics.DrawString("NEW", val5, (Brush)(object)val6, 3f, 38f);
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
private void PaintPalette(object o, PaintEventArgs e)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
Graphics graphics = e.Graphics;
graphics.Clear(Theme.Bg);
for (int i = 0; i < skinColours.Count; i++)
{
Rectangle rectangle = new Rectangle(i % 17 * 22, i / 17 * 22, 20, 20);
SolidBrush val = new SolidBrush(ToColor(skinColours[i]));
try
{
graphics.FillRectangle((Brush)(object)val, rectangle);
}
finally
{
((IDisposable)val)?.Dispose();
}
Pen val2 = new Pen((skinColours[i] == rgb) ? Theme.Accent : Theme.Line, (float)((skinColours[i] != rgb) ? 1 : 2));
try
{
graphics.DrawRectangle(val2, rectangle);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
}
private void PaintSkin(object o, PaintEventArgs e)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Expected O, but got Unknown
Graphics graphics = e.Graphics;
graphics.InterpolationMode = (InterpolationMode)5;
for (int i = 0; i < 64; i++)
{
for (int j = 0; j < 64; j++)
{
byte[] array = skin.Get(j, i);
Color color = ((array[3] >= 128) ? Color.FromArgb(array[0], array[1], array[2]) : ((((j + i) & 1) == 0) ? Color.FromArgb(34, 37, 45) : Color.FromArgb(28, 31, 38)));
SolidBrush val = new SolidBrush(color);
try
{
graphics.FillRectangle((Brush)(object)val, j * 5, i * 5, 5, 5);
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
if (hoverX < 0 || hoverY < 0 || hoverX >= 64 || hoverY >= 64)
{
return;
}
Pen val2 = new Pen(Color.White, 2f);
try
{
graphics.DrawRectangle(val2, hoverX * 5 - 1, hoverY * 5 - 1, 6, 6);
}
finally
{
((IDisposable)val2)?.Dispose();
}
int num = Math.Min(242, hoverX * 5 + 12);
int num2 = Math.Max(0, hoverY * 5 - 84);
graphics.FillRectangle(Brushes.Black, num - 2, num2 - 2, 74, 74);
for (int k = -3; k <= 3; k++)
{
for (int l = -3; l <= 3; l++)
{
int num3 = hoverX + l;
int num4 = hoverY + k;
Color color2 = Theme.Bg;
if (num3 >= 0 && num4 >= 0 && num3 < 64 && num4 < 64)
{
byte[] array2 = skin.Get(num3, num4);
if (array2[3] >= 128)
{
color2 = Color.FromArgb(array2[0], array2[1], array2[2]);
}
}
SolidBrush val3 = new SolidBrush(color2);
try
{
graphics.FillRectangle((Brush)(object)val3, num + (l + 3) * 10, num2 + (k + 3) * 10, 10, 10);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
}
Pen val4 = new Pen(Color.White, 2f);
try
{
graphics.DrawRectangle(val4, num + 30, num2 + 30, 10, 10);
}
finally
{
((IDisposable)val4)?.Dispose();
}
}
private static Color ToColor(int c)
{
return Color.FromArgb((c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF);
}
public static void ToHsv(int c, out float h, out float s, out float v)
{
float num = (float)((c >> 16) & 0xFF) / 255f;
float num2 = (float)((c >> 8) & 0xFF) / 255f;
float num3 = (float)(c & 0xFF) / 255f;
float num4 = Math.Max(num, Math.Max(num2, num3));
float num5 = Math.Min(num, Math.Min(num2, num3));
float num6 = num4 - num5;
v = num4;
s = ((num4 == 0f) ? 0f : (num6 / num4));
if (num6 == 0f)
{
h = 0f;
}
else if (num4 == num)
{
h = 60f * ((num2 - num3) / num6 % 6f);
}
else if (num4 == num2)
{
h = 60f * ((num3 - num) / num6 + 2f);
}
else
{
h = 60f * ((num - num2) / num6 + 4f);
}
if (h < 0f)
{
h += 360f;
}
}
public static int HsvToRgb(float h, float s, float v)
{
float num = v * s;
float num2 = num * (1f - Math.Abs(h / 60f % 2f - 1f));
float num3 = v - num;
float num4;
float num5;
float num6;
if (h < 60f)
{
num4 = num;
num5 = num2;
num6 = 0f;
}
else if (h < 120f)
{
num4 = num2;
num5 = num;
num6 = 0f;
}
else if (h < 180f)
{
num4 = 0f;
num5 = num;
num6 = num2;
}
else if (h < 240f)
{
num4 = 0f;
num5 = num2;
num6 = num;
}
else if (h < 300f)
{
num4 = num2;
num5 = 0f;
num6 = num;
}
else
{
num4 = num;
num5 = 0f;
num6 = num2;
}
return ((int)Math.Round((num4 + num3) * 255f) << 16) | ((int)Math.Round((num5 + num3) * 255f) << 8) | (int)Math.Round((num6 + num3) * 255f);
}
}
You are not using the latest version of the tool, please update.
Latest version is '11.1.0.9782' (yours is '8.2.0.7535-95108c96')
Screen recording
30 frames · screen recording · 133sBehavior summary
ran 133s1 process(es) observed
Kernel audit saw no cross-process reach. Kernel object-access auditing and the thread trace were active on this run and attributed no handle to another process, no remote or unbacked thread start and no spoofed parent to the sample tree. An observation, not a gap.
No WMI attributed to the sample. The WMI-Activity trace was running and recorded 1072 operations on the machine during the run; none of them came from the sample's process tree.
Command lines, unwrapped
1 read1 captured text was read and unwrapped locally. No address was recovered from any of them, and none of them was hiding its own contents behind an encoding or a format string. This is a result, not a gap.
Network activity
The network section is a paid-plan layer: the DNS the sample resolved, the connections it opened, the TLS it negotiated, and the rule engine's reading of the capture.
This run was captured, and what it captured is on a paid plan rather than absent. An internet-connected detonation is the same plan, so a paid run also shows what the sample reached rather than only what it tried.
Process tree
What ran during the detonation, and what each process did. Select a node to see the activity attributed to it.
Dungeons2SkinLoader.exe
1 processAttributed activity
Not attributed to any process
2 kindsThese operations were captured but carry no pid this tree could match, so they are not shown against any node above.
Persistence mechanisms
cleanNo persistence established
None of the 90 auto-start methods below were established during this run.
Detection coverage
0 / 90Every auto-start method checked on this sample, grouped by family. A method with no result is reported clean, and one the sample only names in its own strings reads "named" rather than "detected".
- Active Setup Installed Component T1547.014 clean
- Explorer Delay-Load Object T1547.001 clean
- Explorer Run Key T1547.001 clean
- Explorer SharedTaskScheduler T1547.001 clean
- Group Policy Extension DLL T1547.004 clean
- Group Policy Run Key T1547.001 clean
- Logon Script T1037.001 clean
- RDP WDS Startup Program T1547.001 clean
- Registry Run Key T1547.001 clean
- Registry RunEx Key T1547.001 clean
- Registry RunOnce Key T1547.001 clean
- Registry RunOnceEx Key T1547.001 clean
- Registry RunServices Key T1547.001 clean
- Startup Folder Item T1547.001 clean
- Startup Folder Redirection T1547.001 clean
- Terminal Services Initial Program T1547.001 clean
- Winlogon GINA DLL T1547.004 clean
- Winlogon MPNotify Value T1547.004 clean
- Winlogon Notify Package T1547.004 clean
- Winlogon Shell Value T1547.004 clean
- Winlogon Taskman Value T1547.004 clean
- Winlogon Userinit Value T1547.004 clean
- BITS Job T1197 clean
- Print Monitor DLL T1547.010 clean
- Print Processor DLL T1547.012 clean
- Scheduled Task T1053.005 clean
- Scheduled Task Registry Implant T1053.005 clean
- Service Control Manager Security Descriptor T1574.011 clean
- Service DLL Hijack T1543.003 clean
- Time Provider DLL T1547.003 clean
- Windows Service Creation T1543.003 clean
- .NET Managed Debugger T1546.012 clean
- Accessibility Tool Hijack T1546.008 clean
- AeDebug Postmortem Debugger T1546.012 clean
- App Paths Hijack T1546.012 clean
- Application Shim Database T1546.011 clean
- Boot Verification Program T1547.002 clean
- Command Processor AutoRun T1546.011 clean
- Explorer Load Value T1547.001 clean
- Explorer MyComputer Tool Hijack T1546.001 clean
- Registry Image File Execution Options T1546.012 clean
- Screensaver Hijack T1546.002 clean
- Setup ErrorHandler Script T1546 clean
- Shell Open Command Hijack T1546.001 clean
- SilentProcessExit Monitor T1546.012 clean
- Telemetry Controller Command T1546.015 clean
- WER ReflectDebugger T1546.012 clean
- Windows Error Reporting Debugger T1546.012 clean
- .NET CLR Profiler DLL T1574.012 clean
- .NET Startup Hook DLL T1574 clean
- AppCert DLLs T1546.009 clean
- AppInit DLLs T1546.010 clean
- AutodialDLL Winsock Injection T1546.006 clean
- DLL Search-Order Hijack T1574.001 T1574.002 clean
- DNS Server Plugin DLL T1574.001 clean
- HTML Help Helper DLL T1546 clean
- KnownDLLs Manipulation T1574.001 clean
- Natural Language Platform DLL Override T1546 clean
- Netsh Helper DLL T1546.007 clean
- Winsock Layered Service Provider T1546.006 clean
- Browser Extension T1176 clean
- Browser Helper Object T1176 clean
- COM Server Hijack T1546.015 clean
- HTML Help COM Object Hijack T1546.015 clean
- Shell Context Menu Handler T1546.001 clean
- Shell Extension Handler T1546.001 clean
- Account RID Hijack T1098 clean
- AMSI Provider T1562.001 clean
- Credential Provider T1547.014 clean
- DSRM Admin Logon Backdoor T1556 clean
- Hidden Local Account T1136.001 clean
- LSA Authentication Package T1547.002 clean
- LSA Extension DLL T1547.005 clean
- LSA Notification Package T1547.005 clean
- LSA Security Package T1547.005 clean
- Network Provider DLL T1556.008 clean
- Security Support Provider T1547.005 clean
- Netsh Port Proxy T1090.001 clean
- Office Add-in T1137.006 clean
- Office Executable Sideload T1574.002 clean
- Office Startup Template T1137.001 clean
- Office Test Key T1137.002 clean
- Power Automate Flow T1546 clean
- PowerShell Profile T1546.013 clean
- Windows Terminal Startup Action T1546 clean
- WMI Event Subscription T1546.003 clean
- BootExecute Native Image T1547.002 clean
- PlatformExecute Native Image T1547.002 clean
- SetupExecute Native Image T1547.002 clean
- UEFI / Bootkit Artifact T1542.003 T1542.001 clean
File activity summary
Dropped payload analysis
not observedNo payload write was recorded and no capture ran on this run, so nothing here is a measurement about dropped files either way.
File & registry ops
4 file · 0 registry · sample scope
File operation times: 4 timed
| Operation | Target | Process | |
|---|---|---|---|
| create |
C:\Users\user\Documents\Dungeons 2 Skin Loader
|
Dungeons2SkinLoader.exe pid 1908 | 2026-09-30 12:51:56.372 |
| create |
C:\Users\user\Documents\Dungeons 2 Skin Loader\config.txt
|
Dungeons2SkinLoader.exe pid 1908 | 2026-09-30 12:51:56.372 |
| create |
C:\Users\user\Documents\Dungeons 2 Skin Loader\gamefolder.txt
|
Dungeons2SkinLoader.exe pid 1908 | 2026-09-30 12:51:56.372 |
| modify |
C:\Users\user\Documents\Dungeons 2 Skin Loader\config.txt
|
- | 2026-09-30 12:51:56.372 |
| setvalue |
System\CurrentControlSet\Services\BITS
Start = 2
|
- | not timed |
No operations match your filter.
External reputation was not produced for this scan. Threat intelligence enrichment is a paid-plan layer: every extracted indicator - hashes, addresses, hostnames - is checked against the external reputation services. Our own ingested feeds ran on this scan and every result below is theirs. Adding the paid layer adds an external reputation verdict on each indicator, so MalwareBazaar and filescan.io are listed below as not checked. See plans.
File reputation
4 clear · 2 not checked| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| MalwareBazaar hash feed | File hash | clean | not in feed | 3,387 records 8 minutes ago |
| MalwareBazaar ransomware feed | File hash | clean | not in feed | 3,348 records 3 hours ago |
| ThreatFox hash IOCs | File hash | clean | not in feed | 1,689 records 9 minutes ago |
| URLhaus payload hashes | File hash | clean | not in feed | 1,310 records 8 minutes ago |
| filescan.io | File hash | not checked | no hash lookup ran for this scan | live lookup |
| MalwareBazaar | File hash | not checked | no hash lookup ran for this scan | live lookup |
Hash lookups only - the sample itself is never uploaded to any third party.
Network indicators
nothing of this kind to check| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| blocklist.de | IP / domain / URL | not checked | no IP, domain or URL observed to check | 26.3k records 8 minutes ago |
| CINS Army | IP / domain / URL | not checked | no IP, domain or URL observed to check | 15k records 8 minutes ago |
| Emerging Threats | IP / domain / URL | not checked | no IP, domain or URL observed to check | 511 records 9 minutes ago |
| Feodo Tracker | IP / domain / URL | not checked | no IP, domain or URL observed to check | 5 records 9 minutes ago |
| IPsum | IP / domain / URL | not checked | no IP, domain or URL observed to check | 18.4k records 9 minutes ago |
| Phishing.Database | IP / domain / URL | not checked | no IP, domain or URL observed to check | 391.5k records 3 hours ago |
| ThreatFox | IP / domain / URL | not checked | no IP, domain or URL observed to check | 1,689 records 9 minutes ago |
| URLhaus | IP / domain / URL | not checked | no IP, domain or URL observed to check | no records ingested |
TLS fingerprints
nothing of this kind to check| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| JA3 / JA4 fingerprint blocklists | JA3 / JA4 | not checked | no TLS client fingerprint observed | 97 records 10 hours ago |
| SSL blocklist | Server certificate | not checked | no server certificate fingerprint is extracted to check | live lookup |
Detection rules
2 clear| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| Sigma rules | Behavior log | clean | - | 2,275 records 6 hours ago |
| Signature rules | Sample content | clean | 3 structural rules matched (file properties, not findings) | 110 records 9 minutes ago |
Tooling catalogs
4 clear| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| LOLBAS | Process image paths | clean | 1 process image path, none masqueraded | 245 records 9 minutes ago |
| LOLBootloaders | File hash | clean | not a known vulnerable bootloader | 520 records 8 minutes ago |
| LOLDrivers | File hash | clean | not a known vulnerable driver | 2,346 records 9 minutes ago |
| LOLRMM | Names and domains | clean | 2 name/domain indicators checked, no remote-management tooling | 358 records 8 minutes ago |
AI analysis
The AI layer is a paid-plan feature. It reads what the other layers produced - the behaviour summary, the call sequence, the indicator list - and writes the narrative and the kill-chain walkthrough.
Nothing is being withheld. This layer did not run for this scan, so there is no result stored behind the lock.
File indicators
3| Severity | Type | Indicator | Description |
|---|---|---|---|
| info | sample_sha256 | 49ed8bfb44aa2c55203abf8b758bae24d1cdbdd3f906c49cadcb061aa4d613f3 | Submitted sample (SHA256) |
| info | sample_md5 | fb3c94e7e8ead26551ba36959c5f13e5 | Submitted sample (MD5) |
| info | imphash | f34d5f2d4577ed6d9ceec516c1f5a744 | Import table hash (imphash) |
Sigma detections
0 matches of 2275 rulesThe Sigma corpus was evaluated against this run's processes, registry, file, network, DNS and script activity. Nothing matched.
Generated rules
No generated rules
Detection rules are auto-generated after analysis.
Extracted files
What came out of the sample: unpacked payloads, carved objects and captured memory. Each one is stored by content hash, so the same object extracted twice is the same row.
No extracted files
Nothing was unpacked or carved out of this sample. Packed samples, documents with embedded objects and installers are the ones that usually produce artifacts here.
Export & download
/s/2589Structured exports for your SIEM/TIP - ATT&CK Navigator layer, STIX 2.1 bundle, MISP event and a defanged IOC list - are free on every report. The packet capture follows this scan's plan, because a capture is the rawest network output this platform produces.
Analysis report
PDF and DOCX reports are available to signed-in accounts on every plan, free included. Sign in to generate one.
Headers
Body
Headers
Body
You are about to download the raw, live sample. It is real, potentially destructive malware and can harm your machine if opened or run. Only handle it inside an isolated analysis environment.
Delivered as a ZIP encrypted with the password infected so the bytes are never handled unprotected.
Report this analysis
Analysis reports are produced automatically from files, addresses and text submitted by visitors. If this one publishes your material, identifies you, or should not be public for any other reason, tell us why and an administrator will review it.
Public analyses of this file
1 run| Submitted | Environment | Verdict | Score |
|---|---|---|---|
| 2026-09-30 12:51 Shown below | Windows 10 22H2 | Nothing conclusive | 4/100 |