ZuLauncher.exePE analysis report - Suspicious
Run integrity
sample ranThe guest staged the sample and launched it, so what follows describes this file rather than an empty desktop.
Suspicious
56/100
21 points past the suspicious line at 35, 14 short of malicious at 70.
Why this verdict
- 1 high-risk capability(ies): reflective code loading
- 4 supporting capabilities in one unsigned binary: file discovery, process discovery, registry query, system information
- Malicious strings: injection / execution, ransomware
- .NET source: Downloads and executes a remote payload
- Local ML score 99.0
- findings review (advisory, not scored): suspicious - proxy and winhttp settings write, registry persistence-style key creation, c2-style http and tcp capability, unsigned dotnet launcher
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.
- HIGH Boot configuration tamper (bcdedit-style via API)
- HIGH Injection/execution API strings
- HIGH Ransomware-related strings
Analysis layers
Detection signatures
13 detected · 1 withheld as common| Severity | Detection | Evidence | Layer |
|---|---|---|---|
| HIGH |
.NET source: Downloads and executes a remote payload
MITRE T1105
|
- | dynamic |
| HIGH |
Boot configuration tamper (bcdedit-style via API)
MITRE T1490
|
string
bcdedit
found in the sample's strings
|
static |
| HIGH |
Injection/execution API strings
MITRE T1055
|
string
bypass
matched string
string
downloadstring
matched string
string
frombase64string
matched string
|
static |
| HIGH |
Ransomware-related strings
MITRE T1486
|
string
.crypt
matched string
string
bcdedit /set
matched string
|
static |
| MED |
.NET source: Registry Run-key / startup persistence
MITRE T1547.001
|
- | dynamic |
| MED |
Credential-theft artifacts (browser/wallet paths)
MITRE T1555
|
string
logins
matched string
|
static |
| MED |
Elevated re-launch (ShellExecute runas)
MITRE T1548.002
|
string
shellexecute
found in the sample's strings
string
runas
found in the sample's strings
|
static |
| MED |
Surveillance/keylogging strings
MITRE T1056
|
string
getdc
matched string
|
static |
| LOW |
.NET source: Heavy string obfuscation / protector
MITRE T1027
|
- | dynamic |
| LOW |
Executes via ShellExecute
MITRE T1204
seen in 12% of benign software
|
string
shellexecute
found in the sample's strings
|
static |
| LOW |
Hides its window (ShowWindow SW_HIDE pattern)
MITRE T1564.003
seen in 13% of benign software
|
string
showwindow
found in the sample's strings
|
static |
| LOW |
Screen-capture capability
MITRE T1113
seen in 8% of benign software
|
capability
getdc
capability: screen_capture
|
static |
| INFO |
.NET managed assembly (decompiled)
|
- | static |
These rules matched this sample, and they also match this much of known-clean software (measured over 1145 signed Windows and third-party binaries). A rule that fires on most clean files cannot move a verdict, so it is held back unless the detonation confirms the behaviour. They are listed because a count that shrinks without saying so is not a count an analyst can check.
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
Structure only. Structural evidence only. Nothing matching this verdict was seen running. The one fact that decided it: capability analysis of the file's imports.
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 matched signature set 28148 - 3.6M signaturesNothing 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.
| Signature set | Value |
|---|---|
| Set version | 28148 |
| Signatures in the set | 3,642,847 |
| Set published | 09 Oct 2026 06:25 +0000 |
| Age when this file was scanned | same day |
A negative answer is only as good as the signature set that gave it, so the set is recorded with the result and the result can be reproduced against it.
Local ML assessment
99.0 of 100 8 strongest of 2568 featuresA gradient-boosted model running entirely on this host scored this file 99.0 of 100 on structure alone: its headers, sections, imports, strings and signature. The file was not executed and nothing about it left this machine.
Read this as corroboration and not as a verdict. Measured across this corpus the model separates signed software from unsigned software more sharply than malicious from benign, so it is charged at most 15 of 100 verdict points and only on top of evidence this report measured for itself. The eight features below are the ones that moved it furthest.
| Structural feature | What it means | Pushes | Weight |
|---|---|---|---|
| image flag dll | Image flag: a library rather than a program | towards malicious | +1.4682 |
| parser warning: Suspicious flags set for section... | Header defect reported by the parse: Suspicious flags set for section... (0) | towards benign | -0.6095 |
| optional.checksum | Header checksum, which is zero on most files that were never signed (0) | towards malicious | +0.4753 |
| imported function count | Number of functions imported from other libraries (1) | towards malicious | +0.4389 |
| coff.timestamp | Build timestamp recorded in the header (1791330944) | towards malicious | +0.3645 |
| debug directory size | Size of the debug table (0) | towards malicious | +0.3529 |
| feature column 632 | Text in the file matching a base64 blob | towards malicious | +0.3479 |
| feature column 2478 | When a timestamp authority countersigned the signature | towards malicious | +0.3135 |
A weight is a log-odds nudge away from the model's own baseline, not a percentage point. Where a feature names a section, an import or a build id, the number beside it is the model's own hashed cell for that name rather than a measurement of the file: two names can share one cell and the sign comes from the hash, so no number is shown for those rows.
- .NET managed binary (no obfuscator signature matched)
Family configuration search
Incomplete2 of this platform's 71 family parsers could not decode this file, and none produced a configuration. A parser that carries no signature of its own is handed every file, and every parser that has ever failed here is one of those, so a failure is usually a decoder meeting a family it was not written for rather than a reading about this sample. Where the two numbers below differ, a signature did match and its decoder then returned nothing. The absence of a configuration is not evidence that none is present.
| Parsers available | 71 |
|---|---|
| Returned a result | 2 |
| Failed to decode | 2 |
Secrets & malicious strings
7 flagged stringsFlagged string categories
| Indicator | Found in | Evidence from the sample |
|---|---|---|
| bypass | extracted string | -NoProfile -ExecutionPolicy Bypass -Command " |
| downloadstring | raw bytes | present in the file bytes only |
| frombase64string | raw bytes | present in the file bytes only |
| Indicator | Found in | Evidence from the sample |
|---|---|---|
| .crypt | extracted string | System.Security.Cryptography |
| bcdedit /set | extracted string | Windows enforces DEP for every program (AlwaysOn), which can stop the game. Run as administrator: bcdedit /set nx OptIn, then restart Windows. |
| Indicator | Found in | Evidence from the sample |
|---|---|---|
| logins | extracted string | loginsvr.exe |
| Indicator | Found in | Evidence from the sample |
|---|---|---|
| getdc | raw bytes | present in the file bytes only |
Capabilities
3 behaviour buckets| Severity | Capability | MITRE | APIs |
|---|---|---|---|
| med | Code execution Creates processes / runs commands or shellcode |
T1059 | system, wscript.shell |
| med | Screen capture Grabs the screen / clipboard |
T1113 | getdc |
| med | Evasion / stalling Sleeps, times, or otherwise stalls analysis |
T1497.003 | sleep |
Security mitigations
partial posture.NET managed
| Assembly | ZuLauncher 1.0.0.0 |
|---|---|
| Streams | #~ #Strings #US #GUID #Blob |
| P/Invoke | 15 unmanaged import(s): CloseHandle, EnumDisplaySettings, GetDC, GetDeviceCaps, GetExtendedTcpTable, GetSystemDEPPolicy, GetWindowLong, GetWindowRect, Op… |
Sections
3 sections · the file's memory layout| Section | Virtual addr | Raw size | Virtual size | Access | Entropy |
|---|---|---|---|---|---|
|
.textEP
Executable code
|
0x2000 |
94.0 KB
|
93.6 KB
|
EXECUTEREAD
|
5.6968
|
|
.rsrc
Resources
|
0x1a000 |
3.5 KB
|
3.2 KB
|
READ
|
4.563
|
|
.reloc
Base relocations
|
0x1c000 |
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 | 20.0 B |
| RVA offset | 0x1a7e8 |
| Content signature | Icon |
| MD5 | e113b50b534c1cf282bd8b50aa427dfe |
| Entropy | 2.223 |
| Type | Icon |
|---|---|
| Name / ID | 2 |
| Language | NEU |
| Size | 744.0 B |
| RVA offset | 0x1a500 |
| Content signature | Icon |
| MD5 | 9f4d765475e3ffba326f0faefe947d52 |
| Entropy | 3.891 |
| Type | Manifest |
|---|---|
| Name / ID | 1 |
| Language | NEU |
| Size | 1.2 KB |
| RVA offset | 0x1a800 |
| Content signature | XML manifest |
| MD5 | 7da64d71c46841182a3ae944f31f61b8 |
| Entropy | 5.198 |
<?xml version="1.0" encoding="utf-8"?>
<!-- Embedded by build.ps1 (/win32manifest). asInvoker: the launcher never needs admin rights, and without a manifest
Windows' installer detection may ask for elevation. The only elevated step (the DEP fix) asks on its own. -->
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="ZuOnline.Launcher" type="win32" processorArchitecture="x86" />
<description>Zu Online Launcher</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> <!-- Windows 7 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> <!-- Windows 8 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> <!-- Windows 8.1 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> <!-- Windows 10 / 11 -->
</application>
</compatibility>
</assembly>
| Type | Version Info |
|---|---|
| Name / ID | 1 |
| Language | NEU |
| Size | 972.0 B |
| RVA offset | 0x1a130 |
| Content signature | Version Info |
| MD5 | ee76524c1ad00dd200a9c6748fcc3f3a |
| Entropy | 3.293 |
| Comments | Zu Online Launcher - installs, updates and starts the Zu Online game client. |
|---|---|
| CompanyName | Zu Online |
| FileVersion | 1.0.0.0 |
| ProductName | Zu Online |
| InternalName | ZuLauncher.exe |
| LegalCopyright | Zu Online - zu-online.online |
| ProductVersion | 1.0.0.0 |
| FileDescription | Zu Online Launcher |
| Assembly Version | 1.0.0.0 |
| OriginalFilename | ZuLauncher.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 |
|---|---|---|---|
| variant | Bind Remover.exe | Malicious | TLSH distance 62 · identical import table (imphash) |
| related | Server.exe | Malicious | identical import table (imphash) |
| related | svchost_update.exe | Malicious | identical import table (imphash) |
| related | CrackPotassium.exe | Malicious | identical import table (imphash) |
| related | MetaDataStringEditor.exe | No threats detected | identical import table (imphash) |
| related | WeMod Geometry Dash Setup.exe | No threats detected | identical import table (imphash) |
| related | dotnet_b64_3des_cbc_to_404keylo… | Malicious | identical import table (imphash) |
| related | START.exe | Suspicious | identical import table (imphash) |
| related | cr-keygen.exe | Malicious | identical import table (imphash) |
| related | dfsvc.exe | No threats detected | identical import table (imphash) |
| related | XIAOMI BOOTLOADER TOOL.exe | Suspicious | identical import table (imphash) |
| related | VM.v2.1.exe | Malicious | identical import table (imphash) |
| related | IronCrownSetup (2).exe | Malicious | identical import table (imphash) |
| related | M4R7HGroup.exe | Suspicious | identical import table (imphash) |
| related | AlyxMP-Setup.exe | Suspicious | identical import table (imphash) |
| related | SpyTeam.exe | Suspicious | identical import table (imphash) |
| related | Dungeons2SkinLoader.exe | No threats detected | identical import table (imphash) |
| related | EndcordInstaller.exe | Malicious | identical import table (imphash) |
| related | Capri-Setup.exe | Malicious | identical import table (imphash) |
| related | Capri-Setup.exe | Malicious | identical import table (imphash) |
| related | Capri-Setup.exe | Malicious | identical import table (imphash) |
| related | XWorm V3.1.exe | Malicious | identical import table (imphash) |
Capability detection
47 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 |
|---|---|
| create process in .NET | host-interaction/process/create |
| read file in .NET | host-interaction/file-system/read |
| write file in .NET | host-interaction/file-system/write |
| create or open mutex on Windows | host-interaction/mutex |
| create or open registry key | - |
| create thread | host-interaction/thread/create |
| suspend thread | host-interaction/thread/suspend |
| list TCP connections and listeners | collection/network |
| open process | - |
| get OS version in .NET | host-interaction/os/version |
| set registry value | host-interaction/registry/create |
| query or enumerate registry value | host-interaction/registry |
| unmanaged call | runtime |
| create a process with modified I/O handles and window | host-interaction/process/create |
| terminate process | host-interaction/process/terminate |
| query or enumerate registry key | host-interaction/registry |
| check if file exists | host-interaction/file-system/exists |
| get file size | host-interaction/file-system/meta |
| move file | host-interaction/file-system/move |
| create directory | host-interaction/file-system/create |
| delete file | host-interaction/file-system/delete |
| delete registry value | host-interaction/registry/delete |
| create HTTP request | communication/http/client |
| send HTTP request | communication/http/client |
| send data | communication |
| receive HTTP response | communication/http/client |
| get disk size | host-interaction/hardware/storage |
| get disk information | host-interaction/hardware/storage |
| get common file path | host-interaction/file-system |
| copy file | host-interaction/file-system/copy |
| invoke .NET assembly method | load-code/dotnet |
| generate random numbers in .NET | data-manipulation/prng |
| save image in .NET | collection |
| find process by name | host-interaction/process/list |
| decode data using Base64 in .NET | data-manipulation/encoding/base64 |
| read data from Internet | communication/http/client |
| receive data | communication |
| manipulate unmanaged memory in .NET | host-interaction/memory |
| allocate unmanaged memory in .NET | host-interaction/memory |
| find data using regex in .NET | data-manipulation/regex |
| write clipboard data | host-interaction/clipboard |
| act as TCP client | communication/tcp/client |
| terminate process by name in .NET | host-interaction/process/terminate |
| manipulate console buffer | host-interaction/console |
| set current directory | host-interaction/file-system |
| 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 1328- !This program cannot be run in DOS mode.
- .text
- `.rsrc
- @.reloc
- prJA
- #Strings
- #GUID
- <Module>
- ZuLauncher.exe
- GameWindow
- ZuLauncher
- RECT
- Installer
- Entry
- Theme
- ButtonKind
- UiButton
- Mote
- LauncherForm
- VerificationException
- Security
- WinTrustFileInfo
- WinTrustData
- Display
- DEVMODE
- SystemCheckForm
- State
- Item
- GameTunnel
- Program
- Paths
- IniFile
- LauncherConfig
- GameServer
- ServerList
- NewsItem
- News
- ManifestEntry
- Updater
- SettingsForm
- mscorlib
- System
- ValueType
- Enum
- System.Windows.Forms
- Form
- Exception
- GWL_STYLE
- WS_CAPTION
- WS_THICKFRAME
- WS_SYSMENU
- WS_MINIMIZEBOX
- WS_MAXIMIZEBOX
- SWP_FRAMECHANGED
- SWP_NOZORDER
- SWP_SHOWWINDOW
- GetWindowLong
- SetWindowLong
- SetWindowPos
- GetWindowRect
- MarkDpiAware
- MergeFlags
- GetSystemDEPPolicy
- DepPolicy
- IsDpiAware
- System.Diagnostics
- Process
- System.Drawing
- Rectangle
- MakeBorderless
- Marker
- ClientPresent
- Unfinished
- System.Collections.Generic
- Dictionary`2
- ReadVerified
- AddVerified
- List`1
- FetchList
- Action`2
- Install
- Wait
- SetReg
- LastDir
- DownloadOne
- SavedInstallDir
- TargetFor
- Validate
- Finish
- Nullable`1
- IWin32Window
- Confirm
- CreateShortcut
- Path
- Size
- .ctor
- Color
- Teal
- Teal2
- Gold
- Gold2
- Text
- Line
- System.Drawing.Drawing2D
- GraphicsPath
- RectangleF
- Round
- Graphics
- Glass
- Font
- StringAlignment
- Draw
- GoldText
- value__
- Primary
- Ghost
- Link
- Window
- Bounds
- Label
- Kind
- Action
- Click
- Enabled
- Hover
- HoverTarget
- Paint
- MaxClients
- buttons
- ToolTip
- Timer
- anim
- statusTimer
- Random
- motes
- PointF
- ridges
- scale
- Bitmap
- btnRepair
- servers
- news
- newsScroll
- hoverServer
- hoverNews
- status
- progress
- shownProgress
- busy
- updateOk
- installed
- phase
- mouse
- Point
- dragFrom
- dragging
- serverPanel
- newsPanel
- portraitRect
- portrait
- Classes
- get_NewsClip
- ServerRow
- fTitle
- fSmall
- FadeIn
- BuildScene
- LoadArt
- PaintPortrait
- Tick
- BuildButtons
- PaintEventArgs
- OnPaint
- Render
- PaintServers
- PaintNews
- PaintBottom
- SaveSnapshot
- HitButton
- HitServer
- HitNews
- MouseEventArgs
- OnMouseMove
- EventArgs
- OnMouseLeave
- OnMouseDown
- OnMouseUp
- OnMouseDoubleClick
- OnMouseWheel
- KeyEventArgs
- closing
- FormClosingEventArgs
- OnFormClosing
- LoadRemote
- RefreshStatus
- StartUpdateCheck
- Play
- StartGame
- WatchStart
- ShowSettings
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.
Import fingerprint
no related sample| Fingerprint | 3:rGsLdAIEK:tf |
|---|---|
| Imports read | 1 function from 1 library (1 distinct) |
| Comparable | no (fewer than 8 distinct imports) |
No comparison was run: this import table is not distinctive enough for a match to mean anything.
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
3 findings C# 30 types · 5002 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 |
|---|---|---|
| high | Downloads and executes a remote payload | T1105 |
| med | Registry Run-key / startup persistence | T1547.001 |
| low | Heavy string obfuscation / protector | T1027 |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;
[assembly: AssemblyProduct("Zu Online")]
[assembly: AssemblyCopyright("Zu Online - zu-online.online")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyCompany("Zu Online")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyDescription("Zu Online Launcher - installs, updates and starts the Zu Online game client.")]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyTitle("Zu Online Launcher")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ZuLauncher;
internal static class GameWindow
{
private struct RECT
{
public int L;
public int T;
public int R;
public int B;
}
private const int GWL_STYLE = -16;
private const int WS_CAPTION = 12582912;
private const int WS_THICKFRAME = 262144;
private const int WS_SYSMENU = 524288;
private const int WS_MINIMIZEBOX = 131072;
private const int WS_MAXIMIZEBOX = 65536;
private const uint SWP_FRAMECHANGED = 32u;
private const uint SWP_NOZORDER = 4u;
private const uint SWP_SHOWWINDOW = 64u;
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr h, int i);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr h, int i, int v);
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr h, IntPtr after, int x, int y, int cx, int cy, uint f);
[DllImport("user32.dll")]
private static extern bool GetWindowRect(IntPtr h, out RECT r);
public static void MarkDpiAware(string exe)
{
try
{
using RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers");
registryKey?.SetValue(exe, MergeFlags(string.Concat(registryKey.GetValue(exe)), "HIGHDPIAWARE", "DisableNXShowUI"));
}
catch
{
}
}
private static string MergeFlags(string current, params string[] add)
{
List<string> list = new List<string>();
string[] array = current.Split(new char[1] { ' ' });
foreach (string text in array)
{
if (text.Length > 0 && text != "~" && !list.Contains(text))
{
list.Add(text);
}
}
foreach (string item in add)
{
if (!list.Contains(item))
{
list.Add(item);
}
}
return "~ " + string.Join(" ", list.ToArray());
}
[DllImport("kernel32.dll")]
private static extern int GetSystemDEPPolicy();
public static int DepPolicy()
{
try
{
return GetSystemDEPPolicy();
}
catch
{
return -1;
}
}
public static bool ApplyDepFix(string exe)
{
string text = "Set-ProcessMitigation -Name ZuOnline.exe -Disable DEP -ErrorAction SilentlyContinue; if (-not (Test-Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers')) { New-Item -Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers' | Out-Null }; Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers' -Name '" + exe.Replace("'", "''") + "' -Value '~ DisableNXShowUI'";
try
{
ProcessStartInfo processStartInfo = new ProcessStartInfo("powershell.exe", "-NoProfile -ExecutionPolicy Bypass -Command \"" + text + "\"");
processStartInfo.Verb = "runas";
processStartInfo.UseShellExecute = true;
processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ProcessStartInfo startInfo = processStartInfo;
using (Process process = Process.Start(startInfo))
{
process.WaitForExit(60000);
}
MarkDpiAware(exe);
return true;
}
catch
{
return false;
}
}
public static bool IsDpiAware(string exe)
{
try
{
using RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers");
return registryKey != null && string.Concat(registryKey.GetValue(exe)).Contains("HIGHDPIAWARE");
}
catch
{
return false;
}
}
public static void MakeBorderless(Process game, Rectangle screen)
{
Thread thread = new Thread((ThreadStart)delegate
{
try
{
DateTime dateTime = DateTime.Now.AddSeconds(90.0);
int num = 0;
while (DateTime.Now < dateTime && !game.HasExited && num < 20)
{
Thread.Sleep(500);
game.Refresh();
IntPtr mainWindowHandle = game.MainWindowHandle;
if (!(mainWindowHandle == IntPtr.Zero))
{
int windowLong = GetWindowLong(mainWindowHandle, -16);
GetWindowRect(mainWindowHandle, out var r);
if (((uint)windowLong & 0xC00000u) != 0 || r.L != screen.X || r.T != screen.Y || r.R - r.L != screen.Width || r.B - r.T != screen.Height)
{
SetWindowLong(mainWindowHandle, -16, windowLong & -13565953);
SetWindowPos(mainWindowHandle, IntPtr.Zero, screen.X, screen.Y, screen.Width, screen.Height, 100u);
num = 0;
}
else
{
num++;
}
}
}
}
catch
{
}
});
thread.IsBackground = false;
thread.Start();
}
}
internal static class Installer
{
private class Entry
{
public string Sha1;
public string Path;
public long Size;
}
private const string Marker = ".zu_install";
private const string RegKey = "Software\\Zu Online";
public static bool ClientPresent(string dir)
{
if (File.Exists(Path.Combine(dir, "ZuOnline.exe")) && File.Exists(Path.Combine(dir, "data.rez")))
{
return !File.Exists(Path.Combine(dir, ".zu_install"));
}
return false;
}
public static bool Unfinished(string dir)
{
if (dir != null)
{
return File.Exists(Path.Combine(dir, ".zu_install"));
}
return false;
}
private static Dictionary<string, string[]> ReadVerified(string dir)
{
Dictionary<string, string[]> dictionary = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
string path = Path.Combine(dir, ".zu_install");
if (File.Exists(path))
{
string[] array = File.ReadAllLines(path);
foreach (string text in array)
{
string[] array2 = text.Split(new char[1] { '\t' });
if (array2.Length == 4)
{
dictionary[array2[0]] = array2;
}
}
}
return dictionary;
}
private static void AddVerified(string dir, string rel, string sha)
{
FileInfo fileInfo = new FileInfo(Path.Combine(dir, rel));
File.AppendAllText(Path.Combine(dir, ".zu_install"), rel + "\t" + fileInfo.Length + "\t" + fileInfo.LastWriteTimeUtc.Ticks + "\t" + sha + Environment.NewLine);
}
private static List<Entry> FetchList(string baseUrl, out long total)
{
string text = Security.FetchSigned(baseUrl + "launcher/client.txt");
List<Entry> list = new List<Entry>();
total = 0L;
string[] array = text.Split(new char[1] { '\n' });
foreach (string text2 in array)
{
string[] array2 = text2.TrimEnd(new char[1] { '\r' }).Split(new char[1] { '\t' });
if (array2.Length == 3)
{
if (!Updater.InsideDir("C:\\zu-check", array2[2]) || array2[2].Contains(".."))
{
throw new IOException("Rejected file list entry: " + array2[2]);
}
Entry entry = new Entry();
entry.Sha1 = array2[0];
entry.Size = long.Parse(array2[1]);
entry.Path = array2[2];
Entry entry2 = entry;
list.Add(entry2);
total += entry2.Size;
}
}
if (list.Count == 0)
{
throw new IOException("The file list is empty.");
}
return list;
}
private static string Sha1Of(string file)
{
using FileStream inputStream = File.OpenRead(file);
using SHA1 sHA = SHA1.Create();
return BitConverter.ToString(sHA.ComputeHash(inputStream)).Replace("-", "").ToLowerInvariant();
}
public static void Install(string baseUrl, string dir, Action<string, int> progress)
{
long total;
List<Entry> list = FetchList(baseUrl, out total);
Directory.CreateDirectory(dir);
if (!File.Exists(Path.Combine(dir, ".zu_install")))
{
File.WriteAllText(Path.Combine(dir, ".zu_install"), "");
}
SetReg("PendingDir", dir);
Dictionary<string, string[]> dictionary = ReadVerified(dir);
long done = 0L;
Stopwatch sw = Stopwatch.StartNew();
long downloaded = 0L;
long lastReport = -1000L;
foreach (Entry e in list)
{
string text = Path.Combine(dir, e.Path);
string text2 = text + ".download";
Directory.CreateDirectory(Path.GetDirectoryName(text));
if (File.Exists(text))
{
FileInfo fileInfo = new FileInfo(text);
if (dictionary.TryGetValue(e.Path, out var value) && value[3] == e.Sha1 && value[1] == fileInfo.Length.ToString() && value[2] == fileInfo.LastWriteTimeUtc.Ticks.ToString())
{
done += e.Size;
continue;
}
if (fileInfo.Length == e.Size)
{
progress("Checking " + e.Path, (int)(done * 100 / total));
if (Sha1Of(text) == e.Sha1)
{
AddVerified(dir, e.Path, e.Sha1);
done += e.Size;
continue;
}
}
}
int num = 1;
while (true)
{
try
{
DownloadOne(baseUrl, e, text2, delegate(long fileBytes, long chunk)
{
downloaded += chunk;
if (sw.ElapsedMilliseconds - lastReport >= 200)
{
lastReport = sw.ElapsedMilliseconds;
double num2 = (double)downloaded / 1048576.0 / Math.Max(0.001, sw.Elapsed.TotalSeconds);
progress($"Downloading {e.Path} {(double)(done + fileBytes) / 1073741824.0:0.00} / {(double)total / 1073741824.0:0.00} GB {num2:0.0} MB/s", (int)((done + fileBytes) * 100 / total));
}
});
if (Sha1Of(text2) != e.Sha1)
{
File.Delete(text2);
throw new IOException("checksum mismatch for " + e.Path);
}
}
catch (WebException ex)
{
if (num >= 10)
{
throw;
}
Wait(progress, ex.Message, num);
goto IL_02c8;
}
catch (IOException ex2)
{
if (num >= 10)
{
throw;
}
Wait(progress, ex2.Message, num);
goto IL_02c8;
}
break;
IL_02c8:
num++;
}
if (File.Exists(text))
{
File.Delete(text);
}
File.Move(text2, text);
AddVerified(dir, e.Path, e.Sha1);
done += e.Size;
}
progress("Installation complete.", 100);
}
private static void Wait(Action<string, int> progress, string why, int attempt)
{
int num = Math.Min(30, 3 * attempt);
progress("Connection problem (" + why + "). Retrying in " + num + " s... (attempt " + (attempt + 1) + " of 10)", -1);
Thread.Sleep(num * 1000);
}
private static void SetReg(string name, string value)
{
try
{
using RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("Software\\Zu Online");
if (value == null)
{
registryKey.DeleteValue(name, throwOnMissingValue: false);
}
else
{
registryKey.SetValue(name, value);
}
}
catch (Exception ex)
{
Program.Log(ex);
}
}
public static string LastDir()
{
try
{
using RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Zu Online");
return (registryKey == null) ? null : ((registryKey.GetValue("PendingDir") as string) ?? (registryKey.GetValue("InstallDir") as string));
}
catch
{
return null;
}
}
private static void DownloadOne(string baseUrl, Entry e, string tmp, Action<long, long> onBytes)
{
long num = (File.Exists(tmp) ? new FileInfo(tmp).Length : 0);
if (num > e.Size)
{
File.Delete(tmp);
num = 0L;
}
if (num == e.Size)
{
return;
}
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(baseUrl + "launcher/client/" + e.Path.Replace('\\', '/') + "?v=" + e.Sha1);
httpWebRequest.ReadWriteTimeout = 60000;
if (num > 0)
{
httpWebRequest.AddRange(num);
}
using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
bool flag = num > 0 && httpWebResponse.StatusCode == HttpStatusCode.PartialContent;
if (!flag)
{
num = 0L;
}
using Stream stream = httpWebResponse.GetResponseStream();
using FileStream fileStream = new FileStream(tmp, flag ? FileMode.Append : FileMode.Create, FileAccess.Write);
byte[] array = new byte[262144];
long num2 = num;
int num3;
while ((num3 = stream.Read(array, 0, array.Length)) > 0)
{
fileStream.Write(array, 0, num3);
num2 += num3;
onBytes(num2, num3);
}
if (num2 != e.Size)
{
throw new IOException("incomplete download of " + e.Path);
}
}
public static string SavedInstallDir()
{
try
{
using RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Zu Online");
return (registryKey == null) ? null : (registryKey.GetValue("InstallDir") as string);
}
catch
{
return null;
}
}
public static string TargetFor(string picked)
{
if (!Path.GetFileName(picked.TrimEnd(new char[1] { '\\' })).Equals("Zu Online", StringComparison.OrdinalIgnoreCase))
{
return Path.Combine(picked, "Zu Online");
}
return picked.TrimEnd(new char[1] { '\\' });
}
public static string Validate(string dir)
{
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
string folderPath2 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
if (dir.StartsWith(folderPath, StringComparison.OrdinalIgnoreCase) || (folderPath2.Length > 0 && dir.StartsWith(folderPath2, StringComparison.OrdinalIgnoreCase)))
{
return "Please choose a folder outside Program Files (the game writes its settings next to itself).";
}
try
{
DriveInfo driveInfo = new DriveInfo(Path.GetPathRoot(dir));
if (driveInfo.AvailableFreeSpace < 3984588800u)
{
return "Not enough free space on " + driveInfo.Name + " (about 3.5 GB needed).";
}
Directory.CreateDirectory(dir);
string path = Path.Combine(dir, ".zu_write_test");
File.WriteAllText(path, "");
File.Delete(path);
}
catch (Exception ex)
{
return "Cannot use this folder: " + ex.Message;
}
return null;
}
public static void Finish(string dir, string serverHost, bool shortcut)
{
string text = Path.Combine(dir, "ZuLauncher.exe");
if (!File.Exists(text))
{
File.Copy(Application.ExecutablePath, text);
}
IniFile iniFile = new IniFile(Path.Combine(dir, "launcher.ini"));
iniFile.Set("launcher", "ServerHost", serverHost);
iniFile.Save();
SetReg("InstallDir", dir);
SetReg("PendingDir", null);
File.Delete(Path.Combine(dir, ".zu_install"));
if (shortcut)
{
CreateShortcut(text);
}
}
public static bool? Confirm(IWin32Window owner, string dir)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Expected O, but got Unknown
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Invalid comparison between Unknown and I4
Form val = new Form();
try
{
((Control)val).Text = "Install Zu Online";
val.FormBorderStyle = (FormBorderStyle)3;
bool maximizeBox = (val.MinimizeBox = false);
val.MaximizeBox = maximizeBox;
val.StartPosition = (FormStartPosition)4;
val.ClientSize = new Size(460, 150);
((Control)val).Font = new Font("Segoe UI", 9.5f);
val.ShowInTaskbar = false;
ControlCollection controls = ((Control)val).Controls;
Label val2 = new Label();
((Control)val2).Text = "Zu Online will be installed in:\n" + dir + "\n\nAbout 3.2 GB will be downloaded.";
((Control)val2).Location = new Point(16, 12);
((Control)val2).Size = new Size(430, 70);
controls.Add((Control)(object)val2);
CheckBox val3 = new CheckBox();
((Control)val3).Text = "Create a desktop shortcut";
val3.Checked = true;
((Control)val3).Location = new Point(16, 84);
((Control)val3).AutoSize = true;
CheckBox val4 = val3;
Button val5 = new Button();
((Control)val5).Text = "Install";
val5.DialogResult = (DialogResult)1;
((Control)val5).Location = new Point(262, 112);
((Control)val5).Size = new Size(90, 28);
Button val6 = val5;
Button val7 = new Button();
((Control)val7).Text = "Cancel";
val7.DialogResult = (DialogResult)2;
((Control)val7).Location = new Point(358, 112);
((Control)val7).Size = new Size(90, 28);
Button val8 = val7;
((Control)val).Controls.AddRange((Control[])(object)new Control[3]
{
(Control)val4,
(Control)val6,
(Control)val8
});
val.AcceptButton = (IButtonControl)(object)val6;
val.CancelButton = (IButtonControl)(object)val8;
if ((int)val.ShowDialog(owner) != 1)
{
return null;
}
return val4.Checked;
}
finally
{
((IDisposable)val)?.Dispose();
}
}
public static void CreateShortcut(string exe)
{
try
{
string text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "Zu Online.lnk");
Type typeFromProgID = Type.GetTypeFromProgID("WScript.Shell");
object target = Activator.CreateInstance(typeFromProgID);
object obj = typeFromProgID.InvokeMember("CreateShortcut", BindingFlags.InvokeMethod, null, target, new object[1] { text });
Type type = obj.GetType();
type.InvokeMember("TargetPath", BindingFlags.SetProperty, null, obj, new object[1] { exe });
type.InvokeMember("WorkingDirectory", BindingFlags.SetProperty, null, obj, new object[1] { Path.GetDirectoryName(exe) });
type.InvokeMember("IconLocation", BindingFlags.SetProperty, null, obj, new object[1] { exe + ",0" });
type.InvokeMember("Save", BindingFlags.InvokeMethod, null, obj, null);
}
catch (Exception ex)
{
Program.Log(ex);
}
}
}
internal static class Theme
{
public static readonly Color Ink = Color.FromArgb(4, 19, 26);
public static readonly Color Teal = Color.FromArgb(70, 230, 220);
public static readonly Color Teal2 = Color.FromArgb(31, 159, 152);
public static readonly Color Gold = Color.FromArgb(255, 222, 160);
public static readonly Color Gold2 = Color.FromArgb(211, 154, 60);
public static readonly Color Text = Color.FromArgb(232, 241, 238);
public static readonly Color Dim = Color.FromArgb(143, 176, 170);
public static readonly Color Good = Color.FromArgb(124, 245, 154);
public static readonly Color Bad = Color.FromArgb(255, 122, 107);
public static readonly Color Line = Color.FromArgb(90, 90, 200, 190);
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 = Math.Min(rad * 2f, Math.Min(r.Width, r.Height));
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 Glass(Graphics g, RectangleF r, float rad, int alpha)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
GraphicsPath val = Round(r, rad);
try
{
SolidBrush val2 = new SolidBrush(Color.FromArgb(alpha, 6, 28, 34));
try
{
Pen val3 = new Pen(Line, 1f);
try
{
g.FillPath((Brush)(object)val2, val);
Region clip = g.Clip;
g.SetClip(val, (CombineMode)1);
LinearGradientBrush val4 = new LinearGradientBrush(new RectangleF(r.X, r.Y - 1f, r.Width, 42f), Color.FromArgb(18, 255, 255, 255), Color.FromArgb(0, 255, 255, 255), 90f);
try
{
g.FillRectangle((Brush)(object)val4, r.X, r.Y, r.Width, 40f);
}
finally
{
((IDisposable)val4)?.Dispose();
}
g.Clip = clip;
g.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
public static void Draw(Graphics g, string s, Font f, Color c, RectangleF r, StringAlignment h, StringAlignment v)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
StringFormat val = new StringFormat();
val.Alignment = h;
val.LineAlignment = v;
val.Trimming = (StringTrimming)3;
val.FormatFlags = (StringFormatFlags)4096;
StringFormat val2 = val;
try
{
SolidBrush val3 = new SolidBrush(c);
try
{
g.DrawString(s, f, (Brush)(object)val3, r, val2);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
public static void Draw(Graphics g, string s, Font f, Color c, RectangleF r)
{
Draw(g, s, f, c, r, (StringAlignment)0, (StringAlignment)1);
}
public static void GoldText(Graphics g, string s, Font f, RectangleF r, StringAlignment h)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
StringFormat val = new StringFormat();
val.Alignment = h;
val.LineAlignment = (StringAlignment)1;
val.FormatFlags = (StringFormatFlags)4096;
StringFormat val2 = val;
try
{
SolidBrush val3 = new SolidBrush(Color.FromArgb(60, 255, 190, 90));
try
{
g.DrawString(s, f, (Brush)(object)val3, new RectangleF(r.X, r.Y + 3f, r.Width, r.Height), val2);
}
finally
{
((IDisposable)val3)?.Dispose();
}
LinearGradientBrush val4 = new LinearGradientBrush(r, Color.FromArgb(255, 246, 221), Gold2, 90f);
try
{
g.DrawString(s, f, (Brush)(object)val4, r, val2);
}
finally
{
((IDisposable)val4)?.Dispose();
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
}
internal enum ButtonKind
{
Primary,
Ghost,
Link,
Window
}
internal class UiButton
{
public RectangleF Bounds;
public string Label;
public string Tip;
public ButtonKind Kind;
public Action Click;
public bool Enabled = true;
public bool Down;
public float Hover;
public bool HoverTarget;
public void Paint(Graphics g, Font font, double phase)
{
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Expected O, but got Unknown
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Expected O, but got Unknown
//IL_0537: Unknown result type (might be due to invalid IL or missing references)
//IL_053e: Expected O, but got Unknown
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Expected O, but got Unknown
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Expected O, but got Unknown
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Expected O, but got Unknown
//IL_0500: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Expected O, but got Unknown
RectangleF rectangleF = Bounds;
float hover = Hover;
if (Down)
{
rectangleF = new RectangleF(rectangleF.X, rectangleF.Y + 1f, rectangleF.Width, rectangleF.Height);
}
switch (Kind)
{
case ButtonKind.Primary:
{
GraphicsPath val7 = Theme.Round(rectangleF, rectangleF.Height / 2f);
try
{
if (Enabled)
{
float num3 = (float)(0.5 + 0.5 * Math.Sin(phase));
for (int num4 = 3; num4 >= 1; num4--)
{
RectangleF r = RectangleF.Inflate(rectangleF, num4 * 4, num4 * 4);
GraphicsPath val8 = Theme.Round(r, r.Height / 2f);
try
{
SolidBrush val9 = new SolidBrush(Color.FromArgb((int)((14f + 16f * num3 + 20f * hover) / (float)num4), 255, 210, 140));
try
{
g.FillPath((Brush)(object)val9, val8);
}
finally
{
((IDisposable)val9)?.Dispose();
}
}
finally
{
((IDisposable)val8)?.Dispose();
}
}
}
float num5 = (float)(phase * 20.0 % (double)(rectangleF.Width * 2f));
LinearGradientBrush val10 = new LinearGradientBrush(new RectangleF(rectangleF.X - num5, rectangleF.Y, rectangleF.Width * 2f, rectangleF.Height), Theme.Teal, Theme.Gold, 0f);
try
{
val10.WrapMode = (WrapMode)1;
if (!Enabled)
{
val10.LinearColors = new Color[2]
{
Color.FromArgb(40, 90, 88),
Color.FromArgb(90, 80, 60)
};
}
g.FillPath((Brush)(object)val10, val7);
}
finally
{
((IDisposable)val10)?.Dispose();
}
LinearGradientBrush val11 = new LinearGradientBrush(rectangleF, Color.FromArgb((int)(60f + 50f * hover), 255, 255, 255), Color.FromArgb(0, 255, 255, 255), 90f);
try
{
g.FillPath((Brush)(object)val11, val7);
}
finally
{
((IDisposable)val11)?.Dispose();
}
}
finally
{
((IDisposable)val7)?.Dispose();
}
Theme.Draw(g, Label, font, Enabled ? Color.FromArgb(6, 32, 38) : Color.FromArgb(150, 20, 40, 44), rectangleF, (StringAlignment)1, (StringAlignment)1);
break;
}
case ButtonKind.Ghost:
{
GraphicsPath val4 = Theme.Round(rectangleF, 12f);
try
{
SolidBrush val5 = new SolidBrush(Color.FromArgb((int)(150f + 60f * hover), 4, 20, 24));
try
{
Pen val6 = new Pen(Color.FromArgb((int)(90f + 140f * hover), 70, 230, 220), 1f);
try
{
g.FillPath((Brush)(object)val5, val4);
g.DrawPath(val6, val4);
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
finally
{
((IDisposable)val4)?.Dispose();
}
Theme.Draw(g, Label, font, Enabled ? Theme.Text : Theme.Dim, rectangleF, (StringAlignment)1, (StringAlignment)1);
break;
}
case ButtonKind.Link:
{
Color dim = Theme.Dim;
float num6 = (int)dim.R;
Color gold = Theme.Gold;
byte r2 = gold.R;
Color dim2 = Theme.Dim;
int red = (int)(num6 + (float)(r2 - dim2.R) * hover);
Color dim3 = Theme.Dim;
float num7 = (int)dim3.G;
Color gold2 = Theme.Gold;
byte g2 = gold2.G;
Color dim4 = Theme.Dim;
int green = (int)(num7 + (float)(g2 - dim4.G) * hover);
Color dim5 = Theme.Dim;
float num8 = (int)dim5.B;
Color gold3 = Theme.Gold;
byte b = gold3.B;
Color dim6 = Theme.Dim;
Color c = Color.FromArgb(red, green, (int)(num8 + (float)(b - dim6.B) * hover));
Theme.Draw(g, Label, font, c, rectangleF, (StringAlignment)1, (StringAlignment)1);
if (hover > 0.01f)
{
Pen val12 = new Pen(Color.FromArgb((int)(255f * hover), Theme.Teal), 2f);
try
{
g.DrawLine(val12, rectangleF.X + rectangleF.Width * (0.5f - 0.35f * hover), rectangleF.Bottom - 4f, rectangleF.X + rectangleF.Width * (0.5f + 0.35f * hover), rectangleF.Bottom - 4f);
break;
}
finally
{
((IDisposable)val12)?.Dispose();
}
}
break;
}
case ButtonKind.Window:
{
if (hover > 0.01f)
{
GraphicsPath val = Theme.Round(rectangleF, 8f);
try
{
SolidBrush val2 = new SolidBrush(Color.FromArgb((int)(140f * hover), (Label == "x") ? 200 : 60, (Label == "x") ? 60 : 90, (Label == "x") ? 50 : 100));
try
{
g.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
Pen val3 = new Pen(Theme.Text, 1.6f);
try
{
float num = rectangleF.X + rectangleF.Width / 2f;
float num2 = rectangleF.Y + rectangleF.Height / 2f;
if (Label == "x")
{
g.DrawLine(val3, num - 5f, num2 - 5f, num + 5f, num2 + 5f);
g.DrawLine(val3, num + 5f, num2 - 5f, num - 5f, num2 + 5f);
}
else if (Label == "?")
{
g.DrawEllipse(val3, num - 8f, num2 - 8f, 16f, 16f);
Theme.Draw(g, "?", font, Theme.Text, new RectangleF(rectangleF.X, rectangleF.Y + 1f, rectangleF.Width, rectangleF.Height), (StringAlignment)1, (StringAlignment)1);
}
else
{
g.DrawLine(val3, num - 6f, num2 + 1f, num + 6f, num2 + 1f);
}
break;
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
}
}
}
internal class Mote
{
public float X;
public float Y;
public float Vx;
public float Vy;
public float R;
public float P;
}
internal class LauncherForm : Form
{
private const int LW = 980;
private const int LH = 620;
public const int MaxClients = 3;
private readonly LauncherConfig cfg = LauncherConfig.Load();
private readonly List<UiButton> buttons = new List<UiButton>();
private readonly ToolTip tip = new ToolTip();
private readonly Timer anim;
private readonly Timer statusTimer;
private readonly Random rnd;
private readonly List<Mote> motes;
private readonly List<PointF[]> ridges;
private float scale;
private Bitmap backdrop;
private UiButton btnPlay;
private UiButton btnRepair;
private List<GameServer> servers;
private List<NewsItem> news;
private int newsScroll;
private int hoverServer;
private int hoverNews;
private string status;
private float progress;
private float shownProgress;
private bool busy;
private bool updateOk;
private bool installed;
private double phase;
private PointF mouse;
private Point dragFrom;
private bool dragging;
private readonly RectangleF serverPanel;
private readonly RectangleF newsPanel;
private readonly RectangleF portraitRect;
private Bitmap portrait;
private static readonly string[] Classes = new string[5] { "Sun Warrior", "Moonmaiden", "Swordsman", "Bead Fairy", "Summoner" };
private readonly Font fTitle;
private readonly Font fHero;
private readonly Font fSub;
private readonly Font fBody;
private readonly Font fSmall;
private readonly Font fBold;
private readonly Font fHead;
private readonly Font fPlay;
private readonly Font fBtn;
private bool closing;
private RectangleF NewsClip
{
get
{
RectangleF rectangleF = newsPanel;
float x = rectangleF.X + 16f;
RectangleF rectangleF2 = newsPanel;
float y = rectangleF2.Y + 50f;
RectangleF rectangleF3 = newsPanel;
float width = rectangleF3.Width - 32f;
RectangleF rectangleF4 = newsPanel;
return new RectangleF(x, y, width, rectangleF4.Height - 62f);
}
}
private RectangleF ServerRow(int i)
{
RectangleF rectangleF = serverPanel;
float x = rectangleF.X + 14f;
RectangleF rectangleF2 = serverPanel;
float y = rectangleF2.Y + 52f + (float)(i * 58);
RectangleF rectangleF3 = serverPanel;
return new RectangleF(x, y, rectangleF3.Width - 28f, 50f);
}
public LauncherForm(bool snapshot)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: 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_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Expected O, but got Unknown
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Expected O, but got Unknown
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Expected O, but got Unknown
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Expected O, but got Unknown
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Expected O, but got Unknown
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Expected O, but got Unknown
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Expected O, but got Unknown
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_03c0: Expected O, but got Unknown
Timer val = new Timer();
val.Interval = 33;
anim = val;
Timer val2 = new Timer();
val2.Interval = 5000;
statusTimer = val2;
rnd = new Random(7);
motes = new List<Mote>();
ridges = new List<PointF[]>();
scale = 1f;
servers = new List<GameServer>();
news = new List<NewsItem>();
hoverServer = -1;
hoverNews = -1;
status = "Starting...";
mouse = new PointF(-999f, -999f);
dragFrom = Point.Empty;
serverPanel = new RectangleF(640f, 92f, 308f, 300f);
newsPanel = new RectangleF(32f, 322f, 580f, 208f);
portraitRect = new RectangleF(32f, 86f, 258f, 190f);
fTitle = new Font("Palatino Linotype", 30f, (FontStyle)1, (GraphicsUnit)2);
fHero = new Font("Palatino Linotype", 34f, (FontStyle)1, (GraphicsUnit)2);
fSub = new Font("Segoe UI", 11f, (FontStyle)1, (GraphicsUnit)2);
fBody = new Font("Segoe UI", 14f, (GraphicsUnit)2);
fSmall = new Font("Segoe UI", 12f, (GraphicsUnit)2);
fBold = new Font("Segoe UI", 14f, (FontStyle)1, (GraphicsUnit)2);
fHead = new Font("Segoe UI", 11f, (FontStyle)1, (GraphicsUnit)2);
fPlay = new Font("Palatino Linotype", 26f, (FontStyle)1, (GraphicsUnit)2);
fBtn = new Font("Segoe UI", 13f, (FontStyle)1, (GraphicsUnit)2);
((Form)this)..ctor();
((Control)this).Text = "Zu Online Launcher";
((Form)this).FormBorderStyle = (FormBorderStyle)0;
((ContainerControl)this).AutoScaleMode = (AutoScaleMode)0;
((Form)this).StartPosition = (FormStartPosition)0;
((Control)this).BackColor = Theme.Ink;
((Control)this).DoubleBuffered = true;
((Form)this).KeyPreview = true;
try
{
((Form)this).Icon = Icon.ExtractAssociatedIcon(Path.Combine(Paths.Root, "ZuOnline.exe"));
}
catch
{
}
Graphics val3 = ((Control)this).CreateGraphics();
try
{
scale = (snapshot ? 1f : (val3.DpiX / 96f));
}
finally
{
((IDisposable)val3)?.Dispose();
}
if (!snapshot)
{
Rectangle workingArea = Screen.FromPoint(Cursor.Position).WorkingArea;
scale = Math.Min(scale, Math.Min((float)workingArea.Width * 0.94f / 980f, (float)workingArea.Height * 0.94f / 620f));
scale = Math.Max(0.6f, scale);
}
((Form)this).ClientSize = new Size((int)(980f * scale), (int)(620f * scale));
Rectangle workingArea2 = Screen.FromPoint(Cursor.Position).WorkingArea;
((Form)this).Location = new Point(workingArea2.X + Math.Max(0, (workingArea2.Width - ((Control)this).Width) / 2), workingArea2.Y + Math.Max(0, (workingArea2.Height - ((Control)this).Height) / 2));
GraphicsPath val4 = Theme.Round(new RectangleF(0f, 0f, ((Form)this).ClientSize.Width, ((Form)this).ClientSize.Height), 18f * scale);
try
{
((Control)this).Region = new Region(val4);
}
finally
{
((IDisposable)val4)?.Dispose();
}
BuildScene();
BuildButtons();
if (snapshot)
{
servers.Add(new GameServer
{
Name = "Zu Online",
Ip = cfg.ServerHost,
Port = 49119,
PingMs = 2
});
servers.Add(new GameServer
{
Name = "Zu Online 2",
Ip = cfg.ServerHost,
Port = 49119,
PingMs = -2
});
news.Add(new NewsItem
{
Header = true,
Text = "Patch notes"
});
news.Add(new NewsItem
{
Date = "10-05",
Text = "New launcher in the style of the website"
});
news.Add(new NewsItem
{
Date = "10-05",
Text = "Item names translated to English",
Url = "x"
});
status = "Client is up to date (1.0.9).";
progress = (shownProgress = 100f);
updateOk = true;
btnPlay.Enabled = true;
phase = 1.2;
return;
}
anim.Tick += delegate
{
Tick();
};
anim.Start();
statusTimer.Tick += delegate
{
RefreshStatus();
};
statusTimer.Start();
installed = Installer.ClientPresent(Paths.Root);
((Form)this).Shown += delegate
{
((Form)this).Opacity = 0.0;
FadeIn();
LoadRemote();
if (installed)
{
StartUpdateCheck(force: false);
}
else
{
string text = Installer.LastDir();
status = (Installer.Unfinished(text) ? ("The installation in " + text + " was interrupted. Press PLAY and choose that folder to continue it.") : "Zu Online is not installed yet. Press PLAY to choose a folder and install it.");
progress = 0f;
updateOk = true;
btnPlay.Enabled = true;
}
};
}
private void FadeIn()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
Timer val = new Timer();
val.Interval = 15;
Timer t = val;
t.Tick += delegate
{
((Form)this).Opacity = Math.Min(1.0, ((Form)this).Opacity + 0.08);
if (((Form)this).Opacity >= 1.0)
{
t.Stop();
}
};
t.Start();
}
private void BuildScene()
{
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Expected O, but got Unknown
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Expected O, but got Unknown
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Expected O, but got Unknown
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Expected O, but got Unknown
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Expected O, but got Unknown
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Expected O, but got Unknown
//IL_0398: Unknown result type (might be due to invalid IL or missing references)
//IL_039f: Expected O, but got Unknown
//IL_0480: Unknown result type (might be due to invalid IL or missing references)
//IL_0487: Expected O, but got Unknown
//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
//IL_06da: Expected O, but got Unknown
//IL_0510: Unknown result type (might be due to invalid IL or missing references)
//IL_0517: Expected O, but got Unknown
//IL_0519: Unknown result type (might be due to invalid IL or missing references)
//IL_0520: Expected O, but got Unknown
ridges.Clear();
for (int i = 0; i < 3; i++)
{
Random random = new Random(1234 + i * 97);
List<PointF> list = new List<PointF>();
float num = 620f * (0.62f + (float)i * 0.12f);
float num2 = 620f * (0.24f - (float)i * 0.05f);
for (float num3 = -40f; num3 <= 1060f; num3 += 40f + (float)random.NextDouble() * 70f)
{
list.Add(new PointF(num3, num - num2 * (0.35f + 0.65f * (float)Math.Pow(random.NextDouble(), 1.6))));
}
ridges.Add(list.ToArray());
}
for (int j = 0; j < 70; j++)
{
motes.Add(new Mote
{
X = (float)rnd.NextDouble() * 980f,
Y = (float)rnd.NextDouble() * 620f,
R = (float)rnd.NextDouble() * 1.8f + 0.4f,
Vx = 0f,
Vy = (0f - (float)rnd.NextDouble()) * 0.35f - 0.05f,
P = (float)rnd.NextDouble() * 6.3f
});
}
backdrop = new Bitmap(980, 620);
Graphics val = Graphics.FromImage((Image)(object)backdrop);
try
{
val.SmoothingMode = (SmoothingMode)4;
LinearGradientBrush val2 = new LinearGradientBrush(new Rectangle(0, 0, 980, 620), Color.FromArgb(2, 9, 12), Color.FromArgb(11, 58, 63), 90f);
try
{
ColorBlend val3 = new ColorBlend();
val3.Colors = new Color[3]
{
Color.FromArgb(2, 9, 12),
Color.FromArgb(6, 34, 43),
Color.FromArgb(11, 58, 63)
};
val3.Positions = new float[3] { 0f, 0.55f, 1f };
val2.InterpolationColors = val3;
val.FillRectangle((Brush)(object)val2, 0, 0, 980, 620);
}
finally
{
((IDisposable)val2)?.Dispose();
}
RectangleF rectangleF = new RectangleF(428f, -38f, 300f, 300f);
GraphicsPath val4 = new GraphicsPath();
try
{
val4.AddEllipse(rectangleF);
PathGradientBrush val5 = new PathGradientBrush(val4);
val5.CenterColor = Color.FromArgb(110, 255, 230, 180);
val5.SurroundColors = new Color[1] { Color.FromArgb(0, 255, 230, 180) };
PathGradientBrush val6 = val5;
try
{
val.FillPath((Brush)(object)val6, val4);
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
finally
{
((IDisposable)val4)?.Dispose();
}
SolidBrush val7 = new SolidBrush(Color.FromArgb(230, 255, 238, 200));
try
{
val.FillEllipse((Brush)(object)val7, 554f, 88f, 48f, 48f);
}
finally
{
((IDisposable)val7)?.Dispose();
}
for (int k = 0; k < ridges.Count; k++)
{
GraphicsPath val8 = new GraphicsPath();
try
{
PointF[] array = ridges[k];
val8.AddLine(-40f, 620f, array[0].X, array[0].Y);
val8.AddCurve(array, 0.5f);
val8.AddLine(array[^1].X, array[^1].Y, 1060f, 620f);
val8.CloseFigure();
int alpha = (new int[3] { 150, 200, 240 })[k];
LinearGradientBrush val9 = new LinearGradientBrush(new RectangleF(0f, 186f, 980f, 434f), Color.FromArgb(alpha, 12 + k * 3, 46 - k * 8, 56 - k * 10), Color.FromArgb(alpha, 2, 10, 13), 90f);
try
{
val.FillPath((Brush)(object)val9, val8);
}
finally
{
((IDisposable)val9)?.Dispose();
}
}
finally
{
((IDisposable)val8)?.Dispose();
}
float num4 = 620f * (0.64f + (float)k * 0.12f);
LinearGradientBrush val10 = new LinearGradientBrush(new RectangleF(0f, num4 - 40f, 980f, 80f), Color.FromArgb(0, 160, 220, 215), Color.FromArgb(0, 160, 220, 215), 90f);
try
{
ColorBlend val11 = new ColorBlend();
val11.Colors = new Color[3]
{
Color.FromArgb(0, 160, 220, 215),
Color.FromArgb(22, 160, 220, 215),
Color.FromArgb(0, 160, 220, 215)
};
val11.Positions = new float[3] { 0f, 0.5f, 1f };
val10.InterpolationColors = val11;
val.FillRectangle((Brush)(object)val10, 0f, num4 - 40f, 980f, 80f);
}
finally
{
((IDisposable)val10)?.Dispose();
}
}
Bitmap val12 = LoadArt();
try
{
if (val12 != null)
{
Bitmap val13 = Glow(val12, new Rectangle(298, 195, 210, 315));
try
{
val.DrawImage((Image)(object)val13, new RectangleF(700f, 168f, 231f, 346f));
}
finally
{
((IDisposable)val13)?.Dispose();
}
portrait = val12.Clone(new Rectangle(38, 160, 258, 185), (PixelFormat)2498570);
}
}
finally
{
((IDisposable)val12)?.Dispose();
}
LinearGradientBrush val14 = new LinearGradientBrush(new RectangleF(0f, 510f, 980f, 110f), Color.FromArgb(0, 2, 10, 13), Color.FromArgb(220, 2, 10, 13), 90f);
try
{
val.FillRectangle((Brush)(object)val14, 0, 510, 980, 110);
}
finally
{
((IDisposable)val14)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
private static Bitmap LoadArt()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
string text = Path.Combine(Paths.Root, "res\\bg.bmp");
if (!File.Exists(text))
{
return null;
}
Image val = Image.FromFile(text);
try
{
return new Bitmap(val);
}
finally
{
((IDisposable)val)?.Dispose();
}
}
private static Bitmap Glow(Bitmap src, Rectangle crop)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
Bitmap val = new Bitmap(crop.Width, crop.Height, (PixelFormat)2498570);
for (int i = 0; i < crop.Height; i++)
{
for (int j = 0; j < crop.Width; j++)
{
Color pixel = src.GetPixel(crop.X + j, crop.Y + i);
float num = (0.3f * (float)(int)pixel.R + 0.59f * (float)(int)pixel.G + 0.11f * (float)(int)pixel.B) / 255f;
float num2 = Math.Max(0f, Math.Min(1f, (num - 0.12f) * 1.9f));
float val2 = (float)Math.Min(j, crop.Width - 1 - j) / ((float)crop.Width * 0.22f);
float val3 = (float)Math.Min(i, crop.Height - 1 - i) / ((float)crop.Height * 0.18f);
num2 *= Math.Min(1f, Math.Min(val2, val3)) * 0.55f;
val.SetPixel(j, i, Color.FromArgb((int)(num2 * 255f), pixel.R, pixel.G, pixel.B));
}
}
return val;
}
private void PaintPortrait(Graphics g)
{
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Expected O, but got Unknown
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
RectangleF rectangleF = portraitRect;
float num = (float)(0.5 + 0.5 * Math.Sin(phase * 0.7));
GraphicsPath val = Theme.Round(rectangleF, 18f);
try
{
if (portrait != null)
{
Region clip = g.Clip;
g.SetClip(val, (CombineMode)1);
g.DrawImage((Image)(object)portrait, rectangleF);
LinearGradientBrush val2 = new LinearGradientBrush(new RectangleF(rectangleF.X, rectangleF.Bottom - 47f, rectangleF.Width, 48f), Color.FromArgb(0, 4, 19, 26), Color.FromArgb(230, 4, 19, 26), 90f);
try
{
g.FillRectangle((Brush)(object)val2, rectangleF.X, rectangleF.Bottom - 46f, rectangleF.Width, 46f);
}
finally
{
((IDisposable)val2)?.Dispose();
}
g.Clip = clip;
}
else
{
SolidBrush val3 = new SolidBrush(Color.FromArgb(160, 6, 28, 34));
try
{
g.FillPath((Brush)(object)val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
for (int num2 = 2; num2 >= 1; num2--)
{
GraphicsPath val4 = Theme.Round(RectangleF.Inflate(rectangleF, num2 * 3, num2 * 3), 18 + num2 * 3);
try
{
Pen val5 = new Pen(Color.FromArgb((int)((30f + 40f * num) / (float)num2), 255, 210, 140), 2f);
try
{
g.DrawPath(val5, val4);
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
finally
{
((IDisposable)val4)?.Dispose();
}
}
Pen val6 = new Pen(Color.FromArgb(200, 211, 154, 60), 1.4f);
try
{
g.DrawPath(val6, val);
}
finally
{
((IDisposable)val6)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
Theme.Draw(g, "THE MOONMAIDEN AWAITS", fHead, Theme.Gold, new RectangleF(rectangleF.X + 16f, rectangleF.Bottom - 34f, rectangleF.Width - 32f, 20f));
}
private void Tick()
{
phase += 0.08;
foreach (UiButton button in buttons)
{
float num = ((button.HoverTarget && button.Enabled) ? 1f : 0f);
button.Hover += (num - button.Hover) * 0.25f;
}
shownProgress += (progress - shownProgress) * 0.2f;
foreach (Mote mote in motes)
{
float num2 = mote.X - mouse.X;
float num3 = mote.Y - mouse.Y;
float num4 = num2 * num2 + num3 * num3;
if (num4 < 9000f)
{
float num5 = (9000f - num4) / 9000f * 0.8f;
mote.Vx += num2 / 120f * num5;
mote.Vy += num3 / 120f * num5;
}
mote.Vx *= 0.96f;
mote.Vy = mote.Vy * 0.96f - 0.008f;
mote.X += mote.Vx;
mote.Y += mote.Vy;
mote.P += 0.05f;
if (mote.Y < -10f)
{
mote.Y = 630f;
mote.X = (float)rnd.NextDouble() * 980f;
mote.Vy = -0.2f;
}
if (mote.X < -10f)
{
mote.X = 990f;
}
else if (mote.X > 990f)
{
mote.X = -10f;
}
}
((Control)this).Invalidate();
}
private void BuildButtons()
{
Add(new RectangleF(846f, 14f, 36f, 30f), "?", ButtonKind.Window, "System check: why the game will not start", ShowSystemCheck);
Add(new RectangleF(888f, 14f, 36f, 30f), "_", ButtonKind.Window, "Minimize (Esc)", delegate
{
((Form)this).WindowState = (FormWindowState)1;
});
Add(new RectangleF(930f, 14f, 36f, 30f), "x", ButtonKind.Window, "Close", delegate
{
((Form)this).Close();
});
float num = 330f;
string[] array = new string[4] { "Account", "Register", "Website", "Folder" };
foreach (string text in array)
{
string label = text;
float num2 = 84f;
Add(new RectangleF(num, 18f, num2, 30f), label, ButtonKind.Link, null, delegate
{
if (label == "Account")
{
OpenUrl(cfg.BaseUrl + "account.php");
}
else if (label == "Register")
{
OpenUrl(cfg.BaseUrl + "reg.php");
}
else if (label == "Website")
{
OpenUrl(cfg.BaseUrl);
}
else
{
Process.Start("explorer.exe", "\"" + Paths.Root + "\"");
}
});
num += num2 + 4f;
}
btnPlay = Add(new RectangleF(640f, 412f, 308f, 68f), "PLAY", ButtonKind.Primary, "Start the game (Enter)", Play);
btnPlay.Enabled = false;
Add(new RectangleF(640f, 492f, 150f, 40f), "Options", ButtonKind.Ghost, "Display, graphics, sound and network", ShowSettings);
Add(new RectangleF(798f, 492f, 150f, 40f), "Refresh", ButtonKind.Ghost, "Reload servers and news (F5)", LoadRemote);
btnRepair = Add(new RectangleF(830f, 574f, 118f, 30f), "Repair files", ButtonKind.Link, "Re-verify every patched file", delegate
{
if (installed)
{
StartUpdateCheck(force: true);
}
else
{
Install();
}
});
}
private UiButton Add(RectangleF r, string label, ButtonKind kind, string tipText, Action click)
{
UiButton uiButton = new UiButton();
uiButton.Bounds = r;
uiButton.Label = label;
uiButton.Kind = kind;
uiButton.Tip = tipText;
uiButton.Click = click;
UiButton uiButton2 = uiButton;
buttons.Add(uiButton2);
return uiButton2;
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics graphics = e.Graphics;
graphics.ScaleTransform(scale, scale);
Render(graphics);
}
private void Render(Graphics g)
{
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Expected O, but got Unknown
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Expected O, but got Unknown
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Expected O, but got Unknown
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Expected O, but got Unknown
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
//IL_038d: Expected O, but got Unknown
g.SmoothingMode = (SmoothingMode)4;
g.TextRenderingHint = (TextRenderingHint)3;
g.InterpolationMode = (InterpolationMode)6;
g.DrawImage((Image)(object)backdrop, 0, 0, 980, 620);
foreach (Mote mote in motes)
{
float num = 0.45f + 0.55f * (float)Math.Sin(mote.P);
Color baseColor = ((num > 0.7f) ? Theme.Gold : Color.FromArgb(120, 240, 230));
SolidBrush val = new SolidBrush(Color.FromArgb((int)(60f + 150f * num), baseColor));
try
{
g.FillEllipse((Brush)(object)val, mote.X - mote.R, mote.Y - mote.R, mote.R * 2f * (1f + num * 0.5f), mote.R * 2f * (1f + num * 0.5f));
}
finally
{
((IDisposable)val)?.Dispose();
}
}
Pen val2 = new Pen(Color.FromArgb(70, 90, 200, 190));
try
{
g.DrawLine(val2, 0, 62, 980, 62);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Theme.GoldText(g, "ZU ONLINE", fTitle, new RectangleF(30f, 8f, 260f, 38f), (StringAlignment)0);
Theme.Draw(g, "L E G E N D O F S H U S H A N", fSub, Theme.Teal, new RectangleF(32f, 40f, 300f, 16f));
PaintPortrait(g);
Theme.Draw(g, "Welcome, cultivator", fSmall, Theme.Teal, new RectangleF(314f, 88f, 300f, 20f));
Theme.GoldText(g, "Begin your", fHero, new RectangleF(312f, 106f, 300f, 42f), (StringAlignment)0);
Theme.GoldText(g, "cultivation", fHero, new RectangleF(312f, 140f, 300f, 42f), (StringAlignment)0);
Font val3 = new Font("Palatino Linotype", 14f, (FontStyle)2, (GraphicsUnit)2);
try
{
Theme.Draw(g, "“Walk the righteous path, become immortal.”", val3, Color.FromArgb(220, 211, 154, 60), new RectangleF(314f, 184f, 300f, 20f));
}
finally
{
((IDisposable)val3)?.Dispose();
}
StringFormat val4 = new StringFormat();
try
{
SolidBrush val5 = new SolidBrush(Color.FromArgb(207, 227, 222));
try
{
g.DrawString("Choose a server with a green light and press PLAY. New here? Create an account first.", fBody, (Brush)(object)val5, new RectangleF(314f, 212f, 294f, 64f), val4);
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
finally
{
((IDisposable)val4)?.Dispose();
}
float num2 = 32f;
string[] classes = Classes;
foreach (string text in classes)
{
RectangleF r = new RectangleF(num2, 288f, g.MeasureString(text, fSmall).Width + 22f, 24f);
GraphicsPath val6 = Theme.Round(r, 12f);
try
{
SolidBrush val7 = new SolidBrush(Color.FromArgb(150, 4, 20, 24));
try
{
Pen val8 = new Pen(Color.FromArgb(120, 211, 154, 60));
try
{
g.FillPath((Brush)(object)val7, val6);
g.DrawPath(val8, val6);
}
finally
{
((IDisposable)val8)?.Dispose();
}
}
finally
{
((IDisposable)val7)?.Dispose();
}
}
finally
{
((IDisposable)val6)?.Dispose();
}
Theme.Draw(g, text, fSmall, Theme.Gold, r, (StringAlignment)1, (StringAlignment)1);
num2 += r.Width + 8f;
}
PaintNews(g);
PaintServers(g);
foreach (UiButton button in buttons)
{
button.Paint(g, (button.Kind == ButtonKind.Primary) ? fPlay : ((button.Kind == ButtonKind.Link && button.Bounds.Y < 60f) ? fBtn : fBtn), phase);
}
PaintBottom(g);
}
private void PaintServers(Graphics g)
{
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Expected O, but got Unknown
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: 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
Theme.Glass(g, serverPanel, 18f, 170);
Font f = fHead;
Color dim = Theme.Dim;
RectangleF rectangleF = serverPanel;
float x = rectangleF.X + 18f;
RectangleF rectangleF2 = serverPanel;
Theme.Draw(g, "SERVERS", f, dim, new RectangleF(x, rectangleF2.Y + 14f, 200f, 22f));
string s = servers.Count + " available";
Font f2 = fSmall;
Color dim2 = Theme.Dim;
RectangleF rectangleF3 = serverPanel;
float x2 = rectangleF3.Right - 120f;
RectangleF rectangleF4 = serverPanel;
Theme.Draw(g, s, f2, dim2, new RectangleF(x2, rectangleF4.Y + 14f, 104f, 22f), (StringAlignment)2, (StringAlignment)1);
if (servers.Count == 0)
{
string s2 = (busy ? "Loading..." : "No servers found");
Font f3 = fBody;
Color dim3 = Theme.Dim;
RectangleF rectangleF5 = serverPanel;
float x3 = rectangleF5.X;
RectangleF rectangleF6 = serverPanel;
float y = rectangleF6.Y + 60f;
RectangleF rectangleF7 = serverPanel;
Theme.Draw(g, s2, f3, dim3, new RectangleF(x3, y, rectangleF7.Width, 40f), (StringAlignment)1, (StringAlignment)1);
return;
}
for (int i = 0; i < servers.Count && i < 4; i++)
{
RectangleF r = ServerRow(i);
GameServer gameServer = servers[i];
bool flag = i == cfg.SelectedServer;
bool flag2 = i == hoverServer;
GraphicsPath val = Theme.Round(r, 14f);
try
{
SolidBrush val2 = new SolidBrush(flag ? Color.FromArgb(70, 70, 230, 220) : Color.FromArgb(flag2 ? 120 : 90, 2, 14, 18));
try
{
g.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
Pen val3 = new Pen(flag ? Theme.Teal : Color.FromArgb(flag2 ? 120 : 50, 90, 200, 190), flag ? 1.5f : 1f);
try
{
g.DrawPath(val3, val);
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
Color color = ((gameServer.PingMs == -1) ? Color.Gold : ((gameServer.PingMs == -2) ? Theme.Bad : Theme.Good));
float num = (float)(0.5 + 0.5 * Math.Sin(phase * 1.6 + (double)i));
SolidBrush val4 = new SolidBrush(Color.FromArgb((int)(60f * num), color));
try
{
g.FillEllipse((Brush)(object)val4, r.X + 12f, r.Y + 15f, 20f, 20f);
}
finally
{
((IDisposable)val4)?.Dispose();
}
SolidBrush val5 = new SolidBrush(color);
try
{
g.FillEllipse((Brush)(object)val5, r.X + 17f, r.Y + 20f, 10f, 10f);
}
finally
{
((IDisposable)val5)?.Dispose();
}
Theme.Draw(g, gameServer.Name, fBold, flag ? Theme.Gold : Theme.Text, new RectangleF(r.X + 42f, r.Y + 6f, r.Width - 120f, 20f));
Theme.Draw(g, GameTunnel.Needed(cfg.ServerHost, gameServer.Ip) ? cfg.ServerHost : (gameServer.Ip + ":" + gameServer.Port), fSmall, Theme.Dim, new RectangleF(r.X + 42f, r.Y + 26f, r.Width - 120f, 18f));
string s3 = ((gameServer.PingMs == -1) ? "checking" : ((gameServer.PingMs == -2) ? "offline" : (gameServer.PingMs + " ms")));
Theme.Draw(g, s3, fBold, color, new RectangleF(r.Right - 90f, r.Y, 78f, r.Height), (StringAlignment)2, (StringAlignment)1);
}
}
private void PaintNews(Graphics g)
{
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Expected O, but got Unknown
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Expected O, but got Unknown
Theme.Glass(g, newsPanel, 18f, 160);
Font f = fHead;
Color dim = Theme.Dim;
RectangleF rectangleF = newsPanel;
float x = rectangleF.X + 18f;
RectangleF rectangleF2 = newsPanel;
Theme.Draw(g, "NEWS & PATCH NOTES", f, dim, new RectangleF(x, rectangleF2.Y + 14f, 300f, 22f));
RectangleF newsClip = NewsClip;
Region clip = g.Clip;
g.SetClip(newsClip);
float num = newsClip.Y - (float)newsScroll;
for (int i = 0; i < news.Count; i++)
{
NewsItem newsItem = news[i];
if (newsItem.Header)
{
num += 4f;
Theme.Draw(g, newsItem.Text.ToUpperInvariant(), fHead, Theme.Teal, new RectangleF(newsClip.X, num, newsClip.Width, 20f));
num += 24f;
continue;
}
RectangleF r = new RectangleF(newsClip.X - 6f, num, newsClip.Width + 12f, 26f);
if (i == hoverNews && newsItem.Url != null)
{
GraphicsPath val = Theme.Round(r, 8f);
try
{
SolidBrush val2 = new SolidBrush(Color.FromArgb(50, 70, 230, 220));
try
{
g.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
SolidBrush val3 = new SolidBrush(Theme.Gold2);
try
{
g.FillEllipse((Brush)(object)val3, newsClip.X, num + 10f, 6f, 6f);
}
finally
{
((IDisposable)val3)?.Dispose();
}
Theme.Draw(g, newsItem.Date, fSmall, Theme.Dim, new RectangleF(newsClip.X + 14f, num, 50f, 26f));
Theme.Draw(g, newsItem.Text, fBody, (newsItem.Url != null) ? Theme.Gold : Theme.Text, new RectangleF(newsClip.X + 62f, num, newsClip.Width - 62f, 26f));
num += 28f;
}
if (news.Count == 0)
{
Theme.Draw(g, busy ? "Loading..." : "No news yet.", fBody, Theme.Dim, newsClip, (StringAlignment)1, (StringAlignment)1);
}
g.Clip = clip;
}
private void PaintBottom(Graphics g)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: 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
RectangleF rectangleF = new RectangleF(32f, 580f, 770f, 10f);
GraphicsPath val = Theme.Round(rectangleF, 5f);
try
{
SolidBrush val2 = new SolidBrush(Color.FromArgb(28, 255, 255, 255));
try
{
g.FillPath((Brush)(object)val2, val);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
float num = rectangleF.Width * Math.Max(0f, Math.Min(100f, shownProgress)) / 100f;
if (num > 4f)
{
RectangleF rectangleF2 = new RectangleF(rectangleF.X, rectangleF.Y, num, rectangleF.Height);
GraphicsPath val3 = Theme.Round(rectangleF2, 5f);
try
{
LinearGradientBrush val4 = new LinearGradientBrush(rectangleF, Theme.Teal2, Theme.Gold, 0f);
try
{
g.FillPath((Brush)(object)val4, val3);
}
finally
{
((IDisposable)val4)?.Dispose();
}
}
finally
{
((IDisposable)val3)?.Dispose();
}
if (busy)
{
float num2 = rectangleF.X + (float)(phase * 120.0 % (double)(rectangleF.Width + 80f)) - 40f;
LinearGradientBrush val5 = new LinearGradientBrush(new RectangleF(num2 - 40f, rectangleF.Y, 80f, rectangleF.Height), Color.FromArgb(0, 255, 255, 255), Color.FromArgb(0, 255, 255, 255), 0f);
try
{
ColorBlend val6 = new ColorBlend();
val6.Colors = new Color[3]
{
Color.FromArgb(0, 255, 255, 255),
Color.FromArgb(150, 255, 255, 255),
Color.FromArgb(0, 255, 255, 255)
};
val6.Positions = new float[3] { 0f, 0.5f, 1f };
val5.InterpolationColors = val6;
Region clip = g.Clip;
g.SetClip(rectangleF2);
g.FillRectangle((Brush)(object)val5, num2 - 40f, rectangleF.Y, 80f, rectangleF.Height);
g.Clip = clip;
}
finally
{
((IDisposable)val5)?.Dispose();
}
}
}
Theme.Draw(g, status, fSmall, Theme.Text, new RectangleF(32f, 554f, 580f, 20f));
Theme.Draw(g, "Client " + Updater.LocalVersion, fSmall, Theme.Dim, new RectangleF(600f, 554f, 200f, 20f), (StringAlignment)2, (StringAlignment)1);
}
public void SaveSnapshot(string file)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
Bitmap val = new Bitmap(980, 620);
try
{
Graphics val2 = Graphics.FromImage((Image)(object)val);
try
{
Render(val2);
((Image)val).Save(file, ImageFormat.Png);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
private PointF L(Point p)
{
return new PointF((float)p.X / scale, (float)p.Y / scale);
}
private UiButton HitButton(PointF p)
{
for (int num = buttons.Count - 1; num >= 0; num--)
{
if (buttons[num].Bounds.Contains(p))
{
return buttons[num];
}
}
return null;
}
private int HitServer(PointF p)
{
for (int i = 0; i < servers.Count && i < 4; i++)
{
if (ServerRow(i).Contains(p))
{
return i;
}
}
return -1;
}
private int HitNews(PointF p)
{
RectangleF newsClip = NewsClip;
if (!newsClip.Contains(p))
{
return -1;
}
float num = newsClip.Y - (float)newsScroll;
for (int i = 0; i < news.Count; i++)
{
if (news[i].Header)
{
num += 28f;
continue;
}
if (p.Y >= num && p.Y < num + 28f)
{
return i;
}
num += 28f;
}
return -1;
}
protected override void OnMouseMove(MouseEventArgs e)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Invalid comparison between Unknown and I4
PointF p = (mouse = L(e.Location));
if ((int)e.Button == 1048576 && dragging)
{
((Form)this).Location = new Point(((Form)this).Location.X + e.X - dragFrom.X, ((Form)this).Location.Y + e.Y - dragFrom.Y);
return;
}
UiButton uiButton = HitButton(p);
foreach (UiButton button in buttons)
{
button.HoverTarget = button == uiButton;
}
hoverServer = HitServer(p);
hoverNews = HitNews(p);
bool flag = (uiButton != null && uiButton.Enabled) || hoverServer >= 0 || (hoverNews >= 0 && news[hoverNews].Url != null);
((Control)this).Cursor = (flag ? Cursors.Hand : Cursors.Default);
string text = ((uiButton != null) ? uiButton.Tip : ((hoverServer >= 0) ? ("Double-click to play on " + servers[hoverServer].Name) : null));
if (tip.GetToolTip((Control)(object)this) != (text ?? ""))
{
tip.SetToolTip((Control)(object)this, text ?? "");
}
}
protected override void OnMouseLeave(EventArgs e)
{
mouse = new PointF(-999f, -999f);
foreach (UiButton button in buttons)
{
button.HoverTarget = false;
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
PointF pointF = L(e.Location);
UiButton uiButton = HitButton(pointF);
if (uiButton != null && uiButton.Enabled)
{
uiButton.Down = true;
return;
}
int num = HitServer(pointF);
if (num >= 0)
{
if (num != cfg.SelectedServer)
{
cfg.SelectedServer = num;
cfg.Save();
}
}
else if (!NewsClip.Contains(pointF))
{
dragging = true;
dragFrom = e.Location;
}
}
protected override void OnMouseUp(MouseEventArgs e)
{
PointF pointF = L(e.Location);
dragging = false;
foreach (UiButton button in buttons)
{
if (button.Down)
{
button.Down = false;
if (button.Bounds.Contains(pointF) && button.Enabled && button.Click != null)
{
button.Click();
}
}
}
int num = HitNews(pointF);
if (num >= 0 && news[num].Url != null && Security.SafeUrl(news[num].Url, cfg.ServerHost))
{
OpenUrl(news[num].Url);
}
}
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
if (HitServer(L(e.Location)) >= 0 && btnPlay.Enabled)
{
Play();
}
}
protected override void OnMouseWheel(MouseEventArgs e)
{
RectangleF rectangleF = newsPanel;
if (!rectangleF.Contains(L(e.Location)))
{
return;
}
int num = 0;
foreach (NewsItem item in news)
{
_ = item;
num += 28;
}
newsScroll = Math.Max(0, Math.Min(Math.Max(0, num - (int)NewsClip.Height), newsScroll - e.Delta / 4));
}
protected override void OnKeyDown(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_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Invalid comparison between Unknown and I4
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Invalid comparison between Unknown and I4
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Invalid comparison between Unknown and I4
if ((int)e.KeyCode == 13 && btnPlay.Enabled)
{
Play();
}
else if ((int)e.KeyCode == 116)
{
LoadRemote();
}
else if ((int)e.KeyCode == 27)
{
((Form)this).WindowState = (FormWindowState)1;
}
else if ((int)e.KeyCode == 40 && servers.Count > 0)
{
cfg.SelectedServer = (cfg.SelectedServer + 1) % servers.Count;
cfg.Save();
}
else if ((int)e.KeyCode == 38 && servers.Count > 0)
{
cfg.SelectedServer = (cfg.SelectedServer + servers.Count - 1) % servers.Count;
cfg.Save();
}
}
private void Ui(Action a)
{
if (closing || !((Control)this).IsHandleCreated || ((Control)this).IsDisposed)
{
return;
}
try
{
((Control)this).BeginInvoke((Delegate)a);
}
catch (ObjectDisposedException)
{
}
catch (InvalidOperationException)
{
}
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
closing = true;
anim.Stop();
statusTimer.Stop();
((Form)this).OnFormClosing(e);
}
private void LoadRemote()
{
ThreadPool.QueueUserWorkItem(delegate
{
List<GameServer> s = null;
List<NewsItem> i = null;
try
{
s = ServerList.Fetch(cfg.BaseUrl);
}
catch
{
}
try
{
i = News.Fetch(cfg.BaseUrl);
}
catch
{
i = new List<NewsItem>
{
new NewsItem
{
Text = "News are not available.",
Date = ""
}
};
}
Ui(delegate
{
string ip = (GameTunnel.Needed(cfg.ServerHost, "127.0.0.1") ? "127.0.0.1" : cfg.ServerHost);
if (s != null && cfg.IsDomain)
{
s = s.FindAll((GameServer g) => g.Ip == "127.0.0.1");
}
if (s != null && s.Count == 0)
{
s = null;
}
servers = s ?? new List<GameServer>
{
new GameServer
{
Name = "Zu Online",
Ip = ip,
Port = 49119
}
};
if (cfg.SelectedServer >= servers.Count)
{
cfg.SelectedServer = 0;
}
news = i;
newsScroll = 0;
RefreshStatus();
});
});
}
private void RefreshStatus()
{
List<GameServer> list = servers;
ThreadPool.QueueUserWorkItem(delegate
{
foreach (GameServer item in list)
{
item.PingMs = (GameTunnel.Needed(cfg.ServerHost, item.Ip) ? GameTunnel.Status(cfg.BaseUrl) : ServerList.Ping(item.Ip, item.Port));
}
});
}
private void StartUpdateCheck(bool force)
{
if (busy)
{
return;
}
busy = true;
updateOk = false;
btnPlay.Enabled = false;
btnRepair.Enabled = false;
status = (force ? "Verifying all files..." : "Checking for updates...");
progress = 2f;
ThreadPool.QueueUserWorkItem(delegate
{
bool ok = false;
bool restart = false;
string result;
try
{
Updater updater = new Updater(cfg.BaseUrl);
Stopwatch clock = Stopwatch.StartNew();
long last = -1000L;
Action<string, int> action = delegate(string msg, int pct)
{
if (pct >= 100 || clock.ElapsedMilliseconds - last >= 100)
{
last = clock.ElapsedMilliseconds;
Ui(delegate
{
status = msg;
progress = Math.Max(2, pct);
});
}
};
updater.Check(force, action);
if (updater.Pending.Count > 0)
{
updater.Download(action);
result = "Update " + updater.RemoteVersion + " installed.";
}
else
{
result = (force ? "All files verified." : ("Client is up to date (" + updater.RemoteVersion + ")."));
}
ok = true;
restart = updater.SelfUpdatedRestart;
}
catch (WebException ex)
{
Program.Log(ex);
result = "Update server unreachable - you can still play.";
ok = true;
}
catch (Exception ex2)
{
Program.Log(ex2);
result = "Update failed: " + ex2.Message;
}
Ui(delegate
{
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
busy = false;
updateOk = ok;
status = result;
progress = (ok ? 100 : 0);
btnPlay.Enabled = ok;
btnRepair.Enabled = true;
if (restart)
{
MessageBox.Show((IWin32Window)(object)this, "The launcher was updated and will restart.", "Zu Online", (MessageBoxButtons)0, (MessageBoxIcon)64);
Process.Start(Application.ExecutablePath);
((Form)this).Close();
}
});
});
}
private void Play()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Invalid comparison between Unknown and I4
if (!updateOk || busy)
{
return;
}
if (!installed)
{
Install();
return;
}
int num = Process.GetProcessesByName("ZuOnline").Length;
if (num >= 3)
{
MessageBox.Show((IWin32Window)(object)this, "At most " + 3 + " game clients can run on one computer at the same time. Close one of them first.", "Zu Online", (MessageBoxButtons)0, (MessageBoxIcon)64);
}
else
{
if (num > 0 && (int)MessageBox.Show((IWin32Window)(object)this, "The game is already running. Start another copy?", "Zu Online", (MessageBoxButtons)4, (MessageBoxIcon)32) != 6)
{
return;
}
if (servers.Count == 0 || cfg.SelectedServer >= servers.Count)
{
if ((int)MessageBox.Show((IWin32Window)(object)this, "No server is available. Your copy of the launcher may be outdated or damaged.\n\nOpen the official site to download a fresh copy?\n" + cfg.BaseUrl, "Zu Online", (MessageBoxButtons)4, (MessageBoxIcon)48) != 6)
{
return;
}
try
{
Process.Start(cfg.BaseUrl);
return;
}
catch
{
return;
}
}
string ip = servers[cfg.SelectedServer].Ip;
if (!GameTunnel.Needed(cfg.ServerHost, ip))
{
StartGame(ip);
return;
}
busy = true;
btnPlay.Enabled = false;
status = "Connecting to the server...";
ThreadPool.QueueUserWorkItem(delegate
{
Stopwatch clock = Stopwatch.StartNew();
long last = -1000L;
string err = GameTunnel.Ensure(cfg.ServerHost, cfg.BaseUrl, delegate(string msg)
{
if (clock.ElapsedMilliseconds - last >= 100)
{
last = clock.ElapsedMilliseconds;
Ui(delegate
{
status = msg;
});
}
});
Ui(delegate
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
busy = false;
btnPlay.Enabled = true;
if (err != null)
{
status = "Could not connect to the server.";
MessageBox.Show((IWin32Window)(object)this, err, "Zu Online", (MessageBoxButtons)0, (MessageBoxIcon)48);
}
else
{
StartGame(ip);
}
});
});
}
}
private void Install()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Invalid comparison between Unknown and I4
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
if (busy)
{
return;
}
FolderBrowserDialog val = new FolderBrowserDialog();
val.Description = "Choose the folder where Zu Online will be installed (about 3.2 GB).";
val.ShowNewFolderButton = true;
FolderBrowserDialog val2 = val;
string dir;
try
{
string text = Installer.LastDir();
val2.SelectedPath = text ?? Path.Combine(Path.GetPathRoot(Environment.SystemDirectory), "Games");
if ((int)((CommonDialog)val2).ShowDialog((IWin32Window)(object)this) != 1)
{
return;
}
dir = Installer.TargetFor(val2.SelectedPath);
}
finally
{
((IDisposable)val2)?.Dispose();
}
string text2 = Installer.Validate(dir);
if (text2 != null)
{
MessageBox.Show((IWin32Window)(object)this, text2, "Zu Online", (MessageBoxButtons)0, (MessageBoxIcon)48);
return;
}
bool? flag = Installer.Confirm((IWin32Window)(object)this, dir);
if (!flag.HasValue)
{
return;
}
bool shortcut = flag.Value;
busy = true;
btnPlay.Enabled = false;
btnRepair.Enabled = false;
btnPlay.Label = "INSTALLING...";
status = "Preparing the installation in " + dir + "...";
progress = 2f;
string baseUrl = cfg.BaseUrl;
string host = cfg.ServerHost;
ThreadPool.QueueUserWorkItem(delegate
{
string error = null;
Stopwatch clock = Stopwatch.StartNew();
long last = -1000L;
try
{
Installer.Install(baseUrl, dir, delegate(string msg, int pct)
{
if (pct < 0 || pct >= 100 || clock.ElapsedMilliseconds - last >= 100)
{
last = clock.ElapsedMilliseconds;
Ui(delegate
{
status = msg;
if (pct >= 0)
{
progress = Math.Max(2, pct);
}
});
}
});
Installer.Finish(dir, host, shortcut);
}
catch (Exception ex)
{
Program.Log(ex);
error = ex.Message;
}
Ui(delegate
{
busy = false;
btnPlay.Label = "PLAY";
btnPlay.Enabled = true;
btnRepair.Enabled = true;
if (error != null)
{
status = "Installation stopped: " + error + " Press PLAY to continue it.";
progress = 0f;
}
else
{
Paths.Root = dir;
Directory.SetCurrentDirectory(dir);
installed = true;
status = "Zu Online is installed in " + dir + (shortcut ? ". A desktop shortcut was added." : ".") + " Press PLAY.";
progress = 100f;
RefreshStatus();
}
});
});
}
private void StartGame(string ip)
{
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
ProcessStartInfo processStartInfo = new ProcessStartInfo(Path.Combine(Paths.Root, "ZuOnline.exe"), "-rez data.rez -rez ltb.rez -rez dtx.rez -rez lto.rez -rez pk_ltb.rez -rez pk_dtx.rez " + ip + " -rez .. -rez .");
processStartInfo.WorkingDirectory = Paths.Root;
processStartInfo.UseShellExecute = false;
ProcessStartInfo startInfo = processStartInfo;
IniFile iniFile = new IniFile(Paths.PlayerIni);
bool flag = cfg.Borderless || iniFile.GetInt("display", "ScreenType", 1) == 0;
Rectangle bounds = Screen.PrimaryScreen.Bounds;
if (flag)
{
iniFile.Set("display", "ScreenType", "1");
iniFile.Set("display", "ScreenWidth", bounds.Width.ToString());
iniFile.Set("display", "ScreenHeight", bounds.Height.ToString());
}
List<string> list = Display.Repair(iniFile);
iniFile.Save();
GameWindow.MarkDpiAware(Path.Combine(Paths.Root, "ZuOnline.exe"));
Process game;
try
{
game = Process.Start(startInfo);
}
catch (Exception ex)
{
MessageBox.Show((IWin32Window)(object)this, "Could not start the game: " + ex.Message, "Zu Online", (MessageBoxButtons)0, (MessageBoxIcon)16);
return;
}
if (flag)
{
GameWindow.MakeBorderless(game, bounds);
}
status = ((list.Count > 0) ? ("Display settings repaired (" + list.Count + "). Starting the game...") : "Starting the game... the window appears in about 20 seconds.");
btnPlay.Label = "STARTING...";
WatchStart(game);
}
private void WatchStart(Process game)
{
ThreadPool.QueueUserWorkItem(delegate
{
bool died = false;
int code = 0;
try
{
died = game.WaitForExit(20000);
if (died)
{
code = game.ExitCode;
}
}
catch
{
}
Ui(delegate
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Invalid comparison between Unknown and I4
btnPlay.Label = "PLAY";
if (died && code != 0)
{
status = "The game stopped at start (code 0x" + code.ToString("X8") + ").";
if ((int)MessageBox.Show((IWin32Window)(object)this, "Windows stopped the game right after it started (code 0x" + code.ToString("X8") + ").\n\nThis is usually Data Execution Prevention blocking the game's old copy protection. Apply the compatibility fix for ZuOnline.exe now? Windows will ask for permission once.", "Zu Online", (MessageBoxButtons)4, (MessageBoxIcon)48) == 6 && GameWindow.ApplyDepFix(Path.Combine(Paths.Root, "ZuOnline.exe")))
{
Play();
}
}
else if (!died)
{
if (cfg.CloseOnPlay)
{
((Form)this).Close();
}
else
{
((Form)this).WindowState = (FormWindowState)1;
}
}
});
});
}
private void ShowSettings()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
SettingsForm settingsForm = new SettingsForm(cfg);
try
{
if ((int)((Form)settingsForm).ShowDialog((IWin32Window)(object)this) == 1)
{
LoadRemote();
}
}
finally
{
((IDisposable)settingsForm)?.Dispose();
}
}
private void ShowSystemCheck()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
SystemCheckForm systemCheckForm = new SystemCheckForm(cfg);
try
{
((Form)systemCheckForm).ShowDialog((IWin32Window)(object)this);
}
finally
{
((IDisposable)systemCheckForm)?.Dispose();
}
}
private static void OpenUrl(string url)
{
try
{
Process.Start(url);
}
catch
{
}
}
}
internal class VerificationException : Exception
{
public VerificationException(string m)
: base(m)
{
}
}
internal static class Security
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
private class WinTrustFileInfo
{
public uint cbStruct = (uint)Marshal.SizeOf(typeof(WinTrustFileInfo));
public string pcwszFilePath;
public IntPtr hFile = IntPtr.Zero;
public IntPtr pgKnownSubject = IntPtr.Zero;
}
[StructLayout(LayoutKind.Sequential)]
private class WinTrustData
{
public uint cbStruct = (uint)Marshal.SizeOf(typeof(WinTrustData));
public IntPtr pPolicyCallbackData = IntPtr.Zero;
public IntPtr pSIPClientData = IntPtr.Zero;
public uint dwUIChoice = 2u;
public uint fdwRevocationChecks;
public uint dwUnionChoice = 1u;
public IntPtr pFile;
public uint dwStateAction;
public uint dwProvFlags = 16u;
public IntPtr hWVTStateData = IntPtr.Zero;
public IntPtr pwszURLReference = IntPtr.Zero;
public uint dwUIContext;
}
private const string PublicKeyXml = "<RSAKeyValue><Modulus>lWLZMYUXeTTtcF1KRjHkhgcLWTWbdiyD+m+RnmEOqMLhwgrWN6qrYuO+StXncoZUM72nKGjtEj1Eft7qUijRgjTU9Z1fZ+6OHfH8gpBcoziUF3qMIyaeo7rkGCHIwOAKAcwxlmfRsVIE6DplQb0a9l/jsFHPbIIkPaJEP8OV2elqk5OE3hmHnTKv7O8OiVDQEEp/RfJRrA024xobE0MqREccwJmSY8xBbSmCALaMpdWC/xHVw9dPz9+W1mopSgpIxvmu0NeLKqHLAHUI4OlxkG+Jdw+o0xZsjHuq/r5ETWe2crrnrnugYOXmXp6YWIuBdgU0Nk+lc5IIJvvYJuXqAQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
private static readonly Guid GenericVerifyV2 = new Guid("00AAC56B-CD44-11d0-8CC2-00C04FC295EE");
private static readonly Regex HostName = new Regex("^(?=.{1,253}$)([A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$");
public static bool Verify(byte[] data, string sigBase64)
{
try
{
using RSACryptoServiceProvider rSACryptoServiceProvider = new RSACryptoServiceProvider(new CspParameters(24));
rSACryptoServiceProvider.PersistKeyInCsp = false;
rSACryptoServiceProvider.FromXmlString("<RSAKeyValue><Modulus>lWLZMYUXeTTtcF1KRjHkhgcLWTWbdiyD+m+RnmEOqMLhwgrWN6qrYuO+StXncoZUM72nKGjtEj1Eft7qUijRgjTU9Z1fZ+6OHfH8gpBcoziUF3qMIyaeo7rkGCHIwOAKAcwxlmfRsVIE6DplQb0a9l/jsFHPbIIkPaJEP8OV2elqk5OE3hmHnTKv7O8OiVDQEEp/RfJRrA024xobE0MqREccwJmSY8xBbSmCALaMpdWC/xHVw9dPz9+W1mopSgpIxvmu0NeLKqHLAHUI4OlxkG+Jdw+o0xZsjHuq/r5ETWe2crrnrnugYOXmXp6YWIuBdgU0Nk+lc5IIJvvYJuXqAQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
return rSACryptoServiceProvider.VerifyData(data, "SHA256", Convert.FromBase64String(sigBase64.Trim()));
}
catch
{
return false;
}
}
public static string FetchSigned(string url)
{
string text = "?t=" + DateTime.UtcNow.Ticks;
byte[] array;
byte[] bytes;
using (WebClient webClient = new WebClient())
{
array = webClient.DownloadData(url + text);
bytes = webClient.DownloadData(url + ".sig" + text);
}
if (!Verify(array, Encoding.ASCII.GetString(bytes)))
{
throw new VerificationException("The update list from the server could not be verified (bad signature). Nothing was installed.");
}
return Encoding.UTF8.GetString(array);
}
[DllImport("wintrust.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
private static extern int WinVerifyTrust(IntPtr hwnd, [MarshalAs(UnmanagedType.LPStruct)] Guid action, IntPtr data);
public static bool IsSignedBy(string file, string organization)
{
if (!File.Exists(file))
{
return false;
}
WinTrustFileInfo winTrustFileInfo = new WinTrustFileInfo();
winTrustFileInfo.pcwszFilePath = file;
WinTrustFileInfo structure = winTrustFileInfo;
IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
IntPtr intPtr2 = IntPtr.Zero;
try
{
Marshal.StructureToPtr(structure, intPtr, fDeleteOld: false);
WinTrustData winTrustData = new WinTrustData();
winTrustData.pFile = intPtr;
WinTrustData structure2 = winTrustData;
intPtr2 = Marshal.AllocHGlobal(Marshal.SizeOf(structure2));
Marshal.StructureToPtr(structure2, intPtr2, fDeleteOld: false);
if (WinVerifyTrust(IntPtr.Zero, GenericVerifyV2, intPtr2) != 0)
{
return false;
}
X509Certificate x509Certificate = X509Certificate.CreateFromSignedFile(file);
return x509Certificate.Subject.IndexOf("O=\"" + organization + "\"", StringComparison.OrdinalIgnoreCase) >= 0 || x509Certificate.Subject.IndexOf("O=" + organization + ",", StringComparison.OrdinalIgnoreCase) >= 0;
}
catch
{
return false;
}
finally
{
Marshal.FreeHGlobal(intPtr);
if (intPtr2 != IntPtr.Zero)
{
Marshal.FreeHGlobal(intPtr2);
}
}
}
public static bool ValidHost(string host)
{
if (host != null)
{
return HostName.IsMatch(host);
}
return false;
}
public static bool SafeUrl(string url, string serverHost)
{
if (string.IsNullOrEmpty(url) || !Uri.TryCreate(url, UriKind.Absolute, out Uri result))
{
return false;
}
if (result.Scheme != Uri.UriSchemeHttp && result.Scheme != Uri.UriSchemeHttps)
{
return false;
}
string text = result.Host.ToLowerInvariant();
string text2 = (serverHost ?? "").ToLowerInvariant();
if (!(text == text2))
{
return text.EndsWith("." + text2);
}
return true;
}
[DllImport("iphlpapi.dll", SetLastError = true)]
private static extern uint GetExtendedTcpTable(IntPtr table, ref int size, bool order, int af, int tableClass, uint reserved);
public static int ListenerPid(int port)
{
int size = 0;
GetExtendedTcpTable(IntPtr.Zero, ref size, order: false, 2, 3, 0u);
IntPtr intPtr = Marshal.AllocHGlobal(size);
try
{
if (GetExtendedTcpTable(intPtr, ref size, order: false, 2, 3, 0u) != 0)
{
return -1;
}
int num = Marshal.ReadInt32(intPtr);
for (int i = 0; i < num; i++)
{
IntPtr ptr = new IntPtr(intPtr.ToInt64() + 4 + i * 24);
int num2 = (Marshal.ReadByte(ptr, 8) << 8) | Marshal.ReadByte(ptr, 9);
if (num2 == port)
{
return Marshal.ReadInt32(ptr, 20);
}
}
return 0;
}
finally
{
Marshal.FreeHGlobal(intPtr);
}
}
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern bool QueryFullProcessImageName(IntPtr h, int flags, StringBuilder name, ref int size);
[DllImport("kernel32.dll")]
private static extern bool CloseHandle(IntPtr h);
public static string ProcessPath(int pid)
{
IntPtr intPtr = OpenProcess(4096u, inherit: false, pid);
if (intPtr == IntPtr.Zero)
{
return null;
}
try
{
StringBuilder stringBuilder = new StringBuilder(1024);
int size = stringBuilder.Capacity;
return QueryFullProcessImageName(intPtr, 0, stringBuilder, ref size) ? stringBuilder.ToString() : null;
}
finally
{
CloseHandle(intPtr);
}
}
}
internal static class Display
{
private struct DEVMODE
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;
public int dmPositionX;
public int dmPositionY;
public int dmDisplayOrientation;
public int dmDisplayFixedOutput;
public short dmColor;
public short dmDuplex;
public short dmYResolution;
public short dmTTOption;
public short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmFormName;
public short dmLogPixels;
public int dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;
public int dmDisplayFlags;
public int dmDisplayFrequency;
public int dmICMMethod;
public int dmICMIntent;
public int dmMediaType;
public int dmDitherType;
public int dmReserved1;
public int dmReserved2;
public int dmPanningWidth;
public int dmPanningHeight;
}
[DllImport("user32.dll", CharSet = CharSet.Ansi)]
private static extern bool EnumDisplaySettings(string dev, int mode, ref DEVMODE dm);
[DllImport("user32.dll")]
private static extern IntPtr GetDC(IntPtr h);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr h, IntPtr dc);
[DllImport("gdi32.dll")]
private static extern int GetDeviceCaps(IntPtr dc, int i);
public static List<Size> Modes()
{
Size size = Screen.PrimaryScreen.Bounds.Size;
HashSet<Size> hashSet = new HashSet<Size>();
DEVMODE dEVMODE = default(DEVMODE);
dEVMODE.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE));
DEVMODE dm = dEVMODE;
for (int i = 0; EnumDisplaySettings(Screen.PrimaryScreen.DeviceName, i, ref dm); i++)
{
if (dm.dmBitsPerPel >= 32 && dm.dmPelsWidth >= 800 && dm.dmPelsHeight >= 600 && dm.dmPelsWidth <= size.Width && dm.dmPelsHeight <= size.Height)
{
hashSet.Add(new Size(dm.dmPelsWidth, dm.dmPelsHeight));
}
}
hashSet.Add(size);
List<Size> list = new List<Size>(hashSet);
list.Sort((Size a, Size b) => (b.Width == a.Width) ? b.Height.CompareTo(a.Height) : b.Width.CompareTo(a.Width));
return list;
}
public static int ScalePercent()
{
IntPtr dC = GetDC(IntPtr.Zero);
try
{
return GetDeviceCaps(dC, 88) * 100 / 96;
}
finally
{
ReleaseDC(IntPtr.Zero, dC);
}
}
public static List<string> Repair(IniFile ini)
{
List<string> list = new List<string>();
List<Size> list2 = Modes();
int @int = ini.GetInt("display", "ScreenWidth", 0);
int int2 = ini.GetInt("display", "ScreenHeight", 0);
if (!list2.Contains(new Size(@int, int2)))
{
Size size = list2[list2.Count - 1];
foreach (Size item in list2)
{
if (item.Width <= Math.Max(@int, 800) && item.Height <= Math.Max(int2, 600))
{
size = item;
break;
}
}
ini.Set("display", "ScreenWidth", size.Width.ToString());
ini.Set("display", "ScreenHeight", size.Height.ToString());
list.Add($"Resolution {@int} x {int2} is not supported by this monitor: set to {size.Width} x {size.Height}.");
}
if (ini.GetInt("display", "ScreenType", 1) != 1)
{
ini.Set("display", "ScreenType", "1");
list.Add("Exclusive fullscreen crashes when the game loses focus: switched to windowed (use Fullscreen in Options for borderless).");
}
int int3 = ini.GetInt("display", "ScreenDepth", 32);
if (int3 != 16 && int3 != 32)
{
ini.Set("display", "ScreenDepth", "32");
list.Add("Colour depth " + int3 + " is invalid: set to 32-bit.");
}
string[] array = new string[3] { "TextureDetialType", "FxLOD", "FxDistance" };
foreach (string text in array)
{
int int4 = ini.GetInt("display", text, 2);
if (int4 < 0 || int4 > 2)
{
ini.Set("display", text, "2");
list.Add(text + " " + int4 + " is out of range: set to High.");
}
}
return list;
}
}
internal class SystemCheckForm : Form
{
private enum State
{
Ok,
Warn,
Fail
}
private class Item
{
public State State;
public string Title;
public string Detail;
public Action Fix;
}
private readonly LauncherConfig cfg;
private readonly ListView list;
private readonly Label summary;
private readonly Button btnFix;
private List<Item> items = new List<Item>();
public SystemCheckForm(LauncherConfig cfg)
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Expected O, but got Unknown
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Expected O, but got Unknown
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Expected O, but got Unknown
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Expected O, but got Unknown
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Expected O, but got Unknown
this.cfg = cfg;
((Control)this).SuspendLayout();
((ContainerControl)this).AutoScaleDimensions = new SizeF(96f, 96f);
((ContainerControl)this).AutoScaleMode = (AutoScaleMode)2;
((Control)this).Text = "Zu Online - System check";
((Form)this).FormBorderStyle = (FormBorderStyle)3;
bool maximizeBox = (((Form)this).MinimizeBox = false);
((Form)this).MaximizeBox = maximizeBox;
((Form)this).StartPosition = (FormStartPosition)4;
((Form)this).ClientSize = new Size(620, 420);
((Control)this).BackColor = Color.FromArgb(14, 34, 38);
((Control)this).ForeColor = Color.FromArgb(230, 235, 230);
((Control)this).Font = new Font("Segoe UI", 9f);
Label val = new Label();
((Control)val).Location = new Point(12, 12);
((Control)val).Size = new Size(596, 36);
((Control)val).Text = "Checking...";
summary = val;
ListView val2 = new ListView();
((Control)val2).Location = new Point(12, 52);
((Control)val2).Size = new Size(596, 316);
val2.View = (View)1;
val2.FullRowSelect = true;
val2.HeaderStyle = (ColumnHeaderStyle)1;
((Control)val2).BackColor = Color.FromArgb(18, 44, 48);
((Control)val2).ForeColor = ((Control)this).ForeColor;
list = val2;
list.Columns.Add("", 72);
list.Columns.Add("Check", 120);
list.Columns.Add("Result", 380);
list.ShowItemToolTips = true;
Button val3 = new Button();
((Control)val3).Text = "Fix problems";
((Control)val3).Location = new Point(316, 380);
((Control)val3).Size = new Size(110, 28);
((ButtonBase)val3).FlatStyle = (FlatStyle)0;
((Control)val3).BackColor = Color.FromArgb(25, 110, 105);
((Control)val3).Enabled = false;
btnFix = val3;
Button val4 = new Button();
((Control)val4).Text = "Check again";
((Control)val4).Location = new Point(432, 380);
((Control)val4).Size = new Size(90, 28);
((ButtonBase)val4).FlatStyle = (FlatStyle)0;
Button val5 = val4;
Button val6 = new Button();
((Control)val6).Text = "Close";
((Control)val6).Location = new Point(528, 380);
((Control)val6).Size = new Size(80, 28);
((ButtonBase)val6).FlatStyle = (FlatStyle)0;
val6.DialogResult = (DialogResult)2;
Button val7 = val6;
Button val8 = new Button();
((Control)val8).Text = "Copy report";
((Control)val8).Location = new Point(12, 380);
((Control)val8).Size = new Size(100, 28);
((ButtonBase)val8).FlatStyle = (FlatStyle)0;
Button val9 = val8;
Button obj = btnFix;
EventHandler eventHandler = delegate
{
foreach (Item item in items)
{
if (item.Fix != null)
{
try
{
item.Fix();
}
catch
{
}
}
}
Run();
};
((Control)obj).Click += eventHandler;
((Control)val5).Click += delegate
{
Run();
};
((Control)val9).Click += delegate
{
try
{
Clipboard.SetText(Report());
((Control)summary).Text = "Report copied: paste it in the bug channel.";
}
catch
{
}
};
((Control)this).Controls.AddRange((Control[])(object)new Control[6]
{
(Control)summary,
(Control)list,
(Control)btnFix,
(Control)val5,
(Control)val7,
(Control)val9
});
((Form)this).CancelButton = (IButtonControl)(object)val7;
((Control)this).ResumeLayout(true);
((Form)this).Shown += OnShownRun;
}
private void OnShownRun(object s, EventArgs e)
{
Run();
}
public static void SaveSnapshot(LauncherConfig cfg, string png)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
SystemCheckForm systemCheckForm = new SystemCheckForm(cfg);
try
{
((Form)systemCheckForm).StartPosition = (FormStartPosition)0;
((Form)systemCheckForm).Location = new Point(-4000, -4000);
((Form)systemCheckForm).ShowInTaskbar = false;
((Form)systemCheckForm).Shown -= systemCheckForm.OnShownRun;
((Control)systemCheckForm).Show();
Application.DoEvents();
systemCheckForm.ShowResults(systemCheckForm.Collect());
Application.DoEvents();
Bitmap val = new Bitmap(((Control)systemCheckForm).Width, ((Control)systemCheckForm).Height);
try
{
((Control)systemCheckForm).DrawToBitmap(val, new Rectangle(Point.Empty, ((Form)systemCheckForm).Size));
((Image)val).Save(png);
}
finally
{
((IDisposable)val)?.Dispose();
}
}
finally
{
((IDisposable)systemCheckForm)?.Dispose();
}
}
private string Report()
{
StringBuilder stringBuilder = new StringBuilder("Zu Online system check " + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "\r\n");
foreach (Item item in items)
{
stringBuilder.AppendFormat("[{0}] {1}: {2}\r\n", item.State, item.Title, item.Detail);
}
return stringBuilder.ToString();
}
private void Run()
{
((Control)summary).Text = "Checking...";
list.Items.Clear();
((Control)btnFix).Enabled = false;
ThreadPool.QueueUserWorkItem(delegate
{
List<Item> r = Collect();
if (((Control)this).IsDisposed || !((Control)this).IsHandleCreated)
{
return;
}
try
{
((Control)this).BeginInvoke((Delegate)(Action)delegate
{
if (!((Control)this).IsDisposed)
{
ShowResults(r);
}
});
}
catch (ObjectDisposedException)
{
}
catch (InvalidOperationException)
{
}
});
}
private void ShowResults(List<Item> r)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
items = r;
list.Items.Clear();
int num = 0;
int num2 = 0;
foreach (Item item in r)
{
ListViewItem val = new ListViewItem(new string[3]
{
(item.State == State.Ok) ? "OK" : ((item.State == State.Warn) ? "Warning" : "Problem"),
item.Title,
item.Detail
});
val.ToolTipText = item.Detail;
val.ForeColor = ((item.State == State.Ok) ? Color.LightGreen : ((item.State == State.Warn) ? Color.Khaki : Color.Salmon));
ListViewItem val2 = val;
list.Items.Add(val2);
if (item.State == State.Fail)
{
num++;
}
else if (item.State == State.Warn)
{
num2++;
}
}
bool flag = r.Exists((Item i) => i.Fix != null);
((Control)btnFix).Enabled = flag;
((Control)summary).Text = ((num == 0 && num2 == 0) ? "Everything looks fine. If the game still does not start, use Copy report and send it to us." : string.Format("{0} problem(s), {1} warning(s).{2}", num, num2, flag ? " Press Fix problems to repair what can be repaired automatically." : ""));
}
private static string WindowsName()
{
try
{
using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
string text = string.Concat(registryKey.GetValue("ProductName"));
string text2 = string.Concat(registryKey.GetValue("CurrentBuild"));
if (int.TryParse(text2, out var result) && result >= 22000)
{
text = text.Replace("Windows 10", "Windows 11");
}
return text + " (build " + text2 + ")";
}
catch
{
return Environment.OSVersion.VersionString;
}
}
private List<Item> Collect()
{
List<Item> list = new List<Item>();
string root = Paths.Root;
List<string> list2 = new List<string>();
string[] array = new string[11]
{
"ZuOnline.exe", "data.rez", "ltb.rez", "dtx.rez", "lto.rez", "pk_dtx.rez", "msvcr71.dll", "msvcp71.dll", "MFC71.dll", "d3dx9_25.dll",
"OpenAL32.dll"
};
foreach (string text in array)
{
if (!File.Exists(Path.Combine(root, text)))
{
list2.Add(text);
}
}
list.Add((list2.Count == 0) ? new Item
{
State = State.Ok,
Title = "Game files",
Detail = "All core files are present."
} : new Item
{
State = State.Fail,
Title = "Game files",
Detail = "Missing: " + string.Join(", ", list2.ToArray()) + ". Use Repair files, or reinstall."
});
try
{
string path = Path.Combine(root, "Profiles\\.write_test");
Directory.CreateDirectory(Path.GetDirectoryName(path));
File.WriteAllText(path, "x");
File.Delete(path);
list.Add(new Item
{
State = State.Ok,
Title = "Folder access",
Detail = "The game folder is writable."
});
}
catch
{
list.Add(new Item
{
State = State.Fail,
Title = "Folder access",
Detail = "Cannot write to " + root + ". Move the game out of Program Files or run the launcher as administrator."
});
}
int num = Display.ScalePercent();
string exe = Path.Combine(root, "ZuOnline.exe");
bool flag = GameWindow.IsDpiAware(exe);
if (num <= 100)
{
list.Add(new Item
{
State = State.Ok,
Title = "Windows scaling",
Detail = "100%."
});
}
else if (flag)
{
list.Add(new Item
{
State = State.Ok,
Title = "Windows scaling",
Detail = num + "%: the game is set to ignore scaling, so its window fits the screen."
});
}
else
{
list.Add(new Item
{
State = State.Warn,
Title = "Windows scaling",
Detail = num + "%: Windows would stretch the game window beyond the screen.",
Fix = delegate
{
GameWindow.MarkDpiAware(exe);
}
});
}
int num2 = GameWindow.DepPolicy();
switch (num2)
{
case 1:
list.Add(new Item
{
State = State.Fail,
Title = "DEP",
Detail = "Windows enforces DEP for every program (AlwaysOn), which can stop the game. Run as administrator: bcdedit /set nx OptIn, then restart Windows."
});
break;
case 3:
list.Add(new Item
{
State = State.Warn,
Title = "DEP",
Detail = "DEP is on for all programs (OptOut); the game needs an exception.",
Fix = delegate
{
GameWindow.ApplyDepFix(exe);
}
});
break;
default:
list.Add(new Item
{
State = State.Ok,
Title = "DEP",
Detail = num2 switch
{
0 => "Off.",
2 => "Default policy (OptIn).",
_ => "Policy unknown.",
}
});
break;
}
IniFile iniFile = new IniFile(Paths.PlayerIni);
IniFile ini = new IniFile(Paths.PlayerIni);
List<string> list3 = Display.Repair(ini);
string text2 = iniFile.Get("display", "ScreenWidth", "?") + " x " + iniFile.Get("display", "ScreenHeight", "?");
list.Add((list3.Count == 0) ? new Item
{
State = State.Ok,
Title = "Display settings",
Detail = "Resolution " + text2 + " is supported by this monitor."
} : new Item
{
State = State.Fail,
Title = "Display settings",
Detail = string.Join(" ", list3.ToArray()),
Fix = delegate
{
IniFile iniFile2 = new IniFile(Paths.PlayerIni);
Display.Repair(iniFile2);
iniFile2.Save();
}
});
int num3 = Process.GetProcessesByName("ZuOnline").Length;
list.Add((num3 == 0) ? new Item
{
State = State.Ok,
Title = "Game process",
Detail = "The game is not running."
} : new Item
{
State = ((num3 < 3) ? State.Warn : State.Fail),
Title = "Game process",
Detail = num3 + " of at most " + 3 + " copies running. A frozen copy can block a new start: close it in Task Manager."
});
string serverHost = cfg.ServerHost;
int num4 = ServerList.Ping(serverHost, 80);
int num5 = GameTunnel.LoginPing(serverHost, cfg.BaseUrl);
list.Add((num4 > 0) ? new Item
{
State = State.Ok,
Title = "Web server",
Detail = serverHost + " answers in " + num4 + " ms."
} : new Item
{
State = State.Fail,
Title = "Web server",
Detail = serverHost + ":80 does not answer: no server list, news or updates. Check the address in Options > Network."
});
list.Add((num5 > 0) ? new Item
{
State = State.Ok,
Title = "Login server",
Detail = serverHost + " answers in " + num5 + " ms."
} : new Item
{
State = State.Fail,
Title = "Login server",
Detail = serverHost + ": the game server is down or a firewall blocks the game."
});
list.Add(new Item
{
State = State.Ok,
Title = "Windows",
Detail = WindowsName() + (Environment.Is64BitOperatingSystem ? ", 64-bit" : ", 32-bit")
});
return list;
}
}
internal static class GameTunnel
{
private const string AccessIdB64 = "";
private const string AccessSecretB64 = "";
private static readonly string[] Subs = new string[2] { "gate", "login" };
private static readonly int[] Ports = new int[2] { 49108, 49119 };
public static string Exe => Path.Combine(Paths.Root, "cloudflared\\cloudflared.exe");
public static bool Needed(string serverHost, string serverIp)
{
if (serverIp == "127.0.0.1" && !IPAddress.TryParse(serverHost, out IPAddress _))
{
return !serverHost.Equals("localhost", StringComparison.OrdinalIgnoreCase);
}
return false;
}
private static string Unhide(string b64)
{
if (b64.Length != 0)
{
return Encoding.UTF8.GetString(Convert.FromBase64String(b64));
}
return "";
}
public static bool Ready()
{
int[] ports = Ports;
foreach (int port in ports)
{
if (Owner(port) <= 0)
{
return false;
}
}
return true;
}
private static int Owner(int port)
{
int num = Security.ListenerPid(port);
if (num <= 0)
{
return 0;
}
string text = Security.ProcessPath(num);
if (text == null)
{
return -1;
}
if (string.Equals(Path.GetFullPath(text), Path.GetFullPath(Exe), StringComparison.OrdinalIgnoreCase))
{
return 1;
}
string text2 = Path.GetFileName(text).ToLowerInvariant();
if (!(text2 == "gatesvr.exe") && !(text2 == "loginsvr.exe"))
{
return -1;
}
return 2;
}
private static string ForeignPortMessage()
{
int[] ports = Ports;
foreach (int num in ports)
{
if (Owner(num) == -1)
{
string text = Security.ProcessPath(Security.ListenerPid(num)) ?? "another program";
return "Port " + num + " on this computer is used by " + text + ".\n\nClose that program and press Play again.";
}
}
return null;
}
private static bool Listening(int port)
{
try
{
using TcpClient tcpClient = new TcpClient();
IAsyncResult asyncResult = tcpClient.BeginConnect(IPAddress.Loopback, port, null, null);
if (!asyncResult.AsyncWaitHandle.WaitOne(300))
{
return false;
}
tcpClient.EndConnect(asyncResult);
return true;
}
catch
{
return false;
}
}
public static string Ensure(string domain, string baseUrl, Action<string> progress)
{
if (Ready())
{
return null;
}
string text = ForeignPortMessage();
if (text != null)
{
return text;
}
if (File.Exists(Exe) && !Security.IsSignedBy(Exe, "Cloudflare, Inc."))
{
try
{
File.Delete(Exe);
}
catch
{
return "The connection component (cloudflared.exe) is not signed by Cloudflare and could not be replaced. Use Repair.";
}
}
if (!File.Exists(Exe))
{
try
{
Fetch(baseUrl, progress);
}
catch (Exception ex)
{
Program.Log(ex);
return "Could not download the connection component (cloudflared.exe): " + ex.Message;
}
Thread.Sleep(1500);
if (!File.Exists(Exe))
{
return "The connection component (cloudflared\\cloudflared.exe) was removed right after download, most likely by your antivirus.\n\nAdd the game folder to the antivirus exceptions, then press Play again.";
}
}
progress("Connecting to the server...");
ProcessStartInfo processStartInfo = new ProcessStartInfo(Path.Combine(Paths.Root, "ZuLauncher.exe"), "--tunnel " + domain);
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = true;
processStartInfo.WorkingDirectory = Paths.Root;
Process.Start(processStartInfo);
for (int i = 0; i < 60; i++)
{
if (Ready())
{
return null;
}
Thread.Sleep(250);
}
return "Could not connect to the game server through the secure tunnel. Check your internet connection and try again.";
}
private static void Fetch(string baseUrl, Action<string> progress)
{
Directory.CreateDirectory(Path.GetDirectoryName(Exe));
string text = Exe + ".download";
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(baseUrl + "launcher/files/cloudflared/cloudflared.exe?t=" + DateTime.UtcNow.Ticks);
using (WebResponse webResponse = httpWebRequest.GetResponse())
{
using Stream stream = webResponse.GetResponseStream();
using FileStream fileStream = File.Create(text);
long contentLength = webResponse.ContentLength;
long num = 0L;
byte[] array = new byte[65536];
int num2;
while ((num2 = stream.Read(array, 0, array.Length)) > 0)
{
fileStream.Write(array, 0, num2);
num += num2;
if (contentLength > 0)
{
progress("Downloading the connection component... " + num * 100 / contentLength + "%");
}
}
if (contentLength > 0 && num != contentLength)
{
throw new IOException("incomplete download");
}
}
if (!Security.IsSignedBy(text, "Cloudflare, Inc."))
{
File.Delete(text);
throw new IOException("the downloaded file is not signed by Cloudflare");
}
if (File.Exists(Exe))
{
File.Delete(Exe);
}
File.Move(text, Exe);
}
public static void Guard(string domain)
{
bool createdNew;
using (new Mutex(initiallyOwned: true, "ZuLauncher.GameTunnel", out createdNew))
{
if (!createdNew || !Security.ValidHost(domain) || !Security.IsSignedBy(Exe, "Cloudflare, Inc."))
{
return;
}
List<Process> list = new List<Process>();
try
{
string text = Unhide("");
string value = Unhide("");
for (int i = 0; i < Subs.Length; i++)
{
if (!Listening(Ports[i]))
{
ProcessStartInfo processStartInfo = new ProcessStartInfo(Exe, "access tcp --hostname " + Subs[i] + "." + domain + " --url 127.0.0.1:" + Ports[i] + " --loglevel error");
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = true;
processStartInfo.WorkingDirectory = Paths.Root;
ProcessStartInfo processStartInfo2 = processStartInfo;
if (text.Length > 0)
{
processStartInfo2.EnvironmentVariables["TUNNEL_SERVICE_TOKEN_ID"] = text;
processStartInfo2.EnvironmentVariables["TUNNEL_SERVICE_TOKEN_SECRET"] = value;
}
list.Add(Process.Start(processStartInfo2));
}
}
DateTime now = DateTime.Now;
TimeSpan timeSpan = TimeSpan.FromMinutes(3.0);
while (DateTime.Now - now < timeSpan)
{
Thread.Sleep(2000);
if (Process.GetProcessesByName("ZuOnline").Length > 0)
{
now = DateTime.Now;
timeSpan = TimeSpan.FromSeconds(30.0);
}
foreach (Process item in list)
{
if (item.HasExited)
{
return;
}
}
}
}
catch (Exception ex)
{
Program.Log(ex);
}
finally
{
foreach (Process item2 in list)
{
try
{
if (!item2.HasExited)
{
item2.Kill();
}
}
catch
{
}
}
}
}
}
public static int Status(string baseUrl)
{
Stopwatch stopwatch = Stopwatch.StartNew();
try
{
using WebClient webClient = new WebClient();
string json = webClient.DownloadString(baseUrl + "api/status.php");
return (int)((Field(json, "login") > 0 && Field(json, "gate") > 0) ? Math.Max(1L, stopwatch.ElapsedMilliseconds) : (-2));
}
catch
{
return -2;
}
}
public static int LoginPing(string host, string baseUrl)
{
if (!Needed(host, "127.0.0.1"))
{
return ServerList.Ping(host, 49119);
}
return Status(baseUrl);
}
private static int Field(string json, string name)
{
Match match = Regex.Match(json, "\"" + name + "\"\\s*:\\s*(-?\\d+)");
if (!match.Success)
{
return -1;
}
return int.Parse(match.Groups[1].Value);
}
}
internal static class Program
{
[DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
public static void Log(Exception ex)
{
try
{
File.AppendAllText(Path.Combine(Paths.Root, "launcher.log"), string.Concat(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss "), ex, Environment.NewLine));
}
catch
{
}
}
[STAThread]
private static void Main(string[] args)
{
try
{
SetProcessDPIAware();
}
catch
{
}
Application.SetUnhandledExceptionMode((UnhandledExceptionMode)2);
Application.ThreadException += delegate(object s, ThreadExceptionEventArgs e)
{
Log(e.Exception);
};
AppDomain.CurrentDomain.UnhandledException += delegate(object s, UnhandledExceptionEventArgs e)
{
Log(e.ExceptionObject as Exception);
};
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Directory.SetCurrentDirectory(Paths.Root);
try
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
}
catch (NotSupportedException)
{
}
if (args.Length == 2 && args[0] == "--tunnel")
{
GameTunnel.Guard(args[1]);
return;
}
Updater.FinishSelfUpdate();
if (args.Length == 2 && args[0] == "--snapshot")
{
LauncherForm launcherForm = new LauncherForm(snapshot: true);
try
{
launcherForm.SaveSnapshot(args[1]);
return;
}
finally
{
((IDisposable)launcherForm)?.Dispose();
}
}
if (args.Length == 2 && args[0] == "--check-snapshot")
{
SystemCheckForm.SaveSnapshot(LauncherConfig.Load(), args[1]);
return;
}
if (args.Length >= 2 && args[0] == "--install-to")
{
string baseUrl = ((args.Length >= 3) ? args[2] : LauncherConfig.Load().BaseUrl);
try
{
Installer.Install(baseUrl, args[1], delegate
{
});
Console.WriteLine("OK");
return;
}
catch (Exception ex2)
{
Log(ex2);
Environment.ExitCode = 1;
return;
}
}
Application.Run((Form)(object)new LauncherForm(snapshot: false));
}
}
internal static class Paths
{
public static string Root = ResolveRoot();
public static readonly string ExeDir = Path.GetDirectoryName(Application.ExecutablePath);
public static string PlayerIni => Path.Combine(Root, "Profiles\\player.ini");
public static string LauncherIni => Path.Combine(Root, "launcher.ini");
private static string ResolveRoot()
{
string directoryName = Path.GetDirectoryName(Application.ExecutablePath);
if (Installer.ClientPresent(directoryName))
{
return directoryName;
}
string text = Installer.SavedInstallDir();
if (text == null || !Installer.ClientPresent(text))
{
return directoryName;
}
return text;
}
public static string Res(string name)
{
return Path.Combine(Root, "res\\" + name);
}
}
internal class IniFile
{
private static readonly Encoding Gbk = Encoding.GetEncoding(936);
private readonly string path;
private readonly List<string> lines;
public IniFile(string path)
{
this.path = path;
lines = (File.Exists(path) ? new List<string>(File.ReadAllLines(path, Gbk)) : new List<string>());
}
private int FindSection(string section)
{
for (int i = 0; i < lines.Count; i++)
{
if (lines[i].Trim().Equals("[" + section + "]", StringComparison.OrdinalIgnoreCase))
{
return i;
}
}
return -1;
}
public string Get(string section, string key, string def)
{
int num = FindSection(section);
if (num < 0)
{
return def;
}
for (int i = num + 1; i < lines.Count && !lines[i].TrimStart(new char[0]).StartsWith("["); i++)
{
int num2 = lines[i].IndexOf('=');
if (num2 > 0 && lines[i].Substring(0, num2).Trim().Equals(key, StringComparison.OrdinalIgnoreCase))
{
return lines[i].Substring(num2 + 1).Trim().Trim(new char[1] { '"' });
}
}
return def;
}
public int GetInt(string section, string key, int def)
{
if (!int.TryParse(Get(section, key, def.ToString()), out var result))
{
return def;
}
return result;
}
public void Set(string section, string key, string value)
{
int num = FindSection(section);
if (num < 0)
{
lines.Add("[" + section + "]");
lines.Add(key + "=" + value);
return;
}
int i;
for (i = num + 1; i < lines.Count && !lines[i].TrimStart(new char[0]).StartsWith("["); i++)
{
int num2 = lines[i].IndexOf('=');
if (num2 > 0 && lines[i].Substring(0, num2).Trim().Equals(key, StringComparison.OrdinalIgnoreCase))
{
lines[i] = key + "=" + value;
return;
}
}
lines.Insert(i, key + "=" + value);
}
public void Save()
{
File.WriteAllLines(path, lines.ToArray(), Gbk);
}
}
internal class LauncherConfig
{
public string ServerHost = "zu-online.online";
public bool CloseOnPlay = true;
public bool Borderless;
public int SelectedServer;
public bool IsDomain
{
get
{
if (!IPAddress.TryParse(ServerHost, out IPAddress _))
{
return !ServerHost.Equals("localhost", StringComparison.OrdinalIgnoreCase);
}
return false;
}
}
public string BaseUrl => (IsDomain ? "https://" : "http://") + ServerHost + "/";
public static LauncherConfig Load()
{
LauncherConfig launcherConfig = new LauncherConfig();
IniFile iniFile = new IniFile(Paths.LauncherIni);
launcherConfig.ServerHost = iniFile.Get("launcher", "ServerHost", launcherConfig.ServerHost);
if (launcherConfig.ServerHost == "192.168.0.9")
{
launcherConfig.ServerHost = new LauncherConfig().ServerHost;
}
if (!Security.ValidHost(launcherConfig.ServerHost))
{
launcherConfig.ServerHost = new LauncherConfig().ServerHost;
}
launcherConfig.CloseOnPlay = iniFile.Get("launcher", "CloseOnPlay", "1") != "0";
launcherConfig.Borderless = iniFile.Get("launcher", "Borderless", "0") == "1";
launcherConfig.SelectedServer = iniFile.GetInt("launcher", "SelectedServer", 0);
return launcherConfig;
}
public void Save()
{
IniFile iniFile = new IniFile(Paths.LauncherIni);
iniFile.Set("launcher", "ServerHost", ServerHost);
iniFile.Set("launcher", "CloseOnPlay", CloseOnPlay ? "1" : "0");
iniFile.Set("launcher", "Borderless", Borderless ? "1" : "0");
iniFile.Set("launcher", "SelectedServer", SelectedServer.ToString());
iniFile.Save();
}
}
internal class GameServer
{
public string Name;
public string Ip;
public int Port;
public int PingMs = -1;
public string StatusText
{
get
{
if (PingMs != -1)
{
if (PingMs != -2)
{
return "online " + PingMs + " ms";
}
return "offline";
}
return "checking...";
}
}
}
internal static class ServerList
{
private static readonly Encoding Gbk = Encoding.GetEncoding(936);
public static List<GameServer> Fetch(string baseUrl)
{
List<GameServer> list = new List<GameServer>();
using WebClient webClient = new WebClient();
string @string = Gbk.GetString(webClient.DownloadData(baseUrl + "patch/bgp/server.html"));
string[] array = @string.Split(new char[1] { '\n' });
foreach (string text in array)
{
string text2 = text.Trim();
if (text2.Length != 0 && !text2.StartsWith("["))
{
string[] array2 = text2.Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
if (array2.Length >= 3 && int.TryParse(array2[2], out var result))
{
list.Add(new GameServer
{
Name = array2[0].Replace('-', ' ').Replace('_', ' '),
Ip = array2[1],
Port = result
});
}
}
}
return list;
}
public static int Ping(string ip, int port)
{
Stopwatch stopwatch = Stopwatch.StartNew();
try
{
using TcpClient tcpClient = new TcpClient();
IAsyncResult asyncResult = tcpClient.BeginConnect(ip, port, null, null);
if (!asyncResult.AsyncWaitHandle.WaitOne(1500))
{
return -2;
}
tcpClient.EndConnect(asyncResult);
return (int)Math.Max(1L, stopwatch.ElapsedMilliseconds);
}
catch
{
return -2;
}
}
}
internal class NewsItem
{
public string Date;
public string Text;
public string Url;
public bool Header;
}
internal static class News
{
public static List<NewsItem> Fetch(string baseUrl)
{
List<NewsItem> list = new List<NewsItem>();
using WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
string[] array = webClient.DownloadString(baseUrl + "launcher/news.txt").Split(new char[1] { '\n' });
foreach (string text in array)
{
string text2 = text.Trim();
if (text2.Length != 0)
{
if (text2.StartsWith("#"))
{
list.Add(new NewsItem
{
Header = true,
Text = text2.TrimStart(new char[1] { '#' }).Trim()
});
}
else
{
string[] array2 = text2.Split(new char[1] { '|' });
list.Add(new NewsItem
{
Date = ((array2.Length > 1) ? array2[0].Trim() : ""),
Text = ((array2.Length > 1) ? array2[1] : array2[0]).Trim(),
Url = ((array2.Length > 2) ? array2[2].Trim() : null)
});
}
}
}
return list;
}
}
internal class ManifestEntry
{
public string Sha1;
public string Path;
public long Size;
}
internal class Updater
{
public string RemoteVersion = "?";
public List<ManifestEntry> Pending = new List<ManifestEntry>();
private readonly string baseUrl;
private readonly Dictionary<string, string[]> cache = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
public bool SelfUpdatedRestart;
private static string CachePath => Path.Combine(Paths.Root, "launcher_cache.txt");
public static string LocalVersion
{
get
{
string path = Path.Combine(Paths.Root, "launcher_version.txt");
if (!File.Exists(path))
{
return "original";
}
return File.ReadAllText(path).Trim();
}
}
public Updater(string baseUrl)
{
this.baseUrl = baseUrl;
if (!File.Exists(CachePath))
{
return;
}
string[] array = File.ReadAllLines(CachePath);
foreach (string text in array)
{
string[] array2 = text.Split(new char[1] { '\t' });
if (array2.Length == 4)
{
cache[array2[0]] = array2;
}
}
}
private static string Sha1Of(string file)
{
using FileStream inputStream = File.OpenRead(file);
using SHA1 sHA = SHA1.Create();
return BitConverter.ToString(sHA.ComputeHash(inputStream)).Replace("-", "").ToLowerInvariant();
}
private string LocalSha1(string rel, bool force)
{
string text = Path.Combine(Paths.Root, rel);
if (!File.Exists(text))
{
return null;
}
FileInfo fileInfo = new FileInfo(text);
if (!force && cache.TryGetValue(rel, out var value) && value[1] == fileInfo.Length.ToString() && value[2] == fileInfo.LastWriteTimeUtc.Ticks.ToString())
{
return value[3];
}
string text2 = Sha1Of(text);
cache[rel] = new string[4]
{
rel,
fileInfo.Length.ToString(),
fileInfo.LastWriteTimeUtc.Ticks.ToString(),
text2
};
return text2;
}
private void SaveCache()
{
List<string> list = new List<string>();
foreach (string[] value in cache.Values)
{
list.Add(string.Join("\t", value));
}
File.WriteAllLines(CachePath, list.ToArray());
}
public void Check(bool force, Action<string, int> progress)
{
Pending.Clear();
string text = Security.FetchSigned(baseUrl + "launcher/manifest.txt");
List<ManifestEntry> list = new List<ManifestEntry>();
string[] array = text.Split(new char[1] { '\n' });
foreach (string text2 in array)
{
string text3 = text2.TrimEnd(new char[1] { '\r' });
if (text3.StartsWith("#version"))
{
RemoteVersion = text3.Substring(8).Trim();
continue;
}
string[] array2 = text3.Split(new char[1] { '\t' });
if (array2.Length == 3)
{
if (!InsideRoot(array2[2]))
{
throw new IOException("Rejected manifest entry outside the game folder: " + array2[2]);
}
list.Add(new ManifestEntry
{
Sha1 = array2[0],
Size = long.Parse(array2[1]),
Path = array2[2]
});
}
}
for (int j = 0; j < list.Count; j++)
{
progress("Verifying " + list[j].Path, j * 100 / Math.Max(1, list.Count));
if (LocalSha1(list[j].Path, force) != list[j].Sha1)
{
Pending.Add(list[j]);
}
}
SaveCache();
if (Pending.Count == 0)
{
File.WriteAllText(Path.Combine(Paths.Root, "launcher_version.txt"), RemoteVersion);
}
}
private static bool InsideRoot(string rel)
{
return InsideDir(Paths.Root, rel);
}
public static bool InsideDir(string dir, string rel)
{
if (rel.Length == 0 || Path.IsPathRooted(rel) || rel.IndexOf(':') >= 0)
{
return false;
}
string text = Path.GetFullPath(dir).TrimEnd(new char[1] { '\\' }) + "\\";
string fullPath;
try
{
fullPath = Path.GetFullPath(Path.Combine(text, rel));
}
catch (ArgumentException)
{
return false;
}
catch (NotSupportedException)
{
return false;
}
return fullPath.StartsWith(text, StringComparison.OrdinalIgnoreCase);
}
public void Download(Action<string, int> progress)
{
long num = 0L;
long num2 = 0L;
foreach (ManifestEntry item in Pending)
{
num += item.Size;
}
Stopwatch stopwatch = Stopwatch.StartNew();
bool flag = false;
foreach (ManifestEntry item2 in Pending)
{
string requestUriString = baseUrl + "launcher/files/" + item2.Path.Replace('\\', '/') + "?v=" + item2.Sha1;
string text = Path.Combine(Paths.Root, item2.Path);
string text2 = text + ".download";
Directory.CreateDirectory(Path.GetDirectoryName(text));
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString);
using (WebResponse webResponse = httpWebRequest.GetResponse())
{
using Stream stream = webResponse.GetResponseStream();
using FileStream fileStream = File.Create(text2);
byte[] array = new byte[65536];
int num3;
while ((num3 = stream.Read(array, 0, array.Length)) > 0)
{
fileStream.Write(array, 0, num3);
num2 += num3;
double num4 = (double)num2 / 1024.0 / Math.Max(0.001, stopwatch.Elapsed.TotalSeconds);
progress($"Downloading {item2.Path} ({num4:0} KB/s)", (int)(num2 * 100 / Math.Max(1L, num)));
}
}
if (Sha1Of(text2) != item2.Sha1)
{
File.Delete(text2);
throw new IOException("Checksum mismatch for " + item2.Path);
}
if (string.Equals(Path.GetFullPath(text), Application.ExecutablePath, StringComparison.OrdinalIgnoreCase))
{
if (File.Exists(text + ".old"))
{
File.Delete(text + ".old");
}
File.Move(text, text + ".old");
flag = true;
}
else if (File.Exists(text))
{
File.Delete(text);
}
File.Move(text2, text);
cache.Remove(item2.Path);
LocalSha1(item2.Path, force: true);
}
File.WriteAllText(Path.Combine(Paths.Root, "launcher_version.txt"), RemoteVersion);
SaveCache();
Pending.Clear();
if (flag)
{
SelfUpdatedRestart = true;
}
}
public static void FinishSelfUpdate()
{
try
{
string path = Application.ExecutablePath + ".old";
if (File.Exists(path))
{
File.Delete(path);
}
}
catch
{
}
}
}
internal class SettingsForm : Form
{
private readonly LauncherConfig cfg;
private readonly IniFile ini = new IniFile(Paths.PlayerIni);
private ComboBox cbRes;
private RadioButton rbFull;
private RadioButton rbWin;
private RadioButton rbC16;
private RadioButton rbC32;
private TrackBar tbTex;
private TrackBar tbFxLod;
private TrackBar tbFxDist;
private ComboBox cbAa;
private CheckBox[] chkSound = (CheckBox[])(object)new CheckBox[4];
private TrackBar[] tbVol = (TrackBar[])(object)new TrackBar[4];
private CheckBox chkClose;
private Label lblTest;
private static readonly string[] SoundKeys = new string[4] { "Music", "Sound", "Skill", "Interface" };
private static readonly string[] SoundNames = new string[4] { "Music", "Ambient sound", "Skill sounds", "Interface sounds" };
public SettingsForm(LauncherConfig cfg)
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Expected O, but got Unknown
this.cfg = cfg;
((Control)this).SuspendLayout();
((ContainerControl)this).AutoScaleDimensions = new SizeF(96f, 96f);
((ContainerControl)this).AutoScaleMode = (AutoScaleMode)2;
((Control)this).Text = "Zu Online - Options";
((Form)this).FormBorderStyle = (FormBorderStyle)3;
bool maximizeBox = (((Form)this).MinimizeBox = false);
((Form)this).MaximizeBox = maximizeBox;
((Form)this).StartPosition = (FormStartPosition)4;
((Form)this).ClientSize = new Size(420, 400);
((Control)this).BackColor = Color.FromArgb(14, 34, 38);
((Control)this).ForeColor = Color.FromArgb(230, 235, 230);
((Control)this).Font = new Font("Segoe UI", 9f);
TabControl val = new TabControl();
((Control)val).Location = new Point(10, 10);
((Control)val).Size = new Size(400, 340);
TabControl val2 = val;
val2.TabPages.Add(DisplayTab());
val2.TabPages.Add(GraphicsTab());
val2.TabPages.Add(SoundTab());
val2.TabPages.Add(NetworkTab());
((Control)this).Controls.Add((Control)(object)val2);
Button val3 = new Button();
((Control)val3).Text = "Save";
((Control)val3).Location = new Point(244, 360);
((Control)val3).Size = new Size(80, 28);
val3.DialogResult = (DialogResult)1;
((ButtonBase)val3).FlatStyle = (FlatStyle)0;
((Control)val3).BackColor = Color.FromArgb(25, 110, 105);
Button val4 = val3;
Button val5 = new Button();
((Control)val5).Text = "Cancel";
((Control)val5).Location = new Point(330, 360);
((Control)val5).Size = new Size(80, 28);
val5.DialogResult = (DialogResult)2;
((ButtonBase)val5).FlatStyle = (FlatStyle)0;
Button val6 = val5;
EventHandler eventHandler = delegate
{
SaveAll();
};
((Control)val4).Click += eventHandler;
((Control)this).Controls.Add((Control)(object)val4);
((Control)this).Controls.Add((Control)(object)val6);
((Form)this).AcceptButton = (IButtonControl)(object)val4;
((Form)this).CancelButton = (IButtonControl)(object)val6;
((Control)this).ResumeLayout(true);
}
private TabPage Page(string title)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
TabPage val = new TabPage(title);
((Control)val).BackColor = Color.FromArgb(18, 44, 48);
((Control)val).ForeColor = ((Control)this).ForeColor;
return val;
}
private Label Lbl(Control parent, string text, int x, int y)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
Label val = new Label();
((Control)val).Text = text;
((Control)val).Location = new Point(x, y);
((Control)val).AutoSize = true;
Label val2 = val;
parent.Controls.Add((Control)(object)val2);
return val2;
}
private TabPage DisplayTab()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Expected O, but got Unknown
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Expected O, but got Unknown
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Expected O, but got Unknown
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Expected O, but got Unknown
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Expected O, but got Unknown
TabPage val = Page("Display");
Lbl((Control)(object)val, "Resolution", 16, 20);
ComboBox val2 = new ComboBox();
((Control)val2).Location = new Point(130, 16);
((Control)val2).Width = 140;
val2.DropDownStyle = (ComboBoxStyle)2;
cbRes = val2;
foreach (Size item in Display.Modes())
{
cbRes.Items.Add((object)(item.Width + " x " + item.Height));
}
IniFile iniFile = new IniFile(Paths.PlayerIni);
Display.Repair(iniFile);
string text = iniFile.Get("display", "ScreenWidth", "1024") + " x " + iniFile.Get("display", "ScreenHeight", "768");
cbRes.SelectedItem = (cbRes.Items.Contains((object)text) ? text : cbRes.Items[cbRes.Items.Count - 1]);
((Control)val).Controls.Add((Control)(object)cbRes);
Lbl((Control)(object)val, "Mode", 16, 60);
RadioButton val3 = new RadioButton();
((Control)val3).Text = "Fullscreen";
((Control)val3).Location = new Point(130, 58);
((Control)val3).AutoSize = true;
rbFull = val3;
RadioButton val4 = new RadioButton();
((Control)val4).Text = "Windowed";
((Control)val4).Location = new Point(230, 58);
((Control)val4).AutoSize = true;
rbWin = val4;
((cfg.Borderless || ini.GetInt("display", "ScreenType", 1) == 0) ? rbFull : rbWin).Checked = true;
rbFull.CheckedChanged += delegate
{
((Control)cbRes).Enabled = !rbFull.Checked;
};
((Control)cbRes).Enabled = !rbFull.Checked;
Panel val5 = new Panel();
((Control)val5).Location = new Point(0, 0);
((Control)val5).Size = new Size(0, 0);
((Control)val).Controls.Add((Control)(object)rbFull);
((Control)val).Controls.Add((Control)(object)rbWin);
Lbl((Control)(object)val, "Colour depth", 16, 100);
Panel val6 = new Panel();
((Control)val6).Location = new Point(126, 94);
((Control)val6).Size = new Size(200, 28);
Panel val7 = val6;
RadioButton val8 = new RadioButton();
((Control)val8).Text = "16-bit";
((Control)val8).Location = new Point(4, 4);
((Control)val8).AutoSize = true;
rbC16 = val8;
RadioButton val9 = new RadioButton();
((Control)val9).Text = "32-bit";
((Control)val9).Location = new Point(104, 4);
((Control)val9).AutoSize = true;
rbC32 = val9;
((ini.GetInt("display", "ScreenDepth", 32) == 16) ? rbC16 : rbC32).Checked = true;
((Control)val7).Controls.Add((Control)(object)rbC16);
((Control)val7).Controls.Add((Control)(object)rbC32);
((Control)val).Controls.Add((Control)(object)val7);
((Control)Lbl((Control)(object)val, "Changes apply the next time the game starts.", 16, 150)).ForeColor = Color.FromArgb(150, 170, 165);
return val;
}
private TrackBar Slider(Control parent, string label, int y, int max, int value, string[] names)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
Lbl(parent, label, 16, y + 6);
TrackBar val2 = new TrackBar();
((Control)val2).Location = new Point(130, y);
((Control)val2).Width = 160;
val2.Minimum = 0;
val2.Maximum = max;
val2.Value = Math.Max(0, Math.Min(max, value));
val2.TickFrequency = 1;
val2.LargeChange = 1;
TrackBar tb = val2;
Label val = Lbl(parent, names[tb.Value], 300, y + 6);
tb.ValueChanged += delegate
{
((Control)val).Text = names[tb.Value];
};
parent.Controls.Add((Control)(object)tb);
return tb;
}
private TabPage GraphicsTab()
{
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Expected O, but got Unknown
TabPage val = Page("Graphics");
string[] names = new string[3] { "Low", "Medium", "High" };
tbTex = Slider((Control)(object)val, "Texture detail", 14, 2, ini.GetInt("display", "TextureDetialType", 2), names);
tbFxLod = Slider((Control)(object)val, "Effect detail", 64, 2, ini.GetInt("display", "FxLOD", 2), names);
tbFxDist = Slider((Control)(object)val, "Effect distance", 114, 2, ini.GetInt("display", "FxDistance", 2), new string[3] { "Near", "Medium", "Far" });
Lbl((Control)(object)val, "Anti-aliasing", 16, 170);
ComboBox val2 = new ComboBox();
((Control)val2).Location = new Point(130, 166);
((Control)val2).Width = 100;
val2.DropDownStyle = (ComboBoxStyle)2;
cbAa = val2;
cbAa.Items.AddRange(new object[4] { "Off", "2x", "4x", "8x" });
int @int = ini.GetInt("display", "AntiAliased", 0);
((ListControl)cbAa).SelectedIndex = ((@int >= 8) ? 3 : ((@int >= 4) ? 2 : ((@int >= 2) ? 1 : 0)));
((Control)val).Controls.Add((Control)(object)cbAa);
Lbl((Control)(object)val, "Presets", 16, 220);
string[] array = new string[3] { "Low", "Medium", "High" };
for (int i = 0; i < 3; i++)
{
int level = i;
Button val3 = new Button();
((Control)val3).Text = array[i];
((Control)val3).Location = new Point(130 + i * 82, 214);
((Control)val3).Size = new Size(76, 26);
((ButtonBase)val3).FlatStyle = (FlatStyle)0;
Button val4 = val3;
((Control)val4).Click += delegate
{
tbTex.Value = level;
tbFxLod.Value = level;
tbFxDist.Value = level;
((ListControl)cbAa).SelectedIndex = ((level == 2) ? 1 : 0);
};
((Control)val).Controls.Add((Control)(object)val4);
}
return val;
}
private TabPage SoundTab()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Expected O, but got Unknown
TabPage val = Page("Sound");
for (int i = 0; i < 4; i++)
{
int num = 16 + i * 56;
CheckBox[] array = chkSound;
int num2 = i;
CheckBox val2 = new CheckBox();
((Control)val2).Text = SoundNames[i];
((Control)val2).Location = new Point(16, num + 4);
((Control)val2).AutoSize = true;
val2.Checked = ini.Get("Sound", SoundKeys[i] + "VolumeEnabled", "1") != "0";
array[num2] = val2;
TrackBar[] array2 = tbVol;
int num3 = i;
TrackBar val3 = new TrackBar();
((Control)val3).Location = new Point(160, num);
((Control)val3).Width = 180;
val3.Minimum = 0;
val3.Maximum = 100;
val3.TickFrequency = 10;
val3.Value = Math.Max(0, Math.Min(100, ini.GetInt("Sound", SoundKeys[i] + "Volume", 75)));
array2[num3] = val3;
Label lbl = Lbl((Control)(object)val, tbVol[i].Value + "%", 345, num + 6);
TrackBar tb = tbVol[i];
CheckBox cb = chkSound[i];
tb.ValueChanged += delegate
{
((Control)lbl).Text = tb.Value + "%";
};
cb.CheckedChanged += delegate
{
((Control)tb).Enabled = cb.Checked;
};
((Control)tb).Enabled = cb.Checked;
((Control)val).Controls.Add((Control)(object)chkSound[i]);
((Control)val).Controls.Add((Control)(object)tbVol[i]);
}
return val;
}
private TabPage NetworkTab()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
TabPage val = Page("Network");
Lbl((Control)(object)val, "Server address", 16, 22);
Lbl((Control)(object)val, cfg.ServerHost, 130, 22);
Button val2 = new Button();
((Control)val2).Text = "Test";
((Control)val2).Location = new Point(290, 16);
((Control)val2).Size = new Size(70, 26);
((ButtonBase)val2).FlatStyle = (FlatStyle)0;
Button val3 = val2;
lblTest = Lbl((Control)(object)val, "", 130, 52);
((Control)val3).Click += delegate
{
((Control)lblTest).Text = "Testing...";
((Control)lblTest).ForeColor = ((Control)this).ForeColor;
string host = cfg.ServerHost;
ThreadPool.QueueUserWorkItem(delegate
{
int web = ServerList.Ping(host, 80);
int login = GameTunnel.LoginPing(host, cfg.BaseUrl);
if (((Control)this).IsDisposed || !((Control)this).IsHandleCreated)
{
return;
}
try
{
((Control)this).BeginInvoke((Delegate)(Action)delegate
{
if (!((Control)lblTest).IsDisposed)
{
((Control)lblTest).Text = "Web: " + ((web > 0) ? (web + " ms") : "offline") + " Login: " + ((login > 0) ? (login + " ms") : "offline");
((Control)lblTest).ForeColor = ((web > 0 && login > 0) ? Color.LightGreen : Color.Salmon);
}
});
}
catch (ObjectDisposedException)
{
}
catch (InvalidOperationException)
{
}
});
};
((Control)val).Controls.Add((Control)(object)val3);
CheckBox val4 = new CheckBox();
((Control)val4).Text = "Close the launcher when the game starts";
((Control)val4).Location = new Point(16, 96);
((Control)val4).AutoSize = true;
val4.Checked = cfg.CloseOnPlay;
chkClose = val4;
((Control)val).Controls.Add((Control)(object)chkClose);
((Control)Lbl((Control)(object)val, "The address is used for the server list, news, updates\nand registration (http://<address>/). Set by the distributor.", 16, 130)).ForeColor = Color.FromArgb(150, 170, 165);
return val;
}
private void SaveAll()
{
string[] array = (((string)cbRes.SelectedItem) ?? "1024 x 768").Split(new char[1] { 'x' });
ini.Set("display", "ScreenWidth", array[0].Trim());
ini.Set("display", "ScreenHeight", array[1].Trim());
ini.Set("display", "ScreenType", "1");
cfg.Borderless = rbFull.Checked;
if (rbFull.Checked)
{
Rectangle bounds = Screen.PrimaryScreen.Bounds;
ini.Set("display", "ScreenWidth", bounds.Width.ToString());
ini.Set("display", "ScreenHeight", bounds.Height.ToString());
}
ini.Set("display", "ScreenDepth", rbC16.Checked ? "16" : "32");
ini.Set("display", "TextureDetialType", tbTex.Value.ToString());
ini.Set("display", "FxLOD", tbFxLod.Value.ToString());
ini.Set("display", "FxDistance", tbFxDist.Value.ToString());
ini.Set("display", "AntiAliased", (new string[4] { "0", "2", "4", "8" })[Math.Max(0, ((ListControl)cbAa).SelectedIndex)]);
for (int i = 0; i < 4; i++)
{
ini.Set("Sound", SoundKeys[i] + "VolumeEnabled", chkSound[i].Checked ? "1" : "0");
ini.Set("Sound", SoundKeys[i] + "Volume", tbVol[i].Value.ToString());
}
ini.Save();
cfg.CloseOnPlay = chkClose.Checked;
cfg.Save();
}
}
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
78 frames · screen recording · 132sBehavior summary
ran 132s1 process(es) observed
Evasion / anti-analysis checks
1 checkStatically visible checks (RDTSC/CPUID/red-pill instructions, anti-debug APIs) plus runtime evasion signals. Instruction-level interception at runtime requires hypervisor introspection (VMI).
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 800 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.
ZuLauncher.exe
1 processAttributed activity
Not attributed to any process
1 kindThese 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
0 file · 10 registry · sample scope
| Operation | Target | Process |
|---|---|---|
| create |
\REGISTRY\MACHINE\Software\WOW6432Node\Microsoft\Tracing
|
ZuLauncher.exe pid 2240 |
| create |
\REGISTRY\MACHINE\Software\WOW6432Node\Microsoft\Tracing\ZuLauncher_RASAPI32
|
ZuLauncher.exe pid 2240 |
| create |
\REGISTRY\MACHINE\Software\WOW6432Node\Microsoft\Tracing\ZuLauncher_RASMANCS
|
ZuLauncher.exe pid 2240 |
| create |
\REGISTRY\MACHINE\SOFTWARE\Policies\Microsoft\Windows\TenantRestrictions\Payload
|
ZuLauncher.exe pid 2240 |
| create |
TenantRestrictions\Payload
|
ZuLauncher.exe pid 2240 |
| create |
SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
|
ZuLauncher.exe pid 2240 |
| create |
\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters
|
ZuLauncher.exe pid 2240 |
| setvalue |
SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
SavedLegacySettings = <56 bytes>
|
- |
| setvalue |
SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
DefaultConnectionSettings = <56 bytes>
|
- |
| setvalue |
SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
WinHttpSettings = <20 bytes>
|
- |
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.
Earlier analysis of these bytes
1 earlier runEarlier analyses of the identical file, matched by SHA-256. Same bytes, same questions - what this platform found the last time it looked is evidence about the file in front of you now.
| Run | Analysed | Module | Verdict | Score |
|---|---|---|---|---|
| #2709 | 2026-10-09 15:28 | File Analysis | Suspicious56 | 56/100 |
File reputation
4 clear · 2 not checked| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| MalwareBazaar hash feed | File hash | clean | not in feed | 3,387 records 49 minutes ago |
| MalwareBazaar ransomware feed | File hash | clean | not in feed | 3,348 records 4 hours ago |
| ThreatFox hash IOCs | File hash | clean | not in feed | 1,689 records 49 minutes ago |
| URLhaus payload hashes | File hash | clean | not in feed | 1,310 records 49 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
7 clear · 1 could not answer| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| URLhaus | IP / domain / URL | feed unavailable | 2 observed indicators, none listed | no records ingested |
| blocklist.de | IP / domain / URL | clean | 2 observed indicators, none listed | 26.3k records 49 minutes ago |
| CINS Army | IP / domain / URL | clean | 2 observed indicators, none listed | 15k records 49 minutes ago |
| Emerging Threats | IP / domain / URL | clean | 2 observed indicators, none listed | 511 records 49 minutes ago |
| Feodo Tracker | IP / domain / URL | clean | 2 observed indicators, none listed | 5 records 50 minutes ago |
| IPsum | IP / domain / URL | clean | 2 observed indicators, none listed | 18.4k records 49 minutes ago |
| Phishing.Database | IP / domain / URL | clean | 2 observed indicators, none listed | 391.5k records 4 hours ago |
| ThreatFox | IP / domain / URL | clean | 2 observed indicators, none listed | 1,689 records 49 minutes ago |
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 50 minutes ago |
Tooling catalogs
4 clear| Source | Checks | Result | Detail | Feed |
|---|---|---|---|---|
| LOLBAS | Process image paths | clean | 1 process image path, none masqueraded | 245 records 50 minutes ago |
| LOLBootloaders | File hash | clean | not a known vulnerable bootloader | 520 records 49 minutes ago |
| LOLDrivers | File hash | clean | not a known vulnerable driver | 2,346 records 50 minutes ago |
| LOLRMM | Names and domains | clean | 3 name/domain indicators checked, no remote-management tooling | 358 records 49 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 |
|---|---|---|---|
| suspicious | sample_sha256 | 52acd67689fd2d34c46daf5cbd4419a232e20a1ba4fa51e20a9fba65e8e0a416 | Submitted sample (SHA256) |
| suspicious | sample_md5 | b5a2cd74926f0c2b91cc23f975e46223 | Submitted sample (MD5) |
| suspicious | imphash | f34d5f2d4577ed6d9ceec516c1f5a744 | Import table hash (imphash) |
Registry indicators
1| Severity | Type | Indicator | Description |
|---|---|---|---|
| suspicious | registry_key | \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters | Autostart / persistence key |
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
Sigma: auto_file_2710_sigma_reg
Auto-generatedtitle: Auto-generated registry behavior rule (sandbox scan 2710)
id: sandbox-auto-2710-reg
status: experimental
description: Auto-generated from sandbox scan 2710
logsource:
category: registry_event
product: windows
detection:
selection:
TargetObject|contains:
- '\REGISTRY\MACHINE\Software\WOW6432Node\Microsoft\Tracing'
- '\REGISTRY\MACHINE\Software\WOW6432Node\Microsoft\Tracing\ZuLauncher_RASAPI32'
- '\REGISTRY\MACHINE\Software\WOW6432Node\Microsoft\Tracing\ZuLauncher_RASMANCS'
- '\REGISTRY\MACHINE\SOFTWARE\Policies\Microsoft\Windows\TenantRestrictions\Payload'
- 'TenantRestrictions\Payload'
- 'SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections'
- '\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters'
condition: selection
level: mediumExtracted 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/2710Structured 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
2 runsThis file has been analysed more than once. The report below is the run that found the most, which is not always the most recent one.
| Submitted | Environment | Verdict | Score |
|---|---|---|---|
| 2026-10-09 15:38 Shown below | Windows 10 22H2 | Suspicious | 56/100 |
| 2026-10-09 15:25 | Windows 10 22H2 | Suspicious | 56/100 |