From 631551259b04b690241f2a9c9cf765c177062c5f Mon Sep 17 00:00:00 2001 From: HypherionMC Date: Wed, 2 Aug 2023 14:01:07 +0200 Subject: [PATCH] Initial Commit --- .gitignore | 135 ++++ App.config | 22 + LICENSE | 674 ++++++++++++++++++ MainLauncherForm.Designer.cs | 277 +++++++ MainLauncherForm.cs | 229 ++++++ MainLauncherForm.resx | 432 +++++++++++ Program.cs | 22 + Properties/AssemblyInfo.cs | 36 + Properties/Resources.Designer.cs | 71 ++ Properties/Resources.resx | 117 +++ Properties/Settings.Designer.cs | 30 + Properties/Settings.settings | 7 + WolfLauncher.csproj | 251 +++++++ WolfLauncher.sln | 25 + core/Launcher.cs | 336 +++++++++ core/LauncherConstants.cs | 16 + core/LauncherLogger.cs | 141 ++++ .../CreateVanillaInstance.Designer.cs | 292 ++++++++ gui/launcher/CreateVanillaInstance.cs | 262 +++++++ gui/launcher/CreateVanillaInstance.resx | 120 ++++ gui/launcher/InstallerForm.Designer.cs | 85 +++ gui/launcher/InstallerForm.cs | 137 ++++ gui/launcher/InstallerForm.resx | 126 ++++ gui/launcher/InstanceSettings.Designer.cs | 191 +++++ gui/launcher/InstanceSettings.cs | 77 ++ gui/launcher/InstanceSettings.resx | 120 ++++ gui/launcher/InstanceWindow.Designer.cs | 273 +++++++ gui/launcher/InstanceWindow.cs | 67 ++ gui/launcher/InstanceWindow.resx | 120 ++++ model/Instance.cs | 30 + packages.config | 33 + readme.md | 76 ++ 32 files changed, 4830 insertions(+) create mode 100644 .gitignore create mode 100644 App.config create mode 100644 LICENSE create mode 100644 MainLauncherForm.Designer.cs create mode 100644 MainLauncherForm.cs create mode 100644 MainLauncherForm.resx create mode 100644 Program.cs create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Properties/Resources.Designer.cs create mode 100644 Properties/Resources.resx create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings create mode 100644 WolfLauncher.csproj create mode 100644 WolfLauncher.sln create mode 100644 core/Launcher.cs create mode 100644 core/LauncherConstants.cs create mode 100644 core/LauncherLogger.cs create mode 100644 gui/launcher/CreateVanillaInstance.Designer.cs create mode 100644 gui/launcher/CreateVanillaInstance.cs create mode 100644 gui/launcher/CreateVanillaInstance.resx create mode 100644 gui/launcher/InstallerForm.Designer.cs create mode 100644 gui/launcher/InstallerForm.cs create mode 100644 gui/launcher/InstallerForm.resx create mode 100644 gui/launcher/InstanceSettings.Designer.cs create mode 100644 gui/launcher/InstanceSettings.cs create mode 100644 gui/launcher/InstanceSettings.resx create mode 100644 gui/launcher/InstanceWindow.Designer.cs create mode 100644 gui/launcher/InstanceWindow.cs create mode 100644 gui/launcher/InstanceWindow.resx create mode 100644 model/Instance.cs create mode 100644 packages.config create mode 100644 readme.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc7a4ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,135 @@ +.vs + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.svclog +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml +*.azurePubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +packages/ +## TODO: If the tool you use requires repositories.config, also uncomment the next line +!packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +![Ss]tyle[Cc]op.targets +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml + +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +_NCrunch* \ No newline at end of file diff --git a/App.config b/App.config new file mode 100644 index 0000000..5d82cbe --- /dev/null +++ b/App.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..20d40b6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/MainLauncherForm.Designer.cs b/MainLauncherForm.Designer.cs new file mode 100644 index 0000000..f95c03e --- /dev/null +++ b/MainLauncherForm.Designer.cs @@ -0,0 +1,277 @@ +namespace WolfLauncher +{ + partial class MainLauncherForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainLauncherForm)); + this.listView1 = new System.Windows.Forms.ListView(); + this.instanceMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.cloneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.playToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.killToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.instanceIconList = new System.Windows.Forms.ImageList(this.components); + this.mainMenu = new System.Windows.Forms.ToolStrip(); + this.addInstanceButton = new System.Windows.Forms.ToolStripButton(); + this.foldersButton = new System.Windows.Forms.ToolStripDropDownButton(); + this.viewLauncherFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.viewInstanceFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.settingsButton = new System.Windows.Forms.ToolStripButton(); + this.helpButton = new System.Windows.Forms.ToolStripDropDownButton(); + this.userDropdown = new System.Windows.Forms.ToolStripDropDownButton(); + this.manageAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.logoutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.instanceMenu.SuspendLayout(); + this.mainMenu.SuspendLayout(); + this.SuspendLayout(); + // + // listView1 + // + this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listView1.ContextMenuStrip = this.instanceMenu; + this.listView1.HideSelection = false; + this.listView1.LargeImageList = this.instanceIconList; + this.listView1.Location = new System.Drawing.Point(12, 38); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(776, 400); + this.listView1.TabIndex = 2; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDoubleClick); + // + // instanceMenu + // + this.instanceMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.settingsToolStripMenuItem, + this.cloneToolStripMenuItem, + this.toolStripSeparator1, + this.playToolStripMenuItem, + this.killToolStripMenuItem, + this.toolStripSeparator2, + this.deleteToolStripMenuItem}); + this.instanceMenu.Name = "instanceMenu"; + this.instanceMenu.Size = new System.Drawing.Size(117, 126); + this.instanceMenu.Opening += new System.ComponentModel.CancelEventHandler(this.instanceMenu_Opening); + // + // settingsToolStripMenuItem + // + this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; + this.settingsToolStripMenuItem.Size = new System.Drawing.Size(116, 22); + this.settingsToolStripMenuItem.Text = "Settings"; + this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click); + // + // cloneToolStripMenuItem + // + this.cloneToolStripMenuItem.Name = "cloneToolStripMenuItem"; + this.cloneToolStripMenuItem.Size = new System.Drawing.Size(116, 22); + this.cloneToolStripMenuItem.Text = "Clone"; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(113, 6); + // + // playToolStripMenuItem + // + this.playToolStripMenuItem.Name = "playToolStripMenuItem"; + this.playToolStripMenuItem.Size = new System.Drawing.Size(116, 22); + this.playToolStripMenuItem.Text = "Play"; + this.playToolStripMenuItem.Click += new System.EventHandler(this.playToolStripMenuItem_Click); + // + // killToolStripMenuItem + // + this.killToolStripMenuItem.Name = "killToolStripMenuItem"; + this.killToolStripMenuItem.Size = new System.Drawing.Size(116, 22); + this.killToolStripMenuItem.Text = "Kill"; + this.killToolStripMenuItem.Click += new System.EventHandler(this.killToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(113, 6); + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(116, 22); + this.deleteToolStripMenuItem.Text = "Delete"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); + // + // instanceIconList + // + this.instanceIconList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("instanceIconList.ImageStream"))); + this.instanceIconList.TransparentColor = System.Drawing.Color.Transparent; + this.instanceIconList.Images.SetKeyName(0, "mclogo.png"); + // + // mainMenu + // + this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addInstanceButton, + this.foldersButton, + this.settingsButton, + this.helpButton, + this.userDropdown}); + this.mainMenu.Location = new System.Drawing.Point(0, 0); + this.mainMenu.Name = "mainMenu"; + this.mainMenu.Size = new System.Drawing.Size(800, 25); + this.mainMenu.TabIndex = 5; + this.mainMenu.Text = "toolStrip1"; + // + // addInstanceButton + // + this.addInstanceButton.Image = ((System.Drawing.Image)(resources.GetObject("addInstanceButton.Image"))); + this.addInstanceButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.addInstanceButton.Name = "addInstanceButton"; + this.addInstanceButton.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; + this.addInstanceButton.Size = new System.Drawing.Size(96, 22); + this.addInstanceButton.Text = "Add Instance"; + this.addInstanceButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.addInstanceButton.Click += new System.EventHandler(this.addInstanceButton_Click); + // + // foldersButton + // + this.foldersButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.viewLauncherFolderToolStripMenuItem, + this.viewInstanceFolderToolStripMenuItem}); + this.foldersButton.Image = ((System.Drawing.Image)(resources.GetObject("foldersButton.Image"))); + this.foldersButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.foldersButton.Name = "foldersButton"; + this.foldersButton.Size = new System.Drawing.Size(74, 22); + this.foldersButton.Text = "Folders"; + // + // viewLauncherFolderToolStripMenuItem + // + this.viewLauncherFolderToolStripMenuItem.Name = "viewLauncherFolderToolStripMenuItem"; + this.viewLauncherFolderToolStripMenuItem.Size = new System.Drawing.Size(187, 22); + this.viewLauncherFolderToolStripMenuItem.Text = "View Launcher Folder"; + // + // viewInstanceFolderToolStripMenuItem + // + this.viewInstanceFolderToolStripMenuItem.Name = "viewInstanceFolderToolStripMenuItem"; + this.viewInstanceFolderToolStripMenuItem.Size = new System.Drawing.Size(187, 22); + this.viewInstanceFolderToolStripMenuItem.Text = "View Instance Folder"; + // + // settingsButton + // + this.settingsButton.Image = ((System.Drawing.Image)(resources.GetObject("settingsButton.Image"))); + this.settingsButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.settingsButton.Name = "settingsButton"; + this.settingsButton.Size = new System.Drawing.Size(69, 22); + this.settingsButton.Text = "Settings"; + // + // helpButton + // + this.helpButton.Image = ((System.Drawing.Image)(resources.GetObject("helpButton.Image"))); + this.helpButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.helpButton.Name = "helpButton"; + this.helpButton.Size = new System.Drawing.Size(61, 22); + this.helpButton.Text = "Help"; + // + // userDropdown + // + this.userDropdown.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.userDropdown.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.manageAccountsToolStripMenuItem, + this.toolStripSeparator3, + this.logoutToolStripMenuItem}); + this.userDropdown.Image = ((System.Drawing.Image)(resources.GetObject("userDropdown.Image"))); + this.userDropdown.ImageTransparentColor = System.Drawing.Color.Magenta; + this.userDropdown.Name = "userDropdown"; + this.userDropdown.Size = new System.Drawing.Size(100, 22); + this.userDropdown.Text = "No Account"; + this.userDropdown.DropDownOpening += new System.EventHandler(this.userDropdown_DropDownOpening); + // + // manageAccountsToolStripMenuItem + // + this.manageAccountsToolStripMenuItem.Name = "manageAccountsToolStripMenuItem"; + this.manageAccountsToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.manageAccountsToolStripMenuItem.Text = "Manage Accounts"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(167, 6); + // + // logoutToolStripMenuItem + // + this.logoutToolStripMenuItem.Name = "logoutToolStripMenuItem"; + this.logoutToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.logoutToolStripMenuItem.Text = "Logout"; + this.logoutToolStripMenuItem.Click += new System.EventHandler(this.logoutToolStripMenuItem_Click); + // + // MainLauncherForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.mainMenu); + this.Controls.Add(this.listView1); + this.Name = "MainLauncherForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Wolf Launcher"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainLauncherForm_FormClosing); + this.Load += new System.EventHandler(this.Form1_LoadAsync); + this.instanceMenu.ResumeLayout(false); + this.mainMenu.ResumeLayout(false); + this.mainMenu.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.ContextMenuStrip instanceMenu; + private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem cloneToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem playToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem killToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; + private System.Windows.Forms.ToolStrip mainMenu; + private System.Windows.Forms.ToolStripButton addInstanceButton; + private System.Windows.Forms.ToolStripDropDownButton foldersButton; + private System.Windows.Forms.ToolStripMenuItem viewLauncherFolderToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem viewInstanceFolderToolStripMenuItem; + private System.Windows.Forms.ToolStripButton settingsButton; + private System.Windows.Forms.ToolStripDropDownButton helpButton; + private System.Windows.Forms.ToolStripDropDownButton userDropdown; + private System.Windows.Forms.ToolStripMenuItem manageAccountsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem logoutToolStripMenuItem; + private System.Windows.Forms.ImageList instanceIconList; + } +} + diff --git a/MainLauncherForm.cs b/MainLauncherForm.cs new file mode 100644 index 0000000..c41bcfb --- /dev/null +++ b/MainLauncherForm.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Windows.Forms; +using CmlLib.Core.Auth.Microsoft; +using WolfLauncher.core; +using WolfLauncher.gui.launcher; +using WolfLauncher.model; +using MojangAPI.Model; + +/** + * Author: HypherionSA + * Main Launcher Interface Window + **/ +namespace WolfLauncher +{ + public partial class MainLauncherForm : Form + { + // Static References + private Launcher launcher = Launcher.INSTANCE; + public static MainLauncherForm INSTANCE; + + public MainLauncherForm() + { + InitializeComponent(); + INSTANCE = this; + + this.Text = String.Format("{0} [{1}] - {2}", LauncherConstants.LauncherName, LauncherConstants.LauncherBuild, LauncherConstants.Version); + } + + private void Form1_LoadAsync(object sender, EventArgs e) + { + // Alpha Warning. Will be removed in beta + MessageBox.Show("This is a very early, usable alpha version. Shit will definitely break or be broken. Don't trust your life with this", "Alpha Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); + + // Load player profile and instances + loadProfile(); + loadInstances(); + } + + private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) + { + // Instance was double clicked, so we open the console window + if (listView1.SelectedItems.Count > 0) + { + InstanceWindow instanceWindow = new InstanceWindow((Instance)listView1.SelectedItems[0].Tag); + instanceWindow.ShowDialog(this); + } + } + + /** + * Load instaces from drive + **/ + public void loadInstances() + { + // Load from disk + List instances = launcher.loadInstances(); + listView1.Items.Clear(); + + foreach (var i in instances) + { + // Set up listview item + ListViewItem itm = new ListViewItem(i.name); + itm.Tag = i; + // TODO Custom Icons + itm.ImageKey = "mclogo.png"; + listView1.Items.Add(itm); + } + } + + private void instanceMenu_Opening(object sender, CancelEventArgs e) + { + // If no instance was selected, we don't allow the menu to open + if (listView1.SelectedItems.Count == 0) + { + e.Cancel = true; + return; + } + + // Check if play and kill menu items can be enabled for the instance + killToolStripMenuItem.Enabled = !(launcher.getRunning() == null || launcher.getRunning() != (Instance)listView1.SelectedItems[0].Tag); + playToolStripMenuItem.Enabled = launcher.getRunning() == null; + } + + /** + * Delete Instance + **/ + private void deleteToolStripMenuItem_Click(object sender, EventArgs e) + { + // No instance was selected, so we return + if (listView1.SelectedItems.Count == 0) + return; + + // Show warning to user + var res = MessageBox.Show("Are you sure? This action cannot be reversed", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + + // User accepted, so we nuke it + if (res == DialogResult.Yes) + Launcher.INSTANCE.deleteInstance((Instance)listView1.SelectedItems[0].Tag); + } + + /** + * Open Launcher Settings + **/ + private void settingsToolStripMenuItem_Click(object sender, EventArgs e) + { + // No instance was selected, so we return + if (listView1.SelectedItems.Count == 0) + return; + + // Display settings dialog. + // TODO: Move this into console window + InstanceSettings settings = new InstanceSettings((Instance)listView1.SelectedItems[0].Tag); + settings.ShowDialog(this); + } + + private void MainLauncherForm_FormClosing(object sender, FormClosingEventArgs e) + { + // Kill running instance if any + Launcher.INSTANCE.killInstance(); + } + + /** + * Kill running instance + **/ + private void killToolStripMenuItem_Click(object sender, EventArgs e) + { + // No instance was selected, so we return + if (listView1.SelectedItems.Count == 0) + return; + + // Micheal Meyers it! It must die + launcher.killInstance(); + } + + /** + * Launch Instance + **/ + public void launchInstance(Instance ins = null) + { + // Launched from Console Window + if (ins != null) + { + launcher.launch(this, ins); + return; + } + + // Launched from context menu + if (listView1.SelectedItems.Count > 0) + { + launcher.launch(this, (model.Instance)listView1.SelectedItems[0].Tag); + } + } + + /** + * Start Instance + **/ + private void playToolStripMenuItem_Click(object sender, EventArgs e) + { + launchInstance(); + } + + /** + * Add new instance + **/ + private void addInstanceButton_Click(object sender, EventArgs e) + { + // Show instance create dialog + CreateVanillaInstance vanillaInstance = new CreateVanillaInstance(); + vanillaInstance.ShowDialog(this); + } + + /** + * Logout from signed in account + **/ + private void logoutToolStripMenuItem_Click(object sender, EventArgs e) + { + // Signout and refresh profile dropdown + launcher.accountHandler().Signout(); + loadProfile(); + } + + /** + * Load user profile information from the Mojang API + **/ + private async void loadProfile() + { + // Check if any accounts are stored + if (launcher.accountHandler().AccountManager.GetAccounts().Count > 0) + { + // Get first stored account + var acc = launcher.accountHandler().AccountManager.GetAccounts().First(); + // Check authentication + var s = launcher.accountHandler().Authenticate(acc); + // Retrieve MC profile + PlayerProfile profile = await launcher.getMojangApi().GetProfileUsingAccessToken(s.Result.AccessToken); + + // Set Dropdown text to profile name + userDropdown.Text = profile.Name; + + // Set Profile Image + userDropdown.Image = launcher.loadProfileImage(profile); + } + else + { + // No accounts are stored + userDropdown.Text = "No Account"; + } + } + + private void userDropdown_DropDownOpening(object sender, EventArgs e) + { + // No account is loaded or stored, so start login process + if (userDropdown.Text == "No Account") + { + // Cancel dropdown + userDropdown.AllowDrop = false; + + // Authenticate + var loginHandler = JELoginHandlerBuilder.BuildDefault(); + loginHandler.Authenticate().Wait(); + + // Refresh Dropdown + loadProfile(); + } + } + } +} \ No newline at end of file diff --git a/MainLauncherForm.resx b/MainLauncherForm.resx new file mode 100644 index 0000000..384b1b7 --- /dev/null +++ b/MainLauncherForm.resx @@ -0,0 +1,432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 255, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6 + MwAAAk1TRnQBSQFMAwEBAAEQAQABEAEAATABAAEwAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABwAMA + ATADAAEBAQABIAYAAZBuAAQBAwUBBv8A/wD2AAMmATgBUgFZAWYBwwFHAU4BVwHhAjoBOwFhAwIBA/8A + /wDmAAMaASQBTgFSAVcBqwE/AVcBeQH+AT0BVQF4Af8BNAFAAVEB/wEyAT0BSwH/AUYBTQFSAdUBMgIz + AVAEAf8A/wDWAAMQARUBSQFMAU4BkgExAUEBWg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s4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..fd1a819 --- /dev/null +++ b/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WolfLauncher +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainLauncherForm()); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1a2ffb9 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Wolf Launcher")] +[assembly: AssemblyDescription("Custom Launcher for Minecraft")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("First Dark Development")] +[assembly: AssemblyProduct("WolfLauncher")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("37f5f132-a705-4b43-9715-074a6685d5d6")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..d32fccb --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WolfLauncher.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WolfLauncher.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..365cf10 --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WolfLauncher.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WolfLauncher.csproj b/WolfLauncher.csproj new file mode 100644 index 0000000..49d689d --- /dev/null +++ b/WolfLauncher.csproj @@ -0,0 +1,251 @@ + + + + + Debug + AnyCPU + {37F5F132-A705-4B43-9715-074A6685D5D6} + WinExe + WolfLauncher + WolfLauncher + v4.7.2 + 512 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\CmlLib.Core.3.3.7\lib\netstandard2.0\CmlLib.dll + + + packages\CmlLib.Core.Auth.Microsoft.3.0.0\lib\netstandard2.0\CmlLib.Core.Auth.Microsoft.dll + + + packages\CmlLib.Core.Installer.Forge.0.0.2\lib\netstandard2.0\CmlLib.Core.Installer.Forge.dll + + + packages\HtmlAgilityPack.1.11.48\lib\Net45\HtmlAgilityPack.dll + + + packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll + + + packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + + packages\Microsoft.Extensions.Logging.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll + + + + packages\Microsoft.Web.WebView2.1.0.1823.32\lib\net45\Microsoft.Web.WebView2.Core.dll + + + packages\Microsoft.Web.WebView2.1.0.1823.32\lib\net45\Microsoft.Web.WebView2.WinForms.dll + + + packages\Microsoft.Web.WebView2.1.0.1823.32\lib\net45\Microsoft.Web.WebView2.Wpf.dll + + + packages\MojangAPI.1.2.1\lib\netstandard2.0\MojangAPI.dll + + + packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + + + packages\Semver.2.3.0\lib\net452\Semver.dll + + + packages\LZMA-SDK.19.0.0\lib\net20\SevenZip.dll + + + + packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + + + packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + True + True + + + packages\System.Net.Http.Json.6.0.1\lib\net461\System.Net.Http.Json.dll + + + + packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + True + True + + + packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll + + + packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll + + + packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + + + + + + + + + + + + packages\XboxAuthNet.3.0.2\lib\net472\XboxAuthNet.dll + + + packages\XboxAuthNet.Game.1.2.1\lib\netstandard2.0\XboxAuthNet.Game.dll + + + + + + + + Form + + + InstanceSettings.cs + + + Form + + + InstanceWindow.cs + + + Form + + + MainLauncherForm.cs + + + Form + + + CreateVanillaInstance.cs + + + Form + + + InstallerForm.cs + + + + + + InstanceSettings.cs + + + InstanceWindow.cs + + + MainLauncherForm.cs + + + CreateVanillaInstance.cs + + + InstallerForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/WolfLauncher.sln b/WolfLauncher.sln new file mode 100644 index 0000000..c621a16 --- /dev/null +++ b/WolfLauncher.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WolfLauncher", "WolfLauncher.csproj", "{37F5F132-A705-4B43-9715-074A6685D5D6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {37F5F132-A705-4B43-9715-074A6685D5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37F5F132-A705-4B43-9715-074A6685D5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37F5F132-A705-4B43-9715-074A6685D5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37F5F132-A705-4B43-9715-074A6685D5D6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {687E8F95-D924-4211-BE0E-2BC37E8865F4} + EndGlobalSection +EndGlobal diff --git a/core/Launcher.cs b/core/Launcher.cs new file mode 100644 index 0000000..c6fb4b9 --- /dev/null +++ b/core/Launcher.cs @@ -0,0 +1,336 @@ +using CmlLib.Core; +using CmlLib.Core.Auth.Microsoft; +using MojangAPI; +using MojangAPI.Model; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Net; +using System.Net.Http; +using System.Windows.Forms; +using WolfLauncher.gui.launcher; +using WolfLauncher.model; + +/** + * Author: HypherionSA + * Core Launcher Logic + **/ +namespace WolfLauncher.core +{ + public class Launcher + { + // Static instance that can be accessed from anywhere + public static Launcher INSTANCE = new Launcher(); + + // Authentication and Launcher Library initialization + private JELoginHandler loginHandler = JELoginHandlerBuilder.BuildDefault(); + private CMLauncher cmLauncher; + private Mojang mojang = new Mojang(new HttpClient()); + + // Launcher Directories + private DirectoryInfo dataDir = new DirectoryInfo("launcherdata"); + private DirectoryInfo mcDir = new DirectoryInfo("launcherdata/minecraft"); + private MinecraftPath mcPath; + + // Monitoring running instance + private Instance runningInstance; + private Process runningProccess; + Timer tmr; + + private Launcher() { + // Check if directories exist, and create them if they don't + if (!dataDir.Exists) + dataDir.Create(); + + if (!mcDir.Exists) + mcDir.Create(); + + // Setup library and minecraft paths + mcPath = new MinecraftPath(mcDir.ToString()); + cmLauncher = new CMLauncher(mcPath); + + // Used to enable kill button on running instance + tmr = new Timer(); + tmr.Interval = 1000; + tmr.Tick += (s, e) => + { + if (runningInstance != null && runningProccess != null) + { + if (runningProccess.HasExited) + { + runningInstance = null; + tmr.Enabled = false; + } + } else + { + runningInstance = null; + tmr.Enabled = false; + } + }; + } + + /** + * Save instance configuration to drive, ready for install + **/ + public bool install(Instance instance) + { + DirectoryInfo instancePath = new DirectoryInfo("instances/" + instance.name); + + // Instances are saved by name, so we check if the directory already exists + if (!instancePath.Exists) + { + // New instance, so we create the folder and write the instance config + instancePath.Create(); + File.WriteAllText(@instancePath.FullName + "\\instance.json", JsonConvert.SerializeObject(instance)); + MainLauncherForm.INSTANCE.loadInstances(); + return true; + } else + { + // Duplicate launcher + MessageBox.Show("Instance Already Exists!", "Instance Creation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + return false; + } + + /** + * Launch an instance. This will also verify that the instance is still valid + **/ + public async void launch(Form parent, Instance instance) + { + runningInstance = instance; + LauncherLogger.INSTANCE.startLogging(instance); + LauncherLogger.INSTANCE.addLog("Launching " + instance.name + " with version " + instance.gameVersion); + + // Create installer/verification form + InstallerForm installer = new InstallerForm(instance); + var res = installer.ShowDialog(parent); + + // Installer process completed, so we continue to launching + if (res == DialogResult.OK) + { + // Load the instance (or data) directory of the instance + DirectoryInfo instanceDir = new DirectoryInfo("instances/" + instance.name); + + // Modify the Minecraft path so we can store data in the instance folder, but share assets and game files across multiple instances + MinecraftPath p = new MinecraftPath(); + p.BasePath = instanceDir.FullName; + p.Assets = mcPath.Assets; + p.Versions = mcPath.Versions; + p.Library = mcPath.Library; + p.Resource = mcPath.Resource; + p.Runtime = mcPath.Runtime; + + if (instance.settings == null) + { + instance.settings = new Instance.Settings + { + maxRam = 2024, + minRam = 512, + screenHeight = "auto", + screenWidth = "auto", + javaPath = "", + javaArgs = "" + }; + } + + // Setup Launcher Values + var options = new MLaunchOption + { + Path = p, + MaximumRamMb = instance.settings.maxRam, + MinimumRamMb = instance.settings.minRam, + Session = loginHandler.AuthenticateSilently().Result, + GameLauncherName = LauncherConstants.LauncherName, + GameLauncherVersion = LauncherConstants.Version + }; + + if (instance.settings.screenWidth != "auto") + options.ScreenWidth = int.Parse(instance.settings.screenWidth); + + if (instance.settings.screenHeight != "auto") + options.ScreenHeight = int.Parse(instance.settings.screenWidth); + + if (!String.IsNullOrEmpty(instance.settings.javaPath)) + options.JavaPath = instance.settings.javaPath; + + if (!String.IsNullOrEmpty(instance.settings.javaArgs)) + options.JVMArguments = new string[] { instance.settings.javaArgs }; + + // Set up the launcher process + var process = await cmLauncher.CreateProcessAsync(parseLoader(instance), options, checkAndDownload: true); + + // Setup console relay to log window + process.OutputDataReceived += (s, e) => + { + LauncherLogger.INSTANCE.addLog(e.Data); + }; + + process.ErrorDataReceived += (s, e) => + { + LauncherLogger.INSTANCE.addLog(e.Data); + }; + + // Enable console redirects + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardError = true; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.StandardErrorEncoding = System.Text.Encoding.UTF8; + process.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8; + process.EnableRaisingEvents = true; + + // Launch the game + process.Start(); + process.BeginErrorReadLine(); + process.BeginOutputReadLine(); + runningProccess = process; + tmr.Enabled = true; + } + } + + /** + * Load instances from instances folder + **/ + public List loadInstances() + { + List instances = new List(); + DirectoryInfo instancesDir = new DirectoryInfo("instances"); + + // Check if launcher contains any instances + if (instancesDir.Exists) + { + foreach(var di in instancesDir.GetDirectories()) + { + try + { + // Load instance configuration file + FileInfo ins = new FileInfo(@di.FullName + "\\instance.json"); + + if (ins.Exists) + { + // Read instance configuration + Instance instance = JsonConvert.DeserializeObject(File.ReadAllText(@ins.FullName)); + + // Validate that file loaded correctly and add to instance list + if (instance != null) + { + instances.Add(instance); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + + } + } + + return instances; + } + + /** + * Converts Minecraft and Loader string into correct game version + **/ + private string parseLoader(Instance i) + { + var returnVer = i.gameVersion; + + // Check if instance uses a loader, if not, we return the vanilla version + if (i.loader != null && i.loader != "none") + { + + // Loader is forge + if (i.loader.StartsWith("forge:")) + { + var loader = i.loader.Replace("forge:", ""); + returnVer += "-forge-" + loader; + } + + if (i.loader.StartsWith("fabric:")) + { + var loader = i.loader.Replace("fabric:", ""); + returnVer = loader; + } + } + + return returnVer; + } + + /** + * Remove an instance from the drive + **/ + public void deleteInstance(Instance instance) + { + try { + // Delete the instance folder and reload instances in main window + DirectoryInfo instancesDir = new DirectoryInfo("instances\\" + instance.name); + Directory.Delete(instancesDir.FullName, true); + MainLauncherForm.INSTANCE.loadInstances(); + } catch (Exception e) + { + MessageBox.Show("Failed to delete instance: " + e.Message, "Failed to remove instance", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /** + * Write instance settings to drive + **/ + public void updateInstanceSettings(Instance instance) + { + FileInfo ins = new FileInfo("instances\\" + instance.name + "\\instance.json"); + File.WriteAllText(ins.FullName, JsonConvert.SerializeObject(instance)); + MainLauncherForm.INSTANCE.loadInstances(); + } + + /** + * Kill a running instance. Called when KILL button is clicked, or launcher is closed + **/ + public void killInstance() + { + if (runningProccess == null || runningProccess.HasExited) + return; + + runningProccess.Kill(); + } + + /** + * Load Player head from skin to display in accounts sections + **/ + public Image loadProfileImage(PlayerProfile p) + { + // Download the player head and convert it to an image object + WebClient client = new WebClient(); + byte[] imageData = client.DownloadData("https://mc-heads.net/avatar/" + p.UUID); + return Image.FromStream(new MemoryStream(imageData)); + } + + public MinecraftPath getMinecraftPath() + { + return mcPath; + } + + public CMLauncher getCMLauncher() + { + return cmLauncher; + } + + public Instance getRunning() + { + return this.runningInstance; + } + + public JELoginHandler accountHandler() + { + return this.loginHandler; + } + + public Mojang getMojangApi() + { + return this.mojang; + } + } +} diff --git a/core/LauncherConstants.cs b/core/LauncherConstants.cs new file mode 100644 index 0000000..3d335ba --- /dev/null +++ b/core/LauncherConstants.cs @@ -0,0 +1,16 @@ +using System.Reflection; + +/** + * Author: HypherionSA + * Constant values used throughout the launcher + **/ +namespace WolfLauncher.core +{ + public class LauncherConstants + { + // Branding + public static readonly string LauncherName = "Wolf Launcher"; + public static readonly string LauncherBuild = "Alpha"; + public static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } +} diff --git a/core/LauncherLogger.cs b/core/LauncherLogger.cs new file mode 100644 index 0000000..b5672e8 --- /dev/null +++ b/core/LauncherLogger.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Text; +using System.Windows.Forms; +using WolfLauncher.model; + +/** + * Author: HypherionSA + * Log Window controller for the Launcher + **/ +namespace WolfLauncher.core +{ + public class LauncherLogger + { + // Static instance accessible anywhere + public static readonly LauncherLogger INSTANCE = new LauncherLogger(); + + // Running Instance Log Directory and File + private readonly DirectoryInfo logDir = new DirectoryInfo("launcherdata/logs"); + private readonly FileInfo logFile = new FileInfo("launcherdata/logs/running.log"); + + // Log Queue, waiting to be written to log and log window + private ConcurrentQueue logQueue = new ConcurrentQueue(); + // Timer to control logging, so it doesn't spam + private Timer tmr; + + // Variables for the active Console window if any + public RichTextBox logWindow { get; set; } + public Instance loggingInstance { get; set; } + public bool canUpdateLog { get; set; } + + // Should not be created elsewhere + private LauncherLogger() + { + // Create log directory if it doesn't exist + if (!logDir.Exists) + logDir.Create(); + + // Setup the log timer + tmr = new Timer(); + tmr.Interval = 1000; + tmr.Enabled = false; + tmr.Tick += Tmr_Elapsed; + } + + /** + * Check if any pending log entries are present, and process them + **/ + private void Tmr_Elapsed(object sender, EventArgs e) + { + // Log is empty, so we don't continue + if (logQueue.Count == 0) + return; + + // Dump the queue into a string + var sb = new StringBuilder(); + while (logQueue.TryDequeue(out string msg)) + { + sb.AppendLine(msg); + } + + // Write to log file for persistance + File.AppendAllText(logFile.FullName, sb.ToString()); + + // Console window is open, so we update the log window + if (logWindow != null && !logWindow.IsDisposed && canUpdateLog) + logWindow.AppendText(sb.ToString()); + } + + /** + * Called when an instance is started, to start the logging process + **/ + public void startLogging(Instance ins) + { + // Disable timer and remove previous log if it exists + tmr.Enabled = false; + if (logFile.Exists) + logFile.Delete(); + + // Clear the queue and enable the timer + logQueue = new ConcurrentQueue(); + tmr.Enabled = true; + + loggingInstance = ins; + } + + /** + * Add an entry to the log + **/ + public void addLog(string log) + { + // Check if string is empty and ignore if it is + if (string.IsNullOrEmpty(log)) + return; + + // Add to log queue + logQueue.Enqueue(log); + } + + /** + * Clear the current log and log file + **/ + public void clearLog() + { + // Disable timer and delete log file + tmr.Enabled = false; + if (logFile.Exists) + logFile.Delete(); + + // Clear queue and re-enable timer + logQueue = new ConcurrentQueue(); + tmr.Enabled = true; + } + + /** + * Load persisted log from disk to be used in log window + **/ + public void loadLog(Instance ins = null) + { + // Instance Console window is closed, so we ignore + if (logWindow == null || logWindow.IsDisposed) + return; + + // Check if the console window matches the running instance + if (loggingInstance != null && ins != null && ins == loggingInstance) + { + // Clear old log from window if any + logWindow.Clear(); + + // Check if persisted log exists + if (!logFile.Exists) + return; + + // Load log from file into window + string log = File.ReadAllText(logFile.FullName, Encoding.UTF8); + logWindow.Text = log; + } + } + } +} diff --git a/gui/launcher/CreateVanillaInstance.Designer.cs b/gui/launcher/CreateVanillaInstance.Designer.cs new file mode 100644 index 0000000..163a5ce --- /dev/null +++ b/gui/launcher/CreateVanillaInstance.Designer.cs @@ -0,0 +1,292 @@ +namespace WolfLauncher.gui.launcher +{ + partial class CreateVanillaInstance + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.versionsList = new System.Windows.Forms.ListView(); + this.mcVer = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.releaseDate = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.releaseType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.filterLabel = new System.Windows.Forms.Label(); + this.releasesCheck = new System.Windows.Forms.CheckBox(); + this.snapshotsCheck = new System.Windows.Forms.CheckBox(); + this.betasCheck = new System.Windows.Forms.CheckBox(); + this.alphasCheck = new System.Windows.Forms.CheckBox(); + this.loaderLabel = new System.Windows.Forms.Label(); + this.noLoader = new System.Windows.Forms.RadioButton(); + this.forgeLoader = new System.Windows.Forms.RadioButton(); + this.fabricLoader = new System.Windows.Forms.RadioButton(); + this.liteLoader = new System.Windows.Forms.RadioButton(); + this.nameLabel = new System.Windows.Forms.Label(); + this.instanceName = new System.Windows.Forms.TextBox(); + this.createInstance = new System.Windows.Forms.Button(); + this.loaderVersionLabel = new System.Windows.Forms.Label(); + this.loaderDropdown = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // versionsList + // + this.versionsList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.mcVer, + this.releaseDate, + this.releaseType}); + this.versionsList.FullRowSelect = true; + this.versionsList.HideSelection = false; + this.versionsList.Location = new System.Drawing.Point(12, 43); + this.versionsList.Name = "versionsList"; + this.versionsList.Size = new System.Drawing.Size(358, 240); + this.versionsList.TabIndex = 0; + this.versionsList.UseCompatibleStateImageBehavior = false; + this.versionsList.View = System.Windows.Forms.View.Details; + this.versionsList.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); + // + // mcVer + // + this.mcVer.Text = "Version"; + this.mcVer.Width = 142; + // + // releaseDate + // + this.releaseDate.Text = "Released"; + this.releaseDate.Width = 93; + // + // releaseType + // + this.releaseType.Text = "Type"; + this.releaseType.Width = 103; + // + // filterLabel + // + this.filterLabel.AutoSize = true; + this.filterLabel.Location = new System.Drawing.Point(388, 43); + this.filterLabel.Name = "filterLabel"; + this.filterLabel.Size = new System.Drawing.Size(29, 13); + this.filterLabel.TabIndex = 1; + this.filterLabel.Text = "Filter"; + // + // releasesCheck + // + this.releasesCheck.AutoSize = true; + this.releasesCheck.Checked = true; + this.releasesCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.releasesCheck.Location = new System.Drawing.Point(391, 63); + this.releasesCheck.Name = "releasesCheck"; + this.releasesCheck.Size = new System.Drawing.Size(70, 17); + this.releasesCheck.TabIndex = 2; + this.releasesCheck.Text = "Releases"; + this.releasesCheck.UseVisualStyleBackColor = true; + this.releasesCheck.CheckedChanged += new System.EventHandler(this.releasesCheck_CheckedChanged); + // + // snapshotsCheck + // + this.snapshotsCheck.AutoSize = true; + this.snapshotsCheck.Location = new System.Drawing.Point(391, 86); + this.snapshotsCheck.Name = "snapshotsCheck"; + this.snapshotsCheck.Size = new System.Drawing.Size(76, 17); + this.snapshotsCheck.TabIndex = 3; + this.snapshotsCheck.Text = "Snapshots"; + this.snapshotsCheck.UseVisualStyleBackColor = true; + this.snapshotsCheck.CheckedChanged += new System.EventHandler(this.snapshotsCheck_CheckedChanged); + // + // betasCheck + // + this.betasCheck.AutoSize = true; + this.betasCheck.Location = new System.Drawing.Point(391, 109); + this.betasCheck.Name = "betasCheck"; + this.betasCheck.Size = new System.Drawing.Size(53, 17); + this.betasCheck.TabIndex = 5; + this.betasCheck.Text = "Betas"; + this.betasCheck.UseVisualStyleBackColor = true; + this.betasCheck.CheckedChanged += new System.EventHandler(this.betasCheck_CheckedChanged); + // + // alphasCheck + // + this.alphasCheck.AutoSize = true; + this.alphasCheck.Location = new System.Drawing.Point(391, 132); + this.alphasCheck.Name = "alphasCheck"; + this.alphasCheck.Size = new System.Drawing.Size(58, 17); + this.alphasCheck.TabIndex = 6; + this.alphasCheck.Text = "Alphas"; + this.alphasCheck.UseVisualStyleBackColor = true; + this.alphasCheck.CheckedChanged += new System.EventHandler(this.alphasCheck_CheckedChanged); + // + // loaderLabel + // + this.loaderLabel.AutoSize = true; + this.loaderLabel.Location = new System.Drawing.Point(9, 294); + this.loaderLabel.Name = "loaderLabel"; + this.loaderLabel.Size = new System.Drawing.Size(64, 13); + this.loaderLabel.TabIndex = 8; + this.loaderLabel.Text = "Mod Loader"; + // + // noLoader + // + this.noLoader.AutoSize = true; + this.noLoader.Checked = true; + this.noLoader.Location = new System.Drawing.Point(79, 292); + this.noLoader.Name = "noLoader"; + this.noLoader.Size = new System.Drawing.Size(51, 17); + this.noLoader.TabIndex = 13; + this.noLoader.TabStop = true; + this.noLoader.Text = "None"; + this.noLoader.UseVisualStyleBackColor = true; + // + // forgeLoader + // + this.forgeLoader.AutoSize = true; + this.forgeLoader.Location = new System.Drawing.Point(134, 292); + this.forgeLoader.Name = "forgeLoader"; + this.forgeLoader.Size = new System.Drawing.Size(52, 17); + this.forgeLoader.TabIndex = 14; + this.forgeLoader.Text = "Forge"; + this.forgeLoader.UseVisualStyleBackColor = true; + this.forgeLoader.CheckedChanged += new System.EventHandler(this.forgeLoader_CheckedChanged); + // + // fabricLoader + // + this.fabricLoader.AutoSize = true; + this.fabricLoader.Enabled = false; + this.fabricLoader.Location = new System.Drawing.Point(192, 292); + this.fabricLoader.Name = "fabricLoader"; + this.fabricLoader.Size = new System.Drawing.Size(54, 17); + this.fabricLoader.TabIndex = 15; + this.fabricLoader.Text = "Fabric"; + this.fabricLoader.UseVisualStyleBackColor = true; + this.fabricLoader.CheckedChanged += new System.EventHandler(this.fabricLoader_CheckedChanged); + // + // liteLoader + // + this.liteLoader.AutoSize = true; + this.liteLoader.Enabled = false; + this.liteLoader.Location = new System.Drawing.Point(252, 292); + this.liteLoader.Name = "liteLoader"; + this.liteLoader.Size = new System.Drawing.Size(78, 17); + this.liteLoader.TabIndex = 16; + this.liteLoader.Text = "Lite Loader"; + this.liteLoader.UseVisualStyleBackColor = true; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(12, 16); + this.nameLabel.Name = "nameLabel"; + this.nameLabel.Size = new System.Drawing.Size(38, 13); + this.nameLabel.TabIndex = 18; + this.nameLabel.Text = "Name:"; + // + // instanceName + // + this.instanceName.Location = new System.Drawing.Point(56, 13); + this.instanceName.Name = "instanceName"; + this.instanceName.Size = new System.Drawing.Size(314, 20); + this.instanceName.TabIndex = 19; + // + // createInstance + // + this.createInstance.Location = new System.Drawing.Point(391, 317); + this.createInstance.Name = "createInstance"; + this.createInstance.Size = new System.Drawing.Size(75, 23); + this.createInstance.TabIndex = 20; + this.createInstance.Text = "Create"; + this.createInstance.UseVisualStyleBackColor = true; + this.createInstance.Click += new System.EventHandler(this.createInstance_Click); + // + // loaderVersionLabel + // + this.loaderVersionLabel.AutoSize = true; + this.loaderVersionLabel.Location = new System.Drawing.Point(9, 322); + this.loaderVersionLabel.Name = "loaderVersionLabel"; + this.loaderVersionLabel.Size = new System.Drawing.Size(81, 13); + this.loaderVersionLabel.TabIndex = 21; + this.loaderVersionLabel.Text = "Loader Version:"; + // + // loaderDropdown + // + this.loaderDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.loaderDropdown.FormattingEnabled = true; + this.loaderDropdown.Location = new System.Drawing.Point(96, 319); + this.loaderDropdown.Name = "loaderDropdown"; + this.loaderDropdown.Size = new System.Drawing.Size(274, 21); + this.loaderDropdown.TabIndex = 22; + // + // CreateVanillaInstance + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(497, 351); + this.Controls.Add(this.loaderDropdown); + this.Controls.Add(this.loaderVersionLabel); + this.Controls.Add(this.createInstance); + this.Controls.Add(this.instanceName); + this.Controls.Add(this.nameLabel); + this.Controls.Add(this.liteLoader); + this.Controls.Add(this.fabricLoader); + this.Controls.Add(this.forgeLoader); + this.Controls.Add(this.noLoader); + this.Controls.Add(this.loaderLabel); + this.Controls.Add(this.alphasCheck); + this.Controls.Add(this.betasCheck); + this.Controls.Add(this.snapshotsCheck); + this.Controls.Add(this.releasesCheck); + this.Controls.Add(this.filterLabel); + this.Controls.Add(this.versionsList); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "CreateVanillaInstance"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Create Instance"; + this.Load += new System.EventHandler(this.CreateVanillaInstance_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView versionsList; + private System.Windows.Forms.ColumnHeader mcVer; + private System.Windows.Forms.ColumnHeader releaseDate; + private System.Windows.Forms.ColumnHeader releaseType; + private System.Windows.Forms.Label filterLabel; + private System.Windows.Forms.CheckBox releasesCheck; + private System.Windows.Forms.CheckBox snapshotsCheck; + private System.Windows.Forms.CheckBox betasCheck; + private System.Windows.Forms.CheckBox alphasCheck; + private System.Windows.Forms.Label loaderLabel; + private System.Windows.Forms.RadioButton noLoader; + private System.Windows.Forms.RadioButton forgeLoader; + private System.Windows.Forms.RadioButton fabricLoader; + private System.Windows.Forms.RadioButton liteLoader; + private System.Windows.Forms.Label nameLabel; + private System.Windows.Forms.TextBox instanceName; + private System.Windows.Forms.Button createInstance; + private System.Windows.Forms.Label loaderVersionLabel; + private System.Windows.Forms.ComboBox loaderDropdown; + } +} \ No newline at end of file diff --git a/gui/launcher/CreateVanillaInstance.cs b/gui/launcher/CreateVanillaInstance.cs new file mode 100644 index 0000000..3f74659 --- /dev/null +++ b/gui/launcher/CreateVanillaInstance.cs @@ -0,0 +1,262 @@ +using CmlLib.Core; +using CmlLib.Core.Installer.FabricMC; +using CmlLib.Core.Installer.Forge.Versions; +using CmlLib.Core.Version; +using CmlLib.Core.VersionLoader; +using CmlLib.Core.VersionMetadata; +using Semver; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using WolfLauncher.core; +using WolfLauncher.model; + +/** + * Author: HypherionSA + * Instance Creation dialog + **/ +namespace WolfLauncher.gui.launcher +{ + public partial class CreateVanillaInstance : Form + { + // Set launcher instance + private Launcher launcher = Launcher.INSTANCE; + private CMLauncher l; + + // Cache + private List items = new List(); + private ListViewItem lastItem; + + // First MC version that supports fabric + private SemVersion fabricLowest = SemVersion.Parse("1.14.2"); + + public CreateVanillaInstance() + { + InitializeComponent(); + l = launcher.getCMLauncher(); + l.VersionLoader = new MojangVersionLoader(); + + this.Text = String.Format("{0} - {1} - {2}", "Create Instance", LauncherConstants.LauncherName, LauncherConstants.Version); + } + + private async void CreateVanillaInstance_Load(object sender, EventArgs e) + { + // Get game versions + MVersionCollection versions = await l.GetAllVersionsAsync(); + versionsList.Items.Clear(); + + // Load Versions into list + foreach(MVersionMetadata meta in versions) + { + ListViewItem itm = new ListViewItem(meta.Name); + itm.SubItems.Add(meta.ReleaseTimeStr); + itm.SubItems.Add(meta.Type); + versionsList.Items.Add(itm); + items.Add(itm); + } + + // Apply version filtering + sortItems(); + } + + private void sortItems() + { + // Clear List + versionsList.Items.Clear(); + + foreach (ListViewItem itm in items) + { + // Release Version + if (itm.SubItems[2].Text.Equals("release") && releasesCheck.Checked) + versionsList.Items.Add(itm); + + // Snapshot Version + if (itm.SubItems[2].Text.Equals("snapshot") && snapshotsCheck.Checked) + versionsList.Items.Add(itm); + + // Beta Version + if (itm.SubItems[2].Text.Equals("old_beta") && betasCheck.Checked) + versionsList.Items.Add(itm); + + // Alpha version + if (itm.SubItems[2].Text.Equals("old_alpha") && alphasCheck.Checked) + versionsList.Items.Add(itm); + } + + // Select first item in list + if (versionsList.Items.Count > 0) + versionsList.Items[0].Selected = true; + } + + private void releasesCheck_CheckedChanged(object sender, EventArgs e) + { + // Apply Filter + sortItems(); + } + + private void snapshotsCheck_CheckedChanged(object sender, EventArgs e) + { + // Apply Filter + sortItems(); + } + + private void betasCheck_CheckedChanged(object sender, EventArgs e) + { + // Apply Filter + sortItems(); + } + + private void alphasCheck_CheckedChanged(object sender, EventArgs e) + { + // Apply Filter + sortItems(); + } + + /** + * Selected version changed. Update Loaders list if needed + **/ + private void listView1_SelectedIndexChanged(object sender, EventArgs e) + { + if (versionsList.SelectedItems.Count > 0) + { + // Refresh Forge + if (forgeLoader.Checked) + loadForge(); + + // Refresh Fabric + if (fabricLoader.Enabled && fabricLoader.Checked) + loadFabric(); + + // Update instance name, if the user didn't change it + ListViewItem sel = versionsList.SelectedItems[0]; + if (lastItem == null || instanceName.Text == lastItem.Text || String.IsNullOrEmpty(instanceName.Text)) + { + instanceName.Text = sel.Text; + lastItem = sel; + } + + // Load fabric versions if available + try + { + SemVersion currentVer = SemVersion.Parse(sel.Text); + fabricLoader.Enabled = currentVer.ComparePrecedenceTo(fabricLowest) >= 0; + } catch + { + fabricLoader.Enabled = true; + } + } + } + + /** + * Load and Filter forge versions + **/ + private async void loadForge() + { + // Clear dropdown + loaderDropdown.Items.Clear(); + + try + { + // Load Forge Versions for selected minecraft version + var forgeLoader = new ForgeVersionLoader(new System.Net.Http.HttpClient()); + var versions = await forgeLoader.GetForgeVersions(versionsList.SelectedItems[0].Text); + var recommended = versions.First(v => v.IsRecommendedVersion); + + foreach (var version in versions) + { + // Mark item as recommended if it is + String ver = version.ForgeVersionName; + if (recommended != null && version.ForgeVersionName == recommended.ForgeVersionName) + ver += " (Recommended)"; + + // Add item to dropdown + loaderDropdown.Items.Add(ver); + } + + } catch { } + } + + /** + * Load Fabric Versions + **/ + private async void loadFabric() + { + // Clear dropdown + loaderDropdown.Items.Clear(); + + // Load Fabric Versions + var fabricLoader = new FabricVersionLoader(); + var fabricVersions = await fabricLoader.GetVersionMetadatasAsync(); + + foreach (var v in fabricVersions) + { + // Add item to dropdown + loaderDropdown.Items.Add(v.Name); + } + } + + /** + * Forge radio checked, so we refresh forge + **/ + private void forgeLoader_CheckedChanged(object sender, EventArgs e) + { + if (forgeLoader.Checked) + loadForge(); + } + + /** + * Set up instance meta data ready to be written to the disk + **/ + private void createInstance_Click(object sender, EventArgs e) + { + // Create new instance manifest + Instance instance = new Instance(); + + // Set game version for instance + instance.gameVersion = versionsList.SelectedItems[0].Text; + // Set instance name + instance.name = instanceName.Text; + + // Local install. This instance will be ignored from update checkers + instance.localInstall = true; + + // Check if a mod loader should be installed + if (loaderDropdown.Items.Count > 0 && loaderDropdown.SelectedItem != null) + { + // Loader is forge + if (forgeLoader.Checked) + instance.loader = "forge:" + loaderDropdown.SelectedItem.ToString().Replace(" (Recommended)", ""); + + // Loader is fabric + if (fabricLoader.Checked) + instance.loader = "fabric:" + loaderDropdown.SelectedItem.ToString(); + } + + // Set default settings for instance + instance.settings = new Instance.Settings + { + maxRam = 2024, + minRam = 512, + screenHeight = "auto", + screenWidth = "auto", + javaPath = "", + javaArgs = "" + }; + + // Persist to disk + var s = launcher.install(instance); + + // Close the window if the instance was created + if (s) + this.Close(); + } + + private void fabricLoader_CheckedChanged(object sender, EventArgs e) + { + // Fabric selected, load fabric versions + if (fabricLoader.Checked) + loadFabric(); + } + } +} diff --git a/gui/launcher/CreateVanillaInstance.resx b/gui/launcher/CreateVanillaInstance.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/gui/launcher/CreateVanillaInstance.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/gui/launcher/InstallerForm.Designer.cs b/gui/launcher/InstallerForm.Designer.cs new file mode 100644 index 0000000..be7d61a --- /dev/null +++ b/gui/launcher/InstallerForm.Designer.cs @@ -0,0 +1,85 @@ +namespace WolfLauncher.gui.launcher +{ + partial class InstallerForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.downloadLabel = new System.Windows.Forms.Label(); + this.dlProgressbar = new System.Windows.Forms.ProgressBar(); + this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); + this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker(); + this.SuspendLayout(); + // + // downloadLabel + // + this.downloadLabel.AutoEllipsis = true; + this.downloadLabel.Location = new System.Drawing.Point(9, 9); + this.downloadLabel.Name = "downloadLabel"; + this.downloadLabel.Size = new System.Drawing.Size(373, 20); + this.downloadLabel.TabIndex = 1; + this.downloadLabel.Text = "Downloading 0/0 files"; + this.downloadLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // dlProgressbar + // + this.dlProgressbar.Location = new System.Drawing.Point(12, 32); + this.dlProgressbar.Name = "dlProgressbar"; + this.dlProgressbar.Size = new System.Drawing.Size(370, 23); + this.dlProgressbar.TabIndex = 2; + // + // backgroundWorker1 + // + this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); + this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); + // + // InstallerForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(396, 70); + this.Controls.Add(this.dlProgressbar); + this.Controls.Add(this.downloadLabel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InstallerForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Installing Instance"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InstallerForm_FormClosing); + this.Load += new System.EventHandler(this.InstallerForm_Load); + this.Shown += new System.EventHandler(this.InstallerForm_Shown); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Label downloadLabel; + private System.Windows.Forms.ProgressBar dlProgressbar; + private System.ComponentModel.BackgroundWorker backgroundWorker1; + private System.ComponentModel.BackgroundWorker backgroundWorker2; + } +} \ No newline at end of file diff --git a/gui/launcher/InstallerForm.cs b/gui/launcher/InstallerForm.cs new file mode 100644 index 0000000..619e8b7 --- /dev/null +++ b/gui/launcher/InstallerForm.cs @@ -0,0 +1,137 @@ +using CmlLib.Core; +using CmlLib.Core.Downloader; +using CmlLib.Core.Files; +using CmlLib.Core.Installer.FabricMC; +using CmlLib.Core.Installer.Forge; +using System; +using System.ComponentModel; +using System.Threading; +using System.Windows.Forms; +using WolfLauncher.core; +using WolfLauncher.model; + +/** + * Author: HypherionSA + * Instance Installer/Verifier +**/ +namespace WolfLauncher.gui.launcher +{ + public partial class InstallerForm : Form + { + // References to Launcher instance + private Launcher launcer = Launcher.INSTANCE; + private Instance i; + private CMLauncher l; + + public InstallerForm(Instance instance) + { + InitializeComponent(); + + // Setup Variables + i = instance; + l = launcer.getCMLauncher(); + Control.CheckForIllegalCrossThreadCalls = false; + + this.Text = String.Format("{0} - {1} - {2}", "Preparing " + instance.name, LauncherConstants.LauncherName, LauncherConstants.Version); + } + + private void InstallerForm_Load(object sender, EventArgs e) + { + // Register Event Listeners + l.FileChanged += downloadFileChanged; + l.ProgressChanged += downloadProgress; + } + + private void downloadProgress(object sender, ProgressChangedEventArgs e) + { + // Update Progress Bar + dlProgressbar.Value = e.ProgressPercentage; + } + + private void downloadFileChanged(DownloadFileChangedEventArgs e) + { + // Verification, so we ignore + if (e.Source is IFileChecker) + return; + + try + { + // Update progress label + downloadLabel.Text = "Downloading " + e.FileKind.ToString() + " - " + e.ProgressedFileCount + "/" + e.TotalFileCount + " files"; + } + catch { } + } + + private void InstallerForm_Shown(object sender, EventArgs e) + { + // Start Installation/Verifaction Process + if (!backgroundWorker1.IsBusy) + backgroundWorker1.RunWorkerAsync(); + } + + private async void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) + { + // Check if we should install a loader + if (i.loader != null && i.loader != "none") + { + + // Instance requires forge + if (i.loader.Contains("forge:")) + { + // Parse forge version from manifest + var loader = i.loader.Replace("forge:", ""); + LauncherLogger.INSTANCE.addLog("Installing Forge " + loader); + + // Install Forge + var forge = new MForge(l); + forge.ProgressChanged += downloadProgress; + forge.FileChanged += downloadFileChanged; + forge.Install(i.gameVersion, loader).Wait(); + l.GetAllVersions(); + } + + // Instance requires Fabric + if (i.loader.Contains("fabric:")) + { + // Parse fabric version from manifest + var loader = i.loader.Replace("fabric:", ""); + LauncherLogger.INSTANCE.addLog("Installing Fabric " + loader); + + // Install Fabric + var fabricLoader = new FabricVersionLoader(); + var fabricV = await fabricLoader.GetVersionMetadatasAsync(); + var fabric = fabricV.GetVersionMetadata(loader); + fabric.Save(l.MinecraftPath); + + // Vanilla Install + l.CheckAndDownload(l.GetVersion(i.gameVersion)); + l.GetAllVersions(); + } + } else + { + // Vanilla Install + l.CheckAndDownload(l.GetVersion(i.gameVersion)); + l.GetAllVersions(); + } + } + + private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + // Progress is finished, so we remove listeners + l.FileChanged -= downloadFileChanged; + l.ProgressChanged -= downloadProgress; + + // Wait for all threads to shut down and close the dialog + Thread.Sleep(1000); + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void InstallerForm_FormClosing(object sender, FormClosingEventArgs e) + { + // Worker is busy, so form cannot be closed + if (backgroundWorker1.IsBusy) + e.Cancel = true; + } + } +} diff --git a/gui/launcher/InstallerForm.resx b/gui/launcher/InstallerForm.resx new file mode 100644 index 0000000..10e3d35 --- /dev/null +++ b/gui/launcher/InstallerForm.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 181, 17 + + \ No newline at end of file diff --git a/gui/launcher/InstanceSettings.Designer.cs b/gui/launcher/InstanceSettings.Designer.cs new file mode 100644 index 0000000..f443cbf --- /dev/null +++ b/gui/launcher/InstanceSettings.Designer.cs @@ -0,0 +1,191 @@ +namespace WolfLauncher.gui.launcher +{ + partial class InstanceSettings + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.maxRamLabel = new System.Windows.Forms.Label(); + this.minRamLabel = new System.Windows.Forms.Label(); + this.maxRam = new System.Windows.Forms.NumericUpDown(); + this.minRam = new System.Windows.Forms.NumericUpDown(); + this.javaArgsLabel = new System.Windows.Forms.Label(); + this.jvmArgs = new System.Windows.Forms.TextBox(); + this.screenHeightLabel = new System.Windows.Forms.Label(); + this.screenWidthLabel = new System.Windows.Forms.Label(); + this.screenWidth = new System.Windows.Forms.TextBox(); + this.screenHeight = new System.Windows.Forms.TextBox(); + this.saveSettings = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.maxRam)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.minRam)).BeginInit(); + this.SuspendLayout(); + // + // maxRamLabel + // + this.maxRamLabel.AutoSize = true; + this.maxRamLabel.Location = new System.Drawing.Point(12, 9); + this.maxRamLabel.Name = "maxRamLabel"; + this.maxRamLabel.Size = new System.Drawing.Size(80, 13); + this.maxRamLabel.TabIndex = 0; + this.maxRamLabel.Text = "Max Ram (MB):"; + // + // minRamLabel + // + this.minRamLabel.AutoSize = true; + this.minRamLabel.Location = new System.Drawing.Point(12, 37); + this.minRamLabel.Name = "minRamLabel"; + this.minRamLabel.Size = new System.Drawing.Size(77, 13); + this.minRamLabel.TabIndex = 1; + this.minRamLabel.Text = "Min Ram (MB):"; + // + // maxRam + // + this.maxRam.Increment = new decimal(new int[] { + 512, + 0, + 0, + 0}); + this.maxRam.Location = new System.Drawing.Point(106, 7); + this.maxRam.Name = "maxRam"; + this.maxRam.Size = new System.Drawing.Size(120, 20); + this.maxRam.TabIndex = 2; + // + // minRam + // + this.minRam.Increment = new decimal(new int[] { + 512, + 0, + 0, + 0}); + this.minRam.Location = new System.Drawing.Point(106, 35); + this.minRam.Name = "minRam"; + this.minRam.Size = new System.Drawing.Size(120, 20); + this.minRam.TabIndex = 3; + // + // javaArgsLabel + // + this.javaArgsLabel.AutoSize = true; + this.javaArgsLabel.Location = new System.Drawing.Point(12, 62); + this.javaArgsLabel.Name = "javaArgsLabel"; + this.javaArgsLabel.Size = new System.Drawing.Size(57, 13); + this.javaArgsLabel.TabIndex = 4; + this.javaArgsLabel.Text = "Java Args:"; + // + // jvmArgs + // + this.jvmArgs.Location = new System.Drawing.Point(106, 61); + this.jvmArgs.Multiline = true; + this.jvmArgs.Name = "jvmArgs"; + this.jvmArgs.Size = new System.Drawing.Size(330, 195); + this.jvmArgs.TabIndex = 5; + // + // screenHeightLabel + // + this.screenHeightLabel.AutoSize = true; + this.screenHeightLabel.Location = new System.Drawing.Point(12, 294); + this.screenHeightLabel.Name = "screenHeightLabel"; + this.screenHeightLabel.Size = new System.Drawing.Size(78, 13); + this.screenHeightLabel.TabIndex = 7; + this.screenHeightLabel.Text = "Screen Height:"; + // + // screenWidthLabel + // + this.screenWidthLabel.AutoSize = true; + this.screenWidthLabel.Location = new System.Drawing.Point(12, 266); + this.screenWidthLabel.Name = "screenWidthLabel"; + this.screenWidthLabel.Size = new System.Drawing.Size(75, 13); + this.screenWidthLabel.TabIndex = 6; + this.screenWidthLabel.Text = "Screen Width:"; + // + // screenWidth + // + this.screenWidth.Location = new System.Drawing.Point(106, 263); + this.screenWidth.Name = "screenWidth"; + this.screenWidth.Size = new System.Drawing.Size(120, 20); + this.screenWidth.TabIndex = 8; + // + // screenHeight + // + this.screenHeight.Location = new System.Drawing.Point(106, 291); + this.screenHeight.Name = "screenHeight"; + this.screenHeight.Size = new System.Drawing.Size(120, 20); + this.screenHeight.TabIndex = 9; + // + // saveSettings + // + this.saveSettings.Location = new System.Drawing.Point(361, 288); + this.saveSettings.Name = "saveSettings"; + this.saveSettings.Size = new System.Drawing.Size(75, 23); + this.saveSettings.TabIndex = 10; + this.saveSettings.Text = "Save"; + this.saveSettings.UseVisualStyleBackColor = true; + this.saveSettings.Click += new System.EventHandler(this.saveSettings_Click); + // + // InstanceSettings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(449, 324); + this.Controls.Add(this.saveSettings); + this.Controls.Add(this.screenHeight); + this.Controls.Add(this.screenWidth); + this.Controls.Add(this.screenHeightLabel); + this.Controls.Add(this.screenWidthLabel); + this.Controls.Add(this.jvmArgs); + this.Controls.Add(this.javaArgsLabel); + this.Controls.Add(this.minRam); + this.Controls.Add(this.maxRam); + this.Controls.Add(this.minRamLabel); + this.Controls.Add(this.maxRamLabel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InstanceSettings"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Instance Settings"; + this.Load += new System.EventHandler(this.InstanceSettings_Load); + ((System.ComponentModel.ISupportInitialize)(this.maxRam)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.minRam)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label maxRamLabel; + private System.Windows.Forms.Label minRamLabel; + private System.Windows.Forms.NumericUpDown maxRam; + private System.Windows.Forms.NumericUpDown minRam; + private System.Windows.Forms.Label javaArgsLabel; + private System.Windows.Forms.TextBox jvmArgs; + private System.Windows.Forms.Label screenHeightLabel; + private System.Windows.Forms.Label screenWidthLabel; + private System.Windows.Forms.TextBox screenWidth; + private System.Windows.Forms.TextBox screenHeight; + private System.Windows.Forms.Button saveSettings; + } +} \ No newline at end of file diff --git a/gui/launcher/InstanceSettings.cs b/gui/launcher/InstanceSettings.cs new file mode 100644 index 0000000..75bf3ab --- /dev/null +++ b/gui/launcher/InstanceSettings.cs @@ -0,0 +1,77 @@ +using System; +using System.Windows.Forms; +using WolfLauncher.core; +using WolfLauncher.model; + +/** + * Author: HypherionSA + * Instance settings dialog like Ram, JVM args, Screensize etc + **/ +namespace WolfLauncher.gui.launcher +{ + public partial class InstanceSettings : Form + { + // Reference to launcher instance + private Instance instance; + + public InstanceSettings(Instance ins) + { + InitializeComponent(); + + instance = ins; + this.Text = String.Format("{0} - {1} - {2}", "Settings for " + ins.name, LauncherConstants.LauncherName, LauncherConstants.Version); + } + + /** + * Read instance settings from manifest + **/ + private void InstanceSettings_Load(object sender, EventArgs e) + { + // Get system information + var i = new Microsoft.VisualBasic.Devices.ComputerInfo(); + + // Set max ram values. Adds in a buffer so you still have memory left for the OS + maxRam.Maximum = i.TotalPhysicalMemory / (1024 * 1024) - 1024; + minRam.Maximum = maxRam.Maximum / 2; + + // Check if instance has settings, otherwise apply defaults + if (instance.settings == null) + { + instance.settings = new Instance.Settings + { + maxRam = 2024, + minRam = 512, + screenHeight = "auto", + screenWidth = "auto", + javaPath = "", + javaArgs = "" + }; + } + + // Set values from manifest + maxRam.Value = instance.settings.maxRam; + minRam.Value = instance.settings.minRam; + jvmArgs.Text = instance.settings.javaArgs; + screenWidth.Text = instance.settings.screenWidth; + screenHeight.Text = instance.settings.screenHeight; + } + + /** + * Persist Settings to instance manifest + **/ + private void saveSettings_Click(object sender, EventArgs e) + { + // Add values to manifest + instance.settings.maxRam = (int)maxRam.Value; + instance.settings.minRam = (int)minRam.Value; + instance.settings.javaArgs = jvmArgs.Text; + instance.settings.screenWidth = screenWidth.Text; + instance.settings.screenHeight = screenHeight.Text; + + // Save Settings + Launcher.INSTANCE.updateInstanceSettings(instance); + + MessageBox.Show("Settings Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } +} diff --git a/gui/launcher/InstanceSettings.resx b/gui/launcher/InstanceSettings.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/gui/launcher/InstanceSettings.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/gui/launcher/InstanceWindow.Designer.cs b/gui/launcher/InstanceWindow.Designer.cs new file mode 100644 index 0000000..8502ed1 --- /dev/null +++ b/gui/launcher/InstanceWindow.Designer.cs @@ -0,0 +1,273 @@ +namespace WolfLauncher.gui.launcher +{ + partial class InstanceWindow + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.logTab = new System.Windows.Forms.TabControl(); + this.logPage = new System.Windows.Forms.TabPage(); + this.logContainer = new System.Windows.Forms.Panel(); + this.logWindow = new System.Windows.Forms.RichTextBox(); + this.logPanelBottom = new System.Windows.Forms.Panel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.launchBtn = new System.Windows.Forms.Button(); + this.launchOfflineBtn = new System.Windows.Forms.Button(); + this.demoBtn = new System.Windows.Forms.Button(); + this.closeBtn = new System.Windows.Forms.Button(); + this.topPanel = new System.Windows.Forms.Panel(); + this.copyLog = new System.Windows.Forms.Button(); + this.uploadLog = new System.Windows.Forms.Button(); + this.clearLog = new System.Windows.Forms.Button(); + this.wrapLines = new System.Windows.Forms.CheckBox(); + this.updateLog = new System.Windows.Forms.CheckBox(); + this.logTab.SuspendLayout(); + this.logPage.SuspendLayout(); + this.logContainer.SuspendLayout(); + this.panel1.SuspendLayout(); + this.topPanel.SuspendLayout(); + this.SuspendLayout(); + // + // logTab + // + this.logTab.Controls.Add(this.logPage); + this.logTab.Dock = System.Windows.Forms.DockStyle.Fill; + this.logTab.Location = new System.Drawing.Point(0, 0); + this.logTab.Name = "logTab"; + this.logTab.SelectedIndex = 0; + this.logTab.Size = new System.Drawing.Size(800, 450); + this.logTab.TabIndex = 0; + // + // logPage + // + this.logPage.Controls.Add(this.logContainer); + this.logPage.Controls.Add(this.panel1); + this.logPage.Controls.Add(this.topPanel); + this.logPage.Location = new System.Drawing.Point(4, 22); + this.logPage.Name = "logPage"; + this.logPage.Padding = new System.Windows.Forms.Padding(3); + this.logPage.Size = new System.Drawing.Size(792, 424); + this.logPage.TabIndex = 0; + this.logPage.Text = "Minecraft Log"; + this.logPage.UseVisualStyleBackColor = true; + // + // logContainer + // + this.logContainer.Controls.Add(this.logWindow); + this.logContainer.Controls.Add(this.logPanelBottom); + this.logContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.logContainer.Location = new System.Drawing.Point(3, 38); + this.logContainer.Name = "logContainer"; + this.logContainer.Size = new System.Drawing.Size(786, 351); + this.logContainer.TabIndex = 2; + // + // logWindow + // + this.logWindow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.logWindow.Dock = System.Windows.Forms.DockStyle.Fill; + this.logWindow.Location = new System.Drawing.Point(0, 0); + this.logWindow.Name = "logWindow"; + this.logWindow.ReadOnly = true; + this.logWindow.Size = new System.Drawing.Size(786, 319); + this.logWindow.TabIndex = 1; + this.logWindow.Text = ""; + this.logWindow.WordWrap = false; + // + // logPanelBottom + // + this.logPanelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; + this.logPanelBottom.Location = new System.Drawing.Point(0, 319); + this.logPanelBottom.Name = "logPanelBottom"; + this.logPanelBottom.Size = new System.Drawing.Size(786, 32); + this.logPanelBottom.TabIndex = 0; + // + // panel1 + // + this.panel1.Controls.Add(this.launchBtn); + this.panel1.Controls.Add(this.launchOfflineBtn); + this.panel1.Controls.Add(this.demoBtn); + this.panel1.Controls.Add(this.closeBtn); + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(3, 389); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(786, 32); + this.panel1.TabIndex = 1; + // + // launchBtn + // + this.launchBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.launchBtn.Location = new System.Drawing.Point(346, 5); + this.launchBtn.Name = "launchBtn"; + this.launchBtn.Size = new System.Drawing.Size(114, 23); + this.launchBtn.TabIndex = 5; + this.launchBtn.Text = "Launch"; + this.launchBtn.UseVisualStyleBackColor = true; + this.launchBtn.Click += new System.EventHandler(this.launchBtn_Click); + // + // launchOfflineBtn + // + this.launchOfflineBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.launchOfflineBtn.Enabled = false; + this.launchOfflineBtn.Location = new System.Drawing.Point(466, 5); + this.launchOfflineBtn.Name = "launchOfflineBtn"; + this.launchOfflineBtn.Size = new System.Drawing.Size(114, 23); + this.launchOfflineBtn.TabIndex = 4; + this.launchOfflineBtn.Text = "Launch Offline"; + this.launchOfflineBtn.UseVisualStyleBackColor = true; + // + // demoBtn + // + this.demoBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.demoBtn.Enabled = false; + this.demoBtn.Location = new System.Drawing.Point(586, 5); + this.demoBtn.Name = "demoBtn"; + this.demoBtn.Size = new System.Drawing.Size(114, 23); + this.demoBtn.TabIndex = 3; + this.demoBtn.Text = "Launch Demo"; + this.demoBtn.UseVisualStyleBackColor = true; + // + // closeBtn + // + this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.closeBtn.Location = new System.Drawing.Point(706, 5); + this.closeBtn.Name = "closeBtn"; + this.closeBtn.Size = new System.Drawing.Size(75, 23); + this.closeBtn.TabIndex = 2; + this.closeBtn.Text = "Close"; + this.closeBtn.UseVisualStyleBackColor = true; + this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); + // + // topPanel + // + this.topPanel.Controls.Add(this.copyLog); + this.topPanel.Controls.Add(this.uploadLog); + this.topPanel.Controls.Add(this.clearLog); + this.topPanel.Controls.Add(this.wrapLines); + this.topPanel.Controls.Add(this.updateLog); + this.topPanel.Dock = System.Windows.Forms.DockStyle.Top; + this.topPanel.Location = new System.Drawing.Point(3, 3); + this.topPanel.Name = "topPanel"; + this.topPanel.Size = new System.Drawing.Size(786, 35); + this.topPanel.TabIndex = 0; + // + // copyLog + // + this.copyLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.copyLog.Enabled = false; + this.copyLog.Location = new System.Drawing.Point(544, 4); + this.copyLog.Name = "copyLog"; + this.copyLog.Size = new System.Drawing.Size(75, 23); + this.copyLog.TabIndex = 4; + this.copyLog.Text = "Copy Log"; + this.copyLog.UseVisualStyleBackColor = true; + // + // uploadLog + // + this.uploadLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.uploadLog.Enabled = false; + this.uploadLog.Location = new System.Drawing.Point(625, 4); + this.uploadLog.Name = "uploadLog"; + this.uploadLog.Size = new System.Drawing.Size(75, 23); + this.uploadLog.TabIndex = 3; + this.uploadLog.Text = "Upload Log"; + this.uploadLog.UseVisualStyleBackColor = true; + // + // clearLog + // + this.clearLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.clearLog.Location = new System.Drawing.Point(706, 4); + this.clearLog.Name = "clearLog"; + this.clearLog.Size = new System.Drawing.Size(75, 23); + this.clearLog.TabIndex = 1; + this.clearLog.Text = "Clear"; + this.clearLog.UseVisualStyleBackColor = true; + this.clearLog.Click += new System.EventHandler(this.clearLog_Click); + // + // wrapLines + // + this.wrapLines.AutoSize = true; + this.wrapLines.Checked = true; + this.wrapLines.CheckState = System.Windows.Forms.CheckState.Checked; + this.wrapLines.Location = new System.Drawing.Point(112, 8); + this.wrapLines.Name = "wrapLines"; + this.wrapLines.Size = new System.Drawing.Size(80, 17); + this.wrapLines.TabIndex = 2; + this.wrapLines.Text = "Wrap Lines"; + this.wrapLines.UseVisualStyleBackColor = true; + this.wrapLines.CheckedChanged += new System.EventHandler(this.wrapLines_CheckedChanged); + // + // updateLog + // + this.updateLog.AutoSize = true; + this.updateLog.Checked = true; + this.updateLog.CheckState = System.Windows.Forms.CheckState.Checked; + this.updateLog.Location = new System.Drawing.Point(9, 8); + this.updateLog.Name = "updateLog"; + this.updateLog.Size = new System.Drawing.Size(97, 17); + this.updateLog.TabIndex = 1; + this.updateLog.Text = "Keep Updating"; + this.updateLog.UseVisualStyleBackColor = true; + this.updateLog.CheckedChanged += new System.EventHandler(this.updateLog_CheckedChanged); + // + // InstanceWindow + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.logTab); + this.Name = "InstanceWindow"; + this.Text = "InstanceWindow"; + this.Load += new System.EventHandler(this.InstanceWindow_Load); + this.logTab.ResumeLayout(false); + this.logPage.ResumeLayout(false); + this.logContainer.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.topPanel.ResumeLayout(false); + this.topPanel.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl logTab; + private System.Windows.Forms.TabPage logPage; + private System.Windows.Forms.Panel topPanel; + private System.Windows.Forms.CheckBox updateLog; + private System.Windows.Forms.CheckBox wrapLines; + private System.Windows.Forms.Button clearLog; + private System.Windows.Forms.Button uploadLog; + private System.Windows.Forms.Button copyLog; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button closeBtn; + private System.Windows.Forms.Button demoBtn; + private System.Windows.Forms.Button launchOfflineBtn; + private System.Windows.Forms.Button launchBtn; + private System.Windows.Forms.Panel logContainer; + private System.Windows.Forms.Panel logPanelBottom; + private System.Windows.Forms.RichTextBox logWindow; + } +} \ No newline at end of file diff --git a/gui/launcher/InstanceWindow.cs b/gui/launcher/InstanceWindow.cs new file mode 100644 index 0000000..c6194bb --- /dev/null +++ b/gui/launcher/InstanceWindow.cs @@ -0,0 +1,67 @@ +using System; +using System.Windows.Forms; +using WolfLauncher.core; +using WolfLauncher.model; + +/** + * Author: HypherionSA + * Console window for instances + **/ +namespace WolfLauncher.gui.launcher +{ + public partial class InstanceWindow : Form + { + // Reference to launcher instance + private Instance instance; + + public InstanceWindow(Instance ins) + { + InitializeComponent(); + this.instance = ins; + + this.Text = String.Format("{0} - {1} - {2}", "Console window for " + ins.name, LauncherConstants.LauncherName, LauncherConstants.Version); + } + + private void wrapLines_CheckedChanged(object sender, EventArgs e) + { + // Apply wordwrapping based on checkbox + logWindow.WordWrap = wrapLines.Checked; + } + + private void InstanceWindow_Load(object sender, EventArgs e) + { + // Setup default values + logWindow.WordWrap = wrapLines.Checked; + + // Load log from logger if it exists + LauncherLogger.INSTANCE.logWindow = this.logWindow; + LauncherLogger.INSTANCE.loadLog(instance); + LauncherLogger.INSTANCE.canUpdateLog = true; + } + + private void clearLog_Click(object sender, EventArgs e) + { + // Clear the log + logWindow.Clear(); + LauncherLogger.INSTANCE.clearLog(); + } + + private void closeBtn_Click(object sender, EventArgs e) + { + // Close the window... Really? I needed to comment this?? + this.Close(); + } + + private void launchBtn_Click(object sender, EventArgs e) + { + // Launch Instance + MainLauncherForm.INSTANCE.launchInstance(instance); + } + + private void updateLog_CheckedChanged(object sender, EventArgs e) + { + // Set if log can be updated in the window or not + LauncherLogger.INSTANCE.canUpdateLog = updateLog.Checked; + } + } +} diff --git a/gui/launcher/InstanceWindow.resx b/gui/launcher/InstanceWindow.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/gui/launcher/InstanceWindow.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/model/Instance.cs b/model/Instance.cs new file mode 100644 index 0000000..4f02e56 --- /dev/null +++ b/model/Instance.cs @@ -0,0 +1,30 @@ + +/** + * Author: HypherionSA + * Instance Manifest Model + **/ +namespace WolfLauncher.model +{ + public class Instance + { + + // General Instance info like Game Version, Name, etc. + public string name { get; set; } + public string gameVersion { get; set; } + public string loader { get; set; } + public bool localInstall { get; set; } + public Settings settings { get; set; } + + public class Settings + { + // Java and Screen Settings + public int maxRam { get; set; } + public int minRam { get; set; } + public string screenWidth { get; set; } + public string screenHeight { get; set; } + + public string javaPath { get; set; } + public string javaArgs { get; set; } + } + } +} diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..d64843a --- /dev/null +++ b/packages.config @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..bf5889a --- /dev/null +++ b/readme.md @@ -0,0 +1,76 @@ +## Wolf Launcher + +A Custom launcher for Servers and Modpacks hosted by First Dark Development. + +Supports Vanilla, Forge, Fabric. Quilt and LiteLoader coming soon. + +### This launcher is still a WIP. The code is shared here for transparency and is not intended to be used yet. + +--- + +## System Requirements + +* Windows 8 or newer +* .NET Framework 4.7.2 or newer +* Internet Connection +* Minecraft Java Account with valid game license + +--- + +## Launcher Features + +* Automatically installs the required JAVA version +* Can install Forge and Fabric along with vanilla instances +* Supports Microsoft Account Authentication +* Is functional atleast... Still VERY WIP + +## Planned Features + +* Modrinth Support + * Mods + * Modpacks + * Resource Packs + +* Modpack Downloads from our servers, for private FDD Servers +* Mod Management +* Resource pack management +* World management +* Shader pack management +* Multiple MC Accounts +* Instance Exporting/Importing +* Local Servers (For testing) + +## Not Planned Features + +* Cracked Accounts (Or playing the game without paying for it) +* Linux/MacOs Support. I can't be bothered to deal with cross platform GUI's for now +* Curseforge Support. Requires an API key and I don't wanna deal with that. This isn't meant as a replacement launcher +* NeoForge - For now at least, will be considered once project is mature and adopted +* FTB Support. FTB doesn't like other launchers using their packs, so not happening + +--- + +### Copying + +You are free to copy this code to make your own launcher, but, there are some requirements. + +* You are not allowed to use the name Wolf Launcher. You need to use your own name +* You are not allowed to use the Wolf Launcher Icons +* You need to provide your own user support +* You cannot use any of our backend systems. This includes, but is not limited to our CDN, Backend API for modpacks hosted on our servers, documentation, logos or artwork. +* You need to give credit to HypherionSA and First Dark Development, and cannot remove our names from the source code. +* If you reuse portions of the code, you need to add a header with the license and credit. + +--- + +### Building from source + +** Coming Soon ** + +--- + +### Licenses + +* Launcher and Code: GPL-3.0 +* Launcher Artwork and Assets: All Rights Reserved +* CMLLib: MIT License \ No newline at end of file