[
  {
    "path": ".github/workflows/main.yml",
    "content": "name: build\n\non:\n  pull_request:\n  push:\n    branches:\n      - \"*\"\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - name: 🛠 Run the build script\n        shell: pwsh\n        run: |\n          ./buildMaster.ps1 -Write | Set-Content ./Master.ps1\n          ./buildManifests.ps1 | ConvertTo-Json -Depth 5 | Set-Content ./Manifests.json\n      - name: 🌊 Commit the new 'compiled' build\n        uses: stefanzweifel/git-auto-commit-action@v4\n        with:\n          commit_message: Autobuild\n#     - name: 🌊 Upload new build to Releases\n#       uses: marvinpinto/action-automatic-releases@latest\n#       with:\n#         repo_token: ${{ secrets.GITHUB_TOKEN }}\n#         automatic_release_tag: nightly\n#         prerelease: false\n#         title: TweakList AutoBuild\n#         files: Master.ps1\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "Manifests.json",
    "content": "{\n  \"Optimize-LunarClient\": {\n    \"path\": \"/modules/Game & Program tuners/Optimize-LunarClient.ps1\",\n    \"description\": \"Tunes a selected Lunar Client profile to your liking, it has some good defaults everyone should have (no numbers in scoreboard, modern keybind handling, no achievements, transparent texture packs section, borderless fullscreen..)\",\n    \"Display Name\": \"Optimize Lunar Client\",\n    \"Platform\": \"Linux; Windows\",\n    \"Category\": \"Optimizations\",\n    \"Depends\": \"Write-Diff; Merge-HashTables\",\n    \"display\": \"Optimize LunarClient\",\n    \"parameters\": {\n      \"LazyChunkLoadSpeed\": {\n        \"values\": [\n          \"highest\",\n          \"high\",\n          \"medium\",\n          \"low\",\n          \"lowest\",\n          \"off_van\"\n        ],\n        \"default\": \"low\",\n        \"type\": \"enum\"\n      },\n      \"Settings\": {\n        \"description\": \"Specify which specific tweak you'd like applying on your profile\",\n        \"values\": {\n          \"Performance\": \"Turn off performance-hungry settings\",\n          \"NoCosmetics\": \"Disable all emotes, cosmetics, wings, hats..\",\n          \"MinimalViewBobbing\": \"Keep item movement but disable walk bobbing\",\n          \"No16xSaturationOverlay\": \"Remove the yellow 16x hunger bar overlay\",\n          \"HideToggleSprint\": \"Hides the ToggleSprint status from HUD\",\n          \"ToggleSneak\": \"Turns on ToggleSneak\",\n          \"DisableUHCMods\": \"Disables ArmorHUD, DirectionHUD and Coordinates mods\",\n          \"FullBright\": \"literally night vision\"\n        },\n        \"type\": \"enum[]\"\n      },\n      \"LCDirectory\": {\n        \"default\": \"\\\"$HOME\\\\.lunarclient\\\"\",\n        \"type\": \"string\"\n      },\n      \"NoBetaWarning\": {\n        \"default\": \"False\",\n        \"type\": \"boolean\"\n      },\n      \"KeepLCOpen\": {\n        \"default\": \"False\",\n        \"type\": \"boolean\"\n      },\n      \"DryRun\": {\n        \"default\": \"False\",\n        \"type\": \"boolean\"\n      }\n    }\n  },\n  \"Optimize-OBS\": {\n    \"path\": \"/modules/Game & Program tuners/Optimize-OBS.ps1\",\n    \"description\": \"Tune your OBS for a specific usecase in the snap of a finger!\",\n    \"Display Name\": \"Optimize OBS\",\n    \"Platform\": \"Linux; Windows\",\n    \"Category\": \"Optimizations\",\n    \"display\": \"Optimize OBS\",\n    \"parameters\": {\n      \"Encoder\": {\n        \"description\": \"Which hardware type you wish to record with\",\n        \"values\": {\n          \"NVENC\": \"NVIDIA's Fastest encoder, it lets you record in hundreds of FPS easily\",\n          \"AMF\": \"AMD GPUs/Integrated GPUs encoder, not as good as NVENC but can still get out ~240FPS at most\",\n          \"QuickSync\": \"Intel's GPU encoder, worst out of the three, note this is H264, not the new fancy but slow AV1\",\n          \"x264\": \"Encoding using your CPU, slow but efficient, only use if necessary/you know what you're doing\"\n        },\n        \"type\": \"enum\"\n      },\n      \"OBS64Path\": {\n        \"description\": \"If you've got a portable install or something, pass in the main OBS binary's path here\",\n        \"type\": \"string\"\n      },\n      \"Preset\": {\n        \"values\": [\n          \"HighPerformance\"\n        ],\n        \"default\": \"HighPerformance\",\n        \"type\": \"enum\"\n      },\n      \"MiscTweaks\": {\n        \"values\": [\n          \"EnableStatsDock\",\n          \"OldDarkTheme\",\n          \"CouleursHotkeys\"\n        ],\n        \"type\": \"enum[]\"\n      },\n      \"OBSProfile\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "Master.ps1",
    "content": "# This file is automatically built at every push to combine every function into a single file\n\nusing namespace System.Management.Automation # Required by Invoke-NGENpsosh\nRemove-Module TweakList -ErrorAction Ignore\nNew-Module TweakList ([ScriptBlock]::Create({\n\nfunction Assert-Choice {\n    if (-Not(Get-Command choice.exe -ErrorAction Ignore)){\n        Write-Host \"[!] Unable to find choice.exe (it comes with Windows, did a little bit of unecessary debloating?)\" -ForegroundColor Red\n        PauseNul\n        exit 1\n    }\n}\nfunction Assert-Path {\n    param(\n        $Path\n    )\n    if (-Not(Test-Path -Path $Path)) {\n        New-Item -Path $Path -Force | Out-Null\n    }\n}\nfunction FindInText{\n    <#\n    Recreated a simple grep for finding shit in TweakList,\n    I mostly use this to check if a function/word has ever been mentionned in all my code\n    #>\n    param(\n        [String]$String,\n        $Path = (Get-Location),\n        [Array]$Exclude,\n        [Switch]$Recurse\n    )\n\n    $Exclude += @(\n    '*.exe','*.bin','*.dll'\n    '*.png','*.jpg'\n    '*.mkv','*.mp4','*.webm'\n    '*.zip','*.tar','*.gz','*.rar','*.7z','*.so'\n    '*.pyc','*.pyd'\n    )\n\n    $Parameters = @{\n        Path = $Path\n        Recurse = $Recurse\n        Exclude = $Exclude\n    }\n    $script:FoundOnce = $False\n    $script:Match = $null\n    Get-ChildItem @Parameters -File | ForEach-Object {\n        $Match = $null\n        Write-Verbose (\"Checking \" + $PSItem.Name)\n        $Match = Get-Content $PSItem.FullName | Where-Object {$_ -Like \"*$String*\"}\n        if ($Match){\n            $script:FoundOnce = $True\n            Write-Host \"- Found in $($_.Name) ($($_.FullName))\" -ForegroundColor Green\n            $Match\n        }\n    }\n\n    if (!$FoundOnce){\n        Write-Host \"Not found\" -ForegroundColor red\n    }\n}\nfunction Get-7zPath {\n\n    if (Get-Command 7z.exe -Ea Ignore){return (Get-Command 7z.exe).Source}\n\n    $DefaultPath = \"$env:ProgramFiles\\7-Zip\\7z.exe\"\n    if (Test-Path $DefaultPath) {return $DefaultPath}\n\n    Try {\n        $InstallLocation = (Get-Package 7-Zip* -ErrorAction Stop).Metadata['InstallLocation'] # Compatible with 7-Zip installed normally / with winget\n        if (Test-Path $InstallLocation -ErrorAction Stop){\n            return \"$InstallLocation`7z.exe\"\n        }\n    }Catch{} # If there's an error it's probably not installed anyways\n\n    if (Get-Boolean \"7-Zip could not be found, would you like to download it using Scoop?\"){\n        Install-Scoop\n        scoop install 7zip\n        if (Get-Command 7z -Ea Ignore){\n            return (Get-Command 7z.exe).Source\n        }else{\n            Write-Error \"7-Zip could not be installed\"\n            return \n        }\n\n    }else{return}\n\n    # leaving this here if anyone knows a smart way to implement this ))\n    # $7Zip = (Get-ChildItem -Path \"$env:HOMEDRIVE\\*7z.exe\" -Recurse -Force -ErrorAction Ignore).FullName | Select-Object -First 1\n\n}\n\nfunction Get-Boolean {\n    param(\n        $Message\n    )\n    $null = $Response\n    $Response = Read-Host $Message\n    While ($Response -NotIn 'yes','y','n','no'){\n        Write-Host \"Answer must be 'yes','y','n' or 'no'\" -ForegroundColor Red\n        $Response = Read-Host $Message\n    }\n    if ($Response -in 'yes','y'){return $true}\n    elseif($Response -in 'n','no'){return $false}\n    else{Write-Error \"Invalid response\";pause;exit}\n}\n\nfunction Get-EncodingArgs{\n    [alias('genca')]\n    param(\n        [String]$Resolution = '3840x2160',\n        [Switch]$Silent,\n        [Switch]$EzEncArgs\n    )\n\nInstall-FFmpeg\n\n$DriverVersion = (Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_Display.Driver\" -ErrorAction Ignore).DisplayVersion\n    if ($DriverVersion){ # Only triggers if it parsed a NVIDIA driver version, else it can probably be an NVIDIA GPU\n        if ($DriverVersion -lt 477.41){ # Oldest NVIDIA version capable\n        Write-Warning \"Outdated NVIDIA Drivers detected ($DriverVersion), you won't be able to encode using NVENC util you update them.\"\n    }\n}\n\n$EncCommands = [ordered]@{\n    'HEVC NVENC' = 'hevc_nvenc -rc vbr  -preset p7 -b:v 400M -cq 19'\n    'H264 NVENC' = 'h264_nvenc -rc vbr  -preset p7 -b:v 400M -cq 16'\n    'HEVC AMF' = 'hevc_amf -quality quality -qp_i 16 -qp_p 18 -qp_b 20'\n    'H264 AMF' = 'h264_amf -quality quality -qp_i 12 -qp_p 12 -qp_b 12'\n    'HEVC QSV' = 'hevc_qsv -preset veryslow -global_quality:v 18'\n    'H264 QSV' = 'h264_qsv -preset veryslow -global_quality:v 15'\n    'H264 CPU' = 'libx264 -preset slow -crf 16 -x265-params aq-mode=3'\n    'HEVC CPU' = 'libx265 -preset medium -crf 18 -x265-params aq-mode=3:no-sao=1:frame-threads=1'\n}\n\n$EncCommands.Keys | ForEach-Object -Begin {\n    $script:shouldStop = $false\n} -Process {\n    if ($shouldStop -eq $true) { return }\n    Invoke-Expression \"ffmpeg.exe -loglevel fatal -f lavfi -i nullsrc=$Resolution -t 0.1 -c:v $($EncCommands.$_) -f null NUL\"\n    if ($LASTEXITCODE -eq 0){\n        $script:valid_args = $EncCommands.$_\n        $script:valid_ezenc = $_\n\n        if ($Silent){\n            Write-Host (\"Found compatible encoding settings using $PSItem`: {0}\" -f ($EncCommands.$_)) -ForegroundColor Green\n        }\n        $shouldStop = $true # Crappy way to stop the loop since most people that'll execute this will technically be parsing the raw URL as a scriptblock\n    }\n}\n\nif (-Not($script:valid_args)){\n    Write-Host \"No compatible encoding settings found (should not happen, is FFmpeg installed?)\" -ForegroundColor DarkRed\n    Get-Command FFmpeg -Ea Ignore\n    pause\n    return\n}\n\nif ($EzEncArgs){\n    return $script:valid_ezenc\n}else{\n    return $valid_args\n}\n\n}\nfunction Get-FunctionContent {\n    [alias('gfc')]\n    [CmdletBinding()]\n    param([Parameter()]\n        [String[]]$Functions,\n        [Switch]$Dependencies,\n        [Switch]$ReturnNames\n    )\n\n    $FunctionsPassed = [System.Collections.ArrayList]@()\n    $Content = [System.Collections.ArrayList]@()\n\n    Get-Command $Functions -ErrorAction Stop | ForEach-Object { # Loop through all functions\n        if ($Resolved = $_.ResolvedCommand){ # Checks if $_.ResolveCommand exists, also assigns it to $Resolved\n            Write-Verbose \"Switching from alias $_ to function $($Resolved.Name)\" -Verbose\n            $_ = Get-Command $Resolved.Name\n        }\n        if ($_ -NotIn $FunctionsPassed){ # If it hasn't been looped over yet\n\n            $Content += ($Block = $_.ScriptBlock.Ast.Extent.Text)\n                # Assigns function block to $Block and appends to $Content\n            \n            $FunctionsPassed.Add($_) | Out-Null # So it doesn't get checked again\n\n            if ($Dependencies){\n\n                if (!$TL_FUNCTIONS){\n                    if (Get-Module -Name TweakList -ErrorAction Ignore){\n                        $TL_FUNCTIONS = [String[]](Get-Module -Name TweakList).ExportedFunctions.Keys\n                    }else {\n                        throw \"TL_FUNCTIONS variable is not defined, which is needed to get available TweakList functions\"\n                    }\n                }\n\n                $AST = [System.Management.Automation.Language.Parser]::ParseInput($Block, [ref]$null, [ref]$null)\n                \n                $DepMatches = $AST.FindAll({\n                        param ($node)\n                        $node.GetType().Name -eq 'CommandAst'\n                    }, $true) | #It gets all cmdlets from the Abstract Syntax Tree\n                ForEach-Object {$_.CommandElements[0].Value} | # Returns their name\n                    Where-Object { # Filters out only TweakList functions\n                        $_ -In ($TL_FUNCTIONS | Where-Object {$_ -ne $_.Name})\n\n                    } | Select-Object -Unique\n\n                ForEach($Match in $DepMatches){\n                    $FunctionsPassed.Add((Get-Command -Name $Match -CommandType Function)) | Out-Null\n\n                    $Content += (Get-Command -Name $Match -CommandType Function).ScriptBlock.Ast.Extent.Text\n\n                }\n            }\n        }\n    }\n\n    if ($Content){\n        $Content = \"#region gfc`n\" + $Content + \"`n#endregion\"\n    }\n\n    if($ReturnNames){\n        return $FunctionsPassed | Select-Object -Unique # | Where-Object {$_ -notin $Functions} \n    } else {\n        return $Content\n    }\n}\n\nfunction Get-HeaderSize {\n    param(\n        $URL,\n        $FileName = \"file\"\n    )\n    Try {\n        $Size = (Invoke-WebRequest -Useb $URL -Method Head -ErrorAction Stop).Headers.'Content-Length'\n    }Catch{\n        Write-Host \"Failed to parse $FileName size (Invalid URL?):\" -ForegroundColor DarkRed\n        Write-Host $_.Exception.Message -ForegroundColor Red\n        return\n\n    }\n    return [Math]::Round((($Size | Select-Object -First 1) / 1MB), 2)\n    \n}\nfunction Get-Path {\n    [alias('gpa')]\n    param($File)\n\n    if (-Not(Get-Command $File -ErrorAction Ignore)){return $null}\n\n    $BaseName, $Extension = $File.Split('.')\n\n    if (Get-Command \"$BaseName.shim\" -ErrorAction Ignore){\n        return (Get-Content (Get-Command \"$BaseName.shim\").Source | Select-Object -First 1).Trim('path = ').replace('\"','')\n    }elseif($Extension){\n        return (Get-Command \"$BaseName.$Extension\").Source\n    }else{\n        return (Get-Command $BaseName).Source\n    }\n}\n\nfunction Get-ScoopApp {\n    [CmdletBinding()] param (\n\n        [Parameter(ValueFromRemainingArguments = $true)]\n        [System.Collections.Arraylist]\n        $Apps # Not necessarily plural\n    )\n\n    Install-Scoop\n\n    $Scoop = (Get-Item (Get-Command scoop).Source).Directory | Split-Path\n    $ToInstall = $Apps | Where-Object {$PSItem -NotIn (Get-ChildItem \"$Scoop\\apps\")}\n    $Available = (Get-ChildItem \"$Scoop\\buckets\\*\\bucket\\*\").BaseName\n    $Buckets = (Get-ChildItem \"$Scoop\\buckets\" -Directory).Name\n    $Installed = (Get-ChildItem \"$Scoop\\apps\" -Directory).Name\n    $script:FailedToInstall = @()\n\n    function Get-Git {\n        if ('git' -NotIn $Installed){\n            scoop install git\n            if ($LASTEXITCODE -ne 0){\n                Write-Host \"Failed to install Git.\" -ForegroundColor Red\n                return\n            }\n        }\n        $ToInstall = $ToInstall | Where-Object {$_ -ne 'git'}\n    }\n\n    $Repos = @{\n\n        main            = @{org = 'ScoopInstaller'     ;repo = 'main'                ;branch = 'master'}\n        extras          = @{org = 'ScoopInstaller'     ;repo = 'extras'              ;branch = 'master'}\n        utils           = @{org = 'couleur-tweak-tips' ;repo = 'utils'               ;branch = 'main'  }\n        nirsoft         = @{org = 'kodybrown'          ;repo = 'scoop-nirsoft'       ;branch = 'master'}\n        'games'         = @{org = 'Calinou'            ;repo = 'scoop-games'         ;branch = 'master'}\n        'nerd-fonts'    = @{org = 'matthewjberger'     ;repo = 'scoop-nerd-fonts'    ;branch = 'master'}\n        versions        = @{org = 'ScoopInstaller'     ;repo = 'versions'            ;branch = 'master'}\n        java            = @{org = 'ScoopInstaller'     ;repo = 'java'                ;branch = 'master'}\n    }\n    $RepoNames = $Repos.Keys -Split('\\r?\\n')\n\n    Foreach($App in $ToInstall){\n\n        if ($App.Split('/').Count -eq 2){\n\n            $Bucket, $App = $App.Split('/')\n\n            if ($Bucket -NotIn $RepoNames){\n                Write-Host \"Bucket $Bucket is not known, add it yourself by typing 'scoop.cmd bucket add bucketname https://bucket.repo/url'\"\n                continue\n            }elseif (($Bucket -NotIn $Buckets) -And ($Bucket -In $RepoNames)){\n                Get-Git\n                scoop bucket add $Repos.$Bucket.repo https://github.com/$($Repos.$Bucket.org)/$($Repos.$Bucket.repo)\n            }\n        }\n\n        $Available = (Get-ChildItem \"$Scoop\\buckets\\*\\bucket\\*\").BaseName\n\n        if ($App -NotIn $Available){\n            Remove-Variable -Name Found -ErrorAction Ignore\n            ForEach($Bucket in $RepoNames){\n                if ($Found){continue}\n\n                Write-Host \"`rCould not find $App, looking for it in the $Bucket bucket..\" -NoNewline\n\n                $Response = Invoke-RestMethod \"https://api.github.com/repos/$($Repos.$Bucket.org)/$($Repos.$Bucket.repo)/git/trees//$($Repos.$Bucket.branch)?recursive=1\"\n                $Manifests = $Response.tree.path | Where-Object {$_ -Like \"bucket/*.json\"}\n                $Manifests = ($Manifests).Replace('bucket/','').Replace('.json','')\n\n                if ($App -in $Manifests){\n                    $script:Found = $True\n                    ''\n                    Get-Git\n                    \n                    scoop bucket add $Repos.$Bucket.repo https://github.com/$($Repos.$Bucket.org)/$($Repos.$Bucket.repo)\n                }else{''} # Fixes the -NoNewLine\n            }\n            \n        }\n        # Wait-Debugger\n        scoop install $App\n        if ($LASTEXITCODE -ne 0){\n            $script:FailedToInstall += $App\n            Write-Verbose \"$App exitted with code $LASTEXITCODE\"        \n        }\n    }\n\n}\nfunction Get-ShortcutTarget {\n    [alias('gst')]\n\n    param([String]$ShortcutPath)\n\n    Try {\n        $null = Get-Item $ShortcutPath -ErrorAction Stop\n    } Catch {\n        throw\n    }\n    \n    return (New-Object -ComObject WScript.Shell).CreateShortcut($ShortcutPath).TargetPath\n}\nfunction Install-FFmpeg {\n\n    $IsFFmpegScoop = (Get-Command ffmpeg -Ea Ignore).Source -Like \"*\\shims\\*\"\n\n    if(Get-Command ffmpeg -Ea Ignore){\n\n        $IsFFmpeg5 = (ffmpeg -hide_banner -h filter=libplacebo) -ne \"Unknown filter 'libplacebo'.\"\n\n        if (-Not($IsFFmpeg5)){\n\n            if ($IsFFmpegScoop){\n                Get Scoop\n                scoop update ffmpeg\n            }else{\n                Write-Warning @\"\nAn old FFmpeg installation was detected @ ($((Get-Command FFmpeg).Source)),\n\nYou could encounter errors such as:\n- Encoding with NVENC failing (in simple terms not being able to render with your GPU)\n- Scripts using new filters (e.g libplacebo)\n\nIf you want to update FFmpeg yourself, you can remove it and use the following command to install ffmpeg and add it to the path:\niex(irm tl.ctt.cx);Get FFmpeg\n\nIf you're using it because you prefer old NVIDIA drivers (why) here be dragons!\n\"@\npause\n                \n            }\n            \n        }\n                \n    }else{\n        Get Scoop\n        $Scoop = (Get-Command Scoop.ps1).Source | Split-Path | Split-Path\n\n        if (-Not(Test-Path \"$Scoop\\buckets\\main\")){\n            if (-Not(Test-Path \"$Scoop\\apps\\git\\current\\bin\\git.exe\")){\n                scoop install git\n            }\n            scoop bucket add main\n        }\n\n        $Local = ((scoop cat ffmpeg) | ConvertFrom-Json).version\n        $Latest = (Invoke-RestMethod https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/ffmpeg.json).version\n\n        if ($Local -ne $Latest){\n            \"FFmpeg version installed using scoop is outdated, updating Scoop..\"\n            if (-not(Test-Path \"$Scoop\\apps\\git\")){\n                scoop install git\n            }\n            scoop update\n        }\n\n        scoop install ffmpeg\n        if ($LASTEXITCODE -ne 0){\n            Write-Warning \"Failed to install FFmpeg\"\n            pause\n        }\n    }\n}\n\nfunction Install-Scoop {\n    param(\n        [String]$InstallDir\n    )\n    Set-ExecutionPolicy Bypass -Scope Process -Force\n\n    if (-Not(Get-Command scoop -Ea Ignore)){\n        \n        $RunningAsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')\n\n        if($InstallDir){\n            $env:SCOOP = $InstallDir\t\n            [Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')\n        }\n\n        If (-Not($RunningAsAdmin)){\n            Invoke-Expression (Invoke-RestMethod -Uri http://get.scoop.sh)\n        }else{\n            Invoke-Expression \"& {$(Invoke-RestMethod -Uri https://get.scoop.sh)} -RunAsAdmin\"\n        }\n    }\n\n    Try {\n        scoop -ErrorAction Stop | Out-Null\n    } Catch {\n        Write-Host \"Failed to install Scoop\" -ForegroundColor DarkRed\n        Write-Host $_.Exception.Message -ForegroundColor Red\n        return\n\n    }\n}\n<#\n\t.LINK\n\tFrankensteined from Inestic's WindowsFeatures Sophia Script function\n\thttps://github.com/Inestic\n\thttps://github.com/farag2/Sophia-Script-for-Windows/blob/06a315c643d5939eae75bf6e24c3f5c6baaf929e/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1#L4946\n\n\t.SYNOPSIS\n\tUser gets a nice checkbox-styled menu in where they can select \n\t\n\t.EXAMPLE\n\n\tScreenshot: https://i.imgur.com/zrCtR3Y.png\n\n\t$ToInstall = Invoke-CheckBox -Items \"7-Zip\", \"PowerShell\", \"Discord\"\n\n\tOr you can have each item have a description by passing an array of hashtables:\n\n\t$ToInstall = Invoke-CheckBox -Items @(\n\n\t\t@{\n\t\t\tDisplayName = \"7-Zip\"\n\t\t\t# Description = \"Cool Unarchiver\"\n\t\t},\n\t\t@{\n\t\t\tDisplayName = \"Windows Sandbox\"\n\t\t\tDescription = \"Windows' Virtual machine\"\n\t\t},\n\t\t@{\n\t\t\tDisplayName = \"Firefox\"\n\t\t\tDescription = \"A great browser\"\n\t\t},\n\t\t@{\n\t\t\tDisplayName = \"PowerShell 777\"\n\t\t\tDescription = \"PowerShell on every system!\"\n\t\t}\n\t)\n#>\nfunction Invoke-Checkbox{\nparam(\n\t$Title = \"Select an option\",\n\t$ButtonName = \"Confirm\",\n\t$Items = @(\"Fill this\", \"With passing an array\", \"to the -Item param!\")\n)\n\nif (!$Items.Description){\n\t$NewItems = @()\n\tForEach($Item in $Items){\n\t\t$NewItems += @{DisplayName = $Item}\n\t}\n\t$Items = $NewItems\n} \n\nAdd-Type -AssemblyName PresentationCore, PresentationFramework, System.Drawing, System.Windows.Forms, WindowsFormsIntegration\n\n\n# Initialize an array list to store the selected Windows features\n$SelectedFeatures = New-Object -TypeName System.Collections.ArrayList($null)\n$ToReturn = New-Object -TypeName System.Collections.ArrayList($null)\n\n\n#region XAML Markup\n# The section defines the design of the upcoming dialog box\n[xml]$XAML = '\n<Window\n\txmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n\txmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n\tName=\"Window\"\n\tMinHeight=\"450\" MinWidth=\"400\"\n\tSizeToContent=\"WidthAndHeight\" WindowStartupLocation=\"CenterScreen\"\n\tTextOptions.TextFormattingMode=\"Display\" SnapsToDevicePixels=\"True\"\n\tFontFamily=\"Arial\" FontSize=\"16\" ShowInTaskbar=\"True\"\n\tBackground=\"#F1F1F1\" Foreground=\"#262626\">\n\n\t<Window.TaskbarItemInfo>\n\t\t<TaskbarItemInfo/>\n\t</Window.TaskbarItemInfo>\n\t\n\t<Window.Resources>\n\t\t<Style TargetType=\"StackPanel\">\n\t\t\t<Setter Property=\"Orientation\" Value=\"Horizontal\"/>\n\t\t\t<Setter Property=\"VerticalAlignment\" Value=\"Top\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"CheckBox\">\n\t\t\t<Setter Property=\"Margin\" Value=\"10, 10, 5, 10\"/>\n\t\t\t<Setter Property=\"IsChecked\" Value=\"True\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"TextBlock\">\n\t\t\t<Setter Property=\"Margin\" Value=\"5, 10, 10, 10\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"Button\">\n\t\t\t<Setter Property=\"Margin\" Value=\"25\"/>\n\t\t\t<Setter Property=\"Padding\" Value=\"15\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"Border\">\n\t\t\t<Setter Property=\"Grid.Row\" Value=\"1\"/>\n\t\t\t<Setter Property=\"CornerRadius\" Value=\"0\"/>\n\t\t\t<Setter Property=\"BorderThickness\" Value=\"0, 1, 0, 1\"/>\n\t\t\t<Setter Property=\"BorderBrush\" Value=\"#000000\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"ScrollViewer\">\n\t\t\t<Setter Property=\"HorizontalScrollBarVisibility\" Value=\"Disabled\"/>\n\t\t\t<Setter Property=\"BorderBrush\" Value=\"#000000\"/>\n\t\t\t<Setter Property=\"BorderThickness\" Value=\"0, 1, 0, 1\"/>\n\t\t</Style>\n\t</Window.Resources>\n\t<Grid>\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\"/>\n\t\t\t<RowDefinition Height=\"*\"/>\n\t\t\t<RowDefinition Height=\"Auto\"/>\n\t\t</Grid.RowDefinitions>\n\t\t<ScrollViewer Name=\"Scroll\" Grid.Row=\"0\"\n\t\t\tHorizontalScrollBarVisibility=\"Disabled\"\n\t\t\tVerticalScrollBarVisibility=\"Auto\">\n\t\t\t<StackPanel Name=\"PanelContainer\" Orientation=\"Vertical\"/>\n\t\t</ScrollViewer>\n\t\t<Button Name=\"Button\" Grid.Row=\"2\"/>\n\t</Grid>\n</Window>\n'\n#endregion XAML Markup\n\n$Form = [Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $xaml))\n$XAML.SelectNodes(\"//*[@Name]\") | ForEach-Object {\n\tSet-Variable -Name ($_.Name) -Value $Form.FindName($_.Name)\n}\n\n#region Functions\nfunction Get-CheckboxClicked\n{\n\t[CmdletBinding()]\n\tparam\n\t(\n\t\t[Parameter(\n\t\t\tMandatory = $true,\n\t\t\tValueFromPipeline = $true\n\t\t)]\n\t\t[ValidateNotNull()]\n\t\t$CheckBox\n\t)\n\n\t$Feature = $Items | Where-Object -FilterScript {$_.DisplayName -eq $CheckBox.Content}\n\n\tif ($CheckBox.IsChecked) {\n\t\t[void]$SelectedFeatures.Add($Feature)\n\t}\n\telse {\n\t\t[void]$SelectedFeatures.Remove($Feature)\n\t}\n\tif ($SelectedFeatures.Count -gt 0) {\n\t\t$Button.Content = $ButtonName\n\t\t$Button.IsEnabled = $true\n\t}\n\telse {\n\t\t$Button.Content = \"Cancel\"\n\t\t$Button.IsEnabled = $true\n\t}\n}\n\nfunction Add-FeatureControl\n{\n\t[CmdletBinding()]\n\tparam\n\t(\n\t\t[Parameter(\n\t\t\tMandatory = $true,\n\t\t\tValueFromPipeline = $true\n\t\t)]\n\t\t[ValidateNotNull()]\n\t\t$Feature\n\t)\n\n\tprocess {\n\n\t\t$StackPanel = New-Object -TypeName System.Windows.Controls.StackPanel\n\n\t\t$CheckBox = New-Object -TypeName System.Windows.Controls.CheckBox\n\t\t$CheckBox.Add_Click({Get-CheckboxClicked -CheckBox $_.Source})\n\t\t$Checkbox.Content = $Feature.DisplayName\n\t\tif ($Feature.Description){\n\t\t\t$CheckBox.ToolTip = $Feature.Description\n\t\t}\n\t\t$Checkbox.IsChecked = $False\n\t\t[void]$StackPanel.Children.Add($CheckBox)\n\n\t\t[void]$PanelContainer.Children.Add($StackPanel)\n\t}\n\n}\n\n$Window.Add_Loaded({$Items | Add-FeatureControl})\n\n$Button.Content = $ButtonName\n$Button.Add_Click({\n\t[void]$Window.Close()\n\n\t$ToReturn.Add($SelectedFeatures.DisplayName)\n})\n\n$Window.Title = $Title\n\n# ty chrissy <3 https://blog.netnerds.net/2016/01/adding-toolbar-icons-to-your-powershell-wpf-guis/\n$base64 = \"iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAMAAADyHTlpAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAPUExURQAAAP///+vr6+fn5wAAAD8IT84AAAAFdFJOU/////8A+7YOUwAAAAlwSFlzAAALEwAACxMBAJqcGAAAANBJREFUSEut08ESgjAMRVFQ/v+bDbxLm9Q0lRnvQtrkDBt1O4a2FoNWHIBajJW/sQ+xOnNnlkMsrXZkkwRolHHaTXiUYfS5SOgXKfuQci0T5bLoIeWYt/O0FnTfu62pyW5X7/S26D/yFca19AvBXMaVbrnc3n6p80QGq9NUOqtnIRshhi7/ffHeK0a94TfQLQPX+HO5LVef0cxy8SX/gokU/bIcQvxjB5t1qYd0aYWuz4XF6FHam/AsLKDTGWZpuWNqWZ358zdmrOLNAlkM6Dg+78AGkhvs7wgAAAAASUVORK5CYII=\"\n \n \n# Create a streaming image by streaming the base64 string to a bitmap streamsource\n$bitmap = New-Object System.Windows.Media.Imaging.BitmapImage\n$bitmap.BeginInit()\n$bitmap.StreamSource = [System.IO.MemoryStream][System.Convert]::FromBase64String($base64)\n$bitmap.EndInit()\n$bitmap.Freeze()\n\n \n# This is the toolbar icon and description\n$Form.TaskbarItemInfo.Overlay = $bitmap\n$Form.TaskbarItemInfo.Description = $window.Title\n\n$Window.Add_Closing({[System.Windows.Forms.Application]::Exit()})\n\n$Form.Show()\n\n# This makes it pop up\n$Form.Activate() | Out-Null\n \n# Create an application context for it to all run within. \n# This helps with responsiveness and threading.\n$appContext = New-Object System.Windows.Forms.ApplicationContext\n[void][System.Windows.Forms.Application]::Run($appContext) \nreturn $ToReturn\n}\n#using namespace System.Management.Automation # this can't be a function but whatever, it doesn't slow down anything\n# Author:\tCollin Chaffin\n# License: MIT (https://github.com/CollinChaffin/psNGENposh/blob/master/LICENSE)\nfunction Invoke-NGENposh {\n<#\n\t.SYNOPSIS\n\t\tThis Powershell function performs various SYNCHRONOUS ngen functions\n\t\n\t.DESCRIPTION\n\t\tThis Powershell function performs various SYNCHRONOUS ngen functions\n\t\n\t\tSince the purpose of this module is to for interactive use,\n\t\tI intentionally did not include any \"Queue\" options.\n\t\n\t.PARAMETER All\n\t\tRegenerate cache for all system assemblies\n\t\n\t.PARAMETER Force\n\t\tInvoke ngen on currently loaded assembles (ensure up to date even if cached)\n\t\n\t.EXAMPLE\n\t\tTo invoke ngen on currently loaded assembles, skipping those already generated:\n\n\t\tPS C:\\> Invoke-NGENposh\n\t\n\t.EXAMPLE\t\n\t\tTo invoke ngen on currently loaded assembles (ensure up to date even if cached):\n\n\t\tPS C:\\> Invoke-NGENposh -Force\n\t\n\t.EXAMPLE\t\n\t\tTo invoke ngen to regenerate cache for all system assemblies (*SEE WARNING BELOW**):\n\n\t\tPS C:\\> Invoke-NGENposh -All\n\t\n\t.NOTES\n\t\t **WARNING: The '-All' switch since the execution is SYNCHRONOUS will\n\t\t\t\t\ttake considerable time, and literally regenerate all the\n\t\t\t\t\tglobal assembly cache.  There should theoretically be no\n\t\t\t\t\tdownside to this, but bear in mind other than time (and cpu)\n\t\t\t\t\tthat since all the generated cache files are new, any\n\t\t\t\t\tsystem backups will consider those files as new and may\n\t\t\t\t\tlikely cause your next incremental backup to be much larger\n#>\n\tparam\n\t(\n\t\t[switch]$All,\n\t\t[switch]$Force,\n\t\t[switch]$Confirm\n\t)\n\n\tif (!$Confirm){\n\t\tWrite-Host \"Press enter to continue and start using NGENPosh, or press CTRL+C to cancel\"\n\t\tpause\n\t}\n    \n# INTERNAL HELPER\nfunction Write-InfoInColor\n{\n\t[CmdletBinding()]\n\tparam\n\t(\n\t\t[Parameter(Mandatory = $true)]\n\t\t[ValidateNotNullOrEmpty()]\n\t\t[String]$Message,\n\t\t[Parameter(Mandatory = $false)]\n\t\t[ValidateNotNullOrEmpty()]\n\t\t[System.ConsoleColor[]]$Background = $Host.UI.RawUI.BackgroundColor,\n\t\t[Parameter(Mandatory = $false)]\n\t\t[ValidateNotNullOrEmpty()]\n\t\t[System.ConsoleColor[]]$Foreground = $Host.UI.RawUI.ForegroundColor,\n\t\t[Switch]$NoNewline\n\t)\n\t\n\t[HostInformationMessage]$outMessage = @{\n\t\tMessage\t\t\t     = $Message\n\t\tForegroundColor\t     = $Foreground\n\t\tBackgroundColor\t     = $Background\n\t\tNoNewline\t\t     = $NoNewline\n\t}\n\tWrite-Information $outMessage -InformationAction Continue\n}\n\t\n\tWrite-InfoInColor \"`n===================================================================================\" -Foreground 'DarkCyan'\n\tWrite-InfoInColor \"                             BEGINNING TO NGEN                                     \" -Foreground 'Cyan'\n\tWrite-InfoInColor \"===================================================================================`n\" -Foreground 'DarkCyan'\n\t\n\tSet-Alias ngenpsh (Join-Path ([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) ngen.exe) -Force\n\t\n\tif ($All)\n\t{\n\t\tWrite-InfoInColor \"EXECUTING GLOBAL NGEN`n`n\" -Foreground 'Cyan'\n\t\tngenpsh update /nologo /force\n\t}\n\telse\n\t{\n\t\tWrite-InfoInColor \"EXECUTING TARGETED NGEN`n`n\" -Foreground 'Cyan'\n\t\t\n\t\t[AppDomain]::CurrentDomain.GetAssemblies() |\n\t\tForEach-Object {\n\t\t\tif ($_.Location)\n\t\t\t{\n\t\t\t\t$Name = (Split-Path $_.location -leaf)\n\t\t\t\tif ((!($Force)) -and [System.Runtime.InteropServices.RuntimeEnvironment]::FromGlobalAccessCache($_))\n\t\t\t\t{\n\t\t\t\t\tWrite-InfoInColor \"[SKIPPED]\" -Foreground 'Yellow' -NoNewLine\n\t\t\t\t\tWrite-InfoInColor \" :: \" -Foreground 'White' -NoNewline\n\t\t\t\t\tWrite-InfoInColor \"[ $Name ]\" -Foreground 'Cyan'\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tngenpsh install $_.location /nologo | ForEach-Object {\n\t\t\t\t\t\tif ($?)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tWrite-InfoInColor \"[SUCCESS]\" -Foreground 'Green' -NoNewLine\n\t\t\t\t\t\t\tWrite-InfoInColor \" :: \" -Foreground 'White' -NoNewline\n\t\t\t\t\t\t\tWrite-InfoInColor \"[ $Name ]\" -Foreground 'Cyan'\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tWrite-InfoInColor \"[FAILURE]\" -Foreground 'Red' -NoNewLine\n\t\t\t\t\t\t\tWrite-InfoInColor \" :: \" -Foreground 'White' -NoNewline\n\t\t\t\t\t\t\tWrite-InfoInColor \"[ $Name ]\" -Foreground 'Cyan'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tWrite-InfoInColor \"`n===================================================================================\" -Foreground 'DarkCyan'\n\tWrite-InfoInColor \"                               COMPLETED NGEN                                      \" -Foreground 'Cyan'\n\tWrite-InfoInColor \"===================================================================================`n\" -Foreground 'DarkCyan'\n}\n\n\n\nfunction Invoke-Registry {\n    [alias('ireg')]\n    param(\n        [Parameter(\n            Position = 0,\n            Mandatory=$true,\n            ValueFromPipeline = $true\n            )\n        ][Array]$Path,\n\n        [Parameter(\n            Position = 1,\n            Mandatory=$true\n            )\n        ][HashTable]$HashTable\n        \n    )\n\n    Process {\n        \"doing $path\"\n        $Path = \"REGISTRY::$($Path -replace 'REGISTRY::','')\"\n        \"now its $path\"\n        if (-Not(Test-Path -LiteralPath $Path)){\n\n            New-Item -ItemType Key -Path $Path -Force\n        }\n\n        ForEach($Key in $HashTable.Keys){\n\n            Set-ItemProperty -LiteralPath $Path -Name $Key -Value $HashTable.$Key\n        }\n    }\n}\n\nfunction IsCustomISO {\n    switch (\n        Get-ItemProperty \"REGISTRY::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\OEMInformation\"\n    ){\n        {$_.SupportURL -Like \"https://atlasos.net*\"}{return 'AtlasOS'}\n        {$_.Manufacturer -eq \"Revision\"}{return 'Revision'}\n        {$_.Manufacturer -eq \"ggOS\"}{return 'ggOS'}\n    }\n    return $False\n}\n\n# https://github.com/chrisseroka/ps-menu\nfunction Menu {\n    param ([array]$menuItems, [switch]$ReturnIndex=$false, [switch]$Multiselect)\n\nfunction DrawMenu {\n    param ($menuItems, $menuPosition, $Multiselect, $selection)\n    $l = $menuItems.length\n    for ($i = 0; $i -le $l;$i++) {\n\t\tif ($menuItems[$i] -ne $null){\n\t\t\t$item = $menuItems[$i]\n\t\t\tif ($Multiselect)\n\t\t\t{\n\t\t\t\tif ($selection -contains $i){\n\t\t\t\t\t$item = '[x] ' + $item\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$item = '[ ] ' + $item\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($i -eq $menuPosition) {\n\t\t\t\tWrite-Host \"> $($item)\" -ForegroundColor Green\n\t\t\t} else {\n\t\t\t\tWrite-Host \"  $($item)\"\n\t\t\t}\n\t\t}\n    }\n}\n\nfunction Toggle-Selection {\n\tparam ($pos, [array]$selection)\n\tif ($selection -contains $pos){ \n\t\t$result = $selection | where {$_ -ne $pos}\n\t}\n\telse {\n\t\t$selection += $pos\n\t\t$result = $selection\n\t}\n\t$result\n}\n\n    $vkeycode = 0\n    $pos = 0\n    $selection = @()\n    if ($menuItems.Length -gt 0)\n\t{\n\t\ttry {\n\t\t\t[console]::CursorVisible=$false #prevents cursor flickering\n\t\t\tDrawMenu $menuItems $pos $Multiselect $selection\n\t\t\tWhile ($vkeycode -ne 13 -and $vkeycode -ne 27) {\n\t\t\t\t$press = $host.ui.rawui.readkey(\"NoEcho,IncludeKeyDown\")\n\t\t\t\t$vkeycode = $press.virtualkeycode\n\t\t\t\tIf ($vkeycode -eq 38 -or $press.Character -eq 'k') {$pos--}\n\t\t\t\tIf ($vkeycode -eq 40 -or $press.Character -eq 'j') {$pos++}\n\t\t\t\tIf ($vkeycode -eq 36) { $pos = 0 }\n\t\t\t\tIf ($vkeycode -eq 35) { $pos = $menuItems.length - 1 }\n\t\t\t\tIf ($press.Character -eq ' ') { $selection = Toggle-Selection $pos $selection }\n\t\t\t\tif ($pos -lt 0) {$pos = 0}\n\t\t\t\tIf ($vkeycode -eq 27) {$pos = $null }\n\t\t\t\tif ($pos -ge $menuItems.length) {$pos = $menuItems.length -1}\n\t\t\t\tif ($vkeycode -ne 27)\n\t\t\t\t{\n\t\t\t\t\t$startPos = [System.Console]::CursorTop - $menuItems.Length\n\t\t\t\t\t[System.Console]::SetCursorPosition(0, $startPos)\n\t\t\t\t\tDrawMenu $menuItems $pos $Multiselect $selection\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\t[System.Console]::SetCursorPosition(0, $startPos + $menuItems.Length)\n\t\t\t[console]::CursorVisible = $true\n\t\t}\n\t}\n\telse {\n\t\t$pos = $null\n\t}\n\n    if ($ReturnIndex -eq $false -and $pos -ne $null)\n\t{\n\t\tif ($Multiselect){\n\t\t\treturn $menuItems[$selection]\n\t\t}\n\t\telse {\n\t\t\treturn $menuItems[$pos]\n\t\t}\n\t}\n\telse \n\t{\n\t\tif ($Multiselect){\n\t\t\treturn $selection\n\t\t}\n\t\telse {\n\t\t\treturn $pos\n\t\t}\n\t}\n}\n\n\n<#\n$Original = @{\n    lets = 'go'\n    Sub = @{\n      Foo =  'bar'\n      big = 'ya'\n    }\n    finish = 'fish'\n}\n$Patch = @{\n    lets = 'arrive'\n    Sub = @{\n      Foo =  'baz'\n    }\n    finish ='cum'\n    New=\"Ye\"\n}\n#>\nfunction Merge-Hashtables {\n    param(\n        $Original,\n        $Patch\n    )\n    $Merged = @{} # Final Merged settings\n\n    if (!$Original){$Original = @{}}\n\n    if ($Original.GetType().Name -in 'PSCustomObject','PSObject'){\n        $Temp = [ordered]@{}\n        $Original.PSObject.Properties | ForEach-Object { $Temp[$_.Name] = $_.Value }\n        $Original = $Temp\n        Remove-Variable Temp #fck temp vars\n    }\n\n    foreach ($Key in [object[]]$Original.Keys) {\n\n        if ($Original.$Key -is [HashTable]){\n            $Merged.$Key += [HashTable](Merge-Hashtables $Original.$Key $Patch.$Key)\n            continue\n        }\n\n        if ($Patch.$Key -and !$Merged.$Key){ # If the setting exists in the patch\n            $Merged.Remove($Key)\n            if ($Original.$Key -ne $Patch.$Key){\n                Write-Verbose \"Changing $Key from $($Original.$Key) to $($Patch.$Key)\"\n            }\n            $Merged += @{$Key = $Patch.$Key} # Then add it to the final settings\n        }else{ # Else put in the unchanged normal setting\n            $Merged += @{$Key = $Original.$Key}\n        }\n    }\n\n    ForEach ($Key in [object[]]$Patch.Keys) {\n        if ($Patch.$Key -is [HashTable] -and ($Key -NotIn $Original.Keys)){\n            $Merged.$Key += [HashTable](Merge-Hashtables $Original.$Key $Patch.$Key)\n            continue\n        }\n        if ($Key -NotIn $Original.Keys){\n            $Merged.$Key += $Patch.$Key\n        }\n    }\n\n    return $Merged\n}\n\n<# Here's some example hashtables you can mess with:\n\n$Original = [Ordered]@{ # Original settings\n    potato = $true\n    avocado = $false\n}\n\n$Patch = @{ # Fixes\n    avocado = $true\n}\n\n\nfunction Merge-Hashtables {\n    param(\n        [Switch]$ShowDiff,\n        $Original,\n        $Patch\n    )\n\n    if (!$Original){$Original = @{}}\n\n    if ($Original.GetType().Name -in 'PSCustomObject','PSObject'){\n        $Temp = [ordered]@{}\n        $Original.PSObject.Properties | ForEach-Object { $Temp[$_.Name] = $_.Value }\n        $Original = $Temp\n        Remove-Variable Temp #fck temp vars\n    }\n\n    $Merged = @{} # Final Merged settings\n\n    foreach($Key in $Original.Keys){ # Loops through all OG settings\n        $Merging = $True\n\n        if ($Patch.$Key){ # If the setting exists in the new settings\n            $Merged += @{$Key = $Patch.$Key} # Then add it to the final settings\n        }else{ # Else put in the normal settings\n            $Merged += @{$Key = $Original.$Key}\n        }\n    }\n    foreach($key in $Patch.Keys){ # If Patch has hashtables that Original does not\n        if (!$Merged.$key){\n            $Merged += @{$key = $Patch.$key}\n        }\n    }\n\n    if (!$Merging){$Merged = $Patch} # If no settings were merged (empty $Original), completely overwrite\n    return $Merged\n}\n\n#>\nfunction New-Shortcut {\n    param(\n        [Switch]$Admin,\n        [Switch]$Overwrite,\n        [String]$LnkPath,\n        [String]$TargetPath,\n        [String]$Arguments,\n        [String]$Icon\n    )\n\n    if ($Overwrite){\n        if (Test-Path $LnkPath){\n            Remove-Item $LnkPath\n        }\n    }\n\n    $WScriptShell = New-Object -ComObject WScript.Shell\n    $Shortcut = $WScriptShell.CreateShortcut($LnkPath)\n    $Shortcut.TargetPath = $TargetPath\n    if ($Arguments){\n        $Shortcut.Arguments = $Arguments\n    }\n    if ($Icon){\n        $Shortcut.IconLocation = $Icon\n    }\n\n    $Shortcut.Save()\n    if ((Get-Item $LnkPath).FullName -cne $LnkPath){\n        Rename-Item $LnkPath -NewName (Get-Item $LnkPath).Name # Shortcut names are always underscore\n    }\n\n    if ($Admin){\n    \n        $bytes = [System.IO.File]::ReadAllBytes($LnkPath)\n        $bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON\n        [System.IO.File]::WriteAllBytes($LnkPath, $bytes)\n    }\n}\nfunction PauseNul {\n    $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') | Out-Null\n}\n<# This function messes with the message that appears before the commands you type\n\n# Turns:\nPS D:\\Scoop>\n# into\nTL D:\\Scoop>\n\nTo indicate TweakList has been imported\n\nYou can prevent this from happening by setting the environment variable TL_NOPROMPT to 1\n#>\n$global:CSI = [char] 27 + '['\nif (!$env:TL_NOPROMPT -and !$TL_NOPROMPT){\n    function global:prompt {\n            \"$CSI`97;7mTL$CSI`m $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) \";\n    }\n}\n\nfunction Set-Choice { # Converts passed string to an array of chars\n    param(\n        [char[]]$Letters = \"YN\"\n    )\n    While ($Key -NotIn $Letters){\n        [char]$Key = $host.UI.RawUI.ReadKey([System.Management.Automation.Host.ReadKeyOptions]'NoEcho, IncludeKeyDown').Character\n        if (($Key -NotIn $Letters) -and !$IsLinux){\n                [Console]::Beep(500,300)\n        }\n    }\n    return $Key\n}\nfunction Set-Title {\n    param(\n        $Title\n    )\n    $Host.UI.RawUI.WindowTitle = \"TweakList - $Title\"\n}\n\nfunction Set-Verbosity {\n    [alias('Verbose','Verb')]\n    param (\n\n\t\t[Parameter(Mandatory = $true,ParameterSetName = \"Enabled\")]\n        [switch]$Enabled,\n\n\t\t[Parameter(Mandatory = $true,ParameterSetName = \"Disabled\")]\n\t\t[switch]$Disabled\n\t)\n    \n    switch ($PSCmdlet.ParameterSetName){\n        \"Enabled\" {\n            $script:Verbose = $True\n            $script:VerbosePreference = 'Continue'\n        }\n        \"Disabled\" {\n            $script:Verbose = $True\n            $script:VerbosePreference = 'SilentlyContinue'\n        }\n    }\n}\nfunction Test-Admin {\n    [CmdletBinding()]\n    param ()\n    \n    if ($IsLinux -or $IsMacOS) {\n        # If sudo-ing or logged on as root, returns user ID 0\n        $idCmd = (Get-Command -Name id).Source\n        [int64] $idResult = & $idCmd -u\n        $idResult -eq 0\n    }\n    else {\n        $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()\n        (New-Object -TypeName Security.Principal.WindowsPrincipal -ArgumentList $currentUser).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)\n    }\n}\nfunction Write-Color {\n    # Ported to PowerShell from an old version of https://github.com/atzuur/colors\n    param(\n        [String]$Message\n    )\n    $E = [char]0x1b\n    $Presets = [Ordered]@{\n        '&RESET'   =\"$E[0m\"\n        '&BOLD'    =\"$E[1m\"\n        '&ITALIC'  =\"$E[3m\"\n        '&URL'     =\"$E[4m\"\n        '&BLINK'   =\"$E[5m\"\n        '&ALTBLINK'=\"$E[6m\"\n        '&SELECTED'=\"$E[7m\"\n        '@BLACK'   =\"$E[30m\"\n        '@RED'     =\"$E[31m\"\n        '@GREEN'   =\"$E[32m\"\n        '@YELLOW'  =\"$E[33m\"\n        '@BLUE'    =\"$E[34m\"\n        '@VIOLET'  =\"$E[35m\"\n        '@BEIGE'   =\"$E[36m\"\n        '@WHITE'   =\"$E[37m\"\n        '@GREY'    =\"$E[90m\"\n        '@LRED'    =\"$E[91m\"\n        '@LGREEN'  =\"$E[92m\"\n        '@LYELLOW' =\"$E[93m\"\n        '@LBLUE'   =\"$E[94m\"\n        '@LVIOLET' =\"$E[95m\"\n        '@LBEIGE'  =\"$E[96m\"\n        '@LWHITE'  =\"$E[97m\"\n        '%BLACK'   =\"$E[40m\"\n        '%RED'     =\"$E[41m\"\n        '%GREEN'   =\"$E[42m\"\n        '%YELLOW'  =\"$E[43m\"\n        '%BLUE'    =\"$E[44m\"\n        '%VIOLET'  =\"$E[45m\"\n        '%BEIGE'   =\"$E[46m\"\n        '%WHITE'   =\"$E[47m\"\n        '%GREY'    =\"$E[100m\"\n        '%LRED'    =\"$E[101m\"\n        '%LGREEN'  =\"$E[102m\"\n        '%LYELLOW' =\"$E[103m\"\n        '%LBLUE'   =\"$E[104m\"\n        '%LVIOLET' =\"$E[105m\"\n        '%LBEIGE'  =\"$E[106m\"\n        '%LWHITE'  =\"$E[107m\"\n    }\n    Foreach($Pattern in $Presets.Keys){\n        $Message = $Message -replace $Pattern, $Presets.$Pattern\n    }\n    return $Message + $Presets.'$RESET'\n}\n\nfunction Write-Diff {\n\tparam(\n\t[String]$Message,\n\t[Boolean]$Positivity,\n\t[String]$Term\n\t)\n\t$E = [char]0x1b # Ansi ESC character\n\n\tif ($Positivity){\n\t\t$Sign = '+'\n\t\t$Accent = \"$E[92m\"\n\t\tif (!$Term){\n\t\t$Term = \"Enabled\"\n\t\t}\n\t}\n\telseif(!$Positivity){\n\t\t$Sign = '-'\n\t\tif (!$Term){\n\t\t\t$Term = \"Removed\"\n\t\t}\n\t\t$Accent = \"$E[91m\"\n\t}\n\n\t$Gray = \"$E[90m\"\n\t$Reset = \"$E[0m\"\n\n\tWrite-Host \"  $Gray[$Accent$Sign$Gray]$Reset $Term $Accent$Message\"\n \n}\n\n\nfunction Write-Menu {\n    <#\n        By QuietusPlus on GitHub: https://github.com/QuietusPlus/Write-Menu\n\n        .SYNOPSIS\n            Outputs a command-line menu which can be navigated using the keyboard.\n\n        .DESCRIPTION\n            Outputs a command-line menu which can be navigated using the keyboard.\n\n            * Automatically creates multiple pages if the entries cannot fit on-screen.\n            * Supports nested menus using a combination of hashtables and arrays.\n            * No entry / page limitations (apart from device performance).\n            * Sort entries using the -Sort parameter.\n            * -MultiSelect: Use space to check a selected entry, all checked entries will be invoked / returned upon confirmation.\n            * Jump to the top / bottom of the page using the \"Home\" and \"End\" keys.\n            * \"Scrolling\" list effect by automatically switching pages when reaching the top/bottom.\n            * Nested menu indicator next to entries.\n            * Remembers parent menus: Opening three levels of nested menus means you have to press \"Esc\" three times.\n\n            Controls             Description\n            --------             -----------\n            Up                   Previous entry\n            Down                 Next entry\n            Left / PageUp        Previous page\n            Right / PageDown     Next page\n            Home                 Jump to top\n            End                  Jump to bottom\n            Space                Check selection (-MultiSelect only)\n            Enter                Confirm selection\n            Esc / Backspace      Exit / Previous menu\n\n        .EXAMPLE\n            PS C:\\>$menuReturn = Write-Menu -Title 'Menu Title' -Entries @('Menu Option 1', 'Menu Option 2', 'Menu Option 3', 'Menu Option 4')\n\n            Output:\n\n              Menu Title\n\n               Menu Option 1\n               Menu Option 2\n               Menu Option 3\n               Menu Option 4\n\n        .EXAMPLE\n            PS C:\\>$menuReturn = Write-Menu -Title 'AppxPackages' -Entries (Get-AppxPackage).Name -Sort\n\n            This example uses Write-Menu to sort and list app packages (Windows Store/Modern Apps) that are installed for the current profile.\n\n        .EXAMPLE\n            PS C:\\>$menuReturn = Write-Menu -Title 'Advanced Menu' -Sort -Entries @{\n                'Command Entry' = '(Get-AppxPackage).Name'\n                'Invoke Entry' = '@(Get-AppxPackage).Name'\n                'Hashtable Entry' = @{\n                    'Array Entry' = \"@('Menu Option 1', 'Menu Option 2', 'Menu Option 3', 'Menu Option 4')\"\n                }\n            }\n\n            This example includes all possible entry types:\n\n            Command Entry     Invoke without opening as nested menu (does not contain any prefixes)\n            Invoke Entry      Invoke and open as nested menu (contains the \"@\" prefix)\n            Hashtable Entry   Opened as a nested menu\n            Array Entry       Opened as a nested menu\n\n        .NOTES\n            Write-Menu by QuietusPlus (inspired by \"Simple Textbased Powershell Menu\" [Michael Albert])\n\n        .LINK\n            https://quietusplus.github.io/Write-Menu\n\n        .LINK\n            https://github.com/QuietusPlus/Write-Menu\n    #>\n\n    [CmdletBinding()]\n\n    <#\n        Parameters\n    #>\n\n    param(\n        # Array or hashtable containing the menu entries\n        [Parameter(Mandatory=$true, ValueFromPipeline = $true)]\n        [ValidateNotNullOrEmpty()]\n        [Alias('InputObject')]\n        $Entries,\n\n        # Title shown at the top of the menu.\n        [Parameter(ValueFromPipelineByPropertyName = $true)]\n        [Alias('Name')]\n        [string]\n        $Title,\n\n        # Sort entries before they are displayed.\n        [Parameter()]\n        [switch]\n        $Sort,\n\n        # Select multiple menu entries using space, each selected entry will then get invoked (this will disable nested menu's).\n        [Parameter()]\n        [switch]\n        $MultiSelect\n    )\n\n    <#\n        Configuration\n    #>\n\n    # Entry prefix, suffix and padding\n    $script:cfgPrefix = ' '\n    $script:cfgPadding = 2\n    $script:cfgSuffix = ' '\n    $script:cfgNested = ' >'\n\n    # Minimum page width\n    $script:cfgWidth = 30\n\n    # Hide cursor\n    [System.Console]::CursorVisible = $false\n\n    # Save initial colours\n    $script:colorForeground = [System.Console]::ForegroundColor\n    $script:colorBackground = [System.Console]::BackgroundColor\n\n    <#\n        Checks\n    #>\n\n    # Check if entries has been passed\n    if ($Entries -like $null) {\n        Write-Error \"Missing -Entries parameter!\"\n        return\n    }\n\n    # Check if host is console\n    if ($host.Name -ne 'ConsoleHost') {\n        Write-Error \"[$($host.Name)] Cannot run inside current host, please use a console window instead!\"\n        return\n    }\n\n    <#\n        Set-Color\n    #>\n\n    function Set-Color ([switch]$Inverted) {\n        switch ($Inverted) {\n            $true {\n                [System.Console]::ForegroundColor = $colorBackground\n                [System.Console]::BackgroundColor = $colorForeground\n            }\n            Default {\n                [System.Console]::ForegroundColor = $colorForeground\n                [System.Console]::BackgroundColor = $colorBackground\n            }\n        }\n    }\n\n    <#\n        Get-Menu\n    #>\n\n    function Get-Menu ($script:inputEntries) {\n        # Clear console\n        Clear-Host\n\n        # Check if -Title has been provided, if so set window title, otherwise set default.\n        if ($Title -notlike $null) {\n            #$host.UI.RawUI.WindowTitle = $Title # DISABLED FOR TWEAKLIST\n            $script:menuTitle = \"$Title\"\n        } else {\n            $script:menuTitle = 'Menu'\n        }\n\n        # Set menu height\n        $script:pageSize = ($host.UI.RawUI.WindowSize.Height - 5)\n\n        # Convert entries to object\n        $script:menuEntries = @()\n        switch ($inputEntries.GetType().Name) {\n            'String' {\n                # Set total entries\n                $script:menuEntryTotal = 1\n                # Create object\n                $script:menuEntries = New-Object PSObject -Property @{\n                    Command = ''\n                    Name = $inputEntries\n                    Selected = $false\n                    onConfirm = 'Name'\n                }; break\n            }\n            'Object[]' {\n                # Get total entries\n                $script:menuEntryTotal = $inputEntries.Length\n                # Loop through array\n                foreach ($i in 0..$($menuEntryTotal - 1)) {\n                    # Create object\n                    $script:menuEntries += New-Object PSObject -Property @{\n                        Command = ''\n                        Name = $($inputEntries)[$i]\n                        Selected = $false\n                        onConfirm = 'Name'\n                    }; $i++\n                }; break\n            }\n            'Hashtable' {\n                # Get total entries\n                $script:menuEntryTotal = $inputEntries.Count\n                # Loop through hashtable\n                foreach ($i in 0..($menuEntryTotal - 1)) {\n                    # Check if hashtable contains a single entry, copy values directly if true\n                    if ($menuEntryTotal -eq 1) {\n                        $tempName = $($inputEntries.Keys)\n                        $tempCommand = $($inputEntries.Values)\n                    } else {\n                        $tempName = $($inputEntries.Keys)[$i]\n                        $tempCommand = $($inputEntries.Values)[$i]\n                    }\n\n                    # Check if command contains nested menu\n                    if ($tempCommand.GetType().Name -eq 'Hashtable') {\n                        $tempAction = 'Hashtable'\n                    } elseif ($tempCommand.Substring(0,1) -eq '@') {\n                        $tempAction = 'Invoke'\n                    } else {\n                        $tempAction = 'Command'\n                    }\n\n                    # Create object\n                    $script:menuEntries += New-Object PSObject -Property @{\n                        Name = $tempName\n                        Command = $tempCommand\n                        Selected = $false\n                        onConfirm = $tempAction\n                    }; $i++\n                }; break\n            }\n            Default {\n                Write-Error \"Type `\"$($inputEntries.GetType().Name)`\" not supported, please use an array or hashtable.\"\n                exit\n            }\n        }\n\n        # Sort entries\n        if ($Sort -eq $true) {\n            $script:menuEntries = $menuEntries | Sort-Object -Property Name\n        }\n\n        # Get longest entry\n        $script:entryWidth = ($menuEntries.Name | Measure-Object -Maximum -Property Length).Maximum\n        # Widen if -MultiSelect is enabled\n        if ($MultiSelect) { $script:entryWidth += 4 }\n        # Set minimum entry width\n        if ($entryWidth -lt $cfgWidth) { $script:entryWidth = $cfgWidth }\n        # Set page width\n        $script:pageWidth = $cfgPrefix.Length + $cfgPadding + $entryWidth + $cfgPadding + $cfgSuffix.Length\n\n        # Set current + total pages\n        $script:pageCurrent = 0\n        $script:pageTotal = [math]::Ceiling((($menuEntryTotal - $pageSize) / $pageSize))\n\n        # Insert new line\n        [System.Console]::WriteLine(\"\")\n\n        # Save title line location + write title\n        $script:lineTitle = [System.Console]::CursorTop\n        [System.Console]::WriteLine(\"  $menuTitle\" + \"`n\")\n\n        # Save first entry line location\n        $script:lineTop = [System.Console]::CursorTop\n    }\n\n    <#\n        Get-Page\n    #>\n\n    function Get-Page {\n        # Update header if multiple pages\n        if ($pageTotal -ne 0) { Update-Header }\n\n        # Clear entries\n        for ($i = 0; $i -le $pageSize; $i++) {\n            # Overwrite each entry with whitespace\n            [System.Console]::WriteLine(\"\".PadRight($pageWidth) + ' ')\n        }\n\n        # Move cursor to first entry\n        [System.Console]::CursorTop = $lineTop\n\n        # Get index of first entry\n        $script:pageEntryFirst = ($pageSize * $pageCurrent)\n\n        # Get amount of entries for last page + fully populated page\n        if ($pageCurrent -eq $pageTotal) {\n            $script:pageEntryTotal = ($menuEntryTotal - ($pageSize * $pageTotal))\n        } else {\n            $script:pageEntryTotal = $pageSize\n        }\n\n        # Set position within console\n        $script:lineSelected = 0\n\n        # Write all page entries\n        for ($i = 0; $i -le ($pageEntryTotal - 1); $i++) {\n            Write-Entry $i\n        }\n    }\n\n    <#\n        Write-Entry\n    #>\n\n    function Write-Entry ([int16]$Index, [switch]$Update) {\n        # Check if entry should be highlighted\n        switch ($Update) {\n            $true { $lineHighlight = $false; break }\n            Default { $lineHighlight = ($Index -eq $lineSelected) }\n        }\n\n        # Page entry name\n        $pageEntry = $menuEntries[($pageEntryFirst + $Index)].Name\n\n        # Prefix checkbox if -MultiSelect is enabled\n        if ($MultiSelect) {\n            switch ($menuEntries[($pageEntryFirst + $Index)].Selected) {\n                $true { $pageEntry = \"[X] $pageEntry\"; break }\n                Default { $pageEntry = \"[ ] $pageEntry\" }\n            }\n        }\n\n        # Full width highlight + Nested menu indicator\n        switch ($menuEntries[($pageEntryFirst + $Index)].onConfirm -in 'Hashtable', 'Invoke') {\n            $true { $pageEntry = \"$pageEntry\".PadRight($entryWidth) + \"$cfgNested\"; break }\n            Default { $pageEntry = \"$pageEntry\".PadRight($entryWidth + $cfgNested.Length) }\n        }\n\n        # Write new line and add whitespace without inverted colours\n        [System.Console]::Write(\"`r\" + $cfgPrefix)\n        # Invert colours if selected\n        if ($lineHighlight) { Set-Color -Inverted }\n        # Write page entry\n        [System.Console]::Write(\"\".PadLeft($cfgPadding) + $pageEntry + \"\".PadRight($cfgPadding))\n        # Restore colours if selected\n        if ($lineHighlight) { Set-Color }\n        # Entry suffix\n        [System.Console]::Write($cfgSuffix + \"`n\")\n    }\n\n    <#\n        Update-Entry\n    #>\n\n    function Update-Entry ([int16]$Index) {\n        # Reset current entry\n        [System.Console]::CursorTop = ($lineTop + $lineSelected)\n        Write-Entry $lineSelected -Update\n\n        # Write updated entry\n        $script:lineSelected = $Index\n        [System.Console]::CursorTop = ($lineTop + $Index)\n        Write-Entry $lineSelected\n\n        # Move cursor to first entry on page\n        [System.Console]::CursorTop = $lineTop\n    }\n\n    <#\n        Update-Header\n    #>\n\n    function Update-Header {\n        # Set corrected page numbers\n        $pCurrent = ($pageCurrent + 1)\n        $pTotal = ($pageTotal + 1)\n\n        # Calculate offset\n        $pOffset = ($pTotal.ToString()).Length\n\n        # Build string, use offset and padding to right align current page number\n        $script:pageNumber = \"{0,-$pOffset}{1,0}\" -f \"$(\"$pCurrent\".PadLeft($pOffset))\",\"/$pTotal\"\n\n        # Move cursor to title\n        [System.Console]::CursorTop = $lineTitle\n        # Move cursor to the right\n        [System.Console]::CursorLeft = ($pageWidth - ($pOffset * 2) - 1)\n        # Write page indicator\n        [System.Console]::WriteLine(\"$pageNumber\")\n    }\n\n    <#\n        Initialisation\n    #>\n\n    # Get menu\n    Get-Menu $Entries\n\n    # Get page\n    Get-Page\n\n    # Declare hashtable for nested entries\n    $menuNested = [ordered]@{}\n\n    <#\n        User Input\n    #>\n\n    # Loop through user input until valid key has been pressed\n    do { $inputLoop = $true\n\n        # Move cursor to first entry and beginning of line\n        [System.Console]::CursorTop = $lineTop\n        [System.Console]::Write(\"`r\")\n\n        # Get pressed key\n        $menuInput = [System.Console]::ReadKey($false)\n\n        # Define selected entry\n        $entrySelected = $menuEntries[($pageEntryFirst + $lineSelected)]\n\n        # Check if key has function attached to it\n        switch ($menuInput.Key) {\n            # Exit / Return\n            { $_ -in 'Escape', 'Backspace' } {\n                # Return to parent if current menu is nested\n                if ($menuNested.Count -ne 0) {\n                    $pageCurrent = 0\n                    $Title = $($menuNested.GetEnumerator())[$menuNested.Count - 1].Name\n                    Get-Menu $($menuNested.GetEnumerator())[$menuNested.Count - 1].Value\n                    Get-Page\n                    $menuNested.RemoveAt($menuNested.Count - 1) | Out-Null\n                # Otherwise exit and return $null\n                } else {\n                    Clear-Host\n                    $inputLoop = $false\n                    [System.Console]::CursorVisible = $true\n                    return $null\n                }; break\n            }\n\n            # Next entry\n            'DownArrow' {\n                if ($lineSelected -lt ($pageEntryTotal - 1)) { # Check if entry isn't last on page\n                    Update-Entry ($lineSelected + 1)\n                } elseif ($pageCurrent -ne $pageTotal) { # Switch if not on last page\n                    $pageCurrent++\n                    Get-Page\n                }; break\n            }\n\n            # Previous entry\n            'UpArrow' {\n                if ($lineSelected -gt 0) { # Check if entry isn't first on page\n                    Update-Entry ($lineSelected - 1)\n                } elseif ($pageCurrent -ne 0) { # Switch if not on first page\n                    $pageCurrent--\n                    Get-Page\n                    Update-Entry ($pageEntryTotal - 1)\n                }; break\n            }\n\n            # Select top entry\n            'Home' {\n                if ($lineSelected -ne 0) { # Check if top entry isn't already selected\n                    Update-Entry 0\n                } elseif ($pageCurrent -ne 0) { # Switch if not on first page\n                    $pageCurrent--\n                    Get-Page\n                    Update-Entry ($pageEntryTotal - 1)\n                }; break\n            }\n\n            # Select bottom entry\n            'End' {\n                if ($lineSelected -ne ($pageEntryTotal - 1)) { # Check if bottom entry isn't already selected\n                    Update-Entry ($pageEntryTotal - 1)\n                } elseif ($pageCurrent -ne $pageTotal) { # Switch if not on last page\n                    $pageCurrent++\n                    Get-Page\n                }; break\n            }\n\n            # Next page\n            { $_ -in 'RightArrow','PageDown' } {\n                if ($pageCurrent -lt $pageTotal) { # Check if already on last page\n                    $pageCurrent++\n                    Get-Page\n                }; break\n            }\n\n            # Previous page\n            { $_ -in 'LeftArrow','PageUp' } { # Check if already on first page\n                if ($pageCurrent -gt 0) {\n                    $pageCurrent--\n                    Get-Page\n                }; break\n            }\n\n            # Select/check entry if -MultiSelect is enabled\n            'Spacebar' {\n                if ($MultiSelect) {\n                    switch ($entrySelected.Selected) {\n                        $true { $entrySelected.Selected = $false }\n                        $false { $entrySelected.Selected = $true }\n                    }\n                    Update-Entry ($lineSelected)\n                }; break\n            }\n\n            # Select all if -MultiSelect has been enabled\n            'Insert' {\n                if ($MultiSelect) {\n                    $menuEntries | ForEach-Object {\n                        $_.Selected = $true\n                    }\n                    Get-Page\n                }; break\n            }\n\n            # Select none if -MultiSelect has been enabled\n            'Delete' {\n                if ($MultiSelect) {\n                    $menuEntries | ForEach-Object {\n                        $_.Selected = $false\n                    }\n                    Get-Page\n                }; break\n            }\n\n            # Confirm selection\n            'Enter' {\n                # Check if -MultiSelect has been enabled\n                if ($MultiSelect) {\n                    Clear-Host\n                    # Process checked/selected entries\n                    $menuEntries | ForEach-Object {\n                        # Entry contains command, invoke it\n                        if (($_.Selected) -and ($_.Command -notlike $null) -and ($entrySelected.Command.GetType().Name -ne 'Hashtable')) {\n                            Invoke-Expression -Command $_.Command\n                        # Return name, entry does not contain command\n                        } elseif ($_.Selected) {\n                            return $_.Name\n                        }\n                    }\n                    # Exit and re-enable cursor\n                    $inputLoop = $false\n                    [System.Console]::CursorVisible = $true\n                    break\n                }\n\n                # Use onConfirm to process entry\n                switch ($entrySelected.onConfirm) {\n                    # Return hashtable as nested menu\n                    'Hashtable' {\n                        $menuNested.$Title = $inputEntries\n                        $Title = $entrySelected.Name\n                        Get-Menu $entrySelected.Command\n                        Get-Page\n                        break\n                    }\n\n                    # Invoke attached command and return as nested menu\n                    'Invoke' {\n                        $menuNested.$Title = $inputEntries\n                        $Title = $entrySelected.Name\n                        Get-Menu $(Invoke-Expression -Command $entrySelected.Command.Substring(1))\n                        Get-Page\n                        break\n                    }\n\n                    # Invoke attached command and exit\n                    'Command' {\n                        Clear-Host\n                        Invoke-Expression -Command $entrySelected.Command\n                        $inputLoop = $false\n                        [System.Console]::CursorVisible = $true\n                        break\n                    }\n\n                    # Return name and exit\n                    'Name' {\n                        Clear-Host\n                        return $entrySelected.Name\n                        $inputLoop = $false\n                        [System.Console]::CursorVisible = $true\n                    }\n                }\n            }\n        }\n    } while ($inputLoop)\n}\n\nFunction ConvertFrom-VDF {\n<# \n.Synopsis \n    Reads a Valve Data File (VDF) formatted string into a custom object.\n\n.Description \n    The ConvertFrom-VDF cmdlet converts a VDF-formatted string to a custom object (PSCustomObject) that has a property for each field in the VDF string. VDF is used as a textual data format for Valve software applications, such as Steam.\n\n.Parameter InputObject\n    Specifies the VDF strings to convert to PSObjects. Enter a variable that contains the string, or type a command or expression that gets the string. \n\n.Example \n    $vdf = ConvertFrom-VDF -InputObject (Get-Content \".\\SharedConfig.vdf\")\n\n    Description \n    ----------- \n    Gets the content of a VDF file named \"SharedConfig.vdf\" in the current location and converts it to a PSObject named $vdf\n\n.Inputs \n    System.String\n\n.Outputs \n    PSCustomObject\n\n\n#>\n    param\n    (\n        [Parameter(Position=0, Mandatory=$true)]\n        [AllowEmptyString()]\n        [String[]]\n        $InputObject\n    )\n\n    $root = New-Object -TypeName PSObject\n    $chain = [ordered]@{}\n    $depth = 0\n    $parent = $root\n    $element = $null\n\n    #Magic PowerShell Switch Enumrates Arrays\n    switch -Regex ($InputObject) {\n        #Case: ValueKey\n        '^\\t*\"(\\S+)\"\\t\\t\"(.+)\"$' {\n            Add-Member -InputObject $element -MemberType NoteProperty -Name $Matches[1] -Value $Matches[2]\n            continue\n        }\n        #Case: ParentKey\n        '^\\t*\"(\\S+)\"$' { \n            $element = New-Object -TypeName PSObject\n            Add-Member -InputObject $parent -MemberType NoteProperty -Name $Matches[1] -Value $element\n            continue\n        }\n        #Case: Opening ParentKey Scope\n        '^\\t*{$' {\n            $parent = $element\n            $chain.Add($depth, $element)\n            $depth++\n            continue\n        }\n        #Case: Closing ParentKey Scope\n        '^\\t*}$' {\n            $depth--\n            $parent = $chain.($depth - 1)\n            $element = $parent\n            $chain.Remove($depth)\n            continue\n        }\n        #Case: Comments or unsupported lines\n        Default {\n            Write-Debug \"Ignored line: $_\"\n            continue\n        }\n    }\n\n    return $root\n}\n\nFunction ConvertTo-VDF\n{\n<# \n.Synopsis \n    Converts a custom object into a Valve Data File (VDF) formatted string.\n\n.Description \n    The ConvertTo-VDF cmdlet converts any object to a string in Valve Data File (VDF) format. The properties are converted to field names, the field values are converted to property values, and the methods are removed.\n\n.Parameter InputObject\n    Specifies PSObject to be converted into VDF strings.  Enter a variable that contains the object. You can also pipe an object to ConvertTo-Json.\n\n.Example \n    ConvertTo-VDF -InputObject $VDFObject | Out-File \".\\SharedConfig.vdf\"\n\n    Description \n    ----------- \n    Converts the PS object to VDF format and pipes it into \"SharedConfig.vdf\" in the current directory\n\n.Inputs \n    PSCustomObject\n\n.Outputs \n    System.String\n\n\n#>\n    param\n    (\n        [Parameter(Position=0, Mandatory=$true)]\n        [ValidateNotNullOrEmpty()]\n        [PSObject]\n        $InputObject,\n\n        [Parameter(Position=1, Mandatory=$false)]\n        [int]\n        $Depth = 0\n    )\n    $output = [string]::Empty\n    \n    foreach ( $property in ($InputObject.psobject.Properties) ) {\n        switch ($property.TypeNameOfValue) {\n            \"System.String\" { \n                $output += (\"`t\" * $Depth) + \"`\"\" + $property.Name + \"`\"`t`t`\"\" + $property.Value + \"`\"`n\"\n                break\n            }\n            \"System.Management.Automation.PSCustomObject\" {\n                $element = $property.Value\n                $output += (\"`t\" * $Depth) + \"`\"\" + $property.Name + \"`\"`n\"\n                $output += (\"`t\" * $Depth) + \"{`n\"\n                $output += ConvertTo-VDF -InputObject $element -Depth ($Depth + 1)\n                $output += (\"`t\" * $Depth) + \"}`n\"\n                break\n            }\n            Default {\n                Write-Error (\"Unsupported Property of type {0}\" -f $_) -ErrorAction Stop\n                break\n            }\n        }\n    }\n\n    return $output\n}\n\nfunction Get-SteamGameInstallDir (\n    [Parameter(Mandatory = $true)][string]$Game, \n    [array]$LibraryFolders = (Get-SteamLibraryFolders)) {\n\n    # Get the installation directory of a Steam game.\n    foreach ($LibraryFolder in $LibraryFolders) {\n        $GameInstallDir = \"$LibraryFolder\\steamapps\\common\\$Game\"\n        if (Test-Path \"$($GameInstallDir.ToLower())\") {\n            return \"$GameInstallDir\"\n        }\n    }\n}\nFunction Get-SteamLibraryFolders()\n{\n<#\n.Synopsis \n\tRetrieves library folder paths from .\\SteamApps\\libraryfolders.vdf\n.Description\n\tReads .\\SteamApps\\libraryfolders.vdf to find the paths of all the library folders set up in steam\n.Example \n\t$libraryFolders = Get-LibraryFolders\n\tDescription \n\t----------- \n\tRetrieves a list of the library folders set up in steam\n#>\n\t$steamPath = Get-SteamPath\n\t\n\t$vdfPath = \"$($steamPath)\\SteamApps\\libraryfolders.vdf\"\n\t\n\t[array]$libraryFolderPaths = @()\n\t\n\tif (Test-Path $vdfPath)\n\t{\n\t\t$libraryFolders = ConvertFrom-VDF (Get-Content $vdfPath -Encoding UTF8) | Select-Object -ExpandProperty libraryfolders\n\t\t\n\t\t$libraryFolderIds = $libraryFolders | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name\n\t\t\n\t\tForEach ($libraryId in $libraryFolderIds)\n\t\t{\n\t\t\t$libraryFolder = $libraryFolders.($libraryId)\n\t\t\t\n\t\t\t$libraryFolderPaths += $libraryFolder.path.Replace('\\\\','\\')\n\t\t}\n\t}\n\t\n\treturn $libraryFolderPaths\n}\n\n\nfunction Get-SteamPath {\n    # Get the Steam installation directory.\n\n    $MUICache = \"Registry::HKCR\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache\"\n    $Protocol = \"Registry::HKCR\\steam\\Shell\\Open\\Command\"\n    $Steam = Get-ItemPropertyValue \"Registry::HKCU\\Software\\Valve\\Steam\" -Name \"SteamPath\" -ErrorAction SilentlyContinue\n    \n    # MUICache\n    if (!$Steam) {\n        $Steam = Split-Path (((Get-Item \"$MUICache\").Property | Where-Object { $PSItem -Like \"*Steam*\" } |\n                Where-Object { (Get-ItemPropertyValue \"$MUICache\" -Name $PSItem) -eq \"Steam\" }).TrimEnd(\".FriendlyAppName\"))\n    }\n\n    # Steam Browser Protocol\n    if (!$Steam) {\n        $Steam = Split-Path (((Get-ItemPropertyValue \"$Protocol\" -Name \"(Default)\" -ErrorAction SilentlyContinue) -Split \"--\", 2, \"SimpleMatch\")[0]).Trim('\"')\n    }\n\n    return $Steam.ToLower()\n}\nfunction Get-IniContent {\n    <#\n    .Synopsis\n        Gets the content of an INI file\n\n    .Description\n        Gets the content of an INI file and returns it as a hashtable\n\n    .Notes\n        Author\t\t: Oliver Lipkau <oliver@lipkau.net>\n\t\tSource\t\t: https://github.com/lipkau/PsIni\n                      http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91\n        Version\t\t: 1.0.0 - 2010/03/12 - OL - Initial release\n                      1.0.1 - 2014/12/11 - OL - Typo (Thx SLDR)\n                                              Typo (Thx Dave Stiff)\n                      1.0.2 - 2015/06/06 - OL - Improvment to switch (Thx Tallandtree)\n                      1.0.3 - 2015/06/18 - OL - Migrate to semantic versioning (GitHub issue#4)\n                      1.0.4 - 2015/06/18 - OL - Remove check for .ini extension (GitHub Issue#6)\n                      1.1.0 - 2015/07/14 - CB - Improve round-tripping and be a bit more liberal (GitHub Pull #7)\n                                           OL - Small Improvments and cleanup\n                      1.1.1 - 2015/07/14 - CB - changed .outputs section to be OrderedDictionary\n                      1.1.2 - 2016/08/18 - SS - Add some more verbose outputs as the ini is parsed,\n                      \t\t\t\t            allow non-existent paths for new ini handling,\n                      \t\t\t\t            test for variable existence using local scope,\n                      \t\t\t\t            added additional debug output.\n\n        #Requires -Version 2.0\n\n    .Inputs\n        System.String\n\n    .Outputs\n        System.Collections.Specialized.OrderedDictionary\n\n    .Example\n        $FileContent = Get-IniContent \"C:\\myinifile.ini\"\n        -----------\n        Description\n        Saves the content of the c:\\myinifile.ini in a hashtable called $FileContent\n\n    .Example\n        $inifilepath | $FileContent = Get-IniContent\n        -----------\n        Description\n        Gets the content of the ini file passed through the pipe into a hashtable called $FileContent\n\n    .Example\n        C:\\PS>$FileContent = Get-IniContent \"c:\\settings.ini\"\n        C:\\PS>$FileContent[\"Section\"][\"Key\"]\n        -----------\n        Description\n        Returns the key \"Key\" of the section \"Section\" from the C:\\settings.ini file\n\n    .Link\n        Out-IniFile\n    #>\n\n    [CmdletBinding()]\n    [OutputType(\n        [System.Collections.Specialized.OrderedDictionary]\n    )]\n    Param(\n        # Specifies the path to the input file.\n        [ValidateNotNullOrEmpty()]\n        [Parameter( Mandatory = $true, ValueFromPipeline = $true )]\n        [String]\n        $FilePath,\n\n        # Specify what characters should be describe a comment.\n        # Lines starting with the characters provided will be rendered as comments.\n        # Default: \";\"\n        [Char[]]\n        $CommentChar = @(\";\", \"#\", \":\", \"/\"),\n\n        # Remove lines determined to be comments from the resulting dictionary.\n        [Switch]\n        $IgnoreComments,\n\n        [Alias('KeyValSeparator')]\n        [String]\n        $delimiter = '='\n    )\n\n    Begin {\n        Write-Debug \"PsBoundParameters:\"\n        $PSBoundParameters.GetEnumerator() | ForEach-Object { Write-Debug $_ }\n        if ($PSBoundParameters['Debug']) {\n            $DebugPreference = 'Continue'\n        }\n        Write-Debug \"DebugPreference: $DebugPreference\"\n\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function started\"\n\n        $commentRegex = \"^\\s*([$($CommentChar -join '')].*)$\"\n        $sectionRegex = \"^\\s*\\[(.+)\\]\\s*$\"\n        $keyRegex     = \"^\\s*(.+?)\\s*$delimiter\\s*(['`\"]?)(.*)\\2\\s*$\"\n\n        Write-Debug (\"commentRegex is {0}.\" -f $commentRegex)\n    }\n\n    Process {\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Processing file: $Filepath\"\n\n        $ini = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n        #$ini = @{}\n\n        if (!(Test-Path $Filepath)) {\n            Write-Verbose (\"Warning: `\"{0}`\" was not found.\" -f $Filepath)\n            Write-Output $ini\n        }\n\n        $commentCount = 0\n        switch -regex -file $FilePath {\n            $sectionRegex {\n                # Section\n                $section = $matches[1]\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Adding section : $section\"\n                $ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n                $CommentCount = 0\n                continue\n            }\n            $commentRegex {\n                # Comment\n                if (!$IgnoreComments) {\n                    if (!(test-path \"variable:local:section\")) {\n                        $section = $script:NoSection\n                        $ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n                    }\n                    $value = $matches[1]\n                    $CommentCount++\n                    Write-Debug (\"Incremented CommentCount is now {0}.\" -f $CommentCount)\n                    $name = \"Comment\" + $CommentCount\n                    Write-Verbose \"$($MyInvocation.MyCommand.Name):: Adding $name with value: $value\"\n                    $ini[$section][$name] = $value\n                }\n                else {\n                    Write-Debug (\"Ignoring comment {0}.\" -f $matches[1])\n                }\n\n                continue\n            }\n            $keyRegex {\n                # Key\n                if (!(test-path \"variable:local:section\")) {\n                    $section = $script:NoSection\n                    $ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n                }\n                $name, $value = $matches[1, 3]\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Adding key $name with value: $value\"\n                if (-not $ini[$section][$name]) {\n                    $ini[$section][$name] = $value\n                }\n                else {\n                    if ($ini[$section][$name] -is [string]) {\n                        $ini[$section][$name] = [System.Collections.ArrayList]::new()\n                        $ini[$section][$name].Add($ini[$section][$name]) | Out-Null\n                        $ini[$section][$name].Add($value) | Out-Null\n                    }\n                    else {\n                        $ini[$section][$name].Add($value) | Out-Null\n                    }\n                }\n                continue\n            }\n        }\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Finished Processing file: $FilePath\"\n        Write-Output $ini\n    }\n\n    End {\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function ended\"\n    }\n}\n\nSet-Alias gic Get-IniContent\n\nFunction Out-IniFile {\n    <#\n    .Synopsis\n        Write hash content to INI file\n\n    .Description\n        Write hash content to INI file\n\n    .Notes\n        Author      : Oliver Lipkau <oliver@lipkau.net>\n        Blog        : http://oliver.lipkau.net/blog/\n        Source      : https://github.com/lipkau/PsIni\n                      http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91\n\n        #Requires -Version 2.0\n\n    .Inputs\n        System.String\n        System.Collections.IDictionary\n\n    .Outputs\n        System.IO.FileSystemInfo\n\n    .Example\n        Out-IniFile $IniVar \"C:\\myinifile.ini\"\n        -----------\n        Description\n        Saves the content of the $IniVar Hashtable to the INI File c:\\myinifile.ini\n\n    .Example\n        $IniVar | Out-IniFile \"C:\\myinifile.ini\" -Force\n        -----------\n        Description\n        Saves the content of the $IniVar Hashtable to the INI File c:\\myinifile.ini and overwrites the file if it is already present\n\n    .Example\n        $file = Out-IniFile $IniVar \"C:\\myinifile.ini\" -PassThru\n        -----------\n        Description\n        Saves the content of the $IniVar Hashtable to the INI File c:\\myinifile.ini and saves the file into $file\n\n    .Example\n        $Category1 = @{“Key1”=”Value1”;”Key2”=”Value2”}\n        $Category2 = @{“Key1”=”Value1”;”Key2”=”Value2”}\n        $NewINIContent = @{“Category1”=$Category1;”Category2”=$Category2}\n        Out-IniFile -InputObject $NewINIContent -FilePath \"C:\\MyNewFile.ini\"\n        -----------\n        Description\n        Creating a custom Hashtable and saving it to C:\\MyNewFile.ini\n    .Link\n        Get-IniContent\n    #>\n\n    [CmdletBinding()]\n    [OutputType(\n        [System.IO.FileSystemInfo]\n    )]\n    Param(\n        # Adds the output to the end of an existing file, instead of replacing the file contents.\n        [switch]\n        $Append,\n\n        # Specifies the file encoding. The default is UTF8.\n        #\n        # Valid values are:\n        # -- ASCII:  Uses the encoding for the ASCII (7-bit) character set.\n        # -- BigEndianUnicode:  Encodes in UTF-16 format using the big-endian byte order.\n        # -- Byte:   Encodes a set of characters into a sequence of bytes.\n        # -- String:  Uses the encoding type for a string.\n        # -- Unicode:  Encodes in UTF-16 format using the little-endian byte order.\n        # -- UTF7:   Encodes in UTF-7 format.\n        # -- UTF8:  Encodes in UTF-8 format.\n        [ValidateSet(\"Unicode\", \"UTF7\", \"UTF8\", \"ASCII\", \"BigEndianUnicode\", \"Byte\", \"String\")]\n        [Parameter()]\n        [String]\n        $Encoding = \"UTF8\",\n\n        # Specifies the path to the output file.\n        [ValidateNotNullOrEmpty()]\n        [ValidateScript( {Test-Path $_ -IsValid} )]\n        [Parameter( Position = 0, Mandatory = $true )]\n        [String]\n        $FilePath,\n\n        # Allows the cmdlet to overwrite an existing read-only file. Even using the Force parameter, the cmdlet cannot override security restrictions.\n        [Switch]\n        $Force,\n\n        # Specifies the Hashtable to be written to the file. Enter a variable that contains the objects or type a command or expression that gets the objects.\n        [Parameter( Mandatory = $true, ValueFromPipeline = $true )]\n        [System.Collections.IDictionary]\n        $InputObject,\n\n        # Passes an object representing the location to the pipeline. By default, this cmdlet does not generate any output.\n        [Switch]\n        $Passthru,\n\n        # Adds spaces around the equal sign when writing the key = value\n        [Switch]\n        $Loose,\n\n        # Writes the file as \"pretty\" as possible\n        #\n        # Adds an extra linebreak between Sections\n        [Switch]\n        $Pretty,\n\n        [Alias('KeyValSeparator')]\n        [String]\n        $delimiter = '='\n    )\n\n    Begin {\n        Write-Debug \"PsBoundParameters:\"\n        $PSBoundParameters.GetEnumerator() | ForEach-Object { Write-Debug $_ }\n        if ($PSBoundParameters['Debug']) {\n            $DebugPreference = 'Continue'\n        }\n        Write-Debug \"DebugPreference: $DebugPreference\"\n\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function started\"\n\n        function Out-Keys {\n            param(\n                [ValidateNotNullOrEmpty()]\n                [Parameter( Mandatory, ValueFromPipeline )]\n                [System.Collections.IDictionary]\n                $InputObject,\n\n                [ValidateSet(\"Unicode\", \"UTF7\", \"UTF8\", \"ASCII\", \"BigEndianUnicode\", \"Byte\", \"String\")]\n                [Parameter( Mandatory )]\n                [string]\n                $Encoding = \"UTF8\",\n\n                [ValidateNotNullOrEmpty()]\n                [ValidateScript( {Test-Path $_ -IsValid})]\n                [Parameter( Mandatory, ValueFromPipelineByPropertyName )]\n                [Alias(\"Path\")]\n                [string]\n                $FilePath,\n\n                [Parameter( Mandatory )]\n                $Delimiter,\n\n                [Parameter( Mandatory )]\n                $MyInvocation\n            )\n\n            Process {\n                if (!($InputObject.get_keys())) {\n                    Write-Warning (\"No data found in '{0}'.\" -f $FilePath)\n                }\n                Foreach ($key in $InputObject.get_keys()) {\n                    if ($key -match \"^Comment\\d+\") {\n                        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing comment: $key\"\n                        \"$($InputObject[$key])\" | Out-File -Encoding $Encoding -FilePath $FilePath -Append\n                    }\n                    else {\n                        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing key: $key\"\n                        $InputObject[$key] |\n                            ForEach-Object { \"$key$delimiter$_\" } |\n                            Out-File -Encoding $Encoding -FilePath $FilePath -Append\n                    }\n                }\n            }\n        }\n\n        if ($Loose) {\n            $delimiter = \"$delimiter \"\n        }\n\n        # Splatting Parameters\n        $parameters = @{\n            Encoding = $Encoding;\n            FilePath = $FilePath\n        }\n\n    }\n\n    Process {\n        $extraLF = \"\"\n\n        if ($Append) {\n            Write-Debug (\"Appending to '{0}'.\" -f $FilePath)\n            $outfile = Get-Item $FilePath\n        }\n        else {\n            Write-Debug (\"Creating new file '{0}'.\" -f $FilePath)\n            $outFile = New-Item -ItemType file -Path $Filepath -Force:$Force\n        }\n\n        if (!(Test-Path $outFile.FullName)) {Throw \"Could not create File\"}\n\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing to file: $Filepath\"\n        foreach ($i in $InputObject.get_keys()) {\n            if (!($InputObject[$i].GetType().GetInterface('IDictionary'))) {\n                #Key value pair\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing key: $i\"\n                \"$i$delimiter$($InputObject[$i])\" | Out-File -Append @parameters\n\n            }\n            elseif ($i -eq $script:NoSection) {\n                #Key value pair of NoSection\n                Out-Keys $InputObject[$i] `\n                    @parameters `\n                    -Delimiter $delimiter `\n                    -MyInvocation $MyInvocation\n            }\n            else {\n                #Sections\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing Section: [$i]\"\n\n                # Only write section, if it is not a dummy ($script:NoSection)\n                if ($i -ne $script:NoSection) { \"$extraLF[$i]\"  | Out-File -Append @parameters }\n                if ($Pretty) {\n                    $extraLF = \"`r`n\"\n                }\n\n                if ( $InputObject[$i].Count) {\n                    Out-Keys $InputObject[$i] `\n                        @parameters `\n                        -Delimiter $delimiter `\n                        -MyInvocation $MyInvocation\n                }\n\n            }\n        }\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Finished Writing to file: $FilePath\"\n    }\n\n    End {\n        if ($PassThru) {\n            Write-Debug (\"Returning file due to PassThru argument.\")\n            Write-Output (Get-Item $outFile)\n        }\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function ended\"\n    }\n}\n\nSet-Alias oif Out-IniFile\n\nfunction Add-ContextMenu {\n    #! TODO https://www.tenforums.com/tutorials/69524-add-remove-drives-send-context-menu-windows-10-a.html\n    param(\n        [ValidateSet(\n            'SendTo',\n            'TakeOwnership',\n            'OpenWithOnBatchFiles',\n            'DrivesInSendTo',\n            'TakeOwnership'\n            )]\n        [Array]$Entries\n    )\n    if (!(Test-Admin)){\n        return 'Changing the context menu / default file extensions requires running as Admin, exitting..'\n\n    }\n\n    if ('SendTo' -in $Entries){\n        New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\\AllFilesystemObjects\\shellex\\ContextMenuHandlers\\SendTo -Name \"(default)\" -PropertyType String -Value \"{7BA4C740-9E81-11CF-99D3-00AA004AE837}\" -Force\n    }\n\n    if ('DrivesInSendTo' -in $Entries){\n        Set-ItemProperty \"Registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -Name NoDrivesInSendToMenu -Value 0\n    }\n\n\n    if ('OpenWithOnBatchFiles' -in $Entries){\n        New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\batfile\\shell\\Open with\\command\" -Force\n        New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\cmdfile\\shell\\Open with\\command\" -Force\n        Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\batfile\\shell\\Open with\\command\" -Name \"(Default)\" -Value \"{09799AFB-AD67-11d1-ABCD-00C04FC30936}\" -Force\n        Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\batfile\\shell\\Open with\\command\" -Name \"(Default)\" -Value \"{09799AFB-AD67-11d1-ABCD-00C04FC30936}\" -Force\n\n    }\n\n    if ('TakeOwnership' -in $Entries){\n        '*','Directory' | ForEach-Object {\n            New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\"\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name '(Default)' -Value 'Take Ownership'\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'NoWorkingDirectory' -Value ''\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'HasLUAShield' -Value ''\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'Position' -Value 'Middle'\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'AppliesTo' -Value \"NOT (System.ItemPathDisplay:=`\"$env:HOMEDRIVE\\`\")\"\n\n            New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\\command\"\n            $Command = 'cmd.exe /c title Taking ownership.. & mode con:lines=30 cols=150 & takeown /f \"%1\" && icacls \"%1\" /grant administrators:F & timeout 2 >nul'\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\\command\" -Name '(Default)' -Value $Command\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\\command\" -Name 'IsolatedCommand' -Value $Command\n\n        }\n    }\n\n}\nfunction Block-RazerSynapse {\n    Try {\n        Remove-Item \"C:\\Windows\\Installer\\Razer\" -Force -Recurse\n    } Catch {\n        \"Failed to remove Razer installer folder\"\n        $_.Exception.Message\n    }\n    New-Item -ItemType File -Path \"C:\\Windows\\Installer\\Razer\" -Force -ErrorAction Stop\n    Write-Host \"An empty file called 'Razer' in C:\\Windows\\Installer has been put to block Razer Synapse's auto installation\"\n}\nfunction Check-XMP {\n    Write-Host \"Checking RAM..\" -NoNewline\n    $PhysicalMemory = Get-CimInstance -ClassName Win32_PhysicalMemory\n    $RamSpeed = $PhysicalMemory.Speed | Select-Object -First 1 # In MHz\n    $IsDesktop = $null -eq (Get-CimInstance -ClassName Win32_Battery) # No battery = not a laptop (in some very rare cases that may fail but whatever it's accurate enough)\n    $IsDDR4 = ($PhysicalMemory.SMBIOSMemoryType | Select-Object -First 1) -eq 26 # DDR4 = 26, DDR3 = 24\n    switch((Get-CimInstance -ClassName CIM_Processor).Manufacturer){\n        {$PSItem -Like \"*AMD*\" -or $PSItem -Like \"*Advanced Micro*\"}{$RamOCType = 'DOCP'}\n        default{$RamOCType = 'XMP'} # Whatever else it is, it's preferably XMP\n    }\n    if (($RamSpeed -eq 2133) -and $IsDesktop -and $IsDDR4){\n        Write-Output @\"\n`rYour RAM is running at the default DDR4 RAM speed of 2133 MHz.\nCheck if your RAM allows running at a higher speed, and if yes, turn on $RamOCType in the BIOS\n\"@\n    }else{\n        Write-Output \"`rCould not determine the need for XMP/DOCP\"\n    }\n    if ($RamSpeed){\"- Your RAM speed is $RamSpeed MHz\"}\n    if ($null -ne $IsDesktop){\"- You're on a desktop: $IsDesktop\"}\n    if ($null -ne $IsDDR4){\"- Your RAM is DDR4: $IsDDR4\"}\n}\n\n\n<#\n\t.SYNOPSIS\n\tScraps the latest version of Sophia edition weither you have W10/11/LTSC/PS7,\n\tchanges all function scopes to global and invokes it, as if it were importing it as a module\n\n\tYou can find farag's dobonhonkerosly big Sophia Script at https://github.com/farag2/Sophia-Script-for-Windows\n\tAnd if you'd like using it as a GUI, try out SophiApp:  https://github.com/Sophia-Community/SophiApp\n\t\n\tUsing the -Write parameter returns the script instead of piping it to Invoke-Expression\n\t.EXAMPLE\n\tImport-Sophia\n\t# Or for short:\n\tipso\n#>\nfunction Import-Sophia {\n\t[alias('ipso')]\n\t[CmdletBinding()]\n\tparam(\n\t\t[switch]\n        $Write,\n\n\t\t[string]\n        [ValidateSet(\n            'de-DE',\n            'en-US',\n            'es-ES',\n            'fr-FR',\n            'hu-HU',\n            'it-IT',\n            'pt-BR',\n            'ru-RU',\n            'tr-TR',\n            'uk-UA',\n            'zh-CN'\n        )]\n        $OverrideLang\n\t)\n\n\tfunction Get-SophiaVersion {\n\n\t\tswitch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber){\n\t\n\t\t\t\"17763\" {\n\t\t\n\t\t\t\t\"Windows_10_LTSC_2019\"\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t{($_ -ge 19044) -and ($_ -le 19048)}{\n\t\t\n\t\t\t\tif ($PSVersionTable.PSVersion.Major -eq 5){\n\t\t\n\t\t\t\t\t# Check if Windows 10 is an LTSC 2021\n\t\t\t\t\tif ((Get-ItemPropertyValue -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\" -Name ProductName) -eq \"Windows 10 Enterprise LTSC 2021\"){\n\t\t\n\t\t\t\t\t\t\"Windows_10_LTSC_2021\"\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t\"Windows_10\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\"Windows_10_PowerShell_7\"\n\t\t\t\t}\n\t\t\t}\n\t\t\t{$_ -ge 22000}\n\t\t\t{\n\t\t\t\tif ($PSVersionTable.PSVersion.Major -eq 5){\n\t\t\t\t\t\"Windows_11\"\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\"Windows_11_PowerShell_7\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t$SophiaVer = \"Sophia_Script_for_\" + (Get-SophiaVersion)\n\n\n\n\t$SupportedLanguages = @(\n\t\t'de-DE',\n\t\t'en-US',\n\t\t'es-ES',\n\t\t'fr-FR',\n\t\t'hu-HU',\n\t\t'it-IT',\n\t\t'pt-BR',\n\t\t'ru-RU',\n\t\t'tr-TR',\n\t\t'uk-UA',\n\t\t'zh-CN'\n\t)\n\n\tif($OverrideLang){\n\t\tif ($OverrideLang -NotIn $SupportedLanguages){\n\t\t\tWrite-Warning \"Language $OverrideLang may not be supported.\"\n\t\t}\n\t\t$Lang = $OverrideLang\n\t}\n\telseif((Get-UICulture).Name -in $SupportedLanguages){\n\t\t$Lang = (Get-UICulture).Name\n\t}\n\telseif((Get-UICulture).Name -eq \"en-GB\"){\n\t\t$Lang = 'en-US'\n\t}\n\telse{\n\t\t$Lang = 'en-US'\n\t}\n\n\t$Lang = (Get-UICulture).Name\n\tif ($OverrideLang){$Lang = $OverrideLang}\n\n\tif ($Lang -NotIn $SupportedLanguages){\n\t\t$Lang = 'en-US'\n\t}\n\tTry{\n\t\t$URL = \"https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/src/$SophiaVer/Localizations/$Lang/Sophia.psd1\"\n\t\t$Hashtable = Invoke-RestMethod $URL -ErrorAction Stop\n\t} Catch {\n\t\tWrite-Warning \"Failed to get Localizations with lang $Lang`nand URL: $URL\"\n\t\t$_\n\t\treturn\n\t}\n\tWhile ($Hashtable[0] -ne 'C'){\n\t\t$Hashtable = $Hashtable.Substring(1) # BOM ((\n\t}\n\t$global:Localizations = $global:Localization = Invoke-Expression $HashTable\n\n\tWrite-Verbose \"Getting $($SophiaVer -replace '_', ' ')\"\n\n\t$RawURL = \"https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/src/$SophiaVer/Module/Sophia.psm1\"\n\tWrite-Verbose $RawURL\n\n\t$SophiaFunctions = (Invoke-RestMethod $RawURL -ErrorAction Stop)\n\n\tWhile ($SophiaFunctions[0] -ne '<'){\n\t\t$SophiaFunctions = $SophiaFunctions.Substring(1) # BOM ((\n\t}\n\n\tif ($Write){\n\t\treturn $SophiaFunctions\n\t}else{\n\t\tNew-Module -Name \"Sophia Script (TL)\" -ScriptBlock ([ScriptBlock]::Create($SophiaFunctions)) | Import-Module -Global\n\t}\n\n}\nfunction Invoke-GitHubScript {\n    [alias('igs')]\n    param(\n        [ValidateSet(\n            'ChrisTitusTechToolbox',\n            'OldChrisTitusTechToolbox',\n            'Fido',\n            'SophiaScript'\n        )]\n        $Repository,\n        $RawURL\n    )\n    if ($RawURL){\n        Invoke-RestMethod $URL | Invoke-Expression\n        return\n    }\n    function Invoke-URL ($Link) {\n        $Response = Invoke-RestMethod $Link\n        While ($Response[0] -NotIn '<','#'){ # Byte Order Mark (BOM) removal\n            $Response = $Response.Substring(1)\n        }\n        Invoke-Expression $Response\n    }\n    switch ($Repository){\n        'ChrisTitusTechToolbox'{Invoke-URL https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winutil.ps1}\n        'OldChrisTitusTechToolbox'{Invoke-Expression (Invoke-RestMethod https://raw.githubusercontent.com/ChrisTitusTech/win10script/master/win10debloat.ps1)}\n        'Fido'{Invoke-URL https://raw.githubusercontent.com/pbatard/Fido/master/Fido.ps1}\n        'SophiaScript'{Import-Sophia}\n    }\n}\n\nfunction New-ContextMenu {\n    param(\n        [Parameter(Mandatory = $true)]\n        [String]$Text,\n        [Parameter(Mandatory = $true)]\n        [Array]$Extensions,\n        [Parameter(Mandatory = $true)]\n        [String]$Command,\n        \n        [String]$Icon\n    ) # Text Extensions Command are all mandatory, though Icon is not and must be an existing .ico path\n\n    if (!(Test-Admin)){\n        return \"Admin priviledges required (touching root class registry keys)\"\n    }\n\n    ForEach($Extension in $Extensions){\n        \n        $shellpath = \"REGISTRY::HKEY_CLASSES_ROOT\\SystemFileAssociations\\$Extension\\shell\"\n\n        if (-Not(Test-Path $shellpath)){\n            New-Item -Item Directory $shellpath -ErrorAction Stop | Out-Null\n            $Item = \"item0\"\n        }else{\n            $Items = ((Get-ChildItem \"$shellpath\").PSChildName | \n            Where-Object {$PSItem -Like \"Item*\"}) -replace 'Item',''\n            if ($items){\n                $Item = \"item\" + ([int]$Items+1)\n            } else{$Item = \"item0\"}\n            Write-Host \"Item is $item since there items: $items\"\n        }\n        if (-Not(Test-Path \"$shellpath\\$Item\")){\n            New-Item -Item Directory \"$shellpath\\$Item\" -ErrorAction Stop | Out-Null\n        }\n        Set-ItemProperty -Path \"$shellpath\\$Item\" -Name \"MUIVerb\" -Value $Text\n        if ($icon){\n            Set-ItemProperty -Path \"$shellpath\\$Item\" -Name \"Icon\" -Value \"$icon\"\n        }\n\n        if (-Not(Test-Path \"$shellpath\\$Item\\command\")){\n            New-Item -Item Directory \"$shellpath\\$Item\\command\" -ErrorAction Stop | Out-Null\n        }\n        Set-Item -Path \"$shellpath\\$Item\\command\" -Value \"$command `\"%L`\"\"\n    }\n}\n<#!TODO:\n    Scan windows defender\n    Git Bash\n    Rotate pictures\n    Open with code\n    Open with visual studio\n    Add to favorites\n#>\n\nfunction Remove-ContextMenu {\n    [alias('rcm')]\n    <#\n    https://www.tenforums.com\n    https://winaero.com\n    https://majorgeeks.com\n    https://github.com/farag2/Sophia-Script-for-Windows\n    #>\n    param(\n        [ValidateSet(\n            'PinToQuickAccess',\n            'RestorePreviousVersions',\n            'Print',\n            'GiveAccessTo',\n            'EditWithPaint3D',\n            'IncludeInLibrary',\n            'AddToWindowsMediaPlayerList',\n            'CastToDevice',\n            'EditWithPaint3D',\n            'EditWithPhotos',\n            'Share',\n            'TakeOwnerShip',\n            '7Zip',\n            'WinRAR',\n            'Notepad++',\n            'OpenWithOnBatchFiles',\n            'SendTo',\n            'DrivesInSendTo',\n            'VLC'\n            )]\n        [Array]$Entries\n    )\n\n    if (!(Test-Admin)){\n        return 'Changing the context menu / default file extensions requires running as Admin, exitting..'\n\n    }\n\n\n    $CurrentPreference = $ErrorActionPreference\n    $ErrorActionPreference = 'Ignore'\n    $Blocked = \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked\"\n\n    if (-Not (Test-Path -Path $Blocked)){\n        New-Item -Path $Blocked -Force\n    }\n\n    if ('RestorePreviousVersions' -in $Entries){\n        New-ItemProperty -Path \"$Blocked\" -Name \"{596AB062-B4D2-4215-9F74-E9109B0A8153}\"\n    }\n\n    if ('PinToQuickAccess'){\n        @('HKEY_CLASSES_ROOT','HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes') |\n        ForEach-Object { Remove-Item \"Registry::$_\\Folder\\shell\\pintohome\" -Force -Recurse}\n    }\n\n    if ('Print' -in $Entries){\n        @(\n            'SystemFileAssociations\\image',\n            'batfile','cmdfile','docxfil','fonfile','htmlfil','inffile','inifile','VBSFile','WSFFile',\n            'JSEFile','otffile','pfmfile','regfile','rtffile','ttcfile','ttffile','txtfile','VBEFile'\n        ) | ForEach-Object {Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\print\" -Name \"ProgrammaticAccessOnly\" -Value ''}\n    }\n\n    if ('GiveAccessTo' -in $Entries) {\n        @('*','Directory\\Background','Directory','Drive','LibraryFolder\\background','UserLibraryFolder') |\n        ForEach-Object {Remove-Item -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shellex\\ContextMenuHandlers\\Sharing\" -Recurse -Force}\n    }\n\n    if ('IncludeInLibrary' -in $Entries){\n        @('HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes','HKEY_CLASSES_ROOT') |\n        ForEach-Object {Remove-Item \"Registry::$_\\Folder\\ShellEx\\ContextMenuHandlers\\Library Location\" -Force}\n    }\n\n    if ('AddToWindowsMediaPlayerList' -in $Entries){\n        @(\n            '3G2','3GP','ADTS','AIFF','ASF','ASX','AU','AVI','FLAC','M2TS','m3u','M4A','MIDI','MK3D',\n            'MKA','MKV','MOV','MP3','MP4','MPEG','TTS','WAV','WAX','WMA','WMV','WPL','WVX'\n        ) | ForEach-Object { Remove-Item \"Registry::HKEY_CLASSES_ROOT\\WMP11.AssocFile.$_\\shell\\Enqueue\" -Force -Recurse }\n\n        @(\n            'MediaCenter.WTVFile','Stack.Audio','Stack.Image','SystemFileAssociations\\audio','WMP.WTVFile',\n            'SystemFileAssociations\\Directory.Audio','SystemFileAssociations\\Directory.Image','WMP.DVR-MSFile','WMP.DVRMSFile'\n        ) | ForEach-Object { Remove-Item \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\Enqueue\" -Force -Recurse}\n    }\n\n    if ('CastToDevice' -in $Entries){\n        New-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked\" -Name \"{7AD84985-87B4-4a16-BE58-8B72A5B390F7}\" -PropertyType String -Value \"Play to menu\" -Force\n    }\n\n    if ('EditWithPaint3D' -in $Entries){\n        @('.3mf','.bmp','.fbx','.gif','.jfif','.jpe','.jpeg','.jpg','.png','.tif','.tiff') | \n        ForEach-Object { Remove-Item \"Registry::HKEY_CLASSES_ROOT\\SystemFileAssociations\\$_\\Shell\\3D Edit\" -Force -Recurse}\n    }\n\n    if ('EditWithPhotos' -in $Entries){\n        Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\\Shell\\ShellEdit\" -Name 'ProgrammaticAccessOnly' -Value ''\n    }\n\n    if ('Share' -in $Entries){\n        New-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked\" -Name \"{E2BF9676-5F8F-435C-97EB-11607A5BEDF7}\" -PropertyType String -Value \"\" -Force\n    }\n\n    if ('TakeOwnerShip' -in $Entries){\n        @(\n        'HKEY_CLASSES_ROOT\\*\\shell\\runas'\n        'HKEY_CLASSES_ROOT\\Directory\\shell\\runas'\n        'HKEY_CLASSES_ROOT\\*\\shell\\TakeOwnership'\n        'HKEY_CLASSES_ROOT\\Directory\\shell\\TakeOwnership'\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\*\\shell\\TakeOwnership'\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\*\\shell\\TakeOwnership'\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Directory\\shell\\TakeOwnership'\n        ) | ForEach-Object {\n            Remove-Item -LiteralPath \"Registry::$_\" -Recurse -Force\n        }\n    }\n\n    if ('SendTo' -in $Entries){\n        $DefaultSendTo = (\n        'Bluetooth File Transfer',\n        'Compressed (zipped) Folder',\n        'Desktop (create shortcut)',\n        'Documents',\n        'Fax Recipient',\n        'Mail Recipient'\n        )\n        $NonDefaultSendTo = Get-ChildItem ([System.Environment]::GetFolderPath('SendTo')) | Where-Object BaseName -NotIn $DefaultSendTo\n        if ($NonDefaultSendTo) {\n            $NonDefaultSendTo.Name\n            if(Get-Boolean \"Are you sure you wish to lose access the following files/scripts?\"){\n                New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\\AllFilesystemObjects\\shellex\\ContextMenuHandlers\\SendTo -Name \"(default)\" -PropertyType String -Value \"-{7BA4C740-9E81-11CF-99D3-00AA004AE837}\" -Force\n            }\n        }else{\n            New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\\AllFilesystemObjects\\shellex\\ContextMenuHandlers\\SendTo -Name \"(default)\" -PropertyType String -Value \"-{7BA4C740-9E81-11CF-99D3-00AA004AE837}\" -Force\n        }\n    }\n\n    if ('DrivesInSendTo' -in $Entries){\n        Set-ItemProperty \"Registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -Name NoDrivesInSendToMenu -Value 1\n    }\n    \n    if ('OpenWithOnBatchFiles' -in $Entries){\n        foreach ($Ext in 'bat','cmd'){\n            Remove-Item -Path \"Registry::HKEY_CLASSES_ROOT\\$($Ext)file\\shell\\Open with\\command\" -Force -Recurse\n        }\n    }\n\n    if ('7Zip' -in $Entries){\n        @(\n            'Classes\\CLSID\\{23170F69-40C1-278A-1000-000100020000}',\n            'Classes\\CLSID\\{23170F69-40C1-278A-1000-000100020000}\\InprocServer32',\n            'Classes\\*\\shellex\\ContextMenuHandlers\\7-Zip',\n            'Classes\\Directory\\shellex\\ContextMenuHandlers\\7-Zip',\n            'Classes\\Folder\\shellex\\ContextMenuHandlers\\7-Zip',\n            '7-Zip\\Options'\n        ) | ForEach-Object {Remove-Item -LiteralPath \"REGISTRY::HKEY_CURRENT_USER\\Software\\$_\" -Recurse -Force}\n    }\n    \n    if ('WinRAR' -in $Entries){ # This hides (adds to Blocked) instead of deleting\n        @('{B41DB860-64E4-11D2-9906-E49FADC173CA}','{B41DB860-8EE4-11D2-9906-E49FADC173CA}') |\n        ForEach-Object {New-ItemProperty -Path $Blocked -Name $_ -Value ''}\n    }\n\n    if ('Notepad++' -in $Entries){\n        @(\n            '*\\shell\\Open with &Notepad++',\n            '*\\shell\\Open with &Notepad++\\command',\n            'Directory\\shell\\Open with &Notepad++',\n            'Directory\\shell\\Open with &Notepad++\\command',\n            'Directory\\Background\\shell\\Open with &Notepad++',\n            'Directory\\Background\\shell\\Open with &Notepad++\\command'\n        ) | ForEach-Object {\n            Remove-Item -LiteralPath \"Registry::HKEY_CURRENT_USER\\Software\\Classes\\$_\" -Recurse -Force\n        }\n\n    }\n\n    if ('VLC' -in $Entries){\n\n        @(\n            'Directory\\shell\\PlayWithVLC'\n            'Directory\\shell\\AddtoPlaylistVLC'\n            \n        ) | ForEach-Object {\n            if (Test-Path \"Registry::HKEY_CLASSES_ROOT\\Directory\\shell\\$_\"){\n                Remove-Item -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\Directory\\shell\\$PSItem\" -Recurse -Force\n            }\n        }\n        ForEach($Context in ('PlayWithVLC','AddtoPlaylistVLC')){\n            @(\n                '3g2', '3ga', '3gp', '3gp2', '3gpp', '669', 'a52', 'aac', 'ac3', 'adt', 'adts', 'aif', 'aifc', 'aiff',\n                'amr', 'amv', 'aob', 'ape', 'asf', 'asx', 'au', 'avi', 'b4s', 'bik', 'Bluray', 'caf', 'cda', 'CDAudio',\n                'cue', 'dav', 'divx', 'drc', 'dts', 'dv', 'DVDMovie', 'dvr-ms', 'evo', 'f4v', 'flac', 'flv', 'gvi', 'gxf',\n                'ifo', 'iso', 'it', 'm1v', 'm2t', 'm2ts', 'm2v', 'm3u', 'm3u8', 'm4a', 'm4p', 'm4v', 'mid', 'mka', 'mkv',\n                'mlp', 'mod', 'mov', 'mp1', 'mp2', 'mp2v', 'mp3', 'mp4', 'mp4v', 'mpa', 'mpc', 'mpe', 'mpeg', 'mpeg1',\n                'mpeg2', 'mpeg4', 'mpg', 'mpga', 'mpv2', 'mts', 'mtv', 'mxf', 'nsv', 'nuv', 'oga', 'ogg', 'ogm', 'ogv',\n                'ogx', 'oma', 'OPENFolder', 'opus', 'pls', 'qcp', 'ra', 'ram', 'rar', 'rec', 'rm', 'rmi', 'rmvb', 'rpl',\n                's3m', 'sdp', 'snd', 'spx', 'SVCDMovie', 'thp', 'tod', 'tp', 'ts', 'tta', 'tts', 'VCDMovie', 'vlc', 'vlt',\n                'vob', 'voc', 'vqf', 'vro', 'w64', 'wav', 'webm', 'wma', 'wmv', 'wpl', 'wsz', 'wtv', 'wv', 'wvx', 'xa', 'xesc',\n                'xm', 'xspf', 'zip', 'zpl','3g2','3ga','3gp','3gp2','3gpp'\n\n            ) | ForEach-Object {\n                $Key = \"Registry::HKEY_CLASSES_ROOT\\VLC.$PSItem\\shell\\$Context\"\n                if (Test-Path $Key){\n                    Remove-Item -LiteralPath $Key -Recurse -Force\n                }\n            }\n        }\n    }\n    \n    $ErrorActionPreference = $CurrentPreference\n}\n\nfunction Remove-FromThisPC {\n    param(\n        [ValidateSet('Remove','Restore')]\n        [String]\n        $Action = 'Remove',\n\n        [ValidateSet(\n            'Desktop',\n            'Documents',\n            'Downloads',\n            'Music',\n            'Pictures',\n            'Videos'\n            )]\n        $Entries,\n        [Switch]$All\n\n    )\n    if ($All){$Entries = 'Desktop','Documents','Downloads','Music','Pictures','Videos'}\n    function Modify-Entry ($GUID){\n        if ($Action -eq 'Remove'){\n            Remove-Item -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\"\n            Remove-Item -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\"    \n        }else{\n            New-Item -ItemType -Directory -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\" | Out-Null\n            New-Item -ItemType -Directory -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\" | Out-Null\n        }\n        \n    }\n    ForEach($Entry in $Entries){\n        Switch($Entry){\n            'Desktop'{\n                Modify-Entry B4BFCC3A-DB2C-424C-B029-7FE99A87C641\n            }\n            'Documents'{\n                Modify-Entry A8CDFF1C-4878-43be-B5FD-F8091C1C60D0\n                Modify-Entry d3162b92-9365-467a-956b-92703aca08af\n            }\n            'Downloads'{\n                Modify-Entry 374DE290-123F-4565-9164-39C4925E467B\n                Modify-Entry 088e3905-0323-4b02-9826-5d99428e115f\n            }\n            'Music'{\n                Modify-Entry 1CF1260C-4DD0-4ebb-811F-33C572699FDE\n                Modify-Entry 3dfdf296-dbec-4fb4-81d1-6a3438bcf4de\n            }\n            'Pictures'{\n                Modify-Entry 3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA\n                Modify-Entry 24ad3ad4-a569-4530-98e1-ab02f9417aa8\n            }\n            'Videos'{\n                Modify-Entry A0953C92-50DC-43bf-BE83-3742FED03C9C\n                Modify-Entry f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a\n            }\n\n        }\n    }\n}\nfunction RemovePackBangs {\n    # Removes the exclamation bangs and spaces from all your !   PackName.zip\n    param(\n        [ValidateScript({\n            Test-Path $_ -PathType Container\n        })]\n        [String]$PackFolderPath = $(if ($IsLinux){\"$env:HOME/.minecraft/resourcepacks\"} else {\"$env:APPDATA\\.minecraft\\resourcepacks\"})\n    )\n\n    Get-ChildItem $PackFolderPath  | ForEach-Object {\n\n        $NewName = $_.Name.TrimStart(\"! \")\n\n        if ($_.Name -ne $NewName){\n            if (Test-Path -LiteralPath (Join-Path $PackFolderPath $NewName)){\n\n                Write-Warning \"Skipping renaming [$($_.Name)], copy exists with no bangs\"\n\n            } else{\n                Write-Host \"Renaming to $NewName\" -ForegroundColor Green\n                Rename-Item -Path $PSItem -NewName $NewName -Verbose\n            }\n        }\n    } \n}\n\nfunction Set-CompatibilitySettings {\n    [alias('scs')]\n    param(\n        [Parameter(Mandatory = $true)]\n        [String]$Path,\n\n        [Switch]$DisableFullScreenOptimizations,\n        [Switch]$RunAsAdmin\n    )\n\n    if (!$RunAsAdmin -and !$DisableFullScreenOptimizations){\n        return \"No compatibility settings were set, returning.\"\n    }\n\n    if ($FilePath.Extension -eq '.lnk'){\n        $FilePath = Get-Item (Get-ShortcutTarget $FilePath) -ErrorAction Stop\n    }else{\n        $FilePath = Get-Item $Path -ErrorAction Stop\n    }\n\n    $Data = '~'\n    if ($DisableFullScreenOptimizations){$Data += \" DISABLEDXMAXIMIZEDWINDOWEDMODE\"}\n    if ($RunAsAdmin){$Data += \" RUNASADMIN\"}\n\n    New-Item -ItemType Directory -Path \"Registry::HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" -ErrorAction Ignore\n    New-ItemProperty -Path \"Registry::HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" `\n    -Name $FilePath.FullName -PropertyType String -Value $Data -Force | Out-Null\n\n}\n# Default is 400(ms)\nfunction Set-MenuShowDelay {\n    param(\n        [Int]$DelayInMs\n    )\n    \n    Set-ItemProperty -Path \"Registry::HKEY_CURRENT_USER\\Control Panel\\Desktop\" -Name MenuShowDelay -PropertyType String -Value $DelayInMs -Force\n}\nfunction TweakList {\n    [alias('tl')]\n    [CmdletBinding()]\n    param(\n        [Parameter(ValueFromRemainingArguments = $true)]\n        [System.Collections.Arraylist]\n        $Arguments\n    )\n    $shortcuts = @{\n        repo = {Start-Process https://github.com/couleur-tweak-tips/TweakList}\n        ui   = {Start-Process https://couleur-tweak-tips.github.io/TweakList-UI}\n    }\n    if ($Arguments){\n        if ($Arguments[0] -in [String[]]$shortcuts.Keys){\n            & $shortcuts.($Arguments[0])\n        }else {\n            Write-Host \"Available shortcuts:\"\n            $shortcuts\n        }\n        return\n    }\n\nreturn @\"\nWelcome to TweakList! If you're seeing this in your terminal, then you're\nalready able to start calling all your functions. You can learn how to use\nTweakList on: https://github.com/couleur-tweak-tips/TweakList/tree/master/docs\n\nIf you're curious what a function actually does, use 'gfc' (aka Get-FunctionContent)\nwith the name of the function you want to see. Example:\n\nPS X:\\> Get-FunctionContent Import-Sophia\n\nAll functions have aliases, if you're using TL a lot: learn em all!\n\nYou can use the TweakList function (AKA tl) to do the following:\n\ntl repo opens TweakList's repo\ntl ui opens the UI\n\n\n\"@\n}\nfunction CB-CleanTaskbar {\n\tif (-Not(Get-Module -Name \"Sophia Script (TL)\" -Ea 0)){\n\t\tImport-Sophia\n\t}\n\tCortanaButton -Hide\n\tPeopleTaskbar -Hide\n\tTaskBarSearch -Hide\n\tTaskViewButton -Hide\n\tUnpinTaskbarShortcuts Edge, Store, Mail\n\n\t# Remove \"Meet now\" from the taskbar, s/o privacy.sexy\n\tSet-ItemProperty -Path \"Registry::HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -Name \"HideSCAMeetNow\" -Value 1\n}\nfunction Remove-DesktopShortcuts {\n    param(\n        [Switch]$ConfirmEach\n    )\n    \n    if($ConfirmEach){\n        Get-ChildItem -Path \"$HOME\\Desktop\" | Where-Object Extension -eq \".lnk\" | Remove-Item -Confirm\n    }else{\n        Get-ChildItem -Path \"$HOME\\Desktop\" | Where-Object Extension -eq \".lnk\" | Remove-Item\n    }\n}\n\n<#\n\nList of commonly used Appx packages:\n\nWindows.PrintDialog\nMicrosoft.WindowsCalculator\nMicrosoft.ZuneVideo\nMicrosoft.Windows.Photos\n\nI did not add them, but you can opt in by calling the function, e.g:\n\n    Remove-KnownAppxPackages -Add @('Windows.PrintDialog','Microsoft.WindowsCalculator')\n\nDon't forget to surround them by a ' so PowerShell considers them as a string\n\n#>\n\nfunction Remove-KnownAppxPackages ([array]$Add,[array]$Exclude) {\n\n    $AppxPackages = @(\n        \"Microsoft.Windows.NarratorQuickStart\"\n        \"Microsoft.Wallet\"\n        \"3DBuilder\"\n        \"Microsoft.Microsoft3DViewer\"\n        \"WindowsAlarms\"\n        \"BingSports\"\n        \"WindowsCommunicationsapps\"\n        \"WindowsCamera\"\n        \"Feedback\"\n        \"Microsoft.GetHelp\"\n        \"GetStarted\"\n        \"ZuneMusic\"\n        \"WindowsMaps\"\n        \"Microsoft.Messaging\"\n        \"Microsoft.MixedReality.Portal\"\n        \"Microsoft.OneConnect\"\n        \"BingFinance\"\n        \"Microsoft.MSPaint\"\n        \"People\"\n        \"WindowsPhone\"\n        \"Microsoft.YourPhone\"\n        \"Microsoft.Print3D\"\n        \"Microsoft.ScreenSketch\"\n        \"Microsoft.MicrosoftStickyNotes\"\n        \"SoundRecorder\"\n        \n        ) | Where-Object { $_ -notin $Exclude }\n\n        $AppxPackages += $Add # Appends the Appx packages given by the user (if any)\n\n        if (-Not($KeepXboxPackages)){\n            $AppxPackages += @(\n                \"XboxApp\"\n                \"Microsoft.XboxGameOverlay\"\n                \"Microsoft.XboxGamingOverlay\"\n                \"Microsoft.XboxSpeechToTextOverlay\"\n                \"Microsoft.XboxIdentityProvider\"\n                \"Microsoft.XboxGameCallableUI\"\n            )\n        }\n\n\n        ForEach ($Package in $AppxPackages){\n        \n        if ($PSVersionTable.PSEdition -eq 'Core'){ # Newer PowerShell versions don't have Appx cmdlets, manually calling PowerShell to \n        \n            powershell.exe -command \"Get-AppxPackage `\"*$Package*`\" | Remove-AppxPackage\"\n        \n        }else{\n            Get-AppxPackage \"*$Package*\" | Remove-AppxPackage\n        }\n        \n        }\n\n}\n\n\nfunction Remove-UselessFiles {\n    \n    @(\n        \"$env:TEMP\"\n        \"$env:WINDIR\\TEMP\"\n        \"$env:HOMEDRIVE\\TEMP\"\n    ) | ForEach-Object { Remove-Item (Convert-Path $_\\*) -Force -ErrorAction SilentlyContinue }\n\n}\nfunction Set-PowerPlan {\n    param (\n        [string]$URL,\n        [switch]$Ultimate\n        )\n\n    if ($Ultimate){\n        powercfg /duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61\n        powercfg /setactive e9a42b02-d5df-448d-aa00-03f14749eb61\n    }elseif($URL){\n        if ($URL -Like \"http*://cdn.discordapp.com/attachments/*.pow\"){\n            $DotPow = \"$env:TMP\\{0}\" -f (Split-Path $URL -Leaf)\n        }else{\n            $DotPow = \"$env:TMP\\Powerplan $(Get-Random).pow\"\n        }\n        Invoke-WebRequest -Uri $PowURL -OutFile $DotPow\n        powercfg -duplicatescheme $DotPow\n        powercfg /s $DotPow\n    }\n}\n\nfunction Set-Win32PrioritySeparation {\n    param(\n        [int]$DWord\n    )\n\n    $Path = 'REGISTRY::HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\PriorityControl'\n    $current = (Get-ItemProperty $Path).Win32PrioritySeparation\n\n    Set-ItemProperty -Path ($Path).Win32PrioritySeparation -Value $Value -Type DWord -Force -ErrorAction Inquire\n\n    Write-Verbose \"Set-Win32ProritySeparation: Changed from $current to $((Get-ItemProperty $Path).Win32PrioritySeparation)\"\n\n}\n\n\nfunction Get-GraalVM {\n    param(\n        [Switch]$Reinstall\n    )\n\n    if ((Test-Path \"$env:ProgramData\\GraalVM\") -and !$Reinstall){\n        return \"GraalVM is already installed, run with -Reinstall to force reinstallation\"\n    }\n    if (-Not(Get-Command curl.exe -ErrorAction Ignore)){\n        return \"curl is not found (comes with windows per default?)\"\n    }\n    Remove-Item \"$env:ProgramData\\GraalVM\" -ErrorAction Ignore -Force -Recurse\n\n    $URL = 'https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.2.0/graalvm-ce-java16-windows-amd64-21.2.0.zip'\n    $SHA256 = 'DAE2511ABFF8EAD3EBC90CD9FC81A8E84B762FC91462B198C3EDDF28F81A937E'\n    $Zip = \"$env:TMP\\GraalVM.zip\"\n\n\n    if (-Not(Test-Path $Zip)){\n        Write-Host \"Downloading GraalVM ($(Get-HeaderSize $URL)`MB)..\" -ForegroundColor Green\n        curl.exe -# -L $URL -o\"$Zip\"\n    }\n\n    if ((Get-FileHash $Zip).Hash -ne $SHA256){\n        Remove-Item \"$env:TMP\\GraalVM.zip\"\n        return \"Failed to download GraalVM (SHA256 checksum mismatch, not the expected file)\"\n        \n    }\n\n    if (Get-Command 7z -ErrorAction Ignore){\n\n        Invoke-Expression \"& `\"7z`\" x -bso0 -bsp1 -bse1 -aoa `\"$env:TMP\\GraalVM.zip`\" -o`\"$env:ProgramData\\GraalVM`\"\"\n    } else {\n        Expand-Archive -Path $Zip -Destination \"$env:ProgramData\\GraalVM\"\n    }\n    Move-Item -Path \"$env:ProgramData\\GraalVM\\graalvm-?e*\\*\" \"C:\\ProgramData\\GraalVM\"\n}\nfunction Get-TLShell {\n    param(\n        [switch]$Offline,\n        [switch]$DontOpen\n        )\n    \n    $WR = \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\" # I've had the habit of calling this folder WR\n                                                    # because it's the only folder I know that is added to path\n                                                    # that you don't need perms to access.\n\nif ($Offline){\n    \n    try {\n        $Master = Invoke-RestMethod -UseBasicParsing https://raw.githubusercontent.com/couleur-tweak-tips/TweakList/master/Master.ps1\n    } catch {\n        Write-Host \"Failed to get Master.ps1 from TweakList GitHub\" -ForegroundColor DarkRed\n        Write-Output \"Error: $($Error[0].ToString())\"\n        return\n    }\n    Set-Content \"$WR/TLSOff.cmd\" -Value @'\n<# : batch portion\n@echo off\npowershell.exe -noexit -noprofile -noexit -command \"iex (${%~f0} | out-string)\"\n: end batch / begin powershell #>\nWrite-Host \"TweakList Shell \" -Foregroundcolor White -NoNewLine\nWrite-Host \"(Offline)\" -Foregroundcolor DarkGray -NoNewLine\nWrite-Host \" - dsc.gg/CTT\" -Foregroundcolor White -NoNewLine\n\n'@\n    $Batch = Get-Item  \"$WR/TLSOff.cmd\"\n    Add-Content $Batch -Value $Master\n    if (!$DontOpen){\n        explorer.exe /select,`\"$($Batch.FullName)`\"\n    }\n\n}else{\n\n\n    \n    if ($WR -NotIn $env:PATH.Split(';')){\n        Write-Error \"`\"$env:LOCALAPPDATA\\Microsoft\\WindowsApps`\" is not added to path, did you mess with Windows?\"\n        return\n    }else{\n        $TLS = \"$WR\\TLS.CMD\"\n        Set-Content -Path $TLS -Value @'\n@echo off\ntitle TweakList Shell\nif /I \"%1\" == \"wr\" (explorer \"%~dp0\" & exit)\nif /I \"%1\" == \"so\" (set sophiaflag=Write-Host 'Importing Sophia Script..' -NoNewLine -ForegroundColor DarkGray;Import-Sophia)\n\nfltmc >nul 2>&1 || (\n    echo Elevating to admin..\n    PowerShell.exe -NoProfile Start-Process -Verb RunAs ' %0' 2> nul || (\n        echo Failed to elevate to admin, launch CMD as Admin and type in \"TL\"\n        pause & exit 1\n    )\n    exit 0\n)\n\npowershell.exe -NoProfile -NoLogo -NoExit -Command ^\n\"if ($PWD.Path -eq \\\"$env:WINDIR\\system32\\\"){cd $HOME} ;^\n[System.Net.ServicePointManager]::SecurityProtocol='Tls12' ;^\nWrite-Host 'Invoking TweakList.. ' -NoNewLine -ForegroundColor DarkGray;^\niex(irm tl.ctt.cx);^\n%SOPHIAFLAG%;^\nWrite-Host \\\"`rTweakList Shell - dsc.gg/CTT                  `n\\\" -Foregroundcolor White\"\n'@ -Force\n    }\n    $ShortcutPath = \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\TweakList Shell.lnk\"\n    $WScriptShell = New-Object -ComObject WScript.Shell\n    $Shortcut = $WScriptShell.CreateShortcut($ShortcutPath)\n    $Shortcut.IconLocation = (Get-Command powershell.exe).Source + \",0\"\n    $Shortcut.TargetPath = \"$WR\\TLS.CMD\"\n    $Shortcut.Save()\n\n    # Got this from my old list of snippets, originally found this on StackOverflow, forgot link\n    $bytes = [System.IO.File]::ReadAllBytes($ShortCutPath)\n    $bytes[0x15] = $bytes[0x15] -bor 0x20 # Set byte 21 (0x15) bit 6 (0x20) ON\n    [System.IO.File]::WriteAllBytes($ShortcutPath, $bytes)\n\n    Write-Host \"You can now type 'TLS' in Run (Windows+R) to launch it, or from your start menu\"\n    if (!$DontOpen){\n        & explorer.exe /select,`\"$(\"$WR\\TLS.CMD\")`\"\n    }\n    \n    \n}\n}\n\n# This function centralizes most of what you can download/install on CTT\n# Anything it doesn't find in that switch ($App){ statement is passed to scoop\n$global:SendTo = [System.Environment]::GetFolderPath('SendTo')\nfunction Get {\n    [alias('g')] # minimalism at it's finest\n    param(\n        [Parameter(ValueFromRemainingArguments = $true)]\n        [Array]$Apps,\n        [Switch]$DryRun\n    )\n\n    $FailedToInstall = $null # Reset that variable for later\n    if ($Apps.Count -eq 1 -and (($Apps[0] -Split '\\r?\\n') -gt 1)){\n        $Apps = $Apps[0] -Split '\\r?\\n'\n    }\n    if ($DryRun){\n        ForEach($App in $Apps){\n            \"Installing $app.\"\n        }\n        return\n    }\n\n    ForEach($App in $Apps){ # Scoop exits when it throws\n\n        switch ($App){\n            'nvddl'{Get-ScoopApp utils/nvddl}\n            {$_ -in 'Remux','Remuxer'}{\n                Invoke-RestMethod https://github.com/couleurm/couleurstoolbox/raw/main/7%20FFmpeg/Old%20Toolbox%20scripts/Remux.bat -Verbose |\n                Out-File \"$SendTo\\Remux.bat\"\n\n            }\n            {$_ -in 'RemuxAVI','AVIRemuxer'}{\n                Invoke-RestMethod https://github.com/couleurm/couleurstoolbox/raw/main/7%20FFmpeg/Old%20Toolbox%20scripts/Remux.bat -Verbose |\n                Out-File \"$SendTo\\Remux - AVI.bat\"\n                $Content = (Get-Content \"$SendTo\\Remux - AVI.bat\") -replace 'set container=mp4','set container=avi'\n                Set-Content \"$SendTo\\Remux - AVI.bat\" $Content\n            }\n            {$_ -in 'Voukoder','vk'}{Install-Voukoder }\n            'Upscaler'{\n\n                Install-FFmpeg \n                Invoke-RestMethod 'https://github.com/couleur-tweak-tips/utils/raw/main/Miscellaneous/CTT%20Upscaler.cmd' |\n                Out-File (Join-Path ([System.Environment]::GetFolderPath('SendTo')) 'CTT Upscaler.cmd') -Encoding ASCII -Force\n                Write-Host @\"\nCTT Upscaler has been installed! Find it in the options when right clicking a video file -> Send To -> CTT Upscaler.cmd\n\"@ -ForegroundColor Green\n\n            }\n            {$_ -In 'QualityMuncher','qm'}{\n                Install-FFmpeg \n\n                Invoke-RestMethod 'https://raw.githubusercontent.com/Thqrn/qualitymuncher/main/Quality%20Muncher.bat' |\n                Out-File (Join-Path ([System.Environment]::GetFolderPath('SendTo')) 'Quality Muncher.bat') -Encoding ASCII -Force\n\n                Invoke-RestMethod 'https://raw.githubusercontent.com/Thqrn/qualitymuncher/main/!!qualitymuncher%20multiqueue.bat' |\n                Out-File (Join-Path ([System.Environment]::GetFolderPath('SendTo')) '!!qualitymuncher multiqueue.bat') -Encoding ASCII -Force\n\n            }\n\n            'Scoop'{Install-Scoop }\n            {$_ -in 'ff','FFmpeg'}{Install-FFmpeg }\n\n            {$_ -in 'zl','ZetaLoader'}{Install-ZetaLoader}\n            {$_ -in 'CRU','custom-resolution-utility'}{Get-ScoopApp extras/cru}\n            {$_ -in 'wt','windowsterminal','windows-terminal'}{Get-ScoopApp extras/windows-terminal}\n            {$_ -in 'np++','Notepad++','notepadplusplus'}{Get-ScoopApp extras/notepadplusplus}\n            {$_ -in 'DDU','DisplayDriverUninstaller'}{Get-ScoopApp extras/ddu}\n            {$_ -in 'Afterburner','MSIAfterburner'}{Get-ScoopApp utils/msiafterburner}\n            {$_ -in 'Everything','Everything-Alpha','Everything-Beta'}{Get-ScoopApp extras/everything-alpha}\n            {$_ -In '7-Zip','7z','7Zip'}{Get-ScoopApp 7zip}\n            {$_ -In 'Smoothie','sm'}{\n                Install-FFmpeg\n                Get-ScoopApp main/git\n                scoop.cmd bucket add utils https://github.com/couleur-tweak-tips/utils\n                scoop.cmd install utils/smoothie\n            }\n            {$_ -In 'OBS','OBSstudio','OBS-Studio'}{Get-ScoopApp extras/obs-studio}\n            {$_ -In 'UTVideo'}{Get-ScoopApp utils/utvideo}\n            {$_ -In 'Nmkoder'}{Get-ScoopApp utils/nmkoder}\n            {$_ -In 'Librewolf'}{Get-ScoopApp extras/librewolf}\n            {$_ -In 'ffmpeg-nightly'}{Get-ScoopApp versions/ffmpeg-nightly}\n            {$_ -In 'Graal','GraalVM'}{Get-ScoopApp utils/GraalVM}\n            {$_ -In 'DiscordCompressor','dc'}{Install-FFmpeg ;Get-ScoopApp utils/discordcompressor}\n            {$_ -In 'Moony','mn'}{if (-Not(Test-Path \"$HOME\\.lunarclient\")){Write-Warning \"You NEED Lunar Client to launch it with Moony\"};Get-ScoopApp utils/Moony}\n            {$_ -In 'TLShell','TLS'}{Get-TLShell }\n            default{Get-ScoopApp $App}\n        }\n        Write-Verbose \"Finished installing $app\"\n\n    }\n    if ($FailedToInstall){\n        \n        Write-Host \"[!] The following apps failed to install (scroll up for details):\" -ForegroundColor Red\n        $FailedToInstall\n    }\n}\nfunction Install-MPVProtocol {\n    param(\n        [ValidateScript({Test-Path -Path $_ -PathType Leaf})]\n        $VideoPlayerFilePath\n    )\n\nif (!(Test-Admin)){\n    \"PowerShell NEEDS to run as Adminisrator in order to create the protocol handler\"\n    return\n}\n\n\nif ((Get-Command mpv -Ea 0) -and (Get-Command mpvnet -Ea 0)){\n    \"Would you like mpv:// links to open with MPV or MPV.net?\"\n    $Answer = Read-Host \"Answer\"\n    while ($answer -notin 'mpv','mpv.net','mpvnet','exit'){\n        \"Answer must be mpv / mpvnet, type exit to quit\"\n    }\n    switch ($Answer) {\n        'exit'{return}\n        {$_ -in 'mpvnet','mpv.net'}{$MPV = (Get-Command mpvnet.exe).Source}\n        'mpv'{$MPV = (Get-Command mpv.exe).Source}\n    }\n}elseif(Get-Command mpv -Ea 0){\n    \"Using default MPV\"\n    $MPV = (Get-Command mpv.exe).Source\n}elseif(Get-Command mpvnet -Ea 0){\n    Write-Warning \"Using MPV.net since MPV was not found (not added to path?)\"\n    $MPV = (Get-Command mpvnet.exe).Source\n}else{\n    return \"MPV or MPV.net couldn't be found, please install MPV / MPV.net\"\n}\n\nNew-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ea SilentlyContinue | Out-Null\nNew-Item -Path \"HKCR:\" -Name \"mpv\" -Force | Out-Null\nSet-ItemProperty -Path \"HKCR:\\mpv\" -Name \"(Default)\" -Value '\"URL:mpv Protocol\"' | Out-Null\nSet-ItemProperty -Path \"HKCR:\\mpv\" -Name \"URL Protocol\" -Value '\"\"' | Out-Null\nNew-Item -Path \"HKCR:\\mpv\" -Name \"shell\" -Force | Out-Null\nNew-Item -Path \"HKCR:\\mpv\\shell\" -Name \"open\" -Force | Out-Null\nNew-Item -Path \"HKCR:\\mpv\\shell\\open\" -Name \"command\" -Force | Out-Null\n#Old command: \"C:\\ProgramData\\CTT\\mpv-protocol\\mpv-protocol-wrapper.cmd\" \"%1\"\n$Command = \"cmd /c title MPV && powershell -ep bypass -NoProfile `\"& \\`\"$MPV\\`\" ('%1' -replace 'mpv://https//','https://')`\"\"\nSet-ItemProperty -Path \"HKCR:\\mpv\\shell\\open\\command\" -Name \"(Default)\" -Value  $Command | Out-Null\n\nWrite-Output \"Added the registry keys to handle mpv protocol and redirect to wrapper!\"\n\n}\nfunction Install-Voukoder {\n    [CmdletBinding()]\n    [alias('isvk')]\n    param(\n        [Switch]$GetTemplates\n            # Skip Voukoder installation and just get to the template selector\n    )\n\n    function Get-VoukoderProgram ($Name){\n        # Parses the registry manually instead of using PackageManagement's Get-Package\n\n        $Programs = @(\n            'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n            'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n            'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n            'HKCU:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n\n        ) | Where-Object {Test-path $_} |\n\n        Get-ItemProperty |  Where-Object Publisher -eq 'Daniel Stankewitz' |\n                Select-Object -Property @{n='Name';     e='DisplayName'   },\n                                        @{n='Version';  e='DisplayVersion'},\n                                        @{n='UninstallString'; e='UninstallString'}\n        \n        return $Programs | Where-Object Name -Like $Name\n    }\n\n    if (!$GetTemplates){\n    \n        $LatestCore = (Invoke-RestMethod https://api.github.com/repos/Vouk/voukoder/releases/latest)[0]\n            # get the latest release manifest from GitHub's API\n\n        if (($tag = $LatestCore.tag_name) -NotLike \"*.*\"){\n            $tag += \".0\" # E.g \"12\" will not convert to a version type, \"12.0\" will\n        }\n        [Version]$LatestCoreVersion = $tag\n\n        $Core = Get-VoukoderProgram -Name \"Voukoder*\" -ErrorAction Ignore | # Find all programs starting with Voukoder\n            Where-Object Name -NotLike \"*Connector*\" | Where-Object Name -NotLike \"*Pro*\" # Exclude connectors and Voukoder Pro\n\n        if ($Core){\n\n            if ($Core.Length -gt 1){\n                $Core\n                Write-Host \"Multiple Voukoder Cores detected (or bad parsing?)\" -ForegroundColor Red\n                return\n            }\n\n            $CurrentVersion = [Version]$Core.Version\n            if ($LatestCoreVersion -gt $CurrentVersion){ # then an upgrade is needed\n                \"Updating Voukoder Core from version $CurrentVersion to $LatestCoreVersion\"\n                Start-Process -FilePath msiexec -ArgumentList \"/qb /x {$($Core.TagId)}\" -Wait -NoNewWindow\n                    # Uses msiexec to uninstall the program\n                $Upgraded = $True\n            }\n        }\n\n        if (!$Core -or $Upgraded){\n\n            $DriverVersion = (Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_Display.Driver\" -ErrorAction Ignore).DisplayVersion\n            if ($DriverVersion -and $DriverVersion -lt 520.00){ # Oldest NVIDIA version capable\n                Write-Warning \"Outdated NVIDIA Drivers detected ($DriverVersion), you may not be able to encode (render) using NVENC util you update them.\"\n                pause\n            }\n\n            \"Downloading and installing Voukoder Core..\"\n            $CoreURL = $LatestCore[0].assets[0].browser_download_url\n            curl.exe -# -L $CoreURL -o\"$env:TMP\\Voukoder-Core.msi\"\n            msiexec /i \"$env:TMP\\Voukoder-Core.msi\" /passive    \n        }\n\n        filter ConnectorVer {$_.Trim('.msi').Trim('.zip').Split('-') | Select-Object -Last 1}\n            # .zip for Resolve's\n\n\n        # Following block generates a hashtable of all of the latest connectors\n\n        $Tree = (Invoke-RestMethod 'https://api.github.com/repos/Vouk/voukoder-connectors/git/trees/master?recursive=1').Tree\n            # Gets all files from the connectors repo, which contain all filepaths\n        $Connectors = [Ordered]@{}\n        ForEach($NLE in 'vegas','vegas18','vegas19','vegas20','aftereffects','premiere','resolve'){\n            # 'vegas' is for older versions\n            switch ($NLE){\n                vegas{\n                    $Pattern = \"*vegas-connector-*\"\n                    break # needs to stop here, otherwise it would overwrite it the next match\n                }\n                {$_ -Like \"vegas*\"}{\n                    $Pattern = \"*connector-$_*\"\n                }\n                default {\n                    $Pattern = \"*$NLE-connector*\"\n                }\n            }\n\n            $LCV = $Tree.path | # Short for LatestConnectorVersion\n            Where-Object {$_ -Like $Pattern} | # Find all versions of all matching connectors\n            ForEach-Object {[Version]($_ | ConnectorVer)} | # Parse it's version using the filter\n            Sort-Object -Descending | Select-Object -First 1 # Sort then select only the latest\n\n            $Path = $Tree.path | Where-Object {$_ -Like \"$Pattern*$LCV*.*\"} # get the absolute path with the latest version\n            $Connectors += @{$NLE = \"https://github.com/Vouk/voukoder-connectors/raw/master/$Path\"}\n            Remove-Variable -Name NLE\n        }\n\n        $Processes = @(\n            'vegas*'\n            'Adobe Premiere Pro'\n            'AfterFX'\n            'Resolve'\n        )\n\n        $Found = { Get-Process $Processes -ErrorAction Ignore }\n\n        if (-not (. $Found)){ # If $Found scriptblock returns nothing\n            Write-Host \"[!] Open your video editor\" -ForegroundColor Red\n            Write-Host \"Voukoder supports: VEGAS 12-20, Premiere, After Effects, DaVinci Resolve (ONLY PAID `\"Studio `\"VERSION)\" -ForeGroundColor Green\n            Write-Host \"Looking for processes: $($Processes -join ', ')\" -ForegroundColor DarkGray\n            While(-not (. $Found)){\n                Start-Sleep -Seconds 1\n            }\n        }\n        Write-Host @(\n            \"`nDetected the following video editor(s):`n`n\"\n            $(. $Found | Select-Object MainWindowTitle, Path, FileVersion | Out-String)\n            )\n\n        function Get-Connector ($PackageName, $Key, $NLEDir, $InnoFlag){\n            # Key is to get the right connector URL in $Connector hashtable\n            \n            function Install-Connector {\n                $msiPath = \"$env:TMP\\Voukoder Connector-$Key.msi\"\n                curl.exe -# -L $Connectors.$Key -o\"$msiPath\"\n                Write-Verbose \"Installing $msiPath at $InnoFlag=$NLEDir\" -Verbose\n                cmd /c \"msiexec /i `\"$msiPath`\" /qb $InnoFlag=`\"$NLEDir`\" /log `\"$env:TEMP\\Voukoder $InnoFlag.txt`\"\"\n                # msiexec /i \"$msiPath\" /qb \"$InnoFlag=`\"$NLEDir`\"\"\n                if ($LASTEXITCODE){\n                    Installer returned with error code $LASTEXITCODE\n                }\n            }\n\n            $CurrentConnector = (Get-VoukoderProgram -Name $PackageName)\n            if ($CurrentConnector){\n                [Version]$CurrentConnectorVersion = $CurrentConnector.Version\n                [Version]$LatestConnector = $Connectors.$Key | ConnectorVer # Parse connector version\n                if ($LatestConnector -gt $CurrentConnectorVersion){\n\n                    Write-Host \"Upgrading $PackageName from $CurrentConnectorVersion to $LatestConnector\"\n                    Start-Process -FilePath msiexec -ArgumentList \"/qb /x {$($CurrentConnector.TagId)}\" -Wait -NoNewWindow\n                    Install-Connector\n                }\n            } else {\n\n                Install-Connector\n            }\n        }\n        $NLEs = Get-Process $Processes -ErrorAction Ignore\n        ForEach($NLE in $NLEs){\n\n            switch ($NLE){\n\n                {(Split-Path $_.Path -Leaf) -in 'vegas180.exe', 'vegas190.exe','vegas200.exe'} {\n                    Write-Verbose \"Using newer VEGAS\"\n\n                    $VegVer = (Split-Path $_.Path -Leaf) -replace 'vegas' -replace '0\\.exe'\n\n                    Get-Connector -PackageName \"Voukoder connector for VEGAS Pro $VegVer\" -Key \"vegas$VegVer\" -NLEDir (Split-Path $_.Path -Parent) -InnoFlag VEGASDIR\n                    \n                    continue # Needs to loop over the next switch, which would've matched and also thought it needed to install an older Version\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -Like 'vegas*.exe'}{\n                    Write-Host \"/!\\ Old-VEGAS connector installation may fail if you already have a connector for newer VEGAS versions\" -ForegroundColor Red\n                    Get-Connector -PackageName \"Voukoder connector for VEGAS\" -Key vegas -NLEDir (Split-Path $_.Path -Parent) -InnoFlag VEGASDIR\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -eq 'afterfx.exe'} {\n                    Get-Connector -PackageName 'Voukoder Connector for Adobe After Effects' -Key aftereffects -NLEDir \"$env:ProgramFiles\\Adobe\\Common\\Plug-ins\\7.0\\MediaCore\" -InnoFlag INSTALLDIR\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -eq 'Adobe Premiere Pro.exe'}{\n                    Get-Connector -PackageName 'Voukoder connector for Premiere' -Key premiere -NLEDir \"$env:ProgramFiles\\Adobe\\Common\\Plug-ins\\7.0\\MediaCore\" -InnoFlag TGDir\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -eq 'Resolve.exe'}{\n                    Write-Warning \"Voukoder's connector for Resolve is ONLY FOR IT'S PAID `\"Studio`\" VERSION\"\n                    pause\n                    \n                    $IOPlugins = \"$env:ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\IOPlugins\"\n                    $dvcpBundle = \"$IOPlugins\\voukoder_plugin.dvcp.bundle\"\n\n                    if (-Not(Test-Path $IOPlugins)){\n                        New-Item -ItemType Directory -Path $IOPlugins | Out-Null\n                    }\n                    elseif (Test-Path $dvcpBundle -PathType Container){\n                        if (-Not(Get-Boolean \"Would you like to reinstall/update the Voukoder Resolve plugin? (Y/N)\")){continue}\n                        Remove-Item $dvcpBundle -Force -Recurse\n                    }\n\n                    $Zip = \"$env:TMP\\Voukoder-Connector-Resolve.zip\"\n                    curl.exe -# -L $Connectors.Resolve -o\"$Zip\"\n\n                    $ExtractDir = \"$env:TMP\\Voukoder-Connector-Resolve\"\n                    Remove-Item $ExtractDir -Recurse -Force -ErrorAction Ignore\n                    Expand-Archive $Zip -Destination $ExtractDir\n\n                    Copy-Item \"$ExtractDir\\voukoder_plugin.dvcp.bundle\" $IOPlugins -Recurse\n                    \n                    Write-Warning \"If connection failed you should find instructions in $ExtractDir\\README.txt\"\n                }\n            }\n        }\n        $NLEBin = $NLE.Path\n    }else{\n        $AvailableNLETemplates = @{\n            \"Vegas Pro 18+\" = \"vegas180.exe\"\n            \"Vegas Pro 14\" = \"vegas140.exe\"\n            \"Premiere Pro\" = \"Adobe Premiere Pro.exe\"\n            \"After Effects\" = \"AfterFX.exe\"\n        }\n        $NLE = Menu -menuItems $AvailableNLETemplates.Keys\n        $NLEBin = $AvailableNLETemplates.$NLE\n    }\n\n        # Converts \n        # https://cdn.discordapp.com/attachments/969870701798522901/972541638578667540/HEVC_NVENC_Upscale.sft2\n        # To hashtable with key \"HEVC NVENC + Upscale\" and val the URL\n\n    filter File2Display {\n        [IO.Path]::GetFileNameWithoutExtension($_) -replace '_',' ' -replace \" Upscale\", \" + Upscale\" -replace '  ',' '\n    }\n\n    $VegasTemplates = @(\n\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/HEVC_NVENC_Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/HEVC_NVENC.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/HEVC_NVENC__Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/H264_NVENC.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x265_Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x265.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x264_Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x264.sft2'\n\n        ) | ForEach-Object {\n        [Ordered]@{($_ | File2Display) = $_}\n    }\n\n    $PremiereTemplates = @(\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/HEVC_NVENC__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/HEVC_NVENC.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/H264_NVENC__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/H264_NVENC.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x264__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x264.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x265__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x265.epr'\n    ) | ForEach-Object {\n        [Ordered]@{($_ | File2Display) = $_}\n    }\n\n    switch($NLEBin){\n\n        {($NLEBin | Split-Path -Leaf).StartsWith('vegas')}{\n\n            $NLETerm = \"Vegas\"\n\n            $TemplatesFolder = if (($NLEBin | Split-Path -Leaf) -like (\"*140.exe\")){\n                \"$env:APPDATA\\Sony\\Render Templates\\voukoder\"\n            } else {\n                \"$env:APPDATA\\VEGAS\\Render Templates\\voukoder\"\n            }\n\n            if (-Not(Test-Path $TemplatesFolder)){\n                New-Item -ItemType Directory -Path $TemplatesFolder -Force | Out-Null\n            }\n\n            $SelectedTemplates =  Invoke-Checkbox -Items $VegasTemplates.Keys -Title \"Select VEGAS render templates to install\"\n\n            ForEach ($Template in $SelectedTemplates){\n                if (Test-Path ($TPPath = \"$TemplatesFolder\\$Template.sft2\")){\n                    Remove-Item $TPPath -Force\n                }\n                curl.exe -# -sSL $VegasTemplates.$Template -o\"$TPPath\"\n            }\n        }\n\n\n\n        {($NLEBin | Split-Path -Leaf).StartsWith('Adobe Premiere Pro.exe')}{\n            \n            $NLETerm = 'Premiere Pro'\n            $TemplatesFolder = \"$env:USERPROFILE\\Documents\\Adobe\\Adobe Media Encoder\\12.0\\Presets\"\n\n            if (-Not(Test-Path $TemplatesFolder)){\n                New-Item -ItemType Directory -Path $TemplatesFolder -Force | Out-Null\n            }\n\n            $SelectedTemplates =  Invoke-Checkbox -Items $PremiereTemplates.Keys -Title \"Select render templates to install\"\n\n            ForEach ($Template in $SelectedTemplates){\n                if (Test-Path ($TPPath = \"$TemplatesFolder\\$Template.epr\")){\n                    Remove-Item $TPPath -Force\n                }\n                curl.exe -# -sSL $PremiereTemplates.$Template -o\"$TPPath\"\n            }\n        \n        }\n\n\n\n\n        {($NLEBin | Split-Path -Leaf).StartsWith('AfterFX.exe')}{\n            $NLETerm = 'After Effects'\n\n            \"Opening a tutorial in your browser and downloading the AE templates file..\"\n            Start-Sleep -Seconds 2\n            if (-Not(Test-Path ($TPDir = \"$env:TMP\\AE_Templates\"))){\n                New-Item -ItemType Directory -Path $TPDir -Force | Out-Null\n            }\n            curl.exe -# -sSL https://github.com/couleur-tweak-tips/TweakList/releases/download/after-effects-voukoder-presets/CTT_AE_VOUKODER_TEMPLATES.aom -o\"$TPDir\\CTT_AE_VOUKODER_TEMPLATES.aom\"\n\n            Start-Process -FilePath explorer.exe -ArgumentList \"/select,`\"$TPDir\\CTT_AE_VOUKODER_TEMPLATES.aom`\"\"\n            $Tutorial = 'https://i.imgur.com/XCaJGoV.mp4'\n            try {\n                Start-Process $Tutorial\n            } catch { # If the user does not have any browser\n                \"Tutorial URL: $Tutorial\" \n            }\n        }\n\n\n\n        default{\n            Write-Host \"Your video editor ($($NLEBin)) does not have any pre-made templates for me to propose you\" -ForegroundColor Red\n            $NLETerm = \"your video editor\"\n        }\n    }\n    Write-Host \"Installation script finished, follow instructions (if any)\"\n    Write-Host \"Then restart $NLETerm to make sure Voukoder render templates have loaded.\" -ForegroundColor Red\n\n}\n\nfunction Invoke-SmoothiePost {\n    param(\n        [String]\n        [ValidateScript({\n            Test-Path -Path (Get-Item $_) -PathType Container -ErrorAction Stop\n        })]\n        $CustomDir\n    )\n    # DIR is the variable used by Scoop, hence why I'm using a separate name\n    if ($CustomDir -and !$DIR){\n        if (!(Test-Path \"$CustomDir\\Smoothie\") -And !(Test-Path \"$CustomDir\\VapourSynth\")){\n            Write-Host \"The folder you gave needs to contain the folders 'Smoothie' and 'VapourSynth', try the right path\"\n        }else{\n            $DIR = (Get-Item $CustomDir).FullName\n        }\n    }\n    if (!$DIR){return \"This script is suppose to be ran by Scoop after it's intallation, not manually\"}\n\n    $rc = (Get-Content \"$DIR\\Smoothie\\settings\\recipe.yaml\" -ErrorAction Stop) -replace ('H264 CPU',(Get-EncodingArgs -EzEncArgs))\n\n    if ($valid_args -like \"H* CPU\"){$rc = $rc -replace ('gpu: true','gpu: false')}\n\n    Set-Content \"$DIR\\Smoothie\\settings\\recipe.ini\" -Value $rc\n\n    $term = Get-Path conhost.exe\n\n    Get Scoop\n\n    $SendTo = [System.Environment]::GetFolderPath('SendTo')\n    $Scoop = Get-Command Scoop | Split-Path | Split-Path\n    $SA = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs', 'Scoop Apps')\n\n    if (-Not(Test-Path $SA)){ # If not using Scoop\n        $SA = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs')\n    }\n\n    Set-Content \"$Scoop\\shims\\sm.shim\" -Value @\"\npath = \"$DIR\\VapourSynth\\python.exe\"\nargs = \"$DIR\\Smoothie\\src\\main.py\"\n\"@\n    if (-Not(Test-Path \"$Scoop\\shims\\sm.exe\")){\n        Copy-Item \"$Scoop\\shims\\7z.exe\" \"$Scoop\\shims\\sm.exe\"\n    }\n\n\n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$Scoop\\shims\\rc.lnk\"\n        TargetPath = \"$DIR\\Smoothie\\settings\\recipe.yaml\"\n    }\n    New-Shortcut @Parameters\n\n\n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$SA\\Smoothie Recipe.lnk\"\n        TargetPath = \"$DIR\\Smoothie\\settings\\recipe.yaml\"\n    }\n    New-Shortcut @Parameters\n\n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$SA\\Smoothie.lnk\"\n        TargetPath = $term\n        Arguments = \"`\"$DIR\\VapourSynth\\python.exe`\" `\"$DIR\\Smoothie\\src\\main.py`\" -cui\"\n        Icon = \"$DIR\\Smoothie\\src\\sm.ico\"\n    }\n    New-Shortcut @Parameters\n    \n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$SendTo\\Smoothie.lnk\"\n        TargetPath = $term\n        Arguments = \"`\"$DIR\\VapourSynth\\python.exe`\" `\"$DIR\\Smoothie\\src\\main.py`\" -cui -input\"\n        Icon = \"$DIR\\Smoothie\\src\\sm.ico\"\n\n    }\n    New-Shortcut @Parameters\n\n}\n\n# This does not install Smoothie, it simply creates shortcuts in the start menu, Send To and configures the recipe\nfunction Invoke-SmoothieRsPost {\n    param(\n        \n        [ValidateScript({\n                Test-Path -Path (Get-Item $_) -PathType Container -ErrorAction Stop\n            })]\n        [String]$DIR,\n        [Switch]$Scoop,\n        [Switch]$Uninstall\n    )\n\n    $ErrorActionPreference = 'Stop'\n\n    <#\n        .SYNOPSIS\n        Merges recipes\n\n        .NOTES\n        It returns void, it just applies all patches on what was passed to -Original\n\n        .NOTES\n        Limitations:\n        - It cannot remove keys from $OG, most it can do is Patch containing a same key that is $null\n\n        .PARAMETER Original\n        The original hashtable which will get modified\n        .PARAMETER Patches\n        Recursively merge with $Original\n    #>\n    function Merge-Recipe {\n        [CmdletBinding()]\n        param (\n            $Original,\n            $Patch\n        )\n        foreach ($category in $Patch.GetEnumerator()) {\n            \n            $key, $patch = $category.name, $category.value\n\n            if ($Original.Contains($key) -and ($Original[$key] -is [Collections.Specialized.OrderedDictionary] -and $Patch -is [Collections.Specialized.OrderedDictionary])) {\n                Merge-Recipe -Original $Original[$key] -Patch $Patch\n            }\n            else {\n                $Original[$key] = $Patch\n            }\n        }\n    }\n    \n    $SendTo = [System.Environment]::GetFolderPath('SendTo')\n    $Start = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs')\n\n    if (!$SendTo -or !(Test-Path $SendTo)) {\n        return \"FATAL: Send To folder [$SendTo] does not exist, did you/a script strip it?\"\n    }\n    if (!$Start -or !(Test-Path $Start)) {\n        return \"FATAL: Start Menu folder [$Start] does not exist, did you/a script strip it?\"\n    }\n\n    if ($Scoop){\n        $shims = (Resolve-Path $DIR/../../../shims).Path\n    }\n\n    if ($Uninstall) {\n        Remove-Item \"$Sendto\\Smoothie.lnk\"\n        Remove-Item \"$SA\\Smoothie.lnk\"\n        if ($Scoop) {\n            Remove-Item \"$shims\\rc.lnk\"\n        }\n        return\n    }\n\n    if ($Scoop) {\n        $old_VERSIONS = Get-ChildItem $dir/.. -Directory -Exclude current, $version\n        $old_DIR = switch ($old_VERSIONS.Length) {\n            { $_ -in 0, $null } {}\n            1 { $old_VERSIONS }\n            default {\n                $script:ret = \"\"\n                $script:mostRecentDate = [datetime]::MinValue\n\n                $old_VERSIONS | ForEach-Object {\n                    $string = $_.BaseName -replace \"Nightly_\"\n                    $datetime = [datetime]::ParseExact($string, \"yyyy.MM.dd_HH-mm\", [CultureInfo]::InvariantCulture)\n\n                    if ($datetime -gt $script:mostRecentDate) {\n                        $script:mostRecentDate = $datetime\n                        $script:ret = $_\n                    }\n                }\n\n                if ($script:mostRecentDate -eq [datetime]::MinValue) {\n                    write-Warning \"Failed to parse old versions:\"\n                    Write-Host $old_VERSIONS.FullName\n                }\n\n                $script:ret\n            }\n        }\n\n        if ($old_DIR -and (Test-Path $old_DIR)) {\n\n            [Collections.Specialized.OrderedDictionary]$old_MACROS = Get-IniContent $old_DIR/encoding_presets.ini -KeyValSeparator ':'\n            [Collections.Specialized.OrderedDictionary]$new_MACROS = Get-IniContent $DIR/encoding_presets.ini -KeyValSeparator ':'\n            \n            Merge-Recipe $new_MACROS $old_MACROS\n            $new_MACROS | Out-IniFile $DIR/encoding_presets.ini -Pretty -Force -Loose -KeyValSeparator ':'\n\n            $old_RECIPES = Get-ChildItem $old_DIR -File -Filter *.ini | Where-Object BaseName -Notin 'defaults', 'encoding_presets'\n\n            $old_RECIPES | ForEach-Object {\n                [Collections.Specialized.OrderedDictionary]$old_RC = Get-IniContent $_.FullName -KeyValSeparator ':'\n                [Collections.Specialized.OrderedDictionary]$new_RC = Get-IniContent $DIR\\recipe.ini -KeyValSeparator ':'\n                \n                Merge-Recipe $new_RC $old_RC\n                $new_RC | Out-IniFile $DIR/$($_.BaseName).ini -Pretty -Force -Loose -KeyValSeparator ':'\n            }\n            $old_files = Get-ChildItem $old_DIR | Where-Object Name -notin 'defaults.ini', 'encoding_presets.ini', 'jamba.vpy', 'bin', 'recipe.ini', 'launch.cmd', 'manifest.json', 'install.json'\n\n            $old_files | ForEach-Object { Move-Item $_.FullName $DIR -Verbose }\n\n        }\n    }\n\n    $SendTo = [System.Environment]::GetFolderPath('SendTo')\n    $Start = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs')\n    . { # Shortcuts\n        if (!$SendTo -or !(Test-Path $SendTo)) {\n            return \"FATAL: Send To folder [$SendTo] does not exist, did you/a script strip it?\"\n        }\n        if (!$Start -or !(Test-Path $Start)) {\n            return \"FATAL: Start Menu folder [$Start] does not exist, did you/a script strip it?\"\n        }\n\n        # %APPDATA%\\Microsoft\\Windows\\SendTo\\Smoothie.lnk\n        $Parameters = @{\n            Overwrite  = $True\n            LnkPath    = \"$SendTo\\&Smoothie.lnk\"\n            TargetPath = \"$DIR\\bin\\smoothie-rs.exe\"\n            Arguments  = \"--tui -i\"\n        }\n        New-Shortcut @Parameters\n\n        if ($Scoop) {\n            \n            # %USERPROFILE%\\scoop\\shims\\rc.lnk\n            $Parameters = @{\n                Overwrite  = $True\n                LnkPath    = \"$shims\\rc.lnk\"\n                TargetPath = \"$dir\\recipe.ini\"\n            }\n            New-Shortcut @Parameters\n        }\n        else {\n            # %APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Smoothie Recipe.lnk\n            $Parameters = @{\n                Overwrite  = $True\n                LnkPath    = \"$Start\\Smoothie Recipe.lnk\"\n                TargetPath = \"$DIR\\recipe.ini\"\n            }\n            # %APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Smoothie.lnk\n            New-Shortcut @Parameters\n            $Parameters = @{\n                Overwrite  = $True\n                LnkPath    = \"$Start\\Smoothie.lnk\"\n                TargetPath = \"$DIR\\bin\\smoothie-rs.exe\"\n                Arguments  = \"--tui\"\n            }\n            New-Shortcut @Parameters\n        }\n    }\n\n}\nfunction Launch{\n\t[alias('l')]\n\tparam(\n\t\t[ValidateSet(\n\t\t\t'DisplayDriverUninstaller',\n\t\t\t'NVCleanstall',\n\t\t\t'NvidiaProfileInspector',\n\t\t\t'MSIUtilityV3',\n\t\t\t'Rufus',\n\t\t\t'AutoRuns',\n\t\t\t'Procmon',\n\t\t\t'CustomResolutionUtility',\n\t\t\t'NotepadReplacer',\n\t\t\t'privacy.sexy',\n\t\t\t'ReShade'\n\t\t\t#! TODO: NVProfileInspector, MSIUtility, CRU, Notepadreplacer, BulkCrapUninstaller, https://www.bill2-software.com/processmanager/exe/BPM-Setup.exe\n\t\t)]\n\t\t[Array]$Apps,\n\t\t[Switch]$DontLaunch, # Just keep them tidy in the Downloads folder))\n\t\t# This is the non hardcoded Downloads folder path s/o @farag2\n\t\t[String]$OutDir = (Get-ItemPropertyValue -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{374DE290-123F-4565-9164-39C4925E467B}\")\n\t)\n\n\tAdd-Type -AssemblyName System.IO.Compression.FileSystem\n\n\tfunction Invoke-Download{\n\t\tparam(\n\t\t\t[String]$URL, # Parses mediafire\n\t\t\t[String]$AppName,\n\t\t\t[Switch]$Scoop, # Scoop 'bucket/manifest' name\n\t\t\t[String]$PathToBinary, # In the zip\n\t\t\t[String]$Checksum,\n\t\t\t[String]$SelfExtracting7z # e.g for DDU\n\t\t)\n\n\t\tif (-Not(Test-Path $env:TMP)){\n\t\t\tthrow \"TMP environment variable not found [$env:TMP]\"\n\t\t}\n\n\t\tif($Scoop){\n\t\t\t$Bucket, $Manifest = $URL -split '/'\n\n\t\t\t$Repos = @{\n\n\t\t\t\tmain = @{org = 'ScoopInstaller';repo = 'main';branch = 'master'}\n\t\t\t\textras = @{org = 'ScoopInstaller';repo = 'extras';branch = 'master'}\n\t\t\t\tutils = @{org = 'couleur-tweak-tips';repo = 'utils';branch = 'main'}\n\t\t\t\tnirsoft = @{org = 'kodybrown';repo = 'scoop-nirsoft';branch = 'master'}\n\t\t\t\tgames = @{org = 'ScoopInstaller';repo = 'games';branch = 'master'}\n\t\t\t\t'nerd-fonts' = @{org = 'ScoopInstaller';repo = 'nerd-fonts';branch = 'master'}\n\t\t\t\tversions = @{org = 'ScoopInstaller';repo = 'versions';branch = 'master'}\n\t\t\t\tjava = @{org = 'ScoopInstaller';repo = 'java';branch = 'master'}\n\t\t\t}\n\t\t\t$repo = $Repos.$Bucket\n\t\t\t$URL = \"https://raw.githubusercontent.com/$($repo.org)/$($repo.repo)/$($repo.branch)/bucket/$Manifest.json\"\n\t\t\t$URL, $Version = Invoke-RestMethod $URL | ForEach-Object {$PSItem.URL, $PSItem.Version}\n\t\t}elseif($URL -Like \"*mediafire.com*\"){\n\t\t\t$URL = (Invoke-WebRequest -UseBasicParsing $URL).Links.href | Where-Object {$PSItem -Like \"http*://download*.mediafire.com/*\"}\n\t\t}\n\n\t\tif ($AppName){\n\t\t\t$FileName = $AppName\n\t\t}else{\n\t\t\t$FileName = $Manifest\n\t\t}\n\t\t\n\t\tif ($Version){$FileName += \" $Version\"}\n\n\t\t$Extension = [io.path]::GetExtension((($URL -replace '#/dl.7z') | Split-Path -Leaf))\n\n\t\t$OutFile = \"$env:TMP\\$FileName$Extension\"\n\t\tif (-Not(Test-Path $OutFile)){\n\t\t\tcurl.exe -#L -A \"Scoop\" $URL -o\"$OutFile\"\n\t\t}\n\n\t\tif($Checksum){\n\t\t\t$Parameters = @{\n\t\t\t\tPath = $OutFile\n\t\t\t}\n\t\t\tif ($Checksum -Like \"*:*\"){ # Contains a :\n\t\t\t\t$Algo, $Checksum = $Checksum -Split ':' # To split hash and algo, eg md5:8424509737CEDBDE4BA9E9A780D5CE96\n\t\t\t\t$Parameters += @{\n\t\t\t\t\tAlgorithm = $Algo \n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($Checksum -ne (Get-FileHash @Parameters).Hash){\n\t\t\t\tthrow \"Hash provided $Checksum does not match $OutFile\"\n\t\t\t}\n\t\t}\n\n\t\tif ($Extension -eq '.zip'){\n\t\t\t$OutDir = \"$env:TMP\\$FileName\\\"\n\t\t\tif (-Not(Test-Path $OutDir)){\n\t\t\t\t[System.IO.Compression.ZipFile]::ExtractToDirectory($OutFile, $OutDir)\n\t\t\t}\n\n\t\t\tif ($PathToBinary){\n\t\t\t\t$OutDir = Join-Path $OutDir $PathToBinary\n\t\t\t}\n\t\t\t$OutFile = $OutDir # To not have to check for the following statement twice\n\t\t}elseif($SelfExtracting7z){\n\t\t\tStart-Process -FilePath $OutFile -ArgumentList \"-y\" -Wait\n\t\t\t$SelfExtracting7z = $SelfExtracting7z -replace \"%VER%\", $Version\n\t\t\tif (-Not(Test-Path \"$env:TMP\\$SelfExtracting7z\" -PathType Container)){\n\t\t\t\tthrow \"Self extracting 7-Zip got wrong path: $SelfExtracting7z\"\n\t\t\t}\n\t\t\t$OutDir = $SelfExtracting7z\n\t\t}\n\n\t\tif (-Not(Test-Path $OutFile)){\n\t\t\tthrow \"$OutFile could not be found\"\n\t\t}\n\n\t\treturn $OutFile\n\n\t}\n\n\t$Paths = @()\n\n\t$Apps | ForEach-Object { # Cycles through given apps\n\t\tWrite-Host \"getting $PSItem\"\n\t\t$Paths += switch ($PSItem){\n\t\t\tDisplayDriverUninstaller{ Invoke-Download -URL extras/ddu -Scoop -PathToBinary \"Display Driver Uninstaller.exe\" -SelfExtracting7z \"DDU v%VER%\" -AppName DDU }\n\t\t\tNVCleanstall{ Invoke-Download -URL extras/nvcleanstall -Scoop -AppName NVCleanstall -PathToBinary \"NVCleanstall.exe\" }\n\t\t\tNvidiaProfileInspector{ Invoke-Download -URL extras/nvidia-profile-inspector -Scoop -AppName NvidiaProfileInspector -PathToBinary 'nvidiaProfileInspector.exe' }\n\t\t\tMSIUtilityV3{\n\t\t\t\tWrite-Warning \"MSI mode is already applied by default on NVIDIA 1600/2000/3000 GPUs and AMD cards\"\n\t\t\t\tInvoke-Download -URL https://www.mediafire.com/file/ewpy1p0rr132thk/MSI_util_v3.zip/file -AppName \"MSIUtilV3\" -PathToBinary \"MSI_util_v3.exe\" -Checksum \"md5:8424509737CEDBDE4BA9E9A780D5CE96\"\n\t\t\t}\n\t\t\tRufus{ Invoke-Download -URL extras/rufus -Scoop -AppName rufus}\n\t\t\tAutoRuns{ Invoke-Download -URL https://download.sysinternals.com/files/Autoruns.zip -AppName AutoRuns -PathToBinary Autoruns64.exe }\n\t\t\tProcmon{ Invoke-Download -URL https://download.sysinternals.com/files/ProcessMonitor.zip -AppName Procmon -PathToBinary Procmon64.exe }\n\t\t\tCustomResolutionUtility { Invoke-Download -URL extras/cru -Scoop -AppName CRU -PathToBinary CRU.exe}\n\t\t\tNotepadReplacer { Invoke-Download -URL utils/notepadreplacer -Scoop -AppName NotepadReplacer}\n\t\t\tprivacy.sexy { Invoke-Download -URL utils/privacysexy -Scoop -AppName privacysexy}\n\t\t\tReShade{\n\t\t\t\t$Website = \"https://reshade.me/\"\n\t\t\t\t$DLLink = (Invoke-WebRequest \"$Website#download\").Links.Href | Where-Object {$_ -Like \"*.exe\"} | Where-Object {$_ -NotLike \"*_Addon.exe\"}\n\t\t\t\t$URL = $Website + $DLLink\n\t\t\t\tInvoke-Download -URL $URL -AppName ReShade\n\t\t\t}\n\t\t}\n\t}\n\treturn $Paths\n}\n# Source: https://github.com/Aetopia/Install-NVCPL\nfunction Install-NVCPL {\n    if (!(Test-Admin)) {\n        Write-Host \"Install-NVCPL: This function needs Administrator priviledges\" -ForegroundColor DarkRed\n        return\n    }\n\n    choice.exe /C 12 /N /M \"Install NVIDIA Control Panel as:`n1. Win32 App`n2. UWP App`n>\"\n  \n    $NVCPL = \"$ENV:TEMP\\NVCPL.zip\"\n    $InstallationDirectory = \"$ENV:PROGRAMFILES\\NVIDIA Corporation\\Control Panel Client\"\n    $ShortcutFile = \"$ENV:PROGRAMDATA\\Microsoft\\Windows\\Start Menu\\Programs\\NVIDIA Control Panel.lnk\"\n    if ($LASTEXITCODE -eq 2) { $NVCPL = \"$NVCPL.appx\" }\n\n    if ($null -eq (Get-CimInstance Win32_VideoController |\n        Where-Object { $_.Name -like \"NVIDIA*\" })) {\n            Write-Host \"No NVIDIA GPU found.\" -ForegroundColor DarkRed\n            return\n        }\n\n        \n    # Disable Telemetry.\n    New-ItemProperty -Path \"HKLM:\\SOFTWARE\\NVIDIA Corporation\\NvControlPanel2\\Client\" -Name \"OptInOrOutPreference\" -Value 0 -PropertyType DWORD -Force -ErrorAction SilentlyContinue | Out-Null\n    New-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\nvlddmkm\\Global\\Startup\" -Name \"SendTelemetryData\" -Value 0 -PropertyType DWORD -Force -ErrorAction SilentlyContinue | Out-Null\n\n    \n    # Using rg-adguard to fetch the latest version of the NVIDIA Control Panel.\n    $Body = @{\n        type = 'url'\n        url  = \"https://apps.microsoft.com/store/detail/nvidia-control-panel/9NF8H0H7WMLT\"\n        ring = 'RP'\n        lang = 'en-US' \n    }\n    Write-Output \"Getting the latest version of the NVIDIA Control Panel from the Microsoft Store...\"\n    $Link = ((Invoke-RestMethod -Method Post -Uri \"https://store.rg-adguard.net/api/GetFiles\" -ContentType \"application/x-www-form-urlencoded\" -Body $Body) -Split \"`n\" | \n        ForEach-Object { $_.Trim() } |\n        Where-Object { $_ -like (\"*http://tlu.dl.delivery.mp.microsoft.com*\") } |\n        ForEach-Object { ((($_ -split \"<td>\", 2, \"SimpleMatch\")[1] -Split \"rel=\", 2, \"SimpleMatch\")[0] -Split \"<a href=\", 2, \"SimpleMatch\")[1].Trim().Trim('\"') })[-1]\n    Invoke-RestMethod \"$Link\" -OutFile \"$NVCPL\"\n  \n    if ($LASTEXITCODE -eq 2) {\n        Write-Output \"Installing the NVIDIA Control Panel as an UWP app...\"\n        Add-AppxPackage \"$NVCPL\" -ForceApplicationShutdown -ForceUpdateFromAnyVersion\n    }\n    else {\n  \n        Write-Output \"Installing the NVIDIA Control Panel as a Win32 app...\"\n  \n        # Run the NVIDIA Control Panel as an Administrator.\n        New-Item \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" -ErrorAction SilentlyContinue | Out-Null\n        New-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" -Name \"$InstallationDirectory\\nvcplui.exe\" -Value \"~ RUNASADMIN\" -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null\n  \n        # Disable the NVIDIA Root Container Service. The service runs when the NVIDIA Control Panel is launched.\n        Stop-Process -Name \"NVDisplay.Container\" -Force -ErrorAction SilentlyContinue\n        Set-Service \"NVDisplay.ContainerLocalSystem\" -StartupType Disabled -ErrorAction SilentlyContinue\n        Stop-Service \"NVDisplay.ContainerLocalSystem\" -Force -ErrorAction SilentlyContinue\n        foreach ($File in ($InstallationDirectory, $ShortcutFile)) { Remove-Item \"$File\" -Recurse -Force -ErrorAction SilentlyContinue }\n        Expand-Archive \"$NVCPL\" \"$InstallationDirectory\" -Force\n  \n        # This DLL is needed inorder to suppress the annoying pop-up that says the UWP Control Panel isn't installed.\n        Invoke-RestMethod \"$((Invoke-RestMethod \"https://api.github.com/repos/Aetopia/Install-NVCPL/releases/latest\").assets.browser_download_url)\" -OutFile \"$InstallationDirectory\\nvcpluir.dll\"\n        $WSShell = New-Object -ComObject \"WScript.Shell\"\n        $Shortcut = $WSShell.CreateShortcut(\"$ShortcutFile\")\n        $Shortcut.TargetPath = \"$InstallationDirectory\\nvcplui.exe\"\n        $Shortcut.IconLocation = \"$InstallationDirectory\\nvcplui.exe, 0\"\n        $Shortcut.Save()\n    }\n    Write-Output \"NVIDIA Control Panel Installed!\"\n}\nfunction Install-ZetaLoader {\n    $GameInstallDir = Get-SteamGameInstallDir \"Halo Infinite\"\n    $ZetaLoader = \"$((Invoke-RestMethod \"https://api.github.com/repos/Aetopia/ZetaLoader/releases/latest\").assets[0].browser_download_url)\"\n    if (!$GameInstallDir) {\n        Write-Error \"Halo Infinite hasn't been installed via Steam.\"\n        exit 1\n    }\n    Write-Output \"Installing ZetaLoader...\"\n    Invoke-RestMethod -Uri \"$ZetaLoader\" -OutFile \"$GameInstallDir\\dinput8.dll\"\n    Write-Output \"ZetaLoader has been installed.\"\n}\n\nfunction 4K-Notifier {\n    param(\n        [Parameter(Mandatory)]\n        [String]$Video,\n        [int]$Timeout = 30\n    )\n    if (!$Video){\n        $Video = Read-Host \"Pleaste paste in the URL of the video you'd like to wait for until it hits 4K\"\n    }\nif (Get-Command yt-dlp -Ea 0){\n    $ytdl = (Get-Command yt-dlp).Source\n}elseif(Get-Command youtube-dl -Ea 0){\n    $ytdl = (Get-Command youtube-dl).Source\n}else{\n    return @\"\nNor YouTube-DL or yt-dlp are installed or added to the path, please run the following command to install it:\niex(irm tl.ctt.cx);Get-ScoopApp main/yt-dlp\n\"@\n}\n''\n$Finished = $null\n$Attempt = 0\nWhile (!$Finished){\n    $Attempt++\n    $Response = & $ytdl -F $Video\n    if ($Response | Where-Object {$PSItem -Like \"*3840x2160*\"}){\n        $Finished = $True\n    }else{\n        Write-Host \"`rYour video has not been encoded to 4K, trying again (attempt no.$attempt) in $Timeout seconds..\" -NoNewLine \n        Start-Sleep -Seconds $Timeout\n        Write-Host \"`rTrying again..                                                       \" -NoNewLine -ForegroundColor Red\n        continue\n    }\n}\nSet-Clipboard -Value $Video\nWrite-Host @\"\n\nYouTubed finished processing your video, it's URL has been copied to your clipboard:\n$Video\n\"@ -ForegroundColor Green\n1..3 | ForEach-Object{\n    [Console]::Beep(500,300)\n    Start-Sleep -Milliseconds 100\n}\n}\n\nfunction Moony2 {\n    param(\n        [Switch]$NoIntro,\n        [Int]$McProcessID\n    )\n    $LaunchParameters = @{} # Fresh hashtable that will be splat with Start-Process\n\n    if (!$NoIntro){\n    Write-Host @'\nIf you're used to the original Moony, this works a little differently,\n\nWhat you just runned lets you create a batchfile from your current running game\nthat you can launch via a single click or even faster: via Run (Windows +R)\n\nPlease launch your Minecraft (any client/version) and press ENTER on your keyboard\nonce you're ready for it to create the batchfile\n'@\n    Pause\n    }\n\n    # java? is regex for either java or javaw\n    if (-Not(Get-Process java?)){\n        Write-Host \"There was no processes with the name java or javaw\"\n        pause\n        Moony -NoIntro\n        return\n    }else{\n        $ProcList = Get-Process -Name java?\n        if ($ProcList[1]){ # If $Procs isn't the only running java process\n                $Selected = Menu $ProcList.MainWindowTitle\n                $Proc = Get-Process | Where-Object {$_.MainWindowTitle -eq ($Selected)} # Crappy passthru\n                if ($Proc[1]){ # unlikely but w/e gotta handle it\n                    Write-Host \"Sorry my code is bad and you have multiple processes with the name $($Proc.MainWindowTitle), GG!\"\n                }\n        }else{$Proc = $ProcList} # lmk if theres a smarter way\n    }\n    $WinProcess = Get-CimInstance -ClassName Win32_Process | Where-Object ProcessId -eq $Proc.Id\n    $JRE = $WinProcess.ExecutablePath\n    $Arguments = $WinProcess.CommandLine.Replace($WinProcess.ExecutablePath,'')\n    if (Test-Path \"$HOME\\.lunarclient\\offline\\multiver\"){\n        $WorkingDirectory = \"$HOME\\.lunarclient\\offline\\multiver\"\n\n    }else{\n            # This cumbersome parse has been split in 3 lines, it just gets the right version from the args\n        $PlayedVersion = $Arguments.split(' ') |\n        Where-Object {$PSItem -Like \"1.*\"} |\n        Where-Object {$PSITem -NotLike \"1.*.*\"} |\n        Select-Object -Last 1\n        $WorkingDirectory = \"$HOME\\.lunarclient\\offline\\$PlayedVersion\"\n    }\n    if ($Arguments -NotLike \"* -server *\"){\n        Write-Host @\"\nWould you like this script to join a specific server right after it launches?\n\nIf so, type the IP, otherwise just leave it blank and press ENTER\n\"@  \n        $ServerIP = Read-Host \"Server IP\"\n        if ($ServerIP -NotIn '',$null){\n            $Arguments += \" -server $ServerIP\"\n        }\n    }\n\n    $InstanceName = Read-Host \"Give a name to your Lunar Client instance, I recommend making it short without spaces\"\n    if ($InstanceName -Like \"* *\"){\n        $InstanceName = Read-Host \"Since there's a space in your name, you won't be able to call it from Run (Windows+R), type it again if you are sure\"\n    }\n\n    Set-Content \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\\$InstanceName.cmd\" @\"\n@echo off\ncd /D \"$WorkingDirectory\"\nstart \"$JRE\" $Arguments\nif %ERRORLEVEL% == 0 (exit) else (pause)\n\"@\n    Write-Host \"Your $InstanceName instance should be good to go, try typing it's name in the Run window (Windows+R)\" -ForegroundColor Green\n    return\n\n}\nfunction Optimize-Bedrock {\n    [alias('optmcbe')]\n    [CmdletBinding()]\n    param(\n        [ValidateScript({\n                Test-Path $_ -PathType Leaf\n            })]\n        [String]$options = \"$env:localappdata\\Packages\\Microsoft.MinecraftUWP_8wekyb3d8bbwe\\LocalState\\games\\com.mojang\\minecraftpe\\options.txt\",\n\n\n        [ValidateSet('Low', 'High', 'ashanksupercool')]\n        $Preset = \"High\",\n\n        $Presets = @{\n\n            High = @{\n                gfx_viewdistance           = 256\n                gfx_particleviewdistance   = 1\n                gfx_viewbobbing            = 1\n                gfx_fancygraphics          = 1\n                gfx_transparentleaves      = 1\n                gfx_smoothlighting         = 1\n                gfx_fancyskies             = 1\n                gfx_msaa                   = 4\n                gfx_texel_aa_2             = 0\n                gfx_multithreaded_renderer = 1\n                gfx_vsync                  = 0\n            } \n        \n            Low = @{\n                gfx_viewdistance           = 160\n                gfx_particleviewdistance   = 0\n                gfx_viewbobbing            = 0\n                gfx_fancygraphics          = 0\n                gfx_transparentleaves      = 0\n                gfx_smoothlighting         = 0\n                gfx_fancyskies             = 0\n                gfx_msaa                   = 1\n                gfx_texel_aa_2             = 0\n                gfx_multithreaded_renderer = 1\n                gfx_vsync                  = 0\n            }\n            ashanksupercool = @{\n                gfx_viewdistance                                 = 256\n                gfx_particleviewdistance                         = 1\n                gfx_viewbobbing                                  = 1\n                gfx_fancygraphics                                = 0\n                gfx_transparentleaves                            = 1\n                gfx_vr_transparentleaves                         = 0\n                gfx_smoothlighting                               = 1\n                gfx_vr_smoothlighting                            = 0\n                gfx_fancyskies                                   = 0\n                gfx_field_of_view                                = 81.2\n                gfx_msaa                                         = 1\n                gfx_gamma                                        = 1\n                gfx_multithreaded_renderer                       = 1\n                gfx_vsync                                        = 0\n                dev_file_watcher                                 = 1\n                audio_music                                      = 0\n                gfx_hidepaperdoll                                = 1\n                dev_enable_texture_hot_reloader                  = 1\n                do_not_show_multiplayer_online_safety_warning    = 1\n                only_show_trusted_skins                          = 0\n                camera_shake                                     = 0\n                gfx_resizableui                                  = 0\n                gfx_hotbarScale                                  = 1\n                'keyboard_type_0_key.pickItem'                   = 75\n                'keyboard_type_0_key.hotbar.1'                   = 49\n                'keyboard_type_0_key.hotbar.2'                   = 50\n                'keyboard_type_0_key.hotbar.3'                   = 51\n                'keyboard_type_0_key.hotbar.4'                   = 52\n                'keyboard_type_0_key.hotbar.5'                   = 82\n                'keyboard_type_0_key.hotbar.6'                   = 70\n                'keyboard_type_0_key.hotbar.7'                   = 86\n                'keyboard_type_0_key.hotbar.8'                   = 90\n                'keyboard_type_0_key.hotbar.9'                   = '- 97'\n                'keyboard_type_0_key.inventory'                  = 69\n                'keyboard_type_0_key.togglePerspective'          = 53\n                'keyboard_type_0_key.jump'                       = 32\n                'keyboard_type_0_key.sneak'                      = 16\n                'keyboard_type_0_key.sprint'                     = 17\n                'keyboard_type_0_key.left'                       = 65\n                'keyboard_type_0_key.right'                      = 68\n                'keyboard_type_0_key.back'                       = 83\n                'keyboard_type_0_key.forward'                    = 87\n                'keyboard_type_0_key.mobEffects'                 = 88\n                'keyboard_type_0_key.chat'                       = 13\n                'keyboard_type_0_key.emote'                      = 0\n            }\n        }\n    )\n\n    Write-Host \"Optimize Minecraft bedrock with $Preset\"\n\n    $optionsTable = (Get-Content $options) -Replace ':', '=' | ConvertFrom-StringData\n    Write-Verbose ($optionsTable | ConvertTo-Json -Depth 3)\n\n    $optionsTable = Merge-Hashtables -Original $optionsTable -Patch $Presets.$Preset\n    Write-Verbose ($optionsTable | ConvertTo-Json -Depth 3)\n    \n    Set-Content $options -Value (ConvertTo-MCSetting $optionsTable) -Force\n}\n\nfunction Optimize-LunarClient {\n    <#\n    .SYNOPSIS\n    Display Name: Optimize Lunar Client\n    Platform: Linux; Windows\n    Category: Optimizations\n    Depends: Write-Diff; Merge-HashTables\n\n    .DESCRIPTION\n    Tunes a selected Lunar Client profile to your liking, it has some good defaults everyone should have (no numbers in scoreboard, modern keybind handling, no achievements, transparent texture packs section, borderless fullscreen..)\n\n    .PARAMETER Settings\n    Specify which specific tweak you'd like applying on your profile\n    Performance: Turn off performance-hungry settings\n    NoCosmetics: Disable all emotes, cosmetics, wings, hats..\n    MinimalViewBobbing: Keep item movement but disable walk bobbing\n    No16xSaturationOverlay: Remove the yellow 16x hunger bar overlay\n    HideToggleSprint: Hides the ToggleSprint status from HUD\n    ToggleSneak: Turns on ToggleSneak\n    DisableUHCMods: Disables ArmorHUD, DirectionHUD and Coordinates mods\n    FullBright: literally night vision    \n    #>\n    [alias('optlc')]\n    param(\n\n        #//[HelpMessage(\"Set your lazy chunk load speed\")]\n        [ValidateSet(\n            'highest',  \n            'high',     \n            'medium',   \n            'low',      \n            'lowest',   \n            'off_van'   \n            )]\n        [String]$LazyChunkLoadSpeed = 'low',\n\n        [ValidateSet(\n            'Performance',\n            'NoCosmetics',\n            'MinimalViewBobbing',\n            'No16xSaturationOverlay',\n            'HideToggleSprint',\n            'ToggleSneak',\n            'DisableUHCMods',\n            'FullBright',\n            'CouleursPreset'    \n        )]\n        #// Gotta be put twice because mf cant handle variables in validate sets\n        [Array]$Settings = (Invoke-Checkbox -Title \"Select tweaks to apply\" -Items @(\n            'Performance'\n            'NoCosmetics'\n            'MinimalViewBobbing'\n            'No16xSaturationOverlay'\n            'HideToggleSprint'\n            'ToggleSneak'\n            'DisableUHCMods'\n            'FullBright'\n            'CouleursPreset'\n        )),\n       \n        [String]\n        $LCDirectory = \"$HOME\\.lunarclient\",\n\n        [Switch]$NoBetaWarning,\n        [Switch]$KeepLCOpen,\n        [Switch]$DryRun\n\n        #//TODO: [Array]$Misc HideFoliage, NoEntityShadow, LCNametags, Clearglass, NoBackground, NoHypixelMods\n    )\n    \n    if (-Not(Test-Path $LCDirectory)){\n        Write-Host \"Lunar Client's directory ($HOME\\.lunarclient) does not exist (for the turbonerds reading this you can overwrite that with -LCDirectory\"\n    }\n    if (!$NoBetaWarning){\n        Write-Warning \"This script may corrupt your Lunar Client profiles, continue at your own risk,`nyou're probably safer if you copy the folder located at $(Convert-Path $HOME\\.lunarclient\\settings\\game)\"\n        pause\n    }\n    if (!$KeepLCOpen){\n        while ((Get-Process -Name java?).MainWindowTitle -Like \"Lunar Client*\"){\n            Write-Host \"You must quit Lunar Client before running these optimizations (LC will overwrite them when it exits)\" -ForegroundColor Red\n            pause\n        }\n    }else{\n        Write-Warning \"You disabled the script from not running if Lunar Client is running, here be dragons!\"\n        Start-Sleep -Milliseconds 500\n    }\n\n    if (!$LazyChunkLoadSpeed -and ('Performance' -in $Settings)){$LazyChunkLoadSpeed = 'low'}\n\n    $Manager = Get-Content \"$LCDirectory\\settings\\game\\profile_manager.json\" -ErrorAction Stop | ConvertFrom-Json\n    \n    $Profiles = @{}\n    ForEach($Profile in $Manager){\n        $Profiles += @{ \"$($Profile.DisplayName) ($($Profile.Name))\" = $Profile}\n    }\n\n    Write-Host \"Select a profile:\"\n    $Selection = Menu @([Array[]]'Create a new profile' + [Array[]]$Profiles.Keys)\n    if ($Selection -in $Manager.name,$Manager.DisplayName){\n        if ($VerbosePreference -eq 'Continue'){\n            Write-Host \"Error, Manager:`n`n\" -ForegroundColor Red\n            Write-Host ($Manager | ConvertTo-Json)\n            return\n            \n        }\n        return \"A profile with the same name already exists!\"\n    }\n\n    if ($Selection -eq 'Create a new profile'){\n        \n        $ProfileName = Read-Host \"Enter a name for the new profile\"\n        New-Item -ItemType Directory -Path \"$LCDirectory\\settings\\game\\$ProfileName\" -ErrorAction Stop | Out-Null\n        Push-Location \"$LCDirectory\\settings\\game\\$ProfileName\"\n        ('general.json', 'mods.json', 'performance.json') | ForEach-Object {\n            if (-Not(Test-Path ./$_)){Add-Content ./$_ -Value '{}'} # Empty json file \n        }\n        Pop-Location\n        $Selection = [PSCustomObject]@{\n\n            name = $ProfileName\n            displayName = $ProfileName\n            active = $False\n            default = $False\n            iconName = 'crossed-swords'\n            server = ''\n        }\n        $Manager += $Selection # Overwriting the string \"Create a new profile\" with the fresh one\n        Set-Content -Path \"$LCDirectory\\settings\\game\\profile_manager.json\" -Value ($Manager | ConvertTo-Json -Compress -Depth 99)\n    }else{\n        $Selection = $Profiles.$Selection\n    }\n\n    $ProfileDir = \"$LCDirectory\\settings\\game\\$($Selection.name)\"\n    ForEach($file in 'general','mods','performance'){ # Assigns $general, $mods and $performance variables\n        Set-Variable -Scope Global -Name $file -Value (Get-Content \"$ProfileDir\\$file.json\" -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop)\n        if ($DryRun){\n        Write-Host $file -ForegroundColor Red\n        (Get-Variable -Name $file).Value | ConvertTo-Json\n        }\n    }\n    \n    $Presets = @{\n        All = @{\n            general = @{\n                shift_effects_bl         = $false\n                achievements_bl\t         = $false\n                compact_menu_bl          = $true\n                modernKeybindHandling_bl = $true\n                borderless_fullscreen_bl = $true\n                trans_res_pack_menu_bg_bl = $true\n            }\n            mods = @{\n                chat = @{\n                    options = @{\n                        chat_bg_opacity_nr = \"0.0\"\n                    }\n                }\n                scoreboard = @{\n                    options = @{\n                        numbers_bl = $true\n                    }\n                }\n            }\n        }\n        CouleursPreset = @{\n            mods = @{\n                scoreboard = @{\n                    seen = $True\n                    x = 2 # Moves scoreboard 2 pixels to the right\n                }\n                potioneffects = @{\n                    seen = $True\n                    position = 'bottom_left'\n                    y = -246.5 # Middle left\n                }\n                saturation_hud_mod = @{\n                    seen = $True\n                    saturation_hud_mod_enabled_bl = $True\n                    position     = 'bottom_right' # Just right to the last hunger bar\n                    x            = -289\n                    y            = -37\n                    options = @{\n                        scale_nr          = 1.5 # Yellow\n                        text_clr_nr       = @{value=-171}\n                        background_clr_nr = @{value=0}\n                    }\n                }\n                zoom = @{\n                    seen = $True\n                    options = @{\n                        zoom_kblc         = 'KEY_X'\n                    }\n                }\n                bossbar = @{\n                    seen = $True\n                    bossbar_enabled_bl = $False\n                }\n            }\n        }\n        Performance = @{\n            general = @{\n                friend_online_status_bl\t= $false\n            }\n            performance = @{\n                lazy_chunk_loading\t= $LazyChunkLoadSpeed\n                ground_arrows_bl    = $false\n                stuck_arrows_bl     = $false\n                hide_skulls_bl      = $true\n                hide_foliage_bl     = $true\n            }\n        }\n        NoCosmetics = @{\n            general = @{\n                renderClothCloaks_bl         = $false\n                render_cosmetic_particles_bl = $false\n                backpack_bl                  = $false\n                dragon_wings_bl              = $false\n                pet_bl                       = $false\n                glasses_bl                   = $false\n                bandanna_bl                  = $false\n                mask_bl                      = $false\n                belts_bl                     = $false\n                neckwear_bl                  = $false\n                bodywear_bl                  = $false\n                hat_bl                       = $false\n                render_emotes_bl             = $false\n                render_emote_particles_bl    = $false\n                cloak_bl                     = $false\n                show_hat_above_helmet_bl     = $false\n                show_over_chestplate_bl      = $false\n                show_over_leggings_bl        = $false\n                show_over_boots_bl           = $false\n                scale_hat_with_skinlayer_bl  = $false\n            }\n        }\n        MinimalViewBobbing = @{\n            general = @{\n                minimal_viewbobbing_bl = $true\n            }\n        }\n        No16xSaturationOverlay = @{\n            mods = @{\n                saturation_mod = @{\n                    options = @{\n                        show_saturation_overlay_bl=$False\n                    }\n                }\n            }\n        }\n        HideToggleSprint = @{\n            mods = @{\n                toggleSneak = @{\n                     options = @{\n                         showHudText_bl = $false\n                     }\n                }\n            }\n        }\n        ToggleSneak = @{\n            mods = @{\n                toggleSneak = @{\n                    options = @{\n                        toggle_sneak_bl = $true\n                    }\n                }\n            }\n        }\n        DisableUHCMods = @{\n            mods = @{\n                waypoints = @{\n                    waypoints_enabled_bl = $false\n                }\n                directionhud = @{\n\t                directionhud_enabled_bl = $false\n                }\n                coords = @{\n\t                coords_enabled_bl = $false\n                }                \n                armorstatus = @{\n\t                armorstatus_enabled_bl = $false\n                }\n            }\n        }\n        FullBright = @{\n            mods = @{\n                lighting = @{\n                    lighting_enabled_bl = $true\n                    options = @{\n                        full_bright_bl\t= $true\n                    } \n                }\n            }\n        }\n\n    }\n        # Whatever you do that's highly recommended :+1:\n    $general = Merge-Hashtables -Original $general -Patch $Presets.All.general\n    $mods = Merge-Hashtables -Original $mods -Patch $Presets.All.mods\n    Write-Diff \"recommended settings (compact mods, fast chat)..\" -Positivity $True -Term \"Setting up\"\n\n    if ('Performance' -in $Settings){\n        $general = Merge-Hashtables -Original $general -Patch $Presets.Performance.general\n        $performance = Merge-Hashtables -Original $performance -Patch $Presets.Performance.performance\n        Write-Diff -Message \"notifications from LC friends getting on (causes massive FPS drop)\"\n        Write-Diff -Positivity $True -Message \"lazy chunk loading at speed $LazyChunkLoadSpeed\"\n        Write-Diff -Message \"ground arrows\"\n        Write-Diff -Message \"player/mob skulls\"\n        Write-Diff -Message \"foliage (normal/tall grass)\"\n    }\n    if ('NoCosmetics' -in $Settings){\n        $general = Merge-Hashtables -Original $general -Patch $Presets.NoCosmetics.general\n        ForEach($CosmeticRemoved in @(\n            \"cloth cloaks\" \n            \"cosmetic particles\" \n            \"backpacks\" \n            \"pets\"\n            \"dragon wings\"\n            \"bandannas\"\n            \"masks\"\n            \"belts\"\n            \"neckwears\"\n            \"bodywears\"\n            \"hats\"\n            \"emotes rendering\"\n            \"emote particles rendering\"\n            \"cloaks\"\n        )){\n            Write-Diff -Message $CosmeticRemoved -Term \"Disabled\"\n        }\n\n    }\n    if ('MinimalViewBobbing' -in $Settings){\n        $general = Merge-Hashtables -Original $general -Patch $Presets.MinimalViewBobbing.general\n        Write-Diff -Positivity $True -Message \"minimal view bobbing\"\n    }\n    if ('No16xSaturationOverlay' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.No16xSaturationOverlay.mods\n        Write-Diff -Positivity $False -Message \"16x saturation hunger bar overlay\"\n    }\n    if ('HideToggleSprint' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.HideToggleSprint.mods\n        Write-Diff -Positivity $False -Term \"Hid\" -Message \"ToggleSprint HUD\"\n    }\n    if ('ToggleSneak' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods $Presets.ToggleSneak.mods\n        Write-Diff -Positivity $True -Message \"ToggleSneak\"\n    }\n    if ('DisableUHCMods' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.DisableUHCMods.mods\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"Waypoints mod\"\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"DirectionHUD mod\"\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"Coordinates mod\"\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"ArmorStatus mod\"\n    }\n    if ('FullBright' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.FullBright.mods\n        Write-Diff -Term \"Added\" -Positivity $true -Message \"Fullbright (disable shaders before restarting)\"\n    }\n    if ('CouleursPreset' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.CouleursPreset.mods\n    }\n\n    ForEach($file in 'general','mods','performance'){ # Assigns $general, $mods and $performance variables\n        if ($DryRun){\n            Write-Host $file -ForegroundColor Red\n            (Get-Variable -Name $file).Value\n        }else{\n            ConvertTo-Json -Depth 99 -Compress -InputObject (Get-Variable -Name $file).Value -ErrorAction Stop | Set-Content \"$ProfileDir\\$file.json\" -ErrorAction Stop\n        }\n    }\n\n}\nfunction Optimize-OBS {\n    <#\n    .SYNOPSIS\n    Display Name: Optimize OBS\n    Platform: Linux; Windows\n    Category: Optimizations\n\n    .DESCRIPTION\n    Tune your OBS for a specific usecase in the snap of a finger!\n\n    .PARAMETER Encoder\n    Which hardware type you wish to record with\n    NVENC: NVIDIA's Fastest encoder, it lets you record in hundreds of FPS easily\n    AMF: AMD GPUs/Integrated GPUs encoder, not as good as NVENC but can still get out ~240FPS at most\n    QuickSync: Intel's GPU encoder, worst out of the three, note this is H264, not the new fancy but slow AV1\n    x264: Encoding using your CPU, slow but efficient, only use if necessary/you know what you're doing\n\n    .PARAMETER OBS64Path\n    If you've got a portable install or something, pass in the main OBS binary's path here\n\n    #>\n    [alias('optobs')]\n    param(\n        [ValidateSet('x264','NVENC','AMF','QuickSync')]\n        [String]$Encoder,\n        \n        [ValidateScript({Test-Path -Path $_ -PathType Leaf})]\n        [String]$OBS64Path,\n\n        [ValidateSet('HighPerformance')]\n        [String]$Preset = 'HighPerformance',\n\n        [ValidateSet(\n            'EnableStatsDock', 'OldDarkTheme','CouleursHotkeys')]\n        [Array]$MiscTweaks = (Invoke-CheckBox -Title \"Select misc tweaks to apply\" -Items (\n            'EnableStatsDock', 'OldDarkTheme','CouleursHotkeys')),\n\n        [ValidateScript({ Test-Path -Path $_ -PathType Container })]\n        [String]$OBSProfile = $null\n\n    )\n\n    if (!$Encoder){\n        $Encoders = [Ordered]@{\n            \"NVENC (NVIDIA GPUs)\" = \"NVENC\"\n            \"AMF (AMD GPUs)\" = \"AMF\"\n            \"QuickSync (Intel iGPUs)\" = \"QuickSync\"\n            \"x264 (CPU)\" = \"x264\"\n        }\n        Write-Host \"Select what OBS will use to record (use arrow keys and press ENTER to confirm)\"\n        $Key = Menu ([Collections.ArrayList]$Encoders.Keys)\n        $Encoder = $Encoders.$Key\n    }\n\n    $OBSPatches = @{\n        HighPerformance = @{\n            NVENC = @{\n                basic = @{\n                    AdvOut = @{\n                        RecEncoder = 'obs_nvenc_h264_tex'\n                    }\n                }\n                recordEncoder = @{\n                    bf=0\n                    cqp=18\n                    multipass='disabled'\n                    preset='p2'\n                    profile='main'\n                    psycho_aq='false'\n                    rate_control='CQP'\n                    lookahead= 'false'\n                    adaptive_quantization= 'false'\n                }\n            }\n            AMF = @{\n                Basic = @{\n                    ADVOut = @{\n                        RecQuality='Small'\n                        RecEncoder='h265_texture_amf'\n                        FFOutputToFile='true'\n                    }\n                }\n                recordEncoder = @{\n                    'cqp' = 20\n                    preset = 'speed'\n                    rate_control = 'CQP'\n                    ffmpeg_opts = \"MaxNumRefFrames=4 HighMotionQualityBoostEnable=1\"\n                }\n            }\n            QuickSync = @{\n\n                basic = @{\n                    AdvOut = @{\n                        RecEncoder = 'obs_qsv11'\n                    }\n                }\n                recordEncoder = @{\n                    enhancements = 'false'\n                    target_usage = 'speed'\n                    bframes = 0\n                    rate_control = 'ICQ'\n                    bitrate = 16500\n                    icq_quality = 18\n                    keyint_sec = 2\n                }\n                \n            }\n            x264 = @{\n                basic = @{\n                    ADVOut = @{\n                        RecEncoder='obs_x264'\n                    }\n                }\n                recordEncoder = @{\n                    crf=1\n                    keyint_sec=1\n                    preset='ultrafast'\n                    profile='high'\n                    rate_control='CRF'\n                    x264opts='qpmin=15 qpmax=15 ref=0 merange=4 direct=none weightp=0 no-chroma-me'\n                }\n            }\n        }\n    }\n\n    # Applies to all patches/presets\n    $Global = @{\n        basic = @{\n            Output = @{\n                RecType='Standard'\n                Mode='Advanced'\n            }\n            AdvOut = @{\n                RecRB='true'\n            }\n        }\n    }\n    $OBSPatches.$Preset.$Encoder = Merge-Hashtables $OBSPatches.$Preset.$Encoder $Global\n        # Merge with global, which will be added for all\n\n    if (!$OBSProfile){\n        Remove-Variable -Name OBSProfile\n        if (-Not($OBS64Path)){\n\n            $Parameters = @{\n                Path = @(\"$env:APPDATA\\Microsoft\\Windows\\Start Menu\",\"$env:ProgramData\\Microsoft\\Windows\\Start Menu\")\n                Recurse = $True\n                Include = 'OBS Studio*.lnk'\n            }\n            $StartMenu = Get-ChildItem @Parameters\n            \n            if (!$StartMenu){\n                if ((Get-Process obs64 -ErrorAction Ignore).Path){$OBS64Path = (Get-Process obs64).Path} # Won't work if OBS is ran as Admin\n                else{\n    return @'\nYour OBS installation could not be found, \nplease manually specify the path to your OBS64 executable, example:\n\nOptimize-OBS -OBS64Path \"D:\\obs\\bin\\64bit\\obs64.exe\"\n\nYou can find it this way:             \nSearch OBS -> Right click it\nOpen file location in Explorer ->\nOpen file location again if it's a shortcut ->\nShift right click obs64.exe -> Copy as path\n'@\n                }\n            }\n            if ($StartMenu.Count -gt 1){\n\n                $Shortcuts = $null\n                $StartMenu = Get-Item $StartMenu\n                ForEach($Lnk in $StartMenu){$Shortcuts += @{$Lnk.BaseName = $Lnk.FullName}}\n                \"There are multiple OBS shortcuts in your Start Menu folder. Please select one.\"\n                $ShortcutName = menu ($Shortcuts.Keys -Split [System.Environment]::NewLine)\n                $StartMenu = $Shortcuts.$ShortcutName\n                $OBS64Path = Get-ShortcutTarget $StartMenu\n            }else{\n                $OBS64Path = Get-ShortcutTarget $StartMenu\n            }\n\n        }\n\n        if (!$IsLinux -or !$IsMacOS){\n            [Version]$CurVer = (Get-Item $OBS64Path).VersionInfo.ProductVersion\n            if ($CurVer -lt [Version]\"28.1.0\"){\n                Write-Warning @\"\nIt is strongly advised you update OBS before continuing (for compatibility with new NVENC/AMD settings)\n\nDetected version: $CurVer\nobs64.exe path: $OBS64Path\npause\n\"@\n            }\n        }\n\n        Set-CompatibilitySettings $OBS64Path -RunAsAdmin\n\n        if (Resolve-Path \"$OBS64Path\\..\\..\\..\\portable_mode.txt\" -ErrorAction Ignore){ # \"Portable Mode\" makes OBS make the config in it's own folder, else it's in appdata\n\n            $ProfilesDir = (Resolve-Path \"$OBS64Path\\..\\..\\..\\config\\obs-studio\\basic\\profiles\" -ErrorAction Stop)\n        }else{\n            $ProfilesDir = (Resolve-Path \"$env:APPDATA\\obs-studio\\basic\\profiles\" -ErrorAction Stop)\n        }\n        $Profiles = Get-ChildItem $ProfilesDir\n\n        ForEach($OBSProfile in $Profiles){$ProfilesHash += @{$OBSProfile.Name = $OBSProfile.FullName}}\n\n        $ProfileNames = ($ProfilesHash.Keys -Split [System.Environment]::NewLine) + 'Create a new profile'\n        \"Please select a profile (use arrow keys to navigate, ENTER to select)\"\n        $OBSProfile = menu  $ProfileNames\n\n        if ($OBSProfile -eq 'Create a new profile'){\n            $NewProfileName = Read-Host \"Enter a name for the new profile\"\n            $OBSProfile = Join-Path $ProfilesDir $NewProfileName\n            New-Item -ItemType Directory -Path $OBSProfile -ErrorAction Stop\n            $DefaultWidth, $DefaultHeight = ((Get-CimInstance Win32_VideoController).VideoModeDescription.Split(' x ') | Where-Object {$_ -ne ''} | Select-Object -First 2)\n            if (!$DefaultWidth -or !$DefaultHeight){\n                $DefaultWidth = 1920\n                $DefaultHeight = 1080\n            }\n            Set-Content \"$OBSProfile\\basic.ini\" -Value @\"\n[General]\nName=$NewProfileName\n\n[Video]\nBaseCX=$DefaultWidth\nBaseCY=$DefaultHeight\nOutputCX=$DefaultWidth\nOutputCY=$DefaultHeight\n\"@\n            Write-Host \"Created new profile '$NewProfileName' with default resolution of $DefaultWidth`x$DefaultHeight\" -ForegroundColor DarkGray\n        }else{\n            $OBSProfile = $ProfilesHash.$OBSProfile\n        }\n    }\n    if ('basic.ini' -notin ((Get-ChildItem $OBSProfile).Name)){\n       return \"FATAL: Profile $OBSProfile is incomplete (missing basic.ini)\"\n    }\n    Write-Verbose \"Tweaking profile $OBSProfile\"\n    try {\n        $Basic = Get-IniContent \"$OBSProfile\\basic.ini\" -ErrorAction Stop\n    } catch {\n        Write-Warning \"Failed to get basic.ini from profile folder $OBSProfile\"\n        $_\n        return\n    }\n    if ($Basic.Video.FPSType -ne 2){ # then switch to fractional FPS\n        $FPS=$Basic.Video.FPSCommon\n        $Basic.Video.FPSType = 2\n        $Basic.Video.FPSNum = 60\n        $Basic.Video.FPSDen = 1\n\n        Write-Warning \"Your FPS is at the default (60), you can go in Settings -> Video to set it to a higher value\"\n    }\n\n    $FPS = $Basic.Video.FPSNum/$Basic.Video.FPSDen\n    $Pixels = [int]$Basic.Video.BaseCX*[int]$Basic.Video.BaseCY\n\n    if (($Basic.AdvOut.RecTracks -NotIn '1','2') -And ($FPS -gt 120)){\n        Write-Warning \"Using multiple audio tracks while recording at a high FPS may cause OBS to fail to stop recording\"\n    }\n\n    if (!$Basic.Hotkeys.ReplayBuffer){\n        Write-Warning \"Replay Buffer is enabled, but there's no hotkey to Save Replay, set it up in Settings -> Hotkeys\"\n    }\n\n    $Basic = Merge-Hashtables -Original $Basic -Patch $OBSPatches.$Preset.$Encoder.basic -ErrorAction Stop\n    Out-IniFile -FilePath \"$OBSProfile\\basic.ini\" -InputObject $Basic -Pretty -Force\n\n    if ($Basic.Video.BaseCX -and $Basic.Video.BaseCY -and $Basic.Video.OutputCX -and $Basic.Video.OutputCY){\n\n        $Base = \"{0}x{1}\" -f $Basic.Video.BaseCX,$Basic.Video.BaseCY\n        $Output = \"{0}x{1}\" -f $Basic.Video.OutputCX,$Basic.Video.OutputCY\n        if ($Base -Ne $Output){\n            Write-Warning \"Your Base/Canvas resolution ($Base) is not the same as the Output/Scaled resolution ($Output),`nthis means OBS is scaling your video. This is not recommended.\"\n        }    \n    }\n    \n    $NoEncSettings = -Not(Test-Path \"$OBSProfile\\recordEncoder.json\")\n    $EmptyEncSettings = (Get-Content \"$OBSProfile\\recordEncoder.json\" -ErrorAction Ignore) -in '',$null\n\n    if ($NoEncSettings -or $EmptyEncSettings){\n        Set-Content -Path \"$OBSProfile\\recordEncoder.json\" -Value '{}' -Force \n    }\n    $RecordEncoder = Get-Content \"$OBSProfile\\recordEncoder.json\" | ConvertFrom-Json -ErrorAction Stop\n\n    if (($Basic.Video.FPSNum/$Basic.Video.FPSDen -gt 480) -And ($Pixels -ge 2073600)){ # Set profile to baseline if recording at a high FPS and if res +> 2MP\n        $RecordEncoder.Profile = 'baseline'\n    }\n    $RecordEncoder = Merge-Hashtables -Original $RecordEncoder -Patch $OBSPatches.$Preset.$Encoder.recordEncoder -ErrorAction Stop\n    if ($Verbose){\n        ConvertTo-Yaml $Basic\n        ConvertTo-Yaml $RecordEncoder    \n    }\n    Set-Content -Path \"$OBSProfile\\recordEncoder.json\" -Value (ConvertTo-Json -InputObject $RecordEncoder -Depth 100) -Force\n\n    if ($True -in [bool]$MiscTweaks){ # If there is anything in $MiscTweaks\n        $global = Get-Item (Join-Path ($OBSProfile | Split-Path | Split-Path | Split-Path) -ChildPath 'global.ini') -ErrorAction Stop\n        $glob = Get-IniContent -FilePath $global\n\n        if ('OldDarkTheme' -in $MiscTweaks){\n            $glob.General.CurrentTheme3 = 'Dark'\n        }\n\n        if ('CouleursHotkeys' -in $MiscTweaks){\n            if (!$glob.Hotkeys){$glob.Hotkeys = @{}}\n            $glob.Hotkeys.'OBSBasic.EnablePreview'  = '{\"bindings\":[{\"control\":true,\"key\":\"OBS_KEY_RETURN\"}]}'\n            $glob.Hotkeys.'OBSBasic.DisablePreview' = '{\"bindings\":[{\"control\":true,\"key\":\"OBS_KEY_RETURN\"}]}'\n            $glob.Hotkeys.'ReplayBuffer'            = '{\"ReplayBuffer.Save\":[{\"alt\":true,\"key\":\"OBS_KEY_NONE\",\"shift\":true}]}'\n            $glob.Hotkeys.'OBSBasic.ResetStats'     = '{\"bindings\":[{\"control\":true,\"key\":\"OBS_KEY_NONE\",\"shift\":true}]}'\n        }\n\n        if ('OldDarkTheme' -in $MiscTweaks){\n\n            $glob.BasicWindow.geometry = 'AdnQywADAAAAAAe/////uwAADJ0AAAKCAAAHv////9oAAAydAAACggAAAAEAAAAACgAAAAe/////2gAADJ0AAAKC'\n            $glob.BasicWindow.DockState = 'AAAA/wAAAAD9AAAAAgAAAAAAAAJOAAABvPwCAAAAAfsAAAASAHMAdABhAHQAcwBEAG8AYwBrAQAAABYAAAG8AAAA5gD///8AAAADAAAE3wAAALr8AQAAAAX7AAAAFABzAGMAZQBuAGUAcwBEAG8AYwBrAQAAAAAAAAD4AAAAoAD////7AAAAFgBzAG8AdQByAGMAZQBzAEQAbwBjAGsBAAAA/AAAAPoAAACgAP////sAAAASAG0AaQB4AGUAcgBEAG8AYwBrAQAAAfoAAAFBAAAA3gD////7AAAAHgB0AHIAYQBuAHMAaQB0AGkAbwBuAHMARABvAGMAawEAAAM/AAAAtAAAAI4A////+wAAABgAYwBvAG4AdAByAG8AbABzAEQAbwBjAGsBAAAD9wAAAOgAAACeAP///wAAAo0AAAG8AAAABAAAAAQAAAAIAAAACPwAAAAA'\n        }\n\n        $glob | Out-IniFile -FilePath $global -Force\n    }\n    Write-Host \"Finished patching OBS, yay! Please switch profiles or reload OBS to see changes\" -ForegroundColor Green\n    Write-Host \"You can find more information about OBS configuration at \" -ForegroundColor Green -NoNewline\n    Write-Host \"ctt.cx/obs\"\n}\nfunction Optimize-OptiFine {\n    [alias('optof')]\n    param(\n        [ValidateSet('Smart','Lowest','CouleursPreset')]\n        [Parameter(Mandatory)]\n        $Preset,\n        [String]$CustomDirectory = (Join-path $env:APPDATA '.minecraft'),\n        [Switch]$MultiMC,\n        [Switch]$PolyMC,\n        [Switch]$GDLauncher\n    )\n\nif($MultiMC){\n    $CustomDirectory = Get-ChildItem \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\" -Recurse | Where-Object Name -Like \"MultiMC.lnk\"\n    $CustomDirectory = Get-ShortcutPath $CustomDirectory\n    $Instances = Get-ChildItem (Join-Path (Split-Path $CustomDirectory) instances)\n    \"Please select a MultiMC instance\"\n    $CustomDirectory = menu (Get-ChildItem $Instances).Name\n    $CustomDirectory = Join-Path $Instances $CustomDirectory\n\n}elseif($PolyMC){\n    $Instances = Get-ChildItem \"$env:APPDATA\\PolyMC\\instances\"\n    \"Please select a PolyMC instance\"\n    $CustomDirectory = menu $Instances.Name\n    $CustomDirectory = Join-Path $Instances $CustomDirectory\n\n}elseif($GDLauncher){\n    $Instances = Get-ChildItem \"$env:APPDATA\\gdlauncher_next\\instances\"\n    \"Please select a GDLauncher instance\"\n    $CustomDirectory = menu $Instances.Name\n    $CustomDirectory = Join-Path $Instances $CustomDirectory\n\n}\n\n$Presets = @{\n\n    CouleursPresets = @{\n        options = @{\n            'key_key.hotbar.5' = 19\n            'key_key.hotbar.6' = 20\n            'key_key.hotbar.7' = 33\n            'key_key.hotbar.8' = 34\n            'key_key.hotbar.9' = 0\n            chatScale      = 0.8\n            chatWidth      = 0.65\n            guiScale       = 3\n            renderDistance = 7\n            maxFps         = 260\n            chatOpacity    = 0.25\n            enableVsync    = $False\n            pauseOnLostFocus = $False\n        }\n    }\n\n    Smart = @{\n        options = @{\n            renderDistance=5\n            mipmapLevels=4\n            ofAoLevel=1.0\n        }\n        optionsof = @{\n            ofMipmapType=3\n            ofCustomSky=$true\n        }\n    }\n\n    Lowest = @{\n        options = @{\n            gamma=1000000 # I've never tried anything else and this always worked\n            renderDistance=2\n            particles=2\n            fboEnable=$true\n            useVbo=$true\n            showInventoryAchievementHint=$false\n        }\n        optionsof = @{\n            ofAaLevel=0 # Anti-Aliasing\n            ofDynamicLights=3\n            ofChunkUpdates=1\n            ofAoLevel=0.0 # Smooth lighting\n            ofOcclusionFancy=$false\n            ofSmoothWorld=$true\n            ofClouds=3\n            ofTrees=1\n            ofDroppedItems=0\n            ofRain=3\n            ofAnimatedWater=2\n            ofAnimatedLava=2\n            ofAnimatedFire=$true\n            ofAnimatedPortal=$false\n            ofAnimatedRedstone=$false\n            ofAnimatedExplosion=$false\n            ofAnimatedFlame=$true\n            ofAnimatedSmoke=$false\n            ofVoidParticles=$false\n            ofWaterParticles=$false\n            ofPortalParticles=$false\n            ofPotionParticles=$false\n            ofFireworkParticles=$false\n            ofDrippingWaterLava=$false\n            ofAnimatedTerrain=$false\n            ofAnimatedTextures=$false\n            ofRainSplash=$false\n            ofSky=$false\n            ofStars=$false\n            ofSunMoon=$false\n            ofVignette=1\n            ofCustomSky=$false\n            ofShowCapes=$false\n            ofFastMath=$true\n            ofSmoothFps=$false\n            ofTranslucentBlocks=1\n        }\n    }\n}\n$Global = @{\n    optionsof = @{\n        ofFastRender=$true\n        ofClouds=3\n        ofAfLevel=1 # Anisotropic filtering\n        ofAaLevel=0 # Anti-aliasing\n        ofRainSplash=$false\n    }\n    options = @{\n        showInventoryAchievementHint=$false\n        maxFps=260\n        renderClouds=$false\n        useVbo=$true\n    }\n}\n$Presets.$Preset = Merge-Hashtables $Presets.$Preset $Global\n\nfunction ConvertTo-MCSetting ($table){\n\n    $file = @()\n    ForEach($setting in $table.keys){\n        $file += [String]$($setting + ':' + ($table.$setting)) -replace'True','true' -replace 'False','false'\n    }\n    return $file\n}\n\nforeach ($file in 'options','optionsof'){\n\n    $Hash = (Get-Content \"$CustomDirectory\\$file.txt\") -Replace ':','=' | ConvertFrom-StringData\n    $Hash = Merge-Hashtables -Original $Hash -Patch $Presets.$Preset.$file\n    Set-Content \"$CustomDirectory\\$file.txt\" -Value (ConvertTo-MCSetting $Hash) -Force\n}\nif (Test-Path \"$CustomDirectory\\optionsLC.txt\"){\n    $Hash = (Get-Content \"$CustomDirectory\\optionsLC.txt\") -Replace ',\"maxFps\":\"260\"','' | ConvertFrom-Json\n}\n$Hash = Merge-Hashtables -Original $Hash -Patch $Presets.$Preset.optionsof\n$Hash = Merge-Hashtables -Original $Hash -Patch $Presets.$Preset.options\n$Hash.maxFPS = 260\nSet-Content \"$CustomDirectory\\optionsLC.txt\" -Value (ConvertTo-Json $Hash) -Force\n\n}\nExport-ModuleMember * -Alias *\n})) | Import-Module -DisableNameChecking -Global\n"
  },
  {
    "path": "README.MD",
    "content": "</br>\n\n<p align=\"center\">\n    <img align=center src=\"https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/ps_black_64.svg?sanitize=true\" alt=\"PS7 logo\" width=\"75\" />  </br>\n    <strong>TweakList</strong> </br>\n    </br>\n    Versatile PowerShell module that automate various post-install jobs you waste time on</br>\n    <a href=\"https://github.com/couleur-tweak-tips/TweakList/blob/master/docs/TweakFuncs.md\">Overview</a>\n    •\n    <a href=\"https://dsc.gg/ctt\">Discord Server</a>\n    •\n    <a href=\"https://github.com/couleur-tweak-tips/TweakList/tree/master/docs\">Docs</a>\n</p>\n<p align=\"center\">\n    <a href=\"https://github.com/couleur-tweak-tips/TweakList\">\n        <img src=\"https://img.shields.io/github/size/couleur-tweak-tips/TweakList/Master.ps1?label=Master%20script%20size&logo=PowerShell&logoColor=FFFFFF\" alt=\"Code Size\" />\n    </a>\n    <a href=\"https://discord.com/invite/aPVMJy78Pa\">\n        <img src=\"https://img.shields.io/discord/774315187183288411?color=7389D8&labelColor=6A7EC2&label=Discord&logo=discord&logoColor=white alt=\"Discord\" />\n    </a>\n    <a href=\"https://github.com/couleur-tweak-tips/TweakList/blob/master/LICENSE\">\n        <img src=\"https://img.shields.io/github/license/couleur-tweak-tips/TweakList.svg\" alt=\"License\" />\n    </a>\n\n</p>\n</br>\n\n[logo]: https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/ps_black_64.svg?sanitize=true\n\n\nTweakList is a PowerShell module aiming to regroup every impactful tweaks for fine tuning, stripping and optimizing Windows, each tweaks has its own file **and can be put together as a \"[TweakScript](https://gist.github.com/couleurm/68d272edc5fb930c31b96b667813e373 \"TweakList example\")\"**\n\n## Get started with a single command\nEach function is in it's [own file](https://github.com/couleur-tweak-tips/TweakList/tree/master/modules), but at each commit a [script](https://github.com/couleur-tweak-tips/TweakList/blob/master/.github/workflows/main.yml) adds up all of them to a single file ([Master.ps1](https://github.com/couleur-tweak-tips/TweakList/blob/master/Master.ps1)) which you can download and import with the following command:\n\n```PowerShell\niex(irm tl.ctt.cx);\n```\n\nYou can learn more about all the functions available in the [/docs/](https://github.com/couleur-tweak-tips/TweakList/tree/master/docs) directory.\n</br>\n\n##### It can do very useful stuff like:\n\n* [Completely automated setup and installation of Scoop (a portable, UAC-less package manager for Windows) and any of it's apps from any bucket](https://github.com/couleur-tweak-tips/TweakList/blob/master/docs/TweakFuncs.md#get)\n* Automatically configure [OBS](https://github.com/couleur-tweak-tips/TweakList/blob/master/docs/TweakFuncs.md#optimize-obs), [OptiFine](https://github.com/couleur-tweak-tips/TweakList/blob/master/docs/TweakFuncs.md#optimize-optifine) and [Voukoder](https://youtu.be/BBp2PnmRHmk)\n* [Remove useless entries from the context menu (aka file/folder right click menu)](https://github.com/couleur-tweak-tips/TweakList/blob/master/modules/Remove-ContextMenu.ps1)\n* [Import functions](https://github.com/couleur-tweak-tips/TweakList/blob/master/modules/Import-Sophia.ps1) from [Sophia Script](https://github.com/farag2/Sophia-Script-for-Windows)\n* Easily run any of [my scripts](https://github.com/couleur-tweak-tips/utils). \n\n\n---\n\n\n## 📝Tweak Functions planned:\n\n- \"Global checks\" function that warns user if bloat is running (Synapse, iCue, OneDrive)\n- Use and parse [autorunsc](https://docs.microsoft.com/en-us/sysinternals/downloads/autoruns#autorunsc-usage) to parse every programs that runs at startup\n- Make combos that run multiple functions at once (e.g completly cleans the taskbar)\n- Disabling defender / mitigations / spectre & meltdown (with warnings of course)\n- Heavy stripping (with warnings of course)\n- Quick ways to download & run the latest version of DDU/NVCleanstall\n\n💭 *(This list will get longer as times goes on, this is what I remembered from the top of my head)*\n\n## How TweakList works in the background:\n\n- Each Tweak Function has its own designated file, with a function declaration that has the exact same name as the file that hosts it\n- At each commit, GitHub actions will add up the content of every single file into a Master script that holds the latest version of every Tweak Function\n- Then people can open PowerShell and run the Master script, which will let the user be able to run every TweakList function, this can be used in a script (e.g your favorite e-sport player's tweaklist) or simply be typed from the command line\n\n## I've borrowed some stuff (with permission), from these scripts/lists:\n\n* [farag2](https://i.imgur.com/Vf1pthm.png)'s [Sophia Script](https://github.com/farag2/Sophia-Script-for-Windows), it contains 150+ functions for automating Windows' settings just right (perfect when you just installed Windows)\n* [Zusier](https://i.imgur.com/hAL2wGf.png)'s [optimization batch](https://github.com/Zusier/Zusiers-optimization-Batch)\n* [Melody](https://i.imgur.com/6nZSqh3.png)'s [Basic Tweaks list](https://sites.google.com/view/melodystweaks/basictweaks)\n* [Major Geeks](https://i.imgur.com/fKbpDnl.png)' [Windows Registry Tweaks](https://www.majorgeeks.com/files/details/majorgeeks_registry_tweaks.html), similar to Sophia Script, it also has a lot of .REGs to debloat the context menu (file right click menu)\n\n"
  },
  {
    "path": "buildManifests.ps1",
    "content": "<#\n\n    .DESCRIPTION\n\n    Splits string-based description from hashtable-based key;values\n\n    .EXAMPLE\n    $desc, $value = Get-Metadata @\"\n    Hey this is a description\n\n    key1: value1\n    key2: value2\n    \"@\n#>\nfunction Get-Metadata ($string) {\n    $desc = $string -split \"`n\" | Where-Object { $_ -NotLike \"*: *\" -and $_.trim() } | Where-Object { $_ -notlike \"//*\" }\n    $values = $string -split \"`n\" | Where-Object { $_ -Like \"*: *\" } | Where-Object { $_ -notlike \"//*\" }\n\n    $value_table = [PSCustomObject]@{}\n    if ($values) {\n\n        foreach ($line in $values) {\n            [string]$key, [string]$value = ($line -split ':', 2).trim()\n            if (!$key -or !$value) {\n                Write-Error \"Failed getting metadata from`n$($string | ConvertTo-Json -Depth 3)\"\n            }\n\n            $value_table | Add-Member -MemberType NoteProperty -Name $key -Value $value\n        }\n    }\n    else {\n        $values = \"\"\n    }\n    if (!$desc) { $desc = \"\" }\n    return @($desc, $value_table)\n}\n\n\nfunction buildManifests2 {\n    param(\n        $Path = (Get-ChildItem ./modules/ -File -Recurse -Include *.ps1)\n    )\n    $ManifestList = [PSCustomObject]::new()\n\n    foreach($i in $Path){\n\n        $filepath = Get-Item $i -ErrorAction Stop\n\n\n        $funcName = $filepath.BaseName        \n        . $filepath.FullName -ErrorAction Stop\n        $HelpInfo = Get-Help $funcName -ErrorAction Stop\n\n        $Manifest = [PSCustomObject]::new()\n\n        $relativePath = $filepath.FullName.Replace($PSScriptRoot,'') -replace '\\\\', '/'\n\n        $Manifest | Add-Member -MemberType NoteProperty -Name path -Value $relativePath\n        \n        \n        if ($desc = $HelpInfo.description.Text) {\n            # .DESCRIPTION\n            \n            $Manifest | Add-Member -MemberType NoteProperty -Name description -Value $desc\n        }\n        else {\n            # function is not documented, skip\n            continue\n        }\n\n        if ($null, $values = Get-Metadata $HelpInfo.details.description.Text) {\n            foreach ($object in $values.psobject.properties) {\n                $key, $value = $object.name, $object.value\n                $Manifest | Add-Member -MemberType NoteProperty -Name $key -Value $value\n            }\n        }\n\n        if (!$Manifest.display) {\n            $Manifest | Add-Member -MemberType NoteProperty -Name display -Value ($FuncName -replace '-', ' ')\n        }\n\n        $Manifest | Add-Member -MemberType NoteProperty -Name parameters -Value ([PSCustomObject]::new())\n\n        foreach ($parameter in $HelpInfo.parameters.parameter) {\n\n\n            [PSCustomObject]$param = [PSCustomObject]::new()\n\n            # if ($parameter.name -in @('misctweaks')){wait-debugger}\n\n            if ($desc, $values = Get-Metadata $parameter.description.Text) {\n\n                if ($desc) {\n                    $param | Add-Member -MemberType NoteProperty -Name description -Value $desc\n                }\n\n                if ($values.PSObject.Properties.Count) {\n                    if ($values -is [String]){\n                        $values = @($values)\n                    }\n                    $param | Add-Member -MemberType NoteProperty -Name values -Value $values\n                }\n            }\n            if (!$param.values) {\n\n                if ($ValidateSets = (Get-Command $funcName).Parameters.$($Parameter.Name).Attributes.ValidValues) {\n                    if ($ValidateSets -is [String]){\n                        $ValidateSets = @($ValidateSets)\n                    }\n                    $param | Add-Member -MemberType NoteProperty -Name values -Value $ValidateSets\n                }\n            }\n            if ($parameter.defaultValue -and $parameter.type.name -ne \"Array\") {\n                $param | Add-Member -MemberType NoteProperty -Name default -Value $parameter.defaultValue\n            }\n\n            $param | Add-Member -MemberType NoteProperty -Name type -Value $(switch ($parameter.type.name) {\n                    Array {\n                        if ($param.values) {\n                            \"enum[]\"\n                        }\n                        else {\n                            Wait-Debugger\n                        }\n                    }\n                    String {\n                        if ($param.values) {\n                            \"enum\"\n                        }\n                        else {\n                            \"string\"\n                        }\n                    }\n                    SwitchParameter {\n                        \"boolean\"\n                    }\n                    default {\n                        Write-Warning \"Unknown type $()\"\n                    }\n                })\n\n            if ($parameter.required -eq \"true\") {\n                $param | Add-Member -MemberType NoteProperty -Name required -Value $true\n            }\n            \n            $Manifest.parameters | Add-Member -MemberType NoteProperty -Name $parameter.name -Value $param\n        } # foreach param\n\n        $ManifestList | Add-Member -MemberType NoteProperty -Name $funcName -Value $Manifest\n    } # foreach file\n\n    return $ManifestList\n}\nbuildManifests2"
  },
  {
    "path": "buildMaster.ps1",
    "content": "[CmdletBinding()]\nparam(\n    [Switch]$Write, # Returns it instead of importing it\n    [String]$Directory = $PSScriptRoot\n)\nif (!$Directory) {\n    Write-Warning \"No directory was passed, defaulting to $($PWD.Path)\"\n    pause\n}\nelse {\n    Push-Location $Directory\n}\n\n\n$FunctionCount = 0\n\n$Master = [System.Text.StringBuilder]::new(@\"\n# This file is automatically built at every push to combine every function into a single file\n\nusing namespace System.Management.Automation # Required by Invoke-NGENpsosh\nRemove-Module TweakList -ErrorAction Ignore\nNew-Module TweakList ([ScriptBlock]::Create({\n\n\"@)\n\nGet-ChildItem ./helpers, ./modules -Recurse -File | ForEach-Object {\n    switch ($_) {\n        { $_.Extension -eq '.ps1' } {\n            Write-Verbose \"Dot-sourcing $_\"\n            . $_.FullName\n            # Wait-Debugger\n            try {\n                Get-Command $_.BaseName -CommandType Function -ErrorAction Stop | Out-Null\n            }\n            catch {\n                Write-Host \"$_ has mismatched basename/function declared\" -ForegroundColor Red\n                break\n            }\n            $Master.Append([System.Environment]::NewLine + (Get-Content $_ -Raw)) | Out-Null\n            $FunctionCount++\n        }\n    } }\n\n$Master.Append(@\"\n\nExport-ModuleMember * -Alias *\n})) | Import-Module -DisableNameChecking -Global\n\"@) | Out-Null\n\n$Master = $Master.ToString()\n\nif (!$Write) {\n    Write-Host \"Imported $FunctionCount functions\"\n    Invoke-Expression $Master\n}\nelse {\n    return $Master\n}\n\nPop-Location"
  },
  {
    "path": "dev/Install-sucklesscut.ps1",
    "content": "function Install-sucklesscut {\n    param(\n        $CustomDIR\n    )\n    if ($CustomDir -and !$DIR){ # Manually installing it, not from \n        if (!(Test-Path \"$CustomDir\\mpv.conf\")){\n            Write-Host \"The folder you gave needs to be the config folder of MPV\" -ForegroundColor Red\n            Write-Host @(\n                \"It should contain files such as ``mpv.conf``, ``input.conf``,\"\n                \"and have a folder named ``scripts``\"\n                -join \"`n\")\n            return\n        }else{\n            $DIR = (Get-Item $CustomDir).FullName\n        }\n    }\n    \"There's two ways to set up the suckless-cut.lua script:\"\n    \"\"\n    \"Yes - Load the script when launching it via a shortcut in Send To (simplest, recommended)\"\n    \"No - Add it permanently in your MPV's config (requires you to know where it's located)\"\n    if (Get-Boolean -Message \"Your choice: \"){\n        $Shortcut = Join-Path [System.Environment]::GetFolderPath('SendTo') 'suckless-cut.lnk'\n\n        if (Test-Path $Shortcut){\n            Remove-Item $Shortcut\n        }\n        \n        $Parameters = @{\n            Overwrite = $True\n            LnkPath = $Shortcut\n            TargetPath = Get-Path mpv.exe\n            Arguments = \"script=`\"$DIR\\suckless-cut.lua`\"\"\n            Icon = \"$DIR\\suckless-cut.icon\"\n        }\n        New-Shortcut @Parameters\n        Write-Host \"Installed! Right-click any video file(s), in the Send To drop-down select ``suckless-cut``\" -ForegroundColor Green\n    }else {\n        if (!$CustomDIR){\n\n            $RootFolder = if ($MPVPath = Get-Path mpv){ # Assign $MPVPath if it exists\n                $MPVPath | Split-Path # $RootFolder will hold this value \n            } else{ # or else this one\n                $env:HOMEDRIVE\n            }\n\n            Add-Type -AssemblyName Windows.Forms\n            # Create an object and properties\n            $FolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog\n            $FolderBrowser.Description = \"Select your MPV config folder\"\n            $FolderBrowser.RootFolder = $RootFolder\n            $FolderBrowser.ShowNewFolderButton = $False\n            [void]$FolderBrowser.ShowDialog()\n            if (!$FolderBrowser.SelectedPath){\n                Write-Host \"Cancelling installation!\" -ForegroundColor Red\n                return\n            } else{\n                \n            }\n        }\n    }\n}"
  },
  {
    "path": "dev/Optimize-Apex.ps1",
    "content": "function Optimize-Apex {\n    [alias('optal')]\n    param(\n\n        [ValidateScript({\n            Test-Path $_ -Type Leaf\n            (Get-Item $_).Name -eq 'r5apex.exe'\n            (Get-Item $_).FullName -Like \"*\\Apex Legends\\r5apex.exe\"\n        })]\n        [String]$r5apexpath\n    )\n\n    $Preset = @{\n        'setting.r_lod_switch_scale' = 0.05\n        cl_particle_fallback_base = 4\n        cl_particle_fallback_multiplier = 1\n        mat_picmic = 3\n        stream_memory = 200000\n        \n    }\n\n### Launch Opts\n$MaxHz =  (Get-CimInstance Win32_VideoController).MaxRefreshRate\n$Opts = \"-high -dev -forcenovsync -fullscreen -preload +mat_compressedtextures 1 +cl_ragdoll_collide 0 -threads 6 +cl_showfps 1 -console +fps_max $MaxHz\"\n\"The following launch options have been copied to your clipboard:\"\n$Opts\nSet-Clipboard $Opts\n\n### Finding r5\n$Shortcut = Get-ChildItem \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\" -Recurse | Where-Object Name -eq \"Apex Legends.lnk\"\nif (!$Shortcut){\n    return \"Could not find shortcut to Apex Legends in start menu, exitting..\"\n}\nSet-CompatibilitySettings $Shortcut -DisableFullScreenOptimizations\n$r5apex = Get-ShortcutTarget -ShortcutPath $Shortcut\n\nfunction ConvertFrom-ApexConfig {\n    param(\n        [Parameter(ValueFromPipeline = $true)]\n        $Config\n    )\n    $Original = @{}\n    ForEach($Line in $Config){\n        $Line = $Line -Replace '\"',''\n        $Key, $Value = $Line.Split(' ')\n        if ($Value -is [Array]){\n            $Value = $Value[0]\n        }\n        if (!$Original.$Key){\n            $Original += @{$Key = $Value}\n        }\n    }\n    return $Original\n}\n\nConvertTo-ApexConfig ($Top,$Config){\n    $Content = @\"\n$(($Top | Where-Object {$_ -NotIn '',$null}) -join [System.Environment]::NewLine)\n\"@\n    ForEach($Setting in $Config){\n        $Content += \"$($Setting.Key) `\"$($Setting.Value)`\"\" + [System.Environment]::NewLine\n    }\n}\n\n### Parsing config\n$autoexec = Join-Path (Split-Path $r5apex -Parent) \"cfg\\autoexec.cfg\"\nif (Test-Path $autoexec){\n    $Config = Get-Content $autoexec | Where-Object {[Regex]::Matches($_,'\"').Count -eq 2} # Filter there are two quotes per the line\n    $Top = Get-Content $autoexec | Where-Object {[Regex]::Matches($_,'\"').Count -ne 2} # Filter the rest (binds ect..)\n    $Config = $Config | ConvertFrom-ApexConfig\n}else{\n    $Config = @{}\n    $Top = @{}\n}\n\n$Profile = Get-Content \"$HOME\\*\\Respawn\\Apex\\profile\\profile.cfg\" | ConvertFrom-ApexConfig\n$Original = @{}\nForEach($Line in $Profile){\n    $Line = $Line.Replace('\"','')\n    $Key, $Value = $Line.Split(' ')\n    if (!$Original.$Key){\n        $Original += @{$Key = [float]$Value}\n    }\n}\n$Profile = $Original\n\n}"
  },
  {
    "path": "dev/Optimize-Apex2.ps1",
    "content": "function Optimize-Apex2{\nparam(\n\t[ValidateScript({Test-Path -Path $_ -PathType Leaf})]\n\t[ValidateScript({(Get-Item $_).Extension -eq \".exe\"})]\n\t[String]$r5apexPath\n)\n\nfunction StartMenu {\n\t$Lnk = \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Apex Legends.lnk\" \n\tif (-Not(Test-Path $Lnk)){\n\n\t\treturn $False\n\t}\n\t$ApexDir = (New-Object -ComObject WScript.Shell).CreateShortcut((Get-Item $Lnk -ErrorAction Stop)).TargetPath | Split-Path\n\tif (-not(Test-Path $ApexDir)){\n\t\treturn $False\n\t}else{\n\t\treturn $ApexDir\n\t}\n}\nfunction MuiCache {\n\n\t$Path = \"REGISTRY::HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache\"\n\n\tif (-not (Test-Path $Path)){\n\t\treturn $False\n\t}\n\t\n\t$Key = (Get-ItemProperty $Path -ErrorAction Ignore | Get-Member | Where-Object Name -Like \"*r5apex.exe.FriendlyAppName\").Name\n\tif (!$Key){\n\t\treturn $false\n\t}else{\n\t\treturn ($Key.TrimEnd(\".FriendlyAppName\") | Split-Path)\n\t}\n\n}\n\n# Looks dumb? Yes, works? As well, let me know a cleaner way 👍\n$ApexDir = if (StartMenu){StartMenu}elseif(MuiCache){MuiCache}\n\nif (!$ApexDir){\nreturn @\"\nCouldn't find Apex Legends' executable (r5apex.exe), please find it yourself,\nshift right click it -> Copy As Path and then launch this tweakfunc again with -r5apexPath `\"..\\common\\Apex Legends\\r5apex.exe`\"\n\"@\n}\n}\n"
  },
  {
    "path": "dev/Optimize-CheatBreaker.ps1",
    "content": "function Optimize-CheatBreaker {\n    param(\n        [String]$gameDir = (if($isLinux){\"$HOME\\.minecraft\"}else{\"$env:APPDATA\\.minecraft\"})\n    )\n\n    $Presets = @{\n        All = @{\n            global = @{\n                \"Transparent background\" = $true\n                \"Dark Mode\" = $True\n                \"Customization Level\" = \"Advanced\"\n                \"Container Background\" = \"None\"\n                \"Show Potion info in inventory\" = $false\n                labels = @{\n\n                }\n            }\n            profile = @{\n                \"Pack Tweaks\" = @{\n                    \"Clear Glass\" = \"REGULAR\"\n                    \"Transparent Inventory\" = $true\n                }\n            }\n        }\n        NoCosmetics = @{\n            global = @{\n                \"Show CheatBreaker Capes\" = $False\n                \"Show CheatBreaker Wings\" = $false\n                \"Show OptiFine Hats\" = $false\n            }\n        }\n        BorderlessFullscreen = @{\n            global = @{\n                \"Borderless Fullscreen\" = $true\n            }\n        }\n        ConfirmDisconnect = @{\n            global = @{\n                \"Disconnect Confirmation Prompt\" = $true\n            }\n        }\n        PotionEffects = @{\n            state = $true\n            settings = @{\n                \"Amplifier Exclude List\" = @(12)\n                \"Duration Exclude List\" = @(12)\n                \"Exclude Specific Effects\" = @(12)\n                \"Effect Name\" = $False\n                \"Icon\" = false\n            }\n            info = @{\n                \"xTranslation\" = 91\n                \"state\" = true\n                \"position\" = \"MIDDLE_BOTTOM_RIGHT\"\n            }\n        }\n        StrongVignette = @{\n            \"Pack Tweaks\" = @{\n                state = $true\n                \"Vignette Minimum Opacity\" = 100\n                \"Vignette Type\" = \"Amplified\"\n            }\n        }\n        FastChat = @{\n            \"Chat\" = @{\n                state = $true\n                \"Show Background\" = \"OFF\"\n            }\n        }\n        NoBossbarAndCooldowns = @{\n            \"Boss Bar\" = @{\n                state = $false\n            }\n            \"Cooldowns\" = @{\n                state = $false\n            }\n        }\n        AlwaysCritsAndSharpParticles = @{\n            \"Particles\" = @{\n                state = $true\n                \"Sharpness Particles\" = \"Always\"\n                \"Show Active Effect Particles\" = false\n                \"Crit Particles\" = \"Always\"\n            }\n        }\n        TurnOnToggleSprintHidden = @{\n            \"renderHUD\" = false\n            \"state\" = true\n        }\n        MotionBlur = @{\n            \"Amount\" = 10\n            \"wasRenderHUD\" = $true\n            \"state\" = true\n        }\n    }\n\n\n}"
  },
  {
    "path": "dev/Set-SteamLaunchOptions.ps1",
    "content": "function Set-SteamLaunchOptions {\n   param(\n        [Parameter(Mandatory=$True)]\n        [int]$GameID,\n\n        [String]$SteamPath = (Get-SteamPath),\n\n        [Parameter(Mandatory=$True)]\n        [String]$Options\n    )\n    \n    if (!$SteamPath){\n        Write-Host \"Set-LaunchOptions: Steam's path could not be found, returning.\"\n        return\n    }\n\n    $Users = @{}\n\n    Get-ChildItem $SteamPath/userdata -Directory | ForEach-Object {\n        \n        $localconfig = Get-Item \"$PSItem/config/localconfig.vdf\" -ErrorAction Stop\n        $configobject = ConvertFrom-VDF (Get-Content $localconfig)\n        $PersonaName = $configobject.UserLocalConfigStore.friends.PersonaName\n\n        $Users += @{\n            $PersonaName = $localconfig\n        }\n\n    }\n\n    $localconfig = if ($Users.Count -gt 1){\n        $Selected = (Invoke-CheckBox -Title \"Select users to apply launch options on\" -Items ([Array]$Users.Keys))\n        if (!$Selected){\n            Write-Host \"No user selected, returning.\"\n            returned\n        }\n        $Users[$Selected]\n    }elseif($Users.Count -eq 1){\n        Write-Host \"Configuring launch options on Steam user ``$($Users.Keys)``\" -ForegroundColor Green\n        $localconfig # the loop has only went through a single user\n    }else{\n        Write-Host \"No accounts found in $SteamPath\\userdata to configure, returning.\"\n        return\n    }\n\n    if(Get-Process steam -ErrorAction Ignore){\n        \n        Write-Warning \"Steam is still running, launch options may get overwrote\"\n        \n    }\n\n    Copy-Item -Path $localconfig -Destination \"$($localconfig.FullName).bak\"\n    Write-Host \"localconfig.vdf backed up @ $($localconfig.FullName).bak)\"\n\n    $Base = ConvertFrom-VDF (Get-Content $localconfig -ErrorAction Stop | Where-Object {$_}) -ErrorAction Stop\n\n    if (!$base.UserLocalConfigStore.Software.Valve.Steam.apps.$GameID){\n        Write-Host \"Set-LaunchOptions: No local config for game ID ```$GameID``\"\n        return\n    }\n\n    $base.UserLocalConfigStore.Software.Valve.Steam.apps.$GameID.LaunchOptions = $Options\n\n    ConvertTo-VDF $Base | Set-Content $localconfig -ErrorAction Stop\n\n\n    \n}"
  },
  {
    "path": "docs/Acronyms.md",
    "content": "## Commonly used Acronyms\n\nWe'll often use certain terms when discussing about TweakList in general, here's a clear definition for each term:\n\n* **TweakList**: Script that starts by importing all the tweakfuncs, then executes a bunch of them\n* **Tweak Functions** (AKA tweakfuncs): .ps1 file containing a function declaration which has the same name as the file (nested functions are allowed)"
  },
  {
    "path": "docs/Making your own tweakfuncs.MD",
    "content": "# Functions\n\n1. All your code in your .ps1 file must be within a function declaration block (unless you have a good reason for it), doing so makes it not execute and will only be interpreted when it'll be ran by a user/other function.\n2. Use a `param()` block in your functions instead of the simpler `function Foo($Arg1, $Arg2){`, example:\n3. If your code makes use of `using ...` it needs to be the very first stuff to be ran,\n(e.g `Invoke-NGENPosh` uses namepace `System.Management.Automation`), add it to the build script\n\n\n```PowerShell\nfunction Foo {\n    param(\n        [String]$Path,\n        [Switch]$ShowWidgets\n    )\n    # ...\n}\n```\n\n# TweakList-UI\n\nIn order for your function to be properly formatted and showcased on [TweakList-UI](https://github.com/couleur-tweak-tips/TweakList-UI), you must follow these guidelines:\n\nEach function which has a multiline comment header (`<# .. #>`) makes it automatically parsed by `/buildManifests.ps1` and structured in `./Manifests.json` for it to be used by TweakList-UI\n\nBetween your ``function Verb-Noun {`` and the start of your `param` block, you can put a multiline command (`<#`, `#>`),\nthen format it like so:\n```PowerShell\n<#\n    .SYNOPSIS\n    Category: Optimizations\n    Platform: Windows; Linux; Your mom's 2008 Dell PDC-91\n    Display Name: Verb Noun\n\n    .DESCRIPTION\n    This incredible tweak will multiply your gigashits by ^10 😳\n        - (149.99£ or 15,000 Hone invites, no refunds)\n\n    .PARAMETER ARG1\n    Specify weight of gigashit\n    1KG: Will be enough to multiply it by 2\n    2KG: Will put CTT out of business\n    10KG: Not tested, reminder that we are not liable for any explosion due to the use of TweakList on your computer\n#>\n```\nValues are separated by a colon and a space, multiple values (e.g see `Platform: `) MUST be separated by a semi-colon and a space\n\n\n# Common PowerShell pitfalls\n\nPowerShell was made to replace batch, but you can still use some batch commands in PowerShell by typing ``cmd /c`` before them\n\n```bat\ncmd /c assoc .ps1\n```\n\nassoc is a specific batch command, but a lot of other commands can be used in PowerShell as well because they're just executables in System32 (PING.exe, tracert.exe, timeout.exe, setx.exe, shutdown.exe reg.exe, tskill.exe,)\n\nIf you're only familiar with handling the registry in batch, you'll only have to change your fancy for and if statements, ``REG.EXE`` can be used the same way on PowerShell\n\n## PowerShell 5.1 alias overrides\n\n-  5.1 is the version of PowerShell that comes with Windows 10/11 \n\nPer default, curl in PowerShell is an alias for the cmdlet ``Invoke-WebRequest``, if you wish to use curl in that version, make sure you specify it's .exe extension\n\nA verbose way to make it cross-platform is to replace it with `$((Get-Command curl -CommandType Application).Source | Select-Object -First 1)`\n\n```bat\ncurl.exe -L https://github.com/couleur-tweak-tips/utils/archive/refs/heads/main.zip\n```\nSame thing for where.exe, which is an alias to Where-Object, just specify it's full cmdlet name."
  },
  {
    "path": "docs/Making your own tweaklist.MD",
    "content": "# Making your own TweakList\n\n## Setting up VSCode\n\nIf you want to be comfortable while making your very own list of tweaks, I strongly recommend you to install [VSCode](https://code.visualstudio.com) with the [PowerShell extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell), import the functions one time to get them loaded so you have the function's parameters' autocompletion.\n\nAlternatively you can use [Notepad++](https://notepad-plus-plus.org/) which has syntax highlighting.\n\n\nYou can alternatively install it with Scoop or Chocolatey:\n```PowerShell\niex(irm tl.ctt.cx); get extras/vscode\n```\n\n```PowerShell\nchocolatey install vscode -y\n```\n\n## The tweaklist itself\n\nEvery tweaklist start with the following line:\n\n```PowerShell\nirm tl.ctt.cx | iex\n```\n> If you're getting errors about a failed TLS handshake, put in ``[System.Net.ServicePointManager]::SecurityProtocol = 'Tls12'`` before (some old Windows builds don't enforce TLS 1.2)\n\nThis will get ./Master.ps1 from the repository, and imports the code as a module\n\n### The functions and their parameters\n\nThe best way to learn how to use them is by looking at other people's tweaklists and the code behind the functions themselves, I've left a bunch of comments on them to make it easier to understand what's going on.\n\nEvery parameter needs a `-` before them, example:\n\n```PowerShell\nFileExtensions -Show\n```\nThis will run the FileExtensions function with the Show parameter, it'll go in the registry and edit the value for it to show file extensions in Windows.\n\nThis type of parameter is a ``switch``, it is declared at the start of the function as a variable with [switch] before it. When running the function with it, the variable $Show will be equal to the $true (PowerShell boolean uses variable :shrug:)\n\nYou can also pass in arrays of strings like so:\n\n```PowerShell\nRemove-KnownAppxPackages -Exclude Calculator, MicrosoftStore\n```"
  },
  {
    "path": "docs/TweakFuncs.md",
    "content": "# TweakFuncs\nEach file in [/modules/](https://github.com/couleur-tweak-tips/TweakList/tree/master/modules) and [/helpers/](https://github.com/couleur-tweak-tips/TweakList/tree/master/helpers) contains a function that has the same name,\nThis file shows you a list of modules and how to use each of them.\nAt each commit, [GitHub Actions](https://github.com/couleur-tweak-tips/TweakList/actions) compiles them to a [single file](https://github.com/couleur-tweak-tips/TweakList/blob/master/Master.ps1),\nwhich you can run to declare all of them by simply typing `iex(irm tl.ctt.cx)` in PowerShell.\n\n## Import-Sophia\n\nParses farag's [Sophia Script](https://github.com/farag2/Sophia-Script-for-Windows) and imports all functions as a temporary module\n\n#### CB-CleanTaskbar\nThis is a Combo function, which imports the Sophia Script's functions (via `Import-Sophia`/`ipso`) and runs the following:\n```PowerShell\nCortanaButton -Hide\nPeopleTaskbar -Hide\nTaskBarSearch -Hide\nTaskViewButton -Hide\nUnpinTaskbarShortcuts Edge, Store, Mail\n```\nRestarting the explorer is needed for a few of them to refresh.\n\n## Get\nThis lets you easily install programs and some of my scripts in a very short command that allows a lot of aliases\n\n```PowerShell\nGet DisplayDriverUninstaller 7-Zip Smoothie\n# Will do the same thing as:\ng ddu 7z sm\n```\n\n## Launch\n\nThis lets you download some \"throw-away\" [programs](https://github.com/couleur-tweak-tips/TweakList/blob/master/modules/Installers/Launch.ps1) to TEMP, it returns the path of the main binary\n\n- DisplayDriverUninstaller\n- NVCleanstall\n- NvidiaProfileInspector\n- MSIUtilityV3\n- Rufus\n- AutoRuns\n- Procmon\n- CustomResolutionUtility\n- NotepadReplacer\n- privacy.sexy\n- ReShade\n\n(List may be out of date)\n\n\nYou can pair this with PowerShell's `&` operator:\n\n```PowerShell\niex(irm tl.ctt.cx);\n& (Launch DisplayDriverUninstaller)\n```\nIt has tab completion and can loop over multiple apps (e.g `Launch DisplayDriverUninstaller, privacy.sexy, Rufus`)\n\n## Get-ScoopApp\nUsed by `Get`, it installs a specific app using the [Scoop](https://scoop.sh) package manager, if it fails to find it in your available [Buckets](https://github.com/ScoopInstaller/Scoop#known-application-buckets) it look in other known buckets, as well as [mine](https://github.com/couleur-tweak-tips/utils/tree/main/bucket). You can also specify a bucket before the name of the app (e.g `extras/firefox`, `utils/smoothie`) and it will get Git/bucket if needed.\n```ps\n# Will do same thing as 'Get DisplayDriverUninstaller'\nGet-ScoopApp extras/ddu\n```\n\n\n\n## Get-FunctionContent\nSimply returns the content of a function you provide\n\nIf you're auditing or snooping at what TweakList is capable\nthis is a good way to lurk around\n```PowerShell\nGet-FunctionContent Get-ScoopApp\n# or it's alias:\ngfc Get-ScoopApp\n```\n\nYou can also pipe what it returns to your clipboard (to paste it in your IDE)\n```PowerShell\nGet-FunctionContent Merge-HashTables | Set-Clipboard\n```\nYou can also use `bat` to have vim-key navigation and syntax highlighting\n```PowerShell\ngfc Launch | bat -l PowerShell\n```\n\n## Optimize-OBS\n\nThis will find your OBS installation, ask you which profile to tune, and adjust the settings that matter for performance\n\n\n```PowerShell\nOptimize-OBS -Encoder NVENC -OBS64Path \"D:\\Scoop\\OBS\\bin\\obs64.exe\"\n```\nAvailable encoders are NVENC (for NVIDIA GPUs), AMF (for AMD GPUs), QuickSync (for intel iGPUs) and x264 (CPU).\n\n## Optimize-OptiFine\n\nSame process as OBS, if you're not using .minecraft in the APPDATA, indicate it with the GameDir `-CustomDirectory`.\n\n```PowerShell\nOptimize-OptiFine -Preset Smart\n```\nThere is also the \"Lowest\" preset which turns every setting down (prepare for a very ugly game).\n\n## Optimize-LunarClient\n\nSpecify which specific tweak you'd like applying on one (or a new) LunarClient Profile\n- **Performance**: Turn off performance-hungry settings\n- **NoCosmetics**: Disable all emotes, cosmetics, wings, hats..\n- **MinimalViewBobbing**: Keep item movement but disable walk bobbing\n- **No16xSaturationOverlay**: Remove the yellow 16x hunger bar overlay\n- **HideToggleSprint**: Hides the ToggleSprint status from HUD\n- **ToggleSneak**: Turns on ToggleSneak\n- **DisableUHCMods**: Disables ArmorHUD, DirectionHUD and Coordinates mods\n- **FullBright**: literally night vision\n\n\n## Add-ContextMenu and Remove-ContextMenu\nRemember that list of actions you can do when right-clicking a file/folder? The more programs you install, the more crowded it gets, Windows also has it's fair share of very specific actions no one really cares about\n\n#### Remove-ContextMenu can remove the following:\n* PinToQuickAccess\n* RestorePreviousVersions\n* Print\n* GiveAccessTo\n* EditWithPaint3D\n* IncludeInLibrary\n* AddToWindowsMediaPlayerList\n* CastToDevice\n* EditWithPaint3D\n* EditWithPhotos\n* Share\n* TakeOwnerShip\n* 7Zip\n* WinRAR\n* Notepad++\n* OpenWithOnBatchFiles\n* SendTo\n\nBe sure to take advantage of TAB completion/cycling!\n```ps\nRemove-ContextMenu WinRAR, Share, EditWithPaind3D\n```\n\n\n#### Add-ContextMenu can add the following:\n* SendTo\n* TakeOwnership\n* OpenWithOnBatchFiles\n\nIt works the same way as ``Remove-ContextMenu``\n\n## RemovePackBangs\n\nThis simply removes exclamation points and spaces from the start of your resourcepack's filenames\n\nIt defaults to the default /.minecraft/resourcepacks (override it with `-PackFolderPath`), it does not check recursively for obvious reasons\nturns\n```PowerShell\n!       §1look at me look at me I am first in your pack list!!!!!!.zip\n!    §5Kool§cKirby§fKlan.zip\n! Pack Special Noël !.zip\n```\ninto\n```PowerShell\n§1look at me look at me I am first in your pack list!!!!!!.zip\n§5Kool§cKirby§fKlan.zip\nPack Special Noël !.zip\n```"
  },
  {
    "path": "helpers/Assert-Choice.ps1",
    "content": "function Assert-Choice {\n    if (-Not(Get-Command choice.exe -ErrorAction Ignore)){\n        Write-Host \"[!] Unable to find choice.exe (it comes with Windows, did a little bit of unecessary debloating?)\" -ForegroundColor Red\n        PauseNul\n        exit 1\n    }\n}"
  },
  {
    "path": "helpers/Assert-Path.ps1",
    "content": "function Assert-Path {\n    param(\n        $Path\n    )\n    if (-Not(Test-Path -Path $Path)) {\n        New-Item -Path $Path -Force | Out-Null\n    }\n}"
  },
  {
    "path": "helpers/FindInText.ps1",
    "content": "function FindInText{\n    <#\n    Recreated a simple grep for finding shit in TweakList,\n    I mostly use this to check if a function/word has ever been mentionned in all my code\n    #>\n    param(\n        [String]$String,\n        $Path = (Get-Location),\n        [Array]$Exclude,\n        [Switch]$Recurse\n    )\n\n    $Exclude += @(\n    '*.exe','*.bin','*.dll'\n    '*.png','*.jpg'\n    '*.mkv','*.mp4','*.webm'\n    '*.zip','*.tar','*.gz','*.rar','*.7z','*.so'\n    '*.pyc','*.pyd'\n    )\n\n    $Parameters = @{\n        Path = $Path\n        Recurse = $Recurse\n        Exclude = $Exclude\n    }\n    $script:FoundOnce = $False\n    $script:Match = $null\n    Get-ChildItem @Parameters -File | ForEach-Object {\n        $Match = $null\n        Write-Verbose (\"Checking \" + $PSItem.Name)\n        $Match = Get-Content $PSItem.FullName | Where-Object {$_ -Like \"*$String*\"}\n        if ($Match){\n            $script:FoundOnce = $True\n            Write-Host \"- Found in $($_.Name) ($($_.FullName))\" -ForegroundColor Green\n            $Match\n        }\n    }\n\n    if (!$FoundOnce){\n        Write-Host \"Not found\" -ForegroundColor red\n    }\n}"
  },
  {
    "path": "helpers/Get-7zPath.ps1",
    "content": "function Get-7zPath {\n\n    if (Get-Command 7z.exe -Ea Ignore){return (Get-Command 7z.exe).Source}\n\n    $DefaultPath = \"$env:ProgramFiles\\7-Zip\\7z.exe\"\n    if (Test-Path $DefaultPath) {return $DefaultPath}\n\n    Try {\n        $InstallLocation = (Get-Package 7-Zip* -ErrorAction Stop).Metadata['InstallLocation'] # Compatible with 7-Zip installed normally / with winget\n        if (Test-Path $InstallLocation -ErrorAction Stop){\n            return \"$InstallLocation`7z.exe\"\n        }\n    }Catch{} # If there's an error it's probably not installed anyways\n\n    if (Get-Boolean \"7-Zip could not be found, would you like to download it using Scoop?\"){\n        Install-Scoop\n        scoop install 7zip\n        if (Get-Command 7z -Ea Ignore){\n            return (Get-Command 7z.exe).Source\n        }else{\n            Write-Error \"7-Zip could not be installed\"\n            return \n        }\n\n    }else{return}\n\n    # leaving this here if anyone knows a smart way to implement this ))\n    # $7Zip = (Get-ChildItem -Path \"$env:HOMEDRIVE\\*7z.exe\" -Recurse -Force -ErrorAction Ignore).FullName | Select-Object -First 1\n\n}\n"
  },
  {
    "path": "helpers/Get-Boolean.ps1",
    "content": "function Get-Boolean {\n    param(\n        $Message\n    )\n    $null = $Response\n    $Response = Read-Host $Message\n    While ($Response -NotIn 'yes','y','n','no'){\n        Write-Host \"Answer must be 'yes','y','n' or 'no'\" -ForegroundColor Red\n        $Response = Read-Host $Message\n    }\n    if ($Response -in 'yes','y'){return $true}\n    elseif($Response -in 'n','no'){return $false}\n    else{Write-Error \"Invalid response\";pause;exit}\n}"
  },
  {
    "path": "helpers/Get-EncodingArgs.ps1",
    "content": "\nfunction Get-EncodingArgs{\n    [alias('genca')]\n    param(\n        [String]$Resolution = '3840x2160',\n        [Switch]$Silent,\n        [Switch]$EzEncArgs\n    )\n\nInstall-FFmpeg\n\n$DriverVersion = (Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_Display.Driver\" -ErrorAction Ignore).DisplayVersion\n    if ($DriverVersion){ # Only triggers if it parsed a NVIDIA driver version, else it can probably be an NVIDIA GPU\n        if ($DriverVersion -lt 477.41){ # Oldest NVIDIA version capable\n        Write-Warning \"Outdated NVIDIA Drivers detected ($DriverVersion), you won't be able to encode using NVENC util you update them.\"\n    }\n}\n\n$EncCommands = [ordered]@{\n    'HEVC NVENC' = 'hevc_nvenc -rc vbr  -preset p7 -b:v 400M -cq 19'\n    'H264 NVENC' = 'h264_nvenc -rc vbr  -preset p7 -b:v 400M -cq 16'\n    'HEVC AMF' = 'hevc_amf -quality quality -qp_i 16 -qp_p 18 -qp_b 20'\n    'H264 AMF' = 'h264_amf -quality quality -qp_i 12 -qp_p 12 -qp_b 12'\n    'HEVC QSV' = 'hevc_qsv -preset veryslow -global_quality:v 18'\n    'H264 QSV' = 'h264_qsv -preset veryslow -global_quality:v 15'\n    'H264 CPU' = 'libx264 -preset slow -crf 16 -x265-params aq-mode=3'\n    'HEVC CPU' = 'libx265 -preset medium -crf 18 -x265-params aq-mode=3:no-sao=1:frame-threads=1'\n}\n\n$EncCommands.Keys | ForEach-Object -Begin {\n    $script:shouldStop = $false\n} -Process {\n    if ($shouldStop -eq $true) { return }\n    Invoke-Expression \"ffmpeg.exe -loglevel fatal -f lavfi -i nullsrc=$Resolution -t 0.1 -c:v $($EncCommands.$_) -f null NUL\"\n    if ($LASTEXITCODE -eq 0){\n        $script:valid_args = $EncCommands.$_\n        $script:valid_ezenc = $_\n\n        if ($Silent){\n            Write-Host (\"Found compatible encoding settings using $PSItem`: {0}\" -f ($EncCommands.$_)) -ForegroundColor Green\n        }\n        $shouldStop = $true # Crappy way to stop the loop since most people that'll execute this will technically be parsing the raw URL as a scriptblock\n    }\n}\n\nif (-Not($script:valid_args)){\n    Write-Host \"No compatible encoding settings found (should not happen, is FFmpeg installed?)\" -ForegroundColor DarkRed\n    Get-Command FFmpeg -Ea Ignore\n    pause\n    return\n}\n\nif ($EzEncArgs){\n    return $script:valid_ezenc\n}else{\n    return $valid_args\n}\n\n}"
  },
  {
    "path": "helpers/Get-FunctionContent.ps1",
    "content": "function Get-FunctionContent {\n    [alias('gfc')]\n    [CmdletBinding()]\n    param([Parameter()]\n        [String[]]$Functions,\n        [Switch]$Dependencies,\n        [Switch]$ReturnNames\n    )\n\n    $FunctionsPassed = [System.Collections.ArrayList]@()\n    $Content = [System.Collections.ArrayList]@()\n\n    Get-Command $Functions -ErrorAction Stop | ForEach-Object { # Loop through all functions\n        if ($Resolved = $_.ResolvedCommand){ # Checks if $_.ResolveCommand exists, also assigns it to $Resolved\n            Write-Verbose \"Switching from alias $_ to function $($Resolved.Name)\" -Verbose\n            $_ = Get-Command $Resolved.Name\n        }\n        if ($_ -NotIn $FunctionsPassed){ # If it hasn't been looped over yet\n\n            $Content += ($Block = $_.ScriptBlock.Ast.Extent.Text)\n                # Assigns function block to $Block and appends to $Content\n            \n            $FunctionsPassed.Add($_) | Out-Null # So it doesn't get checked again\n\n            if ($Dependencies){\n\n                if (!$TL_FUNCTIONS){\n                    if (Get-Module -Name TweakList -ErrorAction Ignore){\n                        $TL_FUNCTIONS = [String[]](Get-Module -Name TweakList).ExportedFunctions.Keys\n                    }else {\n                        throw \"TL_FUNCTIONS variable is not defined, which is needed to get available TweakList functions\"\n                    }\n                }\n\n                $AST = [System.Management.Automation.Language.Parser]::ParseInput($Block, [ref]$null, [ref]$null)\n                \n                $DepMatches = $AST.FindAll({\n                        param ($node)\n                        $node.GetType().Name -eq 'CommandAst'\n                    }, $true) | #It gets all cmdlets from the Abstract Syntax Tree\n                ForEach-Object {$_.CommandElements[0].Value} | # Returns their name\n                    Where-Object { # Filters out only TweakList functions\n                        $_ -In ($TL_FUNCTIONS | Where-Object {$_ -ne $_.Name})\n\n                    } | Select-Object -Unique\n\n                ForEach($Match in $DepMatches){\n                    $FunctionsPassed.Add((Get-Command -Name $Match -CommandType Function)) | Out-Null\n\n                    $Content += (Get-Command -Name $Match -CommandType Function).ScriptBlock.Ast.Extent.Text\n\n                }\n            }\n        }\n    }\n\n    if ($Content){\n        $Content = \"#region gfc`n\" + $Content + \"`n#endregion\"\n    }\n\n    if($ReturnNames){\n        return $FunctionsPassed | Select-Object -Unique # | Where-Object {$_ -notin $Functions} \n    } else {\n        return $Content\n    }\n}\n"
  },
  {
    "path": "helpers/Get-HeaderSize.ps1",
    "content": "function Get-HeaderSize {\n    param(\n        $URL,\n        $FileName = \"file\"\n    )\n    Try {\n        $Size = (Invoke-WebRequest -Useb $URL -Method Head -ErrorAction Stop).Headers.'Content-Length'\n    }Catch{\n        Write-Host \"Failed to parse $FileName size (Invalid URL?):\" -ForegroundColor DarkRed\n        Write-Host $_.Exception.Message -ForegroundColor Red\n        return\n\n    }\n    return [Math]::Round((($Size | Select-Object -First 1) / 1MB), 2)\n    \n}"
  },
  {
    "path": "helpers/Get-Path.ps1",
    "content": "function Get-Path {\n    [alias('gpa')]\n    param($File)\n\n    if (-Not(Get-Command $File -ErrorAction Ignore)){return $null}\n\n    $BaseName, $Extension = $File.Split('.')\n\n    if (Get-Command \"$BaseName.shim\" -ErrorAction Ignore){\n        return (Get-Content (Get-Command \"$BaseName.shim\").Source | Select-Object -First 1).Trim('path = ').replace('\"','')\n    }elseif($Extension){\n        return (Get-Command \"$BaseName.$Extension\").Source\n    }else{\n        return (Get-Command $BaseName).Source\n    }\n}"
  },
  {
    "path": "helpers/Get-ScoopApp.ps1",
    "content": "\nfunction Get-ScoopApp {\n    [CmdletBinding()] param (\n\n        [Parameter(ValueFromRemainingArguments = $true)]\n        [System.Collections.Arraylist]\n        $Apps # Not necessarily plural\n    )\n\n    Install-Scoop\n\n    $Scoop = (Get-Item (Get-Command scoop).Source).Directory | Split-Path\n    $ToInstall = $Apps | Where-Object {$PSItem -NotIn (Get-ChildItem \"$Scoop\\apps\")}\n    $Available = (Get-ChildItem \"$Scoop\\buckets\\*\\bucket\\*\").BaseName\n    $Buckets = (Get-ChildItem \"$Scoop\\buckets\" -Directory).Name\n    $Installed = (Get-ChildItem \"$Scoop\\apps\" -Directory).Name\n    $script:FailedToInstall = @()\n\n    function Get-Git {\n        if ('git' -NotIn $Installed){\n            scoop install git\n            if ($LASTEXITCODE -ne 0){\n                Write-Host \"Failed to install Git.\" -ForegroundColor Red\n                return\n            }\n        }\n        $ToInstall = $ToInstall | Where-Object {$_ -ne 'git'}\n    }\n\n    $Repos = @{\n\n        main            = @{org = 'ScoopInstaller'     ;repo = 'main'                ;branch = 'master'}\n        extras          = @{org = 'ScoopInstaller'     ;repo = 'extras'              ;branch = 'master'}\n        utils           = @{org = 'couleur-tweak-tips' ;repo = 'utils'               ;branch = 'main'  }\n        nirsoft         = @{org = 'kodybrown'          ;repo = 'scoop-nirsoft'       ;branch = 'master'}\n        'games'         = @{org = 'Calinou'            ;repo = 'scoop-games'         ;branch = 'master'}\n        'nerd-fonts'    = @{org = 'matthewjberger'     ;repo = 'scoop-nerd-fonts'    ;branch = 'master'}\n        versions        = @{org = 'ScoopInstaller'     ;repo = 'versions'            ;branch = 'master'}\n        java            = @{org = 'ScoopInstaller'     ;repo = 'java'                ;branch = 'master'}\n    }\n    $RepoNames = $Repos.Keys -Split('\\r?\\n')\n\n    Foreach($App in $ToInstall){\n\n        if ($App.Split('/').Count -eq 2){\n\n            $Bucket, $App = $App.Split('/')\n\n            if ($Bucket -NotIn $RepoNames){\n                Write-Host \"Bucket $Bucket is not known, add it yourself by typing 'scoop.cmd bucket add bucketname https://bucket.repo/url'\"\n                continue\n            }elseif (($Bucket -NotIn $Buckets) -And ($Bucket -In $RepoNames)){\n                Get-Git\n                scoop bucket add $Repos.$Bucket.repo https://github.com/$($Repos.$Bucket.org)/$($Repos.$Bucket.repo)\n            }\n        }\n\n        $Available = (Get-ChildItem \"$Scoop\\buckets\\*\\bucket\\*\").BaseName\n\n        if ($App -NotIn $Available){\n            Remove-Variable -Name Found -ErrorAction Ignore\n            ForEach($Bucket in $RepoNames){\n                if ($Found){continue}\n\n                Write-Host \"`rCould not find $App, looking for it in the $Bucket bucket..\" -NoNewline\n\n                $Response = Invoke-RestMethod \"https://api.github.com/repos/$($Repos.$Bucket.org)/$($Repos.$Bucket.repo)/git/trees//$($Repos.$Bucket.branch)?recursive=1\"\n                $Manifests = $Response.tree.path | Where-Object {$_ -Like \"bucket/*.json\"}\n                $Manifests = ($Manifests).Replace('bucket/','').Replace('.json','')\n\n                if ($App -in $Manifests){\n                    $script:Found = $True\n                    ''\n                    Get-Git\n                    \n                    scoop bucket add $Repos.$Bucket.repo https://github.com/$($Repos.$Bucket.org)/$($Repos.$Bucket.repo)\n                }else{''} # Fixes the -NoNewLine\n            }\n            \n        }\n        # Wait-Debugger\n        scoop install $App\n        if ($LASTEXITCODE -ne 0){\n            $script:FailedToInstall += $App\n            Write-Verbose \"$App exitted with code $LASTEXITCODE\"        \n        }\n    }\n\n}"
  },
  {
    "path": "helpers/Get-ShortcutTarget.ps1",
    "content": "function Get-ShortcutTarget {\n    [alias('gst')]\n\n    param([String]$ShortcutPath)\n\n    Try {\n        $null = Get-Item $ShortcutPath -ErrorAction Stop\n    } Catch {\n        throw\n    }\n    \n    return (New-Object -ComObject WScript.Shell).CreateShortcut($ShortcutPath).TargetPath\n}"
  },
  {
    "path": "helpers/Install-FFmpeg.ps1",
    "content": "function Install-FFmpeg {\n\n    $IsFFmpegScoop = (Get-Command ffmpeg -Ea Ignore).Source -Like \"*\\shims\\*\"\n\n    if(Get-Command ffmpeg -Ea Ignore){\n\n        $IsFFmpeg5 = (ffmpeg -hide_banner -h filter=libplacebo) -ne \"Unknown filter 'libplacebo'.\"\n\n        if (-Not($IsFFmpeg5)){\n\n            if ($IsFFmpegScoop){\n                Get Scoop\n                scoop update ffmpeg\n            }else{\n                Write-Warning @\"\nAn old FFmpeg installation was detected @ ($((Get-Command FFmpeg).Source)),\n\nYou could encounter errors such as:\n- Encoding with NVENC failing (in simple terms not being able to render with your GPU)\n- Scripts using new filters (e.g libplacebo)\n\nIf you want to update FFmpeg yourself, you can remove it and use the following command to install ffmpeg and add it to the path:\niex(irm tl.ctt.cx);Get FFmpeg\n\nIf you're using it because you prefer old NVIDIA drivers (why) here be dragons!\n\"@\npause\n                \n            }\n            \n        }\n                \n    }else{\n        Get Scoop\n        $Scoop = (Get-Command Scoop.ps1).Source | Split-Path | Split-Path\n\n        if (-Not(Test-Path \"$Scoop\\buckets\\main\")){\n            if (-Not(Test-Path \"$Scoop\\apps\\git\\current\\bin\\git.exe\")){\n                scoop install git\n            }\n            scoop bucket add main\n        }\n\n        $Local = ((scoop cat ffmpeg) | ConvertFrom-Json).version\n        $Latest = (Invoke-RestMethod https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/ffmpeg.json).version\n\n        if ($Local -ne $Latest){\n            \"FFmpeg version installed using scoop is outdated, updating Scoop..\"\n            if (-not(Test-Path \"$Scoop\\apps\\git\")){\n                scoop install git\n            }\n            scoop update\n        }\n\n        scoop install ffmpeg\n        if ($LASTEXITCODE -ne 0){\n            Write-Warning \"Failed to install FFmpeg\"\n            pause\n        }\n    }\n}\n"
  },
  {
    "path": "helpers/Install-Scoop.ps1",
    "content": "function Install-Scoop {\n    param(\n        [String]$InstallDir\n    )\n    Set-ExecutionPolicy Bypass -Scope Process -Force\n\n    if (-Not(Get-Command scoop -Ea Ignore)){\n        \n        $RunningAsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')\n\n        if($InstallDir){\n            $env:SCOOP = $InstallDir\t\n            [Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')\n        }\n\n        If (-Not($RunningAsAdmin)){\n            Invoke-Expression (Invoke-RestMethod -Uri http://get.scoop.sh)\n        }else{\n            Invoke-Expression \"& {$(Invoke-RestMethod -Uri https://get.scoop.sh)} -RunAsAdmin\"\n        }\n    }\n\n    Try {\n        scoop -ErrorAction Stop | Out-Null\n    } Catch {\n        Write-Host \"Failed to install Scoop\" -ForegroundColor DarkRed\n        Write-Host $_.Exception.Message -ForegroundColor Red\n        return\n\n    }\n}"
  },
  {
    "path": "helpers/Invoke-Checkbox.ps1",
    "content": "<#\n\t.LINK\n\tFrankensteined from Inestic's WindowsFeatures Sophia Script function\n\thttps://github.com/Inestic\n\thttps://github.com/farag2/Sophia-Script-for-Windows/blob/06a315c643d5939eae75bf6e24c3f5c6baaf929e/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1#L4946\n\n\t.SYNOPSIS\n\tUser gets a nice checkbox-styled menu in where they can select \n\t\n\t.EXAMPLE\n\n\tScreenshot: https://i.imgur.com/zrCtR3Y.png\n\n\t$ToInstall = Invoke-CheckBox -Items \"7-Zip\", \"PowerShell\", \"Discord\"\n\n\tOr you can have each item have a description by passing an array of hashtables:\n\n\t$ToInstall = Invoke-CheckBox -Items @(\n\n\t\t@{\n\t\t\tDisplayName = \"7-Zip\"\n\t\t\t# Description = \"Cool Unarchiver\"\n\t\t},\n\t\t@{\n\t\t\tDisplayName = \"Windows Sandbox\"\n\t\t\tDescription = \"Windows' Virtual machine\"\n\t\t},\n\t\t@{\n\t\t\tDisplayName = \"Firefox\"\n\t\t\tDescription = \"A great browser\"\n\t\t},\n\t\t@{\n\t\t\tDisplayName = \"PowerShell 777\"\n\t\t\tDescription = \"PowerShell on every system!\"\n\t\t}\n\t)\n#>\nfunction Invoke-Checkbox{\nparam(\n\t$Title = \"Select an option\",\n\t$ButtonName = \"Confirm\",\n\t$Items = @(\"Fill this\", \"With passing an array\", \"to the -Item param!\")\n)\n\nif (!$Items.Description){\n\t$NewItems = @()\n\tForEach($Item in $Items){\n\t\t$NewItems += @{DisplayName = $Item}\n\t}\n\t$Items = $NewItems\n} \n\nAdd-Type -AssemblyName PresentationCore, PresentationFramework, System.Drawing, System.Windows.Forms, WindowsFormsIntegration\n\n\n# Initialize an array list to store the selected Windows features\n$SelectedFeatures = New-Object -TypeName System.Collections.ArrayList($null)\n$ToReturn = New-Object -TypeName System.Collections.ArrayList($null)\n\n\n#region XAML Markup\n# The section defines the design of the upcoming dialog box\n[xml]$XAML = '\n<Window\n\txmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n\txmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n\tName=\"Window\"\n\tMinHeight=\"450\" MinWidth=\"400\"\n\tSizeToContent=\"WidthAndHeight\" WindowStartupLocation=\"CenterScreen\"\n\tTextOptions.TextFormattingMode=\"Display\" SnapsToDevicePixels=\"True\"\n\tFontFamily=\"Arial\" FontSize=\"16\" ShowInTaskbar=\"True\"\n\tBackground=\"#F1F1F1\" Foreground=\"#262626\">\n\n\t<Window.TaskbarItemInfo>\n\t\t<TaskbarItemInfo/>\n\t</Window.TaskbarItemInfo>\n\t\n\t<Window.Resources>\n\t\t<Style TargetType=\"StackPanel\">\n\t\t\t<Setter Property=\"Orientation\" Value=\"Horizontal\"/>\n\t\t\t<Setter Property=\"VerticalAlignment\" Value=\"Top\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"CheckBox\">\n\t\t\t<Setter Property=\"Margin\" Value=\"10, 10, 5, 10\"/>\n\t\t\t<Setter Property=\"IsChecked\" Value=\"True\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"TextBlock\">\n\t\t\t<Setter Property=\"Margin\" Value=\"5, 10, 10, 10\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"Button\">\n\t\t\t<Setter Property=\"Margin\" Value=\"25\"/>\n\t\t\t<Setter Property=\"Padding\" Value=\"15\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"Border\">\n\t\t\t<Setter Property=\"Grid.Row\" Value=\"1\"/>\n\t\t\t<Setter Property=\"CornerRadius\" Value=\"0\"/>\n\t\t\t<Setter Property=\"BorderThickness\" Value=\"0, 1, 0, 1\"/>\n\t\t\t<Setter Property=\"BorderBrush\" Value=\"#000000\"/>\n\t\t</Style>\n\t\t<Style TargetType=\"ScrollViewer\">\n\t\t\t<Setter Property=\"HorizontalScrollBarVisibility\" Value=\"Disabled\"/>\n\t\t\t<Setter Property=\"BorderBrush\" Value=\"#000000\"/>\n\t\t\t<Setter Property=\"BorderThickness\" Value=\"0, 1, 0, 1\"/>\n\t\t</Style>\n\t</Window.Resources>\n\t<Grid>\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\"/>\n\t\t\t<RowDefinition Height=\"*\"/>\n\t\t\t<RowDefinition Height=\"Auto\"/>\n\t\t</Grid.RowDefinitions>\n\t\t<ScrollViewer Name=\"Scroll\" Grid.Row=\"0\"\n\t\t\tHorizontalScrollBarVisibility=\"Disabled\"\n\t\t\tVerticalScrollBarVisibility=\"Auto\">\n\t\t\t<StackPanel Name=\"PanelContainer\" Orientation=\"Vertical\"/>\n\t\t</ScrollViewer>\n\t\t<Button Name=\"Button\" Grid.Row=\"2\"/>\n\t</Grid>\n</Window>\n'\n#endregion XAML Markup\n\n$Form = [Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $xaml))\n$XAML.SelectNodes(\"//*[@Name]\") | ForEach-Object {\n\tSet-Variable -Name ($_.Name) -Value $Form.FindName($_.Name)\n}\n\n#region Functions\nfunction Get-CheckboxClicked\n{\n\t[CmdletBinding()]\n\tparam\n\t(\n\t\t[Parameter(\n\t\t\tMandatory = $true,\n\t\t\tValueFromPipeline = $true\n\t\t)]\n\t\t[ValidateNotNull()]\n\t\t$CheckBox\n\t)\n\n\t$Feature = $Items | Where-Object -FilterScript {$_.DisplayName -eq $CheckBox.Content}\n\n\tif ($CheckBox.IsChecked) {\n\t\t[void]$SelectedFeatures.Add($Feature)\n\t}\n\telse {\n\t\t[void]$SelectedFeatures.Remove($Feature)\n\t}\n\tif ($SelectedFeatures.Count -gt 0) {\n\t\t$Button.Content = $ButtonName\n\t\t$Button.IsEnabled = $true\n\t}\n\telse {\n\t\t$Button.Content = \"Cancel\"\n\t\t$Button.IsEnabled = $true\n\t}\n}\n\nfunction Add-FeatureControl\n{\n\t[CmdletBinding()]\n\tparam\n\t(\n\t\t[Parameter(\n\t\t\tMandatory = $true,\n\t\t\tValueFromPipeline = $true\n\t\t)]\n\t\t[ValidateNotNull()]\n\t\t$Feature\n\t)\n\n\tprocess {\n\n\t\t$StackPanel = New-Object -TypeName System.Windows.Controls.StackPanel\n\n\t\t$CheckBox = New-Object -TypeName System.Windows.Controls.CheckBox\n\t\t$CheckBox.Add_Click({Get-CheckboxClicked -CheckBox $_.Source})\n\t\t$Checkbox.Content = $Feature.DisplayName\n\t\tif ($Feature.Description){\n\t\t\t$CheckBox.ToolTip = $Feature.Description\n\t\t}\n\t\t$Checkbox.IsChecked = $False\n\t\t[void]$StackPanel.Children.Add($CheckBox)\n\n\t\t[void]$PanelContainer.Children.Add($StackPanel)\n\t}\n\n}\n\n$Window.Add_Loaded({$Items | Add-FeatureControl})\n\n$Button.Content = $ButtonName\n$Button.Add_Click({\n\t[void]$Window.Close()\n\n\t$ToReturn.Add($SelectedFeatures.DisplayName)\n})\n\n$Window.Title = $Title\n\n# ty chrissy <3 https://blog.netnerds.net/2016/01/adding-toolbar-icons-to-your-powershell-wpf-guis/\n$base64 = \"iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAMAAADyHTlpAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAPUExURQAAAP///+vr6+fn5wAAAD8IT84AAAAFdFJOU/////8A+7YOUwAAAAlwSFlzAAALEwAACxMBAJqcGAAAANBJREFUSEut08ESgjAMRVFQ/v+bDbxLm9Q0lRnvQtrkDBt1O4a2FoNWHIBajJW/sQ+xOnNnlkMsrXZkkwRolHHaTXiUYfS5SOgXKfuQci0T5bLoIeWYt/O0FnTfu62pyW5X7/S26D/yFca19AvBXMaVbrnc3n6p80QGq9NUOqtnIRshhi7/ffHeK0a94TfQLQPX+HO5LVef0cxy8SX/gokU/bIcQvxjB5t1qYd0aYWuz4XF6FHam/AsLKDTGWZpuWNqWZ358zdmrOLNAlkM6Dg+78AGkhvs7wgAAAAASUVORK5CYII=\"\n \n \n# Create a streaming image by streaming the base64 string to a bitmap streamsource\n$bitmap = New-Object System.Windows.Media.Imaging.BitmapImage\n$bitmap.BeginInit()\n$bitmap.StreamSource = [System.IO.MemoryStream][System.Convert]::FromBase64String($base64)\n$bitmap.EndInit()\n$bitmap.Freeze()\n\n \n# This is the toolbar icon and description\n$Form.TaskbarItemInfo.Overlay = $bitmap\n$Form.TaskbarItemInfo.Description = $window.Title\n\n$Window.Add_Closing({[System.Windows.Forms.Application]::Exit()})\n\n$Form.Show()\n\n# This makes it pop up\n$Form.Activate() | Out-Null\n \n# Create an application context for it to all run within. \n# This helps with responsiveness and threading.\n$appContext = New-Object System.Windows.Forms.ApplicationContext\n[void][System.Windows.Forms.Application]::Run($appContext) \nreturn $ToReturn\n}"
  },
  {
    "path": "helpers/Invoke-NGENposh.ps1",
    "content": "#using namespace System.Management.Automation # this can't be a function but whatever, it doesn't slow down anything\n# Author:\tCollin Chaffin\n# License: MIT (https://github.com/CollinChaffin/psNGENposh/blob/master/LICENSE)\nfunction Invoke-NGENposh {\n<#\n\t.SYNOPSIS\n\t\tThis Powershell function performs various SYNCHRONOUS ngen functions\n\t\n\t.DESCRIPTION\n\t\tThis Powershell function performs various SYNCHRONOUS ngen functions\n\t\n\t\tSince the purpose of this module is to for interactive use,\n\t\tI intentionally did not include any \"Queue\" options.\n\t\n\t.PARAMETER All\n\t\tRegenerate cache for all system assemblies\n\t\n\t.PARAMETER Force\n\t\tInvoke ngen on currently loaded assembles (ensure up to date even if cached)\n\t\n\t.EXAMPLE\n\t\tTo invoke ngen on currently loaded assembles, skipping those already generated:\n\n\t\tPS C:\\> Invoke-NGENposh\n\t\n\t.EXAMPLE\t\n\t\tTo invoke ngen on currently loaded assembles (ensure up to date even if cached):\n\n\t\tPS C:\\> Invoke-NGENposh -Force\n\t\n\t.EXAMPLE\t\n\t\tTo invoke ngen to regenerate cache for all system assemblies (*SEE WARNING BELOW**):\n\n\t\tPS C:\\> Invoke-NGENposh -All\n\t\n\t.NOTES\n\t\t **WARNING: The '-All' switch since the execution is SYNCHRONOUS will\n\t\t\t\t\ttake considerable time, and literally regenerate all the\n\t\t\t\t\tglobal assembly cache.  There should theoretically be no\n\t\t\t\t\tdownside to this, but bear in mind other than time (and cpu)\n\t\t\t\t\tthat since all the generated cache files are new, any\n\t\t\t\t\tsystem backups will consider those files as new and may\n\t\t\t\t\tlikely cause your next incremental backup to be much larger\n#>\n\tparam\n\t(\n\t\t[switch]$All,\n\t\t[switch]$Force,\n\t\t[switch]$Confirm\n\t)\n\n\tif (!$Confirm){\n\t\tWrite-Host \"Press enter to continue and start using NGENPosh, or press CTRL+C to cancel\"\n\t\tpause\n\t}\n    \n# INTERNAL HELPER\nfunction Write-InfoInColor\n{\n\t[CmdletBinding()]\n\tparam\n\t(\n\t\t[Parameter(Mandatory = $true)]\n\t\t[ValidateNotNullOrEmpty()]\n\t\t[String]$Message,\n\t\t[Parameter(Mandatory = $false)]\n\t\t[ValidateNotNullOrEmpty()]\n\t\t[System.ConsoleColor[]]$Background = $Host.UI.RawUI.BackgroundColor,\n\t\t[Parameter(Mandatory = $false)]\n\t\t[ValidateNotNullOrEmpty()]\n\t\t[System.ConsoleColor[]]$Foreground = $Host.UI.RawUI.ForegroundColor,\n\t\t[Switch]$NoNewline\n\t)\n\t\n\t[HostInformationMessage]$outMessage = @{\n\t\tMessage\t\t\t     = $Message\n\t\tForegroundColor\t     = $Foreground\n\t\tBackgroundColor\t     = $Background\n\t\tNoNewline\t\t     = $NoNewline\n\t}\n\tWrite-Information $outMessage -InformationAction Continue\n}\n\t\n\tWrite-InfoInColor \"`n===================================================================================\" -Foreground 'DarkCyan'\n\tWrite-InfoInColor \"                             BEGINNING TO NGEN                                     \" -Foreground 'Cyan'\n\tWrite-InfoInColor \"===================================================================================`n\" -Foreground 'DarkCyan'\n\t\n\tSet-Alias ngenpsh (Join-Path ([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) ngen.exe) -Force\n\t\n\tif ($All)\n\t{\n\t\tWrite-InfoInColor \"EXECUTING GLOBAL NGEN`n`n\" -Foreground 'Cyan'\n\t\tngenpsh update /nologo /force\n\t}\n\telse\n\t{\n\t\tWrite-InfoInColor \"EXECUTING TARGETED NGEN`n`n\" -Foreground 'Cyan'\n\t\t\n\t\t[AppDomain]::CurrentDomain.GetAssemblies() |\n\t\tForEach-Object {\n\t\t\tif ($_.Location)\n\t\t\t{\n\t\t\t\t$Name = (Split-Path $_.location -leaf)\n\t\t\t\tif ((!($Force)) -and [System.Runtime.InteropServices.RuntimeEnvironment]::FromGlobalAccessCache($_))\n\t\t\t\t{\n\t\t\t\t\tWrite-InfoInColor \"[SKIPPED]\" -Foreground 'Yellow' -NoNewLine\n\t\t\t\t\tWrite-InfoInColor \" :: \" -Foreground 'White' -NoNewline\n\t\t\t\t\tWrite-InfoInColor \"[ $Name ]\" -Foreground 'Cyan'\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tngenpsh install $_.location /nologo | ForEach-Object {\n\t\t\t\t\t\tif ($?)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tWrite-InfoInColor \"[SUCCESS]\" -Foreground 'Green' -NoNewLine\n\t\t\t\t\t\t\tWrite-InfoInColor \" :: \" -Foreground 'White' -NoNewline\n\t\t\t\t\t\t\tWrite-InfoInColor \"[ $Name ]\" -Foreground 'Cyan'\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tWrite-InfoInColor \"[FAILURE]\" -Foreground 'Red' -NoNewLine\n\t\t\t\t\t\t\tWrite-InfoInColor \" :: \" -Foreground 'White' -NoNewline\n\t\t\t\t\t\t\tWrite-InfoInColor \"[ $Name ]\" -Foreground 'Cyan'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tWrite-InfoInColor \"`n===================================================================================\" -Foreground 'DarkCyan'\n\tWrite-InfoInColor \"                               COMPLETED NGEN                                      \" -Foreground 'Cyan'\n\tWrite-InfoInColor \"===================================================================================`n\" -Foreground 'DarkCyan'\n}\n\n\n"
  },
  {
    "path": "helpers/Invoke-Registry.ps1",
    "content": "function Invoke-Registry {\n    [alias('ireg')]\n    param(\n        [Parameter(\n            Position = 0,\n            Mandatory=$true,\n            ValueFromPipeline = $true\n            )\n        ][Array]$Path,\n\n        [Parameter(\n            Position = 1,\n            Mandatory=$true\n            )\n        ][HashTable]$HashTable\n        \n    )\n\n    Process {\n        \"doing $path\"\n        $Path = \"REGISTRY::$($Path -replace 'REGISTRY::','')\"\n        \"now its $path\"\n        if (-Not(Test-Path -LiteralPath $Path)){\n\n            New-Item -ItemType Key -Path $Path -Force\n        }\n\n        ForEach($Key in $HashTable.Keys){\n\n            Set-ItemProperty -LiteralPath $Path -Name $Key -Value $HashTable.$Key\n        }\n    }\n}\n"
  },
  {
    "path": "helpers/IsCustomISO.ps1",
    "content": "function IsCustomISO {\n    switch (\n        Get-ItemProperty \"REGISTRY::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\OEMInformation\"\n    ){\n        {$_.SupportURL -Like \"https://atlasos.net*\"}{return 'AtlasOS'}\n        {$_.Manufacturer -eq \"Revision\"}{return 'Revision'}\n        {$_.Manufacturer -eq \"ggOS\"}{return 'ggOS'}\n    }\n    return $False\n}\n"
  },
  {
    "path": "helpers/Menu.ps1",
    "content": "# https://github.com/chrisseroka/ps-menu\nfunction Menu {\n    param ([array]$menuItems, [switch]$ReturnIndex=$false, [switch]$Multiselect)\n\nfunction DrawMenu {\n    param ($menuItems, $menuPosition, $Multiselect, $selection)\n    $l = $menuItems.length\n    for ($i = 0; $i -le $l;$i++) {\n\t\tif ($menuItems[$i] -ne $null){\n\t\t\t$item = $menuItems[$i]\n\t\t\tif ($Multiselect)\n\t\t\t{\n\t\t\t\tif ($selection -contains $i){\n\t\t\t\t\t$item = '[x] ' + $item\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$item = '[ ] ' + $item\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($i -eq $menuPosition) {\n\t\t\t\tWrite-Host \"> $($item)\" -ForegroundColor Green\n\t\t\t} else {\n\t\t\t\tWrite-Host \"  $($item)\"\n\t\t\t}\n\t\t}\n    }\n}\n\nfunction Toggle-Selection {\n\tparam ($pos, [array]$selection)\n\tif ($selection -contains $pos){ \n\t\t$result = $selection | where {$_ -ne $pos}\n\t}\n\telse {\n\t\t$selection += $pos\n\t\t$result = $selection\n\t}\n\t$result\n}\n\n    $vkeycode = 0\n    $pos = 0\n    $selection = @()\n    if ($menuItems.Length -gt 0)\n\t{\n\t\ttry {\n\t\t\t[console]::CursorVisible=$false #prevents cursor flickering\n\t\t\tDrawMenu $menuItems $pos $Multiselect $selection\n\t\t\tWhile ($vkeycode -ne 13 -and $vkeycode -ne 27) {\n\t\t\t\t$press = $host.ui.rawui.readkey(\"NoEcho,IncludeKeyDown\")\n\t\t\t\t$vkeycode = $press.virtualkeycode\n\t\t\t\tIf ($vkeycode -eq 38 -or $press.Character -eq 'k') {$pos--}\n\t\t\t\tIf ($vkeycode -eq 40 -or $press.Character -eq 'j') {$pos++}\n\t\t\t\tIf ($vkeycode -eq 36) { $pos = 0 }\n\t\t\t\tIf ($vkeycode -eq 35) { $pos = $menuItems.length - 1 }\n\t\t\t\tIf ($press.Character -eq ' ') { $selection = Toggle-Selection $pos $selection }\n\t\t\t\tif ($pos -lt 0) {$pos = 0}\n\t\t\t\tIf ($vkeycode -eq 27) {$pos = $null }\n\t\t\t\tif ($pos -ge $menuItems.length) {$pos = $menuItems.length -1}\n\t\t\t\tif ($vkeycode -ne 27)\n\t\t\t\t{\n\t\t\t\t\t$startPos = [System.Console]::CursorTop - $menuItems.Length\n\t\t\t\t\t[System.Console]::SetCursorPosition(0, $startPos)\n\t\t\t\t\tDrawMenu $menuItems $pos $Multiselect $selection\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\t[System.Console]::SetCursorPosition(0, $startPos + $menuItems.Length)\n\t\t\t[console]::CursorVisible = $true\n\t\t}\n\t}\n\telse {\n\t\t$pos = $null\n\t}\n\n    if ($ReturnIndex -eq $false -and $pos -ne $null)\n\t{\n\t\tif ($Multiselect){\n\t\t\treturn $menuItems[$selection]\n\t\t}\n\t\telse {\n\t\t\treturn $menuItems[$pos]\n\t\t}\n\t}\n\telse \n\t{\n\t\tif ($Multiselect){\n\t\t\treturn $selection\n\t\t}\n\t\telse {\n\t\t\treturn $pos\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "helpers/Merge-Hashtables.ps1",
    "content": "<#\n$Original = @{\n    lets = 'go'\n    Sub = @{\n      Foo =  'bar'\n      big = 'ya'\n    }\n    finish = 'fish'\n}\n$Patch = @{\n    lets = 'arrive'\n    Sub = @{\n      Foo =  'baz'\n    }\n    finish ='cum'\n    New=\"Ye\"\n}\n#>\nfunction Merge-Hashtables {\n    param(\n        $Original,\n        $Patch\n    )\n    $Merged = @{} # Final Merged settings\n\n    if (!$Original){$Original = @{}}\n\n    if ($Original.GetType().Name -in 'PSCustomObject','PSObject'){\n        $Temp = [ordered]@{}\n        $Original.PSObject.Properties | ForEach-Object { $Temp[$_.Name] = $_.Value }\n        $Original = $Temp\n        Remove-Variable Temp #fck temp vars\n    }\n\n    foreach ($Key in [object[]]$Original.Keys) {\n\n        if ($Original.$Key -is [HashTable]){\n            $Merged.$Key += [HashTable](Merge-Hashtables $Original.$Key $Patch.$Key)\n            continue\n        }\n\n        if ($Patch.$Key -and !$Merged.$Key){ # If the setting exists in the patch\n            $Merged.Remove($Key)\n            if ($Original.$Key -ne $Patch.$Key){\n                Write-Verbose \"Changing $Key from $($Original.$Key) to $($Patch.$Key)\"\n            }\n            $Merged += @{$Key = $Patch.$Key} # Then add it to the final settings\n        }else{ # Else put in the unchanged normal setting\n            $Merged += @{$Key = $Original.$Key}\n        }\n    }\n\n    ForEach ($Key in [object[]]$Patch.Keys) {\n        if ($Patch.$Key -is [HashTable] -and ($Key -NotIn $Original.Keys)){\n            $Merged.$Key += [HashTable](Merge-Hashtables $Original.$Key $Patch.$Key)\n            continue\n        }\n        if ($Key -NotIn $Original.Keys){\n            $Merged.$Key += $Patch.$Key\n        }\n    }\n\n    return $Merged\n}\n\n<# Here's some example hashtables you can mess with:\n\n$Original = [Ordered]@{ # Original settings\n    potato = $true\n    avocado = $false\n}\n\n$Patch = @{ # Fixes\n    avocado = $true\n}\n\n\nfunction Merge-Hashtables {\n    param(\n        [Switch]$ShowDiff,\n        $Original,\n        $Patch\n    )\n\n    if (!$Original){$Original = @{}}\n\n    if ($Original.GetType().Name -in 'PSCustomObject','PSObject'){\n        $Temp = [ordered]@{}\n        $Original.PSObject.Properties | ForEach-Object { $Temp[$_.Name] = $_.Value }\n        $Original = $Temp\n        Remove-Variable Temp #fck temp vars\n    }\n\n    $Merged = @{} # Final Merged settings\n\n    foreach($Key in $Original.Keys){ # Loops through all OG settings\n        $Merging = $True\n\n        if ($Patch.$Key){ # If the setting exists in the new settings\n            $Merged += @{$Key = $Patch.$Key} # Then add it to the final settings\n        }else{ # Else put in the normal settings\n            $Merged += @{$Key = $Original.$Key}\n        }\n    }\n    foreach($key in $Patch.Keys){ # If Patch has hashtables that Original does not\n        if (!$Merged.$key){\n            $Merged += @{$key = $Patch.$key}\n        }\n    }\n\n    if (!$Merging){$Merged = $Patch} # If no settings were merged (empty $Original), completely overwrite\n    return $Merged\n}\n\n#>"
  },
  {
    "path": "helpers/New-Shortcut.ps1",
    "content": "function New-Shortcut {\n    param(\n        [Switch]$Admin,\n        [Switch]$Overwrite,\n        [String]$LnkPath,\n        [String]$TargetPath,\n        [String]$Arguments,\n        [String]$Icon\n    )\n\n    if ($Overwrite){\n        if (Test-Path $LnkPath){\n            Remove-Item $LnkPath\n        }\n    }\n\n    $WScriptShell = New-Object -ComObject WScript.Shell\n    $Shortcut = $WScriptShell.CreateShortcut($LnkPath)\n    $Shortcut.TargetPath = $TargetPath\n    if ($Arguments){\n        $Shortcut.Arguments = $Arguments\n    }\n    if ($Icon){\n        $Shortcut.IconLocation = $Icon\n    }\n\n    $Shortcut.Save()\n    if ((Get-Item $LnkPath).FullName -cne $LnkPath){\n        Rename-Item $LnkPath -NewName (Get-Item $LnkPath).Name # Shortcut names are always underscore\n    }\n\n    if ($Admin){\n    \n        $bytes = [System.IO.File]::ReadAllBytes($LnkPath)\n        $bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON\n        [System.IO.File]::WriteAllBytes($LnkPath, $bytes)\n    }\n}"
  },
  {
    "path": "helpers/PauseNul.ps1",
    "content": "function PauseNul {\n    $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') | Out-Null\n}"
  },
  {
    "path": "helpers/Prompt.ps1",
    "content": "<# This function messes with the message that appears before the commands you type\n\n# Turns:\nPS D:\\Scoop>\n# into\nTL D:\\Scoop>\n\nTo indicate TweakList has been imported\n\nYou can prevent this from happening by setting the environment variable TL_NOPROMPT to 1\n#>\n$global:CSI = [char] 27 + '['\nif (!$env:TL_NOPROMPT -and !$TL_NOPROMPT){\n    function global:prompt {\n            \"$CSI`97;7mTL$CSI`m $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) \";\n    }\n}\n"
  },
  {
    "path": "helpers/PsInI/Get-IniContent.ps1",
    "content": "﻿function Get-IniContent {\n    <#\n    .Synopsis\n        Gets the content of an INI file\n\n    .Description\n        Gets the content of an INI file and returns it as a hashtable\n\n    .Notes\n        Author\t\t: Oliver Lipkau <oliver@lipkau.net>\n\t\tSource\t\t: https://github.com/lipkau/PsIni\n                      http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91\n        Version\t\t: 1.0.0 - 2010/03/12 - OL - Initial release\n                      1.0.1 - 2014/12/11 - OL - Typo (Thx SLDR)\n                                              Typo (Thx Dave Stiff)\n                      1.0.2 - 2015/06/06 - OL - Improvment to switch (Thx Tallandtree)\n                      1.0.3 - 2015/06/18 - OL - Migrate to semantic versioning (GitHub issue#4)\n                      1.0.4 - 2015/06/18 - OL - Remove check for .ini extension (GitHub Issue#6)\n                      1.1.0 - 2015/07/14 - CB - Improve round-tripping and be a bit more liberal (GitHub Pull #7)\n                                           OL - Small Improvments and cleanup\n                      1.1.1 - 2015/07/14 - CB - changed .outputs section to be OrderedDictionary\n                      1.1.2 - 2016/08/18 - SS - Add some more verbose outputs as the ini is parsed,\n                      \t\t\t\t            allow non-existent paths for new ini handling,\n                      \t\t\t\t            test for variable existence using local scope,\n                      \t\t\t\t            added additional debug output.\n\n        #Requires -Version 2.0\n\n    .Inputs\n        System.String\n\n    .Outputs\n        System.Collections.Specialized.OrderedDictionary\n\n    .Example\n        $FileContent = Get-IniContent \"C:\\myinifile.ini\"\n        -----------\n        Description\n        Saves the content of the c:\\myinifile.ini in a hashtable called $FileContent\n\n    .Example\n        $inifilepath | $FileContent = Get-IniContent\n        -----------\n        Description\n        Gets the content of the ini file passed through the pipe into a hashtable called $FileContent\n\n    .Example\n        C:\\PS>$FileContent = Get-IniContent \"c:\\settings.ini\"\n        C:\\PS>$FileContent[\"Section\"][\"Key\"]\n        -----------\n        Description\n        Returns the key \"Key\" of the section \"Section\" from the C:\\settings.ini file\n\n    .Link\n        Out-IniFile\n    #>\n\n    [CmdletBinding()]\n    [OutputType(\n        [System.Collections.Specialized.OrderedDictionary]\n    )]\n    Param(\n        # Specifies the path to the input file.\n        [ValidateNotNullOrEmpty()]\n        [Parameter( Mandatory = $true, ValueFromPipeline = $true )]\n        [String]\n        $FilePath,\n\n        # Specify what characters should be describe a comment.\n        # Lines starting with the characters provided will be rendered as comments.\n        # Default: \";\"\n        [Char[]]\n        $CommentChar = @(\";\", \"#\", \":\", \"/\"),\n\n        # Remove lines determined to be comments from the resulting dictionary.\n        [Switch]\n        $IgnoreComments,\n\n        [Alias('KeyValSeparator')]\n        [String]\n        $delimiter = '='\n    )\n\n    Begin {\n        Write-Debug \"PsBoundParameters:\"\n        $PSBoundParameters.GetEnumerator() | ForEach-Object { Write-Debug $_ }\n        if ($PSBoundParameters['Debug']) {\n            $DebugPreference = 'Continue'\n        }\n        Write-Debug \"DebugPreference: $DebugPreference\"\n\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function started\"\n\n        $commentRegex = \"^\\s*([$($CommentChar -join '')].*)$\"\n        $sectionRegex = \"^\\s*\\[(.+)\\]\\s*$\"\n        $keyRegex     = \"^\\s*(.+?)\\s*$delimiter\\s*(['`\"]?)(.*)\\2\\s*$\"\n\n        Write-Debug (\"commentRegex is {0}.\" -f $commentRegex)\n    }\n\n    Process {\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Processing file: $Filepath\"\n\n        $ini = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n        #$ini = @{}\n\n        if (!(Test-Path $Filepath)) {\n            Write-Verbose (\"Warning: `\"{0}`\" was not found.\" -f $Filepath)\n            Write-Output $ini\n        }\n\n        $commentCount = 0\n        switch -regex -file $FilePath {\n            $sectionRegex {\n                # Section\n                $section = $matches[1]\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Adding section : $section\"\n                $ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n                $CommentCount = 0\n                continue\n            }\n            $commentRegex {\n                # Comment\n                if (!$IgnoreComments) {\n                    if (!(test-path \"variable:local:section\")) {\n                        $section = $script:NoSection\n                        $ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n                    }\n                    $value = $matches[1]\n                    $CommentCount++\n                    Write-Debug (\"Incremented CommentCount is now {0}.\" -f $CommentCount)\n                    $name = \"Comment\" + $CommentCount\n                    Write-Verbose \"$($MyInvocation.MyCommand.Name):: Adding $name with value: $value\"\n                    $ini[$section][$name] = $value\n                }\n                else {\n                    Write-Debug (\"Ignoring comment {0}.\" -f $matches[1])\n                }\n\n                continue\n            }\n            $keyRegex {\n                # Key\n                if (!(test-path \"variable:local:section\")) {\n                    $section = $script:NoSection\n                    $ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)\n                }\n                $name, $value = $matches[1, 3]\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Adding key $name with value: $value\"\n                if (-not $ini[$section][$name]) {\n                    $ini[$section][$name] = $value\n                }\n                else {\n                    if ($ini[$section][$name] -is [string]) {\n                        $ini[$section][$name] = [System.Collections.ArrayList]::new()\n                        $ini[$section][$name].Add($ini[$section][$name]) | Out-Null\n                        $ini[$section][$name].Add($value) | Out-Null\n                    }\n                    else {\n                        $ini[$section][$name].Add($value) | Out-Null\n                    }\n                }\n                continue\n            }\n        }\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Finished Processing file: $FilePath\"\n        Write-Output $ini\n    }\n\n    End {\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function ended\"\n    }\n}\n\nSet-Alias gic Get-IniContent\n"
  },
  {
    "path": "helpers/PsInI/Out-IniFile.ps1",
    "content": "Function Out-IniFile {\n    <#\n    .Synopsis\n        Write hash content to INI file\n\n    .Description\n        Write hash content to INI file\n\n    .Notes\n        Author      : Oliver Lipkau <oliver@lipkau.net>\n        Blog        : http://oliver.lipkau.net/blog/\n        Source      : https://github.com/lipkau/PsIni\n                      http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91\n\n        #Requires -Version 2.0\n\n    .Inputs\n        System.String\n        System.Collections.IDictionary\n\n    .Outputs\n        System.IO.FileSystemInfo\n\n    .Example\n        Out-IniFile $IniVar \"C:\\myinifile.ini\"\n        -----------\n        Description\n        Saves the content of the $IniVar Hashtable to the INI File c:\\myinifile.ini\n\n    .Example\n        $IniVar | Out-IniFile \"C:\\myinifile.ini\" -Force\n        -----------\n        Description\n        Saves the content of the $IniVar Hashtable to the INI File c:\\myinifile.ini and overwrites the file if it is already present\n\n    .Example\n        $file = Out-IniFile $IniVar \"C:\\myinifile.ini\" -PassThru\n        -----------\n        Description\n        Saves the content of the $IniVar Hashtable to the INI File c:\\myinifile.ini and saves the file into $file\n\n    .Example\n        $Category1 = @{“Key1”=”Value1”;”Key2”=”Value2”}\n        $Category2 = @{“Key1”=”Value1”;”Key2”=”Value2”}\n        $NewINIContent = @{“Category1”=$Category1;”Category2”=$Category2}\n        Out-IniFile -InputObject $NewINIContent -FilePath \"C:\\MyNewFile.ini\"\n        -----------\n        Description\n        Creating a custom Hashtable and saving it to C:\\MyNewFile.ini\n    .Link\n        Get-IniContent\n    #>\n\n    [CmdletBinding()]\n    [OutputType(\n        [System.IO.FileSystemInfo]\n    )]\n    Param(\n        # Adds the output to the end of an existing file, instead of replacing the file contents.\n        [switch]\n        $Append,\n\n        # Specifies the file encoding. The default is UTF8.\n        #\n        # Valid values are:\n        # -- ASCII:  Uses the encoding for the ASCII (7-bit) character set.\n        # -- BigEndianUnicode:  Encodes in UTF-16 format using the big-endian byte order.\n        # -- Byte:   Encodes a set of characters into a sequence of bytes.\n        # -- String:  Uses the encoding type for a string.\n        # -- Unicode:  Encodes in UTF-16 format using the little-endian byte order.\n        # -- UTF7:   Encodes in UTF-7 format.\n        # -- UTF8:  Encodes in UTF-8 format.\n        [ValidateSet(\"Unicode\", \"UTF7\", \"UTF8\", \"ASCII\", \"BigEndianUnicode\", \"Byte\", \"String\")]\n        [Parameter()]\n        [String]\n        $Encoding = \"UTF8\",\n\n        # Specifies the path to the output file.\n        [ValidateNotNullOrEmpty()]\n        [ValidateScript( {Test-Path $_ -IsValid} )]\n        [Parameter( Position = 0, Mandatory = $true )]\n        [String]\n        $FilePath,\n\n        # Allows the cmdlet to overwrite an existing read-only file. Even using the Force parameter, the cmdlet cannot override security restrictions.\n        [Switch]\n        $Force,\n\n        # Specifies the Hashtable to be written to the file. Enter a variable that contains the objects or type a command or expression that gets the objects.\n        [Parameter( Mandatory = $true, ValueFromPipeline = $true )]\n        [System.Collections.IDictionary]\n        $InputObject,\n\n        # Passes an object representing the location to the pipeline. By default, this cmdlet does not generate any output.\n        [Switch]\n        $Passthru,\n\n        # Adds spaces around the equal sign when writing the key = value\n        [Switch]\n        $Loose,\n\n        # Writes the file as \"pretty\" as possible\n        #\n        # Adds an extra linebreak between Sections\n        [Switch]\n        $Pretty,\n\n        [Alias('KeyValSeparator')]\n        [String]\n        $delimiter = '='\n    )\n\n    Begin {\n        Write-Debug \"PsBoundParameters:\"\n        $PSBoundParameters.GetEnumerator() | ForEach-Object { Write-Debug $_ }\n        if ($PSBoundParameters['Debug']) {\n            $DebugPreference = 'Continue'\n        }\n        Write-Debug \"DebugPreference: $DebugPreference\"\n\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function started\"\n\n        function Out-Keys {\n            param(\n                [ValidateNotNullOrEmpty()]\n                [Parameter( Mandatory, ValueFromPipeline )]\n                [System.Collections.IDictionary]\n                $InputObject,\n\n                [ValidateSet(\"Unicode\", \"UTF7\", \"UTF8\", \"ASCII\", \"BigEndianUnicode\", \"Byte\", \"String\")]\n                [Parameter( Mandatory )]\n                [string]\n                $Encoding = \"UTF8\",\n\n                [ValidateNotNullOrEmpty()]\n                [ValidateScript( {Test-Path $_ -IsValid})]\n                [Parameter( Mandatory, ValueFromPipelineByPropertyName )]\n                [Alias(\"Path\")]\n                [string]\n                $FilePath,\n\n                [Parameter( Mandatory )]\n                $Delimiter,\n\n                [Parameter( Mandatory )]\n                $MyInvocation\n            )\n\n            Process {\n                if (!($InputObject.get_keys())) {\n                    Write-Warning (\"No data found in '{0}'.\" -f $FilePath)\n                }\n                Foreach ($key in $InputObject.get_keys()) {\n                    if ($key -match \"^Comment\\d+\") {\n                        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing comment: $key\"\n                        \"$($InputObject[$key])\" | Out-File -Encoding $Encoding -FilePath $FilePath -Append\n                    }\n                    else {\n                        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing key: $key\"\n                        $InputObject[$key] |\n                            ForEach-Object { \"$key$delimiter$_\" } |\n                            Out-File -Encoding $Encoding -FilePath $FilePath -Append\n                    }\n                }\n            }\n        }\n\n        if ($Loose) {\n            $delimiter = \"$delimiter \"\n        }\n\n        # Splatting Parameters\n        $parameters = @{\n            Encoding = $Encoding;\n            FilePath = $FilePath\n        }\n\n    }\n\n    Process {\n        $extraLF = \"\"\n\n        if ($Append) {\n            Write-Debug (\"Appending to '{0}'.\" -f $FilePath)\n            $outfile = Get-Item $FilePath\n        }\n        else {\n            Write-Debug (\"Creating new file '{0}'.\" -f $FilePath)\n            $outFile = New-Item -ItemType file -Path $Filepath -Force:$Force\n        }\n\n        if (!(Test-Path $outFile.FullName)) {Throw \"Could not create File\"}\n\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing to file: $Filepath\"\n        foreach ($i in $InputObject.get_keys()) {\n            if (!($InputObject[$i].GetType().GetInterface('IDictionary'))) {\n                #Key value pair\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing key: $i\"\n                \"$i$delimiter$($InputObject[$i])\" | Out-File -Append @parameters\n\n            }\n            elseif ($i -eq $script:NoSection) {\n                #Key value pair of NoSection\n                Out-Keys $InputObject[$i] `\n                    @parameters `\n                    -Delimiter $delimiter `\n                    -MyInvocation $MyInvocation\n            }\n            else {\n                #Sections\n                Write-Verbose \"$($MyInvocation.MyCommand.Name):: Writing Section: [$i]\"\n\n                # Only write section, if it is not a dummy ($script:NoSection)\n                if ($i -ne $script:NoSection) { \"$extraLF[$i]\"  | Out-File -Append @parameters }\n                if ($Pretty) {\n                    $extraLF = \"`r`n\"\n                }\n\n                if ( $InputObject[$i].Count) {\n                    Out-Keys $InputObject[$i] `\n                        @parameters `\n                        -Delimiter $delimiter `\n                        -MyInvocation $MyInvocation\n                }\n\n            }\n        }\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Finished Writing to file: $FilePath\"\n    }\n\n    End {\n        if ($PassThru) {\n            Write-Debug (\"Returning file due to PassThru argument.\")\n            Write-Output (Get-Item $outFile)\n        }\n        Write-Verbose \"$($MyInvocation.MyCommand.Name):: Function ended\"\n    }\n}\n\nSet-Alias oif Out-IniFile\n"
  },
  {
    "path": "helpers/PsInI/README.MD",
    "content": "## PsIni\n\nThese functions are from the [PsIni module](https://github.com/lipkau/PsIni), licensed under [MIT](https://github.com/lipkau/PsIni/blob/master/LICENSE)\n\n### Usage\n\nGames like Fortnite and Valorant have these kind of settings file in .INI, they should be a piece of cake to optimize:\n\n```ps\n$GUS = Get-IniContent -FilePath \"$env:LOCALAPPDATA\\VALORANT\\Saved\\Config\\$UserID\\Windows\\GameUserSettings.ini\"\n# Do some modifications (eg using Merge-HashTables). . .\nOut-IniFile -FilePath \"$env:LOCALAPPDATA\\VALORANT\\Saved\\Config\\$UserID\\Windows\\GameUserSettings.ini\" -InputObject $GUS\n```\n\n"
  },
  {
    "path": "helpers/Set-Choice.ps1",
    "content": "function Set-Choice { # Converts passed string to an array of chars\n    param(\n        [char[]]$Letters = \"YN\"\n    )\n    While ($Key -NotIn $Letters){\n        [char]$Key = $host.UI.RawUI.ReadKey([System.Management.Automation.Host.ReadKeyOptions]'NoEcho, IncludeKeyDown').Character\n        if (($Key -NotIn $Letters) -and !$IsLinux){\n                [Console]::Beep(500,300)\n        }\n    }\n    return $Key\n}"
  },
  {
    "path": "helpers/Set-Title.ps1",
    "content": "function Set-Title {\n    param(\n        $Title\n    )\n    $Host.UI.RawUI.WindowTitle = \"TweakList - $Title\"\n}\n"
  },
  {
    "path": "helpers/Set-Verbosity.ps1",
    "content": "function Set-Verbosity {\n    [alias('Verbose','Verb')]\n    param (\n\n\t\t[Parameter(Mandatory = $true,ParameterSetName = \"Enabled\")]\n        [switch]$Enabled,\n\n\t\t[Parameter(Mandatory = $true,ParameterSetName = \"Disabled\")]\n\t\t[switch]$Disabled\n\t)\n    \n    switch ($PSCmdlet.ParameterSetName){\n        \"Enabled\" {\n            $script:Verbose = $True\n            $script:VerbosePreference = 'Continue'\n        }\n        \"Disabled\" {\n            $script:Verbose = $True\n            $script:VerbosePreference = 'SilentlyContinue'\n        }\n    }\n}"
  },
  {
    "path": "helpers/SteamTools/ConvertFrom-VDF.ps1",
    "content": "Function ConvertFrom-VDF {\n<# \n.Synopsis \n    Reads a Valve Data File (VDF) formatted string into a custom object.\n\n.Description \n    The ConvertFrom-VDF cmdlet converts a VDF-formatted string to a custom object (PSCustomObject) that has a property for each field in the VDF string. VDF is used as a textual data format for Valve software applications, such as Steam.\n\n.Parameter InputObject\n    Specifies the VDF strings to convert to PSObjects. Enter a variable that contains the string, or type a command or expression that gets the string. \n\n.Example \n    $vdf = ConvertFrom-VDF -InputObject (Get-Content \".\\SharedConfig.vdf\")\n\n    Description \n    ----------- \n    Gets the content of a VDF file named \"SharedConfig.vdf\" in the current location and converts it to a PSObject named $vdf\n\n.Inputs \n    System.String\n\n.Outputs \n    PSCustomObject\n\n\n#>\n    param\n    (\n        [Parameter(Position=0, Mandatory=$true)]\n        [AllowEmptyString()]\n        [String[]]\n        $InputObject\n    )\n\n    $root = New-Object -TypeName PSObject\n    $chain = [ordered]@{}\n    $depth = 0\n    $parent = $root\n    $element = $null\n\n    #Magic PowerShell Switch Enumrates Arrays\n    switch -Regex ($InputObject) {\n        #Case: ValueKey\n        '^\\t*\"(\\S+)\"\\t\\t\"(.+)\"$' {\n            Add-Member -InputObject $element -MemberType NoteProperty -Name $Matches[1] -Value $Matches[2]\n            continue\n        }\n        #Case: ParentKey\n        '^\\t*\"(\\S+)\"$' { \n            $element = New-Object -TypeName PSObject\n            Add-Member -InputObject $parent -MemberType NoteProperty -Name $Matches[1] -Value $element\n            continue\n        }\n        #Case: Opening ParentKey Scope\n        '^\\t*{$' {\n            $parent = $element\n            $chain.Add($depth, $element)\n            $depth++\n            continue\n        }\n        #Case: Closing ParentKey Scope\n        '^\\t*}$' {\n            $depth--\n            $parent = $chain.($depth - 1)\n            $element = $parent\n            $chain.Remove($depth)\n            continue\n        }\n        #Case: Comments or unsupported lines\n        Default {\n            Write-Debug \"Ignored line: $_\"\n            continue\n        }\n    }\n\n    return $root\n}\n"
  },
  {
    "path": "helpers/SteamTools/ConvertTo-VDF.ps1",
    "content": "Function ConvertTo-VDF\n{\n<# \n.Synopsis \n    Converts a custom object into a Valve Data File (VDF) formatted string.\n\n.Description \n    The ConvertTo-VDF cmdlet converts any object to a string in Valve Data File (VDF) format. The properties are converted to field names, the field values are converted to property values, and the methods are removed.\n\n.Parameter InputObject\n    Specifies PSObject to be converted into VDF strings.  Enter a variable that contains the object. You can also pipe an object to ConvertTo-Json.\n\n.Example \n    ConvertTo-VDF -InputObject $VDFObject | Out-File \".\\SharedConfig.vdf\"\n\n    Description \n    ----------- \n    Converts the PS object to VDF format and pipes it into \"SharedConfig.vdf\" in the current directory\n\n.Inputs \n    PSCustomObject\n\n.Outputs \n    System.String\n\n\n#>\n    param\n    (\n        [Parameter(Position=0, Mandatory=$true)]\n        [ValidateNotNullOrEmpty()]\n        [PSObject]\n        $InputObject,\n\n        [Parameter(Position=1, Mandatory=$false)]\n        [int]\n        $Depth = 0\n    )\n    $output = [string]::Empty\n    \n    foreach ( $property in ($InputObject.psobject.Properties) ) {\n        switch ($property.TypeNameOfValue) {\n            \"System.String\" { \n                $output += (\"`t\" * $Depth) + \"`\"\" + $property.Name + \"`\"`t`t`\"\" + $property.Value + \"`\"`n\"\n                break\n            }\n            \"System.Management.Automation.PSCustomObject\" {\n                $element = $property.Value\n                $output += (\"`t\" * $Depth) + \"`\"\" + $property.Name + \"`\"`n\"\n                $output += (\"`t\" * $Depth) + \"{`n\"\n                $output += ConvertTo-VDF -InputObject $element -Depth ($Depth + 1)\n                $output += (\"`t\" * $Depth) + \"}`n\"\n                break\n            }\n            Default {\n                Write-Error (\"Unsupported Property of type {0}\" -f $_) -ErrorAction Stop\n                break\n            }\n        }\n    }\n\n    return $output\n}\n"
  },
  {
    "path": "helpers/SteamTools/Get-SteamGameInstallDir.ps1",
    "content": "function Get-SteamGameInstallDir (\n    [Parameter(Mandatory = $true)][string]$Game, \n    [array]$LibraryFolders = (Get-SteamLibraryFolders)) {\n\n    # Get the installation directory of a Steam game.\n    foreach ($LibraryFolder in $LibraryFolders) {\n        $GameInstallDir = \"$LibraryFolder\\steamapps\\common\\$Game\"\n        if (Test-Path \"$($GameInstallDir.ToLower())\") {\n            return \"$GameInstallDir\"\n        }\n    }\n}"
  },
  {
    "path": "helpers/SteamTools/Get-SteamLibraryFolders.ps1",
    "content": "Function Get-SteamLibraryFolders()\n{\n<#\n.Synopsis \n\tRetrieves library folder paths from .\\SteamApps\\libraryfolders.vdf\n.Description\n\tReads .\\SteamApps\\libraryfolders.vdf to find the paths of all the library folders set up in steam\n.Example \n\t$libraryFolders = Get-LibraryFolders\n\tDescription \n\t----------- \n\tRetrieves a list of the library folders set up in steam\n#>\n\t$steamPath = Get-SteamPath\n\t\n\t$vdfPath = \"$($steamPath)\\SteamApps\\libraryfolders.vdf\"\n\t\n\t[array]$libraryFolderPaths = @()\n\t\n\tif (Test-Path $vdfPath)\n\t{\n\t\t$libraryFolders = ConvertFrom-VDF (Get-Content $vdfPath -Encoding UTF8) | Select-Object -ExpandProperty libraryfolders\n\t\t\n\t\t$libraryFolderIds = $libraryFolders | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name\n\t\t\n\t\tForEach ($libraryId in $libraryFolderIds)\n\t\t{\n\t\t\t$libraryFolder = $libraryFolders.($libraryId)\n\t\t\t\n\t\t\t$libraryFolderPaths += $libraryFolder.path.Replace('\\\\','\\')\n\t\t}\n\t}\n\t\n\treturn $libraryFolderPaths\n}\n\n"
  },
  {
    "path": "helpers/SteamTools/Get-SteamPath.ps1",
    "content": "function Get-SteamPath {\n    # Get the Steam installation directory.\n\n    $MUICache = \"Registry::HKCR\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache\"\n    $Protocol = \"Registry::HKCR\\steam\\Shell\\Open\\Command\"\n    $Steam = Get-ItemPropertyValue \"Registry::HKCU\\Software\\Valve\\Steam\" -Name \"SteamPath\" -ErrorAction SilentlyContinue\n    \n    # MUICache\n    if (!$Steam) {\n        $Steam = Split-Path (((Get-Item \"$MUICache\").Property | Where-Object { $PSItem -Like \"*Steam*\" } |\n                Where-Object { (Get-ItemPropertyValue \"$MUICache\" -Name $PSItem) -eq \"Steam\" }).TrimEnd(\".FriendlyAppName\"))\n    }\n\n    # Steam Browser Protocol\n    if (!$Steam) {\n        $Steam = Split-Path (((Get-ItemPropertyValue \"$Protocol\" -Name \"(Default)\" -ErrorAction SilentlyContinue) -Split \"--\", 2, \"SimpleMatch\")[0]).Trim('\"')\n    }\n\n    return $Steam.ToLower()\n}"
  },
  {
    "path": "helpers/SteamTools/README.MD",
    "content": "The following functions are from the fork-of-fork-of-fork of [Steam-GetOnTop](https://github.com/ApocalyptoSoldier/Steam-GetOnTop/tree/master/Modules/SteamTools), originally from [ChiefIntegrator](https://github.com/ChiefIntegrator)\n* Get-SteamPath, might make it cross-platform later 👍\n* ConvertFrom-VDF and ConvertTo-VDF, will be a huge\n* Get-SteamLibraryFolders (renamed it from Get-LibraryFolders)"
  },
  {
    "path": "helpers/Test-Admin.ps1",
    "content": "function Test-Admin {\n    [CmdletBinding()]\n    param ()\n    \n    if ($IsLinux -or $IsMacOS) {\n        # If sudo-ing or logged on as root, returns user ID 0\n        $idCmd = (Get-Command -Name id).Source\n        [int64] $idResult = & $idCmd -u\n        $idResult -eq 0\n    }\n    else {\n        $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()\n        (New-Object -TypeName Security.Principal.WindowsPrincipal -ArgumentList $currentUser).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)\n    }\n}"
  },
  {
    "path": "helpers/Write-Color.ps1",
    "content": "function Write-Color {\n    # Ported to PowerShell from an old version of https://github.com/atzuur/colors\n    param(\n        [String]$Message\n    )\n    $E = [char]0x1b\n    $Presets = [Ordered]@{\n        '&RESET'   =\"$E[0m\"\n        '&BOLD'    =\"$E[1m\"\n        '&ITALIC'  =\"$E[3m\"\n        '&URL'     =\"$E[4m\"\n        '&BLINK'   =\"$E[5m\"\n        '&ALTBLINK'=\"$E[6m\"\n        '&SELECTED'=\"$E[7m\"\n        '@BLACK'   =\"$E[30m\"\n        '@RED'     =\"$E[31m\"\n        '@GREEN'   =\"$E[32m\"\n        '@YELLOW'  =\"$E[33m\"\n        '@BLUE'    =\"$E[34m\"\n        '@VIOLET'  =\"$E[35m\"\n        '@BEIGE'   =\"$E[36m\"\n        '@WHITE'   =\"$E[37m\"\n        '@GREY'    =\"$E[90m\"\n        '@LRED'    =\"$E[91m\"\n        '@LGREEN'  =\"$E[92m\"\n        '@LYELLOW' =\"$E[93m\"\n        '@LBLUE'   =\"$E[94m\"\n        '@LVIOLET' =\"$E[95m\"\n        '@LBEIGE'  =\"$E[96m\"\n        '@LWHITE'  =\"$E[97m\"\n        '%BLACK'   =\"$E[40m\"\n        '%RED'     =\"$E[41m\"\n        '%GREEN'   =\"$E[42m\"\n        '%YELLOW'  =\"$E[43m\"\n        '%BLUE'    =\"$E[44m\"\n        '%VIOLET'  =\"$E[45m\"\n        '%BEIGE'   =\"$E[46m\"\n        '%WHITE'   =\"$E[47m\"\n        '%GREY'    =\"$E[100m\"\n        '%LRED'    =\"$E[101m\"\n        '%LGREEN'  =\"$E[102m\"\n        '%LYELLOW' =\"$E[103m\"\n        '%LBLUE'   =\"$E[104m\"\n        '%LVIOLET' =\"$E[105m\"\n        '%LBEIGE'  =\"$E[106m\"\n        '%LWHITE'  =\"$E[107m\"\n    }\n    Foreach($Pattern in $Presets.Keys){\n        $Message = $Message -replace $Pattern, $Presets.$Pattern\n    }\n    return $Message + $Presets.'$RESET'\n}\n"
  },
  {
    "path": "helpers/Write-Diff.ps1",
    "content": "function Write-Diff {\n\tparam(\n\t[String]$Message,\n\t[Boolean]$Positivity,\n\t[String]$Term\n\t)\n\t$E = [char]0x1b # Ansi ESC character\n\n\tif ($Positivity){\n\t\t$Sign = '+'\n\t\t$Accent = \"$E[92m\"\n\t\tif (!$Term){\n\t\t$Term = \"Enabled\"\n\t\t}\n\t}\n\telseif(!$Positivity){\n\t\t$Sign = '-'\n\t\tif (!$Term){\n\t\t\t$Term = \"Removed\"\n\t\t}\n\t\t$Accent = \"$E[91m\"\n\t}\n\n\t$Gray = \"$E[90m\"\n\t$Reset = \"$E[0m\"\n\n\tWrite-Host \"  $Gray[$Accent$Sign$Gray]$Reset $Term $Accent$Message\"\n \n}\n"
  },
  {
    "path": "helpers/Write-Menu.ps1",
    "content": "\nfunction Write-Menu {\n    <#\n        By QuietusPlus on GitHub: https://github.com/QuietusPlus/Write-Menu\n\n        .SYNOPSIS\n            Outputs a command-line menu which can be navigated using the keyboard.\n\n        .DESCRIPTION\n            Outputs a command-line menu which can be navigated using the keyboard.\n\n            * Automatically creates multiple pages if the entries cannot fit on-screen.\n            * Supports nested menus using a combination of hashtables and arrays.\n            * No entry / page limitations (apart from device performance).\n            * Sort entries using the -Sort parameter.\n            * -MultiSelect: Use space to check a selected entry, all checked entries will be invoked / returned upon confirmation.\n            * Jump to the top / bottom of the page using the \"Home\" and \"End\" keys.\n            * \"Scrolling\" list effect by automatically switching pages when reaching the top/bottom.\n            * Nested menu indicator next to entries.\n            * Remembers parent menus: Opening three levels of nested menus means you have to press \"Esc\" three times.\n\n            Controls             Description\n            --------             -----------\n            Up                   Previous entry\n            Down                 Next entry\n            Left / PageUp        Previous page\n            Right / PageDown     Next page\n            Home                 Jump to top\n            End                  Jump to bottom\n            Space                Check selection (-MultiSelect only)\n            Enter                Confirm selection\n            Esc / Backspace      Exit / Previous menu\n\n        .EXAMPLE\n            PS C:\\>$menuReturn = Write-Menu -Title 'Menu Title' -Entries @('Menu Option 1', 'Menu Option 2', 'Menu Option 3', 'Menu Option 4')\n\n            Output:\n\n              Menu Title\n\n               Menu Option 1\n               Menu Option 2\n               Menu Option 3\n               Menu Option 4\n\n        .EXAMPLE\n            PS C:\\>$menuReturn = Write-Menu -Title 'AppxPackages' -Entries (Get-AppxPackage).Name -Sort\n\n            This example uses Write-Menu to sort and list app packages (Windows Store/Modern Apps) that are installed for the current profile.\n\n        .EXAMPLE\n            PS C:\\>$menuReturn = Write-Menu -Title 'Advanced Menu' -Sort -Entries @{\n                'Command Entry' = '(Get-AppxPackage).Name'\n                'Invoke Entry' = '@(Get-AppxPackage).Name'\n                'Hashtable Entry' = @{\n                    'Array Entry' = \"@('Menu Option 1', 'Menu Option 2', 'Menu Option 3', 'Menu Option 4')\"\n                }\n            }\n\n            This example includes all possible entry types:\n\n            Command Entry     Invoke without opening as nested menu (does not contain any prefixes)\n            Invoke Entry      Invoke and open as nested menu (contains the \"@\" prefix)\n            Hashtable Entry   Opened as a nested menu\n            Array Entry       Opened as a nested menu\n\n        .NOTES\n            Write-Menu by QuietusPlus (inspired by \"Simple Textbased Powershell Menu\" [Michael Albert])\n\n        .LINK\n            https://quietusplus.github.io/Write-Menu\n\n        .LINK\n            https://github.com/QuietusPlus/Write-Menu\n    #>\n\n    [CmdletBinding()]\n\n    <#\n        Parameters\n    #>\n\n    param(\n        # Array or hashtable containing the menu entries\n        [Parameter(Mandatory=$true, ValueFromPipeline = $true)]\n        [ValidateNotNullOrEmpty()]\n        [Alias('InputObject')]\n        $Entries,\n\n        # Title shown at the top of the menu.\n        [Parameter(ValueFromPipelineByPropertyName = $true)]\n        [Alias('Name')]\n        [string]\n        $Title,\n\n        # Sort entries before they are displayed.\n        [Parameter()]\n        [switch]\n        $Sort,\n\n        # Select multiple menu entries using space, each selected entry will then get invoked (this will disable nested menu's).\n        [Parameter()]\n        [switch]\n        $MultiSelect\n    )\n\n    <#\n        Configuration\n    #>\n\n    # Entry prefix, suffix and padding\n    $script:cfgPrefix = ' '\n    $script:cfgPadding = 2\n    $script:cfgSuffix = ' '\n    $script:cfgNested = ' >'\n\n    # Minimum page width\n    $script:cfgWidth = 30\n\n    # Hide cursor\n    [System.Console]::CursorVisible = $false\n\n    # Save initial colours\n    $script:colorForeground = [System.Console]::ForegroundColor\n    $script:colorBackground = [System.Console]::BackgroundColor\n\n    <#\n        Checks\n    #>\n\n    # Check if entries has been passed\n    if ($Entries -like $null) {\n        Write-Error \"Missing -Entries parameter!\"\n        return\n    }\n\n    # Check if host is console\n    if ($host.Name -ne 'ConsoleHost') {\n        Write-Error \"[$($host.Name)] Cannot run inside current host, please use a console window instead!\"\n        return\n    }\n\n    <#\n        Set-Color\n    #>\n\n    function Set-Color ([switch]$Inverted) {\n        switch ($Inverted) {\n            $true {\n                [System.Console]::ForegroundColor = $colorBackground\n                [System.Console]::BackgroundColor = $colorForeground\n            }\n            Default {\n                [System.Console]::ForegroundColor = $colorForeground\n                [System.Console]::BackgroundColor = $colorBackground\n            }\n        }\n    }\n\n    <#\n        Get-Menu\n    #>\n\n    function Get-Menu ($script:inputEntries) {\n        # Clear console\n        Clear-Host\n\n        # Check if -Title has been provided, if so set window title, otherwise set default.\n        if ($Title -notlike $null) {\n            #$host.UI.RawUI.WindowTitle = $Title # DISABLED FOR TWEAKLIST\n            $script:menuTitle = \"$Title\"\n        } else {\n            $script:menuTitle = 'Menu'\n        }\n\n        # Set menu height\n        $script:pageSize = ($host.UI.RawUI.WindowSize.Height - 5)\n\n        # Convert entries to object\n        $script:menuEntries = @()\n        switch ($inputEntries.GetType().Name) {\n            'String' {\n                # Set total entries\n                $script:menuEntryTotal = 1\n                # Create object\n                $script:menuEntries = New-Object PSObject -Property @{\n                    Command = ''\n                    Name = $inputEntries\n                    Selected = $false\n                    onConfirm = 'Name'\n                }; break\n            }\n            'Object[]' {\n                # Get total entries\n                $script:menuEntryTotal = $inputEntries.Length\n                # Loop through array\n                foreach ($i in 0..$($menuEntryTotal - 1)) {\n                    # Create object\n                    $script:menuEntries += New-Object PSObject -Property @{\n                        Command = ''\n                        Name = $($inputEntries)[$i]\n                        Selected = $false\n                        onConfirm = 'Name'\n                    }; $i++\n                }; break\n            }\n            'Hashtable' {\n                # Get total entries\n                $script:menuEntryTotal = $inputEntries.Count\n                # Loop through hashtable\n                foreach ($i in 0..($menuEntryTotal - 1)) {\n                    # Check if hashtable contains a single entry, copy values directly if true\n                    if ($menuEntryTotal -eq 1) {\n                        $tempName = $($inputEntries.Keys)\n                        $tempCommand = $($inputEntries.Values)\n                    } else {\n                        $tempName = $($inputEntries.Keys)[$i]\n                        $tempCommand = $($inputEntries.Values)[$i]\n                    }\n\n                    # Check if command contains nested menu\n                    if ($tempCommand.GetType().Name -eq 'Hashtable') {\n                        $tempAction = 'Hashtable'\n                    } elseif ($tempCommand.Substring(0,1) -eq '@') {\n                        $tempAction = 'Invoke'\n                    } else {\n                        $tempAction = 'Command'\n                    }\n\n                    # Create object\n                    $script:menuEntries += New-Object PSObject -Property @{\n                        Name = $tempName\n                        Command = $tempCommand\n                        Selected = $false\n                        onConfirm = $tempAction\n                    }; $i++\n                }; break\n            }\n            Default {\n                Write-Error \"Type `\"$($inputEntries.GetType().Name)`\" not supported, please use an array or hashtable.\"\n                exit\n            }\n        }\n\n        # Sort entries\n        if ($Sort -eq $true) {\n            $script:menuEntries = $menuEntries | Sort-Object -Property Name\n        }\n\n        # Get longest entry\n        $script:entryWidth = ($menuEntries.Name | Measure-Object -Maximum -Property Length).Maximum\n        # Widen if -MultiSelect is enabled\n        if ($MultiSelect) { $script:entryWidth += 4 }\n        # Set minimum entry width\n        if ($entryWidth -lt $cfgWidth) { $script:entryWidth = $cfgWidth }\n        # Set page width\n        $script:pageWidth = $cfgPrefix.Length + $cfgPadding + $entryWidth + $cfgPadding + $cfgSuffix.Length\n\n        # Set current + total pages\n        $script:pageCurrent = 0\n        $script:pageTotal = [math]::Ceiling((($menuEntryTotal - $pageSize) / $pageSize))\n\n        # Insert new line\n        [System.Console]::WriteLine(\"\")\n\n        # Save title line location + write title\n        $script:lineTitle = [System.Console]::CursorTop\n        [System.Console]::WriteLine(\"  $menuTitle\" + \"`n\")\n\n        # Save first entry line location\n        $script:lineTop = [System.Console]::CursorTop\n    }\n\n    <#\n        Get-Page\n    #>\n\n    function Get-Page {\n        # Update header if multiple pages\n        if ($pageTotal -ne 0) { Update-Header }\n\n        # Clear entries\n        for ($i = 0; $i -le $pageSize; $i++) {\n            # Overwrite each entry with whitespace\n            [System.Console]::WriteLine(\"\".PadRight($pageWidth) + ' ')\n        }\n\n        # Move cursor to first entry\n        [System.Console]::CursorTop = $lineTop\n\n        # Get index of first entry\n        $script:pageEntryFirst = ($pageSize * $pageCurrent)\n\n        # Get amount of entries for last page + fully populated page\n        if ($pageCurrent -eq $pageTotal) {\n            $script:pageEntryTotal = ($menuEntryTotal - ($pageSize * $pageTotal))\n        } else {\n            $script:pageEntryTotal = $pageSize\n        }\n\n        # Set position within console\n        $script:lineSelected = 0\n\n        # Write all page entries\n        for ($i = 0; $i -le ($pageEntryTotal - 1); $i++) {\n            Write-Entry $i\n        }\n    }\n\n    <#\n        Write-Entry\n    #>\n\n    function Write-Entry ([int16]$Index, [switch]$Update) {\n        # Check if entry should be highlighted\n        switch ($Update) {\n            $true { $lineHighlight = $false; break }\n            Default { $lineHighlight = ($Index -eq $lineSelected) }\n        }\n\n        # Page entry name\n        $pageEntry = $menuEntries[($pageEntryFirst + $Index)].Name\n\n        # Prefix checkbox if -MultiSelect is enabled\n        if ($MultiSelect) {\n            switch ($menuEntries[($pageEntryFirst + $Index)].Selected) {\n                $true { $pageEntry = \"[X] $pageEntry\"; break }\n                Default { $pageEntry = \"[ ] $pageEntry\" }\n            }\n        }\n\n        # Full width highlight + Nested menu indicator\n        switch ($menuEntries[($pageEntryFirst + $Index)].onConfirm -in 'Hashtable', 'Invoke') {\n            $true { $pageEntry = \"$pageEntry\".PadRight($entryWidth) + \"$cfgNested\"; break }\n            Default { $pageEntry = \"$pageEntry\".PadRight($entryWidth + $cfgNested.Length) }\n        }\n\n        # Write new line and add whitespace without inverted colours\n        [System.Console]::Write(\"`r\" + $cfgPrefix)\n        # Invert colours if selected\n        if ($lineHighlight) { Set-Color -Inverted }\n        # Write page entry\n        [System.Console]::Write(\"\".PadLeft($cfgPadding) + $pageEntry + \"\".PadRight($cfgPadding))\n        # Restore colours if selected\n        if ($lineHighlight) { Set-Color }\n        # Entry suffix\n        [System.Console]::Write($cfgSuffix + \"`n\")\n    }\n\n    <#\n        Update-Entry\n    #>\n\n    function Update-Entry ([int16]$Index) {\n        # Reset current entry\n        [System.Console]::CursorTop = ($lineTop + $lineSelected)\n        Write-Entry $lineSelected -Update\n\n        # Write updated entry\n        $script:lineSelected = $Index\n        [System.Console]::CursorTop = ($lineTop + $Index)\n        Write-Entry $lineSelected\n\n        # Move cursor to first entry on page\n        [System.Console]::CursorTop = $lineTop\n    }\n\n    <#\n        Update-Header\n    #>\n\n    function Update-Header {\n        # Set corrected page numbers\n        $pCurrent = ($pageCurrent + 1)\n        $pTotal = ($pageTotal + 1)\n\n        # Calculate offset\n        $pOffset = ($pTotal.ToString()).Length\n\n        # Build string, use offset and padding to right align current page number\n        $script:pageNumber = \"{0,-$pOffset}{1,0}\" -f \"$(\"$pCurrent\".PadLeft($pOffset))\",\"/$pTotal\"\n\n        # Move cursor to title\n        [System.Console]::CursorTop = $lineTitle\n        # Move cursor to the right\n        [System.Console]::CursorLeft = ($pageWidth - ($pOffset * 2) - 1)\n        # Write page indicator\n        [System.Console]::WriteLine(\"$pageNumber\")\n    }\n\n    <#\n        Initialisation\n    #>\n\n    # Get menu\n    Get-Menu $Entries\n\n    # Get page\n    Get-Page\n\n    # Declare hashtable for nested entries\n    $menuNested = [ordered]@{}\n\n    <#\n        User Input\n    #>\n\n    # Loop through user input until valid key has been pressed\n    do { $inputLoop = $true\n\n        # Move cursor to first entry and beginning of line\n        [System.Console]::CursorTop = $lineTop\n        [System.Console]::Write(\"`r\")\n\n        # Get pressed key\n        $menuInput = [System.Console]::ReadKey($false)\n\n        # Define selected entry\n        $entrySelected = $menuEntries[($pageEntryFirst + $lineSelected)]\n\n        # Check if key has function attached to it\n        switch ($menuInput.Key) {\n            # Exit / Return\n            { $_ -in 'Escape', 'Backspace' } {\n                # Return to parent if current menu is nested\n                if ($menuNested.Count -ne 0) {\n                    $pageCurrent = 0\n                    $Title = $($menuNested.GetEnumerator())[$menuNested.Count - 1].Name\n                    Get-Menu $($menuNested.GetEnumerator())[$menuNested.Count - 1].Value\n                    Get-Page\n                    $menuNested.RemoveAt($menuNested.Count - 1) | Out-Null\n                # Otherwise exit and return $null\n                } else {\n                    Clear-Host\n                    $inputLoop = $false\n                    [System.Console]::CursorVisible = $true\n                    return $null\n                }; break\n            }\n\n            # Next entry\n            'DownArrow' {\n                if ($lineSelected -lt ($pageEntryTotal - 1)) { # Check if entry isn't last on page\n                    Update-Entry ($lineSelected + 1)\n                } elseif ($pageCurrent -ne $pageTotal) { # Switch if not on last page\n                    $pageCurrent++\n                    Get-Page\n                }; break\n            }\n\n            # Previous entry\n            'UpArrow' {\n                if ($lineSelected -gt 0) { # Check if entry isn't first on page\n                    Update-Entry ($lineSelected - 1)\n                } elseif ($pageCurrent -ne 0) { # Switch if not on first page\n                    $pageCurrent--\n                    Get-Page\n                    Update-Entry ($pageEntryTotal - 1)\n                }; break\n            }\n\n            # Select top entry\n            'Home' {\n                if ($lineSelected -ne 0) { # Check if top entry isn't already selected\n                    Update-Entry 0\n                } elseif ($pageCurrent -ne 0) { # Switch if not on first page\n                    $pageCurrent--\n                    Get-Page\n                    Update-Entry ($pageEntryTotal - 1)\n                }; break\n            }\n\n            # Select bottom entry\n            'End' {\n                if ($lineSelected -ne ($pageEntryTotal - 1)) { # Check if bottom entry isn't already selected\n                    Update-Entry ($pageEntryTotal - 1)\n                } elseif ($pageCurrent -ne $pageTotal) { # Switch if not on last page\n                    $pageCurrent++\n                    Get-Page\n                }; break\n            }\n\n            # Next page\n            { $_ -in 'RightArrow','PageDown' } {\n                if ($pageCurrent -lt $pageTotal) { # Check if already on last page\n                    $pageCurrent++\n                    Get-Page\n                }; break\n            }\n\n            # Previous page\n            { $_ -in 'LeftArrow','PageUp' } { # Check if already on first page\n                if ($pageCurrent -gt 0) {\n                    $pageCurrent--\n                    Get-Page\n                }; break\n            }\n\n            # Select/check entry if -MultiSelect is enabled\n            'Spacebar' {\n                if ($MultiSelect) {\n                    switch ($entrySelected.Selected) {\n                        $true { $entrySelected.Selected = $false }\n                        $false { $entrySelected.Selected = $true }\n                    }\n                    Update-Entry ($lineSelected)\n                }; break\n            }\n\n            # Select all if -MultiSelect has been enabled\n            'Insert' {\n                if ($MultiSelect) {\n                    $menuEntries | ForEach-Object {\n                        $_.Selected = $true\n                    }\n                    Get-Page\n                }; break\n            }\n\n            # Select none if -MultiSelect has been enabled\n            'Delete' {\n                if ($MultiSelect) {\n                    $menuEntries | ForEach-Object {\n                        $_.Selected = $false\n                    }\n                    Get-Page\n                }; break\n            }\n\n            # Confirm selection\n            'Enter' {\n                # Check if -MultiSelect has been enabled\n                if ($MultiSelect) {\n                    Clear-Host\n                    # Process checked/selected entries\n                    $menuEntries | ForEach-Object {\n                        # Entry contains command, invoke it\n                        if (($_.Selected) -and ($_.Command -notlike $null) -and ($entrySelected.Command.GetType().Name -ne 'Hashtable')) {\n                            Invoke-Expression -Command $_.Command\n                        # Return name, entry does not contain command\n                        } elseif ($_.Selected) {\n                            return $_.Name\n                        }\n                    }\n                    # Exit and re-enable cursor\n                    $inputLoop = $false\n                    [System.Console]::CursorVisible = $true\n                    break\n                }\n\n                # Use onConfirm to process entry\n                switch ($entrySelected.onConfirm) {\n                    # Return hashtable as nested menu\n                    'Hashtable' {\n                        $menuNested.$Title = $inputEntries\n                        $Title = $entrySelected.Name\n                        Get-Menu $entrySelected.Command\n                        Get-Page\n                        break\n                    }\n\n                    # Invoke attached command and return as nested menu\n                    'Invoke' {\n                        $menuNested.$Title = $inputEntries\n                        $Title = $entrySelected.Name\n                        Get-Menu $(Invoke-Expression -Command $entrySelected.Command.Substring(1))\n                        Get-Page\n                        break\n                    }\n\n                    # Invoke attached command and exit\n                    'Command' {\n                        Clear-Host\n                        Invoke-Expression -Command $entrySelected.Command\n                        $inputLoop = $false\n                        [System.Console]::CursorVisible = $true\n                        break\n                    }\n\n                    # Return name and exit\n                    'Name' {\n                        Clear-Host\n                        return $entrySelected.Name\n                        $inputLoop = $false\n                        [System.Console]::CursorVisible = $true\n                    }\n                }\n            }\n        }\n    } while ($inputLoop)\n}\n"
  },
  {
    "path": "modules/Add-ContextMenu.ps1",
    "content": "function Add-ContextMenu {\n    #! TODO https://www.tenforums.com/tutorials/69524-add-remove-drives-send-context-menu-windows-10-a.html\n    param(\n        [ValidateSet(\n            'SendTo',\n            'TakeOwnership',\n            'OpenWithOnBatchFiles',\n            'DrivesInSendTo',\n            'TakeOwnership'\n            )]\n        [Array]$Entries\n    )\n    if (!(Test-Admin)){\n        return 'Changing the context menu / default file extensions requires running as Admin, exitting..'\n\n    }\n\n    if ('SendTo' -in $Entries){\n        New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\\AllFilesystemObjects\\shellex\\ContextMenuHandlers\\SendTo -Name \"(default)\" -PropertyType String -Value \"{7BA4C740-9E81-11CF-99D3-00AA004AE837}\" -Force\n    }\n\n    if ('DrivesInSendTo' -in $Entries){\n        Set-ItemProperty \"Registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -Name NoDrivesInSendToMenu -Value 0\n    }\n\n\n    if ('OpenWithOnBatchFiles' -in $Entries){\n        New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\batfile\\shell\\Open with\\command\" -Force\n        New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\cmdfile\\shell\\Open with\\command\" -Force\n        Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\batfile\\shell\\Open with\\command\" -Name \"(Default)\" -Value \"{09799AFB-AD67-11d1-ABCD-00C04FC30936}\" -Force\n        Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\batfile\\shell\\Open with\\command\" -Name \"(Default)\" -Value \"{09799AFB-AD67-11d1-ABCD-00C04FC30936}\" -Force\n\n    }\n\n    if ('TakeOwnership' -in $Entries){\n        '*','Directory' | ForEach-Object {\n            New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\"\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name '(Default)' -Value 'Take Ownership'\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'NoWorkingDirectory' -Value ''\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'HasLUAShield' -Value ''\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'Position' -Value 'Middle'\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\" -Name 'AppliesTo' -Value \"NOT (System.ItemPathDisplay:=`\"$env:HOMEDRIVE\\`\")\"\n\n            New-Item -Path \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\\command\"\n            $Command = 'cmd.exe /c title Taking ownership.. & mode con:lines=30 cols=150 & takeown /f \"%1\" && icacls \"%1\" /grant administrators:F & timeout 2 >nul'\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\\command\" -Name '(Default)' -Value $Command\n            New-ItemProperty -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\runas\\command\" -Name 'IsolatedCommand' -Value $Command\n\n        }\n    }\n\n}"
  },
  {
    "path": "modules/Block-RazerSynapse.ps1",
    "content": "function Block-RazerSynapse {\n    Try {\n        Remove-Item \"C:\\Windows\\Installer\\Razer\" -Force -Recurse\n    } Catch {\n        \"Failed to remove Razer installer folder\"\n        $_.Exception.Message\n    }\n    New-Item -ItemType File -Path \"C:\\Windows\\Installer\\Razer\" -Force -ErrorAction Stop\n    Write-Host \"An empty file called 'Razer' in C:\\Windows\\Installer has been put to block Razer Synapse's auto installation\"\n}"
  },
  {
    "path": "modules/Check-XMP.ps1",
    "content": "function Check-XMP {\n    Write-Host \"Checking RAM..\" -NoNewline\n    $PhysicalMemory = Get-CimInstance -ClassName Win32_PhysicalMemory\n    $RamSpeed = $PhysicalMemory.Speed | Select-Object -First 1 # In MHz\n    $IsDesktop = $null -eq (Get-CimInstance -ClassName Win32_Battery) # No battery = not a laptop (in some very rare cases that may fail but whatever it's accurate enough)\n    $IsDDR4 = ($PhysicalMemory.SMBIOSMemoryType | Select-Object -First 1) -eq 26 # DDR4 = 26, DDR3 = 24\n    switch((Get-CimInstance -ClassName CIM_Processor).Manufacturer){\n        {$PSItem -Like \"*AMD*\" -or $PSItem -Like \"*Advanced Micro*\"}{$RamOCType = 'DOCP'}\n        default{$RamOCType = 'XMP'} # Whatever else it is, it's preferably XMP\n    }\n    if (($RamSpeed -eq 2133) -and $IsDesktop -and $IsDDR4){\n        Write-Output @\"\n`rYour RAM is running at the default DDR4 RAM speed of 2133 MHz.\nCheck if your RAM allows running at a higher speed, and if yes, turn on $RamOCType in the BIOS\n\"@\n    }else{\n        Write-Output \"`rCould not determine the need for XMP/DOCP\"\n    }\n    if ($RamSpeed){\"- Your RAM speed is $RamSpeed MHz\"}\n    if ($null -ne $IsDesktop){\"- You're on a desktop: $IsDesktop\"}\n    if ($null -ne $IsDDR4){\"- Your RAM is DDR4: $IsDDR4\"}\n}\n\n"
  },
  {
    "path": "modules/Combos/CB-CleanTaskbar.ps1",
    "content": "function CB-CleanTaskbar {\n\tif (-Not(Get-Module -Name \"Sophia Script (TL)\" -Ea 0)){\n\t\tImport-Sophia\n\t}\n\tCortanaButton -Hide\n\tPeopleTaskbar -Hide\n\tTaskBarSearch -Hide\n\tTaskViewButton -Hide\n\tUnpinTaskbarShortcuts Edge, Store, Mail\n\n\t# Remove \"Meet now\" from the taskbar, s/o privacy.sexy\n\tSet-ItemProperty -Path \"Registry::HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -Name \"HideSCAMeetNow\" -Value 1\n}"
  },
  {
    "path": "modules/Game & Program tuners/Optimize-Bedrock.ps1",
    "content": "function Optimize-Bedrock {\n    [alias('optmcbe')]\n    [CmdletBinding()]\n    param(\n        [ValidateScript({\n                Test-Path $_ -PathType Leaf\n            })]\n        [String]$options = \"$env:localappdata\\Packages\\Microsoft.MinecraftUWP_8wekyb3d8bbwe\\LocalState\\games\\com.mojang\\minecraftpe\\options.txt\",\n\n\n        [ValidateSet('Low', 'High', 'ashanksupercool')]\n        $Preset = \"High\",\n\n        $Presets = @{\n\n            High = @{\n                gfx_viewdistance           = 256\n                gfx_particleviewdistance   = 1\n                gfx_viewbobbing            = 1\n                gfx_fancygraphics          = 1\n                gfx_transparentleaves      = 1\n                gfx_smoothlighting         = 1\n                gfx_fancyskies             = 1\n                gfx_msaa                   = 4\n                gfx_texel_aa_2             = 0\n                gfx_multithreaded_renderer = 1\n                gfx_vsync                  = 0\n            } \n        \n            Low = @{\n                gfx_viewdistance           = 160\n                gfx_particleviewdistance   = 0\n                gfx_viewbobbing            = 0\n                gfx_fancygraphics          = 0\n                gfx_transparentleaves      = 0\n                gfx_smoothlighting         = 0\n                gfx_fancyskies             = 0\n                gfx_msaa                   = 1\n                gfx_texel_aa_2             = 0\n                gfx_multithreaded_renderer = 1\n                gfx_vsync                  = 0\n            }\n            ashanksupercool = @{\n                gfx_viewdistance                                 = 256\n                gfx_particleviewdistance                         = 1\n                gfx_viewbobbing                                  = 1\n                gfx_fancygraphics                                = 0\n                gfx_transparentleaves                            = 1\n                gfx_vr_transparentleaves                         = 0\n                gfx_smoothlighting                               = 1\n                gfx_vr_smoothlighting                            = 0\n                gfx_fancyskies                                   = 0\n                gfx_field_of_view                                = 81.2\n                gfx_msaa                                         = 1\n                gfx_gamma                                        = 1\n                gfx_multithreaded_renderer                       = 1\n                gfx_vsync                                        = 0\n                dev_file_watcher                                 = 1\n                audio_music                                      = 0\n                gfx_hidepaperdoll                                = 1\n                dev_enable_texture_hot_reloader                  = 1\n                do_not_show_multiplayer_online_safety_warning    = 1\n                only_show_trusted_skins                          = 0\n                camera_shake                                     = 0\n                gfx_resizableui                                  = 0\n                gfx_hotbarScale                                  = 1\n                'keyboard_type_0_key.pickItem'                   = 75\n                'keyboard_type_0_key.hotbar.1'                   = 49\n                'keyboard_type_0_key.hotbar.2'                   = 50\n                'keyboard_type_0_key.hotbar.3'                   = 51\n                'keyboard_type_0_key.hotbar.4'                   = 52\n                'keyboard_type_0_key.hotbar.5'                   = 82\n                'keyboard_type_0_key.hotbar.6'                   = 70\n                'keyboard_type_0_key.hotbar.7'                   = 86\n                'keyboard_type_0_key.hotbar.8'                   = 90\n                'keyboard_type_0_key.hotbar.9'                   = '- 97'\n                'keyboard_type_0_key.inventory'                  = 69\n                'keyboard_type_0_key.togglePerspective'          = 53\n                'keyboard_type_0_key.jump'                       = 32\n                'keyboard_type_0_key.sneak'                      = 16\n                'keyboard_type_0_key.sprint'                     = 17\n                'keyboard_type_0_key.left'                       = 65\n                'keyboard_type_0_key.right'                      = 68\n                'keyboard_type_0_key.back'                       = 83\n                'keyboard_type_0_key.forward'                    = 87\n                'keyboard_type_0_key.mobEffects'                 = 88\n                'keyboard_type_0_key.chat'                       = 13\n                'keyboard_type_0_key.emote'                      = 0\n            }\n        }\n    )\n\n    Write-Host \"Optimize Minecraft bedrock with $Preset\"\n\n    $optionsTable = (Get-Content $options) -Replace ':', '=' | ConvertFrom-StringData\n    Write-Verbose ($optionsTable | ConvertTo-Json -Depth 3)\n\n    $optionsTable = Merge-Hashtables -Original $optionsTable -Patch $Presets.$Preset\n    Write-Verbose ($optionsTable | ConvertTo-Json -Depth 3)\n    \n    Set-Content $options -Value (ConvertTo-MCSetting $optionsTable) -Force\n}\n"
  },
  {
    "path": "modules/Game & Program tuners/Optimize-LunarClient.ps1",
    "content": "function Optimize-LunarClient {\n    <#\n    .SYNOPSIS\n    Display Name: Optimize Lunar Client\n    Platform: Linux; Windows\n    Category: Optimizations\n    Depends: Write-Diff; Merge-HashTables\n\n    .DESCRIPTION\n    Tunes a selected Lunar Client profile to your liking, it has some good defaults everyone should have (no numbers in scoreboard, modern keybind handling, no achievements, transparent texture packs section, borderless fullscreen..)\n\n    .PARAMETER Settings\n    Specify which specific tweak you'd like applying on your profile\n    Performance: Turn off performance-hungry settings\n    NoCosmetics: Disable all emotes, cosmetics, wings, hats..\n    MinimalViewBobbing: Keep item movement but disable walk bobbing\n    No16xSaturationOverlay: Remove the yellow 16x hunger bar overlay\n    HideToggleSprint: Hides the ToggleSprint status from HUD\n    ToggleSneak: Turns on ToggleSneak\n    DisableUHCMods: Disables ArmorHUD, DirectionHUD and Coordinates mods\n    FullBright: literally night vision    \n    #>\n    [alias('optlc')]\n    param(\n\n        #//[HelpMessage(\"Set your lazy chunk load speed\")]\n        [ValidateSet(\n            'highest',  \n            'high',     \n            'medium',   \n            'low',      \n            'lowest',   \n            'off_van'   \n            )]\n        [String]$LazyChunkLoadSpeed = 'low',\n\n        [ValidateSet(\n            'Performance',\n            'NoCosmetics',\n            'MinimalViewBobbing',\n            'No16xSaturationOverlay',\n            'HideToggleSprint',\n            'ToggleSneak',\n            'DisableUHCMods',\n            'FullBright',\n            'CouleursPreset'    \n        )]\n        #// Gotta be put twice because mf cant handle variables in validate sets\n        [Array]$Settings = (Invoke-Checkbox -Title \"Select tweaks to apply\" -Items @(\n            'Performance'\n            'NoCosmetics'\n            'MinimalViewBobbing'\n            'No16xSaturationOverlay'\n            'HideToggleSprint'\n            'ToggleSneak'\n            'DisableUHCMods'\n            'FullBright'\n            'CouleursPreset'\n        )),\n       \n        [String]\n        $LCDirectory = \"$HOME\\.lunarclient\",\n\n        [Switch]$NoBetaWarning,\n        [Switch]$KeepLCOpen,\n        [Switch]$DryRun\n\n        #//TODO: [Array]$Misc HideFoliage, NoEntityShadow, LCNametags, Clearglass, NoBackground, NoHypixelMods\n    )\n    \n    if (-Not(Test-Path $LCDirectory)){\n        Write-Host \"Lunar Client's directory ($HOME\\.lunarclient) does not exist (for the turbonerds reading this you can overwrite that with -LCDirectory\"\n    }\n    if (!$NoBetaWarning){\n        Write-Warning \"This script may corrupt your Lunar Client profiles, continue at your own risk,`nyou're probably safer if you copy the folder located at $(Convert-Path $HOME\\.lunarclient\\settings\\game)\"\n        pause\n    }\n    if (!$KeepLCOpen){\n        while ((Get-Process -Name java?).MainWindowTitle -Like \"Lunar Client*\"){\n            Write-Host \"You must quit Lunar Client before running these optimizations (LC will overwrite them when it exits)\" -ForegroundColor Red\n            pause\n        }\n    }else{\n        Write-Warning \"You disabled the script from not running if Lunar Client is running, here be dragons!\"\n        Start-Sleep -Milliseconds 500\n    }\n\n    if (!$LazyChunkLoadSpeed -and ('Performance' -in $Settings)){$LazyChunkLoadSpeed = 'low'}\n\n    $Manager = Get-Content \"$LCDirectory\\settings\\game\\profile_manager.json\" -ErrorAction Stop | ConvertFrom-Json\n    \n    $Profiles = @{}\n    ForEach($Profile in $Manager){\n        $Profiles += @{ \"$($Profile.DisplayName) ($($Profile.Name))\" = $Profile}\n    }\n\n    Write-Host \"Select a profile:\"\n    $Selection = Menu @([Array[]]'Create a new profile' + [Array[]]$Profiles.Keys)\n    if ($Selection -in $Manager.name,$Manager.DisplayName){\n        if ($VerbosePreference -eq 'Continue'){\n            Write-Host \"Error, Manager:`n`n\" -ForegroundColor Red\n            Write-Host ($Manager | ConvertTo-Json)\n            return\n            \n        }\n        return \"A profile with the same name already exists!\"\n    }\n\n    if ($Selection -eq 'Create a new profile'){\n        \n        $ProfileName = Read-Host \"Enter a name for the new profile\"\n        New-Item -ItemType Directory -Path \"$LCDirectory\\settings\\game\\$ProfileName\" -ErrorAction Stop | Out-Null\n        Push-Location \"$LCDirectory\\settings\\game\\$ProfileName\"\n        ('general.json', 'mods.json', 'performance.json') | ForEach-Object {\n            if (-Not(Test-Path ./$_)){Add-Content ./$_ -Value '{}'} # Empty json file \n        }\n        Pop-Location\n        $Selection = [PSCustomObject]@{\n\n            name = $ProfileName\n            displayName = $ProfileName\n            active = $False\n            default = $False\n            iconName = 'crossed-swords'\n            server = ''\n        }\n        $Manager += $Selection # Overwriting the string \"Create a new profile\" with the fresh one\n        Set-Content -Path \"$LCDirectory\\settings\\game\\profile_manager.json\" -Value ($Manager | ConvertTo-Json -Compress -Depth 99)\n    }else{\n        $Selection = $Profiles.$Selection\n    }\n\n    $ProfileDir = \"$LCDirectory\\settings\\game\\$($Selection.name)\"\n    ForEach($file in 'general','mods','performance'){ # Assigns $general, $mods and $performance variables\n        Set-Variable -Scope Global -Name $file -Value (Get-Content \"$ProfileDir\\$file.json\" -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop)\n        if ($DryRun){\n        Write-Host $file -ForegroundColor Red\n        (Get-Variable -Name $file).Value | ConvertTo-Json\n        }\n    }\n    \n    $Presets = @{\n        All = @{\n            general = @{\n                shift_effects_bl         = $false\n                achievements_bl\t         = $false\n                compact_menu_bl          = $true\n                modernKeybindHandling_bl = $true\n                borderless_fullscreen_bl = $true\n                trans_res_pack_menu_bg_bl = $true\n            }\n            mods = @{\n                chat = @{\n                    options = @{\n                        chat_bg_opacity_nr = \"0.0\"\n                    }\n                }\n                scoreboard = @{\n                    options = @{\n                        numbers_bl = $true\n                    }\n                }\n            }\n        }\n        CouleursPreset = @{\n            mods = @{\n                scoreboard = @{\n                    seen = $True\n                    x = 2 # Moves scoreboard 2 pixels to the right\n                }\n                potioneffects = @{\n                    seen = $True\n                    position = 'bottom_left'\n                    y = -246.5 # Middle left\n                }\n                saturation_hud_mod = @{\n                    seen = $True\n                    saturation_hud_mod_enabled_bl = $True\n                    position     = 'bottom_right' # Just right to the last hunger bar\n                    x            = -289\n                    y            = -37\n                    options = @{\n                        scale_nr          = 1.5 # Yellow\n                        text_clr_nr       = @{value=-171}\n                        background_clr_nr = @{value=0}\n                    }\n                }\n                zoom = @{\n                    seen = $True\n                    options = @{\n                        zoom_kblc         = 'KEY_X'\n                    }\n                }\n                bossbar = @{\n                    seen = $True\n                    bossbar_enabled_bl = $False\n                }\n            }\n        }\n        Performance = @{\n            general = @{\n                friend_online_status_bl\t= $false\n            }\n            performance = @{\n                lazy_chunk_loading\t= $LazyChunkLoadSpeed\n                ground_arrows_bl    = $false\n                stuck_arrows_bl     = $false\n                hide_skulls_bl      = $true\n                hide_foliage_bl     = $true\n            }\n        }\n        NoCosmetics = @{\n            general = @{\n                renderClothCloaks_bl         = $false\n                render_cosmetic_particles_bl = $false\n                backpack_bl                  = $false\n                dragon_wings_bl              = $false\n                pet_bl                       = $false\n                glasses_bl                   = $false\n                bandanna_bl                  = $false\n                mask_bl                      = $false\n                belts_bl                     = $false\n                neckwear_bl                  = $false\n                bodywear_bl                  = $false\n                hat_bl                       = $false\n                render_emotes_bl             = $false\n                render_emote_particles_bl    = $false\n                cloak_bl                     = $false\n                show_hat_above_helmet_bl     = $false\n                show_over_chestplate_bl      = $false\n                show_over_leggings_bl        = $false\n                show_over_boots_bl           = $false\n                scale_hat_with_skinlayer_bl  = $false\n            }\n        }\n        MinimalViewBobbing = @{\n            general = @{\n                minimal_viewbobbing_bl = $true\n            }\n        }\n        No16xSaturationOverlay = @{\n            mods = @{\n                saturation_mod = @{\n                    options = @{\n                        show_saturation_overlay_bl=$False\n                    }\n                }\n            }\n        }\n        HideToggleSprint = @{\n            mods = @{\n                toggleSneak = @{\n                     options = @{\n                         showHudText_bl = $false\n                     }\n                }\n            }\n        }\n        ToggleSneak = @{\n            mods = @{\n                toggleSneak = @{\n                    options = @{\n                        toggle_sneak_bl = $true\n                    }\n                }\n            }\n        }\n        DisableUHCMods = @{\n            mods = @{\n                waypoints = @{\n                    waypoints_enabled_bl = $false\n                }\n                directionhud = @{\n\t                directionhud_enabled_bl = $false\n                }\n                coords = @{\n\t                coords_enabled_bl = $false\n                }                \n                armorstatus = @{\n\t                armorstatus_enabled_bl = $false\n                }\n            }\n        }\n        FullBright = @{\n            mods = @{\n                lighting = @{\n                    lighting_enabled_bl = $true\n                    options = @{\n                        full_bright_bl\t= $true\n                    } \n                }\n            }\n        }\n\n    }\n        # Whatever you do that's highly recommended :+1:\n    $general = Merge-Hashtables -Original $general -Patch $Presets.All.general\n    $mods = Merge-Hashtables -Original $mods -Patch $Presets.All.mods\n    Write-Diff \"recommended settings (compact mods, fast chat)..\" -Positivity $True -Term \"Setting up\"\n\n    if ('Performance' -in $Settings){\n        $general = Merge-Hashtables -Original $general -Patch $Presets.Performance.general\n        $performance = Merge-Hashtables -Original $performance -Patch $Presets.Performance.performance\n        Write-Diff -Message \"notifications from LC friends getting on (causes massive FPS drop)\"\n        Write-Diff -Positivity $True -Message \"lazy chunk loading at speed $LazyChunkLoadSpeed\"\n        Write-Diff -Message \"ground arrows\"\n        Write-Diff -Message \"player/mob skulls\"\n        Write-Diff -Message \"foliage (normal/tall grass)\"\n    }\n    if ('NoCosmetics' -in $Settings){\n        $general = Merge-Hashtables -Original $general -Patch $Presets.NoCosmetics.general\n        ForEach($CosmeticRemoved in @(\n            \"cloth cloaks\" \n            \"cosmetic particles\" \n            \"backpacks\" \n            \"pets\"\n            \"dragon wings\"\n            \"bandannas\"\n            \"masks\"\n            \"belts\"\n            \"neckwears\"\n            \"bodywears\"\n            \"hats\"\n            \"emotes rendering\"\n            \"emote particles rendering\"\n            \"cloaks\"\n        )){\n            Write-Diff -Message $CosmeticRemoved -Term \"Disabled\"\n        }\n\n    }\n    if ('MinimalViewBobbing' -in $Settings){\n        $general = Merge-Hashtables -Original $general -Patch $Presets.MinimalViewBobbing.general\n        Write-Diff -Positivity $True -Message \"minimal view bobbing\"\n    }\n    if ('No16xSaturationOverlay' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.No16xSaturationOverlay.mods\n        Write-Diff -Positivity $False -Message \"16x saturation hunger bar overlay\"\n    }\n    if ('HideToggleSprint' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.HideToggleSprint.mods\n        Write-Diff -Positivity $False -Term \"Hid\" -Message \"ToggleSprint HUD\"\n    }\n    if ('ToggleSneak' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods $Presets.ToggleSneak.mods\n        Write-Diff -Positivity $True -Message \"ToggleSneak\"\n    }\n    if ('DisableUHCMods' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.DisableUHCMods.mods\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"Waypoints mod\"\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"DirectionHUD mod\"\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"Coordinates mod\"\n        Write-Diff -Positivity $False -Term \"Disabled\" -Message \"ArmorStatus mod\"\n    }\n    if ('FullBright' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.FullBright.mods\n        Write-Diff -Term \"Added\" -Positivity $true -Message \"Fullbright (disable shaders before restarting)\"\n    }\n    if ('CouleursPreset' -in $Settings){\n        $mods = Merge-Hashtables -Original $mods -Patch $Presets.CouleursPreset.mods\n    }\n\n    ForEach($file in 'general','mods','performance'){ # Assigns $general, $mods and $performance variables\n        if ($DryRun){\n            Write-Host $file -ForegroundColor Red\n            (Get-Variable -Name $file).Value\n        }else{\n            ConvertTo-Json -Depth 99 -Compress -InputObject (Get-Variable -Name $file).Value -ErrorAction Stop | Set-Content \"$ProfileDir\\$file.json\" -ErrorAction Stop\n        }\n    }\n\n}"
  },
  {
    "path": "modules/Game & Program tuners/Optimize-OBS.ps1",
    "content": "function Optimize-OBS {\n    <#\n    .SYNOPSIS\n    Display Name: Optimize OBS\n    Platform: Linux; Windows\n    Category: Optimizations\n\n    .DESCRIPTION\n    Tune your OBS for a specific usecase in the snap of a finger!\n\n    .PARAMETER Encoder\n    Which hardware type you wish to record with\n    NVENC: NVIDIA's Fastest encoder, it lets you record in hundreds of FPS easily\n    AMF: AMD GPUs/Integrated GPUs encoder, not as good as NVENC but can still get out ~240FPS at most\n    QuickSync: Intel's GPU encoder, worst out of the three, note this is H264, not the new fancy but slow AV1\n    x264: Encoding using your CPU, slow but efficient, only use if necessary/you know what you're doing\n\n    .PARAMETER OBS64Path\n    If you've got a portable install or something, pass in the main OBS binary's path here\n\n    #>\n    [alias('optobs')]\n    param(\n        [ValidateSet('x264','NVENC','AMF','QuickSync')]\n        [String]$Encoder,\n        \n        [ValidateScript({Test-Path -Path $_ -PathType Leaf})]\n        [String]$OBS64Path,\n\n        [ValidateSet('HighPerformance')]\n        [String]$Preset = 'HighPerformance',\n\n        [ValidateSet(\n            'EnableStatsDock', 'OldDarkTheme','CouleursHotkeys')]\n        [Array]$MiscTweaks = (Invoke-CheckBox -Title \"Select misc tweaks to apply\" -Items (\n            'EnableStatsDock', 'OldDarkTheme','CouleursHotkeys')),\n\n        [ValidateScript({ Test-Path -Path $_ -PathType Container })]\n        [String]$OBSProfile = $null\n\n    )\n\n    if (!$Encoder){\n        $Encoders = [Ordered]@{\n            \"NVENC (NVIDIA GPUs)\" = \"NVENC\"\n            \"AMF (AMD GPUs)\" = \"AMF\"\n            \"QuickSync (Intel iGPUs)\" = \"QuickSync\"\n            \"x264 (CPU)\" = \"x264\"\n        }\n        Write-Host \"Select what OBS will use to record (use arrow keys and press ENTER to confirm)\"\n        $Key = Menu ([Collections.ArrayList]$Encoders.Keys)\n        $Encoder = $Encoders.$Key\n    }\n\n    $OBSPatches = @{\n        HighPerformance = @{\n            NVENC = @{\n                basic = @{\n                    AdvOut = @{\n                        RecEncoder = 'obs_nvenc_h264_tex'\n                    }\n                }\n                recordEncoder = @{\n                    bf=0\n                    cqp=18\n                    multipass='disabled'\n                    preset='p2'\n                    profile='main'\n                    psycho_aq='false'\n                    rate_control='CQP'\n                    lookahead= 'false'\n                    adaptive_quantization= 'false'\n                }\n            }\n            AMF = @{\n                Basic = @{\n                    ADVOut = @{\n                        RecQuality='Small'\n                        RecEncoder='h265_texture_amf'\n                        FFOutputToFile='true'\n                    }\n                }\n                recordEncoder = @{\n                    'cqp' = 20\n                    preset = 'speed'\n                    rate_control = 'CQP'\n                    ffmpeg_opts = \"MaxNumRefFrames=4 HighMotionQualityBoostEnable=1\"\n                }\n            }\n            QuickSync = @{\n\n                basic = @{\n                    AdvOut = @{\n                        RecEncoder = 'obs_qsv11'\n                    }\n                }\n                recordEncoder = @{\n                    enhancements = 'false'\n                    target_usage = 'speed'\n                    bframes = 0\n                    rate_control = 'ICQ'\n                    bitrate = 16500\n                    icq_quality = 18\n                    keyint_sec = 2\n                }\n                \n            }\n            x264 = @{\n                basic = @{\n                    ADVOut = @{\n                        RecEncoder='obs_x264'\n                    }\n                }\n                recordEncoder = @{\n                    crf=1\n                    keyint_sec=1\n                    preset='ultrafast'\n                    profile='high'\n                    rate_control='CRF'\n                    x264opts='qpmin=15 qpmax=15 ref=0 merange=4 direct=none weightp=0 no-chroma-me'\n                }\n            }\n        }\n    }\n\n    # Applies to all patches/presets\n    $Global = @{\n        basic = @{\n            Output = @{\n                RecType='Standard'\n                Mode='Advanced'\n            }\n            AdvOut = @{\n                RecRB='true'\n            }\n        }\n    }\n    $OBSPatches.$Preset.$Encoder = Merge-Hashtables $OBSPatches.$Preset.$Encoder $Global\n        # Merge with global, which will be added for all\n\n    if (!$OBSProfile){\n        Remove-Variable -Name OBSProfile\n        if (-Not($OBS64Path)){\n\n            $Parameters = @{\n                Path = @(\"$env:APPDATA\\Microsoft\\Windows\\Start Menu\",\"$env:ProgramData\\Microsoft\\Windows\\Start Menu\")\n                Recurse = $True\n                Include = 'OBS Studio*.lnk'\n            }\n            $StartMenu = Get-ChildItem @Parameters\n            \n            if (!$StartMenu){\n                if ((Get-Process obs64 -ErrorAction Ignore).Path){$OBS64Path = (Get-Process obs64).Path} # Won't work if OBS is ran as Admin\n                else{\n    return @'\nYour OBS installation could not be found, \nplease manually specify the path to your OBS64 executable, example:\n\nOptimize-OBS -OBS64Path \"D:\\obs\\bin\\64bit\\obs64.exe\"\n\nYou can find it this way:             \nSearch OBS -> Right click it\nOpen file location in Explorer ->\nOpen file location again if it's a shortcut ->\nShift right click obs64.exe -> Copy as path\n'@\n                }\n            }\n            if ($StartMenu.Count -gt 1){\n\n                $Shortcuts = $null\n                $StartMenu = Get-Item $StartMenu\n                ForEach($Lnk in $StartMenu){$Shortcuts += @{$Lnk.BaseName = $Lnk.FullName}}\n                \"There are multiple OBS shortcuts in your Start Menu folder. Please select one.\"\n                $ShortcutName = menu ($Shortcuts.Keys -Split [System.Environment]::NewLine)\n                $StartMenu = $Shortcuts.$ShortcutName\n                $OBS64Path = Get-ShortcutTarget $StartMenu\n            }else{\n                $OBS64Path = Get-ShortcutTarget $StartMenu\n            }\n\n        }\n\n        if (!$IsLinux -or !$IsMacOS){\n            [Version]$CurVer = (Get-Item $OBS64Path).VersionInfo.ProductVersion\n            if ($CurVer -lt [Version]\"28.1.0\"){\n                Write-Warning @\"\nIt is strongly advised you update OBS before continuing (for compatibility with new NVENC/AMD settings)\n\nDetected version: $CurVer\nobs64.exe path: $OBS64Path\npause\n\"@\n            }\n        }\n\n        Set-CompatibilitySettings $OBS64Path -RunAsAdmin\n\n        if (Resolve-Path \"$OBS64Path\\..\\..\\..\\portable_mode.txt\" -ErrorAction Ignore){ # \"Portable Mode\" makes OBS make the config in it's own folder, else it's in appdata\n\n            $ProfilesDir = (Resolve-Path \"$OBS64Path\\..\\..\\..\\config\\obs-studio\\basic\\profiles\" -ErrorAction Stop)\n        }else{\n            $ProfilesDir = (Resolve-Path \"$env:APPDATA\\obs-studio\\basic\\profiles\" -ErrorAction Stop)\n        }\n        $Profiles = Get-ChildItem $ProfilesDir\n\n        ForEach($OBSProfile in $Profiles){$ProfilesHash += @{$OBSProfile.Name = $OBSProfile.FullName}}\n\n        $ProfileNames = ($ProfilesHash.Keys -Split [System.Environment]::NewLine) + 'Create a new profile'\n        \"Please select a profile (use arrow keys to navigate, ENTER to select)\"\n        $OBSProfile = menu  $ProfileNames\n\n        if ($OBSProfile -eq 'Create a new profile'){\n            $NewProfileName = Read-Host \"Enter a name for the new profile\"\n            $OBSProfile = Join-Path $ProfilesDir $NewProfileName\n            New-Item -ItemType Directory -Path $OBSProfile -ErrorAction Stop\n            $DefaultWidth, $DefaultHeight = ((Get-CimInstance Win32_VideoController).VideoModeDescription.Split(' x ') | Where-Object {$_ -ne ''} | Select-Object -First 2)\n            if (!$DefaultWidth -or !$DefaultHeight){\n                $DefaultWidth = 1920\n                $DefaultHeight = 1080\n            }\n            Set-Content \"$OBSProfile\\basic.ini\" -Value @\"\n[General]\nName=$NewProfileName\n\n[Video]\nBaseCX=$DefaultWidth\nBaseCY=$DefaultHeight\nOutputCX=$DefaultWidth\nOutputCY=$DefaultHeight\n\"@\n            Write-Host \"Created new profile '$NewProfileName' with default resolution of $DefaultWidth`x$DefaultHeight\" -ForegroundColor DarkGray\n        }else{\n            $OBSProfile = $ProfilesHash.$OBSProfile\n        }\n    }\n    if ('basic.ini' -notin ((Get-ChildItem $OBSProfile).Name)){\n       return \"FATAL: Profile $OBSProfile is incomplete (missing basic.ini)\"\n    }\n    Write-Verbose \"Tweaking profile $OBSProfile\"\n    try {\n        $Basic = Get-IniContent \"$OBSProfile\\basic.ini\" -ErrorAction Stop\n    } catch {\n        Write-Warning \"Failed to get basic.ini from profile folder $OBSProfile\"\n        $_\n        return\n    }\n    if ($Basic.Video.FPSType -ne 2){ # then switch to fractional FPS\n        $FPS=$Basic.Video.FPSCommon\n        $Basic.Video.FPSType = 2\n        $Basic.Video.FPSNum = 60\n        $Basic.Video.FPSDen = 1\n\n        Write-Warning \"Your FPS is at the default (60), you can go in Settings -> Video to set it to a higher value\"\n    }\n\n    $FPS = $Basic.Video.FPSNum/$Basic.Video.FPSDen\n    $Pixels = [int]$Basic.Video.BaseCX*[int]$Basic.Video.BaseCY\n\n    if (($Basic.AdvOut.RecTracks -NotIn '1','2') -And ($FPS -gt 120)){\n        Write-Warning \"Using multiple audio tracks while recording at a high FPS may cause OBS to fail to stop recording\"\n    }\n\n    if (!$Basic.Hotkeys.ReplayBuffer){\n        Write-Warning \"Replay Buffer is enabled, but there's no hotkey to Save Replay, set it up in Settings -> Hotkeys\"\n    }\n\n    $Basic = Merge-Hashtables -Original $Basic -Patch $OBSPatches.$Preset.$Encoder.basic -ErrorAction Stop\n    Out-IniFile -FilePath \"$OBSProfile\\basic.ini\" -InputObject $Basic -Pretty -Force\n\n    if ($Basic.Video.BaseCX -and $Basic.Video.BaseCY -and $Basic.Video.OutputCX -and $Basic.Video.OutputCY){\n\n        $Base = \"{0}x{1}\" -f $Basic.Video.BaseCX,$Basic.Video.BaseCY\n        $Output = \"{0}x{1}\" -f $Basic.Video.OutputCX,$Basic.Video.OutputCY\n        if ($Base -Ne $Output){\n            Write-Warning \"Your Base/Canvas resolution ($Base) is not the same as the Output/Scaled resolution ($Output),`nthis means OBS is scaling your video. This is not recommended.\"\n        }    \n    }\n    \n    $NoEncSettings = -Not(Test-Path \"$OBSProfile\\recordEncoder.json\")\n    $EmptyEncSettings = (Get-Content \"$OBSProfile\\recordEncoder.json\" -ErrorAction Ignore) -in '',$null\n\n    if ($NoEncSettings -or $EmptyEncSettings){\n        Set-Content -Path \"$OBSProfile\\recordEncoder.json\" -Value '{}' -Force \n    }\n    $RecordEncoder = Get-Content \"$OBSProfile\\recordEncoder.json\" | ConvertFrom-Json -ErrorAction Stop\n\n    if (($Basic.Video.FPSNum/$Basic.Video.FPSDen -gt 480) -And ($Pixels -ge 2073600)){ # Set profile to baseline if recording at a high FPS and if res +> 2MP\n        $RecordEncoder.Profile = 'baseline'\n    }\n    $RecordEncoder = Merge-Hashtables -Original $RecordEncoder -Patch $OBSPatches.$Preset.$Encoder.recordEncoder -ErrorAction Stop\n    if ($Verbose){\n        ConvertTo-Yaml $Basic\n        ConvertTo-Yaml $RecordEncoder    \n    }\n    Set-Content -Path \"$OBSProfile\\recordEncoder.json\" -Value (ConvertTo-Json -InputObject $RecordEncoder -Depth 100) -Force\n\n    if ($True -in [bool]$MiscTweaks){ # If there is anything in $MiscTweaks\n        $global = Get-Item (Join-Path ($OBSProfile | Split-Path | Split-Path | Split-Path) -ChildPath 'global.ini') -ErrorAction Stop\n        $glob = Get-IniContent -FilePath $global\n\n        if ('OldDarkTheme' -in $MiscTweaks){\n            $glob.General.CurrentTheme3 = 'Dark'\n        }\n\n        if ('CouleursHotkeys' -in $MiscTweaks){\n            if (!$glob.Hotkeys){$glob.Hotkeys = @{}}\n            $glob.Hotkeys.'OBSBasic.EnablePreview'  = '{\"bindings\":[{\"control\":true,\"key\":\"OBS_KEY_RETURN\"}]}'\n            $glob.Hotkeys.'OBSBasic.DisablePreview' = '{\"bindings\":[{\"control\":true,\"key\":\"OBS_KEY_RETURN\"}]}'\n            $glob.Hotkeys.'ReplayBuffer'            = '{\"ReplayBuffer.Save\":[{\"alt\":true,\"key\":\"OBS_KEY_NONE\",\"shift\":true}]}'\n            $glob.Hotkeys.'OBSBasic.ResetStats'     = '{\"bindings\":[{\"control\":true,\"key\":\"OBS_KEY_NONE\",\"shift\":true}]}'\n        }\n\n        if ('OldDarkTheme' -in $MiscTweaks){\n\n            $glob.BasicWindow.geometry = 'AdnQywADAAAAAAe/////uwAADJ0AAAKCAAAHv////9oAAAydAAACggAAAAEAAAAACgAAAAe/////2gAADJ0AAAKC'\n            $glob.BasicWindow.DockState = 'AAAA/wAAAAD9AAAAAgAAAAAAAAJOAAABvPwCAAAAAfsAAAASAHMAdABhAHQAcwBEAG8AYwBrAQAAABYAAAG8AAAA5gD///8AAAADAAAE3wAAALr8AQAAAAX7AAAAFABzAGMAZQBuAGUAcwBEAG8AYwBrAQAAAAAAAAD4AAAAoAD////7AAAAFgBzAG8AdQByAGMAZQBzAEQAbwBjAGsBAAAA/AAAAPoAAACgAP////sAAAASAG0AaQB4AGUAcgBEAG8AYwBrAQAAAfoAAAFBAAAA3gD////7AAAAHgB0AHIAYQBuAHMAaQB0AGkAbwBuAHMARABvAGMAawEAAAM/AAAAtAAAAI4A////+wAAABgAYwBvAG4AdAByAG8AbABzAEQAbwBjAGsBAAAD9wAAAOgAAACeAP///wAAAo0AAAG8AAAABAAAAAQAAAAIAAAACPwAAAAA'\n        }\n\n        $glob | Out-IniFile -FilePath $global -Force\n    }\n    Write-Host \"Finished patching OBS, yay! Please switch profiles or reload OBS to see changes\" -ForegroundColor Green\n    Write-Host \"You can find more information about OBS configuration at \" -ForegroundColor Green -NoNewline\n    Write-Host \"ctt.cx/obs\"\n}"
  },
  {
    "path": "modules/Game & Program tuners/Optimize-OptiFine.ps1",
    "content": "function Optimize-OptiFine {\n    [alias('optof')]\n    param(\n        [ValidateSet('Smart','Lowest','CouleursPreset')]\n        [Parameter(Mandatory)]\n        $Preset,\n        [String]$CustomDirectory = (Join-path $env:APPDATA '.minecraft'),\n        [Switch]$MultiMC,\n        [Switch]$PolyMC,\n        [Switch]$GDLauncher\n    )\n\nif($MultiMC){\n    $CustomDirectory = Get-ChildItem \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\" -Recurse | Where-Object Name -Like \"MultiMC.lnk\"\n    $CustomDirectory = Get-ShortcutPath $CustomDirectory\n    $Instances = Get-ChildItem (Join-Path (Split-Path $CustomDirectory) instances)\n    \"Please select a MultiMC instance\"\n    $CustomDirectory = menu (Get-ChildItem $Instances).Name\n    $CustomDirectory = Join-Path $Instances $CustomDirectory\n\n}elseif($PolyMC){\n    $Instances = Get-ChildItem \"$env:APPDATA\\PolyMC\\instances\"\n    \"Please select a PolyMC instance\"\n    $CustomDirectory = menu $Instances.Name\n    $CustomDirectory = Join-Path $Instances $CustomDirectory\n\n}elseif($GDLauncher){\n    $Instances = Get-ChildItem \"$env:APPDATA\\gdlauncher_next\\instances\"\n    \"Please select a GDLauncher instance\"\n    $CustomDirectory = menu $Instances.Name\n    $CustomDirectory = Join-Path $Instances $CustomDirectory\n\n}\n\n$Presets = @{\n\n    CouleursPresets = @{\n        options = @{\n            'key_key.hotbar.5' = 19\n            'key_key.hotbar.6' = 20\n            'key_key.hotbar.7' = 33\n            'key_key.hotbar.8' = 34\n            'key_key.hotbar.9' = 0\n            chatScale      = 0.8\n            chatWidth      = 0.65\n            guiScale       = 3\n            renderDistance = 7\n            maxFps         = 260\n            chatOpacity    = 0.25\n            enableVsync    = $False\n            pauseOnLostFocus = $False\n        }\n    }\n\n    Smart = @{\n        options = @{\n            renderDistance=5\n            mipmapLevels=4\n            ofAoLevel=1.0\n        }\n        optionsof = @{\n            ofMipmapType=3\n            ofCustomSky=$true\n        }\n    }\n\n    Lowest = @{\n        options = @{\n            gamma=1000000 # I've never tried anything else and this always worked\n            renderDistance=2\n            particles=2\n            fboEnable=$true\n            useVbo=$true\n            showInventoryAchievementHint=$false\n        }\n        optionsof = @{\n            ofAaLevel=0 # Anti-Aliasing\n            ofDynamicLights=3\n            ofChunkUpdates=1\n            ofAoLevel=0.0 # Smooth lighting\n            ofOcclusionFancy=$false\n            ofSmoothWorld=$true\n            ofClouds=3\n            ofTrees=1\n            ofDroppedItems=0\n            ofRain=3\n            ofAnimatedWater=2\n            ofAnimatedLava=2\n            ofAnimatedFire=$true\n            ofAnimatedPortal=$false\n            ofAnimatedRedstone=$false\n            ofAnimatedExplosion=$false\n            ofAnimatedFlame=$true\n            ofAnimatedSmoke=$false\n            ofVoidParticles=$false\n            ofWaterParticles=$false\n            ofPortalParticles=$false\n            ofPotionParticles=$false\n            ofFireworkParticles=$false\n            ofDrippingWaterLava=$false\n            ofAnimatedTerrain=$false\n            ofAnimatedTextures=$false\n            ofRainSplash=$false\n            ofSky=$false\n            ofStars=$false\n            ofSunMoon=$false\n            ofVignette=1\n            ofCustomSky=$false\n            ofShowCapes=$false\n            ofFastMath=$true\n            ofSmoothFps=$false\n            ofTranslucentBlocks=1\n        }\n    }\n}\n$Global = @{\n    optionsof = @{\n        ofFastRender=$true\n        ofClouds=3\n        ofAfLevel=1 # Anisotropic filtering\n        ofAaLevel=0 # Anti-aliasing\n        ofRainSplash=$false\n    }\n    options = @{\n        showInventoryAchievementHint=$false\n        maxFps=260\n        renderClouds=$false\n        useVbo=$true\n    }\n}\n$Presets.$Preset = Merge-Hashtables $Presets.$Preset $Global\n\nfunction ConvertTo-MCSetting ($table){\n\n    $file = @()\n    ForEach($setting in $table.keys){\n        $file += [String]$($setting + ':' + ($table.$setting)) -replace'True','true' -replace 'False','false'\n    }\n    return $file\n}\n\nforeach ($file in 'options','optionsof'){\n\n    $Hash = (Get-Content \"$CustomDirectory\\$file.txt\") -Replace ':','=' | ConvertFrom-StringData\n    $Hash = Merge-Hashtables -Original $Hash -Patch $Presets.$Preset.$file\n    Set-Content \"$CustomDirectory\\$file.txt\" -Value (ConvertTo-MCSetting $Hash) -Force\n}\nif (Test-Path \"$CustomDirectory\\optionsLC.txt\"){\n    $Hash = (Get-Content \"$CustomDirectory\\optionsLC.txt\") -Replace ',\"maxFps\":\"260\"','' | ConvertFrom-Json\n}\n$Hash = Merge-Hashtables -Original $Hash -Patch $Presets.$Preset.optionsof\n$Hash = Merge-Hashtables -Original $Hash -Patch $Presets.$Preset.options\n$Hash.maxFPS = 260\nSet-Content \"$CustomDirectory\\optionsLC.txt\" -Value (ConvertTo-Json $Hash) -Force\n\n}"
  },
  {
    "path": "modules/Import-Sophia.ps1",
    "content": "<#\n\t.SYNOPSIS\n\tScraps the latest version of Sophia edition weither you have W10/11/LTSC/PS7,\n\tchanges all function scopes to global and invokes it, as if it were importing it as a module\n\n\tYou can find farag's dobonhonkerosly big Sophia Script at https://github.com/farag2/Sophia-Script-for-Windows\n\tAnd if you'd like using it as a GUI, try out SophiApp:  https://github.com/Sophia-Community/SophiApp\n\t\n\tUsing the -Write parameter returns the script instead of piping it to Invoke-Expression\n\t.EXAMPLE\n\tImport-Sophia\n\t# Or for short:\n\tipso\n#>\nfunction Import-Sophia {\n\t[alias('ipso')]\n\t[CmdletBinding()]\n\tparam(\n\t\t[switch]\n        $Write,\n\n\t\t[string]\n        [ValidateSet(\n            'de-DE',\n            'en-US',\n            'es-ES',\n            'fr-FR',\n            'hu-HU',\n            'it-IT',\n            'pt-BR',\n            'ru-RU',\n            'tr-TR',\n            'uk-UA',\n            'zh-CN'\n        )]\n        $OverrideLang\n\t)\n\n\tfunction Get-SophiaVersion {\n\n\t\tswitch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber){\n\t\n\t\t\t\"17763\" {\n\t\t\n\t\t\t\t\"Windows_10_LTSC_2019\"\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t{($_ -ge 19044) -and ($_ -le 19048)}{\n\t\t\n\t\t\t\tif ($PSVersionTable.PSVersion.Major -eq 5){\n\t\t\n\t\t\t\t\t# Check if Windows 10 is an LTSC 2021\n\t\t\t\t\tif ((Get-ItemPropertyValue -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\" -Name ProductName) -eq \"Windows 10 Enterprise LTSC 2021\"){\n\t\t\n\t\t\t\t\t\t\"Windows_10_LTSC_2021\"\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t\"Windows_10\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\"Windows_10_PowerShell_7\"\n\t\t\t\t}\n\t\t\t}\n\t\t\t{$_ -ge 22000}\n\t\t\t{\n\t\t\t\tif ($PSVersionTable.PSVersion.Major -eq 5){\n\t\t\t\t\t\"Windows_11\"\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\"Windows_11_PowerShell_7\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t$SophiaVer = \"Sophia_Script_for_\" + (Get-SophiaVersion)\n\n\n\n\t$SupportedLanguages = @(\n\t\t'de-DE',\n\t\t'en-US',\n\t\t'es-ES',\n\t\t'fr-FR',\n\t\t'hu-HU',\n\t\t'it-IT',\n\t\t'pt-BR',\n\t\t'ru-RU',\n\t\t'tr-TR',\n\t\t'uk-UA',\n\t\t'zh-CN'\n\t)\n\n\tif($OverrideLang){\n\t\tif ($OverrideLang -NotIn $SupportedLanguages){\n\t\t\tWrite-Warning \"Language $OverrideLang may not be supported.\"\n\t\t}\n\t\t$Lang = $OverrideLang\n\t}\n\telseif((Get-UICulture).Name -in $SupportedLanguages){\n\t\t$Lang = (Get-UICulture).Name\n\t}\n\telseif((Get-UICulture).Name -eq \"en-GB\"){\n\t\t$Lang = 'en-US'\n\t}\n\telse{\n\t\t$Lang = 'en-US'\n\t}\n\n\t$Lang = (Get-UICulture).Name\n\tif ($OverrideLang){$Lang = $OverrideLang}\n\n\tif ($Lang -NotIn $SupportedLanguages){\n\t\t$Lang = 'en-US'\n\t}\n\tTry{\n\t\t$URL = \"https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/src/$SophiaVer/Localizations/$Lang/Sophia.psd1\"\n\t\t$Hashtable = Invoke-RestMethod $URL -ErrorAction Stop\n\t} Catch {\n\t\tWrite-Warning \"Failed to get Localizations with lang $Lang`nand URL: $URL\"\n\t\t$_\n\t\treturn\n\t}\n\tWhile ($Hashtable[0] -ne 'C'){\n\t\t$Hashtable = $Hashtable.Substring(1) # BOM ((\n\t}\n\t$global:Localizations = $global:Localization = Invoke-Expression $HashTable\n\n\tWrite-Verbose \"Getting $($SophiaVer -replace '_', ' ')\"\n\n\t$RawURL = \"https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/src/$SophiaVer/Module/Sophia.psm1\"\n\tWrite-Verbose $RawURL\n\n\t$SophiaFunctions = (Invoke-RestMethod $RawURL -ErrorAction Stop)\n\n\tWhile ($SophiaFunctions[0] -ne '<'){\n\t\t$SophiaFunctions = $SophiaFunctions.Substring(1) # BOM ((\n\t}\n\n\tif ($Write){\n\t\treturn $SophiaFunctions\n\t}else{\n\t\tNew-Module -Name \"Sophia Script (TL)\" -ScriptBlock ([ScriptBlock]::Create($SophiaFunctions)) | Import-Module -Global\n\t}\n\n}"
  },
  {
    "path": "modules/Installers/Aetopia's utils/Install-NVCPL.ps1",
    "content": "# Source: https://github.com/Aetopia/Install-NVCPL\nfunction Install-NVCPL {\n    if (!(Test-Admin)) {\n        Write-Host \"Install-NVCPL: This function needs Administrator priviledges\" -ForegroundColor DarkRed\n        return\n    }\n\n    choice.exe /C 12 /N /M \"Install NVIDIA Control Panel as:`n1. Win32 App`n2. UWP App`n>\"\n  \n    $NVCPL = \"$ENV:TEMP\\NVCPL.zip\"\n    $InstallationDirectory = \"$ENV:PROGRAMFILES\\NVIDIA Corporation\\Control Panel Client\"\n    $ShortcutFile = \"$ENV:PROGRAMDATA\\Microsoft\\Windows\\Start Menu\\Programs\\NVIDIA Control Panel.lnk\"\n    if ($LASTEXITCODE -eq 2) { $NVCPL = \"$NVCPL.appx\" }\n\n    if ($null -eq (Get-CimInstance Win32_VideoController |\n        Where-Object { $_.Name -like \"NVIDIA*\" })) {\n            Write-Host \"No NVIDIA GPU found.\" -ForegroundColor DarkRed\n            return\n        }\n\n        \n    # Disable Telemetry.\n    New-ItemProperty -Path \"HKLM:\\SOFTWARE\\NVIDIA Corporation\\NvControlPanel2\\Client\" -Name \"OptInOrOutPreference\" -Value 0 -PropertyType DWORD -Force -ErrorAction SilentlyContinue | Out-Null\n    New-ItemProperty -Path \"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\nvlddmkm\\Global\\Startup\" -Name \"SendTelemetryData\" -Value 0 -PropertyType DWORD -Force -ErrorAction SilentlyContinue | Out-Null\n\n    \n    # Using rg-adguard to fetch the latest version of the NVIDIA Control Panel.\n    $Body = @{\n        type = 'url'\n        url  = \"https://apps.microsoft.com/store/detail/nvidia-control-panel/9NF8H0H7WMLT\"\n        ring = 'RP'\n        lang = 'en-US' \n    }\n    Write-Output \"Getting the latest version of the NVIDIA Control Panel from the Microsoft Store...\"\n    $Link = ((Invoke-RestMethod -Method Post -Uri \"https://store.rg-adguard.net/api/GetFiles\" -ContentType \"application/x-www-form-urlencoded\" -Body $Body) -Split \"`n\" | \n        ForEach-Object { $_.Trim() } |\n        Where-Object { $_ -like (\"*http://tlu.dl.delivery.mp.microsoft.com*\") } |\n        ForEach-Object { ((($_ -split \"<td>\", 2, \"SimpleMatch\")[1] -Split \"rel=\", 2, \"SimpleMatch\")[0] -Split \"<a href=\", 2, \"SimpleMatch\")[1].Trim().Trim('\"') })[-1]\n    Invoke-RestMethod \"$Link\" -OutFile \"$NVCPL\"\n  \n    if ($LASTEXITCODE -eq 2) {\n        Write-Output \"Installing the NVIDIA Control Panel as an UWP app...\"\n        Add-AppxPackage \"$NVCPL\" -ForceApplicationShutdown -ForceUpdateFromAnyVersion\n    }\n    else {\n  \n        Write-Output \"Installing the NVIDIA Control Panel as a Win32 app...\"\n  \n        # Run the NVIDIA Control Panel as an Administrator.\n        New-Item \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" -ErrorAction SilentlyContinue | Out-Null\n        New-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" -Name \"$InstallationDirectory\\nvcplui.exe\" -Value \"~ RUNASADMIN\" -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null\n  \n        # Disable the NVIDIA Root Container Service. The service runs when the NVIDIA Control Panel is launched.\n        Stop-Process -Name \"NVDisplay.Container\" -Force -ErrorAction SilentlyContinue\n        Set-Service \"NVDisplay.ContainerLocalSystem\" -StartupType Disabled -ErrorAction SilentlyContinue\n        Stop-Service \"NVDisplay.ContainerLocalSystem\" -Force -ErrorAction SilentlyContinue\n        foreach ($File in ($InstallationDirectory, $ShortcutFile)) { Remove-Item \"$File\" -Recurse -Force -ErrorAction SilentlyContinue }\n        Expand-Archive \"$NVCPL\" \"$InstallationDirectory\" -Force\n  \n        # This DLL is needed inorder to suppress the annoying pop-up that says the UWP Control Panel isn't installed.\n        Invoke-RestMethod \"$((Invoke-RestMethod \"https://api.github.com/repos/Aetopia/Install-NVCPL/releases/latest\").assets.browser_download_url)\" -OutFile \"$InstallationDirectory\\nvcpluir.dll\"\n        $WSShell = New-Object -ComObject \"WScript.Shell\"\n        $Shortcut = $WSShell.CreateShortcut(\"$ShortcutFile\")\n        $Shortcut.TargetPath = \"$InstallationDirectory\\nvcplui.exe\"\n        $Shortcut.IconLocation = \"$InstallationDirectory\\nvcplui.exe, 0\"\n        $Shortcut.Save()\n    }\n    Write-Output \"NVIDIA Control Panel Installed!\"\n}"
  },
  {
    "path": "modules/Installers/Aetopia's utils/Install-ZetaLoader.ps1",
    "content": "function Install-ZetaLoader {\n    $GameInstallDir = Get-SteamGameInstallDir \"Halo Infinite\"\n    $ZetaLoader = \"$((Invoke-RestMethod \"https://api.github.com/repos/Aetopia/ZetaLoader/releases/latest\").assets[0].browser_download_url)\"\n    if (!$GameInstallDir) {\n        Write-Error \"Halo Infinite hasn't been installed via Steam.\"\n        exit 1\n    }\n    Write-Output \"Installing ZetaLoader...\"\n    Invoke-RestMethod -Uri \"$ZetaLoader\" -OutFile \"$GameInstallDir\\dinput8.dll\"\n    Write-Output \"ZetaLoader has been installed.\"\n}\n"
  },
  {
    "path": "modules/Installers/Get-GraalVM.ps1",
    "content": "function Get-GraalVM {\n    param(\n        [Switch]$Reinstall\n    )\n\n    if ((Test-Path \"$env:ProgramData\\GraalVM\") -and !$Reinstall){\n        return \"GraalVM is already installed, run with -Reinstall to force reinstallation\"\n    }\n    if (-Not(Get-Command curl.exe -ErrorAction Ignore)){\n        return \"curl is not found (comes with windows per default?)\"\n    }\n    Remove-Item \"$env:ProgramData\\GraalVM\" -ErrorAction Ignore -Force -Recurse\n\n    $URL = 'https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.2.0/graalvm-ce-java16-windows-amd64-21.2.0.zip'\n    $SHA256 = 'DAE2511ABFF8EAD3EBC90CD9FC81A8E84B762FC91462B198C3EDDF28F81A937E'\n    $Zip = \"$env:TMP\\GraalVM.zip\"\n\n\n    if (-Not(Test-Path $Zip)){\n        Write-Host \"Downloading GraalVM ($(Get-HeaderSize $URL)`MB)..\" -ForegroundColor Green\n        curl.exe -# -L $URL -o\"$Zip\"\n    }\n\n    if ((Get-FileHash $Zip).Hash -ne $SHA256){\n        Remove-Item \"$env:TMP\\GraalVM.zip\"\n        return \"Failed to download GraalVM (SHA256 checksum mismatch, not the expected file)\"\n        \n    }\n\n    if (Get-Command 7z -ErrorAction Ignore){\n\n        Invoke-Expression \"& `\"7z`\" x -bso0 -bsp1 -bse1 -aoa `\"$env:TMP\\GraalVM.zip`\" -o`\"$env:ProgramData\\GraalVM`\"\"\n    } else {\n        Expand-Archive -Path $Zip -Destination \"$env:ProgramData\\GraalVM\"\n    }\n    Move-Item -Path \"$env:ProgramData\\GraalVM\\graalvm-?e*\\*\" \"C:\\ProgramData\\GraalVM\"\n}"
  },
  {
    "path": "modules/Installers/Get-TLShell.ps1",
    "content": "function Get-TLShell {\n    param(\n        [switch]$Offline,\n        [switch]$DontOpen\n        )\n    \n    $WR = \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\" # I've had the habit of calling this folder WR\n                                                    # because it's the only folder I know that is added to path\n                                                    # that you don't need perms to access.\n\nif ($Offline){\n    \n    try {\n        $Master = Invoke-RestMethod -UseBasicParsing https://raw.githubusercontent.com/couleur-tweak-tips/TweakList/master/Master.ps1\n    } catch {\n        Write-Host \"Failed to get Master.ps1 from TweakList GitHub\" -ForegroundColor DarkRed\n        Write-Output \"Error: $($Error[0].ToString())\"\n        return\n    }\n    Set-Content \"$WR/TLSOff.cmd\" -Value @'\n<# : batch portion\n@echo off\npowershell.exe -noexit -noprofile -noexit -command \"iex (${%~f0} | out-string)\"\n: end batch / begin powershell #>\nWrite-Host \"TweakList Shell \" -Foregroundcolor White -NoNewLine\nWrite-Host \"(Offline)\" -Foregroundcolor DarkGray -NoNewLine\nWrite-Host \" - dsc.gg/CTT\" -Foregroundcolor White -NoNewLine\n\n'@\n    $Batch = Get-Item  \"$WR/TLSOff.cmd\"\n    Add-Content $Batch -Value $Master\n    if (!$DontOpen){\n        explorer.exe /select,`\"$($Batch.FullName)`\"\n    }\n\n}else{\n\n\n    \n    if ($WR -NotIn $env:PATH.Split(';')){\n        Write-Error \"`\"$env:LOCALAPPDATA\\Microsoft\\WindowsApps`\" is not added to path, did you mess with Windows?\"\n        return\n    }else{\n        $TLS = \"$WR\\TLS.CMD\"\n        Set-Content -Path $TLS -Value @'\n@echo off\ntitle TweakList Shell\nif /I \"%1\" == \"wr\" (explorer \"%~dp0\" & exit)\nif /I \"%1\" == \"so\" (set sophiaflag=Write-Host 'Importing Sophia Script..' -NoNewLine -ForegroundColor DarkGray;Import-Sophia)\n\nfltmc >nul 2>&1 || (\n    echo Elevating to admin..\n    PowerShell.exe -NoProfile Start-Process -Verb RunAs ' %0' 2> nul || (\n        echo Failed to elevate to admin, launch CMD as Admin and type in \"TL\"\n        pause & exit 1\n    )\n    exit 0\n)\n\npowershell.exe -NoProfile -NoLogo -NoExit -Command ^\n\"if ($PWD.Path -eq \\\"$env:WINDIR\\system32\\\"){cd $HOME} ;^\n[System.Net.ServicePointManager]::SecurityProtocol='Tls12' ;^\nWrite-Host 'Invoking TweakList.. ' -NoNewLine -ForegroundColor DarkGray;^\niex(irm tl.ctt.cx);^\n%SOPHIAFLAG%;^\nWrite-Host \\\"`rTweakList Shell - dsc.gg/CTT                  `n\\\" -Foregroundcolor White\"\n'@ -Force\n    }\n    $ShortcutPath = \"$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\TweakList Shell.lnk\"\n    $WScriptShell = New-Object -ComObject WScript.Shell\n    $Shortcut = $WScriptShell.CreateShortcut($ShortcutPath)\n    $Shortcut.IconLocation = (Get-Command powershell.exe).Source + \",0\"\n    $Shortcut.TargetPath = \"$WR\\TLS.CMD\"\n    $Shortcut.Save()\n\n    # Got this from my old list of snippets, originally found this on StackOverflow, forgot link\n    $bytes = [System.IO.File]::ReadAllBytes($ShortCutPath)\n    $bytes[0x15] = $bytes[0x15] -bor 0x20 # Set byte 21 (0x15) bit 6 (0x20) ON\n    [System.IO.File]::WriteAllBytes($ShortcutPath, $bytes)\n\n    Write-Host \"You can now type 'TLS' in Run (Windows+R) to launch it, or from your start menu\"\n    if (!$DontOpen){\n        & explorer.exe /select,`\"$(\"$WR\\TLS.CMD\")`\"\n    }\n    \n    \n}\n}\n"
  },
  {
    "path": "modules/Installers/Get.ps1",
    "content": "# This function centralizes most of what you can download/install on CTT\n# Anything it doesn't find in that switch ($App){ statement is passed to scoop\n$global:SendTo = [System.Environment]::GetFolderPath('SendTo')\nfunction Get {\n    [alias('g')] # minimalism at it's finest\n    param(\n        [Parameter(ValueFromRemainingArguments = $true)]\n        [Array]$Apps,\n        [Switch]$DryRun\n    )\n\n    $FailedToInstall = $null # Reset that variable for later\n    if ($Apps.Count -eq 1 -and (($Apps[0] -Split '\\r?\\n') -gt 1)){\n        $Apps = $Apps[0] -Split '\\r?\\n'\n    }\n    if ($DryRun){\n        ForEach($App in $Apps){\n            \"Installing $app.\"\n        }\n        return\n    }\n\n    ForEach($App in $Apps){ # Scoop exits when it throws\n\n        switch ($App){\n            'nvddl'{Get-ScoopApp utils/nvddl}\n            {$_ -in 'Remux','Remuxer'}{\n                Invoke-RestMethod https://github.com/couleurm/couleurstoolbox/raw/main/7%20FFmpeg/Old%20Toolbox%20scripts/Remux.bat -Verbose |\n                Out-File \"$SendTo\\Remux.bat\"\n\n            }\n            {$_ -in 'RemuxAVI','AVIRemuxer'}{\n                Invoke-RestMethod https://github.com/couleurm/couleurstoolbox/raw/main/7%20FFmpeg/Old%20Toolbox%20scripts/Remux.bat -Verbose |\n                Out-File \"$SendTo\\Remux - AVI.bat\"\n                $Content = (Get-Content \"$SendTo\\Remux - AVI.bat\") -replace 'set container=mp4','set container=avi'\n                Set-Content \"$SendTo\\Remux - AVI.bat\" $Content\n            }\n            {$_ -in 'Voukoder','vk'}{Install-Voukoder }\n            'Upscaler'{\n\n                Install-FFmpeg \n                Invoke-RestMethod 'https://github.com/couleur-tweak-tips/utils/raw/main/Miscellaneous/CTT%20Upscaler.cmd' |\n                Out-File (Join-Path ([System.Environment]::GetFolderPath('SendTo')) 'CTT Upscaler.cmd') -Encoding ASCII -Force\n                Write-Host @\"\nCTT Upscaler has been installed! Find it in the options when right clicking a video file -> Send To -> CTT Upscaler.cmd\n\"@ -ForegroundColor Green\n\n            }\n            {$_ -In 'QualityMuncher','qm'}{\n                Install-FFmpeg \n\n                Invoke-RestMethod 'https://raw.githubusercontent.com/Thqrn/qualitymuncher/main/Quality%20Muncher.bat' |\n                Out-File (Join-Path ([System.Environment]::GetFolderPath('SendTo')) 'Quality Muncher.bat') -Encoding ASCII -Force\n\n                Invoke-RestMethod 'https://raw.githubusercontent.com/Thqrn/qualitymuncher/main/!!qualitymuncher%20multiqueue.bat' |\n                Out-File (Join-Path ([System.Environment]::GetFolderPath('SendTo')) '!!qualitymuncher multiqueue.bat') -Encoding ASCII -Force\n\n            }\n\n            'Scoop'{Install-Scoop }\n            {$_ -in 'ff','FFmpeg'}{Install-FFmpeg }\n\n            {$_ -in 'zl','ZetaLoader'}{Install-ZetaLoader}\n            {$_ -in 'CRU','custom-resolution-utility'}{Get-ScoopApp extras/cru}\n            {$_ -in 'wt','windowsterminal','windows-terminal'}{Get-ScoopApp extras/windows-terminal}\n            {$_ -in 'np++','Notepad++','notepadplusplus'}{Get-ScoopApp extras/notepadplusplus}\n            {$_ -in 'DDU','DisplayDriverUninstaller'}{Get-ScoopApp extras/ddu}\n            {$_ -in 'Afterburner','MSIAfterburner'}{Get-ScoopApp utils/msiafterburner}\n            {$_ -in 'Everything','Everything-Alpha','Everything-Beta'}{Get-ScoopApp extras/everything-alpha}\n            {$_ -In '7-Zip','7z','7Zip'}{Get-ScoopApp 7zip}\n            {$_ -In 'Smoothie','sm'}{\n                Install-FFmpeg\n                Get-ScoopApp main/git\n                scoop.cmd bucket add utils https://github.com/couleur-tweak-tips/utils\n                scoop.cmd install utils/smoothie\n            }\n            {$_ -In 'OBS','OBSstudio','OBS-Studio'}{Get-ScoopApp extras/obs-studio}\n            {$_ -In 'UTVideo'}{Get-ScoopApp utils/utvideo}\n            {$_ -In 'Nmkoder'}{Get-ScoopApp utils/nmkoder}\n            {$_ -In 'Librewolf'}{Get-ScoopApp extras/librewolf}\n            {$_ -In 'ffmpeg-nightly'}{Get-ScoopApp versions/ffmpeg-nightly}\n            {$_ -In 'Graal','GraalVM'}{Get-ScoopApp utils/GraalVM}\n            {$_ -In 'DiscordCompressor','dc'}{Install-FFmpeg ;Get-ScoopApp utils/discordcompressor}\n            {$_ -In 'Moony','mn'}{if (-Not(Test-Path \"$HOME\\.lunarclient\")){Write-Warning \"You NEED Lunar Client to launch it with Moony\"};Get-ScoopApp utils/Moony}\n            {$_ -In 'TLShell','TLS'}{Get-TLShell }\n            default{Get-ScoopApp $App}\n        }\n        Write-Verbose \"Finished installing $app\"\n\n    }\n    if ($FailedToInstall){\n        \n        Write-Host \"[!] The following apps failed to install (scroll up for details):\" -ForegroundColor Red\n        $FailedToInstall\n    }\n}"
  },
  {
    "path": "modules/Installers/Install-MPVProtocol.ps1",
    "content": "function Install-MPVProtocol {\n    param(\n        [ValidateScript({Test-Path -Path $_ -PathType Leaf})]\n        $VideoPlayerFilePath\n    )\n\nif (!(Test-Admin)){\n    \"PowerShell NEEDS to run as Adminisrator in order to create the protocol handler\"\n    return\n}\n\n\nif ((Get-Command mpv -Ea 0) -and (Get-Command mpvnet -Ea 0)){\n    \"Would you like mpv:// links to open with MPV or MPV.net?\"\n    $Answer = Read-Host \"Answer\"\n    while ($answer -notin 'mpv','mpv.net','mpvnet','exit'){\n        \"Answer must be mpv / mpvnet, type exit to quit\"\n    }\n    switch ($Answer) {\n        'exit'{return}\n        {$_ -in 'mpvnet','mpv.net'}{$MPV = (Get-Command mpvnet.exe).Source}\n        'mpv'{$MPV = (Get-Command mpv.exe).Source}\n    }\n}elseif(Get-Command mpv -Ea 0){\n    \"Using default MPV\"\n    $MPV = (Get-Command mpv.exe).Source\n}elseif(Get-Command mpvnet -Ea 0){\n    Write-Warning \"Using MPV.net since MPV was not found (not added to path?)\"\n    $MPV = (Get-Command mpvnet.exe).Source\n}else{\n    return \"MPV or MPV.net couldn't be found, please install MPV / MPV.net\"\n}\n\nNew-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ea SilentlyContinue | Out-Null\nNew-Item -Path \"HKCR:\" -Name \"mpv\" -Force | Out-Null\nSet-ItemProperty -Path \"HKCR:\\mpv\" -Name \"(Default)\" -Value '\"URL:mpv Protocol\"' | Out-Null\nSet-ItemProperty -Path \"HKCR:\\mpv\" -Name \"URL Protocol\" -Value '\"\"' | Out-Null\nNew-Item -Path \"HKCR:\\mpv\" -Name \"shell\" -Force | Out-Null\nNew-Item -Path \"HKCR:\\mpv\\shell\" -Name \"open\" -Force | Out-Null\nNew-Item -Path \"HKCR:\\mpv\\shell\\open\" -Name \"command\" -Force | Out-Null\n#Old command: \"C:\\ProgramData\\CTT\\mpv-protocol\\mpv-protocol-wrapper.cmd\" \"%1\"\n$Command = \"cmd /c title MPV && powershell -ep bypass -NoProfile `\"& \\`\"$MPV\\`\" ('%1' -replace 'mpv://https//','https://')`\"\"\nSet-ItemProperty -Path \"HKCR:\\mpv\\shell\\open\\command\" -Name \"(Default)\" -Value  $Command | Out-Null\n\nWrite-Output \"Added the registry keys to handle mpv protocol and redirect to wrapper!\"\n\n}"
  },
  {
    "path": "modules/Installers/Install-Voukoder.ps1",
    "content": "function Install-Voukoder {\n    [CmdletBinding()]\n    [alias('isvk')]\n    param(\n        [Switch]$GetTemplates\n            # Skip Voukoder installation and just get to the template selector\n    )\n\n    function Get-VoukoderProgram ($Name){\n        # Parses the registry manually instead of using PackageManagement's Get-Package\n\n        $Programs = @(\n            'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n            'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n            'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n            'HKCU:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'\n\n        ) | Where-Object {Test-path $_} |\n\n        Get-ItemProperty |  Where-Object Publisher -eq 'Daniel Stankewitz' |\n                Select-Object -Property @{n='Name';     e='DisplayName'   },\n                                        @{n='Version';  e='DisplayVersion'},\n                                        @{n='UninstallString'; e='UninstallString'}\n        \n        return $Programs | Where-Object Name -Like $Name\n    }\n\n    if (!$GetTemplates){\n    \n        $LatestCore = (Invoke-RestMethod https://api.github.com/repos/Vouk/voukoder/releases/latest)[0]\n            # get the latest release manifest from GitHub's API\n\n        if (($tag = $LatestCore.tag_name) -NotLike \"*.*\"){\n            $tag += \".0\" # E.g \"12\" will not convert to a version type, \"12.0\" will\n        }\n        [Version]$LatestCoreVersion = $tag\n\n        $Core = Get-VoukoderProgram -Name \"Voukoder*\" -ErrorAction Ignore | # Find all programs starting with Voukoder\n            Where-Object Name -NotLike \"*Connector*\" | Where-Object Name -NotLike \"*Pro*\" # Exclude connectors and Voukoder Pro\n\n        if ($Core){\n\n            if ($Core.Length -gt 1){\n                $Core\n                Write-Host \"Multiple Voukoder Cores detected (or bad parsing?)\" -ForegroundColor Red\n                return\n            }\n\n            $CurrentVersion = [Version]$Core.Version\n            if ($LatestCoreVersion -gt $CurrentVersion){ # then an upgrade is needed\n                \"Updating Voukoder Core from version $CurrentVersion to $LatestCoreVersion\"\n                Start-Process -FilePath msiexec -ArgumentList \"/qb /x {$($Core.TagId)}\" -Wait -NoNewWindow\n                    # Uses msiexec to uninstall the program\n                $Upgraded = $True\n            }\n        }\n\n        if (!$Core -or $Upgraded){\n\n            $DriverVersion = (Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_Display.Driver\" -ErrorAction Ignore).DisplayVersion\n            if ($DriverVersion -and $DriverVersion -lt 520.00){ # Oldest NVIDIA version capable\n                Write-Warning \"Outdated NVIDIA Drivers detected ($DriverVersion), you may not be able to encode (render) using NVENC util you update them.\"\n                pause\n            }\n\n            \"Downloading and installing Voukoder Core..\"\n            $CoreURL = $LatestCore[0].assets[0].browser_download_url\n            curl.exe -# -L $CoreURL -o\"$env:TMP\\Voukoder-Core.msi\"\n            msiexec /i \"$env:TMP\\Voukoder-Core.msi\" /passive    \n        }\n\n        filter ConnectorVer {$_.Trim('.msi').Trim('.zip').Split('-') | Select-Object -Last 1}\n            # .zip for Resolve's\n\n\n        # Following block generates a hashtable of all of the latest connectors\n\n        $Tree = (Invoke-RestMethod 'https://api.github.com/repos/Vouk/voukoder-connectors/git/trees/master?recursive=1').Tree\n            # Gets all files from the connectors repo, which contain all filepaths\n        $Connectors = [Ordered]@{}\n        ForEach($NLE in 'vegas','vegas18','vegas19','vegas20','aftereffects','premiere','resolve'){\n            # 'vegas' is for older versions\n            switch ($NLE){\n                vegas{\n                    $Pattern = \"*vegas-connector-*\"\n                    break # needs to stop here, otherwise it would overwrite it the next match\n                }\n                {$_ -Like \"vegas*\"}{\n                    $Pattern = \"*connector-$_*\"\n                }\n                default {\n                    $Pattern = \"*$NLE-connector*\"\n                }\n            }\n\n            $LCV = $Tree.path | # Short for LatestConnectorVersion\n            Where-Object {$_ -Like $Pattern} | # Find all versions of all matching connectors\n            ForEach-Object {[Version]($_ | ConnectorVer)} | # Parse it's version using the filter\n            Sort-Object -Descending | Select-Object -First 1 # Sort then select only the latest\n\n            $Path = $Tree.path | Where-Object {$_ -Like \"$Pattern*$LCV*.*\"} # get the absolute path with the latest version\n            $Connectors += @{$NLE = \"https://github.com/Vouk/voukoder-connectors/raw/master/$Path\"}\n            Remove-Variable -Name NLE\n        }\n\n        $Processes = @(\n            'vegas*'\n            'Adobe Premiere Pro'\n            'AfterFX'\n            'Resolve'\n        )\n\n        $Found = { Get-Process $Processes -ErrorAction Ignore }\n\n        if (-not (. $Found)){ # If $Found scriptblock returns nothing\n            Write-Host \"[!] Open your video editor\" -ForegroundColor Red\n            Write-Host \"Voukoder supports: VEGAS 12-20, Premiere, After Effects, DaVinci Resolve (ONLY PAID `\"Studio `\"VERSION)\" -ForeGroundColor Green\n            Write-Host \"Looking for processes: $($Processes -join ', ')\" -ForegroundColor DarkGray\n            While(-not (. $Found)){\n                Start-Sleep -Seconds 1\n            }\n        }\n        Write-Host @(\n            \"`nDetected the following video editor(s):`n`n\"\n            $(. $Found | Select-Object MainWindowTitle, Path, FileVersion | Out-String)\n            )\n\n        function Get-Connector ($PackageName, $Key, $NLEDir, $InnoFlag){\n            # Key is to get the right connector URL in $Connector hashtable\n            \n            function Install-Connector {\n                $msiPath = \"$env:TMP\\Voukoder Connector-$Key.msi\"\n                curl.exe -# -L $Connectors.$Key -o\"$msiPath\"\n                Write-Verbose \"Installing $msiPath at $InnoFlag=$NLEDir\" -Verbose\n                cmd /c \"msiexec /i `\"$msiPath`\" /qb $InnoFlag=`\"$NLEDir`\" /log `\"$env:TEMP\\Voukoder $InnoFlag.txt`\"\"\n                # msiexec /i \"$msiPath\" /qb \"$InnoFlag=`\"$NLEDir`\"\"\n                if ($LASTEXITCODE){\n                    Installer returned with error code $LASTEXITCODE\n                }\n            }\n\n            $CurrentConnector = (Get-VoukoderProgram -Name $PackageName)\n            if ($CurrentConnector){\n                [Version]$CurrentConnectorVersion = $CurrentConnector.Version\n                [Version]$LatestConnector = $Connectors.$Key | ConnectorVer # Parse connector version\n                if ($LatestConnector -gt $CurrentConnectorVersion){\n\n                    Write-Host \"Upgrading $PackageName from $CurrentConnectorVersion to $LatestConnector\"\n                    Start-Process -FilePath msiexec -ArgumentList \"/qb /x {$($CurrentConnector.TagId)}\" -Wait -NoNewWindow\n                    Install-Connector\n                }\n            } else {\n\n                Install-Connector\n            }\n        }\n        $NLEs = Get-Process $Processes -ErrorAction Ignore\n        ForEach($NLE in $NLEs){\n\n            switch ($NLE){\n\n                {(Split-Path $_.Path -Leaf) -in 'vegas180.exe', 'vegas190.exe','vegas200.exe'} {\n                    Write-Verbose \"Using newer VEGAS\"\n\n                    $VegVer = (Split-Path $_.Path -Leaf) -replace 'vegas' -replace '0\\.exe'\n\n                    Get-Connector -PackageName \"Voukoder connector for VEGAS Pro $VegVer\" -Key \"vegas$VegVer\" -NLEDir (Split-Path $_.Path -Parent) -InnoFlag VEGASDIR\n                    \n                    continue # Needs to loop over the next switch, which would've matched and also thought it needed to install an older Version\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -Like 'vegas*.exe'}{\n                    Write-Host \"/!\\ Old-VEGAS connector installation may fail if you already have a connector for newer VEGAS versions\" -ForegroundColor Red\n                    Get-Connector -PackageName \"Voukoder connector for VEGAS\" -Key vegas -NLEDir (Split-Path $_.Path -Parent) -InnoFlag VEGASDIR\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -eq 'afterfx.exe'} {\n                    Get-Connector -PackageName 'Voukoder Connector for Adobe After Effects' -Key aftereffects -NLEDir \"$env:ProgramFiles\\Adobe\\Common\\Plug-ins\\7.0\\MediaCore\" -InnoFlag INSTALLDIR\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -eq 'Adobe Premiere Pro.exe'}{\n                    Get-Connector -PackageName 'Voukoder connector for Premiere' -Key premiere -NLEDir \"$env:ProgramFiles\\Adobe\\Common\\Plug-ins\\7.0\\MediaCore\" -InnoFlag TGDir\n                }\n\n\n                {(Split-Path $_.Path -Leaf) -eq 'Resolve.exe'}{\n                    Write-Warning \"Voukoder's connector for Resolve is ONLY FOR IT'S PAID `\"Studio`\" VERSION\"\n                    pause\n                    \n                    $IOPlugins = \"$env:ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\IOPlugins\"\n                    $dvcpBundle = \"$IOPlugins\\voukoder_plugin.dvcp.bundle\"\n\n                    if (-Not(Test-Path $IOPlugins)){\n                        New-Item -ItemType Directory -Path $IOPlugins | Out-Null\n                    }\n                    elseif (Test-Path $dvcpBundle -PathType Container){\n                        if (-Not(Get-Boolean \"Would you like to reinstall/update the Voukoder Resolve plugin? (Y/N)\")){continue}\n                        Remove-Item $dvcpBundle -Force -Recurse\n                    }\n\n                    $Zip = \"$env:TMP\\Voukoder-Connector-Resolve.zip\"\n                    curl.exe -# -L $Connectors.Resolve -o\"$Zip\"\n\n                    $ExtractDir = \"$env:TMP\\Voukoder-Connector-Resolve\"\n                    Remove-Item $ExtractDir -Recurse -Force -ErrorAction Ignore\n                    Expand-Archive $Zip -Destination $ExtractDir\n\n                    Copy-Item \"$ExtractDir\\voukoder_plugin.dvcp.bundle\" $IOPlugins -Recurse\n                    \n                    Write-Warning \"If connection failed you should find instructions in $ExtractDir\\README.txt\"\n                }\n            }\n        }\n        $NLEBin = $NLE.Path\n    }else{\n        $AvailableNLETemplates = @{\n            \"Vegas Pro 18+\" = \"vegas180.exe\"\n            \"Vegas Pro 14\" = \"vegas140.exe\"\n            \"Premiere Pro\" = \"Adobe Premiere Pro.exe\"\n            \"After Effects\" = \"AfterFX.exe\"\n        }\n        $NLE = Menu -menuItems $AvailableNLETemplates.Keys\n        $NLEBin = $AvailableNLETemplates.$NLE\n    }\n\n        # Converts \n        # https://cdn.discordapp.com/attachments/969870701798522901/972541638578667540/HEVC_NVENC_Upscale.sft2\n        # To hashtable with key \"HEVC NVENC + Upscale\" and val the URL\n\n    filter File2Display {\n        [IO.Path]::GetFileNameWithoutExtension($_) -replace '_',' ' -replace \" Upscale\", \" + Upscale\" -replace '  ',' '\n    }\n\n    $VegasTemplates = @(\n\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/HEVC_NVENC_Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/HEVC_NVENC.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/HEVC_NVENC__Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/H264_NVENC.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x265_Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x265.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x264_Upscale.sft2'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/vegas-voukoder-presets/x264.sft2'\n\n        ) | ForEach-Object {\n        [Ordered]@{($_ | File2Display) = $_}\n    }\n\n    $PremiereTemplates = @(\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/HEVC_NVENC__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/HEVC_NVENC.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/H264_NVENC__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/H264_NVENC.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x264__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x264.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x265__Upscale.epr'\n        'https://github.com/couleur-tweak-tips/TweakList/releases/download/premiere-voukoder-presets/x265.epr'\n    ) | ForEach-Object {\n        [Ordered]@{($_ | File2Display) = $_}\n    }\n\n    switch($NLEBin){\n\n        {($NLEBin | Split-Path -Leaf).StartsWith('vegas')}{\n\n            $NLETerm = \"Vegas\"\n\n            $TemplatesFolder = if (($NLEBin | Split-Path -Leaf) -like (\"*140.exe\")){\n                \"$env:APPDATA\\Sony\\Render Templates\\voukoder\"\n            } else {\n                \"$env:APPDATA\\VEGAS\\Render Templates\\voukoder\"\n            }\n\n            if (-Not(Test-Path $TemplatesFolder)){\n                New-Item -ItemType Directory -Path $TemplatesFolder -Force | Out-Null\n            }\n\n            $SelectedTemplates =  Invoke-Checkbox -Items $VegasTemplates.Keys -Title \"Select VEGAS render templates to install\"\n\n            ForEach ($Template in $SelectedTemplates){\n                if (Test-Path ($TPPath = \"$TemplatesFolder\\$Template.sft2\")){\n                    Remove-Item $TPPath -Force\n                }\n                curl.exe -# -sSL $VegasTemplates.$Template -o\"$TPPath\"\n            }\n        }\n\n\n\n        {($NLEBin | Split-Path -Leaf).StartsWith('Adobe Premiere Pro.exe')}{\n            \n            $NLETerm = 'Premiere Pro'\n            $TemplatesFolder = \"$env:USERPROFILE\\Documents\\Adobe\\Adobe Media Encoder\\12.0\\Presets\"\n\n            if (-Not(Test-Path $TemplatesFolder)){\n                New-Item -ItemType Directory -Path $TemplatesFolder -Force | Out-Null\n            }\n\n            $SelectedTemplates =  Invoke-Checkbox -Items $PremiereTemplates.Keys -Title \"Select render templates to install\"\n\n            ForEach ($Template in $SelectedTemplates){\n                if (Test-Path ($TPPath = \"$TemplatesFolder\\$Template.epr\")){\n                    Remove-Item $TPPath -Force\n                }\n                curl.exe -# -sSL $PremiereTemplates.$Template -o\"$TPPath\"\n            }\n        \n        }\n\n\n\n\n        {($NLEBin | Split-Path -Leaf).StartsWith('AfterFX.exe')}{\n            $NLETerm = 'After Effects'\n\n            \"Opening a tutorial in your browser and downloading the AE templates file..\"\n            Start-Sleep -Seconds 2\n            if (-Not(Test-Path ($TPDir = \"$env:TMP\\AE_Templates\"))){\n                New-Item -ItemType Directory -Path $TPDir -Force | Out-Null\n            }\n            curl.exe -# -sSL https://github.com/couleur-tweak-tips/TweakList/releases/download/after-effects-voukoder-presets/CTT_AE_VOUKODER_TEMPLATES.aom -o\"$TPDir\\CTT_AE_VOUKODER_TEMPLATES.aom\"\n\n            Start-Process -FilePath explorer.exe -ArgumentList \"/select,`\"$TPDir\\CTT_AE_VOUKODER_TEMPLATES.aom`\"\"\n            $Tutorial = 'https://i.imgur.com/XCaJGoV.mp4'\n            try {\n                Start-Process $Tutorial\n            } catch { # If the user does not have any browser\n                \"Tutorial URL: $Tutorial\" \n            }\n        }\n\n\n\n        default{\n            Write-Host \"Your video editor ($($NLEBin)) does not have any pre-made templates for me to propose you\" -ForegroundColor Red\n            $NLETerm = \"your video editor\"\n        }\n    }\n    Write-Host \"Installation script finished, follow instructions (if any)\"\n    Write-Host \"Then restart $NLETerm to make sure Voukoder render templates have loaded.\" -ForegroundColor Red\n\n}\n"
  },
  {
    "path": "modules/Installers/Invoke-SmoothiePost.ps1",
    "content": "function Invoke-SmoothiePost {\n    param(\n        [String]\n        [ValidateScript({\n            Test-Path -Path (Get-Item $_) -PathType Container -ErrorAction Stop\n        })]\n        $CustomDir\n    )\n    # DIR is the variable used by Scoop, hence why I'm using a separate name\n    if ($CustomDir -and !$DIR){\n        if (!(Test-Path \"$CustomDir\\Smoothie\") -And !(Test-Path \"$CustomDir\\VapourSynth\")){\n            Write-Host \"The folder you gave needs to contain the folders 'Smoothie' and 'VapourSynth', try the right path\"\n        }else{\n            $DIR = (Get-Item $CustomDir).FullName\n        }\n    }\n    if (!$DIR){return \"This script is suppose to be ran by Scoop after it's intallation, not manually\"}\n\n    $rc = (Get-Content \"$DIR\\Smoothie\\settings\\recipe.yaml\" -ErrorAction Stop) -replace ('H264 CPU',(Get-EncodingArgs -EzEncArgs))\n\n    if ($valid_args -like \"H* CPU\"){$rc = $rc -replace ('gpu: true','gpu: false')}\n\n    Set-Content \"$DIR\\Smoothie\\settings\\recipe.ini\" -Value $rc\n\n    $term = Get-Path conhost.exe\n\n    Get Scoop\n\n    $SendTo = [System.Environment]::GetFolderPath('SendTo')\n    $Scoop = Get-Command Scoop | Split-Path | Split-Path\n    $SA = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs', 'Scoop Apps')\n\n    if (-Not(Test-Path $SA)){ # If not using Scoop\n        $SA = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs')\n    }\n\n    Set-Content \"$Scoop\\shims\\sm.shim\" -Value @\"\npath = \"$DIR\\VapourSynth\\python.exe\"\nargs = \"$DIR\\Smoothie\\src\\main.py\"\n\"@\n    if (-Not(Test-Path \"$Scoop\\shims\\sm.exe\")){\n        Copy-Item \"$Scoop\\shims\\7z.exe\" \"$Scoop\\shims\\sm.exe\"\n    }\n\n\n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$Scoop\\shims\\rc.lnk\"\n        TargetPath = \"$DIR\\Smoothie\\settings\\recipe.yaml\"\n    }\n    New-Shortcut @Parameters\n\n\n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$SA\\Smoothie Recipe.lnk\"\n        TargetPath = \"$DIR\\Smoothie\\settings\\recipe.yaml\"\n    }\n    New-Shortcut @Parameters\n\n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$SA\\Smoothie.lnk\"\n        TargetPath = $term\n        Arguments = \"`\"$DIR\\VapourSynth\\python.exe`\" `\"$DIR\\Smoothie\\src\\main.py`\" -cui\"\n        Icon = \"$DIR\\Smoothie\\src\\sm.ico\"\n    }\n    New-Shortcut @Parameters\n    \n    $Parameters = @{\n        Overwrite = $True\n        LnkPath = \"$SendTo\\Smoothie.lnk\"\n        TargetPath = $term\n        Arguments = \"`\"$DIR\\VapourSynth\\python.exe`\" `\"$DIR\\Smoothie\\src\\main.py`\" -cui -input\"\n        Icon = \"$DIR\\Smoothie\\src\\sm.ico\"\n\n    }\n    New-Shortcut @Parameters\n\n}\n"
  },
  {
    "path": "modules/Installers/Invoke-SmoothieRsPost.ps1",
    "content": "# This does not install Smoothie, it simply creates shortcuts in the start menu, Send To and configures the recipe\nfunction Invoke-SmoothieRsPost {\n    param(\n        \n        [ValidateScript({\n                Test-Path -Path (Get-Item $_) -PathType Container -ErrorAction Stop\n            })]\n        [String]$DIR,\n        [Switch]$Scoop,\n        [Switch]$Uninstall\n    )\n\n    $ErrorActionPreference = 'Stop'\n\n    <#\n        .SYNOPSIS\n        Merges recipes\n\n        .NOTES\n        It returns void, it just applies all patches on what was passed to -Original\n\n        .NOTES\n        Limitations:\n        - It cannot remove keys from $OG, most it can do is Patch containing a same key that is $null\n\n        .PARAMETER Original\n        The original hashtable which will get modified\n        .PARAMETER Patches\n        Recursively merge with $Original\n    #>\n    function Merge-Recipe {\n        [CmdletBinding()]\n        param (\n            $Original,\n            $Patch\n        )\n        foreach ($category in $Patch.GetEnumerator()) {\n            \n            $key, $patch = $category.name, $category.value\n\n            if ($Original.Contains($key) -and ($Original[$key] -is [Collections.Specialized.OrderedDictionary] -and $Patch -is [Collections.Specialized.OrderedDictionary])) {\n                Merge-Recipe -Original $Original[$key] -Patch $Patch\n            }\n            else {\n                $Original[$key] = $Patch\n            }\n        }\n    }\n    \n    $SendTo = [System.Environment]::GetFolderPath('SendTo')\n    $Start = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs')\n\n    if (!$SendTo -or !(Test-Path $SendTo)) {\n        return \"FATAL: Send To folder [$SendTo] does not exist, did you/a script strip it?\"\n    }\n    if (!$Start -or !(Test-Path $Start)) {\n        return \"FATAL: Start Menu folder [$Start] does not exist, did you/a script strip it?\"\n    }\n\n    if ($Scoop){\n        $shims = (Resolve-Path $DIR/../../../shims).Path\n    }\n\n    if ($Uninstall) {\n        Remove-Item \"$Sendto\\Smoothie.lnk\"\n        Remove-Item \"$SA\\Smoothie.lnk\"\n        if ($Scoop) {\n            Remove-Item \"$shims\\rc.lnk\"\n        }\n        return\n    }\n\n    if ($Scoop) {\n        $old_VERSIONS = Get-ChildItem $dir/.. -Directory -Exclude current, $version\n        $old_DIR = switch ($old_VERSIONS.Length) {\n            { $_ -in 0, $null } {}\n            1 { $old_VERSIONS }\n            default {\n                $script:ret = \"\"\n                $script:mostRecentDate = [datetime]::MinValue\n\n                $old_VERSIONS | ForEach-Object {\n                    $string = $_.BaseName -replace \"Nightly_\"\n                    $datetime = [datetime]::ParseExact($string, \"yyyy.MM.dd_HH-mm\", [CultureInfo]::InvariantCulture)\n\n                    if ($datetime -gt $script:mostRecentDate) {\n                        $script:mostRecentDate = $datetime\n                        $script:ret = $_\n                    }\n                }\n\n                if ($script:mostRecentDate -eq [datetime]::MinValue) {\n                    write-Warning \"Failed to parse old versions:\"\n                    Write-Host $old_VERSIONS.FullName\n                }\n\n                $script:ret\n            }\n        }\n\n        if ($old_DIR -and (Test-Path $old_DIR)) {\n\n            [Collections.Specialized.OrderedDictionary]$old_MACROS = Get-IniContent $old_DIR/encoding_presets.ini -KeyValSeparator ':'\n            [Collections.Specialized.OrderedDictionary]$new_MACROS = Get-IniContent $DIR/encoding_presets.ini -KeyValSeparator ':'\n            \n            Merge-Recipe $new_MACROS $old_MACROS\n            $new_MACROS | Out-IniFile $DIR/encoding_presets.ini -Pretty -Force -Loose -KeyValSeparator ':'\n\n            $old_RECIPES = Get-ChildItem $old_DIR -File -Filter *.ini | Where-Object BaseName -Notin 'defaults', 'encoding_presets'\n\n            $old_RECIPES | ForEach-Object {\n                [Collections.Specialized.OrderedDictionary]$old_RC = Get-IniContent $_.FullName -KeyValSeparator ':'\n                [Collections.Specialized.OrderedDictionary]$new_RC = Get-IniContent $DIR\\recipe.ini -KeyValSeparator ':'\n                \n                Merge-Recipe $new_RC $old_RC\n                $new_RC | Out-IniFile $DIR/$($_.BaseName).ini -Pretty -Force -Loose -KeyValSeparator ':'\n            }\n            $old_files = Get-ChildItem $old_DIR | Where-Object Name -notin 'defaults.ini', 'encoding_presets.ini', 'jamba.vpy', 'bin', 'recipe.ini', 'launch.cmd', 'manifest.json', 'install.json'\n\n            $old_files | ForEach-Object { Move-Item $_.FullName $DIR -Verbose }\n\n        }\n    }\n\n    $SendTo = [System.Environment]::GetFolderPath('SendTo')\n    $Start = [System.IO.Path]::Combine([Environment]::GetFolderPath('StartMenu'), 'Programs')\n    . { # Shortcuts\n        if (!$SendTo -or !(Test-Path $SendTo)) {\n            return \"FATAL: Send To folder [$SendTo] does not exist, did you/a script strip it?\"\n        }\n        if (!$Start -or !(Test-Path $Start)) {\n            return \"FATAL: Start Menu folder [$Start] does not exist, did you/a script strip it?\"\n        }\n\n        # %APPDATA%\\Microsoft\\Windows\\SendTo\\Smoothie.lnk\n        $Parameters = @{\n            Overwrite  = $True\n            LnkPath    = \"$SendTo\\&Smoothie.lnk\"\n            TargetPath = \"$DIR\\bin\\smoothie-rs.exe\"\n            Arguments  = \"--tui -i\"\n        }\n        New-Shortcut @Parameters\n\n        if ($Scoop) {\n            \n            # %USERPROFILE%\\scoop\\shims\\rc.lnk\n            $Parameters = @{\n                Overwrite  = $True\n                LnkPath    = \"$shims\\rc.lnk\"\n                TargetPath = \"$dir\\recipe.ini\"\n            }\n            New-Shortcut @Parameters\n        }\n        else {\n            # %APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Smoothie Recipe.lnk\n            $Parameters = @{\n                Overwrite  = $True\n                LnkPath    = \"$Start\\Smoothie Recipe.lnk\"\n                TargetPath = \"$DIR\\recipe.ini\"\n            }\n            # %APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Smoothie.lnk\n            New-Shortcut @Parameters\n            $Parameters = @{\n                Overwrite  = $True\n                LnkPath    = \"$Start\\Smoothie.lnk\"\n                TargetPath = \"$DIR\\bin\\smoothie-rs.exe\"\n                Arguments  = \"--tui\"\n            }\n            New-Shortcut @Parameters\n        }\n    }\n\n}"
  },
  {
    "path": "modules/Installers/Launch.ps1",
    "content": "function Launch{\n\t[alias('l')]\n\tparam(\n\t\t[ValidateSet(\n\t\t\t'DisplayDriverUninstaller',\n\t\t\t'NVCleanstall',\n\t\t\t'NvidiaProfileInspector',\n\t\t\t'MSIUtilityV3',\n\t\t\t'Rufus',\n\t\t\t'AutoRuns',\n\t\t\t'Procmon',\n\t\t\t'CustomResolutionUtility',\n\t\t\t'NotepadReplacer',\n\t\t\t'privacy.sexy',\n\t\t\t'ReShade'\n\t\t\t#! TODO: NVProfileInspector, MSIUtility, CRU, Notepadreplacer, BulkCrapUninstaller, https://www.bill2-software.com/processmanager/exe/BPM-Setup.exe\n\t\t)]\n\t\t[Array]$Apps,\n\t\t[Switch]$DontLaunch, # Just keep them tidy in the Downloads folder))\n\t\t# This is the non hardcoded Downloads folder path s/o @farag2\n\t\t[String]$OutDir = (Get-ItemPropertyValue -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{374DE290-123F-4565-9164-39C4925E467B}\")\n\t)\n\n\tAdd-Type -AssemblyName System.IO.Compression.FileSystem\n\n\tfunction Invoke-Download{\n\t\tparam(\n\t\t\t[String]$URL, # Parses mediafire\n\t\t\t[String]$AppName,\n\t\t\t[Switch]$Scoop, # Scoop 'bucket/manifest' name\n\t\t\t[String]$PathToBinary, # In the zip\n\t\t\t[String]$Checksum,\n\t\t\t[String]$SelfExtracting7z # e.g for DDU\n\t\t)\n\n\t\tif (-Not(Test-Path $env:TMP)){\n\t\t\tthrow \"TMP environment variable not found [$env:TMP]\"\n\t\t}\n\n\t\tif($Scoop){\n\t\t\t$Bucket, $Manifest = $URL -split '/'\n\n\t\t\t$Repos = @{\n\n\t\t\t\tmain = @{org = 'ScoopInstaller';repo = 'main';branch = 'master'}\n\t\t\t\textras = @{org = 'ScoopInstaller';repo = 'extras';branch = 'master'}\n\t\t\t\tutils = @{org = 'couleur-tweak-tips';repo = 'utils';branch = 'main'}\n\t\t\t\tnirsoft = @{org = 'kodybrown';repo = 'scoop-nirsoft';branch = 'master'}\n\t\t\t\tgames = @{org = 'ScoopInstaller';repo = 'games';branch = 'master'}\n\t\t\t\t'nerd-fonts' = @{org = 'ScoopInstaller';repo = 'nerd-fonts';branch = 'master'}\n\t\t\t\tversions = @{org = 'ScoopInstaller';repo = 'versions';branch = 'master'}\n\t\t\t\tjava = @{org = 'ScoopInstaller';repo = 'java';branch = 'master'}\n\t\t\t}\n\t\t\t$repo = $Repos.$Bucket\n\t\t\t$URL = \"https://raw.githubusercontent.com/$($repo.org)/$($repo.repo)/$($repo.branch)/bucket/$Manifest.json\"\n\t\t\t$URL, $Version = Invoke-RestMethod $URL | ForEach-Object {$PSItem.URL, $PSItem.Version}\n\t\t}elseif($URL -Like \"*mediafire.com*\"){\n\t\t\t$URL = (Invoke-WebRequest -UseBasicParsing $URL).Links.href | Where-Object {$PSItem -Like \"http*://download*.mediafire.com/*\"}\n\t\t}\n\n\t\tif ($AppName){\n\t\t\t$FileName = $AppName\n\t\t}else{\n\t\t\t$FileName = $Manifest\n\t\t}\n\t\t\n\t\tif ($Version){$FileName += \" $Version\"}\n\n\t\t$Extension = [io.path]::GetExtension((($URL -replace '#/dl.7z') | Split-Path -Leaf))\n\n\t\t$OutFile = \"$env:TMP\\$FileName$Extension\"\n\t\tif (-Not(Test-Path $OutFile)){\n\t\t\tcurl.exe -#L -A \"Scoop\" $URL -o\"$OutFile\"\n\t\t}\n\n\t\tif($Checksum){\n\t\t\t$Parameters = @{\n\t\t\t\tPath = $OutFile\n\t\t\t}\n\t\t\tif ($Checksum -Like \"*:*\"){ # Contains a :\n\t\t\t\t$Algo, $Checksum = $Checksum -Split ':' # To split hash and algo, eg md5:8424509737CEDBDE4BA9E9A780D5CE96\n\t\t\t\t$Parameters += @{\n\t\t\t\t\tAlgorithm = $Algo \n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($Checksum -ne (Get-FileHash @Parameters).Hash){\n\t\t\t\tthrow \"Hash provided $Checksum does not match $OutFile\"\n\t\t\t}\n\t\t}\n\n\t\tif ($Extension -eq '.zip'){\n\t\t\t$OutDir = \"$env:TMP\\$FileName\\\"\n\t\t\tif (-Not(Test-Path $OutDir)){\n\t\t\t\t[System.IO.Compression.ZipFile]::ExtractToDirectory($OutFile, $OutDir)\n\t\t\t}\n\n\t\t\tif ($PathToBinary){\n\t\t\t\t$OutDir = Join-Path $OutDir $PathToBinary\n\t\t\t}\n\t\t\t$OutFile = $OutDir # To not have to check for the following statement twice\n\t\t}elseif($SelfExtracting7z){\n\t\t\tStart-Process -FilePath $OutFile -ArgumentList \"-y\" -Wait\n\t\t\t$SelfExtracting7z = $SelfExtracting7z -replace \"%VER%\", $Version\n\t\t\tif (-Not(Test-Path \"$env:TMP\\$SelfExtracting7z\" -PathType Container)){\n\t\t\t\tthrow \"Self extracting 7-Zip got wrong path: $SelfExtracting7z\"\n\t\t\t}\n\t\t\t$OutDir = $SelfExtracting7z\n\t\t}\n\n\t\tif (-Not(Test-Path $OutFile)){\n\t\t\tthrow \"$OutFile could not be found\"\n\t\t}\n\n\t\treturn $OutFile\n\n\t}\n\n\t$Paths = @()\n\n\t$Apps | ForEach-Object { # Cycles through given apps\n\t\tWrite-Host \"getting $PSItem\"\n\t\t$Paths += switch ($PSItem){\n\t\t\tDisplayDriverUninstaller{ Invoke-Download -URL extras/ddu -Scoop -PathToBinary \"Display Driver Uninstaller.exe\" -SelfExtracting7z \"DDU v%VER%\" -AppName DDU }\n\t\t\tNVCleanstall{ Invoke-Download -URL extras/nvcleanstall -Scoop -AppName NVCleanstall -PathToBinary \"NVCleanstall.exe\" }\n\t\t\tNvidiaProfileInspector{ Invoke-Download -URL extras/nvidia-profile-inspector -Scoop -AppName NvidiaProfileInspector -PathToBinary 'nvidiaProfileInspector.exe' }\n\t\t\tMSIUtilityV3{\n\t\t\t\tWrite-Warning \"MSI mode is already applied by default on NVIDIA 1600/2000/3000 GPUs and AMD cards\"\n\t\t\t\tInvoke-Download -URL https://www.mediafire.com/file/ewpy1p0rr132thk/MSI_util_v3.zip/file -AppName \"MSIUtilV3\" -PathToBinary \"MSI_util_v3.exe\" -Checksum \"md5:8424509737CEDBDE4BA9E9A780D5CE96\"\n\t\t\t}\n\t\t\tRufus{ Invoke-Download -URL extras/rufus -Scoop -AppName rufus}\n\t\t\tAutoRuns{ Invoke-Download -URL https://download.sysinternals.com/files/Autoruns.zip -AppName AutoRuns -PathToBinary Autoruns64.exe }\n\t\t\tProcmon{ Invoke-Download -URL https://download.sysinternals.com/files/ProcessMonitor.zip -AppName Procmon -PathToBinary Procmon64.exe }\n\t\t\tCustomResolutionUtility { Invoke-Download -URL extras/cru -Scoop -AppName CRU -PathToBinary CRU.exe}\n\t\t\tNotepadReplacer { Invoke-Download -URL utils/notepadreplacer -Scoop -AppName NotepadReplacer}\n\t\t\tprivacy.sexy { Invoke-Download -URL utils/privacysexy -Scoop -AppName privacysexy}\n\t\t\tReShade{\n\t\t\t\t$Website = \"https://reshade.me/\"\n\t\t\t\t$DLLink = (Invoke-WebRequest \"$Website#download\").Links.Href | Where-Object {$_ -Like \"*.exe\"} | Where-Object {$_ -NotLike \"*_Addon.exe\"}\n\t\t\t\t$URL = $Website + $DLLink\n\t\t\t\tInvoke-Download -URL $URL -AppName ReShade\n\t\t\t}\n\t\t}\n\t}\n\treturn $Paths\n}"
  },
  {
    "path": "modules/Invoke-GitHubScript.ps1",
    "content": "function Invoke-GitHubScript {\n    [alias('igs')]\n    param(\n        [ValidateSet(\n            'ChrisTitusTechToolbox',\n            'OldChrisTitusTechToolbox',\n            'Fido',\n            'SophiaScript'\n        )]\n        $Repository,\n        $RawURL\n    )\n    if ($RawURL){\n        Invoke-RestMethod $URL | Invoke-Expression\n        return\n    }\n    function Invoke-URL ($Link) {\n        $Response = Invoke-RestMethod $Link\n        While ($Response[0] -NotIn '<','#'){ # Byte Order Mark (BOM) removal\n            $Response = $Response.Substring(1)\n        }\n        Invoke-Expression $Response\n    }\n    switch ($Repository){\n        'ChrisTitusTechToolbox'{Invoke-URL https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winutil.ps1}\n        'OldChrisTitusTechToolbox'{Invoke-Expression (Invoke-RestMethod https://raw.githubusercontent.com/ChrisTitusTech/win10script/master/win10debloat.ps1)}\n        'Fido'{Invoke-URL https://raw.githubusercontent.com/pbatard/Fido/master/Fido.ps1}\n        'SophiaScript'{Import-Sophia}\n    }\n}\n"
  },
  {
    "path": "modules/Miscellaneous/4K-Notifier.ps1",
    "content": "function 4K-Notifier {\n    param(\n        [Parameter(Mandatory)]\n        [String]$Video,\n        [int]$Timeout = 30\n    )\n    if (!$Video){\n        $Video = Read-Host \"Pleaste paste in the URL of the video you'd like to wait for until it hits 4K\"\n    }\nif (Get-Command yt-dlp -Ea 0){\n    $ytdl = (Get-Command yt-dlp).Source\n}elseif(Get-Command youtube-dl -Ea 0){\n    $ytdl = (Get-Command youtube-dl).Source\n}else{\n    return @\"\nNor YouTube-DL or yt-dlp are installed or added to the path, please run the following command to install it:\niex(irm tl.ctt.cx);Get-ScoopApp main/yt-dlp\n\"@\n}\n''\n$Finished = $null\n$Attempt = 0\nWhile (!$Finished){\n    $Attempt++\n    $Response = & $ytdl -F $Video\n    if ($Response | Where-Object {$PSItem -Like \"*3840x2160*\"}){\n        $Finished = $True\n    }else{\n        Write-Host \"`rYour video has not been encoded to 4K, trying again (attempt no.$attempt) in $Timeout seconds..\" -NoNewLine \n        Start-Sleep -Seconds $Timeout\n        Write-Host \"`rTrying again..                                                       \" -NoNewLine -ForegroundColor Red\n        continue\n    }\n}\nSet-Clipboard -Value $Video\nWrite-Host @\"\n\nYouTubed finished processing your video, it's URL has been copied to your clipboard:\n$Video\n\"@ -ForegroundColor Green\n1..3 | ForEach-Object{\n    [Console]::Beep(500,300)\n    Start-Sleep -Milliseconds 100\n}\n}\n"
  },
  {
    "path": "modules/Miscellaneous/Moony2.ps1",
    "content": "function Moony2 {\n    param(\n        [Switch]$NoIntro,\n        [Int]$McProcessID\n    )\n    $LaunchParameters = @{} # Fresh hashtable that will be splat with Start-Process\n\n    if (!$NoIntro){\n    Write-Host @'\nIf you're used to the original Moony, this works a little differently,\n\nWhat you just runned lets you create a batchfile from your current running game\nthat you can launch via a single click or even faster: via Run (Windows +R)\n\nPlease launch your Minecraft (any client/version) and press ENTER on your keyboard\nonce you're ready for it to create the batchfile\n'@\n    Pause\n    }\n\n    # java? is regex for either java or javaw\n    if (-Not(Get-Process java?)){\n        Write-Host \"There was no processes with the name java or javaw\"\n        pause\n        Moony -NoIntro\n        return\n    }else{\n        $ProcList = Get-Process -Name java?\n        if ($ProcList[1]){ # If $Procs isn't the only running java process\n                $Selected = Menu $ProcList.MainWindowTitle\n                $Proc = Get-Process | Where-Object {$_.MainWindowTitle -eq ($Selected)} # Crappy passthru\n                if ($Proc[1]){ # unlikely but w/e gotta handle it\n                    Write-Host \"Sorry my code is bad and you have multiple processes with the name $($Proc.MainWindowTitle), GG!\"\n                }\n        }else{$Proc = $ProcList} # lmk if theres a smarter way\n    }\n    $WinProcess = Get-CimInstance -ClassName Win32_Process | Where-Object ProcessId -eq $Proc.Id\n    $JRE = $WinProcess.ExecutablePath\n    $Arguments = $WinProcess.CommandLine.Replace($WinProcess.ExecutablePath,'')\n    if (Test-Path \"$HOME\\.lunarclient\\offline\\multiver\"){\n        $WorkingDirectory = \"$HOME\\.lunarclient\\offline\\multiver\"\n\n    }else{\n            # This cumbersome parse has been split in 3 lines, it just gets the right version from the args\n        $PlayedVersion = $Arguments.split(' ') |\n        Where-Object {$PSItem -Like \"1.*\"} |\n        Where-Object {$PSITem -NotLike \"1.*.*\"} |\n        Select-Object -Last 1\n        $WorkingDirectory = \"$HOME\\.lunarclient\\offline\\$PlayedVersion\"\n    }\n    if ($Arguments -NotLike \"* -server *\"){\n        Write-Host @\"\nWould you like this script to join a specific server right after it launches?\n\nIf so, type the IP, otherwise just leave it blank and press ENTER\n\"@  \n        $ServerIP = Read-Host \"Server IP\"\n        if ($ServerIP -NotIn '',$null){\n            $Arguments += \" -server $ServerIP\"\n        }\n    }\n\n    $InstanceName = Read-Host \"Give a name to your Lunar Client instance, I recommend making it short without spaces\"\n    if ($InstanceName -Like \"* *\"){\n        $InstanceName = Read-Host \"Since there's a space in your name, you won't be able to call it from Run (Windows+R), type it again if you are sure\"\n    }\n\n    Set-Content \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\\$InstanceName.cmd\" @\"\n@echo off\ncd /D \"$WorkingDirectory\"\nstart \"$JRE\" $Arguments\nif %ERRORLEVEL% == 0 (exit) else (pause)\n\"@\n    Write-Host \"Your $InstanceName instance should be good to go, try typing it's name in the Run window (Windows+R)\" -ForegroundColor Green\n    return\n\n}"
  },
  {
    "path": "modules/New-ContextMenu.ps1",
    "content": "function New-ContextMenu {\n    param(\n        [Parameter(Mandatory = $true)]\n        [String]$Text,\n        [Parameter(Mandatory = $true)]\n        [Array]$Extensions,\n        [Parameter(Mandatory = $true)]\n        [String]$Command,\n        \n        [String]$Icon\n    ) # Text Extensions Command are all mandatory, though Icon is not and must be an existing .ico path\n\n    if (!(Test-Admin)){\n        return \"Admin priviledges required (touching root class registry keys)\"\n    }\n\n    ForEach($Extension in $Extensions){\n        \n        $shellpath = \"REGISTRY::HKEY_CLASSES_ROOT\\SystemFileAssociations\\$Extension\\shell\"\n\n        if (-Not(Test-Path $shellpath)){\n            New-Item -Item Directory $shellpath -ErrorAction Stop | Out-Null\n            $Item = \"item0\"\n        }else{\n            $Items = ((Get-ChildItem \"$shellpath\").PSChildName | \n            Where-Object {$PSItem -Like \"Item*\"}) -replace 'Item',''\n            if ($items){\n                $Item = \"item\" + ([int]$Items+1)\n            } else{$Item = \"item0\"}\n            Write-Host \"Item is $item since there items: $items\"\n        }\n        if (-Not(Test-Path \"$shellpath\\$Item\")){\n            New-Item -Item Directory \"$shellpath\\$Item\" -ErrorAction Stop | Out-Null\n        }\n        Set-ItemProperty -Path \"$shellpath\\$Item\" -Name \"MUIVerb\" -Value $Text\n        if ($icon){\n            Set-ItemProperty -Path \"$shellpath\\$Item\" -Name \"Icon\" -Value \"$icon\"\n        }\n\n        if (-Not(Test-Path \"$shellpath\\$Item\\command\")){\n            New-Item -Item Directory \"$shellpath\\$Item\\command\" -ErrorAction Stop | Out-Null\n        }\n        Set-Item -Path \"$shellpath\\$Item\\command\" -Value \"$command `\"%L`\"\"\n    }\n}"
  },
  {
    "path": "modules/One-liners/Remove-DesktopShortcuts.ps1",
    "content": "function Remove-DesktopShortcuts {\n    param(\n        [Switch]$ConfirmEach\n    )\n    \n    if($ConfirmEach){\n        Get-ChildItem -Path \"$HOME\\Desktop\" | Where-Object Extension -eq \".lnk\" | Remove-Item -Confirm\n    }else{\n        Get-ChildItem -Path \"$HOME\\Desktop\" | Where-Object Extension -eq \".lnk\" | Remove-Item\n    }\n}\n"
  },
  {
    "path": "modules/Remove-ContextMenu.ps1",
    "content": "<#!TODO:\n    Scan windows defender\n    Git Bash\n    Rotate pictures\n    Open with code\n    Open with visual studio\n    Add to favorites\n#>\n\nfunction Remove-ContextMenu {\n    [alias('rcm')]\n    <#\n    https://www.tenforums.com\n    https://winaero.com\n    https://majorgeeks.com\n    https://github.com/farag2/Sophia-Script-for-Windows\n    #>\n    param(\n        [ValidateSet(\n            'PinToQuickAccess',\n            'RestorePreviousVersions',\n            'Print',\n            'GiveAccessTo',\n            'EditWithPaint3D',\n            'IncludeInLibrary',\n            'AddToWindowsMediaPlayerList',\n            'CastToDevice',\n            'EditWithPaint3D',\n            'EditWithPhotos',\n            'Share',\n            'TakeOwnerShip',\n            '7Zip',\n            'WinRAR',\n            'Notepad++',\n            'OpenWithOnBatchFiles',\n            'SendTo',\n            'DrivesInSendTo',\n            'VLC'\n            )]\n        [Array]$Entries\n    )\n\n    if (!(Test-Admin)){\n        return 'Changing the context menu / default file extensions requires running as Admin, exitting..'\n\n    }\n\n\n    $CurrentPreference = $ErrorActionPreference\n    $ErrorActionPreference = 'Ignore'\n    $Blocked = \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked\"\n\n    if (-Not (Test-Path -Path $Blocked)){\n        New-Item -Path $Blocked -Force\n    }\n\n    if ('RestorePreviousVersions' -in $Entries){\n        New-ItemProperty -Path \"$Blocked\" -Name \"{596AB062-B4D2-4215-9F74-E9109B0A8153}\"\n    }\n\n    if ('PinToQuickAccess'){\n        @('HKEY_CLASSES_ROOT','HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes') |\n        ForEach-Object { Remove-Item \"Registry::$_\\Folder\\shell\\pintohome\" -Force -Recurse}\n    }\n\n    if ('Print' -in $Entries){\n        @(\n            'SystemFileAssociations\\image',\n            'batfile','cmdfile','docxfil','fonfile','htmlfil','inffile','inifile','VBSFile','WSFFile',\n            'JSEFile','otffile','pfmfile','regfile','rtffile','ttcfile','ttffile','txtfile','VBEFile'\n        ) | ForEach-Object {Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\print\" -Name \"ProgrammaticAccessOnly\" -Value ''}\n    }\n\n    if ('GiveAccessTo' -in $Entries) {\n        @('*','Directory\\Background','Directory','Drive','LibraryFolder\\background','UserLibraryFolder') |\n        ForEach-Object {Remove-Item -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\$_\\shellex\\ContextMenuHandlers\\Sharing\" -Recurse -Force}\n    }\n\n    if ('IncludeInLibrary' -in $Entries){\n        @('HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes','HKEY_CLASSES_ROOT') |\n        ForEach-Object {Remove-Item \"Registry::$_\\Folder\\ShellEx\\ContextMenuHandlers\\Library Location\" -Force}\n    }\n\n    if ('AddToWindowsMediaPlayerList' -in $Entries){\n        @(\n            '3G2','3GP','ADTS','AIFF','ASF','ASX','AU','AVI','FLAC','M2TS','m3u','M4A','MIDI','MK3D',\n            'MKA','MKV','MOV','MP3','MP4','MPEG','TTS','WAV','WAX','WMA','WMV','WPL','WVX'\n        ) | ForEach-Object { Remove-Item \"Registry::HKEY_CLASSES_ROOT\\WMP11.AssocFile.$_\\shell\\Enqueue\" -Force -Recurse }\n\n        @(\n            'MediaCenter.WTVFile','Stack.Audio','Stack.Image','SystemFileAssociations\\audio','WMP.WTVFile',\n            'SystemFileAssociations\\Directory.Audio','SystemFileAssociations\\Directory.Image','WMP.DVR-MSFile','WMP.DVRMSFile'\n        ) | ForEach-Object { Remove-Item \"Registry::HKEY_CLASSES_ROOT\\$_\\shell\\Enqueue\" -Force -Recurse}\n    }\n\n    if ('CastToDevice' -in $Entries){\n        New-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked\" -Name \"{7AD84985-87B4-4a16-BE58-8B72A5B390F7}\" -PropertyType String -Value \"Play to menu\" -Force\n    }\n\n    if ('EditWithPaint3D' -in $Entries){\n        @('.3mf','.bmp','.fbx','.gif','.jfif','.jpe','.jpeg','.jpg','.png','.tif','.tiff') | \n        ForEach-Object { Remove-Item \"Registry::HKEY_CLASSES_ROOT\\SystemFileAssociations\\$_\\Shell\\3D Edit\" -Force -Recurse}\n    }\n\n    if ('EditWithPhotos' -in $Entries){\n        Set-ItemProperty \"Registry::HKEY_CLASSES_ROOT\\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\\Shell\\ShellEdit\" -Name 'ProgrammaticAccessOnly' -Value ''\n    }\n\n    if ('Share' -in $Entries){\n        New-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked\" -Name \"{E2BF9676-5F8F-435C-97EB-11607A5BEDF7}\" -PropertyType String -Value \"\" -Force\n    }\n\n    if ('TakeOwnerShip' -in $Entries){\n        @(\n        'HKEY_CLASSES_ROOT\\*\\shell\\runas'\n        'HKEY_CLASSES_ROOT\\Directory\\shell\\runas'\n        'HKEY_CLASSES_ROOT\\*\\shell\\TakeOwnership'\n        'HKEY_CLASSES_ROOT\\Directory\\shell\\TakeOwnership'\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\*\\shell\\TakeOwnership'\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\*\\shell\\TakeOwnership'\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Directory\\shell\\TakeOwnership'\n        ) | ForEach-Object {\n            Remove-Item -LiteralPath \"Registry::$_\" -Recurse -Force\n        }\n    }\n\n    if ('SendTo' -in $Entries){\n        $DefaultSendTo = (\n        'Bluetooth File Transfer',\n        'Compressed (zipped) Folder',\n        'Desktop (create shortcut)',\n        'Documents',\n        'Fax Recipient',\n        'Mail Recipient'\n        )\n        $NonDefaultSendTo = Get-ChildItem ([System.Environment]::GetFolderPath('SendTo')) | Where-Object BaseName -NotIn $DefaultSendTo\n        if ($NonDefaultSendTo) {\n            $NonDefaultSendTo.Name\n            if(Get-Boolean \"Are you sure you wish to lose access the following files/scripts?\"){\n                New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\\AllFilesystemObjects\\shellex\\ContextMenuHandlers\\SendTo -Name \"(default)\" -PropertyType String -Value \"-{7BA4C740-9E81-11CF-99D3-00AA004AE837}\" -Force\n            }\n        }else{\n            New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\\AllFilesystemObjects\\shellex\\ContextMenuHandlers\\SendTo -Name \"(default)\" -PropertyType String -Value \"-{7BA4C740-9E81-11CF-99D3-00AA004AE837}\" -Force\n        }\n    }\n\n    if ('DrivesInSendTo' -in $Entries){\n        Set-ItemProperty \"Registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -Name NoDrivesInSendToMenu -Value 1\n    }\n    \n    if ('OpenWithOnBatchFiles' -in $Entries){\n        foreach ($Ext in 'bat','cmd'){\n            Remove-Item -Path \"Registry::HKEY_CLASSES_ROOT\\$($Ext)file\\shell\\Open with\\command\" -Force -Recurse\n        }\n    }\n\n    if ('7Zip' -in $Entries){\n        @(\n            'Classes\\CLSID\\{23170F69-40C1-278A-1000-000100020000}',\n            'Classes\\CLSID\\{23170F69-40C1-278A-1000-000100020000}\\InprocServer32',\n            'Classes\\*\\shellex\\ContextMenuHandlers\\7-Zip',\n            'Classes\\Directory\\shellex\\ContextMenuHandlers\\7-Zip',\n            'Classes\\Folder\\shellex\\ContextMenuHandlers\\7-Zip',\n            '7-Zip\\Options'\n        ) | ForEach-Object {Remove-Item -LiteralPath \"REGISTRY::HKEY_CURRENT_USER\\Software\\$_\" -Recurse -Force}\n    }\n    \n    if ('WinRAR' -in $Entries){ # This hides (adds to Blocked) instead of deleting\n        @('{B41DB860-64E4-11D2-9906-E49FADC173CA}','{B41DB860-8EE4-11D2-9906-E49FADC173CA}') |\n        ForEach-Object {New-ItemProperty -Path $Blocked -Name $_ -Value ''}\n    }\n\n    if ('Notepad++' -in $Entries){\n        @(\n            '*\\shell\\Open with &Notepad++',\n            '*\\shell\\Open with &Notepad++\\command',\n            'Directory\\shell\\Open with &Notepad++',\n            'Directory\\shell\\Open with &Notepad++\\command',\n            'Directory\\Background\\shell\\Open with &Notepad++',\n            'Directory\\Background\\shell\\Open with &Notepad++\\command'\n        ) | ForEach-Object {\n            Remove-Item -LiteralPath \"Registry::HKEY_CURRENT_USER\\Software\\Classes\\$_\" -Recurse -Force\n        }\n\n    }\n\n    if ('VLC' -in $Entries){\n\n        @(\n            'Directory\\shell\\PlayWithVLC'\n            'Directory\\shell\\AddtoPlaylistVLC'\n            \n        ) | ForEach-Object {\n            if (Test-Path \"Registry::HKEY_CLASSES_ROOT\\Directory\\shell\\$_\"){\n                Remove-Item -LiteralPath \"Registry::HKEY_CLASSES_ROOT\\Directory\\shell\\$PSItem\" -Recurse -Force\n            }\n        }\n        ForEach($Context in ('PlayWithVLC','AddtoPlaylistVLC')){\n            @(\n                '3g2', '3ga', '3gp', '3gp2', '3gpp', '669', 'a52', 'aac', 'ac3', 'adt', 'adts', 'aif', 'aifc', 'aiff',\n                'amr', 'amv', 'aob', 'ape', 'asf', 'asx', 'au', 'avi', 'b4s', 'bik', 'Bluray', 'caf', 'cda', 'CDAudio',\n                'cue', 'dav', 'divx', 'drc', 'dts', 'dv', 'DVDMovie', 'dvr-ms', 'evo', 'f4v', 'flac', 'flv', 'gvi', 'gxf',\n                'ifo', 'iso', 'it', 'm1v', 'm2t', 'm2ts', 'm2v', 'm3u', 'm3u8', 'm4a', 'm4p', 'm4v', 'mid', 'mka', 'mkv',\n                'mlp', 'mod', 'mov', 'mp1', 'mp2', 'mp2v', 'mp3', 'mp4', 'mp4v', 'mpa', 'mpc', 'mpe', 'mpeg', 'mpeg1',\n                'mpeg2', 'mpeg4', 'mpg', 'mpga', 'mpv2', 'mts', 'mtv', 'mxf', 'nsv', 'nuv', 'oga', 'ogg', 'ogm', 'ogv',\n                'ogx', 'oma', 'OPENFolder', 'opus', 'pls', 'qcp', 'ra', 'ram', 'rar', 'rec', 'rm', 'rmi', 'rmvb', 'rpl',\n                's3m', 'sdp', 'snd', 'spx', 'SVCDMovie', 'thp', 'tod', 'tp', 'ts', 'tta', 'tts', 'VCDMovie', 'vlc', 'vlt',\n                'vob', 'voc', 'vqf', 'vro', 'w64', 'wav', 'webm', 'wma', 'wmv', 'wpl', 'wsz', 'wtv', 'wv', 'wvx', 'xa', 'xesc',\n                'xm', 'xspf', 'zip', 'zpl','3g2','3ga','3gp','3gp2','3gpp'\n\n            ) | ForEach-Object {\n                $Key = \"Registry::HKEY_CLASSES_ROOT\\VLC.$PSItem\\shell\\$Context\"\n                if (Test-Path $Key){\n                    Remove-Item -LiteralPath $Key -Recurse -Force\n                }\n            }\n        }\n    }\n    \n    $ErrorActionPreference = $CurrentPreference\n}\n"
  },
  {
    "path": "modules/Remove-FromThisPC.ps1",
    "content": "function Remove-FromThisPC {\n    param(\n        [ValidateSet('Remove','Restore')]\n        [String]\n        $Action = 'Remove',\n\n        [ValidateSet(\n            'Desktop',\n            'Documents',\n            'Downloads',\n            'Music',\n            'Pictures',\n            'Videos'\n            )]\n        $Entries,\n        [Switch]$All\n\n    )\n    if ($All){$Entries = 'Desktop','Documents','Downloads','Music','Pictures','Videos'}\n    function Modify-Entry ($GUID){\n        if ($Action -eq 'Remove'){\n            Remove-Item -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\"\n            Remove-Item -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\"    \n        }else{\n            New-Item -ItemType -Directory -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\" | Out-Null\n            New-Item -ItemType -Directory -Path \"Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{$GUID}\" | Out-Null\n        }\n        \n    }\n    ForEach($Entry in $Entries){\n        Switch($Entry){\n            'Desktop'{\n                Modify-Entry B4BFCC3A-DB2C-424C-B029-7FE99A87C641\n            }\n            'Documents'{\n                Modify-Entry A8CDFF1C-4878-43be-B5FD-F8091C1C60D0\n                Modify-Entry d3162b92-9365-467a-956b-92703aca08af\n            }\n            'Downloads'{\n                Modify-Entry 374DE290-123F-4565-9164-39C4925E467B\n                Modify-Entry 088e3905-0323-4b02-9826-5d99428e115f\n            }\n            'Music'{\n                Modify-Entry 1CF1260C-4DD0-4ebb-811F-33C572699FDE\n                Modify-Entry 3dfdf296-dbec-4fb4-81d1-6a3438bcf4de\n            }\n            'Pictures'{\n                Modify-Entry 3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA\n                Modify-Entry 24ad3ad4-a569-4530-98e1-ab02f9417aa8\n            }\n            'Videos'{\n                Modify-Entry A0953C92-50DC-43bf-BE83-3742FED03C9C\n                Modify-Entry f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a\n            }\n\n        }\n    }\n}"
  },
  {
    "path": "modules/RemovePackBangs.ps1",
    "content": "function RemovePackBangs {\n    # Removes the exclamation bangs and spaces from all your !   PackName.zip\n    param(\n        [ValidateScript({\n            Test-Path $_ -PathType Container\n        })]\n        [String]$PackFolderPath = $(if ($IsLinux){\"$env:HOME/.minecraft/resourcepacks\"} else {\"$env:APPDATA\\.minecraft\\resourcepacks\"})\n    )\n\n    Get-ChildItem $PackFolderPath  | ForEach-Object {\n\n        $NewName = $_.Name.TrimStart(\"! \")\n\n        if ($_.Name -ne $NewName){\n            if (Test-Path -LiteralPath (Join-Path $PackFolderPath $NewName)){\n\n                Write-Warning \"Skipping renaming [$($_.Name)], copy exists with no bangs\"\n\n            } else{\n                Write-Host \"Renaming to $NewName\" -ForegroundColor Green\n                Rename-Item -Path $PSItem -NewName $NewName -Verbose\n            }\n        }\n    } \n}\n"
  },
  {
    "path": "modules/Set-CompatibilitySettings.ps1",
    "content": "function Set-CompatibilitySettings {\n    [alias('scs')]\n    param(\n        [Parameter(Mandatory = $true)]\n        [String]$Path,\n\n        [Switch]$DisableFullScreenOptimizations,\n        [Switch]$RunAsAdmin\n    )\n\n    if (!$RunAsAdmin -and !$DisableFullScreenOptimizations){\n        return \"No compatibility settings were set, returning.\"\n    }\n\n    if ($FilePath.Extension -eq '.lnk'){\n        $FilePath = Get-Item (Get-ShortcutTarget $FilePath) -ErrorAction Stop\n    }else{\n        $FilePath = Get-Item $Path -ErrorAction Stop\n    }\n\n    $Data = '~'\n    if ($DisableFullScreenOptimizations){$Data += \" DISABLEDXMAXIMIZEDWINDOWEDMODE\"}\n    if ($RunAsAdmin){$Data += \" RUNASADMIN\"}\n\n    New-Item -ItemType Directory -Path \"Registry::HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" -ErrorAction Ignore\n    New-ItemProperty -Path \"Registry::HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" `\n    -Name $FilePath.FullName -PropertyType String -Value $Data -Force | Out-Null\n\n}"
  },
  {
    "path": "modules/Set-MenuShowDelay.ps1",
    "content": "# Default is 400(ms)\nfunction Set-MenuShowDelay {\n    param(\n        [Int]$DelayInMs\n    )\n    \n    Set-ItemProperty -Path \"Registry::HKEY_CURRENT_USER\\Control Panel\\Desktop\" -Name MenuShowDelay -PropertyType String -Value $DelayInMs -Force\n}"
  },
  {
    "path": "modules/TweakList.ps1",
    "content": "function TweakList {\n    [alias('tl')]\n    [CmdletBinding()]\n    param(\n        [Parameter(ValueFromRemainingArguments = $true)]\n        [System.Collections.Arraylist]\n        $Arguments\n    )\n    $shortcuts = @{\n        repo = {Start-Process https://github.com/couleur-tweak-tips/TweakList}\n        ui   = {Start-Process https://couleur-tweak-tips.github.io/TweakList-UI}\n    }\n    if ($Arguments){\n        if ($Arguments[0] -in [String[]]$shortcuts.Keys){\n            & $shortcuts.($Arguments[0])\n        }else {\n            Write-Host \"Available shortcuts:\"\n            $shortcuts\n        }\n        return\n    }\n\nreturn @\"\nWelcome to TweakList! If you're seeing this in your terminal, then you're\nalready able to start calling all your functions. You can learn how to use\nTweakList on: https://github.com/couleur-tweak-tips/TweakList/tree/master/docs\n\nIf you're curious what a function actually does, use 'gfc' (aka Get-FunctionContent)\nwith the name of the function you want to see. Example:\n\nPS X:\\> Get-FunctionContent Import-Sophia\n\nAll functions have aliases, if you're using TL a lot: learn em all!\n\nYou can use the TweakList function (AKA tl) to do the following:\n\ntl repo opens TweakList's repo\ntl ui opens the UI\n\n\n\"@\n}"
  },
  {
    "path": "modules/Windows/Remove-KnownAppxPackages.ps1",
    "content": "<#\n\nList of commonly used Appx packages:\n\nWindows.PrintDialog\nMicrosoft.WindowsCalculator\nMicrosoft.ZuneVideo\nMicrosoft.Windows.Photos\n\nI did not add them, but you can opt in by calling the function, e.g:\n\n    Remove-KnownAppxPackages -Add @('Windows.PrintDialog','Microsoft.WindowsCalculator')\n\nDon't forget to surround them by a ' so PowerShell considers them as a string\n\n#>\n\nfunction Remove-KnownAppxPackages ([array]$Add,[array]$Exclude) {\n\n    $AppxPackages = @(\n        \"Microsoft.Windows.NarratorQuickStart\"\n        \"Microsoft.Wallet\"\n        \"3DBuilder\"\n        \"Microsoft.Microsoft3DViewer\"\n        \"WindowsAlarms\"\n        \"BingSports\"\n        \"WindowsCommunicationsapps\"\n        \"WindowsCamera\"\n        \"Feedback\"\n        \"Microsoft.GetHelp\"\n        \"GetStarted\"\n        \"ZuneMusic\"\n        \"WindowsMaps\"\n        \"Microsoft.Messaging\"\n        \"Microsoft.MixedReality.Portal\"\n        \"Microsoft.OneConnect\"\n        \"BingFinance\"\n        \"Microsoft.MSPaint\"\n        \"People\"\n        \"WindowsPhone\"\n        \"Microsoft.YourPhone\"\n        \"Microsoft.Print3D\"\n        \"Microsoft.ScreenSketch\"\n        \"Microsoft.MicrosoftStickyNotes\"\n        \"SoundRecorder\"\n        \n        ) | Where-Object { $_ -notin $Exclude }\n\n        $AppxPackages += $Add # Appends the Appx packages given by the user (if any)\n\n        if (-Not($KeepXboxPackages)){\n            $AppxPackages += @(\n                \"XboxApp\"\n                \"Microsoft.XboxGameOverlay\"\n                \"Microsoft.XboxGamingOverlay\"\n                \"Microsoft.XboxSpeechToTextOverlay\"\n                \"Microsoft.XboxIdentityProvider\"\n                \"Microsoft.XboxGameCallableUI\"\n            )\n        }\n\n\n        ForEach ($Package in $AppxPackages){\n        \n        if ($PSVersionTable.PSEdition -eq 'Core'){ # Newer PowerShell versions don't have Appx cmdlets, manually calling PowerShell to \n        \n            powershell.exe -command \"Get-AppxPackage `\"*$Package*`\" | Remove-AppxPackage\"\n        \n        }else{\n            Get-AppxPackage \"*$Package*\" | Remove-AppxPackage\n        }\n        \n        }\n\n}\n\n"
  },
  {
    "path": "modules/Windows/Remove-UselessFiles.ps1",
    "content": "function Remove-UselessFiles {\n    \n    @(\n        \"$env:TEMP\"\n        \"$env:WINDIR\\TEMP\"\n        \"$env:HOMEDRIVE\\TEMP\"\n    ) | ForEach-Object { Remove-Item (Convert-Path $_\\*) -Force -ErrorAction SilentlyContinue }\n\n}"
  },
  {
    "path": "modules/Windows/Set-PowerPlan.ps1",
    "content": "function Set-PowerPlan {\n    param (\n        [string]$URL,\n        [switch]$Ultimate\n        )\n\n    if ($Ultimate){\n        powercfg /duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61\n        powercfg /setactive e9a42b02-d5df-448d-aa00-03f14749eb61\n    }elseif($URL){\n        if ($URL -Like \"http*://cdn.discordapp.com/attachments/*.pow\"){\n            $DotPow = \"$env:TMP\\{0}\" -f (Split-Path $URL -Leaf)\n        }else{\n            $DotPow = \"$env:TMP\\Powerplan $(Get-Random).pow\"\n        }\n        Invoke-WebRequest -Uri $PowURL -OutFile $DotPow\n        powercfg -duplicatescheme $DotPow\n        powercfg /s $DotPow\n    }\n}\n"
  },
  {
    "path": "modules/Windows/Set-Win32PrioritySeparation.ps1",
    "content": "function Set-Win32PrioritySeparation {\n    param(\n        [int]$DWord\n    )\n\n    $Path = 'REGISTRY::HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\PriorityControl'\n    $current = (Get-ItemProperty $Path).Win32PrioritySeparation\n\n    Set-ItemProperty -Path ($Path).Win32PrioritySeparation -Value $Value -Type DWord -Force -ErrorAction Inquire\n\n    Write-Verbose \"Set-Win32ProritySeparation: Changed from $current to $((Get-ItemProperty $Path).Win32PrioritySeparation)\"\n\n}\n\n"
  }
]