├── .gitignore ├── .nuget ├── NuGet.Config ├── NuGet.exe └── NuGet.targets ├── CalculateHash ├── App.config ├── CalculateHash.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── Utilities │ └── HashUtilities.cs ├── LICENSE ├── MapleLauncher.sln ├── MapleLauncher ├── App.config ├── IO │ └── Config.cs ├── MapleKeys.cs ├── MapleLauncher.csproj ├── Net │ ├── Acceptor.cs │ ├── ClientSession.cs │ ├── InPacket.cs │ ├── OutPacket.cs │ ├── PacketException.cs │ ├── ServerInfo.cs │ ├── ServerSession.cs │ └── Session.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── maple_one.png │ ├── mercedes_skill_build_guide_maplestory.jpg │ ├── ss+(2015-07-03+at+02.25.47).jpg │ └── start.png ├── Utilities │ ├── HashUtilities.cs │ ├── JsonUtilities.cs │ └── NetworkUtilities.cs ├── frmMain.Designer.cs ├── frmMain.cs ├── frmMain.resx ├── frmSettings.Designer.cs ├── frmSettings.cs ├── frmSettings.resx ├── maple.ico └── packages.config └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yaminike/ms-MapleLauncher/a964e67f1be6101339f099a6c217e84810e65cbb/.nuget/NuGet.exe -------------------------------------------------------------------------------- /.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | 32 | 33 | 34 | 35 | $(SolutionDir).nuget 36 | 37 | 38 | 39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config 40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config 41 | 42 | 43 | 44 | $(MSBuildProjectDirectory)\packages.config 45 | $(PackagesProjectConfig) 46 | 47 | 48 | 49 | 50 | $(NuGetToolsPath)\NuGet.exe 51 | @(PackageSource) 52 | 53 | "$(NuGetExePath)" 54 | mono --runtime=v4.0.30319 "$(NuGetExePath)" 55 | 56 | $(TargetDir.Trim('\\')) 57 | 58 | -RequireConsent 59 | -NonInteractive 60 | 61 | "$(SolutionDir) " 62 | "$(SolutionDir)" 63 | 64 | 65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 67 | 68 | 69 | 70 | RestorePackages; 71 | $(BuildDependsOn); 72 | 73 | 74 | 75 | 76 | $(BuildDependsOn); 77 | BuildPackage; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /CalculateHash/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CalculateHash/CalculateHash.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E5E277BC-BFFD-4F6A-AA7D-E8BDE1E1592D} 8 | Exe 9 | Properties 10 | CalculateHash 11 | CalculateHash 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /CalculateHash/Program.cs: -------------------------------------------------------------------------------- 1 | using CalculateHash.Utilities; 2 | using System; 3 | 4 | namespace CalculateHash 5 | { 6 | internal static class Program 7 | { 8 | private static void Main(string[] args) 9 | { 10 | if (args.Length == 1) 11 | { 12 | string path = args[0]; 13 | string hash = HashUtilities.GetMD5HashFromFile(path); 14 | 15 | Console.WriteLine("Hash: {0}", hash); 16 | } 17 | 18 | Console.WriteLine("Press any key to quit..."); 19 | Console.ReadKey(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CalculateHash/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CalculateHash")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CalculateHash")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e5e277bc-bffd-4f6a-aa7d-e8bde1e1592d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CalculateHash/Utilities/HashUtilities.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | 5 | namespace CalculateHash.Utilities 6 | { 7 | internal static class HashUtilities 8 | { 9 | public static string GetMD5HashFromFile(string path) 10 | { 11 | FileStream file = new FileStream(path, FileMode.Open); 12 | MD5 md5 = new MD5CryptoServiceProvider(); 13 | byte[] retVal = md5.ComputeHash(file); 14 | file.Close(); 15 | 16 | StringBuilder sb = new StringBuilder(); 17 | 18 | for (int i = 0; i < retVal.Length; i++) 19 | { 20 | sb.Append(retVal[i].ToString("X2")); 21 | } 22 | 23 | return sb.ToString(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /MapleLauncher.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapleLauncher", "MapleLauncher\MapleLauncher.csproj", "{F5FB4492-EC7D-4B96-8086-A10A929046E2}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalculateHash", "CalculateHash\CalculateHash.csproj", "{E5E277BC-BFFD-4F6A-AA7D-E8BDE1E1592D}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{568C4FEE-530A-444B-8BE2-8CE7C43217B3}" 11 | ProjectSection(SolutionItems) = preProject 12 | .nuget\NuGet.Config = .nuget\NuGet.Config 13 | .nuget\NuGet.exe = .nuget\NuGet.exe 14 | .nuget\NuGet.targets = .nuget\NuGet.targets 15 | EndProjectSection 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Any CPU = Debug|Any CPU 20 | Release|Any CPU = Release|Any CPU 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {F5FB4492-EC7D-4B96-8086-A10A929046E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {F5FB4492-EC7D-4B96-8086-A10A929046E2}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {F5FB4492-EC7D-4B96-8086-A10A929046E2}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {F5FB4492-EC7D-4B96-8086-A10A929046E2}.Release|Any CPU.Build.0 = Release|Any CPU 27 | {E5E277BC-BFFD-4F6A-AA7D-E8BDE1E1592D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {E5E277BC-BFFD-4F6A-AA7D-E8BDE1E1592D}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {E5E277BC-BFFD-4F6A-AA7D-E8BDE1E1592D}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {E5E277BC-BFFD-4F6A-AA7D-E8BDE1E1592D}.Release|Any CPU.Build.0 = Release|Any CPU 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /MapleLauncher/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MapleLauncher/IO/Config.cs: -------------------------------------------------------------------------------- 1 | namespace MapleLauncher.IO 2 | { 3 | public sealed class Config 4 | { 5 | public string MapleStoryPath { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /MapleLauncher/MapleKeys.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Net; 5 | 6 | namespace MapleLauncher 7 | { 8 | public static class MapleKeys 9 | { 10 | private static Dictionary, byte[]>> Keys { get; set; } 11 | 12 | public static void Initialize() 13 | { 14 | MapleKeys.Keys = new Dictionary, byte[]>>(); 15 | 16 | try 17 | { 18 | if (File.Exists("noupdate.txt")) 19 | { 20 | throw new Exception(); // NOTE: Trigger offline-load. 21 | } 22 | 23 | HttpWebRequest req = WebRequest.Create("http://direct.craftnet.nl/app_updates/get_keys.php?source=SRK&version=4") as HttpWebRequest; 24 | 25 | req.Proxy = null; 26 | 27 | using (HttpWebResponse response = req.GetResponse() as HttpWebResponse) 28 | { 29 | using (StreamReader sr = new StreamReader(response.GetResponseStream())) 30 | { 31 | string text = sr.ReadToEnd(); 32 | 33 | MapleKeys.Load(text); 34 | 35 | File.AppendAllText("MapleKeys.txt", text); 36 | } 37 | } 38 | } 39 | catch (Exception e) 40 | { 41 | if (File.Exists("MapleKeys.txt")) 42 | { 43 | string text = File.ReadAllText("MapleKeys.txt"); 44 | 45 | MapleKeys.Load(text); 46 | } 47 | else 48 | { 49 | throw new Exception("Unable to initialize MapleKeys."); 50 | } 51 | } 52 | 53 | MapleKeys.Add(Localisation.Global, 118, 1, new byte[] { 54 | 0x5A, // Full key's lost 55 | 0x22, 56 | 0xFB, 57 | 0xD1, 58 | 0x8F, 59 | 0x93, 60 | 0xCD, 61 | 0xE6, 62 | }); 63 | } 64 | 65 | private static void Load(string pContents) 66 | { 67 | string[] lines = pContents.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); 68 | 69 | for (int i = 0; i < lines.Length; i += 2) 70 | { 71 | var firstLine = lines[i]; 72 | var semicolonPos = firstLine.IndexOf(':'); 73 | var dotPos = firstLine.IndexOf('.'); 74 | 75 | Localisation localisation = (Localisation)(byte.Parse(firstLine.Substring(0, semicolonPos))); 76 | ushort version = ushort.Parse(firstLine.Substring(semicolonPos + 1, dotPos - (semicolonPos + 1))); 77 | byte subVersion = byte.Parse(firstLine.Substring(dotPos + 1)); 78 | 79 | string tmpkey = lines[i + 1]; 80 | byte[] realkey = new byte[8]; 81 | int tmp = 0; 82 | 83 | for (int j = 0; j < 4 * 8 * 2; j += 4 * 2) 84 | { 85 | realkey[tmp++] = byte.Parse(tmpkey[j] + "" + tmpkey[j + 1], System.Globalization.NumberStyles.HexNumber); 86 | } 87 | 88 | MapleKeys.Add(localisation, version, subVersion, realkey); 89 | } 90 | } 91 | 92 | private static void Add(Localisation localisation, ushort version, byte subVersion, byte[] key) 93 | { 94 | if (!MapleKeys.Keys.ContainsKey(localisation)) 95 | { 96 | MapleKeys.Keys.Add(localisation, new Dictionary, byte[]>()); 97 | } 98 | 99 | MapleKeys.Keys[localisation].Add(new KeyValuePair(version, subVersion), key); 100 | } 101 | 102 | public static byte[] Get(ServerInfo info) 103 | { 104 | if (MapleKeys.Keys == null) 105 | { 106 | MapleKeys.Initialize(); 107 | } 108 | 109 | if (!MapleKeys.Keys.ContainsKey(info.Localisation)) 110 | { 111 | return null; 112 | } 113 | 114 | byte subVersion = byte.Parse(info.Subversion); 115 | 116 | for (; info.Version > 0; info.Version--) 117 | { 118 | for (byte b = subVersion; b > 0; b--) 119 | { 120 | var container = new KeyValuePair(info.Version, b); 121 | 122 | if (MapleKeys.Keys[info.Localisation].ContainsKey(container)) 123 | { 124 | byte[] key = MapleKeys.Keys[info.Localisation][container]; 125 | byte[] ret = new byte[32]; 126 | 127 | for (int i = 0; i < 8; i++) 128 | { 129 | ret[i * 4] = key[i]; 130 | } 131 | 132 | return ret; 133 | } 134 | } 135 | } 136 | 137 | return null; 138 | } 139 | } 140 | } -------------------------------------------------------------------------------- /MapleLauncher/MapleLauncher.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F5FB4492-EC7D-4B96-8086-A10A929046E2} 8 | WinExe 9 | Properties 10 | MapleLauncher 11 | MapleLauncher 12 | v4.0 13 | 512 14 | true 15 | 16 | ..\ 17 | true 18 | 19 | 20 | AnyCPU 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | true 29 | 30 | 31 | AnyCPU 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | maple.ico 41 | 42 | 43 | 44 | ..\packages\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll 45 | True 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Form 62 | 63 | 64 | frmMain.cs 65 | 66 | 67 | Form 68 | 69 | 70 | frmSettings.cs 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | frmMain.cs 89 | 90 | 91 | frmSettings.cs 92 | 93 | 94 | ResXFileCodeGenerator 95 | Resources.Designer.cs 96 | Designer 97 | 98 | 99 | True 100 | Resources.resx 101 | True 102 | 103 | 104 | 105 | SettingsSingleFileGenerator 106 | Settings.Designer.cs 107 | 108 | 109 | True 110 | Settings.settings 111 | True 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 129 | 130 | 131 | 132 | 139 | -------------------------------------------------------------------------------- /MapleLauncher/Net/Acceptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace MapleLauncher.Net 10 | { 11 | // kredit - patel 2017 to infinity 12 | public sealed class Acceptor 13 | { 14 | public const int Backlog = 25; 15 | 16 | public ushort Port { get; private set; } 17 | 18 | private readonly TcpListener m_listener; 19 | 20 | private bool m_disposed; 21 | 22 | public Action OnClientAccepted; 23 | 24 | public EndPoint LocalEndpoint 25 | { 26 | get 27 | { 28 | return this.m_listener.LocalEndpoint; 29 | } 30 | } 31 | 32 | public Acceptor(ushort port) : this(IPAddress.Any, port) { } 33 | 34 | public Acceptor(string ip, ushort port) : this(IPAddress.Parse(ip), port) { } 35 | 36 | public Acceptor(IPAddress ip, ushort port) 37 | { 38 | Port = port; 39 | m_listener = new TcpListener(IPAddress.Any, port); 40 | OnClientAccepted = null; 41 | m_disposed = false; 42 | } 43 | 44 | public void Start() 45 | { 46 | m_listener.Start(Backlog); 47 | m_listener.BeginAcceptSocket(EndAccept, null); 48 | } 49 | 50 | public void Stop() 51 | { 52 | Dispose(); 53 | } 54 | 55 | private void EndAccept(IAsyncResult iar) 56 | { 57 | if (m_disposed) { return; } 58 | 59 | Socket client = m_listener.EndAcceptSocket(iar); 60 | 61 | if (OnClientAccepted != null) 62 | OnClientAccepted(client); 63 | 64 | if (!m_disposed) 65 | m_listener.BeginAcceptSocket(EndAccept, null); 66 | } 67 | 68 | public void Dispose() 69 | { 70 | if (!m_disposed) 71 | { 72 | m_disposed = true; 73 | m_listener.Server.Close(); 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /MapleLauncher/Net/ClientSession.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Sockets; 2 | using System.Windows.Forms; 3 | 4 | namespace MapleLauncher.Net 5 | { 6 | public sealed class ClientSession : Session 7 | { 8 | public static ClientSession Instance { get; private set; } 9 | 10 | public ClientSession(Socket socket) 11 | : base(socket) 12 | { 13 | var server = new ServerSession(Program.IP, Program.Port); 14 | 15 | if (!server.Connect()) 16 | { 17 | frmMain.Instance.InformStatus("Unable to connect to server."); 18 | 19 | MessageBox.Show("Unable to connect to server. \nPlease try again later.", Program.Name, MessageBoxButtons.OK, MessageBoxIcon.Error); 20 | 21 | Application.Exit(); 22 | } 23 | } 24 | 25 | public override void Dispatch(InPacket inPacket) 26 | { 27 | using (OutPacket outPacket = new OutPacket(inPacket)) 28 | { 29 | if (ServerSession.Instance != null) 30 | { 31 | ServerSession.Instance.Send(outPacket.ToArray()); 32 | } 33 | } 34 | } 35 | 36 | public override void Terminate() 37 | { 38 | if (ServerSession.Instance != null) 39 | { 40 | ServerSession.Instance.Disconnect(); 41 | } 42 | 43 | ClientSession.Instance = null; 44 | 45 | frmMain.Instance.Listen(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /MapleLauncher/Net/InPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MapleLauncher.Net 4 | { 5 | public class InPacket 6 | { 7 | private readonly byte[] m_buffer; 8 | private int m_index; 9 | 10 | public int Position 11 | { 12 | get 13 | { 14 | return m_index; 15 | } 16 | } 17 | public int Available 18 | { 19 | get 20 | { 21 | return m_buffer.Length - m_index; 22 | } 23 | } 24 | 25 | public ushort OperationCode { get; private set; } 26 | 27 | public InPacket(byte[] packet, bool encryped = true) 28 | { 29 | m_buffer = packet; 30 | m_index = 0; 31 | 32 | if (encryped) 33 | { 34 | this.OperationCode = this.ReadUShort(); 35 | } 36 | } 37 | 38 | public void Reset() 39 | { 40 | this.m_index = 0; 41 | } 42 | 43 | private void CheckLength(int length) 44 | { 45 | if (m_index + length > m_buffer.Length || length < 0) 46 | throw new PacketException("Not enough space"); 47 | } 48 | 49 | public byte ReadByte() 50 | { 51 | CheckLength(1); 52 | return m_buffer[m_index++]; 53 | } 54 | public bool ReadBool() 55 | { 56 | return ReadByte() == 1; 57 | } 58 | public byte[] ReadBytes(int count) 59 | { 60 | CheckLength(count); 61 | var temp = new byte[count]; 62 | Buffer.BlockCopy(m_buffer, m_index, temp, 0, count); 63 | m_index += count; 64 | return temp; 65 | } 66 | public unsafe short ReadShort() 67 | { 68 | CheckLength(2); 69 | 70 | short value; 71 | 72 | fixed (byte* ptr = m_buffer) 73 | { 74 | value = *(short*)(ptr + m_index); 75 | } 76 | 77 | m_index += 2; 78 | 79 | return value; 80 | } 81 | public unsafe ushort ReadUShort() 82 | { 83 | CheckLength(2); 84 | 85 | ushort value; 86 | 87 | fixed (byte* ptr = m_buffer) 88 | { 89 | value = *(ushort*)(ptr + m_index); 90 | } 91 | 92 | m_index += 2; 93 | 94 | return value; 95 | } 96 | public unsafe int ReadInt() 97 | { 98 | CheckLength(4); 99 | 100 | int value; 101 | 102 | fixed (byte* ptr = m_buffer) 103 | { 104 | value = *(int*)(ptr + m_index); 105 | } 106 | 107 | m_index += 4; 108 | 109 | return value; 110 | } 111 | public unsafe long ReadLong() 112 | { 113 | CheckLength(8); 114 | 115 | long value; 116 | 117 | fixed (byte* ptr = m_buffer) 118 | { 119 | value = *(long*)(ptr + m_index); 120 | } 121 | 122 | m_index += 8; 123 | 124 | return value; 125 | } 126 | 127 | public string ReadString(int count = -1) 128 | { 129 | if (count == -1) 130 | { 131 | count = this.ReadShort(); 132 | } 133 | 134 | CheckLength(count); 135 | 136 | char[] final = new char[count]; 137 | 138 | for (int i = 0; i < count; i++) 139 | { 140 | final[i] = (char)ReadByte(); 141 | } 142 | 143 | return new string(final); 144 | } 145 | 146 | public byte[] ReadLeftoverBytes() 147 | { 148 | return this.ReadBytes(this.Available); 149 | } 150 | 151 | public void Skip(int count) 152 | { 153 | CheckLength(count); 154 | m_index += count; 155 | } 156 | 157 | public byte[] ToArray() 158 | { 159 | var final = new byte[m_buffer.Length]; 160 | Buffer.BlockCopy(m_buffer, 0, final, 0, m_buffer.Length); 161 | return final; 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /MapleLauncher/Net/OutPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.IO; 4 | 5 | namespace MapleLauncher.Net 6 | { 7 | public class OutPacket : IDisposable 8 | { 9 | public const int DefaultBufferSize = 32; 10 | 11 | private MemoryStream m_stream; 12 | private bool m_disposed; 13 | 14 | public int Position 15 | { 16 | get 17 | { 18 | return (int)m_stream.Position; 19 | } 20 | set 21 | { 22 | if (value <= 0) 23 | throw new PacketException("Value less than 1"); 24 | 25 | m_stream.Position = value; 26 | } 27 | } 28 | public bool Disposed 29 | { 30 | get 31 | { 32 | return m_disposed; 33 | } 34 | } 35 | 36 | public OutPacket() 37 | { 38 | m_stream = new MemoryStream(DefaultBufferSize); 39 | m_disposed = false; 40 | } 41 | 42 | public OutPacket(InPacket inPacket) 43 | { 44 | m_stream = new MemoryStream(DefaultBufferSize); 45 | m_disposed = false; 46 | WriteUShort(inPacket.OperationCode); 47 | WriteBytes(inPacket.ReadLeftoverBytes()); 48 | } 49 | 50 | public OutPacket(ushort opcode, int size = DefaultBufferSize) 51 | { 52 | m_stream = new MemoryStream(size); 53 | m_disposed = false; 54 | WriteUShort(opcode); 55 | } 56 | 57 | //From LittleEndianByteConverter by Shoftee 58 | private void Append(long value, int byteCount) 59 | { 60 | for (int i = 0; i < byteCount; i++) 61 | { 62 | m_stream.WriteByte((byte)value); 63 | value >>= 8; 64 | } 65 | } 66 | 67 | private void Reset(int position) 68 | { 69 | this.m_stream.Position = position; 70 | } 71 | 72 | public void WriteBool(bool value) 73 | { 74 | ThrowIfDisposed(); 75 | WriteByte(value ? (byte)1 : (byte)0); 76 | } 77 | public void WriteByte(byte value = 0) 78 | { 79 | ThrowIfDisposed(); 80 | m_stream.WriteByte(value); 81 | } 82 | 83 | public void WriteSByte(sbyte value = 0) 84 | { 85 | ThrowIfDisposed(); 86 | Append(value, 1); 87 | } 88 | 89 | public void WriteBytes(params byte[] value) 90 | { 91 | ThrowIfDisposed(); 92 | m_stream.Write(value, 0, value.Length); 93 | } 94 | public void WriteShort(short value = 0) 95 | { 96 | ThrowIfDisposed(); 97 | Append(value, 2); 98 | } 99 | public void WriteUShort(ushort value = 0) 100 | { 101 | ThrowIfDisposed(); 102 | Append(value, 2); 103 | } 104 | public void WriteInt(int value = 0) 105 | { 106 | ThrowIfDisposed(); 107 | Append(value, 4); 108 | } 109 | public void WriteUInt(uint value = 0) 110 | { 111 | ThrowIfDisposed(); 112 | Append(value, 4); 113 | } 114 | public void SetUInt(int position, uint value) 115 | { 116 | int temp = (int)this.Position; 117 | this.Reset(position); 118 | this.WriteUInt(value); 119 | this.Reset(temp); 120 | } 121 | public void WriteLong(long value = 0) 122 | { 123 | ThrowIfDisposed(); 124 | Append(value, 8); 125 | } 126 | public void WriteString(string value) 127 | { 128 | ThrowIfDisposed(); 129 | 130 | WriteShort((short)value.Length); 131 | 132 | foreach (char c in value) 133 | WriteByte((byte)c); 134 | } 135 | public void WriteString(string value, int length) 136 | { 137 | var i = 0; 138 | 139 | for (; i < value.Length & i < length; i++) 140 | { 141 | WriteByte((byte)value[i]); 142 | } 143 | 144 | for (; i < length; i++) 145 | { 146 | this.WriteByte(); 147 | } 148 | } 149 | 150 | public void WriteIntDateTime(DateTime item) 151 | { 152 | string time = item.Year.ToString(); 153 | time += item.Month < 10 ? ("0" + item.Month.ToString()) : item.Month.ToString(); 154 | time += item.Day < 10 ? ("0" + item.Day.ToString()) : item.Day.ToString(); 155 | time += item.Hour < 10 ? ("0" + item.Hour.ToString()) : item.Hour.ToString(); 156 | this.WriteInt(int.Parse(time)); 157 | } 158 | 159 | public void WriteLongDateTime(DateTime item) 160 | { 161 | this.WriteLong((long)((item.Millisecond * 10000) + 116444592000000000L)); 162 | } 163 | 164 | public void WriteHexString(string input) 165 | { 166 | input = input.Replace(" ", ""); 167 | 168 | if (input.Length % 2 != 0) 169 | { 170 | throw new ArgumentException("Input size is incorrect."); 171 | } 172 | 173 | for (int i = 0; i < input.Length; i += 2) 174 | { 175 | this.WriteByte(byte.Parse(input.Substring(i, 2), NumberStyles.HexNumber)); 176 | } 177 | } 178 | 179 | public void Skip(int count) 180 | { 181 | if (count <= 0) 182 | throw new PacketException("Value less than 1"); 183 | 184 | for (int i = 0; i < count; i++) 185 | WriteByte(); 186 | } 187 | 188 | public byte[] ToArray() 189 | { 190 | ThrowIfDisposed(); 191 | return m_stream.ToArray(); 192 | } 193 | 194 | private void ThrowIfDisposed() 195 | { 196 | if (m_disposed) 197 | { 198 | throw new ObjectDisposedException(GetType().FullName); 199 | } 200 | } 201 | 202 | public void Dispose() 203 | { 204 | m_disposed = true; 205 | 206 | if (m_stream != null) 207 | m_stream.Dispose(); 208 | 209 | m_stream = null; 210 | } 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /MapleLauncher/Net/PacketException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MapleLauncher.Net 8 | { 9 | public sealed class PacketException : System.Exception 10 | { 11 | public PacketException(string message) : base(message) { } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MapleLauncher/Net/ServerInfo.cs: -------------------------------------------------------------------------------- 1 | namespace MapleLauncher 2 | { 3 | public sealed class ServerInfo 4 | { 5 | public ushort Version { get; set; } 6 | public string Subversion { get; set; } 7 | public Localisation Localisation { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /MapleLauncher/Net/ServerSession.cs: -------------------------------------------------------------------------------- 1 | namespace MapleLauncher.Net 2 | { 3 | public sealed class ServerSession : Session 4 | { 5 | public static ServerSession Instance { get; private set; } 6 | 7 | public ServerSession(string ip, ushort port) 8 | : base(ip, port) 9 | { 10 | ServerSession.Instance = this; 11 | } 12 | 13 | public override void OnHandshake(ServerInfo info) 14 | { 15 | if (ClientSession.Instance != null) 16 | { 17 | ClientSession.Instance.Handshake(info); 18 | } 19 | 20 | this.Send(frmMain.Instance.GetHashPacket()); 21 | } 22 | 23 | public override void Dispatch(InPacket inPacket) 24 | { 25 | if (inPacket.OperationCode == Program.ServerIP) 26 | { 27 | ushort status = inPacket.ReadUShort(); 28 | ushort status2 = inPacket.ReadUShort(); 29 | byte[] ip = inPacket.ReadBytes(4); 30 | ushort port = inPacket.ReadUShort(); 31 | byte[] leftover = inPacket.ReadLeftoverBytes(); 32 | 33 | Program.IP = string.Format("{0}.{1}.{2}.{3}", ip[0], ip[1], ip[2], ip[3]); 34 | Program.Port = port; 35 | 36 | using (OutPacket outPacket = new OutPacket(Program.ServerIP)) 37 | { 38 | outPacket.WriteUShort(status); 39 | outPacket.WriteUShort(status2); 40 | outPacket.WriteBytes(127, 0, 0, 1); 41 | outPacket.WriteUShort(8484); 42 | outPacket.WriteBytes(leftover); 43 | 44 | if (ClientSession.Instance != null) 45 | { 46 | ClientSession.Instance.Send(outPacket.ToArray()); 47 | } 48 | } 49 | } 50 | else 51 | { 52 | using (OutPacket outPacket = new OutPacket(inPacket)) 53 | { 54 | if (ClientSession.Instance != null) 55 | { 56 | ClientSession.Instance.Send(outPacket.ToArray()); 57 | } 58 | } 59 | } 60 | } 61 | 62 | public override void Terminate() 63 | { 64 | ServerSession.Instance = null; 65 | 66 | if (ClientSession.Instance != null) 67 | { 68 | ClientSession.Instance.Disconnect(); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /MapleLauncher/Net/Session.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Net; 4 | using System.Net.Sockets; 5 | using System.Security.Cryptography; 6 | using System.Timers; 7 | using MapleLauncher.Utilities; 8 | 9 | namespace MapleLauncher.Net 10 | { 11 | public abstract class Session 12 | { 13 | 14 | /// 15 | /// Socket we use 16 | /// 17 | private Socket _socket; 18 | 19 | 20 | #region Data and encryption 21 | 22 | /// 23 | /// IV used for header generation and AES decryption 24 | /// 25 | private byte[] _decryptIV; 26 | 27 | /// 28 | /// IV used for header generation and AES encryption 29 | /// 30 | private byte[] _encryptIV; 31 | 32 | 33 | /// 34 | /// Buffer used for receiving Packet. 35 | /// 36 | private byte[] _buffer; 37 | 38 | /// 39 | /// Position for receiving data. 40 | /// 41 | private int _bufferpos; 42 | 43 | /// 44 | /// Lenght of packet to receive. 45 | /// 46 | private int _bufferlen; 47 | 48 | private bool _header; 49 | private bool _encryption = false; 50 | private bool _receivingFromServer = true; 51 | 52 | public ServerInfo ServerInfo { get; private set; } 53 | 54 | public bool Disconnected { get; private set; } 55 | 56 | public string IP { get; private set; } 57 | public ushort Port { get; private set; } 58 | 59 | private IPEndPoint ipEndPoint; 60 | 61 | #endregion 62 | 63 | public Session(Socket socket) 64 | { 65 | this.ipEndPoint = socket.RemoteEndPoint as IPEndPoint; 66 | 67 | this.IP = this.ipEndPoint.Address.ToString(); 68 | this.Port = (ushort)this.ipEndPoint.Port; 69 | 70 | Disconnected = false; 71 | _socket = socket; 72 | _receivingFromServer = false; 73 | 74 | IPEndPoint remoteIpEndPoint = _socket.RemoteEndPoint as IPEndPoint; 75 | IP = remoteIpEndPoint.Address.ToString(); 76 | Port = (ushort)remoteIpEndPoint.Port; 77 | 78 | this.Initialize(); 79 | 80 | StartReading(4, true); 81 | } 82 | 83 | public Session(string host, ushort port) 84 | { 85 | this.IP = host; 86 | this.Port = port; 87 | 88 | Connect(); 89 | } 90 | 91 | public virtual void Initialize() { } 92 | 93 | public bool Connect() 94 | { 95 | _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 96 | Disconnected = true; 97 | _encryption = false; 98 | try 99 | { 100 | _socket.Connect(IP, Port); 101 | 102 | Disconnected = false; 103 | StartReading(2, true); 104 | return true; 105 | } 106 | catch 107 | { 108 | return false; 109 | } 110 | } 111 | 112 | public void Disconnect() 113 | { 114 | if (Disconnected) return; 115 | try 116 | { 117 | _socket.Shutdown(SocketShutdown.Both); 118 | } 119 | catch 120 | { 121 | } 122 | //Console.WriteLine(TypeName + " Manual disconnection!"); 123 | OnDisconnectINTERNAL(); 124 | } 125 | 126 | /// 127 | /// Starts the reading mechanism. 128 | /// 129 | /// Amount of bytes to receive 130 | /// Do we receive a header? 131 | private void StartReading(int pLength, bool pHeader = false) 132 | { 133 | if (Disconnected) return; 134 | _header = pHeader; 135 | _buffer = new byte[pLength]; 136 | _bufferlen = pLength; 137 | _bufferpos = 0; 138 | ContinueReading(); 139 | } 140 | 141 | /// 142 | /// Calls Socket.BeginReceive to receive more data. 143 | /// 144 | private void ContinueReading() 145 | { 146 | if (Disconnected) return; 147 | try 148 | { 149 | _socket.BeginReceive(_buffer, _bufferpos, _bufferlen - _bufferpos, SocketFlags.None, new AsyncCallback(EndReading), null); 150 | } 151 | catch (Exception ex) 152 | { 153 | //Console.WriteLine(TypeName + " [ERROR] ContinueReading(): {0}", ex.ToString()); 154 | OnDisconnectINTERNAL(); 155 | } 156 | } 157 | 158 | /// 159 | /// Used as IAsyncResult parser for ContinueReading(). 160 | /// 161 | /// The result AsyncCallback makes 162 | private void EndReading(IAsyncResult pIAR) 163 | { 164 | int amountReceived = 0; 165 | try 166 | { 167 | amountReceived = _socket.EndReceive(pIAR); 168 | } 169 | catch (Exception ex) 170 | { 171 | //Console.WriteLine(TypeName + " : " + ex.ToString()); 172 | amountReceived = 0; 173 | } 174 | if (amountReceived == 0) 175 | { 176 | // We got a disWvsBeta.Common.Sessions here! 177 | OnDisconnectINTERNAL(); 178 | return; 179 | } 180 | 181 | // Add amount of bytes received to _bufferpos so we know if we got everything. 182 | _bufferpos += amountReceived; 183 | 184 | 185 | 186 | // Check if we got all data. There is _no_ way we would have received more bytes than needed. Period. 187 | if (_bufferpos == _bufferlen) 188 | { 189 | // It seems we have all data we need 190 | // Now check if we got a header 191 | if (_header) 192 | { 193 | if (!_encryption && _receivingFromServer) 194 | { 195 | // Unencrypted Packet have a short header with plain length. 196 | ushort length = (ushort)(_buffer[0] | _buffer[1] << 8); 197 | StartReading(length); 198 | } 199 | else 200 | { 201 | int length = GetHeaderLength(_buffer); 202 | StartReading(length); 203 | } 204 | } 205 | else 206 | { 207 | InPacket packet; 208 | if (_encryption) 209 | { 210 | _buffer = Decrypt(_buffer); 211 | packet = new InPacket(_buffer); 212 | 213 | Dispatch(packet); 214 | } 215 | else 216 | { 217 | _encryption = true; // First packet received or sent is unencrypted. All others are. 218 | packet = new InPacket(_buffer, false); 219 | 220 | this.ServerInfo = new ServerInfo(); 221 | 222 | this.ServerInfo.Version = packet.ReadUShort(); 223 | this.ServerInfo.Subversion = packet.ReadString(); 224 | _encryptIV = packet.ReadBytes(4); 225 | _decryptIV = packet.ReadBytes(4); 226 | this.ServerInfo.Localisation = (Localisation)packet.ReadByte(); 227 | 228 | Session.AssignUserKey(this.ServerInfo); 229 | 230 | this.OnHandshake(this.ServerInfo); 231 | } 232 | 233 | StartReading(4, true); 234 | } 235 | } 236 | else 237 | { 238 | ContinueReading(); 239 | } 240 | 241 | 242 | } 243 | 244 | /// 245 | /// Sends bytes to the other side 246 | /// 247 | /// Data to encrypt and send 248 | public void Send(byte[] pData) 249 | { 250 | if (!_encryption && !_receivingFromServer) 251 | { 252 | byte[] data = new byte[pData.Length + 2]; 253 | data[0] = (byte)pData.Length; 254 | data[1] = (byte)((pData.Length >> 8) & 0xFF); 255 | Buffer.BlockCopy(pData, 0, data, 2, pData.Length); 256 | pData = data; 257 | _encryption = true; // First packet received or sent is unencrypted. All others are. 258 | } 259 | else 260 | { 261 | pData = Encrypt(pData); 262 | } 263 | try 264 | { 265 | int sent = _socket.Send(pData); 266 | if (sent != pData.Length) 267 | { 268 | //Console.WriteLine(TypeName + " [ERROR] Error while sending data: not all bytes transferred: only {0} of {1} sent!", sent, pData.Length); 269 | } 270 | } 271 | catch (Exception ex) 272 | { 273 | //Console.WriteLine(TypeName + " [ERROR] Failed sending: {0}", ex.ToString()); 274 | OnDisconnectINTERNAL(); 275 | } 276 | } 277 | 278 | Random rnd = new Random(); 279 | 280 | public void Handshake(ServerInfo serverInfo) 281 | { 282 | _encryptIV = new byte[4]; 283 | rnd.NextBytes(_encryptIV); 284 | _decryptIV = new byte[4]; 285 | rnd.NextBytes(_decryptIV); 286 | 287 | using (OutPacket outPacket = new OutPacket()) 288 | { 289 | outPacket.WriteUShort(serverInfo.Version); 290 | outPacket.WriteString(serverInfo.Subversion); 291 | outPacket.WriteBytes(_decryptIV); 292 | outPacket.WriteBytes(_encryptIV); 293 | outPacket.WriteByte((byte)serverInfo.Localisation); 294 | outPacket.WriteByte(); // NOTE: Unknown, added in v.160.1. 295 | 296 | this.Send(outPacket.ToArray()); 297 | } 298 | 299 | Session.AssignUserKey(this.ServerInfo); 300 | } 301 | 302 | public abstract void Dispatch(InPacket inPacket); 303 | 304 | public virtual void OnHandshake(ServerInfo info) { } 305 | 306 | private void OnDisconnectINTERNAL() 307 | { 308 | if (this.Disconnected) 309 | { 310 | return; 311 | } 312 | 313 | this.Disconnected = true; 314 | 315 | Debug.WriteLine("{0}:{1} disconnected! Called by:", this.IP, this.Port); 316 | Debug.WriteLine(Environment.StackTrace); 317 | 318 | this.Terminate(); 319 | } 320 | 321 | public virtual void Terminate() { } 322 | 323 | #region Encryption Stuff 324 | /// 325 | /// 256 bytes long shift key, used for MapleStory cryptography and header generation. 326 | /// 327 | private static byte[] sShiftKey = new byte[] { 328 | 0xEC, 0x3F, 0x77, 0xA4, 0x45, 0xD0, 0x71, 0xBF, 0xB7, 0x98, 0x20, 0xFC, 0x4B, 0xE9, 0xB3, 0xE1, 329 | 0x5C, 0x22, 0xF7, 0x0C, 0x44, 0x1B, 0x81, 0xBD, 0x63, 0x8D, 0xD4, 0xC3, 0xF2, 0x10, 0x19, 0xE0, 330 | 0xFB, 0xA1, 0x6E, 0x66, 0xEA, 0xAE, 0xD6, 0xCE, 0x06, 0x18, 0x4E, 0xEB, 0x78, 0x95, 0xDB, 0xBA, 331 | 0xB6, 0x42, 0x7A, 0x2A, 0x83, 0x0B, 0x54, 0x67, 0x6D, 0xE8, 0x65, 0xE7, 0x2F, 0x07, 0xF3, 0xAA, 332 | 0x27, 0x7B, 0x85, 0xB0, 0x26, 0xFD, 0x8B, 0xA9, 0xFA, 0xBE, 0xA8, 0xD7, 0xCB, 0xCC, 0x92, 0xDA, 333 | 0xF9, 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346 | /// 347 | /// Encrypts the given data, and updates the Encrypt IV 348 | /// 349 | /// Data to be encrypted (without header!) 350 | /// Encrypted data (with header!) 351 | private byte[] Encrypt(byte[] pData) 352 | { 353 | // Include header 354 | byte[] data = new byte[pData.Length + 4]; 355 | 356 | GenerateHeader(data, _encryptIV, pData.Length, this.ServerInfo.Version, _receivingFromServer); 357 | 358 | if (Program.UseMapleEncryption) 359 | { 360 | EncryptMSCrypto(pData); 361 | } 362 | AESTransform(pData, _encryptIV); 363 | NextIV(_encryptIV); 364 | Buffer.BlockCopy(pData, 0, data, 4, pData.Length); 365 | 366 | return data; 367 | } 368 | 369 | /// 370 | /// Decrypts given data, and updates the Decrypt IV 371 | /// 372 | /// Data to be decrypted 373 | /// Decrypted data 374 | private byte[] Decrypt(byte[] pData) 375 | { 376 | AESTransform(pData, _decryptIV); 377 | NextIV(_decryptIV); 378 | 379 | if (Program.UseMapleEncryption) 380 | { 381 | DecryptMSCrypto(pData); 382 | } 383 | 384 | return pData; 385 | } 386 | 387 | /// 388 | /// Rolls the value left. Port from NLS (C++) _rotl8 389 | /// 390 | /// Value to be shifted 391 | /// Position to shift to 392 | /// Shifted value 393 | private static byte RollLeft(byte value, int shift) 394 | { 395 | uint overflow = ((uint)value) << (shift % 8); 396 | return (byte)((overflow & 0xFF) | (overflow >> 8)); 397 | } 398 | 399 | /// 400 | /// Rolls the value right. Port from NLS (C++) _rotr8 401 | /// 402 | /// Value to be shifted 403 | /// Position to shift to 404 | /// Shifted value 405 | private static byte RollRight(byte value, int shift) 406 | { 407 | uint overflow = (((uint)value) << 8) >> (shift % 8); 408 | return (byte)((overflow & 0xFF) | (overflow >> 8)); 409 | } 410 | 411 | /// 412 | /// Encrypts given data with the MapleStory cryptography 413 | /// 414 | /// Unencrypted data 415 | private static void EncryptMSCrypto(byte[] pData) 416 | { 417 | int length = pData.Length, j; 418 | byte a, c; 419 | for (var i = 0; i < 3; i++) 420 | { 421 | a = 0; 422 | for (j = length; j > 0; j--) 423 | { 424 | c = pData[length - j]; 425 | c = RollLeft(c, 3); 426 | c = (byte)(c + j); 427 | c ^= a; 428 | a = c; 429 | c = RollRight(a, j); 430 | c ^= 0xFF; 431 | c += 0x48; 432 | pData[length - j] = c; 433 | } 434 | a = 0; 435 | for (j = length; j > 0; j--) 436 | { 437 | c = pData[j - 1]; 438 | c = RollLeft(c, 4); 439 | c = (byte)(c + j); 440 | c ^= a; 441 | a = c; 442 | c ^= 0x13; 443 | c = RollRight(c, 3); 444 | pData[j - 1] = c; 445 | } 446 | } 447 | } 448 | 449 | /// 450 | /// Decrypts given data with the MapleStory cryptography 451 | /// 452 | /// 453 | private static void DecryptMSCrypto(byte[] pData) 454 | { 455 | int length = pData.Length, j; 456 | byte a, b, c; 457 | for (var i = 0; i < 3; i++) 458 | { 459 | a = 0; 460 | b = 0; 461 | for (j = length; j > 0; j--) 462 | { 463 | c = pData[j - 1]; 464 | c = RollLeft(c, 3); 465 | c ^= 0x13; 466 | a = c; 467 | c ^= b; 468 | c = (byte)(c - j); 469 | c = RollRight(c, 4); 470 | b = a; 471 | pData[j - 1] = c; 472 | } 473 | a = 0; 474 | b = 0; 475 | for (j = length; j > 0; j--) 476 | { 477 | c = pData[length - j]; 478 | c -= 0x48; 479 | c ^= 0xFF; 480 | c = RollLeft(c, j); 481 | a = c; 482 | c ^= b; 483 | c = (byte)(c - j); 484 | c = RollRight(c, 3); 485 | b = a; 486 | pData[length - j] = c; 487 | } 488 | } 489 | } 490 | 491 | /// 492 | /// Generates a new IV code for AES and header generation. It will reset the oldIV with the newIV automatically. 493 | /// 494 | /// The old IV that is used already. 495 | private static void NextIV(byte[] pOldIV) 496 | { 497 | byte[] newIV = new byte[] { 0xF2, 0x53, 0x50, 0xC6 }; 498 | for (var i = 0; i < 4; i++) 499 | { 500 | byte input = pOldIV[i]; 501 | byte tableInput = sShiftKey[input]; 502 | newIV[0] += (byte)(sShiftKey[newIV[1]] - input); 503 | newIV[1] -= (byte)(newIV[2] ^ tableInput); 504 | newIV[2] ^= (byte)(sShiftKey[newIV[3]] + input); 505 | newIV[3] -= (byte)(newIV[0] - tableInput); 506 | 507 | uint val = BitConverter.ToUInt32(newIV, 0); 508 | uint val2 = val >> 0x1D; 509 | val <<= 0x03; 510 | val2 |= val; 511 | newIV[0] = (byte)(val2 & 0xFF); 512 | newIV[1] = (byte)((val2 >> 8) & 0xFF); 513 | newIV[2] = (byte)((val2 >> 16) & 0xFF); 514 | newIV[3] = (byte)((val2 >> 24) & 0xFF); 515 | } 516 | Buffer.BlockCopy(newIV, 0, pOldIV, 0, 4); 517 | } 518 | 519 | /// 520 | /// Retrieves length of content from the header 521 | /// 522 | /// Buffer containing the header 523 | /// Length of buffer 524 | private static int GetHeaderLength(byte[] pBuffer) 525 | { 526 | int length = (int)pBuffer[0] | 527 | (int)(pBuffer[1] << 8) | 528 | (int)(pBuffer[2] << 16) | 529 | (int)(pBuffer[3] << 24); 530 | length = (length >> 16) ^ (length & 0xFFFF); 531 | return (ushort)length; 532 | } 533 | 534 | /// 535 | /// Generates header for Packet 536 | /// 537 | /// Buffer 538 | /// IV 539 | /// Packet Length - Header Length 540 | /// MapleStory Version 541 | /// Is to server? 542 | private static void GenerateHeader(byte[] pBuffer, byte[] pIV, int pLength, ushort pVersion, bool pToServer) 543 | { 544 | int a = (pIV[3] << 8) | pIV[2]; 545 | byte[] header = new byte[4]; 546 | if (pToServer) 547 | { 548 | a = a ^ (pVersion); 549 | int b = a ^ pLength; 550 | header[0] = (byte)(a % 0x100); 551 | header[1] = (byte)(a / 0x100); 552 | header[2] = (byte)(b % 0x100); 553 | header[3] = (byte)(b / 0x100); 554 | Buffer.BlockCopy(header, 0, pBuffer, 0, 4); 555 | } 556 | else 557 | { 558 | a ^= -(pVersion + 1); 559 | int b = a ^ pLength; 560 | header[0] = (byte)(a % 0x100); 561 | header[1] = (byte)((a - header[0]) / 0x100); 562 | header[2] = (byte)(b ^ 0x100); 563 | header[3] = (byte)((b - header[2]) / 0x100); 564 | } 565 | Buffer.BlockCopy(header, 0, pBuffer, 0, 4); 566 | } 567 | 568 | #region AES 569 | 570 | /// 571 | /// 'Secret' 8 * 4 byte long key used for AES encryption. 572 | /// 573 | private static byte[] sSecretKey = new byte[] { 574 | 0x6D, 0x00, 0x00, 0x00,// 0xCC, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 575 | 0x23, 0x00, 0x00, 0x00,// 0x3E, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 576 | 0x13, 0x00, 0x00, 0x00,// 0x47, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 577 | 0xE9, 0x00, 0x00, 0x00,// 0x54, 0x00, 0x00, 0x00, 0xAB, 0x00, 0x00, 0x00, 0xBC, 0x00, 0x00, 0x00, 578 | 0xEE, 0x00, 0x00, 0x00,// 0x9B, 0x00, 0x00, 0x00, 0x4F, 0x00, 0x00, 0x00, 0xD3, 0x00, 0x00, 0x00, 579 | 0x27, 0x00, 0x00, 0x00,// 0x60, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0xCF, 0x00, 0x00, 0x00, 580 | 0xA8, 0x00, 0x00, 0x00,// 0xF2, 0x00, 0x00, 0x00, 0xAB, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 581 | 0xCF, 0x00, 0x00, 0x00,// 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 582 | }; 583 | 584 | private static RijndaelManaged _rijndaelAES = new RijndaelManaged(); 585 | private static ICryptoTransform _transformer = null; 586 | 587 | private static void AssignUserKey(ServerInfo info) 588 | { 589 | _rijndaelAES.Key = MapleKeys.Get(info); 590 | _rijndaelAES.Mode = CipherMode.ECB; 591 | _rijndaelAES.Padding = PaddingMode.PKCS7; 592 | _transformer = _rijndaelAES.CreateEncryptor(); 593 | } 594 | 595 | /// 596 | /// Transforms given buffer with AES + given IV 597 | /// 598 | /// Data to be transformed 599 | /// IV used to transform data 600 | private static void AESTransform(byte[] pData, byte[] pIV) 601 | { 602 | if (_transformer == null) 603 | { 604 | _rijndaelAES.Key = sSecretKey; 605 | _rijndaelAES.Mode = CipherMode.ECB; 606 | _rijndaelAES.Padding = PaddingMode.PKCS7; 607 | _transformer = _rijndaelAES.CreateEncryptor(); 608 | } 609 | int remaining = pData.Length; 610 | int length = 0x5B0; 611 | int start = 0; 612 | byte[] realIV = new byte[pIV.Length * 4]; 613 | while (remaining > 0) 614 | { 615 | for (int index = 0; index < realIV.Length; ++index) realIV[index] = pIV[index % 4]; 616 | 617 | if (remaining < length) length = remaining; 618 | for (int index = start; index < (start + length); ++index) 619 | { 620 | if (((index - start) % realIV.Length) == 0) 621 | { 622 | byte[] tempIV = new byte[realIV.Length]; 623 | _transformer.TransformBlock(realIV, 0, realIV.Length, tempIV, 0); 624 | Buffer.BlockCopy(tempIV, 0, realIV, 0, realIV.Length); 625 | } 626 | pData[index] ^= realIV[(index - start) % realIV.Length]; 627 | } 628 | start += length; 629 | remaining -= length; 630 | length = 0x5B4; 631 | } 632 | } 633 | 634 | #endregion 635 | #endregion 636 | } 637 | } -------------------------------------------------------------------------------- /MapleLauncher/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace MapleLauncher 5 | { 6 | public enum Localisation : byte 7 | { 8 | Global = 8 9 | } 10 | 11 | internal static class Program 12 | { 13 | public const string Name = "MapleLauncher"; 14 | public static string IP = "127.0.0.1"; 15 | public static ushort Port = 8484; 16 | public static ushort ServerIP = 0x000B; 17 | 18 | public const bool MaskIP = true; 19 | public const string MaskedIP = "8.31.99.141"; 20 | 21 | public const string ClientName = "MapleStory.exe"; 22 | 23 | public const string Website = "http://www.RaGEZONE.com/"; 24 | public const string Forums = "http://forum.RaGEZONE.com/f425/"; 25 | 26 | public const string ConfigName = "config.json"; 27 | 28 | public const bool UseMapleEncryption = true; 29 | 30 | private static void Main() 31 | { 32 | AppDomain.CurrentDomain.UnhandledException += Program.OnUnhandledException; 33 | 34 | Application.EnableVisualStyles(); 35 | Application.SetCompatibleTextRenderingDefault(false); 36 | Application.Run(new frmMain()); 37 | } 38 | 39 | private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) 40 | { 41 | MessageBox.Show("An unknown error has occurred: \n", e.ExceptionObject.ToString()); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MapleLauncher/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MapleLauncher")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MapleLauncher")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f5fb4492-ec7d-4b96-8086-a10a929046e2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MapleLauncher/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.0 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MapleLauncher.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MapleLauncher.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap maple_one { 67 | get { 68 | object obj = ResourceManager.GetObject("maple_one", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap mercedes_skill_build_guide_maplestory { 77 | get { 78 | object obj = ResourceManager.GetObject("mercedes_skill_build_guide_maplestory", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap ss__2015_07_03_at_02_25_47_ { 87 | get { 88 | object obj = ResourceManager.GetObject("ss+(2015-07-03+at+02.25.47)", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap start { 97 | get { 98 | object obj = ResourceManager.GetObject("start", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /MapleLauncher/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\maple_one.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\ss+(2015-07-03+at+02.25.47).jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\Resources\start.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | 131 | ..\Resources\mercedes_skill_build_guide_maplestory.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | -------------------------------------------------------------------------------- /MapleLauncher/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.0 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MapleLauncher.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MapleLauncher/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MapleLauncher/Resources/maple_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yaminike/ms-MapleLauncher/a964e67f1be6101339f099a6c217e84810e65cbb/MapleLauncher/Resources/maple_one.png -------------------------------------------------------------------------------- /MapleLauncher/Resources/mercedes_skill_build_guide_maplestory.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yaminike/ms-MapleLauncher/a964e67f1be6101339f099a6c217e84810e65cbb/MapleLauncher/Resources/mercedes_skill_build_guide_maplestory.jpg -------------------------------------------------------------------------------- /MapleLauncher/Resources/ss+(2015-07-03+at+02.25.47).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yaminike/ms-MapleLauncher/a964e67f1be6101339f099a6c217e84810e65cbb/MapleLauncher/Resources/ss+(2015-07-03+at+02.25.47).jpg -------------------------------------------------------------------------------- /MapleLauncher/Resources/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yaminike/ms-MapleLauncher/a964e67f1be6101339f099a6c217e84810e65cbb/MapleLauncher/Resources/start.png -------------------------------------------------------------------------------- /MapleLauncher/Utilities/HashUtilities.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | 5 | namespace MapleLauncher.Utilities 6 | { 7 | internal static class HashUtilities 8 | { 9 | public static string GetMD5HashFromFile(string path) 10 | { 11 | FileStream file = new FileStream(path, FileMode.Open); 12 | MD5 md5 = new MD5CryptoServiceProvider(); 13 | byte[] retVal = md5.ComputeHash(file); 14 | file.Close(); 15 | 16 | StringBuilder sb = new StringBuilder(); 17 | 18 | for (int i = 0; i < retVal.Length; i++) 19 | { 20 | sb.Append(retVal[i].ToString("X2")); 21 | } 22 | 23 | return sb.ToString(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MapleLauncher/Utilities/JsonUtilities.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.IO; 3 | 4 | namespace MapleLauncher.Utilities 5 | { 6 | public static class JsonUtilities 7 | { 8 | public static string Serialize(object T) 9 | { 10 | return JsonConvert.SerializeObject(T, Formatting.Indented); 11 | } 12 | 13 | public static T Deserialize(string value) 14 | { 15 | return JsonConvert.DeserializeObject(value); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MapleLauncher/Utilities/NetworkUtilities.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace MapleLauncher.Utilities 4 | { 5 | internal static class NetworkUtilities 6 | { 7 | public static void MaskIP(string ip) 8 | { 9 | string command = string.Format("netsh int ip add addr 1 {0} mask=255.255.255.255", ip); 10 | 11 | Process process = new Process(); 12 | ProcessStartInfo startInfo = new ProcessStartInfo(); 13 | 14 | startInfo.WindowStyle = ProcessWindowStyle.Hidden; 15 | startInfo.FileName = "cmd.exe"; 16 | startInfo.Arguments = command; 17 | 18 | process.StartInfo = startInfo; 19 | process.Start(); 20 | 21 | frmMain.Instance.InformStatus("Succesfully masked IP Address '{0}'.", ip); 22 | } 23 | 24 | public static void UnmaskIP(string ip) 25 | { 26 | string command = string.Format("netsh int ip delete addr 1 {0}", ip); 27 | 28 | Process process = new Process(); 29 | ProcessStartInfo startInfo = new ProcessStartInfo(); 30 | 31 | startInfo.WindowStyle = ProcessWindowStyle.Hidden; 32 | startInfo.FileName = "cmd.exe"; 33 | startInfo.Arguments = command; 34 | 35 | process.StartInfo = startInfo; 36 | process.Start(); 37 | 38 | frmMain.Instance.InformStatus("Succesfully unmasked IP Address '{0}'.", ip); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /MapleLauncher/frmMain.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace MapleLauncher 2 | { 3 | partial class frmMain 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); 33 | this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); 34 | this.statusStrip = new System.Windows.Forms.StatusStrip(); 35 | this.lblStatus = new System.Windows.Forms.ToolStripStatusLabel(); 36 | this.btnStart = new System.Windows.Forms.PictureBox(); 37 | this.pbLogo = new System.Windows.Forms.PictureBox(); 38 | this.notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components); 39 | this.btnWebsite = new System.Windows.Forms.ToolStripMenuItem(); 40 | this.btnForums = new System.Windows.Forms.ToolStripMenuItem(); 41 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 42 | this.btnQuit = new System.Windows.Forms.ToolStripMenuItem(); 43 | this.statusStrip.SuspendLayout(); 44 | ((System.ComponentModel.ISupportInitialize)(this.btnStart)).BeginInit(); 45 | ((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit(); 46 | this.notifyIconMenu.SuspendLayout(); 47 | this.SuspendLayout(); 48 | // 49 | // notifyIcon 50 | // 51 | this.notifyIcon.ContextMenuStrip = this.notifyIconMenu; 52 | this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon"))); 53 | this.notifyIcon.Text = "notifyIcon1"; 54 | this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseDoubleClick); 55 | // 56 | // statusStrip 57 | // 58 | this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 59 | this.lblStatus}); 60 | this.statusStrip.Location = new System.Drawing.Point(0, 140); 61 | this.statusStrip.Name = "statusStrip"; 62 | this.statusStrip.Size = new System.Drawing.Size(454, 22); 63 | this.statusStrip.TabIndex = 2; 64 | this.statusStrip.Text = "statusStrip1"; 65 | // 66 | // lblStatus 67 | // 68 | this.lblStatus.Name = "lblStatus"; 69 | this.lblStatus.Size = new System.Drawing.Size(29, 17); 70 | this.lblStatus.Text = "Idle."; 71 | // 72 | // btnStart 73 | // 74 | this.btnStart.Image = global::MapleLauncher.Properties.Resources.start; 75 | this.btnStart.Location = new System.Drawing.Point(315, 23); 76 | this.btnStart.Name = "btnStart"; 77 | this.btnStart.Size = new System.Drawing.Size(117, 76); 78 | this.btnStart.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; 79 | this.btnStart.TabIndex = 3; 80 | this.btnStart.TabStop = false; 81 | this.btnStart.Click += new System.EventHandler(this.btnStart_Click); 82 | // 83 | // pbLogo 84 | // 85 | this.pbLogo.Image = global::MapleLauncher.Properties.Resources.mercedes_skill_build_guide_maplestory; 86 | this.pbLogo.Location = new System.Drawing.Point(0, 0); 87 | this.pbLogo.Name = "pbLogo"; 88 | this.pbLogo.Size = new System.Drawing.Size(500, 150); 89 | this.pbLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; 90 | this.pbLogo.TabIndex = 0; 91 | this.pbLogo.TabStop = false; 92 | // 93 | // notifyIconMenu 94 | // 95 | this.notifyIconMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 96 | this.btnWebsite, 97 | this.btnForums, 98 | this.toolStripSeparator1, 99 | this.btnQuit}); 100 | this.notifyIconMenu.Name = "notifyIconMenu"; 101 | this.notifyIconMenu.Size = new System.Drawing.Size(153, 98); 102 | // 103 | // btnWebsite 104 | // 105 | this.btnWebsite.Name = "btnWebsite"; 106 | this.btnWebsite.Size = new System.Drawing.Size(152, 22); 107 | this.btnWebsite.Text = "Website"; 108 | this.btnWebsite.Click += new System.EventHandler(this.btnWebsite_Click); 109 | // 110 | // btnForums 111 | // 112 | this.btnForums.Name = "btnForums"; 113 | this.btnForums.Size = new System.Drawing.Size(152, 22); 114 | this.btnForums.Text = "Forums"; 115 | this.btnForums.Click += new System.EventHandler(this.btnForums_Click); 116 | // 117 | // toolStripSeparator1 118 | // 119 | this.toolStripSeparator1.Name = "toolStripSeparator1"; 120 | this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); 121 | // 122 | // btnQuit 123 | // 124 | this.btnQuit.Name = "btnQuit"; 125 | this.btnQuit.Size = new System.Drawing.Size(152, 22); 126 | this.btnQuit.Text = "Quit"; 127 | this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); 128 | // 129 | // frmMain 130 | // 131 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); 132 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 133 | this.ClientSize = new System.Drawing.Size(454, 162); 134 | this.Controls.Add(this.btnStart); 135 | this.Controls.Add(this.statusStrip); 136 | this.Controls.Add(this.pbLogo); 137 | this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 138 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 139 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 140 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); 141 | this.MaximizeBox = false; 142 | this.Name = "frmMain"; 143 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 144 | this.Text = "MapleLauncher"; 145 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing); 146 | this.Load += new System.EventHandler(this.frmMain_Load); 147 | this.Resize += new System.EventHandler(this.frmMain_Resize); 148 | this.statusStrip.ResumeLayout(false); 149 | this.statusStrip.PerformLayout(); 150 | ((System.ComponentModel.ISupportInitialize)(this.btnStart)).EndInit(); 151 | ((System.ComponentModel.ISupportInitialize)(this.pbLogo)).EndInit(); 152 | this.notifyIconMenu.ResumeLayout(false); 153 | this.ResumeLayout(false); 154 | this.PerformLayout(); 155 | 156 | } 157 | 158 | #endregion 159 | 160 | private System.Windows.Forms.PictureBox pbLogo; 161 | private System.Windows.Forms.NotifyIcon notifyIcon; 162 | private System.Windows.Forms.StatusStrip statusStrip; 163 | private System.Windows.Forms.ToolStripStatusLabel lblStatus; 164 | private System.Windows.Forms.PictureBox btnStart; 165 | private System.Windows.Forms.ContextMenuStrip notifyIconMenu; 166 | private System.Windows.Forms.ToolStripMenuItem btnWebsite; 167 | private System.Windows.Forms.ToolStripMenuItem btnForums; 168 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 169 | private System.Windows.Forms.ToolStripMenuItem btnQuit; 170 | } 171 | } 172 | 173 | -------------------------------------------------------------------------------- /MapleLauncher/frmMain.cs: -------------------------------------------------------------------------------- 1 | using MapleLauncher.IO; 2 | using MapleLauncher.Net; 3 | using MapleLauncher.Utilities; 4 | using System; 5 | using System.Diagnostics; 6 | using System.IO; 7 | using System.Net.Sockets; 8 | using System.Windows.Forms; 9 | 10 | namespace MapleLauncher 11 | { 12 | public partial class frmMain : Form 13 | { 14 | public static frmMain Instance { get; private set; } 15 | 16 | public Config Config { get; private set; } 17 | public Acceptor Acceptor { get; private set; } 18 | 19 | public frmMain() 20 | { 21 | MapleKeys.Initialize(); 22 | 23 | this.InitializeComponent(); 24 | 25 | this.Acceptor = new Acceptor(8484); 26 | this.Acceptor.OnClientAccepted = OnClientAccepted; 27 | 28 | frmMain.Instance = this; 29 | } 30 | 31 | private void LoadConfig() 32 | { 33 | string json = File.ReadAllText(Program.ConfigName); 34 | this.Config = JsonUtilities.Deserialize(json); 35 | } 36 | 37 | private void SaveConfig() 38 | { 39 | string json = JsonUtilities.Serialize(this.Config); 40 | File.WriteAllText(Program.ConfigName, json); 41 | } 42 | 43 | public void Listen() 44 | { 45 | this.Acceptor.Start(); 46 | 47 | this.InformStatus("Waiting for MapleStory..."); 48 | } 49 | 50 | private void Minimize() 51 | { 52 | this.notifyIcon.Visible = true; 53 | this.notifyIcon.BalloonTipTitle = Program.Name + " is here!"; 54 | this.notifyIcon.BalloonTipText = "Right click to see more!"; 55 | this.notifyIcon.ShowBalloonTip(500); 56 | 57 | this.Hide(); 58 | } 59 | 60 | private void Unmimize() 61 | { 62 | this.notifyIcon.Visible = false; 63 | 64 | this.Show(); 65 | 66 | this.WindowState = FormWindowState.Normal; 67 | } 68 | 69 | private void OnClientAccepted(Socket socket) 70 | { 71 | this.Minimize(); 72 | 73 | new ClientSession(socket); 74 | } 75 | 76 | public byte[] GetHashPacket() 77 | { 78 | using (OutPacket outPacket = new OutPacket(0x0999)) 79 | { 80 | foreach (string path in Directory.GetFiles(this.Config.MapleStoryPath)) 81 | { 82 | string extension = Path.GetExtension(path); 83 | string name = Path.GetFileNameWithoutExtension(path); 84 | 85 | if (extension.ToLower().Contains("wz")) 86 | { 87 | outPacket.WriteString(name); 88 | outPacket.WriteString(HashUtilities.GetMD5HashFromFile(path)); 89 | } 90 | } 91 | 92 | return outPacket.ToArray(); 93 | } 94 | } 95 | 96 | public void InformStatus(string text, params object[] args) 97 | { 98 | if (InvokeRequired) 99 | { 100 | Invoke(new MethodInvoker(() => InformStatus(text, args))); 101 | 102 | return; 103 | } 104 | 105 | text = string.Format(text, args); 106 | 107 | lblStatus.Text = text; 108 | } 109 | 110 | #region Events 111 | private void frmMain_Load(object sender, EventArgs e) 112 | { 113 | if (!File.Exists(Program.ConfigName)) 114 | { 115 | MessageBox.Show(string.Format("Unable to locate configuration file '{0}'. \nPlease contact your server administrator.", Program.ConfigName), Program.Name, MessageBoxButtons.OK, MessageBoxIcon.Error); 116 | 117 | Application.Exit(); 118 | } 119 | 120 | this.Text = Program.Name; 121 | 122 | this.LoadConfig(); 123 | 124 | if (Program.MaskIP) 125 | { 126 | NetworkUtilities.MaskIP(Program.MaskedIP); 127 | } 128 | 129 | this.Listen(); 130 | } 131 | 132 | private void frmMain_FormClosing(object sender, FormClosingEventArgs e) 133 | { 134 | this.SaveConfig(); 135 | 136 | NetworkUtilities.UnmaskIP(Program.MaskedIP); 137 | } 138 | 139 | private void btnWebsite_Click(object sender, EventArgs e) 140 | { 141 | Process.Start(Program.Website); 142 | } 143 | 144 | private void btnForums_Click(object sender, EventArgs e) 145 | { 146 | Process.Start(Program.Forums); 147 | } 148 | 149 | private void btnQuit_Click(object sender, EventArgs e) 150 | { 151 | Application.Exit(); 152 | } 153 | 154 | private void btnStart_Click(object sender, EventArgs e) 155 | { 156 | string path = Path.Combine(this.Config.MapleStoryPath, Program.ClientName); 157 | 158 | if (!File.Exists(path)) 159 | { 160 | MessageBox.Show(string.Format("Unable to locate '{0}'.", path), Program.Name, MessageBoxButtons.OK, MessageBoxIcon.Error); 161 | 162 | return; 163 | } 164 | 165 | Process.Start(path); 166 | } 167 | 168 | private void frmMain_Resize(object sender, EventArgs e) 169 | { 170 | if (this.WindowState == FormWindowState.Minimized) 171 | { 172 | this.Minimize(); 173 | } 174 | else if (WindowState == FormWindowState.Normal) 175 | { 176 | this.Unmimize(); 177 | } 178 | } 179 | 180 | private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e) 181 | { 182 | this.Unmimize(); 183 | } 184 | #endregion 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /MapleLauncher/frmMain.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 387, 17 125 | 126 | 127 | 128 | 129 | AAABAAIAICAAAAEACACoCAAAJgAAABAQAAABAAgAaAUAAM4IAAAoAAAAIAAAAEAAAAABAAgAAAAAAIAE 130 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAUdYAAIT/ABRo8QAAVuMAH3T/AABEtABSUlIAPT09AGWY 131 | rQCnz+AAvN/tAABMyAAsmf8Aeau/ADmKpABtobUAirfJAAAqbwAzfpYAHz9MABhkfQBfsv8AWIicANDr 132 | 9QDJ4+4ALVNjANnt9QAQUWYADk5jAEiG/wCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 133 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 134 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 135 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 136 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 137 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 138 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 139 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 140 | AAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 247 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 248 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 249 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 250 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 251 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 252 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoKCgoKAAAAABURHBEJCQ0AAA4ODgoAAAkVEBAYGAkJ 253 | DQwADg4KAAAJFRAQGgkJDQwZDAAKAAAAFxsREQ0NFwwIFAwAAAAAAAgICAgICAgUFBkMAAAAAAAABAQE 254 | BAQEBAQSAAAAAAAGBQMDAwMDAwUGBgQEAAAAAwIHAgICAgsLAwMFBAAAAAIHEwcCAgICAgsLAwYAAAAT 255 | EwIPDwUFAwsDBQYEAAAAAAcHFg8FBgYDBQYSAAAAAAAABxYPBQUFBhIEAAAAAAAAAAAHCwACBQYEAAAA 256 | AAAAAAAAAAcCAwYSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOABAADAAAAAgAAAAIABAACAAwAAgAMAAIAD 257 | AAAAAQAAAAEAAAABAAAAAQAAgAMAAMAHAADgDwAA8B8AAPg/AAA= 258 | 259 | 260 | -------------------------------------------------------------------------------- /MapleLauncher/frmSettings.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace MapleLauncher 2 | { 3 | partial class frmSettings 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.txtMapleStoryPath = new System.Windows.Forms.TextBox(); 32 | this.btnOk = new System.Windows.Forms.Button(); 33 | this.btnCancel = new System.Windows.Forms.Button(); 34 | this.btnBrowse = new System.Windows.Forms.Button(); 35 | this.SuspendLayout(); 36 | // 37 | // txtMapleStoryPath 38 | // 39 | this.txtMapleStoryPath.Location = new System.Drawing.Point(12, 12); 40 | this.txtMapleStoryPath.Name = "txtMapleStoryPath"; 41 | this.txtMapleStoryPath.Size = new System.Drawing.Size(177, 25); 42 | this.txtMapleStoryPath.TabIndex = 0; 43 | this.txtMapleStoryPath.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 44 | // 45 | // btnOk 46 | // 47 | this.btnOk.AutoSize = true; 48 | this.btnOk.Location = new System.Drawing.Point(66, 73); 49 | this.btnOk.Name = "btnOk"; 50 | this.btnOk.Size = new System.Drawing.Size(75, 27); 51 | this.btnOk.TabIndex = 1; 52 | this.btnOk.Text = "Ok"; 53 | this.btnOk.UseVisualStyleBackColor = true; 54 | this.btnOk.Click += new System.EventHandler(this.btnOk_Click); 55 | // 56 | // btnCancel 57 | // 58 | this.btnCancel.AutoSize = true; 59 | this.btnCancel.Location = new System.Drawing.Point(147, 73); 60 | this.btnCancel.Name = "btnCancel"; 61 | this.btnCancel.Size = new System.Drawing.Size(75, 27); 62 | this.btnCancel.TabIndex = 2; 63 | this.btnCancel.Text = "Cancel"; 64 | this.btnCancel.UseVisualStyleBackColor = true; 65 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); 66 | // 67 | // btnBrowse 68 | // 69 | this.btnBrowse.AutoSize = true; 70 | this.btnBrowse.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 71 | this.btnBrowse.Location = new System.Drawing.Point(195, 10); 72 | this.btnBrowse.Name = "btnBrowse"; 73 | this.btnBrowse.Size = new System.Drawing.Size(27, 27); 74 | this.btnBrowse.TabIndex = 3; 75 | this.btnBrowse.Text = "..."; 76 | this.btnBrowse.UseVisualStyleBackColor = true; 77 | this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); 78 | // 79 | // frmSettings 80 | // 81 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); 82 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 83 | this.ClientSize = new System.Drawing.Size(234, 112); 84 | this.Controls.Add(this.btnBrowse); 85 | this.Controls.Add(this.btnCancel); 86 | this.Controls.Add(this.btnOk); 87 | this.Controls.Add(this.txtMapleStoryPath); 88 | this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 89 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 90 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); 91 | this.MaximizeBox = false; 92 | this.MinimizeBox = false; 93 | this.Name = "frmSettings"; 94 | this.ShowIcon = false; 95 | this.ShowInTaskbar = false; 96 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 97 | this.Text = "Settings"; 98 | this.ResumeLayout(false); 99 | this.PerformLayout(); 100 | 101 | } 102 | 103 | #endregion 104 | 105 | private System.Windows.Forms.TextBox txtMapleStoryPath; 106 | private System.Windows.Forms.Button btnOk; 107 | private System.Windows.Forms.Button btnCancel; 108 | private System.Windows.Forms.Button btnBrowse; 109 | } 110 | } -------------------------------------------------------------------------------- /MapleLauncher/frmSettings.cs: -------------------------------------------------------------------------------- 1 | using MapleLauncher.IO; 2 | using System; 3 | using System.Windows.Forms; 4 | 5 | namespace MapleLauncher 6 | { 7 | public partial class frmSettings : Form 8 | { 9 | public frmSettings() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | private void btnOk_Click(object sender, EventArgs e) 15 | { 16 | frmMain.Instance.Config.MapleStoryPath = txtMapleStoryPath.Text; 17 | } 18 | 19 | private void btnCancel_Click(object sender, EventArgs e) 20 | { 21 | Close(); 22 | } 23 | 24 | private void btnBrowse_Click(object sender, EventArgs e) 25 | { 26 | using (FolderBrowserDialog fbd = new FolderBrowserDialog()) 27 | { 28 | if (fbd.ShowDialog() == DialogResult.OK) 29 | { 30 | txtMapleStoryPath.Text = fbd.SelectedPath; 31 | } 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /MapleLauncher/frmSettings.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /MapleLauncher/maple.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yaminike/ms-MapleLauncher/a964e67f1be6101339f099a6c217e84810e65cbb/MapleLauncher/maple.ico -------------------------------------------------------------------------------- /MapleLauncher/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ms-MapleLauncher 2 | A custom launcher that sends hash checksum of the data files and acts a redirector. 3 | 4 | ### Configuration 5 | In order to run this launcher, you must have a configuration file. Here's an example configuration file: 6 | 7 | ``` 8 | { 9 | "MapleStoryPath": "E:\\MapleStory\\GMS\\v.162.3\\" 10 | } 11 | ``` 12 | 13 | ### How To Setup 14 | 15 | 1. Clone the Git repository to a local folder on your machine. 16 | 2. Open the project using Visual Studio 2013 or 2015. 17 | 3. Add a reference to Newtonsoft.Json.dll. 18 | 4. Edit Program.cs to your liking. Here's a list of the values to know about: 19 | Name: The name of your server. This will show up in some places 20 | *IP*: The IP Address of your server to connect to. 21 | *Port*: The Port of your server to connect to. 22 | *ServerIP*: The operation code of the ServerIP packet. That's usualy 0x000B, so you don't have to modify this. 23 | *MaskIP*: Should the program mask the IP Address? In case you have a localhost that connects to 127.0.0.1, you can leave this disabled. 24 | *MaskedIP*: The IP Address to mask. That's mostly for higher-version servers, where the client connects to Neckson's servers. 25 | *ClientName*: The name of the client (localhost.exe, MapleStory.exe, etcetera). 26 | *Website*: The link to your website (used for the tray icon). 27 | *Forums*: The link to your forums (used for the tray icon). 28 | *ConfigName*: The path to the configuration file (config.json as default). 29 | *UseMapleEncryption*: Should the launcher encrypt data with the MapleStory custom encryption? (False for higher versions, true for lower). 30 | 5. Edit the frmMain's design to your liking. 31 | 6. Build the application. 32 | 7. ??? 33 | 8. PROFIT! 34 | 35 | ### How To Calculate Hash? 36 | 37 | Included in the solution is an application called "CalculateHash" which will return the calculated hash checksum of a file. Simply drag the .wz file on it and it will display it's hash checksum! 38 | 39 | ### Handling The Packet 40 | 41 | Handling the custom packet is quite easy. Here's a small example to help you get started! 42 | (Sorry for my rusty Java skills): 43 | 44 | ``` 45 | case WZ_CHECKSUM: 46 | Map wzFiles = new Map(); 47 | wzFiles.put("Base", "1"); 48 | wzFiles.put("Character", "2"); 49 | wzFiles.put("Effect", "3"); 50 | wzFiles.put("Etc", "4"); 51 | wzFiles.put("Item", "5"); 52 | wzFiles.put("Map", "6"); 53 | wzFiles.put("Mob", "7"); 54 | wzFiles.put("Morph", "8"); 55 | wzFiles.put("Npc", "9"); 56 | wzFiles.put("Quest", "10"); 57 | wzFiles.put("Reactor", "11"); 58 | wzFiles.put("Skill", "12"); 59 | wzFiles.put("Sound", "13"); 60 | wzFiles.put("String", "14"); 61 | wzFiles.put("TamingMob", "15"); 62 | wzFiles.put("UI", "16"); 63 | }; 64 | 65 | while (slea.Available() >= 0) { 66 | String name = slea.readMapleString(); 67 | String hash = slea.readMapleString(); 68 | 69 | String computedHash = map.get(name); 70 | 71 | if (hash != computedHash) { 72 | c.disconnect(); 73 | 74 | break; 75 | } 76 | } 77 | 78 | break; 79 | ``` 80 | --------------------------------------------------------------------------------