├── .gitattributes ├── MelonLoader.ModTemplate ├── MelonLoader.ModTemplate.ico ├── Core.cs ├── AssemblyInfo.cs ├── ProjectTemplate.csproj ├── MelonLoader.ModTemplate.vstemplate └── MelonLoader.ModTemplate.csproj ├── MelonLoader.WizardExtension ├── Resources │ └── classdata.tpk ├── MelonLoader.WizardExtension.ico ├── GameInfo.cs ├── Properties │ └── AssemblyInfo.cs ├── source.extension.vsixmanifest ├── MelonLoader.WizardExtensionPackage.cs ├── MelonLoader.WizardExtension.csproj ├── UnityDataParser.cs └── WizardImplementation.cs ├── MelonLoader.PluginTemplate ├── MelonLoader.PluginTemplate.ico ├── Core.cs ├── AssemblyInfo.cs ├── ProjectTemplate.csproj ├── MelonLoader.PluginTemplate.vstemplate └── MelonLoader.PluginTemplate.csproj ├── MelonLoader.ManualModTemplate ├── MelonLoader.ManualModTemplate.ico ├── Core.cs ├── AssemblyInfo.cs ├── ProjectTemplate.csproj ├── MelonLoader.ManualModTemplate.vstemplate └── MelonLoader.ManualModTemplate.csproj ├── MelonLoader.ManualPluginTemplate ├── MelonLoader.ManualPluginTemplate.ico ├── Core.cs ├── AssemblyInfo.cs ├── ProjectTemplate.csproj ├── MelonLoader.ManualPluginTemplate.vstemplate └── MelonLoader.ManualPluginTemplate.csproj ├── README.md ├── MelonLoader.VSWizard.sln ├── .gitignore └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /MelonLoader.ModTemplate/MelonLoader.ModTemplate.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrevTV/MelonLoader.VSWizard/HEAD/MelonLoader.ModTemplate/MelonLoader.ModTemplate.ico -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/Resources/classdata.tpk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrevTV/MelonLoader.VSWizard/HEAD/MelonLoader.WizardExtension/Resources/classdata.tpk -------------------------------------------------------------------------------- /MelonLoader.PluginTemplate/MelonLoader.PluginTemplate.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrevTV/MelonLoader.VSWizard/HEAD/MelonLoader.PluginTemplate/MelonLoader.PluginTemplate.ico -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/MelonLoader.WizardExtension.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrevTV/MelonLoader.VSWizard/HEAD/MelonLoader.WizardExtension/MelonLoader.WizardExtension.ico -------------------------------------------------------------------------------- /MelonLoader.ManualModTemplate/MelonLoader.ManualModTemplate.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrevTV/MelonLoader.VSWizard/HEAD/MelonLoader.ManualModTemplate/MelonLoader.ManualModTemplate.ico -------------------------------------------------------------------------------- /MelonLoader.ManualPluginTemplate/MelonLoader.ManualPluginTemplate.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrevTV/MelonLoader.VSWizard/HEAD/MelonLoader.ManualPluginTemplate/MelonLoader.ManualPluginTemplate.ico -------------------------------------------------------------------------------- /MelonLoader.ManualModTemplate/Core.cs: -------------------------------------------------------------------------------- 1 | using MelonLoader; 2 | 3 | [assembly: MelonInfo(typeof($safeprojectname$.Core), "$projectname$", "1.0.0", "Author", null)] 4 | [assembly: MelonGame(null, null)] 5 | namespace $safeprojectname$; 6 | 7 | public class Core : MelonMod 8 | { 9 | public override void OnInitializeMelon() 10 | { 11 | LoggerInstance.Msg("Initialized."); 12 | } 13 | } -------------------------------------------------------------------------------- /MelonLoader.ModTemplate/Core.cs: -------------------------------------------------------------------------------- 1 | using MelonLoader; 2 | 3 | [assembly: MelonInfo(typeof($safeprojectname$.Core), "$projectname$", "1.0.0", "$AUTHOR$", null)] 4 | [assembly: MelonGame($GAME_DEV$, $GAME_NAME$)] 5 | namespace $safeprojectname$; 6 | 7 | public class Core : MelonMod 8 | { 9 | public override void $INIT_METHOD_NAME$() 10 | { 11 | LoggerInstance.Msg("Initialized."); 12 | } 13 | } -------------------------------------------------------------------------------- /MelonLoader.ManualPluginTemplate/Core.cs: -------------------------------------------------------------------------------- 1 | using MelonLoader; 2 | 3 | [assembly: MelonInfo(typeof($safeprojectname$.Core), "$projectname$", "1.0.0", "Author", null)] 4 | [assembly: MelonGame(null, null)] 5 | namespace $safeprojectname$; 6 | 7 | public class Core : MelonPlugin 8 | { 9 | public override void OnPreInitialization() 10 | { 11 | LoggerInstance.Msg("Pre-initialization."); 12 | } 13 | 14 | public override void OnInitializeMelon() 15 | { 16 | LoggerInstance.Msg("Initialized."); 17 | } 18 | } -------------------------------------------------------------------------------- /MelonLoader.ModTemplate/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("MelonLoader.ModTemplate")] 4 | [assembly: AssemblyDescription("")] 5 | [assembly: AssemblyConfiguration("")] 6 | [assembly: AssemblyCompany("Lava Gang")] 7 | [assembly: AssemblyProduct("MelonLoader.ModTemplate")] 8 | [assembly: AssemblyCopyright("Copyright © Lava Gang 2024")] 9 | [assembly: AssemblyTrademark("")] 10 | [assembly: AssemblyCulture("")] 11 | [assembly: AssemblyVersion("1.0.0.0")] 12 | [assembly: AssemblyFileVersion("1.0.0.0")] 13 | -------------------------------------------------------------------------------- /MelonLoader.PluginTemplate/Core.cs: -------------------------------------------------------------------------------- 1 | using MelonLoader; 2 | 3 | [assembly: MelonInfo(typeof($safeprojectname$.Core), "$projectname$", "1.0.0", "$AUTHOR$", null)] 4 | [assembly: MelonGame($GAME_DEV$, $GAME_NAME$)] 5 | namespace $safeprojectname$; 6 | 7 | public class Core : MelonPlugin 8 | { 9 | public override void OnPreInitialization() 10 | { 11 | LoggerInstance.Msg("Pre-initialization."); 12 | } 13 | 14 | public override void $INIT_METHOD_NAME$() 15 | { 16 | LoggerInstance.Msg("Initialized."); 17 | } 18 | } -------------------------------------------------------------------------------- /MelonLoader.PluginTemplate/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("MelonLoader.PluginTemplate")] 4 | [assembly: AssemblyDescription("")] 5 | [assembly: AssemblyConfiguration("")] 6 | [assembly: AssemblyCompany("Lava Gang")] 7 | [assembly: AssemblyProduct("MelonLoader.PluginTemplate")] 8 | [assembly: AssemblyCopyright("Copyright © Lava Gang 2024")] 9 | [assembly: AssemblyTrademark("")] 10 | [assembly: AssemblyCulture("")] 11 | [assembly: AssemblyVersion("1.0.0.0")] 12 | [assembly: AssemblyFileVersion("1.0.0.0")] 13 | -------------------------------------------------------------------------------- /MelonLoader.ManualModTemplate/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("MelonLoader.ManualModTemplate")] 4 | [assembly: AssemblyDescription("")] 5 | [assembly: AssemblyConfiguration("")] 6 | [assembly: AssemblyCompany("Lava Gang")] 7 | [assembly: AssemblyProduct("MelonLoader.ManualModTemplate")] 8 | [assembly: AssemblyCopyright("Copyright © Lava Gang 2024")] 9 | [assembly: AssemblyTrademark("")] 10 | [assembly: AssemblyCulture("")] 11 | [assembly: AssemblyVersion("1.0.0.0")] 12 | [assembly: AssemblyFileVersion("1.0.0.0")] 13 | -------------------------------------------------------------------------------- /MelonLoader.ManualPluginTemplate/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("MelonLoader.ManualPluginTemplate")] 4 | [assembly: AssemblyDescription("")] 5 | [assembly: AssemblyConfiguration("")] 6 | [assembly: AssemblyCompany("Lava Gang")] 7 | [assembly: AssemblyProduct("MelonLoader.ManualPluginTemplate")] 8 | [assembly: AssemblyCopyright("Copyright © Lava Gang 2024")] 9 | [assembly: AssemblyTrademark("")] 10 | [assembly: AssemblyCulture("")] 11 | [assembly: AssemblyVersion("1.0.0.0")] 12 | [assembly: AssemblyFileVersion("1.0.0.0")] 13 | -------------------------------------------------------------------------------- /MelonLoader.ManualModTemplate/ProjectTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net6.0 4 | enable 5 | disable 6 | $safeprojectname$ 7 | default 8 | false 9 | 1.0.0.0 10 | 1.0.0.0 11 | en-US 12 | $safeprojectname$ 13 | latest 14 | 15 | 16 | 17 | True 18 | false 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MelonLoader.ManualPluginTemplate/ProjectTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net6.0 4 | enable 5 | disable 6 | $safeprojectname$ 7 | default 8 | false 9 | 1.0.0.0 10 | 1.0.0.0 11 | en-US 12 | $safeprojectname$ 13 | latest 14 | 15 | 16 | 17 | True 18 | false 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/GameInfo.cs: -------------------------------------------------------------------------------- 1 | using AssetRipper.Primitives; 2 | using System; 3 | 4 | namespace MelonLoader.WizardExtension 5 | { 6 | public class GameInfo 7 | { 8 | private static readonly Version _ml6Version = new(0, 6, 0); 9 | 10 | // Compat Check 11 | public bool IsUnityGame { get; set; } = true; 12 | public bool HasMelonInstalled { get; set; } = true; 13 | public bool IsMelonValid { get; set; } = true; 14 | 15 | // Data 16 | public string Path { get; set; } = ""; 17 | public string ExePath { get; set; } = ""; 18 | public string DataPath { get; set; } = ""; 19 | public Version MelonVersion { get; set; } = new(); 20 | public bool IsMelon6Plus { get => MelonVersion >= _ml6Version; } 21 | public bool IsIl2Cpp { get; set; } = false; 22 | 23 | public string GameName { get; set; } = null; 24 | public string GameDeveloper { get; set; } = null; 25 | public UnityVersion EngineVersion { get; set; } = UnityVersion.MinVersion; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /MelonLoader.ModTemplate/ProjectTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$FRAMEWORK_VER$ 4 | enable 5 | disable 6 | $safeprojectname$ 7 | default 8 | false 9 | 1.0.0.0 10 | 1.0.0.0 11 | en-US 12 | $safeprojectname$ 13 | latest 14 | $IMPLICIT_USINGS$ 15 | 16 | 17 | 18 | $PROJ_REFERENCES$ 19 | 20 | 21 | 22 | True 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /MelonLoader.PluginTemplate/ProjectTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$FRAMEWORK_VER$ 4 | enable 5 | disable 6 | $safeprojectname$ 7 | default 8 | false 9 | 1.0.0.0 10 | 1.0.0.0 11 | en-US 12 | $safeprojectname$ 13 | latest 14 | $IMPLICIT_USINGS$ 15 | 16 | 17 | 18 | $PROJ_REFERENCES$ 19 | 20 | 21 | 22 | True 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /MelonLoader.ManualModTemplate/MelonLoader.ManualModTemplate.vstemplate: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MelonLoader Mod (Manual) 5 | A template for setting up MelonLoader mods. This assumes the mod uses .NET 6 on MelonLoader 0.6+. Requires references to be added manually. 6 | MelonLoader.ManualModTemplate.ico 7 | CSharp 8 | csharp 9 | 1000 10 | fe6fb177-df66-404e-91ae-66a18a1e55bb 11 | true 12 | MelonLoaderMod 13 | true 14 | 15 | 16 | 17 | Core.cs 18 | 19 | 20 | -------------------------------------------------------------------------------- /MelonLoader.ManualPluginTemplate/MelonLoader.ManualPluginTemplate.vstemplate: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MelonLoader Plugin (Manual) 5 | A template for setting up MelonLoader plugins. This assumes the mod uses .NET 6 on MelonLoader 0.6+. Requires references to be added manually. 6 | MelonLoader.ManualPluginTemplate.ico 7 | CSharp 8 | csharp 9 | 1000 10 | d2d34fcc-a0ce-4060-a09b-f83513a6df5a 11 | true 12 | MelonLoaderPlugin 13 | true 14 | 15 | 16 | 17 | Core.cs 18 | 19 | 20 | -------------------------------------------------------------------------------- /MelonLoader.ModTemplate/MelonLoader.ModTemplate.vstemplate: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MelonLoader Mod 5 | A wizard for setting up MelonLoader mods. 6 | MelonLoader.ModTemplate.ico 7 | CSharp 8 | csharp 9 | 1000 10 | 9925f0be-8acf-47cb-b342-7a1d0e7a05dd 11 | true 12 | MelonLoaderMod 13 | true 14 | 15 | 16 | 17 | Core.cs 18 | 19 | 20 | 21 | MelonLoader.WizardExtension, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=b05c59bf5a58e638 22 | MelonLoader.WizardExtension.WizardImplementation 23 | 24 | -------------------------------------------------------------------------------- /MelonLoader.PluginTemplate/MelonLoader.PluginTemplate.vstemplate: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MelonLoader Plugin 5 | A wizard for setting up MelonLoader plugins. 6 | MelonLoader.PluginTemplate.ico 7 | CSharp 8 | csharp 9 | 1000 10 | ec752448-543c-4924-861e-1bd6dffa859a 11 | true 12 | MelonLoaderPlugin 13 | true 14 | 15 | 16 | 17 | Core.cs 18 | 19 | 20 | 21 | MelonLoader.WizardExtension, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=b05c59bf5a58e638 22 | MelonLoader.WizardExtension.WizardImplementation 23 | 24 | -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/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("MelonLoader.WizardExtension")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MelonLoader.WizardExtension")] 13 | [assembly: AssemblyCopyright("")] 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 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MelonLoader VS Wizard 2 | 3 | An automated Visual Studio 2022 template for creating MelonLoader mods and plugins. It supports MelonLoader 0.5.0 to the latest as well as Il2Cpp and Mono games. 4 | 5 | ## What does it handle? 6 | It handles the creation of the required boilerplate (the `MelonMod`/`MelonPlugin` class, `MelonInfo`, and `MelonGame`) as well as referencing the required assemblies for mod development, mainly MelonLoader, Harmony, and for Il2Cpp, proxy assemblies and the unhollower (Il2CppAssemblyUnhollower or Il2CppInterop). It also handles variation between MelonLoader or Unity versions, such as framework versions or override changes. 7 | 8 | ## Usage 9 | 0. Download MelonLoader to your game and run it once before continuing. 10 | 1. Download the VSIX from the [Releases](https://github.com/TrevTV/MelonLoader.VSWizard/releases) tab. 11 | 2. Close all instances of Visual Studio and run the VSIX installer (double-clicking it should open it). 12 | 3. Open Visual Studio and create a new project. 13 | 4. Search for `MelonLoader` and click on either Mod or Plugin. 14 | 5. Enter the project info and press Create. 15 | 6. Select the EXE of the game you are modding and press Open. 16 | 7. Wait for the project creation and it should open a Visual Studio window with a working project. 17 | 18 | You may want to change the author in the `MelonInfo` attribute. It defaults to your computer's username. 19 | 20 | ## Licensing 21 | - [AssetRipper.Primitives](https://github.com/AssetRipper/Primitives) is licensed under the MIT License. See [LICENSE](https://github.com/AssetRipper/Primitives/blob/master/License.md) for the full License. 22 | - [AssetsTools.NET](https://github.com/nesrak1/AssetsTools.NET) is licensed under the MIT License. See [LICENSE](https://github.com/nesrak1/AssetsTools.NET/blob/master/LICENSE) for the full License. 23 | - [StrongNamer](https://github.com/dsplaisted/strongnamer) is licensed under the MIT License. See [LICENSE](https://github.com/dsplaisted/strongnamer/blob/master/LICENSE) for the full License. 24 | - [MelonLoader](https://github.com/LavaGang/MelonLoader) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/LavaGang/MelonLoader/blob/master/LICENSE.md) for the full License. 25 | -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MelonLoader.WizardExtension 6 | Extension to handle the wizard for MelonLoader templates. 7 | MelonLoader.WizardExtension.ico 8 | 9 | 10 | 11 | amd64 12 | 13 | 14 | arm64 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/MelonLoader.WizardExtensionPackage.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell; 2 | using System; 3 | using System.Runtime.InteropServices; 4 | using System.Threading; 5 | using Task = System.Threading.Tasks.Task; 6 | 7 | namespace MelonLoader.WizardExtension 8 | { 9 | /// 10 | /// This is the class that implements the package exposed by this assembly. 11 | /// 12 | /// 13 | /// 14 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 15 | /// is to implement the IVsPackage interface and register itself with the shell. 16 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 17 | /// to do it: it derives from the Package class that provides the implementation of the 18 | /// IVsPackage interface and uses the registration attributes defined in the framework to 19 | /// register itself and its components with the shell. These attributes tell the pkgdef creation 20 | /// utility what data to put into .pkgdef file. 21 | /// 22 | /// 23 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. 24 | /// 25 | /// 26 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 27 | [Guid(MelonLoaderWizardExtensionPackage.PackageGuidString)] 28 | public sealed class MelonLoaderWizardExtensionPackage : AsyncPackage 29 | { 30 | /// 31 | /// MelonLoader.WizardExtensionPackage GUID string. 32 | /// 33 | public const string PackageGuidString = "92d8770b-6508-4ad8-9818-b97507982abf"; 34 | 35 | #region Package Members 36 | 37 | /// 38 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 39 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 40 | /// 41 | /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. 42 | /// A provider for progress updates. 43 | /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. 44 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 45 | { 46 | // When initialized asynchronously, the current thread may be a background thread at this point. 47 | // Do any initialization that requires the UI thread after switching to the UI thread. 48 | await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 49 | } 50 | 51 | #endregion 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /MelonLoader.ModTemplate/MelonLoader.ModTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 12 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD} 13 | Library 14 | Properties 15 | MelonLoader.ModTemplate 16 | MelonLoader.ModTemplate 17 | v4.7.2 18 | 512 19 | false 20 | false 21 | false 22 | false 23 | false 24 | false 25 | false 26 | false 27 | false 28 | false 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | False 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /MelonLoader.PluginTemplate/MelonLoader.PluginTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 12 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7} 13 | Library 14 | Properties 15 | MelonLoader.PluginTemplate 16 | MelonLoader.PluginTemplate 17 | v4.7.2 18 | 512 19 | false 20 | false 21 | false 22 | false 23 | false 24 | false 25 | false 26 | false 27 | false 28 | false 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | False 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /MelonLoader.ManualModTemplate/MelonLoader.ManualModTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 12 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C} 13 | Library 14 | Properties 15 | MelonLoader.ManualModTemplate 16 | MelonLoader.ManualModTemplate 17 | v4.7.2 18 | 512 19 | false 20 | false 21 | false 22 | false 23 | false 24 | false 25 | false 26 | false 27 | false 28 | false 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | False 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /MelonLoader.ManualPluginTemplate/MelonLoader.ManualPluginTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 12 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B} 13 | Library 14 | Properties 15 | MelonLoader.ManualPluginTemplate 16 | MelonLoader.ManualPluginTemplate 17 | v4.7.2 18 | 512 19 | false 20 | false 21 | false 22 | false 23 | false 24 | false 25 | false 26 | false 27 | false 28 | false 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | False 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /MelonLoader.VSWizard.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 17 3 | VisualStudioVersion = 17.8.34330.188 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MelonLoader.ModTemplate", "MelonLoader.ModTemplate\MelonLoader.ModTemplate.csproj", "{D7920CFA-47EF-4A62-86C1-7FF02737B0CD}" 6 | EndProject 7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MelonLoader.WizardExtension", "MelonLoader.WizardExtension\MelonLoader.WizardExtension.csproj", "{B63634D6-971E-4FA8-AC31-4C8D6977FBCA}" 8 | EndProject 9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MelonLoader.PluginTemplate", "MelonLoader.PluginTemplate\MelonLoader.PluginTemplate.csproj", "{86A95121-B313-4789-B0FB-7BE19D5CBEC7}" 10 | EndProject 11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MelonLoader.ManualModTemplate", "MelonLoader.ManualModTemplate\MelonLoader.ManualModTemplate.csproj", "{3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}" 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MelonLoader.ManualPluginTemplate", "MelonLoader.ManualPluginTemplate\MelonLoader.ManualPluginTemplate.csproj", "{E116C734-7C62-4E74-9A2B-3FACE9003C6B}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Debug|arm64 = Debug|arm64 19 | Debug|x86 = Debug|x86 20 | Release|Any CPU = Release|Any CPU 21 | Release|arm64 = Release|arm64 22 | Release|x86 = Release|x86 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Debug|arm64.ActiveCfg = Debug|arm64 28 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Debug|arm64.Build.0 = Debug|arm64 29 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Debug|x86.ActiveCfg = Debug|x86 30 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Debug|x86.Build.0 = Debug|x86 31 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Release|arm64.ActiveCfg = Release|arm64 34 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Release|arm64.Build.0 = Release|arm64 35 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Release|x86.ActiveCfg = Release|x86 36 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD}.Release|x86.Build.0 = Release|x86 37 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Debug|arm64.ActiveCfg = Debug|arm64 40 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Debug|arm64.Build.0 = Debug|arm64 41 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Debug|x86.ActiveCfg = Debug|x86 42 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Debug|x86.Build.0 = Debug|x86 43 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Release|Any CPU.ActiveCfg = Release|Any CPU 44 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Release|Any CPU.Build.0 = Release|Any CPU 45 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Release|arm64.ActiveCfg = Release|arm64 46 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Release|arm64.Build.0 = Release|arm64 47 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Release|x86.ActiveCfg = Release|x86 48 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA}.Release|x86.Build.0 = Release|x86 49 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 50 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Debug|Any CPU.Build.0 = Debug|Any CPU 51 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Debug|arm64.ActiveCfg = Debug|arm64 52 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Debug|arm64.Build.0 = Debug|arm64 53 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Debug|x86.ActiveCfg = Debug|x86 54 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Debug|x86.Build.0 = Debug|x86 55 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Release|Any CPU.ActiveCfg = Release|Any CPU 56 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Release|Any CPU.Build.0 = Release|Any CPU 57 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Release|arm64.ActiveCfg = Release|arm64 58 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Release|arm64.Build.0 = Release|arm64 59 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Release|x86.ActiveCfg = Release|x86 60 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7}.Release|x86.Build.0 = Release|x86 61 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 62 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Debug|Any CPU.Build.0 = Debug|Any CPU 63 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Debug|arm64.ActiveCfg = Debug|arm64 64 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Debug|arm64.Build.0 = Debug|arm64 65 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Debug|x86.ActiveCfg = Debug|x86 66 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Debug|x86.Build.0 = Debug|x86 67 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Release|Any CPU.ActiveCfg = Release|Any CPU 68 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Release|Any CPU.Build.0 = Release|Any CPU 69 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Release|arm64.ActiveCfg = Release|arm64 70 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Release|arm64.Build.0 = Release|arm64 71 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Release|x86.ActiveCfg = Release|x86 72 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C}.Release|x86.Build.0 = Release|x86 73 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 74 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Debug|Any CPU.Build.0 = Debug|Any CPU 75 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Debug|arm64.ActiveCfg = Debug|arm64 76 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Debug|arm64.Build.0 = Debug|arm64 77 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Debug|x86.ActiveCfg = Debug|x86 78 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Debug|x86.Build.0 = Debug|x86 79 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Release|Any CPU.ActiveCfg = Release|Any CPU 80 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Release|Any CPU.Build.0 = Release|Any CPU 81 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Release|arm64.ActiveCfg = Release|arm64 82 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Release|arm64.Build.0 = Release|arm64 83 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Release|x86.ActiveCfg = Release|x86 84 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B}.Release|x86.Build.0 = Release|x86 85 | EndGlobalSection 86 | GlobalSection(SolutionProperties) = preSolution 87 | HideSolutionNode = FALSE 88 | EndGlobalSection 89 | GlobalSection(ExtensibilityGlobals) = postSolution 90 | SolutionGuid = {0A9A91A7-8BC4-4C61-8DC1-8079CDBDEDF0} 91 | EndGlobalSection 92 | EndGlobal 93 | -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/MelonLoader.WizardExtension.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | true 9 | 10 | 11 | key.snk 12 | 13 | 14 | 15 | Debug 16 | AnyCPU 17 | 2.0 18 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | {B63634D6-971E-4FA8-AC31-4C8D6977FBCA} 20 | Library 21 | Properties 22 | MelonLoader.WizardExtension 23 | MelonLoader.WizardExtension 24 | v4.7.2 25 | true 26 | true 27 | true 28 | true 29 | true 30 | true 31 | true 32 | Program 33 | $(DevEnvDir)devenv.exe 34 | /rootsuffix Exp 35 | latest 36 | 37 | 38 | true 39 | full 40 | false 41 | bin\Debug\ 42 | DEBUG;TRACE 43 | prompt 44 | 4 45 | 46 | 47 | pdbonly 48 | true 49 | bin\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Designer 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 3.1.3 80 | 81 | 82 | 3.0.0 83 | 84 | 85 | 86 | 87 | 0.2.5 88 | 89 | 90 | 91 | 92 | {3B4D5FA1-CEE0-42D2-B331-02C0BE551F7C} 93 | MelonLoader.ManualModTemplate 94 | ProjectTemplates 95 | false 96 | TemplateProjectOutputGroup%3b 97 | 98 | 99 | {E116C734-7C62-4E74-9A2B-3FACE9003C6B} 100 | MelonLoader.ManualPluginTemplate 101 | ProjectTemplates 102 | false 103 | TemplateProjectOutputGroup%3b 104 | 105 | 106 | {D7920CFA-47EF-4A62-86C1-7FF02737B0CD} 107 | MelonLoader.ModTemplate 108 | ProjectTemplates 109 | false 110 | TemplateProjectOutputGroup%3b 111 | 112 | 113 | {86A95121-B313-4789-B0FB-7BE19D5CBEC7} 114 | MelonLoader.PluginTemplate 115 | ProjectTemplates 116 | false 117 | TemplateProjectOutputGroup%3b 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 132 | -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/UnityDataParser.cs: -------------------------------------------------------------------------------- 1 | using AssetsTools.NET.Extra; 2 | using AssetsTools.NET; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Text.RegularExpressions; 10 | using UnityVersion = AssetRipper.Primitives.UnityVersion; 11 | using System.Reflection; 12 | 13 | namespace MelonLoader.WizardExtension 14 | { 15 | // copied from MelonLoader 16 | internal static class UnityDataParser 17 | { 18 | internal static void Run(GameInfo info) 19 | { 20 | AssetsManager assetsManager = new(); 21 | ReadGameInfo(assetsManager, info); 22 | assetsManager.UnloadAll(); 23 | 24 | if (string.IsNullOrEmpty(info.GameDeveloper) 25 | || string.IsNullOrEmpty(info.GameName)) 26 | ReadGameInfoFallback(info); 27 | 28 | if (info.EngineVersion == UnityVersion.MinVersion) 29 | { 30 | try { info.EngineVersion = ReadVersionFallback(info); } 31 | catch { } 32 | } 33 | 34 | if (string.IsNullOrEmpty(info.GameDeveloper)) 35 | info.GameDeveloper = null; 36 | if (string.IsNullOrEmpty(info.GameName)) 37 | info.GameName = null; 38 | } 39 | 40 | private static void ReadGameInfo(AssetsManager assetsManager, GameInfo info) 41 | { 42 | AssetsFileInstance instance = null; 43 | try 44 | { 45 | string bundlePath = Path.Combine(info.DataPath, "globalgamemanagers"); 46 | if (!File.Exists(bundlePath)) 47 | bundlePath = Path.Combine(info.DataPath, "mainData"); 48 | 49 | if (!File.Exists(bundlePath)) 50 | { 51 | bundlePath = Path.Combine(info.DataPath, "data.unity3d"); 52 | if (!File.Exists(bundlePath)) 53 | return; 54 | 55 | BundleFileInstance bundleFile = assetsManager.LoadBundleFile(bundlePath); 56 | instance = assetsManager.LoadAssetsFileFromBundle(bundleFile, "globalgamemanagers"); 57 | } 58 | else 59 | instance = assetsManager.LoadAssetsFile(bundlePath, true); 60 | if (instance == null) 61 | return; 62 | 63 | ClassPackageFile classPackage = null; 64 | using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MelonLoader.WizardExtension.Resources.classdata.tpk")) 65 | classPackage = assetsManager.LoadClassPackage(stream); 66 | 67 | if (!instance.file.Metadata.TypeTreeEnabled) 68 | assetsManager.LoadClassDatabaseFromPackage(instance.file.Metadata.UnityVersion); 69 | 70 | if (info.EngineVersion == UnityVersion.MinVersion) 71 | info.EngineVersion = UnityVersion.Parse(instance.file.Metadata.UnityVersion); 72 | 73 | List assetFiles = instance.file.GetAssetsOfType(AssetClassID.PlayerSettings); 74 | if (assetFiles.Count > 0) 75 | { 76 | AssetFileInfo playerSettings = assetFiles.First(); 77 | 78 | AssetTypeValueField playerSettings_baseField = assetsManager.GetBaseField(instance, playerSettings); 79 | if (playerSettings_baseField != null) 80 | { 81 | AssetTypeValueField bundleVersion = playerSettings_baseField.Get("bundleVersion"); 82 | AssetTypeValueField companyName = playerSettings_baseField.Get("companyName"); 83 | if (companyName != null) 84 | info.GameDeveloper = companyName.AsString; 85 | 86 | AssetTypeValueField productName = playerSettings_baseField.Get("productName"); 87 | if (productName != null) 88 | info.GameName = productName.AsString; 89 | } 90 | } 91 | } 92 | catch { } 93 | 94 | instance?.file.Close(); 95 | } 96 | 97 | private static void ReadGameInfoFallback(GameInfo info) 98 | { 99 | try 100 | { 101 | string appInfoFilePath = Path.Combine(info.DataPath, "app.info"); 102 | if (!File.Exists(appInfoFilePath)) 103 | return; 104 | 105 | string[] filestr = File.ReadAllLines(appInfoFilePath); 106 | if ((filestr == null) || (filestr.Length < 2)) 107 | return; 108 | 109 | if (string.IsNullOrEmpty(info.GameDeveloper) && !string.IsNullOrEmpty(filestr[0])) 110 | info.GameDeveloper = filestr[0]; 111 | 112 | if (string.IsNullOrEmpty(info.GameName) && !string.IsNullOrEmpty(filestr[1])) 113 | info.GameName = filestr[1]; 114 | 115 | } 116 | catch { } 117 | } 118 | 119 | private static UnityVersion ReadVersionFallback(GameInfo info) 120 | { 121 | string unityPlayerPath = info.ExePath; 122 | if (Environment.OSVersion.Platform == PlatformID.Win32NT) 123 | { 124 | var unityVer = FileVersionInfo.GetVersionInfo(unityPlayerPath); 125 | return new UnityVersion((ushort)unityVer.FileMajorPart, (ushort)unityVer.FileMinorPart, (ushort)unityVer.FileBuildPart); 126 | } 127 | 128 | try 129 | { 130 | var globalgamemanagersPath = Path.Combine(info.DataPath, "globalgamemanagers"); 131 | if (File.Exists(globalgamemanagersPath)) 132 | return GetVersionFromGlobalGameManagers(File.ReadAllBytes(globalgamemanagersPath)); 133 | } 134 | catch { } 135 | 136 | try 137 | { 138 | var dataPath = Path.Combine(info.DataPath, "data.unity3d"); 139 | if (File.Exists(dataPath)) 140 | return GetVersionFromDataUnity3D(File.OpenRead(dataPath)); 141 | } 142 | catch { } 143 | 144 | return default; 145 | } 146 | 147 | private static UnityVersion GetVersionFromGlobalGameManagers(byte[] ggmBytes) 148 | { 149 | var verString = new StringBuilder(); 150 | var idx = 0x14; 151 | while (ggmBytes[idx] != 0) 152 | { 153 | verString.Append(Convert.ToChar(ggmBytes[idx])); 154 | idx++; 155 | } 156 | 157 | Regex UnityVersionRegex = new(@"^[0-9]+\.[0-9]+\.[0-9]+[abcfx][0-9]+$", RegexOptions.Compiled); 158 | string unityVer = verString.ToString(); 159 | if (!UnityVersionRegex.IsMatch(unityVer)) 160 | { 161 | idx = 0x30; 162 | verString = new StringBuilder(); 163 | while (ggmBytes[idx] != 0) 164 | { 165 | verString.Append(Convert.ToChar(ggmBytes[idx])); 166 | idx++; 167 | } 168 | 169 | unityVer = verString.ToString().Trim(); 170 | } 171 | 172 | return UnityVersion.Parse(unityVer); 173 | } 174 | 175 | private static UnityVersion GetVersionFromDataUnity3D(Stream fileStream) 176 | { 177 | var verString = new StringBuilder(); 178 | 179 | if (fileStream.CanSeek) 180 | fileStream.Seek(0x12, SeekOrigin.Begin); 181 | else 182 | { 183 | if (fileStream.Read(new byte[0x12], 0, 0x12) != 0x12) 184 | throw new("Failed to seek to 0x12 in data.unity3d"); 185 | } 186 | 187 | while (true) 188 | { 189 | var read = fileStream.ReadByte(); 190 | if (read == 0) 191 | break; 192 | verString.Append(Convert.ToChar(read)); 193 | } 194 | 195 | return UnityVersion.Parse(verString.ToString().Trim()); 196 | } 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | *.sbr 86 | *.tlb 87 | *.tli 88 | *.tlh 89 | *.tmp 90 | *.tmp_proj 91 | *_wpftmp.csproj 92 | *.log 93 | *.tlog 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 298 | *.vbp 299 | 300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 301 | *.dsw 302 | *.dsp 303 | 304 | # Visual Studio 6 technical files 305 | *.ncb 306 | *.aps 307 | 308 | # Visual Studio LightSwitch build output 309 | **/*.HTMLClient/GeneratedArtifacts 310 | **/*.DesktopClient/GeneratedArtifacts 311 | **/*.DesktopClient/ModelManifest.xml 312 | **/*.Server/GeneratedArtifacts 313 | **/*.Server/ModelManifest.xml 314 | _Pvt_Extensions 315 | 316 | # Paket dependency manager 317 | .paket/paket.exe 318 | paket-files/ 319 | 320 | # FAKE - F# Make 321 | .fake/ 322 | 323 | # CodeRush personal settings 324 | .cr/personal 325 | 326 | # Python Tools for Visual Studio (PTVS) 327 | __pycache__/ 328 | *.pyc 329 | 330 | # Cake - Uncomment if you are using it 331 | # tools/** 332 | # !tools/packages.config 333 | 334 | # Tabs Studio 335 | *.tss 336 | 337 | # Telerik's JustMock configuration file 338 | *.jmconfig 339 | 340 | # BizTalk build output 341 | *.btp.cs 342 | *.btm.cs 343 | *.odx.cs 344 | *.xsd.cs 345 | 346 | # OpenCover UI analysis results 347 | OpenCover/ 348 | 349 | # Azure Stream Analytics local run output 350 | ASALocalRun/ 351 | 352 | # MSBuild Binary and Structured Log 353 | *.binlog 354 | 355 | # NVidia Nsight GPU debugger configuration file 356 | *.nvuser 357 | 358 | # MFractors (Xamarin productivity tool) working folder 359 | .mfractor/ 360 | 361 | # Local History for Visual Studio 362 | .localhistory/ 363 | 364 | # Visual Studio History (VSHistory) files 365 | .vshistory/ 366 | 367 | # BeatPulse healthcheck temp database 368 | healthchecksdb 369 | 370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 371 | MigrationBackup/ 372 | 373 | # Ionide (cross platform F# VS Code tools) working folder 374 | .ionide/ 375 | 376 | # Fody - auto-generated XML schema 377 | FodyWeavers.xsd 378 | 379 | # VS Code files for those working on multiple tools 380 | .vscode/* 381 | !.vscode/settings.json 382 | !.vscode/tasks.json 383 | !.vscode/launch.json 384 | !.vscode/extensions.json 385 | *.code-workspace 386 | 387 | # Local History for Visual Studio Code 388 | .history/ 389 | 390 | # Windows Installer files from build outputs 391 | *.cab 392 | *.msi 393 | *.msix 394 | *.msm 395 | *.msp 396 | 397 | # JetBrains Rider 398 | *.sln.iml 399 | MelonLoader.WizardExtension/key.snk 400 | -------------------------------------------------------------------------------- /MelonLoader.WizardExtension/WizardImplementation.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using Microsoft.VisualStudio.TemplateWizard; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Windows; 10 | using System.Windows.Forms; 11 | using MessageBox = System.Windows.MessageBox; 12 | 13 | namespace MelonLoader.WizardExtension 14 | { 15 | public class WizardImplementation : IWizard 16 | { 17 | private Dictionary _replacements = []; 18 | 19 | public void BeforeOpeningFile(ProjectItem projectItem) 20 | { 21 | } 22 | 23 | public void ProjectFinishedGenerating(Project project) 24 | { 25 | } 26 | 27 | public void RunFinished() 28 | { 29 | } 30 | 31 | public void RunStarted(object automationObject, Dictionary replacementsDictionary, WizardRunKind runKind, object[] customParams) 32 | { 33 | try 34 | { 35 | BeginWizard(); 36 | foreach (var item in _replacements) 37 | replacementsDictionary.Add(item.Key, item.Value); 38 | } 39 | catch (WizardCancelledException) 40 | { 41 | throw; 42 | } 43 | catch (Exception ex) 44 | { 45 | MessageBox.Show(ex.ToString()); 46 | throw new WizardCancelledException(); 47 | } 48 | } 49 | 50 | private void BeginWizard() 51 | { 52 | using OpenFileDialog dialog = new(); 53 | dialog.Title = "Select Game Executable"; 54 | dialog.Multiselect = false; 55 | dialog.Filter = "Unity Executables (*.exe)|*.exe"; 56 | 57 | if (dialog.ShowDialog() != DialogResult.OK) 58 | throw new WizardCancelledException(); 59 | 60 | var info = TryParseGamePath(dialog.FileName); 61 | 62 | string framework = GetFramework(info); 63 | 64 | _replacements.Add("$GAME_DIR$", info.Path); 65 | _replacements.Add("$GAME_DEV$", info.GameDeveloper == null ? "null" : $"\"{info.GameDeveloper}\""); 66 | _replacements.Add("$GAME_NAME$", info.GameName == null ? "null" : $"\"{info.GameName}\""); 67 | _replacements.Add("$FRAMEWORK_VER$", framework); 68 | _replacements.Add("$AUTHOR$", Environment.UserName); 69 | _replacements.Add("$PROJ_REFERENCES$", GenerateReferences(info, framework)); 70 | _replacements.Add("$INIT_METHOD_NAME$", info.MelonVersion >= new Version(0, 5, 5) ? "OnInitializeMelon" : "OnApplicationStart"); 71 | _replacements.Add("$IMPLICIT_USINGS$", framework == "35" ? "disable" : "enable"); 72 | } 73 | 74 | private string GetFramework(GameInfo info) 75 | { 76 | string framework = "6.0"; 77 | if (!info.IsMelon6Plus && info.IsIl2Cpp) 78 | framework = "472"; 79 | 80 | if (!info.IsIl2Cpp) 81 | { 82 | if (info.EngineVersion >= new AssetRipper.Primitives.UnityVersion(2021, 2, 0)) 83 | framework = "standard2.1"; 84 | else if (info.EngineVersion >= new AssetRipper.Primitives.UnityVersion(2018, 1, 0)) 85 | framework = "472"; 86 | else if (info.EngineVersion >= new AssetRipper.Primitives.UnityVersion(2017, 1, 0)) 87 | framework = "35"; // possible for it to be 472, but this is a safer bet 88 | else 89 | framework = "35"; 90 | } 91 | 92 | return framework; 93 | } 94 | 95 | private string GenerateReferences(GameInfo info, string framework) 96 | { 97 | string il2cppDllDir = info.IsMelon6Plus ? Path.Combine(info.Path, "MelonLoader", "Il2CppAssemblies") : Path.Combine(info.Path, "MelonLoader", "Managed"); 98 | string dllDir = info.IsIl2Cpp ? il2cppDllDir : Path.Combine(info.DataPath, "Managed"); 99 | 100 | if (info.IsIl2Cpp && (!Directory.Exists(il2cppDllDir) || !File.Exists(Path.Combine(info.Path, "MelonLoader", "Dependencies", "Il2CppAssemblyGenerator", "Config.cfg")))) 101 | { 102 | MessageBox.Show("Game has no generated assemblies. Please run it once with MelonLoader installed before creating a project."); 103 | throw new WizardCancelledException(); 104 | } 105 | 106 | StringBuilder referencesBuilder = new(); 107 | List files = [.. Directory.GetFiles(dllDir, "*.dll")]; 108 | if (info.MelonVersion <= new Version(0, 5, 3)) 109 | files.Add(Path.Combine(info.Path, "MelonLoader", "MelonLoader.dll")); 110 | else if (info.MelonVersion <= new Version(0, 5, 7)) 111 | { 112 | files.Add(Path.Combine(info.Path, "MelonLoader", "MelonLoader.dll")); 113 | files.Add(Path.Combine(info.Path, "MelonLoader", "0Harmony.dll")); 114 | } 115 | else // ML 0.6+ 116 | { 117 | files.Add(Path.Combine(info.Path, "MelonLoader", info.IsIl2Cpp ? "net6" : "net35", "MelonLoader.dll")); 118 | files.Add(Path.Combine(info.Path, "MelonLoader", info.IsIl2Cpp ? "net6" : "net35", "0Harmony.dll")); 119 | 120 | if (info.IsIl2Cpp) 121 | { 122 | files.Add(Path.Combine(info.Path, "MelonLoader", "net6", "Il2CppInterop.Runtime.dll")); 123 | files.Add(Path.Combine(info.Path, "MelonLoader", "net6", "Il2CppInterop.Common.dll")); 124 | } 125 | } 126 | 127 | // this doesn't seem to be needed on all net35 mods for some reason, but at least on LiS:BtS it was, and it didn't seem to affect others so may as well add it 128 | if (framework == "35") 129 | { 130 | if (info.IsMelon6Plus) 131 | files.Add(Path.Combine(info.Path, "MelonLoader", "net35", "ValueTupleBridge.dll")); 132 | else 133 | files.Add(Path.Combine(info.Path, "MelonLoader", "ValueTupleBridge.dll")); 134 | } 135 | 136 | foreach (string file in files) 137 | { 138 | if (IsBlacklistedReference(Path.GetFileName(file))) 139 | continue; 140 | 141 | referencesBuilder.AppendLine($"\t\t"); 142 | referencesBuilder.AppendLine($"\t\t\t{file}"); 143 | referencesBuilder.AppendLine($"\t\t"); 144 | } 145 | 146 | return referencesBuilder.ToString(); 147 | } 148 | 149 | private GameInfo TryParseGamePath(string exe) 150 | { 151 | GameInfo info = new(); 152 | 153 | // likely won't occur, but may as well just in case 154 | if (string.IsNullOrWhiteSpace(exe)) 155 | { 156 | ThrowError("Path does not contain an EXE."); 157 | info.IsUnityGame = false; 158 | return info; 159 | } 160 | 161 | string dir = Path.GetDirectoryName(exe); 162 | 163 | info.Path = dir; 164 | 165 | if (string.IsNullOrWhiteSpace(dir) || !Directory.Exists(dir)) 166 | { 167 | ThrowError("Game path does not exist."); 168 | return info; 169 | } 170 | 171 | var files = Directory.GetFiles(dir, "*.*", SearchOption.AllDirectories); 172 | 173 | string dataDir = Path.Combine(dir, Path.GetFileNameWithoutExtension(exe) + "_Data"); 174 | if (!Directory.Exists(dataDir)) 175 | { 176 | ThrowError("Path does not contain a Data folder. It may not be a Unity game."); 177 | info.IsUnityGame = false; 178 | return info; 179 | } 180 | 181 | info.ExePath = exe; 182 | info.DataPath = dataDir; 183 | 184 | string prefix = "MelonLoader"; 185 | if (files.Any(f => f.Contains(prefix + "\\net6") || f.Contains(prefix + "\\net35"))) 186 | prefix += "\\" + (info.IsIl2Cpp ? "net6" : "net35"); 187 | if (!files.Any(f => f.EndsWith(prefix + "\\MelonLoader.dll"))) 188 | { 189 | ThrowError("Game does not have MelonLoader installed.\nInstall and run MelonLoader once before using this wizard."); 190 | info.HasMelonInstalled = false; 191 | return info; 192 | } 193 | 194 | if (File.Exists(Path.Combine(info.DataPath, "il2cpp_data", "Metadata", "global-metadata.dat"))) 195 | info.IsIl2Cpp = true; 196 | 197 | FileVersionInfo fvi = null; 198 | 199 | try 200 | { 201 | string melonPath = files.First(f => f.EndsWith(prefix + "\\MelonLoader.dll")); 202 | fvi = FileVersionInfo.GetVersionInfo(melonPath); 203 | } 204 | catch 205 | { 206 | ThrowError("Failed to read MelonLoader DLL. It may be corrupt."); 207 | info.IsMelonValid = false; 208 | return info; 209 | } 210 | 211 | info.MelonVersion = Version.Parse(fvi.FileVersion); 212 | if (info.MelonVersion < new Version(0, 5, 0)) 213 | { 214 | ThrowError("The installed MelonLoader version is too old. This wizard only supports MelonLoader 0.5+."); 215 | info.IsMelonValid = false; 216 | return info; 217 | } 218 | 219 | UnityDataParser.Run(info); 220 | return info; 221 | } 222 | 223 | private bool IsBlacklistedReference(string fileName) 224 | { 225 | if (fileName == "mscorlib.dll" || fileName == "netstandard.dll" || fileName == "Mono.Security.dll") 226 | return true; 227 | 228 | if (fileName.StartsWith("System")) 229 | return true; 230 | 231 | return false; 232 | } 233 | 234 | private void ThrowError(string status) 235 | { 236 | var result = MessageBox.Show(status, "Error", MessageBoxButton.OKCancel); 237 | if (result == MessageBoxResult.Cancel) 238 | throw new WizardCancelledException(); 239 | 240 | _replacements.Clear(); 241 | BeginWizard(); 242 | } 243 | 244 | // These methods are only called for item templates, not for project templates. 245 | public bool ShouldAddProjectItem(string filePath) => true; 246 | public void ProjectItemFinishedGenerating(ProjectItem projectItem) { } 247 | } 248 | } 249 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------